From b7365179864b2d6d4be0feee64d4a8276346153e Mon Sep 17 00:00:00 2001 From: bsongis Date: Tue, 27 May 2014 16:20:12 +0200 Subject: [PATCH] More statistics --- companion/src/CMakeLists.txt | 4 +++- companion/src/avroutputdialog.cpp | 5 ++++- companion/src/generaledit.cpp | 3 +++ companion/src/googleanalytics.cpp | 5 +++-- companion/src/mainwindow.cpp | 2 +- companion/src/mdichild.cpp | 3 +++ companion/src/modeledit/modeledit.cpp | 3 +++ companion/src/printdialog.cpp | 3 +++ companion/src/simulation/simulatordialog.cpp | 2 ++ companion/src/wizarddialog.cpp | 3 +++ 10 files changed, 28 insertions(+), 5 deletions(-) diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 198b48598..39e308d24 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -342,10 +342,12 @@ set(simu_SRCS modeledit/edge.cpp # TODO not needed appdata.cpp simulator.cpp + googleanalytics.cpp ) set(simu_HDRS - modeledit/node.h + modeledit/node.h + googleanalytics.h ) qt4_wrap_cpp(simu_SRCS ${simu_HDRS} ) diff --git a/companion/src/avroutputdialog.cpp b/companion/src/avroutputdialog.cpp index 2ea2171f3..6b0a7194a 100644 --- a/companion/src/avroutputdialog.cpp +++ b/companion/src/avroutputdialog.cpp @@ -3,6 +3,7 @@ #include #include "eeprominterface.h" #include "flashinterface.h" +#include "googleanalytics.h" #if defined WIN32 || !defined __GNUC__ #include @@ -92,7 +93,9 @@ avrOutputDialog::avrOutputDialog(QWidget *parent, QString prog, QStringList arg, process->start(prog,arg); } - } + } + + ga.sendPageView(getBoardName(GetCurrentFirmware()->getBoard()) + " Flash"); } # if !__GNUC__ diff --git a/companion/src/generaledit.cpp b/companion/src/generaledit.cpp index f4604fcca..69cd9932b 100644 --- a/companion/src/generaledit.cpp +++ b/companion/src/generaledit.cpp @@ -4,6 +4,7 @@ #include "appdata.h" #include #include +#include "googleanalytics.h" #define BIT_WARN_THR ( 0x01 ) #define BIT_WARN_SW ( 0x02 ) @@ -307,6 +308,8 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) : ui->backlightColor1_label->hide(); ui->backlightColor2_label->hide(); } + + ga.sendPageView(getBoardName(GetCurrentFirmware()->getBoard()) + " GeneralEdit"); } GeneralEdit::~GeneralEdit() diff --git a/companion/src/googleanalytics.cpp b/companion/src/googleanalytics.cpp index 516379ddd..ce7271316 100755 --- a/companion/src/googleanalytics.cpp +++ b/companion/src/googleanalytics.cpp @@ -16,7 +16,7 @@ GoogleAnalytics::~GoogleAnalytics() delete networkManager; } -void GoogleAnalytics::sendPageView(QString page) +void GoogleAnalytics::sendPageView(QString title) { // create request and set URL of receiver QNetworkRequest request; @@ -30,7 +30,8 @@ void GoogleAnalytics::sendPageView(QString page) requestParams += "&t=pageview"; // type of request requestParams += "&tid=" TRACKING_ID; // Google Analytics account requestParams += "&cid=" + QString::number(userId); // unique user identifier - requestParams += "&dp=" + page; // name of page (or app name) + requestParams += "&dp=companion-" + title.toLower().replace(" ", "-"); // name of page + requestParams += "&dt=" + title; // title of page requestParams += "&ul=" + QLocale::system().name(); // language // send request via post method diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index 486262fb0..15cb2564f 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -164,7 +164,7 @@ MainWindow::MainWindow(): QTimer::singleShot(0, this, SLOT(autoClose())); } - ga.sendEvent(getBoardName(GetCurrentFirmware()->getBoard()), "Start Companion"); + ga.sendPageView("Home"); } void MainWindow::displayWarnings() diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index 15c21c63c..d8f828bea 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -55,6 +55,7 @@ #include "wizarddialog.h" #include "taranisnotfound.h" #include +#include "googleanalytics.h" #if defined WIN32 || !defined __GNUC__ #include @@ -80,6 +81,8 @@ MdiChild::MdiChild(): if(!(this->isMaximized() || this->isMinimized())) { adjustSize(); } + + ga.sendPageView(getBoardName(firmware->getBoard()) + " Models"); } MdiChild::~MdiChild() diff --git a/companion/src/modeledit/modeledit.cpp b/companion/src/modeledit/modeledit.cpp index a7c9cfbcd..ceef887b5 100644 --- a/companion/src/modeledit/modeledit.cpp +++ b/companion/src/modeledit/modeledit.cpp @@ -13,6 +13,7 @@ #include "telemetry.h" #include "appdata.h" #include +#include "googleanalytics.h" ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, FirmwareInterface * firmware) : QDialog(parent), @@ -42,6 +43,8 @@ ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmw addTab(new TelemetryPanel(this, model, generalSettings, firmware), tr("Telemetry")); connect(setupPanel, SIGNAL(extendedLimitsToggled()), chnPanel, SLOT(refreshExtendedLimits())); + + ga.sendPageView(getBoardName(firmware->getBoard()) + " ModelEdit"); } ModelEdit::~ModelEdit() diff --git a/companion/src/printdialog.cpp b/companion/src/printdialog.cpp index 20d76c4dc..1acb7d98a 100644 --- a/companion/src/printdialog.cpp +++ b/companion/src/printdialog.cpp @@ -6,6 +6,7 @@ #include #include #include +#include "googleanalytics.h" #if !defined WIN32 && defined __GNUC__ #include @@ -61,6 +62,8 @@ PrintDialog::PrintDialog(QWidget *parent, FirmwareInterface * firmware, GeneralS printToFile(); QTimer::singleShot(0, this, SLOT(autoClose())); } + + ga.sendPageView(getBoardName(GetCurrentFirmware()->getBoard()) + " ModelsPrint"); } void PrintDialog::closeEvent(QCloseEvent *event) diff --git a/companion/src/simulation/simulatordialog.cpp b/companion/src/simulation/simulatordialog.cpp index 69f85346f..c5a6c801f 100644 --- a/companion/src/simulation/simulatordialog.cpp +++ b/companion/src/simulation/simulatordialog.cpp @@ -4,6 +4,7 @@ #include #include "helpers.h" #include "simulatorinterface.h" +#include "googleanalytics.h" #define GBALL_SIZE 20 #define RESX 1024 @@ -23,6 +24,7 @@ SimulatorDialog::SimulatorDialog(QWidget * parent, unsigned int flags): trimPressed (TRIM_NONE), middleButtonPressed(false) { + ga.sendPageView(getBoardName(GetCurrentFirmware()->getBoard()) + " Simulator"); } uint32_t SimulatorDialog9X::switchstatus = 0; diff --git a/companion/src/wizarddialog.cpp b/companion/src/wizarddialog.cpp index c99ad6ecc..4add68c3e 100644 --- a/companion/src/wizarddialog.cpp +++ b/companion/src/wizarddialog.cpp @@ -16,6 +16,7 @@ #include "wizarddialog.h" #include "wizarddata.h" #include "helpers.h" +#include "googleanalytics.h" WizardDialog::WizardDialog(const GeneralSettings & settings, unsigned int modelId, QWidget *parent) : QWizard(parent), @@ -55,6 +56,8 @@ WizardDialog::WizardDialog(const GeneralSettings & settings, unsigned int modelI #endif setOption(HaveHelpButton, true); connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp())); + + ga.sendPageView("Wizard"); } void WizardDialog::showHelp()