- void MainWindow::LoadProject()
- {
- QDir t_sAppDir = QDir::current();
- QString t_sFileName = QFileDialog::getExistingDirectory(this, tr("Open Project"), t_sAppDir.path()+"/projects", QFileDialog::ShowDirsOnly|QFileDialog::DontResolveSymlinks);
- QDir t_dir(t_sFileName + "/Game");
- bool t_bSuccess = false;
- if (t_dir.exists())
- {
- if (Database *t_pDB = Database::Get())
- {
- t_pDB->LoadDB(t_sFileName.toStdString()+"/Game/GameDatabase.db");
- if (!m_pTimer)
- m_pTimer = new QTimer(this);
- connect(m_pTimer,SIGNAL(timeout()),SLOT(CustomUpdate()));
- m_pTimer->start(100);
- m_WindowAction = WINDOW_LOAD_DB;
- setEnabled(false);
- m_sProjectDir = t_sFileName;
- t_bSuccess = true;
- }
- }
- if (!t_bSuccess)
- {
- QErrorMessage *t_Msg = new QErrorMessage(this);
- t_Msg->showMessage(t_sFileName + " is no valid project directory.");
- }
- }