debugger: more Profile adjustments

Change-Id: Icb7f62da5a23e3208e1b75524118f1b75bd7a4c8
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2012-06-26 16:16:59 +02:00
parent 4816cb3299
commit 579e95af8f
3 changed files with 34 additions and 33 deletions

View File

@@ -234,7 +234,7 @@ void AttachCoreDialog::setCoreFile(const QString &fileName)
Profile *AttachCoreDialog::profile() const Profile *AttachCoreDialog::profile() const
{ {
return m_ui->toolchainComboBox->profile(); return m_ui->toolchainComboBox->currentProfile();
} }
void AttachCoreDialog::setProfileIndex(int i) void AttachCoreDialog::setProfileIndex(int i)
@@ -381,7 +381,7 @@ QString AttachExternalDialog::executable() const
Profile *AttachExternalDialog::profile() const Profile *AttachExternalDialog::profile() const
{ {
return m_ui->toolchainComboBox->profile(); return m_ui->toolchainComboBox->currentProfile();
} }
void AttachExternalDialog::setProfileIndex(int i) void AttachExternalDialog::setProfileIndex(int i)
@@ -589,7 +589,7 @@ QString StartExternalDialog::executableFile() const
Profile *StartExternalDialog::profile() const Profile *StartExternalDialog::profile() const
{ {
return m_ui->toolChainComboBox->profile(); return m_ui->toolChainComboBox->currentProfile();
} }
bool StartExternalDialog::isValid() const bool StartExternalDialog::isValid() const
@@ -719,8 +719,7 @@ public:
QString overrideStartScript; QString overrideStartScript;
bool useServerStartScript; bool useServerStartScript;
QString serverStartScript; QString serverStartScript;
QString sysroot; Core::Id profileId;
int abiIndex;
QString debugInfoLocation; QString debugInfoLocation;
}; };
@@ -739,7 +738,7 @@ inline bool operator!=(const StartRemoteParameters &p1, const StartRemoteParamet
{ return !p1.equals(p2); } { return !p1.equals(p2); }
StartRemoteParameters::StartRemoteParameters() : StartRemoteParameters::StartRemoteParameters() :
useServerStartScript(false), abiIndex(0) useServerStartScript(false), profileId(0)
{ {
} }
@@ -750,7 +749,7 @@ bool StartRemoteParameters::equals(const StartRemoteParameters &rhs) const
&& overrideStartScript == rhs.overrideStartScript && overrideStartScript == rhs.overrideStartScript
&& useServerStartScript == rhs.useServerStartScript && useServerStartScript == rhs.useServerStartScript
&& serverStartScript == rhs.serverStartScript && serverStartScript == rhs.serverStartScript
&& sysroot == rhs.sysroot && abiIndex == rhs.abiIndex && profileId == rhs.profileId
&& debugInfoLocation == rhs.debugInfoLocation; && debugInfoLocation == rhs.debugInfoLocation;
} }
@@ -758,12 +757,11 @@ void StartRemoteParameters::toSettings(QSettings *settings) const
{ {
settings->setValue(_("LastRemoteChannel"), remoteChannel); settings->setValue(_("LastRemoteChannel"), remoteChannel);
settings->setValue(_("LastLocalExecutable"), localExecutable); settings->setValue(_("LastLocalExecutable"), localExecutable);
settings->setValue(_("LastExternalAbiIndex"), abiIndex);
settings->setValue(_("LastRemoteArchitecture"), remoteArchitecture); settings->setValue(_("LastRemoteArchitecture"), remoteArchitecture);
settings->setValue(_("LastServerStartScript"), serverStartScript); settings->setValue(_("LastServerStartScript"), serverStartScript);
settings->setValue(_("LastUseServerStartScript"), useServerStartScript); settings->setValue(_("LastUseServerStartScript"), useServerStartScript);
settings->setValue(_("LastRemoteStartScript"), overrideStartScript); settings->setValue(_("LastRemoteStartScript"), overrideStartScript);
settings->setValue(_("LastSysroot"), sysroot); settings->setValue(_("LastProfileId"), profileId.toString());
settings->setValue(_("LastDebugInfoLocation"), debugInfoLocation); settings->setValue(_("LastDebugInfoLocation"), debugInfoLocation);
} }
@@ -771,12 +769,11 @@ void StartRemoteParameters::fromSettings(const QSettings *settings)
{ {
remoteChannel = settings->value(_("LastRemoteChannel")).toString(); remoteChannel = settings->value(_("LastRemoteChannel")).toString();
localExecutable = settings->value(_("LastLocalExecutable")).toString(); localExecutable = settings->value(_("LastLocalExecutable")).toString();
abiIndex = settings->value(_("LastExternalAbiIndex")).toInt(); profileId = Core::Id(settings->value(_("LastProfileId")).toString());
remoteArchitecture = settings->value(_("LastRemoteArchitecture")).toString(); remoteArchitecture = settings->value(_("LastRemoteArchitecture")).toString();
serverStartScript = settings->value(_("LastServerStartScript")).toString(); serverStartScript = settings->value(_("LastServerStartScript")).toString();
useServerStartScript = settings->value(_("LastUseServerStartScript")).toBool(); useServerStartScript = settings->value(_("LastUseServerStartScript")).toBool();
overrideStartScript = settings->value(_("LastRemoteStartScript")).toString(); overrideStartScript = settings->value(_("LastRemoteStartScript")).toString();
sysroot = settings->value(_("LastSysroot")).toString();
debugInfoLocation = settings->value(_("LastDebugInfoLocation")).toString(); debugInfoLocation = settings->value(_("LastDebugInfoLocation")).toString();
} }
@@ -864,7 +861,6 @@ bool StartRemoteDialog::run(QWidget *parent,
sp->overrideStartScript = newParameters.overrideStartScript; sp->overrideStartScript = newParameters.overrideStartScript;
sp->useServerStartScript = newParameters.useServerStartScript; sp->useServerStartScript = newParameters.useServerStartScript;
sp->serverStartScript = newParameters.serverStartScript; sp->serverStartScript = newParameters.serverStartScript;
sp->sysroot = newParameters.sysroot;
sp->debugInfoLocation = newParameters.debugInfoLocation; sp->debugInfoLocation = newParameters.debugInfoLocation;
return true; return true;
} }
@@ -878,8 +874,7 @@ StartRemoteParameters StartRemoteDialog::parameters() const
result.overrideStartScript = m_ui->overrideStartScriptPathChooser->path(); result.overrideStartScript = m_ui->overrideStartScriptPathChooser->path();
result.useServerStartScript = m_ui->useServerStartScriptCheckBox->isChecked(); result.useServerStartScript = m_ui->useServerStartScriptCheckBox->isChecked();
result.serverStartScript = m_ui->serverStartScriptPathChooser->path(); result.serverStartScript = m_ui->serverStartScriptPathChooser->path();
result.sysroot = m_ui->sysrootPathChooser->path(); result.profileId = m_ui->toolchainComboBox->currentProfileId();
result.abiIndex = m_ui->toolchainComboBox->currentIndex();
result.debugInfoLocation = m_ui->debuginfoPathChooser->path(); result.debugInfoLocation = m_ui->debuginfoPathChooser->path();
return result; return result;
} }
@@ -894,9 +889,7 @@ void StartRemoteDialog::setParameters(const StartRemoteParameters &p)
m_ui->overrideStartScriptPathChooser->setPath(p.overrideStartScript); m_ui->overrideStartScriptPathChooser->setPath(p.overrideStartScript);
m_ui->useServerStartScriptCheckBox->setChecked(p.useServerStartScript); m_ui->useServerStartScriptCheckBox->setChecked(p.useServerStartScript);
m_ui->serverStartScriptPathChooser->setPath(p.serverStartScript); m_ui->serverStartScriptPathChooser->setPath(p.serverStartScript);
m_ui->sysrootPathChooser->setPath(p.sysroot); m_ui->toolchainComboBox->setCurrentProfileId(p.profileId);
if (p.abiIndex >= 0 && p.abiIndex < m_ui->toolchainComboBox->count())
m_ui->toolchainComboBox->setCurrentIndex(p.abiIndex);
m_ui->debuginfoPathChooser->setPath(p.debugInfoLocation); m_ui->debuginfoPathChooser->setPath(p.debugInfoLocation);
} }
@@ -920,7 +913,7 @@ void StartRemoteDialog::historyIndexChanged(int index)
Profile *StartRemoteDialog::profile() const Profile *StartRemoteDialog::profile() const
{ {
return m_ui->toolchainComboBox->profile(); return m_ui->toolchainComboBox->currentProfile();
} }
void StartRemoteDialog::setRemoteArchitectures(const QStringList &list) void StartRemoteDialog::setRemoteArchitectures(const QStringList &list)

View File

@@ -85,11 +85,10 @@ void DebuggerToolChainComboBox::init(bool hostAbiOnly)
setEnabled(count() > 1); setEnabled(count() > 1);
} }
void DebuggerToolChainComboBox::setProfile(const Profile *profile) void DebuggerToolChainComboBox::setCurrentProfile(const Profile *profile)
{ {
QTC_ASSERT(profile->isValid(), return); QTC_ASSERT(profile->isValid(), return);
const int c = count(); for (int i = 0, n = count(); i != n; ++i) {
for (int i = 0; i < c; i++) {
if (profileAt(i) == profile) { if (profileAt(i) == profile) {
setCurrentIndex(i); setCurrentIndex(i);
break; break;
@@ -97,19 +96,25 @@ void DebuggerToolChainComboBox::setProfile(const Profile *profile)
} }
} }
Profile *DebuggerToolChainComboBox::profile() const Profile *DebuggerToolChainComboBox::currentProfile() const
{ {
return profileAt(currentIndex()); return profileAt(currentIndex());
} }
//QString DebuggerToolChainComboBox::debuggerCommand() const void DebuggerToolChainComboBox::setCurrentProfileId(Core::Id id)
//{ {
// int index = currentIndex(); for (int i = 0, n = count(); i != n; ++i) {
// Core::Id id = qvariant_cast<Core::Id>(itemData(index)); if (profileAt(i)->id() == id) {
// Profile *st = ProfileManager::instance()->find(id); setCurrentIndex(i);
// QTC_ASSERT(st, return QString()); break;
// return DebuggerProfileInformation::debuggerCommand(st).toString(); }
//} }
}
Core::Id DebuggerToolChainComboBox::currentProfileId() const
{
return profileAt(currentIndex())->id();
}
Profile *DebuggerToolChainComboBox::profileAt(int index) const Profile *DebuggerToolChainComboBox::profileAt(int index) const
{ {

View File

@@ -35,6 +35,7 @@
#include <QComboBox> #include <QComboBox>
namespace Core { class Id; }
namespace ProjectExplorer { class Profile; } namespace ProjectExplorer { class Profile; }
namespace Debugger { namespace Debugger {
@@ -50,9 +51,11 @@ public:
void init(bool hostAbiOnly); void init(bool hostAbiOnly);
void setProfile(const ProjectExplorer::Profile *profile); void setCurrentProfileId(Core::Id id);
ProjectExplorer::Profile *profile() const; Core::Id currentProfileId() const;
//QString debuggerCommand() const;
void setCurrentProfile(const ProjectExplorer::Profile *profile);
ProjectExplorer::Profile *currentProfile() const;
private: private:
ProjectExplorer::Profile *profileAt(int index) const; ProjectExplorer::Profile *profileAt(int index) const;