Skip to content
Snippets Groups Projects
Commit 08001d24 authored by dt's avatar dt
Browse files

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents b718730d 3cae726f
No related merge requests found
......@@ -81,11 +81,11 @@ void CdbOptions::toSettings(QSettings *s) const
s->endGroup();
}
bool CdbOptions::autoDetectPath(QString *outPath)
bool CdbOptions::autoDetectPath(QString *outPath, QStringList *checkedDirectories /* = 0 */)
{
// Look for $ProgramFiles/"Debugging Tools For Windows" and its
// :" (x86)", " (x64)" variations
static const char *postFixes[] = { " (x86)", " (x64)" };
static const char *postFixes[] = { " (x86)", " (x32)", " (x64)" };
outPath->clear();
const QByteArray programDirB = qgetenv("ProgramFiles");
......@@ -95,6 +95,8 @@ bool CdbOptions::autoDetectPath(QString *outPath)
const QString programDir = QString::fromLocal8Bit(programDirB) + QDir::separator();
const QString installDir = QLatin1String("Debugging Tools For Windows");
QString path = programDir + installDir;
if (checkedDirectories)
checkedDirectories->push_back(path);
if (QFileInfo(path).isDir()) {
*outPath = QDir::toNativeSeparators(path);
return true;
......@@ -103,6 +105,8 @@ bool CdbOptions::autoDetectPath(QString *outPath)
for (int i = 0; i < sizeof(postFixes)/sizeof(const char*); i++) {
path.truncate(rootLength);
path += QLatin1String(postFixes[i]);
if (checkedDirectories)
checkedDirectories->push_back(path);
if (QFileInfo(path).isDir()) {
*outPath = QDir::toNativeSeparators(path);
return true;
......
......@@ -53,7 +53,7 @@ public:
unsigned compare(const CdbOptions &s) const;
// Locate the debugging tools
static bool autoDetectPath(QString *path);
static bool autoDetectPath(QString *path, QStringList *checkedDirectories = 0);
bool enabled;
QString path;
......
......@@ -32,7 +32,9 @@
#include "debuggerconstants.h"
#include <coreplugin/icore.h>
#include <QtCore/QCoreApplication>
#include <QtGui/QMessageBox>
const char * const CDB_SETTINGS_ID = QT_TRANSLATE_NOOP("Debugger::Internal::CdbOptionsPageWidget", "Cdb");
......@@ -70,10 +72,18 @@ CdbOptions CdbOptionsPageWidget::options() const
void CdbOptionsPageWidget::autoDetect()
{
QString path;
const bool ok = CdbOptions::autoDetectPath(&path);
QStringList checkedDirectories;
const bool ok = CdbOptions::autoDetectPath(&path, &checkedDirectories);
m_ui.cdbOptionsGroupBox->setChecked(ok);
if (ok)
if (ok) {
m_ui.pathChooser->setPath(path);
} else {
const QString msg = tr("\"Debugging Tools for Windows\" could not be found.");
const QString details = tr("Checked:\n%1").arg(checkedDirectories.join(QString(QLatin1Char('\n'))));
QMessageBox msbBox(QMessageBox::Information, tr("Autodetection"), msg, QMessageBox::Ok, this);
msbBox.setDetailedText(details);
msbBox.exec();
}
}
void CdbOptionsPageWidget::setFailureMessage(const QString &msg)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment