diff --git a/src/apps/marble-maps/DeveloperDialog.qml b/src/apps/marble-maps/DeveloperDialog.qml index 9fedd5d4e..4d4e2ea4f 100644 --- a/src/apps/marble-maps/DeveloperDialog.qml +++ b/src/apps/marble-maps/DeveloperDialog.qml @@ -1,126 +1,133 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2015 Dennis Nienhüser // import QtQuick 2.3 import QtQuick.Controls 1.3 import QtQuick.Window 2.2 import QtQuick.Layouts 1.1 import org.kde.marble 0.20 Item { id: root height: column.height + Screen.pixelDensity * 4 SystemPalette { id: palette colorGroup: SystemPalette.Active } Settings { id: settings Component.onDestruction: { settings.setValue("Developer", "inertialGlobeRotation", marbleMaps.inertialGlobeRotation) settings.setValue("Developer", "positionProvider", marbleMaps.currentPositionProvider) settings.setValue("Developer", "runtimeTrace", runtimeTrace.checked ? "true" : "false") settings.setValue("Developer", "debugTags", debugTags.checked ? "true" : "false") settings.setValue("Developer", "debugPlacemarks", debugPlacemarks.checked ? "true" : "false") settings.setValue("Developer", "debugPolygons", debugPolygons.checked ? "true" : "false") settings.setValue("Developer", "debugBatches", debugBatches.checked ? "true" : "false") + settings.setValue("Developer", "debugOutput", debugOutputEnabled ? "true" : "false") } } Rectangle { anchors.fill: parent color: palette.base } Column { id: column anchors { left: parent.left right: parent.right top: parent.top margins: Screen.pixelDensity * 2 } spacing: Screen.pixelDensity * 1 Grid { columns: 2 flow: Grid.TopToBottom spacing: Screen.pixelDensity * 2 Column { spacing: Screen.pixelDensity * 0.5 Text { - text: "Developer Tools" + text: "Tools" } CheckBox { text: "Inertial Rotation" checked: settings.value("Developer", "inertialGlobeRotation") === "true" onCheckedChanged: marbleMaps.inertialGlobeRotation = checked } CheckBox { text: "GPS Simulation" checked: settings.value("Developer", "positionProvider") === "RouteSimulationPositionProviderPlugin" onCheckedChanged: marbleMaps.currentPositionProvider = checked ? "RouteSimulationPositionProviderPlugin" : "QtPositioning" } CheckBox { id: runtimeTrace text: "Render Performance" checked: settings.value("Developer", "runtimeTrace") === "true" onCheckedChanged: marbleMaps.setShowRuntimeTrace(checked) } + + CheckBox { + text: "Shell Output" + checked: settings.value("Developer", "debugOutput") === "true" + onCheckedChanged: settings.debugOutputEnabled = checked + } } Column { spacing: Screen.pixelDensity * 0.5 Text { - text: "Debug Rendering" + text: "Information" } CheckBox { id: debugTags text: "OSM Tags" checked: settings.value("Developer", "debugTags") === "true" onCheckedChanged: placemarkDialog.showTags = checked } CheckBox { id: debugPlacemarks text: "Placemarks" checked: settings.value("Developer", "debugPlacemarks") === "true" onCheckedChanged: marbleMaps.setShowDebugPlacemarks(checked) } CheckBox { id: debugPolygons text: "Polygons" checked: settings.value("Developer", "debugPolygons") === "true" onCheckedChanged: marbleMaps.setShowDebugPolygons(checked) } CheckBox { id: debugBatches text: "Batches" checked: settings.value("Developer", "debugBatches") === "true" onCheckedChanged: marbleMaps.setShowDebugBatches(checked) } } } } } diff --git a/src/lib/marble/declarative/Settings.cpp b/src/lib/marble/declarative/Settings.cpp index 1860cfa8c..998217677 100644 --- a/src/lib/marble/declarative/Settings.cpp +++ b/src/lib/marble/declarative/Settings.cpp @@ -1,58 +1,74 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2011 Dennis Nienhüser // #include "Settings.h" +#include "MarbleDebug.h" #include #include Settings::Settings() : m_organizationName( QApplication::organizationName() ), m_applicationName( QApplication::applicationName() ) { // nothing to do } QString Settings::organizationName() const { return m_organizationName; } void Settings::setOrganizationName( const QString &organization ) { m_organizationName = organization; } QString Settings::applicationName() const { return m_applicationName; } void Settings::setApplicationName( const QString &application ) { m_applicationName = application; } +bool Settings::debugOutputEnabled() const +{ + return Marble::MarbleDebug::isEnabled(); +} + QVariant Settings::value( const QString &group, const QString &key, const QVariant &value ) const { QSettings settings( m_organizationName, m_applicationName ); settings.beginGroup( group ); return settings.value( key, value ); } void Settings::setValue( const QString &group, const QString &key, const QVariant &value ) { QSettings settings( m_organizationName, m_applicationName ); settings.beginGroup( group ); settings.setValue( key, value ); settings.endGroup(); } +void Settings::setDebugOutputEnabled(bool debugOutputEnabled) +{ + if (Marble::MarbleDebug::isEnabled() == debugOutputEnabled) { + return; + } + + Marble::MarbleDebug::setEnabled(debugOutputEnabled); + emit debugOutputEnabledChanged(Marble::MarbleDebug::isEnabled()); +} + #include "moc_Settings.cpp" diff --git a/src/lib/marble/declarative/Settings.h b/src/lib/marble/declarative/Settings.h index 4ebfe06b8..e7965156b 100644 --- a/src/lib/marble/declarative/Settings.h +++ b/src/lib/marble/declarative/Settings.h @@ -1,46 +1,53 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2011 Dennis Nienhüser // #ifndef MARBLE_DECLARATIVE_SETTINGS_H #define MARBLE_DECLARATIVE_SETTINGS_H #include #include class Settings : public QObject { Q_OBJECT Q_PROPERTY( QString organizationName READ organizationName WRITE setOrganizationName ) Q_PROPERTY( QString applicationName READ applicationName WRITE setApplicationName ) + Q_PROPERTY( bool debugOutputEnabled READ debugOutputEnabled WRITE setDebugOutputEnabled NOTIFY debugOutputEnabledChanged) public: Settings(); QString organizationName() const; void setOrganizationName( const QString &organization ); QString applicationName() const; void setApplicationName( const QString &application ); + bool debugOutputEnabled() const; + public Q_SLOTS: QVariant value( const QString &group, const QString &key, const QVariant &value = QVariant() ) const; void setValue( const QString &group, const QString &key, const QVariant &value ); + void setDebugOutputEnabled(bool debugOutputEnabled); + +Q_SIGNALS: + void debugOutputEnabledChanged(bool debugOutputEnabled); + private: QString m_organizationName; - QString m_applicationName; }; #endif // MARBLE_DECLARATIVE_SETTINGS_H