diff --git a/apps/launcher/advancedpage.cpp b/apps/launcher/advancedpage.cpp index 51695654ba..fa29b848b7 100644 --- a/apps/launcher/advancedpage.cpp +++ b/apps/launcher/advancedpage.cpp @@ -128,7 +128,7 @@ bool Launcher::AdvancedPage::loadSettings() antialiasAlphaTestCheckBox->setCheckState(Qt::Unchecked); } loadSettingBool(magicItemAnimationsCheckBox, "use magic item animations", "Game"); - connect(animSourcesCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotAnimSourcesToggled(bool))); + connect(animSourcesCheckBox, &QCheckBox::toggled, this, &AdvancedPage::slotAnimSourcesToggled); loadSettingBool(animSourcesCheckBox, "use additional anim sources", "Game"); if (animSourcesCheckBox->checkState() != Qt::Unchecked) { @@ -150,12 +150,12 @@ bool Launcher::AdvancedPage::loadSettings() loadSettingBool(nightDaySwitchesCheckBox, "day night switches", "Game"); - connect(postprocessEnabledCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotPostProcessToggled(bool))); + connect(postprocessEnabledCheckBox, &QCheckBox::toggled, this, &AdvancedPage::slotPostProcessToggled); loadSettingBool(postprocessEnabledCheckBox, "enabled", "Post Processing"); loadSettingBool(postprocessTransparentPostpassCheckBox, "transparent postpass", "Post Processing"); postprocessHDRTimeComboBox->setValue(Settings::Manager::getDouble("auto exposure speed", "Post Processing")); - connect(skyBlendingCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotSkyBlendingToggled(bool))); + connect(skyBlendingCheckBox, &QCheckBox::toggled, this, &AdvancedPage::slotSkyBlendingToggled); loadSettingBool(radialFogCheckBox, "radial fog", "Fog"); loadSettingBool(exponentialFogCheckBox, "exponential fog", "Fog"); loadSettingBool(skyBlendingCheckBox, "sky blending", "Fog"); @@ -320,7 +320,7 @@ void Launcher::AdvancedPage::saveSettings() saveSettingBool(skyBlendingCheckBox, "sky blending", "Fog"); Settings::Manager::setDouble("sky blending start", "Fog", skyBlendingStartComboBox->value()); } - + // Audio { int audioDeviceIndex = audioDeviceSelectorComboBox->currentIndex(); diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index e1b34a8034..2d52b6a066 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -132,10 +132,10 @@ Launcher::DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, Config: mNewProfileDialog = new TextInputDialog(tr("New Content List"), tr("Content List name:"), this); mCloneProfileDialog = new TextInputDialog(tr("Clone Content List"), tr("Content List name:"), this); - connect(mNewProfileDialog->lineEdit(), SIGNAL(textChanged(QString)), - this, SLOT(updateNewProfileOkButton(QString))); - connect(mCloneProfileDialog->lineEdit(), SIGNAL(textChanged(QString)), - this, SLOT(updateCloneProfileOkButton(QString))); + connect(mNewProfileDialog->lineEdit(), &LineEdit::textChanged, + this, &DataFilesPage::updateNewProfileOkButton); + connect(mCloneProfileDialog->lineEdit(), &LineEdit::textChanged, + this, &DataFilesPage::updateCloneProfileOkButton); connect(ui.directoryAddSubdirsButton, &QPushButton::released, this, [this]() { this->addSubdirectories(true); }); connect(ui.directoryInsertButton, &QPushButton::released, this, [this]() { this->addSubdirectories(false); }); connect(ui.directoryUpButton, &QPushButton::released, this, [this]() { this->moveDirectory(-1); }); @@ -150,8 +150,8 @@ Launcher::DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, Config: // Connect signal and slot after the settings have been loaded. We only care about the user changing // the addons and don't want to get signals of the system doing it during startup. - connect(mSelector, SIGNAL(signalAddonDataChanged(QModelIndex,QModelIndex)), - this, SLOT(slotAddonDataChanged())); + connect(mSelector, &ContentSelectorView::ContentSelector::signalAddonDataChanged, + this, &DataFilesPage::slotAddonDataChanged); // Call manually to indicate all changes to addon data during startup. slotAddonDataChanged(); } @@ -177,23 +177,24 @@ void Launcher::DataFilesPage::buildView() refreshButton->setDefaultAction(ui.refreshDataFilesAction); //establish connections - connect (ui.profilesComboBox, SIGNAL (currentIndexChanged(int)), - this, SLOT (slotProfileChanged(int))); + connect (ui.profilesComboBox, qOverload(&::ProfilesComboBox::currentIndexChanged), + this, &DataFilesPage::slotProfileChanged); - connect (ui.profilesComboBox, SIGNAL (profileRenamed(QString, QString)), - this, SLOT (slotProfileRenamed(QString, QString))); + connect (ui.profilesComboBox, &::ProfilesComboBox::profileRenamed, + this, &DataFilesPage::slotProfileRenamed); - connect (ui.profilesComboBox, SIGNAL (signalProfileChanged(QString, QString)), - this, SLOT (slotProfileChangedByUser(QString, QString))); + connect (ui.profilesComboBox, qOverload(&::ProfilesComboBox::signalProfileChanged), + this, &DataFilesPage::slotProfileChangedByUser); - connect(ui.refreshDataFilesAction, SIGNAL(triggered()),this, SLOT(slotRefreshButtonClicked())); + connect(ui.refreshDataFilesAction, &QAction::triggered, + this, &DataFilesPage::slotRefreshButtonClicked); - connect(ui.updateNavMeshButton, SIGNAL(clicked()), this, SLOT(startNavMeshTool())); - connect(ui.cancelNavMeshButton, SIGNAL(clicked()), this, SLOT(killNavMeshTool())); + connect(ui.updateNavMeshButton, &QPushButton::clicked, this, &DataFilesPage::startNavMeshTool); + connect(ui.cancelNavMeshButton, &QPushButton::clicked, this, &DataFilesPage::killNavMeshTool); - connect(mNavMeshToolInvoker->getProcess(), SIGNAL(readyReadStandardOutput()), this, SLOT(readNavMeshToolStdout())); - connect(mNavMeshToolInvoker->getProcess(), SIGNAL(readyReadStandardError()), this, SLOT(readNavMeshToolStderr())); - connect(mNavMeshToolInvoker->getProcess(), SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(navMeshToolFinished(int, QProcess::ExitStatus))); + connect(mNavMeshToolInvoker->getProcess(), &QProcess::readyReadStandardOutput, this, &DataFilesPage::readNavMeshToolStdout); + connect(mNavMeshToolInvoker->getProcess(), &QProcess::readyReadStandardError, this, &DataFilesPage::readNavMeshToolStderr); + connect(mNavMeshToolInvoker->getProcess(), qOverload(&QProcess::finished), this, &DataFilesPage::navMeshToolFinished); } bool Launcher::DataFilesPage::loadSettings() diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index bd418c3cc9..363f0ec03b 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -42,11 +42,11 @@ Launcher::GraphicsPage::GraphicsPage(QWidget *parent) customWidthSpinBox->setMaximum(res.width()); customHeightSpinBox->setMaximum(res.height()); - connect(windowModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotFullScreenChanged(int))); - connect(standardRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotStandardToggled(bool))); - connect(screenComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(screenChanged(int))); - connect(framerateLimitCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotFramerateLimitToggled(bool))); - connect(shadowDistanceCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotShadowDistLimitToggled(bool))); + connect(windowModeComboBox, qOverload(&QComboBox::currentIndexChanged), this, &GraphicsPage::slotFullScreenChanged); + connect(standardRadioButton, &QRadioButton::toggled, this, &GraphicsPage::slotStandardToggled); + connect(screenComboBox, qOverload(&QComboBox::currentIndexChanged), this, &GraphicsPage::screenChanged); + connect(framerateLimitCheckBox, &QCheckBox::toggled, this, &GraphicsPage::slotFramerateLimitToggled); + connect(shadowDistanceCheckBox, &QCheckBox::toggled, this, &GraphicsPage::slotShadowDistLimitToggled); } bool Launcher::GraphicsPage::setupSDL() diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 69259f8b27..8e5af37121 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -38,11 +38,11 @@ Launcher::MainDialog::MainDialog(QWidget *parent) mGameInvoker = new ProcessInvoker(); mWizardInvoker = new ProcessInvoker(); - connect(mWizardInvoker->getProcess(), SIGNAL(started()), - this, SLOT(wizardStarted())); + connect(mWizardInvoker->getProcess(), &QProcess::started, + this, &MainDialog::wizardStarted); - connect(mWizardInvoker->getProcess(), SIGNAL(finished(int,QProcess::ExitStatus)), - this, SLOT(wizardFinished(int,QProcess::ExitStatus))); + connect(mWizardInvoker->getProcess(), qOverload(&QProcess::finished), + this, &MainDialog::wizardFinished); iconWidget->setViewMode(QListView::IconMode); iconWidget->setWrapping(false); @@ -60,9 +60,9 @@ Launcher::MainDialog::MainDialog(QWidget *parent) buttonBox->addButton(helpButton, QDialogButtonBox::HelpRole); buttonBox->addButton(playButton, QDialogButtonBox::AcceptRole); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(close())); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(play())); - connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(help())); + connect(buttonBox, &QDialogButtonBox::rejected, this, &MainDialog::close); + connect(buttonBox, &QDialogButtonBox::accepted, this, &MainDialog::play); + connect(buttonBox, &QDialogButtonBox::helpRequested, this, &MainDialog::help); // Remove what's this? button setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); @@ -111,9 +111,7 @@ void Launcher::MainDialog::createIcons() advancedButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom); advancedButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - connect(iconWidget, - SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), - this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*))); + connect(iconWidget, &QListWidget::currentItemChanged, this, &MainDialog::changePage); } @@ -143,12 +141,12 @@ void Launcher::MainDialog::createPages() // Select the first page iconWidget->setCurrentItem(iconWidget->item(0), QItemSelectionModel::Select); - connect(mPlayPage, SIGNAL(playButtonClicked()), this, SLOT(play())); + connect(mPlayPage, &PlayPage::playButtonClicked, this, &MainDialog::play); - connect(mPlayPage, SIGNAL(signalProfileChanged(int)), mDataFilesPage, SLOT(slotProfileChanged(int))); - connect(mDataFilesPage, SIGNAL(signalProfileChanged(int)), mPlayPage, SLOT(setProfilesIndex(int))); + connect(mPlayPage, &PlayPage::signalProfileChanged, mDataFilesPage, &DataFilesPage::slotProfileChanged); + connect(mDataFilesPage, &DataFilesPage::signalProfileChanged, mPlayPage, &PlayPage::setProfilesIndex); // Using Qt::QueuedConnection because signal is emitted in a subthread and slot is in the main thread - connect(mDataFilesPage, SIGNAL(signalLoadedCellsChanged(QStringList)), mAdvancedPage, SLOT(slotLoadedCellsChanged(QStringList)), Qt::QueuedConnection); + connect(mDataFilesPage, &DataFilesPage::signalLoadedCellsChanged, mAdvancedPage, &AdvancedPage::slotLoadedCellsChanged, Qt::QueuedConnection); } Launcher::FirstRunDialogResult Launcher::MainDialog::showFirstRunDialog() diff --git a/apps/launcher/playpage.cpp b/apps/launcher/playpage.cpp index 99b74fdd39..9ecfaa8fce 100644 --- a/apps/launcher/playpage.cpp +++ b/apps/launcher/playpage.cpp @@ -9,8 +9,8 @@ Launcher::PlayPage::PlayPage(QWidget *parent) : QWidget(parent) profilesComboBox->setView(new QListView()); - connect(profilesComboBox, SIGNAL(activated(int)), this, SIGNAL (signalProfileChanged(int))); - connect(playButton, SIGNAL(clicked()), this, SLOT(slotPlayClicked())); + connect(profilesComboBox, qOverload(&QComboBox::activated), this, &PlayPage::signalProfileChanged); + connect(playButton, &QPushButton::clicked, this, &PlayPage::slotPlayClicked); } diff --git a/apps/launcher/settingspage.cpp b/apps/launcher/settingspage.cpp index 3157583eb8..96f11808f0 100644 --- a/apps/launcher/settingspage.cpp +++ b/apps/launcher/settingspage.cpp @@ -36,22 +36,22 @@ Launcher::SettingsPage::SettingsPage(Files::ConfigurationManager &cfg, mImporterInvoker = new ProcessInvoker(); resetProgressBar(); - connect(mWizardInvoker->getProcess(), SIGNAL(started()), - this, SLOT(wizardStarted())); + connect(mWizardInvoker->getProcess(), &QProcess::started, + this, &SettingsPage::wizardStarted); - connect(mWizardInvoker->getProcess(), SIGNAL(finished(int,QProcess::ExitStatus)), - this, SLOT(wizardFinished(int,QProcess::ExitStatus))); + connect(mWizardInvoker->getProcess(), qOverload(&QProcess::finished), + this, &SettingsPage::wizardFinished); - connect(mImporterInvoker->getProcess(), SIGNAL(started()), - this, SLOT(importerStarted())); + connect(mImporterInvoker->getProcess(), &QProcess::started, + this, &SettingsPage::importerStarted); - connect(mImporterInvoker->getProcess(), SIGNAL(finished(int,QProcess::ExitStatus)), - this, SLOT(importerFinished(int,QProcess::ExitStatus))); + connect(mImporterInvoker->getProcess(), qOverload(&QProcess::finished), + this, &SettingsPage::importerFinished); mProfileDialog = new TextInputDialog(tr("New Content List"), tr("Content List name:"), this); - connect(mProfileDialog->lineEdit(), SIGNAL(textChanged(QString)), - this, SLOT(updateOkButton(QString))); + connect(mProfileDialog->lineEdit(), &LineEdit::textChanged, + this, &SettingsPage::updateOkButton); // Detect Morrowind configuration files QStringList iniPaths; diff --git a/apps/launcher/utils/lineedit.cpp b/apps/launcher/utils/lineedit.cpp index 3487075808..7942621f0f 100644 --- a/apps/launcher/utils/lineedit.cpp +++ b/apps/launcher/utils/lineedit.cpp @@ -15,8 +15,8 @@ void LineEdit::setupClearButton() mClearButton->setCursor(Qt::ArrowCursor); mClearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }"); mClearButton->hide(); - connect(mClearButton, SIGNAL(clicked()), this, SLOT(clear())); - connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateClearButton(const QString&))); + connect(mClearButton, &QToolButton::clicked, this, &LineEdit::clear); + connect(this, &LineEdit::textChanged, this, &LineEdit::updateClearButton); } void LineEdit::resizeEvent(QResizeEvent *) diff --git a/apps/launcher/utils/profilescombobox.cpp b/apps/launcher/utils/profilescombobox.cpp index dc0a806c9f..9bd5928803 100644 --- a/apps/launcher/utils/profilescombobox.cpp +++ b/apps/launcher/utils/profilescombobox.cpp @@ -6,8 +6,8 @@ ProfilesComboBox::ProfilesComboBox(QWidget *parent) : ContentSelectorView::ComboBox(parent) { - connect(this, SIGNAL(activated(int)), this, - SLOT(slotIndexChangedByUser(int))); + connect(this, qOverload(&ProfilesComboBox::activated), + this, &ProfilesComboBox::slotIndexChangedByUser); setInsertPolicy(QComboBox::NoInsert); } @@ -18,8 +18,8 @@ void ProfilesComboBox::setEditEnabled(bool editable) return; if (!editable) { - disconnect(lineEdit(), SIGNAL(editingFinished()), this, SLOT(slotEditingFinished())); - disconnect(lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged(QString))); + disconnect(lineEdit(), &QLineEdit::editingFinished, this, &ProfilesComboBox::slotEditingFinished); + disconnect(lineEdit(), &QLineEdit::textChanged, this, &ProfilesComboBox::slotTextChanged); return setEditable(false); } @@ -32,14 +32,11 @@ void ProfilesComboBox::setEditEnabled(bool editable) setLineEdit(edit); setCompleter(nullptr); - connect(lineEdit(), SIGNAL(editingFinished()), this, - SLOT(slotEditingFinished())); + connect(lineEdit(), &QLineEdit::editingFinished, this, &ProfilesComboBox::slotEditingFinished); - connect(lineEdit(), SIGNAL(textChanged(QString)), this, - SLOT(slotTextChanged(QString))); + connect(lineEdit(), &QLineEdit::textChanged, this, &ProfilesComboBox::slotTextChanged); - connect (lineEdit(), SIGNAL(textChanged(QString)), this, - SIGNAL (signalProfileTextChanged (QString))); + connect(lineEdit(), &QLineEdit::textChanged, this, &ProfilesComboBox::signalProfileTextChanged); } void ProfilesComboBox::slotTextChanged(const QString &text) diff --git a/apps/launcher/utils/textinputdialog.cpp b/apps/launcher/utils/textinputdialog.cpp index 5bbcf4c198..cffb734350 100644 --- a/apps/launcher/utils/textinputdialog.cpp +++ b/apps/launcher/utils/textinputdialog.cpp @@ -39,8 +39,8 @@ Launcher::TextInputDialog::TextInputDialog(const QString& title, const QString & setModal(true); - connect(mButtonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(mButtonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(mButtonBox, &QDialogButtonBox::accepted, this, &TextInputDialog::accept); + connect(mButtonBox, &QDialogButtonBox::rejected, this, &TextInputDialog::reject); } Launcher::TextInputDialog::~TextInputDialog()