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;
|
||||
QString GTAV_FOLDER = QString::fromUtf8(qgetenv("GTAV_FOLDER"));
|
||||
if (GTAV_FOLDER != "") {
|
||||
if (!GTAV_FOLDER.isEmpty()) {
|
||||
dir.setPath(GTAV_FOLDER);
|
||||
if (dir.exists()) {
|
||||
if (ok != NULL)
|
||||
if (ok)
|
||||
*ok = true;
|
||||
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
||||
return dir.absolutePath();
|
||||
|
@ -77,7 +77,7 @@ QString AppEnv::getGameFolder(bool *ok)
|
|||
if (forceDir) {
|
||||
dir.setPath(GTAV_returnFolder);
|
||||
if (dir.exists()) {
|
||||
if (ok != 0)
|
||||
if (ok)
|
||||
*ok = true;
|
||||
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
||||
return dir.absolutePath();
|
||||
|
@ -86,7 +86,7 @@ QString AppEnv::getGameFolder(bool *ok)
|
|||
|
||||
dir.setPath(GTAV_defaultFolder);
|
||||
if (dir.exists()) {
|
||||
if (ok != 0)
|
||||
if (ok)
|
||||
*ok = true;
|
||||
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
||||
return dir.absolutePath();
|
||||
|
@ -95,14 +95,14 @@ QString AppEnv::getGameFolder(bool *ok)
|
|||
if (!forceDir) {
|
||||
dir.setPath(GTAV_returnFolder);
|
||||
if (dir.exists()) {
|
||||
if (ok != 0)
|
||||
if (ok)
|
||||
*ok = true;
|
||||
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
||||
return dir.absolutePath();
|
||||
}
|
||||
}
|
||||
|
||||
if (ok != 0)
|
||||
if (ok)
|
||||
*ok = false;
|
||||
return QString();
|
||||
}
|
||||
|
|
|
@ -694,7 +694,7 @@ void OptionsDialog::setupSnapmaticPictureViewer()
|
|||
void OptionsDialog::on_cmdExploreFolder_clicked()
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1302,8 +1302,8 @@ void ProfileInterface::exportSelected()
|
|||
settings.beginGroup("FileDialogs");
|
||||
//bool dontUseNativeDialog = settings.value("DontUseNativeDialog", false).toBool();
|
||||
settings.beginGroup("ExportDirectory");
|
||||
QString exportDirectory = QFileDialog::getExistingDirectory(this, tr("Export selected..."), settings.value(profileName, profileFolder).toString());
|
||||
if (exportDirectory != "") {
|
||||
const QString exportDirectory = QFileDialog::getExistingDirectory(this, tr("Export selected..."), settings.value(profileName, profileFolder).toString());
|
||||
if (!exportDirectory.isEmpty()) {
|
||||
settings.setValue(profileName, exportDirectory);
|
||||
for (const QString &widgetStr : qAsConst(widgets)) {
|
||||
ProfileWidget *widget = widgets.key(widgetStr, nullptr);
|
||||
|
|
|
@ -321,8 +321,9 @@ void UserInterface::setupDirEnv(bool showFolderDialog)
|
|||
QDir::setCurrent(GTAV_Folder);
|
||||
}
|
||||
else if (showFolderDialog) {
|
||||
GTAV_Folder = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
||||
if (QDir(GTAV_Folder).exists()) {
|
||||
const QString GTAV_Folder_Temp = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
||||
if (!GTAV_Folder_Temp.isEmpty() && QDir(GTAV_Folder_Temp).exists()) {
|
||||
GTAV_Folder = GTAV_Folder_Temp;
|
||||
folderExists = true;
|
||||
QDir::setCurrent(GTAV_Folder);
|
||||
AppEnv::setGameFolder(GTAV_Folder);
|
||||
|
@ -809,8 +810,8 @@ void UserInterface::updateCacheId(uint cacheId)
|
|||
|
||||
void UserInterface::on_actionSelect_GTA_Folder_triggered()
|
||||
{
|
||||
QString GTAV_Folder_Temp = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
||||
if (QDir(GTAV_Folder_Temp).exists()) {
|
||||
const QString GTAV_Folder_Temp = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
||||
if (!GTAV_Folder_Temp.isEmpty() && QDir(GTAV_Folder_Temp).exists()) {
|
||||
if (profileOpen) {
|
||||
closeProfile_p();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue