Ejemplo n.º 1
0
void CGameDialog::Init()
{
  InitGlobalPrefPath();
  LoadPrefs();
  ScanForGames();
  if (mGames.empty())
  {
	  Error("Didn't find any valid game file descriptions, aborting\n");
  }
  else
  {
	  std::list<CGameDescription *>::iterator iGame, iPrevGame;
	  for(iGame=mGames.begin(), iPrevGame = mGames.end(); iGame!=mGames.end(); iPrevGame = iGame, ++iGame)
	  {
		  if(iPrevGame != mGames.end())
			  if(strcmp((*iGame)->getRequiredKeyValue("name"), (*iPrevGame)->getRequiredKeyValue("name")) < 0)
			  {
				  CGameDescription *h = *iGame;
				  *iGame = *iPrevGame;
				  *iPrevGame = h;
			  }
	  }
  }
 
  CGameDescription* currentGameDescription = 0;

  if (!m_bGamePrompt)
  {
    // search by .game name
    std::list<CGameDescription *>::iterator iGame;
    for(iGame=mGames.begin(); iGame!=mGames.end(); ++iGame)
    {
      if ((*iGame)->mGameFile == m_sGameFile)
      {
        currentGameDescription = (*iGame);
        break;
      }
    }
  }
  if (m_bGamePrompt || !currentGameDescription)
  {
    Create();
    DoGameDialog();
    // use m_nComboSelect to identify the game to run as and set the globals
    currentGameDescription = GameDescriptionForComboItem();
    ASSERT_NOTNULL(currentGameDescription);
  }
  g_pGameDescription = currentGameDescription;

  g_pGameDescription->Dump();
}
Ejemplo n.º 2
0
DGameTracker::DGameTracker(QWidget* parent_widget)
    : QStackedWidget(parent_widget),
      m_watcher(this)
{
    connect(&m_watcher, SIGNAL(directoryChanged(QString)), this, SLOT(ScanForGames()));

    m_tree_widget = new DGameTree(this);
    addWidget(m_tree_widget);
    connect(m_tree_widget, SIGNAL(StartGame()), this, SIGNAL(StartGame()));

    m_grid_widget = new DGameGrid(this);
    addWidget(m_grid_widget);
    connect(m_grid_widget, SIGNAL(StartGame()), this, SIGNAL(StartGame()));

    SetViewStyle(STYLE_LIST);
}