Commit 1729c2c0 authored by Friedemann Kleint's avatar Friedemann Kleint

Debugger: Improve the helper build mechanism on the settings page.

- Give the controls a tooltip listing file details (date)
- Make building a QtConcurrent task
- Make log window scroll to bottom and pop up on error
- Make the build code pass on error messages about copying the
  source files to the log file
- Clean up the building code string-wise, use QLatin1String and
  translate messages, cache the icons. Use a QSharedPointer for
  the QtVersions in the settings page since they are passed to
  the BuildTask, which may outlive the dialog.
parent ef43fbf5
......@@ -56,10 +56,12 @@ public:
static QString buildDebuggingHelperLibrary(const QString &qmakePath, const QString &make, const Environment &env);
static QString buildDebuggingHelperLibrary(const QString &directory, const QString &makeCommand, const QString &qmakeCommand, const QString &mkspec, const Environment &env);
// Build the helpers and return the output log/errormessage.
static QStringList debuggingHelperLibraryLocations(const QString &qmakePath);
static QStringList debuggingHelperLibraryLocations(const QString &qtInstallData, const QString &qtpath);
static QString copyDebuggingHelperLibrary(const QString &qtInstallData, const QString &qtdir);
// Copy the source files to a target location and return the chosen target location.
static QString copyDebuggingHelperLibrary(const QString &qtInstallData, const QString &qtdir, QString *errorMessage);
private:
static QStringList debuggingHelperLibraryDirectories(const QString &qtInstallData, const QString &qtpath);
......
......@@ -31,7 +31,11 @@
#include <coreplugin/dialogs/ioptionspage.h>
#include <QtCore/QSharedPointer>
#include <QtGui/QWidget>
#include <QtGui/QPixmap>
#include <QtGui/QIcon>
QT_BEGIN_NAMESPACE
class QTreeWidgetItem;
......@@ -40,34 +44,62 @@ QT_END_NAMESPACE
namespace Qt4ProjectManager {
class QtVersion;
typedef QSharedPointer<QtVersion> QSharedPointerQtVersion;
namespace Internal {
namespace Ui {
class QtVersionManager;
}
// A task suitable to be run by QtConcurrent to build the helpers.
// Note that it may outlive the settings page if someone quickly cancels it,
// so, the versions are passed around by QSharedPointer.
class DebuggingHelperBuildTask : public QObject {
Q_DISABLE_COPY(DebuggingHelperBuildTask)
Q_OBJECT
public:
explicit DebuggingHelperBuildTask(const QSharedPointerQtVersion &version);
virtual ~DebuggingHelperBuildTask();
void run();
signals:
void finished(const QString &versionName, const QString &output);
private:
QSharedPointerQtVersion m_version;
};
class QtOptionsPageWidget : public QWidget
{
Q_OBJECT
Q_DISABLE_COPY(QtOptionsPageWidget)
public:
QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> versions, QtVersion *defaultVersion);
~QtOptionsPageWidget();
QList<QtVersion *> versions() const;
QList<QSharedPointerQtVersion> versions() const;
int defaultVersion() const;
void finish();
private:
void showEnvironmentPage(QTreeWidgetItem * item);
void fixQtVersionName(int index);
int indexForWidget(QWidget *debuggingHelperWidget) const;
int indexForTreeItem(QTreeWidgetItem *item) const;
int indexForTreeItem(const QTreeWidgetItem *item) const;
QTreeWidgetItem *treeItemForIndex(int index) const;
QtVersion *currentVersion() const;
int currentIndex() const;
void updateDebuggingHelperStateLabel(const QtVersion *version = 0);
const QPixmap m_debuggingHelperOkPixmap;
const QPixmap m_debuggingHelperErrorPixmap;
const QIcon m_debuggingHelperOkIcon;
const QIcon m_debuggingHelperErrorIcon;
const QString m_specifyNameString;
const QString m_specifyPathString;
Internal::Ui::QtVersionManager *m_ui;
QList<QtVersion *> m_versions;
QList<QSharedPointerQtVersion> m_versions; // Passed on to the helper build task, so, use QSharedPointerQtVersion
int m_defaultVersion;
QString m_specifyNameString;
QString m_specifyPathString;
private slots:
void versionChanged(QTreeWidgetItem *item, QTreeWidgetItem *old);
......@@ -89,6 +121,7 @@ private slots:
void msvcVersionChanged();
void buildDebuggingHelper();
void showDebuggingBuildLog();
void debuggingHelperBuildFinished(const QString &versionName, const QString &output);
};
class QtOptionsPage : public Core::IOptionsPage
......
......@@ -1266,8 +1266,10 @@ QString QtVersion::buildDebuggingHelperLibrary()
// TODO: the debugging helper doesn't comply to actual tool chain yet
ProjectExplorer::ToolChain *tc = createToolChain(defaultToolchainType());
tc->addToEnvironment(env);
QString directory = DebuggingHelperLibrary::copyDebuggingHelperLibrary(qtInstallData, path());
QString output = DebuggingHelperLibrary::buildDebuggingHelperLibrary(directory, tc->makeCommand(), qmakeCommand(), mkspec(), env);
QString output;
QString directory = DebuggingHelperLibrary::copyDebuggingHelperLibrary(qtInstallData, path(), &output);
if (!directory.isEmpty())
output += DebuggingHelperLibrary::buildDebuggingHelperLibrary(directory, tc->makeCommand(), qmakeCommand(), mkspec(), env);
m_hasDebuggingHelper = !debuggingHelperLibrary().isEmpty();
delete tc;
return output;
......
......@@ -17,31 +17,6 @@
<string>Qt versions</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QTreeWidget" name="qtdirList">
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="columnCount">
<number>3</number>
</property>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Path</string>
</property>
</column>
<column>
<property name="text">
<string>Debugging Helper</string>
</property>
</column>
</widget>
</item>
<item row="0" column="2">
<layout class="QVBoxLayout">
<property name="spacing">
......@@ -91,43 +66,6 @@
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="versionNameLabel">
<property name="text">
<string>Version Name:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="nameEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="pathLabel">
<property name="text">
<string>Path:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Core::Utils::PathChooser" name="qtPath" native="true"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mingwLabel">
<property name="text">
<string>MinGw Directory:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Core::Utils::PathChooser" name="mingwPath" native="true"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="msvcLabel">
<property name="text">
<string>MSVC Version:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
......@@ -162,23 +100,6 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="QLabel" name="mwcLabel">
<property name="text">
<string>MWC Directory:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="Core::Utils::PathChooser" name="mwcPath" native="true"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Debugging Helper:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
......@@ -210,6 +131,75 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</item>
<item row="0" column="0" colspan="2">
<widget class="QTreeWidget" name="qtdirList">
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="columnCount">
<number>3</number>
</property>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Path</string>
</property>
</column>
<column>
<property name="text">
<string>Debugging Helper</string>
</property>
</column>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="versionNameLabel">
<property name="text">
<string>Version Name:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="nameEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="pathLabel">
<property name="text">
<string>Path:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Core::Utils::PathChooser" name="qtPath"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mingwLabel">
<property name="text">
<string>MinGw Directory:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Core::Utils::PathChooser" name="mingwPath"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="msvcLabel">
<property name="text">
<string>MSVC Version:</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="debuggingHelperLabel">
<property name="text">
<string>Debugging Helper:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="errorLabel">
<property name="text">
......@@ -217,6 +207,16 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="mwcLabel">
<property name="text">
<string>MWC Directory:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="Core::Utils::PathChooser" name="mwcPath"/>
</item>
</layout>
<zorder>qtdirList</zorder>
<zorder>versionNameLabel</zorder>
......@@ -226,12 +226,10 @@ p, li { white-space: pre-wrap; }
<zorder>mingwLabel</zorder>
<zorder>mingwPath</zorder>
<zorder>msvcLabel</zorder>
<zorder>label</zorder>
<zorder>debuggingHelperLabel</zorder>
<zorder>errorLabel</zorder>
<zorder>mwcLabel</zorder>
<zorder>mwcPath</zorder>
<zorder>msvcComboBox</zorder>
<zorder>msvcNotFoundLabel</zorder>
</widget>
</item>
<item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment