Skip to content

Commit

Permalink
Some work on replacing automatic signals on_XXX_YYY() with a proper c…
Browse files Browse the repository at this point in the history
…onnection (#1592).
  • Loading branch information
agarny committed Apr 4, 2018
1 parent 1f17877 commit 3b94f42
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 25 deletions.
25 changes: 20 additions & 5 deletions src/checkforupdatesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,21 @@ CheckForUpdatesDialog::CheckForUpdatesDialog(QSettings *pSettings,

mGui->setupUi(this);

connect(mGui->buttonBox, &QDialogButtonBox::accepted,
this, &CheckForUpdatesDialog::onButtonBoxAccepted);

connect(mGui->statusLabel, &QLabel::linkActivated,
this, &CheckForUpdatesDialog::onStatusLabelLinkActivated);

connect(mGui->recheckButton, &QPushButton::clicked,
this, &CheckForUpdatesDialog::onRecheckButtonClicked);

connect(mGui->checkForUpdatesAtStartupCheckBox, &QCheckBox::toggled,
this, &CheckForUpdatesDialog::onCheckForUpdatesAtStartupCheckBoxToggled);

connect(mGui->includeSnapshotsCheckBox, &QCheckBox::toggled,
this, &CheckForUpdatesDialog::onIncludeSnapshotsCheckBoxToggled);

// Create/set our engine and check for updates in the former case

if (pEngine) {
Expand Down Expand Up @@ -293,7 +308,7 @@ void CheckForUpdatesDialog::updateGui()

//==============================================================================

void CheckForUpdatesDialog::on_buttonBox_accepted()
void CheckForUpdatesDialog::onButtonBoxAccepted()
{
// Simply close ourselves

Expand All @@ -302,7 +317,7 @@ void CheckForUpdatesDialog::on_buttonBox_accepted()

//==============================================================================

void CheckForUpdatesDialog::on_statusLabel_linkActivated(const QString &pLink)
void CheckForUpdatesDialog::onStatusLabelLinkActivated(const QString &pLink)
{
// Open the link in the user's browser

Expand All @@ -311,7 +326,7 @@ void CheckForUpdatesDialog::on_statusLabel_linkActivated(const QString &pLink)

//==============================================================================

void CheckForUpdatesDialog::on_recheckButton_clicked()
void CheckForUpdatesDialog::onRecheckButtonClicked()
{
// Recheck for updates and then update our GUI accordingly

Expand All @@ -322,7 +337,7 @@ void CheckForUpdatesDialog::on_recheckButton_clicked()

//==============================================================================

void CheckForUpdatesDialog::on_checkForUpdatesAtStartupCheckBox_toggled(bool pChecked)
void CheckForUpdatesDialog::onCheckForUpdatesAtStartupCheckBoxToggled(bool pChecked)
{
Q_UNUSED(pChecked);

Expand All @@ -334,7 +349,7 @@ void CheckForUpdatesDialog::on_checkForUpdatesAtStartupCheckBox_toggled(bool pCh

//==============================================================================

void CheckForUpdatesDialog::on_includeSnapshotsCheckBox_toggled(bool pChecked)
void CheckForUpdatesDialog::onIncludeSnapshotsCheckBoxToggled(bool pChecked)
{
Q_UNUSED(pChecked);

Expand Down
10 changes: 5 additions & 5 deletions src/checkforupdatesdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ class CheckForUpdatesDialog : public Dialog
void updateGui();

private slots:
void on_buttonBox_accepted();
void on_statusLabel_linkActivated(const QString &pLink);
void on_recheckButton_clicked();
void on_checkForUpdatesAtStartupCheckBox_toggled(bool pChecked);
void on_includeSnapshotsCheckBox_toggled(bool pChecked);
void onButtonBoxAccepted();
void onStatusLabelLinkActivated(const QString &pLink);
void onRecheckButtonClicked();
void onCheckForUpdatesAtStartupCheckBoxToggled(bool pChecked);
void onIncludeSnapshotsCheckBoxToggled(bool pChecked);
};

//==============================================================================
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/dataStore/DataStore/src/datastoredialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ DataStoreDialog::DataStoreDialog(DataStore *pDataStore, bool pIncludeVoi,

mGui->dataLabel->hide();

connect(mGui->allDataCheckBox, &QCheckBox::clicked,
this, &DataStoreDialog::onAllDataCheckBoxClicked);
connect(mGui->allDataCheckBox, &QCheckBox::toggled,
mGui->buttonBox->button(QDialogButtonBox::Ok), &QPushButton::setEnabled);

Expand Down Expand Up @@ -336,7 +338,7 @@ void DataStoreDialog::updateDataSelectedState(QStandardItem *pItem)

//==============================================================================

void DataStoreDialog::on_allDataCheckBox_clicked()
void DataStoreDialog::onAllDataCheckBoxClicked()
{
// If our checked state is partially checked, then we want to make it fully
// so
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/dataStore/DataStore/src/datastoredialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class DATASTORE_EXPORT DataStoreDialog : public Core::Dialog
private slots:
void updateDataSelectedState(QStandardItem *pItem);

void on_allDataCheckBox_clicked();
void onAllDataCheckBoxClicked();
};

//==============================================================================
Expand Down
19 changes: 14 additions & 5 deletions src/pluginsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ PluginsDialog::PluginsDialog(QSettings *pSettings,

mGui->setupUi(this);

connect(mGui->treeView, &QTreeView::collapsed,
this, &PluginsDialog::onTreeViewCollapsed);

connect(mGui->selectablePluginsCheckBox, &QCheckBox::toggled,
this, &PluginsDialog::onSelectablePluginsCheckBoxToggled);

connect(mGui->buttonBox, &QDialogButtonBox::accepted,
this, &PluginsDialog::onButtonBoxAccepted);

connect(mGui->buttonBox, &QDialogButtonBox::rejected,
this, &PluginsDialog::reject);

Expand Down Expand Up @@ -243,7 +252,7 @@ PluginsDialog::PluginsDialog(QSettings *pSettings,

// Show/hide our unselectable plugins

on_selectablePluginsCheckBox_toggled(mGui->selectablePluginsCheckBox->isChecked());
onSelectablePluginsCheckBoxToggled(mGui->selectablePluginsCheckBox->isChecked());
}

//==============================================================================
Expand Down Expand Up @@ -549,7 +558,7 @@ void PluginsDialog::openLink(const QString &pLink) const

//==============================================================================

void PluginsDialog::on_buttonBox_accepted()
void PluginsDialog::onButtonBoxAccepted()
{
// Keep track of the loading state of the various selectable plugins

Expand All @@ -571,7 +580,7 @@ void PluginsDialog::apply()
tr("<strong>%1</strong> must be restarted for your changes to take effect. Do you want to proceed?").arg(qAppName())) == QMessageBox::Yes ) {
// Do what is done when clicking on the OK button

on_buttonBox_accepted();
onButtonBoxAccepted();

// Let people know that we are done and that we want the settings to be
// applied
Expand Down Expand Up @@ -627,7 +636,7 @@ QStandardItem * PluginsDialog::pluginCategoryItem(const PluginInfo::Category &pC

//==============================================================================

void PluginsDialog::on_treeView_collapsed(const QModelIndex &pIndex)
void PluginsDialog::onTreeViewCollapsed(const QModelIndex &pIndex)
{
// We don't want plugin categories to be collapse, so cancel all collapsings

Expand All @@ -636,7 +645,7 @@ void PluginsDialog::on_treeView_collapsed(const QModelIndex &pIndex)

//==============================================================================

void PluginsDialog::on_selectablePluginsCheckBox_toggled(bool pChecked)
void PluginsDialog::onSelectablePluginsCheckBoxToggled(bool pChecked)
{
// Keep track of whether to show selectable plugins

Expand Down
6 changes: 3 additions & 3 deletions src/pluginsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ class PluginsDialog : public Dialog
void updatePluginsSelectedState(QStandardItem *pItem, bool pInitializing);

private slots:
void on_treeView_collapsed(const QModelIndex &pIndex);
void onTreeViewCollapsed(const QModelIndex &pIndex);

void on_selectablePluginsCheckBox_toggled(bool pChecked);
void onSelectablePluginsCheckBoxToggled(bool pChecked);

void on_buttonBox_accepted();
void onButtonBoxAccepted();

void updateInformation(const QModelIndex &pNewIndex,
const QModelIndex &pOldIndex);
Expand Down
13 changes: 10 additions & 3 deletions src/preferencesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ PreferencesDialog::PreferencesDialog(QSettings *pSettings,

mGui->setupUi(this);

connect(mGui->treeView, &QTreeView::collapsed,
this, &PreferencesDialog::onTreeViewCollapsed);

connect(mGui->buttonBox, &QDialogButtonBox::accepted,
this, &PreferencesDialog::onButtonBoxAccepted);

connect(mGui->buttonBox, &QDialogButtonBox::rejected,
this, &PreferencesDialog::reject);

Expand Down Expand Up @@ -310,16 +316,17 @@ QStandardItem * PreferencesDialog::pluginCategoryItem(const PluginInfo::Category

//==============================================================================

void PreferencesDialog::on_treeView_collapsed(const QModelIndex &pIndex)
void PreferencesDialog::onTreeViewCollapsed(const QModelIndex &pIndex)
{
// We don't want plugin categories to be collapse, so cancel all collapsings
// We don't want plugin categories to be collapsed, so cancel all
// collapsings

mGui->treeView->expand(pIndex);
}

//==============================================================================

void PreferencesDialog::on_buttonBox_accepted()
void PreferencesDialog::onButtonBoxAccepted()
{
// Save all of our plugins' preferences, if they have changed, and keep
// track of their name
Expand Down
4 changes: 2 additions & 2 deletions src/preferencesdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ class PreferencesDialog : public Dialog
QStandardItem * pluginCategoryItem(const PluginInfo::Category &pCategory);

private slots:
void on_treeView_collapsed(const QModelIndex &pIndex);
void onTreeViewCollapsed(const QModelIndex &pIndex);

void on_buttonBox_accepted();
void onButtonBoxAccepted();

void updatePreferencesWidget(const QModelIndex &pNewIndex,
const QModelIndex &pOldIndex);
Expand Down

0 comments on commit 3b94f42

Please sign in to comment.