add Area Location String to PictureDialog
This commit is contained in:
parent
5dc3e72faf
commit
043c657119
9 changed files with 133 additions and 9 deletions
|
@ -43,7 +43,7 @@ QString AppEnv::getGameFolder(bool *ok)
|
|||
dir.setPath(GTAV_FOLDER);
|
||||
if (dir.exists())
|
||||
{
|
||||
*ok = true;
|
||||
if (ok != NULL) *ok = true;
|
||||
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ QString AppEnv::getGameFolder(bool *ok)
|
|||
dir.setPath(GTAV_returnFolder);
|
||||
if (dir.exists())
|
||||
{
|
||||
*ok = true;
|
||||
if (ok != 0) *ok = true;
|
||||
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
@ -72,12 +72,12 @@ QString AppEnv::getGameFolder(bool *ok)
|
|||
dir.setPath(GTAV_defaultFolder);
|
||||
if (dir.exists())
|
||||
{
|
||||
*ok = true;
|
||||
if (ok != 0) *ok = true;
|
||||
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
*ok = false;
|
||||
if (ok != 0) *ok = false;
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
74
GlobalString.cpp
Executable file
74
GlobalString.cpp
Executable file
|
@ -0,0 +1,74 @@
|
|||
/*****************************************************************************
|
||||
* 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 <QLocale>
|
||||
#include <QSettings>
|
||||
#include <QFileInfo>
|
||||
#include <QApplication>
|
||||
#include "GlobalString.h"
|
||||
#include "config.h"
|
||||
|
||||
GlobalString::GlobalString()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
QString GlobalString::getString(QString valueStr, bool *ok)
|
||||
{
|
||||
QString globalString = valueStr;
|
||||
QSettings globalFile(getLanguageFile(), QSettings::IniFormat);
|
||||
globalFile.beginGroup("Global");
|
||||
QStringList globalStrList = globalFile.childKeys();
|
||||
if (globalStrList.contains(valueStr))
|
||||
{
|
||||
if (ok != 0) *ok = true;
|
||||
globalString = globalFile.value(valueStr, valueStr).toString();
|
||||
}
|
||||
globalFile.endGroup();
|
||||
return globalString;
|
||||
}
|
||||
|
||||
QString GlobalString::getLanguageFile()
|
||||
{
|
||||
QString language = getLanguage();
|
||||
QString languageFile = ":/global/global." + language + ".ini";
|
||||
if (!QFileInfo(languageFile).exists())
|
||||
{
|
||||
languageFile = ":/global/global.en.ini";
|
||||
}
|
||||
return languageFile;
|
||||
}
|
||||
|
||||
QString GlobalString::getLanguage()
|
||||
{
|
||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||
settings.beginGroup("Interface");
|
||||
QString language = settings.value("Language","System").toString();
|
||||
settings.endGroup();
|
||||
if (language == "System" || language.trimmed() == "")
|
||||
{
|
||||
QString languageName = QLocale::system().name();
|
||||
QStringList langList = languageName.split("_");
|
||||
if (langList.length() >= 1)
|
||||
{
|
||||
language = langList.at(0);
|
||||
}
|
||||
}
|
||||
return language;
|
||||
}
|
33
GlobalString.h
Executable file
33
GlobalString.h
Executable file
|
@ -0,0 +1,33 @@
|
|||
/*****************************************************************************
|
||||
* 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 GLOBALSTRING_H
|
||||
#define GLOBALSTRING_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
class GlobalString
|
||||
{
|
||||
public:
|
||||
GlobalString();
|
||||
static QString getString(QString valueStr, bool *ok = 0);
|
||||
static QString getLanguageFile();
|
||||
static QString getLanguage();
|
||||
};
|
||||
|
||||
#endif // GLOBALSTRING_H
|
|
@ -23,6 +23,7 @@
|
|||
#include "SidebarGenerator.h"
|
||||
#include "StandardPaths.h"
|
||||
#include "PictureExport.h"
|
||||
#include "GlobalString.h"
|
||||
#include "PictureCopy.h"
|
||||
#include "UiModLabel.h"
|
||||
|
||||
|
@ -52,6 +53,7 @@ PictureDialog::PictureDialog(ProfileDatabase *profileDB, QWidget *parent) :
|
|||
ui->cmdExport->setEnabled(0);
|
||||
plyrsList = QStringList();
|
||||
indexed = 0;
|
||||
picArea = "";
|
||||
picTitl = "";
|
||||
picPath = "";
|
||||
crewID = "";
|
||||
|
@ -155,6 +157,8 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, QString pictu
|
|||
crewID = QString::number(picture->getCrewNumber());
|
||||
plyrsList = picture->getPlayers();
|
||||
picTitl = picture->getPictureTitl();
|
||||
picArea = picture->getArea();
|
||||
picAreaStr = GlobalString::getString(picArea);
|
||||
|
||||
QString plyrsStr;
|
||||
if (plyrsList.length() >= 1)
|
||||
|
@ -180,7 +184,7 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, QString pictu
|
|||
if (crewID == "") { crewID = tr("No crew"); }
|
||||
|
||||
this->setWindowTitle(windowTitleStr.arg(picture->getPictureStr()));
|
||||
ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, plyrsStr, crewID, picTitl));
|
||||
ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, plyrsStr, crewID, picTitl, picAreaStr));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -73,6 +73,8 @@ private:
|
|||
QString jsonDrawString;
|
||||
QString windowTitleStr;
|
||||
QStringList plyrsList;
|
||||
QString picAreaStr;
|
||||
QString picArea;
|
||||
QString picTitl;
|
||||
QString picPath;
|
||||
QString crewID;
|
||||
|
|
|
@ -75,10 +75,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><span style=" font-weight:600;">Title: </span>%6<br>
|
||||
<span style=" font-weight:600;">Location: </span>%1, %2, %3 <br>
|
||||
<span style=" font-weight:600;">Players: </span>%4<br>
|
||||
<span style=" font-weight:600;">Crew ID: </span>%5</string>
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">Title: </span>%6<br/><span style=" font-weight:600;">Location: </span>%7 (%1, %2, %3)<br/><span style=" font-weight:600;">Players: </span>%4<br/><span style=" font-weight:600;">Crew ID: </span>%5</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
|
|
@ -55,6 +55,7 @@ SnapmaticPicture::SnapmaticPicture(const QString &fileName, QObject *parent) : Q
|
|||
jsonLocY = 0;
|
||||
jsonLocZ = 0;
|
||||
jsonCrewID = 0;
|
||||
jsonArea = "";
|
||||
jsonPlyrsList = QStringList();
|
||||
}
|
||||
|
||||
|
@ -333,6 +334,10 @@ void SnapmaticPicture::parseJsonContent()
|
|||
if (locMap.contains("y")) { jsonLocY = locMap["y"].toDouble(); }
|
||||
if (locMap.contains("z")) { jsonLocZ = locMap["z"].toDouble(); }
|
||||
}
|
||||
if (jsonMap.contains("area"))
|
||||
{
|
||||
jsonArea = jsonMap["area"].toString();
|
||||
}
|
||||
if (jsonMap.contains("crewid"))
|
||||
{
|
||||
jsonCrewID = jsonMap["crewid"].toInt();
|
||||
|
@ -350,6 +355,11 @@ bool SnapmaticPicture::isJsonOk()
|
|||
return jsonOk;
|
||||
}
|
||||
|
||||
QString SnapmaticPicture::getArea()
|
||||
{
|
||||
return jsonArea;
|
||||
}
|
||||
|
||||
QString SnapmaticPicture::getJsonStr()
|
||||
{
|
||||
return jsonStr;
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
|
||||
// JSON
|
||||
bool isJsonOk();
|
||||
QString getArea();
|
||||
int getCrewNumber();
|
||||
QString getJsonStr();
|
||||
double getLocationX();
|
||||
|
@ -85,6 +86,7 @@ private:
|
|||
double jsonLocX;
|
||||
double jsonLocY;
|
||||
double jsonLocZ;
|
||||
QString jsonArea;
|
||||
QStringList jsonPlyrsList;
|
||||
|
||||
signals:
|
||||
|
|
|
@ -31,6 +31,7 @@ SOURCES += main.cpp \
|
|||
DatabaseThread.cpp \
|
||||
ExportDialog.cpp \
|
||||
ExportThread.cpp \
|
||||
GlobalString.cpp \
|
||||
IconLoader.cpp \
|
||||
OptionsDialog.cpp \
|
||||
PictureCopy.cpp \
|
||||
|
@ -61,6 +62,7 @@ HEADERS += \
|
|||
DatabaseThread.h \
|
||||
ExportDialog.h \
|
||||
ExportThread.h \
|
||||
GlobalString.h \
|
||||
IconLoader.h \
|
||||
OptionsDialog.h \
|
||||
PictureCopy.h \
|
||||
|
|
Loading…
Reference in a new issue