Index: mythgame/mythgame/gamehandler.cpp =================================================================== --- mythgame/mythgame/gamehandler.cpp (Revision 7282) +++ mythgame/mythgame/gamehandler.cpp (Arbeitskopie) @@ -46,7 +46,15 @@ } MSqlQuery query(MSqlQuery::InitCon()); - query.exec("SELECT DISTINCT playername FROM gameplayers WHERE playername <> '';"); + + QString thequery = QString("SELECT DISTINCT playername FROM gameplayers WHERE " + "playername <> '' AND ( hostname = '*' OR hostname = '%1' ) ;") + .arg(gContext->GetHostName()); + query.exec(thequery); + + +// query.exec("SELECT DISTINCT playername FROM gameplayers WHERE playername <> '' AND ( hostname = '*' OR hostname = '' ) ;"); + while (query.next()) { QString name = query.value(0).toString(); Index: mythgame/mythgame/dbcheck.cpp =================================================================== --- mythgame/mythgame/dbcheck.cpp (Revision 7282) +++ mythgame/mythgame/dbcheck.cpp (Arbeitskopie) @@ -10,7 +10,7 @@ #include "gamesettings.h" -const QString currentDatabaseVersion = "1008"; +const QString currentDatabaseVersion = "1009"; static bool UpdateDBVersionNumber(const QString &newnumber) { @@ -1104,6 +1104,16 @@ return false; } + if (dbver == "1008") + { + const QString updates[] = { +"ALTER TABLE gameplayers ADD COLUMN hostname varchar(255) NOT NULL default '*'; ", +"" +}; + if (!performActualUpdate(updates, "1009", dbver)) + return false; + } + return true; } Index: mythgame/mythgame/gamesettings.cpp =================================================================== --- mythgame/mythgame/gamesettings.cpp (Revision 7282) +++ mythgame/mythgame/gamesettings.cpp (Arbeitskopie) @@ -172,6 +172,39 @@ }; }; +class PlayerHostName: public ComboBoxSetting, public MGSetting { +public: + PlayerHostName(const MythGamePlayerSettings& parent): + MGSetting(parent, "hostname") { + setLabel(QObject::tr("Hostname")); + addSelection("(all Clients)", "*"); + addSelection("(current Client)", gContext->GetHostName()); + + //If there are other Client's allready in the Database + //add them to the Selection List + MSqlQuery query(MSqlQuery::InitCon()); + QString thequery = QString("SELECT hostname FROM gameplayers " + "WHERE hostname != '%1' and hostname != '*' " + "GROUP BY hostname;") + .arg(gContext->GetHostName()); + query.exec(thequery); + if (query.isActive() && query.size() > 0) + { + while (query.next()) + { + QString queryhostname = query.value(0).toString(); + QString hosttext = QString("Client : %1") + .arg(queryhostname); + addSelection(hosttext, queryhostname); + } + } + //Done, adding other Client's + + setValue(0); + setHelpText(QObject::tr("Name of the Client Computer on wich this Emulator works.")); + }; +}; + MythGamePlayerSettings::MythGamePlayerSettings() { // must be first @@ -187,6 +220,7 @@ group->addChild(new WorkingDirPath(*this)); group->addChild(new Extensions(*this)); group->addChild(new AllowMultipleRoms(*this)); + group->addChild(new PlayerHostName(*this)); addChild(group); };