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