From 2b302332b80c5244072ba3a9df7d59f1139197e5 Mon Sep 17 00:00:00 2001 From: dt <qtc-committer@nokia.com> Date: Tue, 28 Apr 2009 12:43:04 +0200 Subject: [PATCH] Move QtVersionManager, QtVersion and QtOptionsPage back After all I don't need all that stuff in the cmakeplugin, all i needed is now bundled in debugginghelper.h/cpp --- .../cmakerunconfiguration.cpp | 2 +- .../projectexplorer/debugginghelper.cpp | 223 ++++++++++++++++++ src/plugins/projectexplorer/debugginghelper.h | 64 +++++ .../projectexplorer/projectexplorer.cpp | 14 +- src/plugins/projectexplorer/projectexplorer.h | 4 - .../projectexplorer/projectexplorer.pro | 10 +- .../projectexplorerconstants.h | 5 - src/plugins/qt4projectmanager/makestep.cpp | 1 - src/plugins/qt4projectmanager/makestep.h | 5 +- .../qt4projectmanager/profilereader.cpp | 2 - src/plugins/qt4projectmanager/profilereader.h | 4 +- .../qt4projectmanager/projectloadwizard.cpp | 10 +- .../qt4projectmanager/projectloadwizard.h | 10 +- src/plugins/qt4projectmanager/qmakestep.cpp | 2 +- src/plugins/qt4projectmanager/qt4nodes.cpp | 1 - src/plugins/qt4projectmanager/qt4project.cpp | 4 +- src/plugins/qt4projectmanager/qt4project.h | 4 +- .../qt4projectconfigwidget.cpp | 11 +- .../qt4projectmanager/qt4projectmanager.cpp | 3 - .../qt4projectmanager/qt4projectmanager.pro | 12 +- .../qt4projectmanagerconstants.h | 5 + .../qt4projectmanagerplugin.cpp | 11 +- .../qt4projectmanagerplugin.h | 5 +- .../qt4projectmanager/qt4runconfiguration.cpp | 1 - .../qtoptionspage.cpp | 6 +- .../qtoptionspage.h | 4 +- .../qtversionmanager.cpp | 209 +--------------- .../qtversionmanager.h | 42 +--- .../qtversionmanager.ui | 4 +- .../showbuildlog.ui | 0 30 files changed, 366 insertions(+), 312 deletions(-) create mode 100644 src/plugins/projectexplorer/debugginghelper.cpp create mode 100644 src/plugins/projectexplorer/debugginghelper.h rename src/plugins/{projectexplorer => qt4projectmanager}/qtoptionspage.cpp (99%) rename src/plugins/{projectexplorer => qt4projectmanager}/qtoptionspage.h (97%) rename src/plugins/{projectexplorer => qt4projectmanager}/qtversionmanager.cpp (82%) rename src/plugins/{projectexplorer => qt4projectmanager}/qtversionmanager.h (76%) rename src/plugins/{projectexplorer => qt4projectmanager}/qtversionmanager.ui (97%) rename src/plugins/{projectexplorer => qt4projectmanager}/showbuildlog.ui (100%) diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp index 849d14685ee..6e013c77f82 100644 --- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp @@ -33,7 +33,7 @@ #include "cmakeprojectconstants.h" #include <projectexplorer/environment.h> -#include <projectexplorer/qtversionmanager.h> +#include <projectexplorer/debugginghelper.h> #include <utils/qtcassert.h> #include <QtGui/QFormLayout> #include <QtGui/QLineEdit> diff --git a/src/plugins/projectexplorer/debugginghelper.cpp b/src/plugins/projectexplorer/debugginghelper.cpp new file mode 100644 index 00000000000..64a1f3e8cb9 --- /dev/null +++ b/src/plugins/projectexplorer/debugginghelper.cpp @@ -0,0 +1,223 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file 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 +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +**************************************************************************/ + +#include "debugginghelper.h" +#include <coreplugin/icore.h> +#include <QtCore/QFileInfo> +#include <QtCore/QHash> +#include <QtCore/QProcess> +#include <QtCore/QDir> +#include <QtCore/QDateTime> +#include <QtGui/QApplication> +#include <QtGui/QDesktopServices> + +using namespace ProjectExplorer; + +QString DebuggingHelperLibrary::findSystemQt(const Environment &env) +{ + QStringList paths = env.path(); + foreach (const QString &path, paths) { + foreach (const QString &possibleCommand, possibleQMakeCommands()) { + QFileInfo qmake(path + "/" + possibleCommand); + if (qmake.exists()) { + if (!qtVersionForQMake(qmake.absoluteFilePath()).isNull()) { + return qmake.absoluteFilePath(); + } + } + } + } + return QString::null; +} + +bool DebuggingHelperLibrary::hasDebuggingHelperLibrary(const QString &qmakePath) +{ + return !debuggingHelperLibrary(qmakePath).isNull(); +} + +QStringList DebuggingHelperLibrary::debuggingHelperLibraryDirectories(const QString &qtInstallData, const QString &qtpath) +{ + uint hash = qHash(qtpath); + QStringList directories; + directories + << (qtInstallData + "/qtc-debugging-helper/") + << (QApplication::applicationDirPath() + "/../qtc-debugging-helper/" + QString::number(hash)) + "/" + << (QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/qtc-debugging-helper/" + QString::number(hash)) + "/"; + return directories; +} + +QString DebuggingHelperLibrary::debuggingHelperLibrary(const QString &qmakePath) +{ + return debuggingHelperLibrary(qtInstallDataDir(qmakePath), qtDir(qmakePath)); +} + +QString DebuggingHelperLibrary::qtInstallDataDir(const QString &qmakePath) +{ + QProcess proc; + proc.start(qmakePath, QStringList() << "-query"<< "QT_INSTALL_DATA"); + if (proc.waitForFinished()) + return QString(proc.readAll().trimmed()); + return QString::null; +} + +QString DebuggingHelperLibrary::qtDir(const QString &qmakePath) +{ + QDir dir = QFileInfo(qmakePath).absoluteDir(); + dir.cdUp(); + return dir.absolutePath(); +} + +// Debugging Helper Library + +QString DebuggingHelperLibrary::debuggingHelperLibrary(const QString &qtInstallData, const QString &qtpath) +{ + foreach(const QString &directory, debuggingHelperLibraryDirectories(qtInstallData, qtpath)) { +#if defined(Q_OS_WIN) + QFileInfo fi(directory + "debug/gdbmacros.dll"); +#elif defined(Q_OS_MAC) + QFileInfo fi(directory + "libgdbmacros.dylib"); +#else // generic UNIX + QFileInfo fi(directory + "libgdbmacros.so"); +#endif + if (fi.exists()) + return fi.filePath(); + } + return QString(); +} + + +QString DebuggingHelperLibrary::buildDebuggingHelperLibrary(const QString &qmakePath, const QString &make, const Environment &env) +{ + QString directory = copyDebuggingHelperLibrary(qtInstallDataDir(qmakePath), qtDir(qmakePath)); + return buildDebuggingHelperLibrary(directory, make, qmakePath, QString::null, env); + return QString::null; +} + +QString DebuggingHelperLibrary::copyDebuggingHelperLibrary(const QString &qtInstallData, const QString &qtdir) +{ + // Locations to try: + // $QTDIR/qtc-debugging-helper + // $APPLICATION-DIR/qtc-debugging-helper/$hash + // $USERDIR/qtc-debugging-helper/$hash + QStringList directories = DebuggingHelperLibrary::debuggingHelperLibraryDirectories(qtInstallData, qtdir); + + QStringList files; + files << "gdbmacros.cpp" << "gdbmacros.pro" + << "LICENSE.LGPL" << "LGPL_EXCEPTION.TXT"; + foreach(const QString &directory, directories) { + QString dumperPath = Core::ICore::instance()->resourcePath() + "/gdbmacros/"; + bool success = true; + QDir().mkpath(directory); + foreach (const QString &file, files) { + QString source = dumperPath + file; + QString dest = directory + file; + QFileInfo destInfo(dest); + if (destInfo.exists()) { + if (destInfo.lastModified() >= QFileInfo(source).lastModified()) + continue; + success &= QFile::remove(dest); + } + success &= QFile::copy(source, dest); + } + if (success) + return directory; + } + return QString::null; +} + +QString DebuggingHelperLibrary::buildDebuggingHelperLibrary(const QString &directory, const QString &makeCommand, const QString &qmakeCommand, const QString &mkspec, const Environment &env) +{ + QString output; + // Setup process + QProcess proc; + proc.setEnvironment(env.toStringList()); + proc.setWorkingDirectory(directory); + proc.setProcessChannelMode(QProcess::MergedChannels); + + output += QString("Building debugging helper library in %1\n").arg(directory); + output += "\n"; + + QString makeFullPath = env.searchInPath(makeCommand); + if (!makeFullPath.isEmpty()) { + output += QString("Running %1 clean...\n").arg(makeFullPath); + proc.start(makeFullPath, QStringList() << "clean"); + proc.waitForFinished(); + output += proc.readAll(); + } else { + output += QString("%1 not found in PATH\n").arg(makeCommand); + return output; + } + + output += QString("\nRunning %1 ...\n").arg(qmakeCommand); + + proc.start(qmakeCommand, QStringList()<<"-spec"<< (mkspec.isEmpty() ? "default" : mkspec) <<"gdbmacros.pro"); + proc.waitForFinished(); + + output += proc.readAll(); + + output += "\n"; + if (!makeFullPath.isEmpty()) { + output += QString("Running %1 ...\n").arg(makeFullPath); + proc.start(makeFullPath, QStringList()); + proc.waitForFinished(); + output += proc.readAll(); + } else { + output += QString("%1 not found in PATH\n").arg(makeCommand); + } + return output; +} + +QString DebuggingHelperLibrary::qtVersionForQMake(const QString &qmakePath) +{ + QProcess qmake; + qmake.start(qmakePath, QStringList()<<"--version"); + if (!qmake.waitForFinished()) + return false; + QString output = qmake.readAllStandardOutput(); + QRegExp regexp("(QMake version|QMake version:)[\\s]*([\\d.]*)", Qt::CaseInsensitive); + regexp.indexIn(output); + if (regexp.cap(2).startsWith("2.")) { + QRegExp regexp2("Using Qt version[\\s]*([\\d\\.]*)", Qt::CaseInsensitive); + regexp2.indexIn(output); + return regexp2.cap(1); + } + return QString(); +} + +QStringList DebuggingHelperLibrary::possibleQMakeCommands() +{ + // On windows noone has renamed qmake, right? +#ifdef Q_OS_WIN + return QStringList() << "qmake.exe"; +#endif + // On unix some distributions renamed qmake to avoid clashes + QStringList result; + result << "qmake-qt4" << "qmake4" << "qmake"; + return result; +} + diff --git a/src/plugins/projectexplorer/debugginghelper.h b/src/plugins/projectexplorer/debugginghelper.h new file mode 100644 index 00000000000..c949157400a --- /dev/null +++ b/src/plugins/projectexplorer/debugginghelper.h @@ -0,0 +1,64 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file 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 +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +**************************************************************************/ + +#ifndef DEBUGGINGHELPER_H +#define DEBUGGINGHELPER_H + +#include "environment.h" +#include "projectexplorer_export.h" + +#include <QtCore/QString> +#include <QtCore/QStringList> + +namespace ProjectExplorer { +class PROJECTEXPLORER_EXPORT DebuggingHelperLibrary +{ +public: + // returns the full path to the first qmake, qmake-qt4, qmake4 that has + // at least version 2.0.0 and thus is a qt4 qmake + static QString findSystemQt(const Environment &env); + // returns something like qmake4, qmake, qmake-qt4 or whatever distributions have chosen (used by QtVersion) + static QStringList possibleQMakeCommands(); + // return true if the qmake at qmakePath is qt4 (used by QtVersion) + static QString qtVersionForQMake(const QString &qmakePath); + + static bool hasDebuggingHelperLibrary(const QString &qmakePath); + static QString debuggingHelperLibrary(const QString &qmakePath); + static QString buildDebuggingHelperLibrary(const QString &qmakePath, const QString &make, const Environment &env); + static QString debuggingHelperLibrary(const QString &qtInstallData, const QString &qtpath); + static QString copyDebuggingHelperLibrary(const QString &qtInstallData, const QString &qtdir); + static QString buildDebuggingHelperLibrary(const QString &directory, const QString &makeCommand, const QString &qmakeCommand, const QString &mkspec, const Environment &env); +private: + static QStringList debuggingHelperLibraryDirectories(const QString &qtInstallData, const QString &qtpath); + static QString qtInstallDataDir(const QString &qmakePath); + static QString qtDir(const QString &qmakePath); +}; +} + +#endif // DEBUGGINGHELPER_H diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index af2289699f9..ebb6a1000a7 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -56,8 +56,6 @@ #include "session.h" #include "sessiondialog.h" #include "buildparserfactory.h" -#include "qtversionmanager.h" -#include "qtoptionspage.h" #include <coreplugin/basemode.h> #include <coreplugin/coreconstants.h> @@ -196,11 +194,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er connect(m_buildManager, SIGNAL(tasksChanged()), this, SLOT(updateTaskActions())); - m_versionManager = new QtVersionManager(); - addAutoReleasedObject(m_versionManager); - - addAutoReleasedObject(new QtOptionsPage()); - addAutoReleasedObject(new CoreListenerCheckingForRunningBuild(m_buildManager)); m_outputPane = new OutputPane; @@ -1867,7 +1860,7 @@ void ProjectExplorerPlugin::populateOpenWithMenu() } } } - m_openWithMenu->setEnabled(anyMatches); + m_openWithMenu->setEnabled(anyMatches); } void ProjectExplorerPlugin::openWithMenuTriggered(QAction *action) @@ -1912,9 +1905,4 @@ void ProjectExplorerPlugin::setSession(QAction *action) m_session->loadSession(session); } -QtVersionManager *ProjectExplorerPlugin::qtVersionManager() const -{ - return m_versionManager; -} - Q_EXPORT_PLUGIN(ProjectExplorerPlugin) diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index b18545a9c39..987cb323fb6 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -64,7 +64,6 @@ class RunConfiguration; class RunControl; class SessionManager; class IRunConfigurationRunner; -class QtVersionManager; namespace Internal { class ApplicationOutput; @@ -105,8 +104,6 @@ public: void showContextMenu(const QPoint &globalPos, Node *node); - QtVersionManager *qtVersionManager() const; - //PluginInterface bool initialize(const QStringList &arguments, QString *error_message); void extensionsInitialized(); @@ -249,7 +246,6 @@ private: Node *m_currentNode; BuildManager *m_buildManager; - QtVersionManager *m_versionManager; QList<Internal::ProjectFileFactory*> m_fileFactories; QStringList m_profileMimeTypes; diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro index c9d0f4dce59..ac021e8976e 100644 --- a/src/plugins/projectexplorer/projectexplorer.pro +++ b/src/plugins/projectexplorer/projectexplorer.pro @@ -59,8 +59,7 @@ HEADERS += projectexplorer.h \ gccparser.h \ msvcparser.h \ filewatcher.h \ - qtversionmanager.h \ - qtoptionspage.h + debugginghelper.h SOURCES += projectexplorer.cpp \ projectwindow.cpp \ buildmanager.cpp \ @@ -108,8 +107,7 @@ SOURCES += projectexplorer.cpp \ gccparser.cpp \ msvcparser.cpp \ filewatcher.cpp \ - qtversionmanager.cpp \ - qtoptionspage.cpp + debugginghelper.cpp FORMS += dependenciespanel.ui \ buildsettingspropertiespage.ui \ processstep.ui \ @@ -118,9 +116,7 @@ FORMS += dependenciespanel.ui \ sessiondialog.ui \ projectwizardpage.ui \ buildstepspage.ui \ - removefiledialog.ui \ - qtversionmanager.ui \ - showbuildlog.ui + removefiledialog.ui win32 { SOURCES += applicationlauncher_win.cpp \ winguiprocess.cpp diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h index 0a749cc7bd5..10c56b8deaa 100644 --- a/src/plugins/projectexplorer/projectexplorerconstants.h +++ b/src/plugins/projectexplorer/projectexplorerconstants.h @@ -176,11 +176,6 @@ const char * const RESOURCE_MIMETYPE = "application/vnd.nokia.xml.qt.resource"; // build parsers const char * const BUILD_PARSER_MSVC = "BuildParser.MSVC"; const char * const BUILD_PARSER_GCC = "BuildParser.Gcc"; - -//Qt4 settings pages -const char * const QT_CATEGORY = "Qt4"; -const char * const QTVERSION_PAGE = "Qt Versions"; -const char * const BUILD_ENVIRONMENT_PAGE = "Build Environments"; } // namespace Constants } // namespace ProjectExplorer diff --git a/src/plugins/qt4projectmanager/makestep.cpp b/src/plugins/qt4projectmanager/makestep.cpp index c3d9b595752..b972142925b 100644 --- a/src/plugins/qt4projectmanager/makestep.cpp +++ b/src/plugins/qt4projectmanager/makestep.cpp @@ -43,7 +43,6 @@ using ProjectExplorer::IBuildParserFactory; using ProjectExplorer::BuildParserInterface; using ProjectExplorer::Environment; -using ProjectExplorer::QtVersion; using ExtensionSystem::PluginManager; using namespace Qt4ProjectManager; using namespace Qt4ProjectManager::Internal; diff --git a/src/plugins/qt4projectmanager/makestep.h b/src/plugins/qt4projectmanager/makestep.h index 91af6a69eca..4276ea77098 100644 --- a/src/plugins/qt4projectmanager/makestep.h +++ b/src/plugins/qt4projectmanager/makestep.h @@ -31,16 +31,15 @@ #define MAKESTEP_H #include "ui_makestep.h" +#include "qtversionmanager.h" #include <projectexplorer/abstractprocessstep.h> #include <projectexplorer/projectexplorer.h> -#include <projectexplorer/qtversionmanager.h> namespace ProjectExplorer { class BuildStep; class IBuildStepFactory; class Project; -class QtVersion; } namespace Qt4ProjectManager { @@ -82,7 +81,7 @@ private slots: void addDirectory(const QString &dir); void removeDirectory(const QString &dir); private: - ProjectExplorer::BuildParserInterface *buildParser(const ProjectExplorer::QtVersion *const version); + ProjectExplorer::BuildParserInterface *buildParser(const QtVersion *const version); Qt4Project *m_project; ProjectExplorer::BuildParserInterface *m_buildParser; bool m_skipMakeClean; diff --git a/src/plugins/qt4projectmanager/profilereader.cpp b/src/plugins/qt4projectmanager/profilereader.cpp index 109a3ffd918..32b600cd288 100644 --- a/src/plugins/qt4projectmanager/profilereader.cpp +++ b/src/plugins/qt4projectmanager/profilereader.cpp @@ -35,8 +35,6 @@ using namespace Qt4ProjectManager; using namespace Qt4ProjectManager::Internal; -using ProjectExplorer::QtVersion; - ProFileReader::ProFileReader() { } diff --git a/src/plugins/qt4projectmanager/profilereader.h b/src/plugins/qt4projectmanager/profilereader.h index 79833c02dff..08397f36df0 100644 --- a/src/plugins/qt4projectmanager/profilereader.h +++ b/src/plugins/qt4projectmanager/profilereader.h @@ -31,7 +31,7 @@ #define PROFILEREADER_H #include "profileevaluator.h" -#include <projectexplorer/qtversionmanager.h> +#include "qtversionmanager.h" #include <QtCore/QObject> #include <QtCore/QMap> @@ -47,7 +47,7 @@ public: ProFileReader(); ~ProFileReader(); - void setQtVersion(ProjectExplorer::QtVersion *qtVersion); + void setQtVersion(QtVersion *qtVersion); bool readProFile(const QString &fileName); QList<ProFile*> includeFiles() const; diff --git a/src/plugins/qt4projectmanager/projectloadwizard.cpp b/src/plugins/qt4projectmanager/projectloadwizard.cpp index 31c0da2cde1..3887e4f9487 100644 --- a/src/plugins/qt4projectmanager/projectloadwizard.cpp +++ b/src/plugins/qt4projectmanager/projectloadwizard.cpp @@ -45,14 +45,12 @@ using namespace Qt4ProjectManager; using namespace Qt4ProjectManager::Internal; -using ProjectExplorer::QtVersion; - ProjectLoadWizard::ProjectLoadWizard(Qt4Project *project, QWidget *parent, Qt::WindowFlags flags) : QWizard(parent, flags), m_project(project), m_importVersion(0), m_temporaryVersion(false) { - ProjectExplorer::QtVersionManager * vm = ProjectExplorer::QtVersionManager::instance(); + QtVersionManager * vm = QtVersionManager::instance(); QString directory = QFileInfo(project->file()->fileName()).absolutePath(); - QString importVersion = ProjectExplorer::QtVersionManager::findQtVersionFromMakefile(directory); + QString importVersion = QtVersionManager::findQtVersionFromMakefile(directory); if (!importVersion.isNull()) { // This also means we have a build in there @@ -65,7 +63,7 @@ ProjectLoadWizard::ProjectLoadWizard(Qt4Project *project, QWidget *parent, Qt::W } m_importBuildConfig = m_importVersion->defaultBuildConfig(); - m_importBuildConfig= ProjectExplorer::QtVersionManager::scanMakefileForQmakeConfig(directory, m_importBuildConfig); + m_importBuildConfig= QtVersionManager::scanMakefileForQmakeConfig(directory, m_importBuildConfig); } // So now we have the version and the configuration for that version @@ -129,7 +127,7 @@ void ProjectLoadWizard::addBuildConfiguration(QString name, QtVersion *qtversion void ProjectLoadWizard::done(int result) { - ProjectExplorer::QtVersionManager *vm = ProjectExplorer::QtVersionManager::instance(); + QtVersionManager *vm = QtVersionManager::instance(); QWizard::done(result); // This normally happens on showing the final page, but since we // don't show it anymore, do it here diff --git a/src/plugins/qt4projectmanager/projectloadwizard.h b/src/plugins/qt4projectmanager/projectloadwizard.h index add96b6e7a9..b6d886fe150 100644 --- a/src/plugins/qt4projectmanager/projectloadwizard.h +++ b/src/plugins/qt4projectmanager/projectloadwizard.h @@ -30,7 +30,7 @@ #ifndef PROJECTLOADWIZARD_H #define PROJECTLOADWIZARD_H -#include <projectexplorer/qtversionmanager.h> +#include "qtversionmanager.h" #include <QtGui/QWizard> @@ -57,14 +57,14 @@ public: void execDialog(); private: - void addBuildConfiguration(QString name, ProjectExplorer::QtVersion *qtversion, ProjectExplorer::QtVersion::QmakeBuildConfig buildConfiguration); - void setupImportPage(ProjectExplorer::QtVersion *version, ProjectExplorer::QtVersion::QmakeBuildConfig buildConfig); + void addBuildConfiguration(QString name, QtVersion *qtversion, QtVersion::QmakeBuildConfig buildConfiguration); + void setupImportPage(QtVersion *version, QtVersion::QmakeBuildConfig buildConfig); Qt4Project *m_project; // Only used for imported stuff - ProjectExplorer::QtVersion *m_importVersion; - ProjectExplorer::QtVersion::QmakeBuildConfig m_importBuildConfig; + QtVersion *m_importVersion; + QtVersion::QmakeBuildConfig m_importBuildConfig; // Those that we might add bool m_temporaryVersion; diff --git a/src/plugins/qt4projectmanager/qmakestep.cpp b/src/plugins/qt4projectmanager/qmakestep.cpp index b333016c0eb..514feb9f371 100644 --- a/src/plugins/qt4projectmanager/qmakestep.cpp +++ b/src/plugins/qt4projectmanager/qmakestep.cpp @@ -33,10 +33,10 @@ #include "qt4projectmanagerconstants.h" #include "qt4projectmanager.h" #include "makestep.h" +#include "qtversionmanager.h" #include <coreplugin/icore.h> #include <utils/qtcassert.h> -#include <projectexplorer/qtversionmanager.h> #include <QFileDialog> #include <QDir> diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index ac790dbfa10..66c32661c35 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -64,7 +64,6 @@ using namespace Qt4ProjectManager; using namespace Qt4ProjectManager::Internal; -using ProjectExplorer::QtVersion; namespace { bool debug = false; diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index a97303cf323..ae6a76ecbc1 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -41,6 +41,7 @@ #include "qt4buildenvironmentwidget.h" #include "qt4projectmanagerconstants.h" #include "projectloadwizard.h" +#include "qtversionmanager.h" #include <coreplugin/icore.h> #include <coreplugin/messagemanager.h> @@ -50,7 +51,6 @@ #include <projectexplorer/nodesvisitor.h> #include <projectexplorer/project.h> #include <projectexplorer/customexecutablerunconfiguration.h> -#include <projectexplorer/qtversionmanager.h> #include <QtCore/QDebug> #include <QtCore/QDir> @@ -236,7 +236,7 @@ Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) : { m_manager->registerProject(this); - ProjectExplorer::QtVersionManager *vm = ProjectExplorer::QtVersionManager::instance(); + QtVersionManager *vm = QtVersionManager::instance(); connect(vm, SIGNAL(defaultQtVersionChanged()), this, SLOT(defaultQtVersionChanged())); diff --git a/src/plugins/qt4projectmanager/qt4project.h b/src/plugins/qt4projectmanager/qt4project.h index c27be2be3fb..6801fd0f40a 100644 --- a/src/plugins/qt4projectmanager/qt4project.h +++ b/src/plugins/qt4projectmanager/qt4project.h @@ -33,12 +33,12 @@ #include "qt4nodes.h" #include "qmakestep.h" #include "makestep.h" +#include "qtversionmanager.h" #include <coreplugin/ifile.h> #include <projectexplorer/applicationrunconfiguration.h> #include <projectexplorer/projectnodes.h> #include <projectexplorer/toolchain.h> -#include <projectexplorer/qtversionmanager.h> #include <QtCore/QObject> #include <QtCore/QList> @@ -148,7 +148,7 @@ public: //returns the qtVersion, if the project is set to use the default qt version, then // that is returned // to check wheter the project uses the default qt version use qtVersionId - ProjectExplorer::QtVersion *qtVersion(const QString &buildConfiguration) const; + QtVersion *qtVersion(const QString &buildConfiguration) const; // returns the id of the qt version, if the project is using the default qt version // this function returns 0 diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp index a50d23bd98c..d6267460d96 100644 --- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp +++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp @@ -43,9 +43,6 @@ #include <QtGui/QFileDialog> -using ProjectExplorer::QtVersionManager; -using ProjectExplorer::QtVersion; - namespace { bool debug = false; } @@ -84,7 +81,7 @@ Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Project *project) connect(m_ui->manageQtVersionPushButtons, SIGNAL(clicked()), this, SLOT(manageQtVersions())); - ProjectExplorer::QtVersionManager *vm = ProjectExplorer::QtVersionManager::instance(); + QtVersionManager *vm = QtVersionManager::instance(); connect(vm, SIGNAL(qtVersionsChanged()), this, SLOT(setupQtVersionsComboBox())); @@ -98,7 +95,7 @@ Qt4ProjectConfigWidget::~Qt4ProjectConfigWidget() void Qt4ProjectConfigWidget::manageQtVersions() { Core::ICore *core = Core::ICore::instance(); - core->showOptionsDialog(ProjectExplorer::Constants::QT_CATEGORY, ProjectExplorer::Constants::QTVERSION_PAGE); + core->showOptionsDialog(Constants::QT_CATEGORY, Constants::QTVERSION_PAGE); } @@ -184,7 +181,7 @@ void Qt4ProjectConfigWidget::updateImportLabel() { m_ui->importLabel->setVisible(false); if (m_ui->shadowBuildCheckBox->isChecked()) { - QString qtPath = ProjectExplorer::QtVersionManager::findQtVersionFromMakefile(m_ui->shadowBuildDirEdit->path()); + QString qtPath = QtVersionManager::findQtVersionFromMakefile(m_ui->shadowBuildDirEdit->path()); if (!qtPath.isEmpty()) { m_ui->importLabel->setVisible(true); } @@ -268,7 +265,7 @@ void Qt4ProjectConfigWidget::qtVersionComboBoxCurrentIndexChanged(const QString } else { newQtVersion = m_ui->qtVersionComboBox->itemData(m_ui->qtVersionComboBox->currentIndex()).toInt(); } - ProjectExplorer::QtVersionManager *vm = ProjectExplorer::QtVersionManager::instance(); + QtVersionManager *vm = QtVersionManager::instance(); bool isValid = vm->version(newQtVersion)->isValid(); m_ui->invalidQtWarningLabel->setVisible(!isValid); if (newQtVersion != m_pro->qtVersionId(m_buildConfiguration)) { diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.cpp b/src/plugins/qt4projectmanager/qt4projectmanager.cpp index 697deb5025c..470e535d730 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanager.cpp @@ -46,7 +46,6 @@ #include <projectexplorer/buildmanager.h> #include <projectexplorer/project.h> #include <projectexplorer/projectexplorerconstants.h> -#include <projectexplorer/qtversionmanager.h> #include <utils/listutils.h> #include <QtCore/QCoreApplication> @@ -68,8 +67,6 @@ using ProjectExplorer::SourceType; using ProjectExplorer::FormType; using ProjectExplorer::ResourceType; using ProjectExplorer::UnknownFileType; -using ProjectExplorer::QtVersion; -using ProjectExplorer::QtVersionManager; // Known file types of a Qt 4 project static const char* qt4FileTypes[] = { diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.pro b/src/plugins/qt4projectmanager/qt4projectmanager.pro index d471edb8cc0..7df7e44bded 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.pro +++ b/src/plugins/qt4projectmanager/qt4projectmanager.pro @@ -32,7 +32,9 @@ HEADERS = qt4projectmanagerplugin.h \ speinfo.h \ qt4projectconfigwidget.h \ qt4buildenvironmentwidget.h \ - projectloadwizard.h + projectloadwizard.h\ + qtversionmanager.h\ + qtoptionspage.h SOURCES = qt4projectmanagerplugin.cpp \ qt4projectmanager.cpp \ qt4project.cpp \ @@ -60,7 +62,9 @@ SOURCES = qt4projectmanagerplugin.cpp \ speinfo.cpp \ qt4projectconfigwidget.cpp \ qt4buildenvironmentwidget.cpp \ - projectloadwizard.cpp + projectloadwizard.cpp\ + qtversionmanager.cpp\ + qtoptionspage.cpp FORMS = envvariablespage.ui \ enveditdialog.ui \ proeditorcontainer.ui \ @@ -68,7 +72,9 @@ FORMS = envvariablespage.ui \ qmakestep.ui \ qt4projectconfigwidget.ui \ embeddedpropertiespage.ui \ - qt4buildenvironmentwidget.ui + qt4buildenvironmentwidget.ui \ + qtversionmanager.ui\ + showbuildlog.ui RESOURCES = qt4projectmanager.qrc \ wizards/wizards.qrc include(../../shared/proparser/proparser.pri) diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerconstants.h b/src/plugins/qt4projectmanager/qt4projectmanagerconstants.h index 5da496dde9c..c6257e36c4f 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanagerconstants.h +++ b/src/plugins/qt4projectmanager/qt4projectmanagerconstants.h @@ -73,6 +73,11 @@ const char * const DEPLOYHELPERRUNSTEP = "trolltech.qt4projectmanager.deployhelp const char * const VIEW_DETAILED = "Qt4.View.Detailed"; const char * const VIEW_PROFILESONLY = "Qt4.View.ProjectHierarchy"; +//Qt4 settings pages +const char * const QT_CATEGORY = "Qt4"; +const char * const QTVERSION_PAGE = "Qt Versions"; +const char * const BUILD_ENVIRONMENT_PAGE = "Build Environments"; + } // namespace Constants } // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp index 22db266f46c..a199b43c731 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp @@ -39,6 +39,8 @@ #include "embeddedpropertiespage.h" #include "qt4runconfiguration.h" #include "profilereader.h" +#include "qtversionmanager.h" +#include "qtoptionspage.h" #include <coreplugin/icore.h> #include <extensionsystem/pluginmanager.h> @@ -47,7 +49,6 @@ #include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectnodes.h> -#include <projectexplorer/qtversionmanager.h> #include <coreplugin/uniqueidmanager.h> #include <coreplugin/mimedatabase.h> #include <coreplugin/actionmanager/actionmanager.h> @@ -64,7 +65,6 @@ using namespace Qt4ProjectManager::Internal; using namespace Qt4ProjectManager; using ProjectExplorer::Project; -using ProjectExplorer::QtVersionManager; Qt4ProjectManagerPlugin::~Qt4ProjectManagerPlugin() { @@ -97,9 +97,14 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * return false; m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance(); - Core::ActionManager *am = core->actionManager(); + QtVersionManager::m_self = new QtVersionManager(); + addAutoReleasedObject(QtVersionManager::m_self); + + addAutoReleasedObject(new QtOptionsPage()); + + //create and register objects m_qt4ProjectManager = new Qt4Manager(this); addObject(m_qt4ProjectManager); diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h index 7dce30081e9..febde6bb135 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h +++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h @@ -33,13 +33,10 @@ #include <projectexplorer/project.h> #include <projectexplorer/projectexplorer.h> -namespace ProjectExplorer { - class QtVersionManager; -} - namespace Qt4ProjectManager { class Qt4Manager; +class QtVersionManager; namespace Internal { diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp index b7673f26709..abcd410b4d1 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp @@ -51,7 +51,6 @@ using namespace Qt4ProjectManager; using ProjectExplorer::ApplicationRunConfiguration; using ProjectExplorer::PersistentSettingsReader; using ProjectExplorer::PersistentSettingsWriter; -using ProjectExplorer::QtVersion; Qt4RunConfiguration::Qt4RunConfiguration(Qt4Project *pro, const QString &proFilePath) : ApplicationRunConfiguration(pro), diff --git a/src/plugins/projectexplorer/qtoptionspage.cpp b/src/plugins/qt4projectmanager/qtoptionspage.cpp similarity index 99% rename from src/plugins/projectexplorer/qtoptionspage.cpp rename to src/plugins/qt4projectmanager/qtoptionspage.cpp index c0ebf08ee18..3848763524f 100644 --- a/src/plugins/projectexplorer/qtoptionspage.cpp +++ b/src/plugins/qt4projectmanager/qtoptionspage.cpp @@ -1,14 +1,14 @@ #include "qtoptionspage.h" #include "ui_showbuildlog.h" #include "ui_qtversionmanager.h" -#include "projectexplorerconstants.h" +#include "qt4projectmanagerconstants.h" #include "qtversionmanager.h" #include <coreplugin/coreconstants.h> #include <QtCore/QDir> -using namespace ProjectExplorer; -using namespace ProjectExplorer::Internal; +using namespace Qt4ProjectManager; +using namespace Qt4ProjectManager::Internal; /// // QtOptionsPage /// diff --git a/src/plugins/projectexplorer/qtoptionspage.h b/src/plugins/qt4projectmanager/qtoptionspage.h similarity index 97% rename from src/plugins/projectexplorer/qtoptionspage.h rename to src/plugins/qt4projectmanager/qtoptionspage.h index 4d7df925343..be4fee3d8fb 100644 --- a/src/plugins/projectexplorer/qtoptionspage.h +++ b/src/plugins/qt4projectmanager/qtoptionspage.h @@ -37,7 +37,7 @@ QT_BEGIN_NAMESPACE class QTreeWidgetItem; QT_END_NAMESPACE -namespace ProjectExplorer { +namespace Qt4ProjectManager { class QtVersion; @@ -101,7 +101,7 @@ private: }; } //namespace Internal -} //namespace ProjectExplorer +} //namespace Qt4ProjectManager #endif // QTOPTIONSPAGE_H diff --git a/src/plugins/projectexplorer/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp similarity index 82% rename from src/plugins/projectexplorer/qtversionmanager.cpp rename to src/plugins/qt4projectmanager/qtversionmanager.cpp index edeb492de47..e4ea46516c9 100644 --- a/src/plugins/projectexplorer/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -29,11 +29,11 @@ #include "qtversionmanager.h" -#include "projectexplorerconstants.h" -#include "cesdkhandler.h" - -#include "projectexplorer.h" +#include "qt4projectmanagerconstants.h" +#include <projectexplorer/debugginghelper.h> +#include <projectexplorer/projectexplorer.h> +#include <projectexplorer/cesdkhandler.h> #include <coreplugin/icore.h> #include <extensionsystem/pluginmanager.h> #include <help/helpplugin.h> @@ -45,14 +45,16 @@ #include <QtGui/QApplication> #include <QtGui/QDesktopServices> -using namespace ProjectExplorer; -using namespace ProjectExplorer::Internal; +using namespace Qt4ProjectManager; +using namespace Qt4ProjectManager::Internal; + +using ProjectExplorer::DebuggingHelperLibrary; static const char *QtVersionsSectionName = "QtVersions"; static const char *defaultQtVersionKey = "DefaultQtVersion"; static const char *newQtVersionsKey = "NewQtVersions"; - +QtVersionManager *QtVersionManager::m_self = 0; QtVersionManager::QtVersionManager() : m_emptyVersion(new QtVersion) @@ -102,7 +104,7 @@ QtVersionManager::~QtVersionManager() QtVersionManager *QtVersionManager::instance() { - return ProjectExplorerPlugin::instance()->qtVersionManager(); + return m_self; } void QtVersionManager::addVersion(QtVersion *version) @@ -230,7 +232,7 @@ void QtVersionManager::addNewVersionsFromInstaller() void QtVersionManager::updateSystemVersion() { bool haveSystemVersion = false; - QString systemQMakePath = DebuggingHelperLibrary::findSystemQt(Environment::systemEnvironment()); + QString systemQMakePath = DebuggingHelperLibrary::findSystemQt(ProjectExplorer::Environment::systemEnvironment()); QString systemQtPath; if (systemQMakePath.isNull()) { systemQtPath = tr("<not found>"); @@ -259,18 +261,6 @@ void QtVersionManager::updateSystemVersion() ++m_defaultVersion; } -QStringList DebuggingHelperLibrary::possibleQMakeCommands() -{ - // On windows noone has renamed qmake, right? -#ifdef Q_OS_WIN - return QStringList() << "qmake.exe"; -#endif - // On unix some distributions renamed qmake to avoid clashes - QStringList result; - result << "qmake-qt4" << "qmake4" << "qmake"; - return result; -} - QtVersion *QtVersionManager::currentQtVersion() const { if (m_defaultVersion < m_versions.count()) @@ -809,7 +799,7 @@ void QtVersion::setMsvcVersion(const QString &version) m_msvcVersion = version; } -void QtVersion::addToEnvironment(Environment &env) +void QtVersion::addToEnvironment(ProjectExplorer::Environment &env) { env.set("QTDIR", m_path); QString qtdirbin = versionInfo().value("QT_INSTALL_BINS"); @@ -901,178 +891,3 @@ QString QtVersion::buildDebuggingHelperLibrary() return output; } - -/// -// Helper functions for building, checking for existance and finding the debugging helper library -/// - -QString DebuggingHelperLibrary::findSystemQt(const Environment &env) -{ - QStringList paths = env.path(); - foreach (const QString &path, paths) { - foreach (const QString &possibleCommand, possibleQMakeCommands()) { - QFileInfo qmake(path + "/" + possibleCommand); - if (qmake.exists()) { - if (!qtVersionForQMake(qmake.absoluteFilePath()).isNull()) { - return qmake.absoluteFilePath(); - } - } - } - } - return QString::null; -} - -bool DebuggingHelperLibrary::hasDebuggingHelperLibrary(const QString &qmakePath) -{ - return !debuggingHelperLibrary(qmakePath).isNull(); -} - -QStringList DebuggingHelperLibrary::debuggingHelperLibraryDirectories(const QString &qtInstallData, const QString &qtpath) -{ - uint hash = qHash(qtpath); - QStringList directories; - directories - << (qtInstallData + "/qtc-debugging-helper/") - << (QApplication::applicationDirPath() + "/../qtc-debugging-helper/" + QString::number(hash)) + "/" - << (QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/qtc-debugging-helper/" + QString::number(hash)) + "/"; - return directories; -} - -QString DebuggingHelperLibrary::debuggingHelperLibrary(const QString &qmakePath) -{ - return debuggingHelperLibrary(qtInstallDataDir(qmakePath), qtDir(qmakePath)); -} - -QString DebuggingHelperLibrary::qtInstallDataDir(const QString &qmakePath) -{ - QProcess proc; - proc.start(qmakePath, QStringList() << "-query"<< "QT_INSTALL_DATA"); - if (proc.waitForFinished()) - return QString(proc.readAll().trimmed()); - return QString::null; -} - -QString DebuggingHelperLibrary::qtDir(const QString &qmakePath) -{ - QDir dir = QFileInfo(qmakePath).absoluteDir(); - dir.cdUp(); - return dir.absolutePath(); -} - -// Debugging Helper Library - -QString DebuggingHelperLibrary::debuggingHelperLibrary(const QString &qtInstallData, const QString &qtpath) -{ - foreach(const QString &directory, debuggingHelperLibraryDirectories(qtInstallData, qtpath)) { -#if defined(Q_OS_WIN) - QFileInfo fi(directory + "debug/gdbmacros.dll"); -#elif defined(Q_OS_MAC) - QFileInfo fi(directory + "libgdbmacros.dylib"); -#else // generic UNIX - QFileInfo fi(directory + "libgdbmacros.so"); -#endif - if (fi.exists()) - return fi.filePath(); - } - return QString(); -} - - -QString DebuggingHelperLibrary::buildDebuggingHelperLibrary(const QString &qmakePath, const QString &make, const Environment &env) -{ - QString directory = copyDebuggingHelperLibrary(qtInstallDataDir(qmakePath), qtDir(qmakePath)); - return buildDebuggingHelperLibrary(directory, make, qmakePath, QString::null, env); - return QString::null; -} - -QString DebuggingHelperLibrary::copyDebuggingHelperLibrary(const QString &qtInstallData, const QString &qtdir) -{ - // Locations to try: - // $QTDIR/qtc-debugging-helper - // $APPLICATION-DIR/qtc-debugging-helper/$hash - // $USERDIR/qtc-debugging-helper/$hash - QStringList directories = DebuggingHelperLibrary::debuggingHelperLibraryDirectories(qtInstallData, qtdir); - - QStringList files; - files << "gdbmacros.cpp" << "gdbmacros.pro" - << "LICENSE.LGPL" << "LGPL_EXCEPTION.TXT"; - foreach(const QString &directory, directories) { - QString dumperPath = Core::ICore::instance()->resourcePath() + "/gdbmacros/"; - bool success = true; - QDir().mkpath(directory); - foreach (const QString &file, files) { - QString source = dumperPath + file; - QString dest = directory + file; - QFileInfo destInfo(dest); - if (destInfo.exists()) { - if (destInfo.lastModified() >= QFileInfo(source).lastModified()) - continue; - success &= QFile::remove(dest); - } - success &= QFile::copy(source, dest); - } - if (success) - return directory; - } - return QString::null; -} - -QString DebuggingHelperLibrary::buildDebuggingHelperLibrary(const QString &directory, const QString &makeCommand, const QString &qmakeCommand, const QString &mkspec, const Environment &env) -{ - QString output; - // Setup process - QProcess proc; - proc.setEnvironment(env.toStringList()); - proc.setWorkingDirectory(directory); - proc.setProcessChannelMode(QProcess::MergedChannels); - - output += QString("Building debugging helper library in %1\n").arg(directory); - output += "\n"; - - QString makeFullPath = env.searchInPath(makeCommand); - if (!makeFullPath.isEmpty()) { - output += QString("Running %1 clean...\n").arg(makeFullPath); - proc.start(makeFullPath, QStringList() << "clean"); - proc.waitForFinished(); - output += proc.readAll(); - } else { - output += QString("%1 not found in PATH\n").arg(makeCommand); - return output; - } - - output += QString("\nRunning %1 ...\n").arg(qmakeCommand); - - proc.start(qmakeCommand, QStringList()<<"-spec"<< (mkspec.isEmpty() ? "default" : mkspec) <<"gdbmacros.pro"); - proc.waitForFinished(); - - output += proc.readAll(); - - output += "\n"; - if (!makeFullPath.isEmpty()) { - output += QString("Running %1 ...\n").arg(makeFullPath); - proc.start(makeFullPath, QStringList()); - proc.waitForFinished(); - output += proc.readAll(); - } else { - output += QString("%1 not found in PATH\n").arg(makeCommand); - } - return output; -} - -QString DebuggingHelperLibrary::qtVersionForQMake(const QString &qmakePath) -{ - QProcess qmake; - qmake.start(qmakePath, QStringList()<<"--version"); - if (!qmake.waitForFinished()) - return false; - QString output = qmake.readAllStandardOutput(); - QRegExp regexp("(QMake version|QMake version:)[\\s]*([\\d.]*)", Qt::CaseInsensitive); - regexp.indexIn(output); - if (regexp.cap(2).startsWith("2.")) { - QRegExp regexp2("Using Qt version[\\s]*([\\d\\.]*)", Qt::CaseInsensitive); - regexp2.indexIn(output); - return regexp2.cap(1); - } - return QString(); -} - diff --git a/src/plugins/projectexplorer/qtversionmanager.h b/src/plugins/qt4projectmanager/qtversionmanager.h similarity index 76% rename from src/plugins/projectexplorer/qtversionmanager.h rename to src/plugins/qt4projectmanager/qtversionmanager.h index de3a26ce0d1..b8b8834bca9 100644 --- a/src/plugins/projectexplorer/qtversionmanager.h +++ b/src/plugins/qt4projectmanager/qtversionmanager.h @@ -30,20 +30,20 @@ #ifndef QTVERSIONMANAGER_H #define QTVERSIONMANAGER_H -#include "environment.h" -#include "toolchain.h" -#include "projectexplorer_export.h" +#include <projectexplorer/environment.h> +#include <projectexplorer/toolchain.h> #include <QtCore/QHash> -namespace ProjectExplorer { +namespace Qt4ProjectManager { namespace Internal { class QtOptionsPageWidget; class QtOptionsPage; +class Qt4ProjectManagerPlugin; } -class PROJECTEXPLORER_EXPORT QtVersion +class QtVersion { friend class Internal::QtOptionsPageWidget; //for changing name and path friend class QtVersionManager; @@ -124,8 +124,9 @@ private: bool m_hasDebuggingHelper; }; -class PROJECTEXPLORER_EXPORT QtVersionManager : public QObject +class QtVersionManager : public QObject { + friend class Internal::Qt4ProjectManagerPlugin; Q_OBJECT // for getUniqueId(); friend class QtVersion; @@ -168,33 +169,10 @@ private: QList<QtVersion *> m_versions; QMap<int, int> m_uniqueIdToIndex; int m_idcount; + // managed by QtProjectManagerPlugin + static QtVersionManager *m_self; }; - -class PROJECTEXPLORER_EXPORT DebuggingHelperLibrary -{ -public: - // returns the full path to the first qmake, qmake-qt4, qmake4 that has - // at least version 2.0.0 and thus is a qt4 qmake - static QString findSystemQt(const Environment &env); - // returns something like qmake4, qmake, qmake-qt4 or whatever distributions have chosen (used by QtVersion) - static QStringList possibleQMakeCommands(); - // return true if the qmake at qmakePath is qt4 (used by QtVersion) - static QString qtVersionForQMake(const QString &qmakePath); - - - static bool hasDebuggingHelperLibrary(const QString &qmakePath); - static QString debuggingHelperLibrary(const QString &qmakePath); - static QString buildDebuggingHelperLibrary(const QString &qmakePath, const QString &make, const Environment &env); - static QString debuggingHelperLibrary(const QString &qtInstallData, const QString &qtpath); - static QString copyDebuggingHelperLibrary(const QString &qtInstallData, const QString &qtdir); - static QString buildDebuggingHelperLibrary(const QString &directory, const QString &makeCommand, const QString &qmakeCommand, const QString &mkspec, const Environment &env); -private: - static QStringList debuggingHelperLibraryDirectories(const QString &qtInstallData, const QString &qtpath); - static QString qtInstallDataDir(const QString &qmakePath); - static QString qtDir(const QString &qmakePath); -}; - -} // namespace ProjectExplorer +} // namespace Qt4ProjectManager #endif // QTVERSIONMANAGER_H diff --git a/src/plugins/projectexplorer/qtversionmanager.ui b/src/plugins/qt4projectmanager/qtversionmanager.ui similarity index 97% rename from src/plugins/projectexplorer/qtversionmanager.ui rename to src/plugins/qt4projectmanager/qtversionmanager.ui index dd8b252299d..2dd168325ce 100644 --- a/src/plugins/projectexplorer/qtversionmanager.ui +++ b/src/plugins/qt4projectmanager/qtversionmanager.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>ProjectExplorer::Internal::QtVersionManager</class> - <widget class="QWidget" name="ProjectExplorer::Internal::QtVersionManager"> + <class>Qt4ProjectManager::Internal::QtVersionManager</class> + <widget class="QWidget" name="Qt4ProjectManager::Internal::QtVersionManager"> <property name="geometry"> <rect> <x>0</x> diff --git a/src/plugins/projectexplorer/showbuildlog.ui b/src/plugins/qt4projectmanager/showbuildlog.ui similarity index 100% rename from src/plugins/projectexplorer/showbuildlog.ui rename to src/plugins/qt4projectmanager/showbuildlog.ui -- GitLab