Merge pull request #3178 from Atlante45/activity_logger_on_off_option

Activity logger on off option
This commit is contained in:
Brad Hefta-Gaub 2014-07-17 08:53:47 -07:00
commit 87ff6b9012
6 changed files with 162 additions and 11 deletions

View file

@ -32,6 +32,7 @@
#include <AccountManager.h>
#include <XmppClient.h>
#include <UUID.h>
#include <UserActivityLogger.h>
#include "Application.h"
#include "AccountManager.h"
@ -433,8 +434,14 @@ Menu::Menu() :
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::ShowIKConstraints, 0, false);
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::AlignForearmsWithWrists, 0, true);
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::AlternateIK, 0, false);
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::DisableNackPackets, 0, false);
addCheckableActionToQMenuAndActionHash(developerMenu,
MenuOption::DisableActivityLogger,
0,
false,
&UserActivityLogger::getInstance(),
SLOT(disable(bool)));
addDisabledActionAndSeparator(developerMenu, "Testing");

View file

@ -341,6 +341,7 @@ namespace MenuOption {
const QString Console = "Console...";
const QString DecreaseAvatarSize = "Decrease Avatar Size";
const QString DecreaseVoxelSize = "Decrease Voxel Size";
const QString DisableActivityLogger = "Disable Activity Logger";
const QString DisableAutoAdjustLOD = "Disable Automatically Adjusting LOD";
const QString DisableNackPackets = "Disable NACK Packets";
const QString DisableQAudioOutputOverflowCheck = "Disable QAudioOutput Overflow Check";

View file

@ -136,6 +136,8 @@ void PreferencesDialog::loadPreferences() {
_skeletonURLString = myAvatar->getSkeletonModel().getURL().toString();
ui.skeletonURLEdit->setText(_skeletonURLString);
ui.sendDataCheckBox->setChecked(!menuInstance->isOptionChecked(MenuOption::DisableActivityLogger));
ui.snapshotLocationEdit->setText(menuInstance->getSnapshotsLocation());
@ -201,6 +203,11 @@ void PreferencesDialog::savePreferences() {
myAvatar->sendIdentityPacket();
Application::getInstance()->bumpSettings();
}
if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableActivityLogger)
!= ui.sendDataCheckBox->isChecked()) {
Menu::getInstance()->triggerOption(MenuOption::DisableActivityLogger);
}
if (!ui.snapshotLocationEdit->text().isEmpty() && QDir(ui.snapshotLocationEdit->text()).exists()) {
Menu::getInstance()->setSnapshotsLocation(ui.snapshotLocationEdit->text());

View file

@ -135,7 +135,7 @@ color: #0e7077</string>
<x>0</x>
<y>30</y>
<width>494</width>
<height>384</height>
<height>361</height>
</rect>
</property>
<property name="frameShape">
@ -155,8 +155,8 @@ color: #0e7077</string>
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>1091</height>
<width>494</width>
<height>1456</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -790,6 +790,132 @@ padding: 10px;margin-top:10px</string>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="privacyLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: #0e7077</string>
</property>
<property name="text">
<string>Privacy</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="buddy">
<cstring>snapshotLocationEdit</cstring>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_18">
<property name="spacing">
<number>0</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label_15">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(51, 51, 51)</string>
</property>
<property name="text">
<string>Send data</string>
</property>
<property name="indent">
<number>15</number>
</property>
<property name="buddy">
<cstring>maxVoxelsSpin</cstring>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_18">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="sendDataCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@ -2073,8 +2199,8 @@ padding: 10px;margin-top:10px</string>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>495</x>
<y>749</y>
<x>966</x>
<y>557</y>
</hint>
<hint type="destinationlabel">
<x>528</x>
@ -2089,8 +2215,8 @@ padding: 10px;margin-top:10px</string>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>504</x>
<y>749</y>
<x>1070</x>
<y>557</y>
</hint>
<hint type="destinationlabel">
<x>20</x>

View file

@ -9,13 +9,13 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "UserActivityLogger.h"
#include <QEventLoop>
#include <QJsonDocument>
#include <QHttpMultiPart>
#include <QTimer>
#include "UserActivityLogger.h"
static const QString USER_ACTIVITY_URL = "/api/v1/user_activities";
UserActivityLogger& UserActivityLogger::getInstance() {
@ -23,10 +23,18 @@ UserActivityLogger& UserActivityLogger::getInstance() {
return sharedInstance;
}
UserActivityLogger::UserActivityLogger() {
UserActivityLogger::UserActivityLogger() : _disabled(false) {
}
void UserActivityLogger::disable(bool disable) {
_disabled = disable;
}
void UserActivityLogger::logAction(QString action, QJsonObject details, JSONCallbackParameters params) {
if (_disabled) {
return;
}
AccountManager& accountManager = AccountManager::getInstance();
QHttpMultiPart* multipart = new QHttpMultiPart(QHttpMultiPart::FormDataType);

View file

@ -26,6 +26,7 @@ public:
static UserActivityLogger& getInstance();
public slots:
void disable(bool disable);
void logAction(QString action, QJsonObject details = QJsonObject(), JSONCallbackParameters params = JSONCallbackParameters());
void launch(QString applicationVersion);
@ -43,6 +44,7 @@ private slots:
private:
UserActivityLogger();
bool _disabled;
};
#endif // hifi_UserActivityLogger_h