Debugger[Symbian]: Remove Symbian/trk options page.

This commit is contained in:
Friedemann Kleint
2010-04-09 08:43:26 +02:00
parent 4c802ee1eb
commit c6779be8b8
13 changed files with 34 additions and 774 deletions

View File

@@ -3,9 +3,6 @@ HEADERS += \
$$PWD/gdbengine.h \ $$PWD/gdbengine.h \
$$PWD/gdboptionspage.h \ $$PWD/gdboptionspage.h \
$$PWD/gdbchooserwidget.h \ $$PWD/gdbchooserwidget.h \
$$PWD/trkoptions.h \
$$PWD/trkoptionswidget.h \
$$PWD/trkoptionspage.h \
$$PWD/abstractgdbadapter.h \ $$PWD/abstractgdbadapter.h \
$$PWD/attachgdbadapter.h \ $$PWD/attachgdbadapter.h \
$$PWD/coregdbadapter.h \ $$PWD/coregdbadapter.h \
@@ -22,9 +19,6 @@ SOURCES += \
$$PWD/pythongdbengine.cpp \ $$PWD/pythongdbengine.cpp \
$$PWD/gdboptionspage.cpp \ $$PWD/gdboptionspage.cpp \
$$PWD/gdbchooserwidget.cpp \ $$PWD/gdbchooserwidget.cpp \
$$PWD/trkoptions.cpp \
$$PWD/trkoptionswidget.cpp \
$$PWD/trkoptionspage.cpp \
$$PWD/abstractgdbadapter.cpp \ $$PWD/abstractgdbadapter.cpp \
$$PWD/attachgdbadapter.cpp \ $$PWD/attachgdbadapter.cpp \
$$PWD/coregdbadapter.cpp \ $$PWD/coregdbadapter.cpp \
@@ -34,7 +28,6 @@ SOURCES += \
$$PWD/trkgdbadapter.cpp \ $$PWD/trkgdbadapter.cpp \
$$PWD/s60debuggerbluetoothstarter.cpp $$PWD/s60debuggerbluetoothstarter.cpp
FORMS += $$PWD/gdboptionspage.ui \ FORMS += $$PWD/gdboptionspage.ui
$$PWD/trkoptionswidget.ui
RESOURCES += $$PWD/gdb.qrc RESOURCES += $$PWD/gdb.qrc

View File

@@ -31,8 +31,6 @@
#include "gdbengine.h" #include "gdbengine.h"
#include "gdboptionspage.h" #include "gdboptionspage.h"
#include "trkoptions.h"
#include "trkoptionspage.h"
#include "debuggeruiswitcher.h" #include "debuggeruiswitcher.h"
#include "debuggermainwindow.h" #include "debuggermainwindow.h"
@@ -176,8 +174,6 @@ GdbEngine::GdbEngine(DebuggerManager *manager) :
IDebuggerEngine(manager), IDebuggerEngine(manager),
m_gdbBinaryToolChainMap(DebuggerSettings::instance()->gdbBinaryToolChainMap()) m_gdbBinaryToolChainMap(DebuggerSettings::instance()->gdbBinaryToolChainMap())
{ {
m_trkOptions = QSharedPointer<TrkOptions>(new TrkOptions);
m_trkOptions->fromSettings(Core::ICore::instance()->settings());
m_gdbAdapter = 0; m_gdbAdapter = 0;
m_progress = 0; m_progress = 0;
@@ -1714,23 +1710,20 @@ int GdbEngine::currentFrame() const
return manager()->stackHandler()->currentIndex(); return manager()->stackHandler()->currentIndex();
} }
static inline QString msgNoBinaryForToolChain(int tc)
{
const ProjectExplorer::ToolChain::ToolChainType toolChain = static_cast<ProjectExplorer::ToolChain::ToolChainType>(tc);
const QString toolChainName = ProjectExplorer::ToolChain::toolChainName(toolChain);
return GdbEngine::tr("There is no gdb binary available for '%1'").arg(toolChainName);
}
bool GdbEngine::checkConfiguration(int toolChain, QString *errorMessage, QString *settingsPage) const bool GdbEngine::checkConfiguration(int toolChain, QString *errorMessage, QString *settingsPage) const
{ {
switch (toolChain) { if (m_gdbBinaryToolChainMap->key(toolChain).isEmpty()) {
case ProjectExplorer::ToolChain::WINSCW: // S60 *errorMessage = msgNoBinaryForToolChain(toolChain);
case ProjectExplorer::ToolChain::GCCE: *settingsPage = GdbOptionsPage::settingsId();
case ProjectExplorer::ToolChain::RVCT_ARMV5:
case ProjectExplorer::ToolChain::RVCT_ARMV6:
case ProjectExplorer::ToolChain::RVCT_ARMV5_GNUPOC:
case ProjectExplorer::ToolChain::GCCE_GNUPOC:
if (!m_trkOptions->check(errorMessage)) {
if (settingsPage)
*settingsPage = TrkOptionsPage::settingsId();
return false; return false;
} }
default:
break;
}
return true; return true;
} }
@@ -1743,13 +1736,13 @@ AbstractGdbAdapter *GdbEngine::createAdapter(const DebuggerStartParametersPtr &s
case ProjectExplorer::ToolChain::RVCT_ARMV6: case ProjectExplorer::ToolChain::RVCT_ARMV6:
case ProjectExplorer::ToolChain::RVCT_ARMV5_GNUPOC: case ProjectExplorer::ToolChain::RVCT_ARMV5_GNUPOC:
case ProjectExplorer::ToolChain::GCCE_GNUPOC: case ProjectExplorer::ToolChain::GCCE_GNUPOC:
return new TrkGdbAdapter(this, m_trkOptions); return new TrkGdbAdapter(this);
default: default:
break; break;
} }
// @todo: remove testing hack // @todo: remove testing hack
if (sp->processArgs.size() == 3 && sp->processArgs.at(0) == _("@sym@")) if (sp->processArgs.size() == 3 && sp->processArgs.at(0) == _("@sym@"))
return new TrkGdbAdapter(this, m_trkOptions); return new TrkGdbAdapter(this);
switch (sp->startMode) { switch (sp->startMode) {
case AttachCore: case AttachCore:
return new CoreGdbAdapter(this); return new CoreGdbAdapter(this);
@@ -4044,10 +4037,8 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
if (m_gdb.isEmpty()) if (m_gdb.isEmpty())
m_gdb = gdb; m_gdb = gdb;
if (m_gdb.isEmpty()) { if (m_gdb.isEmpty()) {
const ProjectExplorer::ToolChain::ToolChainType toolChain = static_cast<ProjectExplorer::ToolChain::ToolChainType>(m_startParameters->toolChainType); handleAdapterStartFailed(msgNoBinaryForToolChain(m_startParameters->toolChainType),
const QString toolChainName = ProjectExplorer::ToolChain::toolChainName(toolChain); GdbOptionsPage::settingsId());
const QString msg = tr("There is no gdb binary available for '%1'").arg(toolChainName);
handleAdapterStartFailed(msg, GdbOptionsPage::settingsId());
return false; return false;
} }
debugMessage(_("STARTING GDB ") + m_gdb); debugMessage(_("STARTING GDB ") + m_gdb);
@@ -4348,7 +4339,6 @@ void GdbEngine::handleAdapterCrashed(const QString &msg)
void GdbEngine::addOptionPages(QList<Core::IOptionsPage *> *opts) const void GdbEngine::addOptionPages(QList<Core::IOptionsPage *> *opts) const
{ {
opts->push_back(new GdbOptionsPage(m_gdbBinaryToolChainMap)); opts->push_back(new GdbOptionsPage(m_gdbBinaryToolChainMap));
opts->push_back(new TrkOptionsPage(m_trkOptions));
} }
QMessageBox *GdbEngine::showMessageBox(int icon, const QString &title, QMessageBox *GdbEngine::showMessageBox(int icon, const QString &title,

View File

@@ -71,7 +71,6 @@ class CoreGdbAdapter;
class PlainGdbAdapter; class PlainGdbAdapter;
class RemoteGdbAdapter; class RemoteGdbAdapter;
class TrkGdbAdapter; class TrkGdbAdapter;
struct TrkOptions;
enum DebuggingHelperState enum DebuggingHelperState
{ {
@@ -125,7 +124,6 @@ private: ////////// General State //////////
Q_SLOT void setAutoDerefPointers(const QVariant &on); Q_SLOT void setAutoDerefPointers(const QVariant &on);
DebuggerStartParametersPtr m_startParameters; DebuggerStartParametersPtr m_startParameters;
QSharedPointer<TrkOptions> m_trkOptions;
bool m_registerNamesListed; bool m_registerNamesListed;
private: ////////// Gdb Process Management ////////// private: ////////// Gdb Process Management //////////

View File

@@ -30,7 +30,6 @@
#include "s60debuggerbluetoothstarter.h" #include "s60debuggerbluetoothstarter.h"
#include "bluetoothlistener.h" #include "bluetoothlistener.h"
#include "debuggermanager.h" #include "debuggermanager.h"
#include "trkoptions.h"
#include "trkdevice.h" #include "trkdevice.h"
namespace Debugger { namespace Debugger {

View File

@@ -30,8 +30,6 @@
#include "trkgdbadapter.h" #include "trkgdbadapter.h"
#include "launcher.h" #include "launcher.h"
#include "trkoptions.h"
#include "trkoptionspage.h"
#include "symbiandevicemanager.h" #include "symbiandevicemanager.h"
#include "s60debuggerbluetoothstarter.h" #include "s60debuggerbluetoothstarter.h"
#include "bluetoothlistener_gui.h" #include "bluetoothlistener_gui.h"
@@ -238,11 +236,9 @@ void Snapshot::insertMemory(const MemoryRange &range, const QByteArray &ba)
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
TrkGdbAdapter::TrkGdbAdapter(GdbEngine *engine, const TrkOptionsPtr &options) : TrkGdbAdapter::TrkGdbAdapter(GdbEngine *engine) :
AbstractGdbAdapter(engine), AbstractGdbAdapter(engine),
m_options(options),
m_running(false), m_running(false),
m_deviceFromSymbianDeviceManager(false),
m_gdbAckMode(true), m_gdbAckMode(true),
m_verbose(0) m_verbose(0)
{ {
@@ -1682,7 +1678,7 @@ void TrkGdbAdapter::slotStartGdb()
{ {
QStringList gdbArgs; QStringList gdbArgs;
gdbArgs.append(QLatin1String("--nx")); // Do not read .gdbinit file gdbArgs.append(QLatin1String("--nx")); // Do not read .gdbinit file
if (!m_engine->startGdb(gdbArgs, m_options->gdb, TrkOptionsPage::settingsId())) { if (!m_engine->startGdb(gdbArgs, QString(), QString())) {
cleanup(); cleanup();
return; return;
} }
@@ -1714,8 +1710,7 @@ void TrkGdbAdapter::interruptInferior()
void TrkGdbAdapter::trkDeviceRemoved(const SymbianUtils::SymbianDevice &dev) void TrkGdbAdapter::trkDeviceRemoved(const SymbianUtils::SymbianDevice &dev)
{ {
if (state() != DebuggerNotReady && m_deviceFromSymbianDeviceManager if (state() != DebuggerNotReady && !m_trkDevice.isNull() && m_trkDevice->port() == dev.portName()) {
&& !m_trkDevice.isNull() && m_trkDevice->port() == dev.portName()) {
const QString message = QString::fromLatin1("Device '%1' has been disconnected.").arg(dev.friendlyName()); const QString message = QString::fromLatin1("Device '%1' has been disconnected.").arg(dev.friendlyName());
logMessage(message); logMessage(message);
emit adapterCrashed(message); emit adapterCrashed(message);
@@ -1724,14 +1719,10 @@ void TrkGdbAdapter::trkDeviceRemoved(const SymbianUtils::SymbianDevice &dev)
bool TrkGdbAdapter::initializeDevice(const QString &remoteChannel, QString *errorMessage) bool TrkGdbAdapter::initializeDevice(const QString &remoteChannel, QString *errorMessage)
{ {
m_deviceFromSymbianDeviceManager = false;
if (remoteChannel.isEmpty()) { if (remoteChannel.isEmpty()) {
// Obtain device from settings page *errorMessage = tr("Port specification missing.");
m_trkDevice = TrkDevicePtr(new TrkDevice); return false;
m_trkDevice->setPort(m_options->mode == TrkOptions::BlueTooth ? }
m_options->blueToothDevice : m_options->serialPort);
m_trkDevice->setSerialFrame(m_options->mode != TrkOptions::BlueTooth);
} else {
// Run config: Acquire from device manager. // Run config: Acquire from device manager.
m_trkDevice = SymbianUtils::SymbianDeviceManager::instance()->acquireDevice(remoteChannel); m_trkDevice = SymbianUtils::SymbianDeviceManager::instance()->acquireDevice(remoteChannel);
if (m_trkDevice.isNull()) { if (m_trkDevice.isNull()) {
@@ -1740,8 +1731,6 @@ bool TrkGdbAdapter::initializeDevice(const QString &remoteChannel, QString *erro
} }
connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(deviceRemoved(const SymbianUtils::SymbianDevice)), connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(deviceRemoved(const SymbianUtils::SymbianDevice)),
this, SLOT(trkDeviceRemoved(SymbianUtils::SymbianDevice))); this, SLOT(trkDeviceRemoved(SymbianUtils::SymbianDevice)));
m_deviceFromSymbianDeviceManager = true;
}
connect(m_trkDevice.data(), SIGNAL(messageReceived(trk::TrkResult)), connect(m_trkDevice.data(), SIGNAL(messageReceived(trk::TrkResult)),
this, SLOT(handleTrkResult(trk::TrkResult))); this, SLOT(handleTrkResult(trk::TrkResult)));
connect(m_trkDevice.data(), SIGNAL(error(QString)), connect(m_trkDevice.data(), SIGNAL(error(QString)),
@@ -1796,7 +1785,7 @@ void TrkGdbAdapter::startAdapter()
emit adapterStartFailed(QString(), QString()); emit adapterStartFailed(QString(), QString());
} else { } else {
logMessage(message); logMessage(message);
emit adapterStartFailed(message, TrkOptionsPage::settingsId()); emit adapterStartFailed(message, QString());
} }
return; return;
} }
@@ -1809,7 +1798,7 @@ void TrkGdbAdapter::startAdapter()
QString msg = QString("Unable to start the gdb server at %1: %2.") QString msg = QString("Unable to start the gdb server at %1: %2.")
.arg(m_gdbServerName).arg(m_gdbServer->errorString()); .arg(m_gdbServerName).arg(m_gdbServer->errorString());
logMessage(msg); logMessage(msg);
emit adapterStartFailed(msg, TrkOptionsPage::settingsId()); emit adapterStartFailed(msg, QString());
return; return;
} }
@@ -2133,11 +2122,8 @@ void TrkGdbAdapter::cleanup()
{ {
if (!m_trkDevice.isNull()) { if (!m_trkDevice.isNull()) {
m_trkDevice->close(); m_trkDevice->close();
if (m_deviceFromSymbianDeviceManager) {
m_trkDevice->disconnect(this); m_trkDevice->disconnect(this);
SymbianUtils::SymbianDeviceManager::instance()->releaseDevice(m_trkDevice->port()); SymbianUtils::SymbianDeviceManager::instance()->releaseDevice(m_trkDevice->port());
m_deviceFromSymbianDeviceManager = false;
}
m_trkDevice = TrkDevicePtr(); m_trkDevice = TrkDevicePtr();
} }

View File

@@ -34,7 +34,6 @@
#include "trkutils.h" #include "trkutils.h"
#include "trkdevice.h" #include "trkdevice.h"
#include "trkoptions.h"
#include "launcher.h" #include "launcher.h"
#include <QtCore/QHash> #include <QtCore/QHash>
@@ -143,9 +142,8 @@ public:
typedef trk::TrkResult TrkResult; typedef trk::TrkResult TrkResult;
typedef trk::Callback<const TrkResult &> TrkCallback; typedef trk::Callback<const TrkResult &> TrkCallback;
typedef trk::Callback<const GdbResult &> GdbCallback; typedef trk::Callback<const GdbResult &> GdbCallback;
typedef QSharedPointer<TrkOptions> TrkOptionsPtr;
TrkGdbAdapter(GdbEngine *engine, const TrkOptionsPtr &options); TrkGdbAdapter(GdbEngine *engine);
~TrkGdbAdapter(); ~TrkGdbAdapter();
void setGdbServerName(const QString &name); void setGdbServerName(const QString &name);
QString gdbServerName() const { return m_gdbServerName; } QString gdbServerName() const { return m_gdbServerName; }
@@ -162,8 +160,6 @@ signals:
void output(const QString &msg); void output(const QString &msg);
private: private:
const TrkOptionsPtr m_options;
QString m_gdbServerName; // 127.0.0.1:(2222+uid) QString m_gdbServerName; // 127.0.0.1:(2222+uid)
bool m_running; bool m_running;
@@ -264,7 +260,6 @@ private:
Q_SLOT void trkDeviceRemoved(const SymbianUtils::SymbianDevice &); Q_SLOT void trkDeviceRemoved(const SymbianUtils::SymbianDevice &);
QSharedPointer<trk::TrkDevice> m_trkDevice; QSharedPointer<trk::TrkDevice> m_trkDevice;
bool m_deviceFromSymbianDeviceManager;
QString m_adapterFailMessage; QString m_adapterFailMessage;
// //

View File

@@ -1,127 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "trkoptions.h"
#include <utils/synchronousprocess.h>
#include <QtCore/QSettings>
#include <QtCore/QFileInfo>
#include <QtCore/QCoreApplication>
#ifdef Q_OS_WIN
# define SERIALPORT_ROOT "COM"
enum { firstSerialPort = 1, lastSerialPort = 12 };
enum { modeDefault = Debugger::Internal::TrkOptions::Serial };
static const char *serialPortDefaultC = SERIALPORT_ROOT"1";
static const char *gdbDefaultC = "gdb-arm-none-symbianelf.exe";
#else
# define SERIALPORT_ROOT "/dev/ttyS"
enum { firstSerialPort = 0, lastSerialPort = 3 };
enum { modeDefault = Debugger::Internal::TrkOptions::BlueTooth };
static const char *serialPortDefaultC = SERIALPORT_ROOT"0";
static const char *gdbDefaultC = "gdb-arm-none-symbianelf";
#endif
static const char *settingsGroupC = "S60Debugger";
static const char *serialPortKeyC = "Port";
static const char *modeKeyC = "Mode";
static const char *blueToothDeviceKeyC = "BlueToothDevice";
static const char *blueToothDeviceDefaultC = "/dev/rfcomm0";
static const char *gdbKeyC = "gdb";
namespace Debugger {
namespace Internal {
TrkOptions::TrkOptions() :
mode(modeDefault),
serialPort(QLatin1String(serialPortDefaultC)),
blueToothDevice(QLatin1String(blueToothDeviceDefaultC)),
gdb(QLatin1String(gdbDefaultC))
{
}
void TrkOptions::fromSettings(const QSettings *s)
{
const QString keyRoot = QLatin1String(settingsGroupC) + QLatin1Char('/');
mode = s->value(keyRoot + QLatin1String(modeKeyC), modeDefault).toInt();
serialPort = s->value(keyRoot + QLatin1String(serialPortKeyC), QLatin1String(serialPortDefaultC)).toString();
gdb = s->value(keyRoot + QLatin1String(gdbKeyC),QLatin1String(gdbDefaultC)).toString();
blueToothDevice = s->value(keyRoot + QLatin1String(blueToothDeviceKeyC), QLatin1String(blueToothDeviceDefaultC)).toString();
}
void TrkOptions::toSettings(QSettings *s) const
{
s->beginGroup(QLatin1String(settingsGroupC));
s->setValue(QLatin1String(modeKeyC), mode);
s->setValue(QLatin1String(serialPortKeyC), serialPort);
s->setValue(QLatin1String(blueToothDeviceKeyC), blueToothDevice);
s->setValue(QLatin1String(gdbKeyC), gdb);
s->endGroup();
}
bool TrkOptions::check(QString *errorMessage) const
{
if (gdb.isEmpty()) {
*errorMessage = QCoreApplication::translate("TrkOptions", "No Symbian gdb executable specified.");
return false;
}
const QString expanded = Utils::SynchronousProcess::locateBinary(gdb);
if (expanded.isEmpty()) {
*errorMessage = QCoreApplication::translate("TrkOptions", "The Symbian gdb executable '%1' could not be found in the search path.").arg(gdb);
return false;
}
return true;
}
bool TrkOptions::equals(const TrkOptions &o) const
{
return mode == o.mode
&& serialPort == o.serialPort
&& blueToothDevice == o.blueToothDevice
&& gdb == o.gdb;
}
QStringList TrkOptions::serialPorts()
{
QStringList rc;
const QString root = QLatin1String(SERIALPORT_ROOT);
for (int p = firstSerialPort; p != lastSerialPort; p++)
rc.push_back(root + QString::number(p));
return rc;
}
QStringList TrkOptions::blueToothDevices()
{
QStringList rc;
rc.push_back(QLatin1String(blueToothDeviceDefaultC));
return rc;
}
} // namespace Internal
} // namespace Debugger

View File

@@ -1,82 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef TRKOPTIONS_H
#define TRKOPTIONS_H
#include <QtCore/QStringList>
QT_BEGIN_NAMESPACE
class QSettings;
QT_END_NAMESPACE
namespace Debugger {
namespace Internal {
/* Parameter to be used for debugging S60 via TRK.
* GDB is a Symbian-ARM Gdb.
* Communication happens either via BlueTooth (Linux only) or
* serial ports. */
struct TrkOptions
{
// Matches the communication enumeration from the S60 devices listener.
enum Mode { Serial, BlueTooth };
TrkOptions();
void fromSettings(const QSettings *s);
void toSettings(QSettings *s) const;
bool equals(const TrkOptions &o) const;
bool check(QString *errorMessage) const;
// Lists of choices for the devices
static QStringList serialPorts();
static QStringList blueToothDevices();
int mode;
QString serialPort;
QString blueToothDevice;
QString gdb;
};
inline bool operator==(const TrkOptions &o1, const TrkOptions &o2)
{
return o1.equals(o2);
}
inline bool operator!=(const TrkOptions &o1, const TrkOptions &o2)
{
return !o1.equals(o2);
}
} // namespace Internal
} // namespace Debugger
#endif // TRKOPTIONS_H

View File

@@ -1,108 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "trkoptionspage.h"
#include "trkoptionswidget.h"
#include "trkoptions.h"
#include "debuggerconstants.h"
#include <coreplugin/icore.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QSettings>
namespace Debugger {
namespace Internal {
TrkOptionsPage::TrkOptionsPage(const TrkOptionsPtr &options) :
m_options(options)
{
}
TrkOptionsPage::~TrkOptionsPage()
{
}
QString TrkOptionsPage::settingsId()
{
return QLatin1String("S.Trk");
}
QString TrkOptionsPage::displayName() const
{
return tr("Symbian");
}
QString TrkOptionsPage::category() const
{
return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
}
QString TrkOptionsPage::displayCategory() const
{
return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY);
}
QIcon TrkOptionsPage::categoryIcon() const
{
return QIcon(QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON));
}
QWidget *TrkOptionsPage::createPage(QWidget *parent)
{
if (!m_widget)
m_widget = new TrkOptionsWidget(parent);
m_widget->setTrkOptions(*m_options);
if (m_searchKeywords.isEmpty())
m_searchKeywords = m_widget->searchKeywords();
return m_widget;
}
void TrkOptionsPage::apply()
{
if (!m_widget)
return;
const TrkOptions newOptions = m_widget->trkOptions();
if (newOptions == *m_options)
return;
*m_options = newOptions;
m_options->toSettings(Core::ICore::instance()->settings());
}
void TrkOptionsPage::finish()
{
}
bool TrkOptionsPage::matches(const QString &s) const
{
return m_searchKeywords.contains(s, Qt::CaseInsensitive);
}
} // namespace Internal
} // namespace Designer

View File

@@ -1,75 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef TRKOPTIONSPAGE_H
#define TRKOPTIONSPAGE_H
#include <QtGui/QWidget>
#include <QtCore/QSharedPointer>
#include <QtCore/QPointer>
#include <coreplugin/dialogs/ioptionspage.h>
namespace Debugger {
namespace Internal {
class TrkOptionsWidget;
struct TrkOptions;
class TrkOptionsPage : public Core::IOptionsPage
{
Q_OBJECT
Q_DISABLE_COPY(TrkOptionsPage)
public:
typedef QSharedPointer<TrkOptions> TrkOptionsPtr;
TrkOptionsPage(const TrkOptionsPtr &options);
virtual ~TrkOptionsPage();
virtual QString id() const { return settingsId(); }
virtual QString displayName() const;
virtual QString category() const;
virtual QString displayCategory() const;
virtual QIcon categoryIcon() const;
virtual QWidget *createPage(QWidget *parent);
virtual void apply();
virtual void finish();
virtual bool matches(const QString &) const;
static QString settingsId();
private:
const TrkOptionsPtr m_options;
QPointer<TrkOptionsWidget> m_widget;
QString m_searchKeywords;
};
} // namespace Internal
} // namespace Designer
#endif // TRKOPTIONSPAGE_H

View File

@@ -1,103 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "trkoptionswidget.h"
#include "trkoptions.h"
#include "debuggerconstants.h"
#include "ui_trkoptionswidget.h"
#include <QtCore/QTextStream>
namespace Debugger {
namespace Internal {
TrkOptionsWidget::TrkOptionsWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::TrkOptionsWidget)
{
ui->setupUi(this);
ui->gdbChooser->setExpectedKind(Utils::PathChooser::Command);
ui->blueToothComboBox->addItems(TrkOptions::blueToothDevices());
ui->serialComboBox->addItems(TrkOptions::serialPorts());
connect(ui->commComboBox, SIGNAL(currentIndexChanged(int)), ui->commStackedWidget, SLOT(setCurrentIndex(int)));
// No bluetooth on Windows yet...
#ifdef Q_OS_WIN
ui->commGroupBox->setVisible(false);
#endif
}
TrkOptionsWidget::~TrkOptionsWidget()
{
delete ui;
}
void TrkOptionsWidget::changeEvent(QEvent *e)
{
QWidget::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void TrkOptionsWidget::setTrkOptions(const TrkOptions &o)
{
ui->commComboBox->setCurrentIndex(o.mode);
ui->commStackedWidget->setCurrentIndex(o.mode);
const int serialPortIndex = qMax(0, ui->serialComboBox->findText(o.serialPort));
ui->serialComboBox->setCurrentIndex(serialPortIndex);
ui->gdbChooser->setPath(o.gdb);
const int blueToothIndex = qMax(0, ui->blueToothComboBox->findText(o.blueToothDevice));
ui->blueToothComboBox->setCurrentIndex(blueToothIndex);
}
TrkOptions TrkOptionsWidget::trkOptions() const
{
TrkOptions rc;
rc.mode = ui->commComboBox->currentIndex();
rc.gdb = ui->gdbChooser->path();
rc.blueToothDevice = ui->blueToothComboBox->currentText();
rc.serialPort = ui->serialComboBox->currentText();
return rc;
}
QString TrkOptionsWidget::searchKeywords() const
{
QString rc;
QTextStream(&rc) << ui->gdbLabel->text() << ' ' << ui->serialLabel->text()
<< ' ' << ui->blueToothLabel->text();
rc.remove(QLatin1Char('&'));
return rc;
}
} // namespace Internal
} // namespace Designer

View File

@@ -1,64 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef TRKOPTIONSWIDGET_H
#define TRKOPTIONSWIDGET_H
#include <QtGui/QWidget>
namespace Debugger {
namespace Internal {
struct TrkOptions;
namespace Ui {
class TrkOptionsWidget;
}
class TrkOptionsWidget : public QWidget {
Q_OBJECT
public:
TrkOptionsWidget(QWidget *parent = 0);
~TrkOptionsWidget();
void setTrkOptions(const TrkOptions &);
TrkOptions trkOptions() const;
QString searchKeywords() const;
protected:
void changeEvent(QEvent *e);
private:
Ui::TrkOptionsWidget *ui;
};
} // namespace Internal
} // namespace Designer
#endif // TRKOPTIONSWIDGET_H

View File

@@ -1,142 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Debugger::Internal::TrkOptionsWidget</class>
<widget class="QWidget" name="Debugger::Internal::TrkOptionsWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="gdbGroupBox">
<property name="title">
<string>Gdb</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="gdbLabel">
<property name="text">
<string>Symbian ARM gdb location:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="gdbChooser" native="true"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="commGroupBox">
<property name="title">
<string>Device Communication</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QComboBox" name="commComboBox">
<item>
<property name="text">
<string>Serial Port</string>
</property>
</item>
<item>
<property name="text">
<string>Bluetooth</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="commStackedWidget">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="serialPage">
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="serialLabel">
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="serialComboBox"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="blueToothPage">
<layout class="QFormLayout" name="formLayout_3">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="1">
<widget class="QComboBox" name="blueToothComboBox"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="blueToothLabel">
<property name="text">
<string>Device:</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="commHorizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>182</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>