move ProfileChooser from Debugger to ProjectExplorer

Change-Id: I5a4dcd5b9101118de8c88b6d26af5a9dbb32ba54
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Orgad Shaneh
2012-07-15 21:45:29 +03:00
committed by hjk
parent 5e3998dd16
commit 187ac69a5f
9 changed files with 49 additions and 54 deletions

View File

@@ -68,7 +68,6 @@ HEADERS += \
watchdelegatewidgets.h \ watchdelegatewidgets.h \
debuggerruncontrolfactory.h \ debuggerruncontrolfactory.h \
debuggertooltipmanager.h \ debuggertooltipmanager.h \
debuggertoolchaincombobox.h \
debuggersourcepathmappingwidget.h \ debuggersourcepathmappingwidget.h \
memoryview.h \ memoryview.h \
qtmessagelogwindow.h \ qtmessagelogwindow.h \
@@ -122,7 +121,6 @@ SOURCES += \
stackframe.cpp \ stackframe.cpp \
watchdelegatewidgets.cpp \ watchdelegatewidgets.cpp \
debuggertooltipmanager.cpp \ debuggertooltipmanager.cpp \
debuggertoolchaincombobox.cpp \
debuggersourcepathmappingwidget.cpp \ debuggersourcepathmappingwidget.cpp \
memoryview.cpp \ memoryview.cpp \
qtmessagelogwindow.cpp \ qtmessagelogwindow.cpp \

View File

@@ -69,8 +69,6 @@ QtcPlugin {
"debuggerstreamops.cpp", "debuggerstreamops.cpp",
"debuggerstreamops.h", "debuggerstreamops.h",
"debuggerstringutils.h", "debuggerstringutils.h",
"debuggertoolchaincombobox.cpp",
"debuggertoolchaincombobox.h",
"debuggertooltipmanager.cpp", "debuggertooltipmanager.cpp",
"debuggertooltipmanager.h", "debuggertooltipmanager.h",
"disassembleragent.cpp", "disassembleragent.cpp",

View File

@@ -36,12 +36,12 @@
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include "debuggerprofileinformation.h" #include "debuggerprofileinformation.h"
#include "debuggerstringutils.h" #include "debuggerstringutils.h"
#include "debuggertoolchaincombobox.h"
#include "cdb/cdbengine.h" #include "cdb/cdbengine.h"
#include "shared/hostutils.h" #include "shared/hostutils.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <projectexplorer/abi.h> #include <projectexplorer/abi.h>
#include <projectexplorer/profilechooser.h>
#include <projectexplorer/profileinformation.h> #include <projectexplorer/profileinformation.h>
#include <utils/filterlineedit.h> #include <utils/filterlineedit.h>
#include <utils/historycompleter.h> #include <utils/historycompleter.h>
@@ -196,7 +196,7 @@ public:
QLabel *coreLabel; QLabel *coreLabel;
Utils::PathChooser *coreFileName; Utils::PathChooser *coreFileName;
QLabel *profileLabel; QLabel *profileLabel;
Debugger::ProfileChooser *profileComboBox; ProfileChooser *profileComboBox;
Utils::PathChooser *overrideStartScriptFileName; Utils::PathChooser *overrideStartScriptFileName;
QLabel *overrideStartScriptLabel; QLabel *overrideStartScriptLabel;
QDialogButtonBox *buttonBox; QDialogButtonBox *buttonBox;
@@ -226,7 +226,7 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent)
d->overrideStartScriptLabel = new QLabel(tr("Override &start script:"), this); d->overrideStartScriptLabel = new QLabel(tr("Override &start script:"), this);
d->overrideStartScriptLabel->setBuddy(d->overrideStartScriptFileName); d->overrideStartScriptLabel->setBuddy(d->overrideStartScriptFileName);
d->profileComboBox = new Debugger::ProfileChooser(this); d->profileComboBox = new ProfileChooser(this);
d->profileComboBox->init(false); d->profileComboBox->init(false);
d->profileLabel = new QLabel(tr("&Target:"), this); d->profileLabel = new QLabel(tr("&Target:"), this);
d->profileLabel->setBuddy(d->profileComboBox); d->profileLabel->setBuddy(d->profileComboBox);
@@ -337,7 +337,7 @@ public:
QLineEdit *pidLineEdit; QLineEdit *pidLineEdit;
Utils::FilterLineEdit *filterWidget; Utils::FilterLineEdit *filterWidget;
QLabel *profileLabel; QLabel *profileLabel;
Debugger::ProfileChooser *profileComboBox; ProfileChooser *profileComboBox;
QTreeView *procView; QTreeView *procView;
QDialogButtonBox *buttonBox; QDialogButtonBox *buttonBox;
@@ -364,7 +364,7 @@ AttachExternalDialog::AttachExternalDialog(QWidget *parent)
d->filterWidget = new Utils::FilterLineEdit(this); d->filterWidget = new Utils::FilterLineEdit(this);
d->filterWidget->setFocus(Qt::TabFocusReason); d->filterWidget->setFocus(Qt::TabFocusReason);
d->profileComboBox = new Debugger::ProfileChooser(this); d->profileComboBox = new ProfileChooser(this);
d->profileComboBox->init(true); d->profileComboBox->init(true);
d->profileLabel = new QLabel(tr("&Target:"), this); d->profileLabel = new QLabel(tr("&Target:"), this);
d->profileLabel->setBuddy(d->profileComboBox); d->profileLabel->setBuddy(d->profileComboBox);
@@ -621,7 +621,7 @@ public:
QLabel *workingDirectoryLabel; QLabel *workingDirectoryLabel;
Utils::PathChooser *workingDirectory; Utils::PathChooser *workingDirectory;
QLabel *profileLabel; QLabel *profileLabel;
Debugger::ProfileChooser *profileChooser; ProfileChooser *profileChooser;
QLabel *breakAtMainLabel; QLabel *breakAtMainLabel;
QCheckBox *breakAtMainCheckBox; QCheckBox *breakAtMainCheckBox;
QLabel *historyLabel; QLabel *historyLabel;
@@ -664,7 +664,7 @@ StartExternalDialog::StartExternalDialog(QWidget *parent)
d->runInTerminalLabel = new QLabel(tr("Run in &terminal:"), this); d->runInTerminalLabel = new QLabel(tr("Run in &terminal:"), this);
d->runInTerminalLabel->setBuddy(d->runInTerminalCheckBox); d->runInTerminalLabel->setBuddy(d->runInTerminalCheckBox);
d->profileChooser = new Debugger::ProfileChooser(this); d->profileChooser = new ProfileChooser(this);
d->profileChooser->init(true); d->profileChooser->init(true);
d->profileLabel = new QLabel(tr("&Target:"), this); d->profileLabel = new QLabel(tr("&Target:"), this);
d->profileLabel->setBuddy(d->profileChooser); d->profileLabel->setBuddy(d->profileChooser);
@@ -963,7 +963,7 @@ class StartRemoteDialogPrivate
{ {
public: public:
QLabel *profileLabel; QLabel *profileLabel;
Debugger::ProfileChooser *profileChooser; ProfileChooser *profileChooser;
QLabel *executableLabel; QLabel *executableLabel;
Utils::PathChooser *executablePathChooser; Utils::PathChooser *executablePathChooser;
QLabel *channelLabel; QLabel *channelLabel;
@@ -990,7 +990,7 @@ StartRemoteDialog::StartRemoteDialog(QWidget *parent, bool enableStartScript)
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Start Debugger")); setWindowTitle(tr("Start Debugger"));
d->profileChooser = new Debugger::ProfileChooser(this); d->profileChooser = new ProfileChooser(this);
d->profileChooser->init(false); d->profileChooser->init(false);
d->profileLabel = new QLabel(tr("Target:"), this); d->profileLabel = new QLabel(tr("Target:"), this);
d->profileLabel->setBuddy(d->profileChooser); d->profileLabel->setBuddy(d->profileChooser);
@@ -1210,7 +1210,7 @@ public:
QLabel *portLabel; QLabel *portLabel;
QSpinBox *portSpinBox; QSpinBox *portSpinBox;
QLabel *profileLabel; QLabel *profileLabel;
Debugger::ProfileChooser *profileChooser; ProfileChooser *profileChooser;
}; };
AttachToQmlPortDialog::AttachToQmlPortDialog(QWidget *parent) AttachToQmlPortDialog::AttachToQmlPortDialog(QWidget *parent)
@@ -1220,7 +1220,7 @@ AttachToQmlPortDialog::AttachToQmlPortDialog(QWidget *parent)
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Start Debugger")); setWindowTitle(tr("Start Debugger"));
d->profileChooser = new Debugger::ProfileChooser(this); d->profileChooser = new ProfileChooser(this);
d->profileLabel = new QLabel(tr("Target:"), this); d->profileLabel = new QLabel(tr("Target:"), this);
d->profileLabel->setBuddy(d->profileChooser); d->profileLabel->setBuddy(d->profileChooser);

View File

@@ -35,10 +35,10 @@
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include "debuggercore.h" #include "debuggercore.h"
#include "debuggerstartparameters.h" #include "debuggerstartparameters.h"
#include "debuggertoolchaincombobox.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <projectexplorer/abi.h> #include <projectexplorer/abi.h>
#include <projectexplorer/profilechooser.h>
#include <projectexplorer/devicesupport/devicemanager.h> #include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/devicesupport/devicemanagermodel.h> #include <projectexplorer/devicesupport/devicemanagermodel.h>
#include <ssh/sshconnection.h> #include <ssh/sshconnection.h>
@@ -96,7 +96,7 @@ public:
QTextBrowser *textBrowser; QTextBrowser *textBrowser;
QPushButton *closeButton; QPushButton *closeButton;
//PathChooser *sysrootPathChooser; //PathChooser *sysrootPathChooser;
ProfileChooser *toolchainComboBox; ProfileChooser *profileChooser;
QSettings *settings; QSettings *settings;
QString remoteCommandLine; QString remoteCommandLine;
@@ -116,7 +116,7 @@ LoadRemoteCoreFileDialog::LoadRemoteCoreFileDialog(QWidget *parent)
d->deviceComboBox = new QComboBox(this); d->deviceComboBox = new QComboBox(this);
d->toolchainComboBox = new ProfileChooser(this); d->profileChooser = new ProfileChooser(this);
d->fileSystemModel = new SftpFileSystemModel(this); d->fileSystemModel = new SftpFileSystemModel(this);
//executablePathChooser = new PathChooser(q); //executablePathChooser = new PathChooser(q);
@@ -142,7 +142,7 @@ LoadRemoteCoreFileDialog::LoadRemoteCoreFileDialog(QWidget *parent)
QFormLayout *formLayout = new QFormLayout(); QFormLayout *formLayout = new QFormLayout();
formLayout->addRow(tr("Device:"), d->deviceComboBox); formLayout->addRow(tr("Device:"), d->deviceComboBox);
formLayout->addRow(tr("Profile:"), d->toolchainComboBox); formLayout->addRow(tr("Profile:"), d->profileChooser);
QHBoxLayout *horizontalLayout2 = new QHBoxLayout(); QHBoxLayout *horizontalLayout2 = new QHBoxLayout();
horizontalLayout2->addStretch(1); horizontalLayout2->addStretch(1);
@@ -168,7 +168,7 @@ LoadRemoteCoreFileDialog::LoadRemoteCoreFileDialog(QWidget *parent)
connect(d->fileSystemView->selectionModel(), connect(d->fileSystemView->selectionModel(),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
SLOT(updateButtons())); SLOT(updateButtons()));
connect(d->toolchainComboBox, SIGNAL(activated(int)), SLOT(updateButtons())); connect(d->profileChooser, SIGNAL(activated(int)), SLOT(updateButtons()));
connect(d->loadCoreFileButton, SIGNAL(clicked()), SLOT(selectCoreFile())); connect(d->loadCoreFileButton, SIGNAL(clicked()), SLOT(selectCoreFile()));
connect(d->deviceComboBox, SIGNAL(currentIndexChanged(int)), connect(d->deviceComboBox, SIGNAL(currentIndexChanged(int)),
SLOT(attachToDevice(int))); SLOT(attachToDevice(int)));
@@ -194,7 +194,7 @@ QString LoadRemoteCoreFileDialog::localCoreFileName() const
Id LoadRemoteCoreFileDialog::profileId() const Id LoadRemoteCoreFileDialog::profileId() const
{ {
return d->toolchainComboBox->currentProfileId(); return d->profileChooser->currentProfileId();
} }
void LoadRemoteCoreFileDialog::attachToDevice(int modelIndex) void LoadRemoteCoreFileDialog::attachToDevice(int modelIndex)
@@ -250,7 +250,7 @@ void LoadRemoteCoreFileDialog::selectCoreFile()
d->fileSystemView->setEnabled(false); d->fileSystemView->setEnabled(false);
d->settings->setValue(QLatin1String("LastProfile"), d->settings->setValue(QLatin1String("LastProfile"),
d->toolchainComboBox->currentProfileId().toString()); d->profileChooser->currentProfileId().toString());
d->settings->setValue(QLatin1String("LastDevice"), d->deviceComboBox->currentIndex()); d->settings->setValue(QLatin1String("LastDevice"), d->deviceComboBox->currentIndex());
d->settings->setValue(QLatin1String("LastSftpRoot"), d->fileSystemModel->rootDirectory()); d->settings->setValue(QLatin1String("LastSftpRoot"), d->fileSystemModel->rootDirectory());

View File

@@ -30,13 +30,12 @@
** **
**************************************************************************/ **************************************************************************/
#include "debuggertoolchaincombobox.h" #include "profilechooser.h"
#include "debuggerprofileinformation.h" #include "profileinformation.h"
#include "profilemanager.h"
#include "abi.h"
#include <projectexplorer/profileinformation.h>
#include <projectexplorer/profilemanager.h>
#include <projectexplorer/abi.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QFileInfo> #include <QFileInfo>
@@ -44,9 +43,7 @@
#include <QPair> #include <QPair>
#include <QtEvents> #include <QtEvents>
using namespace ProjectExplorer; namespace ProjectExplorer {
namespace Debugger {
ProfileChooser::ProfileChooser(QWidget *parent) : ProfileChooser::ProfileChooser(QWidget *parent) :
QComboBox(parent) QComboBox(parent)
@@ -56,29 +53,26 @@ ProfileChooser::ProfileChooser(QWidget *parent) :
void ProfileChooser::init(bool hostAbiOnly) void ProfileChooser::init(bool hostAbiOnly)
{ {
const Abi hostAbi = Abi::hostAbi(); const Abi hostAbi = Abi::hostAbi();
foreach (const Profile *st, ProfileManager::instance()->profiles()) { foreach (const Profile *profile, ProfileManager::instance()->profiles()) {
if (!st->isValid()) if (!profile->isValid())
continue; continue;
ToolChain *tc = ToolChainProfileInformation::toolChain(st); ToolChain *tc = ToolChainProfileInformation::toolChain(profile);
if (!tc) if (!tc)
continue; continue;
const Abi abi = tc->targetAbi(); const Abi abi = tc->targetAbi();
if (hostAbiOnly && hostAbi.os() != abi.os()) if (hostAbiOnly && hostAbi.os() != abi.os())
continue; continue;
const QString debuggerCommand = DebuggerProfileInformation::debuggerCommand(st).toString(); const QString debuggerCommand = profile->value(Core::Id("Debugger.Information")).toString();
if (debuggerCommand.isEmpty())
continue;
const QString completeBase = QFileInfo(debuggerCommand).completeBaseName(); const QString completeBase = QFileInfo(debuggerCommand).completeBaseName();
const QString name = tr("%1 (%2)").arg(st->displayName(), completeBase); const QString name = tr("%1 (%2)").arg(profile->displayName(), completeBase);
addItem(name, qVariantFromValue(st->id())); addItem(name, qVariantFromValue(profile->id()));
QString debugger = QDir::toNativeSeparators(debuggerCommand); QString debugger = QDir::toNativeSeparators(debuggerCommand);
debugger.replace(QString(QLatin1Char(' ')), QLatin1String("&nbsp;")); debugger.replace(QString(QLatin1Char(' ')), QLatin1String("&nbsp;"));
QString toolTip = tr("<html><head/><body><table>" QString toolTip = tr("<html><head/><body><table>"
"<tr><td>ABI:</td><td><i>%1</i></td></tr>" "<tr><td>ABI:</td><td><i>%1</i></td></tr>"
"<tr><td>Debugger:</td><td>%2</td></tr>") "<tr><td>Debugger:</td><td>%2</td></tr>")
.arg(st->displayName(), QDir::toNativeSeparators(debugger)); .arg(profile->displayName(), QDir::toNativeSeparators(debugger));
setItemData(count() - 1, toolTip, Qt::ToolTipRole); setItemData(count() - 1, toolTip, Qt::ToolTipRole);
} }
setEnabled(count() > 1); setEnabled(count() > 1);
@@ -110,4 +104,4 @@ Profile *ProfileChooser::profileAt(int index) const
return ProfileManager::instance()->find(id); return ProfileManager::instance()->find(id);
} }
} // namespace Debugger } // namespace ProjectExplorer

View File

@@ -30,20 +30,21 @@
** **
**************************************************************************/ **************************************************************************/
#ifndef DEBUGGERTOOLCHAINCOMBOBOX_H #ifndef PROJECTEXPLORER_PROFILECHOOSER_H
#define DEBUGGERTOOLCHAINCOMBOBOX_H #define PROJECTEXPLORER_PROFILECHOOSER_H
#include "debugger_global.h" #include "projectexplorer_export.h"
#include <QComboBox> #include <QComboBox>
namespace Core { class Id; } namespace Core { class Id; }
namespace ProjectExplorer { class Profile; }
namespace Debugger { namespace ProjectExplorer {
class Profile;
// Let the user pick a profile. // Let the user pick a profile.
class DEBUGGER_EXPORT ProfileChooser : public QComboBox class PROJECTEXPLORER_EXPORT ProfileChooser : public QComboBox
{ {
Q_OBJECT Q_OBJECT
@@ -55,12 +56,12 @@ public:
void setCurrentProfileId(Core::Id id); void setCurrentProfileId(Core::Id id);
Core::Id currentProfileId() const; Core::Id currentProfileId() const;
ProjectExplorer::Profile *currentProfile() const; Profile *currentProfile() const;
private: private:
ProjectExplorer::Profile *profileAt(int index) const; Profile *profileAt(int index) const;
}; };
} // namespace Debugger } // namespace ProjectExplorer
#endif // DEBUGGERTOOLCHAINCOMBOBOX_H #endif // PROJECTEXPLORER_PROFILECHOOSER_H

View File

@@ -21,6 +21,7 @@ HEADERS += projectexplorer.h \
projectexplorer_export.h \ projectexplorer_export.h \
projectwindow.h \ projectwindow.h \
profile.h \ profile.h \
profilechooser.h \
profileconfigwidget.h \ profileconfigwidget.h \
profileinformation.h \ profileinformation.h \
profileinformationconfigwidget.h \ profileinformationconfigwidget.h \
@@ -131,6 +132,7 @@ SOURCES += projectexplorer.cpp \
gcctoolchain.cpp \ gcctoolchain.cpp \
projectwindow.cpp \ projectwindow.cpp \
profile.cpp \ profile.cpp \
profilechooser.cpp \
profileinformation.cpp \ profileinformation.cpp \
profileinformationconfigwidget.cpp \ profileinformationconfigwidget.cpp \
profilemanager.cpp \ profilemanager.cpp \

View File

@@ -110,6 +110,8 @@ QtcPlugin {
"processstep.h", "processstep.h",
"profile.cpp", "profile.cpp",
"profile.h", "profile.h",
"profilechooser.cpp",
"profilechooser.h",
"profileconfigwidget.h", "profileconfigwidget.h",
"profileinformation.cpp", "profileinformation.cpp",
"profileinformation.h", "profileinformation.h",

View File

@@ -37,8 +37,8 @@
#include "remotelinuxusedportsgatherer.h" #include "remotelinuxusedportsgatherer.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <debugger/debuggertoolchaincombobox.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <projectexplorer/profilechooser.h>
#include <projectexplorer/devicesupport/devicemanager.h> #include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/devicesupport/devicemanagermodel.h> #include <projectexplorer/devicesupport/devicemanagermodel.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
@@ -105,7 +105,7 @@ public:
QPushButton *attachProcessButton; QPushButton *attachProcessButton;
QTextBrowser *textBrowser; QTextBrowser *textBrowser;
QPushButton *closeButton; QPushButton *closeButton;
Debugger::ProfileChooser *profileChooser; ProfileChooser *profileChooser;
RemoteLinuxUsedPortsGatherer gatherer; RemoteLinuxUsedPortsGatherer gatherer;
SshRemoteProcessRunner runner; SshRemoteProcessRunner runner;
@@ -121,7 +121,7 @@ StartGdbServerDialogPrivate::StartGdbServerDialogPrivate(StartGdbServerDialog *q
deviceComboBox = new QComboBox(q); deviceComboBox = new QComboBox(q);
profileChooser = new Debugger::ProfileChooser(q); profileChooser = new ProfileChooser(q);
// sysrootPathChooser = new PathChooser(q); // sysrootPathChooser = new PathChooser(q);
// sysrootPathChooser->setExpectedKind(PathChooser::Directory); // sysrootPathChooser->setExpectedKind(PathChooser::Directory);
// sysrootPathChooser->setPromptDialogTitle(StartGdbServerDialog::tr("Select Sysroot")); // sysrootPathChooser->setPromptDialogTitle(StartGdbServerDialog::tr("Select Sysroot"));