2010-03-24 20:48:24 +01:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file uavgadgetinstancemanager.h
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* @brief
|
|
|
|
* @see The GNU Public License (GPL) Version 3
|
|
|
|
* @defgroup coreplugin
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef UAVGADGETINSTANCEMANAGER_H
|
|
|
|
#define UAVGADGETINSTANCEMANAGER_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QtCore/QMap>
|
|
|
|
#include <QtCore/QStringList>
|
|
|
|
|
2010-03-25 23:31:25 +01:00
|
|
|
namespace ExtensionSystem {
|
|
|
|
class PluginManager;
|
|
|
|
}
|
|
|
|
|
2010-03-24 20:48:24 +01:00
|
|
|
namespace Core
|
|
|
|
{
|
|
|
|
|
2010-03-25 19:33:58 +01:00
|
|
|
namespace Internal {
|
|
|
|
class SettingsDialog;
|
|
|
|
}
|
|
|
|
|
2010-03-24 20:48:24 +01:00
|
|
|
class IUAVGadget;
|
|
|
|
class IUAVGadgetConfiguration;
|
2010-03-25 19:33:58 +01:00
|
|
|
class IOptionsPage;
|
2010-03-24 20:48:24 +01:00
|
|
|
class IUAVGadgetFactory;
|
|
|
|
|
|
|
|
class UAVGadgetInstanceManager : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit UAVGadgetInstanceManager(QObject *parent = 0);
|
2010-03-25 23:31:25 +01:00
|
|
|
~UAVGadgetInstanceManager();
|
2010-03-25 19:33:58 +01:00
|
|
|
void readConfigurations();
|
|
|
|
void writeConfigurations();
|
|
|
|
IUAVGadget *createGadget(QString classId, QWidget *parent);
|
2010-03-27 20:24:21 +01:00
|
|
|
void removeGadget(IUAVGadget *gadget);
|
2010-03-25 19:33:58 +01:00
|
|
|
bool canDeleteConfiguration(IUAVGadgetConfiguration *config);
|
|
|
|
void deleteConfiguration(IUAVGadgetConfiguration *config);
|
|
|
|
void cloneConfiguration(IUAVGadgetConfiguration *config);
|
2010-03-25 23:31:25 +01:00
|
|
|
void applyChanges(IUAVGadgetConfiguration *config);
|
|
|
|
void configurationNameEdited(QString text, bool hasText = true);
|
2010-03-25 19:33:58 +01:00
|
|
|
QStringList classIds() const { return m_classIds.keys(); }
|
|
|
|
QStringList configurationNames(QString classId) const;
|
|
|
|
QString gadgetName(QString classId) const;
|
2010-03-24 20:48:24 +01:00
|
|
|
|
|
|
|
signals:
|
2010-03-25 23:31:25 +01:00
|
|
|
void configurationChanged(IUAVGadgetConfiguration* config);
|
|
|
|
void configurationAdded(IUAVGadgetConfiguration* config);
|
|
|
|
void configurationToBeDeleted(IUAVGadgetConfiguration* config);
|
2010-03-27 20:24:21 +01:00
|
|
|
void configurationNameChanged(IUAVGadgetConfiguration* config, QString oldName, QString newName);
|
2010-03-24 20:48:24 +01:00
|
|
|
|
|
|
|
public slots:
|
2010-03-25 19:33:58 +01:00
|
|
|
void settingsDialogShown(Core::Internal::SettingsDialog* settingsDialog);
|
|
|
|
void settingsDialogRemoved();
|
2010-03-24 20:48:24 +01:00
|
|
|
|
|
|
|
private:
|
2010-03-25 19:33:58 +01:00
|
|
|
IUAVGadgetFactory *factory(QString classId) const;
|
|
|
|
void createOptionsPages();
|
|
|
|
QList<IUAVGadgetConfiguration*> *configurations(QString classId) const;
|
|
|
|
QString suggestName(QString classId, QString name);
|
|
|
|
QList<IUAVGadget*> m_gadgetInstances;
|
|
|
|
QList<IUAVGadgetFactory*> m_factories;
|
|
|
|
QList<IUAVGadgetConfiguration*> m_configurations;
|
|
|
|
QList<IOptionsPage*> m_optionsPages;
|
|
|
|
QMap<QString, QString> m_classIds;
|
|
|
|
QMap<QString, QStringList> m_takenNames;
|
|
|
|
QList<IUAVGadgetConfiguration*> m_provisionalConfigs;
|
2010-03-26 17:10:58 +01:00
|
|
|
QList<IUAVGadgetConfiguration*> m_provisionalDeletes;
|
2010-03-25 19:33:58 +01:00
|
|
|
QList<IOptionsPage*> m_provisionalOptionsPages;
|
|
|
|
Core::Internal::SettingsDialog *m_settingsDialog;
|
2010-03-25 23:31:25 +01:00
|
|
|
ExtensionSystem::PluginManager *m_pm;
|
2010-03-24 20:48:24 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Core
|
|
|
|
|
|
|
|
#endif // UAVGADGETINSTANCEMANAGER_H
|