1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
/*
* Sudoku: A plug-in for the Video Disk Recorder
*
* Copyright (C) 2005-2010, Thomas Günther <tom@toms-cafe.de>
*
* 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 2 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "sudoku.h"
namespace Sudoku { class PuzzleGame; }
#include "menu.h"
#include "setup.h"
#include <vdr/i18n.h>
#include <vdr/plugin.h>
#include <vdr/config.h>
#if APIVERSNUM < 10600
#error "VDR-1.6.0 API version or greater is required!"
#endif
/** 'Sudoku' is a VDR plugin to generate and solve Number Place puzzles. */
namespace SudokuPlugin
{
/** Version number of the plugin */
static const char* VERSION = "0.3.5";
/** Short description of the plugin's purpose */
static const char* DESCRIPTION =
trNOOP("Sudoku - generate and solve Number Place puzzles");
/** Name of the entry in VDR's main menu */
static const char* MAINMENUENTRY = trNOOP("Sudoku");
//--- class SudokuPlugin::Plugin ---------------------------------------------
/** Main class of the VDR plugin 'Sudoku' */
class Plugin : public cPlugin
{
SetupData setup;
Sudoku::PuzzleGame* puzzle;
public:
/** Version number of the plugin */
virtual const char* Version() { return VERSION; }
/** Localized short description of the plugin's purpose */
virtual const char* Description() { return tr(DESCRIPTION); }
/** Perform the startup actions of the plugin. */
virtual bool Start();
/** Localized name of the entry in VDR's main menu */
virtual const char* MainMenuEntry() { return tr(MAINMENUENTRY); }
/** OSD object that shows the plugin's main menu */
virtual cOsdObject* MainMenuAction();
/** Setup menu page to adjust the setup parameters of the plugin */
virtual cMenuSetupPage* SetupMenu();
/** Parse the setup parameters of the plugin. */
virtual bool SetupParse(const char* name, const char* value);
};
} // namespace SudokuPlugin
using namespace SudokuPlugin;
//--- class SudokuPlugin::Plugin -----------------------------------------------
/** Perform the startup actions of the plugin.
*
* This method is called once at VDR's startup.
*/
bool Plugin::Start()
{
puzzle = NULL;
return true;
}
/** OSD object that shows the plugin's main menu
*
* This method is called every time the plugin's main menu entry is selected.
*/
cOsdObject* Plugin::MainMenuAction()
{
return new Menu(this, setup, puzzle);
}
/** Setup menu page to adjust the setup parameters of the plugin
*
* This method is called every time the plugin's setup menu entry is selected.
*/
cMenuSetupPage* Plugin::SetupMenu()
{
return new SetupPage(setup);
}
/** Parse the setup parameters of the plugin.
*
* This method is called for each setup parameter the plugin has previously
* stored in the global setup data.
*/
bool Plugin::SetupParse(const char* name, const char* value)
{
return setup.parse(name, value);
}
/** "Magic" hook that allows VDR to load the plugin into its memory */
VDRPLUGINCREATOR(Plugin); // Don't touch this!
|