Commit 2b302332 authored by dt's avatar dt
Browse files

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
parent 1c722840
......@@ -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>
......
/**************************************************************************
**
** 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;
}
/**************************************************************************
**
** 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
......@@ -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;
......@@ -1912,9 +1905,4 @@ void ProjectExplorerPlugin::setSession(QAction *action)
m_session->loadSession(session);
}
QtVersionManager *ProjectExplorerPlugin::qtVersionManager() const
{
return m_versionManager;
}
Q_EXPORT_PLUGIN(ProjectExplorerPlugin)
......@@ -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;
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -35,8 +35,6 @@
using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
using ProjectExplorer::QtVersion;
ProFileReader::ProFileReader()
{
}
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
......@@ -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>
......
......@@ -64,7 +64,6 @@
using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
using ProjectExplorer::QtVersion;
namespace {
bool debug = false;
......
......@@ -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()));
......
......@@ -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
......
......@@ -43,9 +43,6 @@
#include <QtGui/QFileDialog>