added telemetry

This commit is contained in:
Syping 2018-01-11 08:41:00 +01:00
parent d3ce20a710
commit d0caea372c
21 changed files with 851 additions and 44 deletions

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
DOCKER_IMAGE=i386/debian:jessie DOCKER_IMAGE=i386/debian:jessie
PROJECT_DIR_DOCKER=/gta5view/ PROJECT_DIR_DOCKER=/gta5view
cd $PROJECT_DIR && \ cd $PROJECT_DIR && \
docker pull $DOCKER_IMAGE && \ docker pull $DOCKER_IMAGE && \

View file

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC * gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016-2017 Syping * Copyright (C) 2016-2018 Syping
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -33,7 +33,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
QString appVersion = qApp->applicationVersion(); QString appVersion = qApp->applicationVersion();
QString buildType = tr(GTA5SYNC_BUILDTYPE); QString buildType = tr(GTA5SYNC_BUILDTYPE);
buildType.replace("_", " "); buildType.replace("_", " ");
QString projectBuild = GTA5SYNC_BUILDDATETIME; QString projectBuild = AppEnv::getBuildDateTime();
QString buildStr = GTA5SYNC_BUILDSTRING; QString buildStr = GTA5SYNC_BUILDSTRING;
// Translator Comments // Translator Comments
@ -102,10 +102,15 @@ AboutDialog::AboutDialog(QWidget *parent) :
ui->labAbout->setText(aboutStr.arg(GTA5SYNC_APPSTR, projectDes, appVersion % " (" % buildType % ")", projectBuild, buildStr, qVersion(), copyrightDesA)); ui->labAbout->setText(aboutStr.arg(GTA5SYNC_APPSTR, projectDes, appVersion % " (" % buildType % ")", projectBuild, buildStr, qVersion(), copyrightDesA));
this->setWindowTitle(titleStr.arg(GTA5SYNC_APPSTR)); this->setWindowTitle(titleStr.arg(GTA5SYNC_APPSTR));
// Set Icon for Close Button
if (QIcon::hasThemeIcon("dialog-close")) if (QIcon::hasThemeIcon("dialog-close"))
{ {
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close")); ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
} }
else if (QIcon::hasThemeIcon("gtk-close"))
{
ui->cmdClose->setIcon(QIcon::fromTheme("gtk-close"));
}
// DPI calculation // DPI calculation
qreal screenRatio = AppEnv::screenRatio(); qreal screenRatio = AppEnv::screenRatio();

View file

@ -37,6 +37,13 @@ AppEnv::AppEnv()
} }
// Build Stuff
QString AppEnv::getBuildDateTime()
{
return GTA5SYNC_BUILDDATETIME;
}
// Folder Stuff // Folder Stuff
QString AppEnv::getGameFolder(bool *ok) QString AppEnv::getGameFolder(bool *ok)

View file

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC * gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016-2017 Syping * Copyright (C) 2016-2018 Syping
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -27,6 +27,9 @@ class AppEnv
public: public:
AppEnv(); AppEnv();
// Build Stuff
static QString getBuildDateTime();
// Folder Stuff // Folder Stuff
static QString getGameFolder(bool *ok = 0); static QString getGameFolder(bool *ok = 0);
static bool setGameFolder(QString gameFolder); static bool setGameFolder(QString gameFolder);

View file

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC * gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016-2017 Syping * Copyright (C) 2017-2018 Syping
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -37,8 +37,35 @@ ImageEditorDialog::ImageEditorDialog(SnapmaticPicture *picture, QString profileN
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
ui->setupUi(this); ui->setupUi(this);
ui->cmdClose->setDefault(true);
ui->cmdClose->setFocus(); ui->cmdClose->setFocus();
// Set Icon for Close Button
if (QIcon::hasThemeIcon("dialog-close"))
{
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
}
else if (QIcon::hasThemeIcon("gtk-close"))
{
ui->cmdClose->setIcon(QIcon::fromTheme("gtk-close"));
}
// Set Icon for Import Button
if (QIcon::hasThemeIcon("document-import"))
{
ui->cmdReplace->setIcon(QIcon::fromTheme("document-import"));
}
// Set Icon for Overwrite Button
if (QIcon::hasThemeIcon("document-save"))
{
ui->cmdSave->setIcon(QIcon::fromTheme("document-save"));
}
else if (QIcon::hasThemeIcon("gtk-save"))
{
ui->cmdSave->setIcon(QIcon::fromTheme("gtk-save"));
}
// DPI calculation // DPI calculation
qreal screenRatio = AppEnv::screenRatio(); qreal screenRatio = AppEnv::screenRatio();

View file

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC * gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2017 Syping * Copyright (C) 2017-2018 Syping
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -55,14 +55,25 @@ ImportDialog::ImportDialog(QWidget *parent) :
avatarAreaImage = QImage(":/img/avatarareaimport.png"); avatarAreaImage = QImage(":/img/avatarareaimport.png");
selectedColour = QColor::fromRgb(0, 0, 0, 255); selectedColour = QColor::fromRgb(0, 0, 0, 255);
// Set Icon for OK Button
if (QIcon::hasThemeIcon("dialog-ok")) if (QIcon::hasThemeIcon("dialog-ok"))
{ {
ui->cmdOK->setIcon(QIcon::fromTheme("dialog-ok")); ui->cmdOK->setIcon(QIcon::fromTheme("dialog-ok"));
} }
else if (QIcon::hasThemeIcon("gtk-ok"))
{
ui->cmdOK->setIcon(QIcon::fromTheme("gtk-ok"));
}
// Set Icon for Cancel Button
if (QIcon::hasThemeIcon("dialog-cancel")) if (QIcon::hasThemeIcon("dialog-cancel"))
{ {
ui->cmdCancel->setIcon(QIcon::fromTheme("dialog-cancel")); ui->cmdCancel->setIcon(QIcon::fromTheme("dialog-cancel"));
} }
else if (QIcon::hasThemeIcon("gtk-cancel"))
{
ui->cmdCancel->setIcon(QIcon::fromTheme("gtk-cancel"));
}
ui->cbIgnore->setChecked(false); ui->cbIgnore->setChecked(false);
ui->labColour->setText(tr("Background Colour: <span style=\"color: %1\">%1</span>").arg(selectedColour.name())); ui->labColour->setText(tr("Background Colour: <span style=\"color: %1\">%1</span>").arg(selectedColour.name()));

View file

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC * gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2017 Syping * Copyright (C) 2017-2018 Syping
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -38,10 +38,28 @@ JsonEditorDialog::JsonEditorDialog(SnapmaticPicture *picture, QWidget *parent) :
ui->setupUi(this); ui->setupUi(this);
ui->cmdClose->setDefault(true); ui->cmdClose->setDefault(true);
ui->cmdClose->setFocus();
// Set Icon for Close Button
if (QIcon::hasThemeIcon("dialog-close")) if (QIcon::hasThemeIcon("dialog-close"))
{ {
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close")); ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
} }
else if (QIcon::hasThemeIcon("gtk-close"))
{
ui->cmdClose->setIcon(QIcon::fromTheme("gtk-close"));
}
// Set Icon for Save Button
if (QIcon::hasThemeIcon("document-save"))
{
ui->cmdSave->setIcon(QIcon::fromTheme("document-save"));
}
else if (QIcon::hasThemeIcon("gtk-save"))
{
ui->cmdSave->setIcon(QIcon::fromTheme("gtk-save"));
}
jsonCode = picture->getJsonStr(); jsonCode = picture->getJsonStr();
#if QT_VERSION >= 0x050200 #if QT_VERSION >= 0x050200

View file

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC * gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016-2017 Syping * Copyright (C) 2016-2018 Syping
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -64,14 +64,25 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
ui->rbPicDesktopRes->setText(ui->rbPicDesktopRes->text().arg(QString::number(desktopSizeWidth), QString::number(desktopSizeHeight))); ui->rbPicDesktopRes->setText(ui->rbPicDesktopRes->text().arg(QString::number(desktopSizeWidth), QString::number(desktopSizeHeight)));
ui->rbPicDefaultRes->setText(ui->rbPicDefaultRes->text().arg(QString::number(defExportSize.width()), QString::number(defExportSize.height()))); ui->rbPicDefaultRes->setText(ui->rbPicDefaultRes->text().arg(QString::number(defExportSize.width()), QString::number(defExportSize.height())));
// Set Icon for OK Button
if (QIcon::hasThemeIcon("dialog-ok")) if (QIcon::hasThemeIcon("dialog-ok"))
{ {
ui->cmdOK->setIcon(QIcon::fromTheme("dialog-ok")); ui->cmdOK->setIcon(QIcon::fromTheme("dialog-ok"));
} }
else if (QIcon::hasThemeIcon("gtk-ok"))
{
ui->cmdOK->setIcon(QIcon::fromTheme("gtk-ok"));
}
// Set Icon for Cancel Button
if (QIcon::hasThemeIcon("dialog-cancel")) if (QIcon::hasThemeIcon("dialog-cancel"))
{ {
ui->cmdCancel->setIcon(QIcon::fromTheme("dialog-cancel")); ui->cmdCancel->setIcon(QIcon::fromTheme("dialog-cancel"));
} }
else if (QIcon::hasThemeIcon("gtk-cancel"))
{
ui->cmdCancel->setIcon(QIcon::fromTheme("gtk-cancel"));
}
setupTreeWidget(); setupTreeWidget();
setupLanguageBox(); setupLanguageBox();

View file

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC * gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016-2017 Syping * Copyright (C) 2016-2018 Syping
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -166,11 +166,15 @@ void PictureDialog::setupPictureDialog()
// Event connects // Event connects
connect(ui->labJSON, SIGNAL(resized(QSize)), this, SLOT(adaptNewDialogSize(QSize))); connect(ui->labJSON, SIGNAL(resized(QSize)), this, SLOT(adaptNewDialogSize(QSize)));
// Dialog buttons // Set Icon for Close Button
if (QIcon::hasThemeIcon("dialog-close")) if (QIcon::hasThemeIcon("dialog-close"))
{ {
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close")); ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
} }
else if (QIcon::hasThemeIcon("gtk-close"))
{
ui->cmdClose->setIcon(QIcon::fromTheme("gtk-close"));
}
installEventFilter(this); installEventFilter(this);
installEventFilter(ui->labPicture); installEventFilter(ui->labPicture);

View file

@ -37,7 +37,9 @@ PlayerListDialog::PlayerListDialog(QStringList players, ProfileDatabase *profile
ui->setupUi(this); ui->setupUi(this);
ui->cmdCancel->setDefault(true); ui->cmdCancel->setDefault(true);
ui->cmdCancel->setFocus();
// Set Icon for Apply Button
if (QIcon::hasThemeIcon("dialog-ok-apply")) if (QIcon::hasThemeIcon("dialog-ok-apply"))
{ {
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok-apply")); ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok-apply"));
@ -46,16 +48,40 @@ PlayerListDialog::PlayerListDialog(QStringList players, ProfileDatabase *profile
{ {
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-apply")); ui->cmdApply->setIcon(QIcon::fromTheme("dialog-apply"));
} }
else if (QIcon::hasThemeIcon("gtk-apply"))
{
ui->cmdApply->setIcon(QIcon::fromTheme("gtk-apply"));
}
else if (QIcon::hasThemeIcon("dialog-ok")) else if (QIcon::hasThemeIcon("dialog-ok"))
{ {
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok")); ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok"));
} }
else if (QIcon::hasThemeIcon("gtk-ok"))
{
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok"));
}
// Set Icon for Cancel Button
if (QIcon::hasThemeIcon("dialog-cancel")) if (QIcon::hasThemeIcon("dialog-cancel"))
{ {
ui->cmdCancel->setIcon(QIcon::fromTheme("dialog-cancel")); ui->cmdCancel->setIcon(QIcon::fromTheme("dialog-cancel"));
} }
else if (QIcon::hasThemeIcon("gtk-cancel"))
{
ui->cmdCancel->setIcon(QIcon::fromTheme("gtk-cancel"));
}
// Set Icon for Manage Buttons
if (QIcon::hasThemeIcon("go-previous") && QIcon::hasThemeIcon("go-next") && QIcon::hasThemeIcon("list-add"))
{
ui->cmdMakeAv->setIcon(QIcon::fromTheme("go-previous"));
ui->cmdMakeSe->setIcon(QIcon::fromTheme("go-next"));
ui->cmdMakeAd->setIcon(QIcon::fromTheme("list-add"));
}
else
{
drawSwitchButtons(); drawSwitchButtons();
}
buildInterface(); buildInterface();
// DPI calculation // DPI calculation

View file

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC * gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016-2017 Syping * Copyright (C) 2016-2018 Syping
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -79,10 +79,21 @@ ProfileInterface::ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *cre
ui->labVersion->setText(QString("%1 %2").arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER)); ui->labVersion->setText(QString("%1 %2").arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER));
ui->saProfileContent->setFilesMode(true); ui->saProfileContent->setFilesMode(true);
// Set Icon for Close Button
if (QIcon::hasThemeIcon("dialog-close")) if (QIcon::hasThemeIcon("dialog-close"))
{ {
ui->cmdCloseProfile->setIcon(QIcon::fromTheme("dialog-close")); ui->cmdCloseProfile->setIcon(QIcon::fromTheme("dialog-close"));
} }
else if (QIcon::hasThemeIcon("gtk-close"))
{
ui->cmdCloseProfile->setIcon(QIcon::fromTheme("gtk-close"));
}
// Set Icon for Import Button
if (QIcon::hasThemeIcon("document-import"))
{
ui->cmdImport->setIcon(QIcon::fromTheme("document-import"));
}
// DPI calculation // DPI calculation
qreal screenRatio = AppEnv::screenRatio(); qreal screenRatio = AppEnv::screenRatio();

View file

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC * gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016-2017 Syping * Copyright (C) 2016-2018 Syping
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -39,7 +39,9 @@ SnapmaticEditor::SnapmaticEditor(CrewDatabase *crewDB, ProfileDatabase *profileD
ui->setupUi(this); ui->setupUi(this);
ui->cmdCancel->setDefault(true); ui->cmdCancel->setDefault(true);
ui->cmdCancel->setFocus();
// Set Icon for Apply Button
if (QIcon::hasThemeIcon("dialog-ok-apply")) if (QIcon::hasThemeIcon("dialog-ok-apply"))
{ {
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok-apply")); ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok-apply"));
@ -48,14 +50,28 @@ SnapmaticEditor::SnapmaticEditor(CrewDatabase *crewDB, ProfileDatabase *profileD
{ {
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-apply")); ui->cmdApply->setIcon(QIcon::fromTheme("dialog-apply"));
} }
else if (QIcon::hasThemeIcon("gtk-apply"))
{
ui->cmdApply->setIcon(QIcon::fromTheme("gtk-apply"));
}
else if (QIcon::hasThemeIcon("dialog-ok")) else if (QIcon::hasThemeIcon("dialog-ok"))
{ {
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok")); ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok"));
} }
else if (QIcon::hasThemeIcon("gtk-ok"))
{
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok"));
}
// Set Icon for Cancel Button
if (QIcon::hasThemeIcon("dialog-cancel")) if (QIcon::hasThemeIcon("dialog-cancel"))
{ {
ui->cmdCancel->setIcon(QIcon::fromTheme("dialog-cancel")); ui->cmdCancel->setIcon(QIcon::fromTheme("dialog-cancel"));
} }
else if (QIcon::hasThemeIcon("gtk-cancel"))
{
ui->cmdCancel->setIcon(QIcon::fromTheme("gtk-cancel"));
}
snapmaticTitle = QString(); snapmaticTitle = QString();
smpic = 0; smpic = 0;

384
TelemetryClass.cpp Normal file
View file

@ -0,0 +1,384 @@
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2018 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 "TelemetryClassAuthenticator.h"
#include "TelemetryClass.h"
#include "AppEnv.h"
#include "config.h"
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QHttpMultiPart>
#include <QStringBuilder>
#include <QNetworkReply>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QSettings>
#include <QSysInfo>
#include <QLocale>
#include <QBuffer>
#include <QDebug>
#include <QFile>
#include <QDir>
#ifdef GTA5SYNC_WIN
#include "windows.h"
#include "intrin.h"
#endif
TelemetryClass TelemetryClass::telemetryClassInstance;
void TelemetryClass::init()
{
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
settings.beginGroup("Telemetry");
#ifndef GTA5SYNC_BUILDTYPE_DEV
telemetryEnabled = settings.value("IsEnabled", false).toBool();
#else
telemetryEnabled = true; // Always enable Telemetry for Developer Versions
#endif
telemetryClientID = settings.value("ClientID", QString()).toString();
settings.endGroup();
}
void TelemetryClass::refresh()
{
init();
}
bool TelemetryClass::canPush()
{
if (!isEnabled() || !isRegistered() || !TelemetryClassAuthenticator::havePushURL()) return false;
return true;
}
bool TelemetryClass::canRegister()
{
if (!isEnabled() || isRegistered() || !TelemetryClassAuthenticator::haveRegURL()) return false;
return true;
}
bool TelemetryClass::isEnabled()
{
return telemetryEnabled;
}
bool TelemetryClass::isStateForced()
{
return telemetryStateForced;
}
bool TelemetryClass::isRegistered()
{
return !telemetryClientID.isEmpty();
}
void TelemetryClass::setEnabled(bool enabled)
{
telemetryEnabled = enabled;
telemetryStateForced = true;
}
void TelemetryClass::setDisabled(bool disabled)
{
telemetryEnabled = !disabled;
telemetryStateForced = true;
}
void TelemetryClass::push(TelemetryCategory category)
{
if (!canPush()) return;
switch (category)
{
case TelemetryCategory::OperatingSystemSpec:
push(category, getOperatingSystem());
break;
case TelemetryCategory::HardwareSpec:
push(category, getSystemHardware());
break;
case TelemetryCategory::UserLocaleData:
push(category, getSystemLocaleList());
break;
case TelemetryCategory::ApplicationConfiguration:
break;
case TelemetryCategory::ApplicationSpec:
push(category, getApplicationSpec());
break;
}
}
void TelemetryClass::push(TelemetryCategory category, QJsonDocument json)
{
if (!canPush()) return;
QJsonDocument jsonDocument(json);
QJsonObject jsonObject = jsonDocument.object();
jsonObject["ClientID"] = telemetryClientID;
jsonDocument.setObject(jsonObject);
QHttpMultiPart *httpMultiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType);
QHttpPart categoryPart;
categoryPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"json-category\""));
categoryPart.setBody(categoryToString(category).toUtf8());
QHttpPart jsonPart;
jsonPart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/octet-stream"));
jsonPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"json-deflated\""));
jsonPart.setBody(qCompress(jsonDocument.toJson(QJsonDocument::Compact)));
httpMultiPart->append(categoryPart);
httpMultiPart->append(jsonPart);
QNetworkAccessManager *netManager = new QNetworkAccessManager();
QNetworkRequest netRequest(TelemetryClassAuthenticator::getTrackingPushURL());
QNetworkReply *netReply = netManager->post(netRequest, httpMultiPart);
httpMultiPart->setParent(netReply);
connect(netManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(pushFinished(QNetworkReply*)));
}
QJsonDocument TelemetryClass::getOperatingSystem()
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
#if QT_VERSION >= 0x050400
jsonObject["OSName"] = QSysInfo::prettyProductName();
jsonObject["OSArch"] = QSysInfo::currentCpuArchitecture();
#endif
jsonDocument.setObject(jsonObject);
return jsonDocument;
}
QJsonDocument TelemetryClass::getSystemHardware()
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
#ifdef GTA5SYNC_WIN
{
int CPUInfo[4] = {-1};
unsigned nExIds, i = 0;
char CPUBrandString[0x40];
__cpuid(CPUInfo, 0x80000000);
nExIds = CPUInfo[0];
for (i = 0x80000000; i <= nExIds; ++i)
{
__cpuid(CPUInfo, i);
if (i == 0x80000002) { memcpy(CPUBrandString, CPUInfo, sizeof(CPUInfo)); }
else if (i == 0x80000003) { memcpy(CPUBrandString + 16, CPUInfo, sizeof(CPUInfo)); }
else if (i == 0x80000004) { memcpy(CPUBrandString + 32, CPUInfo, sizeof(CPUInfo)); }
}
jsonObject["CPUName"] = QString(CPUBrandString).trimmed();
SYSTEM_INFO sysInfo;
GetSystemInfo(&sysInfo);
jsonObject["CPUThreads"] = QString::number(sysInfo.dwNumberOfProcessors);
MEMORYSTATUSEX statex;
statex.dwLength = sizeof(statex);
GlobalMemoryStatusEx(&statex);
jsonObject["SystemRAM"] = QString(QString::number((statex.ullTotalPhys / 1024) / 1024) % "MB");
}
#else
QDir procDir("/proc");
if (procDir.exists())
{
QFile cpuInfo("/proc/cpuinfo");
if (cpuInfo.open(QFile::ReadOnly))
{
QByteArray cpuInfoArray = cpuInfo.readAll();
QBuffer cpuInfoBuffer(&cpuInfoArray);
if (cpuInfoBuffer.open(QBuffer::ReadOnly))
{
QByteArray toFind = "model name";
while (cpuInfoBuffer.canReadLine())
{
QByteArray cpuData = cpuInfoBuffer.readLine();
if (cpuData.left(toFind.length()) == toFind)
{
jsonObject["CPUName"] = QString::fromUtf8(cpuData).split(':').at(1).trimmed();
break;
}
}
int cpuThreads = 0;
toFind = "processor";
cpuInfoBuffer.seek(0);
while (cpuInfoBuffer.canReadLine())
{
QByteArray cpuData = cpuInfoBuffer.readLine();
if (cpuData.left(toFind.length()) == toFind)
{
cpuThreads++;
}
}
jsonObject["CPUThreads"] = QString::number(cpuThreads);
}
}
QFile memInfo("/proc/meminfo");
if (memInfo.open(QFile::ReadOnly))
{
QByteArray memInfoArray = memInfo.readAll();
QBuffer memInfoBuffer(&memInfoArray);
if (memInfoBuffer.open(QBuffer::ReadOnly))
{
QByteArray toFind = "MemTotal:";
while (memInfoBuffer.canReadLine())
{
QByteArray memData = memInfoBuffer.readLine();
if (memData.left(toFind.length()) == toFind)
{
QByteArray memDataVal = memData.mid(toFind.length()).trimmed();
int totalMemoryInKB = memDataVal.left(memDataVal.length() - 3).toInt();
jsonObject["SystemRAM"] = QString(QString::number(totalMemoryInKB / 1024) % "MB");
break;
}
}
}
}
}
#endif
jsonDocument.setObject(jsonObject);
return jsonDocument;
}
QJsonDocument TelemetryClass::getApplicationSpec()
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
#if QT_VERSION >= 0x050400
jsonObject["Arch"] = QSysInfo::buildCpuArchitecture();
#endif
jsonObject["Name"] = GTA5SYNC_APPSTR;
jsonObject["Version"] = GTA5SYNC_APPVER;
jsonObject["BuildDateTime"] = AppEnv::getBuildDateTime();
jsonObject["BuildType"] = GTA5SYNC_BUILDTYPE;
jsonObject["QtVersion"] = qVersion();
jsonDocument.setObject(jsonObject);
return jsonDocument;
}
QJsonDocument TelemetryClass::getSystemLocaleList()
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
QStringList languagesList = QLocale::system().uiLanguages();
if (languagesList.length() >= 1)
{
jsonObject["PrimaryLanguage"] = languagesList.at(0);
}
if (languagesList.length() >= 2)
{
languagesList.removeAt(0);
jsonObject["SecondaryLanguages"] = QJsonValue::fromVariant(languagesList);
}
jsonDocument.setObject(jsonObject);
return jsonDocument;
}
QString TelemetryClass::categoryToString(TelemetryCategory category)
{
switch (category)
{
case TelemetryCategory::OperatingSystemSpec:
return QString("OperatingSystemSpec");
break;
case TelemetryCategory::HardwareSpec:
return QString("HardwareSpec");
break;
case TelemetryCategory::UserLocaleData:
return QString("UserLocaleData");
break;
case TelemetryCategory::ApplicationConfiguration:
return QString("ApplicationConfiguration");
break;
case TelemetryCategory::UserFeedback:
return QString("UserFeedback");
break;
case TelemetryCategory::ApplicationSpec:
return QString("ApplicationSpec");
break;
case TelemetryCategory::CustomEmitted:
return QString("CustomEmitted");
break;
default:
return QString("UnknownCategory");
break;
}
}
void TelemetryClass::registerClient()
{
QNetworkAccessManager *netManager = new QNetworkAccessManager();
QNetworkRequest netRequest(TelemetryClassAuthenticator::getTrackingRegURL());
netManager->get(netRequest);
connect(netManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(registerFinished(QNetworkReply*)));
}
void TelemetryClass::pushStartupSet()
{
push(TelemetryCategory::ApplicationSpec);
push(TelemetryCategory::UserLocaleData);
push(TelemetryCategory::OperatingSystemSpec);
push(TelemetryCategory::HardwareSpec);
}
void TelemetryClass::pushFinished(QNetworkReply *reply)
{
#ifdef GTA5SYNC_DEBUG
qDebug() << "Telemetry" << reply->readAll().trimmed();
#endif
reply->deleteLater();
sender()->deleteLater();
emit pushed();
}
void TelemetryClass::registerFinished(QNetworkReply *reply)
{
if (reply->canReadLine())
{
QByteArray readData = reply->readLine();
if (QString::fromUtf8(readData).trimmed() == QString("Registration success!") && reply->canReadLine())
{
readData = reply->readLine();
telemetryClientID = QString::fromUtf8(readData).trimmed();
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
settings.beginGroup("Telemetry");
settings.setValue("ClientID", telemetryClientID);
settings.endGroup();
#ifdef GTA5SYNC_DEBUG
qDebug() << "Telemetry" << QString("Registration success!");
#endif
}
else
{
#ifdef GTA5SYNC_DEBUG
qDebug() << "Telemetry" << QString("Registration failed!");
#endif
}
}
else
{
#ifdef GTA5SYNC_DEBUG
qDebug() << "Telemetry" << QString("Registration failed!");
#endif
}
reply->deleteLater();
sender()->deleteLater();
emit registered();
}

75
TelemetryClass.h Normal file
View file

@ -0,0 +1,75 @@
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2018 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 TELEMETRYCLASS_H
#define TELEMETRYCLASS_H
#include <QNetworkReply>
#include <QApplication>
#include <QObject>
#include <QString>
enum class TelemetryCategory : int { OperatingSystemSpec = 0, HardwareSpec = 1, UserLocaleData = 2, ApplicationConfiguration = 3, UserFeedback = 4, ApplicationSpec = 5, CustomEmitted = 99};
class TelemetryClass : public QObject
{
Q_OBJECT
public:
static TelemetryClass* getInstance() { return &telemetryClassInstance; }
static QString categoryToString(TelemetryCategory category);
bool canPush();
bool canRegister();
bool isEnabled();
bool isStateForced();
bool isRegistered();
void init();
void refresh();
void setEnabled(bool enabled);
void setDisabled(bool disabled);
void push(TelemetryCategory category);
void push(TelemetryCategory category, const QJsonDocument json);
void registerClient();
private:
static TelemetryClass telemetryClassInstance;
QString telemetryClientID;
bool telemetryEnabled;
bool telemetryStateForced;
QJsonDocument getOperatingSystem();
QJsonDocument getSystemHardware();
QJsonDocument getApplicationSpec();
QJsonDocument getSystemLocaleList();
public slots:
void pushStartupSet();
private slots:
void pushFinished(QNetworkReply *reply);
void registerFinished(QNetworkReply *reply);
signals:
void pushed();
void registered();
};
extern TelemetryClass telemetryClass;
#define Telemetry TelemetryClass::getInstance()
#endif // TELEMETRYCLASS_H

View file

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC * gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016-2017 Syping * Copyright (C) 2016-2018 Syping
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -63,16 +63,41 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D
this->setWindowTitle(defaultWindowTitle.arg(tr("Select Profile"))); this->setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
ui->labVersion->setText(QString("%1 %2").arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER)); ui->labVersion->setText(QString("%1 %2").arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER));
// Set Icon for Close Button
if (QIcon::hasThemeIcon("dialog-close")) if (QIcon::hasThemeIcon("dialog-close"))
{ {
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close")); ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
} }
else if (QIcon::hasThemeIcon("gtk-close"))
{
ui->cmdClose->setIcon(QIcon::fromTheme("gtk-close"));
}
// Set Icon for Reload Button
if (QIcon::hasThemeIcon("view-refresh"))
{
ui->cmdReload->setIcon(QIcon::fromTheme("view-refresh"));
}
else if (QIcon::hasThemeIcon("reload"))
{
ui->cmdReload->setIcon(QIcon::fromTheme("reload"));
}
// Set Icon for Preferences Menu Item
if (QIcon::hasThemeIcon("preferences-system")) if (QIcon::hasThemeIcon("preferences-system"))
{ {
#ifndef Q_OS_MACOS // Setting icon for preferences/settings/options lead to a crash in Mac OS X #ifndef Q_OS_MACOS // Setting icon for preferences/settings/options lead to a crash in Mac OS X
ui->actionOptions->setIcon(QIcon::fromTheme("preferences-system")); ui->actionOptions->setIcon(QIcon::fromTheme("preferences-system"));
#endif #endif
} }
else if (QIcon::hasThemeIcon("configure"))
{
#ifndef Q_OS_MACOS // Setting icon for preferences/settings/options lead to a crash in Mac OS X
ui->actionOptions->setIcon(QIcon::fromTheme("configure"));
#endif
}
// Set Icon for Exit Menu Item
if (QIcon::hasThemeIcon("application-exit")) if (QIcon::hasThemeIcon("application-exit"))
{ {
#ifndef Q_OS_MACOS // Setting icon for exit/quit lead to a crash in Mac OS X #ifndef Q_OS_MACOS // Setting icon for exit/quit lead to a crash in Mac OS X

View file

@ -50,7 +50,7 @@
#ifndef GTA5SYNC_APPVER #ifndef GTA5SYNC_APPVER
#ifndef GTA5SYNC_DAILYB #ifndef GTA5SYNC_DAILYB
#define GTA5SYNC_APPVER "1.5.0-dev7" #define GTA5SYNC_APPVER "1.5.0-dev8"
#else #else
#define GTA5SYNC_APPVER GTA5SYNC_DAILYB #define GTA5SYNC_APPVER GTA5SYNC_DAILYB
#endif #endif

View file

@ -1,6 +1,6 @@
#/***************************************************************************** #/*****************************************************************************
#* gta5view Grand Theft Auto V Profile Viewer #* gta5view Grand Theft Auto V Profile Viewer
#* Copyright (C) 2015-2017 Syping #* Copyright (C) 2015-2018 Syping
#* #*
#* This program is free software: you can redistribute it and/or modify #* 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 #* it under the terms of the GNU General Public License as published by
@ -60,9 +60,11 @@ SOURCES += main.cpp \
SnapmaticWidget.cpp \ SnapmaticWidget.cpp \
StandardPaths.cpp \ StandardPaths.cpp \
StringParser.cpp \ StringParser.cpp \
TelemetryClass.cpp \
TranslationClass.cpp \ TranslationClass.cpp \
UserInterface.cpp \ UserInterface.cpp \
anpro/JSHighlighter.cpp \ anpro/JSHighlighter.cpp \
tmext/TelemetryClassAuthenticator.cpp \
uimod/UiModLabel.cpp \ uimod/UiModLabel.cpp \
uimod/UiModWidget.cpp uimod/UiModWidget.cpp
@ -98,9 +100,11 @@ HEADERS += \
SnapmaticWidget.h \ SnapmaticWidget.h \
StandardPaths.h \ StandardPaths.h \
StringParser.h \ StringParser.h \
TelemetryClass.h \
TranslationClass.h \ TranslationClass.h \
UserInterface.h \ UserInterface.h \
anpro/JSHighlighter.h \ anpro/JSHighlighter.h \
tmext/TelemetryClassAuthenticator.h \
uimod/UiModLabel.h \ uimod/UiModLabel.h \
uimod/UiModWidget.h uimod/UiModWidget.h
@ -142,7 +146,7 @@ DISTFILES += res/app.rc \
lang/gta5sync_no.ts \ lang/gta5sync_no.ts \
lang/README.txt lang/README.txt
INCLUDEPATH += ./anpro ./uimod INCLUDEPATH += ./anpro ./tmext ./uimod
# GTA5SYNC/GTA5VIEW ONLY # GTA5SYNC/GTA5VIEW ONLY
@ -156,6 +160,7 @@ win32: DEFINES += GTA5SYNC_WIN
win32: RC_FILE += res/app.rc win32: RC_FILE += res/app.rc
win32: LIBS += -luser32 win32: LIBS += -luser32
win32: CONFIG -= embed_manifest_exe win32: CONFIG -= embed_manifest_exe
contains(DEFINES, GTA5SYNC_APV): greaterThan(QT_MAJOR_VERSION, 4): greaterThan(QT_MINOR_VERSION, 1): win32: LIBS += -ldwmapi
# MAC OS X ONLY # MAC OS X ONLY
macx: ICON = res/5sync.icns macx: ICON = res/5sync.icns
@ -208,3 +213,12 @@ contains(DEFINES, GTA5SYNC_QCONF){
INSTALLS += langfiles INSTALLS += langfiles
} }
} }
# TELEMETRY BASED STUFF
!contains(DEFINES, GTA5SYNC_TELEMETRY){
SOURCES -= TelemetryClass.cpp \
tmext/TelemetryClassAuthenticator.cpp
HEADERS -= TelemetryClass.h \
tmext/TelemetryClassAuthenticator.h
}

View file

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC * gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016-2017 Syping * Copyright (C) 2016-2018 Syping
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -49,6 +49,10 @@
#include <iostream> #include <iostream>
#endif #endif
#ifdef GTA5SYNC_TELEMETRY
#include "TelemetryClass.h"
#endif
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
@ -100,9 +104,16 @@ int main(int argc, char *argv[])
a.addLibraryPath(pluginsDir); a.addLibraryPath(pluginsDir);
} }
QStringList applicationArgs = a.arguments();
QString selectedAction;
QString arg1;
applicationArgs.removeAt(0);
TCInstance->initUserLanguage(); TCInstance->initUserLanguage();
TCInstance->loadTranslation(&a); TCInstance->loadTranslation(&a);
if (!applicationArgs.contains("--skip-firststart"))
{
if (isFirstStart) if (isFirstStart)
{ {
QMessageBox::StandardButton button = QMessageBox::information(a.desktop(), QString("%1 %2").arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER), QApplication::tr("<h4>Welcome to %1!</h4>You want to configure %1 before you start using it?").arg(GTA5SYNC_APPSTR), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); QMessageBox::StandardButton button = QMessageBox::information(a.desktop(), QString("%1 %2").arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER), QApplication::tr("<h4>Welcome to %1!</h4>You want to configure %1 before you start using it?").arg(GTA5SYNC_APPSTR), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
@ -116,13 +127,32 @@ int main(int argc, char *argv[])
} }
settings.setValue("IsFirstStart", false); settings.setValue("IsFirstStart", false);
} }
}
settings.endGroup(); settings.endGroup();
QStringList applicationArgs = a.arguments(); #ifdef GTA5SYNC_TELEMETRY
QString selectedAction; if (!applicationArgs.contains("--disable-telemetry"))
QString arg1; {
applicationArgs.removeAt(0); QObject::connect(Telemetry, SIGNAL(registered()), Telemetry, SLOT(pushStartupSet()));
if (!applicationArgs.contains("--skip-telemetryinit"))
{
Telemetry->init();
if (Telemetry->canPush())
{
Telemetry->pushStartupSet();
}
else if (Telemetry->canRegister())
{
Telemetry->registerClient();
}
}
}
else
{
Telemetry->setDisabled(true);
}
#endif
for (QString currentArg : applicationArgs) for (QString currentArg : applicationArgs)
{ {

View file

@ -24,13 +24,13 @@ BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "CompanyName", "Syping" VALUE "CompanyName", "Syping"
VALUE "FileDescription", "gta5view\0" VALUE "FileDescription", "gta5view"
VALUE "FileVersion", "1.5.0-dev7\0" VALUE "FileVersion", "1.5.0-dev8"
VALUE "InternalName", "gta5view\0" VALUE "InternalName", "gta5view"
VALUE "LegalCopyright", "Copyright © 2016-2017 Syping\0" VALUE "LegalCopyright", "Copyright © 2016-2017 Syping"
VALUE "OriginalFilename", "gta5view.exe\0" VALUE "OriginalFilename", "gta5view.exe"
VALUE "ProductName", "gta5view\0" VALUE "ProductName", "gta5view"
VALUE "ProductVersion", "1.5.0-dev7\0" VALUE "ProductVersion", "1.5.0-dev8"
END END
END END
END END

View file

@ -0,0 +1,99 @@
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2018 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 "TelemetryClassAuthenticator.h"
#include <QUrlQuery>
#include <QUrl>
#ifndef GTA5SYNC_TELEMETRY_PUSHURL
#define GTA5SYNC_TELEMETRY_PUSHURL ""
#endif
#ifndef GTA5SYNC_TELEMETRY_REGURL
#define GTA5SYNC_TELEMETRY_REGURL ""
#endif
#ifndef GTA5SYNC_TELEMETRY_AUTHID
#define GTA5SYNC_TELEMETRY_AUTHID ""
#endif
#ifndef GTA5SYNC_TELEMETRY_AUTHPW
#define GTA5SYNC_TELEMETRY_AUTHPW ""
#endif
const QUrl TelemetryClassAuthenticator::getTrackingPushURL()
{
if (haveAccessData())
{
QUrl pushUrl(GTA5SYNC_TELEMETRY_PUSHURL);
QUrlQuery pushQuery(pushUrl);
if (!getTrackingAuthID().isEmpty()) { pushQuery.addQueryItem("tid", getTrackingAuthID()); }
if (!getTrackingAuthPW().isEmpty()) { pushQuery.addQueryItem("tpw", getTrackingAuthPW()); }
pushUrl.setQuery(pushQuery.query(QUrl::FullyEncoded));
return pushUrl;
}
else
{
QUrl pushUrl(GTA5SYNC_TELEMETRY_PUSHURL);
return pushUrl;
}
}
const QUrl TelemetryClassAuthenticator::getTrackingRegURL()
{
if (haveAccessData())
{
QUrl regUrl(GTA5SYNC_TELEMETRY_REGURL);
QUrlQuery regQuery(regUrl);
if (!getTrackingAuthID().isEmpty()) { regQuery.addQueryItem("tid", getTrackingAuthID()); }
if (!getTrackingAuthPW().isEmpty()) { regQuery.addQueryItem("tpw", getTrackingAuthPW()); }
regUrl.setQuery(regQuery.query(QUrl::FullyEncoded));
return regUrl;
}
else
{
QUrl regUrl(GTA5SYNC_TELEMETRY_REGURL);
return regUrl;
}
}
const QString TelemetryClassAuthenticator::getTrackingAuthID()
{
return QString(GTA5SYNC_TELEMETRY_AUTHID);
}
const QString TelemetryClassAuthenticator::getTrackingAuthPW()
{
return QString(GTA5SYNC_TELEMETRY_AUTHPW);
}
bool TelemetryClassAuthenticator::havePushURL()
{
return !getTrackingPushURL().isEmpty();
}
bool TelemetryClassAuthenticator::haveRegURL()
{
return !getTrackingRegURL().isEmpty();
}
bool TelemetryClassAuthenticator::haveAccessData()
{
if (getTrackingAuthID().isEmpty() && getTrackingAuthPW().isEmpty()) { return false; }
return true;
}

View file

@ -0,0 +1,41 @@
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2018 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 TELEMETRYCLASSAUTHENTICATOR_H
#define TELEMETRYCLASSAUTHENTICATOR_H
#include <QApplication>
#include <QObject>
#include <QString>
#include <QUrl>
class TelemetryClassAuthenticator : public QObject
{
Q_OBJECT
public:
static const QUrl getTrackingPushURL();
static const QUrl getTrackingRegURL();
static const QString getTrackingAuthID();
static const QString getTrackingAuthPW();
static bool havePushURL();
static bool haveRegURL();
static bool haveAccessData();
};
#endif // TELEMETRYCLASSAUTHENTICATOR_H