Commit 32ea9a64 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

QmlPM: Use Qt5-style connects

The heavy lifting was done by clazy.

Change-Id: I8fe343c8e7cfc9b0e620afe4ae947f9e997899f9
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent ca5ce834
...@@ -43,7 +43,7 @@ FileFilterBaseItem::FileFilterBaseItem(QObject *parent) : ...@@ -43,7 +43,7 @@ FileFilterBaseItem::FileFilterBaseItem(QObject *parent) :
m_updateFileListTimer.setSingleShot(true); m_updateFileListTimer.setSingleShot(true);
m_updateFileListTimer.setInterval(50); m_updateFileListTimer.setInterval(50);
connect(&m_updateFileListTimer, SIGNAL(timeout()), this, SLOT(updateFileListNow())); connect(&m_updateFileListTimer, &QTimer::timeout, this, &FileFilterBaseItem::updateFileListNow);
} }
Utils::FileSystemWatcher *FileFilterBaseItem::dirWatcher() Utils::FileSystemWatcher *FileFilterBaseItem::dirWatcher()
...@@ -51,7 +51,8 @@ Utils::FileSystemWatcher *FileFilterBaseItem::dirWatcher() ...@@ -51,7 +51,8 @@ Utils::FileSystemWatcher *FileFilterBaseItem::dirWatcher()
if (!m_dirWatcher) { if (!m_dirWatcher) {
m_dirWatcher = new Utils::FileSystemWatcher(1, this); // Separate id, might exceed OS limits. m_dirWatcher = new Utils::FileSystemWatcher(1, this); // Separate id, might exceed OS limits.
m_dirWatcher->setObjectName(QLatin1String("FileFilterBaseItemWatcher")); m_dirWatcher->setObjectName(QLatin1String("FileFilterBaseItemWatcher"));
connect(m_dirWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(updateFileList())); connect(m_dirWatcher, &Utils::FileSystemWatcher::directoryChanged,
this, &FileFilterBaseItem::updateFileList);
} }
return m_dirWatcher; return m_dirWatcher;
} }
......
...@@ -72,11 +72,10 @@ signals: ...@@ -72,11 +72,10 @@ signals:
void pathsChanged(); void pathsChanged();
void filesChanged(const QSet<QString> &added, const QSet<QString> &removed); void filesChanged(const QSet<QString> &added, const QSet<QString> &removed);
private slots: private:
void updateFileList(); void updateFileList();
void updateFileListNow(); void updateFileListNow();
private:
QString absolutePath(const QString &path) const; QString absolutePath(const QString &path) const;
QString absoluteDir() const; QString absoluteDir() const;
......
...@@ -94,8 +94,8 @@ void QmlProjectItem::setSourceDirectory(const QString &directoryPath) ...@@ -94,8 +94,8 @@ void QmlProjectItem::setSourceDirectory(const QString &directoryPath)
FileFilterBaseItem *fileFilter = qobject_cast<FileFilterBaseItem*>(contentElement); FileFilterBaseItem *fileFilter = qobject_cast<FileFilterBaseItem*>(contentElement);
if (fileFilter) { if (fileFilter) {
fileFilter->setDefaultDirectory(directoryPath); fileFilter->setDefaultDirectory(directoryPath);
connect(fileFilter, SIGNAL(filesChanged(QSet<QString>,QSet<QString>)), connect(fileFilter, &FileFilterBaseItem::filesChanged,
this, SIGNAL(qmlFilesChanged(QSet<QString>,QSet<QString>))); this, &QmlProjectItem::qmlFilesChanged);
} }
} }
......
...@@ -79,8 +79,8 @@ QmlProject::~QmlProject() ...@@ -79,8 +79,8 @@ QmlProject::~QmlProject()
void QmlProject::addedTarget(Target *target) void QmlProject::addedTarget(Target *target)
{ {
connect(target, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration*)), connect(target, &Target::addedRunConfiguration,
this, SLOT(addedRunConfiguration(ProjectExplorer::RunConfiguration*))); this, &QmlProject::addedRunConfiguration);
foreach (RunConfiguration *rc, target->runConfigurations()) foreach (RunConfiguration *rc, target->runConfigurations())
addedRunConfiguration(rc); addedRunConfiguration(rc);
} }
...@@ -91,7 +91,7 @@ void QmlProject::onActiveTargetChanged(Target *target) ...@@ -91,7 +91,7 @@ void QmlProject::onActiveTargetChanged(Target *target)
disconnect(m_activeTarget, &Target::kitChanged, this, &QmlProject::onKitChanged); disconnect(m_activeTarget, &Target::kitChanged, this, &QmlProject::onKitChanged);
m_activeTarget = target; m_activeTarget = target;
if (m_activeTarget) if (m_activeTarget)
connect(target, SIGNAL(kitChanged()), this, SLOT(onKitChanged())); connect(target, &Target::kitChanged, this, &QmlProject::onKitChanged);
// make sure e.g. the default qml imports are adapted // make sure e.g. the default qml imports are adapted
refresh(Configuration); refresh(Configuration);
...@@ -141,8 +141,8 @@ void QmlProject::parseProject(RefreshOptions options) ...@@ -141,8 +141,8 @@ void QmlProject::parseProject(RefreshOptions options)
QString errorMessage; QString errorMessage;
m_projectItem = QmlProjectFileFormat::parseProjectFile(projectFilePath(), &errorMessage); m_projectItem = QmlProjectFileFormat::parseProjectFile(projectFilePath(), &errorMessage);
if (m_projectItem) { if (m_projectItem) {
connect(m_projectItem.data(), SIGNAL(qmlFilesChanged(QSet<QString>,QSet<QString>)), connect(m_projectItem.data(), &QmlProjectItem::qmlFilesChanged,
this, SLOT(refreshFiles(QSet<QString>,QSet<QString>))); this, &QmlProject::refreshFiles);
} else { } else {
MessageManager::write(tr("Error while loading project file %1.") MessageManager::write(tr("Error while loading project file %1.")
......
...@@ -86,17 +86,16 @@ public: ...@@ -86,17 +86,16 @@ public:
enum QmlImport { UnknownImport, QtQuick1Import, QtQuick2Import }; enum QmlImport { UnknownImport, QtQuick1Import, QtQuick2Import };
QmlImport defaultImport() const; QmlImport defaultImport() const;
private slots: protected:
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override;
private:
void refreshFiles(const QSet<QString> &added, const QSet<QString> &removed); void refreshFiles(const QSet<QString> &added, const QSet<QString> &removed);
void addedTarget(ProjectExplorer::Target *target); void addedTarget(ProjectExplorer::Target *target);
void onActiveTargetChanged(ProjectExplorer::Target *target); void onActiveTargetChanged(ProjectExplorer::Target *target);
void onKitChanged(); void onKitChanged();
void addedRunConfiguration(ProjectExplorer::RunConfiguration *); void addedRunConfiguration(ProjectExplorer::RunConfiguration *);
protected:
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override;
private:
// plain format // plain format
void parseProject(RefreshOptions options); void parseProject(RefreshOptions options);
QStringList convertToAbsoluteFiles(const QStringList &paths) const; QStringList convertToAbsoluteFiles(const QStringList &paths) const;
......
...@@ -100,13 +100,13 @@ QString QmlProjectRunConfiguration::disabledReason() const ...@@ -100,13 +100,13 @@ QString QmlProjectRunConfiguration::disabledReason() const
void QmlProjectRunConfiguration::ctor() void QmlProjectRunConfiguration::ctor()
{ {
// reset default settings in constructor // reset default settings in constructor
connect(EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)), connect(EditorManager::instance(), &EditorManager::currentEditorChanged,
this, SLOT(changeCurrentFile(Core::IEditor*))); this, &QmlProjectRunConfiguration::changeCurrentFile);
connect(EditorManager::instance(), SIGNAL(currentDocumentStateChanged()), connect(EditorManager::instance(), &EditorManager::currentDocumentStateChanged,
this, SLOT(changeCurrentFile())); this, [this] { changeCurrentFile(); });
connect(target(), SIGNAL(kitChanged()), connect(target(), &Target::kitChanged,
this, SLOT(updateEnabled())); this, &QmlProjectRunConfiguration::updateEnabled);
if (id() == Constants::QML_SCENE_RC_ID) if (id() == Constants::QML_SCENE_RC_ID)
setDisplayName(tr("QML Scene", "QMLRunConfiguration display name.")); setDisplayName(tr("QML Scene", "QMLRunConfiguration display name."));
......
...@@ -80,10 +80,6 @@ public: ...@@ -80,10 +80,6 @@ public:
signals: signals:
void scriptSourceChanged(); void scriptSourceChanged();
private slots:
void changeCurrentFile(Core::IEditor* = 0);
void updateEnabled();
protected: protected:
QmlProjectRunConfiguration(ProjectExplorer::Target *parent, QmlProjectRunConfiguration(ProjectExplorer::Target *parent,
QmlProjectRunConfiguration *source); QmlProjectRunConfiguration *source);
...@@ -93,6 +89,9 @@ protected: ...@@ -93,6 +89,9 @@ protected:
private: private:
void ctor(); void ctor();
void changeCurrentFile(Core::IEditor* = 0);
void updateEnabled();
QString executable() const; QString executable() const;
QString commandLineArguments() const; QString commandLineArguments() const;
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <QStandardItemModel> #include <QStandardItemModel>
using Core::ICore; using Core::ICore;
using ProjectExplorer::ProjectExplorerPlugin;
namespace QmlProjectManager { namespace QmlProjectManager {
namespace Internal { namespace Internal {
...@@ -68,8 +69,8 @@ QmlProjectRunConfigurationWidget::QmlProjectRunConfigurationWidget(QmlProjectRun ...@@ -68,8 +69,8 @@ QmlProjectRunConfigurationWidget::QmlProjectRunConfigurationWidget(QmlProjectRun
connect(m_fileListCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), connect(m_fileListCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, &QmlProjectRunConfigurationWidget::setMainScript); this, &QmlProjectRunConfigurationWidget::setMainScript);
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(fileListChanged()), connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::fileListChanged,
SLOT(updateFileComboBox())); this, &QmlProjectRunConfigurationWidget::updateFileComboBox);
QLineEdit *qmlViewerArgs = new QLineEdit; QLineEdit *qmlViewerArgs = new QLineEdit;
qmlViewerArgs->setText(rc->m_qmlViewerArgs); qmlViewerArgs->setText(rc->m_qmlViewerArgs);
...@@ -83,8 +84,8 @@ QmlProjectRunConfigurationWidget::QmlProjectRunConfigurationWidget(QmlProjectRun ...@@ -83,8 +84,8 @@ QmlProjectRunConfigurationWidget::QmlProjectRunConfigurationWidget(QmlProjectRun
updateFileComboBox(); updateFileComboBox();
connect(rc, SIGNAL(scriptSourceChanged()), connect(rc, &QmlProjectRunConfiguration::scriptSourceChanged,
this, SLOT(updateFileComboBox())); this, &QmlProjectRunConfigurationWidget::updateFileComboBox);
} }
static bool caseInsensitiveLessThan(const QString &s1, const QString &s2) static bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
......
...@@ -44,12 +44,11 @@ class QmlProjectRunConfigurationWidget : public QWidget ...@@ -44,12 +44,11 @@ class QmlProjectRunConfigurationWidget : public QWidget
public: public:
explicit QmlProjectRunConfigurationWidget(QmlProjectRunConfiguration *rc); explicit QmlProjectRunConfigurationWidget(QmlProjectRunConfiguration *rc);
private slots: private:
void updateFileComboBox(); void updateFileComboBox();
void setMainScript(int index); void setMainScript(int index);
void onViewerArgsChanged(); void onViewerArgsChanged();
private:
QmlProjectRunConfiguration *m_runConfiguration; QmlProjectRunConfiguration *m_runConfiguration;
QComboBox *m_fileListCombo; QComboBox *m_fileListCombo;
......
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