From: Olivier Goffart Date: Wed, 20 Sep 2017 08:14:48 +0000 (+0200) Subject: Use the Qt5 connection syntax (automated with clazy) X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~701^2~65 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=7aca2352be51701b0f1bdcc3b20e2215af14cb93;p=nextcloud-desktop.git Use the Qt5 connection syntax (automated with clazy) This is motivated by the fact that QMetaObject::noralizeSignature takes 7.35% CPU of the LargeSyncBench. (Mostly from ABstractNetworkJob::setupConnections and PropagateUploadFileV1::startNextChunk). It could be fixed by using normalized signature in the connection statement, but i tought it was a good oportunity to modernize the code. This commit only contains calls that were automatically converted with clazy. --- diff --git a/src/3rdparty/qtsingleapplication/qtlocalpeer.cpp b/src/3rdparty/qtsingleapplication/qtlocalpeer.cpp index 33cca898a..3ebba6e6f 100644 --- a/src/3rdparty/qtsingleapplication/qtlocalpeer.cpp +++ b/src/3rdparty/qtsingleapplication/qtlocalpeer.cpp @@ -101,7 +101,7 @@ bool QtLocalPeer::isClient() bool res = server->listen(socketName); if (!res) 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; } diff --git a/src/3rdparty/qtsingleapplication/qtsingleapplication.cpp b/src/3rdparty/qtsingleapplication/qtsingleapplication.cpp index 9610937de..844824cb4 100644 --- a/src/3rdparty/qtsingleapplication/qtsingleapplication.cpp +++ b/src/3rdparty/qtsingleapplication/qtsingleapplication.cpp @@ -95,7 +95,7 @@ QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char * *pids = 0; pidPeer = new QtLocalPeer(this, appId + QLatin1Char('-') + QString::number(QCoreApplication::applicationPid())); - connect(pidPeer, SIGNAL(messageReceived(QString,QObject*)), SIGNAL(messageReceived(QString,QObject*))); + connect(pidPeer, &QtLocalPeer::messageReceived, this, &QtSingleApplication::messageReceived); pidPeer->isClient(); lockfile.unlock(); } @@ -169,9 +169,9 @@ void QtSingleApplication::setActivationWindow(QWidget *aw, bool activateOnMessag if (!pidPeer) return; if (activateOnMessage) - connect(pidPeer, SIGNAL(messageReceived(QString,QObject*)), this, SLOT(activateWindow())); + connect(pidPeer, &QtLocalPeer::messageReceived, this, &QtSingleApplication::activateWindow); else - disconnect(pidPeer, SIGNAL(messageReceived(QString,QObject*)), this, SLOT(activateWindow())); + disconnect(pidPeer, &QtLocalPeer::messageReceived, this, &QtSingleApplication::activateWindow); } diff --git a/src/3rdparty/qtsingleapplication/qtsinglecoreapplication.cpp b/src/3rdparty/qtsingleapplication/qtsinglecoreapplication.cpp index 25a511f6c..e34fd6328 100644 --- a/src/3rdparty/qtsingleapplication/qtsinglecoreapplication.cpp +++ b/src/3rdparty/qtsingleapplication/qtsinglecoreapplication.cpp @@ -37,7 +37,7 @@ QtSingleCoreApplication::QtSingleCoreApplication(int &argc, char **argv) { peer = new QtLocalPeer(this); block = false; - connect(peer, SIGNAL(messageReceived(QString)), SIGNAL(messageReceived(QString))); + connect(peer, &QtLocalPeer::messageReceived, this, &QtSingleCoreApplication::messageReceived); } @@ -45,7 +45,7 @@ QtSingleCoreApplication::QtSingleCoreApplication(const QString &appId, int &argc : QCoreApplication(argc, argv) { peer = new QtLocalPeer(this, appId); - connect(peer, SIGNAL(messageReceived(QString)), SIGNAL(messageReceived(QString))); + connect(peer, &QtLocalPeer::messageReceived, this, &QtSingleCoreApplication::messageReceived); } diff --git a/src/cmd/cmd.cpp b/src/cmd/cmd.cpp index d8d836ecf..b8116b919 100644 --- a/src/cmd/cmd.cpp +++ b/src/cmd/cmd.cpp @@ -512,7 +512,7 @@ restart_sync: engine.setNetworkLimits(options.uplimit, options.downlimit); QObject::connect(&engine, &SyncEngine::finished, [&app](bool result) { app.exit(result ? EXIT_SUCCESS : EXIT_FAILURE); }); - QObject::connect(&engine, SIGNAL(transmissionProgress(ProgressInfo)), &cmd, SLOT(transmissionProgressSlot())); + QObject::connect(&engine, &SyncEngine::transmissionProgress, &cmd, &Cmd::transmissionProgressSlot); // Exclude lists diff --git a/src/common/checksums.cpp b/src/common/checksums.cpp index 6ffb57385..245bcaa37 100644 --- a/src/common/checksums.cpp +++ b/src/common/checksums.cpp @@ -151,8 +151,8 @@ QByteArray ComputeChecksum::checksumType() const void ComputeChecksum::start(const QString &filePath) { // Calculate the checksum in a different thread first. - connect(&_watcher, SIGNAL(finished()), - this, SLOT(slotCalculationDone()), + connect(&_watcher, &QFutureWatcherBase::finished, + this, &ComputeChecksum::slotCalculationDone, Qt::UniqueConnection); _watcher.setFuture(QtConcurrent::run(ComputeChecksum::computeNow, filePath, checksumType())); } @@ -208,8 +208,8 @@ void ValidateChecksumHeader::start(const QString &filePath, const QByteArray &ch auto calculator = new ComputeChecksum(this); calculator->setChecksumType(_expectedChecksumType); - connect(calculator, SIGNAL(done(QByteArray, QByteArray)), - SLOT(slotChecksumCalculated(QByteArray, QByteArray))); + connect(calculator, &ComputeChecksum::done, + this, &ValidateChecksumHeader::slotChecksumCalculated); calculator->start(filePath); } diff --git a/src/gui/accountmanager.cpp b/src/gui/accountmanager.cpp index a62e1f30f..38a0ff185 100644 --- a/src/gui/accountmanager.cpp +++ b/src/gui/accountmanager.cpp @@ -319,8 +319,8 @@ AccountPtr AccountManager::createAccount() { AccountPtr acc = Account::create(); acc->setSslErrorHandler(new SslDialogErrorHandler); - connect(acc.data(), SIGNAL(proxyAuthenticationRequired(QNetworkProxy, QAuthenticator *)), - ProxyAuthHandler::instance(), SLOT(handleProxyAuthenticationRequired(QNetworkProxy, QAuthenticator *))); + connect(acc.data(), &Account::proxyAuthenticationRequired, + ProxyAuthHandler::instance(), &ProxyAuthHandler::handleProxyAuthenticationRequired); return acc; } @@ -359,8 +359,8 @@ QString AccountManager::generateFreeAccountId() const void AccountManager::addAccountState(AccountState *accountState) { QObject::connect(accountState->account().data(), - SIGNAL(wantsAccountSaved(Account *)), - SLOT(saveAccount(Account *))); + &Account::wantsAccountSaved, + this, &AccountManager::saveAccount); AccountStatePtr ptr(accountState); _accounts << ptr; diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index f40a38889..8183d4b8f 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -139,41 +139,41 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent) ui->_folderList->installEventFilter(mouseCursorChanger); createAccountToolbox(); - connect(AccountManager::instance(), SIGNAL(accountAdded(AccountState *)), - SLOT(slotAccountAdded(AccountState *))); - connect(ui->_folderList, SIGNAL(customContextMenuRequested(QPoint)), - this, SLOT(slotCustomContextMenuRequested(QPoint))); - connect(ui->_folderList, SIGNAL(clicked(const QModelIndex &)), - this, SLOT(slotFolderListClicked(const QModelIndex &))); - connect(ui->_folderList, SIGNAL(expanded(QModelIndex)), this, SLOT(refreshSelectiveSyncStatus())); - connect(ui->_folderList, SIGNAL(collapsed(QModelIndex)), this, SLOT(refreshSelectiveSyncStatus())); - connect(ui->selectiveSyncNotification, SIGNAL(linkActivated(QString)), - this, SLOT(slotLinkActivated(QString))); - connect(_model, SIGNAL(suggestExpand(QModelIndex)), ui->_folderList, SLOT(expand(QModelIndex))); - connect(_model, SIGNAL(dirtyChanged()), this, SLOT(refreshSelectiveSyncStatus())); + connect(AccountManager::instance(), &AccountManager::accountAdded, + this, &AccountSettings::slotAccountAdded); + connect(ui->_folderList, &QWidget::customContextMenuRequested, + this, &AccountSettings::slotCustomContextMenuRequested); + connect(ui->_folderList, &QAbstractItemView::clicked, + this, &AccountSettings::slotFolderListClicked); + connect(ui->_folderList, &QTreeView::expanded, this, &AccountSettings::refreshSelectiveSyncStatus); + connect(ui->_folderList, &QTreeView::collapsed, this, &AccountSettings::refreshSelectiveSyncStatus); + connect(ui->selectiveSyncNotification, &QLabel::linkActivated, + this, &AccountSettings::slotLinkActivated); + connect(_model, &FolderStatusModel::suggestExpand, ui->_folderList, &QTreeView::expand); + connect(_model, &FolderStatusModel::dirtyChanged, this, &AccountSettings::refreshSelectiveSyncStatus); refreshSelectiveSyncStatus(); - connect(_model, SIGNAL(rowsInserted(QModelIndex, int, int)), - this, SLOT(refreshSelectiveSyncStatus())); + connect(_model, &QAbstractItemModel::rowsInserted, + this, &AccountSettings::refreshSelectiveSyncStatus); QAction *syncNowAction = new QAction(this); syncNowAction->setShortcut(QKeySequence(Qt::Key_F6)); - connect(syncNowAction, SIGNAL(triggered()), SLOT(slotScheduleCurrentFolder())); + connect(syncNowAction, &QAction::triggered, this, &AccountSettings::slotScheduleCurrentFolder); addAction(syncNowAction); QAction *syncNowWithRemoteDiscovery = new QAction(this); syncNowWithRemoteDiscovery->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F6)); - connect(syncNowWithRemoteDiscovery, SIGNAL(triggered()), SLOT(slotScheduleCurrentFolderForceRemoteDiscovery())); + connect(syncNowWithRemoteDiscovery, &QAction::triggered, this, &AccountSettings::slotScheduleCurrentFolderForceRemoteDiscovery); addAction(syncNowWithRemoteDiscovery); - connect(ui->selectiveSyncApply, SIGNAL(clicked()), _model, SLOT(slotApplySelectiveSync())); - connect(ui->selectiveSyncCancel, SIGNAL(clicked()), _model, SLOT(resetFolders())); - connect(ui->bigFolderApply, SIGNAL(clicked(bool)), _model, SLOT(slotApplySelectiveSync())); - connect(ui->bigFolderSyncAll, SIGNAL(clicked(bool)), _model, SLOT(slotSyncAllPendingBigFolders())); - connect(ui->bigFolderSyncNone, SIGNAL(clicked(bool)), _model, SLOT(slotSyncNoPendingBigFolders())); + connect(ui->selectiveSyncApply, &QAbstractButton::clicked, _model, &FolderStatusModel::slotApplySelectiveSync); + connect(ui->selectiveSyncCancel, &QAbstractButton::clicked, _model, &FolderStatusModel::resetFolders); + connect(ui->bigFolderApply, &QAbstractButton::clicked, _model, &FolderStatusModel::slotApplySelectiveSync); + connect(ui->bigFolderSyncAll, &QAbstractButton::clicked, _model, &FolderStatusModel::slotSyncAllPendingBigFolders); + connect(ui->bigFolderSyncNone, &QAbstractButton::clicked, _model, &FolderStatusModel::slotSyncNoPendingBigFolders); - connect(FolderMan::instance(), SIGNAL(folderListChanged(Folder::Map)), _model, SLOT(resetFolders())); - connect(this, SIGNAL(folderChanged()), _model, SLOT(resetFolders())); + connect(FolderMan::instance(), &FolderMan::folderListChanged, _model, &FolderStatusModel::resetFolders); + connect(this, &AccountSettings::folderChanged, _model, &FolderStatusModel::resetFolders); QColor color = palette().highlight().color(); @@ -184,8 +184,8 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent) connect(_accountState, &AccountState::stateChanged, this, &AccountSettings::slotAccountStateChanged); slotAccountStateChanged(); - connect(&_quotaInfo, SIGNAL(quotaUpdated(qint64, qint64)), - this, SLOT(slotUpdateQuota(qint64, qint64))); + connect(&_quotaInfo, &QuotaInfo::quotaUpdated, + this, &AccountSettings::slotUpdateQuota); } @@ -194,15 +194,15 @@ void AccountSettings::createAccountToolbox() QMenu *menu = new QMenu(); _addAccountAction = new QAction(tr("Add new"), this); menu->addAction(_addAccountAction); - connect(_addAccountAction, SIGNAL(triggered(bool)), SLOT(slotOpenAccountWizard())); + connect(_addAccountAction, &QAction::triggered, this, &AccountSettings::slotOpenAccountWizard); _toggleSignInOutAction = new QAction(tr("Log out"), this); - connect(_toggleSignInOutAction, SIGNAL(triggered(bool)), SLOT(slotToggleSignInState())); + connect(_toggleSignInOutAction, &QAction::triggered, this, &AccountSettings::slotToggleSignInState); menu->addAction(_toggleSignInOutAction); QAction *action = new QAction(tr("Remove"), this); menu->addAction(action); - connect(action, SIGNAL(triggered(bool)), SLOT(slotDeleteAccount())); + connect(action, &QAction::triggered, this, &AccountSettings::slotDeleteAccount); ui->_accountToolbox->setText(tr("Account") + QLatin1Char(' ')); ui->_accountToolbox->setMenu(menu); @@ -268,7 +268,7 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos) menu->setAttribute(Qt::WA_DeleteOnClose); QAction *ac = menu->addAction(tr("Open folder")); - connect(ac, SIGNAL(triggered(bool)), this, SLOT(slotOpenCurrentLocalSubFolder())); + connect(ac, &QAction::triggered, this, &AccountSettings::slotOpenCurrentLocalSubFolder); QString fileName = _model->data(index, FolderStatusDelegate::FolderPathRole).toString(); if (!QFile::exists(fileName)) { @@ -294,12 +294,12 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos) menu->setAttribute(Qt::WA_DeleteOnClose); QAction *ac = menu->addAction(tr("Open folder")); - connect(ac, SIGNAL(triggered(bool)), this, SLOT(slotOpenCurrentFolder())); + connect(ac, &QAction::triggered, this, &AccountSettings::slotOpenCurrentFolder); if (!ui->_folderList->isExpanded(index)) { ac = menu->addAction(tr("Choose what to sync")); ac->setEnabled(folderConnected); - connect(ac, SIGNAL(triggered(bool)), this, SLOT(doExpand())); + connect(ac, &QAction::triggered, this, &AccountSettings::doExpand); } if (!folderPaused) { @@ -308,14 +308,14 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos) ac->setText(tr("Restart sync")); } ac->setEnabled(folderConnected); - connect(ac, SIGNAL(triggered(bool)), this, SLOT(slotForceSyncCurrentFolder())); + connect(ac, &QAction::triggered, this, &AccountSettings::slotForceSyncCurrentFolder); } ac = menu->addAction(folderPaused ? tr("Resume sync") : tr("Pause sync")); - connect(ac, SIGNAL(triggered(bool)), this, SLOT(slotEnableCurrentFolder())); + connect(ac, &QAction::triggered, this, &AccountSettings::slotEnableCurrentFolder); ac = menu->addAction(tr("Remove folder sync connection")); - connect(ac, SIGNAL(triggered(bool)), this, SLOT(slotRemoveCurrentFolder())); + connect(ac, &QAction::triggered, this, &AccountSettings::slotRemoveCurrentFolder); menu->exec(tv->mapToGlobal(pos)); } @@ -361,8 +361,8 @@ void AccountSettings::slotAddFolder() FolderWizard *folderWizard = new FolderWizard(_accountState->account(), this); - connect(folderWizard, SIGNAL(accepted()), SLOT(slotFolderWizardAccepted())); - connect(folderWizard, SIGNAL(rejected()), SLOT(slotFolderWizardRejected())); + connect(folderWizard, &QDialog::accepted, this, &AccountSettings::slotFolderWizardAccepted); + connect(folderWizard, &QDialog::rejected, this, &AccountSettings::slotFolderWizardRejected); folderWizard->open(); } diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index a13b8c227..63ad88860 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -38,12 +38,12 @@ AccountState::AccountState(AccountPtr account) { qRegisterMetaType("AccountState*"); - connect(account.data(), SIGNAL(invalidCredentials()), - SLOT(slotInvalidCredentials())); - connect(account.data(), SIGNAL(credentialsFetched(AbstractCredentials *)), - SLOT(slotCredentialsFetched(AbstractCredentials *))); - connect(account.data(), SIGNAL(credentialsAsked(AbstractCredentials *)), - SLOT(slotCredentialsAsked(AbstractCredentials *))); + connect(account.data(), &Account::invalidCredentials, + this, &AccountState::slotInvalidCredentials); + connect(account.data(), &Account::credentialsFetched, + this, &AccountState::slotCredentialsFetched); + connect(account.data(), &Account::credentialsAsked, + this, &AccountState::slotCredentialsAsked); _timeSinceLastETagCheck.invalidate(); } @@ -242,7 +242,7 @@ void AccountState::slotConnectionValidatorResult(ConnectionValidator::Status sta qCInfo(lcAccountState) << "AccountState reconnection: delaying for" << _maintenanceToConnectedDelay << "ms"; _timeSinceMaintenanceOver.start(); - QTimer::singleShot(_maintenanceToConnectedDelay + 100, this, SLOT(checkConnectivity())); + QTimer::singleShot(_maintenanceToConnectedDelay + 100, this, &AccountState::checkConnectivity); return; } else if (_timeSinceMaintenanceOver.elapsed() < _maintenanceToConnectedDelay) { qCInfo(lcAccountState) << "AccountState reconnection: only" diff --git a/src/gui/activitylistmodel.cpp b/src/gui/activitylistmodel.cpp index f03153483..d4a6f0eb5 100644 --- a/src/gui/activitylistmodel.cpp +++ b/src/gui/activitylistmodel.cpp @@ -124,8 +124,8 @@ void ActivityListModel::startFetchJob(AccountState *s) return; } JsonApiJob *job = new JsonApiJob(s->account(), QLatin1String("ocs/v1.php/cloud/activity"), this); - QObject::connect(job, SIGNAL(jsonReceived(QJsonDocument, int)), - this, SLOT(slotActivitiesReceived(QJsonDocument, int))); + QObject::connect(job, &JsonApiJob::jsonReceived, + this, &ActivityListModel::slotActivitiesReceived); job->setProperty("AccountStatePtr", QVariant::fromValue>(s)); QList> params; diff --git a/src/gui/activitywidget.cpp b/src/gui/activitywidget.cpp index 3d1b9047a..9091b80bc 100644 --- a/src/gui/activitywidget.cpp +++ b/src/gui/activitywidget.cpp @@ -81,19 +81,19 @@ ActivityWidget::ActivityWidget(QWidget *parent) showLabels(); - connect(_model, SIGNAL(activityJobStatusCode(AccountState *, int)), - this, SLOT(slotAccountActivityStatus(AccountState *, int))); + connect(_model, &ActivityListModel::activityJobStatusCode, + this, &ActivityWidget::slotAccountActivityStatus); _copyBtn = _ui->_dialogButtonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole); _copyBtn->setToolTip(tr("Copy the activity list to the clipboard.")); - connect(_copyBtn, SIGNAL(clicked()), SIGNAL(copyToClipboard())); + connect(_copyBtn, &QAbstractButton::clicked, this, &ActivityWidget::copyToClipboard); - connect(_model, SIGNAL(rowsInserted(QModelIndex, int, int)), SIGNAL(rowsInserted())); + connect(_model, &QAbstractItemModel::rowsInserted, this, &ActivityWidget::rowsInserted); connect(_ui->_activityList, SIGNAL(activated(QModelIndex)), this, SLOT(slotOpenFile(QModelIndex))); - connect(&_removeTimer, SIGNAL(timeout()), this, SLOT(slotCheckToCleanWidgets())); + connect(&_removeTimer, &QTimer::timeout, this, &ActivityWidget::slotCheckToCleanWidgets); _removeTimer.setInterval(1000); } @@ -260,10 +260,10 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList &list) widget = _widgetForNotifId[activity.ident()]; } else { widget = new NotificationWidget(this); - connect(widget, SIGNAL(sendNotificationRequest(QString, QString, QByteArray)), - this, SLOT(slotSendNotificationRequest(QString, QString, QByteArray))); - connect(widget, SIGNAL(requestCleanupAndBlacklist(Activity)), - this, SLOT(slotRequestCleanupAndBlacklist(Activity))); + connect(widget, &NotificationWidget::sendNotificationRequest, + this, &ActivityWidget::slotSendNotificationRequest); + connect(widget, &NotificationWidget::requestCleanupAndBlacklist, + this, &ActivityWidget::slotRequestCleanupAndBlacklist); _notificationsLayout->addWidget(widget); // _ui->_notifyScroll->setMinimumHeight( widget->height()); @@ -386,8 +386,8 @@ void ActivityWidget::slotSendNotificationRequest(const QString &accountName, con QUrl l(link); job->setLinkAndVerb(l, verb); job->setWidget(theSender); - connect(job, SIGNAL(networkError(QNetworkReply *)), - this, SLOT(slotNotifyNetworkError(QNetworkReply *))); + connect(job, &AbstractNetworkJob::networkError, + this, &ActivityWidget::slotNotifyNetworkError); connect(job, SIGNAL(jobFinished(QString, int)), this, SLOT(slotNotifyServerFinished(QString, int))); job->start(); @@ -515,32 +515,32 @@ ActivitySettings::ActivitySettings(QWidget *parent) hbox->addWidget(_tab); _activityWidget = new ActivityWidget(this); _activityTabId = _tab->addTab(_activityWidget, Theme::instance()->applicationIcon(), tr("Server Activity")); - connect(_activityWidget, SIGNAL(copyToClipboard()), this, SLOT(slotCopyToClipboard())); - connect(_activityWidget, SIGNAL(hideActivityTab(bool)), this, SLOT(setActivityTabHidden(bool))); - connect(_activityWidget, SIGNAL(guiLog(QString, QString)), this, SIGNAL(guiLog(QString, QString))); - connect(_activityWidget, SIGNAL(newNotification()), SLOT(slotShowActivityTab())); + connect(_activityWidget, &ActivityWidget::copyToClipboard, this, &ActivitySettings::slotCopyToClipboard); + connect(_activityWidget, &ActivityWidget::hideActivityTab, this, &ActivitySettings::setActivityTabHidden); + connect(_activityWidget, &ActivityWidget::guiLog, this, &ActivitySettings::guiLog); + connect(_activityWidget, &ActivityWidget::newNotification, this, &ActivitySettings::slotShowActivityTab); _protocolWidget = new ProtocolWidget(this); _protocolTabId = _tab->addTab(_protocolWidget, Theme::instance()->syncStateIcon(SyncResult::Success), tr("Sync Protocol")); - connect(_protocolWidget, SIGNAL(copyToClipboard()), this, SLOT(slotCopyToClipboard())); + connect(_protocolWidget, &ProtocolWidget::copyToClipboard, this, &ActivitySettings::slotCopyToClipboard); _issuesWidget = new IssuesWidget(this); _syncIssueTabId = _tab->addTab(_issuesWidget, Theme::instance()->syncStateIcon(SyncResult::Problem), QString()); slotShowIssueItemCount(0); // to display the label. - connect(_issuesWidget, SIGNAL(issueCountUpdated(int)), - this, SLOT(slotShowIssueItemCount(int))); - connect(_issuesWidget, SIGNAL(copyToClipboard()), - this, SLOT(slotCopyToClipboard())); + connect(_issuesWidget, &IssuesWidget::issueCountUpdated, + this, &ActivitySettings::slotShowIssueItemCount); + connect(_issuesWidget, &IssuesWidget::copyToClipboard, + this, &ActivitySettings::slotCopyToClipboard); // Add a progress indicator to spin if the acitivity list is updated. _progressIndicator = new QProgressIndicator(this); _tab->setCornerWidget(_progressIndicator); - connect(&_notificationCheckTimer, SIGNAL(timeout()), - this, SLOT(slotRegularNotificationCheck())); + connect(&_notificationCheckTimer, &QTimer::timeout, + this, &ActivitySettings::slotRegularNotificationCheck); // connect a model signal to stop the animation. - connect(_activityWidget, SIGNAL(rowsInserted()), _progressIndicator, SLOT(stopAnimation())); + connect(_activityWidget, &ActivityWidget::rowsInserted, _progressIndicator, &QProgressIndicator::stopAnimation); // We want the protocol be the default _tab->setCurrentIndex(1); diff --git a/src/gui/application.cpp b/src/gui/application.cpp index c3521a9b6..73f79d0b9 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -150,7 +150,7 @@ Application::Application(int &argc, char **argv) _folderManager.reset(new FolderMan); - connect(this, SIGNAL(messageReceived(QString, QObject *)), SLOT(slotParseMessage(QString, QObject *))); + connect(this, &SharedTools::QtSingleApplication::messageReceived, this, &Application::slotParseMessage); if (!AccountManager::instance()->restore()) { // If there is an error reading the account settings, try again @@ -176,7 +176,7 @@ Application::Application(int &argc, char **argv) setQuitOnLastWindowClosed(false); _theme->setSystrayUseMonoIcons(cfg.monoIcons()); - connect(_theme, SIGNAL(systrayUseMonoIconsChanged(bool)), SLOT(slotUseMonoIconsChanged(bool))); + connect(_theme, &Theme::systrayUseMonoIconsChanged, this, &Application::slotUseMonoIconsChanged); FolderMan::instance()->setupFolders(); _proxy.setupQtProxyFromConfig(); // folders have to be defined first, than we set up the Qt proxy. @@ -189,23 +189,23 @@ Application::Application(int &argc, char **argv) // Enable word wrapping of QInputDialog (#4197) setStyleSheet("QInputDialog QLabel { qproperty-wordWrap:1; }"); - connect(AccountManager::instance(), SIGNAL(accountAdded(AccountState *)), - SLOT(slotAccountStateAdded(AccountState *))); - connect(AccountManager::instance(), SIGNAL(accountRemoved(AccountState *)), - SLOT(slotAccountStateRemoved(AccountState *))); + connect(AccountManager::instance(), &AccountManager::accountAdded, + this, &Application::slotAccountStateAdded); + connect(AccountManager::instance(), &AccountManager::accountRemoved, + this, &Application::slotAccountStateRemoved); foreach (auto ai, AccountManager::instance()->accounts()) { slotAccountStateAdded(ai.data()); } - connect(FolderMan::instance()->socketApi(), SIGNAL(shareCommandReceived(QString, QString)), - _gui, SLOT(slotShowShareDialog(QString, QString))); + connect(FolderMan::instance()->socketApi(), &SocketApi::shareCommandReceived, + _gui.data(), &ownCloudGui::slotShowShareDialog); // startup procedure. - connect(&_checkConnectionTimer, SIGNAL(timeout()), this, SLOT(slotCheckConnection())); + connect(&_checkConnectionTimer, &QTimer::timeout, this, &Application::slotCheckConnection); _checkConnectionTimer.setInterval(ConnectionValidator::DefaultCallingIntervalMsec); // check for connection every 32 seconds. _checkConnectionTimer.start(); // Also check immediately - QTimer::singleShot(0, this, SLOT(slotCheckConnection())); + QTimer::singleShot(0, this, &Application::slotCheckConnection); // Can't use onlineStateChanged because it is always true on modern systems because of many interfaces connect(&_networkConfigurationManager, SIGNAL(configurationChanged(QNetworkConfiguration)), @@ -213,13 +213,13 @@ Application::Application(int &argc, char **argv) // Update checks UpdaterScheduler *updaterScheduler = new UpdaterScheduler(this); - connect(updaterScheduler, SIGNAL(updaterAnnouncement(QString, QString)), - _gui, SLOT(slotShowTrayMessage(QString, QString))); - connect(updaterScheduler, SIGNAL(requestRestart()), - _folderManager.data(), SLOT(slotScheduleAppRestart())); + connect(updaterScheduler, &UpdaterScheduler::updaterAnnouncement, + _gui.data(), &ownCloudGui::slotShowTrayMessage); + connect(updaterScheduler, &UpdaterScheduler::requestRestart, + _folderManager.data(), &FolderMan::slotScheduleAppRestart); // Cleanup at Quit. - connect(this, SIGNAL(aboutToQuit()), SLOT(slotCleanup())); + connect(this, &QCoreApplication::aboutToQuit, this, &Application::slotCleanup); } Application::~Application() @@ -237,16 +237,16 @@ Application::~Application() void Application::slotAccountStateRemoved(AccountState *accountState) { if (_gui) { - disconnect(accountState, SIGNAL(stateChanged(int)), - _gui, SLOT(slotAccountStateChanged())); - disconnect(accountState->account().data(), SIGNAL(serverVersionChanged(Account *, QString, QString)), - _gui, SLOT(slotTrayMessageIfServerUnsupported(Account *))); + disconnect(accountState, &AccountState::stateChanged, + _gui.data(), &ownCloudGui::slotAccountStateChanged); + disconnect(accountState->account().data(), &Account::serverVersionChanged, + _gui.data(), &ownCloudGui::slotTrayMessageIfServerUnsupported); } if (_folderManager) { - disconnect(accountState, SIGNAL(stateChanged(int)), - _folderManager.data(), SLOT(slotAccountStateChanged())); - disconnect(accountState->account().data(), SIGNAL(serverVersionChanged(Account *, QString, QString)), - _folderManager.data(), SLOT(slotServerVersionChanged(Account *))); + disconnect(accountState, &AccountState::stateChanged, + _folderManager.data(), &FolderMan::slotAccountStateChanged); + disconnect(accountState->account().data(), &Account::serverVersionChanged, + _folderManager.data(), &FolderMan::slotServerVersionChanged); } // if there is no more account, show the wizard. @@ -259,14 +259,14 @@ void Application::slotAccountStateRemoved(AccountState *accountState) void Application::slotAccountStateAdded(AccountState *accountState) { - connect(accountState, SIGNAL(stateChanged(int)), - _gui, SLOT(slotAccountStateChanged())); - connect(accountState->account().data(), SIGNAL(serverVersionChanged(Account *, QString, QString)), - _gui, SLOT(slotTrayMessageIfServerUnsupported(Account *))); - connect(accountState, SIGNAL(stateChanged(int)), - _folderManager.data(), SLOT(slotAccountStateChanged())); - connect(accountState->account().data(), SIGNAL(serverVersionChanged(Account *, QString, QString)), - _folderManager.data(), SLOT(slotServerVersionChanged(Account *))); + connect(accountState, &AccountState::stateChanged, + _gui.data(), &ownCloudGui::slotAccountStateChanged); + connect(accountState->account().data(), &Account::serverVersionChanged, + _gui.data(), &ownCloudGui::slotTrayMessageIfServerUnsupported); + connect(accountState, &AccountState::stateChanged, + _folderManager.data(), &FolderMan::slotAccountStateChanged); + connect(accountState->account().data(), &Account::serverVersionChanged, + _folderManager.data(), &FolderMan::slotServerVersionChanged); _gui->slotTrayMessageIfServerUnsupported(accountState->account().data()); } diff --git a/src/gui/authenticationdialog.cpp b/src/gui/authenticationdialog.cpp index bae0bcd13..80fea6321 100644 --- a/src/gui/authenticationdialog.cpp +++ b/src/gui/authenticationdialog.cpp @@ -40,8 +40,8 @@ AuthenticationDialog::AuthenticationDialog(const QString &realm, const QString & _password->setEchoMode(QLineEdit::Password); QDialogButtonBox *box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal); - connect(box, SIGNAL(accepted()), this, SLOT(accept())); - connect(box, SIGNAL(rejected()), this, SLOT(reject())); + connect(box, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(box, &QDialogButtonBox::rejected, this, &QDialog::reject); lay->addWidget(box); } diff --git a/src/gui/creds/shibboleth/shibbolethuserjob.cpp b/src/gui/creds/shibboleth/shibbolethuserjob.cpp index 743643692..24c164b26 100644 --- a/src/gui/creds/shibboleth/shibbolethuserjob.cpp +++ b/src/gui/creds/shibboleth/shibbolethuserjob.cpp @@ -27,7 +27,7 @@ ShibbolethUserJob::ShibbolethUserJob(AccountPtr account, QObject *parent) : JsonApiJob(account, QLatin1String("ocs/v1.php/cloud/user"), parent) { setIgnoreCredentialFailure(true); - connect(this, SIGNAL(jsonReceived(QJsonDocument, int)), this, SLOT(slotJsonReceived(QJsonDocument, int))); + connect(this, &JsonApiJob::jsonReceived, this, &ShibbolethUserJob::slotJsonReceived); } void ShibbolethUserJob::slotJsonReceived(const QJsonDocument &json, int statusCode) diff --git a/src/gui/creds/shibboleth/shibbolethwebview.cpp b/src/gui/creds/shibboleth/shibbolethwebview.cpp index 64a1f7c35..dbcd340b6 100644 --- a/src/gui/creds/shibboleth/shibbolethwebview.cpp +++ b/src/gui/creds/shibboleth/shibbolethwebview.cpp @@ -63,10 +63,10 @@ ShibbolethWebView::ShibbolethWebView(AccountPtr account, QWidget *parent) setAttribute(Qt::WA_DeleteOnClose); QWebPage *page = new UserAgentWebPage(this); - connect(page, SIGNAL(loadStarted()), - this, SLOT(slotLoadStarted())); - connect(page, SIGNAL(loadFinished(bool)), - this, SLOT(slotLoadFinished(bool))); + connect(page, &QWebPage::loadStarted, + this, &ShibbolethWebView::slotLoadStarted); + connect(page, &QWebPage::loadFinished, + this, &ShibbolethWebView::slotLoadFinished); // Make sure to accept the same SSL certificate issues as the regular QNAM we use for syncing QObject::connect(page->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply *, QList)), diff --git a/src/gui/creds/shibbolethcredentials.cpp b/src/gui/creds/shibbolethcredentials.cpp index 6f5641b35..32b300833 100644 --- a/src/gui/creds/shibbolethcredentials.cpp +++ b/src/gui/creds/shibbolethcredentials.cpp @@ -79,7 +79,7 @@ void ShibbolethCredentials::setAccount(Account *account) // When constructed with a cookie (by the wizard), we usually don't know the // user name yet. Request it now from the server. if (_ready && _user.isEmpty()) { - QTimer::singleShot(1234, this, SLOT(slotFetchUser())); + QTimer::singleShot(1234, this, &ShibbolethCredentials::slotFetchUser); } } @@ -96,8 +96,8 @@ QString ShibbolethCredentials::user() const QNetworkAccessManager *ShibbolethCredentials::createQNAM() const { QNetworkAccessManager *qnam(new AccessManager); - connect(qnam, SIGNAL(finished(QNetworkReply *)), - this, SLOT(slotReplyFinished(QNetworkReply *))); + connect(qnam, &QNetworkAccessManager::finished, + this, &ShibbolethCredentials::slotReplyFinished); return qnam; } @@ -145,7 +145,7 @@ void ShibbolethCredentials::fetchFromKeychainHelper() job->setInsecureFallback(false); job->setKey(keychainKey(_url.toString(), user(), _keychainMigration ? QString() : _account->id())); - connect(job, SIGNAL(finished(QKeychain::Job *)), SLOT(slotReadJobDone(QKeychain::Job *))); + connect(job, &Job::finished, this, &ShibbolethCredentials::slotReadJobDone); job->start(); } @@ -210,7 +210,7 @@ void ShibbolethCredentials::slotFetchUser() // We must first do a request to webdav so the session is enabled. // (because for some reason we can't access the API without that.. a bug in the server maybe?) EntityExistsJob *job = new EntityExistsJob(_account->sharedFromThis(), _account->davPath(), this); - connect(job, SIGNAL(exists(QNetworkReply *)), this, SLOT(slotFetchUserHelper())); + connect(job, &EntityExistsJob::exists, this, &ShibbolethCredentials::slotFetchUserHelper); job->setIgnoreCredentialFailure(true); job->start(); } @@ -218,7 +218,7 @@ void ShibbolethCredentials::slotFetchUser() void ShibbolethCredentials::slotFetchUserHelper() { ShibbolethUserJob *job = new ShibbolethUserJob(_account->sharedFromThis(), this); - connect(job, SIGNAL(userFetched(QString)), this, SLOT(slotUserFetched(QString))); + connect(job, &ShibbolethUserJob::userFetched, this, &ShibbolethCredentials::slotUserFetched); job->start(); } @@ -308,9 +308,9 @@ void ShibbolethCredentials::showLoginWindow() jar->clearSessionCookies(); _browser = new ShibbolethWebView(_account->sharedFromThis()); - connect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie)), - this, SLOT(onShibbolethCookieReceived(QNetworkCookie)), Qt::QueuedConnection); - connect(_browser, SIGNAL(rejected()), this, SLOT(slotBrowserRejected())); + connect(_browser.data(), &ShibbolethWebView::shibbolethCookieReceived, + this, &ShibbolethCredentials::onShibbolethCookieReceived, Qt::QueuedConnection); + connect(_browser.data(), &ShibbolethWebView::rejected, this, &ShibbolethCredentials::slotBrowserRejected); ownCloudGui::raiseDialog(_browser); } diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 864c496bf..a6e6e3171 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -82,32 +82,32 @@ Folder::Folder(const FolderDefinition &definition, if (!setIgnoredFiles()) qCWarning(lcFolder, "Could not read system exclude file"); - connect(_accountState.data(), SIGNAL(isConnectedChanged()), this, SIGNAL(canSyncChanged())); - connect(_engine.data(), SIGNAL(rootEtag(QString)), this, SLOT(etagRetreivedFromSyncEngine(QString))); + connect(_accountState.data(), &AccountState::isConnectedChanged, this, &Folder::canSyncChanged); + connect(_engine.data(), &SyncEngine::rootEtag, this, &Folder::etagRetreivedFromSyncEngine); - connect(_engine.data(), SIGNAL(started()), SLOT(slotSyncStarted()), Qt::QueuedConnection); - connect(_engine.data(), SIGNAL(finished(bool)), SLOT(slotSyncFinished(bool)), Qt::QueuedConnection); - connect(_engine.data(), SIGNAL(csyncUnavailable()), SLOT(slotCsyncUnavailable()), Qt::QueuedConnection); + connect(_engine.data(), &SyncEngine::started, this, &Folder::slotSyncStarted, Qt::QueuedConnection); + connect(_engine.data(), &SyncEngine::finished, this, &Folder::slotSyncFinished, Qt::QueuedConnection); + connect(_engine.data(), &SyncEngine::csyncUnavailable, this, &Folder::slotCsyncUnavailable, Qt::QueuedConnection); //direct connection so the message box is blocking the sync. - connect(_engine.data(), SIGNAL(aboutToRemoveAllFiles(SyncFileItem::Direction, bool *)), - SLOT(slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool *))); - connect(_engine.data(), SIGNAL(aboutToRestoreBackup(bool *)), - SLOT(slotAboutToRestoreBackup(bool *))); - connect(_engine.data(), SIGNAL(transmissionProgress(ProgressInfo)), this, SLOT(slotTransmissionProgress(ProgressInfo))); - connect(_engine.data(), SIGNAL(itemCompleted(const SyncFileItemPtr &)), - this, SLOT(slotItemCompleted(const SyncFileItemPtr &))); - connect(_engine.data(), SIGNAL(newBigFolder(QString, bool)), - this, SLOT(slotNewBigFolderDiscovered(QString, bool))); - connect(_engine.data(), SIGNAL(seenLockedFile(QString)), FolderMan::instance(), SLOT(slotSyncOnceFileUnlocks(QString))); - connect(_engine.data(), SIGNAL(aboutToPropagate(SyncFileItemVector &)), - SLOT(slotLogPropagationStart())); + connect(_engine.data(), &SyncEngine::aboutToRemoveAllFiles, + this, &Folder::slotAboutToRemoveAllFiles); + connect(_engine.data(), &SyncEngine::aboutToRestoreBackup, + this, &Folder::slotAboutToRestoreBackup); + connect(_engine.data(), &SyncEngine::transmissionProgress, this, &Folder::slotTransmissionProgress); + connect(_engine.data(), &SyncEngine::itemCompleted, + this, &Folder::slotItemCompleted); + connect(_engine.data(), &SyncEngine::newBigFolder, + this, &Folder::slotNewBigFolderDiscovered); + connect(_engine.data(), &SyncEngine::seenLockedFile, FolderMan::instance(), &FolderMan::slotSyncOnceFileUnlocks); + connect(_engine.data(), &SyncEngine::aboutToPropagate, + this, &Folder::slotLogPropagationStart); connect(_engine.data(), &SyncEngine::syncError, this, &Folder::slotSyncError); _scheduleSelfTimer.setSingleShot(true); _scheduleSelfTimer.setInterval(SyncEngine::minimumFileAgeForUpload); - connect(&_scheduleSelfTimer, SIGNAL(timeout()), - SLOT(slotScheduleThisFolder())); + connect(&_scheduleSelfTimer, &QTimer::timeout, + this, &Folder::slotScheduleThisFolder); } Folder::~Folder() @@ -288,7 +288,7 @@ void Folder::slotRunEtagJob() _requestEtagJob = new RequestEtagJob(account, remotePath(), this); _requestEtagJob->setTimeout(60 * 1000); // check if the etag is different when retrieved - QObject::connect(_requestEtagJob, SIGNAL(etagRetreived(QString)), this, SLOT(etagRetreived(QString))); + QObject::connect(_requestEtagJob.data(), &RequestEtagJob::etagRetreived, this, &Folder::etagRetreived); FolderMan::instance()->slotScheduleETagJob(alias(), _requestEtagJob); // The _requestEtagJob is auto deleting itself on finish. Our guard pointer _requestEtagJob will then be null. } @@ -789,7 +789,7 @@ void Folder::slotSyncFinished(bool success) // file system change notifications are ignored for that folder. And it takes // some time under certain conditions to make the file system notifications // all come in. - QTimer::singleShot(200, this, SLOT(slotEmitFinishedDelayed())); + QTimer::singleShot(200, this, &Folder::slotEmitFinishedDelayed); _lastSyncDuration = _timeSinceLastSyncStart.elapsed(); _timeSinceLastSyncDone.start(); diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index 475eb4f1a..6418cd70b 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -60,24 +60,24 @@ FolderMan::FolderMan(QObject *parent) int polltime = cfg.remotePollInterval(); qCInfo(lcFolderMan) << "setting remote poll timer interval to" << polltime << "msec"; _etagPollTimer.setInterval(polltime); - QObject::connect(&_etagPollTimer, SIGNAL(timeout()), this, SLOT(slotEtagPollTimerTimeout())); + QObject::connect(&_etagPollTimer, &QTimer::timeout, this, &FolderMan::slotEtagPollTimerTimeout); _etagPollTimer.start(); _startScheduledSyncTimer.setSingleShot(true); - connect(&_startScheduledSyncTimer, SIGNAL(timeout()), - SLOT(slotStartScheduledFolderSync())); + connect(&_startScheduledSyncTimer, &QTimer::timeout, + this, &FolderMan::slotStartScheduledFolderSync); _timeScheduler.setInterval(5000); _timeScheduler.setSingleShot(false); - connect(&_timeScheduler, SIGNAL(timeout()), - SLOT(slotScheduleFolderByTime())); + connect(&_timeScheduler, &QTimer::timeout, + this, &FolderMan::slotScheduleFolderByTime); _timeScheduler.start(); - connect(AccountManager::instance(), SIGNAL(accountRemoved(AccountState *)), - SLOT(slotRemoveFoldersForAccount(AccountState *))); + connect(AccountManager::instance(), &AccountManager::accountRemoved, + this, &FolderMan::slotRemoveFoldersForAccount); - connect(_lockWatcher.data(), SIGNAL(fileUnlocked(QString)), - SLOT(slotWatchedFileUnlocked(QString))); + connect(_lockWatcher.data(), &LockWatcher::fileUnlocked, + this, &FolderMan::slotWatchedFileUnlocked); } FolderMan *FolderMan::instance() @@ -109,18 +109,18 @@ void FolderMan::unloadFolder(Folder *f) } _folderMap.remove(f->alias()); - disconnect(f, SIGNAL(syncStarted()), - this, SLOT(slotFolderSyncStarted())); - disconnect(f, SIGNAL(syncFinished(SyncResult)), - this, SLOT(slotFolderSyncFinished(SyncResult))); - disconnect(f, SIGNAL(syncStateChange()), - this, SLOT(slotForwardFolderSyncStateChange())); - disconnect(f, SIGNAL(syncPausedChanged(Folder *, bool)), - this, SLOT(slotFolderSyncPaused(Folder *, bool))); + disconnect(f, &Folder::syncStarted, + this, &FolderMan::slotFolderSyncStarted); + disconnect(f, &Folder::syncFinished, + this, &FolderMan::slotFolderSyncFinished); + disconnect(f, &Folder::syncStateChange, + this, &FolderMan::slotForwardFolderSyncStateChange); + disconnect(f, &Folder::syncPausedChanged, + this, &FolderMan::slotFolderSyncPaused); disconnect(&f->syncEngine().syncFileStatusTracker(), SIGNAL(fileStatusChanged(const QString &, SyncFileStatus)), _socketApi.data(), SLOT(broadcastStatusPushMessage(const QString &, SyncFileStatus))); - disconnect(f, SIGNAL(watchedFileChangedExternally(QString)), - &f->syncEngine().syncFileStatusTracker(), SLOT(slotPathTouched(QString))); + disconnect(f, &Folder::watchedFileChangedExternally, + &f->syncEngine().syncFileStatusTracker(), &SyncFileStatusTracker::slotPathTouched); } int FolderMan::unloadAndDeleteAllFolders() @@ -163,7 +163,7 @@ void FolderMan::registerFolderMonitor(Folder *folder) // Connect the pathChanged signal, which comes with the changed path, // to the signal mapper which maps to the folder alias. The changed path // is lost this way, but we do not need it for the current implementation. - connect(fw, SIGNAL(pathChanged(QString)), folder, SLOT(slotWatchedPathChanged(QString))); + connect(fw, &FolderWatcher::pathChanged, folder, &Folder::slotWatchedPathChanged); _folderWatchers.insert(folder->alias(), fw); } @@ -584,7 +584,7 @@ void FolderMan::scheduleFolderNext(Folder *f) void FolderMan::slotScheduleETagJob(const QString & /*alias*/, RequestEtagJob *job) { - QObject::connect(job, SIGNAL(destroyed(QObject *)), this, SLOT(slotEtagJobDestroyed(QObject *))); + QObject::connect(job, &QObject::destroyed, this, &FolderMan::slotEtagJobDestroyed); QMetaObject::invokeMethod(this, "slotRunOneEtagJob", Qt::QueuedConnection); // maybe: add to queue } @@ -954,15 +954,15 @@ Folder *FolderMan::addFolderInternal(FolderDefinition folderDefinition, } // See matching disconnects in unloadFolder(). - connect(folder, SIGNAL(syncStarted()), SLOT(slotFolderSyncStarted())); - connect(folder, SIGNAL(syncFinished(SyncResult)), SLOT(slotFolderSyncFinished(SyncResult))); - connect(folder, SIGNAL(syncStateChange()), SLOT(slotForwardFolderSyncStateChange())); - connect(folder, SIGNAL(syncPausedChanged(Folder *, bool)), SLOT(slotFolderSyncPaused(Folder *, bool))); - connect(folder, SIGNAL(canSyncChanged()), SLOT(slotFolderCanSyncChanged())); + connect(folder, &Folder::syncStarted, this, &FolderMan::slotFolderSyncStarted); + connect(folder, &Folder::syncFinished, this, &FolderMan::slotFolderSyncFinished); + connect(folder, &Folder::syncStateChange, this, &FolderMan::slotForwardFolderSyncStateChange); + connect(folder, &Folder::syncPausedChanged, this, &FolderMan::slotFolderSyncPaused); + connect(folder, &Folder::canSyncChanged, this, &FolderMan::slotFolderCanSyncChanged); connect(&folder->syncEngine().syncFileStatusTracker(), SIGNAL(fileStatusChanged(const QString &, SyncFileStatus)), _socketApi.data(), SLOT(broadcastStatusPushMessage(const QString &, SyncFileStatus))); - connect(folder, SIGNAL(watchedFileChangedExternally(QString)), - &folder->syncEngine().syncFileStatusTracker(), SLOT(slotPathTouched(QString))); + connect(folder, &Folder::watchedFileChangedExternally, + &folder->syncEngine().syncFileStatusTracker(), &SyncFileStatusTracker::slotPathTouched); registerFolderMonitor(folder); return folder; @@ -1032,10 +1032,10 @@ void FolderMan::removeFolder(Folder *f) unloadFolder(f); if (currentlyRunning) { // We want to schedule the next folder once this is done - connect(f, SIGNAL(syncFinished(SyncResult)), - SLOT(slotFolderSyncFinished(SyncResult))); + connect(f, &Folder::syncFinished, + this, &FolderMan::slotFolderSyncFinished); // Let the folder delete itself when done. - connect(f, SIGNAL(syncFinished(SyncResult)), f, SLOT(deleteLater())); + connect(f, &Folder::syncFinished, f, &QObject::deleteLater); } else { delete f; } diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index d0c48eddc..0c593ebdb 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -67,10 +67,10 @@ void FolderStatusModel::setAccountState(const AccountState *accountState) _folders.clear(); _accountState = accountState; - connect(FolderMan::instance(), SIGNAL(folderSyncStateChange(Folder *)), - SLOT(slotFolderSyncStateChange(Folder *)), Qt::UniqueConnection); - connect(FolderMan::instance(), SIGNAL(scheduleQueueChanged()), - SLOT(slotFolderScheduleQueueChanged()), Qt::UniqueConnection); + connect(FolderMan::instance(), &FolderMan::folderSyncStateChange, + this, &FolderStatusModel::slotFolderSyncStateChange, Qt::UniqueConnection); + connect(FolderMan::instance(), &FolderMan::scheduleQueueChanged, + this, &FolderStatusModel::slotFolderScheduleQueueChanged, Qt::UniqueConnection); auto folders = FolderMan::instance()->map(); foreach (auto f, folders) { @@ -85,8 +85,8 @@ void FolderStatusModel::setAccountState(const AccountState *accountState) info._checked = Qt::PartiallyChecked; _folders << info; - connect(f, SIGNAL(progressInfo(ProgressInfo)), this, SLOT(slotSetProgress(ProgressInfo)), Qt::UniqueConnection); - connect(f, SIGNAL(newBigFolderDiscovered(QString)), this, SLOT(slotNewBigFolder()), Qt::UniqueConnection); + connect(f, &Folder::progressInfo, this, &FolderStatusModel::slotSetProgress, Qt::UniqueConnection); + connect(f, &Folder::newBigFolderDiscovered, this, &FolderStatusModel::slotNewBigFolder, Qt::UniqueConnection); } // Sort by header text @@ -556,12 +556,12 @@ void FolderStatusModel::fetchMore(const QModelIndex &parent) << "http://owncloud.org/ns:size" << "http://owncloud.org/ns:permissions"); job->setTimeout(60 * 1000); - connect(job, SIGNAL(directoryListingSubfolders(QStringList)), - SLOT(slotUpdateDirectories(QStringList))); - connect(job, SIGNAL(finishedWithError(QNetworkReply *)), - this, SLOT(slotLscolFinishedWithError(QNetworkReply *))); - connect(job, SIGNAL(directoryListingIterated(const QString &, const QMap &)), - this, SLOT(slotGatherPermissions(const QString &, const QMap &))); + connect(job, &LsColJob::directoryListingSubfolders, + this, &FolderStatusModel::slotUpdateDirectories); + connect(job, &LsColJob::finishedWithError, + this, &FolderStatusModel::slotLscolFinishedWithError); + connect(job, &LsColJob::directoryListingIterated, + this, &FolderStatusModel::slotGatherPermissions); job->start(); @@ -570,7 +570,7 @@ void FolderStatusModel::fetchMore(const QModelIndex &parent) // Show 'fetching data...' hint after a while. _fetchingItems[persistentIndex].start(); - QTimer::singleShot(1000, this, SLOT(slotShowFetchProgress())); + QTimer::singleShot(1000, this, &FolderStatusModel::slotShowFetchProgress); } void FolderStatusModel::slotGatherPermissions(const QString &href, const QMap &map) diff --git a/src/gui/folderwatcher_linux.cpp b/src/gui/folderwatcher_linux.cpp index 5d2d4e7fd..f0e0eb0e4 100644 --- a/src/gui/folderwatcher_linux.cpp +++ b/src/gui/folderwatcher_linux.cpp @@ -34,7 +34,7 @@ FolderWatcherPrivate::FolderWatcherPrivate(FolderWatcher *p, const QString &path _fd = inotify_init(); if (_fd != -1) { _socket.reset(new QSocketNotifier(_fd, QSocketNotifier::Read)); - connect(_socket.data(), SIGNAL(activated(int)), SLOT(slotReceivedNotification(int))); + connect(_socket.data(), &QSocketNotifier::activated, this, &FolderWatcherPrivate::slotReceivedNotification); } else { qCWarning(lcFolderWatcher) << "notify_init() failed: " << strerror(errno); } diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp index 9c0128f59..2a244badd 100644 --- a/src/gui/folderwizard.cpp +++ b/src/gui/folderwizard.cpp @@ -62,7 +62,7 @@ FolderWizardLocalPath::FolderWizardLocalPath(const AccountPtr &account) { _ui.setupUi(this); registerField(QLatin1String("sourceFolder*"), _ui.localFolderLineEdit); - connect(_ui.localFolderChooseBtn, SIGNAL(clicked()), this, SLOT(slotChooseLocalFolder())); + connect(_ui.localFolderChooseBtn, &QAbstractButton::clicked, this, &FolderWizardLocalPath::slotChooseLocalFolder); _ui.localFolderChooseBtn->setToolTip(tr("Click to select a local folder to sync.")); QString defaultPath = QDir::homePath() + QLatin1Char('/') + Theme::instance()->appName(); @@ -151,15 +151,15 @@ FolderWizardRemotePath::FolderWizardRemotePath(const AccountPtr &account) _ui.folderTreeWidget->setSortingEnabled(true); _ui.folderTreeWidget->sortByColumn(0, Qt::AscendingOrder); - connect(_ui.addFolderButton, SIGNAL(clicked()), SLOT(slotAddRemoteFolder())); - connect(_ui.refreshButton, SIGNAL(clicked()), SLOT(slotRefreshFolders())); - connect(_ui.folderTreeWidget, SIGNAL(itemExpanded(QTreeWidgetItem *)), SLOT(slotItemExpanded(QTreeWidgetItem *))); - connect(_ui.folderTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), SLOT(slotCurrentItemChanged(QTreeWidgetItem *))); - connect(_ui.folderEntry, SIGNAL(textEdited(QString)), SLOT(slotFolderEntryEdited(QString))); + connect(_ui.addFolderButton, &QAbstractButton::clicked, this, &FolderWizardRemotePath::slotAddRemoteFolder); + connect(_ui.refreshButton, &QAbstractButton::clicked, this, &FolderWizardRemotePath::slotRefreshFolders); + connect(_ui.folderTreeWidget, &QTreeWidget::itemExpanded, this, &FolderWizardRemotePath::slotItemExpanded); + connect(_ui.folderTreeWidget, &QTreeWidget::currentItemChanged, this, &FolderWizardRemotePath::slotCurrentItemChanged); + connect(_ui.folderEntry, &QLineEdit::textEdited, this, &FolderWizardRemotePath::slotFolderEntryEdited); _lscolTimer.setInterval(500); _lscolTimer.setSingleShot(true); - connect(&_lscolTimer, SIGNAL(timeout()), SLOT(slotLsColFolderEntry())); + connect(&_lscolTimer, &QTimer::timeout, this, &FolderWizardRemotePath::slotLsColFolderEntry); _ui.folderTreeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); // Make sure that there will be a scrollbar when the contents is too wide @@ -200,7 +200,7 @@ void FolderWizardRemotePath::slotCreateRemoteFolder(const QString &folder) /* check the owncloud configuration file and query the ownCloud */ connect(job, SIGNAL(finished(QNetworkReply::NetworkError)), SLOT(slotCreateRemoteFolderFinished(QNetworkReply::NetworkError))); - connect(job, SIGNAL(networkError(QNetworkReply *)), SLOT(slotHandleMkdirNetworkError(QNetworkReply *))); + connect(job, &AbstractNetworkJob::networkError, this, &FolderWizardRemotePath::slotHandleMkdirNetworkError); job->start(); } @@ -373,10 +373,10 @@ void FolderWizardRemotePath::slotLsColFolderEntry() // No error handling, no updating, we do this manually // because of extra logic in the typed-path case. disconnect(job, 0, this, 0); - connect(job, SIGNAL(finishedWithError(QNetworkReply *)), - SLOT(slotTypedPathError(QNetworkReply *))); - connect(job, SIGNAL(directoryListingSubfolders(QStringList)), - SLOT(slotTypedPathFound(QStringList))); + connect(job, &LsColJob::finishedWithError, + this, &FolderWizardRemotePath::slotTypedPathError); + connect(job, &LsColJob::directoryListingSubfolders, + this, &FolderWizardRemotePath::slotTypedPathFound); } void FolderWizardRemotePath::slotTypedPathFound(const QStringList &subpaths) @@ -404,10 +404,10 @@ LsColJob *FolderWizardRemotePath::runLsColJob(const QString &path) { LsColJob *job = new LsColJob(_account, path, this); job->setProperties(QList() << "resourcetype"); - connect(job, SIGNAL(directoryListingSubfolders(QStringList)), - SLOT(slotUpdateDirectories(QStringList))); - connect(job, SIGNAL(finishedWithError(QNetworkReply *)), - SLOT(slotHandleLsColNetworkError(QNetworkReply *))); + connect(job, &LsColJob::directoryListingSubfolders, + this, &FolderWizardRemotePath::slotUpdateDirectories); + connect(job, &LsColJob::finishedWithError, + this, &FolderWizardRemotePath::slotHandleLsColNetworkError); job->start(); return job; diff --git a/src/gui/generalsettings.cpp b/src/gui/generalsettings.cpp index d298b6cae..5a035c4c2 100644 --- a/src/gui/generalsettings.cpp +++ b/src/gui/generalsettings.cpp @@ -42,11 +42,11 @@ GeneralSettings::GeneralSettings(QWidget *parent) { _ui->setupUi(this); - connect(_ui->desktopNotificationsCheckBox, SIGNAL(toggled(bool)), - SLOT(slotToggleOptionalDesktopNotifications(bool))); + connect(_ui->desktopNotificationsCheckBox, &QAbstractButton::toggled, + this, &GeneralSettings::slotToggleOptionalDesktopNotifications); _ui->autostartCheckBox->setChecked(Utility::hasLaunchOnStartup(Theme::instance()->appName())); - connect(_ui->autostartCheckBox, SIGNAL(toggled(bool)), SLOT(slotToggleLaunchOnStartup(bool))); + connect(_ui->autostartCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::slotToggleLaunchOnStartup); // setup about section QString about = Theme::instance()->about(); @@ -63,11 +63,11 @@ GeneralSettings::GeneralSettings(QWidget *parent) slotUpdateInfo(); // misc - connect(_ui->monoIconsCheckBox, SIGNAL(toggled(bool)), SLOT(saveMiscSettings())); - connect(_ui->crashreporterCheckBox, SIGNAL(toggled(bool)), SLOT(saveMiscSettings())); - connect(_ui->newFolderLimitCheckBox, SIGNAL(toggled(bool)), SLOT(saveMiscSettings())); + connect(_ui->monoIconsCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings); + connect(_ui->crashreporterCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings); + connect(_ui->newFolderLimitCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings); connect(_ui->newFolderLimitSpinBox, SIGNAL(valueChanged(int)), SLOT(saveMiscSettings())); - connect(_ui->newExternalStorage, SIGNAL(toggled(bool)), SLOT(saveMiscSettings())); + connect(_ui->newExternalStorage, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings); #ifndef WITH_CRASHREPORTER _ui->crashreporterCheckBox->setVisible(false); @@ -84,10 +84,10 @@ GeneralSettings::GeneralSettings(QWidget *parent) // is no point in offering an option _ui->monoIconsCheckBox->setVisible(Theme::instance()->monoIconsAvailable()); - connect(_ui->ignoredFilesButton, SIGNAL(clicked()), SLOT(slotIgnoreFilesEditor())); + connect(_ui->ignoredFilesButton, &QAbstractButton::clicked, this, &GeneralSettings::slotIgnoreFilesEditor); // accountAdded means the wizard was finished and the wizard might change some options. - connect(AccountManager::instance(), SIGNAL(accountAdded(AccountState *)), this, SLOT(loadMiscSettings())); + connect(AccountManager::instance(), &AccountManager::accountAdded, this, &GeneralSettings::loadMiscSettings); } GeneralSettings::~GeneralSettings() @@ -124,8 +124,8 @@ void GeneralSettings::slotUpdateInfo() } if (updater) { - connect(updater, SIGNAL(downloadStateChanged()), SLOT(slotUpdateInfo()), Qt::UniqueConnection); - connect(_ui->restartButton, SIGNAL(clicked()), updater, SLOT(slotStartInstaller()), Qt::UniqueConnection); + connect(updater, &OCUpdater::downloadStateChanged, this, &GeneralSettings::slotUpdateInfo, Qt::UniqueConnection); + connect(_ui->restartButton, &QAbstractButton::clicked, updater, &OCUpdater::slotStartInstaller, Qt::UniqueConnection); connect(_ui->restartButton, SIGNAL(clicked()), qApp, SLOT(quit()), Qt::UniqueConnection); _ui->updateStateLabel->setText(updater->statusString()); _ui->restartButton->setVisible(updater->downloadState() == OCUpdater::DownloadComplete); diff --git a/src/gui/ignorelisteditor.cpp b/src/gui/ignorelisteditor.cpp index 3253b2b1e..a71a9cde8 100644 --- a/src/gui/ignorelisteditor.cpp +++ b/src/gui/ignorelisteditor.cpp @@ -54,11 +54,11 @@ IgnoreListEditor::IgnoreListEditor(QWidget *parent) readIgnoreFile(cfgFile.excludeFile(ConfigFile::SystemScope), true); readIgnoreFile(cfgFile.excludeFile(ConfigFile::UserScope), false); - connect(this, SIGNAL(accepted()), SLOT(slotUpdateLocalIgnoreList())); + connect(this, &QDialog::accepted, this, &IgnoreListEditor::slotUpdateLocalIgnoreList); ui->removePushButton->setEnabled(false); - connect(ui->tableWidget, SIGNAL(itemSelectionChanged()), SLOT(slotItemSelectionChanged())); - connect(ui->removePushButton, SIGNAL(clicked()), SLOT(slotRemoveCurrentItem())); - connect(ui->addPushButton, SIGNAL(clicked()), SLOT(slotAddPattern())); + connect(ui->tableWidget, &QTableWidget::itemSelectionChanged, this, &IgnoreListEditor::slotItemSelectionChanged); + connect(ui->removePushButton, &QAbstractButton::clicked, this, &IgnoreListEditor::slotRemoveCurrentItem); + connect(ui->addPushButton, &QAbstractButton::clicked, this, &IgnoreListEditor::slotAddPattern); ui->tableWidget->resizeColumnsToContents(); ui->tableWidget->horizontalHeader()->setResizeMode(patternCol, QHeaderView::Stretch); diff --git a/src/gui/issueswidget.cpp b/src/gui/issueswidget.cpp index 40f2822b7..267098541 100644 --- a/src/gui/issueswidget.cpp +++ b/src/gui/issueswidget.cpp @@ -44,30 +44,30 @@ IssuesWidget::IssuesWidget(QWidget *parent) { _ui->setupUi(this); - connect(ProgressDispatcher::instance(), SIGNAL(progressInfo(QString, ProgressInfo)), - this, SLOT(slotProgressInfo(QString, ProgressInfo))); - connect(ProgressDispatcher::instance(), SIGNAL(itemCompleted(QString, SyncFileItemPtr)), - this, SLOT(slotItemCompleted(QString, SyncFileItemPtr))); + connect(ProgressDispatcher::instance(), &ProgressDispatcher::progressInfo, + this, &IssuesWidget::slotProgressInfo); + connect(ProgressDispatcher::instance(), &ProgressDispatcher::itemCompleted, + this, &IssuesWidget::slotItemCompleted); connect(ProgressDispatcher::instance(), &ProgressDispatcher::syncError, this, &IssuesWidget::addError); - connect(_ui->_treeWidget, SIGNAL(itemActivated(QTreeWidgetItem *, int)), SLOT(slotOpenFile(QTreeWidgetItem *, int))); - connect(_ui->copyIssuesButton, SIGNAL(clicked()), SIGNAL(copyToClipboard())); + connect(_ui->_treeWidget, &QTreeWidget::itemActivated, this, &IssuesWidget::slotOpenFile); + connect(_ui->copyIssuesButton, &QAbstractButton::clicked, this, &IssuesWidget::copyToClipboard); - connect(_ui->showIgnores, SIGNAL(toggled(bool)), SLOT(slotRefreshIssues())); - connect(_ui->showWarnings, SIGNAL(toggled(bool)), SLOT(slotRefreshIssues())); + connect(_ui->showIgnores, &QAbstractButton::toggled, this, &IssuesWidget::slotRefreshIssues); + connect(_ui->showWarnings, &QAbstractButton::toggled, this, &IssuesWidget::slotRefreshIssues); connect(_ui->filterAccount, SIGNAL(currentIndexChanged(int)), SLOT(slotRefreshIssues())); connect(_ui->filterAccount, SIGNAL(currentIndexChanged(int)), SLOT(slotUpdateFolderFilters())); connect(_ui->filterFolder, SIGNAL(currentIndexChanged(int)), SLOT(slotRefreshIssues())); for (auto account : AccountManager::instance()->accounts()) { slotAccountAdded(account.data()); } - connect(AccountManager::instance(), SIGNAL(accountAdded(AccountState *)), - SLOT(slotAccountAdded(AccountState *))); - connect(AccountManager::instance(), SIGNAL(accountRemoved(AccountState *)), - SLOT(slotAccountRemoved(AccountState *))); - connect(FolderMan::instance(), SIGNAL(folderListChanged(Folder::Map)), - SLOT(slotUpdateFolderFilters())); + connect(AccountManager::instance(), &AccountManager::accountAdded, + this, &IssuesWidget::slotAccountAdded); + connect(AccountManager::instance(), &AccountManager::accountRemoved, + this, &IssuesWidget::slotAccountRemoved); + connect(FolderMan::instance(), &FolderMan::folderListChanged, + this, &IssuesWidget::slotUpdateFolderFilters); // Adjust copyToClipboard() when making changes here! diff --git a/src/gui/lockwatcher.cpp b/src/gui/lockwatcher.cpp index da83744a9..cf76c097b 100644 --- a/src/gui/lockwatcher.cpp +++ b/src/gui/lockwatcher.cpp @@ -27,8 +27,8 @@ static const int check_frequency = 20 * 1000; // ms LockWatcher::LockWatcher(QObject *parent) : QObject(parent) { - connect(&_timer, SIGNAL(timeout()), - SLOT(checkFiles())); + connect(&_timer, &QTimer::timeout, + this, &LockWatcher::checkFiles); _timer.start(check_frequency); } diff --git a/src/gui/logbrowser.cpp b/src/gui/logbrowser.cpp index 41b526a3c..a7303b0f0 100644 --- a/src/gui/logbrowser.cpp +++ b/src/gui/logbrowser.cpp @@ -76,7 +76,7 @@ LogBrowser::LogBrowser(QWidget *parent) // find button QPushButton *findBtn = new QPushButton; findBtn->setText(tr("&Find")); - connect(findBtn, SIGNAL(clicked()), this, SLOT(slotFind())); + connect(findBtn, &QAbstractButton::clicked, this, &LogBrowser::slotFind); toolLayout->addWidget(findBtn); // stretch @@ -87,12 +87,12 @@ LogBrowser::LogBrowser(QWidget *parent) // Debug logging _logDebugCheckBox = new QCheckBox(tr("&Capture debug messages") + " "); - connect(_logDebugCheckBox, SIGNAL(stateChanged(int)), SLOT(slotDebugCheckStateChanged(int))); + connect(_logDebugCheckBox, &QCheckBox::stateChanged, this, &LogBrowser::slotDebugCheckStateChanged); toolLayout->addWidget(_logDebugCheckBox); QDialogButtonBox *btnbox = new QDialogButtonBox; QPushButton *closeBtn = btnbox->addButton(QDialogButtonBox::Close); - connect(closeBtn, SIGNAL(clicked()), this, SLOT(close())); + connect(closeBtn, &QAbstractButton::clicked, this, &QWidget::close); mainLayout->addWidget(btnbox); @@ -101,14 +101,14 @@ LogBrowser::LogBrowser(QWidget *parent) _clearBtn->setText(tr("Clear")); _clearBtn->setToolTip(tr("Clear the log display.")); btnbox->addButton(_clearBtn, QDialogButtonBox::ActionRole); - connect(_clearBtn, SIGNAL(clicked()), this, SLOT(slotClearLog())); + connect(_clearBtn, &QAbstractButton::clicked, this, &LogBrowser::slotClearLog); // save Button _saveBtn = new QPushButton; _saveBtn->setText(tr("S&ave")); _saveBtn->setToolTip(tr("Save the log file to a file on disk for debugging.")); btnbox->addButton(_saveBtn, QDialogButtonBox::ActionRole); - connect(_saveBtn, SIGNAL(clicked()), this, SLOT(slotSave())); + connect(_saveBtn, &QAbstractButton::clicked, this, &LogBrowser::slotSave); setLayout(mainLayout); @@ -116,11 +116,11 @@ LogBrowser::LogBrowser(QWidget *parent) Logger::instance()->setLogWindowActivated(true); // Direct connection for log coming from this thread, and queued for the one in a different thread - connect(Logger::instance(), SIGNAL(logWindowLog(QString)), this, SLOT(slotNewLog(QString)), Qt::AutoConnection); + connect(Logger::instance(), &Logger::logWindowLog, this, &LogBrowser::slotNewLog, Qt::AutoConnection); QAction *showLogWindow = new QAction(this); showLogWindow->setShortcut(QKeySequence("F12")); - connect(showLogWindow, SIGNAL(triggered()), SLOT(close())); + connect(showLogWindow, &QAction::triggered, this, &QWidget::close); addAction(showLogWindow); ConfigFile cfg; diff --git a/src/gui/networksettings.cpp b/src/gui/networksettings.cpp index b135bbea2..eb19f7193 100644 --- a/src/gui/networksettings.cpp +++ b/src/gui/networksettings.cpp @@ -45,13 +45,13 @@ NetworkSettings::NetworkSettings(QWidget *parent) _ui->userLineEdit->setEnabled(true); _ui->passwordLineEdit->setEnabled(true); _ui->authWidgets->setEnabled(_ui->authRequiredcheckBox->isChecked()); - connect(_ui->authRequiredcheckBox, SIGNAL(toggled(bool)), - _ui->authWidgets, SLOT(setEnabled(bool))); + connect(_ui->authRequiredcheckBox, &QAbstractButton::toggled, + _ui->authWidgets, &QWidget::setEnabled); - connect(_ui->manualProxyRadioButton, SIGNAL(toggled(bool)), - _ui->manualSettings, SLOT(setEnabled(bool))); - connect(_ui->manualProxyRadioButton, SIGNAL(toggled(bool)), - _ui->typeComboBox, SLOT(setEnabled(bool))); + connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled, + _ui->manualSettings, &QWidget::setEnabled); + connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled, + _ui->typeComboBox, &QWidget::setEnabled); loadProxySettings(); loadBWLimitSettings(); @@ -59,18 +59,18 @@ NetworkSettings::NetworkSettings(QWidget *parent) // proxy connect(_ui->typeComboBox, SIGNAL(currentIndexChanged(int)), SLOT(saveProxySettings())); connect(_ui->proxyButtonGroup, SIGNAL(buttonClicked(int)), SLOT(saveProxySettings())); - connect(_ui->hostLineEdit, SIGNAL(editingFinished()), SLOT(saveProxySettings())); - connect(_ui->userLineEdit, SIGNAL(editingFinished()), SLOT(saveProxySettings())); - connect(_ui->passwordLineEdit, SIGNAL(editingFinished()), SLOT(saveProxySettings())); - connect(_ui->portSpinBox, SIGNAL(editingFinished()), SLOT(saveProxySettings())); - connect(_ui->authRequiredcheckBox, SIGNAL(toggled(bool)), SLOT(saveProxySettings())); - - connect(_ui->uploadLimitRadioButton, SIGNAL(clicked()), SLOT(saveBWLimitSettings())); - connect(_ui->noUploadLimitRadioButton, SIGNAL(clicked()), SLOT(saveBWLimitSettings())); - connect(_ui->autoUploadLimitRadioButton, SIGNAL(clicked()), SLOT(saveBWLimitSettings())); - connect(_ui->downloadLimitRadioButton, SIGNAL(clicked()), SLOT(saveBWLimitSettings())); - connect(_ui->noDownloadLimitRadioButton, SIGNAL(clicked()), SLOT(saveBWLimitSettings())); - connect(_ui->autoDownloadLimitRadioButton, SIGNAL(clicked()), SLOT(saveBWLimitSettings())); + connect(_ui->hostLineEdit, &QLineEdit::editingFinished, this, &NetworkSettings::saveProxySettings); + connect(_ui->userLineEdit, &QLineEdit::editingFinished, this, &NetworkSettings::saveProxySettings); + connect(_ui->passwordLineEdit, &QLineEdit::editingFinished, this, &NetworkSettings::saveProxySettings); + connect(_ui->portSpinBox, &QAbstractSpinBox::editingFinished, this, &NetworkSettings::saveProxySettings); + connect(_ui->authRequiredcheckBox, &QAbstractButton::toggled, this, &NetworkSettings::saveProxySettings); + + connect(_ui->uploadLimitRadioButton, &QAbstractButton::clicked, this, &NetworkSettings::saveBWLimitSettings); + connect(_ui->noUploadLimitRadioButton, &QAbstractButton::clicked, this, &NetworkSettings::saveBWLimitSettings); + connect(_ui->autoUploadLimitRadioButton, &QAbstractButton::clicked, this, &NetworkSettings::saveBWLimitSettings); + connect(_ui->downloadLimitRadioButton, &QAbstractButton::clicked, this, &NetworkSettings::saveBWLimitSettings); + connect(_ui->noDownloadLimitRadioButton, &QAbstractButton::clicked, this, &NetworkSettings::saveBWLimitSettings); + connect(_ui->autoDownloadLimitRadioButton, &QAbstractButton::clicked, this, &NetworkSettings::saveBWLimitSettings); connect(_ui->downloadSpinBox, SIGNAL(valueChanged(int)), SLOT(saveBWLimitSettings())); connect(_ui->uploadSpinBox, SIGNAL(valueChanged(int)), SLOT(saveBWLimitSettings())); } diff --git a/src/gui/notificationwidget.cpp b/src/gui/notificationwidget.cpp index bcada1075..dbf8c18ff 100644 --- a/src/gui/notificationwidget.cpp +++ b/src/gui/notificationwidget.cpp @@ -66,13 +66,13 @@ void NotificationWidget::setActivity(const Activity &activity) // in case there is no action defined, do a close button. QPushButton *b = _ui._buttonBox->addButton(QDialogButtonBox::Close); b->setDefault(true); - connect(b, SIGNAL(clicked()), this, SLOT(slotButtonClicked())); + connect(b, &QAbstractButton::clicked, this, &NotificationWidget::slotButtonClicked); _buttons.append(b); } else { foreach (auto link, activity._links) { QPushButton *b = _ui._buttonBox->addButton(link._label, QDialogButtonBox::AcceptRole); b->setDefault(link._isPrimary); - connect(b, SIGNAL(clicked()), this, SLOT(slotButtonClicked())); + connect(b, &QAbstractButton::clicked, this, &NotificationWidget::slotButtonClicked); _buttons.append(b); } } diff --git a/src/gui/ocsshareejob.cpp b/src/gui/ocsshareejob.cpp index b359201c0..40bb70d91 100644 --- a/src/gui/ocsshareejob.cpp +++ b/src/gui/ocsshareejob.cpp @@ -20,7 +20,7 @@ OcsShareeJob::OcsShareeJob(AccountPtr account) : OcsJob(account) { setPath("ocs/v1.php/apps/files_sharing/api/v1/sharees"); - connect(this, SIGNAL(jobFinished(QJsonDocument)), SLOT(jobDone(QJsonDocument))); + connect(this, &OcsJob::jobFinished, this, &OcsShareeJob::jobDone); } void OcsShareeJob::getSharees(const QString &search, diff --git a/src/gui/ocssharejob.cpp b/src/gui/ocssharejob.cpp index 9b93ee99f..520225461 100644 --- a/src/gui/ocssharejob.cpp +++ b/src/gui/ocssharejob.cpp @@ -25,7 +25,7 @@ OcsShareJob::OcsShareJob(AccountPtr account) : OcsJob(account) { setPath("ocs/v1.php/apps/files_sharing/api/v1/shares"); - connect(this, SIGNAL(jobFinished(QJsonDocument)), this, SLOT(jobDone(QJsonDocument))); + connect(this, &OcsJob::jobFinished, this, &OcsShareJob::jobDone); } void OcsShareJob::getShares(const QString &path) diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index 225cbf3b3..ad9b7bf9d 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -70,8 +70,8 @@ ownCloudGui::ownCloudGui(Application *parent) // for the beginning, set the offline icon until the account was verified _tray->setIcon(Theme::instance()->folderOfflineIcon(/*systray?*/ true, /*currently visible?*/ false)); - connect(_tray.data(), SIGNAL(activated(QSystemTrayIcon::ActivationReason)), - SLOT(slotTrayClicked(QSystemTrayIcon::ActivationReason))); + connect(_tray.data(), &QSystemTrayIcon::activated, + this, &ownCloudGui::slotTrayClicked); setupActions(); setupContextMenu(); @@ -79,24 +79,24 @@ ownCloudGui::ownCloudGui(Application *parent) _tray->show(); ProgressDispatcher *pd = ProgressDispatcher::instance(); - connect(pd, SIGNAL(progressInfo(QString, ProgressInfo)), this, - SLOT(slotUpdateProgress(QString, ProgressInfo))); + connect(pd, &ProgressDispatcher::progressInfo, this, + &ownCloudGui::slotUpdateProgress); FolderMan *folderMan = FolderMan::instance(); - connect(folderMan, SIGNAL(folderSyncStateChange(Folder *)), - this, SLOT(slotSyncStateChange(Folder *))); - - connect(AccountManager::instance(), SIGNAL(accountAdded(AccountState *)), - SLOT(updateContextMenuNeeded())); - connect(AccountManager::instance(), SIGNAL(accountRemoved(AccountState *)), - SLOT(updateContextMenuNeeded())); - - connect(Logger::instance(), SIGNAL(guiLog(QString, QString)), - SLOT(slotShowTrayMessage(QString, QString))); - connect(Logger::instance(), SIGNAL(optionalGuiLog(QString, QString)), - SLOT(slotShowOptionalTrayMessage(QString, QString))); - connect(Logger::instance(), SIGNAL(guiMessage(QString, QString)), - SLOT(slotShowGuiMessage(QString, QString))); + connect(folderMan, &FolderMan::folderSyncStateChange, + this, &ownCloudGui::slotSyncStateChange); + + connect(AccountManager::instance(), &AccountManager::accountAdded, + this, &ownCloudGui::updateContextMenuNeeded); + connect(AccountManager::instance(), &AccountManager::accountRemoved, + this, &ownCloudGui::updateContextMenuNeeded); + + connect(Logger::instance(), &Logger::guiLog, + this, &ownCloudGui::slotShowTrayMessage); + connect(Logger::instance(), &Logger::optionalGuiLog, + this, &ownCloudGui::slotShowOptionalTrayMessage); + connect(Logger::instance(), &Logger::guiMessage, + this, &ownCloudGui::slotShowGuiMessage); } // This should rather be in application.... or rather in ConfigFile? @@ -302,7 +302,7 @@ void ownCloudGui::addAccountContextMenu(AccountStatePtr accountState, QMenu *men } auto actionOpenoC = menu->addAction(browserOpen); actionOpenoC->setProperty(propertyAccountC, QVariant::fromValue(accountState->account())); - QObject::connect(actionOpenoC, SIGNAL(triggered(bool)), SLOT(slotOpenOwnCloud())); + QObject::connect(actionOpenoC, &QAction::triggered, this, &ownCloudGui::slotOpenOwnCloud); FolderMan *folderMan = FolderMan::instance(); bool firstFolder = true; @@ -336,22 +336,22 @@ void ownCloudGui::addAccountContextMenu(AccountStatePtr accountState, QMenu *men if (onePaused) { QAction *enable = menu->addAction(tr("Unpause all folders")); enable->setProperty(propertyAccountC, QVariant::fromValue(accountState)); - connect(enable, SIGNAL(triggered(bool)), SLOT(slotUnpauseAllFolders())); + connect(enable, &QAction::triggered, this, &ownCloudGui::slotUnpauseAllFolders); } if (!allPaused) { QAction *enable = menu->addAction(tr("Pause all folders")); enable->setProperty(propertyAccountC, QVariant::fromValue(accountState)); - connect(enable, SIGNAL(triggered(bool)), SLOT(slotPauseAllFolders())); + connect(enable, &QAction::triggered, this, &ownCloudGui::slotPauseAllFolders); } if (accountState->isSignedOut()) { QAction *signin = menu->addAction(tr("Log in...")); signin->setProperty(propertyAccountC, QVariant::fromValue(accountState)); - connect(signin, SIGNAL(triggered()), this, SLOT(slotLogin())); + connect(signin, &QAction::triggered, this, &ownCloudGui::slotLogin); } else { QAction *signout = menu->addAction(tr("Log out")); signout->setProperty(propertyAccountC, QVariant::fromValue(accountState)); - connect(signout, SIGNAL(triggered()), this, SLOT(slotLogout())); + connect(signout, &QAction::triggered, this, &ownCloudGui::slotLogout); } } } @@ -462,7 +462,7 @@ void ownCloudGui::setupContextMenu() // When the qdbusmenuWorkaround is necessary, we can't do on-demand updates // because the workaround is to hide and show the tray icon. if (_qdbusmenuWorkaround) { - connect(&_workaroundBatchTrayUpdate, SIGNAL(timeout()), SLOT(updateContextMenu())); + connect(&_workaroundBatchTrayUpdate, &QTimer::timeout, this, &ownCloudGui::updateContextMenu); _workaroundBatchTrayUpdate.setInterval(30 * 1000); _workaroundBatchTrayUpdate.setSingleShot(true); } else { @@ -473,7 +473,7 @@ void ownCloudGui::setupContextMenu() connect(_contextMenu.data(), SIGNAL(aboutToShow()), SLOT(slotContextMenuAboutToShow())); connect(_contextMenu.data(), SIGNAL(aboutToHide()), SLOT(slotContextMenuAboutToHide())); #else - connect(_contextMenu.data(), SIGNAL(aboutToShow()), SLOT(updateContextMenu())); + connect(_contextMenu.data(), &QMenu::aboutToShow, this, &ownCloudGui::updateContextMenu); #endif } @@ -576,7 +576,7 @@ void ownCloudGui::updateContextMenu() text = tr("Unpause synchronization"); } QAction *action = _contextMenu->addAction(text); - connect(action, SIGNAL(triggered(bool)), SLOT(slotUnpauseAllFolders())); + connect(action, &QAction::triggered, this, &ownCloudGui::slotUnpauseAllFolders); } if (atLeastOneNotPaused) { QString text; @@ -586,7 +586,7 @@ void ownCloudGui::updateContextMenu() text = tr("Pause synchronization"); } QAction *action = _contextMenu->addAction(text); - connect(action, SIGNAL(triggered(bool)), SLOT(slotPauseAllFolders())); + connect(action, &QAction::triggered, this, &ownCloudGui::slotPauseAllFolders); } if (atLeastOneSignedIn) { if (accountList.count() > 1) { @@ -686,18 +686,18 @@ void ownCloudGui::setupActions() _actionRecent = new QAction(tr("Details..."), this); _actionRecent->setEnabled(true); - QObject::connect(_actionRecent, SIGNAL(triggered(bool)), SLOT(slotShowSyncProtocol())); - QObject::connect(_actionSettings, SIGNAL(triggered(bool)), SLOT(slotShowSettings())); - QObject::connect(_actionNewAccountWizard, SIGNAL(triggered(bool)), SLOT(slotNewAccountWizard())); + QObject::connect(_actionRecent, &QAction::triggered, this, &ownCloudGui::slotShowSyncProtocol); + QObject::connect(_actionSettings, &QAction::triggered, this, &ownCloudGui::slotShowSettings); + QObject::connect(_actionNewAccountWizard, &QAction::triggered, this, &ownCloudGui::slotNewAccountWizard); _actionHelp = new QAction(tr("Help"), this); - QObject::connect(_actionHelp, SIGNAL(triggered(bool)), SLOT(slotHelp())); + QObject::connect(_actionHelp, &QAction::triggered, this, &ownCloudGui::slotHelp); _actionQuit = new QAction(tr("Quit %1").arg(Theme::instance()->appNameGUI()), this); QObject::connect(_actionQuit, SIGNAL(triggered(bool)), _app, SLOT(quit())); _actionLogin = new QAction(tr("Log in..."), this); - connect(_actionLogin, SIGNAL(triggered()), this, SLOT(slotLogin())); + connect(_actionLogin, &QAction::triggered, this, &ownCloudGui::slotLogin); _actionLogout = new QAction(tr("Log out"), this); - connect(_actionLogout, SIGNAL(triggered()), this, SLOT(slotLogout())); + connect(_actionLogout, &QAction::triggered, this, &ownCloudGui::slotLogout); if (_app->debugMode()) { _actionCrash = new QAction(tr("Crash now", "Only shows in debug mode to allow testing the crash handler"), this); @@ -742,7 +742,7 @@ void ownCloudGui::slotUpdateProgress(const QString &folder, const ProgressInfo & .arg(progress._currentDiscoveredFolder)); } } else if (progress.status() == ProgressInfo::Done) { - QTimer::singleShot(2000, this, SLOT(slotDisplayIdle())); + QTimer::singleShot(2000, this, &ownCloudGui::slotDisplayIdle); } if (progress.status() != ProgressInfo::Propagation) { return; @@ -1036,7 +1036,7 @@ void ownCloudGui::slotShowShareDialog(const QString &sharePath, const QString &l w->setAttribute(Qt::WA_DeleteOnClose, true); _shareDialogs[localPath] = w; - connect(w, SIGNAL(destroyed(QObject *)), SLOT(slotRemoveDestroyedShareDialogs())); + connect(w, &QObject::destroyed, this, &ownCloudGui::slotRemoveDestroyedShareDialogs); } raiseDialog(w); } diff --git a/src/gui/owncloudsetupwizard.cpp b/src/gui/owncloudsetupwizard.cpp index 33e55cb14..86a0c19ad 100644 --- a/src/gui/owncloudsetupwizard.cpp +++ b/src/gui/owncloudsetupwizard.cpp @@ -44,19 +44,19 @@ OwncloudSetupWizard::OwncloudSetupWizard(QObject *parent) , _ocWizard(new OwncloudWizard) , _remoteFolder() { - connect(_ocWizard, SIGNAL(determineAuthType(const QString &)), - this, SLOT(slotDetermineAuthType(const QString &))); - connect(_ocWizard, SIGNAL(connectToOCUrl(const QString &)), - this, SLOT(slotConnectToOCUrl(const QString &))); - connect(_ocWizard, SIGNAL(createLocalAndRemoteFolders(QString, QString)), - this, SLOT(slotCreateLocalAndRemoteFolders(QString, QString))); + connect(_ocWizard, &OwncloudWizard::determineAuthType, + this, &OwncloudSetupWizard::slotDetermineAuthType); + connect(_ocWizard, &OwncloudWizard::connectToOCUrl, + this, &OwncloudSetupWizard::slotConnectToOCUrl); + connect(_ocWizard, &OwncloudWizard::createLocalAndRemoteFolders, + this, &OwncloudSetupWizard::slotCreateLocalAndRemoteFolders); /* basicSetupFinished might be called from a reply from the network. slotAssistantFinished might destroy the temporary QNetworkAccessManager. Therefore Qt::QueuedConnection is required */ - connect(_ocWizard, SIGNAL(basicSetupFinished(int)), - this, SLOT(slotAssistantFinished(int)), Qt::QueuedConnection); - connect(_ocWizard, SIGNAL(finished(int)), SLOT(deleteLater())); - connect(_ocWizard, SIGNAL(skipFolderConfiguration()), SLOT(slotSkipFolderConfiguration())); + connect(_ocWizard, &OwncloudWizard::basicSetupFinished, + this, &OwncloudSetupWizard::slotAssistantFinished, Qt::QueuedConnection); + connect(_ocWizard, &QDialog::finished, this, &QObject::deleteLater); + connect(_ocWizard, &OwncloudWizard::skipFolderConfiguration, this, &OwncloudSetupWizard::slotSkipFolderConfiguration); } OwncloudSetupWizard::~OwncloudSetupWizard() @@ -202,9 +202,9 @@ void OwncloudSetupWizard::slotContinueDetermineAuth() [this, account]() { CheckServerJob *job = new CheckServerJob(account, this); job->setIgnoreCredentialFailure(true); - connect(job, SIGNAL(instanceFound(QUrl, QJsonObject)), SLOT(slotOwnCloudFoundAuth(QUrl, QJsonObject))); - connect(job, SIGNAL(instanceNotFound(QNetworkReply *)), SLOT(slotNoOwnCloudFoundAuth(QNetworkReply *))); - connect(job, SIGNAL(timeout(const QUrl &)), SLOT(slotNoOwnCloudFoundAuthTimeout(const QUrl &))); + connect(job, &CheckServerJob::instanceFound, this, &OwncloudSetupWizard::slotOwnCloudFoundAuth); + connect(job, &CheckServerJob::instanceNotFound, this, &OwncloudSetupWizard::slotNoOwnCloudFoundAuth); + connect(job, &CheckServerJob::timeout, this, &OwncloudSetupWizard::slotNoOwnCloudFoundAuthTimeout); job->setTimeout((account->url().scheme() == "https") ? 30 * 1000 : 10 * 1000); job->start(); }); @@ -310,8 +310,8 @@ void OwncloudSetupWizard::testOwnCloudConnect() // so don't automatically follow redirects. job->setFollowRedirects(false); job->setProperties(QList() << "getlastmodified"); - connect(job, SIGNAL(result(QVariantMap)), _ocWizard, SLOT(successfulStep())); - connect(job, SIGNAL(finishedWithError()), this, SLOT(slotAuthError())); + connect(job, &PropfindJob::result, _ocWizard, &OwncloudWizard::successfulStep); + connect(job, &PropfindJob::finishedWithError, this, &OwncloudSetupWizard::slotAuthError); job->start(); } @@ -429,7 +429,7 @@ void OwncloudSetupWizard::slotCreateLocalAndRemoteFolders(const QString &localFo } if (nextStep) { EntityExistsJob *job = new EntityExistsJob(_ocWizard->account(), _ocWizard->account()->davPath() + remoteFolder, this); - connect(job, SIGNAL(exists(QNetworkReply *)), SLOT(slotRemoteFolderExists(QNetworkReply *))); + connect(job, &EntityExistsJob::exists, this, &OwncloudSetupWizard::slotRemoteFolderExists); job->start(); } else { finalizeSetup(false); @@ -602,8 +602,8 @@ void OwncloudSetupWizard::slotSkipFolderConfiguration() { applyAccountChanges(); - disconnect(_ocWizard, SIGNAL(basicSetupFinished(int)), - this, SLOT(slotAssistantFinished(int))); + disconnect(_ocWizard, &OwncloudWizard::basicSetupFinished, + this, &OwncloudSetupWizard::slotAssistantFinished); _ocWizard->close(); emit ownCloudWizardDone(QDialog::Accepted); } diff --git a/src/gui/protocolwidget.cpp b/src/gui/protocolwidget.cpp index 75b8aaa52..f3a52dff6 100644 --- a/src/gui/protocolwidget.cpp +++ b/src/gui/protocolwidget.cpp @@ -38,10 +38,10 @@ ProtocolWidget::ProtocolWidget(QWidget *parent) { _ui->setupUi(this); - connect(ProgressDispatcher::instance(), SIGNAL(itemCompleted(QString, SyncFileItemPtr)), - this, SLOT(slotItemCompleted(QString, SyncFileItemPtr))); + connect(ProgressDispatcher::instance(), &ProgressDispatcher::itemCompleted, + this, &ProtocolWidget::slotItemCompleted); - connect(_ui->_treeWidget, SIGNAL(itemActivated(QTreeWidgetItem *, int)), SLOT(slotOpenFile(QTreeWidgetItem *, int))); + connect(_ui->_treeWidget, &QTreeWidget::itemActivated, this, &ProtocolWidget::slotOpenFile); // Adjust copyToClipboard() when making changes here! QStringList header; @@ -74,7 +74,7 @@ ProtocolWidget::ProtocolWidget(QWidget *parent) QPushButton *copyBtn = _ui->_dialogButtonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole); copyBtn->setToolTip(tr("Copy the activity list to the clipboard.")); copyBtn->setEnabled(true); - connect(copyBtn, SIGNAL(clicked()), SIGNAL(copyToClipboard())); + connect(copyBtn, &QAbstractButton::clicked, this, &ProtocolWidget::copyToClipboard); } ProtocolWidget::~ProtocolWidget() diff --git a/src/gui/proxyauthhandler.cpp b/src/gui/proxyauthhandler.cpp index 5b7d7382d..f2ccd97ac 100644 --- a/src/gui/proxyauthhandler.cpp +++ b/src/gui/proxyauthhandler.cpp @@ -131,8 +131,8 @@ void ProxyAuthHandler::handleProxyAuthenticationRequired( sending_qnam = qnam_alive.data(); if (sending_qnam) { _gaveCredentialsTo.insert(sending_qnam); - connect(sending_qnam, SIGNAL(destroyed(QObject *)), - SLOT(slotSenderDestroyed(QObject *))); + connect(sending_qnam, &QObject::destroyed, + this, &ProxyAuthHandler::slotSenderDestroyed); } } @@ -194,8 +194,8 @@ bool ProxyAuthHandler::getCredsFromKeychain() _readPasswordJob->setInsecureFallback(false); _readPasswordJob->setKey(keychainPasswordKey()); _readPasswordJob->setAutoDelete(false); - connect(_readPasswordJob.data(), SIGNAL(finished(QKeychain::Job *)), - SLOT(slotKeychainJobDone())); + connect(_readPasswordJob.data(), &QKeychain::Job::finished, + this, &ProxyAuthHandler::slotKeychainJobDone); _keychainJobRunning = true; _readPasswordJob->start(); } @@ -242,7 +242,7 @@ void ProxyAuthHandler::storeCredsInKeychain() job->setKey(keychainPasswordKey()); job->setTextData(_password); job->setAutoDelete(false); - connect(job, SIGNAL(finished(QKeychain::Job *)), SLOT(slotKeychainJobDone())); + connect(job, &QKeychain::Job::finished, this, &ProxyAuthHandler::slotKeychainJobDone); _keychainJobRunning = true; job->start(); diff --git a/src/gui/quotainfo.cpp b/src/gui/quotainfo.cpp index 1eb1066cc..0368eefbe 100644 --- a/src/gui/quotainfo.cpp +++ b/src/gui/quotainfo.cpp @@ -36,9 +36,9 @@ QuotaInfo::QuotaInfo(AccountState *accountState, QObject *parent) , _lastQuotaUsedBytes(0) , _active(false) { - connect(accountState, SIGNAL(stateChanged(int)), - SLOT(slotAccountStateChanged())); - connect(&_jobRestartTimer, SIGNAL(timeout()), SLOT(slotCheckQuota())); + connect(accountState, &AccountState::stateChanged, + this, &QuotaInfo::slotAccountStateChanged); + connect(&_jobRestartTimer, &QTimer::timeout, this, &QuotaInfo::slotCheckQuota); _jobRestartTimer.setSingleShot(true); } @@ -101,8 +101,8 @@ void QuotaInfo::slotCheckQuota() _job = new PropfindJob(account, quotaBaseFolder(), this); _job->setProperties(QList() << "quota-available-bytes" << "quota-used-bytes"); - connect(_job, SIGNAL(result(QVariantMap)), SLOT(slotUpdateLastQuota(QVariantMap))); - connect(_job, SIGNAL(networkError(QNetworkReply *)), SLOT(slotRequestFailed())); + connect(_job.data(), &PropfindJob::result, this, &QuotaInfo::slotUpdateLastQuota); + connect(_job.data(), &AbstractNetworkJob::networkError, this, &QuotaInfo::slotRequestFailed); _job->start(); } diff --git a/src/gui/selectivesyncdialog.cpp b/src/gui/selectivesyncdialog.cpp index a9c96cb77..1457967f7 100644 --- a/src/gui/selectivesyncdialog.cpp +++ b/src/gui/selectivesyncdialog.cpp @@ -83,10 +83,10 @@ SelectiveSyncWidget::SelectiveSyncWidget(AccountPtr account, QWidget *parent) layout->addWidget(_folderTree); - connect(_folderTree, SIGNAL(itemExpanded(QTreeWidgetItem *)), - SLOT(slotItemExpanded(QTreeWidgetItem *))); - connect(_folderTree, SIGNAL(itemChanged(QTreeWidgetItem *, int)), - SLOT(slotItemChanged(QTreeWidgetItem *, int))); + connect(_folderTree, &QTreeWidget::itemExpanded, + this, &SelectiveSyncWidget::slotItemExpanded); + connect(_folderTree, &QTreeWidget::itemChanged, + this, &SelectiveSyncWidget::slotItemChanged); _folderTree->setSortingEnabled(true); _folderTree->sortByColumn(0, Qt::AscendingOrder); _folderTree->setColumnCount(2); @@ -107,10 +107,10 @@ void SelectiveSyncWidget::refreshFolders() LsColJob *job = new LsColJob(_account, _folderPath, this); job->setProperties(QList() << "resourcetype" << "http://owncloud.org/ns:size"); - connect(job, SIGNAL(directoryListingSubfolders(QStringList)), - this, SLOT(slotUpdateDirectories(QStringList))); - connect(job, SIGNAL(finishedWithError(QNetworkReply *)), - this, SLOT(slotLscolFinishedWithError(QNetworkReply *))); + connect(job, &LsColJob::directoryListingSubfolders, + this, &SelectiveSyncWidget::slotUpdateDirectories); + connect(job, &LsColJob::finishedWithError, + this, &SelectiveSyncWidget::slotLscolFinishedWithError); job->start(); _folderTree->clear(); _loading->show(); @@ -291,8 +291,8 @@ void SelectiveSyncWidget::slotItemExpanded(QTreeWidgetItem *item) LsColJob *job = new LsColJob(_account, prefix + dir, this); job->setProperties(QList() << "resourcetype" << "http://owncloud.org/ns:size"); - connect(job, SIGNAL(directoryListingSubfolders(QStringList)), - SLOT(slotUpdateDirectories(QStringList))); + connect(job, &LsColJob::directoryListingSubfolders, + this, &SelectiveSyncWidget::slotUpdateDirectories); job->start(); } @@ -440,7 +440,7 @@ SelectiveSyncDialog::SelectiveSyncDialog(AccountPtr account, Folder *folder, QWi _okButton->setEnabled(false); } // Make sure we don't get crashes if the folder is destroyed while we are still open - connect(_folder, SIGNAL(destroyed(QObject *)), this, SLOT(deleteLater())); + connect(_folder, &QObject::destroyed, this, &QObject::deleteLater); } SelectiveSyncDialog::SelectiveSyncDialog(AccountPtr account, const QString &folder, @@ -463,7 +463,7 @@ void SelectiveSyncDialog::init(const AccountPtr &account) connect(_okButton, SIGNAL(clicked()), this, SLOT(accept())); QPushButton *button; button = buttonBox->addButton(QDialogButtonBox::Cancel); - connect(button, SIGNAL(clicked()), this, SLOT(reject())); + connect(button, &QAbstractButton::clicked, this, &QDialog::reject); layout->addWidget(buttonBox); } diff --git a/src/gui/servernotificationhandler.cpp b/src/gui/servernotificationhandler.cpp index afbd66ddf..7c69bf599 100644 --- a/src/gui/servernotificationhandler.cpp +++ b/src/gui/servernotificationhandler.cpp @@ -48,8 +48,8 @@ void ServerNotificationHandler::slotFetchNotifications(AccountState *ptr) // if the previous notification job has finished, start next. _notificationJob = new JsonApiJob(ptr->account(), QLatin1String("ocs/v2.php/apps/notifications/api/v1/notifications"), this); - QObject::connect(_notificationJob.data(), SIGNAL(jsonReceived(QJsonDocument, int)), - this, SLOT(slotNotificationsReceived(QJsonDocument, int))); + QObject::connect(_notificationJob.data(), &JsonApiJob::jsonReceived, + this, &ServerNotificationHandler::slotNotificationsReceived); _notificationJob->setProperty("AccountStatePtr", QVariant::fromValue(ptr)); _notificationJob->start(); diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp index 2ea52e921..f67dcaca0 100644 --- a/src/gui/settingsdialog.cpp +++ b/src/gui/settingsdialog.cpp @@ -109,8 +109,8 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) _toolBar->addAction(_activityAction); _activitySettings = new ActivitySettings; _ui->stack->addWidget(_activitySettings); - connect(_activitySettings, SIGNAL(guiLog(QString, QString)), _gui, - SLOT(slotShowOptionalTrayMessage(QString, QString))); + connect(_activitySettings, &ActivitySettings::guiLog, _gui, + &ownCloudGui::slotShowOptionalTrayMessage); _activitySettings->setNotificationRefreshInterval(cfg.notificationRefreshInterval()); QAction *generalAction = createColorAwareAction(QLatin1String(":/client/resources/settings.png"), tr("General")); @@ -129,24 +129,24 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) _actionGroupWidgets.insert(generalAction, generalSettings); _actionGroupWidgets.insert(networkAction, networkSettings); - connect(_actionGroup, SIGNAL(triggered(QAction *)), SLOT(slotSwitchPage(QAction *))); + connect(_actionGroup, &QActionGroup::triggered, this, &SettingsDialog::slotSwitchPage); - connect(AccountManager::instance(), SIGNAL(accountAdded(AccountState *)), - this, SLOT(accountAdded(AccountState *))); - connect(AccountManager::instance(), SIGNAL(accountRemoved(AccountState *)), - this, SLOT(accountRemoved(AccountState *))); + connect(AccountManager::instance(), &AccountManager::accountAdded, + this, &SettingsDialog::accountAdded); + connect(AccountManager::instance(), &AccountManager::accountRemoved, + this, &SettingsDialog::accountRemoved); foreach (auto ai, AccountManager::instance()->accounts()) { accountAdded(ai.data()); } - QTimer::singleShot(1, this, SLOT(showFirstPage())); + QTimer::singleShot(1, this, &SettingsDialog::showFirstPage); QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close); connect(closeButton, SIGNAL(clicked()), SLOT(accept())); QAction *showLogWindow = new QAction(this); showLogWindow->setShortcut(QKeySequence("F12")); - connect(showLogWindow, SIGNAL(triggered()), gui, SLOT(slotToggleLogBrowser())); + connect(showLogWindow, &QAction::triggered, gui, &ownCloudGui::slotToggleLogBrowser); addAction(showLogWindow); customizeStyle(); @@ -245,11 +245,11 @@ void SettingsDialog::accountAdded(AccountState *s) _actionGroupWidgets.insert(accountAction, accountSettings); _actionForAccount.insert(s->account().data(), accountAction); - connect(accountSettings, SIGNAL(folderChanged()), _gui, SLOT(slotFoldersChanged())); - connect(accountSettings, SIGNAL(openFolderAlias(const QString &)), - _gui, SLOT(slotFolderOpenAction(QString))); - connect(accountSettings, SIGNAL(showIssuesList(QString)), SLOT(showIssuesList(QString))); - connect(s->account().data(), SIGNAL(accountChangedAvatar()), SLOT(slotAccountAvatarChanged())); + connect(accountSettings, &AccountSettings::folderChanged, _gui, &ownCloudGui::slotFoldersChanged); + connect(accountSettings, &AccountSettings::openFolderAlias, + _gui, &ownCloudGui::slotFolderOpenAction); + connect(accountSettings, &AccountSettings::showIssuesList, this, &SettingsDialog::showIssuesList); + connect(s->account().data(), &Account::accountChangedAvatar, this, &SettingsDialog::slotAccountAvatarChanged); slotRefreshActivity(s); } diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp index aa47598e9..a81d20894 100644 --- a/src/gui/sharedialog.cpp +++ b/src/gui/sharedialog.cpp @@ -58,10 +58,10 @@ ShareDialog::ShareDialog(QPointer accountState, _ui->setupUi(this); QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close); - connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); + connect(closeButton, &QAbstractButton::clicked, this, &QWidget::close); // We want to act on account state changes - connect(_accountState, SIGNAL(stateChanged(int)), SLOT(slotAccountStateChanged(int))); + connect(_accountState.data(), &AccountState::stateChanged, this, &ShareDialog::slotAccountStateChanged); // Because people press enter in the dialog and we don't want to close for that closeButton->setDefault(false); @@ -118,7 +118,7 @@ ShareDialog::ShareDialog(QPointer accountState, if (QFileInfo(_localPath).isFile()) { ThumbnailJob *job = new ThumbnailJob(_sharePath, _accountState->account(), this); - connect(job, SIGNAL(jobFinished(int, QByteArray)), SLOT(slotThumbnailFetched(int, QByteArray))); + connect(job, &ThumbnailJob::jobFinished, this, &ShareDialog::slotThumbnailFetched); job->start(); } @@ -135,8 +135,8 @@ ShareDialog::ShareDialog(QPointer accountState, << "http://open-collaboration-services.org/ns:share-permissions" << "http://owncloud.org/ns:privatelink"); job->setTimeout(10 * 1000); - connect(job, SIGNAL(result(QVariantMap)), SLOT(slotPropfindReceived(QVariantMap))); - connect(job, SIGNAL(finishedWithError(QNetworkReply *)), SLOT(slotPropfindError())); + connect(job, &PropfindJob::result, this, &ShareDialog::slotPropfindReceived); + connect(job, &PropfindJob::finishedWithError, this, &ShareDialog::slotPropfindError); job->start(); } diff --git a/src/gui/sharee.cpp b/src/gui/sharee.cpp index 2d1ca4d49..e1cec2ff1 100644 --- a/src/gui/sharee.cpp +++ b/src/gui/sharee.cpp @@ -72,8 +72,8 @@ void ShareeModel::fetch(const QString &search, const ShareeSet &blacklist) _search = search; _shareeBlacklist = blacklist; OcsShareeJob *job = new OcsShareeJob(_account); - connect(job, SIGNAL(shareeJobFinished(QJsonDocument)), SLOT(shareesFetched(QJsonDocument))); - connect(job, SIGNAL(ocsError(int, QString)), SIGNAL(displayErrorMessage(int, QString))); + connect(job, &OcsShareeJob::shareeJobFinished, this, &ShareeModel::shareesFetched); + connect(job, &OcsJob::ocsError, this, &ShareeModel::displayErrorMessage); job->getSharees(_search, _type, 1, 50); } diff --git a/src/gui/sharelinkwidget.cpp b/src/gui/sharelinkwidget.cpp index bba3151bb..3f542c0d3 100644 --- a/src/gui/sharelinkwidget.cpp +++ b/src/gui/sharelinkwidget.cpp @@ -71,18 +71,18 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account, _ui->layout_editing->addWidget(_pi_editing, 0, 2); _ui->horizontalLayout_expire->insertWidget(_ui->horizontalLayout_expire->count() - 1, _pi_date); - connect(_ui->nameLineEdit, SIGNAL(returnPressed()), SLOT(slotShareNameEntered())); - connect(_ui->createShareButton, SIGNAL(clicked(bool)), SLOT(slotShareNameEntered())); - connect(_ui->linkShares, SIGNAL(itemSelectionChanged()), SLOT(slotShareSelectionChanged())); - connect(_ui->linkShares, SIGNAL(itemChanged(QTableWidgetItem *)), SLOT(slotNameEdited(QTableWidgetItem *))); - connect(_ui->checkBox_password, SIGNAL(clicked()), this, SLOT(slotCheckBoxPasswordClicked())); - connect(_ui->lineEdit_password, SIGNAL(returnPressed()), this, SLOT(slotPasswordReturnPressed())); - connect(_ui->lineEdit_password, SIGNAL(textChanged(QString)), this, SLOT(slotPasswordChanged(QString))); - connect(_ui->pushButton_setPassword, SIGNAL(clicked(bool)), SLOT(slotPasswordReturnPressed())); - connect(_ui->checkBox_expire, SIGNAL(clicked()), this, SLOT(slotCheckBoxExpireClicked())); - connect(_ui->calendar, SIGNAL(dateChanged(QDate)), SLOT(slotExpireDateChanged(QDate))); - connect(_ui->checkBox_editing, SIGNAL(clicked()), this, SLOT(slotPermissionsCheckboxClicked())); - connect(_ui->checkBox_fileListing, SIGNAL(clicked(bool)), this, SLOT(slotPermissionsCheckboxClicked())); + connect(_ui->nameLineEdit, &QLineEdit::returnPressed, this, &ShareLinkWidget::slotShareNameEntered); + connect(_ui->createShareButton, &QAbstractButton::clicked, this, &ShareLinkWidget::slotShareNameEntered); + connect(_ui->linkShares, &QTableWidget::itemSelectionChanged, this, &ShareLinkWidget::slotShareSelectionChanged); + connect(_ui->linkShares, &QTableWidget::itemChanged, this, &ShareLinkWidget::slotNameEdited); + connect(_ui->checkBox_password, &QAbstractButton::clicked, this, &ShareLinkWidget::slotCheckBoxPasswordClicked); + connect(_ui->lineEdit_password, &QLineEdit::returnPressed, this, &ShareLinkWidget::slotPasswordReturnPressed); + connect(_ui->lineEdit_password, &QLineEdit::textChanged, this, &ShareLinkWidget::slotPasswordChanged); + connect(_ui->pushButton_setPassword, &QAbstractButton::clicked, this, &ShareLinkWidget::slotPasswordReturnPressed); + connect(_ui->checkBox_expire, &QAbstractButton::clicked, this, &ShareLinkWidget::slotCheckBoxExpireClicked); + connect(_ui->calendar, &QDateTimeEdit::dateChanged, this, &ShareLinkWidget::slotExpireDateChanged); + connect(_ui->checkBox_editing, &QAbstractButton::clicked, this, &ShareLinkWidget::slotPermissionsCheckboxClicked); + connect(_ui->checkBox_fileListing, &QAbstractButton::clicked, this, &ShareLinkWidget::slotPermissionsCheckboxClicked); _ui->errorLabel->hide(); @@ -156,8 +156,8 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account, // Prepare sharing menu _shareLinkMenu = new QMenu(this); - connect(_shareLinkMenu, SIGNAL(triggered(QAction *)), - SLOT(slotShareLinkActionTriggered(QAction *))); + connect(_shareLinkMenu, &QMenu::triggered, + this, &ShareLinkWidget::slotShareLinkActionTriggered); _openLinkAction = _shareLinkMenu->addAction(tr("Open link in browser")); _copyLinkAction = _shareLinkMenu->addAction(tr("Copy link to clipboard")); _copyDirectLinkAction = _shareLinkMenu->addAction(tr("Copy link to clipboard (direct download)")); @@ -169,10 +169,10 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account, */ if (sharingPossible) { _manager = new ShareManager(_account, this); - connect(_manager, SIGNAL(sharesFetched(QList>)), SLOT(slotSharesFetched(QList>))); + connect(_manager, &ShareManager::sharesFetched, this, &ShareLinkWidget::slotSharesFetched); connect(_manager, SIGNAL(linkShareCreated(QSharedPointer)), SLOT(slotCreateShareFetched(const QSharedPointer))); - connect(_manager, SIGNAL(linkShareRequiresPassword(QString)), SLOT(slotCreateShareRequiresPassword(QString))); - connect(_manager, SIGNAL(serverError(int, QString)), SLOT(slotServerError(int, QString))); + connect(_manager, &ShareManager::linkShareRequiresPassword, this, &ShareLinkWidget::slotCreateShareRequiresPassword); + connect(_manager, &ShareManager::serverError, this, &ShareLinkWidget::slotServerError); } } @@ -218,13 +218,13 @@ void ShareLinkWidget::slotSharesFetched(const QList> &shar auto linkShare = qSharedPointerDynamicCast(share); // Connect all shares signals to gui slots - connect(share.data(), SIGNAL(serverError(int, QString)), SLOT(slotServerError(int, QString))); - connect(share.data(), SIGNAL(shareDeleted()), SLOT(slotDeleteShareFetched())); + connect(share.data(), &Share::serverError, this, &ShareLinkWidget::slotServerError); + connect(share.data(), &Share::shareDeleted, this, &ShareLinkWidget::slotDeleteShareFetched); connect(share.data(), SIGNAL(expireDateSet()), SLOT(slotExpireSet())); connect(share.data(), SIGNAL(publicUploadSet()), SLOT(slotPermissionsSet())); connect(share.data(), SIGNAL(passwordSet()), SLOT(slotPasswordSet())); connect(share.data(), SIGNAL(passwordSetError(int, QString)), SLOT(slotPasswordSetError(int, QString))); - connect(share.data(), SIGNAL(permissionsSet()), SLOT(slotPermissionsSet())); + connect(share.data(), &Share::permissionsSet, this, &ShareLinkWidget::slotPermissionsSet); // Build the table row auto row = table->rowCount(); @@ -247,13 +247,13 @@ void ShareLinkWidget::slotSharesFetched(const QList> &shar auto shareButton = new QToolButton; shareButton->setText("..."); shareButton->setProperty(propertyShareC, QVariant::fromValue(linkShare)); - connect(shareButton, SIGNAL(clicked(bool)), SLOT(slotShareLinkButtonClicked())); + connect(shareButton, &QAbstractButton::clicked, this, &ShareLinkWidget::slotShareLinkButtonClicked); table->setCellWidget(row, 1, shareButton); auto deleteButton = new QToolButton; deleteButton->setIcon(deleteIcon); deleteButton->setProperty(propertyShareC, QVariant::fromValue(linkShare)); - connect(deleteButton, SIGNAL(clicked(bool)), SLOT(slotDeleteShareClicked())); + connect(deleteButton, &QAbstractButton::clicked, this, &ShareLinkWidget::slotDeleteShareClicked); table->setCellWidget(row, 2, deleteButton); // Reestablish the previous selection diff --git a/src/gui/sharemanager.cpp b/src/gui/sharemanager.cpp index 37c39839f..95a976451 100644 --- a/src/gui/sharemanager.cpp +++ b/src/gui/sharemanager.cpp @@ -72,8 +72,8 @@ QSharedPointer Share::getShareWith() const void Share::setPermissions(Permissions permissions) { OcsShareJob *job = new OcsShareJob(_account); - connect(job, SIGNAL(shareJobFinished(QJsonDocument, QVariant)), SLOT(slotPermissionsSet(QJsonDocument, QVariant))); - connect(job, SIGNAL(ocsError(int, QString)), SLOT(slotOcsError(int, QString))); + connect(job, &OcsShareJob::shareJobFinished, this, &Share::slotPermissionsSet); + connect(job, &OcsJob::ocsError, this, &Share::slotOcsError); job->setPermissions(getId(), permissions); } @@ -91,8 +91,8 @@ Share::Permissions Share::getPermissions() const void Share::deleteShare() { OcsShareJob *job = new OcsShareJob(_account); - connect(job, SIGNAL(shareJobFinished(QJsonDocument, QVariant)), SLOT(slotDeleted())); - connect(job, SIGNAL(ocsError(int, const QString &)), SLOT(slotOcsError(int, const QString &))); + connect(job, &OcsShareJob::shareJobFinished, this, &Share::slotDeleted); + connect(job, &OcsJob::ocsError, this, &Share::slotOcsError); job->deleteShare(getId()); } @@ -164,8 +164,8 @@ QString LinkShare::getName() const void LinkShare::setName(const QString &name) { OcsShareJob *job = new OcsShareJob(_account); - connect(job, SIGNAL(shareJobFinished(QJsonDocument, QVariant)), SLOT(slotNameSet(QJsonDocument, QVariant))); - connect(job, SIGNAL(ocsError(int, QString)), SLOT(slotOcsError(int, QString))); + connect(job, &OcsShareJob::shareJobFinished, this, &LinkShare::slotNameSet); + connect(job, &OcsJob::ocsError, this, &LinkShare::slotOcsError); job->setName(getId(), name); } @@ -177,8 +177,8 @@ QString LinkShare::getToken() const void LinkShare::setPassword(const QString &password) { OcsShareJob *job = new OcsShareJob(_account); - connect(job, SIGNAL(shareJobFinished(QJsonDocument, QVariant)), SLOT(slotPasswordSet(QJsonDocument, QVariant))); - connect(job, SIGNAL(ocsError(int, QString)), SLOT(slotSetPasswordError(int, QString))); + connect(job, &OcsShareJob::shareJobFinished, this, &LinkShare::slotPasswordSet); + connect(job, &OcsJob::ocsError, this, &LinkShare::slotSetPasswordError); job->setPassword(getId(), password); } @@ -191,8 +191,8 @@ void LinkShare::slotPasswordSet(const QJsonDocument &, const QVariant &value) void LinkShare::setExpireDate(const QDate &date) { OcsShareJob *job = new OcsShareJob(_account); - connect(job, SIGNAL(shareJobFinished(QJsonDocument, QVariant)), SLOT(slotExpireDateSet(QJsonDocument, QVariant))); - connect(job, SIGNAL(ocsError(int, QString)), SLOT(slotOcsError(int, QString))); + connect(job, &OcsShareJob::shareJobFinished, this, &LinkShare::slotExpireDateSet); + connect(job, &OcsJob::ocsError, this, &LinkShare::slotOcsError); job->setExpireDate(getId(), date); } @@ -234,8 +234,8 @@ void ShareManager::createLinkShare(const QString &path, const QString &password) { OcsShareJob *job = new OcsShareJob(_account); - connect(job, SIGNAL(shareJobFinished(QJsonDocument, QVariant)), SLOT(slotLinkShareCreated(QJsonDocument))); - connect(job, SIGNAL(ocsError(int, QString)), SLOT(slotOcsError(int, QString))); + connect(job, &OcsShareJob::shareJobFinished, this, &ShareManager::slotLinkShareCreated); + connect(job, &OcsJob::ocsError, this, &ShareManager::slotOcsError); job->createLinkShare(path, name, password); } @@ -276,8 +276,8 @@ void ShareManager::createShare(const QString &path, continuation.permissions = permissions; _jobContinuation[job] = QVariant::fromValue(continuation); - connect(job, SIGNAL(shareJobFinished(QJsonDocument, QVariant)), SLOT(slotCreateShare(QJsonDocument))); - connect(job, SIGNAL(ocsError(int, QString)), SLOT(slotOcsError(int, QString))); + connect(job, &OcsShareJob::shareJobFinished, this, &ShareManager::slotCreateShare); + connect(job, &OcsJob::ocsError, this, &ShareManager::slotOcsError); job->getSharedWithMe(); } @@ -308,8 +308,8 @@ void ShareManager::slotCreateShare(const QJsonDocument &reply) } OcsShareJob *job = new OcsShareJob(_account); - connect(job, SIGNAL(shareJobFinished(QJsonDocument, QVariant)), SLOT(slotShareCreated(QJsonDocument))); - connect(job, SIGNAL(ocsError(int, QString)), SLOT(slotOcsError(int, QString))); + connect(job, &OcsShareJob::shareJobFinished, this, &ShareManager::slotShareCreated); + connect(job, &OcsJob::ocsError, this, &ShareManager::slotOcsError); job->createShare(cont.path, cont.shareType, cont.shareWith, cont.permissions); } @@ -325,8 +325,8 @@ void ShareManager::slotShareCreated(const QJsonDocument &reply) void ShareManager::fetchShares(const QString &path) { OcsShareJob *job = new OcsShareJob(_account); - connect(job, SIGNAL(shareJobFinished(QJsonDocument, QVariant)), SLOT(slotSharesFetched(QJsonDocument))); - connect(job, SIGNAL(ocsError(int, QString)), SLOT(slotOcsError(int, QString))); + connect(job, &OcsShareJob::shareJobFinished, this, &ShareManager::slotSharesFetched); + connect(job, &OcsJob::ocsError, this, &ShareManager::slotOcsError); job->getShares(path); } diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp index 5b505f21a..848ecfbfb 100644 --- a/src/gui/shareusergroupwidget.cpp +++ b/src/gui/shareusergroupwidget.cpp @@ -71,8 +71,8 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account, _completerModel = new ShareeModel(_account, _isFile ? QLatin1String("file") : QLatin1String("folder"), _completer); - connect(_completerModel, SIGNAL(shareesReady()), this, SLOT(slotShareesReady())); - connect(_completerModel, SIGNAL(displayErrorMessage(int, QString)), this, SLOT(displayError(int, QString))); + connect(_completerModel, &ShareeModel::shareesReady, this, &ShareUserGroupWidget::slotShareesReady); + connect(_completerModel, &ShareeModel::displayErrorMessage, this, &ShareUserGroupWidget::displayError); _completer->setModel(_completerModel); _completer->setCaseSensitivity(Qt::CaseInsensitive); @@ -80,11 +80,11 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account, _ui->shareeLineEdit->setCompleter(_completer); _manager = new ShareManager(_account, this); - connect(_manager, SIGNAL(sharesFetched(QList>)), SLOT(slotSharesFetched(QList>))); - connect(_manager, SIGNAL(shareCreated(QSharedPointer)), SLOT(getShares())); - connect(_manager, SIGNAL(serverError(int, QString)), this, SLOT(displayError(int, QString))); - connect(_ui->shareeLineEdit, SIGNAL(returnPressed()), SLOT(slotLineEditReturn())); - connect(_ui->privateLinkText, SIGNAL(linkActivated(QString)), SLOT(slotPrivateLinkShare())); + connect(_manager, &ShareManager::sharesFetched, this, &ShareUserGroupWidget::slotSharesFetched); + connect(_manager, &ShareManager::shareCreated, this, &ShareUserGroupWidget::getShares); + connect(_manager, &ShareManager::serverError, this, &ShareUserGroupWidget::displayError); + connect(_ui->shareeLineEdit, &QLineEdit::returnPressed, this, &ShareUserGroupWidget::slotLineEditReturn); + connect(_ui->privateLinkText, &QLabel::linkActivated, this, &ShareUserGroupWidget::slotPrivateLinkShare); // By making the next two QueuedConnections we can override // the strings the completer sets on the line edit. @@ -94,9 +94,9 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account, Qt::QueuedConnection); // Queued connection so this signal is recieved after textChanged - connect(_ui->shareeLineEdit, SIGNAL(textEdited(QString)), - this, SLOT(slotLineEditTextEdited(QString)), Qt::QueuedConnection); - connect(&_completionTimer, SIGNAL(timeout()), this, SLOT(searchForSharees())); + connect(_ui->shareeLineEdit, &QLineEdit::textEdited, + this, &ShareUserGroupWidget::slotLineEditTextEdited, Qt::QueuedConnection); + connect(&_completionTimer, &QTimer::timeout, this, &ShareUserGroupWidget::searchForSharees); _completionTimer.setSingleShot(true); _completionTimer.setInterval(600); @@ -192,8 +192,8 @@ void ShareUserGroupWidget::slotSharesFetched(const QList> } ShareUserLine *s = new ShareUserLine(share, _maxSharingPermissions, _isFile, _ui->scrollArea); - connect(s, SIGNAL(resizeRequested()), this, SLOT(slotAdjustScrollWidgetSize())); - connect(s, SIGNAL(visualDeletionDone()), this, SLOT(getShares())); + connect(s, &ShareUserLine::resizeRequested, this, &ShareUserGroupWidget::slotAdjustScrollWidgetSize); + connect(s, &ShareUserLine::visualDeletionDone, this, &ShareUserGroupWidget::getShares); layout->addWidget(s); x++; @@ -390,11 +390,11 @@ ShareUserLine::ShareUserLine(QSharedPointer share, _ui->permissionsEdit->setEnabled(maxSharingPermissions & (SharePermissionCreate | SharePermissionUpdate | SharePermissionDelete)); - connect(_permissionUpdate, SIGNAL(triggered(bool)), SLOT(slotPermissionsChanged())); - connect(_permissionCreate, SIGNAL(triggered(bool)), SLOT(slotPermissionsChanged())); - connect(_permissionDelete, SIGNAL(triggered(bool)), SLOT(slotPermissionsChanged())); - connect(_ui->permissionShare, SIGNAL(clicked(bool)), SLOT(slotPermissionsChanged())); - connect(_ui->permissionsEdit, SIGNAL(clicked(bool)), SLOT(slotEditPermissionsChanged())); + connect(_permissionUpdate, &QAction::triggered, this, &ShareUserLine::slotPermissionsChanged); + connect(_permissionCreate, &QAction::triggered, this, &ShareUserLine::slotPermissionsChanged); + connect(_permissionDelete, &QAction::triggered, this, &ShareUserLine::slotPermissionsChanged); + connect(_ui->permissionShare, &QAbstractButton::clicked, this, &ShareUserLine::slotPermissionsChanged); + connect(_ui->permissionsEdit, &QAbstractButton::clicked, this, &ShareUserLine::slotEditPermissionsChanged); /* * We don't show permssion share for federated shares with server <9.1 @@ -407,8 +407,8 @@ ShareUserLine::ShareUserLine(QSharedPointer share, _ui->permissionToolButton->setVisible(false); } - connect(share.data(), SIGNAL(permissionsSet()), SLOT(slotPermissionsSet())); - connect(share.data(), SIGNAL(shareDeleted()), SLOT(slotShareDeleted())); + connect(share.data(), &Share::permissionsSet, this, &ShareUserLine::slotPermissionsSet); + connect(share.data(), &Share::shareDeleted, this, &ShareUserLine::slotShareDeleted); _ui->deleteShareButton->setIcon(QIcon::fromTheme(QLatin1String("user-trash"), QIcon(QLatin1String(":/client/resources/delete.png")))); @@ -509,8 +509,8 @@ void ShareUserLine::slotShareDeleted() animation->setStartValue(height()); animation->setEndValue(0); - connect(animation, SIGNAL(finished()), SLOT(slotDeleteAnimationFinished())); - connect(animation, SIGNAL(valueChanged(QVariant)), this, SIGNAL(resizeRequested())); + connect(animation, &QAbstractAnimation::finished, this, &ShareUserLine::slotDeleteAnimationFinished); + connect(animation, &QVariantAnimation::valueChanged, this, &ShareUserLine::resizeRequested); animation->start(); } diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index 0073e6154..b46ff1c21 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -207,10 +207,10 @@ SocketApi::SocketApi(QObject *parent) qCInfo(lcSocketApi) << "server started, listening at " << socketPath; } - connect(&_localServer, SIGNAL(newConnection()), this, SLOT(slotNewConnection())); + connect(&_localServer, &QLocalServer::newConnection, this, &SocketApi::slotNewConnection); // folder watcher - connect(FolderMan::instance(), SIGNAL(folderSyncStateChange(Folder *)), this, SLOT(slotUpdateFolderView(Folder *))); + connect(FolderMan::instance(), &FolderMan::folderSyncStateChange, this, &SocketApi::slotUpdateFolderView); } SocketApi::~SocketApi() @@ -230,9 +230,9 @@ void SocketApi::slotNewConnection() return; } qCInfo(lcSocketApi) << "New connection" << socket; - connect(socket, SIGNAL(readyRead()), this, SLOT(slotReadSocket())); + connect(socket, &QIODevice::readyRead, this, &SocketApi::slotReadSocket); connect(socket, SIGNAL(disconnected()), this, SLOT(onLostConnection())); - connect(socket, SIGNAL(destroyed(QObject *)), this, SLOT(slotSocketDestroyed(QObject *))); + connect(socket, &QObject::destroyed, this, &SocketApi::slotSocketDestroyed); ASSERT(socket->readAll().isEmpty()); _listeners.append(SocketListener(socket)); diff --git a/src/gui/sslbutton.cpp b/src/gui/sslbutton.cpp index e6c87e1f3..b1a16317c 100644 --- a/src/gui/sslbutton.cpp +++ b/src/gui/sslbutton.cpp @@ -35,8 +35,8 @@ SslButton::SslButton(QWidget *parent) setAutoRaise(true); _menu = new QMenu(this); - QObject::connect(_menu, SIGNAL(aboutToShow()), - this, SLOT(slotUpdateMenu())); + QObject::connect(_menu, &QMenu::aboutToShow, + this, &SslButton::slotUpdateMenu); } QString SslButton::protoToString(QSsl::SslProtocol proto) diff --git a/src/gui/sslerrordialog.cpp b/src/gui/sslerrordialog.cpp index 83ebcffe8..bd4c9b45b 100644 --- a/src/gui/sslerrordialog.cpp +++ b/src/gui/sslerrordialog.cpp @@ -68,13 +68,13 @@ SslErrorDialog::SslErrorDialog(AccountPtr account, QWidget *parent) QPushButton *cancelButton = _ui->_dialogButtonBox->button(QDialogButtonBox::Cancel); okButton->setEnabled(false); - connect(_ui->_cbTrustConnect, SIGNAL(clicked(bool)), - okButton, SLOT(setEnabled(bool))); + connect(_ui->_cbTrustConnect, &QAbstractButton::clicked, + okButton, &QWidget::setEnabled); if (okButton) { okButton->setDefault(true); - connect(okButton, SIGNAL(clicked()), SLOT(accept())); - connect(cancelButton, SIGNAL(clicked()), SLOT(reject())); + connect(okButton, &QAbstractButton::clicked, this, &QDialog::accept); + connect(cancelButton, &QAbstractButton::clicked, this, &QDialog::reject); } } diff --git a/src/gui/synclogdialog.cpp b/src/gui/synclogdialog.cpp index d57f28851..eb58721d8 100644 --- a/src/gui/synclogdialog.cpp +++ b/src/gui/synclogdialog.cpp @@ -41,7 +41,7 @@ SyncLogDialog::SyncLogDialog(QWidget *parent, ProtocolWidget *protoWidget) QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close); if (closeButton) { - connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); + connect(closeButton, &QAbstractButton::clicked, this, &QWidget::close); } } diff --git a/src/gui/tooltipupdater.cpp b/src/gui/tooltipupdater.cpp index 30f12a39c..205dfc64f 100644 --- a/src/gui/tooltipupdater.cpp +++ b/src/gui/tooltipupdater.cpp @@ -24,8 +24,8 @@ ToolTipUpdater::ToolTipUpdater(QTreeView *treeView) : QObject(treeView) , _treeView(treeView) { - connect(_treeView->model(), SIGNAL(dataChanged(QModelIndex, QModelIndex, QVector)), - SLOT(dataChanged(QModelIndex, QModelIndex, QVector))); + connect(_treeView->model(), &QAbstractItemModel::dataChanged, + this, &ToolTipUpdater::dataChanged); _treeView->viewport()->installEventFilter(this); } diff --git a/src/gui/updater/ocupdater.cpp b/src/gui/updater/ocupdater.cpp index f1b3e1efd..8a5a9eff8 100644 --- a/src/gui/updater/ocupdater.cpp +++ b/src/gui/updater/ocupdater.cpp @@ -39,18 +39,18 @@ static const char autoUpdateAttemptedC[] = "Updater/autoUpdateAttempted"; UpdaterScheduler::UpdaterScheduler(QObject *parent) : QObject(parent) { - connect(&_updateCheckTimer, SIGNAL(timeout()), - this, SLOT(slotTimerFired())); + connect(&_updateCheckTimer, &QTimer::timeout, + this, &UpdaterScheduler::slotTimerFired); // Note: the sparkle-updater is not an OCUpdater if (OCUpdater *updater = qobject_cast(Updater::instance())) { - connect(updater, SIGNAL(newUpdateAvailable(QString, QString)), - this, SIGNAL(updaterAnnouncement(QString, QString))); - connect(updater, SIGNAL(requestRestart()), SIGNAL(requestRestart())); + connect(updater, &OCUpdater::newUpdateAvailable, + this, &UpdaterScheduler::updaterAnnouncement); + connect(updater, &OCUpdater::requestRestart, this, &UpdaterScheduler::requestRestart); } // at startup, do a check in any case. - QTimer::singleShot(3000, this, SLOT(slotTimerFired())); + QTimer::singleShot(3000, this, &UpdaterScheduler::slotTimerFired); ConfigFile cfg; auto checkInterval = cfg.updateCheckInterval(); @@ -194,9 +194,9 @@ void OCUpdater::slotStartInstaller() void OCUpdater::checkForUpdate() { QNetworkReply *reply = _accessManager->get(QNetworkRequest(_updateUrl)); - connect(_timeoutWatchdog, SIGNAL(timeout()), this, SLOT(slotTimedOut())); + connect(_timeoutWatchdog, &QTimer::timeout, this, &OCUpdater::slotTimedOut); _timeoutWatchdog->start(30 * 1000); - connect(reply, SIGNAL(finished()), this, SLOT(slotVersionInfoArrived())); + connect(reply, &QNetworkReply::finished, this, &OCUpdater::slotVersionInfoArrived); setDownloadState(CheckingServer); } @@ -303,8 +303,8 @@ void NSISUpdater::versionInfoArrived(const UpdateInfo &info) setDownloadState(DownloadComplete); } else { QNetworkReply *reply = qnam()->get(QNetworkRequest(QUrl(url))); - connect(reply, SIGNAL(readyRead()), SLOT(slotWriteFile())); - connect(reply, SIGNAL(finished()), SLOT(slotDownloadFinished())); + connect(reply, &QIODevice::readyRead, this, &NSISUpdater::slotWriteFile); + connect(reply, &QNetworkReply::finished, this, &NSISUpdater::slotDownloadFinished); setDownloadState(Downloading); _file.reset(new QTemporaryFile); _file->setAutoRemove(true); @@ -353,11 +353,11 @@ void NSISUpdater::showDialog(const UpdateInfo &info) QPushButton *reject = bb->addButton(tr("Skip this time"), QDialogButtonBox::AcceptRole); QPushButton *getupdate = bb->addButton(tr("Get update"), QDialogButtonBox::AcceptRole); - connect(skip, SIGNAL(clicked()), msgBox, SLOT(reject())); - connect(reject, SIGNAL(clicked()), msgBox, SLOT(reject())); - connect(getupdate, SIGNAL(clicked()), msgBox, SLOT(accept())); + connect(skip, &QAbstractButton::clicked, msgBox, &QDialog::reject); + connect(reject, &QAbstractButton::clicked, msgBox, &QDialog::reject); + connect(getupdate, &QAbstractButton::clicked, msgBox, &QDialog::accept); - connect(skip, SIGNAL(clicked()), SLOT(slotSetSeenVersion())); + connect(skip, &QAbstractButton::clicked, this, &NSISUpdater::slotSetSeenVersion); connect(getupdate, SIGNAL(clicked()), SLOT(slotOpenUpdateUrl())); layout->addWidget(bb); diff --git a/src/gui/wizard/owncloudadvancedsetuppage.cpp b/src/gui/wizard/owncloudadvancedsetuppage.cpp index 9bc1b60c3..a181faac0 100644 --- a/src/gui/wizard/owncloudadvancedsetuppage.cpp +++ b/src/gui/wizard/owncloudadvancedsetuppage.cpp @@ -54,12 +54,12 @@ OwncloudAdvancedSetupPage::OwncloudAdvancedSetupPage() stopSpinner(); setupCustomization(); - connect(_ui.pbSelectLocalFolder, SIGNAL(clicked()), SLOT(slotSelectFolder())); + connect(_ui.pbSelectLocalFolder, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotSelectFolder); setButtonText(QWizard::NextButton, tr("Connect...")); - connect(_ui.rSyncEverything, SIGNAL(clicked()), SLOT(slotSyncEverythingClicked())); - connect(_ui.rSelectiveSync, SIGNAL(clicked()), SLOT(slotSelectiveSyncClicked())); - connect(_ui.bSelectiveSync, SIGNAL(clicked()), SLOT(slotSelectiveSyncClicked())); + connect(_ui.rSyncEverything, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotSyncEverythingClicked); + connect(_ui.rSelectiveSync, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotSelectiveSyncClicked); + connect(_ui.bSelectiveSync, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotSelectiveSyncClicked); QIcon appIcon = theme->applicationIcon(); _ui.lServerIcon->setText(QString()); @@ -120,13 +120,13 @@ void OwncloudAdvancedSetupPage::initializePage() auto quotaJob = new PropfindJob(acc, _remoteFolder, this); quotaJob->setProperties(QList() << "http://owncloud.org/ns:size"); - connect(quotaJob, SIGNAL(result(QVariantMap)), SLOT(slotQuotaRetrieved(QVariantMap))); + connect(quotaJob, &PropfindJob::result, this, &OwncloudAdvancedSetupPage::slotQuotaRetrieved); quotaJob->start(); if (Theme::instance()->wizardSelectiveSyncDefaultNothing()) { _selectiveSyncBlacklist = QStringList("/"); - QTimer::singleShot(0, this, SLOT(slotSelectiveSyncClicked())); + QTimer::singleShot(0, this, &OwncloudAdvancedSetupPage::slotSelectiveSyncClicked); } ConfigFile cfgFile; diff --git a/src/gui/wizard/owncloudconnectionmethoddialog.cpp b/src/gui/wizard/owncloudconnectionmethoddialog.cpp index 3e40f1546..2c4bd12a5 100644 --- a/src/gui/wizard/owncloudconnectionmethoddialog.cpp +++ b/src/gui/wizard/owncloudconnectionmethoddialog.cpp @@ -24,9 +24,9 @@ OwncloudConnectionMethodDialog::OwncloudConnectionMethodDialog(QWidget *parent) { ui->setupUi(this); - connect(ui->btnNoTLS, SIGNAL(clicked(bool)), this, SLOT(returnNoTLS())); - connect(ui->btnClientSideTLS, SIGNAL(clicked(bool)), this, SLOT(returnClientSideTLS())); - connect(ui->btnBack, SIGNAL(clicked(bool)), this, SLOT(returnBack())); + connect(ui->btnNoTLS, &QAbstractButton::clicked, this, &OwncloudConnectionMethodDialog::returnNoTLS); + connect(ui->btnClientSideTLS, &QAbstractButton::clicked, this, &OwncloudConnectionMethodDialog::returnClientSideTLS); + connect(ui->btnBack, &QAbstractButton::clicked, this, &OwncloudConnectionMethodDialog::returnBack); } void OwncloudConnectionMethodDialog::setUrl(const QUrl &url) diff --git a/src/gui/wizard/owncloudsetuppage.cpp b/src/gui/wizard/owncloudsetuppage.cpp index 31a3bbc8e..4440fe21a 100644 --- a/src/gui/wizard/owncloudsetuppage.cpp +++ b/src/gui/wizard/owncloudsetuppage.cpp @@ -66,8 +66,8 @@ OwncloudSetupPage::OwncloudSetupPage(QWidget *parent) setupCustomization(); slotUrlChanged(QLatin1String("")); // don't jitter UI - connect(_ui.leUrl, SIGNAL(textChanged(QString)), SLOT(slotUrlChanged(QString))); - connect(_ui.leUrl, SIGNAL(editingFinished()), SLOT(slotUrlEditFinished())); + connect(_ui.leUrl, &QLineEdit::textChanged, this, &OwncloudSetupPage::slotUrlChanged); + connect(_ui.leUrl, &QLineEdit::editingFinished, this, &OwncloudSetupPage::slotUrlEditFinished); addCertDial = new AddCertificateDialog(this); } @@ -268,7 +268,7 @@ void OwncloudSetupPage::setErrorString(const QString &err, bool retryHTTPonly) } break; case OwncloudConnectionMethodDialog::Client_Side_TLS: addCertDial->show(); - connect(addCertDial, SIGNAL(accepted()), this, SLOT(slotCertificateAccepted())); + connect(addCertDial, &QDialog::accepted, this, &OwncloudSetupPage::slotCertificateAccepted); break; case OwncloudConnectionMethodDialog::Closed: case OwncloudConnectionMethodDialog::Back: diff --git a/src/gui/wizard/owncloudshibbolethcredspage.cpp b/src/gui/wizard/owncloudshibbolethcredspage.cpp index 9d88555a6..1467ea549 100644 --- a/src/gui/wizard/owncloudshibbolethcredspage.cpp +++ b/src/gui/wizard/owncloudshibbolethcredspage.cpp @@ -49,10 +49,10 @@ void OwncloudShibbolethCredsPage::setupBrowser() qnam->setCookieJar(jar); _browser = new ShibbolethWebView(account); - connect(_browser, SIGNAL(shibbolethCookieReceived(const QNetworkCookie &)), - this, SLOT(slotShibbolethCookieReceived(const QNetworkCookie &)), Qt::QueuedConnection); - connect(_browser, SIGNAL(rejected()), - this, SLOT(slotBrowserRejected())); + connect(_browser.data(), &ShibbolethWebView::shibbolethCookieReceived, + this, &OwncloudShibbolethCredsPage::slotShibbolethCookieReceived, Qt::QueuedConnection); + connect(_browser.data(), &ShibbolethWebView::rejected, + this, &OwncloudShibbolethCredsPage::slotBrowserRejected); _browser->move(ocWizard->x(), ocWizard->y()); _browser->show(); diff --git a/src/gui/wizard/owncloudwizard.cpp b/src/gui/wizard/owncloudwizard.cpp index a1c24bbd4..f1397c9b5 100644 --- a/src/gui/wizard/owncloudwizard.cpp +++ b/src/gui/wizard/owncloudwizard.cpp @@ -62,22 +62,22 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) setPage(WizardCommon::Page_AdvancedSetup, _advancedSetupPage); setPage(WizardCommon::Page_Result, _resultPage); - connect(this, SIGNAL(finished(int)), SIGNAL(basicSetupFinished(int))); + connect(this, &QDialog::finished, this, &OwncloudWizard::basicSetupFinished); // note: start Id is set by the calling class depending on if the // welcome text is to be shown or not. setWizardStyle(QWizard::ModernStyle); - connect(this, SIGNAL(currentIdChanged(int)), SLOT(slotCurrentPageChanged(int))); - connect(_setupPage, SIGNAL(determineAuthType(QString)), SIGNAL(determineAuthType(QString))); - connect(_httpCredsPage, SIGNAL(connectToOCUrl(QString)), SIGNAL(connectToOCUrl(QString))); - connect(_browserCredsPage, SIGNAL(connectToOCUrl(QString)), SIGNAL(connectToOCUrl(QString))); + connect(this, &QWizard::currentIdChanged, this, &OwncloudWizard::slotCurrentPageChanged); + connect(_setupPage, &OwncloudSetupPage::determineAuthType, this, &OwncloudWizard::determineAuthType); + connect(_httpCredsPage, &OwncloudHttpCredsPage::connectToOCUrl, this, &OwncloudWizard::connectToOCUrl); + connect(_browserCredsPage, &OwncloudOAuthCredsPage::connectToOCUrl, this, &OwncloudWizard::connectToOCUrl); #ifndef NO_SHIBBOLETH - connect(_shibbolethCredsPage, SIGNAL(connectToOCUrl(QString)), SIGNAL(connectToOCUrl(QString))); + connect(_shibbolethCredsPage, &OwncloudShibbolethCredsPage::connectToOCUrl, this, &OwncloudWizard::connectToOCUrl); #endif - connect(_advancedSetupPage, SIGNAL(createLocalAndRemoteFolders(QString, QString)), - SIGNAL(createLocalAndRemoteFolders(QString, QString))); - connect(this, SIGNAL(customButtonClicked(int)), this, SIGNAL(skipFolderConfiguration())); + connect(_advancedSetupPage, &OwncloudAdvancedSetupPage::createLocalAndRemoteFolders, + this, &OwncloudWizard::createLocalAndRemoteFolders); + connect(this, &QWizard::customButtonClicked, this, &OwncloudWizard::skipFolderConfiguration); Theme *theme = Theme::instance(); @@ -193,7 +193,7 @@ void OwncloudWizard::slotCurrentPageChanged(int id) } if (id == WizardCommon::Page_Result) { - disconnect(this, SIGNAL(finished(int)), this, SIGNAL(basicSetupFinished(int))); + disconnect(this, &QDialog::finished, this, &OwncloudWizard::basicSetupFinished); emit basicSetupFinished(QDialog::Accepted); appendToConfigurationLog(QString::null); // Immediately close on show, we currently don't want this page anymore diff --git a/src/gui/wizard/owncloudwizardresultpage.cpp b/src/gui/wizard/owncloudwizardresultpage.cpp index 4610b409d..71764e35c 100644 --- a/src/gui/wizard/owncloudwizardresultpage.cpp +++ b/src/gui/wizard/owncloudwizardresultpage.cpp @@ -41,7 +41,7 @@ OwncloudWizardResultPage::OwncloudWizardResultPage() _ui.pbOpenLocal->setIcon(QIcon(QLatin1String(":/client/resources/folder-sync.png"))); _ui.pbOpenLocal->setIconSize(QSize(48, 48)); _ui.pbOpenLocal->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); - connect(_ui.pbOpenLocal, SIGNAL(clicked()), SLOT(slotOpenLocal())); + connect(_ui.pbOpenLocal, &QAbstractButton::clicked, this, &OwncloudWizardResultPage::slotOpenLocal); Theme *theme = Theme::instance(); QIcon appIcon = theme->applicationIcon(); @@ -49,7 +49,7 @@ OwncloudWizardResultPage::OwncloudWizardResultPage() _ui.pbOpenServer->setIcon(appIcon.pixmap(48)); _ui.pbOpenServer->setIconSize(QSize(48, 48)); _ui.pbOpenServer->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); - connect(_ui.pbOpenServer, SIGNAL(clicked()), SLOT(slotOpenServer())); + connect(_ui.pbOpenServer, &QAbstractButton::clicked, this, &OwncloudWizardResultPage::slotOpenServer); setupCustomization(); } diff --git a/src/libsync/abstractnetworkjob.cpp b/src/libsync/abstractnetworkjob.cpp index 14f8b1dda..41d61b307 100644 --- a/src/libsync/abstractnetworkjob.cpp +++ b/src/libsync/abstractnetworkjob.cpp @@ -52,15 +52,15 @@ AbstractNetworkJob::AbstractNetworkJob(AccountPtr account, const QString &path, { _timer.setSingleShot(true); _timer.setInterval(OwncloudPropagator::httpTimeout() * 1000); // default to 5 minutes. - connect(&_timer, SIGNAL(timeout()), this, SLOT(slotTimeout())); + connect(&_timer, &QTimer::timeout, this, &AbstractNetworkJob::slotTimeout); - connect(this, SIGNAL(networkActivity()), SLOT(resetTimeout())); + connect(this, &AbstractNetworkJob::networkActivity, this, &AbstractNetworkJob::resetTimeout); // Network activity on the propagator jobs (GET/PUT) keeps all requests alive. // This is a workaround for OC instances which only support one // parallel up and download if (_account) { - connect(_account.data(), SIGNAL(propagatorNetworkActivity()), SLOT(resetTimeout())); + connect(_account.data(), &Account::propagatorNetworkActivity, this, &AbstractNetworkJob::resetTimeout); } } @@ -103,13 +103,13 @@ void AbstractNetworkJob::setPath(const QString &path) void AbstractNetworkJob::setupConnections(QNetworkReply *reply) { - connect(reply, SIGNAL(finished()), SLOT(slotFinished())); - connect(reply, SIGNAL(encrypted()), SIGNAL(networkActivity())); - connect(reply->manager(), SIGNAL(proxyAuthenticationRequired(QNetworkProxy, QAuthenticator *)), SIGNAL(networkActivity())); - connect(reply, SIGNAL(sslErrors(QList)), SIGNAL(networkActivity())); - connect(reply, SIGNAL(metaDataChanged()), SIGNAL(networkActivity())); - connect(reply, SIGNAL(downloadProgress(qint64, qint64)), SIGNAL(networkActivity())); - connect(reply, SIGNAL(uploadProgress(qint64, qint64)), SIGNAL(networkActivity())); + connect(reply, &QNetworkReply::finished, this, &AbstractNetworkJob::slotFinished); + connect(reply, &QNetworkReply::encrypted, this, &AbstractNetworkJob::networkActivity); + connect(reply->manager(), &QNetworkAccessManager::proxyAuthenticationRequired, this, &AbstractNetworkJob::networkActivity); + connect(reply, &QNetworkReply::sslErrors, this, &AbstractNetworkJob::networkActivity); + connect(reply, &QNetworkReply::metaDataChanged, this, &AbstractNetworkJob::networkActivity); + connect(reply, &QNetworkReply::downloadProgress, this, &AbstractNetworkJob::networkActivity); + connect(reply, &QNetworkReply::uploadProgress, this, &AbstractNetworkJob::networkActivity); } QNetworkReply *AbstractNetworkJob::addTimer(QNetworkReply *reply) diff --git a/src/libsync/account.cpp b/src/libsync/account.cpp index 589b8e5bd..4c5f8a411 100644 --- a/src/libsync/account.cpp +++ b/src/libsync/account.cpp @@ -150,12 +150,12 @@ void Account::setCredentials(AbstractCredentials *cred) } connect(_am.data(), SIGNAL(sslErrors(QNetworkReply *, QList)), SLOT(slotHandleSslErrors(QNetworkReply *, QList))); - connect(_am.data(), SIGNAL(proxyAuthenticationRequired(QNetworkProxy, QAuthenticator *)), - SIGNAL(proxyAuthenticationRequired(QNetworkProxy, QAuthenticator *))); - connect(_credentials.data(), SIGNAL(fetched()), - SLOT(slotCredentialsFetched())); - connect(_credentials.data(), SIGNAL(asked()), - SLOT(slotCredentialsAsked())); + connect(_am.data(), &QNetworkAccessManager::proxyAuthenticationRequired, + this, &Account::proxyAuthenticationRequired); + connect(_credentials.data(), &AbstractCredentials::fetched, + this, &Account::slotCredentialsFetched); + connect(_credentials.data(), &AbstractCredentials::asked, + this, &Account::slotCredentialsAsked); } QUrl Account::davUrl() const @@ -213,8 +213,8 @@ void Account::resetNetworkAccessManager() _am->setCookieJar(jar); // takes ownership of the old cookie jar connect(_am.data(), SIGNAL(sslErrors(QNetworkReply *, QList)), SLOT(slotHandleSslErrors(QNetworkReply *, QList))); - connect(_am.data(), SIGNAL(proxyAuthenticationRequired(QNetworkProxy, QAuthenticator *)), - SIGNAL(proxyAuthenticationRequired(QNetworkProxy, QAuthenticator *))); + connect(_am.data(), &QNetworkAccessManager::proxyAuthenticationRequired, + this, &Account::proxyAuthenticationRequired); } QNetworkAccessManager *Account::networkAccessManager() diff --git a/src/libsync/bandwidthmanager.cpp b/src/libsync/bandwidthmanager.cpp index 97cbddd21..0393b353f 100644 --- a/src/libsync/bandwidthmanager.cpp +++ b/src/libsync/bandwidthmanager.cpp @@ -56,34 +56,34 @@ BandwidthManager::BandwidthManager(OwncloudPropagator *p) _currentUploadLimit = _propagator->_uploadLimit.fetchAndAddAcquire(0); _currentDownloadLimit = _propagator->_downloadLimit.fetchAndAddAcquire(0); - QObject::connect(&_switchingTimer, SIGNAL(timeout()), this, SLOT(switchingTimerExpired())); + QObject::connect(&_switchingTimer, &QTimer::timeout, this, &BandwidthManager::switchingTimerExpired); _switchingTimer.setInterval(10 * 1000); _switchingTimer.start(); QMetaObject::invokeMethod(this, "switchingTimerExpired", Qt::QueuedConnection); // absolute uploads/downloads - QObject::connect(&_absoluteLimitTimer, SIGNAL(timeout()), this, SLOT(absoluteLimitTimerExpired())); + QObject::connect(&_absoluteLimitTimer, &QTimer::timeout, this, &BandwidthManager::absoluteLimitTimerExpired); _absoluteLimitTimer.setInterval(1000); _absoluteLimitTimer.start(); // Relative uploads - QObject::connect(&_relativeUploadMeasuringTimer, SIGNAL(timeout()), - this, SLOT(relativeUploadMeasuringTimerExpired())); + QObject::connect(&_relativeUploadMeasuringTimer, &QTimer::timeout, + this, &BandwidthManager::relativeUploadMeasuringTimerExpired); _relativeUploadMeasuringTimer.setInterval(relativeLimitMeasuringTimerIntervalMsec); _relativeUploadMeasuringTimer.start(); _relativeUploadMeasuringTimer.setSingleShot(true); // will be restarted from the delay timer - QObject::connect(&_relativeUploadDelayTimer, SIGNAL(timeout()), - this, SLOT(relativeUploadDelayTimerExpired())); + QObject::connect(&_relativeUploadDelayTimer, &QTimer::timeout, + this, &BandwidthManager::relativeUploadDelayTimerExpired); _relativeUploadDelayTimer.setSingleShot(true); // will be restarted from the measuring timer // Relative downloads - QObject::connect(&_relativeDownloadMeasuringTimer, SIGNAL(timeout()), - this, SLOT(relativeDownloadMeasuringTimerExpired())); + QObject::connect(&_relativeDownloadMeasuringTimer, &QTimer::timeout, + this, &BandwidthManager::relativeDownloadMeasuringTimerExpired); _relativeDownloadMeasuringTimer.setInterval(relativeLimitMeasuringTimerIntervalMsec); _relativeDownloadMeasuringTimer.start(); _relativeDownloadMeasuringTimer.setSingleShot(true); // will be restarted from the delay timer - QObject::connect(&_relativeDownloadDelayTimer, SIGNAL(timeout()), - this, SLOT(relativeDownloadDelayTimerExpired())); + QObject::connect(&_relativeDownloadDelayTimer, &QTimer::timeout, + this, &BandwidthManager::relativeDownloadDelayTimerExpired); _relativeDownloadDelayTimer.setSingleShot(true); // will be restarted from the measuring timer } diff --git a/src/libsync/connectionvalidator.cpp b/src/libsync/connectionvalidator.cpp index f2bae6638..fd454e68f 100644 --- a/src/libsync/connectionvalidator.cpp +++ b/src/libsync/connectionvalidator.cpp @@ -116,9 +116,9 @@ void ConnectionValidator::slotCheckServerAndAuth() CheckServerJob *checkJob = new CheckServerJob(_account, this); checkJob->setTimeout(timeoutToUseMsec); checkJob->setIgnoreCredentialFailure(true); - connect(checkJob, SIGNAL(instanceFound(QUrl, QJsonObject)), SLOT(slotStatusFound(QUrl, QJsonObject))); - connect(checkJob, SIGNAL(instanceNotFound(QNetworkReply *)), SLOT(slotNoStatusFound(QNetworkReply *))); - connect(checkJob, SIGNAL(timeout(QUrl)), SLOT(slotJobTimeout(QUrl))); + connect(checkJob, &CheckServerJob::instanceFound, this, &ConnectionValidator::slotStatusFound); + connect(checkJob, &CheckServerJob::instanceNotFound, this, &ConnectionValidator::slotNoStatusFound); + connect(checkJob, &CheckServerJob::timeout, this, &ConnectionValidator::slotJobTimeout); checkJob->start(); } @@ -154,7 +154,7 @@ void ConnectionValidator::slotStatusFound(const QUrl &url, const QJsonObject &in } // now check the authentication - QTimer::singleShot( 0, this, SLOT( checkAuthentication() )); + QTimer::singleShot(0, this, &ConnectionValidator::checkAuthentication); } // status.php could not be loaded (network or server issue!). @@ -201,8 +201,8 @@ void ConnectionValidator::checkAuthentication() PropfindJob *job = new PropfindJob(_account, "/", this); job->setTimeout(timeoutToUseMsec); job->setProperties(QList() << "getlastmodified"); - connect(job, SIGNAL(result(QVariantMap)), SLOT(slotAuthSuccess())); - connect(job, SIGNAL(finishedWithError(QNetworkReply *)), SLOT(slotAuthFailed(QNetworkReply *))); + connect(job, &PropfindJob::result, this, &ConnectionValidator::slotAuthSuccess); + connect(job, &PropfindJob::finishedWithError, this, &ConnectionValidator::slotAuthFailed); job->start(); } @@ -249,7 +249,7 @@ void ConnectionValidator::checkServerCapabilities() { JsonApiJob *job = new JsonApiJob(_account, QLatin1String("ocs/v1.php/cloud/capabilities"), this); job->setTimeout(timeoutToUseMsec); - QObject::connect(job, SIGNAL(jsonReceived(QJsonDocument, int)), this, SLOT(slotCapabilitiesRecieved(QJsonDocument))); + QObject::connect(job, &JsonApiJob::jsonReceived, this, &ConnectionValidator::slotCapabilitiesRecieved); job->start(); } @@ -272,7 +272,7 @@ void ConnectionValidator::fetchUser() { JsonApiJob *job = new JsonApiJob(_account, QLatin1String("ocs/v1.php/cloud/user"), this); job->setTimeout(timeoutToUseMsec); - QObject::connect(job, SIGNAL(jsonReceived(QJsonDocument, int)), this, SLOT(slotUserFetched(QJsonDocument))); + QObject::connect(job, &JsonApiJob::jsonReceived, this, &ConnectionValidator::slotUserFetched); job->start(); } @@ -312,7 +312,7 @@ void ConnectionValidator::slotUserFetched(const QJsonDocument &json) AvatarJob *job = new AvatarJob(_account, this); job->setTimeout(20 * 1000); - QObject::connect(job, SIGNAL(avatarPixmap(QImage)), this, SLOT(slotAvatarImage(QImage))); + QObject::connect(job, &AvatarJob::avatarPixmap, this, &ConnectionValidator::slotAvatarImage); job->start(); } diff --git a/src/libsync/creds/httpcredentials.cpp b/src/libsync/creds/httpcredentials.cpp index a40890424..52e96edf3 100644 --- a/src/libsync/creds/httpcredentials.cpp +++ b/src/libsync/creds/httpcredentials.cpp @@ -147,8 +147,8 @@ QNetworkAccessManager *HttpCredentials::createQNAM() const { AccessManager *qnam = new HttpCredentialsAccessManager(this); - connect(qnam, SIGNAL(authenticationRequired(QNetworkReply *, QAuthenticator *)), - this, SLOT(slotAuthentication(QNetworkReply *, QAuthenticator *))); + connect(qnam, &QNetworkAccessManager::authenticationRequired, + this, &HttpCredentials::slotAuthentication); return qnam; } @@ -198,7 +198,7 @@ void HttpCredentials::fetchFromKeychainHelper() addSettingsToJob(_account, job); job->setInsecureFallback(false); job->setKey(kck); - connect(job, SIGNAL(finished(QKeychain::Job *)), SLOT(slotReadClientCertPEMJobDone(QKeychain::Job *))); + connect(job, &Job::finished, this, &HttpCredentials::slotReadClientCertPEMJobDone); job->start(); } @@ -238,7 +238,7 @@ void HttpCredentials::slotReadClientCertPEMJobDone(QKeychain::Job *incoming) addSettingsToJob(_account, job); job->setInsecureFallback(false); job->setKey(kck); - connect(job, SIGNAL(finished(QKeychain::Job *)), SLOT(slotReadClientKeyPEMJobDone(QKeychain::Job *))); + connect(job, &Job::finished, this, &HttpCredentials::slotReadClientKeyPEMJobDone); job->start(); } @@ -273,7 +273,7 @@ void HttpCredentials::slotReadClientKeyPEMJobDone(QKeychain::Job *incoming) addSettingsToJob(_account, job); job->setInsecureFallback(false); job->setKey(kck); - connect(job, SIGNAL(finished(QKeychain::Job *)), SLOT(slotReadJobDone(QKeychain::Job *))); + connect(job, &Job::finished, this, &HttpCredentials::slotReadJobDone); job->start(); } @@ -419,7 +419,7 @@ void HttpCredentials::invalidateToken() // indirectly) from QNetworkAccessManagerPrivate::authenticationRequired, which itself // is a called from a BlockingQueuedConnection from the Qt HTTP thread. And clearing the // cache needs to synchronize again with the HTTP thread. - QTimer::singleShot(0, _account, SLOT(clearQNAMCache())); + QTimer::singleShot(0, _account, &Account::clearQNAMCache); } void HttpCredentials::forgetSensitiveData() @@ -446,7 +446,7 @@ void HttpCredentials::persist() WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); addSettingsToJob(_account, job); job->setInsecureFallback(false); - connect(job, SIGNAL(finished(QKeychain::Job *)), SLOT(slotWriteClientCertPEMJobDone(QKeychain::Job *))); + connect(job, &Job::finished, this, &HttpCredentials::slotWriteClientCertPEMJobDone); job->setKey(keychainKey(_account->url().toString(), _user + clientCertificatePEMC, _account->id())); job->setBinaryData(_clientSslCertificate.toPem()); job->start(); @@ -459,7 +459,7 @@ void HttpCredentials::slotWriteClientCertPEMJobDone(Job *incomingJob) WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); addSettingsToJob(_account, job); job->setInsecureFallback(false); - connect(job, SIGNAL(finished(QKeychain::Job *)), SLOT(slotWriteClientKeyPEMJobDone(QKeychain::Job *))); + connect(job, &Job::finished, this, &HttpCredentials::slotWriteClientKeyPEMJobDone); job->setKey(keychainKey(_account->url().toString(), _user + clientKeyPEMC, _account->id())); job->setBinaryData(_clientSslKey.toPem()); job->start(); @@ -471,7 +471,7 @@ void HttpCredentials::slotWriteClientKeyPEMJobDone(Job *incomingJob) WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); addSettingsToJob(_account, job); job->setInsecureFallback(false); - connect(job, SIGNAL(finished(QKeychain::Job *)), SLOT(slotWriteJobDone(QKeychain::Job *))); + connect(job, &Job::finished, this, &HttpCredentials::slotWriteJobDone); job->setKey(keychainKey(_account->url().toString(), _user, _account->id())); job->setTextData(isUsingOAuth() ? _refreshToken : _password); job->start(); diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index a4345c58a..537e6ee02 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -282,10 +282,10 @@ void DiscoverySingleDirectoryJob::start() lsColJob->setProperties(props); - QObject::connect(lsColJob, SIGNAL(directoryListingIterated(QString, QMap)), - this, SLOT(directoryListingIteratedSlot(QString, QMap))); - QObject::connect(lsColJob, SIGNAL(finishedWithError(QNetworkReply *)), this, SLOT(lsJobFinishedWithErrorSlot(QNetworkReply *))); - QObject::connect(lsColJob, SIGNAL(finishedWithoutError()), this, SLOT(lsJobFinishedWithoutErrorSlot())); + QObject::connect(lsColJob, &LsColJob::directoryListingIterated, + this, &DiscoverySingleDirectoryJob::directoryListingIteratedSlot); + QObject::connect(lsColJob, &LsColJob::finishedWithError, this, &DiscoverySingleDirectoryJob::lsJobFinishedWithErrorSlot); + QObject::connect(lsColJob, &LsColJob::finishedWithoutError, this, &DiscoverySingleDirectoryJob::lsJobFinishedWithoutErrorSlot); lsColJob->start(); _lsColJob = lsColJob; @@ -469,11 +469,11 @@ void DiscoveryMainThread::setupHooks(DiscoveryJob *discoveryJob, const QString & _discoveryJob = discoveryJob; _pathPrefix = pathPrefix; - connect(discoveryJob, SIGNAL(doOpendirSignal(QString, DiscoveryDirectoryResult *)), - this, SLOT(doOpendirSlot(QString, DiscoveryDirectoryResult *)), + connect(discoveryJob, &DiscoveryJob::doOpendirSignal, + this, &DiscoveryMainThread::doOpendirSlot, Qt::QueuedConnection); - connect(discoveryJob, SIGNAL(doGetSizeSignal(QString, qint64 *)), - this, SLOT(doGetSizeSlot(QString, qint64 *)), + connect(discoveryJob, &DiscoveryJob::doGetSizeSignal, + this, &DiscoveryMainThread::doGetSizeSlot, Qt::QueuedConnection); } @@ -499,16 +499,16 @@ void DiscoveryMainThread::doOpendirSlot(const QString &subPath, DiscoveryDirecto // Schedule the DiscoverySingleDirectoryJob _singleDirJob = new DiscoverySingleDirectoryJob(_account, fullPath, this); - QObject::connect(_singleDirJob, SIGNAL(finishedWithResult()), - this, SLOT(singleDirectoryJobResultSlot())); - QObject::connect(_singleDirJob, SIGNAL(finishedWithError(int, QString)), - this, SLOT(singleDirectoryJobFinishedWithErrorSlot(int, QString))); - QObject::connect(_singleDirJob, SIGNAL(firstDirectoryPermissions(QString)), - this, SLOT(singleDirectoryJobFirstDirectoryPermissionsSlot(QString))); - QObject::connect(_singleDirJob, SIGNAL(etagConcatenation(QString)), - this, SIGNAL(etagConcatenation(QString))); - QObject::connect(_singleDirJob, SIGNAL(etag(QString)), - this, SIGNAL(etag(QString))); + QObject::connect(_singleDirJob.data(), &DiscoverySingleDirectoryJob::finishedWithResult, + this, &DiscoveryMainThread::singleDirectoryJobResultSlot); + QObject::connect(_singleDirJob.data(), &DiscoverySingleDirectoryJob::finishedWithError, + this, &DiscoveryMainThread::singleDirectoryJobFinishedWithErrorSlot); + QObject::connect(_singleDirJob.data(), &DiscoverySingleDirectoryJob::firstDirectoryPermissions, + this, &DiscoveryMainThread::singleDirectoryJobFirstDirectoryPermissionsSlot); + QObject::connect(_singleDirJob.data(), &DiscoverySingleDirectoryJob::etagConcatenation, + this, &DiscoveryMainThread::etagConcatenation); + QObject::connect(_singleDirJob.data(), &DiscoverySingleDirectoryJob::etag, + this, &DiscoveryMainThread::etag); if (!_firstFolderProcessed) { _singleDirJob->setIsRootPath(); @@ -584,10 +584,10 @@ void DiscoveryMainThread::doGetSizeSlot(const QString &path, qint64 *result) auto propfindJob = new PropfindJob(_account, fullPath, this); propfindJob->setProperties(QList() << "resourcetype" << "http://owncloud.org/ns:size"); - QObject::connect(propfindJob, SIGNAL(finishedWithError()), - this, SLOT(slotGetSizeFinishedWithError())); - QObject::connect(propfindJob, SIGNAL(result(QVariantMap)), - this, SLOT(slotGetSizeResult(QVariantMap))); + QObject::connect(propfindJob, &PropfindJob::finishedWithError, + this, &DiscoveryMainThread::slotGetSizeFinishedWithError); + QObject::connect(propfindJob, &PropfindJob::result, + this, &DiscoveryMainThread::slotGetSizeResult); propfindJob->start(); } diff --git a/src/libsync/networkjobs.cpp b/src/libsync/networkjobs.cpp index 3a87571cf..3af0f6c21 100644 --- a/src/libsync/networkjobs.cpp +++ b/src/libsync/networkjobs.cpp @@ -362,14 +362,14 @@ bool LsColJob::finished() int httpCode = reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (httpCode == 207 && contentType.contains("application/xml; charset=utf-8")) { LsColXMLParser parser; - connect(&parser, SIGNAL(directoryListingSubfolders(const QStringList &)), - this, SIGNAL(directoryListingSubfolders(const QStringList &))); - connect(&parser, SIGNAL(directoryListingIterated(const QString &, const QMap &)), - this, SIGNAL(directoryListingIterated(const QString &, const QMap &))); - connect(&parser, SIGNAL(finishedWithError(QNetworkReply *)), - this, SIGNAL(finishedWithError(QNetworkReply *))); - connect(&parser, SIGNAL(finishedWithoutError()), - this, SIGNAL(finishedWithoutError())); + connect(&parser, &LsColXMLParser::directoryListingSubfolders, + this, &LsColJob::directoryListingSubfolders); + connect(&parser, &LsColXMLParser::directoryListingIterated, + this, &LsColJob::directoryListingIterated); + connect(&parser, &LsColXMLParser::finishedWithError, + this, &LsColJob::finishedWithError); + connect(&parser, &LsColXMLParser::finishedWithoutError, + this, &LsColJob::finishedWithoutError); QString expectedPath = reply()->request().url().path(); // something like "/owncloud/remote.php/webdav/folder" if (!parser.parse(reply()->readAll(), &_sizes, expectedPath)) { @@ -400,16 +400,16 @@ CheckServerJob::CheckServerJob(AccountPtr account, QObject *parent) , _permanentRedirects(0) { setIgnoreCredentialFailure(true); - connect(this, SIGNAL(redirected(QNetworkReply *, QUrl, int)), - SLOT(slotRedirected(QNetworkReply *, QUrl, int))); + connect(this, &AbstractNetworkJob::redirected, + this, &CheckServerJob::slotRedirected); } void CheckServerJob::start() { _serverUrl = account()->url(); sendRequest("GET", Utility::concatUrlPath(_serverUrl, path())); - connect(reply(), SIGNAL(metaDataChanged()), this, SLOT(metaDataChangedSlot())); - connect(reply(), SIGNAL(encrypted()), this, SLOT(encryptedSlot())); + connect(reply(), &QNetworkReply::metaDataChanged, this, &CheckServerJob::metaDataChangedSlot); + connect(reply(), &QNetworkReply::encrypted, this, &CheckServerJob::encryptedSlot); AbstractNetworkJob::start(); } diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index 346d61e86..46c3899ae 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -331,8 +331,8 @@ bool PropagateItemJob::checkForProblemsWithShared(int httpStatusCode, const QStr if (newJob) { newJob->setRestoreJobMsg(msg); _restoreJob.reset(newJob); - connect(_restoreJob.data(), SIGNAL(finished(SyncFileItem::Status)), - this, SLOT(slotRestoreJobFinished(SyncFileItem::Status))); + connect(_restoreJob.data(), &PropagatorJob::finished, + this, &PropagateItemJob::slotRestoreJobFinished); QMetaObject::invokeMethod(newJob, "start"); } return true; @@ -521,7 +521,7 @@ void OwncloudPropagator::start(const SyncFileItemVector &items) _rootJob->appendJob(it); } - connect(_rootJob.data(), SIGNAL(finished(SyncFileItem::Status)), this, SLOT(emitFinished(SyncFileItem::Status))); + connect(_rootJob.data(), &PropagatorJob::finished, this, &OwncloudPropagator::emitFinished); scheduleNextJob(); } @@ -654,7 +654,7 @@ QString OwncloudPropagator::getFilePath(const QString &tmp_file_name) const void OwncloudPropagator::scheduleNextJob() { - QTimer::singleShot(0, this, SLOT(scheduleNextJobImpl())); + QTimer::singleShot(0, this, &OwncloudPropagator::scheduleNextJobImpl); } void OwncloudPropagator::scheduleNextJobImpl() @@ -854,9 +854,9 @@ PropagateDirectory::PropagateDirectory(OwncloudPropagator *propagator, const Syn , _subJobs(propagator) { if (_firstJob) { - connect(_firstJob.data(), SIGNAL(finished(SyncFileItem::Status)), this, SLOT(slotFirstJobFinished(SyncFileItem::Status))); + connect(_firstJob.data(), &PropagatorJob::finished, this, &PropagateDirectory::slotFirstJobFinished); } - connect(&_subJobs, SIGNAL(finished(SyncFileItem::Status)), this, SLOT(slotSubJobsFinished(SyncFileItem::Status))); + connect(&_subJobs, &PropagatorJob::finished, this, &PropagateDirectory::slotSubJobsFinished); } PropagatorJob::JobParallelism PropagateDirectory::parallelism() @@ -968,7 +968,7 @@ void CleanupPollsJob::start() if (record.isValid()) { SyncFileItemPtr item = SyncFileItem::fromSyncJournalFileRecord(record); PollJob *job = new PollJob(_account, info._url, item, _journal, _localPath, this); - connect(job, SIGNAL(finishedSignal()), SLOT(slotPollFinished())); + connect(job, &PollJob::finishedSignal, this, &CleanupPollsJob::slotPollFinished); job->start(); } } diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h index f62fd58a9..605614902 100644 --- a/src/libsync/owncloudpropagator.h +++ b/src/libsync/owncloudpropagator.h @@ -221,7 +221,7 @@ private slots: bool possiblyRunNextJob(PropagatorJob *next) { if (next->_state == NotYetStarted) { - connect(next, SIGNAL(finished(SyncFileItem::Status)), this, SLOT(slotSubJobFinished(SyncFileItem::Status))); + connect(next, &PropagatorJob::finished, this, &PropagatorCompositeJob::slotSubJobFinished); } return next->scheduleSelfOrChild(); } diff --git a/src/libsync/progressdispatcher.cpp b/src/libsync/progressdispatcher.cpp index df6417e4a..bfdc0521b 100644 --- a/src/libsync/progressdispatcher.cpp +++ b/src/libsync/progressdispatcher.cpp @@ -130,7 +130,7 @@ void ProgressDispatcher::setProgressInfo(const QString &folder, const ProgressIn ProgressInfo::ProgressInfo() { - connect(&_updateEstimatesTimer, SIGNAL(timeout()), SLOT(updateEstimates())); + connect(&_updateEstimatesTimer, &QTimer::timeout, this, &ProgressInfo::updateEstimates); reset(); } diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index 3e6b8898a..812c01316 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -137,10 +137,10 @@ void GETFileJob::start() qCWarning(lcGetJob) << " Network error: " << errorString(); } - connect(reply(), SIGNAL(metaDataChanged()), this, SLOT(slotMetaDataChanged())); - connect(reply(), SIGNAL(readyRead()), this, SLOT(slotReadyRead())); - connect(reply(), SIGNAL(downloadProgress(qint64, qint64)), this, SIGNAL(downloadProgress(qint64, qint64))); - connect(this, SIGNAL(networkActivity()), account().data(), SIGNAL(propagatorNetworkActivity())); + connect(reply(), &QNetworkReply::metaDataChanged, this, &GETFileJob::slotMetaDataChanged); + connect(reply(), &QIODevice::readyRead, this, &GETFileJob::slotReadyRead); + connect(reply(), &QNetworkReply::downloadProgress, this, &GETFileJob::downloadProgress); + connect(this, &AbstractNetworkJob::networkActivity, account().data(), &Account::propagatorNetworkActivity); AbstractNetworkJob::start(); } @@ -356,8 +356,8 @@ void PropagateDownloadFile::start() qCDebug(lcPropagateDownload) << _item->_file << "may not need download, computing checksum"; auto computeChecksum = new ComputeChecksum(this); computeChecksum->setChecksumType(parseChecksumHeaderType(_item->_checksumHeader)); - connect(computeChecksum, SIGNAL(done(QByteArray, QByteArray)), - SLOT(conflictChecksumComputed(QByteArray, QByteArray))); + connect(computeChecksum, &ComputeChecksum::done, + this, &PropagateDownloadFile::conflictChecksumComputed); computeChecksum->start(propagator()->getFilePath(_item->_file)); return; } @@ -478,8 +478,8 @@ void PropagateDownloadFile::startDownload() &_tmpFile, headers, expectedEtagForResume, _resumeStart, this); } _job->setBandwidthManager(&propagator()->_bandwidthManager); - connect(_job, SIGNAL(finishedSignal()), this, SLOT(slotGetFinished())); - connect(_job, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(slotDownloadProgress(qint64, qint64))); + connect(_job.data(), &GETFileJob::finishedSignal, this, &PropagateDownloadFile::slotGetFinished); + connect(_job.data(), &GETFileJob::downloadProgress, this, &PropagateDownloadFile::slotDownloadProgress); propagator()->_activeJobList.append(this); _job->start(); } @@ -620,10 +620,10 @@ void PropagateDownloadFile::slotGetFinished() // will also emit the validated() signal to continue the flow in slot transmissionChecksumValidated() // as this is (still) also correct. ValidateChecksumHeader *validator = new ValidateChecksumHeader(this); - connect(validator, SIGNAL(validated(QByteArray, QByteArray)), - SLOT(transmissionChecksumValidated(QByteArray, QByteArray))); - connect(validator, SIGNAL(validationFailed(QString)), - SLOT(slotChecksumFail(QString))); + connect(validator, &ValidateChecksumHeader::validated, + this, &PropagateDownloadFile::transmissionChecksumValidated); + connect(validator, &ValidateChecksumHeader::validationFailed, + this, &PropagateDownloadFile::slotChecksumFail); auto checksumHeader = job->reply()->rawHeader(checkSumHeaderC); validator->start(_tmpFile.fileName(), checksumHeader); } @@ -750,8 +750,8 @@ void PropagateDownloadFile::transmissionChecksumValidated(const QByteArray &chec auto computeChecksum = new ComputeChecksum(this); computeChecksum->setChecksumType(theContentChecksumType); - connect(computeChecksum, SIGNAL(done(QByteArray, QByteArray)), - SLOT(contentChecksumComputed(QByteArray, QByteArray))); + connect(computeChecksum, &ComputeChecksum::done, + this, &PropagateDownloadFile::contentChecksumComputed); computeChecksum->start(_tmpFile.fileName()); } diff --git a/src/libsync/propagateremotedelete.cpp b/src/libsync/propagateremotedelete.cpp index 0ace61790..2e7d03b22 100644 --- a/src/libsync/propagateremotedelete.cpp +++ b/src/libsync/propagateremotedelete.cpp @@ -70,7 +70,7 @@ void PropagateRemoteDelete::start() _job = new DeleteJob(propagator()->account(), propagator()->_remoteFolder + _item->_file, this); - connect(_job, SIGNAL(finishedSignal()), this, SLOT(slotDeleteJobFinished())); + connect(_job.data(), &DeleteJob::finishedSignal, this, &PropagateRemoteDelete::slotDeleteJobFinished); propagator()->_activeJobList.append(this); _job->start(); } diff --git a/src/libsync/propagateremotemkdir.cpp b/src/libsync/propagateremotemkdir.cpp index 4772f42eb..fb0869a2b 100644 --- a/src/libsync/propagateremotemkdir.cpp +++ b/src/libsync/propagateremotemkdir.cpp @@ -111,8 +111,8 @@ void PropagateRemoteMkdir::slotMkcolJobFinished() auto propfindJob = new PropfindJob(_job->account(), _job->path(), this); propfindJob->setProperties(QList() << "getetag" << "http://owncloud.org/ns:id"); - QObject::connect(propfindJob, SIGNAL(result(QVariantMap)), this, SLOT(propfindResult(QVariantMap))); - QObject::connect(propfindJob, SIGNAL(finishedWithError()), this, SLOT(propfindError())); + QObject::connect(propfindJob, &PropfindJob::result, this, &PropagateRemoteMkdir::propfindResult); + QObject::connect(propfindJob, &PropfindJob::finishedWithError, this, &PropagateRemoteMkdir::propfindError); propfindJob->start(); _job = propfindJob; return; diff --git a/src/libsync/propagateremotemove.cpp b/src/libsync/propagateremotemove.cpp index b347b0ab0..db8ab1836 100644 --- a/src/libsync/propagateremotemove.cpp +++ b/src/libsync/propagateremotemove.cpp @@ -112,7 +112,7 @@ void PropagateRemoteMove::start() _job = new MoveJob(propagator()->account(), propagator()->_remoteFolder + _item->_file, destination, this); - connect(_job, SIGNAL(finishedSignal()), this, SLOT(slotMoveJobFinished())); + connect(_job.data(), &MoveJob::finishedSignal, this, &PropagateRemoteMove::slotMoveJobFinished); propagator()->_activeJobList.append(this); _job->start(); } diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp index 05ec97a00..5ba8a5c6b 100644 --- a/src/libsync/propagateupload.cpp +++ b/src/libsync/propagateupload.cpp @@ -85,8 +85,8 @@ void PUTFileJob::start() qCWarning(lcPutJob) << " Network error: " << reply()->errorString(); } - connect(reply(), SIGNAL(uploadProgress(qint64, qint64)), this, SIGNAL(uploadProgress(qint64, qint64))); - connect(this, SIGNAL(networkActivity()), account().data(), SIGNAL(propagatorNetworkActivity())); + connect(reply(), &QNetworkReply::uploadProgress, this, &PUTFileJob::uploadProgress); + connect(this, &AbstractNetworkJob::networkActivity, account().data(), &Account::propagatorNetworkActivity); _requestTimer.start(); AbstractNetworkJob::start(); } @@ -98,7 +98,7 @@ void PollJob::start() QUrl finalUrl = QUrl::fromUserInput(accountUrl.scheme() + QLatin1String("://") + accountUrl.authority() + (path().startsWith('/') ? QLatin1String("") : QLatin1String("/")) + path()); sendRequest("GET", finalUrl); - connect(reply(), SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(resetTimeout())); + connect(reply(), &QNetworkReply::downloadProgress, this, &AbstractNetworkJob::resetTimeout); AbstractNetworkJob::start(); } @@ -197,8 +197,8 @@ void PropagateUploadFileCommon::start() propagator()->_remoteFolder + _item->_file, this); _jobs.append(job); - connect(job, SIGNAL(finishedSignal()), SLOT(slotComputeContentChecksum())); - connect(job, SIGNAL(destroyed(QObject *)), SLOT(slotJobDestroyed(QObject *))); + connect(job, &DeleteJob::finishedSignal, this, &PropagateUploadFileCommon::slotComputeContentChecksum); + connect(job, &QObject::destroyed, this, &PropagateUploadFileCommon::slotJobDestroyed); job->start(); } @@ -232,10 +232,10 @@ void PropagateUploadFileCommon::slotComputeContentChecksum() auto computeChecksum = new ComputeChecksum(this); computeChecksum->setChecksumType(checksumType); - connect(computeChecksum, SIGNAL(done(QByteArray, QByteArray)), - SLOT(slotComputeTransmissionChecksum(QByteArray, QByteArray))); - connect(computeChecksum, SIGNAL(done(QByteArray, QByteArray)), - computeChecksum, SLOT(deleteLater())); + connect(computeChecksum, &ComputeChecksum::done, + this, &PropagateUploadFileCommon::slotComputeTransmissionChecksum); + connect(computeChecksum, &ComputeChecksum::done, + computeChecksum, &QObject::deleteLater); computeChecksum->start(filePath); } @@ -264,10 +264,10 @@ void PropagateUploadFileCommon::slotComputeTransmissionChecksum(const QByteArray computeChecksum->setChecksumType(QByteArray()); } - connect(computeChecksum, SIGNAL(done(QByteArray, QByteArray)), - SLOT(slotStartUpload(QByteArray, QByteArray))); - connect(computeChecksum, SIGNAL(done(QByteArray, QByteArray)), - computeChecksum, SLOT(deleteLater())); + connect(computeChecksum, &ComputeChecksum::done, + this, &PropagateUploadFileCommon::slotStartUpload); + connect(computeChecksum, &ComputeChecksum::done, + computeChecksum, &QObject::deleteLater); const QString filePath = propagator()->getFilePath(_item->_file); computeChecksum->start(filePath); } @@ -465,7 +465,7 @@ void PropagateUploadFileCommon::startPollJob(const QString &path) { PollJob *job = new PollJob(propagator()->account(), path, _item, propagator()->_journal, propagator()->_localDir, this); - connect(job, SIGNAL(finishedSignal()), SLOT(slotPollFinished())); + connect(job, &PollJob::finishedSignal, this, &PropagateUploadFileCommon::slotPollFinished); SyncJournalDb::PollInfo info; info._file = _item->_file; info._url = path; diff --git a/src/libsync/propagateuploadng.cpp b/src/libsync/propagateuploadng.cpp index 4afdad38b..379726672 100644 --- a/src/libsync/propagateuploadng.cpp +++ b/src/libsync/propagateuploadng.cpp @@ -90,12 +90,12 @@ void PropagateUploadFileNG::doStartUpload() _jobs.append(job); job->setProperties(QList() << "resourcetype" << "getcontentlength"); - connect(job, SIGNAL(finishedWithoutError()), this, SLOT(slotPropfindFinished())); - connect(job, SIGNAL(finishedWithError(QNetworkReply *)), - this, SLOT(slotPropfindFinishedWithError())); - connect(job, SIGNAL(destroyed(QObject *)), this, SLOT(slotJobDestroyed(QObject *))); - connect(job, SIGNAL(directoryListingIterated(QString, QMap)), - this, SLOT(slotPropfindIterate(QString, QMap))); + connect(job, &LsColJob::finishedWithoutError, this, &PropagateUploadFileNG::slotPropfindFinished); + connect(job, &LsColJob::finishedWithError, + this, &PropagateUploadFileNG::slotPropfindFinishedWithError); + connect(job, &QObject::destroyed, this, &PropagateUploadFileCommon::slotJobDestroyed); + connect(job, &LsColJob::directoryListingIterated, + this, &PropagateUploadFileNG::slotPropfindIterate); job->start(); return; } else if (progressInfo._valid) { @@ -159,7 +159,7 @@ void PropagateUploadFileNG::slotPropfindFinished() // with corruptions if there are too many chunks, or if we abort and there are still stale chunks. for (auto it = _serverChunks.begin(); it != _serverChunks.end(); ++it) { auto job = new DeleteJob(propagator()->account(), Utility::concatUrlPath(chunkUrl(), it->originalName), this); - QObject::connect(job, SIGNAL(finishedSignal()), this, SLOT(slotDeleteJobFinished())); + QObject::connect(job, &DeleteJob::finishedSignal, this, &PropagateUploadFileNG::slotDeleteJobFinished); _jobs.append(job); job->start(); } @@ -238,7 +238,7 @@ void PropagateUploadFileNG::startNewUpload() connect(job, SIGNAL(finished(QNetworkReply::NetworkError)), this, SLOT(slotMkColFinished(QNetworkReply::NetworkError))); - connect(job, SIGNAL(destroyed(QObject *)), this, SLOT(slotJobDestroyed(QObject *))); + connect(job, &QObject::destroyed, this, &PropagateUploadFileCommon::slotJobDestroyed); job->start(); } @@ -292,8 +292,8 @@ void PropagateUploadFileNG::startNextChunk() auto job = new MoveJob(propagator()->account(), Utility::concatUrlPath(chunkUrl(), "/.file"), destination, headers, this); _jobs.append(job); - connect(job, SIGNAL(finishedSignal()), this, SLOT(slotMoveJobFinished())); - connect(job, SIGNAL(destroyed(QObject *)), this, SLOT(slotJobDestroyed(QObject *))); + connect(job, &MoveJob::finishedSignal, this, &PropagateUploadFileNG::slotMoveJobFinished); + connect(job, &QObject::destroyed, this, &PropagateUploadFileCommon::slotJobDestroyed); propagator()->_activeJobList.append(this); job->start(); return; @@ -324,12 +324,12 @@ void PropagateUploadFileNG::startNextChunk() // job takes ownership of device via a QScopedPointer. Job deletes itself when finishing PUTFileJob *job = new PUTFileJob(propagator()->account(), url, device, headers, _currentChunk, this); _jobs.append(job); - connect(job, SIGNAL(finishedSignal()), this, SLOT(slotPutFinished())); - connect(job, SIGNAL(uploadProgress(qint64, qint64)), - this, SLOT(slotUploadProgress(qint64, qint64))); + connect(job, &PUTFileJob::finishedSignal, this, &PropagateUploadFileNG::slotPutFinished); + connect(job, &PUTFileJob::uploadProgress, + this, &PropagateUploadFileNG::slotUploadProgress); connect(job, SIGNAL(uploadProgress(qint64, qint64)), device, SLOT(slotJobUploadProgress(qint64, qint64))); - connect(job, SIGNAL(destroyed(QObject *)), this, SLOT(slotJobDestroyed(QObject *))); + connect(job, &QObject::destroyed, this, &PropagateUploadFileCommon::slotJobDestroyed); job->start(); propagator()->_activeJobList.append(this); _currentChunk++; diff --git a/src/libsync/propagateuploadv1.cpp b/src/libsync/propagateuploadv1.cpp index 790023a64..b03ac6d9e 100644 --- a/src/libsync/propagateuploadv1.cpp +++ b/src/libsync/propagateuploadv1.cpp @@ -126,10 +126,10 @@ void PropagateUploadFileV1::startNextChunk() // job takes ownership of device via a QScopedPointer. Job deletes itself when finishing PUTFileJob *job = new PUTFileJob(propagator()->account(), propagator()->_remoteFolder + path, device, headers, _currentChunk, this); _jobs.append(job); - connect(job, SIGNAL(finishedSignal()), this, SLOT(slotPutFinished())); - connect(job, SIGNAL(uploadProgress(qint64, qint64)), this, SLOT(slotUploadProgress(qint64, qint64))); + connect(job, &PUTFileJob::finishedSignal, this, &PropagateUploadFileV1::slotPutFinished); + connect(job, &PUTFileJob::uploadProgress, this, &PropagateUploadFileV1::slotUploadProgress); connect(job, SIGNAL(uploadProgress(qint64, qint64)), device, SLOT(slotJobUploadProgress(qint64, qint64))); - connect(job, SIGNAL(destroyed(QObject *)), this, SLOT(slotJobDestroyed(QObject *))); + connect(job, &QObject::destroyed, this, &PropagateUploadFileCommon::slotJobDestroyed); job->start(); propagator()->_activeJobList.append(this); _currentChunk++; diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index b133df115..b4b10d405 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -95,7 +95,7 @@ SyncEngine::SyncEngine(AccountPtr account, const QString &localPath, _clearTouchedFilesTimer.setSingleShot(true); _clearTouchedFilesTimer.setInterval(30 * 1000); - connect(&_clearTouchedFilesTimer, SIGNAL(timeout()), SLOT(slotClearTouchedFiles())); + connect(&_clearTouchedFilesTimer, &QTimer::timeout, this, &SyncEngine::slotClearTouchedFiles); _thread.setObjectName("SyncEngine_Thread"); } @@ -731,8 +731,8 @@ void SyncEngine::startSync() qCInfo(lcEngine) << "Finish Poll jobs before starting a sync"; CleanupPollsJob *job = new CleanupPollsJob(pollInfos, _account, _journal, _localPath, this); - connect(job, SIGNAL(finished()), this, SLOT(startSync())); - connect(job, SIGNAL(aborted(QString)), this, SLOT(slotCleanPollsJobAborted(QString))); + connect(job, &CleanupPollsJob::finished, this, &SyncEngine::startSync); + connect(job, &CleanupPollsJob::aborted, this, &SyncEngine::slotCleanPollsJobAborted); job->start(); return; } @@ -845,13 +845,13 @@ void SyncEngine::startSync() _discoveryMainThread = new DiscoveryMainThread(account()); _discoveryMainThread->setParent(this); - connect(this, SIGNAL(finished(bool)), _discoveryMainThread, SLOT(deleteLater())); + connect(this, &SyncEngine::finished, _discoveryMainThread.data(), &QObject::deleteLater); qCInfo(lcEngine) << "Server" << account()->serverVersion() << (account()->isHttp2Supported() ? "Using HTTP/2" : ""); if (account()->rootEtagChangesNotOnlySubFolderEtags()) { - connect(_discoveryMainThread, SIGNAL(etag(QString)), this, SLOT(slotRootEtagReceived(QString))); + connect(_discoveryMainThread.data(), &DiscoveryMainThread::etag, this, &SyncEngine::slotRootEtagReceived); } else { - connect(_discoveryMainThread, SIGNAL(etagConcatenation(QString)), this, SLOT(slotRootEtagReceived(QString))); + connect(_discoveryMainThread.data(), &DiscoveryMainThread::etagConcatenation, this, &SyncEngine::slotRootEtagReceived); } DiscoveryJob *discoveryJob = new DiscoveryJob(_csync_ctx.data()); @@ -868,12 +868,12 @@ void SyncEngine::startSync() discoveryJob->_syncOptions = _syncOptions; discoveryJob->moveToThread(&_thread); - connect(discoveryJob, SIGNAL(finished(int)), this, SLOT(slotDiscoveryJobFinished(int))); - connect(discoveryJob, SIGNAL(folderDiscovered(bool, QString)), - this, SLOT(slotFolderDiscovered(bool, QString))); + connect(discoveryJob, &DiscoveryJob::finished, this, &SyncEngine::slotDiscoveryJobFinished); + connect(discoveryJob, &DiscoveryJob::folderDiscovered, + this, &SyncEngine::slotFolderDiscovered); - connect(discoveryJob, SIGNAL(newBigFolder(QString, bool)), - this, SIGNAL(newBigFolder(QString, bool))); + connect(discoveryJob, &DiscoveryJob::newBigFolder, + this, &SyncEngine::newBigFolder); // This is used for the DiscoveryJob to be able to request the main thread/ @@ -1038,15 +1038,15 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult) _propagator = QSharedPointer( new OwncloudPropagator(_account, _localPath, _remotePath, _journal)); _propagator->setSyncOptions(_syncOptions); - connect(_propagator.data(), SIGNAL(itemCompleted(const SyncFileItemPtr &)), - this, SLOT(slotItemCompleted(const SyncFileItemPtr &))); - connect(_propagator.data(), SIGNAL(progress(const SyncFileItem &, quint64)), - this, SLOT(slotProgress(const SyncFileItem &, quint64))); - connect(_propagator.data(), SIGNAL(finished(bool)), this, SLOT(slotFinished(bool)), Qt::QueuedConnection); - connect(_propagator.data(), SIGNAL(seenLockedFile(QString)), SIGNAL(seenLockedFile(QString))); - connect(_propagator.data(), SIGNAL(touchedFile(QString)), SLOT(slotAddTouchedFile(QString))); - connect(_propagator.data(), SIGNAL(insufficientLocalStorage()), SLOT(slotInsufficientLocalStorage())); - connect(_propagator.data(), SIGNAL(insufficientRemoteStorage()), SLOT(slotInsufficientRemoteStorage())); + connect(_propagator.data(), &OwncloudPropagator::itemCompleted, + this, &SyncEngine::slotItemCompleted); + connect(_propagator.data(), &OwncloudPropagator::progress, + this, &SyncEngine::slotProgress); + connect(_propagator.data(), &OwncloudPropagator::finished, this, &SyncEngine::slotFinished, Qt::QueuedConnection); + connect(_propagator.data(), &OwncloudPropagator::seenLockedFile, this, &SyncEngine::seenLockedFile); + connect(_propagator.data(), &OwncloudPropagator::touchedFile, this, &SyncEngine::slotAddTouchedFile); + connect(_propagator.data(), &OwncloudPropagator::insufficientLocalStorage, this, &SyncEngine::slotInsufficientLocalStorage); + connect(_propagator.data(), &OwncloudPropagator::insufficientRemoteStorage, this, &SyncEngine::slotInsufficientRemoteStorage); // apply the network limits to the propagator setNetworkLimits(_uploadLimit, _downloadLimit); diff --git a/src/libsync/syncfilestatustracker.cpp b/src/libsync/syncfilestatustracker.cpp index 7b40b6071..4db5b72fc 100644 --- a/src/libsync/syncfilestatustracker.cpp +++ b/src/libsync/syncfilestatustracker.cpp @@ -111,13 +111,13 @@ static inline bool showWarningInSocketApi(const SyncFileItem &item) SyncFileStatusTracker::SyncFileStatusTracker(SyncEngine *syncEngine) : _syncEngine(syncEngine) { - connect(syncEngine, SIGNAL(aboutToPropagate(SyncFileItemVector &)), - SLOT(slotAboutToPropagate(SyncFileItemVector &))); - connect(syncEngine, SIGNAL(itemCompleted(const SyncFileItemPtr &)), - SLOT(slotItemCompleted(const SyncFileItemPtr &))); - connect(syncEngine, SIGNAL(finished(bool)), SLOT(slotSyncFinished())); - connect(syncEngine, SIGNAL(started()), SLOT(slotSyncEngineRunningChanged())); - connect(syncEngine, SIGNAL(finished(bool)), SLOT(slotSyncEngineRunningChanged())); + connect(syncEngine, &SyncEngine::aboutToPropagate, + this, &SyncFileStatusTracker::slotAboutToPropagate); + connect(syncEngine, &SyncEngine::itemCompleted, + this, &SyncFileStatusTracker::slotItemCompleted); + connect(syncEngine, &SyncEngine::finished, this, &SyncFileStatusTracker::slotSyncFinished); + connect(syncEngine, &SyncEngine::started, this, &SyncFileStatusTracker::slotSyncEngineRunningChanged); + connect(syncEngine, &SyncEngine::finished, this, &SyncFileStatusTracker::slotSyncEngineRunningChanged); } SyncFileStatus SyncFileStatusTracker::fileStatus(const QString &relativePath)