Commit c64f85cd authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

QtSupport: Use Qt5-style connects

The heavy lifting was done by clazy.

Change-Id: I24cb0cd088b74364320cdd34282d7b15305a93bf
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 9a637ba3
......@@ -33,7 +33,7 @@ using namespace Core;
static MessageManager *m_instance = 0;
Internal::MessageOutputWindow *m_messageOutputWindow = 0;
QObject *MessageManager::instance()
MessageManager *MessageManager::instance()
{
return m_instance;
}
......@@ -66,11 +66,6 @@ void MessageManager::showOutputPane()
m_messageOutputWindow->popup(IOutputPane::ModeSwitch);
}
void MessageManager::write(const QString &text)
{
write(text, NoModeSwitch);
}
void MessageManager::write(const QString &text, PrintToOutputPaneFlags flags)
{
if (!m_messageOutputWindow)
......
......@@ -40,7 +40,7 @@ class CORE_EXPORT MessageManager : public QObject
Q_OBJECT
public:
static QObject *instance();
static MessageManager *instance();
static void showOutputPane();
......@@ -55,10 +55,9 @@ public:
Q_DECLARE_FLAGS(PrintToOutputPaneFlags, PrintToOutputPaneFlag)
static void write(const QString &text); // imply NoModeSwitch
public slots:
static void write(const QString &text, Core::MessageManager::PrintToOutputPaneFlags flags);
static void write(const QString &text,
Core::MessageManager::PrintToOutputPaneFlags flags = NoModeSwitch);
private:
MessageManager();
......
......@@ -42,8 +42,8 @@ CodeGenSettingsPageWidget::CodeGenSettingsPageWidget(QWidget *parent) :
QWidget(parent)
{
m_ui.setupUi(this);
connect(m_ui.includeQtModuleCheckBox, SIGNAL(toggled(bool)),
m_ui.addQtVersionCheckBox, SLOT(setEnabled(bool)));
connect(m_ui.includeQtModuleCheckBox, &QAbstractButton::toggled,
m_ui.addQtVersionCheckBox, &QWidget::setEnabled);
}
CodeGenSettings CodeGenSettingsPageWidget::parameters() const
......
......@@ -734,14 +734,16 @@ ExamplesListModelFilter::ExamplesListModelFilter(ExamplesListModel *sourceModel,
m_exampleDataRequested(false)
{
// initialization hooks
connect(QtVersionManager::instance(), SIGNAL(qtVersionsLoaded()),
this, SLOT(qtVersionManagerLoaded()));
connect(Core::HelpManager::instance(), SIGNAL(setupFinished()),
this, SLOT(helpManagerInitialized()));
connect(QtVersionManager::instance(), &QtVersionManager::qtVersionsLoaded,
this, &ExamplesListModelFilter::qtVersionManagerLoaded);
connect(Core::HelpManager::instance(), &Core::HelpManager::setupFinished,
this, &ExamplesListModelFilter::helpManagerInitialized);
connect(this, SIGNAL(showTutorialsOnlyChanged()), SLOT(updateFilter()));
connect(this, &ExamplesListModelFilter::showTutorialsOnlyChanged,
this, &ExamplesListModelFilter::updateFilter);
connect(m_sourceModel, SIGNAL(selectedExampleSetChanged()), this, SIGNAL(exampleSetIndexChanged()));
connect(m_sourceModel, &ExamplesListModel::selectedExampleSetChanged,
this, &ExamplesListModelFilter::exampleSetIndexChanged);
setSourceModel(m_sourceModel);
}
......@@ -868,10 +870,10 @@ void ExamplesListModelFilter::tryToInitialize()
if (!m_initalized
&& m_qtVersionManagerInitialized && m_helpManagerInitialized && m_exampleDataRequested) {
m_initalized = true;
connect(QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
this, SLOT(handleQtVersionsChanged()));
connect(ProjectExplorer::KitManager::instance(), SIGNAL(defaultkitChanged()),
this, SLOT(handleQtVersionsChanged()));
connect(QtVersionManager::instance(), &QtVersionManager::qtVersionsChanged,
this, &ExamplesListModelFilter::handleQtVersionsChanged);
connect(ProjectExplorer::KitManager::instance(), &ProjectExplorer::KitManager::defaultkitChanged,
this, &ExamplesListModelFilter::handleQtVersionsChanged);
handleQtVersionsChanged();
}
}
......
......@@ -210,11 +210,10 @@ signals:
void searchStrings(const QStringList &arg);
void exampleSetIndexChanged();
private slots:
private:
void qtVersionManagerLoaded();
void helpManagerInitialized();
private:
void exampleDataRequested() const;
void tryToInitialize();
void timerEvent(QTimerEvent *event);
......
......@@ -64,17 +64,6 @@ using namespace Utils;
namespace QtSupport {
namespace Internal {
class ExampleDialog : public QDialog
{
Q_OBJECT
public:
enum ResultCode { Copy = QDialog::Accepted + 1, Keep };
ExampleDialog(QWidget *parent = 0) : QDialog(parent) {};
private slots:
void handleCopyClicked() { done(Copy); };
void handleKeepClicked() { done(Keep); };
};
const char C_FALLBACK_ROOT[] = "ProjectsFallbackRoot";
QPointer<ExamplesListModel> &examplesModelStatic()
......@@ -90,7 +79,7 @@ class Fetcher : public QObject
public:
Fetcher() : QObject(), m_shutdown(false)
{
connect(Core::ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(shutdown()));
connect(Core::ICore::instance(), &Core::ICore::coreAboutToClose, this, &Fetcher::shutdown);
}
void wait()
......@@ -146,7 +135,7 @@ public slots:
m_waitcondition.wakeAll();
}
private slots:
private:
void shutdown()
{
m_shutdown = true;
......@@ -293,7 +282,7 @@ void ExamplesWelcomePage::openUrl(const QUrl &url)
QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileInfo, QStringList &filesToOpen, const QStringList& dependencies)
{
const QString projectDir = proFileInfo.canonicalPath();
ExampleDialog d(Core::ICore::mainWindow());
QDialog d(Core::ICore::mainWindow());
QGridLayout *lay = new QGridLayout(&d);
QLabel *descrLbl = new QLabel;
d.setWindowTitle(tr("Copy Project to writable Location?"));
......@@ -321,16 +310,17 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
Core::DocumentManager::projectsDirectory()).toString());
lay->addWidget(txt, 1, 0);
lay->addWidget(chooser, 1, 1);
enum { Copy = QDialog::Accepted + 1, Keep = QDialog::Accepted + 2 };
QDialogButtonBox *bb = new QDialogButtonBox;
QPushButton *copyBtn = bb->addButton(tr("&Copy Project and Open"), QDialogButtonBox::AcceptRole);
connect(copyBtn, SIGNAL(released()), &d, SLOT(handleCopyClicked()));
connect(copyBtn, &QAbstractButton::released, &d, [&d] { d.done(Copy); });
copyBtn->setDefault(true);
QPushButton *keepBtn = bb->addButton(tr("&Keep Project and Open"), QDialogButtonBox::RejectRole);
connect(keepBtn, SIGNAL(released()), &d, SLOT(handleKeepClicked()));
connect(keepBtn, &QAbstractButton::released, &d, [&d] { d.done(Keep); });
lay->addWidget(bb, 2, 0, 1, 2);
connect(chooser, SIGNAL(validChanged(bool)), copyBtn, SLOT(setEnabled(bool)));
connect(chooser, &PathChooser::validChanged, copyBtn, &QWidget::setEnabled);
int code = d.exec();
if (code == ExampleDialog::Copy) {
if (code == Copy) {
QString exampleDirName = proFileInfo.dir().dirName();
QString destBaseDir = chooser->path();
settings->setValue(QString::fromLatin1(C_FALLBACK_ROOT), destBaseDir);
......@@ -370,7 +360,7 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
}
}
if (code == ExampleDialog::Keep)
if (code == Keep)
return proFileInfo.absoluteFilePath();
return QString();
......
......@@ -47,9 +47,8 @@ ProMessageHandler::ProMessageHandler(bool verbose, bool exact)
//: Prefix used for output from the cumulative evaluation of project files.
, m_prefix(tr("[Inexact] "))
{
QObject::connect(this, SIGNAL(writeMessage(QString,Core::MessageManager::PrintToOutputPaneFlags)),
Core::MessageManager::instance(), SLOT(write(QString,Core::MessageManager::PrintToOutputPaneFlags)),
Qt::QueuedConnection);
connect(this, &ProMessageHandler::writeMessage,
Core::MessageManager::instance(), &Core::MessageManager::write, Qt::QueuedConnection);
}
void ProMessageHandler::message(int type, const QString &msg, const QString &fileName, int lineNo)
......@@ -129,8 +128,8 @@ ProFileCacheManager::ProFileCacheManager(QObject *parent) :
s_instance = this;
m_timer.setInterval(5000);
m_timer.setSingleShot(true);
connect(&m_timer, SIGNAL(timeout()),
this, SLOT(clear()));
connect(&m_timer, &QTimer::timeout,
this, &ProFileCacheManager::clear);
}
void ProFileCacheManager::incRefCount()
......
......@@ -101,7 +101,7 @@ public:
private:
ProFileCacheManager(QObject *parent);
~ProFileCacheManager();
Q_SLOT void clear();
void clear();
ProFileCache *m_cache;
int m_refCount;
QTimer m_timer;
......
......@@ -55,12 +55,13 @@ QtKitConfigWidget::QtKitConfigWidget(ProjectExplorer::Kit *k, const ProjectExplo
refresh();
m_combo->setToolTip(toolTip());
connect(m_combo, SIGNAL(currentIndexChanged(int)), this, SLOT(currentWasChanged(int)));
connect(m_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &QtKitConfigWidget::currentWasChanged);
connect(QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
this, SLOT(versionsChanged(QList<int>,QList<int>,QList<int>)));
connect(QtVersionManager::instance(), &QtVersionManager::qtVersionsChanged,
this, &QtKitConfigWidget::versionsChanged);
connect(m_manageButton, SIGNAL(clicked()), this, SLOT(manageQtVersions()));
connect(m_manageButton, &QAbstractButton::clicked, this, &QtKitConfigWidget::manageQtVersions);
}
QtKitConfigWidget::~QtKitConfigWidget()
......
......@@ -52,12 +52,10 @@ public:
QWidget *buttonWidget() const override;
QString toolTip() const override;
private slots:
private:
void versionsChanged(const QList<int> &added, const QList<int> &removed, const QList<int> &changed);
void manageQtVersions();
void currentWasChanged(int idx);
private:
int findQtVersion(const int id) const;
QComboBox *m_combo;
......
......@@ -219,8 +219,8 @@ void QtKitInformation::kitsWereLoaded()
foreach (ProjectExplorer::Kit *k, ProjectExplorer::KitManager::kits())
fix(k);
connect(QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
this, SLOT(qtVersionsChanged(QList<int>,QList<int>,QList<int>)));
connect(QtVersionManager::instance(), &QtVersionManager::qtVersionsChanged,
this, &QtKitInformation::qtVersionsChanged);
}
KitMatcher QtKitInformation::platformMatcher(Core::Id platform)
......
......@@ -71,7 +71,7 @@ public:
QSet<Core::Id> supportedPlatforms(const ProjectExplorer::Kit *k) const override;
QSet<Core::Id> availableFeatures(const ProjectExplorer::Kit *k) const override;
private slots:
private:
void qtVersionsChanged(const QList<int> &addedIds,
const QList<int> &removedIds,
const QList<int> &changedIds);
......
......@@ -769,8 +769,8 @@ void QtOptionsPageWidget::updateWidgets()
if (m_configurationWidget) {
m_versionUi->formLayout->addRow(m_configurationWidget);
m_configurationWidget->setEnabled(!version->isAutodetected());
connect(m_configurationWidget, SIGNAL(changed()),
this, SLOT(qtVersionChanged()));
connect(m_configurationWidget, &QtConfigWidget::changed,
this, &QtOptionsPageWidget::qtVersionChanged);
}
} else {
m_versionUi->nameEdit->clear();
......
......@@ -86,7 +86,7 @@ private:
QIcon m_validVersionIcon;
QtConfigWidget *m_configurationWidget;
private slots:
private:
void updateQtVersions(const QList<int> &, const QList<int> &, const QList<int> &);
void qtVersionChanged();
void versionChanged(const QModelIndex &current, const QModelIndex &previous);
......@@ -103,7 +103,6 @@ private slots:
void setInfoWidgetVisibility();
void infoAnchorClicked(const QUrl &);
private:
struct ValidityInfo {
QString description;
QString message;
......
......@@ -88,8 +88,8 @@ QtOutputFormatter::QtOutputFormatter(Project *project)
d->projectFinder.setProjectFiles(project->files(Project::SourceFiles));
d->projectFinder.setProjectDirectory(project->projectDirectory().toString());
connect(project, SIGNAL(fileListChanged()),
this, SLOT(updateProjectFileList()));
connect(project, &Project::fileListChanged,
this, &QtOutputFormatter::updateProjectFileList);
}
}
......
......@@ -63,10 +63,8 @@ protected:
void clearLastLine();
virtual void openEditor(const QString &fileName, int line, int column = -1);
private slots:
void updateProjectFileList();
private:
void updateProjectFileList();
LinkResult matchLine(const QString &line) const;
void appendMessagePart(QTextCursor &cursor, const QString &txt, const QTextCharFormat &format);
void appendLine(QTextCursor &cursor, const LinkResult &lr, const QString &line,
......
......@@ -118,13 +118,13 @@ QtVersionManager::QtVersionManager()
// Give the file a bit of time to settle before reading it...
m_fileWatcherTimer->setInterval(2000);
connect(m_fileWatcherTimer, SIGNAL(timeout()), SLOT(updateFromInstaller()));
connect(m_fileWatcherTimer, &QTimer::timeout, this, [this] { updateFromInstaller(); });
}
void QtVersionManager::triggerQtVersionRestore()
{
disconnect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainsLoaded()),
this, SLOT(triggerQtVersionRestore()));
disconnect(ProjectExplorer::ToolChainManager::instance(), &ProjectExplorer::ToolChainManager::toolChainsLoaded,
this, &QtVersionManager::triggerQtVersionRestore);
bool success = restoreQtVersions();
m_instance->updateFromInstaller(false);
......@@ -142,8 +142,8 @@ void QtVersionManager::triggerQtVersionRestore()
const FileName configFileName = globalSettingsFileName();
if (configFileName.exists()) {
m_configFileWatcher = new FileSystemWatcher(m_instance);
connect(m_configFileWatcher, SIGNAL(fileChanged(QString)),
m_fileWatcherTimer, SLOT(start()));
connect(m_configFileWatcher, &FileSystemWatcher::fileChanged,
m_fileWatcherTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
m_configFileWatcher->addFile(configFileName.toString(),
FileSystemWatcher::WatchModifiedDate);
} // exists
......@@ -165,8 +165,8 @@ QtVersionManager::~QtVersionManager()
void QtVersionManager::initialized()
{
connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainsLoaded()),
QtVersionManager::instance(), SLOT(triggerQtVersionRestore()));
connect(ProjectExplorer::ToolChainManager::instance(), &ProjectExplorer::ToolChainManager::toolChainsLoaded,
QtVersionManager::instance(), &QtVersionManager::triggerQtVersionRestore);
}
QtVersionManager *QtVersionManager::instance()
......
......@@ -73,11 +73,10 @@ signals:
public slots:
void updateDumpFor(const Utils::FileName &qmakeCommand);
private slots:
private:
void updateFromInstaller(bool emitSignal = true);
void triggerQtVersionRestore();
private:
// Used by QtOptionsPage
static void setNewQtVersions(QList<BaseQtVersion *> newVersions);
// Used by QtVersion
......
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