Work on connect stax.

This commit is contained in:
martinrotter 2017-03-06 08:40:09 +01:00
parent bbe144837f
commit 128a6aa22a
30 changed files with 162 additions and 169 deletions

View File

@ -593,27 +593,26 @@ void FormMain::createConnections() {
// Menu "File" connections. // Menu "File" connections.
connect(m_ui->m_actionBackupDatabaseSettings, &QAction::triggered, this, &FormMain::backupDatabaseSettings); connect(m_ui->m_actionBackupDatabaseSettings, &QAction::triggered, this, &FormMain::backupDatabaseSettings);
connect(m_ui->m_actionRestoreDatabaseSettings, &QAction::triggered, this, &FormMain::restoreDatabaseSettings); connect(m_ui->m_actionRestoreDatabaseSettings, &QAction::triggered, this, &FormMain::restoreDatabaseSettings);
connect(m_ui->m_actionQuit, &QAction::triggered, qApp, SLOT(quit())); connect(m_ui->m_actionQuit, &QAction::triggered, qApp, &Application::quit);
connect(m_ui->m_actionServiceAdd, &QAction::triggered, this, SLOT(showAddAccountDialog())); connect(m_ui->m_actionServiceAdd, &QAction::triggered, this, &FormMain::showAddAccountDialog);
// Menu "View" connections. // Menu "View" connections.
connect(m_ui->m_actionFullscreen, &QAction::toggled, this, SLOT(switchFullscreenMode())); connect(m_ui->m_actionFullscreen, &QAction::toggled, this, &FormMain::switchFullscreenMode);
connect(m_ui->m_actionSwitchMainMenu, &QAction::toggled, m_ui->m_menuBar, SLOT(setVisible(bool))); connect(m_ui->m_actionSwitchMainMenu, &QAction::toggled, m_ui->m_menuBar, &QMenuBar::setVisible);
connect(m_ui->m_actionSwitchMainWindow, &QAction::triggered, this, SLOT(switchVisibility())); connect(m_ui->m_actionSwitchMainWindow, &QAction::triggered, this, &FormMain::switchVisibility);
connect(m_ui->m_actionSwitchStatusBar, &QAction::toggled, statusBar(), SLOT(setVisible(bool))); connect(m_ui->m_actionSwitchStatusBar, &QAction::toggled, statusBar(), &StatusBar::setVisible);
// Menu "Tools" connections. // Menu "Tools" connections.
connect(m_ui->m_actionSettings, &QAction::triggered, this, SLOT(showSettings())); connect(m_ui->m_actionSettings, &QAction::triggered, this, &FormMain::showSettings);
connect(m_ui->m_actionDownloadManager, &QAction::triggered, m_ui->m_tabWidget, SLOT(showDownloadManager())); connect(m_ui->m_actionDownloadManager, &QAction::triggered, m_ui->m_tabWidget, &TabWidget::showDownloadManager);
connect(m_ui->m_actionCleanupDatabase, &QAction::triggered, this, &FormMain::showDbCleanupAssistant);
connect(m_ui->m_actionCleanupDatabase, &QAction::triggered, this, SLOT(showDbCleanupAssistant()));
// Menu "Help" connections. // Menu "Help" connections.
connect(m_ui->m_actionAboutGuard, &QAction::triggered, this, SLOT(showAbout())); connect(m_ui->m_actionAboutGuard, &QAction::triggered, this, &FormMain::showAbout);
connect(m_ui->m_actionCheckForUpdates, &QAction::triggered, this, SLOT(showUpdates())); connect(m_ui->m_actionCheckForUpdates, &QAction::triggered, this, &FormMain::showUpdates);
connect(m_ui->m_actionReportBug, &QAction::triggered, this, SLOT(reportABug())); connect(m_ui->m_actionReportBug, &QAction::triggered, this, &FormMain::reportABug);
connect(m_ui->m_actionDonate, &QAction::triggered, this, SLOT(donate())); connect(m_ui->m_actionDonate, &QAction::triggered, this, &FormMain::donate);
connect(m_ui->m_actionDisplayWiki, &QAction::triggered, this, SLOT(showWiki())); connect(m_ui->m_actionDisplayWiki, &QAction::triggered, this, &FormMain::showWiki);
// Tab widget connections. // Tab widget connections.
connect(m_ui->m_actionTabsCloseAllExceptCurrent, &QAction::triggered, m_ui->m_tabWidget, &TabWidget::closeAllTabsExceptCurrent); connect(m_ui->m_actionTabsCloseAllExceptCurrent, &QAction::triggered, m_ui->m_tabWidget, &TabWidget::closeAllTabsExceptCurrent);
@ -635,73 +634,73 @@ void FormMain::createConnections() {
// Toolbar forwardings. // Toolbar forwardings.
connect(m_ui->m_actionAddFeedIntoSelectedAccount, &QAction::triggered, connect(m_ui->m_actionAddFeedIntoSelectedAccount, &QAction::triggered,
tabWidget()->feedMessageViewer()->feedsView(), SLOT(addFeedIntoSelectedAccount())); tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::addFeedIntoSelectedAccount);
connect(m_ui->m_actionAddCategoryIntoSelectedAccount, &QAction::triggered, connect(m_ui->m_actionAddCategoryIntoSelectedAccount, &QAction::triggered,
tabWidget()->feedMessageViewer()->feedsView(), SLOT(addCategoryIntoSelectedAccount())); tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::addCategoryIntoSelectedAccount);
connect(m_ui->m_actionSwitchImportanceOfSelectedMessages, connect(m_ui->m_actionSwitchImportanceOfSelectedMessages,
&QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), SLOT(switchSelectedMessagesImportance())); &QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), &MessagesView::switchSelectedMessagesImportance);
connect(m_ui->m_actionDeleteSelectedMessages, connect(m_ui->m_actionDeleteSelectedMessages,
&QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), SLOT(deleteSelectedMessages())); &QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), &MessagesView::deleteSelectedMessages);
connect(m_ui->m_actionMarkSelectedMessagesAsRead, connect(m_ui->m_actionMarkSelectedMessagesAsRead,
&QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), SLOT(markSelectedMessagesRead())); &QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), &MessagesView::markSelectedMessagesRead);
connect(m_ui->m_actionMarkSelectedMessagesAsUnread, &QAction::triggered, connect(m_ui->m_actionMarkSelectedMessagesAsUnread, &QAction::triggered,
tabWidget()->feedMessageViewer()->messagesView(), &MessagesView::markSelectedMessagesUnread); tabWidget()->feedMessageViewer()->messagesView(), &MessagesView::markSelectedMessagesUnread);
connect(m_ui->m_actionOpenSelectedSourceArticlesExternally, connect(m_ui->m_actionOpenSelectedSourceArticlesExternally,
&QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), SLOT(openSelectedSourceMessagesExternally())); &QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), &MessagesView::openSelectedSourceMessagesExternally);
connect(m_ui->m_actionOpenSelectedMessagesInternally, connect(m_ui->m_actionOpenSelectedMessagesInternally,
&QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), SLOT(openSelectedMessagesInternally())); &QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), &MessagesView::openSelectedMessagesInternally);
connect(m_ui->m_actionSendMessageViaEmail, connect(m_ui->m_actionSendMessageViaEmail,
&QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), SLOT(sendSelectedMessageViaEmail())); &QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), &MessagesView::sendSelectedMessageViaEmail);
connect(m_ui->m_actionMarkAllItemsRead, connect(m_ui->m_actionMarkAllItemsRead,
&QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), SLOT(markAllItemsRead())); &QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::markAllItemsRead);
connect(m_ui->m_actionMarkSelectedItemsAsRead, connect(m_ui->m_actionMarkSelectedItemsAsRead,
&QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), SLOT(markSelectedItemRead())); &QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::markSelectedItemRead);
connect(m_ui->m_actionExpandCollapseItem, connect(m_ui->m_actionExpandCollapseItem,
&QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), SLOT(expandCollapseCurrentItem())); &QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::expandCollapseCurrentItem);
connect(m_ui->m_actionMarkSelectedItemsAsUnread, connect(m_ui->m_actionMarkSelectedItemsAsUnread,
&QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), SLOT(markSelectedItemUnread())); &QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::markSelectedItemUnread);
connect(m_ui->m_actionClearSelectedItems, connect(m_ui->m_actionClearSelectedItems,
&QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), SLOT(clearSelectedFeeds())); &QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::clearSelectedFeeds);
connect(m_ui->m_actionClearAllItems, connect(m_ui->m_actionClearAllItems,
&QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), SLOT(clearAllFeeds())); &QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::clearAllFeeds);
connect(m_ui->m_actionUpdateSelectedItems, connect(m_ui->m_actionUpdateSelectedItems,
&QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), SLOT(updateSelectedItems())); &QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::updateSelectedItems);
connect(m_ui->m_actionUpdateAllItems, connect(m_ui->m_actionUpdateAllItems,
&QAction::triggered, qApp->feedReader(), SLOT(updateAllFeeds())); &QAction::triggered, qApp->feedReader(), &FeedReader::updateAllFeeds);
connect(m_ui->m_actionStopRunningItemsUpdate, connect(m_ui->m_actionStopRunningItemsUpdate,
&QAction::triggered, qApp->feedReader(), SLOT(stopRunningFeedUpdate())); &QAction::triggered, qApp->feedReader(), &FeedReader::stopRunningFeedUpdate);
connect(m_ui->m_actionEditSelectedItem, connect(m_ui->m_actionEditSelectedItem,
&QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), SLOT(editSelectedItem())); &QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::editSelectedItem);
connect(m_ui->m_actionViewSelectedItemsNewspaperMode, connect(m_ui->m_actionViewSelectedItemsNewspaperMode,
&QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), SLOT(openSelectedItemsInNewspaperMode())); &QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::openSelectedItemsInNewspaperMode);
connect(m_ui->m_actionDeleteSelectedItem, connect(m_ui->m_actionDeleteSelectedItem,
&QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), SLOT(deleteSelectedItem())); &QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::deleteSelectedItem);
connect(m_ui->m_actionSwitchFeedsList, &QAction::triggered, connect(m_ui->m_actionSwitchFeedsList, &QAction::triggered,
tabWidget()->feedMessageViewer(), &FeedMessageViewer::switchFeedComponentVisibility); tabWidget()->feedMessageViewer(), &FeedMessageViewer::switchFeedComponentVisibility);
connect(m_ui->m_actionSelectNextItem, connect(m_ui->m_actionSelectNextItem,
&QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), SLOT(selectNextItem())); &QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::selectNextItem);
connect(m_ui->m_actionSwitchToolBars, &QAction::toggled, connect(m_ui->m_actionSwitchToolBars, &QAction::toggled,
tabWidget()->feedMessageViewer(), &FeedMessageViewer::setToolBarsEnabled); tabWidget()->feedMessageViewer(), &FeedMessageViewer::setToolBarsEnabled);
connect(m_ui->m_actionSwitchListHeaders, &QAction::toggled, connect(m_ui->m_actionSwitchListHeaders, &QAction::toggled,
tabWidget()->feedMessageViewer(), &FeedMessageViewer::setListHeadersEnabled); tabWidget()->feedMessageViewer(), &FeedMessageViewer::setListHeadersEnabled);
connect(m_ui->m_actionSelectPreviousItem, connect(m_ui->m_actionSelectPreviousItem,
&QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), SLOT(selectPreviousItem())); &QAction::triggered, tabWidget()->feedMessageViewer()->feedsView(), &FeedsView::selectPreviousItem);
connect(m_ui->m_actionSelectNextMessage, connect(m_ui->m_actionSelectNextMessage,
&QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), SLOT(selectNextItem())); &QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), &MessagesView::selectNextItem);
connect(m_ui->m_actionSelectNextUnreadMessage, connect(m_ui->m_actionSelectNextUnreadMessage,
&QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), SLOT(selectNextUnreadItem())); &QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), &MessagesView::selectNextUnreadItem);
connect(m_ui->m_actionSelectPreviousMessage, connect(m_ui->m_actionSelectPreviousMessage,
&QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), SLOT(selectPreviousItem())); &QAction::triggered, tabWidget()->feedMessageViewer()->messagesView(), &MessagesView::selectPreviousItem);
connect(m_ui->m_actionSwitchMessageListOrientation, &QAction::triggered, connect(m_ui->m_actionSwitchMessageListOrientation, &QAction::triggered,
tabWidget()->feedMessageViewer(), &FeedMessageViewer::switchMessageSplitterOrientation); tabWidget()->feedMessageViewer(), &FeedMessageViewer::switchMessageSplitterOrientation);
connect(m_ui->m_actionShowOnlyUnreadItems, &QAction::toggled, connect(m_ui->m_actionShowOnlyUnreadItems, &QAction::toggled,
tabWidget()->feedMessageViewer(), &FeedMessageViewer::toggleShowOnlyUnreadFeeds); tabWidget()->feedMessageViewer(), &FeedMessageViewer::toggleShowOnlyUnreadFeeds);
connect(m_ui->m_actionRestoreSelectedMessages, &QAction::triggered, connect(m_ui->m_actionRestoreSelectedMessages, &QAction::triggered,
tabWidget()->feedMessageViewer()->messagesView(), SLOT(restoreSelectedMessages())); tabWidget()->feedMessageViewer()->messagesView(), &MessagesView::restoreSelectedMessages);
connect(m_ui->m_actionRestoreAllRecycleBins, &QAction::triggered, connect(m_ui->m_actionRestoreAllRecycleBins, &QAction::triggered,
tabWidget()->feedMessageViewer()->feedsView()->sourceModel(), SLOT(restoreAllBins())); tabWidget()->feedMessageViewer()->feedsView()->sourceModel(), &FeedsModel::restoreAllBins);
connect(m_ui->m_actionEmptyAllRecycleBins, &QAction::triggered, connect(m_ui->m_actionEmptyAllRecycleBins, &QAction::triggered,
tabWidget()->feedMessageViewer()->feedsView()->sourceModel(), SLOT(emptyAllBins())); tabWidget()->feedMessageViewer()->feedsView()->sourceModel(), &FeedsModel::emptyAllBins);
} }
void FormMain::backupDatabaseSettings() { void FormMain::backupDatabaseSettings() {

View File

@ -34,10 +34,10 @@ FormRestoreDatabaseSettings::FormRestoreDatabaseSettings(QWidget *parent)
setWindowIcon(qApp->icons()->fromTheme(QSL("document-import"))); setWindowIcon(qApp->icons()->fromTheme(QSL("document-import")));
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint); setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
connect(m_ui->m_btnSelectFolder, SIGNAL(clicked()), this, SLOT(selectFolder())); connect(m_ui->m_btnSelectFolder, &QPushButton::clicked, this, &FormRestoreDatabaseSettings::selectFolderWithGui);
connect(m_ui->m_groupDatabase, SIGNAL(toggled(bool)), this, SLOT(checkOkButton())); connect(m_ui->m_groupDatabase, &QGroupBox::toggled, this, &FormRestoreDatabaseSettings::checkOkButton);
connect(m_ui->m_groupSettings, SIGNAL(toggled(bool)), this, SLOT(checkOkButton())); connect(m_ui->m_groupSettings, &QGroupBox::toggled, this, &FormRestoreDatabaseSettings::checkOkButton);
connect(m_ui->m_buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(performRestoration())); connect(m_ui->m_buttonBox->button(QDialogButtonBox::Ok), &QPushButton::clicked, this, &FormRestoreDatabaseSettings::performRestoration);
selectFolder(qApp->getDocumentsFolderPath()); selectFolder(qApp->getDocumentsFolderPath());
} }
@ -75,6 +75,10 @@ void FormRestoreDatabaseSettings::checkOkButton() {
m_ui->m_listSettings->currentRow() >= 0))); m_ui->m_listSettings->currentRow() >= 0)));
} }
void FormRestoreDatabaseSettings::selectFolderWithGui() {
selectFolder();
}
void FormRestoreDatabaseSettings::selectFolder(QString folder) { void FormRestoreDatabaseSettings::selectFolder(QString folder) {
if (folder.isEmpty()) { if (folder.isEmpty()) {
folder = QFileDialog::getExistingDirectory(this, tr("Select source directory"), m_ui->m_lblSelectFolder->label()->text()); folder = QFileDialog::getExistingDirectory(this, tr("Select source directory"), m_ui->m_lblSelectFolder->label()->text());

View File

@ -34,6 +34,7 @@ class FormRestoreDatabaseSettings : public QDialog {
private slots: private slots:
void performRestoration(); void performRestoration();
void checkOkButton(); void checkOkButton();
void selectFolderWithGui();
void selectFolder(QString folder = QString()); void selectFolder(QString folder = QString());
private: private:

View File

@ -44,7 +44,7 @@ FormUpdate::FormUpdate(QWidget *parent)
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint); setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
setWindowIcon(qApp->icons()->fromTheme(QSL("help-about"))); setWindowIcon(qApp->icons()->fromTheme(QSL("help-about")));
connect(m_btnUpdate, SIGNAL(clicked()), this, SLOT(startUpdate())); connect(m_btnUpdate, &QPushButton::clicked, this, &FormUpdate::startUpdate);
checkForUpdates(); checkForUpdates();
} }
@ -212,8 +212,8 @@ void FormUpdate::startUpdate() {
// Initialie downloader. // Initialie downloader.
m_downloader = new Downloader(this); m_downloader = new Downloader(this);
connect(m_downloader, SIGNAL(progress(qint64,qint64)), this, SLOT(updateProgress(qint64,qint64))); connect(m_downloader, &Downloader::progress, this, &FormUpdate::updateProgress);
connect(m_downloader, SIGNAL(completed(QNetworkReply::NetworkError,QByteArray)), this, SLOT(updateCompleted(QNetworkReply::NetworkError,QByteArray))); connect(m_downloader, &Downloader::completed, this, &FormUpdate::updateCompleted);
updateProgress(0, 100); updateProgress(0, 100);
} }

View File

@ -52,8 +52,8 @@ void DiscoverFeedsButton::setFeedAddresses(const QStringList &addresses) {
if (menu() == nullptr) { if (menu() == nullptr) {
// Initialize the menu. // Initialize the menu.
setMenu(new QMenu(this)); setMenu(new QMenu(this));
connect(menu(), SIGNAL(triggered(QAction*)), this, SLOT(linkTriggered(QAction*))); connect(menu(), &QMenu::triggered, this, &DiscoverFeedsButton::linkTriggered);
connect(menu(), SIGNAL(aboutToShow()), this, SLOT(fillMenu())); connect(menu(), &QMenu::aboutToShow, this, &DiscoverFeedsButton::fillMenu);
} }
menu()->hide(); menu()->hide();

View File

@ -206,25 +206,25 @@ void FeedMessageViewer::toggleShowOnlyUnreadFeeds() {
void FeedMessageViewer::createConnections() { void FeedMessageViewer::createConnections() {
// Filtering & searching. // Filtering & searching.
connect(m_toolBarMessages, SIGNAL(messageSearchPatternChanged(QString)), m_messagesView, SLOT(searchMessages(QString))); connect(m_toolBarMessages, &MessagesToolBar::messageSearchPatternChanged, m_messagesView, &MessagesView::searchMessages);
connect(m_toolBarMessages, SIGNAL(messageFilterChanged(MessagesModel::MessageHighlighter)), m_messagesView, SLOT(filterMessages(MessagesModel::MessageHighlighter))); connect(m_toolBarMessages, &MessagesToolBar::messageFilterChanged, m_messagesView, &MessagesView::filterMessages);
// Message changers. // Message changers.
connect(m_messagesView, SIGNAL(currentMessageRemoved()), m_messagesBrowser, SLOT(clear())); connect(m_messagesView, &MessagesView::currentMessageRemoved, m_messagesBrowser, &MessagePreviewer::clear);
connect(m_messagesView, SIGNAL(currentMessageChanged(Message,RootItem*)), m_messagesBrowser, SLOT(loadMessage(Message,RootItem*))); connect(m_messagesView, &MessagesView::currentMessageChanged, m_messagesBrowser, &MessagePreviewer::loadMessage);
connect(m_messagesBrowser, SIGNAL(markMessageRead(int,RootItem::ReadStatus)), connect(m_messagesBrowser, &MessagePreviewer::markMessageRead,
m_messagesView->sourceModel(), SLOT(setMessageReadById(int,RootItem::ReadStatus))); m_messagesView->sourceModel(), &MessagesModel::setMessageReadById);
connect(m_messagesBrowser, SIGNAL(markMessageImportant(int,RootItem::Importance)), connect(m_messagesBrowser, &MessagePreviewer::markMessageImportant,
m_messagesView->sourceModel(), SLOT(setMessageImportantById(int,RootItem::Importance))); m_messagesView->sourceModel(), &MessagesModel::setMessageImportantById);
// If user selects feeds, load their messages. // If user selects feeds, load their messages.
connect(m_feedsView, SIGNAL(itemSelected(RootItem*)), m_messagesView, SLOT(loadItem(RootItem*))); connect(m_feedsView, &FeedsView::itemSelected, m_messagesView, &MessagesView::loadItem);
// State of many messages is changed, then we need // State of many messages is changed, then we need
// to reload selections. // to reload selections.
connect(m_feedsView->sourceModel(), SIGNAL(reloadMessageListRequested(bool)), connect(m_feedsView->sourceModel(), &FeedsModel::reloadMessageListRequested,
m_messagesView, SLOT(reloadSelections(bool))); m_messagesView, &MessagesView::reloadSelections);
} }
void FeedMessageViewer::initialize() { void FeedMessageViewer::initialize() {

View File

@ -55,10 +55,10 @@ FeedsView::FeedsView(QWidget *parent)
m_proxyModel = qApp->feedReader()->feedsProxyModel(); m_proxyModel = qApp->feedReader()->feedsProxyModel();
// Connections. // Connections.
connect(m_sourceModel, SIGNAL(requireItemValidationAfterDragDrop(QModelIndex)), this, SLOT(validateItemAfterDragDrop(QModelIndex))); connect(m_sourceModel, &FeedsModel::requireItemValidationAfterDragDrop, this, &FeedsView::validateItemAfterDragDrop);
connect(m_sourceModel, SIGNAL(itemExpandRequested(QList<RootItem*>,bool)), this, SLOT(onItemExpandRequested(QList<RootItem*>,bool))); connect(m_sourceModel, &FeedsModel::itemExpandRequested, this, &FeedsView::onItemExpandRequested);
connect(m_sourceModel, SIGNAL(itemExpandStateSaveRequested(RootItem*)), this, SLOT(onItemExpandStateSaveRequested(RootItem*))); connect(m_sourceModel, &FeedsModel::itemExpandStateSaveRequested, this, &FeedsView::onItemExpandStateSaveRequested);
connect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(saveSortState(int,Qt::SortOrder))); connect(header(), &QHeaderView::sortIndicatorChanged, this, &FeedsView::saveSortState);
connect(m_proxyModel, &FeedsProxyModel::expandAfterFilterIn, this, &FeedsView::expandItemDelayed); connect(m_proxyModel, &FeedsProxyModel::expandAfterFilterIn, this, &FeedsView::expandItemDelayed);
setModel(m_proxyModel); setModel(m_proxyModel);
@ -70,9 +70,9 @@ FeedsView::~FeedsView() {
} }
void FeedsView::setSortingEnabled(bool enable) { void FeedsView::setSortingEnabled(bool enable) {
disconnect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(saveSortState(int,Qt::SortOrder))); disconnect(header(), &QHeaderView::sortIndicatorChanged, this, &FeedsView::saveSortState);
QTreeView::setSortingEnabled(enable); QTreeView::setSortingEnabled(enable);
connect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(saveSortState(int,Qt::SortOrder))); connect(header(), &QHeaderView::sortIndicatorChanged, this, &FeedsView::saveSortState);
} }
QList<Feed*> FeedsView::selectedFeeds() const { QList<Feed*> FeedsView::selectedFeeds() const {

View File

@ -25,7 +25,7 @@
LocationLineEdit::LocationLineEdit(QWidget *parent) LocationLineEdit::LocationLineEdit(QWidget *parent)
: BaseLineEdit(parent), m_mouseSelectsAllText(true), m_googleSuggest(new GoogleSuggest(this)) { : BaseLineEdit(parent), m_mouseSelectsAllText(true), m_googleSuggest(new GoogleSuggest(this)) {
setPlaceholderText(tr("Website address goes here")); setPlaceholderText(tr("Website address goes here"));
connect(this, SIGNAL(submitted(QString)), m_googleSuggest, SLOT(preventSuggest())); connect(this, &LocationLineEdit::submitted, m_googleSuggest, &GoogleSuggest::preventSuggest);
} }
LocationLineEdit::~LocationLineEdit() { LocationLineEdit::~LocationLineEdit() {

View File

@ -117,8 +117,7 @@ void MessagesToolBar::initializeSearchBox() {
m_actionSearchMessages->setProperty("type", SEACRH_MESSAGES_ACTION_NAME); m_actionSearchMessages->setProperty("type", SEACRH_MESSAGES_ACTION_NAME);
m_actionSearchMessages->setProperty("name", tr("Message search box")); m_actionSearchMessages->setProperty("name", tr("Message search box"));
connect(m_txtSearchMessages, SIGNAL(textChanged(QString)), connect(m_txtSearchMessages, &MessagesSearchLineEdit::textChanged, this, &MessagesToolBar::messageSearchPatternChanged);
this, SIGNAL(messageSearchPatternChanged(QString)));
} }
void MessagesToolBar::initializeHighlighter() { void MessagesToolBar::initializeHighlighter() {

View File

@ -53,11 +53,11 @@ MessagesView::~MessagesView() {
} }
void MessagesView::createConnections() { void MessagesView::createConnections() {
connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(openSelectedSourceMessagesExternally())); connect(this, &MessagesView::doubleClicked, this, &MessagesView::openSelectedSourceMessagesExternally);
// Adjust columns when layout gets changed. // Adjust columns when layout gets changed.
connect(header(), SIGNAL(geometriesChanged()), this, SLOT(adjustColumns())); connect(header(), &QHeaderView::geometriesChanged, this, &MessagesView::adjustColumns);
connect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(onSortIndicatorChanged(int,Qt::SortOrder))); connect(header(), &QHeaderView::sortIndicatorChanged, this, &MessagesView::onSortIndicatorChanged);
} }
void MessagesView::keyboardSearch(const QString &search) { void MessagesView::keyboardSearch(const QString &search) {

View File

@ -27,7 +27,7 @@
NewspaperPreviewer::NewspaperPreviewer(RootItem *root, QList<Message> messages, QWidget *parent) NewspaperPreviewer::NewspaperPreviewer(RootItem *root, QList<Message> messages, QWidget *parent)
: TabContent(parent), m_ui(new Ui::NewspaperPreviewer), m_root(root), m_messages(messages) { : TabContent(parent), m_ui(new Ui::NewspaperPreviewer), m_root(root), m_messages(messages) {
m_ui->setupUi(this); m_ui->setupUi(this);
connect(m_ui->m_btnShowMoreMessages, SIGNAL(clicked(bool)), this, SLOT(showMoreMessages())); connect(m_ui->m_btnShowMoreMessages, &QPushButton::clicked, this, &NewspaperPreviewer::showMoreMessages);
showMoreMessages(); showMoreMessages();
} }
@ -43,7 +43,7 @@ void NewspaperPreviewer::showMoreMessages() {
MessagePreviewer *prev = new MessagePreviewer(this); MessagePreviewer *prev = new MessagePreviewer(this);
QMargins margins = prev->layout()->contentsMargins(); QMargins margins = prev->layout()->contentsMargins();
connect(prev, SIGNAL(requestMessageListReload(bool)), this, SIGNAL(requestMessageListReload(bool))); connect(prev, &MessagePreviewer::requestMessageListReload, this, &NewspaperPreviewer::requestMessageListReload);
margins.setRight(0); margins.setRight(0);
prev->layout()->setContentsMargins(margins); prev->layout()->setContentsMargins(margins);

View File

@ -67,13 +67,15 @@ void PlainToolButton::setChecked(bool checked) {
} }
void PlainToolButton::reactOnActionChange(QAction *action) { void PlainToolButton::reactOnActionChange(QAction *action) {
QAction *real_action = action == nullptr ? qobject_cast<QAction*>(sender()) : action; if (action != nullptr) {
setEnabled(action->isEnabled());
if (real_action != nullptr) { setCheckable(action->isCheckable());
setEnabled(real_action->isEnabled()); setChecked(action->isChecked());
setCheckable(real_action->isCheckable()); setIcon(action->icon());
setChecked(real_action->isChecked()); setToolTip(action->toolTip());
setIcon(real_action->icon());
setToolTip(real_action->toolTip());
} }
} }
void PlainToolButton::reactOnSenderActionChange() {
reactOnActionChange(qobject_cast<QAction*>(sender()));
}

View File

@ -35,7 +35,8 @@ class PlainToolButton : public QToolButton {
public slots: public slots:
void setChecked(bool checked); void setChecked(bool checked);
void reactOnActionChange(QAction *action = NULL); void reactOnActionChange(QAction *action);
void reactOnSenderActionChange();
protected: protected:
// Custom look. // Custom look.

View File

@ -172,8 +172,8 @@ void StatusBar::loadChangeableActions(const QStringList &action_names) {
widget_to_add = tool_button; widget_to_add = tool_button;
action_to_add = matching_action; action_to_add = matching_action;
connect(tool_button, SIGNAL(clicked(bool)), matching_action, SLOT(trigger())); connect(tool_button, &PlainToolButton::clicked, matching_action, &QAction::trigger);
connect(matching_action, SIGNAL(changed()), tool_button, SLOT(reactOnActionChange())); connect(matching_action, &QAction::changed, tool_button, &PlainToolButton::reactOnSenderActionChange);
} }
else { else {
action_to_add = nullptr; action_to_add = nullptr;

View File

@ -62,7 +62,7 @@ SystemTrayIcon::SystemTrayIcon(const QString &normal_icon, const QString &plain_
setContextMenu(parent->trayMenu()); setContextMenu(parent->trayMenu());
// Create necessary connections. // Create necessary connections.
connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(onActivated(QSystemTrayIcon::ActivationReason))); connect(this, &SystemTrayIcon::activated, this, &SystemTrayIcon::onActivated);
} }
SystemTrayIcon::~SystemTrayIcon() { SystemTrayIcon::~SystemTrayIcon() {

View File

@ -47,7 +47,7 @@ void TabBar::setTabType(int index, const TabBar::TabType &type) {
close_button->setFixedSize(iconSize()); close_button->setFixedSize(iconSize());
// Close underlying tab when button is clicked. // Close underlying tab when button is clicked.
connect(close_button, SIGNAL(clicked()), this, SLOT(closeTabViaButton())); connect(close_button, &PlainToolButton::clicked, this, &TabBar::closeTabViaButton);
setTabButton(index, QTabBar::RightSide, close_button); setTabButton(index, QTabBar::RightSide, close_button);
break; break;
} }

View File

@ -60,7 +60,7 @@ void TabWidget::setupMainMenuButton() {
m_btnMainMenu->setIcon(qApp->icons()->fromTheme(QSL("start-here"))); m_btnMainMenu->setIcon(qApp->icons()->fromTheme(QSL("start-here")));
m_btnMainMenu->setPopupMode(QToolButton::InstantPopup); m_btnMainMenu->setPopupMode(QToolButton::InstantPopup);
connect(m_btnMainMenu, SIGNAL(clicked()), this, SLOT(openMainMenu())); connect(m_btnMainMenu, &PlainToolButton::clicked, this, &TabWidget::openMainMenu);
} }
void TabWidget::openMainMenu() { void TabWidget::openMainMenu() {
@ -140,23 +140,18 @@ void TabWidget::tabRemoved(int index) {
} }
void TabWidget::createConnections() { void TabWidget::createConnections() {
connect(tabBar(), SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); connect(tabBar(), &TabBar::tabCloseRequested, this, &TabWidget::closeTab);
connect(tabBar(), SIGNAL(emptySpaceDoubleClicked()), this, SLOT(addEmptyBrowser())); connect(tabBar(), &TabBar::emptySpaceDoubleClicked, this, &TabWidget::addEmptyBrowser);
connect(tabBar(), SIGNAL(tabMoved(int,int)), this, SLOT(fixContentsAfterMove(int,int))); connect(tabBar(), &TabBar::tabMoved, this, &TabWidget::fixContentsAfterMove);
connect(feedMessageViewer()->messagesView(), SIGNAL(openMessagesInNewspaperView(RootItem*,QList<Message>)), connect(feedMessageViewer()->messagesView(), &MessagesView::openMessagesInNewspaperView, this, &TabWidget::addNewspaperView);
this, SLOT(addNewspaperView(RootItem*,QList<Message>))); connect(feedMessageViewer()->feedsView(), &FeedsView::openMessagesInNewspaperView, this, &TabWidget::addNewspaperView);
connect(feedMessageViewer()->feedsView(), SIGNAL(openMessagesInNewspaperView(RootItem*,QList<Message>)),
this, SLOT(addNewspaperView(RootItem*,QList<Message>)));
} }
void TabWidget::initializeTabs() { void TabWidget::initializeTabs() {
// Create widget for "Feeds" page and add it. // Create widget for "Feeds" page and add it.
m_feedMessageViewer = new FeedMessageViewer(this); m_feedMessageViewer = new FeedMessageViewer(this);
const int index_of_browser = addTab(m_feedMessageViewer, const int index_of_browser = addTab(m_feedMessageViewer, QIcon(), tr("Feeds"), TabBar::FeedReader);
QIcon(),
tr("Feeds"),
TabBar::FeedReader);
setTabToolTip(index_of_browser, tr("Browse your feeds and messages")); setTabToolTip(index_of_browser, tr("Browse your feeds and messages"));
} }
@ -257,8 +252,8 @@ int TabWidget::addBrowser(bool move_after_current, bool make_active, const QUrl
} }
// Make connections. // Make connections.
connect(browser, SIGNAL(titleChanged(int,QString)), this, SLOT(changeTitle(int,QString))); connect(browser, &WebBrowser::titleChanged, this, &TabWidget::changeTitle);
connect(browser, SIGNAL(iconChanged(int,QIcon)), this, SLOT(changeIcon(int,QIcon))); connect(browser, &WebBrowser::iconChanged, this, &TabWidget::changeIcon);
// Setup the tab index. // Setup the tab index.
browser->setIndex(final_index); browser->setIndex(final_index);

View File

@ -28,19 +28,19 @@ ToolBarEditor::ToolBarEditor(QWidget *parent)
m_ui->setupUi(this); m_ui->setupUi(this);
// Create connections. // Create connections.
connect(m_ui->m_btnInsertSeparator, SIGNAL(clicked()), this, SLOT(insertSeparator())); connect(m_ui->m_btnInsertSeparator, &QPushButton::clicked, this, &ToolBarEditor::insertSeparator);
connect(m_ui->m_btnInsertSpacer, SIGNAL(clicked()), this, SLOT(insertSpacer())); connect(m_ui->m_btnInsertSpacer, &QPushButton::clicked, this, &ToolBarEditor::insertSpacer);
connect(m_ui->m_btnAddSelectedAction, SIGNAL(clicked()), this, SLOT(addSelectedAction())); connect(m_ui->m_btnAddSelectedAction, &QPushButton::clicked, this, &ToolBarEditor::addSelectedAction);
connect(m_ui->m_btnDeleteAllActions, SIGNAL(clicked()), this, SLOT(deleteAllActions())); connect(m_ui->m_btnDeleteAllActions, &QPushButton::clicked, this, &ToolBarEditor::deleteAllActions);
connect(m_ui->m_btnDeleteSelectedAction, SIGNAL(clicked()), this, SLOT(deleteSelectedAction())); connect(m_ui->m_btnDeleteSelectedAction, &QPushButton::clicked, this, &ToolBarEditor::deleteSelectedAction);
connect(m_ui->m_btnMoveActionUp, SIGNAL(clicked()), this, SLOT(moveActionUp())); connect(m_ui->m_btnMoveActionUp, &QPushButton::clicked, this, &ToolBarEditor::moveActionUp);
connect(m_ui->m_btnMoveActionDown, SIGNAL(clicked()), this, SLOT(moveActionDown())); connect(m_ui->m_btnMoveActionDown, &QPushButton::clicked, this, &ToolBarEditor::moveActionDown);
connect(m_ui->m_listAvailableActions, SIGNAL(itemSelectionChanged()), this, SLOT(updateActionsAvailability())); connect(m_ui->m_listAvailableActions, &QListWidget::itemSelectionChanged, this, &ToolBarEditor::updateActionsAvailability);
connect(m_ui->m_listActivatedActions, SIGNAL(itemSelectionChanged()), this, SLOT(updateActionsAvailability())); connect(m_ui->m_listActivatedActions, &QListWidget::itemSelectionChanged, this, &ToolBarEditor::updateActionsAvailability);
connect(m_ui->m_listActivatedActions, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(deleteSelectedAction())); connect(m_ui->m_listActivatedActions, &QListWidget::itemDoubleClicked, this, &ToolBarEditor::deleteSelectedAction);
connect(m_ui->m_listAvailableActions, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(addSelectedAction())); connect(m_ui->m_listAvailableActions, &QListWidget::itemDoubleClicked, this, &ToolBarEditor::addSelectedAction);
m_ui->m_listActivatedActions->installEventFilter(this); m_ui->m_listActivatedActions->installEventFilter(this);
} }

View File

@ -49,13 +49,12 @@ Application::Application(const QString &id, int &argc, char **argv)
m_updateFeedsLock(nullptr), m_userActions(QList<QAction*>()), m_mainForm(nullptr), m_updateFeedsLock(nullptr), m_userActions(QList<QAction*>()), m_mainForm(nullptr),
m_trayIcon(nullptr), m_settings(nullptr), m_system(nullptr), m_skins(nullptr), m_trayIcon(nullptr), m_settings(nullptr), m_system(nullptr), m_skins(nullptr),
m_localization(nullptr), m_icons(nullptr), m_database(nullptr), m_downloadManager(nullptr) { m_localization(nullptr), m_icons(nullptr), m_database(nullptr), m_downloadManager(nullptr) {
connect(this, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit())); connect(this, &Application::aboutToQuit, this, &Application::onAboutToQuit);
connect(this, SIGNAL(commitDataRequest(QSessionManager&)), this, SLOT(onCommitData(QSessionManager&))); connect(this, &Application::commitDataRequest, this, &Application::onCommitData);
connect(this, SIGNAL(saveStateRequest(QSessionManager&)), this, SLOT(onSaveState(QSessionManager&))); connect(this, &Application::saveStateRequest, this, &Application::onSaveState);
#if defined(USE_WEBENGINE) #if defined(USE_WEBENGINE)
connect(QWebEngineProfile::defaultProfile(), &QWebEngineProfile::downloadRequested, connect(QWebEngineProfile::defaultProfile(), &QWebEngineProfile::downloadRequested, this, &Application::downloadRequested);
this, &Application::downloadRequested);
#endif #endif
} }
@ -149,8 +148,8 @@ DownloadManager *Application::downloadManager() {
if (m_downloadManager == nullptr) { if (m_downloadManager == nullptr) {
m_downloadManager = new DownloadManager(); m_downloadManager = new DownloadManager();
connect(m_downloadManager, SIGNAL(downloadFinished()), mainForm()->statusBar(), SLOT(clearProgressDownload())); connect(m_downloadManager, &DownloadManager::downloadFinished, mainForm()->statusBar(), &StatusBar::clearProgressDownload);
connect(m_downloadManager, SIGNAL(downloadProgress(int,QString)), mainForm()->statusBar(), SLOT(showProgressDownload(int,QString))); connect(m_downloadManager, &DownloadManager::downloadProgressed, mainForm()->statusBar(), &StatusBar::showProgressDownload);
} }
return m_downloadManager; return m_downloadManager;

View File

@ -27,7 +27,7 @@
BaseNetworkAccessManager::BaseNetworkAccessManager(QObject *parent) BaseNetworkAccessManager::BaseNetworkAccessManager(QObject *parent)
: QNetworkAccessManager(parent) { : QNetworkAccessManager(parent) {
connect(this, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), this, SLOT(onSslErrors(QNetworkReply*,QList<QSslError>))); connect(this, &BaseNetworkAccessManager::sslErrors, this, &BaseNetworkAccessManager::onSslErrors);
loadSettings(); loadSettings();
} }

View File

@ -31,7 +31,7 @@ Downloader::Downloader(QObject *parent)
m_timer->setInterval(DOWNLOAD_TIMEOUT); m_timer->setInterval(DOWNLOAD_TIMEOUT);
m_timer->setSingleShot(true); m_timer->setSingleShot(true);
connect(m_timer, SIGNAL(timeout()), this, SLOT(timeout())); connect(m_timer, &QTimer::timeout, this, &Downloader::cancel);
} }
Downloader::~Downloader() { Downloader::~Downloader() {
@ -147,10 +147,6 @@ void Downloader::progressInternal(qint64 bytes_received, qint64 bytes_total) {
emit progress(bytes_received, bytes_total); emit progress(bytes_received, bytes_total);
} }
void Downloader::timeout() {
cancel();
}
void Downloader::runDeleteRequest(const QNetworkRequest &request) { void Downloader::runDeleteRequest(const QNetworkRequest &request) {
m_timer->start(); m_timer->start();
m_activeReply = m_downloadManager->deleteResource(request); m_activeReply = m_downloadManager->deleteResource(request);
@ -159,8 +155,8 @@ void Downloader::runDeleteRequest(const QNetworkRequest &request) {
m_activeReply->setProperty("username", m_targetUsername); m_activeReply->setProperty("username", m_targetUsername);
m_activeReply->setProperty("password", m_targetPassword); m_activeReply->setProperty("password", m_targetPassword);
connect(m_activeReply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(progressInternal(qint64,qint64))); connect(m_activeReply, &QNetworkReply::downloadProgress, this, &Downloader::progressInternal);
connect(m_activeReply, SIGNAL(finished()), this, SLOT(finished())); connect(m_activeReply, &QNetworkReply::finished, this, &Downloader::finished);
} }
void Downloader::runPutRequest(const QNetworkRequest &request, const QByteArray &data) { void Downloader::runPutRequest(const QNetworkRequest &request, const QByteArray &data) {
@ -171,8 +167,8 @@ void Downloader::runPutRequest(const QNetworkRequest &request, const QByteArray
m_activeReply->setProperty("username", m_targetUsername); m_activeReply->setProperty("username", m_targetUsername);
m_activeReply->setProperty("password", m_targetPassword); m_activeReply->setProperty("password", m_targetPassword);
connect(m_activeReply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(progressInternal(qint64,qint64))); connect(m_activeReply, &QNetworkReply::downloadProgress, this, &Downloader::progressInternal);
connect(m_activeReply, SIGNAL(finished()), this, SLOT(finished())); connect(m_activeReply, &QNetworkReply::finished, this, &Downloader::finished);
} }
void Downloader::runPostRequest(const QNetworkRequest &request, const QByteArray &data) { void Downloader::runPostRequest(const QNetworkRequest &request, const QByteArray &data) {
@ -183,8 +179,8 @@ void Downloader::runPostRequest(const QNetworkRequest &request, const QByteArray
m_activeReply->setProperty("username", m_targetUsername); m_activeReply->setProperty("username", m_targetUsername);
m_activeReply->setProperty("password", m_targetPassword); m_activeReply->setProperty("password", m_targetPassword);
connect(m_activeReply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(progressInternal(qint64,qint64))); connect(m_activeReply, &QNetworkReply::downloadProgress, this, &Downloader::progressInternal);
connect(m_activeReply, SIGNAL(finished()), this, SLOT(finished())); connect(m_activeReply, &QNetworkReply::finished, this, &Downloader::finished);
} }
void Downloader::runGetRequest(const QNetworkRequest &request) { void Downloader::runGetRequest(const QNetworkRequest &request) {
@ -195,8 +191,8 @@ void Downloader::runGetRequest(const QNetworkRequest &request) {
m_activeReply->setProperty("username", m_targetUsername); m_activeReply->setProperty("username", m_targetUsername);
m_activeReply->setProperty("password", m_targetPassword); m_activeReply->setProperty("password", m_targetPassword);
connect(m_activeReply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(progressInternal(qint64,qint64))); connect(m_activeReply, &QNetworkReply::downloadProgress, this, &Downloader::progressInternal);
connect(m_activeReply, SIGNAL(finished()), this, SLOT(finished())); connect(m_activeReply, &QNetworkReply::finished, this, &Downloader::finished);
} }
QVariant Downloader::lastContentType() const { QVariant Downloader::lastContentType() const {

View File

@ -75,9 +75,6 @@ class Downloader : public QObject {
// Called when progress of downloaded file changes. // Called when progress of downloaded file changes.
void progressInternal(qint64 bytes_received, qint64 bytes_total); void progressInternal(qint64 bytes_received, qint64 bytes_total);
// Called when current operation times out.
void timeout();
private: private:
void runDeleteRequest(const QNetworkRequest &request); void runDeleteRequest(const QNetworkRequest &request);
void runPutRequest(const QNetworkRequest &request, const QByteArray &data); void runPutRequest(const QNetworkRequest &request, const QByteArray &data);

View File

@ -49,10 +49,10 @@ DownloadItem::DownloadItem(QNetworkReply *reply, QWidget *parent) : QWidget(pare
m_requestFileName = qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::AlwaysPromptForFilename)).toBool(); m_requestFileName = qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::AlwaysPromptForFilename)).toBool();
connect(m_ui->m_btnStopDownload, SIGNAL(clicked()), this, SLOT(stop())); connect(m_ui->m_btnStopDownload, &QToolButton::clicked, this, &DownloadItem::stop);
connect(m_ui->m_btnOpenFile, SIGNAL(clicked()), this, SLOT(openFile())); connect(m_ui->m_btnOpenFile, &QToolButton::clicked, this, &DownloadItem::openFile);
connect(m_ui->m_btnTryAgain, SIGNAL(clicked()), this, SLOT(tryAgain())); connect(m_ui->m_btnTryAgain, &QToolButton::clicked, this, &DownloadItem::tryAgain);
connect(m_ui->m_btnOpenFolder, SIGNAL(clicked()), this, SLOT(openFolder())); connect(m_ui->m_btnOpenFolder, &QToolButton::clicked, this, &DownloadItem::openFolder);
init(); init();
} }
@ -72,11 +72,11 @@ void DownloadItem::init() {
m_url = m_reply->url(); m_url = m_reply->url();
m_reply->setParent(this); m_reply->setParent(this);
connect(m_reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead())); connect(m_reply, &QNetworkReply::readyRead, this, &DownloadItem::downloadReadyRead);
connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error(QNetworkReply::NetworkError))); connect(m_reply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), this, &DownloadItem::error);
connect(m_reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64))); connect(m_reply, &QNetworkReply::downloadProgress, this, &DownloadItem::downloadProgress);
connect(m_reply, SIGNAL(metaDataChanged()), this, SLOT(metaDataChanged())); connect(m_reply, &QNetworkReply::metaDataChanged, this, &DownloadItem::metaDataChanged);
connect(m_reply, SIGNAL(finished()), this, SLOT(finished())); connect(m_reply, &QNetworkReply::finished, this, &DownloadItem::finished);
// Reset info. // Reset info.
m_ui->m_lblInfoDownload->clear(); m_ui->m_lblInfoDownload->clear();
@ -452,7 +452,7 @@ DownloadManager::DownloadManager(QWidget *parent) : TabContent(parent), m_ui(new
m_ui->m_viewDownloads->setModel(m_model); m_ui->m_viewDownloads->setModel(m_model);
setDownloadDirectory(qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::TargetDirectory)).toString()); setDownloadDirectory(qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::TargetDirectory)).toString());
connect(m_ui->m_btnCleanup, SIGNAL(clicked()), this, SLOT(cleanup())); connect(m_ui->m_btnCleanup, &QPushButton::clicked, this, &DownloadManager::cleanup);
load(); load();
} }
@ -527,9 +527,9 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply *reply) {
} }
void DownloadManager::addItem(DownloadItem *item) { void DownloadManager::addItem(DownloadItem *item) {
connect(item, SIGNAL(statusChanged()), this, SLOT(updateRow())); connect(item, &DownloadItem::statusChanged, this, static_cast<void (DownloadManager::*)()>(&DownloadManager::updateRow));
connect(item, SIGNAL(progress(qint64,qint64)), this, SLOT(itemProgress())); connect(item, &DownloadItem::progress, this, &DownloadManager::itemProgress);
connect(item, SIGNAL(downloadFinished()), this, SLOT(itemFinished())); connect(item, &DownloadItem::downloadFinished, this, &DownloadManager::itemFinished);
const int row = m_downloads.count(); const int row = m_downloads.count();
m_model->beginInsertRows(QModelIndex(), row, row); m_model->beginInsertRows(QModelIndex(), row, row);
@ -570,7 +570,7 @@ void DownloadManager::itemProgress() {
emit downloadFinished(); emit downloadFinished();
} }
else { else {
emit downloadProgress(progress, tr("Downloading %n file(s)...", "", activeDownloads())); emit downloadProgressed(progress, tr("Downloading %n file(s)...", "", activeDownloads()));
} }
} }

View File

@ -149,7 +149,7 @@ class DownloadManager : public TabContent {
void itemFinished(); void itemFinished();
signals: signals:
void downloadProgress(int progress, const QString &description); void downloadProgressed(int progress, const QString &description);
void downloadFinished(); void downloadFinished();
private: private:

View File

@ -74,9 +74,9 @@ GoogleSuggest::GoogleSuggest(LocationLineEdit *editor, QObject *parent)
timer->setSingleShot(true); timer->setSingleShot(true);
timer->setInterval(500); timer->setInterval(500);
connect(popup.data(), SIGNAL(itemClicked(QListWidgetItem*)), SLOT(doneCompletion())); connect(popup.data(), &QListWidget::itemClicked, this, &GoogleSuggest::doneCompletion);
connect(timer, SIGNAL(timeout()), SLOT(autoSuggest())); connect(timer, &QTimer::timeout, this, &GoogleSuggest::autoSuggest);
connect(editor, SIGNAL(textEdited(QString)), timer, SLOT(start())); connect(editor, &LocationLineEdit::textEdited, timer, &QTimer::start);
} }
GoogleSuggest::~GoogleSuggest() { GoogleSuggest::~GoogleSuggest() {
@ -170,8 +170,8 @@ void GoogleSuggest::autoSuggest() {
m_enteredText = QUrl::toPercentEncoding(editor->text()); m_enteredText = QUrl::toPercentEncoding(editor->text());
QString url = QString(GOOGLE_SUGGEST_URL).arg(m_enteredText); QString url = QString(GOOGLE_SUGGEST_URL).arg(m_enteredText);
connect(SilentNetworkAccessManager::instance()->get(QNetworkRequest(QString(url))), SIGNAL(finished()), connect(SilentNetworkAccessManager::instance()->get(QNetworkRequest(QString(url))), &QNetworkReply::finished,
this, SLOT(handleNetworkData())); this, &GoogleSuggest::handleNetworkData);
} }
void GoogleSuggest::handleNetworkData() { void GoogleSuggest::handleNetworkData() {

View File

@ -166,7 +166,7 @@ NetworkResult NetworkFactory::performNetworkOperation(const QString &url, int ti
} }
// We need to quit event loop when the download finishes. // We need to quit event loop when the download finishes.
QObject::connect(&downloader, SIGNAL(completed(QNetworkReply::NetworkError)), &loop, SLOT(quit())); QObject::connect(&downloader, &Downloader::completed, &loop, &QEventLoop::quit);
downloader.manipulateData(url, operation, input_data, timeout, protected_contents, username, password); downloader.manipulateData(url, operation, input_data, timeout, protected_contents, username, password);
loop.exec(); loop.exec();
@ -189,7 +189,7 @@ NetworkResult NetworkFactory::downloadFeedFile(const QString &url, int timeout,
downloader.appendRawHeader("Accept", ACCEPT_HEADER_FOR_FEED_DOWNLOADER); downloader.appendRawHeader("Accept", ACCEPT_HEADER_FOR_FEED_DOWNLOADER);
// We need to quit event loop when the download finishes. // We need to quit event loop when the download finishes.
QObject::connect(&downloader, SIGNAL(completed(QNetworkReply::NetworkError)), &loop, SLOT(quit())); QObject::connect(&downloader, &Downloader::completed, &loop, &QEventLoop::quit);
downloader.downloadFile(url, timeout, protected_contents, username, password); downloader.downloadFile(url, timeout, protected_contents, username, password);
loop.exec(); loop.exec();

View File

@ -27,8 +27,8 @@ QPointer<SilentNetworkAccessManager> SilentNetworkAccessManager::s_instance;
SilentNetworkAccessManager::SilentNetworkAccessManager(QObject *parent) SilentNetworkAccessManager::SilentNetworkAccessManager(QObject *parent)
: BaseNetworkAccessManager(parent) { : BaseNetworkAccessManager(parent) {
connect(this, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), connect(this, &SilentNetworkAccessManager::authenticationRequired,
this, SLOT(onAuthenticationRequired(QNetworkReply*,QAuthenticator*)), Qt::DirectConnection); this, &SilentNetworkAccessManager::onAuthenticationRequired, Qt::DirectConnection);
} }
SilentNetworkAccessManager::~SilentNetworkAccessManager() { SilentNetworkAccessManager::~SilentNetworkAccessManager() {

View File

@ -134,7 +134,7 @@ bool QtLocalPeer::isClient()
#endif #endif
if (!res) if (!res)
qWarning("QtSingleCoreApplication: listen on local socket failed, %s", qPrintable(server->errorString())); qWarning("QtSingleCoreApplication: listen on local socket failed, %s", qPrintable(server->errorString()));
QObject::connect(server, SIGNAL(newConnection()), SLOT(receiveConnection())); QObject::connect(server, &QLocalServer::newConnection, this, &QtLocalPeer::receiveConnection);
return false; return false;
} }

6
src/qtsingleapplication/qtsingleapplication.cpp Normal file → Executable file
View File

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

4
src/qtsingleapplication/qtsinglecoreapplication.cpp Normal file → Executable file
View File

@ -74,7 +74,7 @@ QtSingleCoreApplication::QtSingleCoreApplication(int &argc, char **argv)
: QCoreApplication(argc, argv) : QCoreApplication(argc, argv)
{ {
peer = new QtLocalPeer(this); peer = new QtLocalPeer(this);
connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&))); connect(peer, &QtLocalPeer::messageReceived, this, &QtSingleCoreApplication::messageReceived);
} }
@ -87,7 +87,7 @@ QtSingleCoreApplication::QtSingleCoreApplication(const QString &appId, int &argc
: QCoreApplication(argc, argv) : QCoreApplication(argc, argv)
{ {
peer = new QtLocalPeer(this, appId); peer = new QtLocalPeer(this, appId);
connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&))); connect(peer, &QtLocalPeer::messageReceived, this, &QtSingleCoreApplication::messageReceived);
} }