Commit 0bf78934 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

ProjectExplorer: Complete Qt5-style connects

+ De-slot private and internal public slots

Change-Id: I0a62adb529ab81b7368645dbeab6edf7e237dc69
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 33c3a1fb
......@@ -55,6 +55,34 @@ const char CUSTOM_EXECUTABLE_ID[] = "ProjectExplorer.CustomExecutableRunConfigur
const char EXECUTABLE_KEY[] = "ProjectExplorer.CustomExecutableRunConfiguration.Executable";
const char WORKING_DIRECTORY_KEY[] = "ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory";
// Dialog embedding the CustomExecutableConfigurationWidget
// prompting the user to complete the configuration.
class CustomExecutableDialog : public QDialog
{
Q_OBJECT
public:
explicit CustomExecutableDialog(CustomExecutableRunConfiguration *rc, QWidget *parent = 0);
void accept();
bool event(QEvent *event);
private:
void changed()
{
setOkButtonEnabled(m_widget->isValid());
}
inline void setOkButtonEnabled(bool e)
{
m_dialogButtonBox->button(QDialogButtonBox::Ok)->setEnabled(e);
}
QDialogButtonBox *m_dialogButtonBox;
CustomExecutableConfigurationWidget *m_widget;
};
void CustomExecutableRunConfiguration::ctor()
{
setDefaultDisplayName(defaultDisplayName());
......@@ -89,40 +117,12 @@ CustomExecutableRunConfiguration::~CustomExecutableRunConfiguration()
{
if (m_dialog) {
emit configurationFinished();
disconnect(m_dialog, SIGNAL(finished(int)),
this, SLOT(configurationDialogFinished()));
disconnect(m_dialog, &QDialog::finished,
this, &CustomExecutableRunConfiguration::configurationDialogFinished);
delete m_dialog;
}
}
// Dialog embedding the CustomExecutableConfigurationWidget
// prompting the user to complete the configuration.
class CustomExecutableDialog : public QDialog
{
Q_OBJECT
public:
explicit CustomExecutableDialog(CustomExecutableRunConfiguration *rc, QWidget *parent = 0);
void accept();
bool event(QEvent *event);
private slots:
void changed()
{
setOkButtonEnabled(m_widget->isValid());
}
private:
inline void setOkButtonEnabled(bool e)
{
m_dialogButtonBox->button(QDialogButtonBox::Ok)->setEnabled(e);
}
QDialogButtonBox *m_dialogButtonBox;
CustomExecutableConfigurationWidget *m_widget;
};
CustomExecutableDialog::CustomExecutableDialog(CustomExecutableRunConfiguration *rc, QWidget *parent)
: QDialog(parent)
, m_dialogButtonBox(new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel))
......@@ -134,11 +134,12 @@ CustomExecutableDialog::CustomExecutableDialog(CustomExecutableRunConfiguration
layout->addWidget(label);
m_widget = new CustomExecutableConfigurationWidget(rc, CustomExecutableConfigurationWidget::DelayedApply);
m_widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
connect(m_widget, SIGNAL(validChanged()), this, SLOT(changed()));
connect(m_widget, &CustomExecutableConfigurationWidget::validChanged,
this, &CustomExecutableDialog::changed);
layout->addWidget(m_widget);
setOkButtonEnabled(false);
connect(m_dialogButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(m_dialogButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(m_dialogButtonBox, &QDialogButtonBox::accepted, this, &CustomExecutableDialog::accept);
connect(m_dialogButtonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
layout->addWidget(m_dialogButtonBox);
layout->setSizeConstraint(QLayout::SetMinAndMaxSize);
}
......@@ -174,8 +175,8 @@ RunConfiguration::ConfigurationState CustomExecutableRunConfiguration::ensureCon
}
m_dialog = new CustomExecutableDialog(this, Core::ICore::mainWindow());
connect(m_dialog, SIGNAL(finished(int)),
this, SLOT(configurationDialogFinished()));
connect(m_dialog, &QDialog::finished,
this, &CustomExecutableRunConfiguration::configurationDialogFinished);
m_dialog->setWindowTitle(displayName()); // pretty pointless
m_dialog->show();
return Waiting;
......@@ -183,8 +184,8 @@ RunConfiguration::ConfigurationState CustomExecutableRunConfiguration::ensureCon
void CustomExecutableRunConfiguration::configurationDialogFinished()
{
disconnect(m_dialog, SIGNAL(finished(int)),
this, SLOT(configurationDialogFinished()));
disconnect(m_dialog, &QDialog::finished,
this, &CustomExecutableRunConfiguration::configurationDialogFinished);
m_dialog->deleteLater();
m_dialog = 0;
emit configurationFinished();
......
......@@ -31,6 +31,8 @@
namespace ProjectExplorer {
class CustomExecutableDialog;
namespace Internal { class CustomExecutableConfigurationWidget; }
class CustomExecutableRunConfigurationFactory;
......@@ -71,11 +73,10 @@ protected:
virtual bool fromMap(const QVariantMap &map) override;
QString defaultDisplayName() const;
private slots:
void configurationDialogFinished();
private:
void ctor();
void configurationDialogFinished();
void setExecutable(const QString &executable);
QString rawExecutable() const;
void setCommandLineArguments(const QString &commandLineArguments);
......@@ -87,7 +88,7 @@ private:
QString m_executable;
QString m_workingDirectory;
QWidget *m_dialog;
CustomExecutableDialog *m_dialog;
};
class CustomExecutableRunConfigurationFactory : public IRunConfigurationFactory
......
......@@ -54,7 +54,7 @@ public:
void saveSettings();
private slots:
private:
void handleDeviceUpdated(Core::Id id);
void currentDeviceChanged(int index);
void addDevice();
......@@ -64,7 +64,6 @@ private slots:
void testDevice();
void handleProcessListRequested();
private:
void initGui();
void handleAdditionalActionRequest(Core::Id actionId);
void displayCurrent();
......
......@@ -55,7 +55,6 @@ public:
bool autoSynchronization() const;
bool hiddenFilesFilter() const;
public slots:
void setAutoSynchronization(bool sync);
void toggleAutoSynchronization();
......
......@@ -47,7 +47,6 @@ public:
bool validatePage() override;
void cleanupPage() override;
public slots:
void triggerCommit(const JsonWizard::GeneratorFiles &files);
void addToProject(const JsonWizard::GeneratorFiles &files);
void summarySettingsHaveChanged();
......
......@@ -74,14 +74,12 @@ public:
bool projectFilterEnabled();
bool generatedFilesFilterEnabled();
void setProjectFilterEnabled(bool filter);
void setGeneratedFilesFilterEnabled(bool filter);
signals:
void renamed(const Utils::FileName &oldName, const Utils::FileName &newName);
public slots:
void setProjectFilterEnabled(bool filter);
void setGeneratedFilesFilterEnabled(bool filter);
private:
void aboutToShowInSimpleTreeChanged(ProjectExplorer::FolderNode *node);
void showInSimpleTreeChanged(ProjectExplorer::FolderNode *node);
......
......@@ -73,14 +73,13 @@ public:
Core::IWizardFactory::WizardKind kind,
ProjectAction action);
void initializeVersionControls();
void setProjectUiVisible(bool visible);
signals:
void projectNodeChanged();
void versionControlChanged(int);
public slots:
void initializeVersionControls();
void setProjectUiVisible(bool visible);
private:
void projectChanged(int);
void manageVcs();
......
......@@ -88,7 +88,6 @@ public:
// TaskView uses this method if the size of the taskview changes
void emitSizeHintChanged(const QModelIndex &index);
public slots:
void currentChanged(const QModelIndex &current, const QModelIndex &previous);
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment