changed StandardPaths class
This commit is contained in:
parent
c82e7cf8e6
commit
2162bdc125
10 changed files with 66 additions and 118 deletions
|
@ -24,7 +24,7 @@
|
|||
CrewDatabase::CrewDatabase(QObject *parent) : QObject(parent)
|
||||
{
|
||||
QDir dir;
|
||||
dir.setPath(StandardPaths::writableLocation(StandardPaths::DataLocation));
|
||||
dir.setPath(StandardPaths::dataLocation());
|
||||
dir.mkdir("../gta5sync");
|
||||
QString dirPath = dir.absolutePath();
|
||||
QString defaultConfPath = dirPath + "/crews.ini";
|
||||
|
|
|
@ -159,8 +159,8 @@ void PictureDialog::on_cmdExport_clicked()
|
|||
QDir dir;
|
||||
|
||||
// Get Documents + Desktop Location
|
||||
QString documentsLocation = StandardPaths::writableLocation(StandardPaths::DocumentsLocation);
|
||||
QString desktopLocation = StandardPaths::writableLocation(StandardPaths::DesktopLocation);
|
||||
QString documentsLocation = StandardPaths::documentsLocation();
|
||||
QString desktopLocation = StandardPaths::desktopLocation();
|
||||
|
||||
// Add Desktop Location to Sidebar
|
||||
dir.setPath(desktopLocation);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
ProfileDatabase::ProfileDatabase(QObject *parent) : QObject(parent)
|
||||
{
|
||||
QDir dir;
|
||||
dir.setPath(StandardPaths::writableLocation(StandardPaths::DataLocation));
|
||||
dir.setPath(StandardPaths::dataLocation());
|
||||
dir.mkdir("../gta5sync");
|
||||
QString dirPath = dir.absolutePath();
|
||||
QString defaultConfPath = dirPath + "/players.ini";
|
||||
|
|
55
StandardPaths.cpp
Executable file
55
StandardPaths.cpp
Executable file
|
@ -0,0 +1,55 @@
|
|||
/*****************************************************************************
|
||||
* gta5sync GRAND THEFT AUTO V SYNC
|
||||
* Copyright (C) 2016 Syping
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "StandardPaths.h"
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QStandardPaths>
|
||||
#else
|
||||
#include <QDesktopServices>
|
||||
#endif
|
||||
|
||||
StandardPaths::StandardPaths()
|
||||
{
|
||||
}
|
||||
|
||||
QString StandardPaths::dataLocation()
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
return QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||
#else
|
||||
return QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
||||
#endif
|
||||
}
|
||||
|
||||
QString StandardPaths::desktopLocation()
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
return QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||
#else
|
||||
return QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
|
||||
#endif
|
||||
}
|
||||
|
||||
QString StandardPaths::documentsLocation()
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
return QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
||||
#else
|
||||
return QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
|
||||
#endif
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* gta5sync GRAND THEFT AUTO V SYNC
|
||||
* Copyright (C) 2016 Syping
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "StandardPaths.h"
|
||||
|
||||
QString StandardPaths::writableLocation(StandardLocation type)
|
||||
{
|
||||
return QDesktopServices::storageLocation(type);
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* gta5sync GRAND THEFT AUTO V SYNC
|
||||
* Copyright (C) 2016 Syping
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
#ifndef STANDARDPATHS4_H
|
||||
#define STANDARDPATHS4_H
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QString>
|
||||
|
||||
class StandardPaths : public QDesktopServices
|
||||
{
|
||||
public:
|
||||
static QString writableLocation(StandardLocation type);
|
||||
};
|
||||
|
||||
#endif // STANDARDPATHS4_H
|
|
@ -1,24 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* gta5sync GRAND THEFT AUTO V SYNC
|
||||
* Copyright (C) 2016 Syping
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "StandardPaths.h"
|
||||
|
||||
QString StandardPaths::writableLocation(StandardLocation type)
|
||||
{
|
||||
return QStandardPaths::writableLocation(type);
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* gta5sync GRAND THEFT AUTO V SYNC
|
||||
* Copyright (C) 2016 Syping
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
#ifndef STANDARDPATHS5_H
|
||||
#define STANDARDPATHS5_H
|
||||
|
||||
#include <QStandardPaths>
|
||||
#include <QString>
|
||||
|
||||
class StandardPaths : public QStandardPaths
|
||||
{
|
||||
public:
|
||||
static QString writableLocation(StandardLocation type);
|
||||
};
|
||||
|
||||
#endif // STANDARDPATHS5_H
|
|
@ -47,7 +47,7 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D
|
|||
bool forceDir = SyncSettings.value("force", false).toBool();
|
||||
|
||||
// init folder
|
||||
QString GTAV_defaultFolder = StandardPaths::writableLocation(StandardPaths::DocumentsLocation) + "/Rockstar Games/GTA V";
|
||||
QString GTAV_defaultFolder = StandardPaths::documentsLocation() + "/Rockstar Games/GTA V";
|
||||
QDir GTAV_Dir;
|
||||
if (forceDir)
|
||||
{
|
||||
|
|
11
gta5sync.pro
11
gta5sync.pro
|
@ -37,7 +37,8 @@ SOURCES += main.cpp \
|
|||
SnapmaticWidget.cpp \
|
||||
SavegameWidget.cpp \
|
||||
ProfileLoader.cpp \
|
||||
AboutDialog.cpp
|
||||
AboutDialog.cpp \
|
||||
StandardPaths.cpp
|
||||
|
||||
HEADERS += \
|
||||
SnapmaticPicture.h \
|
||||
|
@ -98,7 +99,7 @@ isEqual(QT_MAJOR_VERSION, 4): SOURCES += qjson4/QJsonArray.cpp \
|
|||
|
||||
# QT4/QT5 STANDARDPATHS CLASS
|
||||
|
||||
isEqual(QT_MAJOR_VERSION, 4): HEADERS += StandardPaths4.h
|
||||
isEqual(QT_MAJOR_VERSION, 4): SOURCES += StandardPaths4.cpp
|
||||
greaterThan(QT_MAJOR_VERSION, 4): HEADERS += StandardPaths5.h
|
||||
greaterThan(QT_MAJOR_VERSION, 4): SOURCES += StandardPaths5.cpp
|
||||
isEqual(QT_MAJOR_VERSION, 4): HEADERS +=
|
||||
isEqual(QT_MAJOR_VERSION, 4): SOURCES +=
|
||||
greaterThan(QT_MAJOR_VERSION, 4): HEADERS +=
|
||||
greaterThan(QT_MAJOR_VERSION, 4): SOURCES +=
|
||||
|
|
Loading…
Reference in a new issue