mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-27 16:54:15 +01:00
OP-99 Export/Import Plugin: Handling of workspace-settings, layout, key-binding. Formatting.
Quite a few changes in the core-plugin. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1328 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
0b9079e277
commit
d11c570785
@ -460,9 +460,8 @@ static const char *settingsGroup = "KeyBindings";
|
||||
static const char *idKey = "ID";
|
||||
static const char *sequenceKey = "Keysequence";
|
||||
|
||||
void ActionManagerPrivate::initialize()
|
||||
void ActionManagerPrivate::readSettings(QSettings *settings)
|
||||
{
|
||||
QSettings *settings = m_mainWnd->settings();
|
||||
const int shortcuts = settings->beginReadArray(QLatin1String(settingsGroup));
|
||||
for (int i=0; i<shortcuts; ++i) {
|
||||
settings->setArrayIndex(i);
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
Command *command(int uid) const;
|
||||
ActionContainer *actionContainer(int uid) const;
|
||||
|
||||
void initialize();
|
||||
void readSettings(QSettings *settings);
|
||||
|
||||
//ActionManager Interface
|
||||
ActionContainer *createMenu(const QString &id);
|
||||
|
@ -186,3 +186,13 @@ void CoreImpl::openFiles(const QStringList &arguments)
|
||||
//m_mainwindow->openFiles(arguments);
|
||||
}
|
||||
|
||||
void CoreImpl::readMainSettings(QSettings* qs)
|
||||
{
|
||||
m_mainwindow->readSettings(qs);
|
||||
}
|
||||
|
||||
void CoreImpl::saveMainSettings(QSettings* qs)
|
||||
{
|
||||
m_mainwindow->saveSettings(qs);
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,8 @@ public:
|
||||
|
||||
QSettings *settings() const;
|
||||
SettingsDatabase *settingsDatabase() const;
|
||||
void readMainSettings(QSettings* qs);
|
||||
void saveMainSettings(QSettings* qs);
|
||||
|
||||
QString resourcePath() const;
|
||||
|
||||
|
@ -77,6 +77,8 @@ public:
|
||||
}
|
||||
void removeTab(int index) {
|
||||
m_tabs.removeAt(index);
|
||||
if ( m_currentIndex >= m_tabs.length() )
|
||||
m_currentIndex = m_tabs.length() - 1;
|
||||
}
|
||||
void updateTabNameIcon(int index, const QIcon &icon, const QString &label);
|
||||
void setCurrentIndex(int index);
|
||||
|
@ -86,6 +86,8 @@ public:
|
||||
|
||||
virtual QSettings *settings() const = 0;
|
||||
virtual SettingsDatabase *settingsDatabase() const = 0;
|
||||
virtual void readMainSettings(QSettings* qs) = 0;
|
||||
virtual void saveMainSettings(QSettings* qs) = 0;
|
||||
|
||||
virtual QString resourcePath() const = 0;
|
||||
|
||||
|
@ -270,16 +270,11 @@ void MainWindow::extensionsInitialized()
|
||||
{
|
||||
|
||||
m_uavGadgetInstanceManager = new UAVGadgetInstanceManager(this);
|
||||
m_uavGadgetInstanceManager->readConfigurations();
|
||||
|
||||
createWorkspaces();
|
||||
|
||||
m_viewManager->extensionsInitalized();
|
||||
m_uavGadgetInstanceManager->readConfigurations(m_settings);
|
||||
|
||||
m_messageManager->init();
|
||||
readSettings(m_settings);
|
||||
|
||||
m_actionManager->initialize();
|
||||
readSettings();
|
||||
updateContext();
|
||||
|
||||
emit m_coreImpl->coreAboutToOpen();
|
||||
@ -301,7 +296,10 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
}
|
||||
|
||||
emit m_coreImpl->coreAboutToClose();
|
||||
writeSettings();
|
||||
saveSettings(m_settings);
|
||||
|
||||
m_uavGadgetInstanceManager->writeConfigurations(m_settings);
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
@ -916,32 +914,40 @@ void MainWindow::shutdown()
|
||||
}
|
||||
|
||||
void MainWindow::createWorkspaces() {
|
||||
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
|
||||
m_settings->beginGroup(QLatin1String("Workspace"));
|
||||
const int numberOfWorkspaces = m_settings->value(QLatin1String("NumberOfWorkspaces"), 2).toInt();
|
||||
|
||||
UAVGadgetMode *uavGadgetMode;
|
||||
Core::UAVGadgetManager *m_uavGadgetManager;
|
||||
for (int i = 1; i <= numberOfWorkspaces; ++i) {
|
||||
Core::UAVGadgetManager *uavGadgetManager;
|
||||
|
||||
m_uavGadgetManager = new Core::UAVGadgetManager(CoreImpl::instance(), this);
|
||||
m_uavGadgetManager->hide();
|
||||
QString numberString = QString::number(i);
|
||||
QString defaultName = "Workspace" + numberString;
|
||||
QString defaultIconName = "Icon" + numberString;
|
||||
const QString name = m_settings->value(defaultName, defaultName).toString();
|
||||
const QString iconName = m_settings->value(defaultIconName, ":/core/images/openpilot_logo_64.png").toString();
|
||||
while (!m_uavGadgetModes.isEmpty()){
|
||||
pm->removeObject(m_uavGadgetModes.takeFirst());
|
||||
}
|
||||
while (!m_uavGadgetManagers.isEmpty()){
|
||||
Core::UAVGadgetManager* uavGadgetManager = m_uavGadgetManagers.takeLast();
|
||||
uavGadgetManager->removeAllSplits();
|
||||
// TODO Fixthis: This only happens, when settings are reloaded.
|
||||
// then the old GadgetManagers should be deleted, but if
|
||||
// I delete them the GCS segfaults.
|
||||
//delete uavGadgetManager;
|
||||
}
|
||||
m_uavGadgetManagers.clear();
|
||||
m_uavGadgetModes.clear();
|
||||
for (int i = 0; i < m_workspaceSettings->numberOfWorkspaces(); ++i) {
|
||||
|
||||
uavGadgetMode = new UAVGadgetMode(m_uavGadgetManager, name,
|
||||
QIcon(iconName), 90-i, QString("Mode" + numberString));
|
||||
m_uavGadgetManager->setUAVGadgetMode(uavGadgetMode);
|
||||
uavGadgetManager = new Core::UAVGadgetManager(CoreImpl::instance(), this);
|
||||
uavGadgetManager->hide();
|
||||
const QString name = m_workspaceSettings->name(i);
|
||||
const QString iconName = m_workspaceSettings->iconName(i);
|
||||
const QString modeName = m_workspaceSettings->modeName(i);
|
||||
|
||||
uavGadgetMode = new UAVGadgetMode(uavGadgetManager, name,
|
||||
QIcon(iconName), 90-i+1, modeName);
|
||||
uavGadgetManager->setUAVGadgetMode(uavGadgetMode);
|
||||
m_uavGadgetModes.append(uavGadgetMode);
|
||||
pm->addObject(uavGadgetMode);
|
||||
addUAVGadgetManager(m_uavGadgetManager);
|
||||
addUAVGadgetManager(uavGadgetManager);
|
||||
}
|
||||
|
||||
m_settings->endGroup();
|
||||
}
|
||||
|
||||
static const char *settingsGroup = "MainWindow";
|
||||
@ -952,53 +958,73 @@ static const char *fullScreenKey = "FullScreen";
|
||||
|
||||
void MainWindow::readSettings()
|
||||
{
|
||||
m_settings->beginGroup(QLatin1String(settingsGroup));
|
||||
readSettings(m_settings);
|
||||
}
|
||||
|
||||
Utils::StyleHelper::setBaseColor(m_settings->value(QLatin1String(colorKey)).value<QColor>());
|
||||
void MainWindow::readSettings(QSettings* qs)
|
||||
{
|
||||
|
||||
const QVariant geom = m_settings->value(QLatin1String(geometryKey));
|
||||
m_actionManager->readSettings(qs);
|
||||
|
||||
qs->beginGroup(QLatin1String(settingsGroup));
|
||||
|
||||
Utils::StyleHelper::setBaseColor(qs->value(QLatin1String(colorKey)).value<QColor>());
|
||||
|
||||
const QVariant geom = qs->value(QLatin1String(geometryKey));
|
||||
if (geom.isValid()) {
|
||||
setGeometry(geom.toRect());
|
||||
} else {
|
||||
resize(750, 400);
|
||||
}
|
||||
if (m_settings->value(QLatin1String(maxKey), false).toBool())
|
||||
if (qs->value(QLatin1String(maxKey), false).toBool())
|
||||
setWindowState(Qt::WindowMaximized);
|
||||
setFullScreen(m_settings->value(QLatin1String(fullScreenKey), false).toBool());
|
||||
setFullScreen(qs->value(QLatin1String(fullScreenKey), false).toBool());
|
||||
|
||||
m_settings->endGroup();
|
||||
qs->endGroup();
|
||||
|
||||
m_workspaceSettings->readSettings(qs);
|
||||
|
||||
createWorkspaces();
|
||||
|
||||
foreach (UAVGadgetManager *manager, m_uavGadgetManagers) {
|
||||
manager->readSettings();
|
||||
manager->readSettings(qs);
|
||||
}
|
||||
// m_rightPaneWidget->readSettings(m_settings);
|
||||
|
||||
m_viewManager->readSettings(qs);
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::writeSettings()
|
||||
void MainWindow::saveSettings()
|
||||
{
|
||||
m_settings->beginGroup(QLatin1String(settingsGroup));
|
||||
saveSettings(m_settings);
|
||||
}
|
||||
|
||||
m_settings->setValue(QLatin1String(colorKey), Utils::StyleHelper::baseColor());
|
||||
void MainWindow::saveSettings(QSettings* qs)
|
||||
{
|
||||
m_workspaceSettings->saveSettings(qs);
|
||||
|
||||
qs->beginGroup(QLatin1String(settingsGroup));
|
||||
|
||||
qs->setValue(QLatin1String(colorKey), Utils::StyleHelper::baseColor());
|
||||
|
||||
if (windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen)) {
|
||||
m_settings->setValue(QLatin1String(maxKey), (bool) (windowState() & Qt::WindowMaximized));
|
||||
m_settings->setValue(QLatin1String(fullScreenKey), (bool) (windowState() & Qt::WindowFullScreen));
|
||||
qs->setValue(QLatin1String(maxKey), (bool) (windowState() & Qt::WindowMaximized));
|
||||
qs->setValue(QLatin1String(fullScreenKey), (bool) (windowState() & Qt::WindowFullScreen));
|
||||
} else {
|
||||
m_settings->setValue(QLatin1String(maxKey), false);
|
||||
m_settings->setValue(QLatin1String(fullScreenKey), false);
|
||||
m_settings->setValue(QLatin1String(geometryKey), geometry());
|
||||
qs->setValue(QLatin1String(maxKey), false);
|
||||
qs->setValue(QLatin1String(fullScreenKey), false);
|
||||
qs->setValue(QLatin1String(geometryKey), geometry());
|
||||
}
|
||||
|
||||
m_settings->endGroup();
|
||||
|
||||
m_viewManager->saveSettings(m_settings);
|
||||
m_actionManager->saveSettings(m_settings);
|
||||
|
||||
m_uavGadgetInstanceManager->writeConfigurations();
|
||||
qs->endGroup();
|
||||
|
||||
foreach (UAVGadgetManager *manager, m_uavGadgetManagers) {
|
||||
manager->saveSettings();
|
||||
manager->saveSettings(qs);
|
||||
}
|
||||
|
||||
m_viewManager->saveSettings(qs);
|
||||
m_actionManager->saveSettings(qs);
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::addAdditionalContext(int context)
|
||||
|
@ -91,7 +91,8 @@ public:
|
||||
void addContextObject(IContext *contex);
|
||||
void removeContextObject(IContext *contex);
|
||||
void resetContext();
|
||||
|
||||
void readSettings(QSettings* qs);
|
||||
void saveSettings(QSettings* qs);
|
||||
void openFiles(const QStringList &fileNames);
|
||||
|
||||
Core::ActionManager *actionManager() const;
|
||||
@ -162,7 +163,7 @@ private:
|
||||
|
||||
void createWorkspaces();
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
void saveSettings();
|
||||
|
||||
CoreImpl *m_coreImpl;
|
||||
UniqueIDManager *m_uniqueIDManager;
|
||||
|
@ -67,13 +67,11 @@ UAVGadgetInstanceManager::~UAVGadgetInstanceManager()
|
||||
}
|
||||
}
|
||||
|
||||
void UAVGadgetInstanceManager::readConfigurations()
|
||||
{
|
||||
readConfigurations(Core::ICore::instance()->settings());
|
||||
}
|
||||
|
||||
void UAVGadgetInstanceManager::readConfigurations(QSettings *qs)
|
||||
{
|
||||
while ( !m_configurations.isEmpty() ){
|
||||
emit configurationToBeDeleted(m_configurations.takeLast());
|
||||
}
|
||||
qs->beginGroup("UAVGadgetConfigurations");
|
||||
foreach (QString classId, m_classIds.keys())
|
||||
{
|
||||
@ -121,11 +119,6 @@ void UAVGadgetInstanceManager::readConfigurations(QSettings *qs)
|
||||
createOptionsPages();
|
||||
}
|
||||
|
||||
void UAVGadgetInstanceManager::writeConfigurations()
|
||||
{
|
||||
writeConfigurations(Core::ICore::instance()->settings());
|
||||
}
|
||||
|
||||
void UAVGadgetInstanceManager::writeConfigurations(QSettings *qs)
|
||||
{
|
||||
qs->beginGroup("UAVGadgetConfigurations");
|
||||
|
@ -57,9 +57,7 @@ Q_OBJECT
|
||||
public:
|
||||
explicit UAVGadgetInstanceManager(QObject *parent = 0);
|
||||
~UAVGadgetInstanceManager();
|
||||
void readConfigurations();
|
||||
void readConfigurations(QSettings *qs);
|
||||
void writeConfigurations();
|
||||
void writeConfigurations(QSettings *qs);
|
||||
IUAVGadget *createGadget(QString classId, QWidget *parent);
|
||||
void removeGadget(IUAVGadget *gadget);
|
||||
|
@ -52,7 +52,6 @@
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QProcess>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QApplication>
|
||||
@ -466,12 +465,11 @@ bool UAVGadgetManager::restoreState(const QByteArray &state)
|
||||
}
|
||||
|
||||
|
||||
void UAVGadgetManager::saveSettings()
|
||||
void UAVGadgetManager::saveSettings(QSettings *qs)
|
||||
{
|
||||
QString defaultUAVGadgetManagerKey = QString("UAVGadgetManager/") + m_uavGadgetMode->uniqueModeName() + "/DefaultSettings";
|
||||
QString uavGadgetManagerKey = QString("UAVGadgetManager/") + m_uavGadgetMode->uniqueModeName() + "/Settings";
|
||||
|
||||
QSettings *qs = m_d->m_core->settings();
|
||||
// The idea is to have a default setting that is only written once
|
||||
if (!qs->contains(defaultUAVGadgetManagerKey))
|
||||
qs->setValue(defaultUAVGadgetManagerKey, saveState().toBase64());
|
||||
@ -479,12 +477,11 @@ void UAVGadgetManager::saveSettings()
|
||||
qs->setValue(uavGadgetManagerKey, saveState().toBase64());
|
||||
}
|
||||
|
||||
void UAVGadgetManager::readSettings()
|
||||
void UAVGadgetManager::readSettings(QSettings *qs)
|
||||
{
|
||||
QString defaultUAVGadgetManagerKey = QString("UAVGadgetManager/") + m_uavGadgetMode->uniqueModeName() + "/DefaultSettings";
|
||||
QString uavGadgetManagerKey = QString("UAVGadgetManager/") + m_uavGadgetMode->uniqueModeName() + "/Settings";
|
||||
|
||||
QSettings *qs = m_d->m_core->settings();
|
||||
QString key("");
|
||||
if (qs->contains(uavGadgetManagerKey))
|
||||
key = uavGadgetManagerKey;
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSettings;
|
||||
@ -98,8 +99,8 @@ public:
|
||||
QByteArray saveState() const;
|
||||
bool restoreState(const QByteArray &state);
|
||||
|
||||
void saveSettings();
|
||||
void readSettings();
|
||||
void saveSettings(QSettings* qs);
|
||||
void readSettings(QSettings* qs);
|
||||
bool toolbarsShown() { return m_showToolbars; }
|
||||
|
||||
signals:
|
||||
|
@ -97,9 +97,8 @@ void ViewManager::aboutToRemoveObject(QObject *obj)
|
||||
m_mainWnd->removeContextObject(view);
|
||||
}
|
||||
|
||||
void ViewManager::extensionsInitalized()
|
||||
void ViewManager::readSettings(QSettings *settings)
|
||||
{
|
||||
QSettings *settings = m_mainWnd->settings();
|
||||
m_mainWnd->restoreState(settings->value(QLatin1String("ViewGroup_Default"), QByteArray()).toByteArray());
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
~ViewManager();
|
||||
|
||||
void init();
|
||||
void extensionsInitalized();
|
||||
void readSettings(QSettings *settings);
|
||||
void saveSettings(QSettings *settings);
|
||||
|
||||
IView * view(const QString & id);
|
||||
|
@ -76,29 +76,16 @@ QWidget *WorkspaceSettings::createPage(QWidget *parent)
|
||||
QWidget *w = new QWidget(parent);
|
||||
m_page->setupUi(w);
|
||||
|
||||
// Read workspaces from settings
|
||||
m_page->numberOfWorkspacesSpinBox->setMaximum(MAX_WORKSPACES);
|
||||
m_modeManager = Core::ICore::instance()->modeManager();
|
||||
m_settings = Core::ICore::instance()->settings();
|
||||
m_settings->beginGroup(QLatin1String("Workspace"));
|
||||
const int numberOfWorkspaces = m_settings->value(QLatin1String("NumberOfWorkspaces"), 2).toInt();
|
||||
m_page->numberOfWorkspacesSpinBox->setValue(numberOfWorkspaces);
|
||||
for (int i = 1; i <= MAX_WORKSPACES; ++i) {
|
||||
QString numberString = QString::number(i);
|
||||
QString defaultName = "Workspace" + numberString;
|
||||
QString defaultIconName = "Icon" + numberString;
|
||||
const QString name = m_settings->value(defaultName, defaultName).toString();
|
||||
const QString iconName = m_settings->value(defaultIconName, ":/core/images/openpilot_logo_64.png").toString();
|
||||
m_iconNames.append(iconName);
|
||||
m_names.append(name);
|
||||
if (i <= numberOfWorkspaces)
|
||||
m_page->workspaceComboBox->addItem(QIcon(iconName), name);
|
||||
m_page->numberOfWorkspacesSpinBox->setValue(m_numberOfWorkspaces);
|
||||
for (int i = 0; i < m_numberOfWorkspaces; ++i) {
|
||||
m_page->workspaceComboBox->addItem(QIcon(m_iconNames.at(i)), m_names.at(i));
|
||||
}
|
||||
|
||||
m_page->iconPathChooser->setExpectedKind(Utils::PathChooser::File);
|
||||
m_page->iconPathChooser->setPromptDialogFilter(tr("Images (*.png *.jpg *.bmp *.xpm)"));
|
||||
m_page->iconPathChooser->setPromptDialogTitle(tr("Choose icon"));
|
||||
|
||||
m_settings->endGroup();
|
||||
|
||||
connect(m_page->workspaceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectWorkspace(int)));
|
||||
connect(m_page->numberOfWorkspacesSpinBox, SIGNAL(valueChanged(int)), this, SLOT(numberOfWorkspacesChanged(int)));
|
||||
@ -111,25 +98,53 @@ QWidget *WorkspaceSettings::createPage(QWidget *parent)
|
||||
return w;
|
||||
}
|
||||
|
||||
void WorkspaceSettings::apply()
|
||||
void WorkspaceSettings::readSettings(QSettings* qs)
|
||||
{
|
||||
selectWorkspace(m_currentIndex, true);
|
||||
m_iconNames.clear();
|
||||
m_names.clear();
|
||||
|
||||
m_settings->beginGroup(QLatin1String("Workspace"));
|
||||
m_settings->setValue(QLatin1String("NumberOfWorkspaces"), m_page->numberOfWorkspacesSpinBox->value());
|
||||
qs->beginGroup(QLatin1String("Workspace"));
|
||||
m_numberOfWorkspaces = qs->value(QLatin1String("NumberOfWorkspaces"), 2).toInt();
|
||||
for (int i = 1; i <= MAX_WORKSPACES; ++i) {
|
||||
QString numberString = QString::number(i);
|
||||
QString defaultName = "Workspace" + numberString;
|
||||
QString defaultIconName = "Icon" + numberString;
|
||||
m_settings->setValue(defaultName, m_names.at(i-1));
|
||||
m_settings->setValue(defaultIconName, m_iconNames.at(i-1));
|
||||
QString modeName = "Mode" + numberString;
|
||||
Core::Internal::UAVGadgetMode *mode = qobject_cast<Core::Internal::UAVGadgetMode*>(m_modeManager->mode(modeName));
|
||||
const QString name = qs->value(defaultName, defaultName).toString();
|
||||
const QString iconName = qs->value(defaultIconName, ":/core/images/openpilot_logo_64.png").toString();
|
||||
m_iconNames.append(iconName);
|
||||
m_names.append(name);
|
||||
}
|
||||
qs->endGroup();
|
||||
}
|
||||
|
||||
void WorkspaceSettings::saveSettings(QSettings* qs)
|
||||
{
|
||||
qs->beginGroup(QLatin1String("Workspace"));
|
||||
qs->setValue(QLatin1String("NumberOfWorkspaces"), m_numberOfWorkspaces);
|
||||
for (int i = 0; i < MAX_WORKSPACES; ++i) {
|
||||
QString numberString = QString::number(i+1);
|
||||
QString defaultName = "Workspace" + numberString;
|
||||
QString defaultIconName = "Icon" + numberString;
|
||||
qs->setValue(defaultName, m_names.at(i));
|
||||
qs->setValue(defaultIconName, m_iconNames.at(i));
|
||||
}
|
||||
qs->endGroup();
|
||||
}
|
||||
|
||||
void WorkspaceSettings::apply()
|
||||
{
|
||||
selectWorkspace(m_currentIndex, true);
|
||||
|
||||
saveSettings(Core::ICore::instance()->settings());
|
||||
|
||||
ModeManager* modeManager = Core::ICore::instance()->modeManager();
|
||||
for (int i = 0; i < MAX_WORKSPACES; ++i) {
|
||||
Core::Internal::UAVGadgetMode *mode =
|
||||
qobject_cast<Core::Internal::UAVGadgetMode*>(modeManager->mode(modeName(i)));
|
||||
if (mode) {
|
||||
m_modeManager->updateModeNameIcon(mode, QIcon(m_iconNames.at(i-1)), m_names.at(i-1));
|
||||
modeManager->updateModeNameIcon(mode, QIcon(iconName(i)), name(i));
|
||||
}
|
||||
}
|
||||
m_settings->endGroup();
|
||||
|
||||
}
|
||||
|
||||
@ -151,6 +166,7 @@ void WorkspaceSettings::iconChanged()
|
||||
|
||||
void WorkspaceSettings::numberOfWorkspacesChanged(int value)
|
||||
{
|
||||
m_numberOfWorkspaces = value;
|
||||
int count = m_page->workspaceComboBox->count();
|
||||
if (value > count) {
|
||||
for (int i = count; i < value; ++i) {
|
||||
|
@ -60,6 +60,12 @@ public:
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void apply();
|
||||
void finish();
|
||||
void readSettings(QSettings* qs);
|
||||
void saveSettings(QSettings* qs);
|
||||
int numberOfWorkspaces() const { return m_numberOfWorkspaces;}
|
||||
QString iconName(int i) const { return m_iconNames.at(i);}
|
||||
QString name(int i) const { return m_names.at(i);}
|
||||
QString modeName(int i) const { return QString("Mode")+ QString::number(i+1);}
|
||||
|
||||
signals:
|
||||
|
||||
@ -70,13 +76,13 @@ public slots:
|
||||
void iconChanged();
|
||||
private:
|
||||
Ui::WorkspaceSettings *m_page;
|
||||
QSettings *m_settings;
|
||||
ModeManager *m_modeManager;
|
||||
QStringList m_iconNames;
|
||||
QStringList m_names;
|
||||
int m_currentIndex;
|
||||
int m_numberOfWorkspaces;
|
||||
static const int MAX_WORKSPACES;
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@ -3,7 +3,6 @@ TARGET = ImportExportGadget
|
||||
DEFINES += IMPORTEXPORT_LIBRARY
|
||||
QT += svg
|
||||
include(../../openpilotgcsplugin.pri)
|
||||
include(../../plugins/coreplugin/coreplugin.pri)
|
||||
include(importexport_dependencies.pri)
|
||||
HEADERS += importexportplugin.h \
|
||||
importexportgadgetwidget.h
|
||||
|
@ -3,25 +3,25 @@
|
||||
*
|
||||
* @file importexport_global.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup importexportplugin
|
||||
* @{
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
* 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.,
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
@ -2,10 +2,12 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* @file importexportgadget.cpp
|
||||
* @author Erhard Siegl Copyright (C) 2010.
|
||||
* @brief
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup importexportplugin
|
||||
* @brief Gadget for Import/Export Plugin
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup importexportplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
@ -50,3 +52,7 @@ void ImportExportGadget::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||
ImportExportGadgetConfiguration *m = qobject_cast<ImportExportGadgetConfiguration*>(config);
|
||||
m_widget->setDialFile(m->getDialFile());
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
@ -1,13 +1,12 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file importexportgadget.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief Bargraph gadget with red/yellow/green zones
|
||||
* @file
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup importexportplugin
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup importexportplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -45,7 +44,9 @@ public:
|
||||
ImportExportGadget(QString classId, ImportExportGadgetWidget *widget, QWidget *parent = 0);
|
||||
~ImportExportGadget();
|
||||
|
||||
QWidget *widget() { return m_widget; }
|
||||
QWidget *widget() {
|
||||
return m_widget;
|
||||
}
|
||||
void loadConfiguration(IUAVGadgetConfiguration* config);
|
||||
|
||||
private:
|
||||
@ -54,3 +55,8 @@ private:
|
||||
|
||||
|
||||
#endif // IMPORTEXPORTGADGET_H_
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
@ -3,9 +3,11 @@
|
||||
*
|
||||
* @file importexportgadgetconfiguration.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Linear dial Plugin Gadget configuration
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup importexportplugin
|
||||
* @brief Configuration for Import/Export Plugin
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup importexportplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
@ -33,8 +35,8 @@
|
||||
*
|
||||
*/
|
||||
ImportExportGadgetConfiguration::ImportExportGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
|
||||
IUAVGadgetConfiguration(classId, parent),
|
||||
dialFile("gcs.ini")
|
||||
IUAVGadgetConfiguration(classId, parent),
|
||||
dialFile("gcs.ini")
|
||||
{
|
||||
//if a saved configuration exists load it
|
||||
if (state.count() > 0) {
|
||||
@ -49,7 +51,7 @@ ImportExportGadgetConfiguration::ImportExportGadgetConfiguration(QString classId
|
||||
IUAVGadgetConfiguration *ImportExportGadgetConfiguration::clone()
|
||||
{
|
||||
ImportExportGadgetConfiguration *m = new ImportExportGadgetConfiguration(this->classId());
|
||||
m->dialFile=dialFile;
|
||||
m->dialFile = dialFile;
|
||||
return m;
|
||||
}
|
||||
/**
|
||||
@ -63,3 +65,8 @@ QByteArray ImportExportGadgetConfiguration::saveState() const
|
||||
stream << dialFile;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
@ -1,13 +1,12 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file importexportgadgetconfiguration.h
|
||||
* @file
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Airspeed Plugin Gadget configuration
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup importexportplugin
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup importexportplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -38,15 +37,19 @@ using namespace Core;
|
||||
*/
|
||||
class IMPORTEXPORT_EXPORT ImportExportGadgetConfiguration : public IUAVGadgetConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ImportExportGadgetConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0);
|
||||
|
||||
//set dial configuration functions
|
||||
void setDialFile(QString filename){dialFile=filename;}
|
||||
void setDialFile(QString filename) {
|
||||
dialFile = filename;
|
||||
}
|
||||
|
||||
//get dial configuration functions
|
||||
QString getDialFile() {return dialFile;}
|
||||
QString getDialFile() {
|
||||
return dialFile;
|
||||
}
|
||||
|
||||
QByteArray saveState() const;
|
||||
IUAVGadgetConfiguration *clone();
|
||||
@ -56,3 +59,7 @@ private:
|
||||
};
|
||||
|
||||
#endif // IMPORTEXPORTGADGETCONFIGURATION_H
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
@ -2,10 +2,12 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* @file importexportgadgetfactory.cpp
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup importexportplugin
|
||||
* @brief Factory for Import/Export Plugin
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup importexportplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
@ -58,3 +60,7 @@ IOptionsPage *ImportExportGadgetFactory::createOptionsPage(IUAVGadgetConfigurati
|
||||
return new ImportExportGadgetOptionsPage(qobject_cast<ImportExportGadgetConfiguration*>(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
@ -1,13 +1,12 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file importexportgadgetfactory.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @file
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup importexportplugin
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup importexportplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -31,7 +30,8 @@
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
#include "importexport_global.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Core
|
||||
{
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
@ -51,3 +51,7 @@ public:
|
||||
};
|
||||
|
||||
#endif // IMPORTEXPORTGADGETFACTORY_H_
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
@ -3,9 +3,11 @@
|
||||
*
|
||||
* @file importexportgadgetoptionspage.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Linear Dial Plugin Gadget options page
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup importexportplugin
|
||||
* @brief Option page for Import/Export Plugin
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup importexportplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
@ -70,4 +72,7 @@ void ImportExportGadgetOptionsPage::finish()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
@ -1,13 +1,12 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file importexportgadgetoptionspage.h
|
||||
* @file
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Linear Dial Plugin Gadget options page
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup importexportplugin
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup importexportplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -35,21 +34,23 @@
|
||||
#include <QStringList>
|
||||
#include <QDebug>
|
||||
|
||||
namespace Core {
|
||||
namespace Core
|
||||
{
|
||||
class IUAVGadgetConfiguration;
|
||||
}
|
||||
|
||||
class ImportExportGadgetConfiguration;
|
||||
|
||||
namespace Ui {
|
||||
class ImportExportGadgetOptionsPage;
|
||||
namespace Ui
|
||||
{
|
||||
class ImportExportGadgetOptionsPage;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class IMPORTEXPORT_EXPORT ImportExportGadgetOptionsPage : public IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ImportExportGadgetOptionsPage(ImportExportGadgetConfiguration *config, QObject *parent = 0);
|
||||
|
||||
@ -67,3 +68,7 @@ private slots:
|
||||
};
|
||||
|
||||
#endif // IMPORTEXPORTGADGETOPTIONSPAGE_H
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
@ -1,3 +1,31 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file importexportgadgetwidget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @brief Widget for Import/Export Plugin
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup importexportplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#include "importexportgadgetwidget.h"
|
||||
#include "ui_importexportgadgetwidget.h"
|
||||
#include "coreplugin/uavgadgetinstancemanager.h"
|
||||
@ -5,10 +33,14 @@
|
||||
#include <QtDebug>
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
#include <QFileInfo>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include <QDir>
|
||||
|
||||
ImportExportGadgetWidget::ImportExportGadgetWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::ImportExportGadgetWidget)
|
||||
QWidget(parent),
|
||||
ui(new Ui::ImportExportGadgetWidget)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
ui->setupUi(this);
|
||||
@ -39,11 +71,19 @@ void ImportExportGadgetWidget::setDialFile(const QString& filename)
|
||||
void ImportExportGadgetWidget::on_exportButton_clicked()
|
||||
{
|
||||
QString file = ui->configFile->text();
|
||||
qDebug() << "Export pressed! Write to file " << file;
|
||||
exportConfiguration(file);
|
||||
qDebug() << "Export pressed! Write to file " << QFileInfo(file).absoluteFilePath();
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("The settings have been exported to ") + file);
|
||||
QDir dir = QFileInfo(file).absoluteDir();
|
||||
if (! dir.exists()) {
|
||||
msgBox.setText(tr("Can't write file ") + QFileInfo(file).absoluteFilePath()
|
||||
+ " since directory "+ dir.absolutePath() + " doesn't exist!");
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
exportConfiguration(file);
|
||||
|
||||
msgBox.setText(tr("The settings have been exported to ") + QFileInfo(file).absoluteFilePath());
|
||||
msgBox.exec();
|
||||
|
||||
}
|
||||
@ -51,12 +91,17 @@ void ImportExportGadgetWidget::on_exportButton_clicked()
|
||||
|
||||
void ImportExportGadgetWidget::exportConfiguration(const QString& fileName)
|
||||
{
|
||||
bool general = ui->checkBoxGeneral;
|
||||
bool allGadgets = ui->checkBoxAllGadgets;
|
||||
|
||||
QSettings qs(fileName, QSettings::defaultFormat());
|
||||
|
||||
Core::UAVGadgetInstanceManager *im;
|
||||
im = Core::ICore::instance()->uavGadgetInstanceManager();
|
||||
im->writeConfigurations(&qs);
|
||||
|
||||
if (general) {
|
||||
Core::ICore::instance()->saveMainSettings(&qs);
|
||||
}
|
||||
if (allGadgets) {
|
||||
Core::ICore::instance()->uavGadgetInstanceManager()->writeConfigurations(&qs);
|
||||
}
|
||||
qDebug() << "Export ended";
|
||||
}
|
||||
|
||||
@ -69,22 +114,44 @@ void ImportExportGadgetWidget::writeError(const QString& msg) const
|
||||
void ImportExportGadgetWidget::on_importButton_clicked()
|
||||
{
|
||||
QString file = ui->configFile->text();
|
||||
qDebug() << "Import pressed! Read from file " << file;
|
||||
qDebug() << "Import pressed! Read from file " << QFileInfo(file).absoluteFilePath();
|
||||
QMessageBox msgBox;
|
||||
if (! QFileInfo(file).isReadable()) {
|
||||
msgBox.setText(tr("Can't read file ") + QFileInfo(file).absoluteFilePath());
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
importConfiguration(file);
|
||||
|
||||
// The new configs are added to the old configs. Things are messy now.
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("The settings have been imported. Restart the application."));
|
||||
msgBox.setText(tr("The settings have been imported from ") + QFileInfo(file).absoluteFilePath()
|
||||
+ tr(". Restart the application."));
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
void ImportExportGadgetWidget::importConfiguration(const QString& fileName)
|
||||
{
|
||||
bool general = ui->checkBoxGeneral;
|
||||
bool allGadgets = ui->checkBoxAllGadgets;
|
||||
|
||||
QSettings qs(fileName, QSettings::defaultFormat());
|
||||
|
||||
Core::UAVGadgetInstanceManager *im;
|
||||
im = Core::ICore::instance()->uavGadgetInstanceManager();
|
||||
im->readConfigurations(&qs);
|
||||
if (allGadgets) {
|
||||
Core::ICore::instance()->uavGadgetInstanceManager()->readConfigurations(&qs);
|
||||
}
|
||||
if (general) {
|
||||
Core::ICore::instance()->readMainSettings(&qs);
|
||||
}
|
||||
|
||||
|
||||
qDebug() << "Import ended";
|
||||
}
|
||||
|
||||
void ImportExportGadgetWidget::on_helpButton_clicked()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("http://wiki.openpilot.org/Import_Export_plugin"));
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
@ -1,3 +1,13 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup importexportplugin
|
||||
* @{
|
||||
*****************************************************************************/
|
||||
#ifndef IMPORTEXPORTGADGETWIDGET_H
|
||||
#define IMPORTEXPORTGADGETWIDGET_H
|
||||
|
||||
@ -5,11 +15,13 @@
|
||||
#include <QString>
|
||||
#include "importexport_global.h"
|
||||
|
||||
namespace Ui {
|
||||
class ImportExportGadgetWidget;
|
||||
namespace Ui
|
||||
{
|
||||
class ImportExportGadgetWidget;
|
||||
}
|
||||
|
||||
class IMPORTEXPORT_EXPORT ImportExportGadgetWidget : public QWidget {
|
||||
class IMPORTEXPORT_EXPORT ImportExportGadgetWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ImportExportGadgetWidget(QWidget *parent = 0);
|
||||
@ -27,8 +39,13 @@ private:
|
||||
void importConfiguration(const QString& fileName);
|
||||
|
||||
private slots:
|
||||
void on_helpButton_clicked();
|
||||
void on_importButton_clicked();
|
||||
void on_exportButton_clicked();
|
||||
};
|
||||
|
||||
#endif // IMPORTEXPORTGADGETWIDGET_H
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
@ -6,88 +6,101 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>296</width>
|
||||
<height>222</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QLineEdit" name="configFile">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>80</y>
|
||||
<width>251</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>80</y>
|
||||
<width>81</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Config File</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>331</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>This is highly experimental. Use at own risk.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="exportButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>120</y>
|
||||
<width>83</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Export</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="importButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>260</x>
|
||||
<y>120</y>
|
||||
<width>88</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Import</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>40</y>
|
||||
<width>331</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Please report bugs!</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>This is experimental. Use at own risk.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Please report bugs!</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Config File</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="configFile"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Items</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxGeneral">
|
||||
<property name="text">
|
||||
<string>General (Workspace, Key-Bindings)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxAllGadgets">
|
||||
<property name="text">
|
||||
<string>All Gadgets</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="exportButton">
|
||||
<property name="text">
|
||||
<string>Export</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="importButton">
|
||||
<property name="text">
|
||||
<string>Import</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="helpButton">
|
||||
<property name="text">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -1,10 +1,12 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file importexportplugin.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @file importexportplugin.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @brief Import/Export Plugin
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @defgroup importexportplugin
|
||||
* @{
|
||||
*
|
||||
@ -35,32 +37,36 @@
|
||||
|
||||
ImportExportPlugin::ImportExportPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
ImportExportPlugin::~ImportExportPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool ImportExportPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mf = new ImportExportGadgetFactory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mf = new ImportExportGadgetFactory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImportExportPlugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void ImportExportPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(ImportExportPlugin)
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
@ -1,13 +1,12 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file importexportplugin.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @file
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup importexportplugin
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup importexportplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -36,13 +35,17 @@ class ImportExportGadgetFactory;
|
||||
class IMPORTEXPORT_EXPORT ImportExportPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
ImportExportPlugin();
|
||||
~ImportExportPlugin();
|
||||
ImportExportPlugin();
|
||||
~ImportExportPlugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
ImportExportGadgetFactory *mf;
|
||||
ImportExportGadgetFactory *mf;
|
||||
};
|
||||
#endif /* IMPORTEXPORTPLUGIN_H_ */
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user