improved telemetry + player list and fixed some other issues

This commit is contained in:
Syping 2018-01-16 00:13:08 +01:00
parent 68c8a971ee
commit 26a24122e1
39 changed files with 3134 additions and 1587 deletions

View File

@ -25,7 +25,7 @@ matrix:
- EXECUTABLE_ARCH=_x64
before_install:
- cd tmext && rm -rf TelemetryClassAuthenticator.cpp && openssl aes-256-cbc -K $encrypted_55502862a724_key -iv $encrypted_55502862a724_iv -in TelemetryClassAuthenticator.cpp.enc -out TelemetryClassAuthenticator.cpp -d && cd ..
- ".travis/source.sh"
script:
- ".travis/travis.sh"

View File

@ -3,9 +3,9 @@
DOCKER_IMAGE=i386/debian:jessie
PROJECT_DIR_DOCKER=/gta5view
cd $PROJECT_DIR && \
docker pull $DOCKER_IMAGE && \
cd ${PROJECT_DIR} && \
docker pull ${DOCKER_IMAGE} && \
docker run --rm \
-v "${PROJECT_DIR}:${PROJECT_DIR_DOCKER}" \
$DOCKER_IMAGE \
${DOCKER_IMAGE} \
/bin/bash -c "export PROJECT_DIR=${PROJECT_DIR_DOCKER} && export QT_SELECT=${QT_SELECT} && export APPLICATION_VERSION=${APPLICATION_VERSION} && export APT_INSTALL=${APT_INSTALL} && export QMAKE_FLAGS_QT4=${QMAKE_FLAGS_QT4} && export QMAKE_FLAGS_QT5=${QMAKE_FLAGS_QT5} && export PACKAGE_VERSION=${PACKAGE_VERSION} && export PACKAGE_BUILD=${PACKAGE_BUILD} && export EXECUTABLE_VERSION=${EXECUTABLE_VERSION} && export EXECUTABLE_ARCH=${EXECUTABLE_ARCH} && cd ${PROJECT_DIR_DOCKER} && .travis/debian_install.sh && .travis/debian_build.sh"

View File

@ -3,9 +3,9 @@
DOCKER_IMAGE=debian:jessie
PROJECT_DIR_DOCKER=/gta5view
cd $PROJECT_DIR && \
docker pull $DOCKER_IMAGE && \
cd ${PROJECT_DIR} && \
docker pull ${DOCKER_IMAGE} && \
docker run --rm \
-v "${PROJECT_DIR}:${PROJECT_DIR_DOCKER}" \
$DOCKER_IMAGE \
${DOCKER_IMAGE} \
/bin/bash -c "export PROJECT_DIR=${PROJECT_DIR_DOCKER} && export QT_SELECT=${QT_SELECT} && export APPLICATION_VERSION=${APPLICATION_VERSION} && export APT_INSTALL=${APT_INSTALL} && export QMAKE_FLAGS_QT4=${QMAKE_FLAGS_QT4} && export QMAKE_FLAGS_QT5=${QMAKE_FLAGS_QT5} && export PACKAGE_VERSION=${PACKAGE_VERSION} && export PACKAGE_BUILD=${PACKAGE_BUILD} && export EXECUTABLE_VERSION=${EXECUTABLE_VERSION} && export EXECUTABLE_ARCH=${EXECUTABLE_ARCH} && cd ${PROJECT_DIR_DOCKER} && .travis/debian_install.sh && .travis/debian_build.sh"

View File

@ -1,8 +1,8 @@
#!/bin/bash
# Creating folders
cd $PROJECT_DIR && \
echo "gta5view build version is $APPLICATION_VERSION" && \
cd ${PROJECT_DIR} && \
echo "gta5view build version is ${APPLICATION_VERSION}" && \
mkdir build && \
mkdir assets && \
chmod -x res/gta5sync_*.qm res/gta5view.desktop res/gta5view.png && \
@ -21,11 +21,11 @@ mkdir -p /usr/share/gta5view && \
# Starting build
cd qt5 && \
qmake -qt=5 -spec linux-clang GTA5SYNC_PREFIX=/usr QMAKE_CXXFLAGS+=-std=gnu++11 $QMAKE_FLAGS_QT5 DEFINES+=GTA5SYNC_BUILDTYPE_DEV "DEFINES+=GTA5SYNC_APPVER=\\\\\\\"$APPLICATION_VERSION\\\\\\\"" DEFINES+=GTA5SYNC_QCONF DEFINES+=GTA5SYNC_TELEMETRY ../../gta5view.pro && \
qmake -qt=5 -spec linux-clang GTA5SYNC_PREFIX=/usr QMAKE_CXXFLAGS+=-std=gnu++11 ${QMAKE_FLAGS_QT5} DEFINES+=GTA5SYNC_BUILDTYPE_DEV "DEFINES+=GTA5SYNC_APPVER=\\\\\\\"${APPLICATION_VERSION}\\\\\\\"" DEFINES+=GTA5SYNC_QCONF DEFINES+=GTA5SYNC_TELEMETRY "DEFINES+=GTA5SYNC_TELEMETRY_WEBURL=\\\\\\\"https://dev.syping.de/gta5view-userstats/\\\\\\\"" ../../gta5view.pro && \
make -j 4 && \
checkinstall -D --default --nodoc --install=no --pkgname=gta5view-qt5 --pkgversion=$PACKAGE_VERSION --pkgrelease=$PACKAGE_BUILD --pkggroup=utility --maintainer="Syping \<dpkg@syping.de\>" --requires=libqt5core5a,libqt5gui5,libqt5network5,libqt5widgets5,qttranslations5-l10n --conflicts=gta5view,gta5view-qt4 --replaces=gta5view,gta5view-qt4 --pakdir=$PROJECT_DIR/assets && \
checkinstall -D --default --nodoc --install=no --pkgname=gta5view-qt5 --pkgversion=${PACKAGE_VERSION} --pkgrelease=${PACKAGE_BUILD} --pkggroup=utility --maintainer="Syping \<dpkg@syping.de\>" --requires=libqt5core5a,libqt5gui5,libqt5network5,libqt5widgets5,qttranslations5-l10n --conflicts=gta5view,gta5view-qt4 --replaces=gta5view,gta5view-qt4 --pakdir=${PROJECT_DIR}/assets && \
cd .. && \
cd qt4 && \
qmake -qt=4 GTA5SYNC_PREFIX=/usr QMAKE_CXXFLAGS+=-std=gnu++11 $QMAKE_FLAGS_QT4 DEFINES+=GTA5SYNC_BUILDTYPE_DEV "DEFINES+=GTA5SYNC_APPVER=\\\\\\\"$APPLICATION_VERSION\\\\\\\"" DEFINES+=GTA5SYNC_QCONF ../../gta5view.pro && \
qmake -qt=4 GTA5SYNC_PREFIX=/usr QMAKE_CXXFLAGS+=-std=gnu++11 ${QMAKE_FLAGS_QT4} DEFINES+=GTA5SYNC_BUILDTYPE_DEV "DEFINES+=GTA5SYNC_APPVER=\\\\\\\"${APPLICATION_VERSION}\\\\\\\"" DEFINES+=GTA5SYNC_QCONF ../../gta5view.pro && \
make -j 4 && \
checkinstall -D --default --nodoc --install=no --pkgname=gta5view-qt4 --pkgversion=$PACKAGE_VERSION --pkgrelease=$PACKAGE_BUILD --pkggroup=utility --maintainer="Syping \<dpkg@syping.de\>" --requires=libqtcore4,libqtgui4,libqt4-network,qtcore4-l10n --conflicts=gta5view,gta5view-qt5 --replaces=gta5view,gta5view-qt5 --pakdir=$PROJECT_DIR/assets
checkinstall -D --default --nodoc --install=no --pkgname=gta5view-qt4 --pkgversion=${PACKAGE_VERSION} --pkgrelease=${PACKAGE_BUILD} --pkggroup=utility --maintainer="Syping \<dpkg@syping.de\>" --requires=libqtcore4,libqtgui4,libqt4-network,qtcore4-l10n --conflicts=gta5view,gta5view-qt5 --replaces=gta5view,gta5view-qt5 --pakdir=${PROJECT_DIR}/assets

View File

@ -2,4 +2,4 @@
# Install packages
apt-get update -qq && \
apt-get install -qq $APT_INSTALL checkinstall dpkg-dev fakeroot g++ gcc qtbase5-dev qt5-qmake qttranslations5-l10n libqt4-dev
apt-get install -qq ${APT_INSTALL} checkinstall dpkg-dev fakeroot g++ gcc qtbase5-dev qt5-qmake qttranslations5-l10n libqt4-dev

4
.travis/source.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
rm -rf tmext/TelemetryClassAuthenticator.cpp && \
openssl aes-256-cbc -K $encrypted_55502862a724_key -iv $encrypted_55502862a724_iv -in tmext/TelemetryClassAuthenticator.cpp.enc -out tmext/TelemetryClassAuthenticator.cpp -d

View File

@ -8,7 +8,7 @@ if [ `git name-rev --tags --name-only $(git rev-parse HEAD)` == "undefined" ]; t
export PACKAGE_VERSION=$(grep -oE '^[^\-]*' <<< $APPLICATION_VERSION)
export PACKAGE_BUILD=$(grep -oP '\-\K.+' <<< $APPLICATION_VERSION)
export EXECUTABLE_VERSION=${PACKAGE_VERSION}${PACKAGE_BUILD}
if [ "$PACKAGE_BUILD" == "" ]; then export PACKAGE_BUILD=$TRAVIS_BUILD_NUMBER; fi
if [ "$PACKAGE_BUILD" == "" ]; then export PACKAGE_BUILD=${TRAVIS_BUILD_NUMBER}; fi
export PROJECT_DIR=$(pwd)
.travis/$BUILD_SCRIPT
.travis/${BUILD_SCRIPT}

View File

@ -5,4 +5,4 @@ sudo .travis/debian_install.sh && \
# Build gta5view
sudo .travis/debian_build.sh && \
cd $PROJECT_DIR
cd ${PROJECT_DIR}

View File

@ -1,18 +1,18 @@
#!/bin/bash
export GTA5VIEW_EXECUTABLE=gta5view-${EXECUTABLE_VERSION}${EXECUTABLE_ARCH}.exe
export GTA5VIEW_EXECUTABLE=gta5view-${EXECUTABLE_VERSION}${EXECUTABLE_ARCH}.exe && \
# Creating folders
cd $PROJECT_DIR && \
echo "gta5view build version is $APPLICATION_VERSION" && \
echo "gta5view executable is $GTA5VIEW_EXECUTABLE" && \
cd ${PROJECT_DIR} && \
echo "gta5view build version is ${APPLICATION_VERSION}" && \
echo "gta5view executable is ${GTA5VIEW_EXECUTABLE}" && \
mkdir build && \
mkdir assets && \
# Starting build
cd build && \
qmake-static $QMAKE_FLAGS DEFINES+=GTA5SYNC_BUILDTYPE_DEV "DEFINES+=GTA5SYNC_APPVER=\\\\\\\"$APPLICATION_VERSION\\\\\\\"" DEFINES+=GTA5SYNC_TELEMETRY ../gta5view.pro && \
qmake-static ${QMAKE_FLAGS} DEFINES+=GTA5SYNC_BUILDTYPE_DEV "DEFINES+=GTA5SYNC_APPVER=\\\\\\\"${APPLICATION_VERSION}\\\\\\\"" DEFINES+=GTA5SYNC_TELEMETRY "DEFINES+=GTA5SYNC_TELEMETRY_WEBURL=\\\\\\\"https://dev.syping.de/gta5view-userstats/\\\\\\\"" ../gta5view.pro && \
make -j 4 && \
cp -Rf release/*.exe $PROJECT_DIR/assets/$GTA5VIEW_EXECUTABLE && \
cd $PROJECT_DIR/assets && \
upx --best $GTA5VIEW_EXECUTABLE
cp -Rf release/*.exe ${PROJECT_DIR}/assets/${GTA5VIEW_EXECUTABLE} && \
cd ${PROJECT_DIR}/assets && \
upx --best ${GTA5VIEW_EXECUTABLE}

View File

@ -1,12 +1,12 @@
#!/bin/bash
QT_VERSION=5.6.3
DOCKER_IMAGE=syping/qt5-static-mingw:$QT_VERSION
DOCKER_IMAGE=syping/qt5-static-mingw:${QT_VERSION}
PROJECT_DIR_DOCKER=/gta5view
cd $PROJECT_DIR && \
docker pull $DOCKER_IMAGE && \
cd ${PROJECT_DIR} && \
docker pull ${DOCKER_IMAGE} && \
docker run --rm \
-v "${PROJECT_DIR}:${PROJECT_DIR_DOCKER}" \
$DOCKER_IMAGE \
${DOCKER_IMAGE} \
/bin/bash -c "export PROJECT_DIR=${PROJECT_DIR_DOCKER} && export QT_SELECT=${QT_SELECT} && export APPLICATION_VERSION=${APPLICATION_VERSION} && export QMAKE_FLAGS_QT4=${QMAKE_FLAGS_QT4} && export QMAKE_FLAGS_QT5=${QMAKE_FLAGS_QT5} && export PACKAGE_VERSION=${PACKAGE_VERSION} && export PACKAGE_BUILD=${PACKAGE_BUILD} && export EXECUTABLE_VERSION=${EXECUTABLE_VERSION} && export EXECUTABLE_ARCH=${EXECUTABLE_ARCH} && cd ${PROJECT_DIR_DOCKER} && .travis/windows_build.sh"

View File

@ -46,6 +46,9 @@ Running with Qt %6&lt;br/&gt;
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
</property>
</widget>
</item>
<item>

View File

@ -1,6 +1,6 @@
/*****************************************************************************
* 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
* it under the terms of the GNU General Public License as published by
@ -74,5 +74,5 @@ QString GlobalString::getLanguageFile()
QString GlobalString::getLanguage()
{
return TCInstance->getCurrentAreaLanguage();
return Translator->getCurrentAreaLanguage();
}

View File

@ -37,7 +37,6 @@ ImageEditorDialog::ImageEditorDialog(SnapmaticPicture *picture, QString profileN
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
ui->setupUi(this);
ui->cmdClose->setDefault(true);
ui->cmdClose->setFocus();
// Set Icon for Close Button

View File

@ -37,7 +37,6 @@ JsonEditorDialog::JsonEditorDialog(SnapmaticPicture *picture, QWidget *parent) :
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint^Qt::WindowMinMaxButtonsHint);
ui->setupUi(this);
ui->cmdClose->setDefault(true);
ui->cmdClose->setFocus();
// Set Icon for Close Button

View File

@ -25,17 +25,25 @@
#include "config.h"
#include <QStringBuilder>
#include <QDesktopWidget>
#include <QJsonDocument>
#include <QStyleFactory>
#include <QApplication>
#include <QJsonObject>
#include <QFileDialog>
#include <QMessageBox>
#include <QStringList>
#include <QClipboard>
#include <QLocale>
#include <QString>
#include <QTimer>
#include <QDebug>
#include <QList>
#include <QDir>
#ifdef GTA5SYNC_TELEMETRY
#include "TelemetryClass.h"
#endif
OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
QDialog(parent), profileDB(profileDB),
ui(new Ui::OptionsDialog)
@ -47,6 +55,7 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
ui->setupUi(this);
ui->tabWidget->setCurrentIndex(0);
ui->labPicCustomRes->setVisible(false);
ui->cmdCancel->setFocus();
QRect desktopResolution = QApplication::desktop()->screenGeometry(this);
int desktopSizeWidth = desktopResolution.width();
@ -91,6 +100,7 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
setupPictureSettings();
setupCustomGTAFolder();
setupInterfaceSettings();
setupStatisticsSettings();
setupSnapmaticPictureViewer();
#ifndef Q_QS_ANDROID
@ -177,7 +187,7 @@ void OptionsDialog::setupLanguageBox()
}
QString aCurrentLanguage = QString("en_GB");
if (TCInstance->isLanguageLoaded()) { aCurrentLanguage = TCInstance->getCurrentLanguage(); }
if (Translator->isLanguageLoaded()) { aCurrentLanguage = Translator->getCurrentLanguage(); }
QLocale currentLocale = QLocale(aCurrentLanguage);
ui->labCurrentLanguage->setText(tr("Current: %1").arg(currentLocale.nativeLanguageName() % " (" % currentLocale.nativeCountryName() % ") [" % aCurrentLanguage % "]"));
@ -216,7 +226,7 @@ void OptionsDialog::setupLanguageBox()
}
}
QString aCurrentAreaLanguage = TCInstance->getCurrentAreaLanguage();
QString aCurrentAreaLanguage = Translator->getCurrentAreaLanguage();
if (QFile::exists(":/global/global." % currentAreaLanguage % ".loc"))
{
QFile locFile(":/global/global." % currentAreaLanguage % ".loc");
@ -396,6 +406,15 @@ void OptionsDialog::applySettings()
settings->setValue("AlwaysUseMessageFont", ui->cbAlwaysUseMessageFont->isChecked());
settings->endGroup();
#ifdef GTA5SYNC_TELEMETRY
settings->beginGroup("Telemetry");
settings->setValue("PushAppConf", ui->cbAppConfigStats->isChecked());
if (!Telemetry->isStateForced()) { settings->setValue("IsEnabled", ui->cbParticipateStats->isChecked()); }
settings->endGroup();
Telemetry->refresh();
Telemetry->work();
#endif
#if QT_VERSION >= 0x050000
bool languageChanged = ui->cbLanguage->currentData().toString() != currentLanguage;
bool languageAreaChanged = ui->cbAreaLanguage->currentData().toString() != currentAreaLanguage;
@ -405,13 +424,13 @@ void OptionsDialog::applySettings()
#endif
if (languageChanged)
{
TCInstance->unloadTranslation(qApp);
TCInstance->initUserLanguage();
TCInstance->loadTranslation(qApp);
Translator->unloadTranslation(qApp);
Translator->initUserLanguage();
Translator->loadTranslation(qApp);
}
else if (languageAreaChanged)
{
TCInstance->initUserLanguage();
Translator->initUserLanguage();
}
emit settingsApplied(newContentMode, languageChanged);
@ -527,6 +546,44 @@ void OptionsDialog::setupPictureSettings()
settings->endGroup();
}
void OptionsDialog::setupStatisticsSettings()
{
#ifdef GTA5SYNC_TELEMETRY
ui->cbParticipateStats->setText(tr("Participate in %1 User Statistics").arg(GTA5SYNC_APPSTR));
ui->labUserStats->setText(QString("<a href=\"%2\">%1</a>").arg(tr("View %1 User Statistics Online").arg(GTA5SYNC_APPSTR), TelemetryClass::getWebURL().toString()));
ui->gbUserFeedback->setVisible(false);
// settings->beginGroup("Startup");
// if (settings->value("IsFirstStart", true).toBool() == true)
// {
// ui->gbUserFeedback->setVisible(false);
// }
// settings->endGroup();
settings->beginGroup("Telemetry");
ui->cbParticipateStats->setChecked(Telemetry->isEnabled());
ui->cbAppConfigStats->setChecked(settings->value("PushAppConf", false).toBool());
settings->endGroup();
if (Telemetry->isStateForced())
{
ui->cbParticipateStats->setEnabled(false);
}
if (Telemetry->isRegistered())
{
ui->labParticipationID->setText(tr("Participation ID: %1").arg(Telemetry->getRegisteredID()));
}
else
{
ui->labParticipationID->setText(tr("Participation ID: %1").arg(tr("Not registered")));
ui->cmdCopyStatsID->setVisible(false);
}
#else
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabStats));
#endif
}
void OptionsDialog::on_cbIgnoreAspectRatio_toggled(bool checked)
{
if (checked)
@ -585,3 +642,27 @@ void OptionsDialog::on_cbDefaultStyle_toggled(bool checked)
{
ui->cbStyleList->setDisabled(checked);
}
void OptionsDialog::on_cmdUserFeedbackSend_clicked()
{
#ifdef GTA5SYNC_TELEMETRY
if (ui->txtUserFeedback->toPlainText().length() < 1024 && ui->txtUserFeedback->toPlainText().length() >= 3)
{
QJsonDocument feedback;
QJsonObject feedbackObject;
feedbackObject["Message"] = ui->txtUserFeedback->toPlainText();
feedback.setObject(feedbackObject);
Telemetry->push(TelemetryCategory::UserFeedback, feedback);
ui->txtUserFeedback->setPlainText(QString());
}
else
{
QMessageBox::information(this, tr("User Feedback"), tr("A feedback message have to between 3-1024 characters long"));
}
#endif
}
void OptionsDialog::on_cmdCopyStatsID_clicked()
{
QApplication::clipboard()->setText(Telemetry->getRegisteredID());
}

View File

@ -47,6 +47,8 @@ private slots:
void on_cbIgnoreAspectRatio_toggled(bool checked);
void on_cmdExploreFolder_clicked();
void on_cbDefaultStyle_toggled(bool checked);
void on_cmdUserFeedbackSend_clicked();
void on_cmdCopyStatsID_clicked();
signals:
void settingsApplied(int contentMode, bool languageChanged);
@ -76,6 +78,7 @@ private:
void setupPictureSettings();
void setupCustomGTAFolder();
void setupInterfaceSettings();
void setupStatisticsSettings();
void setupSnapmaticPictureViewer();
void applySettings();
};

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>435</width>
<height>405</height>
<height>464</height>
</rect>
</property>
<property name="windowTitle">
@ -20,7 +20,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="tabProfile">
<attribute name="title">
@ -382,6 +382,184 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tabStats">
<attribute name="title">
<string>Feedback</string>
</attribute>
<layout class="QVBoxLayout" name="vlStats">
<item>
<widget class="QGroupBox" name="gbUserStats">
<property name="title">
<string>Participation</string>
</property>
<layout class="QVBoxLayout" name="vlUserStats">
<item>
<widget class="QCheckBox" name="cbParticipateStats">
<property name="text">
<string>Participate in %1 User Statistics</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labUserStats">
<property name="text">
<string notr="true">&lt;a href=&quot;%2&quot;&gt;%1&lt;/a&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gbCategorys">
<property name="title">
<string>Categorys</string>
</property>
<layout class="QVBoxLayout" name="vlCategorys">
<item>
<widget class="QCheckBox" name="cbGeneralStats">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Hardware, Application and OS Specification</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbOSLangStats">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>System Language Configuration</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbAppConfigStats">
<property name="text">
<string>Application Configuration</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gbOther">
<property name="title">
<string>Other</string>
</property>
<layout class="QHBoxLayout" name="hlOtherStats">
<item>
<widget class="QLabel" name="labParticipationID">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Participation ID: %1</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdCopyStatsID">
<property name="text">
<string>&amp;Copy</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gbUserFeedback">
<property name="title">
<string>User Feedback</string>
</property>
<layout class="QVBoxLayout" name="vlUserFeedback">
<item>
<widget class="QPlainTextEdit" name="txtUserFeedback"/>
</item>
<item>
<layout class="QHBoxLayout" name="hlUserFeedbackButtons">
<item>
<widget class="QLabel" name="labUserFeedback">
<property name="text">
<string>Limit: 1 message/day</string>
</property>
</widget>
</item>
<item>
<spacer name="hsUserFeedbackButtons">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cmdUserFeedbackSend">
<property name="text">
<string>&amp;Send</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="vsUserStats">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabInterface">
<attribute name="title">
<string>Interface</string>
@ -401,6 +579,9 @@
<property name="text">
<string>Current: %1</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
@ -420,6 +601,9 @@
<property name="text">
<string>Current: %1</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>

View File

@ -1,6 +1,6 @@
/*****************************************************************************
* 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
* it under the terms of the GNU General Public License as published by
@ -34,9 +34,7 @@ PlayerListDialog::PlayerListDialog(QStringList players, ProfileDatabase *profile
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
listUpdated = false;
ui->setupUi(this);
ui->cmdCancel->setDefault(true);
ui->cmdCancel->setFocus();
// Set Icon for Apply Button
@ -150,16 +148,19 @@ void PlayerListDialog::drawSwitchButtons()
QPainter avPainter(&avImage);
avPainter.setFont(painterFont);
avPainter.setBrush(palette.buttonText());
avPainter.setPen(palette.buttonText().color());
avPainter.drawText(0, 0, makeAvSize, makeAvSize, Qt::AlignCenter | Qt::TextDontClip, "<");
avPainter.end();
QPainter sePainter(&seImage);
sePainter.setFont(painterFont);
sePainter.setBrush(palette.buttonText());
sePainter.setPen(palette.buttonText().color());
sePainter.drawText(0, 0, makeSeSize, makeSeSize, Qt::AlignCenter | Qt::TextDontClip, ">");
sePainter.end();
QPainter adPainter(&adImage);
adPainter.setFont(painterFont);
adPainter.setBrush(palette.buttonText());
adPainter.setPen(palette.buttonText().color());
adPainter.drawText(0, 0, makeAdSize, makeAdSize, Qt::AlignCenter | Qt::TextDontClip, "+");
adPainter.end();
@ -182,24 +183,32 @@ void PlayerListDialog::buildInterface()
const QStringList dbPlayers = profileDB->getPlayers();
for (QString sePlayer : players)
{
ui->listSePlayers->addItem(QString("%1 (%2)").arg(sePlayer, profileDB->getPlayerName(sePlayer)));
QListWidgetItem *playerItem = new QListWidgetItem(profileDB->getPlayerName(sePlayer));
playerItem->setData(Qt::UserRole, sePlayer);
ui->listSePlayers->addItem(playerItem);
}
for (QString dbPlayer : dbPlayers)
{
if (!players.contains(dbPlayer))
{
ui->listAvPlayers->addItem(QString("%1 (%2)").arg(dbPlayer, profileDB->getPlayerName(dbPlayer)));
QListWidgetItem *playerItem = new QListWidgetItem(profileDB->getPlayerName(dbPlayer));
playerItem->setData(Qt::UserRole, dbPlayer);
ui->listAvPlayers->addItem(playerItem);
}
}
ui->listAvPlayers->sortItems(Qt::AscendingOrder);
}
void PlayerListDialog::on_cmdMakeAv_clicked()
{
for (QListWidgetItem *item : ui->listSePlayers->selectedItems())
{
QString playerItemText = item->text();
QString playerName = item->text();
int playerID = item->data(Qt::UserRole).toInt();
delete item;
ui->listAvPlayers->addItem(playerItemText);
QListWidgetItem *playerItem = new QListWidgetItem(playerName);
playerItem->setData(Qt::UserRole, playerID);
ui->listAvPlayers->addItem(playerItem);
ui->listAvPlayers->sortItems(Qt::AscendingOrder);
}
}
@ -214,9 +223,12 @@ void PlayerListDialog::on_cmdMakeSe_clicked()
}
for (QListWidgetItem *item : ui->listAvPlayers->selectedItems())
{
QString playerItemText = item->text();
QString playerName = item->text();
int playerID = item->data(Qt::UserRole).toInt();
delete item;
ui->listSePlayers->addItem(playerItemText);
QListWidgetItem *playerItem = new QListWidgetItem(playerName);
playerItem->setData(Qt::UserRole, playerID);
ui->listSePlayers->addItem(playerItem);
}
}
@ -229,27 +241,30 @@ void PlayerListDialog::on_cmdMakeAd_clicked()
for (int i = 0; i < ui->listAvPlayers->count(); ++i)
{
QListWidgetItem *item = ui->listAvPlayers->item(i);
QString playerItemText = item->text();
if (playerItemText.split(" ").at(0) == QString::number(playerID))
QString itemPlayerName = item->text();
int itemPlayerID = item->data(Qt::UserRole).toInt();
if (itemPlayerID == playerID)
{
delete item;
ui->listSePlayers->addItem(playerItemText);
QListWidgetItem *playerItem = new QListWidgetItem(itemPlayerName);
playerItem->setData(Qt::UserRole, playerID);
ui->listSePlayers->addItem(playerItem);
return;
}
}
for (int i = 0; i < ui->listSePlayers->count(); ++i)
{
QListWidgetItem *item = ui->listSePlayers->item(i);
QString playerItemText = item->text();
if (playerItemText.split(" ").at(0) == QString::number(playerID))
int itemPlayerID = item->data(Qt::UserRole).toInt();
if (itemPlayerID == playerID)
{
QMessageBox::warning(this, tr("Add Player..."), tr("Failed to add Player %1 because Player %1 is already added!").arg(QString::number(playerID)));
//ui->listSePlayers->setCurrentItem(item);
return;
}
}
QString playerItemText = QString("%1 (%1)").arg(QString::number(playerID));
ui->listSePlayers->addItem(playerItemText);
QListWidgetItem *playerItem = new QListWidgetItem(QString::number(playerID));
playerItem->setData(Qt::UserRole, playerID);
ui->listSePlayers->addItem(playerItem);
}
}
@ -258,7 +273,7 @@ void PlayerListDialog::on_cmdApply_clicked()
players.clear();
for (int i = 0; i < ui->listSePlayers->count(); ++i)
{
players += ui->listSePlayers->item(i)->text().split(" ").at(0);
players += ui->listSePlayers->item(i)->data(Qt::UserRole).toString();
}
emit playerListUpdated(players);
listUpdated = true;

View File

@ -105,6 +105,9 @@
</item>
<item>
<widget class="QListWidget" name="listSePlayers">
<property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>

View File

@ -1046,7 +1046,7 @@ void ProfileInterface::exportSelected()
if (errorStr != "")
{
errorStr.remove(0, 2);
QMessageBox::warning(this, tr("Export selected"), tr("Export failed with...\n\n%1").arg(errorStr));
QMessageBox::warning(this, tr("Export selected..."), tr("Export failed with...\n\n%1").arg(errorStr));
}
if (exportThread->isFinished())
@ -1066,7 +1066,7 @@ void ProfileInterface::exportSelected()
}
else
{
QMessageBox::information(this, tr("Export selected"), tr("No Snapmatic pictures or Savegames files are selected"));
QMessageBox::information(this, tr("Export selected..."), tr("No Snapmatic pictures or Savegames files are selected"));
}
}
@ -1160,7 +1160,7 @@ void ProfileInterface::settingsApplied(int _contentMode, bool languageChanged)
void ProfileInterface::enableSelected()
{
int fails = 0;
QList<SnapmaticWidget*> snapmaticWidgets;
for (ProfileWidget *widget : widgets.keys())
{
if (widget->isSelected())
@ -1168,18 +1168,33 @@ void ProfileInterface::enableSelected()
if (widget->getWidgetType() == "SnapmaticWidget")
{
SnapmaticWidget *snapmaticWidget = qobject_cast<SnapmaticWidget*>(widget);
if (!snapmaticWidget->makePictureVisible())
{
fails++;
}
snapmaticWidgets += snapmaticWidget;
}
}
}
if (snapmaticWidgets.isEmpty())
{
QMessageBox::information(this, QApplication::translate("UserInterface", "Show In-game"), QApplication::translate("ProfileInterface", "No Snapmatic pictures are selected"));
return;
}
QStringList fails;
for (SnapmaticWidget *widget : snapmaticWidgets)
{
SnapmaticPicture *picture = widget->getPicture();
if (!widget->makePictureVisible())
{
fails << QString("%1 [%2]").arg(picture->getPictureTitle(), picture->getPictureString());
}
}
if (!fails.isEmpty())
{
QMessageBox::warning(this, QApplication::translate("UserInterface", "Show In-game"), QApplication::translate("ProfileInterface", "%1 failed with...\n\n%2", "Action failed with...").arg(QApplication::translate("UserInterface", "Show In-game"), fails.join(", ")));
}
}
void ProfileInterface::disableSelected()
{
int fails = 0;
QList<SnapmaticWidget*> snapmaticWidgets;
for (ProfileWidget *widget : widgets.keys())
{
if (widget->isSelected())
@ -1187,13 +1202,28 @@ void ProfileInterface::disableSelected()
if (widget->getWidgetType() == "SnapmaticWidget")
{
SnapmaticWidget *snapmaticWidget = qobject_cast<SnapmaticWidget*>(widget);
if (!snapmaticWidget->makePictureHidden())
{
fails++;
}
snapmaticWidgets += snapmaticWidget;
}
}
}
if (snapmaticWidgets.isEmpty())
{
QMessageBox::information(this, QApplication::translate("UserInterface", "Hide In-game"), QApplication::translate("ProfileInterface", "No Snapmatic pictures are selected"));
return;
}
QStringList fails;
for (SnapmaticWidget *widget : snapmaticWidgets)
{
SnapmaticPicture *picture = widget->getPicture();
if (!widget->makePictureHidden())
{
fails << QString("%1 [%2]").arg(picture->getPictureTitle(), picture->getPictureString());
}
}
if (!fails.isEmpty())
{
QMessageBox::warning(this, QApplication::translate("UserInterface", "Hide In-game"), QApplication::translate("ProfileInterface", "%1 failed with...\n\n%2", "Action failed with...").arg(QApplication::translate("UserInterface", "Hide In-game"), fails.join(", ")));
}
}
int ProfileInterface::selectedWidgets()
@ -1529,7 +1559,7 @@ void ProfileInterface::massTool(MassTool tool)
if (snapmaticWidgets.isEmpty())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("You don't have any Snapmatics selected!"));
QMessageBox::information(this, tr("Qualify as Avatar"), tr("No Snapmatic pictures are selected"));
return;
}
@ -1594,7 +1624,7 @@ void ProfileInterface::massTool(MassTool tool)
pbDialog.close();
if (!fails.isEmpty())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("%1 failed with...\n\n%2", "Action failed with...").arg(tr("Qualify", "%1 failed with..."), fails.join(", ")));
QMessageBox::warning(this, tr("Qualify as Avatar"), tr("%1 failed with...\n\n%2", "Action failed with...").arg(tr("Qualify", "%1 failed with..."), fails.join(", ")));
}
}
break;
@ -1615,7 +1645,7 @@ void ProfileInterface::massTool(MassTool tool)
if (snapmaticWidgets.isEmpty())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("You don't have any Snapmatics selected!"));
QMessageBox::information(this, tr("Change Players..."), tr("No Snapmatic pictures are selected"));
return;
}
@ -1687,7 +1717,7 @@ void ProfileInterface::massTool(MassTool tool)
pbDialog.close();
if (!fails.isEmpty())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("%1 failed with...\n\n%2", "Action failed with...").arg(tr("Change Players", "%1 failed with..."), fails.join(", ")));
QMessageBox::warning(this, tr("Change Players..."), tr("%1 failed with...\n\n%2", "Action failed with...").arg(tr("Change Players", "%1 failed with..."), fails.join(", ")));
}
}
break;
@ -1708,7 +1738,7 @@ void ProfileInterface::massTool(MassTool tool)
if (snapmaticWidgets.isEmpty())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("You don't have any Snapmatics selected!"));
QMessageBox::information(this, tr("Change Crew..."), tr("No Snapmatic pictures are selected"));
return;
}
@ -1736,7 +1766,7 @@ preSelectionCrewID:
{
if (!crewChar.isNumber())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("Failed to enter a valid Snapmatic Crew ID"));
QMessageBox::warning(this, tr("Change Crew..."), tr("Failed to enter a valid Snapmatic Crew ID"));
goto preSelectionCrewID;
}
}
@ -1805,7 +1835,7 @@ preSelectionCrewID:
pbDialog.close();
if (!fails.isEmpty())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("%1 failed with...\n\n%2", "Action failed with...").arg(tr("Change Crew", "%1 failed with..."), fails.join(", ")));
QMessageBox::warning(this, tr("Change Crew..."), tr("%1 failed with...\n\n%2", "Action failed with...").arg(tr("Change Crew", "%1 failed with..."), fails.join(", ")));
}
}
break;
@ -1826,7 +1856,7 @@ preSelectionCrewID:
if (snapmaticWidgets.isEmpty())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("You don't have any Snapmatics selected!"));
QMessageBox::information(this, tr("Change Title..."), tr("No Snapmatic pictures are selected"));
return;
}
@ -1839,7 +1869,7 @@ preSelectionTitle:
{
if (!SnapmaticPicture::verifyTitle(newTitle))
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("Failed to enter a valid Snapmatic title"));
QMessageBox::warning(this, tr("Change Title..."), tr("Failed to enter a valid Snapmatic title"));
goto preSelectionTitle;
}
snapmaticTitle = newTitle;
@ -1904,7 +1934,7 @@ preSelectionTitle:
pbDialog.close();
if (!fails.isEmpty())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("%1 failed with...\n\n%2", "Action failed with...").arg(tr("Change Title", "%1 failed with..."), fails.join(", ")));
QMessageBox::warning(this, tr("Change Title..."), tr("%1 failed with...\n\n%2", "Action failed with...").arg(tr("Change Title", "%1 failed with..."), fails.join(", ")));
}
}
break;

View File

@ -1,3 +1,21 @@
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016-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 "SavegameDialog.h"
#include "ui_SavegameDialog.h"
#include "SavegameCopy.h"
@ -14,6 +32,7 @@ SavegameDialog::SavegameDialog(QWidget *parent) :
// Setup User Interface
ui->setupUi(this);
ui->cmdClose->setFocus();
savegameLabStr = ui->labSavegameText->text();
if (QIcon::hasThemeIcon("dialog-close"))

View File

@ -1,3 +1,21 @@
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016-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 SAVEGAMEDIALOG_H
#define SAVEGAMEDIALOG_H

View File

@ -38,7 +38,6 @@ SnapmaticEditor::SnapmaticEditor(CrewDatabase *crewDB, ProfileDatabase *profileD
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
ui->setupUi(this);
ui->cmdCancel->setDefault(true);
ui->cmdCancel->setFocus();
// Set Icon for Apply Button
@ -240,9 +239,9 @@ void SnapmaticEditor::setSnapmaticPlayers(const QStringList &players)
ui->labPlayers->setText(playersStr.arg(QApplication::translate("PictureDialog", "No Players"), editStr));
}
#ifndef Q_OS_ANDROID
ui->gbValues->resize(ui->gbValues->sizeHint());
ui->frameWidget->resize(ui->frameWidget->sizeHint());
resize(width(), heightForWidth(width()));
ui->gbValues->resize(ui->gbValues->width(), ui->gbValues->heightForWidth(ui->gbValues->width()));
ui->frameWidget->resize(ui->gbValues->width(), ui->frameWidget->heightForWidth(ui->frameWidget->width()));
if (heightForWidth(width()) > height()) { resize(width(), heightForWidth(width())); }
#endif
}
@ -268,9 +267,9 @@ void SnapmaticEditor::setSnapmaticTitle(const QString &title)
ui->labAppropriate->setText(tr("Appropriate: %1").arg(QString("<span style=\"color: red\">%1</a>").arg(tr("No", "No, could lead to issues"))));
}
#ifndef Q_OS_ANDROID
ui->gbValues->resize(ui->gbValues->sizeHint());
ui->frameWidget->resize(ui->frameWidget->sizeHint());
resize(width(), heightForWidth(width()));
ui->gbValues->resize(ui->gbValues->width(), ui->gbValues->heightForWidth(ui->gbValues->width()));
ui->frameWidget->resize(ui->gbValues->width(), ui->frameWidget->heightForWidth(ui->frameWidget->width()));
if (heightForWidth(width()) > height()) { resize(width(), heightForWidth(width())); }
#endif
}
@ -280,9 +279,9 @@ void SnapmaticEditor::setSnapmaticCrew(const QString &crew)
QString crewStr = tr("Crew: %1 (%2)").arg(StringParser::escapeString(crew), editStr);
ui->labCrew->setText(crewStr);
#ifndef Q_OS_ANDROID
ui->gbValues->resize(ui->gbValues->sizeHint());
ui->frameWidget->resize(ui->frameWidget->sizeHint());
resize(width(), heightForWidth(width()));
ui->gbValues->resize(ui->gbValues->width(), ui->gbValues->heightForWidth(ui->gbValues->width()));
ui->frameWidget->resize(ui->gbValues->width(), ui->frameWidget->heightForWidth(ui->frameWidget->width()));
if (heightForWidth(width()) > height()) { resize(width(), heightForWidth(width())); }
#endif
}

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>362</height>
<height>381</height>
</rect>
</property>
<property name="windowTitle">
@ -115,6 +115,9 @@
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
</property>
</widget>
</item>
<item>
@ -128,6 +131,9 @@
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
</property>
</widget>
</item>
<item>
@ -141,6 +147,9 @@
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
</property>
</widget>
</item>
<item>

View File

@ -36,6 +36,10 @@
#include <QFile>
#include <QDir>
#ifndef GTA5SYNC_TELEMETRY_WEBURL
#define GTA5SYNC_TELEMETRY_WEBURL ""
#endif
#ifdef GTA5SYNC_WIN
#include "windows.h"
#include "intrin.h"
@ -51,8 +55,10 @@ void TelemetryClass::init()
telemetryEnabled = settings.value("IsEnabled", false).toBool();
#else
telemetryEnabled = true; // Always enable Telemetry for Developer Versions
telemetryStateForced = true;
#endif
telemetryClientID = settings.value("ClientID", QString()).toString();
telemetryPushAppConf = settings.value("PushAppConf", false).toBool();
settings.endGroup();
}
@ -88,6 +94,11 @@ bool TelemetryClass::isRegistered()
return !telemetryClientID.isEmpty();
}
QString TelemetryClass::getRegisteredID()
{
return telemetryClientID;
}
void TelemetryClass::setEnabled(bool enabled)
{
telemetryEnabled = enabled;
@ -114,7 +125,8 @@ void TelemetryClass::push(TelemetryCategory category)
case TelemetryCategory::UserLocaleData:
push(category, getSystemLocaleList());
break;
case TelemetryCategory::ApplicationConfiguration:
case TelemetryCategory::ApplicationConf:
push(category, getApplicationConf());
break;
case TelemetryCategory::ApplicationSpec:
push(category, getApplicationSpec());
@ -276,6 +288,58 @@ QJsonDocument TelemetryClass::getApplicationSpec()
return jsonDocument;
}
QJsonDocument TelemetryClass::getApplicationConf()
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
settings.beginGroup("Interface");
QJsonObject interfaceObject;
interfaceObject["AreaLanguage"] = settings.value("AreaLanguage", "Auto").toString();
interfaceObject["Language"] = settings.value("Language", "System").toString();
interfaceObject["NavigationBar"] = settings.value("NavigationBar", false).toBool();
jsonObject["Interface"] = interfaceObject;
settings.endGroup();
settings.beginGroup("Pictures");
QJsonObject picturesObject;
picturesObject["AspectRatio"] = ((Qt::AspectRatioMode)settings.value("AspectRatio").toInt() == Qt::IgnoreAspectRatio) ? "IgnoreAspectRatio" : "KeepAspectRatio";
picturesObject["CustomQuality"] = settings.value("CustomQuality", 100).toInt();
picturesObject["CustomQualityEnabled"] = settings.value("CustomQualityEnabled", false).toBool();
picturesObject["ExportSizeMode"] = settings.value("ExportSizeMode", "Default").toString();
jsonObject["Pictures"] = picturesObject;
settings.endGroup();
settings.beginGroup("Profile");
QJsonObject profileObject;
int contentMode = settings.value("ContentMode", 0).toInt();
switch (contentMode)
{
case 0:
profileObject["ContentMode"] = "OpenWithSingleClick";
break;
case 1:
profileObject["ContentMode"] = "OpenWithDoubleClick";
break;
case 2:
profileObject["ContentMode"] = "SelectWithSingleClick";
break;
}
jsonObject["Profile"] = profileObject;
settings.endGroup();
settings.beginGroup("Startup");
QJsonObject startupObject;
startupObject["AppStyle"] = settings.value("AppStyle", "System").toString();
startupObject["CustomStyle"] = settings.value("CustomStyle", false).toBool();
jsonObject["Startup"] = startupObject;
settings.endGroup();
jsonDocument.setObject(jsonObject);
return jsonDocument;
}
QJsonDocument TelemetryClass::getSystemLocaleList()
{
QJsonDocument jsonDocument;
@ -307,8 +371,8 @@ QString TelemetryClass::categoryToString(TelemetryCategory category)
case TelemetryCategory::UserLocaleData:
return QString("UserLocaleData");
break;
case TelemetryCategory::ApplicationConfiguration:
return QString("ApplicationConfiguration");
case TelemetryCategory::ApplicationConf:
return QString("ApplicationConf");
break;
case TelemetryCategory::UserFeedback:
return QString("UserFeedback");
@ -325,6 +389,11 @@ QString TelemetryClass::categoryToString(TelemetryCategory category)
}
}
QUrl TelemetryClass::getWebURL()
{
return QUrl(GTA5SYNC_TELEMETRY_WEBURL);
}
void TelemetryClass::registerClient()
{
QNetworkAccessManager *netManager = new QNetworkAccessManager();
@ -334,33 +403,88 @@ void TelemetryClass::registerClient()
connect(netManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(registerFinished(QNetworkReply*)));
}
void TelemetryClass::pushStartupSet()
void TelemetryClass::work()
{
push(TelemetryCategory::ApplicationSpec);
push(TelemetryCategory::UserLocaleData);
push(TelemetryCategory::OperatingSystemSpec);
push(TelemetryCategory::HardwareSpec);
if (!canPush() && canRegister())
{
connect(this, SIGNAL(registered(bool)), this, SLOT(work_pd(bool)));
registerClient();
}
else if (canPush())
{
work_p(true);
}
}
void TelemetryClass::work_p(bool doWork)
{
if (doWork)
{
push(TelemetryCategory::ApplicationSpec);
push(TelemetryCategory::UserLocaleData);
push(TelemetryCategory::OperatingSystemSpec);
push(TelemetryCategory::HardwareSpec);
if (telemetryPushAppConf)
{
push(TelemetryCategory::ApplicationConf);
}
}
}
void TelemetryClass::work_pd(bool doWork)
{
disconnect(this, SIGNAL(registered(bool)), this, SLOT(work_pd(bool)));
work_p(doWork);
}
void TelemetryClass::pushFinished(QNetworkReply *reply)
{
bool isSuccessful = false;
if (reply->canReadLine())
{
QByteArray readedData = reply->readLine();
if (QString::fromUtf8(readedData).trimmed() == QString("Submit success!"))
{
#ifdef GTA5SYNC_DEBUG
qDebug() << "Telemetry" << reply->readAll().trimmed();
qDebug() << "Telemetry" << QString("Submit success!");
#endif
isSuccessful = true;
#ifdef GTA5SYNC_DEBUG
if (reply->isReadable())
{
readedData = reply->readAll().trimmed();
if (!readedData.isEmpty()) { qDebug() << "Telemetry Push" << readedData; }
}
#endif
}
else
{
#ifdef GTA5SYNC_DEBUG
qDebug() << "Telemetry" << QString("Submit failed!");
#endif
}
}
else
{
#ifdef GTA5SYNC_DEBUG
qDebug() << "Telemetry" << QString("Submit failed!");
#endif
}
reply->deleteLater();
sender()->deleteLater();
emit pushed();
emit pushed(isSuccessful);
}
void TelemetryClass::registerFinished(QNetworkReply *reply)
{
bool isSuccessful = false;
if (reply->canReadLine())
{
QByteArray readData = reply->readLine();
if (QString::fromUtf8(readData).trimmed() == QString("Registration success!") && reply->canReadLine())
QByteArray readedData = reply->readLine();
if (QString::fromUtf8(readedData).trimmed() == QString("Registration success!") && reply->canReadLine())
{
readData = reply->readLine();
telemetryClientID = QString::fromUtf8(readData).trimmed();
readedData = reply->readLine();
telemetryClientID = QString::fromUtf8(readedData).trimmed();
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
settings.beginGroup("Telemetry");
settings.setValue("ClientID", telemetryClientID);
@ -368,6 +492,7 @@ void TelemetryClass::registerFinished(QNetworkReply *reply)
#ifdef GTA5SYNC_DEBUG
qDebug() << "Telemetry" << QString("Registration success!");
#endif
isSuccessful = true;
}
else
{
@ -384,5 +509,5 @@ void TelemetryClass::registerFinished(QNetworkReply *reply)
}
reply->deleteLater();
sender()->deleteLater();
emit registered();
emit registered(isSuccessful);
}

View File

@ -23,8 +23,9 @@
#include <QApplication>
#include <QObject>
#include <QString>
#include <QUrl>
enum class TelemetryCategory : int { OperatingSystemSpec = 0, HardwareSpec = 1, UserLocaleData = 2, ApplicationConfiguration = 3, UserFeedback = 4, ApplicationSpec = 5, CustomEmitted = 99};
enum class TelemetryCategory : int { OperatingSystemSpec = 0, HardwareSpec = 1, UserLocaleData = 2, ApplicationConf = 3, UserFeedback = 4, ApplicationSpec = 5, CustomEmitted = 99};
class TelemetryClass : public QObject
{
@ -32,40 +33,44 @@ class TelemetryClass : public QObject
public:
static TelemetryClass* getInstance() { return &telemetryClassInstance; }
static QString categoryToString(TelemetryCategory category);
static QUrl getWebURL();
bool canPush();
bool canRegister();
bool isEnabled();
bool isStateForced();
bool isRegistered();
void init();
void work();
void refresh();
void setEnabled(bool enabled);
void setDisabled(bool disabled);
void push(TelemetryCategory category);
void push(TelemetryCategory category, const QJsonDocument json);
void registerClient();
QString getRegisteredID();
private:
static TelemetryClass telemetryClassInstance;
QString telemetryClientID;
bool telemetryEnabled;
bool telemetryStateForced;
bool telemetryPushAppConf;
void work_p(bool doWork);
QJsonDocument getOperatingSystem();
QJsonDocument getSystemHardware();
QJsonDocument getApplicationSpec();
QJsonDocument getApplicationConf();
QJsonDocument getSystemLocaleList();
public slots:
void pushStartupSet();
private slots:
void pushFinished(QNetworkReply *reply);
void registerFinished(QNetworkReply *reply);
void work_pd(bool doWork);
signals:
void pushed();
void registered();
void pushed(bool isSucessful);
void registered(bool isSucessful);
};
extern TelemetryClass telemetryClass;

View File

@ -62,6 +62,6 @@ private:
extern TranslationClass translationClass;
#define TCInstance TranslationClass::getInstance()
#define Translator TranslationClass::getInstance()
#endif // TRANSLATIONCLASS_H

View File

@ -1,6 +1,6 @@
/*****************************************************************************
* 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
* it under the terms of the GNU General Public License as published by
@ -45,15 +45,11 @@
#endif
#ifndef GTA5SYNC_COPYRIGHT
#define GTA5SYNC_COPYRIGHT "2016-2017"
#define GTA5SYNC_COPYRIGHT "2016-2018"
#endif
#ifndef GTA5SYNC_APPVER
#ifndef GTA5SYNC_DAILYB
#define GTA5SYNC_APPVER "1.5.0-dev8"
#else
#define GTA5SYNC_APPVER GTA5SYNC_DAILYB
#endif
#define GTA5SYNC_APPVER "1.5.0-dev9"
#endif
#ifdef GTA5SYNC_BUILDTYPE_REL
@ -92,12 +88,6 @@
#endif
#endif
#ifdef GTA5SYNC_DAILYB
#ifndef GTA5SYNC_BUILDTYPE
#define GTA5SYNC_BUILDTYPE QT_TRANSLATE_NOOP("AboutDialog", "Daily Build")
#endif
#endif
#ifndef GTA5SYNC_BUILDTYPE
#define GTA5SYNC_BUILDTYPE QT_TRANSLATE_NOOP("AboutDialog", "Custom")
#endif

File diff suppressed because it is too large Load Diff

View File

@ -26,18 +26,27 @@
#include "UserInterface.h"
#include "CrewDatabase.h"
#include "SavegameData.h"
#include "UiModWidget.h"
#include "UiModLabel.h"
#include "IconLoader.h"
#include "AppEnv.h"
#include "config.h"
#include <QDesktopWidget>
#include <QStringBuilder>
#include <QSignalMapper>
#include <QStyleFactory>
#include <QApplication>
#include <QPushButton>
#include <QSpacerItem>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QMessageBox>
#include <QStringList>
#include <QTranslator>
#include <QCheckBox>
#include <QFileInfo>
#include <QSysInfo>
#include <QLayout>
#include <QObject>
#include <QString>
#include <QDebug>
@ -98,19 +107,28 @@ int main(int argc, char *argv[])
#endif
#endif
QString pluginsDir = AppEnv::getPluginsFolder();
if (QFileInfo(pluginsDir).exists())
{
a.addLibraryPath(pluginsDir);
}
QStringList applicationArgs = a.arguments();
QString selectedAction;
QString arg1;
applicationArgs.removeAt(0);
TCInstance->initUserLanguage();
TCInstance->loadTranslation(&a);
Translator->initUserLanguage();
Translator->loadTranslation(&a);
#ifdef GTA5SYNC_TELEMETRY
if (!applicationArgs.contains("--disable-telemetry"))
{
if (!applicationArgs.contains("--skip-telemetryinit"))
{
Telemetry->init();
Telemetry->work();
}
}
else
{
Telemetry->setDisabled(true);
}
#endif
if (!applicationArgs.contains("--skip-firststart"))
{
@ -129,31 +147,54 @@ int main(int argc, char *argv[])
}
}
settings.endGroup();
#ifdef GTA5SYNC_TELEMETRY
if (!applicationArgs.contains("--disable-telemetry"))
bool telemetryWindowLaunched = settings.value("TelemetryWindowLaunched", false).toBool();
if (!telemetryWindowLaunched && !Telemetry->isEnabled() && !Telemetry->isStateForced())
{
QObject::connect(Telemetry, SIGNAL(registered()), Telemetry, SLOT(pushStartupSet()));
if (!applicationArgs.contains("--skip-telemetryinit"))
QDialog telemetryDialog;
telemetryDialog.setObjectName(QStringLiteral("TelemetryDialog"));
telemetryDialog.setWindowTitle(QString("%1 %2").arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER));
telemetryDialog.setWindowFlags(telemetryDialog.windowFlags()^Qt::WindowContextHelpButtonHint^Qt::WindowCloseButtonHint);
telemetryDialog.setWindowIcon(IconLoader::loadingAppIcon());
QVBoxLayout telemetryLayout;
telemetryLayout.setObjectName(QStringLiteral("TelemetryLayout"));
telemetryDialog.setLayout(&telemetryLayout);
UiModLabel telemetryLabel(&telemetryDialog);
telemetryLabel.setObjectName(QStringLiteral("TelemetryLabel"));
telemetryLabel.setText(QString("<h4>%2</h4>%1").arg(QApplication::translate("TelemetryDialog", "You want help %1 to improve in the future by collection of data?").arg(GTA5SYNC_APPSTR), QApplication::translate("TelemetryDialog", "%1 User Statistics").arg(GTA5SYNC_APPSTR)));
telemetryLayout.addWidget(&telemetryLabel);
QCheckBox telemetryCheckBox(&telemetryDialog);
telemetryCheckBox.setObjectName(QStringLiteral("TelemetryCheckBox"));
telemetryCheckBox.setText(QApplication::translate("TelemetryDialog", "Yes, I would like to take part."));
telemetryCheckBox.setChecked(true);
telemetryLayout.addWidget(&telemetryCheckBox);
QHBoxLayout telemetryButtonLayout;
telemetryButtonLayout.setObjectName(QStringLiteral("TelemetryButtonLayout"));
telemetryLayout.addLayout(&telemetryButtonLayout);
QSpacerItem telemetryButtonSpacer(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
telemetryButtonLayout.addSpacerItem(&telemetryButtonSpacer);
QPushButton telemetryButton(&telemetryDialog);
telemetryButton.setObjectName(QStringLiteral("TelemetryButton"));
telemetryButton.setText(QApplication::translate("TelemetryDialog", "&OK"));
telemetryButtonLayout.addWidget(&telemetryButton);
QObject::connect(&telemetryButton, SIGNAL(clicked(bool)), &telemetryDialog, SLOT(close()));
telemetryDialog.setFixedSize(telemetryDialog.sizeHint());
telemetryDialog.exec();
if (telemetryCheckBox.isChecked())
{
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
telemetrySettings.beginGroup("Telemetry");
telemetrySettings.setValue("IsEnabled", true);
telemetrySettings.endGroup();
Telemetry->init();
if (Telemetry->canPush())
{
Telemetry->pushStartupSet();
}
else if (Telemetry->canRegister())
{
Telemetry->registerClient();
}
Telemetry->work();
}
}
else
{
Telemetry->setDisabled(true);
settings.setValue("TelemetryWindowLaunched", true);
}
#endif
settings.endGroup();
for (QString currentArg : applicationArgs)
{
QString reworkedArg;

View File

@ -25,12 +25,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Syping"
VALUE "FileDescription", "gta5view"
VALUE "FileVersion", "1.5.0-dev8"
VALUE "FileVersion", "1.5.0-dev9"
VALUE "InternalName", "gta5view"
VALUE "LegalCopyright", "Copyright © 2016-2017 Syping"
VALUE "LegalCopyright", "Copyright © 2016-2018 Syping"
VALUE "OriginalFilename", "gta5view.exe"
VALUE "ProductName", "gta5view"
VALUE "ProductVersion", "1.5.0-dev8"
VALUE "ProductVersion", "1.5.0-dev9"
END
END
END

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff