1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

OP-38 ConfigGadget - just the inicial classes

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@528 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pedro 2010-04-19 21:02:15 +00:00 committed by pedro
parent 28cd8f002b
commit 87aae1ea77
15 changed files with 667 additions and 0 deletions

View File

@ -0,0 +1,10 @@
<plugin name="Config" version="0.0.1" compatVersion="1.3.1">
<vendor>The OpenPilot Project</vendor>
<copyright>(C) 2010 OpenPilot Project</copyright>
<license>Your License goes here</license>
<description>A plugin that does nothing!</description>
<url>http://www.openpilot.org</url>
<dependencyList>
<dependency name="Core" version="1.0.0"/>
</dependencyList>
</plugin>

View File

@ -0,0 +1,17 @@
TEMPLATE = lib
TARGET = Config
include(../../openpilotgcsplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
OTHER_FILES += config.pluginspec
HEADERS += configplugin.h \
configgadgetconfiguration.h \
configgadgetwidget.h \
configgadgetfactory.h \
configgadgetoptionspage.h \
configgadget.h
SOURCES += configplugin.cpp \
configgadgetconfiguration.cpp \
configgadgetwidget.cpp \
configgadgetfactory.cpp \
configgadgetoptionspage.cpp \
configgadget.cpp

View File

@ -0,0 +1,30 @@
/**
******************************************************************************
*
* @file configgadgetfactory.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup map
* @{
*
*****************************************************************************/
/*
* 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 CONFIGFACTORY_H
#define CONFIGFACTORY_H
#endif // CONFIGFACTORY_H

View File

@ -0,0 +1,46 @@
/**
******************************************************************************
*
* @file configgadget.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup map
* @{
*
*****************************************************************************/
/*
* 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 "configgadget.h"
#include "configgadgetwidget.h"
#include "configgadgetconfiguration.h"
ConfigGadget::ConfigGadget(QString classId, ConfigGadgetWidget *widget, QWidget *parent) :
IUAVGadget(classId, parent),
m_widget(widget)
{
}
ConfigGadget::~ConfigGadget()
{
}
void ConfigGadget::loadConfiguration(IUAVGadgetConfiguration* config)
{
}

View File

@ -0,0 +1,56 @@
/**
******************************************************************************
*
* @file configgadget.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup config
* @{
*
*****************************************************************************/
/*
* 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 CONFIGGADGET_H
#define CONFIGGADGET_H
#include <coreplugin/iuavgadget.h>
#include "configgadgetwidget.h"
class IUAVGadget;
//class QList<int>;
class QWidget;
class QString;
class ConfigGadgetWidget;
using namespace Core;
class ConfigGadget : public Core::IUAVGadget
{
Q_OBJECT
public:
ConfigGadget(QString classId, ConfigGadgetWidget *widget, QWidget *parent = 0);
~ConfigGadget();
QWidget *widget() { return m_widget; }
void loadConfiguration(IUAVGadgetConfiguration* config);
private:
ConfigGadgetWidget *m_widget;
};
#endif // CONFIGGADGET_H

View File

@ -0,0 +1,48 @@
/**
******************************************************************************
*
* @file configgadgetconfiguration.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup config
* @{
*
*****************************************************************************/
/*
* 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 "configgadgetconfiguration.h"
#include <QtCore/QDataStream>
ConfigGadgetConfiguration::ConfigGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent)
{
}
IUAVGadgetConfiguration *ConfigGadgetConfiguration::clone()
{
ConfigGadgetConfiguration *m = new ConfigGadgetConfiguration(this->classId());
return m;
}
QByteArray ConfigGadgetConfiguration::saveState() const
{
QByteArray bytes;
QDataStream stream(&bytes, QIODevice::WriteOnly);
return bytes;
}

View File

@ -0,0 +1,45 @@
/**
******************************************************************************
*
* @file configgadgetfactory.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup config
* @{
*
*****************************************************************************/
/*
* 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 CONFIGGADGETCONFIGURATION_H
#define CONFIGGADGETCONFIGURATION_H
#include <coreplugin/iuavgadgetconfiguration.h>
using namespace Core;
class ConfigGadgetConfiguration : public IUAVGadgetConfiguration
{
Q_OBJECT
public:
explicit ConfigGadgetConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0);
QByteArray saveState() const;
IUAVGadgetConfiguration *clone();
};
#endif // CONFIGGADGETCONFIGURATION_H

View File

@ -0,0 +1,57 @@
/**
******************************************************************************
*
* @file configgadgetfactory.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup config
* @{
*
*****************************************************************************/
/*
* 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 "configgadgetfactory.h"
#include "configgadgetwidget.h"
#include "configgadget.h"
#include "configgadgetconfiguration.h"
#include "configgadgetoptionspage.h"
#include <coreplugin/iuavgadget.h>
ConfigGadgetFactory::ConfigGadgetFactory(QObject *parent) :
IUAVGadgetFactory(QString("MapGadget"), tr("Map Gadget"), parent)
{
}
ConfigGadgetFactory::~ConfigGadgetFactory()
{
}
Core::IUAVGadget* ConfigGadgetFactory::createGadget(QWidget *parent)
{
ConfigGadgetWidget* gadgetWidget = new ConfigGadgetWidget(parent);
return new ConfigGadget(QString("ConfigGadget"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *ConfigGadgetFactory::createConfiguration(const QByteArray &state)
{
return new ConfigGadgetConfiguration(QString("ConfigGadget"), state);
}
IOptionsPage *ConfigGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
{
return new ConfigGadgetOptionsPage(qobject_cast<ConfigGadgetConfiguration*>(config));
}

View File

@ -0,0 +1,52 @@
/**
******************************************************************************
*
* @file configgadgetfactory.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup map
* @{
*
*****************************************************************************/
/*
* 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 CONFIGGADGETFACTORY_H
#define CONFIGGADGETFACTORY_H
#include <coreplugin/iuavgadgetfactory.h>
namespace Core {
class IUAVGadget;
class IUAVGadgetFactory;
}
using namespace Core;
class ConfigGadgetFactory: public Core::IUAVGadgetFactory
{
Q_OBJECT
public:
ConfigGadgetFactory(QObject *parent = 0);
~ConfigGadgetFactory();
IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};
#endif // CONFIGGADGETFACTORY_H

View File

@ -0,0 +1,47 @@
/**
******************************************************************************
*
* @file configgadgetoptionspage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup config
* @{
*
*****************************************************************************/
/*
* 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 "configgadgetoptionspage.h"
ConfigGadgetOptionsPage::ConfigGadgetOptionsPage(ConfigGadgetConfiguration *config, QObject *parent)
{
//todo:implement
}
QWidget *ConfigGadgetOptionsPage::createPage(QWidget *parent)
{
//todo:implement
return parent;
}
void ConfigGadgetOptionsPage::apply()
{
//todo:implement
}
void ConfigGadgetOptionsPage::finish(){
//todo:implement
}

View File

@ -0,0 +1,51 @@
/**
******************************************************************************
*
* @file configgadgetoptionspage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup config
* @{
*
*****************************************************************************/
/*
* 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 CONFIGGADGETOPTIONSPAGE_H
#define CONFIGGADGETOPTIONSPAGE_H
#include "coreplugin/dialogs/ioptionspage.h"
namespace Core {
class IUAVGadgetConfiguration;
}
using namespace Core;
class ConfigGadgetConfiguration;
class ConfigGadgetOptionsPage : public IOptionsPage
{
public:
Q_OBJECT
public:
explicit ConfigGadgetOptionsPage(ConfigGadgetConfiguration *config, QObject *parent = 0);
QWidget *createPage(QWidget *parent);
void apply();
void finish();
};
#endif // CONFIGGADGETOPTIONSPAGE_H

View File

@ -0,0 +1,55 @@
/**
******************************************************************************
*
* @file configgadgetwidget.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup config
* @{
*
*****************************************************************************/
/*
* 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 "configgadgetwidget.h"
#include <QStringList>
#include <QtGui/QWidget>
#include <QtGui/QTextEdit>
#include <QtGui/QVBoxLayout>
#include <QtGui/QPushButton>
ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
{
setMinimumSize(64,64);
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
this->
setToolTip(tr("Choose a gadget to display in this view.\n") +
tr("You can also split this view in two.\n\n") +
tr("Maybe you first have to choose Show Toolbars in the Window menu."));
}
ConfigGadgetWidget::~ConfigGadgetWidget()
{
// Do nothing
}
void ConfigGadgetWidget::resizeEvent(QResizeEvent *event)
{
QWidget::resizeEvent(event);
}

View File

@ -0,0 +1,44 @@
/**
******************************************************************************
*
* @file configgadgetwidget.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup config
* @{
*
*****************************************************************************/
/*
* 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 CONFIGGADGETWIDGET_H
#define CONFIGGADGETWIDGET_H
#include <QtGui/QWidget>
class ConfigGadgetWidget: public QWidget
{
Q_OBJECT
public:
ConfigGadgetWidget(QWidget *parent = 0);
~ConfigGadgetWidget();
protected:
void resizeEvent(QResizeEvent * event);
};
#endif // CONFIGGADGETWIDGET_H

View File

@ -0,0 +1,62 @@
/**
******************************************************************************
*
* @file configplugin.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup config
* @{
*
*****************************************************************************/
/*
* 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 "configplugin.h"
#include "configgadgetfactory.h"
#include <QtPlugin>
#include <QStringList>
#include <extensionsystem/pluginmanager.h>
ConfigPlugin::ConfigPlugin()
{
// Do nothing
}
ConfigPlugin::~ConfigPlugin()
{
// Do nothing
}
bool ConfigPlugin::initialize(const QStringList& args, QString *errMsg)
{
Q_UNUSED(args);
Q_UNUSED(errMsg);
// cf = new ConfigGadgetFactory(this);
// addAutoReleasedObject(cf);
return true;
}
void ConfigPlugin::extensionsInitialized()
{
// Do nothing
}
void ConfigPlugin::shutdown()
{
// Do nothing
}
Q_EXPORT_PLUGIN(ConfigPlugin)

View File

@ -0,0 +1,47 @@
/**
******************************************************************************
*
* @file configgadgetplugin.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup config
* @{
*
*****************************************************************************/
/*
* 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 CONFIGPLUGIN_H
#define CONFIGPLUGIN_H
#include <extensionsystem/iplugin.h>
class ConfigGadgetFactory;
class ConfigPlugin : public ExtensionSystem::IPlugin
{
public:
ConfigPlugin();
~ConfigPlugin();
void extensionsInitialized();
bool initialize(const QStringList & arguments, QString * errorString);
void shutdown();
private:
ConfigGadgetFactory *cf;
};
#endif // CONFIGPLUGIN_H