1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

[Code] Updated coding style with patched Astyle + normalized signals.

Code was formatted with patched astyle that correctly formats
foreach macro.
Normalize tool is now used to normalize all signal/slots signatures
to normalized format. It saves few reallocations on connections.
This commit is contained in:
nowrep 2013-03-06 09:05:41 +01:00
parent cc93b67002
commit 5f5cf7417d
84 changed files with 329 additions and 321 deletions

View File

@ -1,7 +1,8 @@
#!/bin/bash
#
# Requirements:
# astyle >=2.02
# astyle > =2.02 (patched with foreach support)
# normalize (Qt tool to normalize all signal/slots format)
#
function format_sources {
@ -9,7 +10,7 @@ function format_sources {
--indent-labels --pad-oper --unpad-paren --pad-header \
--convert-tabs --indent-preprocessor --break-closing-brackets \
--align-pointer=type --align-reference=name \
`find -type f -name '*.cpp'`
`find -type f -name '*.cpp'` | grep 'Formatted'
find . -name "*.orig" -print0 | xargs -0 rm -rf
}
@ -20,16 +21,19 @@ function format_headers {
--keep-one-line-statements --keep-one-line-blocks \
--indent-preprocessor --convert-tabs \
--align-pointer=type --align-reference=name \
`find -type f -name '*.h'`
`find -type f -name '*.h'` | grep 'Formatted'
find . -name "*.orig" -print0 | xargs -0 rm -rf
}
cd ../src
echo "running astyle for *.cpp ..."
echo "Running astyle for *.cpp ..."
format_sources
echo "running astyle for *.h ..."
echo "Running astyle for *.h ..."
format_headers
echo "Running normalize ..."
normalize --modify .
exit 0

View File

@ -143,7 +143,7 @@ void QtSingleApplication::sysInit(const QString &appId)
{
actWin = 0;
peer = new QtLocalPeer(this, appId);
connect(peer, SIGNAL(messageReceived(const QString &)), SIGNAL(messageReceived(const QString &)));
connect(peer, SIGNAL(messageReceived(QString)), SIGNAL(messageReceived(QString)));
}
@ -258,10 +258,10 @@ void QtSingleApplication::setActivationWindow(QWidget* aw, bool activateOnMessag
}
if (activateOnMessage) {
connect(peer, SIGNAL(messageReceived(const QString &)), this, SLOT(activateWindow()));
connect(peer, SIGNAL(messageReceived(QString)), this, SLOT(activateWindow()));
}
else {
disconnect(peer, SIGNAL(messageReceived(const QString &)), this, SLOT(activateWindow()));
disconnect(peer, SIGNAL(messageReceived(QString)), this, SLOT(activateWindow()));
}
}

View File

@ -127,10 +127,11 @@ void StyleHelper::setBaseColor(const QColor &newcolor)
if (color.isValid() && color != m_baseColor) {
m_baseColor = color;
foreach(QWidget * w, QApplication::topLevelWidgets())
foreach (QWidget* w, QApplication::topLevelWidgets()) {
w->update();
}
}
}
static void verticalGradientHelper(QPainter* p, const QRect &spanRect, const QRect &rect, bool lightColored)
{

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -54,7 +54,7 @@ BookmarksManager::BookmarksManager(QupZilla* mainClass, QWidget* parent)
connect(ui->bookmarksTree, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(itemChanged(QTreeWidgetItem*)));
connect(ui->addFolder, SIGNAL(clicked()), this, SLOT(addFolder()));
connect(ui->bookmarksTree, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenuRequested(const QPoint &)));
connect(ui->bookmarksTree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
connect(ui->bookmarksTree, SIGNAL(itemControlClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*)));
connect(ui->bookmarksTree, SIGNAL(itemMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*)));
connect(ui->collapseAll, SIGNAL(clicked()), ui->bookmarksTree, SLOT(collapseAll()));

View File

@ -143,7 +143,7 @@ void DownloadItem::startDownloadingFromFtp(const QUrl &url)
connect(m_ftpDownloader, SIGNAL(finished()), this, SLOT(finished()));
connect(m_ftpDownloader, SIGNAL(dataTransferProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64)));
connect(m_ftpDownloader, SIGNAL(errorOccured(QFtp::Error)), this, SLOT(error()));
connect(m_ftpDownloader, SIGNAL(ftpAuthenticationRequierd(const QUrl &, QAuthenticator*)), mApp->networkManager(), SLOT(ftpAuthentication(const QUrl &, QAuthenticator*)));
connect(m_ftpDownloader, SIGNAL(ftpAuthenticationRequierd(QUrl,QAuthenticator*)), mApp->networkManager(), SLOT(ftpAuthentication(QUrl,QAuthenticator*)));
m_ftpDownloader->download(url, &m_outputFile);
m_downloading = true;

View File

@ -159,13 +159,15 @@ void DownloadManager::timerEvent(QTimerEvent* e)
}
int progress = 0;
foreach(int prog, progresses)
foreach (int prog, progresses) {
progress += prog;
}
progress = progress / progresses.count();
double speed = 0.00;
foreach(double spee, speeds)
foreach (double spee, speeds) {
speed += spee;
}
ui->speedLabel->setText(tr("%1% of %2 files (%3) %4 remaining").arg(QString::number(progress), QString::number(progresses.count()),
DownloadItem::currentSpeedToString(speed),

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -43,9 +43,9 @@ HistoryModel::HistoryModel(History* history)
init();
connect(m_history, SIGNAL(resetHistory()), this, SLOT(resetHistory()));
connect(m_history, SIGNAL(historyEntryAdded(const HistoryEntry &)), this, SLOT(historyEntryAdded(const HistoryEntry &)));
connect(m_history, SIGNAL(historyEntryDeleted(const HistoryEntry &)), this, SLOT(historyEntryDeleted(const HistoryEntry &)));
connect(m_history, SIGNAL(historyEntryEdited(const HistoryEntry &, const HistoryEntry &)), this, SLOT(historyEntryEdited(const HistoryEntry &, const HistoryEntry &)));
connect(m_history, SIGNAL(historyEntryAdded(HistoryEntry)), this, SLOT(historyEntryAdded(HistoryEntry)));
connect(m_history, SIGNAL(historyEntryDeleted(HistoryEntry)), this, SLOT(historyEntryDeleted(HistoryEntry)));
connect(m_history, SIGNAL(historyEntryEdited(HistoryEntry,HistoryEntry)), this, SLOT(historyEntryEdited(HistoryEntry,HistoryEntry)));
}
QVariant HistoryModel::headerData(int section, Qt::Orientation orientation, int role) const

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -93,8 +93,8 @@ WebSearchBar::WebSearchBar(QupZilla* mainClass)
m_openSearchEngine = new OpenSearchEngine(this);
m_openSearchEngine->setNetworkAccessManager(mApp->networkManager());
connect(m_openSearchEngine, SIGNAL(suggestions(const QStringList &)), this, SLOT(addSuggestions(const QStringList &)));
connect(this, SIGNAL(textEdited(const QString &)), m_openSearchEngine, SLOT(requestSuggestions(QString)));
connect(m_openSearchEngine, SIGNAL(suggestions(QStringList)), this, SLOT(addSuggestions(QStringList)));
connect(this, SIGNAL(textEdited(QString)), m_openSearchEngine, SLOT(requestSuggestions(QString)));
QTimer::singleShot(0, this, SLOT(setupEngines()));
}

View File

@ -480,11 +480,11 @@ QNetworkReply* NetworkManager::createRequest(QNetworkAccessManager::Operation op
QVariant v = req.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
WebPage* webPage = static_cast<WebPage*>(v.value<void*>());
if (webPage) {
connect(reply, SIGNAL(downloadRequest(const QNetworkRequest &)),
webPage, SLOT(downloadRequested(const QNetworkRequest &)));
connect(reply, SIGNAL(downloadRequest(QNetworkRequest)),
webPage, SLOT(downloadRequested(QNetworkRequest)));
}
connect(reply, SIGNAL(ftpAuthenticationRequierd(const QUrl &, QAuthenticator*)),
this, SLOT(ftpAuthentication(const QUrl &, QAuthenticator*)));
connect(reply, SIGNAL(ftpAuthenticationRequierd(QUrl,QAuthenticator*)),
this, SLOT(ftpAuthentication(QUrl,QAuthenticator*)));
}
return reply;
}

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -39,7 +39,7 @@ void NetworkManagerProxy::setPrimaryNetworkAccessManager(NetworkManager* manager
connect(this, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), m_manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)));
connect(this, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), m_manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
connect(this, SIGNAL(finished(QNetworkReply*)), m_manager, SIGNAL(finished(QNetworkReply*)));
connect(this, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError> &)), m_manager, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError> &)));
connect(this, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), m_manager, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)));
}
QNetworkReply* NetworkManagerProxy::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice* outgoingData)

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -269,7 +269,7 @@ void SpeedDial::loadThumbnail(const QString &url, bool loadTitle)
PageThumbnailer* thumbnailer = new PageThumbnailer(this);
thumbnailer->setUrl(QUrl::fromEncoded(url.toUtf8()));
thumbnailer->setLoadTitle(loadTitle);
connect(thumbnailer, SIGNAL(thumbnailCreated(const QPixmap &)), this, SLOT(thumbnailCreated(const QPixmap &)));
connect(thumbnailer, SIGNAL(thumbnailCreated(QPixmap)), this, SLOT(thumbnailCreated(QPixmap)));
thumbnailer->start();
}

View File

@ -18,7 +18,7 @@
*/
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -92,7 +92,7 @@ void RSSManager::refreshTable()
TreeWidget* tree = new TreeWidget();
tree->setHeaderLabel(tr("News"));
tree->setContextMenuPolicy(Qt::CustomContextMenu);
connect(tree, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequested(const QPoint &)));
connect(tree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuRequested(QPoint)));
ui->tabWidget->addTab(tree, title);
ui->tabWidget->setTabToolTip(i, address.toString());

View File

@ -47,7 +47,7 @@ BookmarksSideBar::BookmarksSideBar(QupZilla* mainClass, QWidget* parent)
ui->bookmarksTree->setMimeType(QLatin1String("application/qupzilla.treewidgetitem.bookmarks"));
ui->bookmarksTree->setDefaultItemShowMode(TreeWidget::ItemsExpanded);
connect(ui->bookmarksTree, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenuRequested(const QPoint &)));
connect(ui->bookmarksTree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
connect(ui->bookmarksTree, SIGNAL(itemControlClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*)));
connect(ui->bookmarksTree, SIGNAL(itemMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*)));
connect(ui->bookmarksTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*)));

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -39,7 +39,7 @@
****************************************************************************/
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -332,8 +332,9 @@ void TreeWidget::filterString(const QString &string)
QList<QTreeWidgetItem*> _allItems = allItems();
if (string.isEmpty()) {
foreach(QTreeWidgetItem * item, _allItems)
foreach (QTreeWidgetItem* item, _allItems) {
item->setHidden(false);
}
for (int i = 0; i < topLevelItemCount(); i++) {
topLevelItem(i)->setHidden(false);
}

View File

@ -170,7 +170,7 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent)
connect(ui->databaseList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(databaseItemChanged(QListWidgetItem*)));
connect(ui->treeImages, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(showImagePreview(QTreeWidgetItem*)));
connect(ui->treeImages, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(imagesCustomContextMenuRequested(const QPoint &)));
connect(ui->treeImages, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(imagesCustomContextMenuRequested(QPoint)));
ui->treeImages->setContextMenuPolicy(Qt::CustomContextMenu);
ui->treeImages->sortByColumn(-1);

View File

@ -62,7 +62,7 @@ TabBar::TabBar(QupZilla* mainClass, TabWidget* tabWidget)
setAcceptDrops(true);
connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenuRequested(const QPoint &)));
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
connect(m_tabWidget, SIGNAL(pinnedTabClosed()), this, SLOT(pinnedTabClosed()));
connect(m_tabWidget, SIGNAL(pinnedTabAdded()), this, SLOT(pinnedTabAdded()));

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/* ============================================================
* Access Keys Navigation plugin for QupZilla
* Copyright (C) 2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2012-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/* ============================================================
* Personal Information Manager plugin for QupZilla
* Copyright (C) 2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2012-2013 David Rosca <nowrep@gmail.com>
* Copyright (C) 2012 Mladen Pejaković <pejakm@gmail.com>
*
* This program is free software: you can redistribute it and/or modify