diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2009-03-01 02:29:40 -0500 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2009-03-01 02:29:40 -0500 |
| commit | 7ec0bd64cd8c030e7f48db8c06234b9fbbedbc72 (patch) | |
| tree | fee127a579e88dba93870bd95bfeaf4f96888972 | |
| parent | 0a668c6c3c1b461555c01ed254e0bb1b71fa0095 (diff) | |
Add plugin directory and initial Arena plugin factory interface
| -rw-r--r-- | sigencore/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | sigencore/plugins/ArenaPlugin.cpp | 53 | ||||
| -rw-r--r-- | sigencore/plugins/ArenaPlugin.h | 68 | ||||
| -rw-r--r-- | sigencore/plugins/ArenaPlugin_p.h | 39 | ||||
| -rw-r--r-- | sigencore/plugins/Global.h | 37 |
5 files changed, 199 insertions, 0 deletions
diff --git a/sigencore/CMakeLists.txt b/sigencore/CMakeLists.txt index 6231da7e..ea66bdb9 100644 --- a/sigencore/CMakeLists.txt +++ b/sigencore/CMakeLists.txt @@ -46,6 +46,8 @@ target_link_libraries(sigencore LINK_INTERFACE_LIBRARIES sigscript ) +add_subdirectory(plugins) + install( TARGETS sigencore diff --git a/sigencore/plugins/ArenaPlugin.cpp b/sigencore/plugins/ArenaPlugin.cpp new file mode 100644 index 00000000..f98fd0e1 --- /dev/null +++ b/sigencore/plugins/ArenaPlugin.cpp @@ -0,0 +1,53 @@ +/* +* Copyright 2009 Ben Boeckel <MathStuf@gmail.com> +* +* 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, see <http://www.gnu.org/licenses/>. +*/ + +// Header include +#include "ArenaPlugin.h" +#include "ArenaPlugin_p.h" + +// Sigencore includes +#include <sigencore/Arena.h> + +using namespace Sigscript; +using namespace Sigencore; +using namespace Sigencore::Interfaces; + +ArenaPlugin::ArenaPlugin(QObject* parent) : + QObject(parent), + d(new Private) +{ +} + +ArenaPlugin::~ArenaPlugin() +{ + delete d; +} + +Arena* ArenaPlugin::getArena(const QString& name, GameWrapper* game, Config* parent) +{ + Arena* arena = createArena(name, game, parent); + connect(arena, SIGNAL(cleanup(Sigencore::Arena*)), this, SLOT(cleanupArena(Sigencore::Arena*))); + return arena; +} + +ArenaPlugin::Private::Private() +{ +} + +ArenaPlugin::Private::~Private() +{ +} diff --git a/sigencore/plugins/ArenaPlugin.h b/sigencore/plugins/ArenaPlugin.h new file mode 100644 index 00000000..602da99d --- /dev/null +++ b/sigencore/plugins/ArenaPlugin.h @@ -0,0 +1,68 @@ +/* +* Copyright 2009 Ben Boeckel <MathStuf@gmail.com> +* +* 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, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef SIGENCOREINTERFACES_ARENAPLUGIN +#define SIGENCOREINTERFACES_ARENAPLUGIN + +// Plugin includes +#include "Global.h" + +// KDE includes +#include <KXMLGUIClient> + +// Qt includes +#include <QtCore/QStringList> +#include <QtGui/QImage> + +// Forward declarations +namespace Sigscript +{ +class Config; +class GameWrapper; +} + +namespace Sigencore +{ +class Arena; + +namespace Interfaces +{ +class SIGENCOREPLUGINS_EXPORT ArenaPlugin : public QObject, public KXMLGUIClient +{ + Q_OBJECT + + public: + ArenaPlugin(QObject* parent); + virtual ~ArenaPlugin(); + + Arena* getArena(const QString& name, Sigscript::GameWrapper* game, Sigscript::Config* parent); + + virtual QStringList arenas() const = 0; + virtual QString description(const QString& name) const = 0; + virtual QImage icon(const QString& name) = 0; + protected: + virtual Arena* createArena(const QString& name, Sigscript::GameWrapper* game, Sigscript::Config* parent) = 0; + protected slots: + virtual void cleanupArena(Sigencore::Arena* arena) = 0; + private: + class Private; + Private* const d; +}; +} +} + +#endif diff --git a/sigencore/plugins/ArenaPlugin_p.h b/sigencore/plugins/ArenaPlugin_p.h new file mode 100644 index 00000000..1ec9ed42 --- /dev/null +++ b/sigencore/plugins/ArenaPlugin_p.h @@ -0,0 +1,39 @@ +/* +* Copyright 2009 Ben Boeckel <MathStuf@gmail.com> +* +* 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, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef SIGENCOREINTERFACES_ARENAPLUGIN_P +#define SIGENCOREINTERFACES_ARENAPLUGIN_P + +// Header include +#include "ArenaPlugin.h" + +namespace Sigencore +{ +namespace Interfaces +{ +class SIGENCOREPLUGINS_IMPORT ArenaPlugin::Private : public QObject +{ + Q_OBJECT + + public: + Private(); + ~Private(); +}; +} +} + +#endif diff --git a/sigencore/plugins/Global.h b/sigencore/plugins/Global.h new file mode 100644 index 00000000..dc987666 --- /dev/null +++ b/sigencore/plugins/Global.h @@ -0,0 +1,37 @@ +/* + * Copyright 2009 Ben Boeckel <MathStuf@gmail.com> + * + * 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, see <http://www.gnu.org/licenses/>. + */ + +#ifndef SIGENCOREPLUGINS_GLOBAL +#define SIGENCOREPLUGINS_GLOBAL + +// KDE includes +#include <kdemacros.h> + +#ifndef SIGENCOREPLUGINS_EXPORT +# ifdef MAKE_SIGENCOREPLUGINS_LIB +# define SIGENCOREPLUGINS_EXPORT KDE_EXPORT +# else +# define SIGENCOREPLUGINS_EXPORT KDE_IMPORT +# endif +# define SIGENCOREPLUGINS_IMPORT KDE_IMPORT +#endif + +#ifndef SIGENCOREPLUGINS_EXPORT_DEPRECATED +# define SIGENCOREPLUGINS_EXPORT_DEPRECATED KDE_DEPRECATED SIGENCOREPLUGINS_EXPORT +#endif + +#endif |
