From 2fbd68ecb37541ce6cf8dffcb437997e8724a5b2 Mon Sep 17 00:00:00 2001 From: bsongis Date: Fri, 13 Jun 2014 10:13:44 +0200 Subject: [PATCH] Google analytics removed. Completely wrong, we use the compilation server numbers instead. --- companion/src/CMakeLists.txt | 7 +- companion/src/avroutputdialog.cpp | 3 - companion/src/generaledit.cpp | 3 - companion/src/googleanalytics.cpp | 73 -------------------- companion/src/googleanalytics.h | 21 ------ companion/src/mainwindow.cpp | 4 -- 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 - 11 files changed, 1 insertion(+), 124 deletions(-) delete mode 100755 companion/src/googleanalytics.cpp delete mode 100755 companion/src/googleanalytics.h diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 526742415..35fb58a83 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -130,15 +130,10 @@ set(common_SRCS firmwares/opentx/opentxM128simulator.cpp firmwares/opentx/opentxM64simulator.cpp file.cpp - googleanalytics.cpp appdata.cpp ) -set(common_MOC_HDRS - googleanalytics.h -) - -qt4_wrap_cpp( common_SRCS ${common_MOC_HDRS} ) +qt4_wrap_cpp(common_SRCS) add_library(common ${common_SRCS}) diff --git a/companion/src/avroutputdialog.cpp b/companion/src/avroutputdialog.cpp index 40c0d0012..431fa18ac 100644 --- a/companion/src/avroutputdialog.cpp +++ b/companion/src/avroutputdialog.cpp @@ -3,7 +3,6 @@ #include #include "eeprominterface.h" #include "flashinterface.h" -#include "googleanalytics.h" #if defined WIN32 || !defined __GNUC__ #include @@ -94,8 +93,6 @@ 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 56373f649..0c1032e59 100644 --- a/companion/src/generaledit.cpp +++ b/companion/src/generaledit.cpp @@ -4,7 +4,6 @@ #include "appdata.h" #include #include -#include "googleanalytics.h" #define BIT_WARN_THR ( 0x01 ) #define BIT_WARN_SW ( 0x02 ) @@ -318,8 +317,6 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) : } disableMouseScrolling(); - - ga.sendPageView(getBoardName(GetCurrentFirmware()->getBoard()) + " GeneralEdit"); } GeneralEdit::~GeneralEdit() diff --git a/companion/src/googleanalytics.cpp b/companion/src/googleanalytics.cpp deleted file mode 100755 index ce7271316..000000000 --- a/companion/src/googleanalytics.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include "googleanalytics.h" -#include - -#define TRACKING_ID "UA-40098569-1" - -GoogleAnalytics ga; - -GoogleAnalytics::GoogleAnalytics(): - userId(qrand()), - networkManager(new QNetworkAccessManager(this)) -{ -} - -GoogleAnalytics::~GoogleAnalytics() -{ - delete networkManager; -} - -void GoogleAnalytics::sendPageView(QString title) -{ - // create request and set URL of receiver - QNetworkRequest request; - QUrl host("http://www.google-analytics.com/collect"); - request.setUrl(host); - request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); - - // setup parameters of request - QString requestParams; - requestParams += "v=1"; // version of protocol - requestParams += "&t=pageview"; // type of request - requestParams += "&tid=" TRACKING_ID; // Google Analytics account - requestParams += "&cid=" + QString::number(userId); // unique user identifier - 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 - networkManager->post(request, requestParams.toStdString().c_str()); -} - -void GoogleAnalytics::sendEvent(QString category, QString action, QString label) -{ - // create request and set URL of receiver - QNetworkRequest request; - QUrl host("http://www.google-analytics.com/collect"); - request.setUrl(host); - request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); - - // setup parameters of request - QString requestParams; - requestParams += "v=1"; // version of protocol - requestParams += "&t=event"; // type of request - requestParams += "&ec=" + category; - requestParams += "&ea=" + action; - requestParams += "&el=" + label; - requestParams += "&tid=" TRACKING_ID; // Google Analytics account - requestParams += "&cid=" + QString::number(userId); // unique user identifier - requestParams += "&dt=Companion"; // name of page (or app name) - requestParams += "&ul=" + QLocale::system().name(); // language - - // send request via post method - networkManager->post(request, requestParams.toStdString().c_str()); -} - -void GoogleAnalytics::slot_receive(QNetworkReply * reply) -{ - // output information about reply - qDebug() << "RequestUrl:" << reply->request().url(); - qDebug() << "Status:" << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); - qDebug() << "Error:"<< reply->error(); - QByteArray bytes = reply->readAll(); - qDebug() << "Contents" << QString::fromUtf8(bytes.data(), bytes.size()); -} diff --git a/companion/src/googleanalytics.h b/companion/src/googleanalytics.h deleted file mode 100755 index 8aca8022c..000000000 --- a/companion/src/googleanalytics.h +++ /dev/null @@ -1,21 +0,0 @@ -#include - -class GoogleAnalytics: public QObject -{ - Q_OBJECT - - public: - GoogleAnalytics(); - ~GoogleAnalytics(); - void sendPageView(QString page); - void sendEvent(QString category, QString action, QString label=""); - - protected slots: - void slot_receive(QNetworkReply * reply); - - protected: - int userId; - QNetworkAccessManager * networkManager; -}; - -extern GoogleAnalytics ga; diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index 8e30b3041..e25d1623b 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -64,7 +64,6 @@ #include "helpers.h" #include "appdata.h" #include "radionotfound.h" -#include "googleanalytics.h" #include "firmwares/opentx/opentxinterface.h" // TODO get rid of this include #define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2" @@ -164,8 +163,6 @@ MainWindow::MainWindow(): if (printing) { QTimer::singleShot(0, this, SLOT(autoClose())); } - - ga.sendPageView("Home"); } void MainWindow::displayWarnings() @@ -512,7 +509,6 @@ void MainWindow::startFirmwareDownload() downloadDialog * dd = new downloadDialog(this, url, filename); connect(dd, SIGNAL(accepted()), this, SLOT(firmwareDownloadAccepted())); dd->exec(); - ga.sendEvent(getBoardName(GetCurrentFirmware()->getBoard()), "Download", url); } } diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index a4f81e98a..720bc0826 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -54,7 +54,6 @@ #include "appdata.h" #include "wizarddialog.h" #include -#include "googleanalytics.h" #if defined WIN32 || !defined __GNUC__ #include @@ -80,8 +79,6 @@ 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 ceef887b5..a7c9cfbcd 100644 --- a/companion/src/modeledit/modeledit.cpp +++ b/companion/src/modeledit/modeledit.cpp @@ -13,7 +13,6 @@ #include "telemetry.h" #include "appdata.h" #include -#include "googleanalytics.h" ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, FirmwareInterface * firmware) : QDialog(parent), @@ -43,8 +42,6 @@ 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 10ac6afc3..9a335f946 100644 --- a/companion/src/printdialog.cpp +++ b/companion/src/printdialog.cpp @@ -6,7 +6,6 @@ #include #include #include -#include "googleanalytics.h" #if !defined WIN32 && defined __GNUC__ #include @@ -62,8 +61,6 @@ 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 c5a6c801f..69f85346f 100644 --- a/companion/src/simulation/simulatordialog.cpp +++ b/companion/src/simulation/simulatordialog.cpp @@ -4,7 +4,6 @@ #include #include "helpers.h" #include "simulatorinterface.h" -#include "googleanalytics.h" #define GBALL_SIZE 20 #define RESX 1024 @@ -24,7 +23,6 @@ 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 d59537ab5..32945e07d 100644 --- a/companion/src/wizarddialog.cpp +++ b/companion/src/wizarddialog.cpp @@ -16,7 +16,6 @@ #include "wizarddialog.h" #include "wizarddata.h" #include "helpers.h" -#include "googleanalytics.h" WizardDialog::WizardDialog(const GeneralSettings & settings, unsigned int modelId, QWidget *parent): QWizard(parent), @@ -60,8 +59,6 @@ WizardDialog::WizardDialog(const GeneralSettings & settings, unsigned int modelI setOption(QWizard::NoCancelButton, false); setOption(HaveHelpButton, true); connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp())); - - ga.sendPageView("Wizard"); } void WizardDialog::showHelp()