Refactoring. Code duplication.
This commit is contained in:
parent
01462c3d20
commit
ba5c40b15d
|
@ -433,19 +433,7 @@ void VPApplication::InitOptions()
|
||||||
VTheme::SetIconTheme();
|
VTheme::SetIconTheme();
|
||||||
VTheme::InitThemeMode();
|
VTheme::InitThemeMode();
|
||||||
|
|
||||||
auto *statistic = VGAnalytics::Instance();
|
VGAnalytics::Init(settings);
|
||||||
QString clientID = settings->GetClientID();
|
|
||||||
if (clientID.isEmpty())
|
|
||||||
{
|
|
||||||
clientID = QUuid::createUuid().toString();
|
|
||||||
settings->SetClientID(clientID);
|
|
||||||
}
|
|
||||||
statistic->SetClientID(clientID);
|
|
||||||
statistic->SetGUILanguage(settings->GetLocale());
|
|
||||||
statistic->SetMeasurementId(GA_MEASUREMENT_ID);
|
|
||||||
statistic->SetApiSecret(GA_API_SECRET);
|
|
||||||
statistic->SetRepoRevision(QLatin1String(BUILD_REVISION));
|
|
||||||
statistic->Enable(settings->IsCollectStatistic());
|
|
||||||
|
|
||||||
m_shortcutManager = new VPuzzleShortcutManager(this);
|
m_shortcutManager = new VPuzzleShortcutManager(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -479,19 +479,7 @@ void MApplication::InitOptions()
|
||||||
VTheme::SetIconTheme();
|
VTheme::SetIconTheme();
|
||||||
VTheme::InitThemeMode();
|
VTheme::InitThemeMode();
|
||||||
|
|
||||||
auto *statistic = VGAnalytics::Instance();
|
VGAnalytics::Init(settings);
|
||||||
QString clientID = settings->GetClientID();
|
|
||||||
if (clientID.isEmpty())
|
|
||||||
{
|
|
||||||
clientID = QUuid::createUuid().toString();
|
|
||||||
settings->SetClientID(clientID);
|
|
||||||
}
|
|
||||||
statistic->SetClientID(clientID);
|
|
||||||
statistic->SetGUILanguage(settings->GetLocale());
|
|
||||||
statistic->SetMeasurementId(GA_MEASUREMENT_ID);
|
|
||||||
statistic->SetApiSecret(GA_API_SECRET);
|
|
||||||
statistic->SetRepoRevision(QLatin1String(BUILD_REVISION));
|
|
||||||
statistic->Enable(settings->IsCollectStatistic());
|
|
||||||
|
|
||||||
m_shortcutManager = new VTapeShortcutManager(this);
|
m_shortcutManager = new VTapeShortcutManager(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include "../qmuparser/qmuparsererror.h"
|
#include "../qmuparser/qmuparsererror.h"
|
||||||
#include "../version.h"
|
#include "../version.h"
|
||||||
#include "../vformat/knownmeasurements/vknownmeasurementsdatabase.h"
|
#include "../vformat/knownmeasurements/vknownmeasurementsdatabase.h"
|
||||||
#include "../vganalytics/def.h"
|
|
||||||
#include "../vganalytics/vganalytics.h"
|
#include "../vganalytics/vganalytics.h"
|
||||||
#include "../vmisc/qt_dispatch/qt_dispatch.h"
|
#include "../vmisc/qt_dispatch/qt_dispatch.h"
|
||||||
#include "../vmisc/theme/vtheme.h"
|
#include "../vmisc/theme/vtheme.h"
|
||||||
|
@ -690,19 +689,7 @@ void VApplication::InitOptions()
|
||||||
m_shortcutManager = new VValentinaShortcutManager(this);
|
m_shortcutManager = new VValentinaShortcutManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *statistic = VGAnalytics::Instance();
|
VGAnalytics::Init(settings);
|
||||||
QString clientID = settings->GetClientID();
|
|
||||||
if (clientID.isEmpty())
|
|
||||||
{
|
|
||||||
clientID = QUuid::createUuid().toString();
|
|
||||||
settings->SetClientID(clientID);
|
|
||||||
}
|
|
||||||
statistic->SetClientID(clientID);
|
|
||||||
statistic->SetGUILanguage(settings->GetLocale());
|
|
||||||
statistic->SetMeasurementId(GA_MEASUREMENT_ID);
|
|
||||||
statistic->SetApiSecret(GA_API_SECRET);
|
|
||||||
statistic->SetRepoRevision(QLatin1String(BUILD_REVISION));
|
|
||||||
statistic->Enable(settings->IsCollectStatistic());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
**
|
**
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
#include "vganalytics.h"
|
#include "vganalytics.h"
|
||||||
#include "../vmisc/defglobal.h"
|
|
||||||
#include "vganalyticsworker.h"
|
#include "vganalyticsworker.h"
|
||||||
|
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
|
@ -61,6 +60,14 @@
|
||||||
#include "../vmisc/compatibility.h"
|
#include "../vmisc/compatibility.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(BUILD_REVISION) && defined(QBS_BUILD)
|
||||||
|
#include <vcsRepoState.h>
|
||||||
|
#define BUILD_REVISION VCS_REPO_STATE_REVISION
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "../vmisc/vcommonsettings.h"
|
||||||
|
#include "def.h"
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
using namespace Qt::Literals::StringLiterals;
|
using namespace Qt::Literals::StringLiterals;
|
||||||
|
|
||||||
|
@ -151,6 +158,26 @@ auto VGAnalytics::Instance() -> VGAnalytics *
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VGAnalytics::Init(VCommonSettings *settings)
|
||||||
|
{
|
||||||
|
SCASSERT(settings != nullptr)
|
||||||
|
|
||||||
|
auto *statistic = VGAnalytics::Instance();
|
||||||
|
QString clientID = settings->GetClientID();
|
||||||
|
if (clientID.isEmpty())
|
||||||
|
{
|
||||||
|
clientID = QUuid::createUuid().toString();
|
||||||
|
settings->SetClientID(clientID);
|
||||||
|
}
|
||||||
|
statistic->SetClientID(clientID);
|
||||||
|
statistic->SetGUILanguage(settings->GetLocale());
|
||||||
|
statistic->SetMeasurementId(GA_MEASUREMENT_ID);
|
||||||
|
statistic->SetApiSecret(GA_API_SECRET);
|
||||||
|
statistic->SetRepoRevision(QLatin1String(BUILD_REVISION));
|
||||||
|
statistic->Enable(settings->IsCollectStatistic());
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VGAnalytics::SetLogLevel(enum VGAnalytics::LogLevel logLevel)
|
void VGAnalytics::SetLogLevel(enum VGAnalytics::LogLevel logLevel)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
|
|
||||||
class QNetworkAccessManager;
|
class QNetworkAccessManager;
|
||||||
class VGAnalyticsWorker;
|
class VGAnalyticsWorker;
|
||||||
|
class VCommonSettings;
|
||||||
|
|
||||||
// https://developers.google.com/analytics/devguides/collection/protocol/ga4/verify-implementation?client_type=gtag
|
// https://developers.google.com/analytics/devguides/collection/protocol/ga4/verify-implementation?client_type=gtag
|
||||||
class VGAnalytics : public QObject
|
class VGAnalytics : public QObject
|
||||||
|
@ -47,6 +48,8 @@ public:
|
||||||
|
|
||||||
static auto Instance() -> VGAnalytics *;
|
static auto Instance() -> VGAnalytics *;
|
||||||
|
|
||||||
|
static void Init(VCommonSettings *settings);
|
||||||
|
|
||||||
enum LogLevel
|
enum LogLevel
|
||||||
{
|
{
|
||||||
Debug,
|
Debug,
|
||||||
|
|
|
@ -28,10 +28,11 @@
|
||||||
|
|
||||||
#include "vabstractapplication.h"
|
#include "vabstractapplication.h"
|
||||||
|
|
||||||
#include "QtConcurrent/qtconcurrentrun.h"
|
|
||||||
#include "compatibility.h"
|
#include "compatibility.h"
|
||||||
#include "svgfont/vsvgfontdatabase.h"
|
#include "svgfont/vsvgfontdatabase.h"
|
||||||
#include "vtranslator.h"
|
#include "vtranslator.h"
|
||||||
|
|
||||||
|
#include "QtConcurrent/qtconcurrentrun.h"
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileSystemWatcher>
|
#include <QFileSystemWatcher>
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user