diff options
31 files changed, 257 insertions, 228 deletions
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index 969ca6682..02a8b2c5f 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -210,7 +210,7 @@ Component::Component(PackageManagerCore *core) { setPrivate(d); - connect(this, SIGNAL(valueChanged(QString, QString)), this, SLOT(updateModelData(QString, QString))); + connect(this, &Component::valueChanged, this, &Component::updateModelData); qRegisterMetaType<QList<QInstaller::Component*> >("QList<QInstaller::Component*>"); } diff --git a/src/libs/installer/componentmodel.cpp b/src/libs/installer/componentmodel.cpp index 682bc02c5..77ff5bfdb 100644 --- a/src/libs/installer/componentmodel.cpp +++ b/src/libs/installer/componentmodel.cpp @@ -107,7 +107,7 @@ ComponentModel::ComponentModel(int columns, PackageManagerCore *core) , m_modelState(DefaultChecked) { m_headerData.insert(0, columns, QVariant()); - connect(this, SIGNAL(modelReset()), this, SLOT(slotModelReset())); + connect(this, &QAbstractItemModel::modelReset, this, &ComponentModel::slotModelReset); } /*! @@ -413,7 +413,7 @@ void ComponentModel::setRootComponents(QList<QInstaller::Component*> rootCompone // show virtual components only in case we run as updater or if the core engine is set to show them const bool showVirtuals = m_core->isUpdater() || m_core->virtualComponentsVisible(); foreach (Component *const component, rootComponents) { - connect(component, SIGNAL(virtualStateChanged()), this, SLOT(onVirtualStateChanged())); + connect(component, &Component::virtualStateChanged, this, &ComponentModel::onVirtualStateChanged); if ((!showVirtuals) && component->isVirtual()) continue; m_rootComponentList.append(component); @@ -473,7 +473,7 @@ void ComponentModel::slotModelReset() foreach (Component *const component, components) { if (component->checkState() == Qt::Checked) checked.insert(component); - connect(component, SIGNAL(virtualStateChanged()), this, SLOT(onVirtualStateChanged())); + connect(component, &Component::virtualStateChanged, this, &ComponentModel::onVirtualStateChanged); } updateCheckedState(checked, Qt::Checked); diff --git a/src/libs/installer/createlocalrepositoryoperation.cpp b/src/libs/installer/createlocalrepositoryoperation.cpp index 170065742..51e209df7 100644 --- a/src/libs/installer/createlocalrepositoryoperation.cpp +++ b/src/libs/installer/createlocalrepositoryoperation.cpp @@ -190,7 +190,8 @@ bool CreateLocalRepositoryOperation::performOperation() // copy the whole meta data into local repository CopyDirectoryOperation copyDirOp; copyDirOp.setArguments(QStringList() << QLatin1String(":/metadata/") << repoPath); - connect(©DirOp, SIGNAL(outputTextChanged(QString)), this, SIGNAL(outputTextChanged(QString))); + connect(©DirOp, &CopyDirectoryOperation::outputTextChanged, + this, &CreateLocalRepositoryOperation::outputTextChanged); const bool success = copyDirOp.performOperation(); helper.m_files = copyDirOp.value(QLatin1String("files")).toStringList(); diff --git a/src/libs/installer/downloadarchivesjob.cpp b/src/libs/installer/downloadarchivesjob.cpp index 8d619267b..c3cfb4abd 100644 --- a/src/libs/installer/downloadarchivesjob.cpp +++ b/src/libs/installer/downloadarchivesjob.cpp @@ -126,8 +126,8 @@ void DownloadArchivesJob::fetchNextArchiveHash() return; } - connect(m_downloader, SIGNAL(downloadCompleted()), this, SLOT(finishedHashDownload()), - Qt::QueuedConnection); + connect(m_downloader, &FileDownloader::downloadCompleted, + this, &DownloadArchivesJob::finishedHashDownload, Qt::QueuedConnection); m_downloader->download(); } else { QMetaObject::invokeMethod(this, "fetchNextArchive", Qt::QueuedConnection); @@ -174,7 +174,8 @@ void DownloadArchivesJob::fetchNextArchive() emit progressChanged(double(m_archivesDownloaded) / m_archivesToDownloadCount); connect(m_downloader, SIGNAL(downloadProgress(double)), this, SLOT(emitDownloadProgress(double))); - connect(m_downloader, SIGNAL(downloadCompleted()), this, SLOT(registerFile()), Qt::QueuedConnection); + connect(m_downloader, &FileDownloader::downloadCompleted, + this, &DownloadArchivesJob::registerFile, Qt::QueuedConnection); m_downloader->download(); } @@ -292,10 +293,10 @@ KDUpdater::FileDownloader *DownloadArchivesJob::setupDownloader(const QString &s auth.setPassword(component->value(QLatin1String("password"))); downloader->setAuthenticator(auth); - connect(downloader, SIGNAL(downloadCanceled()), this, SLOT(downloadCanceled())); - connect(downloader, SIGNAL(downloadAborted(QString)), this, SLOT(downloadFailed(QString)), + connect(downloader, &FileDownloader::downloadCanceled, this, &DownloadArchivesJob::downloadCanceled); + connect(downloader, &FileDownloader::downloadAborted, this, &DownloadArchivesJob::downloadFailed, Qt::QueuedConnection); - connect(downloader, SIGNAL(downloadStatus(QString)), this, SIGNAL(downloadStatusChanged(QString))); + connect(downloader, &FileDownloader::downloadStatus, this, &DownloadArchivesJob::downloadStatusChanged); if (FileDownloaderFactory::isSupportedScheme(scheme)) { downloader->setDownloadedFileName(component->localTempPath() + QLatin1Char('/') diff --git a/src/libs/installer/downloadfiletask.cpp b/src/libs/installer/downloadfiletask.cpp index f308315c9..dde85795c 100644 --- a/src/libs/installer/downloadfiletask.cpp +++ b/src/libs/installer/downloadfiletask.cpp @@ -55,7 +55,7 @@ AuthenticationRequiredException::AuthenticationRequiredException(Type type, cons Downloader::Downloader() : m_finished(0) { - connect(&m_nam, SIGNAL(finished(QNetworkReply*)), SLOT(onFinished(QNetworkReply*))); + connect(&m_nam, &QNetworkAccessManager::finished, this, &Downloader::onFinished); } Downloader::~Downloader() @@ -78,11 +78,11 @@ void Downloader::download(QFutureInterface<FileTaskResult> &fi, const QList<File fi.setExpectedResultCount(items.count()); m_nam.setProxyFactory(networkProxyFactory); - connect(&m_nam, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, - SLOT(onAuthenticationRequired(QNetworkReply*,QAuthenticator*))); - connect(&m_nam, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), this, - SLOT(onProxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); - QTimer::singleShot(0, this, SLOT(doDownload())); + connect(&m_nam, &QNetworkAccessManager::authenticationRequired, this, + &Downloader::onAuthenticationRequired); + connect(&m_nam, &QNetworkAccessManager::proxyAuthenticationRequired, this, + &Downloader::onProxyAuthenticationRequired); + QTimer::singleShot(0, this, &Downloader::doDownload); } void Downloader::doDownload() @@ -345,14 +345,13 @@ QNetworkReply *Downloader::startDownload(const FileTaskItem &item) std::unique_ptr<Data> data(new Data(item)); m_downloads[reply] = std::move(data); - connect(reply, SIGNAL(readyRead()), this, SLOT(onReadyRead())); + connect(reply, &QIODevice::readyRead, this, &Downloader::onReadyRead); connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onError(QNetworkReply::NetworkError))); #ifndef QT_NO_SSL - connect(reply, SIGNAL(sslErrors(QList<QSslError>)), SLOT(onSslErrors(QList<QSslError>))); + connect(reply, &QNetworkReply::sslErrors, this, &Downloader::onSslErrors); #endif - connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(onDownloadProgress(qint64, - qint64))); + connect(reply, &QNetworkReply::downloadProgress, this, &Downloader::onDownloadProgress); return reply; } @@ -399,7 +398,7 @@ void DownloadFileTask::doTask(QFutureInterface<FileTaskResult> &fi) { QEventLoop el; Downloader downloader; - connect(&downloader, SIGNAL(finished()), &el, SLOT(quit())); + connect(&downloader, &Downloader::finished, &el, &QEventLoop::quit); QList<FileTaskItem> items = taskItems(); if (!m_authenticator.isNull()) { diff --git a/src/libs/installer/elevatedexecuteoperation.cpp b/src/libs/installer/elevatedexecuteoperation.cpp index 1f439067c..9fe20a103 100644 --- a/src/libs/installer/elevatedexecuteoperation.cpp +++ b/src/libs/installer/elevatedexecuteoperation.cpp @@ -161,12 +161,12 @@ bool ElevatedExecuteOperation::Private::run(const QStringList &arguments) if (showStandardError) process->setProcessChannelMode(QProcessWrapper::MergedChannels); - connect(q, SIGNAL(cancelProcess()), process, SLOT(cancel())); + connect(q, &ElevatedExecuteOperation::cancelProcess, process, &QProcessWrapper::cancel); //we still like the none blocking possibility to perform this operation without threads QEventLoop loop; if (QThread::currentThread() == qApp->thread()) { - QObject::connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), &loop, SLOT(quit())); + QObject::connect(process, &QProcessWrapper::finished, &loop, &QEventLoop::quit); } //readProcessOutput should only called from this current Thread -> Qt::DirectConnection QObject::connect(process, SIGNAL(readyRead()), q, SLOT(readProcessOutput()), Qt::DirectConnection); diff --git a/src/libs/installer/extractarchiveoperation.cpp b/src/libs/installer/extractarchiveoperation.cpp index d75913d7e..3a1be7ad3 100644 --- a/src/libs/installer/extractarchiveoperation.cpp +++ b/src/libs/installer/extractarchiveoperation.cpp @@ -64,21 +64,20 @@ bool ExtractArchiveOperation::performOperation() Receiver receiver; Callback callback; - connect(&callback, SIGNAL(currentFileChanged(QString)), this, SLOT(fileFinished(QString))); - connect(&callback, SIGNAL(progressChanged(double)), this, SIGNAL(progressChanged(double))); + connect(&callback, &Callback::currentFileChanged, this, &ExtractArchiveOperation::fileFinished); + connect(&callback, &Callback::progressChanged, this, &ExtractArchiveOperation::progressChanged); if (PackageManagerCore *core = this->value(QLatin1String("installer")).value<PackageManagerCore*>()) { - connect(core, SIGNAL(statusChanged(QInstaller::PackageManagerCore::Status)), &callback, - SLOT(statusChanged(QInstaller::PackageManagerCore::Status))); + connect(core, &PackageManagerCore::statusChanged, &callback, &Callback::statusChanged); } //Runnable is derived from QRunable which will be deleted by the ThreadPool -> no parent is needed Runnable *runnable = new Runnable(archivePath, targetDir, &callback); - connect(runnable, SIGNAL(finished(bool,QString)), &receiver, SLOT(runnableFinished(bool,QString)), + connect(runnable, &Runnable::finished, &receiver, &Receiver::runnableFinished, Qt::QueuedConnection); QEventLoop loop; - connect(&receiver, SIGNAL(finished()), &loop, SLOT(quit())); + connect(&receiver, &Receiver::finished, &loop, &QEventLoop::quit); if (QThreadPool::globalInstance()->tryStart(runnable)) { loop.exec(); } else { @@ -113,11 +112,11 @@ bool ExtractArchiveOperation::undoOperation() const QStringList files = value(QLatin1String("files")).toStringList(); WorkerThread *const thread = new WorkerThread(this, files); - connect(thread, SIGNAL(currentFileChanged(QString)), this, SIGNAL(outputTextChanged(QString))); - connect(thread, SIGNAL(progressChanged(double)), this, SIGNAL(progressChanged(double))); + connect(thread, &WorkerThread::currentFileChanged, this, &ExtractArchiveOperation::outputTextChanged); + connect(thread, &WorkerThread::progressChanged, this, &ExtractArchiveOperation::progressChanged); QEventLoop loop; - connect(thread, SIGNAL(finished()), &loop, SLOT(quit()), Qt::QueuedConnection); + connect(thread, &QThread::finished, &loop, &QEventLoop::quit, Qt::QueuedConnection); thread->start(); loop.exec(); thread->deleteLater(); diff --git a/src/libs/installer/fileutils.cpp b/src/libs/installer/fileutils.cpp index 9f7890fbc..a44db1126 100644 --- a/src/libs/installer/fileutils.cpp +++ b/src/libs/installer/fileutils.cpp @@ -270,7 +270,7 @@ void QInstaller::removeDirectoryThreaded(const QString &path, bool ignoreErrors) { RemoveDirectoryThread thread(path, ignoreErrors); QEventLoop loop; - QObject::connect(&thread, SIGNAL(finished()), &loop, SLOT(quit())); + QObject::connect(&thread, &RemoveDirectoryThread::finished, &loop, &QEventLoop::quit); thread.start(); loop.exec(); if (!thread.error().isEmpty()) diff --git a/src/libs/installer/metadatajob.cpp b/src/libs/installer/metadatajob.cpp index e215e99f6..fa3168e8f 100644 --- a/src/libs/installer/metadatajob.cpp +++ b/src/libs/installer/metadatajob.cpp @@ -50,9 +50,9 @@ MetadataJob::MetadataJob(QObject *parent) , m_core(0) { setCapabilities(Cancelable); - connect(&m_xmlTask, SIGNAL(finished()), this, SLOT(xmlTaskFinished())); - connect(&m_metadataTask, SIGNAL(finished()), this, SLOT(metadataTaskFinished())); - connect(&m_metadataTask, SIGNAL(progressValueChanged(int)), this, SLOT(progressChanged(int))); + connect(&m_xmlTask, &QFutureWatcherBase::finished, this, &MetadataJob::xmlTaskFinished); + connect(&m_metadataTask, &QFutureWatcherBase::finished, this, &MetadataJob::metadataTaskFinished); + connect(&m_metadataTask, &QFutureWatcherBase::progressValueChanged, this, &MetadataJob::progressChanged); } MetadataJob::~MetadataJob() @@ -244,7 +244,7 @@ void MetadataJob::metadataTaskFinished() QFutureWatcher<void> *watcher = new QFutureWatcher<void>(); m_unzipTasks.insert(watcher, qobject_cast<QObject*> (task)); - connect(watcher, SIGNAL(finished()), this, SLOT(unzipTaskFinished())); + connect(watcher, &QFutureWatcherBase::finished, this, &MetadataJob::unzipTaskFinished); watcher->setFuture(QtConcurrent::run(&UnzipArchiveTask::doTask, task)); } } else { diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp index 8f60f5f3a..9efee0465 100644 --- a/src/libs/installer/packagemanagercore.cpp +++ b/src/libs/installer/packagemanagercore.cpp @@ -639,11 +639,11 @@ int PackageManagerCore::downloadNeededArchives(double partProgressSize) DownloadArchivesJob archivesJob(this); archivesJob.setAutoDelete(false); archivesJob.setArchivesToDownload(archivesToDownload); - connect(this, SIGNAL(installationInterrupted()), &archivesJob, SLOT(cancel())); - connect(&archivesJob, SIGNAL(outputTextChanged(QString)), ProgressCoordinator::instance(), - SLOT(emitLabelAndDetailTextChanged(QString))); - connect(&archivesJob, SIGNAL(downloadStatusChanged(QString)), ProgressCoordinator::instance(), - SIGNAL(downloadStatusChanged(QString))); + connect(this, &PackageManagerCore::installationInterrupted, &archivesJob, &KDJob::cancel); + connect(&archivesJob, &DownloadArchivesJob::outputTextChanged, + ProgressCoordinator::instance(), &ProgressCoordinator::emitLabelAndDetailTextChanged); + connect(&archivesJob, &DownloadArchivesJob::downloadStatusChanged, + ProgressCoordinator::instance(), &ProgressCoordinator::downloadStatusChanged); ProgressCoordinator::instance()->registerPartProgress(&archivesJob, SIGNAL(progressChanged(double)), partProgressSize); @@ -1617,8 +1617,8 @@ ComponentModel *PackageManagerCore::defaultComponentModel() const d->m_defaultModel = componentModel(const_cast<PackageManagerCore*> (this), QLatin1String("AllComponentsModel")); } - connect(this, SIGNAL(finishAllComponentsReset(QList<QInstaller::Component*>)), d->m_defaultModel, - SLOT(setRootComponents(QList<QInstaller::Component*>))); + connect(this, &PackageManagerCore::finishAllComponentsReset, d->m_defaultModel, + &ComponentModel::setRootComponents); return d->m_defaultModel; } @@ -1632,8 +1632,8 @@ ComponentModel *PackageManagerCore::updaterComponentModel() const d->m_updaterModel = componentModel(const_cast<PackageManagerCore*> (this), QLatin1String("UpdaterComponentsModel")); } - connect(this, SIGNAL(finishUpdaterComponentsReset(QList<QInstaller::Component*>)), d->m_updaterModel, - SLOT(setRootComponents(QList<QInstaller::Component*>))); + connect(this, &PackageManagerCore::finishUpdaterComponentsReset, d->m_updaterModel, + &ComponentModel::setRootComponents); return d->m_updaterModel; } @@ -1708,7 +1708,8 @@ bool PackageManagerCore::killProcess(const QString &absoluteFilePath) const const QFuture<bool> future = QtConcurrent::run(KDUpdater::killProcess, process, 30000); QEventLoop loop; - loop.connect(&futureWatcher, SIGNAL(finished()), SLOT(quit()), Qt::QueuedConnection); + connect(&futureWatcher, &QFutureWatcher<bool>::finished, + &loop, &QEventLoop::quit, Qt::QueuedConnection); futureWatcher.setFuture(future); if (!future.isFinished()) diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index 4f8af73f0..a8da31405 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -247,10 +247,14 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core, q m_performedOperationsOld.append(op.take()); } - connect(this, SIGNAL(installationStarted()), m_core, SIGNAL(installationStarted())); - connect(this, SIGNAL(installationFinished()), m_core, SIGNAL(installationFinished())); - connect(this, SIGNAL(uninstallationStarted()), m_core, SIGNAL(uninstallationStarted())); - connect(this, SIGNAL(uninstallationFinished()), m_core, SIGNAL(uninstallationFinished())); + connect(this, &PackageManagerCorePrivate::installationStarted, + m_core, &PackageManagerCore::installationStarted); + connect(this, &PackageManagerCorePrivate::installationFinished, + m_core, &PackageManagerCore::installationFinished); + connect(this, &PackageManagerCorePrivate::uninstallationStarted, + m_core, &PackageManagerCore::uninstallationStarted); + connect(this, &PackageManagerCorePrivate::uninstallationFinished, + m_core, &PackageManagerCore::uninstallationFinished); } PackageManagerCorePrivate::~PackageManagerCorePrivate() @@ -312,7 +316,8 @@ bool PackageManagerCorePrivate::performOperationThreaded(Operation *operation, O const QFuture<bool> future = QtConcurrent::run(runOperation, operation, type); QEventLoop loop; - loop.connect(&futureWatcher, SIGNAL(finished()), SLOT(quit()), Qt::QueuedConnection); + QObject::connect(&futureWatcher, &decltype(futureWatcher)::finished, &loop, &QEventLoop::quit, + Qt::QueuedConnection); futureWatcher.setFuture(future); if (!future.isFinished()) @@ -551,10 +556,14 @@ void PackageManagerCorePrivate::initialize(const QHash<QString, QString> ¶ms } processFilesForDelayedDeletion(); - disconnect(this, SIGNAL(installationStarted()), ProgressCoordinator::instance(), SLOT(reset())); - connect(this, SIGNAL(installationStarted()), ProgressCoordinator::instance(), SLOT(reset())); - disconnect(this, SIGNAL(uninstallationStarted()), ProgressCoordinator::instance(), SLOT(reset())); - connect(this, SIGNAL(uninstallationStarted()), ProgressCoordinator::instance(), SLOT(reset())); + disconnect(this, &PackageManagerCorePrivate::installationStarted, + ProgressCoordinator::instance(), &ProgressCoordinator::reset); + connect(this, &PackageManagerCorePrivate::installationStarted, + ProgressCoordinator::instance(), &ProgressCoordinator::reset); + disconnect(this, &PackageManagerCorePrivate::uninstallationStarted, + ProgressCoordinator::instance(), &ProgressCoordinator::reset); + connect(this, &PackageManagerCorePrivate::uninstallationStarted, + ProgressCoordinator::instance(), &ProgressCoordinator::reset); if (!isInstaller()) m_localPackageHub->setFileName(componentsXmlPath()); @@ -573,10 +582,8 @@ void PackageManagerCorePrivate::initialize(const QHash<QString, QString> ¶ms m_metadataJob.disconnect(); m_metadataJob.setAutoDelete(false); m_metadataJob.setPackageManagerCore(m_core); - connect(&m_metadataJob, SIGNAL(infoMessage(KDJob*, QString)), this, - SLOT(infoMessage(KDJob*, QString))); - connect(&m_metadataJob, SIGNAL(progress(KDJob *, quint64, quint64)), this, - SLOT(infoProgress(KDJob *, quint64, quint64))); + connect(&m_metadataJob, &KDJob::infoMessage, this, &PackageManagerCorePrivate::infoMessage); + connect(&m_metadataJob, &KDJob::progress, this, &PackageManagerCorePrivate::infoProgress); KDUpdater::FileDownloaderFactory::instance().setProxyFactory(m_core->proxyFactory()); } diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index 0106bc0cb..a180f3a7a 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -319,45 +319,49 @@ PackageManagerGui::PackageManagerGui(PackageManagerCore *core, QWidget *parent) setOption(QWizard::NoBackButtonOnStartPage); setOption(QWizard::NoBackButtonOnLastPage); - connect(this, SIGNAL(rejected()), m_core, SLOT(setCanceled())); - connect(this, SIGNAL(interrupted()), m_core, SLOT(interrupt())); + connect(this, &QDialog::rejected, m_core, &PackageManagerCore::setCanceled); + connect(this, &PackageManagerGui::interrupted, m_core, &PackageManagerCore::interrupt); // both queued to show the finished page once everything is done - connect(m_core, SIGNAL(installationFinished()), this, SLOT(showFinishedPage()), + connect(m_core, &PackageManagerCore::installationFinished, + this, &PackageManagerGui::showFinishedPage, Qt::QueuedConnection); - connect(m_core, SIGNAL(uninstallationFinished()), this, SLOT(showFinishedPage()), + connect(m_core, &PackageManagerCore::uninstallationFinished, + this, &PackageManagerGui::showFinishedPage, Qt::QueuedConnection); - connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(currentPageChanged(int))); - connect(this, SIGNAL(currentIdChanged(int)), m_core, SIGNAL(currentPageChanged(int))); - connect(button(QWizard::FinishButton), SIGNAL(clicked()), this, SIGNAL(finishButtonClicked())); - connect(button(QWizard::FinishButton), SIGNAL(clicked()), m_core, SIGNAL(finishButtonClicked())); + connect(this, &QWizard::currentIdChanged, this, &PackageManagerGui::currentPageChanged); + connect(this, &QWizard::currentIdChanged, m_core, &PackageManagerCore::currentPageChanged); + connect(button(QWizard::FinishButton), &QAbstractButton::clicked, + this, &PackageManagerGui::finishButtonClicked); + connect(button(QWizard::FinishButton), &QAbstractButton::clicked, + m_core, &PackageManagerCore::finishButtonClicked); // make sure the QUiLoader's retranslateUi is executed first, then the script - connect(this, SIGNAL(languageChanged()), m_core, SLOT(languageChanged()), Qt::QueuedConnection); - connect(this, SIGNAL(languageChanged()), this, SLOT(onLanguageChanged()), Qt::QueuedConnection); + connect(this, &PackageManagerGui::languageChanged, + m_core, &PackageManagerCore::languageChanged, Qt::QueuedConnection); + connect(this, &PackageManagerGui::languageChanged, + this, &PackageManagerGui::onLanguageChanged, Qt::QueuedConnection); connect(m_core, - SIGNAL(wizardPageInsertionRequested(QWidget*,QInstaller::PackageManagerCore::WizardPage)), - this, SLOT(wizardPageInsertionRequested(QWidget*,QInstaller::PackageManagerCore::WizardPage))); - connect(m_core, SIGNAL(wizardPageRemovalRequested(QWidget*)), this, - SLOT(wizardPageRemovalRequested(QWidget*))); - connect(m_core, - SIGNAL(wizardWidgetInsertionRequested(QWidget*,QInstaller::PackageManagerCore::WizardPage)), - this, SLOT(wizardWidgetInsertionRequested(QWidget*,QInstaller::PackageManagerCore::WizardPage))); - connect(m_core, SIGNAL(wizardWidgetRemovalRequested(QWidget*)), this, - SLOT(wizardWidgetRemovalRequested(QWidget*))); - connect(m_core, SIGNAL(wizardPageVisibilityChangeRequested(bool,int)), this, - SLOT(wizardPageVisibilityChangeRequested(bool,int)), Qt::QueuedConnection); + &PackageManagerCore::wizardPageInsertionRequested, + this, &PackageManagerGui::wizardPageInsertionRequested); + connect(m_core, &PackageManagerCore::wizardPageRemovalRequested, + this, &PackageManagerGui::wizardPageRemovalRequested); + connect(m_core, &PackageManagerCore::wizardWidgetInsertionRequested, + this, &PackageManagerGui::wizardWidgetInsertionRequested); + connect(m_core, &PackageManagerCore::wizardWidgetRemovalRequested, + this, &PackageManagerGui::wizardWidgetRemovalRequested); + connect(m_core, &PackageManagerCore::wizardPageVisibilityChangeRequested, + this, &PackageManagerGui::wizardPageVisibilityChangeRequested, Qt::QueuedConnection); - connect(m_core, - SIGNAL(setValidatorForCustomPageRequested(QInstaller::Component*,QString,QString)), this, - SLOT(setValidatorForCustomPageRequested(QInstaller::Component*,QString,QString))); + connect(m_core, &PackageManagerCore::setValidatorForCustomPageRequested, + this, &PackageManagerGui::setValidatorForCustomPageRequested); - connect(m_core, SIGNAL(setAutomatedPageSwitchEnabled(bool)), this, - SLOT(setAutomatedPageSwitchEnabled(bool))); + connect(m_core, &PackageManagerCore::setAutomatedPageSwitchEnabled, + this, &PackageManagerGui::setAutomatedPageSwitchEnabled); - connect(this, SIGNAL(customButtonClicked(int)), this, SLOT(customButtonClicked(int))); + connect(this, &QWizard::customButtonClicked, this, &PackageManagerGui::customButtonClicked); for (int i = QWizard::BackButton; i < QWizard::CustomButton1; ++i) d->m_defaultButtonText.insert(i, buttonText(QWizard::WizardButton(i))); @@ -451,7 +455,7 @@ void PackageManagerGui::clickButton(int wb, int delay) wb = QWizard::CancelButton; if (QAbstractButton *b = button(static_cast<QWizard::WizardButton>(wb))) - QTimer::singleShot(delay, b, SLOT(click())); + QTimer::singleShot(delay, b, &QAbstractButton::click); else qWarning() << "Button with type: " << d->buttonType(wb) << "not found!"; } @@ -1216,20 +1220,22 @@ IntroductionPage::IntroductionPage(PackageManagerCore *core) m_packageManager->setObjectName(QLatin1String("PackageManagerRadioButton")); boxLayout->addWidget(m_packageManager); m_packageManager->setChecked(core->isPackageManager()); - connect(m_packageManager, SIGNAL(toggled(bool)), this, SLOT(setPackageManager(bool))); + connect(m_packageManager, &QAbstractButton::toggled, this, &IntroductionPage::setPackageManager); m_updateComponents = new QRadioButton(tr("Update components"), this); m_updateComponents->setObjectName(QLatin1String("UpdaterRadioButton")); boxLayout->addWidget(m_updateComponents); m_updateComponents->setChecked(core->isUpdater()); - connect(m_updateComponents, SIGNAL(toggled(bool)), this, SLOT(setUpdater(bool))); + connect(m_updateComponents, &QAbstractButton::toggled, this, &IntroductionPage::setUpdater); m_removeAllComponents = new QRadioButton(tr("Remove all components"), this); m_removeAllComponents->setObjectName(QLatin1String("UninstallerRadioButton")); boxLayout->addWidget(m_removeAllComponents); m_removeAllComponents->setChecked(core->isUninstaller()); - connect(m_removeAllComponents, SIGNAL(toggled(bool)), this, SLOT(setUninstaller(bool))); - connect(m_removeAllComponents, SIGNAL(toggled(bool)), core, SLOT(setCompleteUninstallation(bool))); + connect(m_removeAllComponents, &QAbstractButton::toggled, + this, &IntroductionPage::setUninstaller); + connect(m_removeAllComponents, &QAbstractButton::toggled, + core, &PackageManagerCore::setCompleteUninstallation); boxLayout->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding)); @@ -1257,16 +1263,18 @@ IntroductionPage::IntroductionPage(PackageManagerCore *core) core->setCompleteUninstallation(core->isUninstaller()); - connect(core, SIGNAL(metaJobProgress(int)), this, SLOT(onProgressChanged(int))); - connect(core, SIGNAL(metaJobInfoMessage(QString)), this, SLOT(setMessage(QString))); - connect(core, SIGNAL(coreNetworkSettingsChanged()), this, SLOT(onCoreNetworkSettingsChanged())); + connect(core, &PackageManagerCore::metaJobProgress, this, &IntroductionPage::onProgressChanged); + connect(core, &PackageManagerCore::metaJobInfoMessage, this, &IntroductionPage::setMessage); + connect(core, &PackageManagerCore::coreNetworkSettingsChanged, + this, &IntroductionPage::onCoreNetworkSettingsChanged); m_updateComponents->setEnabled(ProductKeyCheck::instance()->hasValidKey()); #ifdef Q_OS_WIN if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) { m_taskButton = new QWinTaskbarButton(this); - connect(core, SIGNAL(metaJobProgress(int)), m_taskButton->progress(), SLOT(setValue(int))); + connect(core, &PackageManagerCore::metaJobProgress, + m_taskButton->progress(), &QWinTaskbarProgress::setValue); } else { m_taskButton = 0; } @@ -1641,8 +1649,8 @@ LicenseAgreementPage::LicenseAgreementPage(PackageManagerCore *core) m_licenseListWidget = new QListWidget(this); m_licenseListWidget->setObjectName(QLatin1String("LicenseListWidget")); m_licenseListWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding); - connect(m_licenseListWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), - this, SLOT(currentItemChanged(QListWidgetItem*))); + connect(m_licenseListWidget, &QListWidget::currentItemChanged, + this, &LicenseAgreementPage::currentItemChanged); m_textBrowser = new QTextBrowser(this); m_textBrowser->setReadOnly(true); @@ -1650,7 +1658,7 @@ LicenseAgreementPage::LicenseAgreementPage(PackageManagerCore *core) m_textBrowser->setOpenExternalLinks(true); m_textBrowser->setObjectName(QLatin1String("LicenseTextBrowser")); m_textBrowser->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); - connect(m_textBrowser, SIGNAL(anchorClicked(QUrl)), this, SLOT(openLicenseUrl(QUrl))); + connect(m_textBrowser, &QTextBrowser::anchorClicked, this, &LicenseAgreementPage::openLicenseUrl); QHBoxLayout *licenseBoxLayout = new QHBoxLayout(); licenseBoxLayout->addWidget(m_licenseListWidget); @@ -1689,8 +1697,8 @@ LicenseAgreementPage::LicenseAgreementPage(PackageManagerCore *core) gridLayout->addWidget(m_rejectLabel, 1, 1); layout->addLayout(gridLayout); - connect(m_acceptRadioButton, SIGNAL(toggled(bool)), this, SIGNAL(completeChanged())); - connect(m_rejectRadioButton, SIGNAL(toggled(bool)), this, SIGNAL(completeChanged())); + connect(m_acceptRadioButton, &QAbstractButton::toggled, this, &QWizardPage::completeChanged); + connect(m_rejectRadioButton, &QAbstractButton::toggled, this, &QWizardPage::completeChanged); m_rejectRadioButton->setChecked(true); } @@ -1817,7 +1825,8 @@ public: layout->addLayout(hlayout, 1); m_checkDefault = new QPushButton; - connect(m_checkDefault, SIGNAL(clicked()), this, SLOT(selectDefault())); + connect(m_checkDefault, &QAbstractButton::clicked, + this, &ComponentSelectionPage::Private::selectDefault); if (m_core->isInstaller()) { m_checkDefault->setObjectName(QLatin1String("SelectDefaultComponentsButton")); m_checkDefault->setShortcut(QKeySequence(ComponentSelectionPage::tr("Alt+A", @@ -1835,7 +1844,8 @@ public: m_checkAll = new QPushButton; hlayout->addWidget(m_checkAll); - connect(m_checkAll, SIGNAL(clicked()), this, SLOT(selectAll())); + connect(m_checkAll, &QAbstractButton::clicked, + this, &ComponentSelectionPage::Private::selectAll); m_checkAll->setObjectName(QLatin1String("SelectAllComponentsButton")); m_checkAll->setShortcut(QKeySequence(ComponentSelectionPage::tr("Alt+S", "select all components"))); @@ -1843,7 +1853,8 @@ public: m_uncheckAll = new QPushButton; hlayout->addWidget(m_uncheckAll); - connect(m_uncheckAll, SIGNAL(clicked()), this, SLOT(deselectAll())); + connect(m_uncheckAll, &QAbstractButton::clicked, + this, &ComponentSelectionPage::Private::deselectAll); m_uncheckAll->setObjectName(QLatin1String("DeselectAllComponentsButton")); m_uncheckAll->setShortcut(QKeySequence(ComponentSelectionPage::tr("Alt+D", "deselect all components"))); @@ -1858,8 +1869,8 @@ public: { m_checkDefault->setVisible(m_core->isInstaller() || m_core->isPackageManager()); if (m_treeView->selectionModel()) { - disconnect(m_treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), - this, SLOT(currentSelectedChanged(QModelIndex))); + disconnect(m_treeView->selectionModel(), &QItemSelectionModel::currentChanged, + this, &ComponentSelectionPage::Private::currentSelectedChanged); } m_currentModel = m_core->isUpdater() ? m_updaterModel : m_allModel; @@ -1900,8 +1911,8 @@ public: hasChildren = m_currentModel->hasChildren(m_currentModel->index(row, 0)); m_treeView->setRootIsDecorated(hasChildren); - connect(m_treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), - this, SLOT(currentSelectedChanged(QModelIndex))); + connect(m_treeView->selectionModel(), &QItemSelectionModel::currentChanged, + this, &ComponentSelectionPage::Private::currentSelectedChanged); m_treeView->setCurrentIndex(m_currentModel->index(0, 0)); } @@ -2155,12 +2166,12 @@ TargetDirectoryPage::TargetDirectoryPage(PackageManagerCore *core) m_lineEdit = new QLineEdit(this); m_lineEdit->setObjectName(QLatin1String("TargetDirectoryLineEdit")); - connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged())); + connect(m_lineEdit, &QLineEdit::textChanged, this, &QWizardPage::completeChanged); hlayout->addWidget(m_lineEdit); QPushButton *browseButton = new QPushButton(this); browseButton->setObjectName(QLatin1String("BrowseDirectoryButton")); - connect(browseButton, SIGNAL(clicked()), this, SLOT(dirRequested())); + connect(browseButton, &QAbstractButton::clicked, this, &TargetDirectoryPage::dirRequested); browseButton->setShortcut(QKeySequence(tr("Alt+R", "browse file system to choose a file"))); browseButton->setText(tr("B&rowse...")); hlayout->addWidget(browseButton); @@ -2466,8 +2477,8 @@ StartMenuDirectoryPage::StartMenuDirectoryPage(PackageManagerCore *core) setLayout(layout); - connect(m_listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, - SLOT(currentItemChanged(QListWidgetItem*))); + connect(m_listWidget, &QListWidget::currentItemChanged, this, + &StartMenuDirectoryPage::currentItemChanged); } /*! @@ -2774,22 +2785,27 @@ PerformInstallationPage::PerformInstallationPage(PackageManagerCore *core) m_performInstallationForm->setupUi(this); - connect(ProgressCoordinator::instance(), SIGNAL(detailTextChanged(QString)), - m_performInstallationForm, SLOT(appendProgressDetails(QString))); - connect(ProgressCoordinator::instance(), SIGNAL(detailTextResetNeeded()), - m_performInstallationForm, SLOT(clearDetailsBrowser())); - connect(m_performInstallationForm, SIGNAL(showDetailsChanged()), this, - SLOT(toggleDetailsWereChanged())); + connect(ProgressCoordinator::instance(), &ProgressCoordinator::detailTextChanged, + m_performInstallationForm, &PerformInstallationForm::appendProgressDetails); + connect(ProgressCoordinator::instance(), &ProgressCoordinator::detailTextResetNeeded, + m_performInstallationForm, &PerformInstallationForm::clearDetailsBrowser); + connect(m_performInstallationForm, &PerformInstallationForm::showDetailsChanged, + this, &PerformInstallationPage::toggleDetailsWereChanged); - connect(core, SIGNAL(installationStarted()), this, SLOT(installationStarted())); - connect(core, SIGNAL(installationFinished()), this, SLOT(installationFinished())); + connect(core, &PackageManagerCore::installationStarted, + this, &PerformInstallationPage::installationStarted); + connect(core, &PackageManagerCore::installationFinished, + this, &PerformInstallationPage::installationFinished); - connect(core, SIGNAL(uninstallationStarted()), this, SLOT(uninstallationStarted())); - connect(core, SIGNAL(uninstallationFinished()), this, SLOT(uninstallationFinished())); + connect(core, &PackageManagerCore::uninstallationStarted, + this, &PerformInstallationPage::uninstallationStarted); + connect(core, &PackageManagerCore::uninstallationFinished, + this, &PerformInstallationPage::uninstallationFinished); - connect(core, SIGNAL(titleMessageChanged(QString)), this, SLOT(setTitleMessage(QString))); - connect(this, SIGNAL(setAutomatedPageSwitchEnabled(bool)), core, - SIGNAL(setAutomatedPageSwitchEnabled(bool))); + connect(core, &PackageManagerCore::titleMessageChanged, + this, &PerformInstallationPage::setTitleMessage); + connect(this, &PerformInstallationPage::setAutomatedPageSwitchEnabled, + core, &PackageManagerCore::setAutomatedPageSwitchEnabled); m_performInstallationForm->setDetailsWidgetVisible(true); @@ -2954,7 +2970,7 @@ FinishedPage::FinishedPage(PackageManagerCore *core) void FinishedPage::entering() { if (m_commitButton) { - disconnect(m_commitButton, SIGNAL(clicked()), this, SLOT(handleFinishClicked())); + disconnect(m_commitButton, &QAbstractButton::clicked, this, &FinishedPage::handleFinishClicked); m_commitButton = 0; } @@ -2967,13 +2983,13 @@ void FinishedPage::entering() cancel->setEnabled(true); cancel->setVisible(true); // we don't use the usual FinishButton so we need to connect the misused CancelButton - connect(cancel, SIGNAL(clicked()), gui(), SIGNAL(finishButtonClicked())); - connect(cancel, SIGNAL(clicked()), packageManagerCore(), SIGNAL(finishButtonClicked())); + connect(cancel, &QAbstractButton::clicked, gui(), &PackageManagerGui::finishButtonClicked); + connect(cancel, &QAbstractButton::clicked, packageManagerCore(), &PackageManagerCore::finishButtonClicked); // for the moment we don't want the rejected signal connected - disconnect(gui(), SIGNAL(rejected()), packageManagerCore(), SLOT(setCanceled())); + disconnect(gui(), &QDialog::rejected, packageManagerCore(), &PackageManagerCore::setCanceled); - connect(gui()->button(QWizard::CommitButton), SIGNAL(clicked()), this, - SLOT(cleanupChangedConnects())); + connect(gui()->button(QWizard::CommitButton), &QAbstractButton::clicked, + this, &FinishedPage::cleanupChangedConnects); } setButtonText(QWizard::CommitButton, tr("Restart")); setButtonText(QWizard::CancelButton, gui()->defaultButtonText(QWizard::FinishButton)); @@ -2992,8 +3008,8 @@ void FinishedPage::entering() gui()->updateButtonLayout(); if (m_commitButton) { - disconnect(m_commitButton, SIGNAL(clicked()), this, SLOT(handleFinishClicked())); - connect(m_commitButton, SIGNAL(clicked()), this, SLOT(handleFinishClicked())); + disconnect(m_commitButton, &QAbstractButton::clicked, this, &FinishedPage::handleFinishClicked); + connect(m_commitButton, &QAbstractButton::clicked, this, &FinishedPage::handleFinishClicked); } if (packageManagerCore()->status() == PackageManagerCore::Success) { @@ -3060,12 +3076,12 @@ void FinishedPage::cleanupChangedConnects() { if (QAbstractButton *cancel = gui()->button(QWizard::CancelButton)) { // remove the workaround connect from entering page - disconnect(cancel, SIGNAL(clicked()), gui(), SIGNAL(finishButtonClicked())); - disconnect(cancel, SIGNAL(clicked()), packageManagerCore(), SIGNAL(finishButtonClicked())); - connect(gui(), SIGNAL(rejected()), packageManagerCore(), SLOT(setCanceled())); + disconnect(cancel, &QAbstractButton::clicked, gui(), &PackageManagerGui::finishButtonClicked); + disconnect(cancel, &QAbstractButton::clicked, packageManagerCore(), &PackageManagerCore::finishButtonClicked); + connect(gui(), &QDialog::rejected, packageManagerCore(), &PackageManagerCore::setCanceled); - disconnect(gui()->button(QWizard::CommitButton), SIGNAL(clicked()), this, - SLOT(cleanupChangedConnects())); + disconnect(gui()->button(QWizard::CommitButton), &QAbstractButton::clicked, + this, &FinishedPage::cleanupChangedConnects); } } diff --git a/src/libs/installer/performinstallationform.cpp b/src/libs/installer/performinstallationform.cpp index 459e94591..d6ffd80a7 100644 --- a/src/libs/installer/performinstallationform.cpp +++ b/src/libs/installer/performinstallationform.cpp @@ -123,13 +123,13 @@ void PerformInstallationForm::setupUi(QWidget *widget) m_downloadStatus->setObjectName(QLatin1String("DownloadStatus")); m_downloadStatus->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); topLayout->addWidget(m_downloadStatus); - connect(ProgressCoordinator::instance(), SIGNAL(downloadStatusChanged(QString)), this, - SLOT(onDownloadStatusChanged(QString))); + connect(ProgressCoordinator::instance(), &ProgressCoordinator::downloadStatusChanged, this, + &PerformInstallationForm::onDownloadStatusChanged); m_detailsButton = new QPushButton(tr("&Show Details"), widget); m_detailsButton->setObjectName(QLatin1String("DetailsButton")); m_detailsButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); - connect(m_detailsButton, SIGNAL(clicked()), this, SLOT(toggleDetails())); + connect(m_detailsButton, &QAbstractButton::clicked, this, &PerformInstallationForm::toggleDetails); topLayout->addWidget(m_detailsButton); QVBoxLayout *bottomLayout = new QVBoxLayout(); @@ -148,7 +148,8 @@ void PerformInstallationForm::setupUi(QWidget *widget) baseLayout->addLayout(bottomLayout); m_updateTimer = new QTimer(widget); - connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(updateProgress())); //updateProgress includes label + connect(m_updateTimer, &QTimer::timeout, + this, &PerformInstallationForm::updateProgress); //updateProgress includes label m_updateTimer->setInterval(30); m_progressBar->setRange(0, 100); diff --git a/src/libs/installer/qprocesswrapper.cpp b/src/libs/installer/qprocesswrapper.cpp index 8e8038cd8..b7d097a3b 100644 --- a/src/libs/installer/qprocesswrapper.cpp +++ b/src/libs/installer/qprocesswrapper.cpp @@ -49,19 +49,17 @@ QProcessWrapper::QProcessWrapper(QObject *parent) qRegisterMetaType<QProcess::ProcessState>(); m_timer.start(250); - connect(&m_timer, SIGNAL(timeout()), this, SLOT(processSignals())); - connect(&process, SIGNAL(bytesWritten(qint64)), SIGNAL(bytesWritten(qint64))); - connect(&process, SIGNAL(aboutToClose()), SIGNAL(aboutToClose())); - connect(&process, SIGNAL(readChannelFinished()), SIGNAL(readChannelFinished())); + connect(&m_timer, &QTimer::timeout, this, &QProcessWrapper::processSignals); + connect(&process, &QIODevice::bytesWritten, this, &QProcessWrapper::bytesWritten); + connect(&process, &QIODevice::aboutToClose, this, &QProcessWrapper::aboutToClose); + connect(&process, &QIODevice::readChannelFinished, this, &QProcessWrapper::readChannelFinished); connect(&process, SIGNAL(error(QProcess::ProcessError)), SIGNAL(error(QProcess::ProcessError))); - connect(&process, SIGNAL(readyReadStandardOutput()), SIGNAL(readyReadStandardOutput())); - connect(&process, SIGNAL(readyReadStandardError()), SIGNAL(readyReadStandardError())); - connect(&process, SIGNAL(finished(int,QProcess::ExitStatus)), - SIGNAL(finished(int,QProcess::ExitStatus))); - connect(&process, SIGNAL(readyRead()), SIGNAL(readyRead())); - connect(&process, SIGNAL(started()), SIGNAL(started())); - connect(&process, SIGNAL(stateChanged(QProcess::ProcessState)), - SIGNAL(stateChanged(QProcess::ProcessState))); + connect(&process, &QProcess::readyReadStandardOutput, this, &QProcessWrapper::readyReadStandardOutput); + connect(&process, &QProcess::readyReadStandardError, this, &QProcessWrapper::readyReadStandardError); + connect(&process, SIGNAL(finished(int,QProcess::ExitStatus)), SIGNAL(finished(int,QProcess::ExitStatus))); + connect(&process, &QIODevice::readyRead, this, &QProcessWrapper::readyRead); + connect(&process, &QProcess::started, this, &QProcessWrapper::started); + connect(&process, &QProcess::stateChanged, this, &QProcessWrapper::stateChanged); } QProcessWrapper::~QProcessWrapper() diff --git a/src/libs/installer/remoteserver.cpp b/src/libs/installer/remoteserver.cpp index b5f077b7e..c493593db 100644 --- a/src/libs/installer/remoteserver.cpp +++ b/src/libs/installer/remoteserver.cpp @@ -81,13 +81,13 @@ void RemoteServer::start() d->m_localServer = new LocalServer(d->m_socketName, d->m_key); d->m_localServer->moveToThread(&d->m_thread); - connect(&d->m_thread, SIGNAL(finished()), d->m_localServer, SLOT(deleteLater())); - connect(d->m_localServer, SIGNAL(newIncomingConnection()), this, SLOT(restartWatchdog())); - connect(d->m_localServer, SIGNAL(shutdownRequested()), this, SLOT(deleteLater())); + connect(&d->m_thread, &QThread::finished, d->m_localServer, &QObject::deleteLater); + connect(d->m_localServer, &LocalServer::newIncomingConnection, this, &RemoteServer::restartWatchdog); + connect(d->m_localServer, &LocalServer::shutdownRequested, this, &QObject::deleteLater); d->m_thread.start(); if (d->m_mode == Protocol::Mode::Production) { - connect(d->m_watchdog.data(), SIGNAL(timeout()), this, SLOT(deleteLater())); + connect(d->m_watchdog.data(), &QTimer::timeout, this, &QObject::deleteLater); d->m_watchdog->start(); } } diff --git a/src/libs/installer/remoteserver_p.h b/src/libs/installer/remoteserver_p.h index 8750e00d9..a33f54eec 100644 --- a/src/libs/installer/remoteserver_p.h +++ b/src/libs/installer/remoteserver_p.h @@ -85,9 +85,9 @@ private: if (m_shutdown) return; - QThread *const thread = new RemoteServerConnection(socketDescriptor, m_key, this); - connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); - connect(thread, SIGNAL(shutdownRequested()), this, SLOT(shutdown())); + RemoteServerConnection *thread = new RemoteServerConnection(socketDescriptor, m_key, this); + connect(thread, &QThread::finished, thread, &QObject::deleteLater); + connect(thread, &RemoteServerConnection::shutdownRequested, this, &LocalServer::shutdown); thread->start(); emit newIncomingConnection(); } diff --git a/src/libs/installer/remoteserverconnection_p.h b/src/libs/installer/remoteserverconnection_p.h index 5c1c0b791..a741891ae 100644 --- a/src/libs/installer/remoteserverconnection_p.h +++ b/src/libs/installer/remoteserverconnection_p.h @@ -52,19 +52,21 @@ private: explicit QProcessSignalReceiver(QProcess *process) : QObject(process) { - connect(process, SIGNAL(bytesWritten(qint64)), SLOT(onBytesWritten(qint64))); - connect(process, SIGNAL(aboutToClose()), SLOT(onAboutToClose())); - connect(process, SIGNAL(readChannelFinished()), SLOT(onReadChannelFinished())); + connect(process, &QIODevice::bytesWritten, this, &QProcessSignalReceiver::onBytesWritten); + connect(process, &QIODevice::aboutToClose, this, &QProcessSignalReceiver::onAboutToClose); + connect(process, &QIODevice::readChannelFinished, this, &QProcessSignalReceiver::onReadChannelFinished); connect(process, SIGNAL(error(QProcess::ProcessError)), SLOT(onError(QProcess::ProcessError))); - connect(process, SIGNAL(readyReadStandardOutput()), SLOT(onReadyReadStandardOutput())); - connect(process, SIGNAL(readyReadStandardError()), SLOT(onReadyReadStandardError())); - connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), - SLOT(onFinished(int, QProcess::ExitStatus))); - connect(process, SIGNAL(readyRead()), SLOT(onReadyRead())); - connect(process, SIGNAL(started()), SLOT(onStarted())); - connect(process, SIGNAL(stateChanged(QProcess::ProcessState)), - SLOT(onStateChanged(QProcess::ProcessState))); + connect(process, &QProcess::readyReadStandardOutput, + this, &QProcessSignalReceiver::onReadyReadStandardOutput); + connect(process, &QProcess::readyReadStandardError, + this, &QProcessSignalReceiver::onReadyReadStandardError); + connect(process, SIGNAL(finished(int,QProcess::ExitStatus)), + SLOT(onFinished(int,QProcess::ExitStatus))); + connect(process, &QIODevice::readyRead, this, &QProcessSignalReceiver::onReadyRead); + connect(process, &QProcess::started, this, &QProcessSignalReceiver::onStarted); + connect(process, &QProcess::stateChanged, + this, &QProcessSignalReceiver::onStateChanged); } private Q_SLOTS: diff --git a/src/libs/installer/scriptengine.cpp b/src/libs/installer/scriptengine.cpp index 9a4272ac9..e3f82194c 100644 --- a/src/libs/installer/scriptengine.cpp +++ b/src/libs/installer/scriptengine.cpp @@ -266,7 +266,7 @@ ScriptEngine::ScriptEngine(PackageManagerCore *core) : setGuiQObject(core->guiObject()); QQmlEngine::setObjectOwnership(core, QQmlEngine::CppOwnership); global.setProperty(QLatin1String("installer"), m_engine.newQObject(core)); - connect(core, SIGNAL(guiObjectChanged(QObject*)), this, SLOT(setGuiQObject(QObject*))); + connect(core, &PackageManagerCore::guiObjectChanged, this, &ScriptEngine::setGuiQObject); } else { global.setProperty(QLatin1String("installer"), m_engine.newQObject(new QObject)); } diff --git a/src/libs/installer/testrepository.cpp b/src/libs/installer/testrepository.cpp index 8a3f306e5..1dcba41ae 100644 --- a/src/libs/installer/testrepository.cpp +++ b/src/libs/installer/testrepository.cpp @@ -92,11 +92,12 @@ void TestRepository::doStart() auth.setPassword(m_repository.password()); m_downloader->setAuthenticator(auth); - connect(m_downloader, SIGNAL(downloadCompleted()), this, SLOT(downloadCompleted())); - connect(m_downloader, SIGNAL(downloadAborted(QString)), this, SLOT(downloadAborted(QString)), - Qt::QueuedConnection); - connect(m_downloader, SIGNAL(authenticatorChanged(QAuthenticator)), this, - SLOT(onAuthenticatorChanged(QAuthenticator))); + connect(m_downloader, &KDUpdater::FileDownloader::downloadCompleted, + this, &TestRepository::downloadCompleted); + connect(m_downloader, &KDUpdater::FileDownloader::downloadAborted, + this, &TestRepository::downloadAborted, Qt::QueuedConnection); + connect(m_downloader, &KDUpdater::FileDownloader::authenticatorChanged, + this, &TestRepository::onAuthenticatorChanged); m_downloader->setAutoRemoveDownloadedFile(true); m_downloader->setUrl(QUrl(url.toString() + QString::fromLatin1("/Updates.xml"))); diff --git a/src/libs/kdtools/kdjob.cpp b/src/libs/kdtools/kdjob.cpp index 43ca36875..cca082f9f 100644 --- a/src/libs/kdtools/kdjob.cpp +++ b/src/libs/kdtools/kdjob.cpp @@ -55,7 +55,7 @@ public: , processedAmount(0) , m_timeout(-1) { - connect(&m_timer, SIGNAL(timeout()), q, SLOT(cancel())); + connect(&m_timer, &QTimer::timeout, q, &KDJob::cancel); } ~Private() @@ -99,7 +99,7 @@ KDJob::KDJob(QObject *parent) : QObject(parent), d(new Private(this)) { - connect(this, SIGNAL(finished(KDJob*)), this, SLOT(onFinished())); + connect(this, &KDJob::finished, this, &KDJob::onFinished); } KDJob::~KDJob() diff --git a/src/libs/kdtools/kdupdaterfiledownloader.cpp b/src/libs/kdtools/kdupdaterfiledownloader.cpp index 735358afe..98234920c 100644 --- a/src/libs/kdtools/kdupdaterfiledownloader.cpp +++ b/src/libs/kdtools/kdupdaterfiledownloader.cpp @@ -1059,7 +1059,7 @@ struct KDUpdater::HttpDownloader::Private void shutDown() { - disconnect(http, SIGNAL(finished()), q, SLOT(httpReqFinished())); + disconnect(http, &QNetworkReply::finished, q, &HttpDownloader::httpReqFinished); http->deleteLater(); http = 0; destination->close(); @@ -1077,11 +1077,11 @@ KDUpdater::HttpDownloader::HttpDownloader(QObject *parent) , d(new Private(this)) { #ifndef QT_NO_SSL - connect(&d->manager, SIGNAL(sslErrors(QNetworkReply*, QList<QSslError>)), - this, SLOT(onSslErrors(QNetworkReply*, QList<QSslError>))); + connect(&d->manager, &QNetworkAccessManager::sslErrors, + this, &HttpDownloader::onSslErrors); #endif - connect(&d->manager, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), this, - SLOT(onAuthenticationRequired(QNetworkReply*, QAuthenticator*))); + connect(&d->manager, &QNetworkAccessManager::authenticationRequired, + this, &HttpDownloader::onAuthenticationRequired); } /*! @@ -1293,12 +1293,12 @@ void KDUpdater::HttpDownloader::startDownload(const QUrl &url) d->manager.setProxyFactory(proxyFactory()); d->http = d->manager.get(QNetworkRequest(url)); - connect(d->http, SIGNAL(readyRead()), this, SLOT(httpReadyRead())); - connect(d->http, SIGNAL(downloadProgress(qint64, qint64)), this, - SLOT(httpReadProgress(qint64, qint64))); - connect(d->http, SIGNAL(finished()), this, SLOT(httpReqFinished())); - connect(d->http, SIGNAL(error(QNetworkReply::NetworkError)), this, - SLOT(httpError(QNetworkReply::NetworkError))); + connect(d->http, &QIODevice::readyRead, this, &HttpDownloader::httpReadyRead); + connect(d->http, &QNetworkReply::downloadProgress, + this, &HttpDownloader::httpReadProgress); + connect(d->http, &QNetworkReply::finished, this, &HttpDownloader::httpReqFinished); + void (QNetworkReply::*errorSignal)(QNetworkReply::NetworkError) = &QNetworkReply::error; + connect(d->http, errorSignal, this, &HttpDownloader::httpError); if (d->destFileName.isEmpty()) { QTemporaryFile *file = new QTemporaryFile(this); diff --git a/src/libs/kdtools/kdupdaterfiledownloader.h b/src/libs/kdtools/kdupdaterfiledownloader.h index 0a4cbce22..a74097625 100644 --- a/src/libs/kdtools/kdupdaterfiledownloader.h +++ b/src/libs/kdtools/kdupdaterfiledownloader.h @@ -110,10 +110,6 @@ Q_SIGNALS: void downloadStatus(const QString &status); void downloadProgress(qint64 bytesReceived, qint64 bytesToReceive); void authenticatorChanged(const QAuthenticator &authenticator); - -#ifndef Q_MOC_RUN -private: -#endif void downloadCompleted(); void downloadAborted(const QString &errorMessage); diff --git a/src/sdk/installerbasecommons.cpp b/src/sdk/installerbasecommons.cpp index 15c9bb1f5..2f916a81d 100644 --- a/src/sdk/installerbasecommons.cpp +++ b/src/sdk/installerbasecommons.cpp @@ -87,7 +87,8 @@ MaintenanceGui::MaintenanceGui(PackageManagerCore *core) } IntroductionPage *intro = new IntroductionPage(core); - connect(intro, SIGNAL(packageManagerCoreTypeChanged()), this, SLOT(updateRestartPage())); + connect(intro, &IntroductionPage::packageManagerCoreTypeChanged, + this, &MaintenanceGui::updateRestartPage); setPage(PackageManagerCore::Introduction, intro); setPage(PackageManagerCore::ComponentSelection, new ComponentSelectionPage(core)); @@ -97,7 +98,7 @@ MaintenanceGui::MaintenanceGui(PackageManagerCore *core) setPage(PackageManagerCore::InstallationFinished, new FinishedPage(core)); RestartPage *p = new RestartPage(core); - connect(p, SIGNAL(restart()), this, SIGNAL(gotRestarted())); + connect(p, &RestartPage::restart, this, &PackageManagerGui::gotRestarted); setPage(PackageManagerCore::InstallationFinished + 1, p); if (core->isUninstaller()) diff --git a/src/sdk/main.cpp b/src/sdk/main.cpp index cda9c932a..5ae5a7f29 100644 --- a/src/sdk/main.cpp +++ b/src/sdk/main.cpp @@ -158,7 +158,7 @@ int main(int argc, char *argv[]) #endif QInstaller::RemoteServer *server = new QInstaller::RemoteServer; - QObject::connect(server, SIGNAL(destroyed()), &app, SLOT(quit())); + QObject::connect(server, &QInstaller::RemoteServer::destroyed, &app, &decltype(app)::quit); server->init(socketName, key, (production ? QInstaller::Protocol::Mode::Production : QInstaller::Protocol::Mode::Debug)); diff --git a/src/sdk/settingsdialog.cpp b/src/sdk/settingsdialog.cpp index 6fd54244a..229568931 100644 --- a/src/sdk/settingsdialog.cpp +++ b/src/sdk/settingsdialog.cpp @@ -227,13 +227,18 @@ SettingsDialog::SettingsDialog(PackageManagerCore *core, QWidget *parent) m_ui->m_httpProxy->setText(httpProxy.hostName()); m_ui->m_httpProxyPort->setValue(httpProxy.port()); - connect(m_ui->m_addRepository, SIGNAL(clicked()), this, SLOT(addRepository())); - connect(m_ui->m_showPasswords, SIGNAL(clicked()), this, SLOT(updatePasswords())); - connect(m_ui->m_removeRepository, SIGNAL(clicked()), this, SLOT(removeRepository())); - connect(m_ui->m_useTmpRepositories, SIGNAL(clicked(bool)), this, SLOT(useTmpRepositoriesOnly(bool))); - connect(m_ui->m_repositoriesView, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), - this, SLOT(currentRepositoryChanged(QTreeWidgetItem*, QTreeWidgetItem*))); - connect(m_ui->m_testRepository, SIGNAL(clicked()), this, SLOT(testRepository())); + connect(m_ui->m_addRepository, &QAbstractButton::clicked, + this, &SettingsDialog::addRepository); + connect(m_ui->m_showPasswords, &QAbstractButton::clicked, + this, &SettingsDialog::updatePasswords); + connect(m_ui->m_removeRepository, &QAbstractButton::clicked, + this, &SettingsDialog::removeRepository); + connect(m_ui->m_useTmpRepositories, &QAbstractButton::clicked, + this, &SettingsDialog::useTmpRepositoriesOnly); + connect(m_ui->m_repositoriesView, &QTreeWidget::currentItemChanged, + this, &SettingsDialog::currentRepositoryChanged); + connect(m_ui->m_testRepository, &QAbstractButton::clicked, + this, &SettingsDialog::testRepository); useTmpRepositoriesOnly(settings.hasReplacementRepos()); m_ui->m_useTmpRepositories->setChecked(settings.hasReplacementRepos()); diff --git a/src/sdk/tabcontroller.cpp b/src/sdk/tabcontroller.cpp index 80eb29ed5..394f953fa 100644 --- a/src/sdk/tabcontroller.cpp +++ b/src/sdk/tabcontroller.cpp @@ -95,7 +95,7 @@ TabController::~TabController() void TabController::setGui(QInstaller::PackageManagerGui *gui) { d->m_gui = gui; - connect(d->m_gui, SIGNAL(gotRestarted()), this, SLOT(restartWizard())); + connect(d->m_gui, &PackageManagerGui::gotRestarted, this, &TabController::restartWizard); } void TabController::setControlScript(const QString &script) @@ -125,8 +125,9 @@ int TabController::init() qDebug() << "Using control script:" << d->m_controlScript; } - connect(d->m_gui, SIGNAL(currentIdChanged(int)), this, SLOT(onCurrentIdChanged(int))); - connect(d->m_gui, SIGNAL(settingsButtonClicked()), this, SLOT(onSettingsButtonClicked())); + connect(d->m_gui, &QWizard::currentIdChanged, this, &TabController::onCurrentIdChanged); + connect(d->m_gui, &PackageManagerGui::settingsButtonClicked, + this, &TabController::onSettingsButtonClicked); } IntroductionPage *page = @@ -169,14 +170,14 @@ void TabController::restartWizard() d->m_core->writeMaintenanceTool(); // restart and switch back to intro page - QTimer::singleShot(0, this, SLOT(init())); + QTimer::singleShot(0, this, &TabController::init); } void TabController::onSettingsButtonClicked() { SettingsDialog dialog(d->m_core); - connect (&dialog, SIGNAL(networkSettingsChanged(QInstaller::Settings)), this, - SLOT(onNetworkSettingsChanged(QInstaller::Settings))); + connect(&dialog, &SettingsDialog::networkSettingsChanged, + this, &TabController::onNetworkSettingsChanged); dialog.exec(); if (d->m_networkSettingsChanged) { diff --git a/tests/auto/installer/consumeoutputoperationtest/tst_consumeoutputoperationtest.cpp b/tests/auto/installer/consumeoutputoperationtest/tst_consumeoutputoperationtest.cpp index 868865b5d..c0f250435 100644 --- a/tests/auto/installer/consumeoutputoperationtest/tst_consumeoutputoperationtest.cpp +++ b/tests/auto/installer/consumeoutputoperationtest/tst_consumeoutputoperationtest.cpp @@ -114,7 +114,7 @@ private: QEventLoop loop; QProcess process; - QObject::connect(&process, SIGNAL(finished(int, QProcess::ExitStatus)), &loop, SLOT(quit())); + QObject::connect(&process, SIGNAL(finished(int,QProcess::ExitStatus)), &loop, SLOT(quit())); process.start(binary, arguments, QIODevice::ReadOnly); if (process.state() != QProcess::NotRunning) diff --git a/tests/downloadspeed/main.cpp b/tests/downloadspeed/main.cpp index 5b66df051..c56305657 100644 --- a/tests/downloadspeed/main.cpp +++ b/tests/downloadspeed/main.cpp @@ -165,16 +165,16 @@ int main(int argc, char *argv[]) loader->setProxyFactory(new ProxyFactory()); Receiver r; - r.connect(loader, SIGNAL(downloadStarted()), &r, SLOT(downloadStarted())); - r.connect(loader, SIGNAL(downloadCanceled()), &r, SLOT(downloadFinished())); - r.connect(loader, SIGNAL(downloadCompleted()), &r, SLOT(downloadFinished())); - r.connect(loader, SIGNAL(downloadAborted(QString)), &r, SLOT(downloadAborted(QString))); + r.connect(loader, &KDUpdater::FileDownloader::downloadStarted, &r, &Receiver::downloadStarted); + r.connect(loader, &KDUpdater::FileDownloader::downloadCanceled, &r, &Receiver::downloadFinished); + r.connect(loader, &KDUpdater::FileDownloader::downloadCompleted, &r, &Receiver::downloadFinished); + r.connect(loader, &KDUpdater::FileDownloader::downloadAborted, &r, &Receiver::downloadAborted); - r.connect(loader, SIGNAL(downloadSpeed(qint64)), &r, SLOT(downloadSpeed(qint64))); - r.connect(loader, SIGNAL(downloadStatus(QString)), &r, SLOT(downloadStatus(QString))); + r.connect(loader, &KDUpdater::FileDownloader::downloadSpeed, &r, &Receiver::downloadSpeed); + r.connect(loader, &KDUpdater::FileDownloader::downloadStatus, &r, &Receiver::downloadStatus); r.connect(loader, SIGNAL(downloadProgress(double)), &r, SLOT(downloadProgress(double))); - r.connect(loader, SIGNAL(estimatedDownloadTime(int)), &r, SLOT(estimatedDownloadTime(int))); - r.connect(loader, SIGNAL(downloadProgress(qint64, qint64)), &r, SLOT(downloadProgress(qint64, qint64))); + r.connect(loader, &KDUpdater::FileDownloader::estimatedDownloadTime, &r, &Receiver::estimatedDownloadTime); + r.connect(loader, SIGNAL(downloadProgress(qint64,qint64)), &r, SLOT(downloadProgress(qint64,qint64))); loader->download(); while (!r.downloaded()) diff --git a/tools/repocompare/main.cpp b/tools/repocompare/main.cpp index 8ebb49146..514557bcb 100644 --- a/tools/repocompare/main.cpp +++ b/tools/repocompare/main.cpp @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) RepositoryManager manager; manager.setProductionRepository(productionRepo); manager.setUpdateRepository(updateRepo); - a.connect(&manager, SIGNAL(repositoriesCompared()), &a, SLOT(quit())); + a.connect(&manager, &RepositoryManager::repositoriesCompared, &a, &QApplication::quit); qDebug() << "Waiting for server reply..."; a.exec(); qDebug() << "Writing into " << outputFile; diff --git a/tools/repocompare/mainwindow.cpp b/tools/repocompare/mainwindow.cpp index 0c9a2ccb1..64da74f0c 100644 --- a/tools/repocompare/mainwindow.cpp +++ b/tools/repocompare/mainwindow.cpp @@ -78,11 +78,11 @@ MainWindow::MainWindow(QWidget *parent) : ui->productionRepo->insertItems(0, settings.value(productionIdentifier).toStringList()); ui->updateRepo->insertItems(0, settings.value(updateIdentifier).toStringList()); - connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close())); - connect(ui->productionButton, SIGNAL(clicked()), this, SLOT(getProductionRepository())); - connect(ui->updateButton, SIGNAL(clicked()), this, SLOT(getUpdateRepository())); - connect(ui->exportButton, SIGNAL(clicked()), this, SLOT(createExportFile())); - connect(&manager, SIGNAL(repositoriesCompared()), this, SLOT(displayRepositories())); + connect(ui->actionExit, &QAction::triggered, this, &QWidget::close); + connect(ui->productionButton, &QAbstractButton::clicked, this, &MainWindow::getProductionRepository); + connect(ui->updateButton, &QAbstractButton::clicked, this, &MainWindow::getUpdateRepository); + connect(ui->exportButton, &QAbstractButton::clicked, this, &MainWindow::createExportFile); + connect(&manager, &RepositoryManager::repositoriesCompared, this, &MainWindow::displayRepositories); } MainWindow::~MainWindow() diff --git a/tools/repocompare/repositorymanager.cpp b/tools/repocompare/repositorymanager.cpp index 12df728f4..8f69432dc 100644 --- a/tools/repocompare/repositorymanager.cpp +++ b/tools/repocompare/repositorymanager.cpp @@ -67,7 +67,7 @@ RepositoryManager::RepositoryManager(QObject *parent) : QObject(parent) { manager = new QNetworkAccessManager(this); - connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(receiveRepository(QNetworkReply*))); + connect(manager, &QNetworkAccessManager::finished, this, &RepositoryManager::receiveRepository); productionMap.clear(); updateMap.clear(); } |