Fix the directories the cmakelugin checks for the debugger plugin

I need to refactor that code for 1.2.
This commit is contained in:
dt
2009-04-17 12:27:04 +02:00
parent dd67f0857d
commit ad1047925b
2 changed files with 16 additions and 9 deletions

View File

@@ -155,7 +155,10 @@ QString CMakeManager::qtVersionForQMake(const QString &qmakePath)
return QString();
}
QString CMakeManager::findQtDir(const ProjectExplorer::Environment &env)
// this is mostly a copy from qt4versionmanager
// TODO refactor this code
// returns QPair< QTDIR, QT_INSTALL_DATA >
QPair<QString, QString> CMakeManager::findQtDir(const ProjectExplorer::Environment &env)
{
QStringList possibleCommands;
// On windows noone has renamed qmake, right?
@@ -171,21 +174,23 @@ QString CMakeManager::findQtDir(const ProjectExplorer::Environment &env)
QFileInfo qmake(path + "/" + possibleCommand);
if (qmake.exists()) {
if (!qtVersionForQMake(qmake.absoluteFilePath()).isNull()) {
QDir qtDir = qmake.absoluteDir();
qtDir.cdUp();
QProcess proc;
proc.start(qmake.absoluteFilePath(), QStringList() << "-query" << "QT_INSTALL_DATA");
if (proc.waitForFinished()) {
return proc.readAll().trimmed();
return qMakePair(qtDir.absolutePath(), QString(proc.readAll().trimmed()));
} else {
proc.kill();
QDir dir(qmake.absoluteDir());
dir.cdUp();
return dir.absolutePath();
return qMakePair(qtDir.absolutePath(), dir.absolutePath());
}
}
}
}
}
return QString();
return qMakePair(QString(), QString());
}
// This code is more or less duplicated in qtversionmanager
@@ -195,14 +200,16 @@ QString CMakeManager::findDumperLibrary(const ProjectExplorer::Environment &env)
static QString lastpath;
if (lastenv == env)
return lastpath;
QString qtdir = findQtDir(env);
if (qtdir.isEmpty())
QPair<QString, QString> pair = findQtDir(env);
QString qtInstallDataDir = pair.second;
if (qtInstallDataDir.isEmpty())
return QString();
uint hash = qHash(qtdir);
uint hash = qHash(pair.first);
QStringList directories;
directories
<< (qtdir + "/qtc-debugging-helper/")
<< (qtInstallDataDir + "/qtc-debugging-helper/")
<< (QApplication::applicationDirPath() + "/../qtc-debugging-helper/" + QString::number(hash)) + "/"
<< (QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/qtc-debugging-helper/" + QString::number(hash)) + "/";
foreach(const QString &directory, directories) {

View File

@@ -65,7 +65,7 @@ public:
static QString findDumperLibrary(const ProjectExplorer::Environment &env);
private:
static QString qtVersionForQMake(const QString &qmakePath);
static QString findQtDir(const ProjectExplorer::Environment &env);
static QPair<QString, QString> findQtDir(const ProjectExplorer::Environment &env);
int m_projectContext;
int m_projectLanguage;
CMakeSettingsPage *m_settingsPage;