summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Sterna <tomek@xiaoka.com>2015-06-18 22:26:10 +0200
committerTomasz Sterna <tomek@xiaoka.com>2015-06-18 22:26:10 +0200
commit4716453e97602e60f58865692f7dc714f5f992e9 (patch)
treeeea4e4e04e5b0defaae53af0368f1903f28db8ef
parentff461247fe6416540f3e211aba40d61c1e359221 (diff)
Implemented togglable debug mode
-rw-r--r--app/qml/pages/AboutPage.qml16
-rw-r--r--app/qml/pages/ManagerPage.qml2
-rw-r--r--daemon/daemon.cpp12
-rw-r--r--daemon/settings.h6
4 files changed, 26 insertions, 10 deletions
diff --git a/app/qml/pages/AboutPage.qml b/app/qml/pages/AboutPage.qml
index fec0fb5..a674b65 100644
--- a/app/qml/pages/AboutPage.qml
+++ b/app/qml/pages/AboutPage.qml
@@ -1,10 +1,17 @@
import QtQuick 2.0
import QtQml 2.1
import Sailfish.Silica 1.0
+import org.nemomobile.configuration 1.0
Page {
id: page
+ ConfigurationGroup {
+ id: settings
+ path: "/org/pebbled/settings"
+ property bool debug
+ }
+
SilicaFlickable {
id: flickable
anchors.fill: parent
@@ -130,6 +137,15 @@ Page {
}
onClicked: Qt.openUrlExternally("mailto:bugs@xiaoka.com?subject=pebbled issue&body=describe your issue here")
}
+ TextSwitch {
+ text: qsTr("Debug Mode")
+ description: qsTr("Enable daemon and app debugging")
+ checked: settings.debug
+ automaticCheck: true
+ onClicked: {
+ settings.debug = !settings.debug;
+ }
+ }
}
}
}
diff --git a/app/qml/pages/ManagerPage.qml b/app/qml/pages/ManagerPage.qml
index a69bc89..8ff0db2 100644
--- a/app/qml/pages/ManagerPage.qml
+++ b/app/qml/pages/ManagerPage.qml
@@ -147,7 +147,7 @@ Page {
}
TextSwitch {
text: qsTr("Control main volume")
- description: qsTr("Pebble music volume buttons change the main phone volume directly instead of through the music player.")
+ description: qsTr("Pebble music volume buttons change the main phone volume directly instead of through the music player")
checked: settings.useSystemVolume
automaticCheck: true
onClicked: {
diff --git a/daemon/daemon.cpp b/daemon/daemon.cpp
index 85af751..78050d3 100644
--- a/daemon/daemon.cpp
+++ b/daemon/daemon.cpp
@@ -50,18 +50,14 @@ int main(int argc, char *argv[])
app.setApplicationName("pebble"); // Use the same appname as the UI.
app.setOrganizationName("");
- QStringList filterRules;
-
- filterRules << (argc > 1 and QString("-d") == argv[0] ?
- "*.debug=false" : "*.debug=true");
-
- // Init logging should be called after app object creation
- QLoggingCategory::setFilterRules(filterRules.join("\n"));
-
QLoggingCategory l("main");
qCDebug(l) << argv[0] << APP_VERSION;
Settings settings;
+
+ QLoggingCategory::setFilterRules(settings.property("debug").toBool() ?
+ "*.debug=true" : "*.debug=false");
+
Manager manager(&settings);
Q_UNUSED(manager);
diff --git a/daemon/settings.h b/daemon/settings.h
index a247dc5..4534a54 100644
--- a/daemon/settings.h
+++ b/daemon/settings.h
@@ -21,6 +21,7 @@ class Settings : public MDConfGroup
Q_PROPERTY(bool notificationsOther MEMBER notificationsOther NOTIFY notificationsOtherChanged)
Q_PROPERTY(bool notificationsAll MEMBER notificationsAll NOTIFY notificationsAllChanged)
Q_PROPERTY(QString accountToken MEMBER accountToken NOTIFY accountTokenChanged)
+ Q_PROPERTY(bool debug MEMBER debug NOTIFY debugChanged)
QString profileWhenConnected;
QString profileWhenDisconnected;
@@ -36,6 +37,7 @@ class Settings : public MDConfGroup
bool notificationsOther;
bool notificationsAll;
QString accountToken;
+ bool debug;
public:
explicit Settings(QObject *parent = 0) :
@@ -50,7 +52,8 @@ public:
notificationsTwitter(true),
notificationsFacebook(true),
notificationsOther(true),
- notificationsAll(false)
+ notificationsAll(false),
+ debug(false)
{
resolveMetaObject();
QMetaObject::invokeMethod(this, "propertyChanged", Qt::DirectConnection);
@@ -72,6 +75,7 @@ signals:
void notificationsOtherChanged();
void notificationsAllChanged();
void accountTokenChanged();
+ void debugChanged();
};
#endif // SETTINGS_H