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

View File

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

View File

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