improve file dialog experience
This commit is contained in:
parent
09d79228a0
commit
40675f605d
4 changed files with 14 additions and 13 deletions
|
@ -55,10 +55,10 @@ QString AppEnv::getGameFolder(bool *ok)
|
||||||
{
|
{
|
||||||
QDir dir;
|
QDir dir;
|
||||||
QString GTAV_FOLDER = QString::fromUtf8(qgetenv("GTAV_FOLDER"));
|
QString GTAV_FOLDER = QString::fromUtf8(qgetenv("GTAV_FOLDER"));
|
||||||
if (GTAV_FOLDER != "") {
|
if (!GTAV_FOLDER.isEmpty()) {
|
||||||
dir.setPath(GTAV_FOLDER);
|
dir.setPath(GTAV_FOLDER);
|
||||||
if (dir.exists()) {
|
if (dir.exists()) {
|
||||||
if (ok != NULL)
|
if (ok)
|
||||||
*ok = true;
|
*ok = true;
|
||||||
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
||||||
return dir.absolutePath();
|
return dir.absolutePath();
|
||||||
|
@ -77,7 +77,7 @@ QString AppEnv::getGameFolder(bool *ok)
|
||||||
if (forceDir) {
|
if (forceDir) {
|
||||||
dir.setPath(GTAV_returnFolder);
|
dir.setPath(GTAV_returnFolder);
|
||||||
if (dir.exists()) {
|
if (dir.exists()) {
|
||||||
if (ok != 0)
|
if (ok)
|
||||||
*ok = true;
|
*ok = true;
|
||||||
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
||||||
return dir.absolutePath();
|
return dir.absolutePath();
|
||||||
|
@ -86,7 +86,7 @@ QString AppEnv::getGameFolder(bool *ok)
|
||||||
|
|
||||||
dir.setPath(GTAV_defaultFolder);
|
dir.setPath(GTAV_defaultFolder);
|
||||||
if (dir.exists()) {
|
if (dir.exists()) {
|
||||||
if (ok != 0)
|
if (ok)
|
||||||
*ok = true;
|
*ok = true;
|
||||||
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
||||||
return dir.absolutePath();
|
return dir.absolutePath();
|
||||||
|
@ -95,14 +95,14 @@ QString AppEnv::getGameFolder(bool *ok)
|
||||||
if (!forceDir) {
|
if (!forceDir) {
|
||||||
dir.setPath(GTAV_returnFolder);
|
dir.setPath(GTAV_returnFolder);
|
||||||
if (dir.exists()) {
|
if (dir.exists()) {
|
||||||
if (ok != 0)
|
if (ok)
|
||||||
*ok = true;
|
*ok = true;
|
||||||
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
||||||
return dir.absolutePath();
|
return dir.absolutePath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ok != 0)
|
if (ok)
|
||||||
*ok = false;
|
*ok = false;
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -694,7 +694,7 @@ void OptionsDialog::setupSnapmaticPictureViewer()
|
||||||
void OptionsDialog::on_cmdExploreFolder_clicked()
|
void OptionsDialog::on_cmdExploreFolder_clicked()
|
||||||
{
|
{
|
||||||
const QString GTAV_Folder = QFileDialog::getExistingDirectory(this, UserInterface::tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
const QString GTAV_Folder = QFileDialog::getExistingDirectory(this, UserInterface::tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
||||||
if (QDir(GTAV_Folder).exists()) {
|
if (!GTAV_Folder.isEmpty() && QDir(GTAV_Folder).exists()) {
|
||||||
ui->txtFolder->setText(GTAV_Folder);
|
ui->txtFolder->setText(GTAV_Folder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1302,8 +1302,8 @@ void ProfileInterface::exportSelected()
|
||||||
settings.beginGroup("FileDialogs");
|
settings.beginGroup("FileDialogs");
|
||||||
//bool dontUseNativeDialog = settings.value("DontUseNativeDialog", false).toBool();
|
//bool dontUseNativeDialog = settings.value("DontUseNativeDialog", false).toBool();
|
||||||
settings.beginGroup("ExportDirectory");
|
settings.beginGroup("ExportDirectory");
|
||||||
QString exportDirectory = QFileDialog::getExistingDirectory(this, tr("Export selected..."), settings.value(profileName, profileFolder).toString());
|
const QString exportDirectory = QFileDialog::getExistingDirectory(this, tr("Export selected..."), settings.value(profileName, profileFolder).toString());
|
||||||
if (exportDirectory != "") {
|
if (!exportDirectory.isEmpty()) {
|
||||||
settings.setValue(profileName, exportDirectory);
|
settings.setValue(profileName, exportDirectory);
|
||||||
for (const QString &widgetStr : qAsConst(widgets)) {
|
for (const QString &widgetStr : qAsConst(widgets)) {
|
||||||
ProfileWidget *widget = widgets.key(widgetStr, nullptr);
|
ProfileWidget *widget = widgets.key(widgetStr, nullptr);
|
||||||
|
|
|
@ -321,8 +321,9 @@ void UserInterface::setupDirEnv(bool showFolderDialog)
|
||||||
QDir::setCurrent(GTAV_Folder);
|
QDir::setCurrent(GTAV_Folder);
|
||||||
}
|
}
|
||||||
else if (showFolderDialog) {
|
else if (showFolderDialog) {
|
||||||
GTAV_Folder = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
const QString GTAV_Folder_Temp = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
||||||
if (QDir(GTAV_Folder).exists()) {
|
if (!GTAV_Folder_Temp.isEmpty() && QDir(GTAV_Folder_Temp).exists()) {
|
||||||
|
GTAV_Folder = GTAV_Folder_Temp;
|
||||||
folderExists = true;
|
folderExists = true;
|
||||||
QDir::setCurrent(GTAV_Folder);
|
QDir::setCurrent(GTAV_Folder);
|
||||||
AppEnv::setGameFolder(GTAV_Folder);
|
AppEnv::setGameFolder(GTAV_Folder);
|
||||||
|
@ -809,8 +810,8 @@ void UserInterface::updateCacheId(uint cacheId)
|
||||||
|
|
||||||
void UserInterface::on_actionSelect_GTA_Folder_triggered()
|
void UserInterface::on_actionSelect_GTA_Folder_triggered()
|
||||||
{
|
{
|
||||||
QString GTAV_Folder_Temp = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
const QString GTAV_Folder_Temp = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
||||||
if (QDir(GTAV_Folder_Temp).exists()) {
|
if (!GTAV_Folder_Temp.isEmpty() && QDir(GTAV_Folder_Temp).exists()) {
|
||||||
if (profileOpen) {
|
if (profileOpen) {
|
||||||
closeProfile_p();
|
closeProfile_p();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue