00001 #ifndef GAMESETTINGS_H
00002 #define GAMESETTINGS_H
00003
00004 #include "mythtv/settings.h"
00005 #include "mythtv/mythcontext.h"
00006
00007
00008
00009 struct GameTypes {
00010 QString nameStr;
00011 QString idStr;
00012 QString extensions;
00013 };
00014
00015 #define MAX_GAME_TYPES 12
00016
00017
00018
00019 const GameTypes GameTypeList[MAX_GAME_TYPES] =
00020 {
00021 { QObject::tr("OTHER"), "OTHER", "" },
00022 { QObject::tr("AMIGA"), "AMIGA", "adf,ipf" },
00023 { QObject::tr("ATARI"), "ATARI", "bin,a26" },
00024 { QObject::tr("GAMEGEAR"), "GAMEGEAR", "gg" },
00025 { QObject::tr("GENESIS/MEGADRIVE"), "GENESIS", "smd,bin,md" },
00026 { QObject::tr("MAME"), "MAME", "" },
00027 { QObject::tr("N64"), "N64", "v64,n64" },
00028 { QObject::tr("NES"), "NES", "zip,nes" },
00029 { QObject::tr("PC GAME"), "PC", "" },
00030 { QObject::tr("PCE/TG16"),"PCE", "pce" },
00031 { QObject::tr("SEGA/MASTER SYSYTEM"), "SEGA", "sms" },
00032 { QObject::tr("SNES"), "SNES", "zip,smc,sfc,fig,swc" }
00033 };
00034
00035 const QString GetGameExtensions(const QString GameType);
00036
00037 class MythGameGeneralSettings;
00038 class MythGamePlayerSettings;
00039 class MythGamePlayerEditor;
00040
00041 class GameDBStorage : public SimpleDBStorage
00042 {
00043 protected:
00044 GameDBStorage(Setting *_setting,
00045 const MythGamePlayerSettings &_parent,
00046 const QString &_name) :
00047 SimpleDBStorage(_setting, "gameplayers", _name), parent(_parent)
00048 {
00049 _setting->setName(_name);
00050 }
00051
00052 virtual QString setClause(MSqlBindings &bindings);
00053 virtual QString whereClause(MSqlBindings &bindings);
00054
00055 const MythGamePlayerSettings& parent;
00056 };
00057
00058 class MythGameGeneralSettings : public ConfigurationWizard
00059 {
00060 public:
00061 MythGameGeneralSettings();
00062 };
00063
00064 class MythGamePlayerSettings : public QObject, public ConfigurationWizard
00065 {
00066 Q_OBJECT
00067
00068 public:
00069 MythGamePlayerSettings();
00070
00071 int getGamePlayerID(void) const { return id->intValue(); };
00072
00073 void loadByID(int id);
00074
00075 static void fillSelections(SelectSetting* setting);
00076 static QString idToName(int id);
00077
00078 QString getSourceName(void) const { return name->getValue(); };
00079
00080 virtual void save() {
00081 if (name)
00082 ConfigurationWizard::save();
00083 };
00084
00085 private:
00086 class ID : public AutoIncrementDBSetting
00087 {
00088 public:
00089 ID() : AutoIncrementDBSetting("gameplayers", "gameplayerid")
00090 {
00091 setName("GamePlayerName");
00092 setVisible(false);
00093 }
00094 };
00095
00096 class Name : public LineEditSetting, public GameDBStorage
00097 {
00098 public:
00099 Name(const MythGamePlayerSettings &parent) :
00100 LineEditSetting(this), GameDBStorage(this, parent, "playername")
00101 {
00102 setLabel(QObject::tr("Player Name"));
00103 setHelpText(QObject::tr("Name of this Game and or Emulator"));
00104 }
00105 };
00106
00107 private:
00108 QString settingValue;
00109 bool changed;
00110 ID *id;
00111 Name *name;
00112 };
00113
00114 class MPUBLIC MythGamePlayerEditor : public QObject, public ConfigurationDialog
00115 {
00116 Q_OBJECT
00117
00118 public:
00119 MythGamePlayerEditor();
00120
00121 virtual MythDialog *dialogWidget(MythMainWindow *parent,
00122 const char *widgetName=0);
00123
00124 virtual DialogCode exec(void);
00125 virtual void load();
00126 virtual void save() { };
00127
00128 public slots:
00129 void menu();
00130 void edit();
00131 void del();
00132
00133 private:
00134 ListBoxSetting *listbox;
00135 };
00136
00137
00138 #endif