mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-03 17:54:06 +00:00
functor-based Qt signal-slot syntax launcher
This commit is contained in:
parent
9040209046
commit
aa57d04b54
@ -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");
|
||||
|
@ -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<int>(&::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<const QString&,const QString&>(&::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<int,QProcess::ExitStatus>(&QProcess::finished), this, &DataFilesPage::navMeshToolFinished);
|
||||
}
|
||||
|
||||
bool Launcher::DataFilesPage::loadSettings()
|
||||
|
@ -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<int>(&QComboBox::currentIndexChanged), this, &GraphicsPage::slotFullScreenChanged);
|
||||
connect(standardRadioButton, &QRadioButton::toggled, this, &GraphicsPage::slotStandardToggled);
|
||||
connect(screenComboBox, qOverload<int>(&QComboBox::currentIndexChanged), this, &GraphicsPage::screenChanged);
|
||||
connect(framerateLimitCheckBox, &QCheckBox::toggled, this, &GraphicsPage::slotFramerateLimitToggled);
|
||||
connect(shadowDistanceCheckBox, &QCheckBox::toggled, this, &GraphicsPage::slotShadowDistLimitToggled);
|
||||
}
|
||||
|
||||
bool Launcher::GraphicsPage::setupSDL()
|
||||
|
@ -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<int,QProcess::ExitStatus>(&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()
|
||||
|
@ -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<int>(&QComboBox::activated), this, &PlayPage::signalProfileChanged);
|
||||
connect(playButton, &QPushButton::clicked, this, &PlayPage::slotPlayClicked);
|
||||
|
||||
}
|
||||
|
||||
|
@ -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<int,QProcess::ExitStatus>(&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<int,QProcess::ExitStatus>(&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;
|
||||
|
@ -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 *)
|
||||
|
@ -6,8 +6,8 @@
|
||||
ProfilesComboBox::ProfilesComboBox(QWidget *parent) :
|
||||
ContentSelectorView::ComboBox(parent)
|
||||
{
|
||||
connect(this, SIGNAL(activated(int)), this,
|
||||
SLOT(slotIndexChangedByUser(int)));
|
||||
connect(this, qOverload<int>(&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)
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user