Ticket #6627: mythgame.fanartboxart3.diff
File mythgame.fanartboxart3.diff, 53.3 KB (added by , 16 years ago) |
---|
-
mythtv/themes/Terra/game-ui.xml
1 <mythuitheme> 2 3 <window name="gameui"> 4 5 <imagetype name="fanart" from="basebackdrop" /> 6 <imagetype name="topbar" from="basetopbar" /> 7 8 <textarea name="heading" from="baseheading"> 9 <value>Play Games</value> 10 </textarea> 11 12 <buttontree name="gametreelist"> 13 <area>8,52,1264,375</area> 14 <numlists>3</numlists> 15 <spacing>10</spacing> 16 <buttonlist name="listtemplate"> 17 <area>0,0,1264,375</area> 18 <layout>vertical</layout> 19 <buttonarea>0,0,100%,97%</buttonarea> 20 <statetype name="buttonitem"> 21 <state name="active"> 22 <area>0,0,100%,30</area> 23 <imagetype name="buttonbackground"> 24 <gradient start="#4b4b3e" end="#4b4b3e" alpha="255"/> 25 </imagetype> 26 <textarea name="buttontext"> 27 <area>5,0,85%,30</area> 28 <font>basesmall</font> 29 <cutdown>yes</cutdown> 30 <align>left,vcenter</align> 31 </textarea> 32 </state> 33 <state name="selected" from="active"> 34 <imagetype name="buttonbackground"> 35 <gradient start="#8a916f" end="#8a916f" alpha="255"/> 36 </imagetype> 37 <textarea name="buttontext"> 38 <area>5,0,85%,30</area> 39 <font>basesmallbrown</font> 40 <cutdown>yes</cutdown> 41 <align>left,vcenter</align> 42 </textarea> 43 </state> 44 <state name="inactive" from="active" /> 45 </statetype> 46 </buttonlist> 47 </buttontree> 48 49 <textarea name="gametitle"> 50 <area>296,440,752,60</area> 51 <font>baseextralarge</font> 52 </textarea> 53 54 <textarea name="system"> 55 <area>296,510,140,35</area> 56 <font>basemedium</font> 57 <value>System:</value> 58 </textarea> 59 60 <textarea name="systemname"> 61 <area>436,510,580,35</area> 62 <font>basemedium</font> 63 </textarea> 64 65 <textarea name="year"> 66 <area>296,545,140,35</area> 67 <font>basemedium</font> 68 <value>Year:</value> 69 </textarea> 70 71 <textarea name="yearname"> 72 <area>436,545,580,35</area> 73 <font>basemedium</font> 74 </textarea> 75 76 <textarea name="genre"> 77 <area>296,580,140,35</area> 78 <font>basemedium</font> 79 <value>Genre:</value> 80 </textarea> 81 82 <textarea name="genrename"> 83 <area>436,580,580,35</area> 84 <font>basemedium</font> 85 </textarea> 86 87 <textarea name="favorite"> 88 <area>296,615,140,35</area> 89 <font>basemedium</font> 90 <value>Favorite:</value> 91 </textarea> 92 93 <textarea name="showfavorite"> 94 <area>436,615,580,35</area> 95 <font>basemedium</font> 96 </textarea> 97 98 <imagetype name="gameimage"> 99 <area>880,448,300,196</area> 100 </imagetype> 101 102 <imagetype name="boxart"> 103 <area>25,448,300,196</area> 104 <preserveaspect>true</preserveaspect> 105 </imagetype> 106 107 </window> 108 109 <window name="gamedetails"> 110 111 <textarea name="title" from="basetextarea"> 112 <area>80,20,720,40</area> 113 <font>baselarge</font> 114 <value>Game Details:</value> 115 </textarea> 116 117 <imagetype name="background"> 118 <filename>pd-background.png</filename> 119 <position>60,60</position> 120 </imagetype> 121 122 <webbrowser name="browser"> 123 <area>80,70,1094,555</area> 124 <zoom>1.0</zoom> 125 <background color="#000000" alpha="1"/> 126 </webbrowser> 127 128 </window> 129 130 </mythuitheme> -
mythplugins/mythgame/theme/theme.pro
10 10 !macx:QMAKE_COPY_DIR = sh ../../cpsvndir 11 11 12 12 defaultfiles.path = $${PREFIX}/share/mythtv/themes/default 13 defaultfiles.files = default/*.xml default/images/*.png 13 defaultfiles.files = default/*.xml default/images/*.png default/htmls/*.html 14 14 15 15 widefiles.path = $${PREFIX}/share/mythtv/themes/default-wide 16 16 widefiles.files = default-wide/*.xml default-wide/images/*.png -
mythplugins/mythgame/theme/default/game-ui.xml
1 1 <mythuitheme> 2 2 3 <window name="game tree">3 <window name="gameui"> 4 4 5 <font name="active" face="Arial"> 6 <color>#ffffff</color> 7 <size>18</size> 8 <bold>yes</bold> 9 </font> 5 <imagetype name="fanart"> 6 <area>0,0,800,600</area> 7 </imagetype> 10 8 11 <font name="inactive" face="Arial">12 <color>#9999cc</color>13 <size>18</size>14 <bold>yes</bold>15 </font>16 17 <font name="selectable" face="Arial">18 <color>#8cdeff</color>19 <size>18</size>20 <bold>yes</bold>21 </font>22 23 9 <font name="largetitle" face="Arial"> 24 10 <color>#ffffff</color> 25 11 <dropcolor>#000000</dropcolor> … … 33 19 <size>20</size> 34 20 <bold>yes</bold> 35 21 </font> 36 37 <container name="background"> 38 <image name="filler" draworder="0" fleximage="yes"> 39 <filename>background.png</filename> 40 <position>0,10</position> 41 </image> 42 <image name="titlelines" draworder="0" fleximage="no"> 43 <filename>trans-titles.png</filename> 44 <position>0,10</position> 45 </image> 46 <image name="infofiller" draworder="0" fleximage="no"> 47 <filename>pf-top.png</filename> 48 <position>26,350</position> 49 </image> 50 </container> 51 52 <container name="gameselector"> 22 23 <buttontree name="gametreelist"> 53 24 <area>0,10,800,310</area> 54 <managedtreelist name="gametreelist" draworder="1" bins="2"> 55 <area>40,10,720,270</area> 56 <image function="selectionbar" filename="mv_selectionbar.png"></image> 57 <image function="uparrow" filename="mv_up_arrow.png"></image> 58 <image function="downarrow" filename="mv_down_arrow.png"></image> 59 <image function="leftarrow" filename="mv_left_arrow.png"></image> 60 <image function="rightarrow" filename="mv_right_arrow.png"></image> 61 <bin number="1"> 62 <area>30,16,190,250</area> 63 <fcnfont name="active" function="active"></fcnfont> 64 <fcnfont name="inactive" function="inactive"></fcnfont> 65 <fcnfont name="active" function="selected"></fcnfont> 66 <fcnfont name="selectable" function="selectable"></fcnfont> 67 </bin> 68 <bin number="2"> 69 <area>235,10,535,270</area> 70 <fcnfont name="active" function="active"></fcnfont> 71 <fcnfont name="active" function="selected"></fcnfont> 72 <fcnfont name="inactive" function="inactive"></fcnfont> 73 <fcnfont name="selectable" function="selectable"></fcnfont> 74 </bin> 75 </managedtreelist> 25 <numlists>2</numlists> 26 <spacing>10</spacing> 27 <buttonlist name="listtemplate" from="basebuttonlist" /> 28 </buttontree> 76 29 77 <image name="showinglines" draworder="2" fleximage="yes"> 78 <filename>showings.png</filename> 79 <position>0,0</position> 80 </image> 81 </container> 82 83 <container name="game_info"> 84 <area>25,355,750,220</area> 85 86 <textarea name="gametitle" draworder="6"> 87 <area>13,5,500,50</area> 30 <textarea name="gametitle"> 31 <area>38,360,500,50</area> 88 32 <font>largetitle</font> 89 33 </textarea> 90 34 91 <textarea name="system" draworder="6">92 <area> 13,75,150,35</area>35 <textarea name="system"> 36 <area>38,430,150,35</area> 93 37 <font>infofont</font> 94 38 <value>System:</value> 95 39 </textarea> 96 40 97 <textarea name="systemname" draworder="6">98 <area>1 53,75,500,35</area>41 <textarea name="systemname"> 42 <area>178,430,500,35</area> 99 43 <font>infofont</font> 100 44 </textarea> 101 45 102 <textarea name="year" draworder="6">103 <area> 13,110,150,35</area>46 <textarea name="year"> 47 <area>38,465,150,35</area> 104 48 <font>infofont</font> 105 49 <value>Year:</value> 106 50 </textarea> 107 51 108 <textarea name="yearname" draworder="6">109 <area>1 53,110,500,35</area>52 <textarea name="yearname"> 53 <area>178,465,500,35</area> 110 54 <font>infofont</font> 111 55 </textarea> 112 56 113 <textarea name="genre" draworder="6">114 <area> 13,140,150,35</area>57 <textarea name="genre"> 58 <area>38,495,150,35</area> 115 59 <font>infofont</font> 116 60 <value>Genre:</value> 117 61 </textarea> 118 62 119 <textarea name="genrename" draworder="6">120 <area>1 53,140,500,35</area>63 <textarea name="genrename"> 64 <area>178,495,500,35</area> 121 65 <font>infofont</font> 122 66 </textarea> 123 67 124 <textarea name="favorite" draworder="6">125 <area> 13,170,150,35</area>68 <textarea name="favorite"> 69 <area>38,525,150,35</area> 126 70 <font>infofont</font> 127 71 <value>Favorite:</value> 128 72 </textarea> 129 73 130 <textarea name="showfavorite" draworder="6">131 <area>1 53,170,500,35</area>74 <textarea name="showfavorite"> 75 <area>178,525,500,35</area> 132 76 <font>infofont</font> 133 77 </textarea> 134 78 135 <image name="gameimage" draworder="6" fleximage="no"> 136 <position>535,25</position> 137 <staticsize>180,150</staticsize> 138 </image> 139 </container> 140 79 <imagetype name="gameimage"> 80 <area>600,420,180,150</area> 81 </imagetype> 82 83 <imagetype name="boxart"> 84 <area>410,420,180,150</area> 85 <preserveaspect>true</preserveaspect> 86 </imagetype> 87 141 88 </window> 142 89 143 90 </mythuitheme> -
mythplugins/mythgame/theme/default-wide/game-ui.xml
1 1 <mythuitheme> 2 2 3 <window name="game tree">3 <window name="gameui"> 4 4 5 <font name="active" face="Trebuchet MS"> 6 <color>#ffffff</color> 7 <size>18</size> 8 <bold>yes</bold> 9 </font> 5 <imagetype name="fanart"> 6 <area>0,0,1280,720</area> 7 </imagetype> 10 8 11 <font name="inactive" face="Trebuchet MS">12 <color>#9999cc</color>13 <size>18</size>14 <bold>yes</bold>15 </font>16 17 <font name="selectable" face="Trebuchet MS">18 <color>#8cdeff</color>19 <size>18</size>20 <bold>yes</bold>21 </font>22 23 9 <font name="largetitle" face="Trebuchet MS"> 24 10 <color>#ffffff</color> 25 11 <dropcolor>#000000</dropcolor> … … 34 20 <bold>yes</bold> 35 21 </font> 36 22 37 <container name="background"> 38 <image name="filler" draworder="0" fleximage="yes"> 39 <filename>background.png</filename> <!-- 1280x326 --> 40 <position>0,48</position> 41 </image> 42 <image name="titlelines" draworder="0" fleximage="no"> 43 <filename>trans-titles.png</filename> <!-- 1280x326 --> 44 <position>0,50</position> 45 <staticsize>280,315</staticsize> 46 </image> 47 <image name="infofiller" draworder="0" fleximage="no"> 48 <filename>pf-top.png</filename> <!-- 1152x260 --> 49 <position>64,412</position> 50 </image> 51 </container> 52 53 <container name="gameselector"> 23 <buttontree name="gametreelist"> 54 24 <area>8,52,1264,310</area> 55 <managedtreelist name="gametreelist" draworder="1" bins="2"> 56 <area>32,0,1200,296</area> 57 <image function="selectionbar" filename="mv_selectionbar.png"></image> 58 <image function="uparrow" filename="mv_up_arrow.png"></image> 59 <image function="downarrow" filename="mv_down_arrow.png"></image> 60 <image function="leftarrow" filename="mv_left_arrow.png"></image> 61 <image function="rightarrow" filename="mv_right_arrow.png"></image> 62 <bin number="1"> 63 <area>56,28,288,271</area> 64 <fcnfont name="active" function="active"></fcnfont> 65 <fcnfont name="inactive" function="inactive"></fcnfont> 66 <fcnfont name="active" function="selected"></fcnfont> 67 <fcnfont name="selectable" function="selectable"></fcnfont> 68 </bin> 69 <bin number="2"> 70 <area>384,0,816,296</area> 71 <fcnfont name="active" function="active"></fcnfont> 72 <fcnfont name="active" function="selected"></fcnfont> 73 <fcnfont name="inactive" function="inactive"></fcnfont> 74 <fcnfont name="selectable" function="selectable"></fcnfont> 75 </bin> 76 </managedtreelist> 25 <numlists>3</numlists> 26 <spacing>10</spacing> 27 <buttonlist name="listtemplate" from="basebuttonlist" /> 28 </buttontree> 77 29 78 <image name="showinglines" draworder="2" fleximage="yes"> 79 <filename>showings.png</filename> 80 <position>20,10</position> 81 <staticsize>1200,310</staticsize> 82 </image> 83 </container> 84 85 <container name="game_info"> 86 <area>64,412,1152,260</area> 87 88 <textarea name="gametitle" draworder="6"> 89 <area>32,28,752,60</area> 30 <textarea name="gametitle" draworder="6"> 31 <area>96,440,752,60</area> 90 32 <font>largetitle</font> 91 33 </textarea> 92 34 93 94 <area> 32,98,140,35</area>35 <textarea name="system" draworder="6"> 36 <area>96,510,140,35</area> 95 37 <font>infofont</font> 96 38 <value>System:</value> 97 39 </textarea> 98 40 99 100 <area> 172,98,580,35</area>41 <textarea name="systemname" draworder="6"> 42 <area>236,510,580,35</area> 101 43 <font>infofont</font> 102 44 </textarea> 103 45 104 105 <area> 32,133,140,35</area>46 <textarea name="year" draworder="6"> 47 <area>96,545,140,35</area> 106 48 <font>infofont</font> 107 49 <value>Year:</value> 108 50 </textarea> 109 51 110 111 <area> 172,133,580,35</area>52 <textarea name="yearname" draworder="6"> 53 <area>236,545,580,35</area> 112 54 <font>infofont</font> 113 55 </textarea> 114 56 115 116 <area> 32,168,140,35</area>57 <textarea name="genre" draworder="6"> 58 <area>96,580,140,35</area> 117 59 <font>infofont</font> 118 60 <value>Genre:</value> 119 61 </textarea> 120 62 121 122 <area> 172,168,580,35</area>63 <textarea name="genrename" draworder="6"> 64 <area>236,580,580,35</area> 123 65 <font>infofont</font> 124 66 </textarea> 125 67 126 127 <area> 32,203,140,35</area>68 <textarea name="favorite" draworder="6"> 69 <area>96,615,140,35</area> 128 70 <font>infofont</font> 129 71 <value>Favorite:</value> 130 72 </textarea> 131 73 132 133 <area> 172,203,580,35</area>74 <textarea name="showfavorite" draworder="6"> 75 <area>236,615,580,35</area> 134 76 <font>infofont</font> 135 77 </textarea> 136 78 137 <image name="gameimage" draworder="6" fleximage="no"> 138 <position>816,36</position> 139 <staticsize>300,196</staticsize> 140 </image> 141 </container> 142 79 <imagetype name="boxart"> 80 <area>610,500,180,150</area> 81 <preserveaspect>true</preserveaspect> 82 </imagetype> 83 84 <imagetype name="gameimage"> 85 <area>880,500,300,196</area> 86 </imagetype> 87 143 88 </window> 144 89 90 <window name="gamedetails"> 91 92 <textarea name="title" from="basetextarea"> 93 <area>80,20,720,40</area> 94 <font>baselarge</font> 95 <value>Game Details:</value> 96 </textarea> 97 98 <imagetype name="background"> 99 <filename>pd-background.png</filename> 100 <position>60,60</position> 101 </imagetype> 102 103 <webbrowser name="browser"> 104 <area>80,70,1094,555</area> 105 <zoom>1.0</zoom> 106 <background color="#000000" alpha="1"/> 107 </webbrowser> 108 109 </window> 110 145 111 </mythuitheme> -
mythplugins/mythgame/mythgame/romedit.cpp
66 66 } 67 67 }; 68 68 69 class Fanart : public LineEditSetting, public GenericDBStorage 70 { 71 public: 72 Fanart(const QString &romname) : 73 LineEditSetting(this), GenericDBStorage( 74 this, "gamemetadata", "fanart", "romname", romname) 75 { 76 setLabel(QObject::tr("Fanart")); 77 setHelpText(QObject::tr("Path to Fanart for this Game.")); 78 } 79 }; 69 80 81 class Boxart : public LineEditSetting, public GenericDBStorage 82 { 83 public: 84 Boxart(const QString &romname) : 85 LineEditSetting(this), GenericDBStorage( 86 this, "gamemetadata", "boxart", "romname", romname) 87 { 88 setLabel(QObject::tr("Boxart")); 89 setHelpText(QObject::tr("Path to Boxart for this Game.")); 90 } 91 }; 92 93 70 94 class Favourite : public CheckBoxSetting, public GenericDBStorage 71 95 { 72 96 public: … … 92 116 group->addChild(new Year(romname)); 93 117 group->addChild(new Country(romname)); 94 118 group->addChild(new Publisher(romname)); 119 group->addChild(new Fanart(romname)); 120 group->addChild(new Boxart(romname)); 95 121 group->addChild(new Favourite(romname)); 96 122 addChild(group); 97 123 } -
mythplugins/mythgame/mythgame/gamehandler.cpp
149 149 150 150 void GameHandler::GetMetadata(GameHandler *handler, QString rom, QString* Genre, QString* Year, 151 151 QString* Country, QString* CRC32, QString* GameName, 152 QString *Publisher, QString *Version) 152 QString *Publisher, QString *Version, QString* Fanart, 153 QString* Boxart) 153 154 { 154 155 QString key; 155 156 QString tmpcrc; … … 165 166 *Genre = QObject::tr("Unknown"); 166 167 *Publisher = QObject::tr("Unknown"); 167 168 *Version = QObject::tr("0"); 169 *Fanart = QObject::tr(""); 170 *Boxart = QObject::tr(""); 168 171 169 172 if (*CRC32 != "") 170 173 { … … 411 414 QString Year; 412 415 QString Publisher; 413 416 QString Version; 417 QString Fanart; 418 QString Boxart; 414 419 415 420 int removalprompt = gContext->GetSetting("GameRemovalPrompt").toInt(); 416 421 int indepth = gContext->GetSetting("GameDeepScan").toInt(); … … 423 428 if (indepth) 424 429 { 425 430 GetMetadata(handler, iter.data().RomFullPath(), &Genre, &Year, &Country, &CRC32, &GameName, 426 &Publisher, &Version );431 &Publisher, &Version, &Fanart, &Boxart); 427 432 } 428 433 else 429 434 { … … 434 439 GameName = QObject::tr("Unknown"); 435 440 Publisher = QObject::tr("Unknown"); 436 441 Version = QObject::tr("0"); 442 Fanart = QObject::tr(""); 443 Boxart = QObject::tr(""); 437 444 } 438 445 439 446 if (GameName == QObject::tr("Unknown")) … … 446 453 query.prepare("INSERT INTO gamemetadata " 447 454 "(system, romname, gamename, genre, year, gametype, " 448 455 "rompath, country, crc_value, diskcount, display, " 449 "publisher, version ) "456 "publisher, version, fanart, boxart) " 450 457 "VALUES (:SYSTEM, :ROMNAME, :GAMENAME, :GENRE, :YEAR, " 451 ":GAMETYPE, :ROMPATH, :COUNTRY, :CRC32, '1', '1', :PUBLISHER, :VERSION)"); 458 ":GAMETYPE, :ROMPATH, :COUNTRY, :CRC32, '1', '1', :PUBLISHER, :VERSION, " 459 ":FANART, BOXART)"); 452 460 453 461 454 462 … … 463 471 query.bindValue(":CRC32", CRC32); 464 472 query.bindValue(":PUBLISHER", Publisher); 465 473 query.bindValue(":VERSION", Version); 466 474 query.bindValue(":FANART", Fanart); 475 query.bindValue(":BOXART", Boxart); 476 467 477 query.exec(); 468 478 } 469 479 else if ((iter.data().FoundLoc() == inDatabase) && (removalprompt)) -
mythplugins/mythgame/mythgame/gameui.cpp
1 #include <mythcontext.h> 2 #include <mythuibuttontree.h> 3 #include <mythdialogbox.h> 4 #include <mythgenerictree.h> 5 6 // MythGame headers 7 #include "gameui.h" 8 #include "gamehandler.h" 9 #include "rominfo.h" 10 #include "gamedetails.h" 11 12 class GameTreeInfo 13 { 14 public: 15 GameTreeInfo(const QString& levels, const QString& filter) 16 : m_levels(QStringList::split(" ", levels)) 17 , m_filter(filter) 18 { 19 } 20 21 int getDepth() const { return m_levels.size(); } 22 const QString& getLevel(unsigned i) const { return m_levels[i]; } 23 const QString& getFilter() const { return m_filter; } 24 25 private: 26 QStringList m_levels; 27 QString m_filter; 28 }; 29 30 Q_DECLARE_METATYPE(GameTreeInfo *) 31 32 GameUI::GameUI(MythScreenStack *parent) 33 : MythScreenType(parent, "GameUI") 34 { 35 gContext->addCurrentLocation("mythgame"); 36 } 37 38 GameUI::~GameUI() 39 { 40 gContext->removeCurrentLocation(); 41 } 42 43 bool GameUI::Create() 44 { 45 if (!LoadWindowFromXML("game-ui.xml", "gameui", this)) 46 return false; 47 48 bool err = false; 49 UIUtilE::Assign(this, m_gameTreeUI, "gametreelist", &err); 50 UIUtilE::Assign(this, m_gameTitle, "gametitle", &err); 51 UIUtilE::Assign(this, m_gameSystem, "systemname", &err); 52 UIUtilE::Assign(this, m_gameYear, "yearname", &err); 53 UIUtilE::Assign(this, m_gameGenre, "genrename", &err); 54 UIUtilE::Assign(this, m_gameFavourite, "showfavorite", &err); 55 UIUtilE::Assign(this, m_gameImage, "gameimage", &err); 56 UIUtilE::Assign(this, m_fanartImage, "fanart", &err); 57 UIUtilE::Assign(this, m_boxImage, "boxart", &err); 58 59 if (err) 60 { 61 VERBOSE(VB_IMPORTANT, "Cannot load screen 'gameui'"); 62 return false; 63 } 64 65 connect(m_gameTreeUI, SIGNAL(itemClicked(MythUIButtonListItem*)), 66 this, SLOT(itemClicked(MythUIButtonListItem*))); 67 68 connect(m_gameTreeUI, SIGNAL(nodeChanged(MythGenericTree*)), 69 this, SLOT(nodeChanged(MythGenericTree*))); 70 71 m_gameShowFileName = gContext->GetSetting("GameShowFileNames").toInt(); 72 73 m_gameTree = new MythGenericTree("game root", 0, false); 74 75 timer = new QTimer(this); 76 connect(timer, SIGNAL(timeout()), SLOT(showImageTimeout())); 77 78 // create system filter to only select games where handlers are present 79 QString systemFilter; 80 81 // The call to GameHandler::count() fills the handler list for us 82 // to move through. 83 unsigned handlercount = GameHandler::count(); 84 85 for (unsigned i = 0; i < handlercount; ++i) 86 { 87 QString system = GameHandler::getHandler(i)->SystemName(); 88 if (i == 0) 89 systemFilter = "system in ('" + system + "'"; 90 else 91 systemFilter += ",'" + system + "'"; 92 } 93 if (systemFilter.isEmpty()) 94 { 95 systemFilter = "1=0"; 96 VERBOSE(VB_GENERAL, QString("Couldn't find any game handlers!")); 97 } 98 else 99 systemFilter += ")"; 100 101 m_showHashed = gContext->GetSetting("GameTreeView").toInt(); 102 103 // create a few top level nodes - this could be moved to a config based 104 // approach with multiple roots if/when someone has the time to create 105 // the relevant dialog screens 106 107 QString levels = gContext->GetSetting("GameFavTreeLevels"); 108 109 MythGenericTree *new_node = new MythGenericTree("Favourites", 1, true); 110 new_node->SetData(qVariantFromValue( 111 new GameTreeInfo(levels, systemFilter + " and favorite=1"))); 112 m_favouriteNode = m_gameTree->addNode(new_node); 113 114 levels = gContext->GetSetting("GameAllTreeLevels"); 115 116 if (m_showHashed) 117 { 118 int pos = levels.find("gamename",0); 119 if (pos >= 0) 120 levels.insert(pos, " hash "); 121 } 122 123 new_node = new MythGenericTree(tr("All Games"), 1, true); 124 new_node->SetData(qVariantFromValue( 125 new GameTreeInfo(levels, systemFilter))); 126 m_gameTree->addNode(new_node); 127 128 new_node = new MythGenericTree(tr("- By Genre"), 1, true); 129 new_node->SetData(qVariantFromValue( 130 new GameTreeInfo("genre gamename", systemFilter))); 131 m_gameTree->addNode(new_node); 132 133 new_node = new MythGenericTree(tr("- By Year"), 1, true); 134 new_node->SetData(qVariantFromValue( 135 new GameTreeInfo("year gamename", systemFilter))); 136 m_gameTree->addNode(new_node); 137 138 new_node = new MythGenericTree(tr("- By Name"), 1, true); 139 new_node->SetData(qVariantFromValue( 140 new GameTreeInfo("gamename", systemFilter))); 141 m_gameTree->addNode(new_node); 142 143 new_node = new MythGenericTree(tr("- By Publisher"), 1, true); 144 new_node->SetData(qVariantFromValue( 145 new GameTreeInfo("publisher gamename", systemFilter))); 146 m_gameTree->addNode(new_node); 147 148 m_gameTreeUI->AssignTree(m_gameTree); 149 150 BuildFocusList(); 151 152 return true; 153 } 154 155 bool GameUI::keyPressEvent(QKeyEvent *event) 156 { 157 if (GetFocusWidget()->keyPressEvent(event)) 158 return true; 159 160 bool handled = false; 161 QStringList actions; 162 gContext->GetMainWindow()->TranslateKeyPress("Game", event, actions); 163 164 for (int i = 0; i < actions.size() && !handled; i++) 165 { 166 QString action = actions[i]; 167 handled = true; 168 169 if (action == "MENU") 170 showMenu(); 171 else if (action == "INFO") 172 showInfo(); 173 else if (action == "TOGGLEFAV") 174 toggleFavorite(); 175 else if (action == "INCSEARCH") 176 searchStart(); 177 else if (action == "INCSEARCHNEXT") 178 searchStart(); 179 else 180 handled = false; 181 } 182 if (!handled && MythScreenType::keyPressEvent(event)) 183 handled = true; 184 185 return handled; 186 } 187 188 void GameUI::nodeChanged(MythGenericTree* node) 189 { 190 if (!isLeaf(node)) 191 { 192 if (node->childCount() == 0 || node == m_favouriteNode) 193 { 194 node->deleteAllChildren(); 195 fillNode(node); 196 } 197 if (timer->isActive()) 198 timer->stop(); 199 clearRomInfo(); 200 } 201 else 202 { 203 RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData()); 204 if (romInfo->Romname().isEmpty()) 205 romInfo->fillData(); 206 updateRomInfo(romInfo); 207 if (!romInfo->ImagePath().isEmpty() || !romInfo->Fanart().isEmpty() || 208 !romInfo->Boxart().isEmpty()) 209 { 210 if (timer->isActive()) 211 timer->changeInterval(330); 212 else 213 timer->start(330, true); 214 } 215 else 216 { 217 if (m_gameImage->IsVisible()) 218 m_gameImage->Hide(); 219 if (m_fanartImage->IsVisible()) 220 m_fanartImage->Hide(); 221 if (m_boxImage->IsVisible()) 222 m_boxImage->Hide(); 223 } 224 } 225 } 226 227 void GameUI::itemClicked(MythUIButtonListItem*) 228 { 229 MythGenericTree *node = m_gameTreeUI->GetCurrentNode(); 230 if (isLeaf(node)) 231 { 232 RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData()); 233 if (romInfo->RomCount() == 1) 234 { 235 GameHandler::Launchgame(romInfo, NULL); 236 } 237 else 238 { 239 QString msg = QObject::tr("Choose System for") + 240 ":\n" + node->getString(); 241 MythScreenStack *popupStack = GetMythMainWindow()-> 242 GetStack("popup stack"); 243 MythDialogBox *chooseSystemPopup = new MythDialogBox( 244 msg, popupStack, "chooseSystemPopup"); 245 246 if (chooseSystemPopup->Create()) 247 { 248 chooseSystemPopup->SetReturnEvent(this, "chooseSystemPopup"); 249 QString all_systems = romInfo->AllSystems(); 250 QStringList players = QStringList::split(",", all_systems); 251 for (QStringList::Iterator it = players.begin(); 252 it != players.end(); ++it) 253 { 254 chooseSystemPopup->AddButton(*it); 255 } 256 chooseSystemPopup->AddButton(tr("Cancel")); 257 popupStack->AddScreen(chooseSystemPopup); 258 } 259 else 260 delete chooseSystemPopup; 261 } 262 } 263 } 264 265 void GameUI::showImageTimeout(void) 266 { 267 m_gameImage->Load(); 268 if (!m_gameImage->IsVisible()) 269 m_gameImage->Show(); 270 m_fanartImage->Load(); 271 if (!m_fanartImage->IsVisible()) 272 m_fanartImage->Show(); 273 m_boxImage->Load(); 274 if (!m_boxImage->IsVisible()) 275 m_boxImage->Show(); 276 } 277 278 void GameUI::searchComplete(QString string) 279 { 280 MythGenericTree *parent = m_gameTreeUI->GetCurrentNode()->getParent(); 281 MythGenericTree *new_node = parent->getChildByName(string); 282 if (new_node) 283 { 284 m_gameTreeUI->SetCurrentNode(new_node); 285 // SetActive updates the buttonlist but SetCurrentNode doesn't. 286 m_gameTreeUI->SetActive(true); 287 } 288 } 289 290 void GameUI::updateRomInfo(RomInfo *rom) 291 { 292 m_gameTitle->SetText(rom->Gamename()); 293 m_gameSystem->SetText(rom->System()); 294 m_gameYear->SetText(rom->Year()); 295 m_gameGenre->SetText(rom->Genre()); 296 297 if (rom->Favorite()) 298 m_gameFavourite->SetText("Yes"); 299 else 300 m_gameFavourite->SetText("No"); 301 302 m_gameImage->SetFilename(rom->ImagePath()); 303 m_fanartImage->SetFilename(rom->Fanart()); 304 m_boxImage->SetFilename(rom->Boxart()); 305 } 306 307 void GameUI::clearRomInfo(void) { 308 m_gameTitle->SetText(""); 309 m_gameSystem->SetText(""); 310 m_gameYear->SetText(""); 311 m_gameGenre->SetText(""); 312 m_gameFavourite->SetText(""); 313 314 if (m_gameImage->IsVisible()) 315 m_gameImage->Hide(); 316 317 if (m_fanartImage->IsVisible()) 318 m_fanartImage->Hide(); 319 320 if (m_boxImage->IsVisible()) 321 m_boxImage->Hide(); 322 } 323 324 void GameUI::edit(void) 325 { 326 MythGenericTree *node = m_gameTreeUI->GetCurrentNode(); 327 if (isLeaf(node)) 328 { 329 RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData()); 330 romInfo->edit_rominfo(); 331 romInfo->fillData(); 332 updateRomInfo(romInfo); 333 } 334 } 335 336 void GameUI::showInfo() 337 { 338 MythGenericTree *node = m_gameTreeUI->GetCurrentNode(); 339 if (isLeaf(node)) 340 { 341 RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData()); 342 MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); 343 GameDetails *details_dialog = new GameDetails(mainStack, romInfo); 344 345 if (details_dialog->Create()) 346 mainStack->AddScreen(details_dialog); 347 else 348 delete details_dialog; 349 } 350 } 351 352 void GameUI::showMenu() 353 { 354 MythGenericTree *node = m_gameTreeUI->GetCurrentNode(); 355 if (isLeaf(node)) 356 { 357 RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData()); 358 MythScreenStack *popupStack = GetMythMainWindow()-> 359 GetStack("popup stack"); 360 MythDialogBox *showMenuPopup = 361 new MythDialogBox(node->getString(), popupStack, "showMenuPopup"); 362 363 if (showMenuPopup->Create()) 364 { 365 showMenuPopup->SetReturnEvent(this, "showMenuPopup"); 366 showMenuPopup->AddButton(tr("Show Information")); 367 if (romInfo->Favorite()) 368 showMenuPopup->AddButton(tr("Remove Favorite")); 369 else 370 showMenuPopup->AddButton(tr("Make Favorite")); 371 showMenuPopup->AddButton(tr("Edit")); 372 popupStack->AddScreen(showMenuPopup); 373 } 374 else 375 delete showMenuPopup; 376 } 377 } 378 379 void GameUI::searchStart(void) 380 { 381 MythGenericTree *parent = m_gameTreeUI->GetCurrentNode()->getParent(); 382 383 if (parent != NULL) 384 { 385 QStringList childList; 386 QList<MythGenericTree*>::iterator it; 387 QList<MythGenericTree*> *children = parent->getAllChildren(); 388 389 for (it = children->begin(); it != children->end(); ++it) 390 { 391 MythGenericTree *child = *it; 392 childList << child->getString(); 393 } 394 395 MythScreenStack *popupStack = 396 GetMythMainWindow()->GetStack("popup stack"); 397 MythUISearchDialog *searchDialog = new MythUISearchDialog(popupStack, 398 tr("Game Search"), childList, true, ""); 399 400 if (searchDialog->Create()) 401 { 402 connect(searchDialog, SIGNAL(haveResult(QString)), 403 SLOT(searchComplete(QString))); 404 405 popupStack->AddScreen(searchDialog); 406 } 407 else 408 delete searchDialog; 409 } 410 } 411 412 void GameUI::toggleFavorite(void) 413 { 414 MythGenericTree *node = m_gameTreeUI->GetCurrentNode(); 415 if (isLeaf(node)) 416 { 417 RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData()); 418 romInfo->setFavorite(); 419 if (romInfo->Favorite()) 420 m_gameFavourite->SetText("Yes"); 421 else 422 m_gameFavourite->SetText("No"); 423 424 if (node->getParent() == m_favouriteNode) { 425 m_gameTreeUI->SetCurrentNode(m_favouriteNode); 426 m_gameTreeUI->SetActive(true); 427 } 428 } 429 } 430 431 void GameUI::customEvent(QEvent *event) 432 { 433 if (event->type() == kMythDialogBoxCompletionEventType) 434 { 435 DialogCompletionEvent *dce = 436 dynamic_cast<DialogCompletionEvent*>(event); 437 438 QString resultid = dce->GetId(); 439 QString resulttext = dce->GetResultText(); 440 441 if (resultid == "showMenuPopup") 442 { 443 if (resulttext == tr("Edit")) { 444 edit(); 445 } 446 else if (resulttext == tr("Show Information")) 447 { 448 showInfo(); 449 } 450 else if (resulttext == tr("Make Favorite") || 451 resulttext == tr("Remove Favorite")) 452 { 453 toggleFavorite(); 454 } 455 } 456 else if (resultid == "chooseSystemPopup") 457 { 458 if (resulttext != "" && resulttext != tr("Cancel")) { 459 MythGenericTree *node = m_gameTreeUI->GetCurrentNode(); 460 RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData()); 461 GameHandler::Launchgame(romInfo, resulttext); 462 } 463 } 464 } 465 } 466 467 QString GameUI::getFillSql(MythGenericTree *node) const 468 { 469 QString layer = node->getString(); 470 int childDepth = node->getInt() + 1; 471 QString childLevel = getChildLevelString(node); 472 QString filter = getFilter(node); 473 bool childIsLeaf = childDepth == getLevelsOnThisBranch(node) + 1; 474 RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData()); 475 476 QString columns; 477 QString conj = "where "; 478 479 if (!filter.isEmpty()) 480 { 481 filter = conj + filter; 482 conj = " and "; 483 } 484 if ((childLevel == "gamename") && (m_gameShowFileName)) 485 { 486 columns = childIsLeaf 487 ? "romname,system,year,genre,gamename" 488 : "romname"; 489 490 if (m_showHashed) 491 filter += " and romname like '" + layer + "%'"; 492 493 } 494 else if ((childLevel == "gamename") && (layer.length() == 1)) { 495 columns = childIsLeaf 496 ? childLevel + ",system,year,genre,gamename" 497 : childLevel; 498 499 if (m_showHashed) 500 filter += " and gamename like '" + layer + "%'"; 501 502 } 503 else if (childLevel == "hash") { 504 columns = "left(gamename,1)"; 505 } 506 else { 507 508 columns = childIsLeaf 509 ? childLevel + ",system,year,genre,gamename" 510 : childLevel; 511 } 512 513 // this whole section ought to be in rominfo.cpp really, but I've put it 514 // in here for now to minimise the number of files changed by this mod 515 if (romInfo) { 516 if (!romInfo->System().isEmpty()) 517 { 518 filter += conj + "trim(system)=:SYSTEM"; 519 conj = " and "; 520 } 521 if (!romInfo->Year().isEmpty()) 522 { 523 filter += conj + "year=:YEAR"; 524 conj = " and "; 525 } 526 if (!romInfo->Genre().isEmpty()) 527 { 528 filter += conj + "trim(genre)=:GENRE"; 529 conj = " and "; 530 } 531 if (!romInfo->Publisher().isEmpty()) 532 { 533 filter += conj + "publisher=:PUBLISHER"; 534 conj = " and "; 535 } 536 537 if (!romInfo->Gamename().isEmpty()) 538 { 539 filter += conj + "trim(gamename)=:GAMENAME"; 540 } 541 542 } 543 544 filter += conj + " display = 1 "; 545 546 QString sql; 547 548 if ((childLevel == "gamename") && (m_gameShowFileName)) 549 { 550 sql = "select distinct " 551 + columns 552 + " from gamemetadata " 553 + filter 554 + " order by romname" 555 + ";"; 556 } 557 else if (childLevel == "hash") { 558 sql = "select distinct " 559 + columns 560 + " from gamemetadata " 561 + filter 562 + " order by gamename,romname" 563 + ";"; 564 } 565 else 566 { 567 sql = "select distinct " 568 + columns 569 + " from gamemetadata " 570 + filter 571 + " order by " 572 + childLevel 573 + ";"; 574 } 575 576 return sql; 577 } 578 579 QString GameUI::getChildLevelString(MythGenericTree *node) const 580 { 581 unsigned this_level = node->getInt(); 582 while (node->getInt() != 1) 583 node = node->getParent(); 584 585 GameTreeInfo *gi = qVariantValue<GameTreeInfo *>(node->GetData()); 586 return gi->getLevel(this_level - 1); 587 } 588 589 QString GameUI::getFilter(MythGenericTree *node) const 590 { 591 while (node->getInt() != 1) 592 node = node->getParent(); 593 GameTreeInfo *gi = qVariantValue<GameTreeInfo *>(node->GetData()); 594 return gi->getFilter(); 595 } 596 597 int GameUI::getLevelsOnThisBranch(MythGenericTree *node) const 598 { 599 while (node->getInt() != 1) 600 node = node->getParent(); 601 602 GameTreeInfo *gi = qVariantValue<GameTreeInfo *>(node->GetData()); 603 return gi->getDepth(); 604 } 605 606 bool GameUI::isLeaf(MythGenericTree *node) const 607 { 608 return (node->getInt() - 1) == getLevelsOnThisBranch(node); 609 } 610 611 void GameUI::fillNode(MythGenericTree *node) 612 { 613 QString layername = node->getString(); 614 RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData()); 615 616 MSqlQuery query(MSqlQuery::InitCon()); 617 618 query.prepare(getFillSql(node)); 619 620 if (romInfo) 621 { 622 if (!romInfo->System().isEmpty()) 623 query.bindValue(":SYSTEM", romInfo->System()); 624 if (!romInfo->Year().isEmpty()) 625 query.bindValue(":YEAR", romInfo->Year()); 626 if (!romInfo->Genre().isEmpty()) 627 query.bindValue(":GENRE", romInfo->Genre()); 628 if (!romInfo->Publisher().isEmpty()) 629 query.bindValue(":PUBLISHER", romInfo->Publisher()); 630 if (!romInfo->Gamename().isEmpty()) 631 query.bindValue(":GAMENAME", romInfo->Gamename()); 632 } 633 634 bool IsLeaf = node->getInt() == getLevelsOnThisBranch(node); 635 if (query.exec() && query.size() > 0) 636 { 637 while (query.next()) 638 { 639 QString current = query.value(0).toString().stripWhiteSpace(); 640 MythGenericTree *new_node = 641 new MythGenericTree(current, node->getInt() + 1, false); 642 if (IsLeaf) 643 { 644 RomInfo *temp = new RomInfo(); 645 temp->setSystem(query.value(1).toString().stripWhiteSpace()); 646 temp->setYear(query.value(2).toString()); 647 temp->setGenre(query.value(3).toString().stripWhiteSpace()); 648 temp->setGamename(query.value(4).toString().stripWhiteSpace()); 649 new_node->SetData(qVariantFromValue(temp)); 650 node->addNode(new_node); 651 } 652 else 653 { 654 RomInfo *newRomInfo; 655 if (node->getInt() > 1) 656 { 657 RomInfo *currentRomInfo; 658 currentRomInfo = qVariantValue<RomInfo *>(node->GetData()); 659 newRomInfo = new RomInfo(*currentRomInfo); 660 } 661 else 662 { 663 newRomInfo = new RomInfo(); 664 } 665 new_node->SetData(qVariantFromValue(newRomInfo)); 666 node->addNode(new_node); 667 if (getChildLevelString(node) != "hash") 668 newRomInfo->setField(getChildLevelString(node), current); 669 } 670 } 671 } 672 } -
mythplugins/mythgame/mythgame/rominfo.cpp
30 30 if (res) 31 31 { 32 32 MSqlQuery query(MSqlQuery::InitCon()); 33 query.prepare("SELECT gamename,genre,year,country,publisher,favorite " 33 query.prepare("SELECT gamename,genre,year,country,publisher,favorite, " 34 "fanart,boxart " 34 35 "FROM gamemetadata " 35 36 "WHERE gametype = :GAMETYPE " 36 37 "AND romname = :ROMNAME"); … … 53 54 QString t_country = query.value(3).toString(); 54 55 QString t_publisher = query.value(4).toString(); 55 56 bool t_favourite = query.value(5).toBool(); 57 QString t_fanart = query.value(6).toString(); 58 QString t_boxart = query.value(7).toString(); 56 59 57 60 if ((t_gamename != Gamename()) || (t_genre != Genre()) || 58 61 (t_year != Year()) || (t_country != Country()) || 59 (t_publisher != Publisher()) || (t_favourite != Favorite())) 62 (t_publisher != Publisher()) || (t_favourite != Favorite()) || 63 (t_fanart != Fanart()) || (t_boxart != Boxart())) 60 64 { 61 65 query.prepare("UPDATE gamemetadata " 62 66 "SET version = 'CUSTOM' " … … 147 151 favorite = data.toInt(); 148 152 else if (field == "rompath") 149 153 rompath = data; 154 else if (field == "fanart") 155 fanart = data; 156 else if (field == "boxart") 157 boxart = data; 150 158 else if (field == "country") 151 159 country = data; 152 160 else if (field == "publisher") … … 211 219 212 220 QString thequery = "SELECT system,gamename,genre,year,romname,favorite," 213 221 "rompath,country,crc_value,diskcount,gametype,publisher," 214 "version FROM gamemetadata WHERE gamename = :GAMENAME "222 "version,fanart,boxart FROM gamemetadata WHERE gamename = :GAMENAME " 215 223 + systemtype + " ORDER BY diskcount DESC"; 216 224 217 225 query.prepare(thequery); … … 234 242 setGameType(query.value(10).toString()); 235 243 setPublisher(query.value(11).toString()); 236 244 setVersion(query.value(12).toString()); 245 setFanart(query.value(13).toString()); 246 setBoxart(query.value(14).toString()); 237 247 } 238 248 239 249 query.prepare("SELECT screenshots FROM gameplayers " -
mythplugins/mythgame/mythgame/gameui.h
1 #ifndef GAMEUI_H_ 2 #define GAMEUI_H_ 3 4 #include <qtimer.h> 5 6 // myth 7 #include <mythscreentype.h> 8 9 class MythUIButtonTree; 10 class MythGenericTree; 11 class RomInfo; 12 13 class GameUI : public MythScreenType 14 { 15 Q_OBJECT 16 17 public: 18 GameUI(MythScreenStack *parentStack); 19 ~GameUI(); 20 21 bool Create(); 22 bool keyPressEvent(QKeyEvent *event); 23 24 public slots: 25 void nodeChanged(MythGenericTree* node); 26 void itemClicked(MythUIButtonListItem* item); 27 void showImageTimeout(void); 28 void searchComplete(QString); 29 30 private: 31 void updateRomInfo(RomInfo *rom); 32 void clearRomInfo(void); 33 void edit(void); 34 void showInfo(void); 35 void showMenu(void); 36 void searchStart(void); 37 void toggleFavorite(void); 38 void customEvent(QEvent *event); 39 40 QString getFillSql(MythGenericTree* node) const; 41 QString getChildLevelString(MythGenericTree *node) const; 42 QString getFilter(MythGenericTree *node) const; 43 int getLevelsOnThisBranch(MythGenericTree *node) const; 44 bool isLeaf(MythGenericTree *node) const; 45 void fillNode(MythGenericTree *node); 46 47 private: 48 bool m_showHashed; 49 int m_gameShowFileName; 50 QTimer *timer; 51 52 MythGenericTree *m_gameTree; 53 MythGenericTree *m_favouriteNode; 54 55 MythUIButtonTree *m_gameTreeUI; 56 MythUIText *m_gameTitle; 57 MythUIText *m_gameSystem; 58 MythUIText *m_gameYear; 59 MythUIText *m_gameGenre; 60 MythUIText *m_gameFavourite; 61 MythUIImage *m_gameImage; 62 MythUIImage *m_fanartImage; 63 MythUIImage *m_boxImage; 64 }; 65 66 #endif -
mythplugins/mythgame/mythgame/gamehandler.h
67 67 void GetMetadata(GameHandler *handler, QString rom, 68 68 QString* Genre, QString* Year, QString* Country, 69 69 QString* CRC32, QString* GameName, 70 QString* Publisher, QString* Version); 70 QString* Publisher, QString* Version, 71 QString* Fanart, QString* Boxart); 71 72 72 73 void promptForRemoval(QString filename, QString RomPath ); 73 74 void UpdateGameDB(GameHandler *handler); -
mythplugins/mythgame/mythgame/rominfo.h
12 12 QString lgenre = "", QString lyear = "", bool lfavorite = FALSE, 13 13 QString lrompath = "", QString lcountry ="", QString lcrc_value = "", 14 14 int ldiskcount = 0, QString lgametype = "", int lromcount = 0, 15 QString lallsystems = "", QString lpublisher = "", QString lversion = "") 15 QString lallsystems = "", QString lpublisher = "", QString lversion = "", 16 QString lfanart = "", QString lboxart = "") 16 17 { 17 18 romname = lromname; 18 19 system = lsystem; … … 21 22 year = lyear; 22 23 favorite = lfavorite; 23 24 rompath = lrompath; 25 fanart = lfanart; 26 boxart = lboxart; 24 27 country = lcountry; 25 28 crc_value = lcrc_value; 26 29 diskcount = ldiskcount; … … 40 43 year = lhs.year; 41 44 favorite = lhs.favorite; 42 45 rompath = lhs.rompath; 46 fanart = lhs.fanart; 47 boxart = lhs.boxart; 43 48 country = lhs.country; 44 49 crc_value = lhs.crc_value; 45 50 diskcount = lhs.diskcount; … … 57 62 QString Rompath() const { return rompath; } 58 63 void setRompath(const QString &lrompath) { rompath = lrompath; } 59 64 65 QString Fanart() const { return fanart; } 66 void setFanart(const QString &lfanart) { fanart = lfanart; } 67 68 QString Boxart() const { return boxart; } 69 void setBoxart(const QString &lboxart) { boxart = lboxart; } 70 60 71 QString Romname() const { return romname; } 61 72 void setRomname(const QString &lromname) { romname = lromname; } 62 73 … … 126 137 QString year; 127 138 bool favorite; 128 139 QString rompath; 140 QString fanart; 141 QString boxart; 129 142 }; 130 143 131 144 bool operator==(const RomInfo& a, const RomInfo& b); 132 145 146 Q_DECLARE_METATYPE(RomInfo *) 147 133 148 #endif -
mythplugins/mythgame/mythgame/dbcheck.cpp
12 12 13 13 #include "gamesettings.h" 14 14 15 const QString currentDatabaseVersion = "101 4";15 const QString currentDatabaseVersion = "1015"; 16 16 17 17 static bool UpdateDBVersionNumber(const QString &newnumber) 18 18 { … … 384 384 return false; 385 385 } 386 386 387 if (dbver == "1014") 388 { 389 const QString updates[] = { 387 390 391 "ALTER TABLE gamemetadata ADD fanart VARCHAR(255) NOT NULL AFTER rompath," 392 "ADD boxart VARCHAR( 255 ) NOT NULL AFTER fanart;", 393 "" 394 }; 395 396 if (!performActualUpdate(updates, "1015", dbver)) 397 return false; 398 } 399 388 400 return true; 389 401 } -
mythplugins/mythgame/mythgame/main.cpp
6 6 #include <QDir> 7 7 #include <QApplication> 8 8 9 #include "gameui.h" 9 10 #include "gamehandler.h" 10 11 #include "rominfo.h" 11 12 #include "gamesettings.h" 12 #include "gametree.h"13 13 #include "dbcheck.h" 14 14 15 15 #include <mythtv/mythcontext.h> … … 60 60 { 61 61 QString themedir = GetMythUI()->GetThemeDir(); 62 62 63 MythThemedMenu * diag= new MythThemedMenu(63 MythThemedMenu *menu = new MythThemedMenu( 64 64 themedir, which_menu, GetMythMainWindow()->GetMainStack(), "game menu"); 65 65 66 66 GameData data; 67 67 68 diag->setCallback(GameCallback, &data);69 diag->setKillable();68 menu->setCallback(GameCallback, &data); 69 menu->setKillable(); 70 70 71 if ( diag->foundTheme())71 if (menu->foundTheme()) 72 72 { 73 if (class LCD * lcd = LCD::Get()) 74 { 73 if (LCD * lcd = LCD::Get()) 75 74 lcd->switchToTime(); 76 } 77 GetMythMainWindow()->GetMainStack()->AddScreen( diag);75 76 GetMythMainWindow()->GetMainStack()->AddScreen(menu); 78 77 return 0; 79 78 } 80 79 else 81 80 { 82 81 VERBOSE(VB_IMPORTANT, QString("Couldn't find menu %1 or theme %2") 83 82 .arg(which_menu).arg(themedir)); 84 delete diag;83 delete menu; 85 84 return -1; 86 85 } 87 86 } 88 87 89 88 void runGames(void); 89 int RunGames(void); 90 90 91 91 void setupKeys(void) 92 92 { … … 105 105 { 106 106 if (!gContext->TestPopupVersion("mythgame", libversion, 107 107 MYTH_BINARY_VERSION)) 108 { 109 VERBOSE(VB_IMPORTANT, 110 QString("libmythgame.so/main.o: binary version mismatch")); 108 111 return -1; 112 } 109 113 110 111 114 gContext->ActivateSettingsCache(false); 112 115 if (!UpgradeGameDatabaseSchema()) 113 116 { … … 126 129 return 0; 127 130 } 128 131 129 void runGames( void)132 void runGames() 130 133 { 131 gContext->addCurrentLocation("mythgame"); 132 GameTree gametree(gContext->GetMainWindow(), "gametree", "game-"); 133 gametree.exec(); 134 gContext->removeCurrentLocation(); 134 RunGames(); 135 135 } 136 136 137 int RunGames(void) 138 { 139 MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); 140 GameUI *game = new GameUI(mainStack); 141 142 if (game->Create()) 143 { 144 mainStack->AddScreen(game); 145 return 0; 146 } 147 else 148 { 149 delete game; 150 return -1; 151 } 152 } 153 137 154 int mythplugin_run(void) 138 155 { 139 runGames(); 140 return 0; 156 return RunGames(); 141 157 } 142 158 143 159 int mythplugin_config(void) -
mythplugins/mythgame/mythgame/mythgame.pro
9 9 INSTALLS += target 10 10 11 11 # Input 12 HEADERS += gamehandler.h rominfo.h unzip.h gamesettings.h game tree.h13 HEADERS += rom_metadata.h romedit.h 12 HEADERS += gamehandler.h rominfo.h unzip.h gamesettings.h gameui.h 13 HEADERS += rom_metadata.h romedit.h gamedetails.h 14 14 15 SOURCES += main.cpp gamehandler.cpp rominfo.cpp game tree.cpp unzip.c15 SOURCES += main.cpp gamehandler.cpp rominfo.cpp gameui.cpp unzip.c 16 16 SOURCES += gamesettings.cpp dbcheck.cpp rom_metadata.cpp romedit.cpp 17 SOURCES += gamedetails.cpp 17 18 18 19 use_hidesyms { 19 20 QMAKE_CXXFLAGS += -fvisibility=hidden