Commit 187ac69a authored by Orgad Shaneh's avatar Orgad Shaneh Committed by hjk

move ProfileChooser from Debugger to ProjectExplorer

Change-Id: I5a4dcd5b9101118de8c88b6d26af5a9dbb32ba54
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 5e3998dd
......@@ -68,7 +68,6 @@ HEADERS += \
watchdelegatewidgets.h \
debuggerruncontrolfactory.h \
debuggertooltipmanager.h \
debuggertoolchaincombobox.h \
debuggersourcepathmappingwidget.h \
memoryview.h \
qtmessagelogwindow.h \
......@@ -122,7 +121,6 @@ SOURCES += \
stackframe.cpp \
watchdelegatewidgets.cpp \
debuggertooltipmanager.cpp \
debuggertoolchaincombobox.cpp \
debuggersourcepathmappingwidget.cpp \
memoryview.cpp \
qtmessagelogwindow.cpp \
......
......@@ -69,8 +69,6 @@ QtcPlugin {
"debuggerstreamops.cpp",
"debuggerstreamops.h",
"debuggerstringutils.h",
"debuggertoolchaincombobox.cpp",
"debuggertoolchaincombobox.h",
"debuggertooltipmanager.cpp",
"debuggertooltipmanager.h",
"disassembleragent.cpp",
......
......@@ -36,12 +36,12 @@
#include "debuggerconstants.h"
#include "debuggerprofileinformation.h"
#include "debuggerstringutils.h"
#include "debuggertoolchaincombobox.h"
#include "cdb/cdbengine.h"
#include "shared/hostutils.h"
#include <coreplugin/icore.h>
#include <projectexplorer/abi.h>
#include <projectexplorer/profilechooser.h>
#include <projectexplorer/profileinformation.h>
#include <utils/filterlineedit.h>
#include <utils/historycompleter.h>
......@@ -196,7 +196,7 @@ public:
QLabel *coreLabel;
Utils::PathChooser *coreFileName;
QLabel *profileLabel;
Debugger::ProfileChooser *profileComboBox;
ProfileChooser *profileComboBox;
Utils::PathChooser *overrideStartScriptFileName;
QLabel *overrideStartScriptLabel;
QDialogButtonBox *buttonBox;
......@@ -226,7 +226,7 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent)
d->overrideStartScriptLabel = new QLabel(tr("Override &start script:"), this);
d->overrideStartScriptLabel->setBuddy(d->overrideStartScriptFileName);
d->profileComboBox = new Debugger::ProfileChooser(this);
d->profileComboBox = new ProfileChooser(this);
d->profileComboBox->init(false);
d->profileLabel = new QLabel(tr("&Target:"), this);
d->profileLabel->setBuddy(d->profileComboBox);
......@@ -337,7 +337,7 @@ public:
QLineEdit *pidLineEdit;
Utils::FilterLineEdit *filterWidget;
QLabel *profileLabel;
Debugger::ProfileChooser *profileComboBox;
ProfileChooser *profileComboBox;
QTreeView *procView;
QDialogButtonBox *buttonBox;
......@@ -364,7 +364,7 @@ AttachExternalDialog::AttachExternalDialog(QWidget *parent)
d->filterWidget = new Utils::FilterLineEdit(this);
d->filterWidget->setFocus(Qt::TabFocusReason);
d->profileComboBox = new Debugger::ProfileChooser(this);
d->profileComboBox = new ProfileChooser(this);
d->profileComboBox->init(true);
d->profileLabel = new QLabel(tr("&Target:"), this);
d->profileLabel->setBuddy(d->profileComboBox);
......@@ -621,7 +621,7 @@ public:
QLabel *workingDirectoryLabel;
Utils::PathChooser *workingDirectory;
QLabel *profileLabel;
Debugger::ProfileChooser *profileChooser;
ProfileChooser *profileChooser;
QLabel *breakAtMainLabel;
QCheckBox *breakAtMainCheckBox;
QLabel *historyLabel;
......@@ -664,7 +664,7 @@ StartExternalDialog::StartExternalDialog(QWidget *parent)
d->runInTerminalLabel = new QLabel(tr("Run in &terminal:"), this);
d->runInTerminalLabel->setBuddy(d->runInTerminalCheckBox);
d->profileChooser = new Debugger::ProfileChooser(this);
d->profileChooser = new ProfileChooser(this);
d->profileChooser->init(true);
d->profileLabel = new QLabel(tr("&Target:"), this);
d->profileLabel->setBuddy(d->profileChooser);
......@@ -963,7 +963,7 @@ class StartRemoteDialogPrivate
{
public:
QLabel *profileLabel;
Debugger::ProfileChooser *profileChooser;
ProfileChooser *profileChooser;
QLabel *executableLabel;
Utils::PathChooser *executablePathChooser;
QLabel *channelLabel;
......@@ -990,7 +990,7 @@ StartRemoteDialog::StartRemoteDialog(QWidget *parent, bool enableStartScript)
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Start Debugger"));
d->profileChooser = new Debugger::ProfileChooser(this);
d->profileChooser = new ProfileChooser(this);
d->profileChooser->init(false);
d->profileLabel = new QLabel(tr("Target:"), this);
d->profileLabel->setBuddy(d->profileChooser);
......@@ -1210,7 +1210,7 @@ public:
QLabel *portLabel;
QSpinBox *portSpinBox;
QLabel *profileLabel;
Debugger::ProfileChooser *profileChooser;
ProfileChooser *profileChooser;
};
AttachToQmlPortDialog::AttachToQmlPortDialog(QWidget *parent)
......@@ -1220,7 +1220,7 @@ AttachToQmlPortDialog::AttachToQmlPortDialog(QWidget *parent)
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Start Debugger"));
d->profileChooser = new Debugger::ProfileChooser(this);
d->profileChooser = new ProfileChooser(this);
d->profileLabel = new QLabel(tr("Target:"), this);
d->profileLabel->setBuddy(d->profileChooser);
......
......@@ -35,10 +35,10 @@
#include "debuggerconstants.h"
#include "debuggercore.h"
#include "debuggerstartparameters.h"
#include "debuggertoolchaincombobox.h"
#include <coreplugin/icore.h>
#include <projectexplorer/abi.h>
#include <projectexplorer/profilechooser.h>
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/devicesupport/devicemanagermodel.h>
#include <ssh/sshconnection.h>
......@@ -96,7 +96,7 @@ public:
QTextBrowser *textBrowser;
QPushButton *closeButton;
//PathChooser *sysrootPathChooser;
ProfileChooser *toolchainComboBox;
ProfileChooser *profileChooser;
QSettings *settings;
QString remoteCommandLine;
......@@ -116,7 +116,7 @@ LoadRemoteCoreFileDialog::LoadRemoteCoreFileDialog(QWidget *parent)
d->deviceComboBox = new QComboBox(this);
d->toolchainComboBox = new ProfileChooser(this);
d->profileChooser = new ProfileChooser(this);
d->fileSystemModel = new SftpFileSystemModel(this);
//executablePathChooser = new PathChooser(q);
......@@ -142,7 +142,7 @@ LoadRemoteCoreFileDialog::LoadRemoteCoreFileDialog(QWidget *parent)
QFormLayout *formLayout = new QFormLayout();
formLayout->addRow(tr("Device:"), d->deviceComboBox);
formLayout->addRow(tr("Profile:"), d->toolchainComboBox);
formLayout->addRow(tr("Profile:"), d->profileChooser);
QHBoxLayout *horizontalLayout2 = new QHBoxLayout();
horizontalLayout2->addStretch(1);
......@@ -168,7 +168,7 @@ LoadRemoteCoreFileDialog::LoadRemoteCoreFileDialog(QWidget *parent)
connect(d->fileSystemView->selectionModel(),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
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->deviceComboBox, SIGNAL(currentIndexChanged(int)),
SLOT(attachToDevice(int)));
......@@ -194,7 +194,7 @@ QString LoadRemoteCoreFileDialog::localCoreFileName() const
Id LoadRemoteCoreFileDialog::profileId() const
{
return d->toolchainComboBox->currentProfileId();
return d->profileChooser->currentProfileId();
}
void LoadRemoteCoreFileDialog::attachToDevice(int modelIndex)
......@@ -250,7 +250,7 @@ void LoadRemoteCoreFileDialog::selectCoreFile()
d->fileSystemView->setEnabled(false);
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("LastSftpRoot"), d->fileSystemModel->rootDirectory());
......
......@@ -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 <QFileInfo>
......@@ -44,9 +43,7 @@
#include <QPair>
#include <QtEvents>
using namespace ProjectExplorer;
namespace Debugger {
namespace ProjectExplorer {
ProfileChooser::ProfileChooser(QWidget *parent) :
QComboBox(parent)
......@@ -56,29 +53,26 @@ ProfileChooser::ProfileChooser(QWidget *parent) :
void ProfileChooser::init(bool hostAbiOnly)
{
const Abi hostAbi = Abi::hostAbi();
foreach (const Profile *st, ProfileManager::instance()->profiles()) {
if (!st->isValid())
foreach (const Profile *profile, ProfileManager::instance()->profiles()) {
if (!profile->isValid())
continue;
ToolChain *tc = ToolChainProfileInformation::toolChain(st);
ToolChain *tc = ToolChainProfileInformation::toolChain(profile);
if (!tc)
continue;
const Abi abi = tc->targetAbi();
if (hostAbiOnly && hostAbi.os() != abi.os())
continue;
const QString debuggerCommand = DebuggerProfileInformation::debuggerCommand(st).toString();
if (debuggerCommand.isEmpty())
continue;
const QString debuggerCommand = profile->value(Core::Id("Debugger.Information")).toString();
const QString completeBase = QFileInfo(debuggerCommand).completeBaseName();
const QString name = tr("%1 (%2)").arg(st->displayName(), completeBase);
addItem(name, qVariantFromValue(st->id()));
const QString name = tr("%1 (%2)").arg(profile->displayName(), completeBase);
addItem(name, qVariantFromValue(profile->id()));
QString debugger = QDir::toNativeSeparators(debuggerCommand);
debugger.replace(QString(QLatin1Char(' ')), QLatin1String("&nbsp;"));
QString toolTip = tr("<html><head/><body><table>"
"<tr><td>ABI:</td><td><i>%1</i></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);
}
setEnabled(count() > 1);
......@@ -110,4 +104,4 @@ Profile *ProfileChooser::profileAt(int index) const
return ProfileManager::instance()->find(id);
}
} // namespace Debugger
} // namespace ProjectExplorer
......@@ -30,20 +30,21 @@
**
**************************************************************************/
#ifndef DEBUGGERTOOLCHAINCOMBOBOX_H
#define DEBUGGERTOOLCHAINCOMBOBOX_H
#ifndef PROJECTEXPLORER_PROFILECHOOSER_H
#define PROJECTEXPLORER_PROFILECHOOSER_H
#include "debugger_global.h"
#include "projectexplorer_export.h"
#include <QComboBox>
namespace Core { class Id; }
namespace ProjectExplorer { class Profile; }
namespace Debugger {
namespace ProjectExplorer {
class Profile;
// Let the user pick a profile.
class DEBUGGER_EXPORT ProfileChooser : public QComboBox
class PROJECTEXPLORER_EXPORT ProfileChooser : public QComboBox
{
Q_OBJECT
......@@ -55,12 +56,12 @@ public:
void setCurrentProfileId(Core::Id id);
Core::Id currentProfileId() const;
ProjectExplorer::Profile *currentProfile() const;
Profile *currentProfile() const;
private:
ProjectExplorer::Profile *profileAt(int index) const;
Profile *profileAt(int index) const;
};
} // namespace Debugger
} // namespace ProjectExplorer
#endif // DEBUGGERTOOLCHAINCOMBOBOX_H
#endif // PROJECTEXPLORER_PROFILECHOOSER_H
......@@ -21,6 +21,7 @@ HEADERS += projectexplorer.h \
projectexplorer_export.h \
projectwindow.h \
profile.h \
profilechooser.h \
profileconfigwidget.h \
profileinformation.h \
profileinformationconfigwidget.h \
......@@ -131,6 +132,7 @@ SOURCES += projectexplorer.cpp \
gcctoolchain.cpp \
projectwindow.cpp \
profile.cpp \
profilechooser.cpp \
profileinformation.cpp \
profileinformationconfigwidget.cpp \
profilemanager.cpp \
......
......@@ -110,6 +110,8 @@ QtcPlugin {
"processstep.h",
"profile.cpp",
"profile.h",
"profilechooser.cpp",
"profilechooser.h",
"profileconfigwidget.h",
"profileinformation.cpp",
"profileinformation.h",
......
......@@ -37,8 +37,8 @@
#include "remotelinuxusedportsgatherer.h"
#include <coreplugin/icore.h>
#include <debugger/debuggertoolchaincombobox.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/profilechooser.h>
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/devicesupport/devicemanagermodel.h>
#include <utils/pathchooser.h>
......@@ -105,7 +105,7 @@ public:
QPushButton *attachProcessButton;
QTextBrowser *textBrowser;
QPushButton *closeButton;
Debugger::ProfileChooser *profileChooser;
ProfileChooser *profileChooser;
RemoteLinuxUsedPortsGatherer gatherer;
SshRemoteProcessRunner runner;
......@@ -121,7 +121,7 @@ StartGdbServerDialogPrivate::StartGdbServerDialogPrivate(StartGdbServerDialog *q
deviceComboBox = new QComboBox(q);
profileChooser = new Debugger::ProfileChooser(q);
profileChooser = new ProfileChooser(q);
// sysrootPathChooser = new PathChooser(q);
// sysrootPathChooser->setExpectedKind(PathChooser::Directory);
// sysrootPathChooser->setPromptDialogTitle(StartGdbServerDialog::tr("Select Sysroot"));
......
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