From 6ff75b475c2014271ac325aaf9cdae0d2909c0e6 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sat, 25 Dec 2021 17:29:55 +0100 Subject: rbutil: Modernize connect() calls. Auto fixed by clazy. Change-Id: Ib7cce8c0a85f8f915263980bf5d2508a4b19bbe3 --- utils/rbutilqt/base/bootloaderinstallimx.cpp | 1 - utils/rbutilqt/configure.cpp | 30 +++++++------- utils/rbutilqt/createvoicewindow.cpp | 8 ++-- utils/rbutilqt/encttscfggui.cpp | 12 +++--- utils/rbutilqt/gui/backupdialog.cpp | 12 +++--- utils/rbutilqt/gui/selectiveinstallwidget.cpp | 24 ++++++------ utils/rbutilqt/installtalkwindow.cpp | 8 ++-- utils/rbutilqt/preview.cpp | 2 +- utils/rbutilqt/progressloggergui.cpp | 10 ++--- utils/rbutilqt/rbutilqt.cpp | 56 +++++++++++++-------------- utils/rbutilqt/test/test-httpget.cpp | 30 +++++++------- utils/rbutilqt/themesinstallwindow.cpp | 18 ++++----- utils/rbutilqt/uninstallwindow.cpp | 8 ++-- 13 files changed, 109 insertions(+), 110 deletions(-) (limited to 'utils') diff --git a/utils/rbutilqt/base/bootloaderinstallimx.cpp b/utils/rbutilqt/base/bootloaderinstallimx.cpp index 7428cf10c8..87f5d9de63 100644 --- a/utils/rbutilqt/base/bootloaderinstallimx.cpp +++ b/utils/rbutilqt/base/bootloaderinstallimx.cpp @@ -121,7 +121,6 @@ void BootloaderInstallImx::installStage2(void) m_tempfile.close(); m_patchedFile.close(); connect(m_thread, &QThread::finished, this, &BootloaderInstallImx::installStage3); - connect(m_thread, SIGNAL(terminated()), this, SLOT(installStage3())); m_thread->start(); } diff --git a/utils/rbutilqt/configure.cpp b/utils/rbutilqt/configure.cpp index 892b327419..6f64a007a9 100644 --- a/utils/rbutilqt/configure.cpp +++ b/utils/rbutilqt/configure.cpp @@ -95,24 +95,24 @@ Config::Config(QWidget *parent,int index) : QDialog(parent) this->setModal(true); connect(ui.buttonOk, SIGNAL(clicked()), this, SLOT(accept())); - connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(abort())); - connect(ui.radioNoProxy, SIGNAL(toggled(bool)), this, SLOT(setNoProxy(bool))); - connect(ui.radioSystemProxy, SIGNAL(toggled(bool)), this, SLOT(setSystemProxy(bool))); - connect(ui.refreshMountPoint, SIGNAL(clicked()), this, SLOT(refreshMountpoint())); - connect(ui.buttonAutodetect,SIGNAL(clicked()),this,SLOT(autodetect())); - connect(ui.buttonCacheBrowse, SIGNAL(clicked()), this, SLOT(browseCache())); - connect(ui.buttonCacheClear, SIGNAL(clicked()), this, SLOT(cacheClear())); - connect(ui.configTts, SIGNAL(clicked()), this, SLOT(configTts())); - connect(ui.configEncoder, SIGNAL(clicked()), this, SLOT(configEnc())); + connect(ui.buttonCancel, &QAbstractButton::clicked, this, &Config::abort); + connect(ui.radioNoProxy, &QAbstractButton::toggled, this, &Config::setNoProxy); + connect(ui.radioSystemProxy, &QAbstractButton::toggled, this, &Config::setSystemProxy); + connect(ui.refreshMountPoint, &QAbstractButton::clicked, this, &Config::refreshMountpoint); + connect(ui.buttonAutodetect, &QAbstractButton::clicked, this, &Config::autodetect); + connect(ui.buttonCacheBrowse, &QAbstractButton::clicked, this, &Config::browseCache); + connect(ui.buttonCacheClear, &QAbstractButton::clicked, this, &Config::cacheClear); + connect(ui.configTts, &QAbstractButton::clicked, this, &Config::configTts); + connect(ui.configEncoder, &QAbstractButton::clicked, this, &Config::configEnc); connect(ui.comboTts, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTtsState(int))); - connect(ui.treeDevices, SIGNAL(itemSelectionChanged()), this, SLOT(updateEncState())); - connect(ui.testTTS,SIGNAL(clicked()),this,SLOT(testTts())); - connect(ui.showDisabled, SIGNAL(toggled(bool)), this, SLOT(showDisabled(bool))); + connect(ui.treeDevices, &QTreeWidget::itemSelectionChanged, this, &Config::updateEncState); + connect(ui.testTTS, &QAbstractButton::clicked, this, &Config::testTts); + connect(ui.showDisabled, &QAbstractButton::toggled, this, &Config::showDisabled); connect(ui.mountPoint, SIGNAL(editTextChanged(QString)), this, SLOT(updateMountpoint(QString))); connect(ui.mountPoint, SIGNAL(currentIndexChanged(int)), this, SLOT(updateMountpoint(int))); - connect(ui.checkShowProxyPassword, SIGNAL(toggled(bool)), this, SLOT(showProxyPassword(bool))); + connect(ui.checkShowProxyPassword, &QAbstractButton::toggled, this, &Config::showProxyPassword); // delete this dialog after it finished automatically. - connect(this, SIGNAL(finished(int)), this, SLOT(deleteLater())); + connect(this, &QDialog::finished, this, &QObject::deleteLater); setUserSettings(); setDevices(); @@ -285,7 +285,7 @@ void Config::setUserSettings() ui.listLanguages->setCurrentItem(a.at(0)); // don't connect before language list has been set up to prevent // triggering the signal by selecting the saved language. - connect(ui.listLanguages, SIGNAL(itemSelectionChanged()), this, SLOT(updateLanguage())); + connect(ui.listLanguages, &QListWidget::itemSelectionChanged, this, &Config::updateLanguage); // devices tab refreshMountpoint(); diff --git a/utils/rbutilqt/createvoicewindow.cpp b/utils/rbutilqt/createvoicewindow.cpp index 158c1201ce..36131cb537 100644 --- a/utils/rbutilqt/createvoicewindow.cpp +++ b/utils/rbutilqt/createvoicewindow.cpp @@ -30,7 +30,7 @@ CreateVoiceWindow::CreateVoiceWindow(QWidget *parent) : QDialog(parent) ui.setupUi(this); voicecreator = new VoiceFileCreator(this); updateSettings(); - connect(ui.change,SIGNAL(clicked()),this,SLOT(change())); + connect(ui.change,&QAbstractButton::clicked,this,&CreateVoiceWindow::change); } void CreateVoiceWindow::change() @@ -40,14 +40,14 @@ void CreateVoiceWindow::change() // call configuration dialog Config *cw = new Config(this,4); - connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); + connect(cw, &Config::settingsUpdated, this, &CreateVoiceWindow::updateSettings); cw->show(); } void CreateVoiceWindow::accept() { logger = new ProgressLoggerGui(this); - connect(logger,SIGNAL(closed()),this,SLOT(close())); + connect(logger,&ProgressLoggerGui::closed,this,&QWidget::close); logger->show(); saveSettings(); @@ -60,7 +60,7 @@ void CreateVoiceWindow::accept() //start creating connect(voicecreator, SIGNAL(done(bool)), logger, SLOT(setFinished())); connect(voicecreator, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int))); - connect(voicecreator, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int))); + connect(voicecreator, &VoiceFileCreator::logProgress, logger, &ProgressLoggerGui::setProgress); connect(logger,SIGNAL(aborted()),voicecreator,SLOT(abort())); voicecreator->createVoiceFile(); } diff --git a/utils/rbutilqt/encttscfggui.cpp b/utils/rbutilqt/encttscfggui.cpp index 19181c0f8b..51a047da61 100644 --- a/utils/rbutilqt/encttscfggui.cpp +++ b/utils/rbutilqt/encttscfggui.cpp @@ -47,8 +47,8 @@ EncTtsCfgGui::EncTtsCfgGui(QDialog* parent, EncTtsSettingInterface* iface, QStri m_busyDlg->setLabel(nullptr); m_busyDlg->setCancelButton(nullptr); m_busyDlg->hide(); - connect(iface,SIGNAL(busy()),this,SLOT(showBusy())); - connect(iface,SIGNAL(busyEnd()),this,SLOT(hideBusy())); + connect(iface,&EncTtsSettingInterface::busy,this,&EncTtsCfgGui::showBusy); + connect(iface,&EncTtsSettingInterface::busyEnd,this,&EncTtsCfgGui::hideBusy); //setup the window setWindowTitle(name); @@ -144,7 +144,7 @@ QWidget* EncTtsCfgGui::createWidgets(EncTtsSetting* setting) QLineEdit *lineEdit = new QLineEdit(this); lineEdit->setAccessibleName(setting->name()); lineEdit->setText(setting->current().toString()); - connect(lineEdit,SIGNAL(textChanged(QString)),this,SLOT(updateSetting())); + connect(lineEdit,&QLineEdit::textChanged,this,&EncTtsCfgGui::updateSetting); value = lineEdit; break; } @@ -169,7 +169,7 @@ QWidget* EncTtsCfgGui::createWidgets(EncTtsSetting* setting) QCheckBox *checkbox = new QCheckBox(this); checkbox->setAccessibleName(setting->name()); checkbox->setCheckState(setting->current().toBool() == true ? Qt::Checked : Qt::Unchecked); - connect(checkbox,SIGNAL(stateChanged(int)),this,SLOT(updateSetting())); + connect(checkbox,&QCheckBox::stateChanged,this,&EncTtsCfgGui::updateSetting); value = checkbox; break; } @@ -184,7 +184,7 @@ QWidget* EncTtsCfgGui::createWidgets(EncTtsSetting* setting) if(value != nullptr) { m_settingsWidgetsMap.insert(setting,value); - connect(setting,SIGNAL(updateGui()),this,SLOT(updateWidget())); + connect(setting,&EncTtsSetting::updateGui,this,&EncTtsCfgGui::updateWidget); } return value; @@ -204,7 +204,7 @@ QWidget* EncTtsCfgGui::createButton(EncTtsSetting* setting) { QPushButton* refreshbtn = new QPushButton(tr("Refresh"),this); refreshbtn->setIcon(QIcon(":/icons/view-refresh.svg")); - connect(refreshbtn,SIGNAL(clicked()),setting,SIGNAL(refresh())); + connect(refreshbtn,&QAbstractButton::clicked,setting,&EncTtsSetting::refresh); return refreshbtn; } else diff --git a/utils/rbutilqt/gui/backupdialog.cpp b/utils/rbutilqt/gui/backupdialog.cpp index f12c47b570..63e628f7cf 100644 --- a/utils/rbutilqt/gui/backupdialog.cpp +++ b/utils/rbutilqt/gui/backupdialog.cpp @@ -59,13 +59,13 @@ BackupDialog::BackupDialog(QWidget* parent) : QDialog(parent) ui.setupUi(this); m_thread = new BackupSizeThread(); - connect(m_thread, SIGNAL(finished()), this, SLOT(updateSizeInfo())); + connect(m_thread, &QThread::finished, this, &BackupDialog::updateSizeInfo); connect(m_thread, SIGNAL(terminated()), this, SLOT(updateSizeInfo())); - connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(close())); - connect(ui.buttonCancel, SIGNAL(clicked()), m_thread, SLOT(quit())); - connect(ui.buttonChange, SIGNAL(clicked()), this, SLOT(changeBackupPath())); - connect(ui.buttonBackup, SIGNAL(clicked()), this, SLOT(backup())); + connect(ui.buttonCancel, &QAbstractButton::clicked, this, &QWidget::close); + connect(ui.buttonCancel, &QAbstractButton::clicked, m_thread, &QThread::quit); + connect(ui.buttonChange, &QAbstractButton::clicked, this, &BackupDialog::changeBackupPath); + connect(ui.buttonBackup, &QAbstractButton::clicked, this, &BackupDialog::backup); ui.backupSize->setText(tr("Installation size: calculating ...")); m_mountpoint = RbSettings::value(RbSettings::Mountpoint).toString(); @@ -120,7 +120,7 @@ void BackupDialog::backup(void) } } m_logger = new ProgressLoggerGui(this); - connect(m_logger, SIGNAL(closed()), this, SLOT(close())); + connect(m_logger, &ProgressLoggerGui::closed, this, &QWidget::close); m_logger->show(); m_logger->addItem(tr("Starting backup ..."),LOGINFO); QCoreApplication::processEvents(); diff --git a/utils/rbutilqt/gui/selectiveinstallwidget.cpp b/utils/rbutilqt/gui/selectiveinstallwidget.cpp index a0504c0f40..3fe2dc7956 100644 --- a/utils/rbutilqt/gui/selectiveinstallwidget.cpp +++ b/utils/rbutilqt/gui/selectiveinstallwidget.cpp @@ -294,9 +294,9 @@ void SelectiveInstallWidget::installBootloader(void) // the bootloader install class does NOT use any GUI stuff. // All messages are passed via signals. connect(bl, SIGNAL(done(bool)), m_logger, SLOT(setFinished())); - connect(bl, SIGNAL(done(bool)), this, SLOT(continueInstall(bool))); + connect(bl, &BootloaderInstallBase::done, this, &SelectiveInstallWidget::continueInstall); connect(bl, SIGNAL(logItem(QString, int)), m_logger, SLOT(addItem(QString, int))); - connect(bl, SIGNAL(logProgress(int, int)), m_logger, SLOT(setProgress(int, int))); + connect(bl, &BootloaderInstallBase::logProgress, m_logger, &ProgressLoggerGui::setProgress); // pass Abort button click signal to current installer connect(m_logger, SIGNAL(aborted()), bl, SLOT(progressAborted())); @@ -446,10 +446,10 @@ void SelectiveInstallWidget::installRockbox(void) PlayerBuildInfo::BuildVersion, m_buildtype).toString()); m_zipinstaller->setMountPoint(m_mountpoint); - connect(m_zipinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool))); + connect(m_zipinstaller, &ZipInstaller::done, this, &SelectiveInstallWidget::continueInstall); connect(m_zipinstaller, SIGNAL(logItem(QString, int)), m_logger, SLOT(addItem(QString, int))); - connect(m_zipinstaller, SIGNAL(logProgress(int, int)), m_logger, SLOT(setProgress(int, int))); + connect(m_zipinstaller, &ZipInstaller::logProgress, m_logger, &ProgressLoggerGui::setProgress); connect(m_logger, SIGNAL(aborted()), m_zipinstaller, SLOT(abort())); m_zipinstaller->install(); @@ -488,9 +488,9 @@ void SelectiveInstallWidget::installFonts(void) if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) m_zipinstaller->setCache(true); - connect(m_zipinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool))); + connect(m_zipinstaller, &ZipInstaller::done, this, &SelectiveInstallWidget::continueInstall); connect(m_zipinstaller, SIGNAL(logItem(QString, int)), m_logger, SLOT(addItem(QString, int))); - connect(m_zipinstaller, SIGNAL(logProgress(int, int)), m_logger, SLOT(setProgress(int, int))); + connect(m_zipinstaller, &ZipInstaller::logProgress, m_logger, &ProgressLoggerGui::setProgress); connect(m_logger, SIGNAL(aborted()), m_zipinstaller, SLOT(abort())); m_zipinstaller->install(); } @@ -528,9 +528,9 @@ void SelectiveInstallWidget::installVoicefile(void) if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) m_zipinstaller->setCache(true); - connect(m_zipinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool))); + connect(m_zipinstaller, &ZipInstaller::done, this, &SelectiveInstallWidget::continueInstall); connect(m_zipinstaller, SIGNAL(logItem(QString, int)), m_logger, SLOT(addItem(QString, int))); - connect(m_zipinstaller, SIGNAL(logProgress(int, int)), m_logger, SLOT(setProgress(int, int))); + connect(m_zipinstaller, &ZipInstaller::logProgress, m_logger, &ProgressLoggerGui::setProgress); connect(m_logger, SIGNAL(aborted()), m_zipinstaller, SLOT(abort())); m_zipinstaller->install(); } @@ -574,9 +574,9 @@ void SelectiveInstallWidget::installManual(void) // if type is html extract it. m_zipinstaller->setUnzip(mantype == "html"); - connect(m_zipinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool))); + connect(m_zipinstaller, &ZipInstaller::done, this, &SelectiveInstallWidget::continueInstall); connect(m_zipinstaller, SIGNAL(logItem(QString, int)), m_logger, SLOT(addItem(QString, int))); - connect(m_zipinstaller, SIGNAL(logProgress(int, int)), m_logger, SLOT(setProgress(int, int))); + connect(m_zipinstaller, &ZipInstaller::logProgress, m_logger, &ProgressLoggerGui::setProgress); connect(m_logger, SIGNAL(aborted()), m_zipinstaller, SLOT(abort())); m_zipinstaller->install(); } @@ -669,9 +669,9 @@ void SelectiveInstallWidget::installPluginData(void) m_zipinstaller->setMountPoint(m_mountpoint); if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) m_zipinstaller->setCache(true); - connect(m_zipinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool))); + connect(m_zipinstaller, &ZipInstaller::done, this, &SelectiveInstallWidget::continueInstall); connect(m_zipinstaller, SIGNAL(logItem(QString, int)), m_logger, SLOT(addItem(QString, int))); - connect(m_zipinstaller, SIGNAL(logProgress(int, int)), m_logger, SLOT(setProgress(int, int))); + connect(m_zipinstaller, &ZipInstaller::logProgress, m_logger, &ProgressLoggerGui::setProgress); connect(m_logger, SIGNAL(aborted()), m_zipinstaller, SLOT(abort())); m_zipinstaller->install(); } diff --git a/utils/rbutilqt/installtalkwindow.cpp b/utils/rbutilqt/installtalkwindow.cpp index f735a36e95..bf374decb5 100644 --- a/utils/rbutilqt/installtalkwindow.cpp +++ b/utils/rbutilqt/installtalkwindow.cpp @@ -29,7 +29,7 @@ InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent) ui.setupUi(this); talkcreator = new TalkFileCreator(this); - connect(ui.change,SIGNAL(clicked()),this,SLOT(change())); + connect(ui.change,&QAbstractButton::clicked,this,&InstallTalkWindow::change); ui.recursive->setChecked(true); ui.GenerateOnlyNew->setChecked(true); @@ -81,7 +81,7 @@ void InstallTalkWindow::change() // make sure the current selected folder doesn't get lost on settings // changes. - connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); + connect(cw, &Config::settingsUpdated, this, &InstallTalkWindow::updateSettings); cw->show(); } @@ -100,7 +100,7 @@ void InstallTalkWindow::accept() logger = new ProgressLoggerGui(this); - connect(logger,SIGNAL(closed()),this,SLOT(close())); + connect(logger,&ProgressLoggerGui::closed,this,&QWidget::close); logger->show(); talkcreator->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); @@ -118,7 +118,7 @@ void InstallTalkWindow::accept() connect(talkcreator, SIGNAL(done(bool)), logger, SLOT(setFinished())); connect(talkcreator, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int))); - connect(talkcreator, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int))); + connect(talkcreator, &TalkFileCreator::logProgress, logger, &ProgressLoggerGui::setProgress); connect(logger,SIGNAL(aborted()),talkcreator,SLOT(abort())); for(int i = 0; i < foldersToTalk.size(); i++) { diff --git a/utils/rbutilqt/preview.cpp b/utils/rbutilqt/preview.cpp index 5006a03a09..ba241dfe01 100644 --- a/utils/rbutilqt/preview.cpp +++ b/utils/rbutilqt/preview.cpp @@ -73,7 +73,7 @@ PreviewLabel::PreviewLabel(QWidget * parent, Qt::WindowFlags f) hovertimer.setInterval(1500); // wait for 1.5 seconds before showing the Fullsize Preview hovertimer.setSingleShot(true); - connect(&hovertimer,SIGNAL(timeout ()),this,SLOT(timeout())); + connect(&hovertimer, &QTimer::timeout, this, &PreviewLabel::timeout); } void PreviewLabel::mouseMoveEvent(QMouseEvent * event) diff --git a/utils/rbutilqt/progressloggergui.cpp b/utils/rbutilqt/progressloggergui.cpp index 37e0908ae0..78fc00db8f 100644 --- a/utils/rbutilqt/progressloggergui.cpp +++ b/utils/rbutilqt/progressloggergui.cpp @@ -29,7 +29,7 @@ ProgressLoggerGui::ProgressLoggerGui(QWidget* parent): ProgressloggerInterface(p dp.setupUi(downloadProgress); dp.listProgress->setAlternatingRowColors(true); dp.saveLog->hide(); - connect(dp.saveLog,SIGNAL(clicked()),this,SLOT(saveErrorLog())); + connect(dp.saveLog,&QAbstractButton::clicked,this,&ProgressLoggerGui::saveErrorLog); setRunning(); } @@ -100,9 +100,9 @@ void ProgressLoggerGui::setRunning() dp.buttonAbort->setIcon(QIcon(QString::fromUtf8(":/icons/process-stop.svg"))); // make sure to not close the window on button press. - disconnect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close())); + disconnect(dp.buttonAbort, &QAbstractButton::clicked, downloadProgress, &QWidget::close); // emit aborted() once button is pressed but not closed(). - disconnect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(closed())); + disconnect(dp.buttonAbort, &QAbstractButton::clicked, this, &ProgressLoggerGui::closed); connect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(aborted())); } @@ -118,10 +118,10 @@ void ProgressLoggerGui::setFinished() dp.buttonAbort->setIcon(QIcon(QString::fromUtf8(":/icons/go-next.svg"))); // close the window on button press. - connect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close())); + connect(dp.buttonAbort, &QAbstractButton::clicked, downloadProgress, &QWidget::close); // emit closed() once button is pressed but not aborted(). disconnect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(aborted())); - connect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(closed())); + connect(dp.buttonAbort, &QAbstractButton::clicked, this, &ProgressLoggerGui::closed); } diff --git a/utils/rbutilqt/rbutilqt.cpp b/utils/rbutilqt/rbutilqt.cpp index 91704db4b2..b425ed4d70 100644 --- a/utils/rbutilqt/rbutilqt.cpp +++ b/utils/rbutilqt/rbutilqt.cpp @@ -127,7 +127,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) ui.selective->setLayout(selectivetablayout); selectiveinstallwidget = new SelectiveInstallWidget(this); selectivetablayout->addWidget(selectiveinstallwidget); - connect(ui.buttonChangeDevice, SIGNAL(clicked()), selectiveinstallwidget, SLOT(saveSettings())); + connect(ui.buttonChangeDevice, &QAbstractButton::clicked, selectiveinstallwidget, &SelectiveInstallWidget::saveSettings); // info tab QGridLayout *infotablayout = new QGridLayout(this); @@ -135,28 +135,28 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) info = new InfoWidget(this); infotablayout->addWidget(info); - connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTabs(int))); + connect(ui.tabWidget, &QTabWidget::currentChanged, this, &RbUtilQt::updateTabs); connect(ui.actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); - connect(ui.action_About, SIGNAL(triggered()), this, SLOT(about())); - connect(ui.action_Help, SIGNAL(triggered()), this, SLOT(help())); - connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(configDialog())); - connect(ui.actionE_xit, SIGNAL(triggered()), this, SLOT(shutdown())); - connect(ui.buttonChangeDevice, SIGNAL(clicked()), this, SLOT(configDialog())); - connect(ui.buttonEject, SIGNAL(clicked()), this, SLOT(eject())); - connect(ui.buttonTalk, SIGNAL(clicked()), this, SLOT(createTalkFiles())); - connect(ui.buttonCreateVoice, SIGNAL(clicked()), this, SLOT(createVoiceFile())); - connect(ui.buttonRemoveRockbox, SIGNAL(clicked()), this, SLOT(uninstall())); - connect(ui.buttonRemoveBootloader, SIGNAL(clicked()), this, SLOT(uninstallBootloader())); - connect(ui.buttonBackup, SIGNAL(clicked()), this, SLOT(backup())); + connect(ui.action_About, &QAction::triggered, this, &RbUtilQt::about); + connect(ui.action_Help, &QAction::triggered, this, &RbUtilQt::help); + connect(ui.action_Configure, &QAction::triggered, this, &RbUtilQt::configDialog); + connect(ui.actionE_xit, &QAction::triggered, this, &RbUtilQt::shutdown); + connect(ui.buttonChangeDevice, &QAbstractButton::clicked, this, &RbUtilQt::configDialog); + connect(ui.buttonEject, &QAbstractButton::clicked, this, &RbUtilQt::eject); + connect(ui.buttonTalk, &QAbstractButton::clicked, this, &RbUtilQt::createTalkFiles); + connect(ui.buttonCreateVoice, &QAbstractButton::clicked, this, &RbUtilQt::createVoiceFile); + connect(ui.buttonRemoveRockbox, &QAbstractButton::clicked, this, &RbUtilQt::uninstall); + connect(ui.buttonRemoveBootloader, &QAbstractButton::clicked, this, &RbUtilQt::uninstallBootloader); + connect(ui.buttonBackup, &QAbstractButton::clicked, this, &RbUtilQt::backup); // actions accessible from the menu - connect(ui.actionCreate_Voice_File, SIGNAL(triggered()), this, SLOT(createVoiceFile())); - connect(ui.actionCreate_Talk_Files, SIGNAL(triggered()), this, SLOT(createTalkFiles())); - connect(ui.actionRemove_bootloader, SIGNAL(triggered()), this, SLOT(uninstallBootloader())); - connect(ui.actionUninstall_Rockbox, SIGNAL(triggered()), this, SLOT(uninstall())); - connect(ui.action_System_Info, SIGNAL(triggered()), this, SLOT(sysinfo())); - connect(ui.action_Trace, SIGNAL(triggered()), this, SLOT(trace())); - connect(ui.actionShow_Changelog, SIGNAL(triggered()), this, SLOT(changelog())); + connect(ui.actionCreate_Voice_File, &QAction::triggered, this, &RbUtilQt::createVoiceFile); + connect(ui.actionCreate_Talk_Files, &QAction::triggered, this, &RbUtilQt::createTalkFiles); + connect(ui.actionRemove_bootloader, &QAction::triggered, this, &RbUtilQt::uninstallBootloader); + connect(ui.actionUninstall_Rockbox, &QAction::triggered, this, &RbUtilQt::uninstall); + connect(ui.action_System_Info, &QAction::triggered, this, &RbUtilQt::sysinfo); + connect(ui.action_Trace, &QAction::triggered, this, &RbUtilQt::trace); + connect(ui.actionShow_Changelog, &QAction::triggered, this, &RbUtilQt::changelog); #if !defined(STATIC) ui.actionInstall_Rockbox_Utility_on_player->setEnabled(false); @@ -205,8 +205,8 @@ void RbUtilQt::downloadInfo() { // try to get the current build information daily = new HttpGet(this); - connect(daily, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); - connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); + connect(daily, &HttpGet::done, this, &RbUtilQt::downloadDone); + connect(qApp, &QGuiApplication::lastWindowClosed, daily, &HttpGet::abort); daily->setCache(false); ui.statusbar->showMessage(tr("Downloading build information, please wait ...")); LOG_INFO() << "downloading build info"; @@ -327,7 +327,7 @@ void RbUtilQt::help() void RbUtilQt::configDialog() { Config *cw = new Config(this); - connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); + connect(cw, &Config::settingsUpdated, this, &RbUtilQt::updateSettings); cw->show(); } @@ -429,7 +429,7 @@ void RbUtilQt::createTalkFiles(void) { if(chkConfig(this)) return; InstallTalkWindow *installWindow = new InstallTalkWindow(this); - connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); + connect(installWindow, &InstallTalkWindow::settingsUpdated, this, &RbUtilQt::updateSettings); installWindow->show(); } @@ -439,7 +439,7 @@ void RbUtilQt::createVoiceFile(void) if(chkConfig(this)) return; CreateVoiceWindow *installWindow = new CreateVoiceWindow(this); - connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); + connect(installWindow, &CreateVoiceWindow::settingsUpdated, this, &RbUtilQt::updateSettings); installWindow->show(); } @@ -503,7 +503,7 @@ void RbUtilQt::uninstallBootloader(void) } connect(bl, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int))); - connect(bl, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int))); + connect(bl, &BootloaderInstallBase::logProgress, logger, &ProgressLoggerGui::setProgress); connect(bl, SIGNAL(done(bool)), logger, SLOT(setFinished())); // pass Abort button click signal to current installer connect(logger, SIGNAL(aborted()), bl, SLOT(progressAborted())); @@ -608,8 +608,8 @@ void RbUtilQt::checkUpdate(void) #endif update = new HttpGet(this); - connect(update, SIGNAL(done(bool)), this, SLOT(downloadUpdateDone(bool))); - connect(qApp, SIGNAL(lastWindowClosed()), update, SLOT(abort())); + connect(update, &HttpGet::done, this, &RbUtilQt::downloadUpdateDone); + connect(qApp, &QGuiApplication::lastWindowClosed, update, &HttpGet::abort); ui.statusbar->showMessage(tr("Checking for update ...")); update->getFile(QUrl(url)); diff --git a/utils/rbutilqt/test/test-httpget.cpp b/utils/rbutilqt/test/test-httpget.cpp index 62aace0352..26945e4e15 100644 --- a/utils/rbutilqt/test/test-httpget.cpp +++ b/utils/rbutilqt/test/test-httpget.cpp @@ -51,8 +51,8 @@ // works asynchronously, this means that all the communication is done // in the two slots readClient() and discardClient(). QTcpSocket* s = new QTcpSocket(this); - connect(s, SIGNAL(readyRead()), this, SLOT(readClient())); - connect(s, SIGNAL(disconnected()), this, SLOT(discardClient())); + connect(s, &QIODevice::readyRead, this, &HttpDaemon::readClient); + connect(s, &QAbstractSocket::disconnected, this, &HttpDaemon::discardClient); s->setSocketDescriptor(socket); } QList lastRequestData(void) @@ -183,8 +183,8 @@ void TestHttpGet::init(void) m_port = QString("%1").arg(m_daemon->port()).toLatin1(); m_cachedir = temporaryFolder(); m_getter = new HttpGet(this); - m_doneSpy = new QSignalSpy(m_getter, SIGNAL(done(bool))); - m_progressSpy = new QSignalSpy(m_getter, SIGNAL(dataReadProgress(int, int))); + m_doneSpy = new QSignalSpy(m_getter, &HttpGet::done); + m_progressSpy = new QSignalSpy(m_getter, &HttpGet::dataReadProgress); m_waitTimeoutOccured = false; } @@ -201,7 +201,7 @@ void TestHttpGet::cleanup(void) void TestHttpGet::testFileUrlRequest(void) { - QTimer::singleShot(TEST_HTTP_TIMEOUT, this, SLOT(waitTimeout(void))); + QTimer::singleShot(TEST_HTTP_TIMEOUT, this, &TestHttpGet::waitTimeout); QString teststring = "The quick brown fox jumps over the lazy dog."; QTemporaryFile datafile; @@ -239,7 +239,7 @@ void TestHttpGet::testUncachedRepeatedRequest(void) "\r\n\r\n"); m_daemon->setResponsesToSend(responses); - QTimer::singleShot(TEST_HTTP_TIMEOUT, this, SLOT(waitTimeout(void))); + QTimer::singleShot(TEST_HTTP_TIMEOUT, this, &TestHttpGet::waitTimeout); m_getter->getFile(QUrl("http://localhost:" + m_port + "/test1.txt")); while(m_doneSpy->count() == 0 && m_waitTimeoutOccured == false) @@ -287,7 +287,7 @@ void TestHttpGet::testCachedRequest(void) "\r\n"); m_daemon->setResponsesToSend(responses); - QTimer::singleShot(TEST_HTTP_TIMEOUT, this, SLOT(waitTimeout(void))); + QTimer::singleShot(TEST_HTTP_TIMEOUT, this, &TestHttpGet::waitTimeout); m_getter->setCache(m_cachedir); m_getter->getFile(QUrl("http://localhost:" + m_port + "/test1.txt")); @@ -336,7 +336,7 @@ void TestHttpGet::testUserAgent(void) "\r\n\r\n"); m_daemon->setResponsesToSend(responses); - QTimer::singleShot(TEST_HTTP_TIMEOUT, this, SLOT(waitTimeout(void))); + QTimer::singleShot(TEST_HTTP_TIMEOUT, this, &TestHttpGet::waitTimeout); m_getter->setGlobalUserAgent(TEST_USER_AGENT); m_getter->setCache(m_cachedir); @@ -376,7 +376,7 @@ void TestHttpGet::testUncachedMovedRequest(void) "\r\n\r\n"); m_daemon->setResponsesToSend(responses); - QTimer::singleShot(TEST_HTTP_TIMEOUT, this, SLOT(waitTimeout(void))); + QTimer::singleShot(TEST_HTTP_TIMEOUT, this, &TestHttpGet::waitTimeout); m_getter->getFile(QUrl("http://localhost:" + m_port + "/test1.php?var=1&b=foo")); while(m_doneSpy->count() == 0 && m_waitTimeoutOccured == false) @@ -391,7 +391,7 @@ void TestHttpGet::testUncachedMovedRequest(void) void TestHttpGet::testResponseCode(void) { - QTimer::singleShot(TEST_HTTP_TIMEOUT, this, SLOT(waitTimeout(void))); + QTimer::singleShot(TEST_HTTP_TIMEOUT, this, &TestHttpGet::waitTimeout); m_getter->getFile(QUrl("http://localhost:" + m_port + "/test1.txt")); while(m_doneSpy->count() == 0 && m_waitTimeoutOccured == false) @@ -416,7 +416,7 @@ void TestHttpGet::testContentToBuffer(void) TEST_BINARY_BLOB); m_daemon->setResponsesToSend(responses); - QTimer::singleShot(TEST_HTTP_TIMEOUT, this, SLOT(waitTimeout(void))); + QTimer::singleShot(TEST_HTTP_TIMEOUT, this, &TestHttpGet::waitTimeout); m_getter->getFile(QUrl("http://localhost:" + m_port + "/test1.txt")); while(m_doneSpy->count() == 0 && m_waitTimeoutOccured == false) @@ -443,7 +443,7 @@ void TestHttpGet::testContentToFile(void) TEST_BINARY_BLOB); m_daemon->setResponsesToSend(responses); - QTimer::singleShot(TEST_HTTP_TIMEOUT, this, SLOT(waitTimeout(void))); + QTimer::singleShot(TEST_HTTP_TIMEOUT, this, &TestHttpGet::waitTimeout); m_getter->setFile(&tf); m_getter->getFile(QUrl("http://localhost:" + m_port + "/test1.txt")); @@ -462,7 +462,7 @@ void TestHttpGet::testContentToFile(void) void TestHttpGet::testNoServer(void) { - QTimer::singleShot(TEST_HTTP_TIMEOUT, this, SLOT(waitTimeout(void))); + QTimer::singleShot(TEST_HTTP_TIMEOUT, this, &TestHttpGet::waitTimeout); m_getter->getFile(QUrl("http://localhost:53/test1.txt")); while(m_doneSpy->count() == 0 && m_waitTimeoutOccured == false) QCoreApplication::processEvents(); @@ -494,7 +494,7 @@ void TestHttpGet::testServerTimestamp(void) m_daemon->setResponsesToSend(responses); - QTimer::singleShot(TEST_HTTP_TIMEOUT, this, SLOT(waitTimeout(void))); + QTimer::singleShot(TEST_HTTP_TIMEOUT, this, &TestHttpGet::waitTimeout); int count = m_doneSpy->count(); for(int i = 0; i < responses.size(); ++i) { @@ -523,7 +523,7 @@ void TestHttpGet::testMovedQuery(void) "\r\n\r\n"); m_daemon->setResponsesToSend(responses); - QTimer::singleShot(TEST_HTTP_TIMEOUT, this, SLOT(waitTimeout(void))); + QTimer::singleShot(TEST_HTTP_TIMEOUT, this, &TestHttpGet::waitTimeout); m_getter->getFile(QUrl("http://localhost:" + m_port + "/test1.php?var=1&b=foo")); while(m_doneSpy->count() == 0 && m_waitTimeoutOccured == false) diff --git a/utils/rbutilqt/themesinstallwindow.cpp b/utils/rbutilqt/themesinstallwindow.cpp index c1a54feb74..358bd7f1a1 100644 --- a/utils/rbutilqt/themesinstallwindow.cpp +++ b/utils/rbutilqt/themesinstallwindow.cpp @@ -43,12 +43,12 @@ ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent) ui.listThemes->setLayoutDirection(Qt::LeftToRight); ui.themeDescription->setLayoutDirection(Qt::LeftToRight); - connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(close())); + connect(ui.buttonCancel, &QAbstractButton::clicked, this, &QWidget::close); connect(ui.buttonOk, SIGNAL(clicked()), this, SLOT(accept())); - connect(ui.listThemes, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), - this, SLOT(updateDetails(QListWidgetItem*, QListWidgetItem*))); - connect(ui.listThemes, SIGNAL(itemSelectionChanged()), this, SLOT(updateSize())); - connect(&igetter, SIGNAL(done(bool)), this, SLOT(updateImage(bool))); + connect(ui.listThemes, &QListWidget::currentItemChanged, + this, &ThemesInstallWindow::updateDetails); + connect(ui.listThemes, &QListWidget::itemSelectionChanged, this, &ThemesInstallWindow::updateSize); + connect(&igetter, &HttpGet::done, this, &ThemesInstallWindow::updateImage); if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) igetter.setCache(true); @@ -130,7 +130,7 @@ void ThemesInstallWindow::downloadDone(bool error) getter->abort(); logger->setFinished(); disconnect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); - connect(logger, SIGNAL(closed()), this, SLOT(close())); + connect(logger, &ProgressLoggerGui::closed, this, &QWidget::close); return; } // handle possible error codes @@ -140,7 +140,7 @@ void ThemesInstallWindow::downloadDone(bool error) logger->addItem(tr("the following error occured:\n%1") .arg(iniDetails.value("error/description", "unknown error").toString()), LOGERROR); logger->setFinished(); - connect(logger, SIGNAL(closed()), this, SLOT(close())); + connect(logger, &ProgressLoggerGui::closed, this, &QWidget::close); return; } logger->addItem(tr("done."), LOGOK); @@ -371,11 +371,11 @@ void ThemesInstallWindow::install() installer->setCache(true); if(!windowSelectOnly) { - connect(logger, SIGNAL(closed()), this, SLOT(close())); + connect(logger, &ProgressLoggerGui::closed, this, &QWidget::close); connect(installer, SIGNAL(done(bool)), logger, SLOT(setFinished())); } connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int))); - connect(installer, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int))); + connect(installer, &ZipInstaller::logProgress, logger, &ProgressLoggerGui::setProgress); connect(installer, SIGNAL(done(bool)), this, SIGNAL(done(bool))); connect(logger, SIGNAL(aborted()), installer, SLOT(abort())); installer->install(); diff --git a/utils/rbutilqt/uninstallwindow.cpp b/utils/rbutilqt/uninstallwindow.cpp index 264b73f544..bbce88ffc2 100644 --- a/utils/rbutilqt/uninstallwindow.cpp +++ b/utils/rbutilqt/uninstallwindow.cpp @@ -24,17 +24,17 @@ UninstallWindow::UninstallWindow(QWidget *parent) : QDialog(parent) { ui.setupUi(this); ui.UninstalllistWidget->setAlternatingRowColors(true); - connect(ui.UninstalllistWidget,SIGNAL(itemSelectionChanged()),this,SLOT(selectionChanged())); - connect(ui.CompleteRadioBtn,SIGNAL(toggled(bool)),this,SLOT(UninstallMethodChanged(bool))); + connect(ui.UninstalllistWidget,&QListWidget::itemSelectionChanged,this,&UninstallWindow::selectionChanged); + connect(ui.CompleteRadioBtn,&QAbstractButton::toggled,this,&UninstallWindow::UninstallMethodChanged); QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString(); uninstaller = new Uninstaller(this,mountpoint); logger = new ProgressLoggerGui(this); connect(uninstaller, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int))); - connect(uninstaller, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int))); + connect(uninstaller, &Uninstaller::logProgress, logger, &ProgressLoggerGui::setProgress); connect(uninstaller, SIGNAL(logFinished(void)), logger, SLOT(setFinished(void))); - connect(logger, SIGNAL(closed()), this, SLOT(close())); + connect(logger, &ProgressLoggerGui::closed, this, &QWidget::close); // disable smart uninstall, if not possible if(!uninstaller->uninstallPossible()) -- cgit v1.2.3