1. void MainWindow::LoadProject()
  2. {
  3. QDir t_sAppDir = QDir::current();
  4. QString t_sFileName = QFileDialog::getExistingDirectory(this, tr("Open Project"), t_sAppDir.path()+"/projects", QFileDialog::ShowDirsOnly|QFileDialog::DontResolveSymlinks);
  5. QDir t_dir(t_sFileName + "/Game");
  6. bool t_bSuccess = false;
  7. if (t_dir.exists())
  8. {
  9. if (Database *t_pDB = Database::Get())
  10. {
  11. t_pDB->LoadDB(t_sFileName.toStdString()+"/Game/GameDatabase.db");
  12. if (!m_pTimer)
  13. m_pTimer = new QTimer(this);
  14. connect(m_pTimer,SIGNAL(timeout()),SLOT(CustomUpdate()));
  15. m_pTimer->start(100);
  16. m_WindowAction = WINDOW_LOAD_DB;
  17. setEnabled(false);
  18. m_sProjectDir = t_sFileName;
  19. t_bSuccess = true;
  20. }
  21. }
  22. if (!t_bSuccess)
  23. {
  24. QErrorMessage *t_Msg = new QErrorMessage(this);
  25. t_Msg->showMessage(t_sFileName + " is no valid project directory.");
  26. }
  27. }