mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
GCS/core+gadgets: Second attempt at cleanup of uav gadget interface.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@400 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
3656caccbb
commit
35f4fc06a0
@ -58,7 +58,8 @@ SOURCES += mainwindow.cpp \
|
|||||||
iconnection.cpp \
|
iconnection.cpp \
|
||||||
iuavgadgetconfiguration.cpp \
|
iuavgadgetconfiguration.cpp \
|
||||||
uavgadgetinstancemanager.cpp \
|
uavgadgetinstancemanager.cpp \
|
||||||
uavgadgetoptionspagedecorator.cpp
|
uavgadgetoptionspagedecorator.cpp \
|
||||||
|
uavgadgetdecorator.cpp
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
tabpositionindicator.h \
|
tabpositionindicator.h \
|
||||||
fancyactionbar.h \
|
fancyactionbar.h \
|
||||||
@ -113,7 +114,8 @@ HEADERS += mainwindow.h \
|
|||||||
iconnection.h \
|
iconnection.h \
|
||||||
iuavgadgetconfiguration.h \
|
iuavgadgetconfiguration.h \
|
||||||
uavgadgetinstancemanager.h \
|
uavgadgetinstancemanager.h \
|
||||||
uavgadgetoptionspagedecorator.h
|
uavgadgetoptionspagedecorator.h \
|
||||||
|
uavgadgetdecorator.h
|
||||||
FORMS += dialogs/settingsdialog.ui \
|
FORMS += dialogs/settingsdialog.ui \
|
||||||
dialogs/shortcutsettings.ui \
|
dialogs/shortcutsettings.ui \
|
||||||
generalsettings.ui \
|
generalsettings.ui \
|
||||||
|
@ -26,95 +26,3 @@
|
|||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "iuavgadget.h"
|
|
||||||
#include "iuavgadgetconfiguration.h"
|
|
||||||
|
|
||||||
using namespace Core;
|
|
||||||
|
|
||||||
IUAVGadget::IUAVGadget(QString classId, QList<IUAVGadgetConfiguration*> *configurations, QObject *parent) :
|
|
||||||
IContext(parent),
|
|
||||||
m_toolbar(new QComboBox),
|
|
||||||
m_classId(classId),
|
|
||||||
m_activeConfiguration(0),
|
|
||||||
m_configurations(configurations)
|
|
||||||
{
|
|
||||||
m_toolbar->setMinimumContentsLength(15);
|
|
||||||
foreach (IUAVGadgetConfiguration *config, *m_configurations)
|
|
||||||
m_toolbar->addItem(config->name());
|
|
||||||
connect(m_toolbar, SIGNAL(activated(int)), this, SLOT(loadConfiguration(int)));
|
|
||||||
if (m_configurations->count() > 0)
|
|
||||||
loadConfiguration(0);
|
|
||||||
updateToolbar();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUAVGadget::loadConfiguration(int index) {
|
|
||||||
IUAVGadgetConfiguration* config = m_configurations->at(index);
|
|
||||||
m_activeConfiguration = config;
|
|
||||||
loadConfiguration(config);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUAVGadget::setActiveConfiguration(IUAVGadgetConfiguration *config)
|
|
||||||
{
|
|
||||||
m_activeConfiguration = config;
|
|
||||||
int index = m_toolbar->findText(config->name());
|
|
||||||
m_toolbar->setCurrentIndex(index);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUAVGadget::configurationChanged(IUAVGadgetConfiguration* config)
|
|
||||||
{
|
|
||||||
if (config == m_activeConfiguration)
|
|
||||||
loadConfiguration(config);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUAVGadget::configurationAdded(IUAVGadgetConfiguration* config)
|
|
||||||
{
|
|
||||||
m_configurations->append(config);
|
|
||||||
m_toolbar->addItem(config->name());
|
|
||||||
updateToolbar();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUAVGadget::configurationToBeDeleted(IUAVGadgetConfiguration* config)
|
|
||||||
{
|
|
||||||
int index = m_configurations->indexOf(config);
|
|
||||||
if (index >= 0) {
|
|
||||||
m_toolbar->removeItem(index);
|
|
||||||
m_configurations->removeAt(index);
|
|
||||||
}
|
|
||||||
updateToolbar();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUAVGadget::configurationNameChanged(QString oldName, QString newName)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < m_toolbar->count(); ++i) {
|
|
||||||
if (m_toolbar->itemText(i) == oldName)
|
|
||||||
m_toolbar->setItemText(i, newName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUAVGadget::updateToolbar()
|
|
||||||
{
|
|
||||||
m_toolbar->setEnabled(m_toolbar->count() > 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray IUAVGadget::saveState()
|
|
||||||
{
|
|
||||||
QByteArray bytes;
|
|
||||||
QDataStream stream(&bytes, QIODevice::WriteOnly);
|
|
||||||
if (m_activeConfiguration)
|
|
||||||
stream << m_activeConfiguration->name().toLatin1();
|
|
||||||
return bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUAVGadget::restoreState(QByteArray state)
|
|
||||||
{
|
|
||||||
QDataStream stream(state);
|
|
||||||
QByteArray configName;
|
|
||||||
stream >> configName;
|
|
||||||
foreach (IUAVGadgetConfiguration *config, *m_configurations) {
|
|
||||||
if (config->name() == configName) {
|
|
||||||
m_activeConfiguration = config;
|
|
||||||
loadConfiguration(config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -46,34 +46,32 @@ class CORE_EXPORT IUAVGadget : public IContext
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
IUAVGadget(QString classId, QList<IUAVGadgetConfiguration*> *configurations, QObject *parent = 0);
|
IUAVGadget(QString classId, QObject *parent = 0) :
|
||||||
|
IContext(parent),
|
||||||
|
m_classId(classId) { }
|
||||||
|
|
||||||
virtual ~IUAVGadget() {}
|
virtual ~IUAVGadget() {}
|
||||||
|
|
||||||
virtual QList<int> context() const = 0;
|
QList<int> context() const { return m_context; }
|
||||||
|
void setContext(QList<int> context) { m_context = context; }
|
||||||
virtual QWidget *widget() = 0;
|
virtual QWidget *widget() = 0;
|
||||||
|
virtual QComboBox *toolBar() { return 0; }
|
||||||
virtual QString contextHelpId() const { return QString(); }
|
virtual QString contextHelpId() const { return QString(); }
|
||||||
QString classId() const { return m_classId; }
|
QString classId() const { return m_classId; }
|
||||||
|
|
||||||
virtual void loadConfiguration(IUAVGadgetConfiguration* /*config*/) { }
|
virtual IUAVGadgetConfiguration *activeConfiguration() { return 0; }
|
||||||
IUAVGadgetConfiguration *activeConfiguration() { return m_activeConfiguration; }
|
virtual void loadConfiguration(IUAVGadgetConfiguration*) { }
|
||||||
void setActiveConfiguration(IUAVGadgetConfiguration *config);
|
virtual QByteArray saveState() { return QByteArray(); }
|
||||||
QComboBox *toolBar() { return m_toolbar; }
|
virtual void restoreState(QByteArray) { }
|
||||||
virtual QByteArray saveState();
|
|
||||||
virtual void restoreState(QByteArray state);
|
|
||||||
public slots:
|
public slots:
|
||||||
void configurationChanged(IUAVGadgetConfiguration* config);
|
virtual void configurationChanged(IUAVGadgetConfiguration* ) { }
|
||||||
void configurationAdded(IUAVGadgetConfiguration* config);
|
virtual void configurationAdded(IUAVGadgetConfiguration*) { }
|
||||||
void configurationToBeDeleted(IUAVGadgetConfiguration* config);
|
virtual void configurationToBeDeleted(IUAVGadgetConfiguration*) { }
|
||||||
void configurationNameChanged(QString oldName, QString newName);
|
virtual void configurationNameChanged(QString, QString) { }
|
||||||
private slots:
|
private slots:
|
||||||
void loadConfiguration(int index);
|
|
||||||
protected:
|
|
||||||
QComboBox *m_toolbar;
|
|
||||||
private:
|
private:
|
||||||
void updateToolbar();
|
|
||||||
QString m_classId;
|
QString m_classId;
|
||||||
IUAVGadgetConfiguration *m_activeConfiguration;
|
QList<int> m_context;
|
||||||
QList<IUAVGadgetConfiguration*> *m_configurations;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
m_name(name) {}
|
m_name(name) {}
|
||||||
virtual ~IUAVGadgetFactory() {}
|
virtual ~IUAVGadgetFactory() {}
|
||||||
|
|
||||||
virtual IUAVGadget *createGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent) = 0;
|
virtual IUAVGadget *createGadget(QWidget *parent) = 0;
|
||||||
virtual IUAVGadgetConfiguration *createConfiguration(bool /*locked*/,
|
virtual IUAVGadgetConfiguration *createConfiguration(bool /*locked*/,
|
||||||
const QString /*configName*/,
|
const QString /*configName*/,
|
||||||
const QByteArray &/*state*/) { return 0; }
|
const QByteArray &/*state*/) { return 0; }
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "iuavgadgetconfiguration.h"
|
#include "iuavgadgetconfiguration.h"
|
||||||
#include <QtGui/QComboBox>
|
#include <QtGui/QComboBox>
|
||||||
#include <QtCore/QByteArray>
|
#include <QtCore/QByteArray>
|
||||||
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|
||||||
@ -70,6 +71,8 @@ void UAVGadgetDecorator::configurationChanged(IUAVGadgetConfiguration* config)
|
|||||||
|
|
||||||
void UAVGadgetDecorator::configurationAdded(IUAVGadgetConfiguration* config)
|
void UAVGadgetDecorator::configurationAdded(IUAVGadgetConfiguration* config)
|
||||||
{
|
{
|
||||||
|
if (config->classId() != classId())
|
||||||
|
return;
|
||||||
m_configurations->append(config);
|
m_configurations->append(config);
|
||||||
m_toolbar->addItem(config->name());
|
m_toolbar->addItem(config->name());
|
||||||
updateToolbar();
|
updateToolbar();
|
||||||
@ -77,6 +80,8 @@ void UAVGadgetDecorator::configurationAdded(IUAVGadgetConfiguration* config)
|
|||||||
|
|
||||||
void UAVGadgetDecorator::configurationToBeDeleted(IUAVGadgetConfiguration* config)
|
void UAVGadgetDecorator::configurationToBeDeleted(IUAVGadgetConfiguration* config)
|
||||||
{
|
{
|
||||||
|
if (config->classId() != classId())
|
||||||
|
return;
|
||||||
int index = m_configurations->indexOf(config);
|
int index = m_configurations->indexOf(config);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
m_toolbar->removeItem(index);
|
m_toolbar->removeItem(index);
|
||||||
@ -85,8 +90,10 @@ void UAVGadgetDecorator::configurationToBeDeleted(IUAVGadgetConfiguration* confi
|
|||||||
updateToolbar();
|
updateToolbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UAVGadgetDecorator::configurationNameChanged(QString oldName, QString newName)
|
void UAVGadgetDecorator::configurationNameChanged(IUAVGadgetConfiguration* config, QString oldName, QString newName)
|
||||||
{
|
{
|
||||||
|
if (config->classId() != classId())
|
||||||
|
return;
|
||||||
for (int i = 0; i < m_toolbar->count(); ++i) {
|
for (int i = 0; i < m_toolbar->count(); ++i) {
|
||||||
if (m_toolbar->itemText(i) == oldName)
|
if (m_toolbar->itemText(i) == oldName)
|
||||||
m_toolbar->setItemText(i, newName);
|
m_toolbar->setItemText(i, newName);
|
||||||
|
@ -49,7 +49,7 @@ public slots:
|
|||||||
void configurationChanged(IUAVGadgetConfiguration* config);
|
void configurationChanged(IUAVGadgetConfiguration* config);
|
||||||
void configurationAdded(IUAVGadgetConfiguration* config);
|
void configurationAdded(IUAVGadgetConfiguration* config);
|
||||||
void configurationToBeDeleted(IUAVGadgetConfiguration* config);
|
void configurationToBeDeleted(IUAVGadgetConfiguration* config);
|
||||||
void configurationNameChanged(QString oldName, QString newName);
|
void configurationNameChanged(IUAVGadgetConfiguration* config, QString oldName, QString newName);
|
||||||
private slots:
|
private slots:
|
||||||
void loadConfiguration(int index);
|
void loadConfiguration(int index);
|
||||||
private:
|
private:
|
||||||
|
@ -27,8 +27,10 @@
|
|||||||
|
|
||||||
#include "uavgadgetinstancemanager.h"
|
#include "uavgadgetinstancemanager.h"
|
||||||
#include "iuavgadget.h"
|
#include "iuavgadget.h"
|
||||||
|
#include "uavgadgetdecorator.h"
|
||||||
#include "iuavgadgetfactory.h"
|
#include "iuavgadgetfactory.h"
|
||||||
#include "iuavgadgetconfiguration.h"
|
#include "iuavgadgetconfiguration.h"
|
||||||
|
#include "uavgadgetoptionspagedecorator.h"
|
||||||
#include "coreplugin/dialogs/ioptionspage.h"
|
#include "coreplugin/dialogs/ioptionspage.h"
|
||||||
#include "coreplugin/dialogs/settingsdialog.h"
|
#include "coreplugin/dialogs/settingsdialog.h"
|
||||||
#include "icore.h"
|
#include "icore.h"
|
||||||
@ -122,7 +124,8 @@ void UAVGadgetInstanceManager::createOptionsPages()
|
|||||||
foreach (IUAVGadgetConfiguration *config, m_configurations)
|
foreach (IUAVGadgetConfiguration *config, m_configurations)
|
||||||
{
|
{
|
||||||
IUAVGadgetFactory *f = factory(config->classId());
|
IUAVGadgetFactory *f = factory(config->classId());
|
||||||
IOptionsPage *page = f->createOptionsPage(config);
|
IOptionsPage *p = f->createOptionsPage(config);
|
||||||
|
IOptionsPage *page = new UAVGadgetOptionsPageDecorator(p, config);
|
||||||
m_optionsPages.append(page);
|
m_optionsPages.append(page);
|
||||||
m_pm->addObject(page);
|
m_pm->addObject(page);
|
||||||
}
|
}
|
||||||
@ -134,17 +137,25 @@ IUAVGadget *UAVGadgetInstanceManager::createGadget(QString classId, QWidget *par
|
|||||||
IUAVGadgetFactory *f = factory(classId);
|
IUAVGadgetFactory *f = factory(classId);
|
||||||
if (f) {
|
if (f) {
|
||||||
QList<IUAVGadgetConfiguration*> *configs = configurations(classId);
|
QList<IUAVGadgetConfiguration*> *configs = configurations(classId);
|
||||||
IUAVGadget *gadget = f->createGadget(configs, parent);
|
IUAVGadget *g = f->createGadget(0);
|
||||||
|
IUAVGadget *gadget = new UAVGadgetDecorator(g, configs);
|
||||||
m_gadgetInstances.append(gadget);
|
m_gadgetInstances.append(gadget);
|
||||||
connect(this, SIGNAL(configurationAdded(IUAVGadgetConfiguration*)), gadget, SLOT(configurationAdded(IUAVGadgetConfiguration*)));
|
connect(this, SIGNAL(configurationAdded(IUAVGadgetConfiguration*)), gadget, SLOT(configurationAdded(IUAVGadgetConfiguration*)));
|
||||||
connect(this, SIGNAL(configurationChanged(IUAVGadgetConfiguration*)), gadget, SLOT(configurationChanged(IUAVGadgetConfiguration*)));
|
connect(this, SIGNAL(configurationChanged(IUAVGadgetConfiguration*)), gadget, SLOT(configurationChanged(IUAVGadgetConfiguration*)));
|
||||||
connect(this, SIGNAL(configurationNameChanged(QString,QString)), gadget, SLOT(configurationNameChanged(QString,QString)));
|
connect(this, SIGNAL(configurationNameChanged(IUAVGadgetConfiguration*, QString,QString)), gadget, SLOT(configurationNameChanged(IUAVGadgetConfiguration*, QString,QString)));
|
||||||
connect(this, SIGNAL(configurationToBeDeleted(IUAVGadgetConfiguration*)), gadget, SLOT(configurationToBeDeleted(IUAVGadgetConfiguration*)));
|
connect(this, SIGNAL(configurationToBeDeleted(IUAVGadgetConfiguration*)), gadget, SLOT(configurationToBeDeleted(IUAVGadgetConfiguration*)));
|
||||||
return gadget;
|
return gadget;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UAVGadgetInstanceManager::removeGadget(IUAVGadget *gadget)
|
||||||
|
{
|
||||||
|
if (m_gadgetInstances.contains(gadget)) {
|
||||||
|
m_gadgetInstances.removeOne(gadget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool UAVGadgetInstanceManager::canDeleteConfiguration(IUAVGadgetConfiguration *config)
|
bool UAVGadgetInstanceManager::canDeleteConfiguration(IUAVGadgetConfiguration *config)
|
||||||
{
|
{
|
||||||
// to be able to delete a configuration, no instance must be using it
|
// to be able to delete a configuration, no instance must be using it
|
||||||
@ -183,7 +194,8 @@ void UAVGadgetInstanceManager::cloneConfiguration(IUAVGadgetConfiguration *conf
|
|||||||
|
|
||||||
IUAVGadgetConfiguration *config = configToClone->clone(name);
|
IUAVGadgetConfiguration *config = configToClone->clone(name);
|
||||||
IUAVGadgetFactory *f = factory(config->classId());
|
IUAVGadgetFactory *f = factory(config->classId());
|
||||||
IOptionsPage *page = f->createOptionsPage(config);
|
IOptionsPage *p = f->createOptionsPage(config);
|
||||||
|
IOptionsPage *page = new UAVGadgetOptionsPageDecorator(p, config);
|
||||||
m_provisionalConfigs.append(config);
|
m_provisionalConfigs.append(config);
|
||||||
m_provisionalOptionsPages.append(page);
|
m_provisionalOptionsPages.append(page);
|
||||||
m_settingsDialog->insertPage(page);
|
m_settingsDialog->insertPage(page);
|
||||||
@ -229,7 +241,7 @@ void UAVGadgetInstanceManager::applyChanges(IUAVGadgetConfiguration *config)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (config->provisionalName() != config->name()) {
|
if (config->provisionalName() != config->name()) {
|
||||||
emit configurationNameChanged(config->name(), config->provisionalName());
|
emit configurationNameChanged(config, config->name(), config->provisionalName());
|
||||||
config->setName(config->provisionalName());
|
config->setName(config->provisionalName());
|
||||||
}
|
}
|
||||||
if (m_configurations.contains(config)) {
|
if (m_configurations.contains(config)) {
|
||||||
@ -251,17 +263,17 @@ void UAVGadgetInstanceManager::configurationNameEdited(QString text, bool hasTex
|
|||||||
bool disable = false;
|
bool disable = false;
|
||||||
foreach (IUAVGadgetConfiguration *c, m_configurations) {
|
foreach (IUAVGadgetConfiguration *c, m_configurations) {
|
||||||
foreach (IUAVGadgetConfiguration *d, m_configurations) {
|
foreach (IUAVGadgetConfiguration *d, m_configurations) {
|
||||||
if (c != d && c->provisionalName() == d->provisionalName())
|
if (c != d && c->classId() == d->classId() && c->provisionalName() == d->provisionalName())
|
||||||
disable = true;
|
disable = true;
|
||||||
}
|
}
|
||||||
foreach (IUAVGadgetConfiguration *d, m_provisionalConfigs) {
|
foreach (IUAVGadgetConfiguration *d, m_provisionalConfigs) {
|
||||||
if (c != d && c->provisionalName() == d->provisionalName())
|
if (c != d && c->classId() == d->classId() && c->provisionalName() == d->provisionalName())
|
||||||
disable = true;
|
disable = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (IUAVGadgetConfiguration *c, m_provisionalConfigs) {
|
foreach (IUAVGadgetConfiguration *c, m_provisionalConfigs) {
|
||||||
foreach (IUAVGadgetConfiguration *d, m_provisionalConfigs) {
|
foreach (IUAVGadgetConfiguration *d, m_provisionalConfigs) {
|
||||||
if (c != d && c->provisionalName() == d->provisionalName())
|
if (c != d && c->classId() == d->classId() && c->provisionalName() == d->provisionalName())
|
||||||
disable = true;
|
disable = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ public:
|
|||||||
void readConfigurations();
|
void readConfigurations();
|
||||||
void writeConfigurations();
|
void writeConfigurations();
|
||||||
IUAVGadget *createGadget(QString classId, QWidget *parent);
|
IUAVGadget *createGadget(QString classId, QWidget *parent);
|
||||||
|
void removeGadget(IUAVGadget *gadget);
|
||||||
bool canDeleteConfiguration(IUAVGadgetConfiguration *config);
|
bool canDeleteConfiguration(IUAVGadgetConfiguration *config);
|
||||||
void deleteConfiguration(IUAVGadgetConfiguration *config);
|
void deleteConfiguration(IUAVGadgetConfiguration *config);
|
||||||
void cloneConfiguration(IUAVGadgetConfiguration *config);
|
void cloneConfiguration(IUAVGadgetConfiguration *config);
|
||||||
@ -70,7 +71,7 @@ signals:
|
|||||||
void configurationChanged(IUAVGadgetConfiguration* config);
|
void configurationChanged(IUAVGadgetConfiguration* config);
|
||||||
void configurationAdded(IUAVGadgetConfiguration* config);
|
void configurationAdded(IUAVGadgetConfiguration* config);
|
||||||
void configurationToBeDeleted(IUAVGadgetConfiguration* config);
|
void configurationToBeDeleted(IUAVGadgetConfiguration* config);
|
||||||
void configurationNameChanged(QString oldName, QString newName);
|
void configurationNameChanged(IUAVGadgetConfiguration* config, QString oldName, QString newName);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void settingsDialogShown(Core::Internal::SettingsDialog* settingsDialog);
|
void settingsDialogShown(Core::Internal::SettingsDialog* settingsDialog);
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "uavgadgetmanager.h"
|
#include "uavgadgetmanager.h"
|
||||||
#include "uavgadgetview.h"
|
#include "uavgadgetview.h"
|
||||||
#include "uavgadgetmode.h"
|
#include "uavgadgetmode.h"
|
||||||
|
#include "uavgadgetinstancemanager.h"
|
||||||
#include "iuavgadgetfactory.h"
|
#include "iuavgadgetfactory.h"
|
||||||
#include "iuavgadget.h"
|
#include "iuavgadget.h"
|
||||||
#include "icore.h"
|
#include "icore.h"
|
||||||
@ -300,11 +301,9 @@ void UAVGadgetManager::handleContextChange(Core::IContext *context)
|
|||||||
// if (debugUAVGadgetManager)
|
// if (debugUAVGadgetManager)
|
||||||
// qDebug() << Q_FUNC_INFO << context;
|
// qDebug() << Q_FUNC_INFO << context;
|
||||||
IUAVGadget *uavGadget = context ? qobject_cast<IUAVGadget*>(context) : 0;
|
IUAVGadget *uavGadget = context ? qobject_cast<IUAVGadget*>(context) : 0;
|
||||||
if (uavGadget) {
|
if (uavGadget)
|
||||||
setCurrentGadget(uavGadget);
|
setCurrentGadget(uavGadget);
|
||||||
} else {
|
|
||||||
updateActions();
|
updateActions();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UAVGadgetManager::setCurrentGadget(IUAVGadget *uavGadget)
|
void UAVGadgetManager::setCurrentGadget(IUAVGadget *uavGadget)
|
||||||
@ -368,6 +367,10 @@ void UAVGadgetManager::closeView(Core::Internal::UAVGadgetView *view)
|
|||||||
if (splitterOrView == m_d->m_splitterOrView)
|
if (splitterOrView == m_d->m_splitterOrView)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
IUAVGadget *gadget = view->gadget();
|
||||||
|
UAVGadgetInstanceManager *im = ICore::instance()->uavGadgetInstanceManager();
|
||||||
|
im->removeGadget(gadget);
|
||||||
|
|
||||||
emptyView(view);
|
emptyView(view);
|
||||||
|
|
||||||
SplitterOrView *splitter = m_d->m_splitterOrView->findSplitter(splitterOrView);
|
SplitterOrView *splitter = m_d->m_splitterOrView->findSplitter(splitterOrView);
|
||||||
@ -382,23 +385,22 @@ void UAVGadgetManager::closeView(Core::Internal::UAVGadgetView *view)
|
|||||||
Q_ASSERT(newCurrent);
|
Q_ASSERT(newCurrent);
|
||||||
if (newCurrent)
|
if (newCurrent)
|
||||||
setCurrentGadget(newCurrent->gadget());
|
setCurrentGadget(newCurrent->gadget());
|
||||||
updateActions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UAVGadgetManager::addGadgetToContext(IUAVGadget *uavGadget)
|
void UAVGadgetManager::addGadgetToContext(IUAVGadget *gadget)
|
||||||
{
|
{
|
||||||
if (!uavGadget)
|
if (!gadget)
|
||||||
return;
|
return;
|
||||||
m_d->m_core->addContextObject(uavGadget);
|
m_d->m_core->addContextObject(gadget);
|
||||||
|
|
||||||
// emit uavGadgetOpened(uavGadget);
|
// emit uavGadgetOpened(uavGadget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UAVGadgetManager::removeGadget(IUAVGadget *uavGadget)
|
void UAVGadgetManager::removeGadget(IUAVGadget *gadget)
|
||||||
{
|
{
|
||||||
if (!uavGadget)
|
if (!gadget)
|
||||||
return;
|
return;
|
||||||
m_d->m_core->removeContextObject(qobject_cast<IContext*>(uavGadget));
|
m_d->m_core->removeContextObject(qobject_cast<IContext*>(gadget));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UAVGadgetManager::ensureUAVGadgetManagerVisible()
|
void UAVGadgetManager::ensureUAVGadgetManagerVisible()
|
||||||
@ -409,6 +411,8 @@ void UAVGadgetManager::ensureUAVGadgetManagerVisible()
|
|||||||
|
|
||||||
void UAVGadgetManager::updateActions()
|
void UAVGadgetManager::updateActions()
|
||||||
{
|
{
|
||||||
|
if (m_d->m_core->modeManager()->currentMode() != m_uavGadgetMode)
|
||||||
|
return;
|
||||||
if (!m_d->m_splitterOrView) // this is only for startup
|
if (!m_d->m_splitterOrView) // this is only for startup
|
||||||
return;
|
return;
|
||||||
// Splitting is only possible when the toolbars are shown
|
// Splitting is only possible when the toolbars are shown
|
||||||
@ -436,6 +440,9 @@ QByteArray UAVGadgetManager::saveState() const
|
|||||||
bool UAVGadgetManager::restoreState(const QByteArray &state)
|
bool UAVGadgetManager::restoreState(const QByteArray &state)
|
||||||
{
|
{
|
||||||
removeAllSplits();
|
removeAllSplits();
|
||||||
|
|
||||||
|
UAVGadgetInstanceManager *im = ICore::instance()->uavGadgetInstanceManager();
|
||||||
|
im->removeGadget(m_d->m_splitterOrView->view()->gadget());
|
||||||
emptyView(m_d->m_splitterOrView->view());
|
emptyView(m_d->m_splitterOrView->view());
|
||||||
QDataStream stream(state);
|
QDataStream stream(state);
|
||||||
|
|
||||||
@ -454,7 +461,6 @@ bool UAVGadgetManager::restoreState(const QByteArray &state)
|
|||||||
m_d->m_splitterOrView->restoreState(splitterstates);
|
m_d->m_splitterOrView->restoreState(splitterstates);
|
||||||
|
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,7 +511,6 @@ void UAVGadgetManager::split(Qt::Orientation orientation)
|
|||||||
SplitterOrView *sor = m_d->m_splitterOrView->findView(uavGadget);
|
SplitterOrView *sor = m_d->m_splitterOrView->findView(uavGadget);
|
||||||
SplitterOrView *next = m_d->m_splitterOrView->findNextView(sor);
|
SplitterOrView *next = m_d->m_splitterOrView->findNextView(sor);
|
||||||
setCurrentGadget(next->gadget());
|
setCurrentGadget(next->gadget());
|
||||||
updateActions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UAVGadgetManager::split()
|
void UAVGadgetManager::split()
|
||||||
@ -527,7 +532,6 @@ void UAVGadgetManager::removeCurrentSplit()
|
|||||||
if (viewToClose == m_d->m_splitterOrView)
|
if (viewToClose == m_d->m_splitterOrView)
|
||||||
return;
|
return;
|
||||||
closeView(viewToClose->view());
|
closeView(viewToClose->view());
|
||||||
updateActions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UAVGadgetManager::removeAllSplits()
|
void UAVGadgetManager::removeAllSplits()
|
||||||
@ -538,6 +542,13 @@ void UAVGadgetManager::removeAllSplits()
|
|||||||
if (!m_d->m_splitterOrView->isSplitter())
|
if (!m_d->m_splitterOrView->isSplitter())
|
||||||
return;
|
return;
|
||||||
IUAVGadget *uavGadget = m_d->m_currentGadget;
|
IUAVGadget *uavGadget = m_d->m_currentGadget;
|
||||||
|
QList<IUAVGadget*> gadgets = m_d->m_splitterOrView->gadgets();
|
||||||
|
gadgets.removeOne(uavGadget);
|
||||||
|
UAVGadgetInstanceManager *im = ICore::instance()->uavGadgetInstanceManager();
|
||||||
|
foreach (IUAVGadget *g, gadgets) {
|
||||||
|
im->removeGadget(g);
|
||||||
|
}
|
||||||
|
|
||||||
m_d->m_currentGadget = 0; // trigger update below
|
m_d->m_currentGadget = 0; // trigger update below
|
||||||
m_d->m_splitterOrView->unsplitAll();
|
m_d->m_splitterOrView->unsplitAll();
|
||||||
m_d->m_splitterOrView->view()->setGadget(uavGadget);
|
m_d->m_splitterOrView->view()->setGadget(uavGadget);
|
||||||
|
@ -217,11 +217,12 @@ void UAVGadgetView::listSelectionActivated(int index)
|
|||||||
{
|
{
|
||||||
if (index < 0) // this could happen when called from SplitterOrView::restoreState()
|
if (index < 0) // this could happen when called from SplitterOrView::restoreState()
|
||||||
index = m_defaultIndex;
|
index = m_defaultIndex;
|
||||||
UAVGadgetInstanceManager *fm = ICore::instance()->uavGadgetInstanceManager();
|
|
||||||
QString classId = m_uavGadgetList->itemData(index).toString();
|
QString classId = m_uavGadgetList->itemData(index).toString();
|
||||||
if (m_uavGadget && (m_uavGadget->classId() == classId))
|
if (m_uavGadget && (m_uavGadget->classId() == classId))
|
||||||
return;
|
return;
|
||||||
IUAVGadget *gadget = fm->createGadget(classId, this);
|
UAVGadgetInstanceManager *im = ICore::instance()->uavGadgetInstanceManager();
|
||||||
|
im->removeGadget(m_uavGadget);
|
||||||
|
IUAVGadget *gadget = im->createGadget(classId, this);
|
||||||
setGadget(gadget);
|
setGadget(gadget);
|
||||||
m_uavGadgetManager->setCurrentGadget(gadget);
|
m_uavGadgetManager->setCurrentGadget(gadget);
|
||||||
}
|
}
|
||||||
@ -460,6 +461,22 @@ UAVGadgetView *SplitterOrView::takeView()
|
|||||||
return oldView;
|
return oldView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<IUAVGadget*> SplitterOrView::gadgets()
|
||||||
|
{
|
||||||
|
QList<IUAVGadget*> g;
|
||||||
|
if (hasGadget())
|
||||||
|
g.append(gadget());
|
||||||
|
if (m_splitter) {
|
||||||
|
for (int i = 0; i < m_splitter->count(); ++i) {
|
||||||
|
if (SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i))) {
|
||||||
|
QList<IUAVGadget*> result = splitterOrView->gadgets();
|
||||||
|
g.append(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
void SplitterOrView::split(Qt::Orientation orientation)
|
void SplitterOrView::split(Qt::Orientation orientation)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_view && (m_splitter == 0));
|
Q_ASSERT(m_view && (m_splitter == 0));
|
||||||
@ -579,11 +596,8 @@ void SplitterOrView::restoreState(const QByteArray &state)
|
|||||||
QString classId;
|
QString classId;
|
||||||
QByteArray uavGadgetState;
|
QByteArray uavGadgetState;
|
||||||
stream >> classId >> uavGadgetState;
|
stream >> classId >> uavGadgetState;
|
||||||
m_view = new UAVGadgetView(m_uavGadgetManager, 0);
|
|
||||||
int index = m_view->indexOfClassId(classId);
|
int index = m_view->indexOfClassId(classId);
|
||||||
m_view->listSelectionActivated(index);
|
m_view->listSelectionActivated(index);
|
||||||
m_layout->addWidget(m_view);
|
|
||||||
m_layout->setCurrentWidget(m_view);
|
|
||||||
gadget()->restoreState(uavGadgetState);
|
gadget()->restoreState(uavGadgetState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,7 @@ public:
|
|||||||
inline bool hasGadget() const { return m_view && (m_view->gadget() != 0); }
|
inline bool hasGadget() const { return m_view && (m_view->gadget() != 0); }
|
||||||
inline UAVGadgetView *view() const { return m_view; }
|
inline UAVGadgetView *view() const { return m_view; }
|
||||||
inline QSplitter *splitter() const { return m_splitter; }
|
inline QSplitter *splitter() const { return m_splitter; }
|
||||||
|
QList<Core::IUAVGadget*> gadgets();
|
||||||
QSplitter *takeSplitter();
|
QSplitter *takeSplitter();
|
||||||
UAVGadgetView *takeView();
|
UAVGadgetView *takeView();
|
||||||
|
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
#include "emptygadget.h"
|
#include "emptygadget.h"
|
||||||
#include "emptygadgetwidget.h"
|
#include "emptygadgetwidget.h"
|
||||||
|
|
||||||
EmptyGadget::EmptyGadget(QString classId, QList<IUAVGadgetConfiguration*> *configurations, EmptyGadgetWidget *widget) :
|
EmptyGadget::EmptyGadget(QString classId, EmptyGadgetWidget *widget, QWidget *parent) :
|
||||||
IUAVGadget(classId, configurations, widget),
|
IUAVGadget(classId, parent),
|
||||||
m_widget(widget)
|
m_widget(widget)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,11 @@
|
|||||||
|
|
||||||
#include <coreplugin/iuavgadget.h>
|
#include <coreplugin/iuavgadget.h>
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
class IUAVGadget;
|
class IUAVGadget;
|
||||||
class QWidget;
|
}
|
||||||
class QString;
|
//class QWidget;
|
||||||
|
//class QString;
|
||||||
class EmptyGadgetWidget;
|
class EmptyGadgetWidget;
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
@ -41,7 +43,7 @@ class EmptyGadget : public Core::IUAVGadget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
EmptyGadget(QString classId, QList<IUAVGadgetConfiguration*> *configurations, EmptyGadgetWidget *widget = 0);
|
EmptyGadget(QString classId, EmptyGadgetWidget *widget, QWidget *parent = 0);
|
||||||
~EmptyGadget();
|
~EmptyGadget();
|
||||||
|
|
||||||
QList<int> context() const { return m_context; }
|
QList<int> context() const { return m_context; }
|
||||||
|
@ -41,7 +41,7 @@ EmptyGadgetFactory::~EmptyGadgetFactory()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IUAVGadget* EmptyGadgetFactory::createGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent) {
|
IUAVGadget* EmptyGadgetFactory::createGadget(QWidget *parent) {
|
||||||
EmptyGadgetWidget* gadgetWidget = new EmptyGadgetWidget(parent);
|
EmptyGadgetWidget* gadgetWidget = new EmptyGadgetWidget(parent);
|
||||||
return new EmptyGadget(QString("EmptyGadget"), configurations, gadgetWidget);
|
return new EmptyGadget(QString("EmptyGadget"), gadgetWidget, parent);
|
||||||
}
|
}
|
||||||
|
@ -30,18 +30,21 @@
|
|||||||
|
|
||||||
#include <coreplugin/iuavgadgetfactory.h>
|
#include <coreplugin/iuavgadgetfactory.h>
|
||||||
|
|
||||||
using namespace Core;
|
namespace Core {
|
||||||
class IUAVGadget;
|
class IUAVGadget;
|
||||||
class IUAVGadgetFactory;
|
class IUAVGadgetFactory;
|
||||||
|
}
|
||||||
|
|
||||||
class EmptyGadgetFactory : public Core::IUAVGadgetFactory
|
using namespace Core;
|
||||||
|
|
||||||
|
class EmptyGadgetFactory : public IUAVGadgetFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
EmptyGadgetFactory(QObject *parent = 0);
|
EmptyGadgetFactory(QObject *parent = 0);
|
||||||
~EmptyGadgetFactory();
|
~EmptyGadgetFactory();
|
||||||
|
|
||||||
Core::IUAVGadget *createGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent);
|
IUAVGadget *createGadget(QWidget *parent);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EMPTYGADGETFACTORY_H_
|
#endif // EMPTYGADGETFACTORY_H_
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
#include "mapgadgetwidget.h"
|
#include "mapgadgetwidget.h"
|
||||||
#include "mapgadgetconfiguration.h"
|
#include "mapgadgetconfiguration.h"
|
||||||
|
|
||||||
MapGadget::MapGadget(QString classId, QList<IUAVGadgetConfiguration*> *configurations, MapGadgetWidget *widget) :
|
MapGadget::MapGadget(QString classId, MapGadgetWidget *widget, QWidget *parent) :
|
||||||
IUAVGadget(classId, configurations, widget),
|
IUAVGadget(classId, parent),
|
||||||
m_widget(widget)
|
m_widget(widget)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -41,8 +41,6 @@ MapGadget::~MapGadget()
|
|||||||
|
|
||||||
void MapGadget::loadConfiguration(IUAVGadgetConfiguration* config)
|
void MapGadget::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||||
{
|
{
|
||||||
setActiveConfiguration(config);
|
|
||||||
|
|
||||||
MapGadgetConfiguration *m = qobject_cast<MapGadgetConfiguration*>(config);
|
MapGadgetConfiguration *m = qobject_cast<MapGadgetConfiguration*>(config);
|
||||||
m_widget->setZoom(m->zoom());
|
m_widget->setZoom(m->zoom());
|
||||||
m_widget->setPosition(QPointF(m->longitude(), m->latitude()));
|
m_widget->setPosition(QPointF(m->longitude(), m->latitude()));
|
||||||
|
@ -43,17 +43,14 @@ class MapGadget : public Core::IUAVGadget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MapGadget(QString classId, QList<IUAVGadgetConfiguration*> *configurations, MapGadgetWidget *widget = 0);
|
MapGadget(QString classId, MapGadgetWidget *widget, QWidget *parent = 0);
|
||||||
~MapGadget();
|
~MapGadget();
|
||||||
|
|
||||||
QList<int> context() const { return m_context; }
|
|
||||||
QWidget *widget() { return m_widget; }
|
QWidget *widget() { return m_widget; }
|
||||||
QString contextHelpId() const { return QString(); }
|
|
||||||
void loadConfiguration(IUAVGadgetConfiguration* config);
|
void loadConfiguration(IUAVGadgetConfiguration* config);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MapGadgetWidget *m_widget;
|
MapGadgetWidget *m_widget;
|
||||||
QList<int> m_context;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#include "mapgadget.h"
|
#include "mapgadget.h"
|
||||||
#include "mapgadgetconfiguration.h"
|
#include "mapgadgetconfiguration.h"
|
||||||
#include "mapgadgetoptionspage.h"
|
#include "mapgadgetoptionspage.h"
|
||||||
#include <coreplugin/uavgadgetoptionspagedecorator.h>
|
|
||||||
#include <coreplugin/iuavgadget.h>
|
#include <coreplugin/iuavgadget.h>
|
||||||
|
|
||||||
MapGadgetFactory::MapGadgetFactory(QObject *parent) :
|
MapGadgetFactory::MapGadgetFactory(QObject *parent) :
|
||||||
@ -41,10 +40,10 @@ MapGadgetFactory::~MapGadgetFactory()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IUAVGadget* MapGadgetFactory::createGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent)
|
Core::IUAVGadget* MapGadgetFactory::createGadget(QWidget *parent)
|
||||||
{
|
{
|
||||||
MapGadgetWidget* gadgetWidget = new MapGadgetWidget(parent);
|
MapGadgetWidget* gadgetWidget = new MapGadgetWidget(parent);
|
||||||
return new MapGadget(QString("MapGadget"), configurations, gadgetWidget);
|
return new MapGadget(QString("MapGadget"), gadgetWidget, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
IUAVGadgetConfiguration *MapGadgetFactory::createConfiguration(bool locked,
|
IUAVGadgetConfiguration *MapGadgetFactory::createConfiguration(bool locked,
|
||||||
@ -56,7 +55,6 @@ IUAVGadgetConfiguration *MapGadgetFactory::createConfiguration(bool locked,
|
|||||||
|
|
||||||
IOptionsPage *MapGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
|
IOptionsPage *MapGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
|
||||||
{
|
{
|
||||||
MapGadgetOptionsPage *page = new MapGadgetOptionsPage(config);
|
return new MapGadgetOptionsPage(config);
|
||||||
return new UAVGadgetOptionsPageDecorator(page, config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
MapGadgetFactory(QObject *parent = 0);
|
MapGadgetFactory(QObject *parent = 0);
|
||||||
~MapGadgetFactory();
|
~MapGadgetFactory();
|
||||||
|
|
||||||
Core::IUAVGadget *createGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent);
|
Core::IUAVGadget *createGadget(QWidget *parent);
|
||||||
IUAVGadgetConfiguration *createConfiguration(bool locked,
|
IUAVGadgetConfiguration *createConfiguration(bool locked,
|
||||||
const QString configName,
|
const QString configName,
|
||||||
const QByteArray &state);
|
const QByteArray &state);
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
#include "scopegadget.h"
|
#include "scopegadget.h"
|
||||||
#include "scopegadgetwidget.h"
|
#include "scopegadgetwidget.h"
|
||||||
|
|
||||||
ScopeGadget::ScopeGadget(QString classId, QList<IUAVGadgetConfiguration*> *configurations, ScopeGadgetWidget *widget) :
|
ScopeGadget::ScopeGadget(QString classId, ScopeGadgetWidget *widget, QWidget *parent) :
|
||||||
IUAVGadget(classId, configurations, widget),
|
IUAVGadget(classId, parent),
|
||||||
m_widget(widget)
|
m_widget(widget)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class ScopeGadget : public Core::IUAVGadget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ScopeGadget(QString classId, QList<IUAVGadgetConfiguration*> *configurations, ScopeGadgetWidget *widget = 0);
|
ScopeGadget(QString classId, ScopeGadgetWidget *widget, QWidget *parent = 0);
|
||||||
~ScopeGadget();
|
~ScopeGadget();
|
||||||
|
|
||||||
QList<int> context() const { return m_context; }
|
QList<int> context() const { return m_context; }
|
||||||
|
@ -21,7 +21,7 @@ ScopeGadgetFactory::~ScopeGadgetFactory()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IUAVGadget* ScopeGadgetFactory::createGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent) {
|
Core::IUAVGadget* ScopeGadgetFactory::createGadget(QWidget *parent) {
|
||||||
ScopeGadgetWidget* gadgetWidget = new ScopeGadgetWidget(parent);
|
ScopeGadgetWidget* gadgetWidget = new ScopeGadgetWidget(parent);
|
||||||
return new ScopeGadget(QString("ScopeGadget"), configurations, gadgetWidget);
|
return new ScopeGadget(QString("ScopeGadget"), gadgetWidget, parent);
|
||||||
}
|
}
|
||||||
|
@ -10,18 +10,21 @@
|
|||||||
|
|
||||||
#include <coreplugin/iuavgadgetfactory.h>
|
#include <coreplugin/iuavgadgetfactory.h>
|
||||||
|
|
||||||
using namespace Core;
|
namespace Core {
|
||||||
class IUAVGadget;
|
class IUAVGadget;
|
||||||
class IUAVGadgetFactory;
|
class IUAVGadgetFactory;
|
||||||
|
}
|
||||||
|
|
||||||
class ScopeGadgetFactory : public Core::IUAVGadgetFactory
|
using namespace Core;
|
||||||
|
|
||||||
|
class ScopeGadgetFactory : public IUAVGadgetFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ScopeGadgetFactory(QObject *parent = 0);
|
ScopeGadgetFactory(QObject *parent = 0);
|
||||||
~ScopeGadgetFactory();
|
~ScopeGadgetFactory();
|
||||||
|
|
||||||
Core::IUAVGadget *createGadget(QList<IUAVGadgetConfiguration*> *configurations, QWidget *parent);
|
IUAVGadget *createGadget(QWidget *parent);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SCOPEGADGETFACTORY_H_
|
#endif // SCOPEGADGETFACTORY_H_
|
||||||
|
Loading…
Reference in New Issue
Block a user