From 01addecb8de0469cd97b55efaf7b1bb6b19b48cb Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 16 Jul 2014 17:13:41 +0200 Subject: [PATCH 01/28] qbs build: Get rid of CopyTransformer. That item was using a directory as an output artifact, which was only working by accident and often caused warning messages about failure to remove files. Use a proper module instead, which is the nicer solution anyway. Change-Id: Ib75a0ce26a24c78eb5421367995a8fc72f6a3c2a Reviewed-by: Joerg Bornemann --- qbs/imports/QtcAutotest.qbs | 1 + .../copyable_resource/copyable-resource.qbs | 32 +++++++++++++++++++ .../auto/extensionsystem/copytransformer.qbs | 26 --------------- tests/auto/extensionsystem/plugin.qbs | 10 +++--- .../circularplugins/plugin1/plugin1.qbs | 2 +- .../circularplugins/plugin2/plugin2.qbs | 2 +- .../circularplugins/plugin3/plugin3.qbs | 2 +- .../correctplugins1/plugin1/plugin1.qbs | 2 +- .../correctplugins1/plugin2/plugin2.qbs | 2 +- .../correctplugins1/plugin3/plugin3.qbs | 2 +- .../extensionsystem/pluginmanager/test.qbs | 8 ++--- .../auto/extensionsystem/pluginspec/test.qbs | 23 ++++--------- .../pluginspec/testplugin/testplugin.qbs | 2 +- 13 files changed, 54 insertions(+), 60 deletions(-) create mode 100644 qbs/modules/copyable_resource/copyable-resource.qbs delete mode 100644 tests/auto/extensionsystem/copytransformer.qbs diff --git a/qbs/imports/QtcAutotest.qbs b/qbs/imports/QtcAutotest.qbs index 376c2f91c64..0bd37a905b2 100644 --- a/qbs/imports/QtcAutotest.qbs +++ b/qbs/imports/QtcAutotest.qbs @@ -5,6 +5,7 @@ import QtcProduct QtcProduct { type: "application" Depends { name: "Qt.test" } + Depends { name: "copyable_resource" } targetName: "tst_" + name.split(' ').join("") // This needs to be absolute, because it is passed to one of the source files. diff --git a/qbs/modules/copyable_resource/copyable-resource.qbs b/qbs/modules/copyable_resource/copyable-resource.qbs new file mode 100644 index 00000000000..d8dda99a919 --- /dev/null +++ b/qbs/modules/copyable_resource/copyable-resource.qbs @@ -0,0 +1,32 @@ +import qbs +import qbs.File +import qbs.FileInfo + +Module { + property path targetDirectory + additionalProductTypes: "copied_resource" + Rule { + inputs: ["copyable_resource"] + outputFileTags: ["copied_resource"] + outputArtifacts: { + var destinationDir = input.moduleProperty("copyable_resource", "targetDirectory"); + if (!destinationDir) { + // If the destination directory has not been explicitly set, replicate the + // structure from the source directory in the build directory. + destinationDir = project.buildDirectory + '/' + + FileInfo.relativePath(project.sourceDirectory, input.filePath); + } + return [{ + filePath: destinationDir + '/' + input.fileName, + fileTags: ["copied_resource"] + }]; + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "Copying " + FileInfo.fileName(input.fileName); + cmd.highlight = "codegen"; + cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; + return cmd; + } + } +} diff --git a/tests/auto/extensionsystem/copytransformer.qbs b/tests/auto/extensionsystem/copytransformer.qbs deleted file mode 100644 index c306748a8c0..00000000000 --- a/tests/auto/extensionsystem/copytransformer.qbs +++ /dev/null @@ -1,26 +0,0 @@ -import qbs -import qbs.File -import qbs.FileInfo - -Transformer { - property pathList sourceFiles - property path targetDirectory - inputs: sourceFiles - Artifact { fileName: targetDirectory } - prepare: { - var commands = [] - for (var tag in inputs) { - for (var index in inputs[tag]) { - var artifact = inputs[tag][index]; - var cmd = new JavaScriptCommand(); - cmd.sourceFile = artifact.filePath; - cmd.description = "Copying '" + cmd.sourceFile + "' to '" + output.filePath + "/'."; - cmd.highlight = "codegen"; - cmd.targetFilePath = output.filePath + '/' + FileInfo.fileName(cmd.sourceFile); - cmd.sourceCode = function() { File.copy(sourceFile, targetFilePath); } - commands.push(cmd); - } - } - return commands; - } -} diff --git a/tests/auto/extensionsystem/plugin.qbs b/tests/auto/extensionsystem/plugin.qbs index 98c27e15c70..8a97ad522e0 100644 --- a/tests/auto/extensionsystem/plugin.qbs +++ b/tests/auto/extensionsystem/plugin.qbs @@ -1,6 +1,5 @@ import qbs import qbs.FileInfo -import "./copytransformer.qbs" as CopyTransformer import QtcFunctions DynamicLibrary { @@ -8,6 +7,7 @@ DynamicLibrary { Depends { name: "ExtensionSystem" } Depends { name: "cpp" } Depends { name: "Qt.core" } + Depends { name: "copyable_resource" } targetName: QtcFunctions.qtLibraryName(qbs, name.split('_')[1]) destinationDirectory: project.buildDirectory + '/' + FileInfo.relativePath(project.ide_source_tree, sourceDirectory) @@ -17,8 +17,10 @@ DynamicLibrary { ].concat(additionalRPaths) property pathList filesToCopy property pathList additionalRPaths: [] - CopyTransformer { - sourceFiles: product.filesToCopy - targetDirectory: product.destinationDirectory + Group { + name: "resources" + fileTags: "copyable_resource" + copyable_resource.targetDirectory: product.destinationDirectory + files: product.filesToCopy } } diff --git a/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin1/plugin1.qbs b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin1/plugin1.qbs index 106403770ab..b90744efb61 100644 --- a/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin1/plugin1.qbs +++ b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin1/plugin1.qbs @@ -4,6 +4,6 @@ import "../../../plugin.qbs" as Plugin Plugin { name: "circular_plugin1" filesToCopy: "plugin.xml" - files: ["plugin1.h", "plugin1.cpp"].concat(filesToCopy) + files: ["plugin1.h", "plugin1.cpp"] cpp.defines: base.concat(["PLUGIN1_LIBRARY"]) } diff --git a/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin2/plugin2.qbs b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin2/plugin2.qbs index a54b405a905..5bf73892976 100644 --- a/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin2/plugin2.qbs +++ b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin2/plugin2.qbs @@ -4,6 +4,6 @@ import "../../../plugin.qbs" as Plugin Plugin { name: "circular_plugin2" filesToCopy: "plugin.xml" - files: ["plugin2.h", "plugin2.cpp"].concat(filesToCopy) + files: ["plugin2.h", "plugin2.cpp"] cpp.defines: base.concat(["PLUGIN2_LIBRARY"]) } diff --git a/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin3/plugin3.qbs b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin3/plugin3.qbs index 600741b2234..5bf2bf3fadb 100644 --- a/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin3/plugin3.qbs +++ b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin3/plugin3.qbs @@ -4,6 +4,6 @@ import "../../../plugin.qbs" as Plugin Plugin { name: "circular_plugin3" filesToCopy: "plugin.xml" - files: ["plugin3.h", "plugin3.cpp"].concat(filesToCopy) + files: ["plugin3.h", "plugin3.cpp"] cpp.defines: base.concat(["PLUGIN3_LIBRARY"]) } diff --git a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.qbs b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.qbs index 9c73779a722..01f72ee6f3d 100644 --- a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.qbs +++ b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.qbs @@ -10,6 +10,6 @@ Plugin { destinationDirectory + "/../plugin2", destinationDirectory + "/../plugin3" ] - files: ["plugin1.h", "plugin1.cpp"].concat(filesToCopy) + files: ["plugin1.h", "plugin1.cpp"] cpp.defines: base.concat(["PLUGIN1_LIBRARY"]) } diff --git a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin2/plugin2.qbs b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin2/plugin2.qbs index 638cb3072a6..916c5dfebc4 100644 --- a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin2/plugin2.qbs +++ b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin2/plugin2.qbs @@ -4,6 +4,6 @@ import "../../../plugin.qbs" as Plugin Plugin { name: "correct_plugin2" filesToCopy: "plugin.spec" - files: ["plugin2.h", "plugin2.cpp"].concat(filesToCopy) + files: ["plugin2.h", "plugin2.cpp"] cpp.defines: base.concat(["PLUGIN2_LIBRARY"]) } diff --git a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin3/plugin3.qbs b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin3/plugin3.qbs index 9f0a5167aaf..3f0ba482958 100644 --- a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin3/plugin3.qbs +++ b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin3/plugin3.qbs @@ -6,6 +6,6 @@ Plugin { Depends { name: "correct_plugin2" } filesToCopy: "plugin.spec" additionalRPaths: [destinationDirectory + "/../plugin2"] - files: ["plugin3.h", "plugin3.cpp"].concat(filesToCopy) + files: ["plugin3.h", "plugin3.cpp"] cpp.defines: base.concat(["PLUGIN3_LIBRARY"]) } diff --git a/tests/auto/extensionsystem/pluginmanager/test.qbs b/tests/auto/extensionsystem/pluginmanager/test.qbs index cc930a49cfc..47958855c31 100644 --- a/tests/auto/extensionsystem/pluginmanager/test.qbs +++ b/tests/auto/extensionsystem/pluginmanager/test.qbs @@ -1,6 +1,5 @@ import qbs import QtcAutotest -import "../copytransformer.qbs" as CopyTransformer QtcAutotest { name: "PluginManager autotest" @@ -15,6 +14,8 @@ QtcAutotest { Group { id: pluginGroup name: "plugins" + fileTags: "copyable_resource" + copyable_resource.targetDirectory: product.destinationDirectory + "/plugins" files: [ "plugins/otherplugin.xml", "plugins/plugin1.xml", @@ -22,11 +23,6 @@ QtcAutotest { ] } - CopyTransformer { - sourceFiles: pluginGroup.files - targetDirectory: product.destinationDirectory + "/plugins" - } - files: "tst_pluginmanager.cpp" cpp.defines: base.concat(['PLUGINMANAGER_TESTS_DIR="' + destinationDirectory + '"']) } diff --git a/tests/auto/extensionsystem/pluginspec/test.qbs b/tests/auto/extensionsystem/pluginspec/test.qbs index e87698c333e..365266d5e99 100644 --- a/tests/auto/extensionsystem/pluginspec/test.qbs +++ b/tests/auto/extensionsystem/pluginspec/test.qbs @@ -1,7 +1,5 @@ import qbs - import QtcAutotest -import "../copytransformer.qbs" as CopyTransformer QtcAutotest { name: "ExtensionSystem pluginspec autotest" @@ -13,6 +11,8 @@ QtcAutotest { Group { id: testSpecsGroup name: "test specs" + fileTags: "copyable_resource" + copyable_resource.targetDirectory: product.destinationDirectory + "/testspecs" files: [ "testspecs/simplespec.xml", "testspecs/simplespec_experimental.xml", @@ -28,6 +28,8 @@ QtcAutotest { Group { id: testDependenciesGroup name: "test dependencies" + fileTags: "copyable_resource" + copyable_resource.targetDirectory: product.destinationDirectory + "/testdependencies" files: [ "testdependencies/spec1.xml", "testdependencies/spec2.xml", @@ -39,21 +41,8 @@ QtcAutotest { Group { id: specGroup name: "spec" + fileTags: "copyable_resource" + copyable_resource.targetDirectory: product.destinationDirectory + "/testdir" files: ["testdir/spec.xml"] } - - CopyTransformer { - sourceFiles: testSpecsGroup.files - targetDirectory: product.destinationDirectory + "/testspecs" - } - - CopyTransformer { - sourceFiles: testDependenciesGroup.files - targetDirectory: product.destinationDirectory + "/testdependencies" - } - - CopyTransformer { - sourceFiles: specGroup.files - targetDirectory: product.destinationDirectory + "/testdir" - } } diff --git a/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.qbs b/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.qbs index 2ed6f66b597..5bf464c01d4 100644 --- a/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.qbs +++ b/tests/auto/extensionsystem/pluginspec/testplugin/testplugin.qbs @@ -6,7 +6,7 @@ Plugin { files: [ "testplugin.h", "testplugin.cpp", "testplugin_global.h" - ].concat(filesToCopy) + ] filesToCopy: "testplugin.xml" cpp.defines: base.concat(["MYPLUGIN_LIBRARY"]) } From 35940f16e41377dbf7a38a76085aad36113ac5a7 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 17 Jul 2014 12:33:03 +0200 Subject: [PATCH 02/28] QbsProjectManager: Only update project nodes etc if necessary. That is, if qbs::Project::projectData() has changed. There are still some false positives left (e.g. the project nodes will also update if only the file paths of executables have changed), but we can deal with those later. Change-Id: Ifa18903aba41c21769bfe4cd0e4f6004f1a94f11 Reviewed-by: Joerg Bornemann --- src/plugins/qbsprojectmanager/qbsproject.cpp | 6 +++++- src/plugins/qbsprojectmanager/qbsproject.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index 682c65395bd..d9f7bc6a504 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -291,8 +291,12 @@ void QbsProject::handleQbsParsingDone(bool success) if (success) { m_qbsProject = m_qbsProjectParser->qbsProject(); + const qbs::ProjectData &projectData = m_qbsProject.projectData(); QTC_CHECK(m_qbsProject.isValid()); - readQbsData(); + if (projectData != m_projectData) { + m_projectData = projectData; + readQbsData(); + } } else { m_qbsUpdateFutureInterface->reportCanceled(); } diff --git a/src/plugins/qbsprojectmanager/qbsproject.h b/src/plugins/qbsprojectmanager/qbsproject.h index ab86c24074a..c2dde5d5a68 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.h +++ b/src/plugins/qbsprojectmanager/qbsproject.h @@ -146,6 +146,7 @@ private: const QString m_projectName; const QString m_fileName; qbs::Project m_qbsProject; + qbs::ProjectData m_projectData; QSet m_qbsDocuments; QbsRootProjectNode *m_rootProjectNode; From e82a47e5afabd65bd6ebb5c39e1d31d4f3dfa9f9 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 17 Jul 2014 12:02:56 +0200 Subject: [PATCH 03/28] QbsProjectManager: No more "forced" vs "non-forced" parsing. This differentiation complicates the code and duplicates checks already done in qbs. Just let the library reparse the project; if it turns out that nothing has to be done, then the operation will be fast. Change-Id: Ib6406f254e51541c69c948f275fff7877b65b4bd Reviewed-by: Joerg Bornemann --- .../qbsprojectmanager/qbsbuildstep.cpp | 2 +- src/plugins/qbsprojectmanager/qbsproject.cpp | 29 +++++------------ src/plugins/qbsprojectmanager/qbsproject.h | 4 +-- .../qbsprojectmanager/qbsprojectfile.cpp | 2 +- .../qbsprojectmanagerplugin.cpp | 2 +- .../qbsprojectmanager/qbsprojectparser.cpp | 32 ++----------------- .../qbsprojectmanager/qbsprojectparser.h | 5 +-- 7 files changed, 16 insertions(+), 60 deletions(-) diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp index 9ee071ace64..92bfb71facd 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp @@ -365,7 +365,7 @@ void QbsBuildStep::parseProject() { m_parsingProject = true; connect(qbsProject(), SIGNAL(projectParsingDone(bool)), SLOT(reparsingDone(bool))); - qbsProject()->parseCurrentBuildConfiguration(true); + qbsProject()->parseCurrentBuildConfiguration(); } void QbsBuildStep::build() diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index d9f7bc6a504..023a8b5a366 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -100,7 +100,6 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) : m_rootProjectNode(0), m_qbsProjectParser(0), m_qbsUpdateFutureInterface(0), - m_forceParsing(false), m_parsingScheduled(false), m_cancelStatus(CancelStatusNone), m_currentBc(0) @@ -283,7 +282,7 @@ void QbsProject::handleQbsParsingDone(bool success) if (cancelStatus == CancelStatusCancelingForReparse) { m_qbsProjectParser->deleteLater(); m_qbsProjectParser = 0; - parseCurrentBuildConfiguration(m_forceParsing); + parseCurrentBuildConfiguration(); return; } @@ -316,8 +315,8 @@ void QbsProject::handleQbsParsingDone(bool success) void QbsProject::targetWasAdded(Target *t) { connect(t, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)), - this, SLOT(delayForcedParsing())); - connect(t, SIGNAL(buildDirectoryChanged()), this, SLOT(delayForcedParsing())); + this, SLOT(delayParsing())); + connect(t, SIGNAL(buildDirectoryChanged()), this, SLOT(delayParsing())); } void QbsProject::changeActiveTarget(Target *t) @@ -351,7 +350,7 @@ void QbsProject::startParsing() return; } - parseCurrentBuildConfiguration(false); + parseCurrentBuildConfiguration(); } void QbsProject::delayParsing() @@ -359,12 +358,6 @@ void QbsProject::delayParsing() m_parsingDelay.start(); } -void QbsProject::delayForcedParsing() -{ - m_forceParsing = true; - delayParsing(); -} - // Qbs may change its data void QbsProject::readQbsData() { @@ -383,11 +376,9 @@ void QbsProject::readQbsData() emit fileListChanged(); } -void QbsProject::parseCurrentBuildConfiguration(bool force) +void QbsProject::parseCurrentBuildConfiguration() { m_parsingScheduled = false; - if (!m_forceParsing) - m_forceParsing = force; if (m_cancelStatus == CancelStatusCancelingForReparse) return; @@ -440,12 +431,8 @@ void QbsProject::registerQbsProjectParser(QbsProjectParser *p) m_qbsProjectParser = p; - if (p) { - p->setForced(m_forceParsing); + if (p) connect(m_qbsProjectParser, SIGNAL(done(bool)), this, SLOT(handleQbsParsingDone(bool))); - } - - m_forceParsing = false; } bool QbsProject::fromMap(const QVariantMap &map) @@ -482,8 +469,8 @@ void QbsProject::parse(const QVariantMap &config, const Environment &env, const registerQbsProjectParser(new QbsProjectParser(this, m_qbsUpdateFutureInterface)); - if (m_qbsProjectParser->parse(config, env, dir)) - emit projectParsingStarted(); + m_qbsProjectParser->parse(config, env, dir); + emit projectParsingStarted(); } void QbsProject::prepareForParsing() diff --git a/src/plugins/qbsprojectmanager/qbsproject.h b/src/plugins/qbsprojectmanager/qbsproject.h index c2dde5d5a68..1f22cde680e 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.h +++ b/src/plugins/qbsprojectmanager/qbsproject.h @@ -93,7 +93,7 @@ public: QString profileForTarget(const ProjectExplorer::Target *t) const; bool isParsing() const; bool hasParseResult() const; - void parseCurrentBuildConfiguration(bool force); + void parseCurrentBuildConfiguration(); void scheduleParsing() { m_parsingScheduled = true; } bool parsingScheduled() const { return m_parsingScheduled; } void cancelParsing(); @@ -114,7 +114,6 @@ public: public slots: void invalidate(); void delayParsing(); - void delayForcedParsing(); void readQbsData(); signals: @@ -153,7 +152,6 @@ private: QbsProjectParser *m_qbsProjectParser; QFutureInterface *m_qbsUpdateFutureInterface; - bool m_forceParsing; bool m_parsingScheduled; enum CancelStatus { diff --git a/src/plugins/qbsprojectmanager/qbsprojectfile.cpp b/src/plugins/qbsprojectmanager/qbsprojectfile.cpp index 5502462e7f5..65980fe9dab 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectfile.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectfile.cpp @@ -89,7 +89,7 @@ bool QbsProjectFile::reload(QString *errorString, ReloadFlag flag, ChangeType ty Q_UNUSED(flag) if (type == TypePermissions) return true; - m_project->delayForcedParsing(); + m_project->delayParsing(); return true; } diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp index 68bfec5291f..4cc2cbb8a13 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp @@ -522,7 +522,7 @@ void QbsProjectManagerPlugin::reparseProject(QbsProject *project) if (BuildManager::isBuilding(project)) project->scheduleParsing(); else - project->parseCurrentBuildConfiguration(true); + project->parseCurrentBuildConfiguration(); } } // namespace Internal diff --git a/src/plugins/qbsprojectmanager/qbsprojectparser.cpp b/src/plugins/qbsprojectmanager/qbsprojectparser.cpp index b43d8d4dd27..45e00d92cb9 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectparser.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectparser.cpp @@ -71,15 +71,10 @@ QbsProjectParser::~QbsProjectParser() m_fi = 0; // we do not own m_fi, do not delete } -void QbsProjectParser::setForced(bool f) +void QbsProjectParser::parse(const QVariantMap &config, const Environment &env, const QString &dir) { - m_wasForced = f; -} - -bool QbsProjectParser::parse(const QVariantMap &config, const Environment &env, const QString &dir) -{ - QTC_ASSERT(!m_qbsSetupProjectJob, return false); - QTC_ASSERT(!dir.isNull(), return false); + QTC_ASSERT(!m_qbsSetupProjectJob, return); + QTC_ASSERT(!dir.isEmpty(), return); m_currentProgressBase = 0; @@ -92,25 +87,6 @@ bool QbsProjectParser::parse(const QVariantMap &config, const Environment &env, params.setBuildVariant(userConfig.take(specialKey).toString()); params.setSettingsDirectory(QbsManager::settings()->baseDirectoy()); params.setOverriddenValues(userConfig); - m_error = params.expandBuildConfiguration(); - if (m_error.hasError()) { - emit done(false); - return false; - } - - // Avoid useless reparsing: - if (!m_wasForced - && m_project.isValid() - && m_project.projectConfiguration() == params.finalBuildConfigurationTree()) { - QHash usedEnv = m_project.usedEnvironment(); - for (QHash::const_iterator i = usedEnv.constBegin(); - i != usedEnv.constEnd(); ++i) { - if (env.value(i.key()) != i.value()) { - emit done(true); - return true; - } - } - } // Some people don't like it when files are created as a side effect of opening a project, // so do not store the build graph if the build directory does not exist yet. @@ -132,8 +108,6 @@ bool QbsProjectParser::parse(const QVariantMap &config, const Environment &env, this, SLOT(handleQbsParsingTaskSetup(QString,int))); connect(m_qbsSetupProjectJob, SIGNAL(taskProgress(int,qbs::AbstractJob*)), this, SLOT(handleQbsParsingProgress(int))); - - return true; } void QbsProjectParser::cancel() diff --git a/src/plugins/qbsprojectmanager/qbsprojectparser.h b/src/plugins/qbsprojectmanager/qbsprojectparser.h index 9d0d1496aec..da7b9dbc74c 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectparser.h +++ b/src/plugins/qbsprojectmanager/qbsprojectparser.h @@ -51,9 +51,7 @@ public: QFutureInterface *fi); ~QbsProjectParser(); - void setForced(bool); - - bool parse(const QVariantMap &config, const Utils::Environment &env, const QString &dir); + void parse(const QVariantMap &config, const Utils::Environment &env, const QString &dir); void cancel(); qbs::Project qbsProject() const; @@ -71,7 +69,6 @@ private: QString pluginsBaseDirectory() const; QString resourcesBaseDirectory() const; - bool m_wasForced; QString m_projectFilePath; qbs::SetupProjectJob *m_qbsSetupProjectJob; qbs::ErrorInfo m_error; From 883545a03dea750207d70f71c2e2736e409342e2 Mon Sep 17 00:00:00 2001 From: Fawzi Mohamed Date: Thu, 17 Jul 2014 12:29:37 +0200 Subject: [PATCH 04/28] qmljs: avoid shortened names libPath -> libraryQualifiedPath vContext -> viewerContext Change-Id: I085f5f3304a6becaa00f715cb3395c8cee5227c6 Reviewed-by: Tim Jenssen --- src/libs/qmljs/qmljscontext.cpp | 2 +- src/libs/qmljs/qmljscontext.h | 6 +++--- src/libs/qmljs/qmljsimportdependencies.cpp | 2 +- src/libs/qmljs/qmljsimportdependencies.h | 2 +- .../qmldesigner/designercore/metainfo/nodemetainfo.cpp | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libs/qmljs/qmljscontext.cpp b/src/libs/qmljs/qmljscontext.cpp index 7c60dcc03a1..b2da89f1a99 100644 --- a/src/libs/qmljs/qmljscontext.cpp +++ b/src/libs/qmljs/qmljscontext.cpp @@ -91,7 +91,7 @@ QmlJS::Snapshot Context::snapshot() const return _snapshot; } -ViewerContext Context::vContext() const +ViewerContext Context::viewerContext() const { return _vContext; } diff --git a/src/libs/qmljs/qmljscontext.h b/src/libs/qmljs/qmljscontext.h index ac0b23d61f5..5cd184ed877 100644 --- a/src/libs/qmljs/qmljscontext.h +++ b/src/libs/qmljs/qmljscontext.h @@ -52,14 +52,14 @@ public: // Context takes ownership of valueOwner static ContextPtr create(const Snapshot &snapshot, ValueOwner *valueOwner, - const ImportsPerDocument &imports, const ViewerContext &vContext); + const ImportsPerDocument &imports, const ViewerContext &viewerContext); ~Context(); ContextPtr ptr() const; ValueOwner *valueOwner() const; Snapshot snapshot() const; - ViewerContext vContext() const; + ViewerContext viewerContext() const; const Imports *imports(const Document *doc) const; @@ -73,7 +73,7 @@ public: private: // Context takes ownership of valueOwner Context(const Snapshot &snapshot, ValueOwner *valueOwner, const ImportsPerDocument &imports, - const ViewerContext &vContext); + const ViewerContext &viewerContext); Snapshot _snapshot; QSharedPointer _valueOwner; diff --git a/src/libs/qmljs/qmljsimportdependencies.cpp b/src/libs/qmljs/qmljsimportdependencies.cpp index cfe16ae7d3f..dd3e2e70b8e 100644 --- a/src/libs/qmljs/qmljsimportdependencies.cpp +++ b/src/libs/qmljs/qmljsimportdependencies.cpp @@ -198,7 +198,7 @@ ImportKey ImportKey::flatKey() const { return res; } -QString ImportKey::libPath() const +QString ImportKey::libraryQualifiedPath() const { QString res = splitPath.join(QString::fromLatin1(".")); if (res.isEmpty() && !splitPath.isEmpty()) diff --git a/src/libs/qmljs/qmljsimportdependencies.h b/src/libs/qmljs/qmljsimportdependencies.h index 0ec88cc1e74..8a412b754ea 100644 --- a/src/libs/qmljs/qmljsimportdependencies.h +++ b/src/libs/qmljs/qmljsimportdependencies.h @@ -108,7 +108,7 @@ public: int minorVersion; QString path() const; - QString libPath() const; + QString libraryQualifiedPath() const; void addToHash(QCryptographicHash &hash) const; ImportKey flatKey() const; diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index 0f48b1a2c28..3eee5fe7c08 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -163,10 +163,10 @@ static QString qualifiedTypeNameForContext(const ObjectValue *objectValue, << " vs " << typeName << " for " << e.exportName.toString(); } - if (packages.isEmpty() || packages.contains(e.exportName.libPath())) { + if (packages.isEmpty() || packages.contains(e.exportName.libraryQualifiedPath())) { if (e.exportName.splitPath.value(0) == QLatin1String("QtQuick")) hasQtQuick = true; - possibleLibraries.append(e.exportName.libPath() + '.' + typeName); + possibleLibraries.append(e.exportName.libraryQualifiedPath() + '.' + typeName); } break; } @@ -298,7 +298,7 @@ public: if (const CppComponentValue * cppComponentValue = value_cast(value)) { TypeName qualifiedTypeName = qualifiedTypeNameForContext(cppComponentValue, - m_context->vContext(), *m_context->snapshot().importDependencies()).toUtf8(); + m_context->viewerContext(), *m_context->snapshot().importDependencies()).toUtf8(); m_properties.append(qMakePair(propertyName, qualifiedTypeName)); } else { TypeId typeId; From b9063569dbe3b82ef4ab531d9e18e4bbb500d5a8 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 17 Jul 2014 13:04:16 +0200 Subject: [PATCH 05/28] Fix vanished fullscreen menu item text on non-OSX Broke when removing old OS X 10.6 code paths. Task-number: QTCREATORBUG-12684 Change-Id: I95dea42d40d2f343476cea0eba44bc2a293a422d Reviewed-by: Robert Loehning --- src/plugins/coreplugin/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 6a4b4e33719..bfa5bc35ced 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -654,7 +654,7 @@ void MainWindow::registerDefaultActions() } // Full Screen Action - m_toggleFullScreenAction = new QAction(this); + m_toggleFullScreenAction = new QAction(tr("Full Screen"), this); m_toggleFullScreenAction->setMenuRole(QAction::NoRole); m_toggleFullScreenAction->setCheckable(!Utils::HostOsInfo::isMacHost()); updateFullScreenAction(); From 76f57922ea9287759511375a6d272380db6ec24a Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Thu, 17 Jul 2014 14:15:14 +0200 Subject: [PATCH 06/28] QmlDesigner: add puppet mode and process id information Change-Id: I8e3bf68c5e4ae3bcc7eb446c9321667afc2428ac Reviewed-by: Marco Bubke --- .../qmldesigner/designercore/instances/puppetcreator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp index 48096c6d03f..44d3bc80539 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp @@ -161,7 +161,8 @@ QProcess *PuppetCreator::puppetProcess(const QString &puppetPath, if (!qgetenv("DEBUG_QML_PUPPET").isEmpty()) QMessageBox::information(Core::ICore::dialogParent(), QStringLiteral("Puppet is starting ..."), - QStringLiteral("You can now attach your debugger to the puppet.")); + QStringLiteral("You can now attach your debugger to the %1 puppet with process id: %2.").arg( + puppetMode, QString::number(puppetProcess->processId()))); return puppetProcess; } From 7203eb46e5d3c7f41adfd3bf50abb68c54df903b Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Thu, 17 Jul 2014 15:33:48 +0200 Subject: [PATCH 07/28] CMake: fix capitalization of the "Run CMake..." button Change-Id: I5402d29e6916110934411848542b1776178615e1 Reviewed-by: Daniel Teske --- src/plugins/cmakeprojectmanager/cmakeproject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index f6227b46591..350ca84cd36 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -831,7 +831,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc) fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); setLayout(fl); - QPushButton *runCmakeButton = new QPushButton(tr("Run cmake...")); + QPushButton *runCmakeButton = new QPushButton(tr("Run CMake...")); connect(runCmakeButton, SIGNAL(clicked()), this, SLOT(runCMake())); fl->addRow(tr("Reconfigure project:"), runCmakeButton); From 2de73ceb6540c57360f2e76985a9e7967590a260 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Thu, 17 Jul 2014 15:10:44 +0200 Subject: [PATCH 08/28] Qt support: fix capitalization of "Clean Up" button Change-Id: Ifdfe2755295b86d7118d105fb478e803764cd429 Reviewed-by: Eike Ziller --- src/plugins/qtsupport/qtversionmanager.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qtsupport/qtversionmanager.ui b/src/plugins/qtsupport/qtversionmanager.ui index 7fca9e2d191..f8640c981eb 100644 --- a/src/plugins/qtsupport/qtversionmanager.ui +++ b/src/plugins/qtsupport/qtversionmanager.ui @@ -91,7 +91,7 @@ - Clean up + Clean Up From b0af82ebc9e8979fe36d10145d4a43954579fba4 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Thu, 17 Jul 2014 15:52:32 +0200 Subject: [PATCH 09/28] CMakeProject: Make CMakeLists.txt and *.cmake use different mime types Since we want to treat them differently. Task-number: QTCREATORBUG-12461 Change-Id: Ia72b8045390ceec693fa416f65010a4c4dbecce1 Reviewed-by: Eike Ziller --- .../cmakeprojectmanager/CMakeProjectManager.mimetypes.xml | 6 +++++- src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp | 2 +- src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp | 1 + src/plugins/cmakeprojectmanager/cmakeproject.cpp | 2 +- src/plugins/cmakeprojectmanager/cmakeprojectconstants.h | 1 + src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp | 2 +- src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp | 1 + 7 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/CMakeProjectManager.mimetypes.xml b/src/plugins/cmakeprojectmanager/CMakeProjectManager.mimetypes.xml index 82894649952..832a61732eb 100644 --- a/src/plugins/cmakeprojectmanager/CMakeProjectManager.mimetypes.xml +++ b/src/plugins/cmakeprojectmanager/CMakeProjectManager.mimetypes.xml @@ -3,7 +3,11 @@ CMake Project file - + + + CMake Project file + + diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index 0222417ece7..d442c52f13f 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -140,7 +140,7 @@ QList CMakeBuildConfigurationFactory::availableBui int CMakeBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const { return (k && Core::MimeDatabase::findByFile(QFileInfo(projectPath)) - .matchesType(QLatin1String(Constants::CMAKEMIMETYPE))) ? 0 : -1; + .matchesType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE))) ? 0 : -1; } QList CMakeBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit *k, diff --git a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp index de86d401b99..74fc4699f2d 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp @@ -51,6 +51,7 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager) setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID); setDisplayName(tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME)); addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE); + addMimeType(CMakeProjectManager::Constants::CMAKEPROJECTMIMETYPE); new TextEditorActionHandler(this, Constants::C_CMAKEEDITOR, TextEditorActionHandler::UnCommentSelection diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 350ca84cd36..5a96b622707 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -775,7 +775,7 @@ CMakeFile::CMakeFile(CMakeProject *parent, QString fileName) : Core::IDocument(parent), m_project(parent) { setId("Cmake.ProjectFile"); - setMimeType(QLatin1String(Constants::CMAKEMIMETYPE)); + setMimeType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE)); setFilePath(fileName); } diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h index 1fb917480f5..bb91725ee92 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h +++ b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h @@ -35,6 +35,7 @@ namespace Constants { const char PROJECTCONTEXT[] = "CMakeProject.ProjectContext"; const char CMAKEMIMETYPE[] = "text/x-cmake"; +const char CMAKEPROJECTMIMETYPE[] = "text/x-cmake-project"; const char CMAKE_EDITOR_ID[] = "CMakeProject.CMakeEditor"; const char CMAKE_EDITOR_DISPLAY_NAME[] = "CMake Editor"; const char C_CMAKEEDITOR[] = "CMakeProject.Context.CMakeEditor"; diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index 1c4d76e9714..0b2f0a0a7f3 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -135,7 +135,7 @@ ProjectExplorer::Project *CMakeManager::openProject(const QString &fileName, QSt QString CMakeManager::mimeType() const { - return QLatin1String(Constants::CMAKEMIMETYPE); + return QLatin1String(Constants::CMAKEPROJECTMIMETYPE); } QString CMakeManager::cmakeExecutable() const diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp index bbe3a19c20e..a3bb189064d 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp @@ -88,6 +88,7 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString * hf->setProductType(); hf->setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID); hf->addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE); + hf->addMimeType(CMakeProjectManager::Constants::CMAKEPROJECTMIMETYPE); addAutoReleasedObject(hf); return true; From 4f5747e3484e887b1e99abe1d936cdf09ef5d088 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Thu, 17 Jul 2014 16:53:42 +0200 Subject: [PATCH 10/28] Compile fix for Qt 4.8.6 Task-number: QTCREATORBUG-12695 Done-by: Fawzi Mohamed Change-Id: Id184bb051c08ee954474cca89308712e14710f23 Reviewed-by: Fawzi Mohamed --- src/libs/qmljs/qmljsinterpreter.cpp | 4 ++-- src/libs/qmljs/qmljsinterpreter.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 0898bb77acf..fbf5725a02b 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -181,9 +181,9 @@ bool FakeMetaObjectWithOrigin::operator ==(const FakeMetaObjectWithOrigin &o) co return fakeMetaObject == o.fakeMetaObject; } -uint qHash(const FakeMetaObjectWithOrigin &fmoo, int seed) +uint qHash(const FakeMetaObjectWithOrigin &fmoo) { - return qHash(fmoo.fakeMetaObject, seed); + return qHash(fmoo.fakeMetaObject); } } // namespace QmlJS diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 64e89fee151..230d9f03f0b 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -687,7 +687,7 @@ public: bool operator ==(const FakeMetaObjectWithOrigin &o) const; }; -QMLJS_EXPORT uint qHash(const FakeMetaObjectWithOrigin &fmoo, int seed = 0); +QMLJS_EXPORT uint qHash(const FakeMetaObjectWithOrigin &fmoo); class QMLJS_EXPORT CppQmlTypes { From 0fbbcfa87059b4ca45b7e9074f57229560604452 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 17 Jul 2014 14:26:46 +0200 Subject: [PATCH 11/28] FancyMainWindow: Polish dockwidget titlebar display Pop up after 500 ms hovering over an active area of the (approximate) size of the titlebar. Hide the titlebase if the mouse leaves it. Completely hide it (as opposed to the initial 3 px) if it's "inactive". Change-Id: I9e43c7f501d2265466a7575da4e661e25aa6ccf5 Reviewed-by: Alessandro Portale --- src/libs/utils/fancymainwindow.cpp | 81 +++++++++++++++++++++++++----- 1 file changed, 68 insertions(+), 13 deletions(-) diff --git a/src/libs/utils/fancymainwindow.cpp b/src/libs/utils/fancymainwindow.cpp index 46c366df224..44259411c72 100644 --- a/src/libs/utils/fancymainwindow.cpp +++ b/src/libs/utils/fancymainwindow.cpp @@ -31,6 +31,7 @@ #include "qtcassert.h" +#include #include #include #include @@ -42,6 +43,7 @@ #include #include #include +#include #include static const char stateKeyC[] = "State"; @@ -131,7 +133,7 @@ public: const int minWidth = 10; const int maxWidth = 10000; - const int inactiveHeight = 3; + const int inactiveHeight = 0; const int activeHeight = m_closeButton->sizeHint().height() + 2; m_minimumInactiveSize = QSize(minWidth, inactiveHeight); @@ -150,12 +152,6 @@ public: setLayout(layout); } - void enterEvent(QEvent *event) - { - setActive(true); - QWidget::enterEvent(event); - } - void leaveEvent(QEvent *event) { if (!q->isFloating()) @@ -202,27 +198,84 @@ public: class DockWidget : public QDockWidget { + Q_OBJECT + public: DockWidget(QWidget *inner, QWidget *parent) - : QDockWidget(parent) + : QDockWidget(parent), m_inner(inner) { setWidget(inner); setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable); setObjectName(inner->objectName() + QLatin1String("DockWidget")); setWindowTitle(inner->windowTitle()); + setMouseTracking(true); QStyleOptionDockWidget opt; initStyleOption(&opt); - auto titleBar = new TitleBarWidget(this, opt); - titleBar->m_titleLabel->setText(inner->windowTitle()); - setTitleBarWidget(titleBar); + m_titleBar = new TitleBarWidget(this, opt); + m_titleBar->m_titleLabel->setText(inner->windowTitle()); + setTitleBarWidget(m_titleBar); + + m_timer.setSingleShot(true); + m_timer.setInterval(500); + + connect(&m_timer, SIGNAL(timeout()), this, SLOT(handleMouseTimeout())); + + connect(this, SIGNAL(topLevelChanged(bool)), this, SLOT(handleToplevelChanged(bool))); auto origFloatButton = findChild(QLatin1String("qt_dockwidget_floatbutton")); - connect(titleBar->m_floatButton, SIGNAL(clicked()), origFloatButton, SIGNAL(clicked())); + connect(m_titleBar->m_floatButton, SIGNAL(clicked()), origFloatButton, SIGNAL(clicked())); auto origCloseButton = findChild(QLatin1String("qt_dockwidget_closebutton")); - connect(titleBar->m_closeButton, SIGNAL(clicked()), origCloseButton, SIGNAL(clicked())); + connect(m_titleBar->m_closeButton, SIGNAL(clicked()), origCloseButton, SIGNAL(clicked())); } + + bool eventFilter(QObject *, QEvent *event) + { + if (event->type() == QEvent::MouseMove) { + QMouseEvent *me = static_cast(event); + int y = me->pos().y(); + int x = me->pos().x(); + int h = m_titleBar->m_floatButton->height(); + if (!isFloating() && 0 <= x && x < m_inner->width() && 0 <= y && y <= h) { + m_timer.start(); + m_startPos = mapToGlobal(me->pos()); + } + } + return false; + } + + void enterEvent(QEvent *event) + { + QApplication::instance()->installEventFilter(this); + QDockWidget::leaveEvent(event); + } + + void leaveEvent(QEvent *event) + { + QApplication::instance()->removeEventFilter(this); + QDockWidget::leaveEvent(event); + } + + Q_SLOT void handleMouseTimeout() + { + QPoint dist = m_startPos - QCursor::pos(); + if (!isFloating() && dist.manhattanLength() < 4) { + m_titleBar->setActive(true); + } + } + + Q_SLOT void handleToplevelChanged(bool floating) + { + if (!floating) + m_titleBar->setActive(false); + } + +private: + QPoint m_startPos; + QWidget *m_inner; + TitleBarWidget *m_titleBar; + QTimer m_timer; }; /*! \class Utils::FancyMainWindow @@ -444,3 +497,5 @@ void FancyMainWindow::setToolBarDockWidget(QDockWidget *dock) } } // namespace Utils + +#include "fancymainwindow.moc" From a1b5a61b6ef301b22382be11d734ea5cff5455cf Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Thu, 17 Jul 2014 15:06:06 +0200 Subject: [PATCH 12/28] Find: remove unused text "Go to Current Document Find" Because it would have needed changing. Change-Id: I58ff194a296cce1fd6096f3cc2ea39854435e7c1 Reviewed-by: Eike Ziller --- src/plugins/coreplugin/find/findtoolbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/find/findtoolbar.cpp b/src/plugins/coreplugin/find/findtoolbar.cpp index a449ec0e399..78ee72d147f 100644 --- a/src/plugins/coreplugin/find/findtoolbar.cpp +++ b/src/plugins/coreplugin/find/findtoolbar.cpp @@ -147,7 +147,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_ui.advancedButton->setDefaultAction(Core::ActionManager::command(Constants::ADVANCED_FIND)->action()); - m_goToCurrentFindAction = new QAction(tr("Go to Current Document Find"), this); + m_goToCurrentFindAction = new QAction(this); Core::ActionManager::registerAction(m_goToCurrentFindAction, Constants::S_RETURNTOEDITOR, Context(Constants::C_FINDTOOLBAR)); connect(m_goToCurrentFindAction, SIGNAL(triggered()), this, SLOT(setFocusToCurrentFindSupport())); From ac771eb552e421e76c79102347c6a4d9620a5270 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 17 Jul 2014 12:14:14 +0200 Subject: [PATCH 13/28] Hide broken "Apply on Save" feature The feature has always been somewhat experimental, but got even more broken over time. Let's hide it for the time being. Change-Id: If46861831d7fb7ed8e9b77b79d1ebe583243ab48 Reviewed-by: Leena Miettinen Reviewed-by: hjk --- doc/src/debugger/qtquick-debugging.qdoc | 5 +++++ src/plugins/debugger/debuggerplugin.cpp | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/doc/src/debugger/qtquick-debugging.qdoc b/doc/src/debugger/qtquick-debugging.qdoc index 7bb43fb0658..f7f6414653c 100644 --- a/doc/src/debugger/qtquick-debugging.qdoc +++ b/doc/src/debugger/qtquick-debugging.qdoc @@ -167,12 +167,17 @@ \section1 Applying QML Changes at Runtime + \omit + // currently broken & disabled + If you change property values or add properties in the code editor, the debugger can update the properties in the running application when you save the file. This is enabled by default. To disable it, click the \inlineimage qml-observer-bar-reload.png "Apply Changes on Save button" (\gui {Apply Changes on Save}) button on the toolbar. + \endomit + When you change property values in the \gui {QML/JS Console} or in the \gui {Locals and Expressions} view, they are immediately updated in the running application, but not in the source code. diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 60ab8baa4b0..76abafbbb40 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -3197,13 +3197,14 @@ void DebuggerPluginPrivate::extensionsInitialized() debugMenu->addSeparator(globalcontext); - QAction *qmlUpdateOnSaveDummyAction = new QAction(tr("Apply Changes on Save"), this); - qmlUpdateOnSaveDummyAction->setCheckable(true); - qmlUpdateOnSaveDummyAction->setIcon(QIcon(_(":/debugger/images/qml/apply-on-save.png"))); - qmlUpdateOnSaveDummyAction->setEnabled(false); - cmd = ActionManager::registerAction(qmlUpdateOnSaveDummyAction, Constants::QML_UPDATE_ON_SAVE, - globalcontext); - debugMenu->addAction(cmd); + // currently broken +// QAction *qmlUpdateOnSaveDummyAction = new QAction(tr("Apply Changes on Save"), this); +// qmlUpdateOnSaveDummyAction->setCheckable(true); +// qmlUpdateOnSaveDummyAction->setIcon(QIcon(_(":/debugger/images/qml/apply-on-save.png"))); +// qmlUpdateOnSaveDummyAction->setEnabled(false); +// cmd = ActionManager::registerAction(qmlUpdateOnSaveDummyAction, Constants::QML_UPDATE_ON_SAVE, +// globalcontext); +// debugMenu->addAction(cmd); QAction *qmlShowAppOnTopDummyAction = new QAction(tr("Show Application on Top"), this); qmlShowAppOnTopDummyAction->setCheckable(true); @@ -3358,7 +3359,8 @@ void DebuggerPluginPrivate::extensionsInitialized() hbox = new QHBoxLayout(qmlToolbar); hbox->setMargin(0); hbox->setSpacing(0); - hbox->addWidget(toolButton(Constants::QML_UPDATE_ON_SAVE)); + // currently broken + //hbox->addWidget(toolButton(Constants::QML_UPDATE_ON_SAVE)); hbox->addWidget(toolButton(Constants::QML_SHOW_APP_ON_TOP)); hbox->addWidget(new StyledSeparator); hbox->addWidget(toolButton(Constants::QML_SELECTTOOL)); From 7eeaa6851fafa418b4264bc1ee1f6fd20ed6f991 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Thu, 17 Jul 2014 17:39:29 +0200 Subject: [PATCH 14/28] Git: replace "Url" with "URL" in UI text Change-Id: I6cf721e84b33183c97c9db8f98842a461af2f0d1 Reviewed-by: Orgad Shaneh --- src/plugins/git/remotemodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/git/remotemodel.cpp b/src/plugins/git/remotemodel.cpp index 0b1bd7164ce..37655bf5d3a 100644 --- a/src/plugins/git/remotemodel.cpp +++ b/src/plugins/git/remotemodel.cpp @@ -144,7 +144,7 @@ QVariant RemoteModel::headerData(int section, Qt::Orientation orientation, int r if (role != Qt::DisplayRole || orientation != Qt::Horizontal) return QVariant(); - return (section == 0) ? tr("Name") : tr("Url"); + return (section == 0) ? tr("Name") : tr("URL"); } bool RemoteModel::setData(const QModelIndex &index, const QVariant &value, int role) From 3ed30f09cf779c5b50533f460b4ee522c9d0bf3f Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 15 Jul 2014 12:47:15 +0200 Subject: [PATCH 15/28] {Fancy,Debugger}MainWindow: Consolidate dock actions menu population There are several places where the list of dock actions are shown, and at least two where it was created. Change-Id: Ib2c18e602b5d6f57c1b7471bd75f3b989d536600 Reviewed-by: Eike Ziller --- src/libs/utils/fancymainwindow.cpp | 10 ++++----- src/libs/utils/fancymainwindow.h | 2 +- src/plugins/debugger/debuggermainwindow.cpp | 24 ++++----------------- src/plugins/debugger/debuggermainwindow.h | 1 - 4 files changed, 9 insertions(+), 28 deletions(-) diff --git a/src/libs/utils/fancymainwindow.cpp b/src/libs/utils/fancymainwindow.cpp index 44259411c72..62c3d912555 100644 --- a/src/libs/utils/fancymainwindow.cpp +++ b/src/libs/utils/fancymainwindow.cpp @@ -377,9 +377,9 @@ void FancyMainWindow::showEvent(QShowEvent *event) void FancyMainWindow::contextMenuEvent(QContextMenuEvent *event) { - QMenu *menu = createPopupMenu(); - menu->exec(event->globalPos()); - delete menu; + QMenu menu; + addDockActionsToMenu(&menu); + menu.exec(event->globalPos()); } void FancyMainWindow::handleVisibilityChanged(bool visible) @@ -448,7 +448,7 @@ static bool actionLessThan(const QAction *action1, const QAction *action2) return action1->text().toLower() < action2->text().toLower(); } -QMenu *FancyMainWindow::createPopupMenu() +void FancyMainWindow::addDockActionsToMenu(QMenu *menu) { QList actions; QList dockwidgets = findChildren(); @@ -460,12 +460,10 @@ QMenu *FancyMainWindow::createPopupMenu() } } qSort(actions.begin(), actions.end(), actionLessThan); - QMenu *menu = new QMenu(this); foreach (QAction *action, actions) menu->addAction(action); menu->addAction(&d->m_menuSeparator); menu->addAction(&d->m_resetLayoutAction); - return menu; } QAction *FancyMainWindow::menuSeparator() const diff --git a/src/libs/utils/fancymainwindow.h b/src/libs/utils/fancymainwindow.h index 736e6ce9b51..8d2bb27e45f 100644 --- a/src/libs/utils/fancymainwindow.h +++ b/src/libs/utils/fancymainwindow.h @@ -67,7 +67,7 @@ public: QAction *resetLayoutAction() const; // Overwritten to add locked/reset. - virtual QMenu *createPopupMenu(); + void addDockActionsToMenu(QMenu *menu); QDockWidget *toolBarDockWidget() const; void setToolBarDockWidget(QDockWidget *dock); diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index 190b0152b2c..fd1fbf490ce 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -128,7 +128,6 @@ public: DebuggerLanguages m_engineDebugLanguages; ActionContainer *m_viewsMenu; - QList m_menuCommandsToAdd; Project *m_previousProject; Target *m_previousTarget; @@ -319,10 +318,6 @@ void DebuggerMainWindowPrivate::createViewsMenuItems() "Debugger.Views.Separator", debugcontext); cmd->setAttribute(Command::CA_Hide); m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); - cmd = Core::ActionManager::registerAction(q->resetLayoutAction(), - "Debugger.Views.ResetSimple", debugcontext); - cmd->setAttribute(Command::CA_Hide); - m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); } void DebuggerMainWindowPrivate::addLanguage(DebuggerLanguage languageId, @@ -410,7 +405,6 @@ QDockWidget *DebuggerMainWindow::createDockWidget(const DebuggerLanguage &langua Command *cmd = Core::ActionManager::registerAction(toggleViewAction, Core::Id("Debugger.").withSuffix(widget->objectName()), globalContext); cmd->setAttribute(Command::CA_Hide); - d->m_menuCommandsToAdd.append(cmd); dockWidget->installEventFilter(&d->m_resizeEventFilter); @@ -426,12 +420,7 @@ QDockWidget *DebuggerMainWindow::createDockWidget(const DebuggerLanguage &langua void DebuggerMainWindow::addStagedMenuEntries() { - Utils::sort(d->m_menuCommandsToAdd, [](Command *cmd1, Command *cmd2) { - return cmd1->action()->text() < cmd2->action()->text(); - }); - foreach (Command *cmd, d->m_menuCommandsToAdd) - d->m_viewsMenu->addAction(cmd); - d->m_menuCommandsToAdd.clear(); + addDockActionsToMenu(d->m_viewsMenu->menu()); } QWidget *DebuggerMainWindow::createContents(IMode *mode) @@ -543,9 +532,9 @@ void DebuggerMainWindow::writeSettings() const void DebuggerMainWindow::showViewsMenu() { - QMenu *menu = createPopupMenu(); - menu->exec(d->m_viewButton->mapToGlobal(QPoint())); - delete menu; + QMenu menu; + addDockActionsToMenu(&menu); + menu.exec(d->m_viewButton->mapToGlobal(QPoint())); } void DebuggerMainWindow::readSettings() @@ -613,11 +602,6 @@ bool DebuggerMainWindowPrivate::isQmlActive() const return (m_activeDebugLanguages & QmlLanguage); } -QMenu *DebuggerMainWindow::createPopupMenu() -{ - return FancyMainWindow::createPopupMenu(); -} - void DebuggerMainWindowPrivate::setSimpleDockWidgetArrangement() { using namespace Constants; diff --git a/src/plugins/debugger/debuggermainwindow.h b/src/plugins/debugger/debuggermainwindow.h index 6ebc2e5c9c2..1336659aae3 100644 --- a/src/plugins/debugger/debuggermainwindow.h +++ b/src/plugins/debugger/debuggermainwindow.h @@ -86,7 +86,6 @@ public: void addStagedMenuEntries(); QWidget *createContents(Core::IMode *mode); - QMenu *createPopupMenu(); void readSettings(); void writeSettings() const; From aef20d43e1dd309470ea3297df496ef97f10d5aa Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 17 Jul 2014 17:22:37 +0200 Subject: [PATCH 16/28] Debugger: More robust approach for DebuggerToolTipTreeView::computeSize model() == 0 should not happen, but the bugreport indicates there was something wrong at a time. Task-number: QTCREATORBUG-12692 Change-Id: Ie850dfc1177d968c39ffae74af89ae1bab44703c Reviewed-by: hjk --- src/plugins/debugger/debuggertooltipmanager.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp index b4034c522f9..2b5afab64a8 100644 --- a/src/plugins/debugger/debuggertooltipmanager.cpp +++ b/src/plugins/debugger/debuggertooltipmanager.cpp @@ -999,14 +999,14 @@ int DebuggerToolTipTreeView::computeHeight(const QModelIndex &index) const void DebuggerToolTipTreeView::computeSize() { - WatchTreeView::reexpand(this, model()->index(0, 0)); int columns = 30; // Decoration int rows = 0; bool rootDecorated = false; - if (model()) { - const int columnCount = model()->columnCount(); - rootDecorated = model()->rowCount() > 0; + if (QAbstractItemModel *m = model()) { + WatchTreeView::reexpand(this, m->index(0, 0)); + const int columnCount = m->columnCount(); + rootDecorated = m->rowCount() > 0; if (rootDecorated) for (int i = 0; i < columnCount; ++i) { resizeColumnToContents(i); @@ -1020,6 +1020,7 @@ void DebuggerToolTipTreeView::computeSize() // Add a bit of space to account for tooltip border, and not // touch the border of the screen. QPoint pos(x(), y()); + QTC_ASSERT(QApplication::desktop(), return); QRect desktopRect = QApplication::desktop()->availableGeometry(pos); const int maxWidth = desktopRect.right() - pos.x() - 5 - 5; const int maxHeight = desktopRect.bottom() - pos.y() - 5 - 5; From 60d7b23d88b15ed87173eb3b0e97f9d923a19253 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 14 Jul 2014 14:45:51 +0200 Subject: [PATCH 17/28] QmlInspector: Use categorized debugging Change-Id: I551d2b65bbd1734847b7e995e0f95e906d116497 Reviewed-by: hjk --- .../debugger/qml/qmlinspectoragent.cpp | 137 ++++++++---------- 1 file changed, 57 insertions(+), 80 deletions(-) diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp index b506d75acb5..af890178044 100644 --- a/src/plugins/debugger/qml/qmlinspectoragent.cpp +++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -47,9 +48,7 @@ using namespace QmlDebug::Constants; namespace Debugger { namespace Internal { -enum { - debug = false -}; +Q_LOGGING_CATEGORY(qmlInspectorLog, "qtc.dbg.qmlinspector") /*! * DebuggerAgent updates the watchhandler with the object tree data. @@ -76,9 +75,9 @@ quint32 QmlInspectorAgent::queryExpressionResult(int debugId, if (!m_engineClient) return 0; - if (debug) - qDebug() << __FUNCTION__ << '(' << debugId << expression - << m_engine.debugId() << ')'; + qCDebug(qmlInspectorLog) + << __FUNCTION__ << '(' << debugId << expression + << m_engine.debugId() << ')'; return m_engineClient->queryExpressionResult(debugId, expression, m_engine.debugId()); @@ -87,8 +86,8 @@ quint32 QmlInspectorAgent::queryExpressionResult(int debugId, void QmlInspectorAgent::assignValue(const WatchData *data, const QString &expr, const QVariant &valueV) { - if (debug) - qDebug() << __FUNCTION__ << '(' << data->id << ')' << data->iname; + qCDebug(qmlInspectorLog) + << __FUNCTION__ << '(' << data->id << ')' << data->iname; if (data->id) { QString val(valueV.toString()); @@ -114,8 +113,7 @@ int parentIdForIname(const QByteArray &iname) void QmlInspectorAgent::updateWatchData(const WatchData &data) { - if (debug) - qDebug() << __FUNCTION__ << '(' << data.id << ')'; + qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << data.id << ')'; if (data.id && !m_fetchDataIds.contains(data.id)) { // objects @@ -126,8 +124,7 @@ void QmlInspectorAgent::updateWatchData(const WatchData &data) void QmlInspectorAgent::watchDataSelected(const WatchData *data) { - if (debug) - qDebug() << __FUNCTION__ << '(' << data->id << ')'; + qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << data->id << ')'; if (data->id) { QTC_ASSERT(m_debugIdLocations.keys().contains(data->id), return); @@ -137,17 +134,14 @@ void QmlInspectorAgent::watchDataSelected(const WatchData *data) bool QmlInspectorAgent::selectObjectInTree(int debugId) { - if (debug) { - qDebug() << __FUNCTION__ << '(' << debugId << ')'; - qDebug() << " " << debugId << "already fetched? " - << m_debugIdToIname.contains(debugId); - } + qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << debugId << ')' << endl + << " " << debugId << "already fetched? " + << m_debugIdToIname.contains(debugId); if (m_debugIdToIname.contains(debugId)) { QByteArray iname = m_debugIdToIname.value(debugId); QTC_ASSERT(iname.startsWith("inspect."), qDebug() << iname); - if (debug) - qDebug() << " selecting" << iname << "in tree"; + qCDebug(qmlInspectorLog) << " selecting" << iname << "in tree"; m_debuggerEngine->watchHandler()->setCurrentItem(iname); m_objectToSelect = 0; return true; @@ -173,9 +167,9 @@ quint32 QmlInspectorAgent::setBindingForObject(int objectDebugId, QString source, int line) { - if (debug) - qDebug() << __FUNCTION__ << '(' << objectDebugId << propertyName - << value.toString() << isLiteralValue << source << line << ')'; + qCDebug(qmlInspectorLog) + << __FUNCTION__ << '(' << objectDebugId << propertyName + << value.toString() << isLiteralValue << source << line << ')'; if (objectDebugId == -1) return 0; @@ -205,9 +199,9 @@ quint32 QmlInspectorAgent::setMethodBodyForObject(int objectDebugId, const QString &methodName, const QString &methodBody) { - if (debug) - qDebug() << __FUNCTION__ << '(' << objectDebugId - << methodName << methodBody << ')'; + qCDebug(qmlInspectorLog) + << __FUNCTION__ << '(' << objectDebugId << methodName << methodBody + << ')'; if (objectDebugId == -1) return 0; @@ -231,9 +225,9 @@ quint32 QmlInspectorAgent::setMethodBodyForObject(int objectDebugId, quint32 QmlInspectorAgent::resetBindingForObject(int objectDebugId, const QString &propertyName) { - if (debug) - qDebug() << __FUNCTION__ << '(' << objectDebugId - << propertyName << ')'; + qCDebug(qmlInspectorLog) + << __FUNCTION__ << '(' << objectDebugId + << propertyName << ')'; if (objectDebugId == -1) return 0; @@ -332,8 +326,7 @@ QHash QmlInspectorAgent::rootObjectIds() const bool QmlInspectorAgent::addObjectWatch(int objectDebugId) { - if (debug) - qDebug() << __FUNCTION__ << '(' << objectDebugId << ')'; + qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << objectDebugId << ')'; if (objectDebugId == -1) return false; @@ -362,8 +355,7 @@ bool QmlInspectorAgent::isObjectBeingWatched(int objectDebugId) bool QmlInspectorAgent::removeObjectWatch(int objectDebugId) { - if (debug) - qDebug() << __FUNCTION__ << '(' << objectDebugId << ')'; + qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << objectDebugId << ')'; if (objectDebugId == -1) return false; @@ -380,8 +372,7 @@ bool QmlInspectorAgent::removeObjectWatch(int objectDebugId) void QmlInspectorAgent::removeAllObjectWatches() { - if (debug) - qDebug() << __FUNCTION__ << "()"; + qCDebug(qmlInspectorLog) << __FUNCTION__ << "()"; foreach (int watchedObject, m_objectWatches) removeObjectWatch(watchedObject); @@ -448,8 +439,7 @@ void QmlInspectorAgent::updateState() void QmlInspectorAgent::onResult(quint32 queryId, const QVariant &value, const QByteArray &type) { - if (debug) - qDebug() << __FUNCTION__ << "() ..."; + qCDebug(qmlInspectorLog) << __FUNCTION__ << "() ..."; if (type == "FETCH_OBJECT_R") { log(LogReceive, _("FETCH_OBJECT_R %1").arg( @@ -494,15 +484,13 @@ void QmlInspectorAgent::onResult(quint32 queryId, const QVariant &value, emit expressionResult(queryId, value); } - if (debug) - qDebug() << __FUNCTION__ << "done"; + qCDebug(qmlInspectorLog) << __FUNCTION__ << "done"; } void QmlInspectorAgent::newObject(int engineId, int /*objectId*/, int /*parentId*/) { - if (debug) - qDebug() << __FUNCTION__ << "()"; + qCDebug(qmlInspectorLog) << __FUNCTION__ << "()"; log(LogReceive, QLatin1String("OBJECT_CREATED")); @@ -520,8 +508,9 @@ void QmlInspectorAgent::onValueChanged(int debugId, const QByteArray &propertyNa ".[properties]." + propertyName; WatchHandler *watchHandler = m_debuggerEngine->watchHandler(); const WatchData *data = watchHandler->findData(iname); - if (debug) - qDebug() << __FUNCTION__ << '(' << debugId << ')' << iname << value.toString(); + qCDebug(qmlInspectorLog) + << __FUNCTION__ << '(' << debugId << ')' << iname + << value.toString(); if (data) { WatchData d(*data); d.value = value.toString(); @@ -531,8 +520,7 @@ void QmlInspectorAgent::onValueChanged(int debugId, const QByteArray &propertyNa void QmlInspectorAgent::reloadEngines() { - if (debug) - qDebug() << __FUNCTION__ << "()"; + qCDebug(qmlInspectorLog) << __FUNCTION__ << "()"; if (!isConnected()) return; @@ -560,8 +548,7 @@ int QmlInspectorAgent::parentIdForObject(int objectDebugId) void QmlInspectorAgent::queryEngineContext() { - if (debug) - qDebug() << __FUNCTION__; + qCDebug(qmlInspectorLog) << __FUNCTION__; if (!isConnected() || !debuggerCore()->boolSetting(ShowQmlObjectTree)) @@ -575,8 +562,7 @@ void QmlInspectorAgent::queryEngineContext() void QmlInspectorAgent::fetchObject(int debugId) { - if (debug) - qDebug() << __FUNCTION__ << '(' << debugId << ')'; + qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << debugId << ')'; if (!isConnected() || !debuggerCore()->boolSetting(ShowQmlObjectTree)) @@ -584,9 +570,8 @@ void QmlInspectorAgent::fetchObject(int debugId) log(LogSend, QLatin1String("FETCH_OBJECT ") + QString::number(debugId)); quint32 queryId = m_engineClient->queryObject(debugId); - if (debug) - qDebug() << __FUNCTION__ << '(' << debugId << ')' - << " - query id" << queryId; + qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << debugId << ')' + << " - query id" << queryId; m_objectTreeQueryIds << queryId; } @@ -595,9 +580,8 @@ void QmlInspectorAgent::fetchContextObjectsForLocation(const QString &file, { // This can be an expensive operation as it may return multiple // objects. Use fetchContextObject() where possible. - if (debug) - qDebug() << __FUNCTION__ << '(' << file << ':' << lineNumber - << ':' << columnNumber << ')'; + qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << file << ':' << lineNumber + << ':' << columnNumber << ')'; if (!isConnected() || !debuggerCore()->boolSetting(ShowQmlObjectTree)) @@ -607,17 +591,15 @@ void QmlInspectorAgent::fetchContextObjectsForLocation(const QString &file, .arg(QString::number(lineNumber)).arg(QString::number(columnNumber))); quint32 queryId = m_engineClient->queryObjectsForLocation(QFileInfo(file).fileName(), lineNumber, columnNumber); - if (debug) - qDebug() << __FUNCTION__ << '(' << file << ':' << lineNumber - << ':' << columnNumber << ')' << " - query id" << queryId; + qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << file << ':' << lineNumber + << ':' << columnNumber << ')' << " - query id" << queryId; m_objectTreeQueryIds << queryId; } void QmlInspectorAgent::updateObjectTree(const ContextReference &context) { - if (debug) - qDebug() << __FUNCTION__ << '(' << context << ')'; + qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << context << ')'; if (!isConnected() || !debuggerCore()->boolSetting(ShowQmlObjectTree)) @@ -632,8 +614,7 @@ void QmlInspectorAgent::updateObjectTree(const ContextReference &context) void QmlInspectorAgent::verifyAndInsertObjectInTree(const ObjectReference &object) { - if (debug) - qDebug() << __FUNCTION__ << '(' << object << ')'; + qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << object << ')'; if (!object.isValid()) return; @@ -680,33 +661,32 @@ void QmlInspectorAgent::verifyAndInsertObjectInTree(const ObjectReference &objec void QmlInspectorAgent::insertObjectInTree(const ObjectReference &object) { - if (debug) - qDebug() << __FUNCTION__ << '(' << object << ')'; + qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << object << ')'; const int objectDebugId = object.debugId(); const int parentId = parentIdForIname(m_debugIdToIname.value(objectDebugId)); QElapsedTimer timeElapsed; QList watchData; - if (debug) + + bool printTime = qmlInspectorLog().isDebugEnabled(); + if (printTime) timeElapsed.start(); watchData.append(buildWatchData(object, m_debugIdToIname.value(parentId), true)); - if (debug) - qDebug() << __FUNCTION__ << "Time: Build Watch Data took " - << timeElapsed.elapsed() << " ms"; - if (debug) + qCDebug(qmlInspectorLog) << __FUNCTION__ << "Time: Build Watch Data took " + << timeElapsed.elapsed() << " ms"; + if (printTime) timeElapsed.start(); buildDebugIdHashRecursive(object); - if (debug) - qDebug() << __FUNCTION__ << "Time: Build Debug Id Hash took " - << timeElapsed.elapsed() << " ms"; + qCDebug(qmlInspectorLog) << __FUNCTION__ << "Time: Build Debug Id Hash took " + << timeElapsed.elapsed() << " ms"; WatchHandler *watchHandler = m_debuggerEngine->watchHandler(); - if (debug) + if (printTime) timeElapsed.start(); watchHandler->insertData(watchData); - if (debug) - qDebug() << __FUNCTION__ << "Time: Insertion took " << timeElapsed.elapsed() << " ms"; + qCDebug(qmlInspectorLog) << __FUNCTION__ << "Time: Insertion took " + << timeElapsed.elapsed() << " ms"; emit objectTreeUpdated(); emit objectFetched(object); @@ -714,8 +694,7 @@ void QmlInspectorAgent::insertObjectInTree(const ObjectReference &object) if (m_debugIdToIname.contains(m_objectToSelect)) { // select item in view QByteArray iname = m_debugIdToIname.value(m_objectToSelect); - if (debug) - qDebug() << " selecting" << iname << "in tree"; + qCDebug(qmlInspectorLog) << " selecting" << iname << "in tree"; watchHandler->setCurrentItem(iname); m_objectToSelect = -1; } @@ -723,8 +702,7 @@ void QmlInspectorAgent::insertObjectInTree(const ObjectReference &object) void QmlInspectorAgent::buildDebugIdHashRecursive(const ObjectReference &ref) { - if (debug) - qDebug() << __FUNCTION__ << '(' << ref << ')'; + qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << ref << ')'; QUrl fileUrl = ref.source().url(); int lineNum = ref.source().lineNumber(); @@ -770,8 +748,7 @@ QList QmlInspectorAgent::buildWatchData(const ObjectReference &obj, const QByteArray &parentIname, bool append) { - if (debug) - qDebug() << __FUNCTION__ << '(' << obj << parentIname << ')'; + qCDebug(qmlInspectorLog) << '(' << obj << parentIname << ')'; QList list; From fe5b3a39e8536a36177e75680aea3b043b310554 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 17 Jul 2014 17:04:02 +0200 Subject: [PATCH 18/28] Core: Refactor handling of "window state" actions out of MainWindow Currently the actions for fullscreen, minimize and zoom only apply to the main window, even if a different window is active. Refactor the handling of these actions into a WindowSupport class, and use that instead for the main window. In a second step, this will be used to add the functionality to the corresponding external windows (e.g. help and editor windows) Change-Id: Ief2c880f40948c3bb724196d6e0cfe888b8ece89 Reviewed-by: Daniel Teske --- src/plugins/coreplugin/coreplugin.pro | 6 +- src/plugins/coreplugin/icore.cpp | 6 ++ src/plugins/coreplugin/icore.h | 3 + src/plugins/coreplugin/mainwindow.cpp | 67 ++++--------- src/plugins/coreplugin/mainwindow.h | 8 +- src/plugins/coreplugin/windowsupport.cpp | 118 +++++++++++++++++++++++ src/plugins/coreplugin/windowsupport.h | 70 ++++++++++++++ 7 files changed, 222 insertions(+), 56 deletions(-) create mode 100644 src/plugins/coreplugin/windowsupport.cpp create mode 100644 src/plugins/coreplugin/windowsupport.h diff --git a/src/plugins/coreplugin/coreplugin.pro b/src/plugins/coreplugin/coreplugin.pro index aa5cda39049..7cda9e211fd 100644 --- a/src/plugins/coreplugin/coreplugin.pro +++ b/src/plugins/coreplugin/coreplugin.pro @@ -100,7 +100,8 @@ SOURCES += mainwindow.cpp \ dialogs/addtovcsdialog.cpp \ icorelistener.cpp \ ioutputpane.cpp \ - patchtool.cpp + patchtool.cpp \ + windowsupport.cpp HEADERS += mainwindow.h \ editmode.h \ @@ -199,7 +200,8 @@ HEADERS += mainwindow.h \ documentmanager.h \ removefiledialog.h \ dialogs/addtovcsdialog.h \ - patchtool.h + patchtool.h \ + windowsupport.h FORMS += dialogs/newdialog.ui \ dialogs/saveitemsdialog.ui \ diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index 5e6cc4613a9..03f1b6969af 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -28,6 +28,7 @@ ****************************************************************************/ #include "icore.h" +#include "windowsupport.h" #include #include @@ -523,6 +524,11 @@ void ICore::removeContextObject(IContext *context) m_mainwindow->removeContextObject(context); } +void ICore::registerWindow(QWidget *window, const Context &context) +{ + new WindowSupport(window, context); // deletes itself when widget is destroyed +} + void ICore::openFiles(const QStringList &arguments, ICore::OpenFilesFlags flags) { m_mainwindow->openFiles(arguments, flags); diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h index 42f28373128..33441ac56ac 100644 --- a/src/plugins/coreplugin/icore.h +++ b/src/plugins/coreplugin/icore.h @@ -109,6 +109,9 @@ public: static void addContextObject(IContext *context); static void removeContextObject(IContext *context); + // manages the minimize, zoom and fullscreen actions for the window + static void registerWindow(QWidget *window, const Context &context); + enum OpenFilesFlags { None = 0, SwitchMode = 1, diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index bfa5bc35ced..8747f55caac 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -54,6 +54,7 @@ #include "statusbarwidget.h" #include "externaltoolmanager.h" #include "editormanager/systemeditor.h" +#include "windowsupport.h" #include #include @@ -111,6 +112,7 @@ MainWindow::MainWindow() : QLatin1String("QtCreator"), this)), m_printer(0), + m_windowSupport(0), m_actionManager(new ActionManager(this)), m_editorManager(0), m_externalToolManager(0), @@ -138,9 +140,6 @@ MainWindow::MainWindow() : m_exitAction(0), m_optionsAction(0), m_toggleSideBarAction(0), - m_toggleFullScreenAction(0), - m_minimizeAction(0), - m_zoomAction(0), m_toggleSideBarButton(new QToolButton) { ActionManager::initialize(); // must be done before registering any actions @@ -236,21 +235,6 @@ void MainWindow::setOverrideColor(const QColor &color) m_overrideColor = color; } -void MainWindow::updateFullScreenAction() -{ - if (isFullScreen()) { - if (Utils::HostOsInfo::isMacHost()) - m_toggleFullScreenAction->setText(tr("Exit Full Screen")); - else - m_toggleFullScreenAction->setChecked(true); - } else { - if (Utils::HostOsInfo::isMacHost()) - m_toggleFullScreenAction->setText(tr("Enter Full Screen")); - else - m_toggleFullScreenAction->setChecked(false); - } -} - bool MainWindow::isNewItemDialogRunning() const { return !m_newDialog.isNull(); @@ -345,6 +329,7 @@ bool MainWindow::init(QString *errorMessage) void MainWindow::extensionsInitialized() { + m_windowSupport = new WindowSupport(this, Context("Core.MainWindow")); m_editorManager->init(); m_statusBarManager->extensionsInitalized(); OutputPaneManager::instance()->init(); @@ -386,6 +371,11 @@ void MainWindow::closeEvent(QCloseEvent *event) m_navigationWidget->closeSubWidgets(); event->accept(); + + // explicitly delete window support, because that calls methods from ICore that call methods + // from mainwindow, so mainwindow still needs to be alive + delete m_windowSupport; + m_windowSupport = 0; } void MainWindow::openDroppedFiles(const QStringList &files) @@ -640,30 +630,29 @@ void MainWindow::registerDefaultActions() if (UseMacShortcuts) { // Minimize Action - m_minimizeAction = new QAction(tr("Minimize"), this); - cmd = ActionManager::registerAction(m_minimizeAction, Constants::MINIMIZE_WINDOW, globalContext); + QAction *minimizeAction = new QAction(tr("Minimize"), this); + minimizeAction->setEnabled(false); // actual implementation in WindowSupport + cmd = ActionManager::registerAction(minimizeAction, Constants::MINIMIZE_WINDOW, globalContext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M"))); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); - connect(m_minimizeAction, SIGNAL(triggered()), this, SLOT(showMinimized())); // Zoom Action - m_zoomAction = new QAction(tr("Zoom"), this); - cmd = ActionManager::registerAction(m_zoomAction, Constants::ZOOM_WINDOW, globalContext); + QAction *zoomAction = new QAction(tr("Zoom"), this); + zoomAction->setEnabled(false); // actual implementation in WindowSupport + cmd = ActionManager::registerAction(zoomAction, Constants::ZOOM_WINDOW, globalContext); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); - connect(m_zoomAction, SIGNAL(triggered()), this, SLOT(showMaximized())); } // Full Screen Action - m_toggleFullScreenAction = new QAction(tr("Full Screen"), this); - m_toggleFullScreenAction->setMenuRole(QAction::NoRole); - m_toggleFullScreenAction->setCheckable(!Utils::HostOsInfo::isMacHost()); - updateFullScreenAction(); - cmd = ActionManager::registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext); + QAction *toggleFullScreenAction = new QAction(tr("Full Screen"), this); + toggleFullScreenAction->setMenuRole(QAction::NoRole); + toggleFullScreenAction->setCheckable(!Utils::HostOsInfo::isMacHost()); + toggleFullScreenAction->setEnabled(false); // actual implementation in WindowSupport + cmd = ActionManager::registerAction(toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Meta+F") : tr("Ctrl+Shift+F11"))); if (Utils::HostOsInfo::isMacHost()) cmd->setAttribute(Command::CA_UpdateText); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); - connect(m_toggleFullScreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen())); if (UseMacShortcuts) mwindow->addSeparator(globalContext, Constants::G_WINDOW_SIZE); @@ -906,15 +895,6 @@ void MainWindow::changeEvent(QEvent *e) qDebug() << "main window activated"; emit windowActivated(); } - } else if (e->type() == QEvent::WindowStateChange) { - if (Utils::HostOsInfo::isMacHost()) { - bool minimized = isMinimized(); - if (debugMainWindow) - qDebug() << "main window state changed to minimized=" << minimized; - m_minimizeAction->setEnabled(!minimized); - m_zoomAction->setEnabled(!minimized); - } - updateFullScreenAction(); } } @@ -1121,15 +1101,6 @@ QPrinter *MainWindow::printer() const return m_printer; } -void MainWindow::toggleFullScreen() -{ - if (isFullScreen()) { - setWindowState(windowState() & ~Qt::WindowFullScreen); - } else { - setWindowState(windowState() | Qt::WindowFullScreen); - } -} - // Display a warning with an additional button to open // the debugger settings dialog if settingsId is nonempty. diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index 5d89286969f..f0ba5ac2de9 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -76,6 +76,7 @@ class ToolSettings; class MimeTypeSettings; class StatusBarManager; class VersionDialog; +class WindowSupport; class SystemEditor; class MainWindow : public Utils::AppMainWindow @@ -107,8 +108,6 @@ public: void setOverrideColor(const QColor &color); - void updateFullScreenAction(); - bool isNewItemDialogRunning() const; signals: @@ -119,7 +118,6 @@ public slots: void newFile(); void openFileWith(); void exit(); - void toggleFullScreen(); void showNewItemDialog(const QString &title, const QList &factories, @@ -167,6 +165,7 @@ private: Context m_additionalContexts; SettingsDatabase *m_settingsDatabase; mutable QPrinter *m_printer; + WindowSupport *m_windowSupport; ActionManager *m_actionManager; EditorManager *m_editorManager; ExternalToolManager *m_externalToolManager; @@ -205,9 +204,6 @@ private: QAction *m_optionsAction; QAction *m_toggleSideBarAction; QAction *m_toggleModeSelectorAction; - QAction *m_toggleFullScreenAction; - QAction *m_minimizeAction; - QAction *m_zoomAction; QToolButton *m_toggleSideBarButton; QColor m_overrideColor; diff --git a/src/plugins/coreplugin/windowsupport.cpp b/src/plugins/coreplugin/windowsupport.cpp new file mode 100644 index 00000000000..be3cf2a01b1 --- /dev/null +++ b/src/plugins/coreplugin/windowsupport.cpp @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "windowsupport.h" + +#include "actionmanager/actionmanager.h" +#include "coreconstants.h" +#include "icore.h" + +#include + +#include +#include +#include + +namespace Core { +namespace Internal { + +WindowSupport::WindowSupport(QWidget *window, const Context &context) + : QObject(window), + m_window(window) +{ + m_window->installEventFilter(this); + + m_contextObject = new IContext(this); + m_contextObject->setWidget(window); + m_contextObject->setContext(context); + ICore::addContextObject(m_contextObject); + + if (UseMacShortcuts) { + m_minimizeAction = new QAction(this); + ActionManager::registerAction(m_minimizeAction, Constants::MINIMIZE_WINDOW, context); + connect(m_minimizeAction, SIGNAL(triggered()), m_window, SLOT(showMinimized())); + + m_zoomAction = new QAction(this); + ActionManager::registerAction(m_zoomAction, Constants::ZOOM_WINDOW, context); + connect(m_zoomAction, SIGNAL(triggered()), m_window, SLOT(showMaximized())); + } + + m_toggleFullScreenAction = new QAction(this); + updateFullScreenAction(); + ActionManager::registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, context); + connect(m_toggleFullScreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen())); +} + +WindowSupport::~WindowSupport() +{ + ICore::removeContextObject(m_contextObject); +} + +bool WindowSupport::eventFilter(QObject *obj, QEvent *event) +{ + if (obj != m_window) + return false; + if (event->type() == QEvent::WindowStateChange) { + if (Utils::HostOsInfo::isMacHost()) { + bool minimized = m_window->isMinimized(); + m_minimizeAction->setEnabled(!minimized); + m_zoomAction->setEnabled(!minimized); + } + updateFullScreenAction(); + } + return false; +} + +void WindowSupport::toggleFullScreen() +{ + if (m_window->isFullScreen()) { + m_window->setWindowState(m_window->windowState() & ~Qt::WindowFullScreen); + } else { + m_window->setWindowState(m_window->windowState() | Qt::WindowFullScreen); + } +} + +void WindowSupport::updateFullScreenAction() +{ + if (m_window->isFullScreen()) { + if (Utils::HostOsInfo::isMacHost()) + m_toggleFullScreenAction->setText(tr("Exit Full Screen")); + else + m_toggleFullScreenAction->setChecked(true); + } else { + if (Utils::HostOsInfo::isMacHost()) + m_toggleFullScreenAction->setText(tr("Enter Full Screen")); + else + m_toggleFullScreenAction->setChecked(false); + } +} + + +} // Internal +} // Core diff --git a/src/plugins/coreplugin/windowsupport.h b/src/plugins/coreplugin/windowsupport.h new file mode 100644 index 00000000000..85d0a6bf718 --- /dev/null +++ b/src/plugins/coreplugin/windowsupport.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef WINDOWSUPPORT_H +#define WINDOWSUPPORT_H + +#include "icontext.h" + +#include + +QT_BEGIN_NAMESPACE +class QAction; +class QWidget; +QT_END_NAMESPACE + +namespace Core { +namespace Internal { + +class WindowSupport : public QObject +{ + Q_OBJECT +public: + WindowSupport(QWidget *window, const Context &context); + ~WindowSupport(); + +protected: + bool eventFilter(QObject *obj, QEvent *event); + +private slots: + void toggleFullScreen(); + void updateFullScreenAction(); + +private: + QWidget *m_window; + IContext *m_contextObject; + QAction *m_minimizeAction; + QAction *m_zoomAction; + QAction *m_toggleFullScreenAction; +}; + +} // Internal +} // Core + +#endif // WINDOWSUPPORT_H From ae2da9a350ee568b80cff93a74e1409ac833f444 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 17 Jul 2014 17:31:57 +0200 Subject: [PATCH 19/28] EditorManager: Add window actions (fullscreen etc) to editor windows Change-Id: I478db8c994cc3126d8d518e3d574e9adfa600ad1 Reviewed-by: Daniel Teske --- .../editormanager/editormanager.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index b9a13dd56dc..a296ef16de3 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -686,9 +686,18 @@ void EditorManager::splitNewWindow(Internal::EditorView *view) else newEditor = editor; // move to the new view splitter = new SplitterOrView; - splitter->setAttribute(Qt::WA_DeleteOnClose); - splitter->setAttribute(Qt::WA_QuitOnClose, false); // don't prevent Qt Creator from closing - splitter->resize(QSize(800, 600)); + QWidget *win = new QWidget; + QVBoxLayout *layout = new QVBoxLayout; + layout->setMargin(0); + layout->setSpacing(0); + win->setLayout(layout); + layout->addWidget(splitter); + win->setFocusProxy(splitter); + win->setAttribute(Qt::WA_DeleteOnClose); + win->setAttribute(Qt::WA_QuitOnClose, false); // don't prevent Qt Creator from closing + win->resize(QSize(800, 600)); + static int windowId = 0; + ICore::registerWindow(win, Context(Id("EditorManager.ExternalWindow.").withSuffix(++windowId))); IContext *context = new IContext; context->setContext(Context(Constants::C_EDITORMANAGER)); context->setWidget(splitter); @@ -696,8 +705,8 @@ void EditorManager::splitNewWindow(Internal::EditorView *view) d->m_root.append(splitter); d->m_rootContext.append(context); connect(splitter, SIGNAL(destroyed(QObject*)), m_instance, SLOT(rootDestroyed(QObject*))); - splitter->show(); - ICore::raiseWindow(splitter); + win->show(); + ICore::raiseWindow(win); if (newEditor) m_instance->activateEditor(splitter->view(), newEditor, IgnoreNavigationHistory); else From d54731b500a608fa428950340d37959def65d3a3 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 17 Jul 2014 17:35:20 +0200 Subject: [PATCH 20/28] Help: Add window actions (fullscreen etc) to external help window Change-Id: I1486bdac965e92990013e77c9ea4d26727dff0f9 Reviewed-by: Daniel Teske --- src/plugins/help/helpwidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/help/helpwidget.cpp b/src/plugins/help/helpwidget.cpp index 791ce0c3356..a126c5e30f7 100644 --- a/src/plugins/help/helpwidget.cpp +++ b/src/plugins/help/helpwidget.cpp @@ -158,6 +158,9 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget layout->addWidget(toolButton(close)); m_viewer->setOpenInNewWindowActionVisible(false); } else if (style == ExternalWindow) { + static int windowId = 0; + Core::ICore::registerWindow(this, + Core::Context(Core::Id("Help.Window.").withSuffix(++windowId))); setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_QuitOnClose, false); // don't prevent Qt Creator from closing connect(m_viewer, SIGNAL(titleChanged()), this, SLOT(updateWindowTitle())); From 3ada46983d71ee3d452e92cb3dd00f562a04d421 Mon Sep 17 00:00:00 2001 From: Thomas Otto Date: Wed, 16 Jul 2014 13:57:22 +0200 Subject: [PATCH 21/28] LoadCoreDialog: widget focus order fixes - On Tab the widget focus now jumps left-to-right--top-to-bottom Change-Id: I3ebf56f4f4b3325ed60c9667bbdbbe6f77d3f9cb Reviewed-by: hjk --- src/plugins/debugger/loadcoredialog.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/plugins/debugger/loadcoredialog.cpp b/src/plugins/debugger/loadcoredialog.cpp index 0f89a87b3ed..a19b902117e 100644 --- a/src/plugins/debugger/loadcoredialog.cpp +++ b/src/plugins/debugger/loadcoredialog.cpp @@ -226,37 +226,37 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent) setWindowTitle(tr("Load Core File")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); + d->buttonBox = new QDialogButtonBox(this); + d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); + d->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); + d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); + d->kitChooser = new DebuggerKitChooser(DebuggerKitChooser::RemoteDebugging, this); d->kitChooser->populate(); - d->selectRemoteCoreButton = new QPushButton(tr("Browse..."), this); - d->remoteCoreFileName = new QLineEdit(this); - d->forceLocalCheckBox = new QCheckBox(this); d->forceLocalLabel = new QLabel(this); d->forceLocalLabel->setText(tr("Use local core file:")); d->forceLocalLabel->setBuddy(d->forceLocalCheckBox); - d->localExecFileName = new PathChooser(this); - d->localExecFileName->setHistoryCompleter(QLatin1String("LocalExecutable")); - d->localExecFileName->setExpectedKind(PathChooser::File); - d->localExecFileName->setPromptDialogTitle(tr("Select Executable")); + d->remoteCoreFileName = new QLineEdit(this); + d->selectRemoteCoreButton = new QPushButton(tr("Browse..."), this); d->localCoreFileName = new PathChooser(this); d->localCoreFileName->setHistoryCompleter(QLatin1String("Debugger.CoreFile.History")); d->localCoreFileName->setExpectedKind(PathChooser::File); d->localCoreFileName->setPromptDialogTitle(tr("Select Core File")); + d->localExecFileName = new PathChooser(this); + d->localExecFileName->setHistoryCompleter(QLatin1String("LocalExecutable")); + d->localExecFileName->setExpectedKind(PathChooser::File); + d->localExecFileName->setPromptDialogTitle(tr("Select Executable")); + d->overrideStartScriptFileName = new PathChooser(this); d->overrideStartScriptFileName->setHistoryCompleter(QLatin1String("Debugger.StartupScript.History")); d->overrideStartScriptFileName->setExpectedKind(PathChooser::File); d->overrideStartScriptFileName->setPromptDialogTitle(tr("Select Startup Script")); - d->buttonBox = new QDialogButtonBox(this); - d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); - d->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); - d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); - QHBoxLayout *coreLayout = new QHBoxLayout; coreLayout->addWidget(d->localCoreFileName); coreLayout->addWidget(d->remoteCoreFileName); From 5392ba213f93ca6e5028e5f5a3fcfedb80cfd094 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Wed, 16 Jul 2014 16:21:05 +0200 Subject: [PATCH 22/28] iOS: fix UI string capitalization Use book-style capitalization for selection list items and sentence style for field labels. Change-Id: I359dc69e22dd1389cc52377e1df3111a243caa58 Reviewed-by: Fawzi Mohamed --- src/plugins/ios/iosrunconfiguration.ui | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/ios/iosrunconfiguration.ui b/src/plugins/ios/iosrunconfiguration.ui index 24ee510a516..91da8b36223 100644 --- a/src/plugins/ios/iosrunconfiguration.ui +++ b/src/plugins/ios/iosrunconfiguration.ui @@ -48,12 +48,12 @@ - iPhone 3.5-inch Retina display + iPhone 3.5-inch Retina Display - iPhone 4-inch Retina display + iPhone 4-inch Retina Display @@ -63,7 +63,7 @@ - iPad Retina display + iPad Retina Display @@ -71,7 +71,7 @@ - Device Type: + Device type: From 282a45a6cff69aa773382fae87df105591adaa55 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Thu, 17 Jul 2014 17:38:32 +0200 Subject: [PATCH 23/28] Android: apply UI text guidelines to messages Do not use "please". Replace "a image" with "an image". Change-Id: I32614291b3be4c8a9860ddf8036ef5898bf52ce6 Reviewed-by: Daniel Teske --- src/plugins/android/avddialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/android/avddialog.cpp b/src/plugins/android/avddialog.cpp index 8aa54debe36..6a9ef3742d5 100644 --- a/src/plugins/android/avddialog.cpp +++ b/src/plugins/android/avddialog.cpp @@ -102,12 +102,12 @@ void AvdDialog::updateApiLevelComboBox() m_avdDialog.warningIcon->setVisible(true); m_avdDialog.warningText->setVisible(true); m_avdDialog.warningText->setText(tr("Cannot create a new AVD. No sufficiently recent Android SDK available.\n" - "Please install an SDK of at least API version %1.") + "Install an SDK of at least API version %1.") .arg(m_minApiLevel)); } else if (filteredList.isEmpty()) { m_avdDialog.warningIcon->setVisible(true); m_avdDialog.warningText->setVisible(true); - m_avdDialog.warningText->setText(tr("Cannot create a AVD for ABI %1. Please install a image for it.") + m_avdDialog.warningText->setText(tr("Cannot create a AVD for ABI %1. Install an image for it.") .arg(abi())); } else { m_avdDialog.warningIcon->setVisible(false); From 2224f8476d3b7e621e0c59a844895891873b6047 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Thu, 17 Jul 2014 17:41:16 +0200 Subject: [PATCH 24/28] Remote Linux: fix UI text capitalization Use sentence style capitalization for field labels. Change-Id: I5dc9a408f2f707b7c92a04e4facf494b6d69642f Reviewed-by: Christian Kandeler --- .../remotelinux/remotelinuxcustomrunconfigurationwidget.ui | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/remotelinux/remotelinuxcustomrunconfigurationwidget.ui b/src/plugins/remotelinux/remotelinuxcustomrunconfigurationwidget.ui index 273faaefe82..16480f80410 100644 --- a/src/plugins/remotelinux/remotelinuxcustomrunconfigurationwidget.ui +++ b/src/plugins/remotelinux/remotelinuxcustomrunconfigurationwidget.ui @@ -17,7 +17,7 @@ - Local Executable: + Local executable: @@ -27,7 +27,7 @@ - Remote Executable: + Remote executable: @@ -47,7 +47,7 @@ - Working Directory: + Working directory: From 29e312f33e75c2cc40a755803593e389cd0d12ca Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 16 Jul 2014 16:32:11 +0200 Subject: [PATCH 25/28] Debugger: Save width of manually resized tree view columns Task-number: QTCREATORBUG-12670 Change-Id: I5c31ffd6d3bb3060e851df56e9d9a80101df9347 Reviewed-by: Alessandro Portale --- src/libs/utils/basetreeview.cpp | 267 ++++++++++++++++++------ src/libs/utils/basetreeview.h | 16 +- src/plugins/debugger/debuggerplugin.cpp | 16 +- src/plugins/valgrind/callgrindtool.cpp | 5 + 4 files changed, 233 insertions(+), 71 deletions(-) diff --git a/src/libs/utils/basetreeview.cpp b/src/libs/utils/basetreeview.cpp index 5ca1e1bd60f..088e5dc9aeb 100644 --- a/src/libs/utils/basetreeview.cpp +++ b/src/libs/utils/basetreeview.cpp @@ -29,16 +29,188 @@ #include "basetreeview.h" +#include + #include #include #include #include #include +#include #include #include +#include #include namespace Utils { +namespace Internal { + +const char ColumnKey[] = "Columns"; + +class BaseTreeViewPrivate : public QObject +{ + Q_OBJECT + +public: + explicit BaseTreeViewPrivate(BaseTreeView *parent) + : q(parent), m_settings(0), m_expectUserChanges(false) + {} + + bool eventFilter(QObject *, QEvent *event) + { + if (event->type() == QEvent::MouseMove) { + // At this time we don't know which section will get which size. + // But we know that a resizedSection() will be emitted later. + QMouseEvent *me = static_cast(event); + if (me->buttons() & Qt::LeftButton) + m_expectUserChanges = true; + } + return false; + } + + void readSettings() + { + // This only reads setting, does not restore state. + // Storage format is a flat list of column numbers and width. + // Columns not mentioned are resized to content//// + m_userHandled.clear(); + if (m_settings && !m_settingsKey.isEmpty()) { + m_settings->beginGroup(m_settingsKey); + QVariantList l = m_settings->value(QLatin1String(ColumnKey)).toList(); + QTC_ASSERT(l.size() % 2 == 0, qDebug() << m_settingsKey; l.append(0)); + for (int i = 0; i < l.size(); i += 2) { + int column = l.at(i).toInt(); + int width = l.at(i + 1).toInt(); + QTC_ASSERT(column >= 0 && column < 20, qDebug() << m_settingsKey << column; continue); + QTC_ASSERT(width > 0 && width < 10000, qDebug() << m_settingsKey << width; continue); + m_userHandled[column] = width; + } + m_settings->endGroup(); + } + } + + void restoreState() + { + if (m_settings && !m_settingsKey.isEmpty()) { + QHeaderView *h = q->header(); + for (auto it = m_userHandled.constBegin(), et = m_userHandled.constEnd(); it != et; ++it) { + const int column = it.key(); + const int targetSize = it.value(); + const int currentSize = h->sectionSize(column); + if (targetSize > 0 && targetSize != currentSize) + h->resizeSection(column, targetSize); + } + } + } + + void saveState() + { + if (m_settings && !m_settingsKey.isEmpty()) { + m_settings->beginGroup(m_settingsKey); + QVariantList l; + for (auto it = m_userHandled.constBegin(), et = m_userHandled.constEnd(); it != et; ++it) { + const int column = it.key(); + const int width = it.value(); + QTC_ASSERT(column >= 0 && column < q->model()->columnCount(), continue); + QTC_ASSERT(width > 0 && width < 10000, continue); + l.append(column); + l.append(width); + } + m_settings->setValue(QLatin1String(ColumnKey), l); + m_settings->endGroup(); + } + } + + Q_SLOT void handleSectionResized(int logicalIndex, int /*oldSize*/, int newSize) + { + if (m_expectUserChanges) { + m_userHandled[logicalIndex] = newSize; + saveState(); + m_expectUserChanges = false; + } + } + + int suggestedColumnSize(int column) const + { + QHeaderView *h = q->header(); + QTC_ASSERT(h, return -1); + QAbstractItemModel *m = q->model(); + QTC_ASSERT(m, return -1); + + QModelIndex a = q->indexAt(QPoint(1, 1)); + a = a.sibling(a.row(), column); + QFontMetrics fm = q->fontMetrics(); + int minimum = fm.width(m->headerData(column, Qt::Horizontal).toString()); + const int ind = q->indentation(); + for (int i = 0; i < 100 && a.isValid(); ++i) { + const QString s = m->data(a).toString(); + int w = fm.width(s) + 10; + if (column == 0) { + for (QModelIndex b = a.parent(); b.isValid(); b = b.parent()) + w += ind; + } + if (w > minimum) + minimum = w; + a = q->indexBelow(a); + } + return minimum; + } + + Q_SLOT void resizeColumns() + { + QHeaderView *h = q->header(); + QTC_ASSERT(h, return); + + if (m_settings && !m_settingsKey.isEmpty()) { + for (int i = 0, n = h->count(); i != n; ++i) { + int targetSize; + if (m_userHandled.contains(i)) + targetSize = m_userHandled.value(i); + else + targetSize = suggestedColumnSize(i); + const int currentSize = h->sectionSize(i); + if (targetSize > 0 && targetSize != currentSize) + h->resizeSection(i, targetSize); + } + } + } + + Q_SLOT void rowActivatedHelper(const QModelIndex &index) + { + q->rowActivated(index); + } + + Q_SLOT void rowClickedHelper(const QModelIndex &index) + { + q->rowClicked(index); + } + + Q_SLOT void toggleColumnWidth(int logicalIndex) + { + QHeaderView *h = q->header(); + const int currentSize = h->sectionSize(logicalIndex); + const int suggestedSize = suggestedColumnSize(logicalIndex); + int targetSize = suggestedSize; + // We switch to the size suggested by the contents, except + // when we have that size already, in that case minimize. + if (currentSize == suggestedSize) { + QFontMetrics fm = q->fontMetrics(); + int headerSize = fm.width(q->model()->headerData(logicalIndex, Qt::Horizontal).toString()); + int minSize = 10 * fm.width(QLatin1Char('x')); + targetSize = qMax(minSize, headerSize); + } + h->resizeSection(logicalIndex, targetSize); + m_userHandled.remove(logicalIndex); // Reset. + saveState(); + } + +public: + BaseTreeView *q; + QMap m_userHandled; // column -> width, "not present" means "automatic" + QSettings *m_settings; + QString m_settingsKey; + bool m_expectUserChanges; +}; class BaseTreeViewDelegate : public QItemDelegate { @@ -58,8 +230,12 @@ public: } }; +} // namespace Internal + +using namespace Internal; + BaseTreeView::BaseTreeView(QWidget *parent) - : TreeView(parent) + : TreeView(parent), d(new BaseTreeViewPrivate(this)) { setAttribute(Qt::WA_MacShowFocusRect, false); setFrameStyle(QFrame::NoFrame); @@ -68,30 +244,42 @@ BaseTreeView::BaseTreeView(QWidget *parent) setSelectionMode(QAbstractItemView::ExtendedSelection); setUniformRowHeights(true); setItemDelegate(new BaseTreeViewDelegate(this)); - header()->setDefaultAlignment(Qt::AlignLeft); - header()->setClickable(true); + + QHeaderView *h = header(); + h->setDefaultAlignment(Qt::AlignLeft); + h->setClickable(true); + h->viewport()->installEventFilter(d); connect(this, SIGNAL(activated(QModelIndex)), - SLOT(rowActivatedHelper(QModelIndex))); + d, SLOT(rowActivatedHelper(QModelIndex))); connect(this, SIGNAL(clicked(QModelIndex)), - SLOT(rowClickedHelper(QModelIndex))); - connect(header(), SIGNAL(sectionClicked(int)), - SLOT(toggleColumnWidth(int))); + d, SLOT(rowClickedHelper(QModelIndex))); + connect(h, SIGNAL(sectionClicked(int)), + d, SLOT(toggleColumnWidth(int))); + connect(h, SIGNAL(sectionResized(int,int,int)), + d, SLOT(handleSectionResized(int,int,int))); +} + +BaseTreeView::~BaseTreeView() +{ + delete d; } void BaseTreeView::setModel(QAbstractItemModel *m) { + QAbstractItemModel *oldModel = model(); const char *sig = "columnAdjustmentRequested()"; - if (model()) { + if (oldModel) { int index = model()->metaObject()->indexOfSignal(sig); if (index != -1) - disconnect(model(), SIGNAL(columnAdjustmentRequested()), this, SLOT(resizeColumns())); + disconnect(model(), SIGNAL(columnAdjustmentRequested()), d, SLOT(resizeColumns())); } TreeView::setModel(m); if (m) { int index = m->metaObject()->indexOfSignal(sig); if (index != -1) - connect(m, SIGNAL(columnAdjustmentRequested()), this, SLOT(resizeColumns())); + connect(m, SIGNAL(columnAdjustmentRequested()), d, SLOT(resizeColumns())); + d->restoreState(); } } @@ -100,60 +288,15 @@ void BaseTreeView::mousePressEvent(QMouseEvent *ev) TreeView::mousePressEvent(ev); const QModelIndex mi = indexAt(ev->pos()); if (!mi.isValid()) - toggleColumnWidth(columnAt(ev->x())); + d->toggleColumnWidth(columnAt(ev->x())); } -void BaseTreeView::resizeColumns() +void BaseTreeView::setSettings(QSettings *settings, const QByteArray &key) { - QHeaderView *h = header(); - if (!h) - return; - - for (int i = 0, n = h->count(); i != n; ++i) { - int targetSize = suggestedColumnSize(i); - if (targetSize > 0) - h->resizeSection(i, targetSize); - } -} - -int BaseTreeView::suggestedColumnSize(int column) const -{ - QHeaderView *h = header(); - if (!h) - return -1; - - QModelIndex a = indexAt(QPoint(1, 1)); - a = a.sibling(a.row(), column); - QFontMetrics fm(font()); - int m = fm.width(model()->headerData(column, Qt::Horizontal).toString()); - const int ind = indentation(); - for (int i = 0; i < 100 && a.isValid(); ++i) { - const QString s = model()->data(a).toString(); - int w = fm.width(s) + 10; - if (column == 0) { - for (QModelIndex b = a.parent(); b.isValid(); b = b.parent()) - w += ind; - } - if (w > m) - m = w; - a = indexBelow(a); - } - return m; -} - -void BaseTreeView::toggleColumnWidth(int logicalIndex) -{ - QHeaderView *h = header(); - const int currentSize = h->sectionSize(logicalIndex); - const int suggestedSize = suggestedColumnSize(logicalIndex); - if (currentSize == suggestedSize) { - QFontMetrics fm(font()); - int headerSize = fm.width(model()->headerData(logicalIndex, Qt::Horizontal).toString()); - int minSize = 10 * fm.width(QLatin1Char('x')); - h->resizeSection(logicalIndex, qMax(minSize, headerSize)); - } else { - h->resizeSection(logicalIndex, suggestedSize); - } + QTC_ASSERT(!d->m_settings, qDebug() << "DUPLICATED setSettings" << key); + d->m_settings = settings; + d->m_settingsKey = QString::fromLatin1(key); + d->readSettings(); } QModelIndexList BaseTreeView::activeRows() const @@ -169,3 +312,5 @@ QModelIndexList BaseTreeView::activeRows() const } } // namespace Utils + +#include "basetreeview.moc" diff --git a/src/libs/utils/basetreeview.h b/src/libs/utils/basetreeview.h index 123839ce775..d80837d9c0b 100644 --- a/src/libs/utils/basetreeview.h +++ b/src/libs/utils/basetreeview.h @@ -34,15 +34,23 @@ #include "itemviews.h" +QT_BEGIN_NAMESPACE +class QSettings; +QT_END_NAMESPACE + namespace Utils { +namespace Internal { class BaseTreeViewPrivate; } + class QTCREATOR_UTILS_EXPORT BaseTreeView : public TreeView { Q_OBJECT public: BaseTreeView(QWidget *parent = 0); + ~BaseTreeView(); + void setSettings(QSettings *settings, const QByteArray &key); QModelIndexList activeRows() const; void setModel(QAbstractItemModel *model); @@ -51,16 +59,10 @@ public: void mousePressEvent(QMouseEvent *ev); public slots: - void resizeColumns(); void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); } -private slots: - void rowActivatedHelper(const QModelIndex &index) { rowActivated(index); } - void rowClickedHelper(const QModelIndex &index) { rowClicked(index); } - void toggleColumnWidth(int logicalIndex); - private: - int suggestedColumnSize(int column) const; + Internal::BaseTreeViewPrivate *d; }; } // namespace Utils diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 76abafbbb40..284b513a458 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -834,7 +834,6 @@ public slots: m_returnView->header()->resizeSection(section, newSize); } - void sourceFilesDockToggled(bool on) { if (on && m_currentEngine->state() == InferiorStopOk) @@ -2762,6 +2761,8 @@ void DebuggerPluginPrivate::extensionsInitialized() { const QKeySequence debugKey = QKeySequence(UseMacShortcuts ? tr("Ctrl+Y") : tr("F5")); + QSettings *settings = Core::ICore::settings(); + m_debuggerSettings = new DebuggerSettings; m_debuggerSettings->readSettings(); @@ -2794,39 +2795,48 @@ void DebuggerPluginPrivate::extensionsInitialized() m_breakHandler = new BreakHandler; m_breakView = new BreakTreeView; + m_breakView->setSettings(settings, "Debugger.BreakWindow"); m_breakView->setModel(m_breakHandler->model()); m_breakWindow = addSearch(m_breakView, tr("Breakpoints"), DOCKWIDGET_BREAK); m_modulesView = new ModulesTreeView; + m_modulesView->setSettings(settings, "Debugger.ModulesView"); m_modulesWindow = addSearch(m_modulesView, tr("Modules"), DOCKWIDGET_MODULES); m_registerView = new RegisterTreeView; + m_registerView->setSettings(settings, "Debugger.RegisterView"); m_registerWindow = addSearch(m_registerView, tr("Registers"), DOCKWIDGET_REGISTER); m_stackView = new StackTreeView; + m_stackView->setSettings(settings, "Debugger.StackView"); m_stackWindow = addSearch(m_stackView, tr("Stack"), DOCKWIDGET_STACK); m_sourceFilesView = new SourceFilesTreeView; + m_sourceFilesView->setSettings(settings, "Debugger.SourceFilesView"); m_sourceFilesWindow = addSearch(m_sourceFilesView, tr("Source Files"), DOCKWIDGET_SOURCE_FILES); m_threadsView = new ThreadsTreeView; + m_threadsView->setSettings(settings, "Debugger.ThreadsView"); m_threadsWindow = addSearch(m_threadsView, tr("Threads"), DOCKWIDGET_THREADS); - m_returnView = new WatchTreeView(ReturnType); + m_returnView = new WatchTreeView(ReturnType); // No settings. m_returnWindow = addSearch(m_returnView, tr("Locals and Expressions"), "CppDebugReturn"); m_localsView = new WatchTreeView(LocalsType); + m_localsView->setSettings(settings, "Debugger.LocalsView"); m_localsWindow = addSearch(m_localsView, tr("Locals and Expressions"), "CppDebugLocals"); - m_watchersView = new WatchTreeView(WatchersType); + m_watchersView = new WatchTreeView(WatchersType); // No settings. m_watchersWindow = addSearch(m_watchersView, tr("Locals and Expressions"), "CppDebugWatchers"); m_inspectorView = new WatchTreeView(InspectType); + m_inspectorView->setSettings(settings, "Debugger.LocalsView"); // sic! same as locals view. m_inspectorWindow = addSearch(m_inspectorView, tr("Locals and Expressions"), "Inspector"); // Snapshot m_snapshotHandler = new SnapshotHandler; m_snapshotView = new SnapshotTreeView(m_snapshotHandler); + m_snapshotView->setSettings(settings, "Debugger.SnapshotView"); m_snapshotView->setModel(m_snapshotHandler->model()); m_snapshotWindow = addSearch(m_snapshotView, tr("Snapshots"), DOCKWIDGET_SNAPSHOTS); diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index cc1124552a2..6aec7c97095 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -587,6 +587,8 @@ QWidget *CallgrindToolPrivate::createWidgets() { QTC_ASSERT(!m_visualisation, return 0); + QSettings *coreSettings = ICore::settings(); + // // DockWidgets // @@ -600,6 +602,7 @@ QWidget *CallgrindToolPrivate::createWidgets() m_callersView = new CostView(mw); m_callersView->setObjectName(QLatin1String("Valgrind.CallgrindTool.CallersView")); + m_callersView->setSettings(coreSettings, "Valgrind.CallgrindTool.CallersView"); m_callersView->sortByColumn(CallModel::CostColumn); m_callersView->setFrameStyle(QFrame::NoFrame); // enable sorting @@ -612,6 +615,7 @@ QWidget *CallgrindToolPrivate::createWidgets() m_calleesView = new CostView(mw); m_calleesView->setObjectName(QLatin1String("Valgrind.CallgrindTool.CalleesView")); + m_calleesView->setSettings(coreSettings, "Valgrind.CallgrindTool.CalleesView"); m_calleesView->sortByColumn(CallModel::CostColumn); m_calleesView->setFrameStyle(QFrame::NoFrame); // enable sorting @@ -624,6 +628,7 @@ QWidget *CallgrindToolPrivate::createWidgets() m_flatView = new CostView(mw); m_flatView->setObjectName(QLatin1String("Valgrind.CallgrindTool.FlatView")); + m_flatView->setSettings(coreSettings, "Valgrind.CallgrindTool.FlatView"); m_flatView->sortByColumn(DataModel::SelfCostColumn); m_flatView->setFrameStyle(QFrame::NoFrame); m_flatView->setAttribute(Qt::WA_MacShowFocusRect, false); From 50f0336c444302d654de96337c2823f3be7231a8 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 18 Jul 2014 10:01:42 +0200 Subject: [PATCH 26/28] Core: Fix qbs build. Change-Id: Idcefac332e3504fee704bb2dc3328bf50c7bd0f2 Reviewed-by: Eike Ziller --- src/plugins/coreplugin/coreplugin.qbs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/coreplugin/coreplugin.qbs b/src/plugins/coreplugin/coreplugin.qbs index 7ea4afa2f82..ea6218ba165 100644 --- a/src/plugins/coreplugin/coreplugin.qbs +++ b/src/plugins/coreplugin/coreplugin.qbs @@ -100,6 +100,7 @@ QtcPlugin { "variablemanager.cpp", "variablemanager.h", "vcsmanager.cpp", "vcsmanager.h", "versiondialog.cpp", "versiondialog.h", + "windowsupport.cpp", "windowsupport.h" ] } From febdfeb92fb77c5d0700e522edaaf470d2ee3416 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 17 Jul 2014 13:53:09 +0300 Subject: [PATCH 27/28] Git: Rename gitBinaryPath => gitExecutable Avoid confusion with gitBinDirectory Change-Id: I335cf6bc82284e02e0652b057f0b80f292d6ddc0 Reviewed-by: Tobias Hunger --- src/plugins/git/changeselectiondialog.cpp | 4 ++-- src/plugins/git/changeselectiondialog.h | 2 +- src/plugins/git/clonewizardpage.cpp | 2 +- src/plugins/git/gerrit/gerritplugin.cpp | 2 +- src/plugins/git/gitclient.cpp | 24 +++++++++++------------ src/plugins/git/gitclient.h | 2 +- src/plugins/git/gitsettings.cpp | 2 +- src/plugins/git/gitsettings.h | 2 +- src/plugins/git/gitversioncontrol.cpp | 2 +- src/plugins/git/mergetool.cpp | 2 +- src/plugins/git/settingspage.cpp | 2 +- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/plugins/git/changeselectiondialog.cpp b/src/plugins/git/changeselectiondialog.cpp index a22c10783ee..f7e41a41f01 100644 --- a/src/plugins/git/changeselectiondialog.cpp +++ b/src/plugins/git/changeselectiondialog.cpp @@ -58,7 +58,7 @@ ChangeSelectionDialog::ChangeSelectionDialog(const QString &workingDirectory, Co , m_command(NoCommand) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - m_gitBinaryPath = GitPlugin::instance()->gitClient()->gitBinaryPath(); + m_gitExecutable = GitPlugin::instance()->gitClient()->gitExecutable(); m_ui->setupUi(this); m_ui->workingDirectoryEdit->setText(workingDirectory); m_gitEnvironment = GitPlugin::instance()->gitClient()->processEnvironment(); @@ -257,7 +257,7 @@ void ChangeSelectionDialog::recalculateDetails() connect(m_process, SIGNAL(finished(int)), this, SLOT(setDetails(int))); - m_process->start(m_gitBinaryPath, args); + m_process->start(m_gitExecutable, args); m_process->closeWriteChannel(); if (!m_process->waitForStarted()) m_ui->detailsText->setPlainText(tr("Error: Could not start Git.")); diff --git a/src/plugins/git/changeselectiondialog.h b/src/plugins/git/changeselectiondialog.h index c1ab0b2b6a0..c5c20221a77 100644 --- a/src/plugins/git/changeselectiondialog.h +++ b/src/plugins/git/changeselectiondialog.h @@ -87,7 +87,7 @@ private: Ui::ChangeSelectionDialog *m_ui; QProcess *m_process; - QString m_gitBinaryPath; + QString m_gitExecutable; QProcessEnvironment m_gitEnvironment; ChangeCommand m_command; QStringListModel *m_changeModel; diff --git a/src/plugins/git/clonewizardpage.cpp b/src/plugins/git/clonewizardpage.cpp index ad942e57ae2..0187e5cfe7b 100644 --- a/src/plugins/git/clonewizardpage.cpp +++ b/src/plugins/git/clonewizardpage.cpp @@ -119,7 +119,7 @@ VcsBase::Command *CloneWizardPage::createCheckoutJob(Utils::FileName *checkoutPa if (d->recursiveCheckBox->isChecked()) args << QLatin1String("--recursive"); args << QLatin1String("--progress") << repository() << checkoutDir; - VcsBase::Command *command = new VcsBase::Command(client->gitBinaryPath(), workingDirectory, + VcsBase::Command *command = new VcsBase::Command(client->gitExecutable(), workingDirectory, client->processEnvironment()); command->addFlags(VcsBase::VcsBasePlugin::MergeOutputChannels); command->addJob(args, -1); diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp index 16b1ff0cf65..c8ef4a94713 100644 --- a/src/plugins/git/gerrit/gerritplugin.cpp +++ b/src/plugins/git/gerrit/gerritplugin.cpp @@ -391,7 +391,7 @@ void GerritPlugin::push() QString GerritPlugin::gitBinary() { bool ok; - const QString git = gitClient()->gitBinaryPath(&ok); + const QString git = gitClient()->gitExecutable(&ok); if (!ok) { VcsBase::VcsBaseOutputWindow::instance()->appendError(tr("Git is not available.")); return QString(); diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 279124a12eb..f0709cecf8f 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -305,7 +305,7 @@ QProcessEnvironment GitDiffHandler::processEnvironment() const QString GitDiffHandler::gitPath() const { - return m_gitClient->gitBinaryPath(); + return m_gitClient->gitExecutable(); } ///////////////////////////////////// @@ -1753,7 +1753,7 @@ void GitClient::branchesForCommit(const QString &revision) DiffEditor::DiffEditorController *controller = qobject_cast(sender()); QString workingDirectory = controller->workingDirectory(); - VcsBase::Command *command = new VcsBase::Command(gitBinaryPath(), workingDirectory, + VcsBase::Command *command = new VcsBase::Command(gitExecutable(), workingDirectory, processEnvironment()); command->setCodec(getSourceCodec(currentDocumentPath())); @@ -2157,7 +2157,7 @@ VcsBase::Command *GitClient::createCommand(const QString &workingDirectory, bool useOutputToWindow, int editorLineNumber) { - VcsBase::Command *command = new VcsBase::Command(gitBinaryPath(), workingDirectory, processEnvironment()); + VcsBase::Command *command = new VcsBase::Command(gitExecutable(), workingDirectory, processEnvironment()); command->setCodec(getSourceCodec(currentDocumentPath())); command->setCookie(QVariant(editorLineNumber)); if (editor) { @@ -2252,7 +2252,7 @@ Utils::SynchronousProcessResponse GitClient::synchronousGit(const QString &worki unsigned flags, QTextCodec *outputCodec) { - return VcsBasePlugin::runVcs(workingDirectory, gitBinaryPath(), gitArguments, + return VcsBasePlugin::runVcs(workingDirectory, gitExecutable(), gitArguments, settings()->intValue(GitSettings::timeoutKey) * 1000, flags, outputCodec, processEnvironment()); } @@ -2263,7 +2263,7 @@ bool GitClient::fullySynchronousGit(const QString &workingDirectory, QByteArray* errorText, unsigned flags) const { - VcsBase::Command command(gitBinaryPath(), workingDirectory, processEnvironment()); + VcsBase::Command command(gitExecutable(), workingDirectory, processEnvironment()); command.addFlags(flags); return command.runFullySynchronous(gitArguments, settings()->intValue(GitSettings::timeoutKey) * 1000, @@ -2543,7 +2543,7 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR void GitClient::launchGitK(const QString &workingDirectory, const QString &fileName) { - const QFileInfo binaryInfo(gitBinaryPath()); + const QFileInfo binaryInfo(gitExecutable()); QDir foundBinDir(binaryInfo.dir()); const bool foundBinDirIsCmdDir = foundBinDir.dirName() == QLatin1String("cmd"); QProcessEnvironment env = processEnvironment(); @@ -2625,7 +2625,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env, bool GitClient::launchGitGui(const QString &workingDirectory) { bool success; - QString gitBinary = gitBinaryPath(&success); + QString gitBinary = gitExecutable(&success); if (success) success = QProcess::startDetached(gitBinary, QStringList(QLatin1String("gui")), workingDirectory); @@ -2638,7 +2638,7 @@ bool GitClient::launchGitGui(const QString &workingDirectory) { Utils::FileName GitClient::gitBinDirectory() { - const QString git = gitBinaryPath(); + const QString git = gitExecutable(); if (git.isEmpty()) return Utils::FileName(); @@ -2654,9 +2654,9 @@ Utils::FileName GitClient::gitBinDirectory() return Utils::FileName::fromString(path); } -QString GitClient::gitBinaryPath(bool *ok, QString *errorMessage) const +QString GitClient::gitExecutable(bool *ok, QString *errorMessage) const { - return settings()->gitBinaryPath(ok, errorMessage); + return settings()->gitExecutable(ok, errorMessage); } QTextCodec *GitClient::encoding(const QString &workingDirectory, const QByteArray &configVar) const @@ -3524,7 +3524,7 @@ GitSettings *GitClient::settings() const // determine version as '(major << 16) + (minor << 8) + patch' or 0. unsigned GitClient::gitVersion(QString *errorMessage) const { - const QString newGitBinary = gitBinaryPath(); + const QString newGitBinary = gitExecutable(); if (m_gitVersionForBinary != newGitBinary && !newGitBinary.isEmpty()) { // Do not execute repeatedly if that fails (due to git // not being installed) until settings are changed. @@ -3537,7 +3537,7 @@ unsigned GitClient::gitVersion(QString *errorMessage) const // determine version as '(major << 16) + (minor << 8) + patch' or 0. unsigned GitClient::synchronousGitVersion(QString *errorMessage) const { - if (gitBinaryPath().isEmpty()) + if (gitExecutable().isEmpty()) return 0; // run git --version diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index c174f812987..31ff87171db 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -136,7 +136,7 @@ public: explicit GitClient(GitSettings *settings); ~GitClient(); - QString gitBinaryPath(bool *ok = 0, QString *errorMessage = 0) const; + QString gitExecutable(bool *ok = 0, QString *errorMessage = 0) const; unsigned gitVersion(QString *errorMessage = 0) const; QString findRepositoryForDirectory(const QString &dir); diff --git a/src/plugins/git/gitsettings.cpp b/src/plugins/git/gitsettings.cpp index 177c49884ab..f04eb78e660 100644 --- a/src/plugins/git/gitsettings.cpp +++ b/src/plugins/git/gitsettings.cpp @@ -70,7 +70,7 @@ GitSettings::GitSettings() declareKey(lastResetIndexKey, 0); } -QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const +QString GitSettings::gitExecutable(bool *ok, QString *errorMessage) const { // Locate binary in path if one is specified, otherwise default // to pathless binary diff --git a/src/plugins/git/gitsettings.h b/src/plugins/git/gitsettings.h index 0c813caee3d..935312c33e5 100644 --- a/src/plugins/git/gitsettings.h +++ b/src/plugins/git/gitsettings.h @@ -62,7 +62,7 @@ public: static const QLatin1String graphLogKey; static const QLatin1String lastResetIndexKey; - QString gitBinaryPath(bool *ok = 0, QString *errorMessage = 0) const; + QString gitExecutable(bool *ok = 0, QString *errorMessage = 0) const; GitSettings &operator = (const GitSettings &s); }; diff --git a/src/plugins/git/gitversioncontrol.cpp b/src/plugins/git/gitversioncontrol.cpp index e4f3808cf3d..8b5ebb1c11e 100644 --- a/src/plugins/git/gitversioncontrol.cpp +++ b/src/plugins/git/gitversioncontrol.cpp @@ -81,7 +81,7 @@ Core::Id GitVersionControl::id() const bool GitVersionControl::isConfigured() const { bool ok = false; - m_client->gitBinaryPath(&ok); + m_client->gitExecutable(&ok); return ok; } diff --git a/src/plugins/git/mergetool.cpp b/src/plugins/git/mergetool.cpp index 5df7b3e32b3..aefb1a687c7 100644 --- a/src/plugins/git/mergetool.cpp +++ b/src/plugins/git/mergetool.cpp @@ -98,7 +98,7 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files) } m_process = new MergeToolProcess(this); m_process->setWorkingDirectory(workingDirectory); - const QString binary = m_gitClient->gitBinaryPath(); + const QString binary = m_gitClient->gitExecutable(); VcsBase::VcsBaseOutputWindow::instance()->appendCommand(workingDirectory, binary, arguments); m_process->start(binary, arguments); if (m_process->waitForStarted()) { diff --git a/src/plugins/git/settingspage.cpp b/src/plugins/git/settingspage.cpp index f4d73051509..4208bba308f 100644 --- a/src/plugins/git/settingspage.cpp +++ b/src/plugins/git/settingspage.cpp @@ -115,7 +115,7 @@ void SettingsPage::apply() if (m_widget->isVisible()) { bool gitFoundOk; QString errorMessage; - newSettings.gitBinaryPath(&gitFoundOk, &errorMessage); + newSettings.gitExecutable(&gitFoundOk, &errorMessage); if (!gitFoundOk) QMessageBox::warning(m_widget, tr("Git Settings"), errorMessage); } From 7dfb7df471ef81a20f45693a2c54a130aca5786a Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 18 Jul 2014 10:35:17 +0200 Subject: [PATCH 28/28] OS X: Add action for closing external windows E.g. editor windows and help windows. There is no automatic system shortcut for this on OS X. Change-Id: I27f1208cde0a6f4b1a6952a7988d00a8481a08a4 Reviewed-by: Daniel Teske --- src/plugins/coreplugin/coreconstants.h | 1 + src/plugins/coreplugin/mainwindow.cpp | 12 +++++++++++- src/plugins/coreplugin/windowsupport.cpp | 10 ++++++++++ src/plugins/coreplugin/windowsupport.h | 3 +++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/coreconstants.h b/src/plugins/coreplugin/coreconstants.h index f517fb618d7..aa07c979e45 100644 --- a/src/plugins/coreplugin/coreconstants.h +++ b/src/plugins/coreplugin/coreconstants.h @@ -103,6 +103,7 @@ const char TOGGLE_FULLSCREEN[] = "QtCreator.ToggleFullScreen"; const char MINIMIZE_WINDOW[] = "QtCreator.MinimizeWindow"; const char ZOOM_WINDOW[] = "QtCreator.ZoomWindow"; +const char CLOSE_WINDOW[] = "QtCreator.CloseWindow"; const char SPLIT[] = "QtCreator.Split"; const char SPLIT_SIDE_BY_SIDE[] = "QtCreator.SplitSideBySide"; diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 8747f55caac..d900c8c5510 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -330,6 +330,7 @@ bool MainWindow::init(QString *errorMessage) void MainWindow::extensionsInitialized() { m_windowSupport = new WindowSupport(this, Context("Core.MainWindow")); + m_windowSupport->setCloseActionEnabled(false); m_editorManager->init(); m_statusBarManager->extensionsInitalized(); OutputPaneManager::instance()->init(); @@ -654,9 +655,18 @@ void MainWindow::registerDefaultActions() cmd->setAttribute(Command::CA_UpdateText); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); - if (UseMacShortcuts) + if (UseMacShortcuts) { mwindow->addSeparator(globalContext, Constants::G_WINDOW_SIZE); + QAction *closeAction = new QAction(tr("Close Window"), this); + closeAction->setEnabled(false); + cmd = ActionManager::registerAction(closeAction, Constants::CLOSE_WINDOW, globalContext); + cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Meta+W"))); + mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); + + mwindow->addSeparator(globalContext, Constants::G_WINDOW_SIZE); + } + // Show Sidebar Action m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)), tr("Show Sidebar"), this); diff --git a/src/plugins/coreplugin/windowsupport.cpp b/src/plugins/coreplugin/windowsupport.cpp index be3cf2a01b1..6f8f23881da 100644 --- a/src/plugins/coreplugin/windowsupport.cpp +++ b/src/plugins/coreplugin/windowsupport.cpp @@ -61,6 +61,10 @@ WindowSupport::WindowSupport(QWidget *window, const Context &context) m_zoomAction = new QAction(this); ActionManager::registerAction(m_zoomAction, Constants::ZOOM_WINDOW, context); connect(m_zoomAction, SIGNAL(triggered()), m_window, SLOT(showMaximized())); + + m_closeAction = new QAction(this); + ActionManager::registerAction(m_closeAction, Constants::CLOSE_WINDOW, context); + connect(m_closeAction, SIGNAL(triggered()), m_window, SLOT(close()), Qt::QueuedConnection); } m_toggleFullScreenAction = new QAction(this); @@ -74,6 +78,12 @@ WindowSupport::~WindowSupport() ICore::removeContextObject(m_contextObject); } +void WindowSupport::setCloseActionEnabled(bool enabled) +{ + if (UseMacShortcuts) + m_closeAction->setEnabled(enabled); +} + bool WindowSupport::eventFilter(QObject *obj, QEvent *event) { if (obj != m_window) diff --git a/src/plugins/coreplugin/windowsupport.h b/src/plugins/coreplugin/windowsupport.h index 85d0a6bf718..2fa4bac9646 100644 --- a/src/plugins/coreplugin/windowsupport.h +++ b/src/plugins/coreplugin/windowsupport.h @@ -49,6 +49,8 @@ public: WindowSupport(QWidget *window, const Context &context); ~WindowSupport(); + void setCloseActionEnabled(bool enabled); + protected: bool eventFilter(QObject *obj, QEvent *event); @@ -61,6 +63,7 @@ private: IContext *m_contextObject; QAction *m_minimizeAction; QAction *m_zoomAction; + QAction *m_closeAction; QAction *m_toggleFullScreenAction; };