From 517f446d12f236aa7f2701968e02605f68c7a95e Mon Sep 17 00:00:00 2001 From: Rafael Date: Mon, 28 Mar 2016 14:10:59 +0200 Subject: [PATCH] window title changes, standard paths completed --- StandardPaths.cpp | 64 +++++++++++++++++++++++++++++++++++++++++++++++ StandardPaths.h | 7 ++++++ UserInterface.cpp | 7 +++++- UserInterface.h | 1 + 4 files changed, 78 insertions(+), 1 deletion(-) diff --git a/StandardPaths.cpp b/StandardPaths.cpp index 3c03b6a..4942695 100755 --- a/StandardPaths.cpp +++ b/StandardPaths.cpp @@ -25,6 +25,25 @@ StandardPaths::StandardPaths() { + +} + +QString StandardPaths::applicationsLocation() +{ +#if QT_VERSION >= 0x050000 + return QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation); +#else + return QDesktopServices::storageLocation(QDesktopServices::ApplicationsLocation); +#endif +} + +QString StandardPaths::cacheLocation() +{ +#if QT_VERSION >= 0x050000 + return QStandardPaths::writableLocation(QStandardPaths::CacheLocation); +#else + return QDesktopServices::storageLocation(QDesktopServices::CacheLocation); +#endif } QString StandardPaths::dataLocation() @@ -53,3 +72,48 @@ QString StandardPaths::documentsLocation() return QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); #endif } + +QString StandardPaths::moviesLocation() +{ +#if QT_VERSION >= 0x050000 + return QStandardPaths::writableLocation(QStandardPaths::MoviesLocation); +#else + return QDesktopServices::storageLocation(QDesktopServices::MoviesLocation); +#endif +} + +QString StandardPaths::fontsLocation() +{ +#if QT_VERSION >= 0x050000 + return QStandardPaths::writableLocation(QStandardPaths::FontsLocation); +#else + return QDesktopServices::storageLocation(QDesktopServices::FontsLocation); +#endif +} + +QString StandardPaths::homeLocation() +{ +#if QT_VERSION >= 0x050000 + return QStandardPaths::writableLocation(QStandardPaths::HomeLocation); +#else + return QDesktopServices::storageLocation(QDesktopServices::HomeLocation); +#endif +} + +QString StandardPaths::musicLocation() +{ +#if QT_VERSION >= 0x050000 + return QStandardPaths::writableLocation(QStandardPaths::MusicLocation); +#else + return QDesktopServices::storageLocation(QDesktopServices::MusicLocation); +#endif +} + +QString StandardPaths::tempLocation() +{ +#if QT_VERSION >= 0x050000 + return QStandardPaths::writableLocation(QStandardPaths::TempLocation); +#else + return QDesktopServices::storageLocation(QDesktopServices::TempLocation); +#endif +} diff --git a/StandardPaths.h b/StandardPaths.h index e3c2386..92033e7 100755 --- a/StandardPaths.h +++ b/StandardPaths.h @@ -25,9 +25,16 @@ class StandardPaths { public: StandardPaths(); + static QString applicationsLocation(); + static QString cacheLocation(); static QString dataLocation(); static QString desktopLocation(); static QString documentsLocation(); + static QString fontsLocation(); + static QString homeLocation(); + static QString moviesLocation(); + static QString musicLocation(); + static QString tempLocation(); }; #endif // STANDARDPATHS_H diff --git a/UserInterface.cpp b/UserInterface.cpp index 80b80d2..1a40536 100755 --- a/UserInterface.cpp +++ b/UserInterface.cpp @@ -37,9 +37,12 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D ui(new Ui::UserInterface) { ui->setupUi(this); - this->setWindowIcon(QIcon(":/img/5sync.png")); profileOpen = 0; profileUI = 0; + defaultWindowTitle = this->windowTitle(); + + this->setWindowIcon(QIcon(":/img/5sync.png")); + this->setWindowTitle(defaultWindowTitle.arg(tr("Select profile"))); // init settings QSettings SyncSettings("Syping", "gta5sync"); @@ -134,6 +137,7 @@ void UserInterface::openProfile(QString profileName) profileUI->setProfileFolder(GTAV_ProfilesFolder + "/" + profileName, profileName); profileUI->setupProfileInterface(); QObject::connect(profileUI, SIGNAL(profileClosed()), this, SLOT(closeProfile())); + this->setWindowTitle(defaultWindowTitle.arg(profileName)); } void UserInterface::closeProfile() @@ -145,6 +149,7 @@ void UserInterface::closeProfile() profileUI->deleteLater(); delete profileUI; } + this->setWindowTitle(defaultWindowTitle.arg(tr("Select profile"))); } UserInterface::~UserInterface() diff --git a/UserInterface.h b/UserInterface.h index 894fa78..1fec791 100755 --- a/UserInterface.h +++ b/UserInterface.h @@ -52,6 +52,7 @@ private: Ui::UserInterface *ui; ProfileInterface *profileUI; bool profileOpen; + QString defaultWindowTitle; QString GTAV_Folder; QString GTAV_ProfilesFolder; void setupProfileUi(QStringList GTAV_Profiles);