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