KitChooser: Introduce virtual methods for Debugger.

Introduce virtual methods such that it is possible to
write derived classes for specific KitInformation classes,
allowing for filtering and setting text and tooltip.

Remove debugging-specific code of KitChooser from
the ProjectExplorer.

Move populate() away from the constructor as not to call
virtuals from it.

Implement DebuggerKitChooser. It should no longer be
possible to to choose an invalid kit for debugging
from the debugger starter dialogs.

Add a protected constructor to DeviceProcessesDialog
allowing to pass a KitChooser.

Change-Id: I8c683a2da7d69bfbccdc08213cb47d69a0df8b3e
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Friedemann Kleint
2012-09-05 10:55:05 +02:00
parent af6bbc442e
commit c3f50e3192
9 changed files with 121 additions and 46 deletions

View File

@@ -39,7 +39,6 @@
#include <coreplugin/icore.h>
#include <projectexplorer/abi.h>
#include <projectexplorer/kitchooser.h>
#include <projectexplorer/kitinformation.h>
#include <utils/historycompleter.h>
#include <utils/pathchooser.h>
@@ -109,6 +108,36 @@ Q_DECLARE_METATYPE(Debugger::Internal::StartApplicationParameters)
namespace Debugger {
namespace Internal {
///////////////////////////////////////////////////////////////////////
//
// DebuggerKitChooser
//
///////////////////////////////////////////////////////////////////////
DebuggerKitChooser::DebuggerKitChooser(Mode mode, QWidget *parent)
: ProjectExplorer::KitChooser(parent)
, m_hostAbi(ProjectExplorer::Abi::hostAbi())
, m_mode(mode)
{
}
// Match valid debuggers and restrict local debugging to compatible toolchains.
bool DebuggerKitChooser::kitMatches(const ProjectExplorer::Kit *k) const
{
if (!DebuggerKitInformation::isValidDebugger(k))
return false;
if (m_mode == LocalDebugging) {
const ProjectExplorer::ToolChain *tc = ToolChainKitInformation::toolChain(k);
return tc && tc->targetAbi().os() == m_hostAbi.os();
}
return true;
}
QString DebuggerKitChooser::kitToolTip(Kit *k) const
{
return DebuggerKitInformation::userOutput(k);
}
///////////////////////////////////////////////////////////////////////
//
// StartApplicationParameters
@@ -225,7 +254,8 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
d->runInTerminalCheckBox = new QCheckBox(this);
d->kitChooser = new KitChooser(this, KitChooser::LocalDebugging);
d->kitChooser = new DebuggerKitChooser(DebuggerKitChooser::LocalDebugging, this);
d->kitChooser->populate();
d->breakAtMainCheckBox = new QCheckBox(this);
d->breakAtMainCheckBox->setText(QString());
@@ -439,7 +469,8 @@ AttachToQmlPortDialog::AttachToQmlPortDialog(QWidget *parent)
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Start Debugger"));
d->kitChooser = new KitChooser(this);
d->kitChooser = new DebuggerKitChooser(DebuggerKitChooser::RemoteDebugging, this);
d->kitChooser->populate();
d->portSpinBox = new QSpinBox(this);
d->portSpinBox->setMaximum(65535);