diff --git a/doc/images/qtcreator-targets.png b/doc/images/qtcreator-targets.png index 80022ad0e9e..f828eafaa50 100644 Binary files a/doc/images/qtcreator-targets.png and b/doc/images/qtcreator-targets.png differ diff --git a/doc/src/projects/creator-projects-targets.qdoc b/doc/src/projects/creator-projects-targets.qdoc index 2c7aefb6e5c..b3f033cd83b 100644 --- a/doc/src/projects/creator-projects-targets.qdoc +++ b/doc/src/projects/creator-projects-targets.qdoc @@ -91,11 +91,9 @@ if they are installed on the development PC, but were not detected automatically. For more information, see \l{Adding Compilers}. - \o In the \gui {Debugger command} field, specify the path to the - debugger command. On Windows, specify the path to the Windows - Console Debugger executable (32-bit version). - Select \gui {Auto detect} to automatically locate the debugger - command. + \o In the \gui Debugger field, select \gui Manage to automatically + detect a suitable debugger or to edit the currently selected + debugger. For more information, see \l{Selecting the Debugger}. \o In the \gui {Qt version} field, select the Qt version to use for building the project. You can add Qt versions to the list if they @@ -112,4 +110,34 @@ \endlist + \section1 Selecting the Debugger + + To automatically detect a suitable debugger in the \gui Debugger field, + select \gui Manage > \gui {Auto-detect}. This should work for the CDB engine + and for the GDB engine for local debugging on Linux or Mac OS. + + To edit the selected debugger, select \gui Manage > \gui Edit. In the + \gui {Debugger for} dialog, specify the type of debugger to use + (\gui {GDB Engine} or \gui {CDB Engine}) and the path to the debugger + binary. + + For the \gui {CDB Engine} (Windows only), specify the path to the Windows + Console Debugger executable. + + For the \gui {GDB Engine}, specify the path to the GDB executable. The + executable must be built with Python scripting support enabled + (except when debugging on Mac OS). The options you have depend on the + development and target platform: + + \list + + \o For debugging on embedded devices using a different ABI, you must + provide a special executable. + + \o For debugging on Windows using MinGW, select a Windows executable of + GDB with Python scripting enabled. You can download it from + \l{http://builds.qt-project.org/job/gdb-windows}. + + \endlist + */ diff --git a/qtcreator.pri b/qtcreator.pri index 908c453f5ee..1e33eeb2d43 100644 --- a/qtcreator.pri +++ b/qtcreator.pri @@ -3,6 +3,18 @@ QTCREATOR_PRI_INCLUDED = 1 QTCREATOR_VERSION = 2.6.81 +isEqual(QT_MAJOR_VERSION, 5) { + +defineReplace(cleanPath) { + return($$clean_path($$1)) +} + +defineReplace(targetPath) { + return($$shell_path($$1)) +} + +} else { # qt5 + defineReplace(cleanPath) { win32:1 ~= s|\\\\|/|g contains(1, ^/.*):pfx = / @@ -20,6 +32,8 @@ defineReplace(targetPath) { return($$replace(1, /, $$QMAKE_DIR_SEP)) } +} # qt5 + defineReplace(qtLibraryName) { unset(LIBRARY_NAME) LIBRARY_NAME = $$1 @@ -56,6 +70,15 @@ defineTest(minQtVersion) { return(false) } +isEqual(QT_MAJOR_VERSION, 5) { + +# For use in custom compilers which just copy files +defineReplace(stripSrcDir) { + return($$relative_path($$absolute_path($$1, $$OUT_PWD), $$_PRO_FILE_PWD_)) +} + +} else { # qt5 + # For use in custom compilers which just copy files win32:i_flag = i defineReplace(stripSrcDir) { @@ -65,10 +88,12 @@ defineReplace(stripSrcDir) { !contains(1, ^/.*):1 = $$OUT_PWD/$$1 } out = $$cleanPath($$1) - out ~= s|^$$re_escape($$PWD/)||$$i_flag + out ~= s|^$$re_escape($$_PRO_FILE_PWD_/)||$$i_flag return($$out) } +} # qt5 + isEmpty(TEST):CONFIG(debug, debug|release) { !debug_and_release|build_pass { TEST = 1 diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index 909e02b5e06..8edd3b30ca6 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -769,8 +769,11 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name, ClassOrNamespac // Qualified names in general. // Ex.: template class A : public B::Type {}; ClassOrNamespace *binding = this; - if (const Name *qualification = qBaseName->base()) - binding = lookupType(qualification); + if (const Name *qualification = qBaseName->base()) { + const TemplateNameId *baseTemplName = qualification->asTemplateNameId(); + if (!baseTemplName || !compareName(baseTemplName, templ->name())) + binding = lookupType(qualification); + } baseName = qBaseName->name(); if (binding) diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index e14a7e93b8a..3f94652ee66 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -810,8 +810,11 @@ bool Preprocessor::handleIdentifier(PPToken *tk) PPToken oldMarkerTk; if (macro->isFunctionLike()) { - if (!expandFunctionlikeMacros()) + if (!expandFunctionlikeMacros() + // Still expand if this originally started with an object-like macro. + && m_state.m_expansionStatus != Expanding) { return false; + } // Collect individual tokens that form the macro arguments. QVector > allArgTks; diff --git a/src/libs/utils/environment.cpp b/src/libs/utils/environment.cpp index 427b333ceeb..4f697a952a3 100644 --- a/src/libs/utils/environment.cpp +++ b/src/libs/utils/environment.cpp @@ -208,60 +208,60 @@ void Environment::clear() m_values.clear(); } +QString Environment::searchInDirectory(const QStringList &execs, QString directory) const +{ + const QChar slash = QLatin1Char('/'); + if (directory.isEmpty()) + return QString(); + // Avoid turing / into // on windows which triggers windows to check + // for network drives! + if (!directory.endsWith(slash)) + directory += slash; + + foreach (const QString &exec, execs) { + QFileInfo fi(directory + exec); + if (fi.exists() && fi.isFile() && fi.isExecutable()) + return fi.absoluteFilePath(); + } + return QString(); +} + QString Environment::searchInPath(const QString &executable, const QStringList &additionalDirs) const { - QStringList execs; - execs << executable; + QString exec = QDir::cleanPath(expandVariables(executable)); + QFileInfo fi(exec); + if (fi.isAbsolute()) + return exec; + + if (executable.isEmpty()) + return QString(); + + QStringList execs(exec); if (HostOsInfo::isWindowsHost()) { // Check all the executable extensions on windows: - QStringList extensions = value(QLatin1String("PATHEXT")).split(QLatin1Char(';')); + // PATHEXT is only used if the executable has no extension + if (fi.suffix().isEmpty()) { + QStringList extensions = value(QLatin1String("PATHEXT")).split(QLatin1Char(';')); - // .exe.bat is legal (and run when starting new.exe), so always go through the - // complete list once: - foreach (const QString &ext, extensions) - execs << executable + ext.toLower(); + foreach (const QString &ext, extensions) + execs << executable + ext.toLower(); + } } - return searchInPath(execs, additionalDirs); -} -QString Environment::searchInPath(const QStringList &executables, - const QStringList &additionalDirs) const -{ - const QChar slash = QLatin1Char('/'); - foreach (const QString &executable, executables) { - QString exec = QDir::cleanPath(expandVariables(executable)); + foreach (QString dir, additionalDirs) { + QString tmp = searchInDirectory(execs, dir); + if (!tmp.isEmpty()) + return tmp; + } - if (exec.isEmpty()) - continue; + if (executable.indexOf(QLatin1Char('/')) != -1) + return QString(); - QFileInfo baseFi(exec); - if (baseFi.isAbsolute() && baseFi.exists()) - return exec; - - // Check in directories: - foreach (const QString &dir, additionalDirs) { - if (dir.isEmpty()) - continue; - QFileInfo fi(dir + QLatin1Char('/') + exec); - if (fi.isFile() && fi.isExecutable()) - return fi.absoluteFilePath(); - } - - // Check in path: - if (exec.indexOf(slash) != -1) - continue; - foreach (const QString &p, path()) { - QString fp = QDir::fromNativeSeparators(p); - // Avoid turing / into // on windows which triggers windows to check - // for network drives! - if (!fp.endsWith(slash)) - fp += slash; - fp += exec; - const QFileInfo fi(fp); - if (fi.exists() && fi.isExecutable() && !fi.isDir()) - return fi.absoluteFilePath(); - } + foreach (const QString &p, path()) { + QString tmp = searchInDirectory(execs, QDir::fromNativeSeparators(p)); + if (!tmp.isEmpty()) + return tmp; } return QString(); } diff --git a/src/libs/utils/environment.h b/src/libs/utils/environment.h index 423e4be404c..bfc98c31da5 100644 --- a/src/libs/utils/environment.h +++ b/src/libs/utils/environment.h @@ -110,8 +110,7 @@ public: bool operator==(const Environment &other) const; private: - QString searchInPath(const QStringList &executables, - const QStringList &additionalDirs = QStringList()) const; + QString searchInDirectory(const QStringList &execs, QString directory) const; QMap m_values; }; diff --git a/src/plugins/android/androidtoolchain.cpp b/src/plugins/android/androidtoolchain.cpp index cd85cbeeedb..4cacc7de585 100644 --- a/src/plugins/android/androidtoolchain.cpp +++ b/src/plugins/android/androidtoolchain.cpp @@ -159,9 +159,12 @@ QList AndroidToolChain::suggestedMkspecList() const return QList()<< FileName::fromString(QLatin1String("android-g++")); } -QString AndroidToolChain::makeCommand() const +QString AndroidToolChain::makeCommand(const Utils::Environment &env) const { - return HostOsInfo::isWindowsHost() ? QLatin1String("ma-make.exe") : QLatin1String("make"); + QString make = HostOsInfo::isWindowsHost() + ? QLatin1String("ma-make.exe") : QLatin1String("make"); + QString tmp = env.searchInPath(make); + return tmp.isEmpty() ? make : tmp; } void AndroidToolChain::setQtVersionId(int id) diff --git a/src/plugins/android/androidtoolchain.h b/src/plugins/android/androidtoolchain.h index aed65a04517..8af32f1b412 100644 --- a/src/plugins/android/androidtoolchain.h +++ b/src/plugins/android/androidtoolchain.h @@ -56,7 +56,7 @@ public: QVariantMap toMap() const; bool fromMap(const QVariantMap &data); QList suggestedMkspecList() const; - QString makeCommand() const; + QString makeCommand(const Utils::Environment &env) const; void setQtVersionId(int); int qtVersionId() const; diff --git a/src/plugins/autotoolsprojectmanager/makestep.cpp b/src/plugins/autotoolsprojectmanager/makestep.cpp index 15da9b64746..08c06f4cbcf 100644 --- a/src/plugins/autotoolsprojectmanager/makestep.cpp +++ b/src/plugins/autotoolsprojectmanager/makestep.cpp @@ -189,7 +189,7 @@ bool MakeStep::init() pp->setMacroExpander(bc->macroExpander()); pp->setEnvironment(bc->environment()); pp->setWorkingDirectory(bc->buildDirectory()); - pp->setCommand(tc ? tc->makeCommand() : QLatin1String("make")); + pp->setCommand(tc ? tc->makeCommand(bc->environment()) : QLatin1String("make")); pp->setArguments(arguments); setOutputParser(new GnuMakeParser()); @@ -295,6 +295,7 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep) : makeStep, SLOT(setAdditionalArguments(QString))); connect(makeStep, SIGNAL(additionalArgumentsChanged(QString)), this, SLOT(updateDetails())); + connect(m_makeStep->project(), SIGNAL(environmentChanged()), this, SLOT(updateDetails())); } QString MakeStepConfigWidget::displayName() const @@ -320,7 +321,7 @@ void MakeStepConfigWidget::updateDetails() param.setMacroExpander(bc->macroExpander()); param.setEnvironment(bc->environment()); param.setWorkingDirectory(bc->buildDirectory()); - param.setCommand(tc->makeCommand()); + param.setCommand(tc->makeCommand(bc->environment())); param.setArguments(arguments); m_summaryText = param.summary(displayName()); } else { diff --git a/src/plugins/classview/classviewparser.cpp b/src/plugins/classview/classviewparser.cpp index 6fc303219b5..62b3d4ce69e 100644 --- a/src/plugins/classview/classviewparser.cpp +++ b/src/plugins/classview/classviewparser.cpp @@ -619,7 +619,8 @@ QStringList Parser::projectNodeFileList(const ProjectExplorer::FolderNode *node) } foreach(const ProjectExplorer::FolderNode *folder, subFolderNodes) { - if (folder->nodeType() != ProjectExplorer::FolderNodeType) + if (folder->nodeType() != ProjectExplorer::FolderNodeType + && folder->nodeType() != ProjectExplorer::VirtualFolderNodeType) continue; list << projectNodeFileList(folder); } diff --git a/src/plugins/clearcase/ClearCase.pluginspec.in b/src/plugins/clearcase/ClearCase.pluginspec.in index be7a81c163e..3fa41473ec2 100644 --- a/src/plugins/clearcase/ClearCase.pluginspec.in +++ b/src/plugins/clearcase/ClearCase.pluginspec.in @@ -2,9 +2,13 @@ AudioCodes (C) 2012 AudioCodes Ltd. +Commercial Usage + +Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia. + GNU Lesser General Public License Usage -this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. 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. +Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. 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. Version Control ClearCase integration. diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp index 85d770972ff..8c9044a2cc1 100644 --- a/src/plugins/clearcase/clearcaseplugin.cpp +++ b/src/plugins/clearcase/clearcaseplugin.cpp @@ -202,6 +202,7 @@ void ClearCasePlugin::cleanCheckInMessageFile() if (!m_checkInMessageFileName.isEmpty()) { QFile::remove(m_checkInMessageFileName); m_checkInMessageFileName.clear(); + m_checkInView.clear(); } } @@ -496,7 +497,7 @@ bool ClearCasePlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *sub void ClearCasePlugin::diffCheckInFiles(const QStringList &files) { - ccDiffWithPred(files); + ccDiffWithPred(m_checkInView, files); } static inline void setDiffBaseDirectory(Core::IEditor *editor, const QString &db) @@ -563,7 +564,7 @@ ClearCaseSubmitEditor *ClearCasePlugin::openClearCaseSubmitEditor(const QString QTC_CHECK(submitEditor); submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_checkInSelectedAction, m_checkInDiffAction); connect(submitEditor, SIGNAL(diffSelectedFiles(QStringList)), this, SLOT(diffCheckInFiles(QStringList))); - submitEditor->setCheckScriptWorkingDirectory(currentState().topLevel()); + submitEditor->setCheckScriptWorkingDirectory(m_checkInView); return submitEditor; } @@ -738,18 +739,17 @@ QString ClearCasePlugin::ccGetFileVersion(const QString &workingDir, const QStri return runCleartoolSync(workingDir, args).trimmed(); } -void ClearCasePlugin::ccDiffWithPred(const QStringList &files) +void ClearCasePlugin::ccDiffWithPred(const QString &workingDir, const QStringList &files) { if (ClearCase::Constants::debug) qDebug() << Q_FUNC_INFO << files; - QString topLevel = currentState().topLevel(); - const QString source = VcsBase::VcsBaseEditorWidget::getSource(topLevel, files); + const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, files); QTextCodec *codec = source.isEmpty() ? static_cast(0) : VcsBase::VcsBaseEditorWidget::getCodec(source); if ((m_settings.diffType == GraphicalDiff) && (files.count() == 1)) { QString file = files.first(); if (m_statusMap->value(file).status == FileStatus::Hijacked) - diffGraphical(ccGetFileVersion(topLevel, file), file); + diffGraphical(ccGetFileVersion(workingDir, file), file); else diffGraphical(file); return; // done here, diff is opened in a new window @@ -762,7 +762,7 @@ void ClearCasePlugin::ccDiffWithPred(const QStringList &files) QString result; foreach (const QString &file, files) { if (m_statusMap->value(QDir::fromNativeSeparators(file)).status == FileStatus::Hijacked) - result += diffExternal(ccGetFileVersion(topLevel, file), file); + result += diffExternal(ccGetFileVersion(workingDir, file), file); else result += diffExternal(file); } @@ -771,20 +771,20 @@ void ClearCasePlugin::ccDiffWithPred(const QStringList &files) // diff of a single file? re-use an existing view if possible to support // the common usage pattern of continuously changing and diffing a file - const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::DiffOutput, topLevel, files); + const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::DiffOutput, workingDir, files); if (files.count() == 1) { // Show in the same editor if diff has been executed before if (Core::IEditor *existingEditor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) { existingEditor->createNew(result); Core::EditorManager::activateEditor(existingEditor, Core::EditorManager::ModeSwitch); - setDiffBaseDirectory(existingEditor, topLevel); + setDiffBaseDirectory(existingEditor, workingDir); return; } diffname = QDir::toNativeSeparators(files.first()); } const QString title = QString::fromLatin1("cc diff %1").arg(diffname); Core::IEditor *editor = showOutputInEditor(title, result, VcsBase::DiffOutput, source, codec); - setDiffBaseDirectory(editor, topLevel); + setDiffBaseDirectory(editor, workingDir); VcsBase::VcsBaseEditorWidget::tagEditor(editor, tag); ClearCaseEditor *diffEditorWidget = qobject_cast(editor->widget()); QTC_ASSERT(diffEditorWidget, return); @@ -884,7 +884,7 @@ void ClearCasePlugin::diffCurrentFile() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return); - ccDiffWithPred(QStringList(state.relativeCurrentFile())); + ccDiffWithPred(state.topLevel(), QStringList(state.relativeCurrentFile())); } void ClearCasePlugin::startCheckInCurrentFile() @@ -974,6 +974,7 @@ void ClearCasePlugin::startCheckIn(const QString &workingDir, const QStringList return; } m_checkInMessageFileName = saver.fileName(); + m_checkInView = workingDir; // Create a submit editor and set file list ClearCaseSubmitEditor *editor = openClearCaseSubmitEditor(m_checkInMessageFileName); editor->setStatusList(files); @@ -1373,10 +1374,9 @@ bool ClearCasePlugin::vcsCheckIn(const QString &messageFile, const QStringList & if (files.isEmpty()) return true; const QString title = QString::fromLatin1("Checkin %1").arg(files.join(QLatin1String("; "))); - QString workingDir = currentState().topLevel(); typedef QSharedPointer FCBPointer; replaceActivity &= (activity != QLatin1String(Constants::KEEP_ACTIVITY)); - if (replaceActivity && !vcsSetActivity(workingDir, title, activity)) + if (replaceActivity && !vcsSetActivity(m_checkInView, title, activity)) return false; QFile msgFile(messageFile); msgFile.open(QFile::ReadOnly | QFile::Text); @@ -1395,11 +1395,11 @@ bool ClearCasePlugin::vcsCheckIn(const QString &messageFile, const QStringList & args << files; QList blockers; foreach (QString fileName, files) { - FCBPointer fcb(new Core::FileChangeBlocker(QFileInfo(workingDir, fileName).canonicalFilePath())); + FCBPointer fcb(new Core::FileChangeBlocker(QFileInfo(m_checkInView, fileName).canonicalFilePath())); blockers.append(fcb); } const ClearCaseResponse response = - runCleartool(workingDir, args, m_settings.longTimeOutMS(), ShowStdOutInLogWindow); + runCleartool(m_checkInView, args, m_settings.longTimeOutMS(), ShowStdOutInLogWindow); QRegExp checkedIn(QLatin1String("Checked in \\\"([^\"]*)\\\"")); bool anySucceeded = false; int offset = checkedIn.indexIn(response.stdOut); diff --git a/src/plugins/clearcase/clearcaseplugin.h b/src/plugins/clearcase/clearcaseplugin.h index 144dd709b85..3eb060e04b6 100644 --- a/src/plugins/clearcase/clearcaseplugin.h +++ b/src/plugins/clearcase/clearcaseplugin.h @@ -203,7 +203,7 @@ private: bool enableAnnotationContextMenu = false); QString ccGetFileVersion(const QString &workingDir, const QString &file) const; void ccUpdate(const QString &workingDir, const QStringList &relativePaths = QStringList()); - void ccDiffWithPred(const QStringList &files); + void ccDiffWithPred(const QString &workingDir, const QStringList &files); void startCheckIn(const QString &workingDir, const QStringList &files = QStringList()); void cleanCheckInMessageFile(); inline ClearCaseControl *clearCaseControl() const; @@ -221,6 +221,7 @@ private: ClearCaseSettings m_settings; QString m_checkInMessageFileName; + QString m_checkInView; QString m_topLevel; QString m_stream; QString m_view; diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp index 8fa8c0077f5..433f5fc61c9 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp @@ -448,15 +448,15 @@ void CMakeRunPage::runCMake() int index = m_generatorComboBox->currentIndex(); - ProjectExplorer::Kit *p = 0; + ProjectExplorer::Kit *k = 0; if (index >= 0) - p = static_cast(m_generatorComboBox->itemData(index).value()); - if (!p) { + k = static_cast(m_generatorComboBox->itemData(index).value()); + if (!k) { m_output->appendPlainText(tr("No generator selected.")); return; } - ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(p); + ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k); m_runCMake->setEnabled(false); m_argumentsLineEdit->setEnabled(false); diff --git a/src/plugins/cmakeprojectmanager/makestep.cpp b/src/plugins/cmakeprojectmanager/makestep.cpp index cb54f8a4b93..2126d814e21 100644 --- a/src/plugins/cmakeprojectmanager/makestep.cpp +++ b/src/plugins/cmakeprojectmanager/makestep.cpp @@ -151,7 +151,7 @@ bool MakeStep::init() pp->setEnvironment(bc->environment()); pp->setWorkingDirectory(bc->buildDirectory()); if (tc) - pp->setCommand(tc->makeCommand()); + pp->setCommand(tc->makeCommand(bc->environment())); else pp->setCommand(QLatin1String("make")); pp->setArguments(arguments); @@ -283,6 +283,7 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep) connect(pro, SIGNAL(buildTargetsChanged()), this, SLOT(buildTargetsChanged())); + connect(pro, SIGNAL(environmentChanged()), this, SLOT(updateDetails())); } void MakeStepConfigWidget::additionalArgumentsEdited() @@ -336,7 +337,7 @@ void MakeStepConfigWidget::updateDetails() param.setMacroExpander(bc->macroExpander()); param.setEnvironment(bc->environment()); param.setWorkingDirectory(bc->buildDirectory()); - param.setCommand(tc->makeCommand()); + param.setCommand(tc->makeCommand(bc->environment())); param.setArguments(arguments); m_summaryText = param.summary(displayName()); } else { diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp index 7996768fe93..a008d07cf58 100644 --- a/src/plugins/coreplugin/outputpanemanager.cpp +++ b/src/plugins/coreplugin/outputpanemanager.cpp @@ -462,10 +462,14 @@ void OutputPaneManager::setBadgeNumber(int number) void OutputPaneManager::showPage(bool focus, bool ensureSizeHint) { int idx = findIndexForPage(qobject_cast(sender())); - showPage(idx, focus); - if (ensureSizeHint) - if (OutputPanePlaceHolder *ph = OutputPanePlaceHolder::getCurrent()) - ph->ensureSizeHintAsMinimum(); + OutputPanePlaceHolder *ph = OutputPanePlaceHolder::getCurrent(); + if (!ph) + m_buttons.value(idx)->flash(); + else + showPage(idx, focus); + + if (ensureSizeHint && ph) + ph->ensureSizeHintAsMinimum(); } void OutputPaneManager::showPage(int idx, bool focus) @@ -702,6 +706,7 @@ void OutputPaneToggleButton::checkStateSet() void OutputPaneToggleButton::flash(int count) { + setVisible(true); //Start flashing if button is not checked if (!isChecked()) { m_flashTimer->setLoopCount(count); diff --git a/src/plugins/cpptools/insertionpointlocator.cpp b/src/plugins/cpptools/insertionpointlocator.cpp index e03b9e79b64..c739bb64fb4 100644 --- a/src/plugins/cpptools/insertionpointlocator.cpp +++ b/src/plugins/cpptools/insertionpointlocator.cpp @@ -593,21 +593,31 @@ QList InsertionPointLocator::methodDefinition( FindMethodDefinitionInsertPoint finder(doc->translationUnit()); finder(declaration, &line, &column); - // Make sure we have a line before and after the new definition. - const QLatin1String prefix("\n\n"); + // Force empty lines before and after the new definition. + QString prefix; QString suffix; - int firstNonSpace = targetFile->position(line, column); - QChar c = targetFile->charAt(firstNonSpace); - while (c == QLatin1Char(' ') || c == QLatin1Char('\t')) { - ++firstNonSpace; - c = targetFile->charAt(firstNonSpace); - } - if (targetFile->charAt(firstNonSpace) != QChar::ParagraphSeparator) { - suffix.append(QLatin1String("\n\n")); + if (!line) { + // Totally empty file. + line = 1; + column = 1; + prefix = suffix = QLatin1Char('\n'); } else { - ++firstNonSpace; - if (targetFile->charAt(firstNonSpace) != QChar::ParagraphSeparator) - suffix.append(QLatin1Char('\n')); + QTC_ASSERT(column, return result); + + prefix = QLatin1String("\n\n"); + int firstNonSpace = targetFile->position(line, column); + QChar c = targetFile->charAt(firstNonSpace); + while (c == QLatin1Char(' ') || c == QLatin1Char('\t')) { + ++firstNonSpace; + c = targetFile->charAt(firstNonSpace); + } + if (targetFile->charAt(firstNonSpace) != QChar::ParagraphSeparator) { + suffix.append(QLatin1String("\n\n")); + } else { + ++firstNonSpace; + if (targetFile->charAt(firstNonSpace) != QChar::ParagraphSeparator) + suffix.append(QLatin1Char('\n')); + } } result += InsertionLocation(target, prefix, suffix, line, column); diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index 50bd8e64384..0138704dabc 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -137,7 +137,7 @@ bool DebuggerKitChooser::kitMatches(const ProjectExplorer::Kit *k) const QString DebuggerKitChooser::kitToolTip(Kit *k) const { - return DebuggerKitInformation::userOutput(k); + return DebuggerKitInformation::userOutput(DebuggerKitInformation::debuggerItem(k)); } /////////////////////////////////////////////////////////////////////// diff --git a/src/plugins/debugger/debuggerkitconfigwidget.cpp b/src/plugins/debugger/debuggerkitconfigwidget.cpp index 1c69314fa80..9ecd51b7aaa 100644 --- a/src/plugins/debugger/debuggerkitconfigwidget.cpp +++ b/src/plugins/debugger/debuggerkitconfigwidget.cpp @@ -45,10 +45,14 @@ #include #include -#include #include +#include #include #include +#include +#include +#include +#include namespace Debugger { namespace Internal { @@ -67,44 +71,30 @@ DebuggerKitConfigWidget::DebuggerKitConfigWidget(ProjectExplorer::Kit *k, ProjectExplorer::KitConfigWidget(parent), m_kit(k), m_info(ki), - m_comboBox(new QComboBox(this)), + m_dirty(false), m_label(new QLabel(this)), - m_chooser(new Utils::PathChooser(this)) + m_button(new QPushButton(tr("Manage..."), this)) { setToolTip(tr("The debugger to use for this kit.")); - QVBoxLayout *layout = new QVBoxLayout(this); + QHBoxLayout *layout = new QHBoxLayout(this); layout->setMargin(0); - - m_comboBox->addItem(DebuggerKitInformation::debuggerEngineName(GdbEngineType), QVariant(int(GdbEngineType))); - if (ProjectExplorer::Abi::hostAbi().os() == ProjectExplorer::Abi::WindowsOS) { - m_comboBox->addItem(DebuggerKitInformation::debuggerEngineName(CdbEngineType), QVariant(int(CdbEngineType))); - } else { - m_comboBox->addItem(DebuggerKitInformation::debuggerEngineName(LldbEngineType), QVariant(int(LldbEngineType))); - } - layout->addWidget(m_comboBox); - - m_label->setTextInteractionFlags(Qt::TextBrowserInteraction); - m_label->setOpenExternalLinks(true); layout->addWidget(m_label); - m_chooser->setContentsMargins(0, 0, 0, 0); - m_chooser->setExpectedKind(Utils::PathChooser::ExistingCommand); - m_chooser->insertButton(0, tr("Auto detect"), this, SLOT(autoDetectDebugger())); - - layout->addWidget(m_chooser); + // ToolButton with Menu, defaulting to 'Autodetect'. + QMenu *buttonMenu = new QMenu(m_button); + QAction *autoDetectAction = buttonMenu->addAction(tr("Auto-detect")); + connect(autoDetectAction, SIGNAL(triggered()), this, SLOT(autoDetectDebugger())); + QAction *changeAction = buttonMenu->addAction(tr("Edit...")); + connect(changeAction, SIGNAL(triggered()), this, SLOT(showDialog())); + m_button->setMenu(buttonMenu); discard(); - connect(m_chooser, SIGNAL(changed(QString)), this, SIGNAL(dirty())); - connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dirty())); - connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshLabel())); } -void DebuggerKitConfigWidget::addToLayout(QGridLayout *layout, int row) +QWidget *DebuggerKitConfigWidget::buttonWidget() const { - addLabel(layout, row); - layout->addWidget(this, row, WidgetColumn, 3 , 1); - addButtonWidget(layout, row + 2); + return m_button; } QString DebuggerKitConfigWidget::displayName() const @@ -114,47 +104,99 @@ QString DebuggerKitConfigWidget::displayName() const void DebuggerKitConfigWidget::makeReadOnly() { - m_comboBox->setEnabled(false); - m_chooser->setEnabled(false); + m_button->setEnabled(false); } void DebuggerKitConfigWidget::apply() { - DebuggerKitInformation::setDebuggerItem(m_kit, DebuggerKitInformation::DebuggerItem(engineType(), fileName())); + DebuggerKitInformation::setDebuggerItem(m_kit, m_item); + m_dirty = false; } void DebuggerKitConfigWidget::discard() { - const DebuggerKitInformation::DebuggerItem item = DebuggerKitInformation::debuggerItem(m_kit); - setEngineType(item.engineType); - setFileName(item.binary); -} - -bool DebuggerKitConfigWidget::isDirty() const -{ - const DebuggerKitInformation::DebuggerItem item = DebuggerKitInformation::debuggerItem(m_kit); - return item.engineType != engineType() || item.binary != fileName(); -} - -QWidget *DebuggerKitConfigWidget::buttonWidget() const -{ - return m_chooser->buttonAtIndex(1); + doSetItem(DebuggerKitInformation::debuggerItem(m_kit)); + m_dirty = false; } void DebuggerKitConfigWidget::autoDetectDebugger() { - const DebuggerKitInformation::DebuggerItem item = DebuggerKitInformation::autoDetectItem(m_kit); - setEngineType(item.engineType); - setFileName(item.binary); + setItem(DebuggerKitInformation::autoDetectItem(m_kit)); } -DebuggerEngineType DebuggerKitConfigWidget::engineType() const +void DebuggerKitConfigWidget::doSetItem(const DebuggerKitInformation::DebuggerItem &item) +{ + m_item = item; + m_label->setText(DebuggerKitInformation::userOutput(m_item)); +} + +void DebuggerKitConfigWidget::setItem(const DebuggerKitInformation::DebuggerItem &item) +{ + if (m_item != item) { + m_dirty = true; + doSetItem(item); + emit dirty(); + } +} + +void DebuggerKitConfigWidget::showDialog() +{ + DebuggerKitConfigDialog dialog; + dialog.setWindowTitle(tr("Debugger for \"%1\"").arg(m_kit->displayName())); + dialog.setDebuggerItem(m_item); + if (dialog.exec() == QDialog::Accepted) + setItem(dialog.item()); +} + +// ----------------------------------------------------------------------- +// DebuggerKitConfigDialog: +// ----------------------------------------------------------------------- + +DebuggerKitConfigDialog::DebuggerKitConfigDialog(QWidget *parent) + : QDialog(parent) + , m_comboBox(new QComboBox(this)) + , m_label(new QLabel(this)) + , m_chooser(new Utils::PathChooser(this)) +{ + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); + QVBoxLayout *layout = new QVBoxLayout(this); + QFormLayout *formLayout = new QFormLayout; + formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); + + m_comboBox->addItem(DebuggerKitInformation::debuggerEngineName(GdbEngineType), QVariant(int(GdbEngineType))); + if (ProjectExplorer::Abi::hostAbi().os() == ProjectExplorer::Abi::WindowsOS) { + m_comboBox->addItem(DebuggerKitInformation::debuggerEngineName(CdbEngineType), QVariant(int(CdbEngineType))); + } else { + m_comboBox->addItem(DebuggerKitInformation::debuggerEngineName(LldbEngineType), QVariant(int(LldbEngineType))); + } + connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshLabel())); + QLabel *engineTypeLabel = new QLabel(tr("&Engine:")); + engineTypeLabel->setBuddy(m_comboBox); + formLayout->addRow(engineTypeLabel, m_comboBox); + + m_label->setTextInteractionFlags(Qt::TextBrowserInteraction); + m_label->setOpenExternalLinks(true); + formLayout->addRow(m_label); + + QLabel *binaryLabel = new QLabel(tr("&Binary:")); + m_chooser->setExpectedKind(Utils::PathChooser::ExistingCommand); + binaryLabel->setBuddy(m_chooser); + formLayout->addRow(binaryLabel, m_chooser); + layout->addLayout(formLayout); + + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); + connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + layout->addWidget(buttonBox); +} + +DebuggerEngineType DebuggerKitConfigDialog::engineType() const { const int index = m_comboBox->currentIndex(); return static_cast(m_comboBox->itemData(index).toInt()); } -void DebuggerKitConfigWidget::setEngineType(DebuggerEngineType et) +void DebuggerKitConfigDialog::setEngineType(DebuggerEngineType et) { const int size = m_comboBox->count(); for (int i = 0; i < size; ++i) { @@ -166,17 +208,17 @@ void DebuggerKitConfigWidget::setEngineType(DebuggerEngineType et) } } -Utils::FileName DebuggerKitConfigWidget::fileName() const +Utils::FileName DebuggerKitConfigDialog::fileName() const { return m_chooser->fileName(); } -void DebuggerKitConfigWidget::setFileName(const Utils::FileName &fn) +void DebuggerKitConfigDialog::setFileName(const Utils::FileName &fn) { m_chooser->setFileName(fn); } -void DebuggerKitConfigWidget::refreshLabel() +void DebuggerKitConfigDialog::refreshLabel() { QString text; const DebuggerEngineType type = engineType(); @@ -205,5 +247,11 @@ void DebuggerKitConfigWidget::refreshLabel() QStringList(QLatin1String("--version"))); } +void DebuggerKitConfigDialog::setDebuggerItem(const DebuggerKitInformation::DebuggerItem &item) +{ + setEngineType(item.engineType); + setFileName(item.binary); +} + } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/debuggerkitconfigwidget.h b/src/plugins/debugger/debuggerkitconfigwidget.h index 4884ff7bd76..735d02fd01f 100644 --- a/src/plugins/debugger/debuggerkitconfigwidget.h +++ b/src/plugins/debugger/debuggerkitconfigwidget.h @@ -33,10 +33,15 @@ #include -#include "debuggerconstants.h" +#include "debuggerkitinformation.h" -QT_FORWARD_DECLARE_CLASS(QLabel) -QT_FORWARD_DECLARE_CLASS(QComboBox) +#include + +QT_BEGIN_NAMESPACE +class QLabel; +class QComboBox; +class QPushButton; +QT_END_NAMESPACE namespace ProjectExplorer { class Kit; } namespace Utils { @@ -67,23 +72,45 @@ public: void apply(); void discard(); - bool isDirty() const; + bool isDirty() const { return m_dirty; } QWidget *buttonWidget() const; - void addToLayout(QGridLayout *layout, int row); +private slots: + void autoDetectDebugger(); + void showDialog(); + +private: + void setItem(const DebuggerKitInformation::DebuggerItem &item); + void doSetItem(const DebuggerKitInformation::DebuggerItem &item); + + ProjectExplorer::Kit *m_kit; + const DebuggerKitInformation *m_info; + DebuggerKitInformation::DebuggerItem m_item; + bool m_dirty; + QLabel *m_label; + QPushButton *m_button; +}; + +class DebuggerKitConfigDialog : public QDialog +{ + Q_OBJECT +public: + explicit DebuggerKitConfigDialog(QWidget *parent = 0); + + void setDebuggerItem(const DebuggerKitInformation::DebuggerItem &item); + DebuggerKitInformation::DebuggerItem item() const + { return DebuggerKitInformation::DebuggerItem(engineType(), fileName()); } + +private slots: + void refreshLabel(); + +private: DebuggerEngineType engineType() const; void setEngineType(DebuggerEngineType et); Utils::FileName fileName() const; void setFileName(const Utils::FileName &fn); -private slots: - void autoDetectDebugger(); - void refreshLabel(); - -private: - ProjectExplorer::Kit *m_kit; - const DebuggerKitInformation *m_info; QComboBox *m_comboBox; QLabel *m_label; Utils::PathChooser *m_chooser; diff --git a/src/plugins/debugger/debuggerkitinformation.cpp b/src/plugins/debugger/debuggerkitinformation.cpp index 75012379838..c06ed2e1c7b 100644 --- a/src/plugins/debugger/debuggerkitinformation.cpp +++ b/src/plugins/debugger/debuggerkitinformation.cpp @@ -209,10 +209,10 @@ enum DebuggerConfigurationErrors { DebuggerNeedsAbsolutePath = 0x8 }; -static unsigned debuggerConfigurationErrors(const ProjectExplorer::Kit *p) +static unsigned debuggerConfigurationErrors(const ProjectExplorer::Kit *k) { unsigned result = 0; - const DebuggerKitInformation::DebuggerItem item = DebuggerKitInformation::debuggerItem(p); + const DebuggerKitInformation::DebuggerItem item = DebuggerKitInformation::debuggerItem(k); if (item.engineType == NoEngineType || item.binary.isEmpty()) return NoDebugger; @@ -226,36 +226,36 @@ static unsigned debuggerConfigurationErrors(const ProjectExplorer::Kit *p) if (!fi.exists() || fi.isDir()) // We need an absolute path to be able to locate Python on Windows. if (item.engineType == GdbEngineType) - if (const ToolChain *tc = ToolChainKitInformation::toolChain(p)) + if (const ToolChain *tc = ToolChainKitInformation::toolChain(k)) if (tc->targetAbi().os() == Abi::WindowsOS && !fi.isAbsolute()) result |= DebuggerNeedsAbsolutePath; return result; } -bool DebuggerKitInformation::isValidDebugger(const ProjectExplorer::Kit *p) +bool DebuggerKitInformation::isValidDebugger(const ProjectExplorer::Kit *k) { - return debuggerConfigurationErrors(p) == 0; + return debuggerConfigurationErrors(k) == 0; } -QList DebuggerKitInformation::validateDebugger(const ProjectExplorer::Kit *p) +QList DebuggerKitInformation::validateDebugger(const ProjectExplorer::Kit *k) { - const unsigned errors = debuggerConfigurationErrors(p); + const unsigned errors = debuggerConfigurationErrors(k); const Core::Id id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM); QList result; if (errors & NoDebugger) result << Task(Task::Warning, tr("No debugger set up."), FileName(), -1, id); if (errors & DebuggerNotFound) { - const QString path = DebuggerKitInformation::debuggerCommand(p).toUserOutput(); + const QString path = DebuggerKitInformation::debuggerCommand(k).toUserOutput(); result << Task(Task::Error, tr("Debugger '%1' not found.").arg(path), FileName(), -1, id); } if (errors & DebuggerNotExecutable) { - const QString path = DebuggerKitInformation::debuggerCommand(p).toUserOutput(); + const QString path = DebuggerKitInformation::debuggerCommand(k).toUserOutput(); result << Task(Task::Error, tr("Debugger '%1' not executable.").arg(path), FileName(), -1, id); } if (errors & DebuggerNeedsAbsolutePath) { - const QString path = DebuggerKitInformation::debuggerCommand(p).toUserOutput(); + const QString path = DebuggerKitInformation::debuggerCommand(k).toUserOutput(); const QString message = tr("The debugger location must be given as an " "absolute path (%1).").arg(path); @@ -269,16 +269,17 @@ KitConfigWidget *DebuggerKitInformation::createConfigWidget(Kit *k) const return new Internal::DebuggerKitConfigWidget(k, this); } -QString DebuggerKitInformation::userOutput(const ProjectExplorer::Kit *k) +QString DebuggerKitInformation::userOutput(const DebuggerItem &item) { - const DebuggerItem item = DebuggerKitInformation::debuggerItem(k); - return tr("%1 using '%2'").arg(debuggerEngineName(item.engineType), - item.binary.toUserOutput()); + const QString binary = item.binary.toUserOutput(); + return binary.isEmpty() ? + tr("%1 ").arg(debuggerEngineName(item.engineType)) : + tr("%1 using '%2'").arg(debuggerEngineName(item.engineType), binary); } KitInformation::ItemList DebuggerKitInformation::toUserOutput(Kit *k) const { - return ItemList() << qMakePair(tr("Debugger"), DebuggerKitInformation::userOutput(k)); + return ItemList() << qMakePair(tr("Debugger"), DebuggerKitInformation::userOutput(DebuggerKitInformation::debuggerItem(k))); } static const char engineTypeKeyC[] = "EngineType"; @@ -308,17 +309,17 @@ QVariant DebuggerKitInformation::itemToVariant(const DebuggerItem &i) return QVariant(vmap); } -DebuggerKitInformation::DebuggerItem DebuggerKitInformation::debuggerItem(const ProjectExplorer::Kit *p) +DebuggerKitInformation::DebuggerItem DebuggerKitInformation::debuggerItem(const ProjectExplorer::Kit *k) { - return p ? - DebuggerKitInformation::variantToItem(p->value(Core::Id(DEBUGGER_INFORMATION))) : + return k ? + DebuggerKitInformation::variantToItem(k->value(Core::Id(DEBUGGER_INFORMATION))) : DebuggerItem(); } -void DebuggerKitInformation::setDebuggerItem(ProjectExplorer::Kit *p, const DebuggerItem &item) +void DebuggerKitInformation::setDebuggerItem(ProjectExplorer::Kit *k, const DebuggerItem &item) { - QTC_ASSERT(p, return); - p->setValue(Core::Id(DEBUGGER_INFORMATION), itemToVariant(item)); + QTC_ASSERT(k, return); + k->setValue(Core::Id(DEBUGGER_INFORMATION), itemToVariant(item)); } void DebuggerKitInformation::setDebuggerCommand(ProjectExplorer::Kit *k, const FileName &command) @@ -326,9 +327,9 @@ void DebuggerKitInformation::setDebuggerCommand(ProjectExplorer::Kit *k, const F setDebuggerItem(k, DebuggerItem(engineType(k), command)); } -void DebuggerKitInformation::setEngineType(ProjectExplorer::Kit *p, DebuggerEngineType type) +void DebuggerKitInformation::setEngineType(ProjectExplorer::Kit *k, DebuggerEngineType type) { - setDebuggerItem(p, DebuggerItem(type, debuggerCommand(p))); + setDebuggerItem(k, DebuggerItem(type, debuggerCommand(k))); } QString DebuggerKitInformation::debuggerEngineName(DebuggerEngineType t) diff --git a/src/plugins/debugger/debuggerkitinformation.h b/src/plugins/debugger/debuggerkitinformation.h index ceb119d08d5..93f632be76c 100644 --- a/src/plugins/debugger/debuggerkitinformation.h +++ b/src/plugins/debugger/debuggerkitinformation.h @@ -47,6 +47,7 @@ public: public: DebuggerItem(); DebuggerItem(DebuggerEngineType engineType, const Utils::FileName &fn); + bool equals(const DebuggerItem &rhs) const { return engineType == rhs.engineType && binary == rhs.binary; } DebuggerEngineType engineType; Utils::FileName binary; @@ -65,16 +66,16 @@ public: QList validate(ProjectExplorer::Kit *k) const { return DebuggerKitInformation::validateDebugger(k); } - static QList validateDebugger(const ProjectExplorer::Kit *p); - static bool isValidDebugger(const ProjectExplorer::Kit *p); + static QList validateDebugger(const ProjectExplorer::Kit *k); + static bool isValidDebugger(const ProjectExplorer::Kit *k); ProjectExplorer::KitConfigWidget *createConfigWidget(ProjectExplorer::Kit *k) const; ItemList toUserOutput(ProjectExplorer::Kit *k) const; - static QString userOutput(const ProjectExplorer::Kit *k); + static QString userOutput(const DebuggerItem &item); - static DebuggerItem debuggerItem(const ProjectExplorer::Kit *p); - static void setDebuggerItem(ProjectExplorer::Kit *p, const DebuggerItem &item); + static DebuggerItem debuggerItem(const ProjectExplorer::Kit *k); + static void setDebuggerItem(ProjectExplorer::Kit *k, const DebuggerItem &item); static Utils::FileName debuggerCommand(const ProjectExplorer::Kit *p) { return debuggerItem(p).binary; } @@ -84,7 +85,7 @@ public: static DebuggerEngineType engineType(const ProjectExplorer::Kit *p) { return debuggerItem(p).engineType; } - static void setEngineType(ProjectExplorer::Kit *p, DebuggerEngineType type); + static void setEngineType(ProjectExplorer::Kit *k, DebuggerEngineType type); static QString debuggerEngineName(DebuggerEngineType t); @@ -93,6 +94,11 @@ private: static QVariant itemToVariant(const DebuggerItem &i); }; +inline bool operator==(const DebuggerKitInformation::DebuggerItem &i1, const DebuggerKitInformation::DebuggerItem &i2) + { return i1.equals(i2); } +inline bool operator!=(const DebuggerKitInformation::DebuggerItem &i1, const DebuggerKitInformation::DebuggerItem &i2) + { return !i1.equals(i2); } + } // namespace Debugger #endif // DEBUGGER_DEBUGGERKITINFORMATION_H diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index a8a9cb9fc27..5a0623eb246 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -566,11 +566,11 @@ class AbiKitMatcher : public KitMatcher { public: explicit AbiKitMatcher(const QList &abis) : m_abis(abis) {} - bool matches(const Kit *p) const + bool matches(const Kit *k) const { - if (const ToolChain *tc = ToolChainKitInformation::toolChain(p)) { + if (const ToolChain *tc = ToolChainKitInformation::toolChain(k)) { return m_abis.contains(tc->targetAbi()) - && DebuggerKitInformation::isValidDebugger(p); + && DebuggerKitInformation::isValidDebugger(k); } return false; } @@ -583,11 +583,11 @@ class CompatibleAbiKitMatcher : public KitMatcher { public: explicit CompatibleAbiKitMatcher(const QList &abis) : m_abis(abis) {} - bool matches(const Kit *p) const + bool matches(const Kit *k) const { - if (const ToolChain *tc = ToolChainKitInformation::toolChain(p)) + if (const ToolChain *tc = ToolChainKitInformation::toolChain(k)) foreach (const Abi &a, m_abis) - if (a.isCompatibleWith(tc->targetAbi()) && DebuggerKitInformation::isValidDebugger(p)) + if (a.isCompatibleWith(tc->targetAbi()) && DebuggerKitInformation::isValidDebugger(k)) return true; return false; } diff --git a/src/plugins/genericprojectmanager/genericmakestep.cpp b/src/plugins/genericprojectmanager/genericmakestep.cpp index f66b78f9610..1969072ac4b 100644 --- a/src/plugins/genericprojectmanager/genericmakestep.cpp +++ b/src/plugins/genericprojectmanager/genericmakestep.cpp @@ -119,7 +119,7 @@ bool GenericMakeStep::init() pp->setMacroExpander(bc->macroExpander()); pp->setWorkingDirectory(bc->buildDirectory()); pp->setEnvironment(bc->environment()); - pp->setCommand(makeCommand()); + pp->setCommand(makeCommand(bc->environment())); pp->setArguments(allArguments()); // If we are cleaning, then make can fail with an error code, but that doesn't mean @@ -173,13 +173,13 @@ QString GenericMakeStep::allArguments() const return args; } -QString GenericMakeStep::makeCommand() const +QString GenericMakeStep::makeCommand(const Utils::Environment &environment) const { QString command = m_makeCommand; if (command.isEmpty()) { ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit()); if (tc) - command = tc->makeCommand(); + command = tc->makeCommand(environment); else command = QLatin1String("make"); } @@ -264,6 +264,11 @@ GenericMakeStepConfigWidget::GenericMakeStepConfigWidget(GenericMakeStep *makeSt connect(m_makeStep->target(), SIGNAL(kitChanged()), this, SLOT(updateMakeOverrrideLabel())); + + connect(pro, SIGNAL(environmentChanged()), + this, SLOT(updateMakeOverrrideLabel())); + connect(pro, SIGNAL(environmentChanged()), + this, SLOT(updateDetails())); } GenericMakeStepConfigWidget::~GenericMakeStepConfigWidget() @@ -278,7 +283,11 @@ QString GenericMakeStepConfigWidget::displayName() const void GenericMakeStepConfigWidget::updateMakeOverrrideLabel() { - m_ui->makeLabel->setText(tr("Override %1:").arg(m_makeStep->makeCommand())); + GenericBuildConfiguration *bc = m_makeStep->genericBuildConfiguration(); + if (!bc) + bc = static_cast(m_makeStep->target()->activeBuildConfiguration()); + + m_ui->makeLabel->setText(tr("Override %1:").arg(m_makeStep->makeCommand(bc->environment()))); } void GenericMakeStepConfigWidget::updateDetails() @@ -291,7 +300,7 @@ void GenericMakeStepConfigWidget::updateDetails() param.setMacroExpander(bc->macroExpander()); param.setWorkingDirectory(bc->buildDirectory()); param.setEnvironment(bc->environment()); - param.setCommand(m_makeStep->makeCommand()); + param.setCommand(m_makeStep->makeCommand(bc->environment())); param.setArguments(m_makeStep->allArguments()); m_summaryText = param.summary(displayName()); emit updateSummary(); diff --git a/src/plugins/genericprojectmanager/genericmakestep.h b/src/plugins/genericprojectmanager/genericmakestep.h index b524ef3eff8..ffe62f05dd7 100644 --- a/src/plugins/genericprojectmanager/genericmakestep.h +++ b/src/plugins/genericprojectmanager/genericmakestep.h @@ -66,7 +66,7 @@ public: bool buildsTarget(const QString &target) const; void setBuildTarget(const QString &target, bool on); QString allArguments() const; - QString makeCommand() const; + QString makeCommand(const Utils::Environment &environment) const; void setClean(bool clean); bool isClean() const; diff --git a/src/plugins/madde/maemoglobal.cpp b/src/plugins/madde/maemoglobal.cpp index 29f07e2e7da..a2d3ea063cc 100644 --- a/src/plugins/madde/maemoglobal.cpp +++ b/src/plugins/madde/maemoglobal.cpp @@ -68,9 +68,9 @@ bool MaemoGlobal::hasMaemoDevice(const Kit *k) return type == Maemo5OsType || type == HarmattanOsType; } -bool MaemoGlobal::supportsMaemoDevice(const Kit *p) +bool MaemoGlobal::supportsMaemoDevice(const Kit *k) { - const Core::Id type = DeviceTypeKitInformation::deviceTypeId(p); + const Core::Id type = DeviceTypeKitInformation::deviceTypeId(k); return type == Maemo5OsType || type == HarmattanOsType; } diff --git a/src/plugins/madde/maemoglobal.h b/src/plugins/madde/maemoglobal.h index d8ef3509a55..ae2c66789c5 100644 --- a/src/plugins/madde/maemoglobal.h +++ b/src/plugins/madde/maemoglobal.h @@ -82,7 +82,7 @@ class MaemoGlobal Q_DECLARE_TR_FUNCTIONS(RemoteLinux::Internal::MaemoGlobal) public: static bool hasMaemoDevice(const ProjectExplorer::Kit *k); - static bool supportsMaemoDevice(const ProjectExplorer::Kit *p); + static bool supportsMaemoDevice(const ProjectExplorer::Kit *k); static bool isValidMaemo5QtVersion(const QString &qmakePath); static bool isValidHarmattanQtVersion(const QString &qmakePath); diff --git a/src/plugins/madde/maemopublisherfremantlefree.cpp b/src/plugins/madde/maemopublisherfremantlefree.cpp index e610659cf69..166a788c74a 100644 --- a/src/plugins/madde/maemopublisherfremantlefree.cpp +++ b/src/plugins/madde/maemopublisherfremantlefree.cpp @@ -308,7 +308,7 @@ void MaemoPublisherFremantleFree::handleProcessFinished(bool failedToStart) finishWithFailure(QString(), tr("Make distclean failed: %1") .arg(ProjectExplorer::ToolChainKitInformation::msgNoToolChainInTarget())); } - m_process->start(tc->makeCommand(), QStringList() << QLatin1String("distclean")); + m_process->start(tc->makeCommand(m_buildConfig->environment()), QStringList() << QLatin1String("distclean")); } break; case RunningMakeDistclean: diff --git a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp index 02d8b7f9e38..8c8b11e78d1 100644 --- a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp +++ b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp @@ -132,12 +132,25 @@ void AbstractMsvcToolChain::addToEnvironment(Utils::Environment &env) const env = m_resultEnvironment; } -QString AbstractMsvcToolChain::makeCommand() const +QString AbstractMsvcToolChain::makeCommand(const Utils::Environment &environment) const { - if (ProjectExplorerPlugin::instance()->projectExplorerSettings().useJom) { - return findInstalledJom(); + bool useJom = ProjectExplorerPlugin::instance()->projectExplorerSettings().useJom; + const QString jom = QLatin1String("jom.exe"); + const QString nmake = QLatin1String("nmake.exe"); + QString tmp; + + if (useJom) { + tmp = environment.searchInPath(jom, QStringList() + << QCoreApplication::applicationDirPath()); + if (!tmp.isEmpty()) + return tmp; } - return QLatin1String("nmake.exe"); + tmp = environment.searchInPath(nmake); + if (!tmp.isEmpty()) + return tmp; + + // Nothing found :( + return useJom ? jom : nmake; } Utils::FileName AbstractMsvcToolChain::compilerCommand() const @@ -266,23 +279,6 @@ bool AbstractMsvcToolChain::generateEnvironmentSettings(Utils::Environment &env, return true; } -QString AbstractMsvcToolChain::findInstalledJom() -{ - if (Abi::hostAbi().os() != Abi::WindowsOS) { - qWarning() << "Jom can only be used on Windows"; - return QString(); - } - - // We want jom! Try to find it. - const QString jom = QLatin1String("jom.exe"); - const QFileInfo installedJom = QFileInfo(QCoreApplication::applicationDirPath() - + QLatin1Char('/') + jom); - if (installedJom.isFile() && installedJom.isExecutable()) - return installedJom.absoluteFilePath(); - else - return jom; -} - bool AbstractMsvcToolChain::operator ==(const ToolChain &other) const { if (!ToolChain::operator ==(other)) diff --git a/src/plugins/projectexplorer/abstractmsvctoolchain.h b/src/plugins/projectexplorer/abstractmsvctoolchain.h index f52bee76881..29097506459 100644 --- a/src/plugins/projectexplorer/abstractmsvctoolchain.h +++ b/src/plugins/projectexplorer/abstractmsvctoolchain.h @@ -56,14 +56,13 @@ public: QList systemHeaderPaths(const Utils::FileName &sysRoot) const; void addToEnvironment(Utils::Environment &env) const; - QString makeCommand() const; + QString makeCommand(const Utils::Environment &environment) const; Utils::FileName compilerCommand() const; IOutputParser *outputParser() const; bool canClone() const; QString varsBat() const { return m_vcvarsBat; } - static QString findInstalledJom(); bool operator ==(const ToolChain &) const; diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp index 19a40d3e443..0039652b82b 100644 --- a/src/plugins/projectexplorer/buildconfiguration.cpp +++ b/src/plugins/projectexplorer/buildconfiguration.cpp @@ -187,9 +187,9 @@ bool BuildConfiguration::fromMap(const QVariantMap &map) return ProjectConfiguration::fromMap(map); } -void BuildConfiguration::handleKitUpdate(ProjectExplorer::Kit *p) +void BuildConfiguration::handleKitUpdate(ProjectExplorer::Kit *k) { - if (p != target()->kit()) + if (k != target()->kit()) return; emit environmentChanged(); } diff --git a/src/plugins/projectexplorer/buildconfiguration.h b/src/plugins/projectexplorer/buildconfiguration.h index 77d8c478ff2..be8e034e514 100644 --- a/src/plugins/projectexplorer/buildconfiguration.h +++ b/src/plugins/projectexplorer/buildconfiguration.h @@ -112,7 +112,7 @@ protected: virtual bool fromMap(const QVariantMap &map); private slots: - void handleKitUpdate(ProjectExplorer::Kit *p); + void handleKitUpdate(ProjectExplorer::Kit *k); private: bool m_clearSystemEnvironment; diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 0a479bf5bfc..648c63e287a 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -452,9 +452,11 @@ QList GccToolChain::suggestedMkspecList() const return QList(); } -QString GccToolChain::makeCommand() const +QString GccToolChain::makeCommand(const Utils::Environment &environment) const { - return QLatin1String("make"); + QString make = QLatin1String("make"); + QString tmp = environment.searchInPath(make); + return tmp.isEmpty() ? make : tmp; } IOutputParser *GccToolChain::outputParser() const @@ -764,11 +766,23 @@ QString ClangToolChain::typeDisplayName() const return Internal::ClangToolChainFactory::tr("Clang"); } -QString ClangToolChain::makeCommand() const +QString ClangToolChain::makeCommand(const Utils::Environment &environment) const { - if (Utils::HostOsInfo::isWindowsHost()) - return QLatin1String("mingw32-make.exe"); - return QLatin1String("make"); + QStringList makes; + if (Utils::HostOsInfo::isWindowsHost()) { + makes << QLatin1String("mingw32-make.exe"); + makes << QLatin1String("make.exe"); + } else { + makes << QLatin1String("make"); + } + + QString tmp; + foreach (const QString &make, makes) { + tmp = environment.searchInPath(make); + if (!tmp.isEmpty()) + return tmp; + } + return makes.first(); } QList ClangToolChain::suggestedMkspecList() const @@ -880,11 +894,23 @@ QList MingwToolChain::suggestedMkspecList() const return QList(); } -QString MingwToolChain::makeCommand() const +QString MingwToolChain::makeCommand(const Utils::Environment &environment) const { - if (Utils::HostOsInfo::isWindowsHost()) - return QLatin1String("mingw32-make.exe"); - return QLatin1String("make"); + QStringList makes; + if (Utils::HostOsInfo::isWindowsHost()) { + makes << QLatin1String("mingw32-make.exe"); + makes << QLatin1String("make.exe"); + } else { + makes << QLatin1String("make"); + } + + QString tmp; + foreach (const QString &make, makes) { + tmp = environment.searchInPath(make); + if (!tmp.isEmpty()) + return tmp; + } + return makes.first(); } ToolChain *MingwToolChain::clone() const diff --git a/src/plugins/projectexplorer/gcctoolchain.h b/src/plugins/projectexplorer/gcctoolchain.h index 37a99164792..d50e1513aa2 100644 --- a/src/plugins/projectexplorer/gcctoolchain.h +++ b/src/plugins/projectexplorer/gcctoolchain.h @@ -66,7 +66,7 @@ public: QList systemHeaderPaths(const Utils::FileName &sysRoot) const; void addToEnvironment(Utils::Environment &env) const; - QString makeCommand() const; + QString makeCommand(const Utils::Environment &environment) const; QList suggestedMkspecList() const; IOutputParser *outputParser() const; @@ -120,7 +120,7 @@ class PROJECTEXPLORER_EXPORT ClangToolChain : public GccToolChain public: QString type() const; QString typeDisplayName() const; - QString makeCommand() const; + QString makeCommand(const Utils::Environment &environment) const; IOutputParser *outputParser() const; @@ -144,7 +144,7 @@ class PROJECTEXPLORER_EXPORT MingwToolChain : public GccToolChain public: QString type() const; QString typeDisplayName() const; - QString makeCommand() const; + QString makeCommand(const Utils::Environment &environment) const; ToolChain *clone() const; diff --git a/src/plugins/projectexplorer/kit.cpp b/src/plugins/projectexplorer/kit.cpp index 89a8010e682..16c0681d308 100644 --- a/src/plugins/projectexplorer/kit.cpp +++ b/src/plugins/projectexplorer/kit.cpp @@ -103,18 +103,18 @@ Kit::~Kit() Kit *Kit::clone(bool keepName) const { - Kit *p = new Kit; + Kit *k = new Kit; if (keepName) - p->d->m_displayName = d->m_displayName; + k->d->m_displayName = d->m_displayName; else - p->d->m_displayName = QCoreApplication::translate("ProjectExplorer::Kit", "Clone of %1") + k->d->m_displayName = QCoreApplication::translate("ProjectExplorer::Kit", "Clone of %1") .arg(d->m_displayName); - p->d->m_autodetected = false; - p->d->m_data = d->m_data; - p->d->m_isValid = d->m_isValid; - p->d->m_icon = d->m_icon; - p->d->m_iconPath = d->m_iconPath; - return p; + k->d->m_autodetected = false; + k->d->m_data = d->m_data; + k->d->m_isValid = d->m_isValid; + k->d->m_icon = d->m_icon; + k->d->m_iconPath = d->m_iconPath; + return k; } bool Kit::isValid() const @@ -145,18 +145,18 @@ static QString candidateName(const QString &name, const QString &postfix) void Kit::setDisplayName(const QString &name) { - KitManager *pm = KitManager::instance(); - QList kitInfo = pm->kitInformation(); + KitManager *km = KitManager::instance(); + QList kitInfo = km->kitInformation(); QStringList nameList; - foreach (Kit *p, pm->kits()) { - if (p == this) + foreach (Kit *k, km->kits()) { + if (k == this) continue; - nameList << p->displayName(); + nameList << k->displayName(); foreach (KitInformation *ki, kitInfo) { - const QString postfix = ki->displayNamePostfix(p); + const QString postfix = ki->displayNamePostfix(k); if (!postfix.isEmpty()) - nameList << candidateName(p->displayName(), postfix); + nameList << candidateName(k->displayName(), postfix); } } diff --git a/src/plugins/projectexplorer/kitinformationconfigwidget.cpp b/src/plugins/projectexplorer/kitinformationconfigwidget.cpp index a6f2e8c4f72..da8903581fd 100644 --- a/src/plugins/projectexplorer/kitinformationconfigwidget.cpp +++ b/src/plugins/projectexplorer/kitinformationconfigwidget.cpp @@ -261,7 +261,7 @@ DeviceTypeInformationConfigWidget::DeviceTypeInformationConfigWidget(Kit *k, QWi QString DeviceTypeInformationConfigWidget::displayName() const { - return tr("Device Type:"); + return tr("Device type:"); } void DeviceTypeInformationConfigWidget::apply() diff --git a/src/plugins/projectexplorer/kitmanager.cpp b/src/plugins/projectexplorer/kitmanager.cpp index 7c503690fdb..8d312e3e0cb 100644 --- a/src/plugins/projectexplorer/kitmanager.cpp +++ b/src/plugins/projectexplorer/kitmanager.cpp @@ -156,8 +156,8 @@ void KitManager::restoreKits() KitList system = restoreKits(Utils::FileName::fromString(systemSettingsFile.absolutePath() + QLatin1String(KIT_FILENAME))); QList readKits = system.kits; // make sure we mark these as autodetected! - foreach (Kit *p, readKits) - p->setAutoDetected(true); + foreach (Kit *k, readKits) + k->setAutoDetected(true); kitsToRegister = readKits; // SDK kits are always considered to be up-to-date, so no need to // recheck them. @@ -166,11 +166,11 @@ void KitManager::restoreKits() KitList userKits = restoreKits(settingsFileName()); readKits = userKits.kits; - foreach (Kit *p, readKits) { - if (p->isAutoDetected()) - kitsToCheck.append(p); + foreach (Kit *k, readKits) { + if (k->isAutoDetected()) + kitsToCheck.append(k); else - kitsToRegister.append(p); + kitsToRegister.append(k); } readKits.clear(); @@ -198,8 +198,8 @@ void KitManager::restoreKits() qDeleteAll(kitsToCheck); // Store manual kits - foreach (Kit *p, kitsToRegister) - addKit(p); + foreach (Kit *k, kitsToRegister) + addKit(k); if (kits().isEmpty()) { Kit *defaultKit = new Kit; // One kit using default values @@ -210,9 +210,9 @@ void KitManager::restoreKits() addKit(defaultKit); } - Kit *p = find(userKits.defaultKit); - if (p) - setDefaultKit(p); + Kit *k = find(userKits.defaultKit); + if (k) + setDefaultKit(k); } KitManager::~KitManager() @@ -231,8 +231,8 @@ void KitManager::saveKits() data.insert(QLatin1String(KIT_FILE_VERSION_KEY), 1); int count = 0; - foreach (Kit *p, kits()) { - QVariantMap tmp = p->toMap(); + foreach (Kit *k, kits()) { + QVariantMap tmp = k->toMap(); if (tmp.isEmpty()) continue; data.insert(QString::fromLatin1(KIT_DATA_KEY) + QString::number(count), tmp); @@ -260,9 +260,9 @@ void KitManager::registerKitInformation(KitInformation *ki) if (!d->m_initialized) return; - foreach (Kit *p, kits()) { - if (!p->hasValue(ki->dataId())) - p->setValue(ki->dataId(), ki->defaultValue(p)); + foreach (Kit *k, kits()) { + if (!k->hasValue(ki->dataId())) + k->setValue(ki->dataId(), ki->defaultValue(k)); } return; @@ -297,11 +297,11 @@ KitManager::KitList KitManager::restoreKits(const Utils::FileName &fileName) const QVariantMap stMap = data.value(key).toMap(); - Kit *p = new Kit; - if (p->fromMap(stMap)) { - result.kits.append(p); + Kit *k = new Kit; + if (k->fromMap(stMap)) { + result.kits.append(k); } else { - delete p; + delete k; qWarning("Warning: Unable to restore kits stored in %s at position %d.", qPrintable(fileName.toUserOutput()), i); } @@ -311,8 +311,8 @@ KitManager::KitList KitManager::restoreKits(const Utils::FileName &fileName) return result; const Core::Id id = Core::Id(defaultId); - foreach (Kit *i, result.kits) { - if (i->id() == id) { + foreach (Kit *k, result.kits) { + if (k->id() == id) { result.defaultKit = id; break; } @@ -328,9 +328,9 @@ QList KitManager::kits(const KitMatcher *m) const } QList result; - foreach (Kit *p, d->m_kitList) { - if (!m || m->matches(p)) - result.append(p); + foreach (Kit *k, d->m_kitList) { + if (!m || m->matches(k)) + result.append(k); } return result; } @@ -340,9 +340,9 @@ Kit *KitManager::find(const Core::Id &id) const if (!id.isValid()) return 0; - foreach (Kit *p, kits()) { - if (p->id() == id) - return p; + foreach (Kit *k, kits()) { + if (k->id() == id) + return k; } return 0; } @@ -379,12 +379,12 @@ KitConfigWidget *KitManager::createConfigWidget(Kit *k) const return result; } -void KitManager::notifyAboutUpdate(ProjectExplorer::Kit *p) +void KitManager::notifyAboutUpdate(ProjectExplorer::Kit *k) { - if (!p || !kits().contains(p)) + if (!k || !kits().contains(k)) return; - d->validateKit(p); - emit kitUpdated(p); + d->validateKit(k); + emit kitUpdated(k); } bool KitManager::registerKit(ProjectExplorer::Kit *k) @@ -446,8 +446,8 @@ void KitManager::setDefaultKit(Kit *k) void KitManager::validateKits() { - foreach (Kit *p, kits()) - d->validateKit(p); + foreach (Kit *k, kits()) + d->validateKit(k); } void KitManager::addKit(Kit *k) diff --git a/src/plugins/projectexplorer/kitmanager.h b/src/plugins/projectexplorer/kitmanager.h index 4756535a234..d36ff8eec26 100644 --- a/src/plugins/projectexplorer/kitmanager.h +++ b/src/plugins/projectexplorer/kitmanager.h @@ -153,7 +153,7 @@ private: }; KitList restoreKits(const Utils::FileName &fileName); - void notifyAboutUpdate(ProjectExplorer::Kit *p); + void notifyAboutUpdate(ProjectExplorer::Kit *k); void addKit(Kit *k); Internal::KitManagerPrivate *const d; diff --git a/src/plugins/projectexplorer/kitmodel.cpp b/src/plugins/projectexplorer/kitmodel.cpp index 337ae9a72d1..c13e52179e4 100644 --- a/src/plugins/projectexplorer/kitmodel.cpp +++ b/src/plugins/projectexplorer/kitmodel.cpp @@ -46,11 +46,11 @@ namespace Internal { class KitNode { public: - explicit KitNode(KitNode *pn, Kit *k = 0, bool c = false) : - parent(pn), kit(k), changed(c) + explicit KitNode(KitNode *kn, Kit *k = 0, bool c = false) : + parent(kn), kit(k), changed(c) { - if (pn) - pn->childNodes.append(this); + if (kn) + kn->childNodes.append(this); widget = KitManager::instance()->createConfigWidget(k); if (widget) { if (k && k->isAutoDetected()) diff --git a/src/plugins/projectexplorer/settingsaccessor.cpp b/src/plugins/projectexplorer/settingsaccessor.cpp index 2f162327746..491635d372f 100644 --- a/src/plugins/projectexplorer/settingsaccessor.cpp +++ b/src/plugins/projectexplorer/settingsaccessor.cpp @@ -2228,10 +2228,10 @@ Version11Handler::Version11Handler() Version11Handler::~Version11Handler() { - KitManager *pm = KitManager::instance(); - if (!pm) // Can happen during teardown! + KitManager *km = KitManager::instance(); + if (!km) // Can happen during teardown! return; - QList knownKits = pm->kits(); + QList knownKits = km->kits(); foreach (Kit *k, m_targets.keys()) { if (!knownKits.contains(k)) delete k; @@ -2251,8 +2251,8 @@ QVariantMap Version11Handler::update(Project *project, const QVariantMap &map) parseToolChainFile(); QVariantMap result; - KitManager *pm = KitManager::instance(); - foreach (Kit *k, pm->kits()) + KitManager *km = KitManager::instance(); + foreach (Kit *k, km->kits()) m_targets.insert(k, QVariantMap()); QMapIterator globalIt(map); @@ -2425,7 +2425,7 @@ QVariantMap Version11Handler::update(Project *project, const QVariantMap &map) if (data.isEmpty()) continue; - pm->registerKit(k); + km->registerKit(k); data.insert(QLatin1String("ProjectExplorer.ProjectConfiguration.Id"), k->id().name()); data.insert(QLatin1String("ProjectExplorer.Target.Profile"), k->id().name()); diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp index 375fdc50c11..92e2e7bdccf 100644 --- a/src/plugins/projectexplorer/target.cpp +++ b/src/plugins/projectexplorer/target.cpp @@ -119,21 +119,21 @@ QList TargetPrivate::deployFactories() const return ExtensionSystem::PluginManager::getObjects(); } -Target::Target(Project *project, Kit *p) : - ProjectConfiguration(project, p->id()), +Target::Target(Project *project, Kit *k) : + ProjectConfiguration(project, k->id()), d(new TargetPrivate) { connect(DeviceManager::instance(), SIGNAL(updated()), this, SLOT(updateDeviceState())); - d->m_kit = p; + d->m_kit = k; setDisplayName(d->m_kit->displayName()); setIcon(d->m_kit->icon()); - KitManager *pm = KitManager::instance(); - connect(pm, SIGNAL(kitUpdated(ProjectExplorer::Kit*)), + KitManager *km = KitManager::instance(); + connect(km, SIGNAL(kitUpdated(ProjectExplorer::Kit*)), this, SLOT(handleKitUpdates(ProjectExplorer::Kit*))); - connect(pm, SIGNAL(kitRemoved(ProjectExplorer::Kit*)), + connect(km, SIGNAL(kitRemoved(ProjectExplorer::Kit*)), this, SLOT(handleKitRemoval(ProjectExplorer::Kit*))); } @@ -180,20 +180,20 @@ void Target::onBuildDirectoryChanged() emit buildDirectoryChanged(); } -void Target::handleKitUpdates(Kit *p) +void Target::handleKitUpdates(Kit *k) { - if (p != d->m_kit) + if (k != d->m_kit) return; - setDisplayName(p->displayName()); - setIcon(p->icon()); + setDisplayName(k->displayName()); + setIcon(k->icon()); updateDefaultDeployConfigurations(); emit kitChanged(); } -void Target::handleKitRemoval(Kit *p) +void Target::handleKitRemoval(Kit *k) { - if (p != d->m_kit) + if (k != d->m_kit) return; d->m_kit = 0; project()->removeTarget(this); diff --git a/src/plugins/projectexplorer/target.h b/src/plugins/projectexplorer/target.h index 94babd46fca..4fb87066a6d 100644 --- a/src/plugins/projectexplorer/target.h +++ b/src/plugins/projectexplorer/target.h @@ -175,8 +175,8 @@ private slots: void changeDeployConfigurationEnabled(); void changeRunConfigurationEnabled(); - void handleKitUpdates(ProjectExplorer::Kit *p); - void handleKitRemoval(ProjectExplorer::Kit *p); + void handleKitUpdates(ProjectExplorer::Kit *k); + void handleKitRemoval(ProjectExplorer::Kit *k); private: TargetPrivate *d; diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index 85f9a6f880b..afee769b872 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -402,13 +402,17 @@ void TaskWindow::addTask(const Task &task) emit tasksChanged(); navigateStateChanged(); - if (task.type == Task::Error && d->m_filter->filterIncludesErrors() && - !d->m_filter->filteredCategories().contains(task.category)) { + if (task.type == Task::Error && d->m_filter->filterIncludesErrors() + && !d->m_filter->filteredCategories().contains(task.category)) { flash(); setBadgeNumber(++d->m_badgeCount); } - if (task.type == Task::Warning && d->m_filter->filterIncludesWarnings() && - !d->m_filter->filteredCategories().contains(task.category)) { + if (task.type == Task::Warning && d->m_filter->filterIncludesWarnings() + && !d->m_filter->filteredCategories().contains(task.category)) { + setBadgeNumber(++d->m_badgeCount); + } + if (task.type == Task::Unknown && d->m_filter->filterIncludesUnknowns() + && !d->m_filter->filteredCategories().contains(task.category)) { setBadgeNumber(++d->m_badgeCount); } } @@ -420,12 +424,16 @@ void TaskWindow::removeTask(const Task &task) emit tasksChanged(); navigateStateChanged(); - if (task.type == Task::Error && d->m_filter->filterIncludesErrors() && - !d->m_filter->filteredCategories().contains(task.category)) { + if (task.type == Task::Error && d->m_filter->filterIncludesErrors() + && !d->m_filter->filteredCategories().contains(task.category)) { setBadgeNumber(--d->m_badgeCount); } - if (task.type == Task::Warning && d->m_filter->filterIncludesWarnings() && - !d->m_filter->filteredCategories().contains(task.category)) { + if (task.type == Task::Warning && d->m_filter->filterIncludesWarnings() + && !d->m_filter->filteredCategories().contains(task.category)) { + setBadgeNumber(--d->m_badgeCount); + } + if (task.type == Task::Unknown && d->m_filter->filterIncludesUnknowns() + && !d->m_filter->filteredCategories().contains(task.category)) { setBadgeNumber(--d->m_badgeCount); } } diff --git a/src/plugins/projectexplorer/toolchain.h b/src/plugins/projectexplorer/toolchain.h index 276bd0bc291..43fcfecb1f6 100644 --- a/src/plugins/projectexplorer/toolchain.h +++ b/src/plugins/projectexplorer/toolchain.h @@ -90,7 +90,7 @@ public: virtual CompilerFlags compilerFlags(const QStringList &cxxflags) const = 0; virtual QList systemHeaderPaths(const Utils::FileName &sysRoot) const = 0; virtual void addToEnvironment(Utils::Environment &env) const = 0; - virtual QString makeCommand() const = 0; + virtual QString makeCommand(const Utils::Environment &env) const = 0; virtual Utils::FileName compilerCommand() const = 0; virtual QString defaultMakeTarget() const; diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index d56303634dc..6f5a78e2e5f 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -269,14 +269,14 @@ ProjectExplorer::IProjectManager *QmlProject::projectManager() const return m_manager; } -bool QmlProject::supportsKit(ProjectExplorer::Kit *p) const +bool QmlProject::supportsKit(ProjectExplorer::Kit *k) const { - Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(p); + Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(k); if (deviceType != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) return false; // TODO: Limit supported versions? - QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(p); + QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k); return version; } diff --git a/src/plugins/qmlprojectmanager/qmlproject.h b/src/plugins/qmlprojectmanager/qmlproject.h index ee7731c0bcc..1ac26041e21 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.h +++ b/src/plugins/qmlprojectmanager/qmlproject.h @@ -65,7 +65,7 @@ public: Core::IDocument *document() const; ProjectExplorer::IProjectManager *projectManager() const; - bool supportsKit(ProjectExplorer::Kit *p) const; + bool supportsKit(ProjectExplorer::Kit *k) const; QList subConfigWidgets(); diff --git a/src/plugins/qnx/qnxabstractqtversion.cpp b/src/plugins/qnx/qnxabstractqtversion.cpp index 1747d2fc396..36d0c3d56f7 100644 --- a/src/plugins/qnx/qnxabstractqtversion.cpp +++ b/src/plugins/qnx/qnxabstractqtversion.cpp @@ -94,9 +94,9 @@ QList QnxAbstractQtVersion::detectQtAbis() const return qtAbisFromLibrary(qtCorePath(versionInfo(), qtVersionString())); } -void QnxAbstractQtVersion::addToEnvironment(const ProjectExplorer::Kit *p, Utils::Environment &env) const +void QnxAbstractQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const { - QtSupport::BaseQtVersion::addToEnvironment(p, env); + QtSupport::BaseQtVersion::addToEnvironment(k, env); if (!m_environmentUpToDate) updateEnvironment(); diff --git a/src/plugins/qnx/qnxabstractqtversion.h b/src/plugins/qnx/qnxabstractqtversion.h index bb1b5b395ff..9d65b312a3a 100644 --- a/src/plugins/qnx/qnxabstractqtversion.h +++ b/src/plugins/qnx/qnxabstractqtversion.h @@ -64,7 +64,7 @@ public: QList detectQtAbis() const; - void addToEnvironment(const ProjectExplorer::Kit *p, Utils::Environment &env) const; + void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const; QtSupport::QtConfigWidget *createConfigurationWidget() const; diff --git a/src/plugins/qt4projectmanager/makestep.cpp b/src/plugins/qt4projectmanager/makestep.cpp index 39e414f5e7a..5e85c10e54a 100644 --- a/src/plugins/qt4projectmanager/makestep.cpp +++ b/src/plugins/qt4projectmanager/makestep.cpp @@ -162,7 +162,7 @@ bool MakeStep::init() workingDirectory = bc->buildDirectory(); pp->setWorkingDirectory(workingDirectory); - QString makeCmd = tc->makeCommand(); + QString makeCmd = tc->makeCommand(bc->environment()); if (!m_makeCmd.isEmpty()) makeCmd = m_makeCmd; pp->setCommand(makeCmd); @@ -403,8 +403,12 @@ void MakeStepConfigWidget::updateDetails() { ToolChain *tc = ToolChainKitInformation::toolChain(m_makeStep->target()->kit()); - if (tc) - m_ui->makeLabel->setText(tr("Override %1:").arg(tc->makeCommand())); + Qt4BuildConfiguration *bc = m_makeStep->qt4BuildConfiguration(); + if (!bc) + bc = qobject_cast(m_makeStep->target()->activeBuildConfiguration()); + + if (tc && bc) + m_ui->makeLabel->setText(tr("Override %1:").arg(tc->makeCommand(bc->environment()))); else m_ui->makeLabel->setText(tr("Make:")); @@ -412,9 +416,6 @@ void MakeStepConfigWidget::updateDetails() setSummaryText(tr("Make: %1").arg(ProjectExplorer::ToolChainKitInformation::msgNoToolChainInTarget())); return; } - Qt4BuildConfiguration *bc = m_makeStep->qt4BuildConfiguration(); - if (!bc) - bc = qobject_cast(m_makeStep->target()->activeBuildConfiguration()); if (!bc) { setSummaryText(tr("Make: No Qt4 build configuration.")); return; @@ -423,7 +424,7 @@ void MakeStepConfigWidget::updateDetails() ProcessParameters param; param.setMacroExpander(bc->macroExpander()); param.setWorkingDirectory(bc->buildDirectory()); - QString makeCmd = tc->makeCommand(); + QString makeCmd = tc->makeCommand(bc->environment()); if (!m_makeStep->makeCommand().isEmpty()) makeCmd = m_makeStep->makeCommand(); param.setCommand(makeCmd); diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp index 0db5fd567c1..c4373fa2464 100644 --- a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp @@ -675,21 +675,21 @@ BuildConfiguration *Qt4BuildConfigurationFactory::restore(Target *parent, const return 0; } -QList Qt4BuildConfigurationFactory::availableBuildConfigurations(const Kit *p, +QList Qt4BuildConfigurationFactory::availableBuildConfigurations(const Kit *k, const QString &proFilePath) { QList infoList; - BaseQtVersion *version = QtKitInformation::qtVersion(p); + BaseQtVersion *version = QtKitInformation::qtVersion(k); if (!version || !version->isValid()) return infoList; BaseQtVersion::QmakeBuildConfigs config = version->defaultBuildConfig(); BuildConfigurationInfo info = BuildConfigurationInfo(config, QString(), QString(), false); - info.directory = Qt4Project::shadowBuildDirectory(proFilePath, p, buildConfigurationDisplayName(info)); + info.directory = Qt4Project::shadowBuildDirectory(proFilePath, k, buildConfigurationDisplayName(info)); infoList.append(info); info.buildConfig = config ^ BaseQtVersion::DebugBuild; - info.directory = Qt4Project::shadowBuildDirectory(proFilePath, p, buildConfigurationDisplayName(info)); + info.directory = Qt4Project::shadowBuildDirectory(proFilePath, k, buildConfigurationDisplayName(info)); infoList.append(info); return infoList; } diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.h b/src/plugins/qt4projectmanager/qt4buildconfiguration.h index 595ff3b14e7..2a64794a5e6 100644 --- a/src/plugins/qt4projectmanager/qt4buildconfiguration.h +++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.h @@ -170,7 +170,7 @@ public: bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const; ProjectExplorer::BuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map); - static QList availableBuildConfigurations(const ProjectExplorer::Kit *p, const QString &proFilePath); + static QList availableBuildConfigurations(const ProjectExplorer::Kit *k, const QString &proFilePath); static QString buildConfigurationDisplayName(const BuildConfigurationInfo &info); private slots: diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index d2dbed0d141..313ac58469f 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -730,15 +730,11 @@ void Qt4PriFileNode::watchFolders(const QSet &folders) m_watchedFolders = folders; } -void Qt4PriFileNode::folderChanged(const QString &folder) +void Qt4PriFileNode::folderChanged(const QString &changedFolder) { //qDebug()<<"########## Qt4PriFileNode::folderChanged"; // So, we need to figure out which files changed. - QString changedFolder = folder; - if (!changedFolder.endsWith(QLatin1Char('/'))) - changedFolder.append(QLatin1Char('/')); - // Collect all the files QSet newFiles; newFiles += recursiveEnumerate(changedFolder); diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index 59862e79c23..a50e12ca36b 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -864,9 +864,9 @@ Qt4Manager *Qt4Project::qt4ProjectManager() const return m_manager; } -bool Qt4Project::supportsKit(Kit *p) const +bool Qt4Project::supportsKit(Kit *k) const { - QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(p); + QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k); return version; } @@ -1390,34 +1390,34 @@ QString Qt4Project::disabledReasonForRunConfiguration(const QString &proFilePath .arg(QFileInfo(proFilePath).fileName()); } -QString Qt4Project::shadowBuildDirectory(const QString &profilePath, const Kit *p, const QString &suffix) +QString Qt4Project::shadowBuildDirectory(const QString &profilePath, const Kit *k, const QString &suffix) { if (profilePath.isEmpty()) return QString(); QFileInfo info(profilePath); - QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(p); + QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k); if (version && !version->supportsShadowBuilds()) return info.absolutePath(); QString base = QDir::cleanPath(projectDirectory(profilePath) + QLatin1String("/../") + info.baseName() + QLatin1String("-build-")); - return base + buildNameFor(p) + QLatin1String("-") + sanitize(suffix); + return base + buildNameFor(k) + QLatin1String("-") + sanitize(suffix); } -QString Qt4Project::buildNameFor(const Kit *p) +QString Qt4Project::buildNameFor(const Kit *k) { - if (!p) + if (!k) return QLatin1String("unknown"); - return QString::fromLatin1(p->id().name()).mid(31, 6); // part of the UUID, should be pretty unique;-) + return QString::fromLatin1(k->id().name()).mid(31, 6); // part of the UUID, should be pretty unique;-) } -Target *Qt4Project::createTarget(Kit *p, const QList &infoList) +Target *Qt4Project::createTarget(Kit *k, const QList &infoList) { - if (target(p)) + if (target(k)) return 0; - Target *t = new Target(this, p); + Target *t = new Target(this, k); // Build Configurations: foreach (const BuildConfigurationInfo &info, infoList) { diff --git a/src/plugins/qt4projectmanager/qt4project.h b/src/plugins/qt4projectmanager/qt4project.h index 160732dc538..f26a2bb5294 100644 --- a/src/plugins/qt4projectmanager/qt4project.h +++ b/src/plugins/qt4projectmanager/qt4project.h @@ -83,7 +83,7 @@ public: ProjectExplorer::IProjectManager *projectManager() const; Qt4Manager *qt4ProjectManager() const; - bool supportsKit(ProjectExplorer::Kit *p) const; + bool supportsKit(ProjectExplorer::Kit *k) const; ProjectExplorer::ProjectNode *rootProjectNode() const; Qt4ProFileNode *rootQt4ProjectNode() const; @@ -135,12 +135,12 @@ public: QString disabledReasonForRunConfiguration(const QString &proFilePath); /// suffix should be unique - static QString shadowBuildDirectory(const QString &profilePath, const ProjectExplorer::Kit *p, + static QString shadowBuildDirectory(const QString &profilePath, const ProjectExplorer::Kit *k, const QString &suffix); /// used by the default implementation of shadowBuildDirectory - static QString buildNameFor(const ProjectExplorer::Kit *p); + static QString buildNameFor(const ProjectExplorer::Kit *k); - ProjectExplorer::Target *createTarget(ProjectExplorer::Kit *p, const QList &infoList); + ProjectExplorer::Target *createTarget(ProjectExplorer::Kit *k, const QList &infoList); void emitBuildDirectoryInitialized(); diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp index 2aba04b96f7..aa7d45dd685 100644 --- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp +++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp @@ -205,10 +205,10 @@ void Qt4ProjectConfigWidget::updateProblemLabel() bool incompatibleBuild = false; bool allGood = false; - ProjectExplorer::Kit *p = m_buildConfiguration->target()->kit(); + ProjectExplorer::Kit *k = m_buildConfiguration->target()->kit(); const QString proFileName = m_buildConfiguration->target()->project()->document()->fileName(); - QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(p); + QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k); if (!version) { m_ui->problemLabel->setVisible(true); m_ui->warningLabel->setVisible(true); diff --git a/src/plugins/qt4projectmanager/qt4targetsetupwidget.cpp b/src/plugins/qt4projectmanager/qt4targetsetupwidget.cpp index 1a1d7e782f0..726129054e9 100644 --- a/src/plugins/qt4projectmanager/qt4targetsetupwidget.cpp +++ b/src/plugins/qt4projectmanager/qt4targetsetupwidget.cpp @@ -57,10 +57,10 @@ namespace Qt4ProjectManager { // Qt4TargetSetupWidget // ------------------------------------------------------------------------- -Qt4TargetSetupWidget::Qt4TargetSetupWidget(ProjectExplorer::Kit *p, +Qt4TargetSetupWidget::Qt4TargetSetupWidget(ProjectExplorer::Kit *k, const QString &proFilePath, const QList &infoList) : - m_kit(p), + m_kit(k), m_haveImported(false), m_ignoreChange(false), m_selected(0) diff --git a/src/plugins/qt4projectmanager/qt4targetsetupwidget.h b/src/plugins/qt4projectmanager/qt4targetsetupwidget.h index f4ede628573..39a22d3e15c 100644 --- a/src/plugins/qt4projectmanager/qt4targetsetupwidget.h +++ b/src/plugins/qt4projectmanager/qt4targetsetupwidget.h @@ -62,7 +62,7 @@ class QT4PROJECTMANAGER_EXPORT Qt4TargetSetupWidget : public QWidget { Q_OBJECT public: - Qt4TargetSetupWidget(ProjectExplorer::Kit *p, + Qt4TargetSetupWidget(ProjectExplorer::Kit *k, const QString &proFilePath, const QList &infoList); ~Qt4TargetSetupWidget(); diff --git a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp index a5d2250cc9a..15eaf9d7408 100644 --- a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp @@ -209,8 +209,8 @@ bool AbstractMobileAppWizardDialog::isQtPlatformSelected(const QString &platform QtSupport::QtPlatformKitMatcher matcher(platform); QList kitsList = ProjectExplorer::KitManager::instance()->kits(&matcher); - foreach (ProjectExplorer::Kit *p, kitsList) { - if (selectedKitsList.contains(p->id())) + foreach (ProjectExplorer::Kit *k, kitsList) { + if (selectedKitsList.contains(k->id())) return true; } return false; diff --git a/src/plugins/qt4projectmanager/wizards/qtwizard.cpp b/src/plugins/qt4projectmanager/wizards/qtwizard.cpp index 0103a614169..16a52d8513a 100644 --- a/src/plugins/qt4projectmanager/wizards/qtwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/qtwizard.cpp @@ -327,8 +327,8 @@ bool BaseQt4ProjectWizardDialog::isQtPlatformSelected(const QString &platform) c QtSupport::QtPlatformKitMatcher matcher(platform); QList kitList = ProjectExplorer::KitManager::instance()->kits(&matcher); - foreach (ProjectExplorer::Kit *p, kitList) { - if (selectedKitList.contains(p->id())) + foreach (ProjectExplorer::Kit *k, kitList) { + if (selectedKitList.contains(k->id())) return true; } return false; diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp index 2e7eab38798..fc76f773eef 100644 --- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp +++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp @@ -276,10 +276,10 @@ void TargetSetupPage::setupWidgets() void TargetSetupPage::reset() { foreach (Qt4TargetSetupWidget *widget, m_widgets.values()) { - ProjectExplorer::Kit *p = widget->profile(); - if (!p) + ProjectExplorer::Kit *k = widget->profile(); + if (!k) continue; - removeProject(p, m_proFilePath); + removeProject(k, m_proFilePath); delete widget; } @@ -505,8 +505,8 @@ void TargetSetupPage::setupImports() import(Utils::FileName::fromString(sourceDir), true); QList kitList = ProjectExplorer::KitManager::instance()->kits(); - foreach (ProjectExplorer::Kit *p, kitList) { - QFileInfo fi(Qt4Project::shadowBuildDirectory(m_proFilePath, p, QString())); + foreach (ProjectExplorer::Kit *k, kitList) { + QFileInfo fi(Qt4Project::shadowBuildDirectory(m_proFilePath, k, QString())); const QString baseDir = fi.absolutePath(); const QString prefix = fi.baseName(); @@ -660,9 +660,9 @@ bool TargetSetupPage::setupProject(Qt4ProjectManager::Qt4Project *project) if (!widget->isKitSelected()) continue; - ProjectExplorer::Kit *p = widget->profile(); - cleanKit(p); - toRegister.append(KitBuildInfo(p, widget->selectedBuildConfigurationInfoList())); + ProjectExplorer::Kit *k = widget->profile(); + cleanKit(k); + toRegister.append(KitBuildInfo(k, widget->selectedBuildConfigurationInfoList())); widget->clearKit(); } reset(); diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 1e454abd74c..464050d703e 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -983,17 +983,17 @@ QString BaseQtVersion::examplesPath() const return qmakeProperty("QT_INSTALL_EXAMPLES"); } -QList BaseQtVersion::systemHeaderPathes(const ProjectExplorer::Kit *p) const +QList BaseQtVersion::systemHeaderPathes(const ProjectExplorer::Kit *k) const { - Q_UNUSED(p); + Q_UNUSED(k); QList result; result.append(ProjectExplorer::HeaderPath(mkspecPath().toString(), ProjectExplorer::HeaderPath::GlobalHeaderPath)); return result; } -void BaseQtVersion::addToEnvironment(const ProjectExplorer::Kit *p, Environment &env) const +void BaseQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Environment &env) const { - Q_UNUSED(p); + Q_UNUSED(k); env.set(QLatin1String("QTDIR"), QDir::toNativeSeparators(qmakeProperty("QT_HOST_DATA"))); env.prependOrSetPath(qmakeProperty("QT_HOST_BINS")); } diff --git a/src/plugins/qtsupport/baseqtversion.h b/src/plugins/qtsupport/baseqtversion.h index 069d5e9eb96..b85bf60db70 100644 --- a/src/plugins/qtsupport/baseqtversion.h +++ b/src/plugins/qtsupport/baseqtversion.h @@ -131,7 +131,7 @@ public: QHash versionInfo() const; static QString qmakeProperty(const QHash &versionInfo, const QByteArray &name); QString qmakeProperty(const QByteArray &name) const; - virtual void addToEnvironment(const ProjectExplorer::Kit *p, Utils::Environment &env) const; + virtual void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const; virtual Utils::FileName sourcePath() const; // used by QtUiCodeModelSupport @@ -153,7 +153,7 @@ public: bool hasDemos() const; QString demosPath() const; - virtual QList systemHeaderPathes(const ProjectExplorer::Kit *p) const; + virtual QList systemHeaderPathes(const ProjectExplorer::Kit *k) const; virtual QString frameworkInstallPath() const; // former local functions diff --git a/src/plugins/qtsupport/debugginghelperbuildtask.cpp b/src/plugins/qtsupport/debugginghelperbuildtask.cpp index a8330b1c3eb..197f12cce68 100644 --- a/src/plugins/qtsupport/debugginghelperbuildtask.cpp +++ b/src/plugins/qtsupport/debugginghelperbuildtask.cpp @@ -111,7 +111,7 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version, m_qmakeArguments << QLatin1String("CONFIG+=x86_64"); } } - m_makeCommand = toolChain->makeCommand(); + m_makeCommand = toolChain->makeCommand(m_environment); m_mkspec = version->mkspec(); // Make sure QtVersion cache is invalidated diff --git a/src/plugins/qtsupport/qtkitinformation.cpp b/src/plugins/qtsupport/qtkitinformation.cpp index c64c27b33fd..efe7220b62c 100644 --- a/src/plugins/qtsupport/qtkitinformation.cpp +++ b/src/plugins/qtsupport/qtkitinformation.cpp @@ -58,9 +58,9 @@ unsigned int QtKitInformation::priority() const return 26000; } -QVariant QtKitInformation::defaultValue(ProjectExplorer::Kit *p) const +QVariant QtKitInformation::defaultValue(ProjectExplorer::Kit *k) const { - Q_UNUSED(p); + Q_UNUSED(k); QtVersionManager *mgr = QtVersionManager::instance(); // find "Qt in PATH": @@ -79,96 +79,86 @@ QVariant QtKitInformation::defaultValue(ProjectExplorer::Kit *p) const return -1; } -QList QtKitInformation::validate(ProjectExplorer::Kit *p) const +QList QtKitInformation::validate(ProjectExplorer::Kit *k) const { - int id = qtVersionId(p); + int id = qtVersionId(k); if (id == -1) return QList(); BaseQtVersion *version = QtVersionManager::instance()->version(id); if (!version) { - setQtVersionId(p, -1); + setQtVersionId(k, -1); return QList(); } - return version->validateKit(p); + return version->validateKit(k); } -ProjectExplorer::KitConfigWidget *QtKitInformation::createConfigWidget(ProjectExplorer::Kit *p) const +ProjectExplorer::KitConfigWidget *QtKitInformation::createConfigWidget(ProjectExplorer::Kit *k) const { - return new Internal::QtKitConfigWidget(p); + return new Internal::QtKitConfigWidget(k); } -QString QtKitInformation::displayNamePostfix(const ProjectExplorer::Kit *p) const +QString QtKitInformation::displayNamePostfix(const ProjectExplorer::Kit *k) const { - BaseQtVersion *version = qtVersion(p); + BaseQtVersion *version = qtVersion(k); return version ? version->displayName() : QString(); } ProjectExplorer::KitInformation::ItemList -QtKitInformation::toUserOutput(ProjectExplorer::Kit *p) const +QtKitInformation::toUserOutput(ProjectExplorer::Kit *k) const { - BaseQtVersion *version = qtVersion(p); + BaseQtVersion *version = qtVersion(k); return ItemList() << qMakePair(tr("Qt version"), version ? version->displayName() : tr("None")); } -void QtKitInformation::addToEnvironment(const ProjectExplorer::Kit *p, Utils::Environment &env) const +void QtKitInformation::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const { - BaseQtVersion *version = qtVersion(p); + BaseQtVersion *version = qtVersion(k); if (version) - version->addToEnvironment(p, env); + version->addToEnvironment(k, env); } -int QtKitInformation::qtVersionId(const ProjectExplorer::Kit *p) +int QtKitInformation::qtVersionId(const ProjectExplorer::Kit *k) { - if (!p) + if (!k) return -1; bool ok = false; - int id = p->value(Core::Id(Internal::QT_INFORMATION), -1).toInt(&ok); + int id = k->value(Core::Id(Internal::QT_INFORMATION), -1).toInt(&ok); if (!ok) id = -1; return id; } -void QtKitInformation::setQtVersionId(ProjectExplorer::Kit *p, const int id) +void QtKitInformation::setQtVersionId(ProjectExplorer::Kit *k, const int id) { - p->setValue(Core::Id(Internal::QT_INFORMATION), id); + k->setValue(Core::Id(Internal::QT_INFORMATION), id); } -BaseQtVersion *QtKitInformation::qtVersion(const ProjectExplorer::Kit *p) +BaseQtVersion *QtKitInformation::qtVersion(const ProjectExplorer::Kit *k) { - return QtVersionManager::instance()->version(qtVersionId(p)); + return QtVersionManager::instance()->version(qtVersionId(k)); } -void QtKitInformation::setQtVersion(ProjectExplorer::Kit *p, const BaseQtVersion *v) +void QtKitInformation::setQtVersion(ProjectExplorer::Kit *k, const BaseQtVersion *v) { if (!v) - setQtVersionId(p, -1); + setQtVersionId(k, -1); else - setQtVersionId(p, v->uniqueId()); -} - -QtTypeKitMatcher::QtTypeKitMatcher(const QString &type) : - m_type(type) -{ } - -bool QtTypeKitMatcher::matches(const ProjectExplorer::Kit *p) const -{ - BaseQtVersion *version = QtKitInformation::qtVersion(p); - return version && version->type() == m_type; + setQtVersionId(k, v->uniqueId()); } QtPlatformKitMatcher::QtPlatformKitMatcher(const QString &platform) : m_platform(platform) { } -bool QtPlatformKitMatcher::matches(const ProjectExplorer::Kit *p) const +bool QtPlatformKitMatcher::matches(const ProjectExplorer::Kit *k) const { - BaseQtVersion *version = QtKitInformation::qtVersion(p); + BaseQtVersion *version = QtKitInformation::qtVersion(k); return version && version->platformName() == m_platform; } -bool QtVersionKitMatcher::matches(const ProjectExplorer::Kit *p) const +bool QtVersionKitMatcher::matches(const ProjectExplorer::Kit *k) const { - BaseQtVersion *version = QtKitInformation::qtVersion(p); + BaseQtVersion *version = QtKitInformation::qtVersion(k); if (!version) return false; QtVersionNumber current = version->qtVersion(); diff --git a/src/plugins/qtsupport/qtkitinformation.h b/src/plugins/qtsupport/qtkitinformation.h index 31da6290b8e..3a5b2ab575b 100644 --- a/src/plugins/qtsupport/qtkitinformation.h +++ b/src/plugins/qtsupport/qtkitinformation.h @@ -50,33 +50,22 @@ public: unsigned int priority() const; // the higher the closer to the top. - QVariant defaultValue(ProjectExplorer::Kit *p) const; + QVariant defaultValue(ProjectExplorer::Kit *k) const; - QList validate(ProjectExplorer::Kit *p) const; + QList validate(ProjectExplorer::Kit *k) const; - ProjectExplorer::KitConfigWidget *createConfigWidget(ProjectExplorer::Kit *p) const; + ProjectExplorer::KitConfigWidget *createConfigWidget(ProjectExplorer::Kit *k) const; - QString displayNamePostfix(const ProjectExplorer::Kit *p) const; + QString displayNamePostfix(const ProjectExplorer::Kit *k) const; - ItemList toUserOutput(ProjectExplorer::Kit *p) const; + ItemList toUserOutput(ProjectExplorer::Kit *k) const; - void addToEnvironment(const ProjectExplorer::Kit *p, Utils::Environment &env) const; + void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const; - static int qtVersionId(const ProjectExplorer::Kit *p); - static void setQtVersionId(ProjectExplorer::Kit *p, const int id); - static BaseQtVersion *qtVersion(const ProjectExplorer::Kit *p); - static void setQtVersion(ProjectExplorer::Kit *p, const BaseQtVersion *v); -}; - -class QTSUPPORT_EXPORT QtTypeKitMatcher : public ProjectExplorer::KitMatcher -{ -public: - QtTypeKitMatcher(const QString &type); - - bool matches(const ProjectExplorer::Kit *p) const; - -private: - QString m_type; + static int qtVersionId(const ProjectExplorer::Kit *k); + static void setQtVersionId(ProjectExplorer::Kit *k, const int id); + static BaseQtVersion *qtVersion(const ProjectExplorer::Kit *k); + static void setQtVersion(ProjectExplorer::Kit *k, const BaseQtVersion *v); }; class QTSUPPORT_EXPORT QtPlatformKitMatcher : public ProjectExplorer::KitMatcher @@ -84,7 +73,7 @@ class QTSUPPORT_EXPORT QtPlatformKitMatcher : public ProjectExplorer::KitMatcher public: QtPlatformKitMatcher(const QString &platform); - bool matches(const ProjectExplorer::Kit *p) const; + bool matches(const ProjectExplorer::Kit *k) const; private: QString m_platform; @@ -99,7 +88,7 @@ public: m_min(min), m_max(max), m_features(required) { } - bool matches(const ProjectExplorer::Kit *p) const; + bool matches(const ProjectExplorer::Kit *k) const; private: QtVersionNumber m_min; diff --git a/src/plugins/texteditor/plaintexteditor.cpp b/src/plugins/texteditor/plaintexteditor.cpp index f95cf32c1f5..58ea7fdc940 100644 --- a/src/plugins/texteditor/plaintexteditor.cpp +++ b/src/plugins/texteditor/plaintexteditor.cpp @@ -69,7 +69,6 @@ PlainTextEditorWidget::PlainTextEditorWidget(QWidget *parent) { setRevisionsVisible(true); setMarksVisible(true); - setRequestMarkEnabled(false); setLineSeparatorsAllowed(true); setIndenter(new NormalIndenter); // Currently only "normal" indentation is supported. diff --git a/src/qtcreatorplugin.pri b/src/qtcreatorplugin.pri index ea0360753be..1c1d6b85589 100644 --- a/src/qtcreatorplugin.pri +++ b/src/qtcreatorplugin.pri @@ -33,11 +33,21 @@ isEmpty(TARGET) { error("qtcreatorplugin.pri: You must provide a TARGET") } +isEqual(QT_MAJOR_VERSION, 5) { + +defineReplace(stripOutDir) { + return($$relative_path($$1, $$OUT_PWD)) +} + +} else { # qt5 + defineReplace(stripOutDir) { 1 ~= s|^$$re_escape($$OUT_PWD/)||$$i_flag return($$1) } +} # qt5 + PLUGINSPEC = $$_PRO_FILE_PWD_/$${TARGET}.pluginspec PLUGINSPEC_IN = $${PLUGINSPEC}.in exists($$PLUGINSPEC_IN) { diff --git a/src/shared/proparser/proitems.h b/src/shared/proparser/proitems.h index 554842b2d1b..e8f382f89ee 100644 --- a/src/shared/proparser/proitems.h +++ b/src/shared/proparser/proitems.h @@ -296,6 +296,9 @@ enum ProToken { TokTestCall, // previous literal/expansion is a test function call // - ((nested expansion + TokArgSeparator)* + nested expansion)? // - TokFuncTerminator + TokReturn, // previous literal/expansion is a return value + TokBreak, // break loop + TokNext, // shortcut to next loop iteration TokNot, // '!' operator TokAnd, // ':' operator TokOr, // '|' operator diff --git a/src/shared/proparser/prowriter.cpp b/src/shared/proparser/prowriter.cpp index e70740efd95..eb51f31f413 100644 --- a/src/shared/proparser/prowriter.cpp +++ b/src/shared/proparser/prowriter.cpp @@ -159,6 +159,9 @@ static const ushort *skipToken(ushort tok, const ushort *&tokPtr, int &lineNo) case TokAnd: case TokOr: case TokCondition: + case TokReturn: + case TokNext: + case TokBreak: break; default: { const ushort *oTokPtr = --tokPtr; diff --git a/src/shared/proparser/qmakebuiltins.cpp b/src/shared/proparser/qmakebuiltins.cpp index 2b7b1cd434c..8248d249cc0 100644 --- a/src/shared/proparser/qmakebuiltins.cpp +++ b/src/shared/proparser/qmakebuiltins.cpp @@ -85,7 +85,7 @@ enum ExpandFunc { enum TestFunc { T_INVALID = 0, T_REQUIRES, T_GREATERTHAN, T_LESSTHAN, T_EQUALS, T_EXISTS, T_EXPORT, T_CLEAR, T_UNSET, T_EVAL, T_CONFIG, T_SYSTEM, - T_RETURN, T_BREAK, T_NEXT, T_DEFINED, T_CONTAINS, T_INFILE, + T_DEFINED, T_CONTAINS, T_INFILE, T_COUNT, T_ISEMPTY, T_INCLUDE, T_LOAD, T_DEBUG, T_LOG, T_MESSAGE, T_WARNING, T_ERROR, T_IF, T_MKPATH, T_WRITE_FILE, T_TOUCH, T_CACHE }; @@ -157,9 +157,6 @@ void QMakeEvaluator::initFunctionStatics() { "if", T_IF }, { "isActiveConfig", T_CONFIG }, { "system", T_SYSTEM }, - { "return", T_RETURN }, - { "break", T_BREAK }, - { "next", T_NEXT }, { "defined", T_DEFINED }, { "contains", T_CONTAINS }, { "infile", T_INFILE }, @@ -1066,17 +1063,6 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( return returnBool(m_functionDefs.replaceFunctions.contains(var) || m_functionDefs.testFunctions.contains(var)); } - case T_RETURN: - m_returnValue = args; - // It is "safe" to ignore returns - due to qmake brokeness - // they cannot be used to terminate loops anyway. - if (m_cumulative) - return ReturnTrue; - if (m_valuemapStack.size() == 1) { - evalError(fL1S("unexpected return().")); - return ReturnFalse; - } - return ReturnReturn; case T_EXPORT: { if (args.count() != 1) { evalError(fL1S("export(variable) requires one argument.")); @@ -1147,20 +1133,6 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( } return ret; } - case T_BREAK: - if (m_skipLevel) - return ReturnFalse; - if (m_loopLevel) - return ReturnBreak; - evalError(fL1S("Unexpected break().")); - return ReturnFalse; - case T_NEXT: - if (m_skipLevel) - return ReturnFalse; - if (m_loopLevel) - return ReturnNext; - evalError(fL1S("Unexpected next().")); - return ReturnFalse; case T_IF: { if (args.count() != 1) { evalError(fL1S("if(condition) requires one argument.")); diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp index 4fa44faf00e..7b83dffbc7c 100644 --- a/src/shared/proparser/qmakeevaluator.cpp +++ b/src/shared/proparser/qmakeevaluator.cpp @@ -184,7 +184,6 @@ QMakeEvaluator::QMakeEvaluator(QMakeGlobals *option, #ifdef PROEVALUATOR_CUMULATIVE m_skipLevel = 0; #endif - m_loopLevel = 0; m_listCount = 0; m_valuemapStack.push(ProValueMap()); m_valuemapInited = false; @@ -673,6 +672,21 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock( invert = false; curr.clear(); continue; + case TokReturn: + m_returnValue = curr; + curr.clear(); + ret = ReturnReturn; + goto ctrlstm; + case TokBreak: + ret = ReturnBreak; + goto ctrlstm; + case TokNext: + ret = ReturnNext; + ctrlstm: + if (!m_skipLevel && okey != or_op) + return ret; + okey = false, or_op = true; // force next evaluation + continue; default: { const ushort *oTokPtr = --tokPtr; evaluateExpression(tokPtr, &curr, false); @@ -752,7 +766,6 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop( else traceMsg("entering loop for %s over %s", dbgKey(variable), dbgStrList(list)); - m_loopLevel++; forever { if (infinite) { if (!variable.isEmpty()) @@ -789,7 +802,6 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop( } } do_break: - m_loopLevel--; traceMsg("done looping"); @@ -1565,8 +1577,6 @@ ProStringList QMakeEvaluator::evaluateFunction( } else { m_valuemapStack.push(ProValueMap()); m_locationStack.push(m_current); - int loopLevel = m_loopLevel; - m_loopLevel = 0; ProStringList args; for (int i = 0; i < argumentsList.count(); ++i) { @@ -1579,7 +1589,6 @@ ProStringList QMakeEvaluator::evaluateFunction( ret = m_returnValue; m_returnValue.clear(); - m_loopLevel = loopLevel; m_current = m_locationStack.pop(); m_valuemapStack.pop(); } diff --git a/src/shared/proparser/qmakeevaluator.h b/src/shared/proparser/qmakeevaluator.h index f84f0502faf..e28672ad15e 100644 --- a/src/shared/proparser/qmakeevaluator.h +++ b/src/shared/proparser/qmakeevaluator.h @@ -222,7 +222,6 @@ public: static void removeEach(ProStringList *varlist, const ProStringList &value); QMakeEvaluator *m_caller; - int m_loopLevel; // To report unexpected break() and next()s #ifdef PROEVALUATOR_CUMULATIVE bool m_cumulative; int m_skipLevel; diff --git a/src/shared/proparser/qmakeparser.cpp b/src/shared/proparser/qmakeparser.cpp index 8d221e40984..9187e93f6e7 100644 --- a/src/shared/proparser/qmakeparser.cpp +++ b/src/shared/proparser/qmakeparser.cpp @@ -97,6 +97,9 @@ static struct { QString strdefineTest; QString strdefineReplace; QString stroption; + QString strreturn; + QString strnext; + QString strbreak; QString strhost_build; QString strLINE; QString strFILE; @@ -117,6 +120,9 @@ void QMakeParser::initialize() statics.strdefineTest = QLatin1String("defineTest"); statics.strdefineReplace = QLatin1String("defineReplace"); statics.stroption = QLatin1String("option"); + statics.strreturn = QLatin1String("return"); + statics.strnext = QLatin1String("next"); + statics.strbreak = QLatin1String("break"); statics.strhost_build = QLatin1String("host_build"); statics.strLINE = QLatin1String("_LINE_"); statics.strFILE = QLatin1String("_FILE_"); @@ -873,9 +879,11 @@ void QMakeParser::putLineMarker(ushort *&tokPtr) void QMakeParser::enterScope(ushort *&tokPtr, bool special, ScopeState state) { + uchar nest = m_blockstack.top().nest; m_blockstack.resize(m_blockstack.size() + 1); m_blockstack.top().special = special; m_blockstack.top().start = tokPtr; + m_blockstack.top().nest = nest; tokPtr += 2; m_state = state; m_canElse = false; @@ -1015,14 +1023,16 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg m_tmp.setRawData((QChar *)uc + 4, nlen); const QString *defName; ushort defType; + uchar nest; if (m_tmp == statics.strfor) { - flushCond(tokPtr); - putLineMarker(tokPtr); if (m_invert || m_operator == OrOperator) { // '|' could actually work reasonably, but qmake does nonsense here. parseError(fL1S("Unexpected operator in front of for().")); + bogusTest(tokPtr); return; } + flushCond(tokPtr); + putLineMarker(tokPtr); if (*uce == (TokLiteral|TokNewStr)) { nlen = uce[1]; uc = uce + 2 + nlen; @@ -1036,6 +1046,7 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg didFor: putTok(tokPtr, TokValueTerminator); enterScope(tokPtr, true, StCtrl); + m_blockstack.top().nest |= NestLoop; return; } else if (*uc == TokArgSeparator && argc == 2) { // for(var, something) @@ -1065,12 +1076,13 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg defName = &statics.strdefineTest; defType = TokTestDef; deffunc: - flushScopes(tokPtr); - putLineMarker(tokPtr); if (m_invert) { parseError(fL1S("Unexpected operator in front of function definition.")); + bogusTest(tokPtr); return; } + flushScopes(tokPtr); + putLineMarker(tokPtr); if (*uce == (TokLiteral|TokNewStr)) { uint nlen = uce[1]; if (uce[nlen + 2] == TokFuncTerminator) { @@ -1081,15 +1093,53 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg putTok(tokPtr, defType); putHashStr(tokPtr, uce + 2, nlen); enterScope(tokPtr, true, StCtrl); + m_blockstack.top().nest = NestFunction; return; } } parseError(fL1S("%1(function) requires one literal argument.").arg(*defName)); return; + } else if (m_tmp == statics.strreturn) { + if (argc > 1) { + parseError(fL1S("return() requires zero or one argument.")); + bogusTest(tokPtr); + return; + } + defType = TokReturn; + nest = NestFunction; + goto ctrlstm2; + } else if (m_tmp == statics.strnext) { + defType = TokNext; + goto ctrlstm; + } else if (m_tmp == statics.strbreak) { + defType = TokBreak; + ctrlstm: + if (*uce != TokFuncTerminator) { + parseError(fL1S("%1() requires zero arguments.").arg(m_tmp)); + bogusTest(tokPtr); + return; + } + nest = NestLoop; + ctrlstm2: + if (m_invert) { + parseError(fL1S("Unexpected NOT operator in front of %1().").arg(m_tmp)); + bogusTest(tokPtr); + return; + } + if (!(m_blockstack.top().nest & nest)) { + parseError(fL1S("Unexpected %1().").arg(m_tmp)); + bogusTest(tokPtr); + return; + } + finalizeTest(tokPtr); + putBlock(tokPtr, uce, ptr - uce - 1); // Only for TokReturn + putTok(tokPtr, defType); + return; } else if (m_tmp == statics.stroption) { if (m_state != StNew || m_blockstack.top().braceLevel || m_blockstack.size() > 1 || m_invert || m_operator != NoOperator) { parseError(fL1S("option() must appear outside any control structures.")); + bogusTest(tokPtr); return; } if (*uce == (TokLiteral|TokNewStr)) { diff --git a/src/shared/proparser/qmakeparser.h b/src/shared/proparser/qmakeparser.h index 0832fff8fcf..02322c52494 100644 --- a/src/shared/proparser/qmakeparser.h +++ b/src/shared/proparser/qmakeparser.h @@ -84,13 +84,20 @@ public: SubGrammar grammar = FullGrammar); private: + enum ScopeNesting { + NestNone = 0, + NestLoop = 1, + NestFunction = 2 + }; + struct BlockScope { - BlockScope() : start(0), braceLevel(0), special(false), inBranch(false) {} + BlockScope() : start(0), braceLevel(0), special(false), inBranch(false), nest(NestNone) {} BlockScope(const BlockScope &other) { *this = other; } ushort *start; // Where this block started; store length here int braceLevel; // Nesting of braces in scope bool special; // Single-line conditionals inside loops, etc. cannot have else branches bool inBranch; // The 'else' branch of the previous TokBranch is still open + uchar nest; // Into what control structures we are nested }; enum ScopeState { diff --git a/tests/system/objects.map b/tests/system/objects.map index d0d8ebfbd97..e63bf0b1fba 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -1,12 +1,24 @@ :*Qt Creator.Clear_QToolButton {text='Clear' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.Continue_Core::Internal::FancyToolButton {text='Continue' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.DoubleTabWidget_ProjectExplorer::Internal::DoubleTabWidget {name='ProjectExplorer__Internal__DoubleTabWidget' type='ProjectExplorer::Internal::DoubleTabWidget' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='DoubleTabWidget'} +:*Qt Creator.Find_Find::Internal::FindToolBar {name='Find__Internal__FindWidget' type='Find::Internal::FindToolBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Find'} :*Qt Creator.Interrupt_Core::Internal::FancyToolButton {text='Interrupt' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.Start Debugging_Core::Internal::FancyToolButton {text='Start Debugging' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.findEdit_Utils::FilterLineEdit {name='findEdit' type='Utils::FilterLineEdit' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator_Core::Internal::FancyToolButton {occurrence='3' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator_Utils::FilterLineEdit {type='Utils::FilterLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator_Utils::IconButton {occurrence='4' type='Utils::IconButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:About Qt Creator_Core::Internal::VersionDialog {type='Core::Internal::VersionDialog' unnamed='1' visible='1' windowTitle='About Qt Creator'} +:Add Bookmark.ExpandBookmarksList_QToolButton {name='toolButton' text='+' type='QToolButton' visible='1' window=':Add Bookmark_BookmarkDialog'} +:Add Bookmark.New Folder_QPushButton {name='newFolderButton' text='New Folder' type='QPushButton' visible='1' window=':Add Bookmark_BookmarkDialog'} +:Add Bookmark.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Add Bookmark_BookmarkDialog'} +:Add Bookmark.treeView_QExpandingLineEdit {container=':Add Bookmark.treeView_QTreeView' type='QExpandingLineEdit' unnamed='1' visible='1'} +:Add Bookmark.treeView_QTreeView {name='treeView' type='QTreeView' visible='1' window=':Add Bookmark_BookmarkDialog'} +:Add Bookmark_BookmarkDialog {name='BookmarkDialog' type='BookmarkDialog' visible='1' windowTitle='Add Bookmark'} +:Add to Version Control.No_QPushButton {text='No' type='QPushButton' unnamed='1' visible='1' window=':Add to Version Control_QMessageBox'} +:Add to Version Control_QMessageBox {type='QMessageBox' unnamed='1' visible='1' windowTitle='Add to Version Control'} +:Behavior.Autocomplete common prefix_QCheckBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='partiallyComplete' text='Autocomplete common prefix' type='QCheckBox' visible='1'} +:Behavior.completionTrigger_QComboBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='completionTrigger' type='QComboBox' visible='1'} :Breakpoints_Debugger::Internal::BreakTreeView {container=':DebugModeWidget.Breakpoints_QDockWidget' type='Debugger::Internal::BreakTreeView' unnamed='1' visible='1'} :CMake Wizard.Cancel_QPushButton {text='Cancel' type='QPushButton' unnamed='1' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'} :CMake Wizard.Finish_QPushButton {text~='(Finish|Done)' type='QPushButton' unnamed='1' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'} @@ -14,6 +26,7 @@ :CMake Wizard.Next_QPushButton {name='__qt__passive_wizardbutton1' text~='(Next.*|Continue)' type='QPushButton' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'} :CMake Wizard.Run CMake_QPushButton {text='Run CMake' type='QPushButton' unnamed='1' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'} :CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard {type='CMakeProjectManager::Internal::CMakeOpenProjectWizard' unnamed='1' visible='1' windowTitle='CMake Wizard'} +:CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox {container=':qt_tabwidget_stackedwidget.CppTools__Internal__CompletionSettingsPage_QWidget' name='groupBox' title='Behavior' type='QGroupBox' visible='1'} :DebugModeWidget.Breakpoints_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.Break' type='QDockWidget' visible='1' windowTitle='Breakpoints'} :DebugModeWidget.Debugger Log_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.Output' type='QDockWidget' visible='1' windowTitle='Debugger Log'} :DebugModeWidget.Debugger Toolbar_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger Toolbar' type='QDockWidget' visible='1' windowTitle='Debugger Toolbar'} @@ -21,11 +34,16 @@ :Debugger Toolbar.Continue_QToolButton {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' text='Continue' type='QToolButton' unnamed='1' visible='1'} :Debugger Toolbar.Exit Debugger_QToolButton {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' text='Stop Debugger' type='QToolButton' unnamed='1' visible='1'} :Debugger Toolbar.StatusText_Utils::StatusLabel {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' type='Utils::StatusLabel' unnamed='1'} +:Dialog.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Dialog_QmlJSEditor::Internal::ComponentNameDialog'} +:Dialog.componentNameEdit_QLineEdit {name='componentNameEdit' type='Utils::ClassNameValidatingLineEdit' visible='1' window=':Dialog_QmlJSEditor::Internal::ComponentNameDialog'} +:Dialog_QmlJSEditor::Internal::ComponentNameDialog {name='QmlJSEditor__Internal__ComponentNameDialog' type='QmlJSEditor::Internal::ComponentNameDialog' visible='1' windowTitle='Move Component into Separate File'} :Edit Environment_ProjectExplorer::EnvironmentItemsDialog {type='ProjectExplorer::EnvironmentItemsDialog' unnamed='1' visible='1' windowTitle='Edit Environment'} :Failed to start application_QMessageBox {type='QMessageBox' unnamed='1' visible='1' windowTitle='Failed to start application'} :Generator:_QComboBox {buddy=':CMake Wizard.Generator:_QLabel' type='QComboBox' unnamed='1' visible='1'} +:Hits_QCLuceneResultWidget {aboveWidget=':Hits_QLabel' type='QCLuceneResultWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Hits_QLabel {text~='\\\\d+ - \\\\d+ of \\\\d+ Hits' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Kits_QTreeView {container=':qt_tabwidget_stackedwidget_QWidget' type='QTreeView' unnamed='1' visible='1'} -:Kits_QtVersion_QComboBox {container=':qt_tabwidget_stackedwidget_QWidget' occurrence='5' type='QComboBox' unnamed='1' visible='1'} +:Kits_QtVersion_QComboBox {container=':qt_tabwidget_stackedwidget_QWidget' occurrence='4' type='QComboBox' unnamed='1' visible='1'} :New.frame_QFrame {name='frame' type='QFrame' visible='1' window=':New_Core::Internal::NewDialog'} :New.templateCategoryView_QTreeView {name='templateCategoryView' type='QTreeView' visible='1' window=':New_Core::Internal::NewDialog'} :New_Core::Internal::NewDialog {name='Core__Internal__NewDialog' type='Core::Internal::NewDialog' visible='1' windowTitle='New'} @@ -38,21 +56,33 @@ :Options_QListView {type='QListView' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'} :QML Debugging.No_QPushButton {text='No' type='QPushButton' unnamed='1' visible='1' window=':QML Debugging_QMessageBox'} :QML Debugging_QMessageBox {type='QMessageBox' unnamed='1' visible='1' windowTitle='QML Debugging'} +:Qt Creator.Add Bookmark_QToolButton {text='Add Bookmark' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator.CloseFind_QToolButton {name='close' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Compile Output_Core::OutputWindow {type='Core::OutputWindow' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Compile Output'} :Qt Creator.DebugModeWidget_QSplitter {name='DebugModeWidget' type='QSplitter' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator.Help_Search for:_QLineEdit {leftWidget=':Qt Creator.Search for:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Issues_QListView {type='QListView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'} :Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.ReRun_QToolButton {toolTip='Re-run this run-configuration' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator.Replace All_QToolButton {name='replaceAllButton' text='Replace All' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator.Replace_QToolButton {name='replaceButton' text='Replace' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator.Search for:_QLabel {text='Search for:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.Stop_QToolButton {text='Stop' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator.replaceEdit_Utils::FilterLineEdit {name='replaceEdit' type='Utils::FilterLineEdit' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.scrollArea_QScrollArea {name='scrollArea' type='QScrollArea' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton {occurrence='3' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator_Bookmarks_TreeView {type='TreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_CloseButton {type='CloseButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_CompileOutput_Core::Internal::OutputPaneToggleButton {occurrence='4' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator_Core::Internal::CommandComboBox {type='Core::Internal::CommandComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' visible='1' windowTitle?='*Qt Creator'} :Qt Creator_CppEditor::Internal::CPPEditorWidget {type='CppEditor::Internal::CPPEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator_Find::Internal::SearchResultTreeView {type='Find::Internal::SearchResultTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator_Help::Internal::HelpViewer {type='Help::Internal::HelpViewer' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Issues_Core::Internal::OutputPaneToggleButton {occurrence='1' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator_QmlJSEditor::QmlJSTextEditorWidget {type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator_QHelpContentWidget {type='QHelpContentWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_QTableView {type='QTableView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:Qt Creator_QmlJSEditor::QmlJSTextEditorWidget {type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_SearchResult_Core::Internal::OutputPaneToggleButton {occurrence='2' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_SystemSettings.Details_Utils::DetailsButton {occurrence='4' text='Details' type='Utils::DetailsButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Utils::NavigationTreeView {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} @@ -69,6 +99,9 @@ :formFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Form file:_QLabel' name='formFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'} :frame.templateDescription_QTextBrowser {container=':New.frame_QFrame' name='templateDescription' type='QTextBrowser' visible='1'} :headerFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Header file:_QLabel' name='headerFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'} +:popupFrame_Proposal_QListView {container=':popupFrame_TextEditor::GenericProposalWidget' type='QListView' unnamed='1' visible='1'} +:popupFrame_TextEditor::GenericProposalWidget {name='m_popupFrame' type='TextEditor::GenericProposalWidget' visible='1'} +:qt_tabwidget_stackedwidget.CppTools__Internal__CompletionSettingsPage_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='CppTools__Internal__CompletionSettingsPage' type='QWidget' visible='1'} :qt_tabwidget_stackedwidget.QtSupport__Internal__QtVersionManager_QtSupport::Internal::QtOptionsPageWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='QtSupport__Internal__QtVersionManager' type='QtSupport::Internal::QtOptionsPageWidget' visible='1'} :qt_tabwidget_stackedwidget_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' type='QWidget' unnamed='1' visible='1'} :scrollArea.Create Build Configurations:_QComboBox_2 {container=':Qt Gui Application.scrollArea_QScrollArea' leftWidget=':scrollArea.Create Build Configurations:_QLabel_2' type='QComboBox' unnamed='1' visible='1'} diff --git a/tests/system/suite_CSUP/objects.map b/tests/system/suite_CSUP/objects.map deleted file mode 100644 index eb3b60f6abf..00000000000 --- a/tests/system/suite_CSUP/objects.map +++ /dev/null @@ -1,24 +0,0 @@ -:*Qt Creator.Find_Find::Internal::FindToolBar {name='Find__Internal__FindWidget' type='Find::Internal::FindToolBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Find'} -:Behavior.Autocomplete common prefix_QCheckBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='partiallyComplete' text='Autocomplete common prefix' type='QCheckBox' visible='1'} -:Behavior.completionTrigger_QComboBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='completionTrigger' type='QComboBox' visible='1'} -:CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox {container=':qt_tabwidget_stackedwidget.CppTools__Internal__CompletionSettingsPage_QWidget' name='groupBox' title='Behavior' type='QGroupBox' visible='1'} -:Next_QPushButton {text~='(Next.*|Continue)' type='QPushButton' visible='1'} -:Options.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'} -:Options.qt_tabwidget_stackedwidget_QStackedWidget {name='qt_tabwidget_stackedwidget' type='QStackedWidget' visible='1' window=':Options_Core::Internal::SettingsDialog'} -:Options.qt_tabwidget_tabbar_QTabBar {name='qt_tabwidget_tabbar' type='QTabBar' visible='1' window=':Options_Core::Internal::SettingsDialog'} -:Options_Core::Internal::SettingsDialog {type='Core::Internal::SettingsDialog' unnamed='1' visible='1' windowTitle~='(Options|Preferences)'} -:Options_QListView {type='QListView' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'} -:Qt Creator.CloseFind_QToolButton {name='close' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.Replace All_QToolButton {name='replaceAllButton' text='Replace All' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.Replace_QToolButton {name='replaceButton' text='Replace' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.findEdit_Utils::FilterLineEdit {name='findEdit' type='Utils::FilterLineEdit' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.replaceEdit_Utils::FilterLineEdit {name='replaceEdit' type='Utils::FilterLineEdit' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' unnamed='1' visible='1' windowTitle?='*Qt Creator'} -:Qt Creator_CppEditor::Internal::CPPEditorWidget {type='CppEditor::Internal::CPPEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator_SearchResult_Core::Internal::OutputPaneToggleButton {occurrence='2' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator_Utils::NavigationTreeView {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:addToVersionControlComboBox_QComboBox {name='addToVersionControlComboBox' type='QComboBox' visible='1'} -:m_popupFrame_QListView {container=':m_popupFrame_TextEditor::GenericProposalWidget' type='QListView' unnamed='1' visible='1'} -:m_popupFrame_TextEditor::GenericProposalWidget {name='m_popupFrame' type='TextEditor::GenericProposalWidget' visible='1'} -:qt_tabwidget_stackedwidget.CppTools__Internal__CompletionSettingsPage_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='CppTools__Internal__CompletionSettingsPage' type='QWidget' visible='1'} diff --git a/tests/system/suite_CSUP/suite.conf b/tests/system/suite_CSUP/suite.conf index 56fb1249186..075687a2056 100644 --- a/tests/system/suite_CSUP/suite.conf +++ b/tests/system/suite_CSUP/suite.conf @@ -1,10 +1,12 @@ AUT=qtcreator CLASS= CLASSPATH= +CWD= ENVVARS=envvars HOOK_SUB_PROCESSES=false IMPLICITAUTSTART=0 LANGUAGE=Python +OBJECTMAP=../objects.map TEST_CASES=tst_CSUP01 tst_CSUP02 tst_CSUP04 tst_CSUP05 VERSION=2 WRAPPERS=Qt diff --git a/tests/system/suite_CSUP/tst_CSUP01/test.py b/tests/system/suite_CSUP/tst_CSUP01/test.py index 90d8ec295ae..10b4f3ffa6b 100644 --- a/tests/system/suite_CSUP/tst_CSUP01/test.py +++ b/tests/system/suite_CSUP/tst_CSUP01/test.py @@ -24,8 +24,8 @@ def main(): type(editorWidget, "") else: type(editorWidget, "") - waitForObjectItem(":m_popupFrame_QListView", "register") - doubleClickItem(":m_popupFrame_QListView", "register", 5, 5, 0, Qt.LeftButton) + waitForObjectItem(":popupFrame_Proposal_QListView", "register") + doubleClickItem(":popupFrame_Proposal_QListView", "register", 5, 5, 0, Qt.LeftButton) test.verify(str(editorWidget.plainText).startswith("register"), "Step 3: Verifying if: The list of suggestions is opened. It is " "possible to select one of the suggestions.") @@ -37,8 +37,8 @@ def main(): type(editorWidget, "") type(editorWidget, "") type(editorWidget, "voi") - waitForObjectItem(":m_popupFrame_QListView", "void") - type(waitForObject(":m_popupFrame_QListView"), "") + waitForObjectItem(":popupFrame_Proposal_QListView", "void") + type(waitForObject(":popupFrame_Proposal_QListView"), "") test.verify(str(editorWidget.plainText).startswith("void"), "Step 4: Verifying if: Word 'void' is completed because only one option is available.") # Step 5: From "Tools -> Options -> Text Editor -> Completion" select Activate completion Manually, @@ -58,7 +58,7 @@ def main(): type(editorWidget, "") else: type(editorWidget, "") - waitForObjectItem(":m_popupFrame_QListView", "return") + waitForObjectItem(":popupFrame_Proposal_QListView", "return") type(editorWidget, "") type(editorWidget, "") test.verify(str(editorWidget.plainText).startswith("ret#"), @@ -67,5 +67,3 @@ def main(): # exit qt creator invokeMenuItem("File", "Save All") invokeMenuItem("File", "Exit") -# no cleanup needed, as whole testing directory gets properly removed after test finished - diff --git a/tests/system/suite_CSUP/tst_CSUP02/test.py b/tests/system/suite_CSUP/tst_CSUP02/test.py index 493b50bf482..9e5a5b9c7a4 100644 --- a/tests/system/suite_CSUP/tst_CSUP02/test.py +++ b/tests/system/suite_CSUP/tst_CSUP02/test.py @@ -25,12 +25,12 @@ def main(): type(editorWidget, "") else: type(editorWidget, "") - type(waitForObject(":m_popupFrame_QListView"), "") - type(waitForObject(":m_popupFrame_QListView"), "") - listView = waitForObject(":m_popupFrame_QListView") + type(waitForObject(":popupFrame_Proposal_QListView"), "") + type(waitForObject(":popupFrame_Proposal_QListView"), "") + listView = waitForObject(":popupFrame_Proposal_QListView") test.compare("class derived from QObject", str(listView.model().data(listView.currentIndex())), "Verifying selecting the correct entry.") - type(waitForObject(":m_popupFrame_QListView"), "") + type(waitForObject(":popupFrame_Proposal_QListView"), "") test.verify(str(editorWidget.plainText).startswith("class name : public QObject"), "Steps 3&4: Verifying if: The list of suggestions is opened. It is " "possible to select one of the suggestions. Code with several " @@ -51,5 +51,3 @@ def main(): # exit qt creator invokeMenuItem("File", "Save All") invokeMenuItem("File", "Exit") -# no cleanup needed, as whole testing directory gets properly removed after test finished - diff --git a/tests/system/suite_CSUP/tst_CSUP04/test.py b/tests/system/suite_CSUP/tst_CSUP04/test.py index 1b8b9c9c1ba..cafe7cf5828 100644 --- a/tests/system/suite_CSUP/tst_CSUP04/test.py +++ b/tests/system/suite_CSUP/tst_CSUP04/test.py @@ -51,7 +51,6 @@ def main(): # exit qt creator invokeMenuItem("File", "Save All") invokeMenuItem("File", "Exit") -# no cleanup needed, as whole testing directory gets properly removed after test finished def __handleFutureProgress__(obj): global searchFinished diff --git a/tests/system/suite_CSUP/tst_CSUP05/test.py b/tests/system/suite_CSUP/tst_CSUP05/test.py index 035b102111e..bc5d5a1e0e1 100644 --- a/tests/system/suite_CSUP/tst_CSUP05/test.py +++ b/tests/system/suite_CSUP/tst_CSUP05/test.py @@ -33,7 +33,7 @@ def main(): # verify if find toolbar exists and if search text contains selected word test.verify(checkIfObjectExists(":*Qt Creator.Find_Find::Internal::FindToolBar"), "Verifying if: Find/Replace pane is displayed at the bottom of the view.") - test.compare(waitForObject(":Qt Creator.findEdit_Utils::FilterLineEdit").displayText, "viewer", + test.compare(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit").displayText, "viewer", "Verifying if: Find line edit contains 'viewer' text.") # insert some word to "Replace with:" field and select "Replace All". replaceEditorContent(waitForObject(":Qt Creator.replaceEdit_Utils::FilterLineEdit"), "find") @@ -65,4 +65,3 @@ def main(): # exit qt creator invokeMenuItem("File", "Save All") invokeMenuItem("File", "Exit") -# no cleanup needed, as whole testing directory gets properly removed after test finished diff --git a/tests/system/suite_HELP/objects.map b/tests/system/suite_HELP/objects.map deleted file mode 100644 index 00e9f70c421..00000000000 --- a/tests/system/suite_HELP/objects.map +++ /dev/null @@ -1,55 +0,0 @@ -:About Qt Creator.Close_QPushButton {text='Close' type='QPushButton' unnamed='1' visible='1' window=':About Qt Creator_Core::Internal::VersionDialog'} -:About Qt Creator.Label {text?='*Qt Creator*' type='QLabel' unnamed='1' visible='1' window=':About Qt Creator_Core::Internal::VersionDialog'} -:About Qt Creator_Core::Internal::VersionDialog {type='Core::Internal::VersionDialog' unnamed='1' visible='1' windowTitle='About Qt Creator'} -:Add Bookmark.+_QToolButton {name='toolButton' text='+' type='QToolButton' visible='1' window=':Add Bookmark_BookmarkDialog'} -:Add Bookmark.New Folder_QPushButton {name='newFolderButton' text='New Folder' type='QPushButton' visible='1' window=':Add Bookmark_BookmarkDialog'} -:Add Bookmark.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Add Bookmark_BookmarkDialog'} -:Add Bookmark.line_QFrame {name='line' type='QFrame' visible='1' window=':Add Bookmark_BookmarkDialog'} -:Add Bookmark.line_QMenu {aboveWidget=':Add Bookmark.line_QFrame' type='QMenu' unnamed='1' visible='1' window=':Add Bookmark_BookmarkDialog'} -:Add Bookmark.treeView_QTreeView {name='treeView' type='QTreeView' visible='1' window=':Add Bookmark_BookmarkDialog'} -:Add Bookmark_BookmarkDialog {name='BookmarkDialog' type='BookmarkDialog' visible='1' windowTitle='Add Bookmark'} -:Folder 1.Folder 2_QModelIndex {column='0' container=':Sample.Folder 1_QModelIndex' text='Folder 2' type='QModelIndex'} -:Folder 2.Qt Creator : Building and Running an Example_QModelIndex {column='0' container=':Folder 1.Folder 2_QModelIndex' text?='QtCreator : Building and Running an Example*' type='QModelIndex'} -:Getting Started.Building and Running an Example_QModelIndex {column='0' container=':Qt Creator Manual*.Getting Started_QModelIndex' text='Building and Running an Example' type='QModelIndex'} -:Hits_QCLuceneResultWidget {aboveWidget=':Hits_QLabel' type='QCLuceneResultWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Hits_QLabel {text~='\\\\d+ - \\\\d+ of \\\\d+ Hits' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:New Folder.Qt Creator : Qt Creator Manual_QModelIndex {column='0' container=':Sample.New Folder_QModelIndex' text='QtCreator : Qt Creator Manual' type='QModelIndex'} -:Next_QPushButton {text~='(Next.*|Continue)' type='QPushButton' visible='1'} -:Options.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'} -:Options.qt_tabwidget_tabbar_QTabBar {name='qt_tabwidget_tabbar' type='QTabBar' visible='1' window=':Options_Core::Internal::SettingsDialog'} -:Options_Core::Internal::SettingsDialog {type='Core::Internal::SettingsDialog' unnamed='1' visible='1' windowTitle~='Options|Preferences'} -:Options_QListView {type='QListView' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'} -:Qt Creator Manual QModelIndex {column='0' container=':Qt Creator_QHelpContentWidget' text~='Qt Creator Manual 2\\\\.[1-9]+[0-9]?\\\\.[1-9]+[0-9]?' type='QModelIndex'} -:Qt Creator Manual*.Getting Started_QModelIndex {column='0' container=':Qt Creator Manual QModelIndex' text='Getting Started' type='QModelIndex'} -:Qt Creator.+_QToolButton {text='+' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.Add Bookmark_QToolButton {text='Add Bookmark' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.Search for:_QLabel {text='Search for:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.Search for:_QLineEdit {leftWidget=':Qt Creator.Search for:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.Search_QPushButton {text='Search' type='QPushButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.with all of the words:_QLabel {text='with all of the words:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.with all of the words:_QLineEdit {leftWidget=':Qt Creator.with all of the words:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.with at least one of the words:_QLabel {text='with at least one of the words:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.with at least one of the words:_QLineEdit {leftWidget=':Qt Creator.with at least one of the words:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.with exact phrase:_QLabel {text='with exact phrase:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.with exact phrase:_QLineEdit {leftWidget=':Qt Creator.with exact phrase:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.without the words:_QLabel {text='without the words:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.without the words:_QLineEdit {leftWidget=':Qt Creator.without the words:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.words similar to:_QLabel {text='words similar to:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.words similar to:_QLineEdit {leftWidget=':Qt Creator.words similar to:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator_Core::Internal::CommandComboBox {occurrence='2' type='Core::Internal::CommandComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator_Core::Internal::CommandComboBox_2 {type='Core::Internal::CommandComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' unnamed='1' visible='1' windowTitle?='*Qt Creator'} -:Qt Creator_Help::Internal::HelpViewer {type='Help::Internal::HelpViewer' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator_QHelpContentWidget {type='QHelpContentWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator_QHelpSearchQueryWidget {type='QHelpSearchQueryWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator_QmlJSEditor::QmlJSTextEditorWidget {type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator_TreeView {type='TreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Reference Documentation_QModelIndex {column='0' container=':Qt Creator_QHelpContentWidget' text='Qt Reference Documentation' type='QModelIndex'} -:Sample.Folder 1_QModelIndex {column='0' container=':Sample_QModelIndex' text='Folder 1' type='QModelIndex'} -:Sample.New Folder_QModelIndex {column='0' container=':Sample_QModelIndex' text?='New Folder*' type='QModelIndex'} -:Sample_QModelIndex {column='0' container=':Qt Creator_TreeView' text='Sample' type='QModelIndex'} -:addToVersionControlComboBox_QComboBox {name='addToVersionControlComboBox' type='QComboBox' visible='1'} -:treeView.Sample_QModelIndex {column='0' container=':Add Bookmark.treeView_QTreeView' text='Sample' type='QModelIndex'} -:treeView.Yes_QPushButton {container=':Add Bookmark.treeView_QTreeView' text='Yes' type='QPushButton' unnamed='1' visible='1'} -:treeView_QExpandingLineEdit {container=':Add Bookmark.treeView_QTreeView' type='QExpandingLineEdit' unnamed='1' visible='1'} diff --git a/tests/system/suite_HELP/suite.conf b/tests/system/suite_HELP/suite.conf index bc9c7f65ab8..66e20c3928b 100755 --- a/tests/system/suite_HELP/suite.conf +++ b/tests/system/suite_HELP/suite.conf @@ -1,10 +1,12 @@ AUT=qtcreator CLASS= CLASSPATH= +CWD= ENVVARS=envvars HOOK_SUB_PROCESSES=false IMPLICITAUTSTART=0 LANGUAGE=Python +OBJECTMAP=../objects.map TEST_CASES=tst_HELP02 tst_HELP04 tst_HELP05 tst_HELP06 VERSION=2 WRAPPERS=Qt diff --git a/tests/system/suite_HELP/tst_HELP02/test.py b/tests/system/suite_HELP/tst_HELP02/test.py index 79673ed4452..0820110a153 100755 --- a/tests/system/suite_HELP/tst_HELP02/test.py +++ b/tests/system/suite_HELP/tst_HELP02/test.py @@ -3,7 +3,9 @@ source("../../shared/suites_qtta.py") # test Qt Creator version information from file and dialog def getQtCreatorVersionFromDialog(): - chk = re.search("(?<=Qt Creator)\s\d+.\d+.\d+" , str(waitForObject(':About Qt Creator.Label' ).text)) + chk = re.search("(?<=Qt Creator)\s\d+.\d+.\d+", + str(waitForObject("{text?='*Qt Creator*' type='QLabel' unnamed='1' visible='1' " + "window=':About Qt Creator_Core::Internal::VersionDialog'}").text)) try: ver = chk.group(0).strip() return ver @@ -37,9 +39,11 @@ def main(): waitForObject(":About Qt Creator_Core::Internal::VersionDialog") actualVersion = getQtCreatorVersionFromDialog() test.verify(actualVersion == expectedVersion, - "Verifying if version is good. Current version is: " + actualVersion + ", expected version is: " + expectedVersion) + "Verifying version. Current version is '%s', expected version is '%s'" + % (actualVersion, expectedVersion)) # close and verify about dialog closed - clickButton(waitForObject(":About Qt Creator.Close_QPushButton")) + clickButton(waitForObject("{text='Close' type='QPushButton' unnamed='1' visible='1' " + "window=':About Qt Creator_Core::Internal::VersionDialog'}")) test.verify(checkIfObjectExists(":About Qt Creator_Core::Internal::VersionDialog", False), "Verifying if About dialog closed.") # exit qt creator @@ -47,4 +51,3 @@ def main(): # verify if qt creator closed properly test.verify(checkIfObjectExists(":Qt Creator_Core::Internal::MainWindow", False), "Verifying if Qt Creator closed.") -# no cleanup needed diff --git a/tests/system/suite_HELP/tst_HELP04/test.py b/tests/system/suite_HELP/tst_HELP04/test.py index c75cc069b2c..caca5f3fb90 100755 --- a/tests/system/suite_HELP/tst_HELP04/test.py +++ b/tests/system/suite_HELP/tst_HELP04/test.py @@ -48,22 +48,25 @@ def main(): # switch to help mode switchViewTo(ViewConstants.HELP) # verify that search widget is accessible - mouseClick(waitForObjectItem(":Qt Creator_Core::Internal::CommandComboBox_2", "Search")) - test.verify(checkIfObjectExists(":Qt Creator_QHelpSearchQueryWidget"), + mouseClick(waitForObjectItem(":Qt Creator_Core::Internal::CommandComboBox", "Search")) + test.verify(checkIfObjectExists("{type='QHelpSearchQueryWidget' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}"), "Verifying search widget visibility.") # try to search empty string - clickButton(waitForObject(":Qt Creator.Search_QPushButton")) + clickButton(waitForObject("{text='Search' type='QPushButton' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}")) progressBarWait() test.verify(waitFor("noMatch in " "str(waitForObject(':Hits_QCLuceneResultWidget').plainText)", 2000), "Verifying if search did not match anything.") # workaround for "endless waiting cursor" - mouseClick(waitForObject(":Qt Reference Documentation_QModelIndex")) + mouseClick(waitForObject("{column='0' container=':Qt Creator_QHelpContentWidget' " + "text='Qt Reference Documentation' type='QModelIndex'}")) # try to search keyword from list for searchKeyword,shouldFind in searchKeywordDictionary.items(): - mouseClick(waitForObject(":Qt Creator.Search for:_QLineEdit")) - replaceEditorContent(":Qt Creator.Search for:_QLineEdit", searchKeyword) - type(waitForObject(":Qt Creator.Search for:_QLineEdit"), "") + mouseClick(waitForObject(":Qt Creator.Help_Search for:_QLineEdit")) + replaceEditorContent(":Qt Creator.Help_Search for:_QLineEdit", searchKeyword) + type(waitForObject(":Qt Creator.Help_Search for:_QLineEdit"), "") progressBarWait() if shouldFind: test.verify(waitFor("re.match('[1-9]\d* - [1-9]\d* of [1-9]\d* Hits'," @@ -84,14 +87,22 @@ def main(): "str(waitForObject(':Hits_QCLuceneResultWidget').plainText)", 1000), "Verifying if search did not match anything for: " + searchKeyword) # advanced search - setup - clickButton(waitForObject(":Qt Creator.+_QToolButton")) - type(waitForObject(":Qt Creator.words similar to:_QLineEdit"), "deploy") - type(waitForObject(":Qt Creator.without the words:_QLineEdit"), "bookmark") - type(waitForObject(":Qt Creator.with exact phrase:_QLineEdit"), "sql in qt") - type(waitForObject(":Qt Creator.with all of the words:_QLineEdit"), "designer sql") - type(waitForObject(":Qt Creator.with at least one of the words:_QLineEdit"), "printing") + clickButton(waitForObject("{text='+' type='QToolButton' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}")) + label = ("{text='%s' type='QLabel' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}") + lineEdit = ("{leftWidget=%s type='QLineEdit' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}") + labelTextsToSearchStr = {"words similar to:":"deploy", + "without the words:":"bookmark", + "with exact phrase:":"sql in qt", + "with all of the words:":"designer sql", + "with at least one of the words:":"printing"} + for labelText,searchStr in labelTextsToSearchStr.items(): + type(waitForObject(lineEdit % (label % labelText)), searchStr) # advanced search - do search - clickButton(waitForObject(":Qt Creator.Search_QPushButton")) + clickButton(waitForObject("{text='Search' type='QPushButton' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}")) progressBarWait() # verify that advanced search results found test.verify(waitFor("re.search('1 - 2 of 2 Hits'," @@ -109,8 +120,7 @@ def main(): test.verify("sql" in str(findObject(":Qt Creator_Help::Internal::HelpViewer").selectedText).lower(), "sql advanced search result can be found") # verify if simple search is properly disabled - test.verify(findObject(":Qt Creator.Search for:_QLineEdit").enabled == False, + test.verify(findObject(":Qt Creator.Help_Search for:_QLineEdit").enabled == False, "Verifying if simple search is not active in advanced mode.") # exit invokeMenuItem("File", "Exit") -# no cleanup needed diff --git a/tests/system/suite_HELP/tst_HELP05/test.py b/tests/system/suite_HELP/tst_HELP05/test.py index c0a675e4982..805dd5133f1 100755 --- a/tests/system/suite_HELP/tst_HELP05/test.py +++ b/tests/system/suite_HELP/tst_HELP05/test.py @@ -31,4 +31,3 @@ def main(): verifyInteractiveQMLHelp("MouseArea {", "QML MouseArea Element") # exit invokeMenuItem("File","Exit") -# no cleanup needed diff --git a/tests/system/suite_HELP/tst_HELP06/test.py b/tests/system/suite_HELP/tst_HELP06/test.py index 4c6e0d52224..cb7050e850a 100755 --- a/tests/system/suite_HELP/tst_HELP06/test.py +++ b/tests/system/suite_HELP/tst_HELP06/test.py @@ -4,21 +4,32 @@ source("../../shared/suites_qtta.py") # test bookmark functionality def renameBookmarkFolder(view, item, newName): openItemContextMenu(view, item, 5, 5, 0) - activateItem(waitForObjectItem(":Add Bookmark.line_QMenu", "Rename Folder")) - replaceEditorContent(waitForObject(":treeView_QExpandingLineEdit"), newName) - type(waitForObject(":treeView_QExpandingLineEdit"), "") + activateItem(waitForObjectItem("{type='QMenu' unnamed='1' visible='1' " + "window=':Add Bookmark_BookmarkDialog'}", "Rename Folder")) + replaceEditorContent(waitForObject(":Add Bookmark.treeView_QExpandingLineEdit"), newName) + type(waitForObject(":Add Bookmark.treeView_QExpandingLineEdit"), "") return +def getQModelIndexStr(textProperty, container): + if (container.startswith(":")): + container = "'%s'" % container + return ("{column='0' container=%s %s type='QModelIndex'}" + % (container, textProperty)) + def main(): startApplication("qtcreator" + SettingsPath) # goto help mode and click on topic switchViewTo(ViewConstants.HELP) - doubleClick(":Qt Creator Manual QModelIndex", 5, 5, 0, Qt.LeftButton) - doubleClick(":Qt Creator Manual*.Getting Started_QModelIndex", 5, 5, 0, Qt.LeftButton) - mouseClick(waitForObject(":Getting Started.Building and Running an Example_QModelIndex"), 5, 5, 0, Qt.LeftButton) + manualQModelIndex = getQModelIndexStr("text?='Qt Creator Manual *'", + ":Qt Creator_QHelpContentWidget") + doubleClick(manualQModelIndex, 5, 5, 0, Qt.LeftButton) + gettingStartedQModelIndex = getQModelIndexStr("text='Getting Started'", manualQModelIndex) + doubleClick(gettingStartedQModelIndex, 5, 5, 0, Qt.LeftButton) + mouseClick(waitForObject(getQModelIndexStr("text='Building and Running an Example'", + gettingStartedQModelIndex)), 5, 5, 0, Qt.LeftButton) # open bookmarks window clickButton(waitForObject(":Qt Creator.Add Bookmark_QToolButton")) - clickButton(waitForObject(":Add Bookmark.+_QToolButton")) + clickButton(waitForObject(":Add Bookmark.ExpandBookmarksList_QToolButton")) # create root bookmark directory clickButton(waitForObject(":Add Bookmark.New Folder_QPushButton")) # rename root bookmark directory @@ -30,54 +41,63 @@ def main(): clickButton(waitForObject(":Add Bookmark.New Folder_QPushButton")) renameBookmarkFolder(bookmarkView, "Sample.Folder 1.New Folder*", "Folder 2") clickButton(waitForObject(":Add Bookmark.OK_QPushButton")) - mouseClick(":Qt Creator Manual QModelIndex", 5, 5, 0, Qt.LeftButton) + mouseClick(manualQModelIndex, 5, 5, 0, Qt.LeftButton) type(waitForObject(":Qt Creator_QHelpContentWidget"), "") clickButton(waitForObject(":Qt Creator.Add Bookmark_QToolButton")) - clickButton(waitForObject(":Add Bookmark.+_QToolButton")) + clickButton(waitForObject(":Add Bookmark.ExpandBookmarksList_QToolButton")) # click on "Sample" and create new directory under it - mouseClick(waitForObject(":treeView.Sample_QModelIndex")) + mouseClick(waitForObject(getQModelIndexStr("text='Sample'", ":Add Bookmark.treeView_QTreeView"))) clickButton(waitForObject(":Add Bookmark.New Folder_QPushButton")) clickButton(waitForObject(":Add Bookmark.OK_QPushButton")) # choose bookmarks mouseClick(waitForObjectItem(":Qt Creator_Core::Internal::CommandComboBox", "Bookmarks")) # verify if all folders are created and bookmarks present - test.verify(checkIfObjectExists(":Sample_QModelIndex", verboseOnFail = True) and - checkIfObjectExists(":Sample.Folder 1_QModelIndex", verboseOnFail = True) and - checkIfObjectExists(":Folder 1.Folder 2_QModelIndex", verboseOnFail = True) and - checkIfObjectExists(":Folder 2.Qt Creator : Building and Running an Example_QModelIndex", verboseOnFail = True) and - checkIfObjectExists(":New Folder.Qt Creator : Qt Creator Manual_QModelIndex", verboseOnFail = True), + sampleQModelIndex = getQModelIndexStr("text='Sample'", ":Qt Creator_Bookmarks_TreeView") + folder1QModelIndex = getQModelIndexStr("text='Folder 1'", sampleQModelIndex) + folder2QModelIndex = getQModelIndexStr("text='Folder 2'", folder1QModelIndex) + bldRunQModelIndex = getQModelIndexStr("text?='QtCreator : Building and Running an Example*'", + folder2QModelIndex) + newFolderQModelIndex = getQModelIndexStr("text='New Folder'", sampleQModelIndex) + manualQModelIndex = getQModelIndexStr("text='QtCreator : Qt Creator Manual'", + newFolderQModelIndex) + test.verify(checkIfObjectExists(sampleQModelIndex, verboseOnFail = True) and + checkIfObjectExists(folder1QModelIndex, verboseOnFail = True) and + checkIfObjectExists(folder2QModelIndex, verboseOnFail = True) and + checkIfObjectExists(bldRunQModelIndex, verboseOnFail = True) and + checkIfObjectExists(manualQModelIndex, verboseOnFail = True), "Verifying if all folders and bookmarks are present") - mouseClick(waitForObject(":Qt Creator_TreeView"), 5, 5, 0, Qt.LeftButton) + mouseClick(waitForObject(":Qt Creator_Bookmarks_TreeView"), 5, 5, 0, Qt.LeftButton) for i in range(6): - type(waitForObject(":Qt Creator_TreeView"), "") - type(waitForObject(":Qt Creator_TreeView"), "") + type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "") + type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "") test.verify("QtCreator : Building and Running an Example" in str(waitForObject(":Qt Creator_Help::Internal::HelpViewer").title), "Verifying if first bookmark is opened") - mouseClick(waitForObject(":Folder 2.Qt Creator : Building and Running an Example_QModelIndex")) - type(waitForObject(":Qt Creator_TreeView"), "") - type(waitForObject(":Qt Creator_TreeView"), "") - type(waitForObject(":Qt Creator_TreeView"), "") - type(waitForObject(":Qt Creator_TreeView"), "") + mouseClick(waitForObject(bldRunQModelIndex)) + type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "") + type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "") + type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "") + type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "") test.verify("QtCreator : Qt Creator Manual" in str(waitForObject(":Qt Creator_Help::Internal::HelpViewer").title), "Verifying if second bookmark is opened") # delete previously created directory clickButton(waitForObject(":Qt Creator.Add Bookmark_QToolButton")) - clickButton(waitForObject(":Add Bookmark.+_QToolButton")) + clickButton(waitForObject(":Add Bookmark.ExpandBookmarksList_QToolButton")) openItemContextMenu(waitForObject(":Add Bookmark.treeView_QTreeView"), "Sample.Folder 1", 5, 5, 0) - activateItem(waitForObjectItem(":Add Bookmark.line_QMenu", "Delete Folder")) - clickButton(waitForObject(":treeView.Yes_QPushButton")) + activateItem(waitForObjectItem("{type='QMenu' unnamed='1' visible='1' " + "window=':Add Bookmark_BookmarkDialog'}", "Delete Folder")) + clickButton(waitForObject("{container=':Add Bookmark.treeView_QTreeView' text='Yes' " + "type='QPushButton' unnamed='1' visible='1'}"))#:treeView.Yes_QPushButton")) # close bookmarks clickButton(waitForObject(":Add Bookmark.OK_QPushButton")) - # choose bookmarks from command combobox (left top corner of qt creator) + # choose bookmarks from command combobox mouseClick(waitForObject(":Qt Creator_Core::Internal::CommandComboBox")) mouseClick(waitForObjectItem(":Qt Creator_Core::Internal::CommandComboBox", "Bookmarks")) # verify if folders and bookmark deleted - test.verify(checkIfObjectExists(":Sample_QModelIndex", verboseOnFail = True) and - checkIfObjectExists(":Sample.Folder 1_QModelIndex ", shouldExist = False, verboseOnFail = True) and - checkIfObjectExists(":Folder 1.Folder 2_QModelIndex", shouldExist = False, verboseOnFail = True) and - checkIfObjectExists(":Folder 2.Qt Creator : Building and Running an Example_QModelIndex", shouldExist = False, verboseOnFail = True) and - checkIfObjectExists(":New Folder.Qt Creator : Qt Creator Manual_QModelIndex", verboseOnFail = True), + test.verify(checkIfObjectExists(sampleQModelIndex, verboseOnFail = True) and + checkIfObjectExists(folder1QModelIndex, shouldExist = False, verboseOnFail = True) and + checkIfObjectExists(folder2QModelIndex, shouldExist = False, verboseOnFail = True) and + checkIfObjectExists(bldRunQModelIndex, shouldExist = False, verboseOnFail = True) and + checkIfObjectExists(manualQModelIndex, verboseOnFail = True), "Verifying if folder 1 and folder 2 deleted including their bookmark") # exit invokeMenuItem("File", "Exit") -# no cleanup needed diff --git a/tests/system/suite_QMLS/objects.map b/tests/system/suite_QMLS/objects.map deleted file mode 100644 index 870e1b31abf..00000000000 --- a/tests/system/suite_QMLS/objects.map +++ /dev/null @@ -1,26 +0,0 @@ -:Add to Version Control.No_QPushButton {text='No' type='QPushButton' unnamed='1' visible='1' window=':Add to Version Control_QMessageBox'} -:Add to Version Control_QMessageBox {type='QMessageBox' unnamed='1' visible='1' windowTitle='Add to Version Control'} -:Behavior.Autocomplete common prefix_QCheckBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='partiallyComplete' text='Autocomplete common prefix' type='QCheckBox' visible='1'} -:Behavior.completionTrigger_QComboBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='completionTrigger' type='QComboBox' visible='1'} -:CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox {container=':qt_tabwidget_stackedwidget.CppTools__Internal__CompletionSettingsPage_QWidget' name='groupBox' title='Behavior' type='QGroupBox' visible='1'} -:Dialog.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Dialog_QmlJSEditor::Internal::ComponentNameDialog'} -:Dialog.componentNameEdit_QLineEdit {name='componentNameEdit' type='Utils::ClassNameValidatingLineEdit' visible='1' window=':Dialog_QmlJSEditor::Internal::ComponentNameDialog'} -:Dialog_QmlJSEditor::Internal::ComponentNameDialog {name='QmlJSEditor__Internal__ComponentNameDialog' type='QmlJSEditor::Internal::ComponentNameDialog' visible='1' windowTitle='Move Component into Separate File'} -:New Qt Quick Application.Add to version control:_QLabel {name='addToVersionControlLabel' text='Add to version control:' type='QLabel' visible='1'} -:Next_QPushButton {name='__qt__passive_wizardbutton1' text~='(Next.*|Continue)' type='QPushButton' visible='1'} -:Options.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'} -:Options.qt_tabwidget_stackedwidget_QStackedWidget {name='qt_tabwidget_stackedwidget' type='QStackedWidget' visible='1' window=':Options_Core::Internal::SettingsDialog'} -:Options.qt_tabwidget_tabbar_QTabBar {name='qt_tabwidget_tabbar' type='QTabBar' visible='1' window=':Options_Core::Internal::SettingsDialog'} -:Options_Core::Internal::SettingsDialog {type='Core::Internal::SettingsDialog' unnamed='1' visible='1' windowTitle~='(Options|Preferences)'} -:Options_QListView {type='QListView' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'} -:Qt Creator.Clear_QToolButton {text='Clear' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator.Issues_QListView {type='QListView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'} -:Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' unnamed='1' visible='1'} -:Qt Creator_Find::Internal::SearchResultTreeView {type='Find::Internal::SearchResultTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator_QmlJSEditor::QmlJSTextEditorWidget {type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator_Utils::NavigationTreeView {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:addToVersionControlComboBox_QComboBox {buddy=':New Qt Quick Application.Add to version control:_QLabel' name='addToVersionControlComboBox' type='QComboBox' visible='1'} -:m_popupFrame_QListView {container=':m_popupFrame_TextEditor::GenericProposalWidget' type='QListView' unnamed='1' visible='1'} -:m_popupFrame_TextEditor::GenericProposalWidget {name='m_popupFrame' type='TextEditor::GenericProposalWidget' visible='1'} -:qt_tabwidget_stackedwidget.CppTools__Internal__CompletionSettingsPage_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='CppTools__Internal__CompletionSettingsPage' type='QWidget' visible='1'} diff --git a/tests/system/suite_QMLS/suite.conf b/tests/system/suite_QMLS/suite.conf index 321ab6db4b5..c937c87736d 100644 --- a/tests/system/suite_QMLS/suite.conf +++ b/tests/system/suite_QMLS/suite.conf @@ -1,10 +1,12 @@ AUT=qtcreator CLASS= CLASSPATH= +CWD= ENVVARS=envvars HOOK_SUB_PROCESSES=false IMPLICITAUTSTART=0 LANGUAGE=Python +OBJECTMAP=../objects.map TEST_CASES=tst_QMLS01 tst_QMLS02 tst_QMLS03 tst_QMLS04 tst_QMLS05 tst_QMLS06 tst_QMLS07 tst_QMLS08 VERSION=2 WRAPPERS=Qt diff --git a/tests/system/suite_QMLS/tst_QMLS01/test.py b/tests/system/suite_QMLS/tst_QMLS01/test.py index b76dd10106c..f7d26b9a6e2 100644 --- a/tests/system/suite_QMLS/tst_QMLS01/test.py +++ b/tests/system/suite_QMLS/tst_QMLS01/test.py @@ -14,7 +14,7 @@ def __beginTestSuggestions__(editorArea, lineText, textToType): # verify whether suggestions makes sense for typed textToType def verifySuggestions(textToType): - popup = findObject(":m_popupFrame_QListView") + popup = findObject(":popupFrame_Proposal_QListView") model = popup.model() for row in range(model.rowCount()): index = model.index(row, 0) @@ -35,12 +35,12 @@ def testSuggestionsAuto(lineText, textToType, expectedText, keyToUseSuggestion): if not __beginTestSuggestions__(editorArea, lineText, textToType): return False # check if suggestions are shown - test.verify(checkIfObjectExists(":m_popupFrame_QListView"), + test.verify(checkIfObjectExists(":popupFrame_Proposal_QListView"), "Verifying if suggestions in automatic mode are shown.") # verify proposed suggestions verifySuggestions(textToType) # test if suggestion can be selected with keyToUseSuggestion - type(findObject(":m_popupFrame_QListView"), keyToUseSuggestion) + type(findObject(":popupFrame_Proposal_QListView"), keyToUseSuggestion) # get text which was written by usage of suggestion typedText = str(lineUnderCursor(editorArea)).strip() # verify if expected text is written @@ -56,7 +56,7 @@ def testSuggestionsManual(lineText, textToType, expectedText): if not __beginTestSuggestions__(editorArea, lineText, textToType): return False # wait if automatic popup displayed - if yes then fail, because we are in manual mode - test.verify(checkIfObjectExists(":m_popupFrame_QListView", False), + test.verify(checkIfObjectExists(":popupFrame_Proposal_QListView", False), "Verifying if suggestions in manual mode are properly not automatically shown") # test if suggestion can be invoked manually if platform.system() == "Darwin": @@ -64,12 +64,12 @@ def testSuggestionsManual(lineText, textToType, expectedText): else: type(editorArea, "") # check if suggestions are shown - test.verify(checkIfObjectExists(":m_popupFrame_QListView"), + test.verify(checkIfObjectExists(":popupFrame_Proposal_QListView"), "Verifying if suggestions in manual mode are shown manually") # verify proposed suggestions verifySuggestions(textToType) # test if suggestion can be used - type(findObject(":m_popupFrame_QListView"), "") + type(findObject(":popupFrame_Proposal_QListView"), "") # get text which was written by usage of suggestion typedText = str(lineUnderCursor(editorArea)).strip() # verify if expected text is written @@ -106,4 +106,3 @@ def main(): testSuggestionsManual("Text {", "col", "color:") # exit qt creator saveAndExit() - diff --git a/tests/system/suite_QMLS/tst_QMLS03/test.py b/tests/system/suite_QMLS/tst_QMLS03/test.py index bbd4facd237..9733291871f 100644 --- a/tests/system/suite_QMLS/tst_QMLS03/test.py +++ b/tests/system/suite_QMLS/tst_QMLS03/test.py @@ -71,7 +71,7 @@ def main(): resultsView = waitForObject(":Qt Creator_Find::Internal::SearchResultTreeView") test.verify(checkUsages(resultsView, expectedResults), "Verifying if usages were properly found using context menu.") # clear previous results & prepare for next search - clickButton(waitForObject(":Qt Creator.Clear_QToolButton")) + clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) mouseClick(editorArea, 5, 5, 0, Qt.LeftButton) # 2. check usages using menu # place cursor to component @@ -89,7 +89,7 @@ def main(): resultsView = waitForObject(":Qt Creator_Find::Internal::SearchResultTreeView") test.verify(checkUsages(resultsView, expectedResults), "Verifying if usages were properly found using main menu.") # clear previous results & prepare for next search - clickButton(waitForObject(":Qt Creator.Clear_QToolButton")) + clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) mouseClick(editorArea, 5, 5, 0, Qt.LeftButton) # 3. check usages using keyboard shortcut # place cursor to component diff --git a/tests/system/suite_qtquick/tst_qml_editor/test.py b/tests/system/suite_qtquick/tst_qml_editor/test.py index 0fda22aea1e..825d070df0c 100644 --- a/tests/system/suite_qtquick/tst_qml_editor/test.py +++ b/tests/system/suite_qtquick/tst_qml_editor/test.py @@ -97,8 +97,7 @@ def testFindUsages(): "window=':Qt Creator_Core::Internal::MainWindow'}", 20000) __invokeFindUsage__(navTree, "focus\\.qml", "FocusScope\s*\{", [""], 6) test.log("Testing find usage of a property") - clickButton(waitForObject("{type='QToolButton' text='Clear' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}")) + clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) home = "" if platform.system() == "Darwin": home = ""