Skip to content
This repository has been archived by the owner on May 31, 2018. It is now read-only.

Commit

Permalink
fix issue to need select game directory for multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
Syping committed Aug 26, 2017
1 parent f090b4b commit 9fa37cf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
10 changes: 5 additions & 5 deletions AppEnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ QString AppEnv::getGameFolder(bool *ok)
QString GTAV_defaultFolder = StandardPaths::documentsLocation() + QDir::separator() + "Rockstar Games" + QDir::separator() + "GTA V";
QString GTAV_returnFolder = GTAV_defaultFolder;

QSettings SyncSettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
SyncSettings.beginGroup("dir");
bool forceDir = SyncSettings.value("force", false).toBool();
GTAV_returnFolder = SyncSettings.value("dir", GTAV_defaultFolder).toString();
SyncSettings.endGroup();
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
settings.beginGroup("dir");
bool forceDir = settings.value("force", false).toBool();
GTAV_returnFolder = settings.value("dir", GTAV_defaultFolder).toString();
settings.endGroup();

if (forceDir)
{
Expand Down
7 changes: 6 additions & 1 deletion SnapmaticEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "SnapmaticPicture.h"
#include "StringParser.h"
#include "AppEnv.h"
#include <QStringBuilder>
#include <QTextDocument>
#include <QInputDialog>
#include <QMessageBox>
Expand Down Expand Up @@ -230,7 +231,7 @@ void SnapmaticEditor::on_cmdApply_clicked()
{
adjustedFileName.remove(adjustedFileName.length() - 7, 7);
}
QString backupFileName = adjustedFileName + ".bak";
QString backupFileName = adjustedFileName % ".bak";
if (!QFile::exists(backupFileName))
{
QFile::copy(adjustedFileName, backupFileName);
Expand Down Expand Up @@ -307,6 +308,10 @@ void SnapmaticEditor::on_labCrew_linkActivated(const QString &link)
int indexNum = 0;
QStringList itemList;
QStringList crewList = crewDB->getCrews();
if (!crewList.contains(QLatin1String("0")))
{
crewList.append(QLatin1String("0"));
}
crewList.sort();
foreach(const QString &crew, crewList)
{
Expand Down
12 changes: 11 additions & 1 deletion UserInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D

void UserInterface::setupDirEnv()
{
// settings init
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);

bool folderExists;
GTAV_Folder = AppEnv::getGameFolder(&folderExists);
if (folderExists)
Expand All @@ -102,11 +105,18 @@ void UserInterface::setupDirEnv()
folderExists = true;
QDir::setCurrent(GTAV_Folder);
AppEnv::setGameFolder(GTAV_Folder);

// First time folder selection save
settings.beginGroup("dir");
if (settings.value("dir", "").toString().isEmpty())
{
settings.setValue("dir", GTAV_Folder);
}
settings.endGroup();
}
}

// profiles init
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
settings.beginGroup("Profile");
QString defaultProfile = settings.value("Default", "").toString();

Expand Down

0 comments on commit 9fa37cf

Please sign in to comment.