2009-04-17 09:03:32 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** 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 "cdboptionspage.h"
|
|
|
|
|
#include "cdboptions.h"
|
|
|
|
|
#include "debuggerconstants.h"
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/icore.h>
|
2009-05-19 16:51:33 +02:00
|
|
|
|
2009-04-17 09:03:32 +02:00
|
|
|
#include <QtCore/QCoreApplication>
|
2009-05-20 11:48:31 +02:00
|
|
|
#include <QtCore/QUrl>
|
2009-05-19 16:51:33 +02:00
|
|
|
#include <QtGui/QMessageBox>
|
2009-05-20 11:48:31 +02:00
|
|
|
#include <QtGui/QDesktopServices>
|
2009-04-17 09:03:32 +02:00
|
|
|
|
2009-05-06 17:52:32 +02:00
|
|
|
const char * const CDB_SETTINGS_ID = QT_TRANSLATE_NOOP("Debugger::Internal::CdbOptionsPageWidget", "Cdb");
|
2009-04-17 09:03:32 +02:00
|
|
|
|
2009-05-20 11:48:31 +02:00
|
|
|
static const char *dgbToolsDownloadLink32C = "http://www.microsoft.com/whdc/devtools/debugging/installx86.Mspx";
|
|
|
|
|
static const char *dgbToolsDownloadLink64C = "http://www.microsoft.com/whdc/devtools/debugging/install64bit.Mspx";
|
|
|
|
|
|
2009-04-17 09:03:32 +02:00
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2009-05-20 11:48:31 +02:00
|
|
|
static inline QString msgPathConfigNote()
|
|
|
|
|
{
|
|
|
|
|
#ifdef Q_OS_WIN64
|
|
|
|
|
const bool is64bit = true;
|
|
|
|
|
#else
|
|
|
|
|
const bool is64bit = false;
|
|
|
|
|
#endif
|
|
|
|
|
const QString link = is64bit ? QLatin1String(dgbToolsDownloadLink64C) : QLatin1String(dgbToolsDownloadLink32C);
|
2009-06-15 19:16:14 +02:00
|
|
|
//: Label text for path configuration. %2 is "x-bit version".
|
2009-05-20 11:48:31 +02:00
|
|
|
return CdbOptionsPageWidget::tr(
|
|
|
|
|
"<html><body><p>Specify the path to the "
|
|
|
|
|
"<a href=\"%1\">Debugging Tools for Windows</a>"
|
2009-06-15 19:16:14 +02:00
|
|
|
" (%2) here.</p>"
|
2009-05-20 11:48:31 +02:00
|
|
|
"<p><b>Note:</b> Restarting Qt Creator is required for these settings to take effect.</p></p>"
|
2009-06-16 13:27:18 +02:00
|
|
|
"</body></html>").arg(link, (is64bit ? tr("64-bit version") : tr("32-bit version")));
|
2009-05-20 11:48:31 +02:00
|
|
|
}
|
|
|
|
|
|
2009-04-17 09:03:32 +02:00
|
|
|
CdbOptionsPageWidget::CdbOptionsPageWidget(QWidget *parent) :
|
|
|
|
|
QWidget(parent)
|
|
|
|
|
{
|
|
|
|
|
m_ui.setupUi(this);
|
2009-05-20 11:48:31 +02:00
|
|
|
m_ui.noteLabel->setText(msgPathConfigNote());
|
|
|
|
|
m_ui.noteLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
|
|
|
|
connect(m_ui.noteLabel, SIGNAL(linkActivated(QString)), this, SLOT(downLoadLinkActivated(QString)));
|
|
|
|
|
|
2009-04-17 09:03:32 +02:00
|
|
|
m_ui.pathChooser->setExpectedKind(Core::Utils::PathChooser::Directory);
|
|
|
|
|
m_ui.pathChooser->addButton(tr("Autodetect"), this, SLOT(autoDetect()));
|
|
|
|
|
m_ui.failureLabel->setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CdbOptionsPageWidget::setOptions(CdbOptions &o)
|
|
|
|
|
{
|
|
|
|
|
m_ui.pathChooser->setPath(o.path);
|
2009-05-20 11:48:31 +02:00
|
|
|
m_ui.cdbPathGroupBox->setChecked(o.enabled);
|
2009-05-08 16:56:48 +02:00
|
|
|
m_ui.symbolPathListEditor->setPathList(o.symbolPaths);
|
|
|
|
|
m_ui.sourcePathListEditor->setPathList(o.sourcePaths);
|
2009-04-17 09:03:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CdbOptions CdbOptionsPageWidget::options() const
|
|
|
|
|
{
|
|
|
|
|
CdbOptions rc;
|
|
|
|
|
rc.path = m_ui.pathChooser->path();
|
2009-05-20 11:48:31 +02:00
|
|
|
rc.enabled = m_ui.cdbPathGroupBox->isChecked();
|
2009-05-08 16:56:48 +02:00
|
|
|
rc.symbolPaths = m_ui.symbolPathListEditor->pathList();
|
|
|
|
|
rc.sourcePaths = m_ui.sourcePathListEditor->pathList();
|
2009-04-17 09:03:32 +02:00
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CdbOptionsPageWidget::autoDetect()
|
|
|
|
|
{
|
|
|
|
|
QString path;
|
2009-05-19 16:51:33 +02:00
|
|
|
QStringList checkedDirectories;
|
|
|
|
|
const bool ok = CdbOptions::autoDetectPath(&path, &checkedDirectories);
|
2009-05-20 11:48:31 +02:00
|
|
|
m_ui.cdbPathGroupBox->setChecked(ok);
|
2009-05-19 16:51:33 +02:00
|
|
|
if (ok) {
|
2009-04-17 09:03:32 +02:00
|
|
|
m_ui.pathChooser->setPath(path);
|
2009-05-19 16:51:33 +02:00
|
|
|
} 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();
|
|
|
|
|
}
|
2009-04-17 09:03:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CdbOptionsPageWidget::setFailureMessage(const QString &msg)
|
|
|
|
|
{
|
|
|
|
|
m_ui.failureLabel->setText(msg);
|
|
|
|
|
m_ui.failureLabel->setVisible(!msg.isEmpty());
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-20 11:48:31 +02:00
|
|
|
void CdbOptionsPageWidget::downLoadLinkActivated(const QString &link)
|
|
|
|
|
{
|
|
|
|
|
QDesktopServices::openUrl(QUrl(link));
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-17 09:03:32 +02:00
|
|
|
// ---------- CdbOptionsPage
|
|
|
|
|
CdbOptionsPage::CdbOptionsPage(const QSharedPointer<CdbOptions> &options) :
|
|
|
|
|
m_options(options)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CdbOptionsPage::~CdbOptionsPage()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString CdbOptionsPage::settingsId()
|
|
|
|
|
{
|
|
|
|
|
return QLatin1String(CDB_SETTINGS_ID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString CdbOptionsPage::trName() const
|
|
|
|
|
{
|
|
|
|
|
return tr(CDB_SETTINGS_ID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString CdbOptionsPage::category() const
|
|
|
|
|
{
|
|
|
|
|
return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString CdbOptionsPage::trCategory() const
|
|
|
|
|
{
|
|
|
|
|
return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QWidget *CdbOptionsPage::createPage(QWidget *parent)
|
|
|
|
|
{
|
|
|
|
|
m_widget = new CdbOptionsPageWidget(parent);
|
|
|
|
|
m_widget->setOptions(*m_options);
|
|
|
|
|
m_widget->setFailureMessage(m_failureMessage);
|
|
|
|
|
return m_widget;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CdbOptionsPage::apply()
|
|
|
|
|
{
|
|
|
|
|
if (!m_widget)
|
|
|
|
|
return;
|
|
|
|
|
const CdbOptions newOptions = m_widget->options();
|
2009-05-08 16:56:48 +02:00
|
|
|
if (const unsigned changedMask = m_options->compare(newOptions)) {
|
2009-04-17 09:03:32 +02:00
|
|
|
*m_options = newOptions;
|
|
|
|
|
m_options->toSettings(Core::ICore::instance()->settings());
|
2009-05-08 16:56:48 +02:00
|
|
|
if (changedMask & CdbOptions::DebuggerPathsChanged)
|
|
|
|
|
emit debuggerPathsChanged();
|
2009-04-17 09:03:32 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CdbOptionsPage::finish()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|