window title changes, standard paths completed

This commit is contained in:
Rafael 2016-03-28 14:10:59 +02:00
parent 96c6d5072d
commit 517f446d12
4 changed files with 78 additions and 1 deletions

View file

@ -25,6 +25,25 @@
StandardPaths::StandardPaths() 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() QString StandardPaths::dataLocation()
@ -53,3 +72,48 @@ QString StandardPaths::documentsLocation()
return QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); return QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
#endif #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
}

View file

@ -25,9 +25,16 @@ class StandardPaths
{ {
public: public:
StandardPaths(); StandardPaths();
static QString applicationsLocation();
static QString cacheLocation();
static QString dataLocation(); static QString dataLocation();
static QString desktopLocation(); static QString desktopLocation();
static QString documentsLocation(); static QString documentsLocation();
static QString fontsLocation();
static QString homeLocation();
static QString moviesLocation();
static QString musicLocation();
static QString tempLocation();
}; };
#endif // STANDARDPATHS_H #endif // STANDARDPATHS_H

View file

@ -37,9 +37,12 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D
ui(new Ui::UserInterface) ui(new Ui::UserInterface)
{ {
ui->setupUi(this); ui->setupUi(this);
this->setWindowIcon(QIcon(":/img/5sync.png"));
profileOpen = 0; profileOpen = 0;
profileUI = 0; profileUI = 0;
defaultWindowTitle = this->windowTitle();
this->setWindowIcon(QIcon(":/img/5sync.png"));
this->setWindowTitle(defaultWindowTitle.arg(tr("Select profile")));
// init settings // init settings
QSettings SyncSettings("Syping", "gta5sync"); QSettings SyncSettings("Syping", "gta5sync");
@ -134,6 +137,7 @@ void UserInterface::openProfile(QString profileName)
profileUI->setProfileFolder(GTAV_ProfilesFolder + "/" + profileName, profileName); profileUI->setProfileFolder(GTAV_ProfilesFolder + "/" + profileName, profileName);
profileUI->setupProfileInterface(); profileUI->setupProfileInterface();
QObject::connect(profileUI, SIGNAL(profileClosed()), this, SLOT(closeProfile())); QObject::connect(profileUI, SIGNAL(profileClosed()), this, SLOT(closeProfile()));
this->setWindowTitle(defaultWindowTitle.arg(profileName));
} }
void UserInterface::closeProfile() void UserInterface::closeProfile()
@ -145,6 +149,7 @@ void UserInterface::closeProfile()
profileUI->deleteLater(); profileUI->deleteLater();
delete profileUI; delete profileUI;
} }
this->setWindowTitle(defaultWindowTitle.arg(tr("Select profile")));
} }
UserInterface::~UserInterface() UserInterface::~UserInterface()

View file

@ -52,6 +52,7 @@ private:
Ui::UserInterface *ui; Ui::UserInterface *ui;
ProfileInterface *profileUI; ProfileInterface *profileUI;
bool profileOpen; bool profileOpen;
QString defaultWindowTitle;
QString GTAV_Folder; QString GTAV_Folder;
QString GTAV_ProfilesFolder; QString GTAV_ProfilesFolder;
void setupProfileUi(QStringList GTAV_Profiles); void setupProfileUi(QStringList GTAV_Profiles);