[-]
[+]
|
Changed |
_service:tar_git:onyx-triambience-settings-plugin.spec
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -1,14 +1,15 @@
<services>
<service name="webhook">
- <param name="repourl">https://github.com/kimmoli/onyx-triambience-settings-plugin.git</param>
+ <param name="repourl">https://github.com/sailfishos-oneplus5/onyx-triambience-settings-plugin.git</param>
<param name="branch">master</param>
</service>
<service name="tar_git">
- <param name="url">https://github.com/kimmoli/onyx-triambience-settings-plugin.git</param>
- <param name="branch">master</param>
- <param name="revision"/>
- <param name="token"/>
- <param name="debian">N</param>
- <param name="dumb">N</param>
-</service></services>
+ <param name="url">https://github.com/sailfishos-oneplus5/onyx-triambience-settings-plugin.git</param>
+ <param name="branch">master</param>
+ <param name="revision">HEAD</param>
+ <param name="token"/>
+ <param name="debian">N</param>
+ <param name="dumb">N</param>
+ </service>
+</services>
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/.gitignore
^
|
@@ -1 +1,4 @@
+*~
*.qm
+*.pro.user
+.vscode
|
[-]
[+]
|
Added |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/README.md
^
|
@@ -0,0 +1,7 @@
+# onyx-triambience-settings-plugin
+A fork of [@kimmoli](https://github.com/kimmoli)'s [original handy settings plugin](https://github.com/kimmoli/onyx-triambience-settings-plugin) for managing your three selected [triambience daemon](https://github.com/sailfishos-oneplus5/triambience-daemon) ambiences with minor tweaks and improvements.
+
+## Screenshots
+
+![Screenshot on dark ambience](screenshots/settings-plugin-dark-ambience.png "The settings plugin UI under a dark ambience")
+![Screenshot on light ambience](screenshots/settings-plugin-light-ambience.png "The settings plugin UI under a light ambience")
|
|
Added |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/screenshots/settings-plugin-dark-ambience.png
^
|
|
Added |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/screenshots/settings-plugin-light-ambience.png
^
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/settings/AmbienceImage.qml
^
|
@@ -1,63 +1,62 @@
-import QtQuick 2.0
-import Sailfish.Silica 1.0
-import org.nemomobile.thumbnailer 1.0
-
-BackgroundItem
-{
-
- width: flick.width ? Math.min(flick.width, screen.sizeCategory > Screen.Medium ? Screen.width*0.7 : Screen.width) : Screen.width
- height: Theme.itemSizeHuge
-
- property alias source: img.source
- property alias ambienceName: namelabel.text
- property alias ambienceColor: namelabel.color
- property bool isSelected: false
-
- Thumbnail
- {
- id: img
- anchors.fill: parent
- sourceSize.width: width
- sourceSize.height: height
- }
-
- Rectangle
- {
- anchors.fill: parent
- gradient: Gradient
- {
- GradientStop { position: 0.0; color: "transparent" }
- GradientStop { position: 1.0; color: Qt.rgba(0.0 ,0.0, 0.0, 0.5) }
- }
- }
-
- BusyIndicator
- {
- size: BusyIndicatorSize.Medium
- anchors.centerIn: parent
- running: img.status != Image.Ready
- visible: running
- }
-
- Label
- {
- id: namelabel
- font.pixelSize: Theme.fontSizeLarge
- anchors.left: parent.left
- anchors.bottom: parent.bottom
- anchors.leftMargin: Theme.paddingLarge
- anchors.bottomMargin: Theme.paddingMedium
- }
-
- GlassItem
- {
- opacity: (isSelected) ? 1.0 : 0.0
- color: Theme.primaryColor
- anchors.left: parent.left
- anchors.leftMargin: -width/2
- anchors.verticalCenter: namelabel.verticalCenter
- dimmed: false
- falloffRadius: defaultFalloffRadius
- brightness: 1.0
- }
-}
+import QtQuick 2.2
+import Sailfish.Silica 1.0
+import org.nemomobile.thumbnailer 1.0
+
+BackgroundItem
+{
+ width: flick.width ? Math.min(flick.width, screen.sizeCategory > Screen.Medium ? Screen.width * 0.7 : Screen.width) : Screen.width
+ height: Theme.itemSizeHuge
+
+ property alias source: img.source
+ property alias ambienceName: namelabel.text
+ property alias ambienceColor: namelabel.color
+ property bool isSelected: false
+
+ Thumbnail
+ {
+ id: img
+ anchors.fill: parent
+ sourceSize.width: width
+ sourceSize.height: height
+ }
+
+ Rectangle
+ {
+ anchors.fill: parent
+ gradient: Gradient
+ {
+ GradientStop { position: 0.0; color: "transparent" }
+ GradientStop { position: 1.0; color: Qt.rgba(0.0, 0.0, 0.0, 0.5) }
+ }
+ }
+
+ BusyIndicator
+ {
+ size: BusyIndicatorSize.Medium
+ anchors.centerIn: parent
+ running: img.status != Image.Ready
+ visible: running
+ }
+
+ Label
+ {
+ id: namelabel
+ font.pixelSize: Theme.fontSizeLarge
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ anchors.leftMargin: Theme.paddingLarge
+ anchors.bottomMargin: Theme.paddingMedium
+ }
+
+ GlassItem
+ {
+ opacity: (isSelected) ? 1.0 : 0.0
+ color: Theme.primaryColor
+ anchors.left: parent.left
+ anchors.leftMargin: -width / 2
+ anchors.verticalCenter: namelabel.verticalCenter
+ dimmed: false
+ falloffRadius: defaultFalloffRadius
+ brightness: 1.0
+ }
+}
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/settings/Selector.qml
^
|
@@ -1,52 +1,51 @@
-import QtQuick 2.0
-import Sailfish.Silica 1.0
-
-Page
-{
- id: page
-
- property var ambiences
- property var name
- property string pageTitle : ""
- signal selected
-
- SilicaFlickable
- {
- id: flick
- anchors.fill: parent
- clip: true
-
- contentHeight: column.height
-
- Column
- {
- id: column
-
- width: page.width
-
- PageHeader
- {
- title: pageTitle
- }
-
- Repeater
- {
- model: ambiences
- delegate: AmbienceImage
- {
- source: wallpaper
- ambienceName: displayName
- ambienceColor: highlightColor
- isSelected: name === page.name
- onClicked:
- {
- page.name = name
- selected()
- pageStack.pop()
- }
- }
-
- }
- }
- }
-}
+import QtQuick 2.2
+import Sailfish.Silica 1.0
+
+Page
+{
+ id: page
+
+ property var ambiences
+ property var name
+ property string pageTitle : ""
+ signal selected
+
+ // Flickable wrapper
+ SilicaFlickable
+ {
+ id: flick
+ anchors.fill: parent
+ contentHeight: col.height
+ clip: true
+
+ // Page content
+ Column
+ {
+ id: col
+ width: page.width
+
+ PageHeader
+ {
+ title: pageTitle
+ }
+
+ Repeater
+ {
+ model: ambiences
+ delegate: AmbienceImage
+ {
+ source: wallpaper
+ ambienceName: displayName
+ ambienceColor: highlightColor
+ isSelected: name === page.name
+ onClicked:
+ {
+ page.name = name
+ selected()
+ pageStack.pop()
+ }
+ }
+ }
+ }
+ }
+}
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/settings/i18n/onyx-triambience-settings-de.ts
^
|
@@ -1,22 +1,23 @@
-<?xml version="1.0" ?><!DOCTYPE TS><TS language="de" version="2.1">
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="de">
<context>
- <name/>
+ <name></name>
<message id="onyx-tristate-settings-title">
- <source>Tristate ambience selector</source>
- <extracomment>page header</extracomment>
- <translation>Tristate Ambiente Wechsler</translation>
+ <source>Ambience slider</source>
+ <translation>Ambiente schieber</translation>
</message>
<message id="onyx-top-position">
- <source>Top</source>
- <translation>Oben</translation>
+ <source>Top position</source>
+ <translation>Oben position</translation>
</message>
<message id="onyx-middle-position">
- <source>Middle</source>
- <translation>Mitte</translation>
+ <source>Middle position</source>
+ <translation>Mitte position</translation>
</message>
<message id="onyx-bottom-position">
- <source>Bottom</source>
- <translation>Unten</translation>
+ <source>Bottom position</source>
+ <translation>Unten position</translation>
</message>
</context>
-</TS>
\ No newline at end of file
+</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/settings/i18n/onyx-triambience-settings-fi.ts
^
|
@@ -1,22 +1,23 @@
-<?xml version="1.0" ?><!DOCTYPE TS><TS language="fi" version="2.1">
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="fi">
<context>
- <name/>
+ <name></name>
<message id="onyx-tristate-settings-title">
- <source>Tristate ambience selector</source>
- <extracomment>page header</extracomment>
- <translation>Kolmitilakytkimen tunnelmat</translation>
+ <source>Ambience slider</source>
+ <translation>Tunnelmien liukusäädin</translation>
</message>
<message id="onyx-top-position">
- <source>Top</source>
+ <source>Top position</source>
<translation>Yläasento</translation>
</message>
<message id="onyx-middle-position">
- <source>Middle</source>
+ <source>Middle position</source>
<translation>Keskiasento</translation>
</message>
<message id="onyx-bottom-position">
- <source>Bottom</source>
+ <source>Bottom position</source>
<translation>Ala-asento</translation>
</message>
</context>
-</TS>
\ No newline at end of file
+</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/settings/i18n/onyx-triambience-settings-pl.ts
^
|
@@ -1,22 +1,23 @@
-<?xml version="1.0" ?><!DOCTYPE TS><TS language="pl" version="2.1">
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="pl">
<context>
- <name/>
+ <name></name>
<message id="onyx-tristate-settings-title">
- <source>Tristate ambience selector</source>
- <extracomment>page header</extracomment>
- <translation>Wybieranie atmosfery</translation>
+ <source>Ambience slider</source>
+ <translation>Suwak atmosfery</translation>
</message>
<message id="onyx-top-position">
- <source>Top</source>
- <translation>Góra</translation>
+ <source>Top position</source>
+ <translation>Góra pozycja</translation>
</message>
<message id="onyx-middle-position">
- <source>Middle</source>
- <translation>Środek</translation>
+ <source>Middle position</source>
+ <translation>Środek pozycja</translation>
</message>
<message id="onyx-bottom-position">
- <source>Bottom</source>
- <translation>Dół</translation>
+ <source>Bottom position</source>
+ <translation>Dół pozycja</translation>
</message>
</context>
-</TS>
\ No newline at end of file
+</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/settings/i18n/onyx-triambience-settings_eng_en.ts
^
|
@@ -4,21 +4,20 @@
<context>
<name></name>
<message id="onyx-tristate-settings-title">
- <source>Tristate ambience selector</source>
- <extracomment>page header</extracomment>
- <translation>Tristate ambience selector</translation>
+ <source>Ambience slider</source>
+ <translation>Ambience slider</translation>
</message>
<message id="onyx-top-position">
- <source>Top</source>
- <translation>Top</translation>
+ <source>Top position</source>
+ <translation>Top position</translation>
</message>
<message id="onyx-middle-position">
- <source>Middle</source>
- <translation>Middle</translation>
+ <source>Middle position</source>
+ <translation>Middle position</translation>
</message>
<message id="onyx-bottom-position">
- <source>Bottom</source>
- <translation>Bottom</translation>
+ <source>Bottom position</source>
+ <translation>Bottom position</translation>
</message>
</context>
</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/settings/onyx-triambience-settings.json
^
|
@@ -1,16 +1,14 @@
-{
- "translation_catalog": "onyx-triambience-settings",
- "entries": [
- {
- "path": "system_settings/look_and_feel/onyx-triambience-settings",
- "title": "Tristate ambience selector",
- "translation_id": "onyx-tristate-settings-title",
- "type": "page",
- "icon": "image://theme/icon-m-ambience",
- "order": 400,
- "params": {
- "source": "/usr/share/jolla-settings/pages/onyx-triambience-settings/settings.qml"
- }
- }
- ]
-}
+{
+ "translation_catalog": "onyx-triambience-settings",
+ "entries": [{
+ "path": "system_settings/look_and_feel/onyx-triambience-settings",
+ "title": "Ambience slider",
+ "translation_id": "onyx-tristate-settings-title",
+ "type": "page",
+ "icon": "image://theme/icon-m-ambience",
+ "order": 400,
+ "params": {
+ "source": "/usr/share/jolla-settings/pages/onyx-triambience-settings/settings.qml"
+ }
+ }]
+}
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/settings/settings.pro
^
|
@@ -1,24 +1,24 @@
-TEMPLATE = aux
-
-entries.path = /usr/share/jolla-settings/entries
-entries.files = onyx-triambience-settings.json
-
-pages.path = /usr/share/jolla-settings/pages/onyx-triambience-settings
-pages.files = settings.qml Selector.qml AmbienceImage.qml
-
-translations.path = /usr/share/translations
-translations.files = i18n/*.qm
-
-# system(lupdate . -ts $$PWD/i18n/onyx-triambience-settings_eng_en.ts)
-system(lrelease -idbased $$PWD/i18n/*.ts)
-
-OTHER_FILES += \
- onyx-triambience-settings.json \
- settings.qml \
- Selector.qml \
- AmbienceImage.qml \
- i18n/*.ts
-
-TRANSLATIONS += i18n/*.ts
-
-INSTALLS = entries pages translations
+TEMPLATE = aux
+
+entries.path = /usr/share/jolla-settings/entries
+entries.files = onyx-triambience-settings.json
+
+pages.path = /usr/share/jolla-settings/pages/onyx-triambience-settings
+pages.files = settings.qml Selector.qml AmbienceImage.qml
+
+translations.path = /usr/share/translations
+translations.files = i18n/*.qm
+
+system(lupdate . -ts $$PWD/i18n/onyx-triambience-settings_eng_en.ts)
+system(lrelease -idbased $$PWD/i18n/*.ts)
+
+OTHER_FILES += \
+ onyx-triambience-settings.json \
+ settings.qml \
+ Selector.qml \
+ AmbienceImage.qml \
+ i18n/*.ts
+
+TRANSLATIONS += i18n/*.ts
+
+INSTALLS = entries pages translations
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/settings/settings.qml
^
|
@@ -1,154 +1,154 @@
-import QtQuick 2.0
-import Sailfish.Silica 1.0
-import org.nemomobile.configuration 1.0
-import com.kimmoli.onyxtriambiencesettings 1.0
-
-Page
-{
- id: page
-
- ListModel
- {
- id: ambiences
-
- function getByName(nameToSearch)
- {
- var name = nameToSearch.split(";")[0]
- for (var i=0 ; i < ambiences.count ; i++)
- {
- var n = ambiences.get(i).name
- if (name === n)
- return ambiences.get(i)
- }
- return 0;
- }
- }
-
- TriambienceSettings
- {
- Component.onCompleted:
- {
- var a = getAmbiences()
- for (var i=0 ; i < a.length ; i++)
- {
- ambiences.append({ name: a[i]["name"],
- filepath: a[i]["filepath"],
- displayName: a[i]["displayName"],
- wallpaper: a[i]["wallpaper"],
- highlightColor: a[i]["highlightColor"]})
- }
- }
- }
-
- SilicaFlickable
- {
- id: flick
- anchors.fill: parent
-
- contentHeight: column.height
-
- Column
- {
- id: column
-
- width: page.width
-
- PageHeader
- {
- //: page header
- //% "Tristate ambience selector"
- title: qsTrId("onyx-tristate-settings-title")
- }
-
- SectionHeader
- {
- //% "Top"
- text: qsTrId("onyx-top-position")
- }
-
- AmbienceImage
- {
- source: ambiences.getByName(ambience_top.value).wallpaper
- ambienceName: ambiences.getByName(ambience_top.value).displayName
- ambienceColor: ambiences.getByName(ambience_top.value).highlightColor
- onClicked:
- {
- var sel = pageStack.push(Qt.resolvedUrl("Selector.qml"), { ambiences: ambiences,
- name: ambience_top.value.split(";")[0],
- pageTitle: qsTrId("onyx-top-position")})
- sel.selected.connect(function()
- {
- ambience_top.value = sel.name + ";" + ambiences.getByName(sel.name).filepath
- })
- }
- }
-
- SectionHeader
- {
- //% "Middle"
- text: qsTrId("onyx-middle-position")
- }
-
- AmbienceImage
- {
- source: ambiences.getByName(ambience_middle.value).wallpaper
- ambienceName: ambiences.getByName(ambience_middle.value).displayName
- ambienceColor: ambiences.getByName(ambience_middle.value).highlightColor
- onClicked:
- {
- var sel = pageStack.push(Qt.resolvedUrl("Selector.qml"), { ambiences: ambiences,
- name: ambience_middle.value.split(";")[0],
- pageTitle: qsTrId("onyx-middle-position")})
- sel.selected.connect(function()
- {
- ambience_middle.value = sel.name + ";" + ambiences.getByName(sel.name).filepath
- })
- }
- }
-
- SectionHeader
- {
- //% "Bottom"
- text: qsTrId("onyx-bottom-position")
- }
-
- AmbienceImage
- {
- source: ambiences.getByName(ambience_bottom.value).wallpaper
- ambienceName: ambiences.getByName(ambience_bottom.value).displayName
- ambienceColor: ambiences.getByName(ambience_bottom.value).highlightColor
- onClicked:
- {
- var sel = pageStack.push(Qt.resolvedUrl("Selector.qml"), { ambiences: ambiences,
- name: ambience_bottom.value.split(";")[0],
- pageTitle: qsTrId("onyx-bottom-position")})
- sel.selected.connect(function()
- {
- ambience_bottom.value = sel.name + ";" + ambiences.getByName(sel.name).filepath
- })
- }
- }
- }
- }
-
- ConfigurationValue
- {
- id: ambience_top
- key: "/apps/onyxtristate/top"
- defaultValue: "silent.ambience"
- }
- ConfigurationValue
- {
- id: ambience_middle
- key: "/apps/onyxtristate/middle"
- defaultValue: "sailing.ambience"
- }
- ConfigurationValue
- {
- id: ambience_bottom
- key: "/apps/onyxtristate/bottom"
- defaultValue: "origami.ambience"
- }
-
-}
-
+import QtQuick 2.2
+import Sailfish.Silica 1.0
+import Nemo.Configuration 1.0
+import com.kimmoli.onyxtriambiencesettings 1.0
+
+Page
+{
+ id: page
+
+ ListModel
+ {
+ id: ambiences
+
+ function getByName(nameToSearch)
+ {
+ var name = nameToSearch.split(";")[0]
+ for (var i = 0; i < ambiences.count; i++)
+ {
+ var n = ambiences.get(i).name
+ if (name === n) return ambiences.get(i)
+ }
+ return 0;
+ }
+ }
+
+ TriambienceSettings
+ {
+ Component.onCompleted:
+ {
+ var a = getAmbiences()
+ for (var i = 0; i < a.length; i++)
+ {
+ ambiences.append({
+ name: a[i]["name"],
+ filepath: a[i]["filepath"],
+ displayName: a[i]["displayName"],
+ wallpaper: a[i]["wallpaper"],
+ highlightColor: a[i]["highlightColor"]
+ })
+ }
+ }
+ }
+
+ // Flickable wrapper
+ SilicaFlickable
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/src/plugin/plugin.cpp
^
|
@@ -5,11 +5,11 @@
#include <QTranslator>
#include "settingsui.h"
+
class Translator : public QTranslator
{
public:
- Translator(QObject *parent)
- : QTranslator(parent)
+ Translator(QObject *parent) : QTranslator(parent)
{
qApp->installTranslator(this);
}
@@ -23,18 +23,12 @@
class Q_DECL_EXPORT OnyxTriambienceSettingsPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
+
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID "com.kimmoli.onyxtriambiencesettings")
#endif
-public:
- OnyxTriambienceSettingsPlugin()
- {
- }
-
- virtual ~OnyxTriambienceSettingsPlugin()
- {
- }
+public:
void registerTypes(const char *uri)
{
Q_ASSERT(uri == QLatin1String("com.kimmoli.onyxtriambiencesettings"));
@@ -56,6 +50,10 @@
QQmlExtensionPlugin::initializeEngine(engine, uri);
}
+
+ OnyxTriambienceSettingsPlugin() { }
+
+ virtual ~OnyxTriambienceSettingsPlugin() { }
};
#include "plugin.moc"
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/src/plugin/plugin.pro
^
|
@@ -1,20 +1,20 @@
TARGET = onyxtriambiencesettings
+
PLUGIN_IMPORT_PATH = com/kimmoli/onyxtriambiencesettings
-QT += dbus
-QT -= gui
TEMPLATE = lib
CONFIG += qt plugin hide_symbols
-QT += qml quick
+
+QT += dbus qml quick
+QT -= gui
INCLUDEPATH += ..
LIBS += -L.. -lonyxtriambiencesettings-qt5
SOURCES += plugin.cpp
target.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH
-qmldir.files += \
- $$_PRO_FILE_PWD_/qmldir
-qmldir.path += $$target.path
+qmldir.files += $$_PRO_FILE_PWD_/qmldir
+qmldir.path += $$target.path
INSTALLS += target qmldir
OTHER_FILES += qmldir
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/src/settingsui.cpp
^
|
@@ -1,108 +1,105 @@
-#include "settingsui.h"
-#include <QVariantMap>
-#include <QVariantList>
-#include <QDebug>
-#include <QSqlDatabase>
-#include <QSqlError>
-#include <QSqlQuery>
-#include <QSqlRecord>
-#include <QStandardPaths>
-
-SettingsUi::SettingsUi(QObject *parent) :
- QObject(parent)
-{
-}
-
-QVariantList SettingsUi::getAmbiences()
-{
- QVariantList tmp;
- QVariantMap map;
- QSqlDatabase* db;
- QSqlQuery query;
-
- db = new QSqlDatabase(QSqlDatabase::addDatabase("QSQLITE"));
- db->setDatabaseName(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/system/privileged/Ambienced/ambienced.sqlite");
-
- if (!db->open())
- {
- qDebug() << "Error opening ambienced db:" << db->lastError().text();
- return tmp;
- }
-
- /* Collect installed ambiences
- *
- * From this table we get:
- * - fileId
- * - wallpaper - abs path to the wallpaper image
- * - highlightcolor
- */
-
- query = QSqlQuery("SELECT * FROM ambience", *db);
-
- if (query.exec())
- {
- while (query.next())
- {
- map.clear();
- map.insert("fileId", query.record().value("fileId").toInt());
- map.insert("wallpaper", query.record().value("homeWallpaper").toString());
- map.insert("highlightColor", query.record().value("highlightColor").toString());
- tmp.append(map);
- }
- }
-
- /* Add file info
- *
- * directoryId
- * displayName
- * filename
- */
-
- int i;
-
- for (i=0 ; i < tmp.size() ; i++)
- {
- QVariantMap eMap = tmp.at(i).value<QVariantMap>();
- tmp.removeAt(i);
-
- query = QSqlQuery(QString("SELECT * FROM file WHERE id=%1").arg(eMap.value("fileId").toInt()), *db);
- if (query.exec())
- {
- while (query.next())
- {
- eMap.insert("dirId", query.record().value("directoryId").toInt());
- eMap.insert("displayName", query.record().value("displayName").toString());
- eMap.insert("name", query.record().value("fileName").toString());
- }
- }
- tmp.insert(i, eMap);
- }
-
- /* Get file path from directory table */
-
- for (i=0 ; i<tmp.size(); i++)
- {
- QVariantMap eMap = tmp.at(i).value<QVariantMap>();
- tmp.removeAt(i);
-
- query = QSqlQuery(QString("SELECT * FROM directory WHERE id=%1").arg(eMap.value("dirId").toInt()), *db);
- if (query.exec())
- {
- while (query.next())
- {
- eMap.insert("filepath", query.record().value("path").toString() + "/" + eMap.value("name").toString());
- }
- }
- tmp.insert(i, eMap);
- }
-
- db->close();
-
- qDebug() << "Found" << tmp.size() << "ambiences.";
-
- return tmp;
-}
-
-SettingsUi::~SettingsUi()
-{
-}
+#include <QDebug>
+#include <QVariantMap>
+#include <QVariantList>
+#include <QStandardPaths>
+#include <QSqlDatabase>
+#include <QSqlQuery>
+#include <QSqlRecord>
+#include <QSqlError>
+#include "settingsui.h"
+
+
+SettingsUi::SettingsUi(QObject *parent) : QObject(parent)
+{
+ /* Leaving this here for future needs */
+}
+
+QVariantList SettingsUi::getAmbiences()
+{
+ QVariantList ambiences;
+ QVariantMap map;
+ QSqlDatabase* db;
+ QSqlQuery query;
+
+ db = new QSqlDatabase(QSqlDatabase::addDatabase("QSQLITE"));
+ db->setDatabaseName(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/system/privileged/Ambienced/ambienced.sqlite");
+
+ if (!db->open())
+ {
+ qDebug() << "Error opening ambienced db:" << db->lastError().text();
+ return ambiences;
+ }
+
+ /* Collect installed ambiences
+ *
+ * From this table we get:
+ * - fileId
+ * - wallpaper - abs path to the wallpaper image
+ * - highlightcolor
+ */
+
+ query = QSqlQuery("SELECT * FROM ambience", *db);
+
+ if (query.exec())
+ {
+ while (query.next())
+ {
+ map.clear();
+ map.insert("fileId", query.record().value("fileId").toInt());
+ map.insert("wallpaper", query.record().value("homeWallpaper").toString());
+ map.insert("highlightColor", query.record().value("highlightColor").toString());
+ ambiences.append(map);
+ }
+ }
+
+ /* Add file info
+ *
+ * directoryId
+ * displayName
+ * filename
+ */
+
+ int i;
+
+ for (i = 0; i < ambiences.size(); i++)
+ {
+ QVariantMap eMap = ambiences.at(i).value<QVariantMap>();
+ ambiences.removeAt(i);
+
+ query = QSqlQuery(QString("SELECT * FROM file WHERE id=%1").arg(eMap.value("fileId").toInt()), *db);
+ if (query.exec())
+ {
+ while (query.next())
+ {
+ eMap.insert("dirId", query.record().value("directoryId").toInt());
+ eMap.insert("displayName", query.record().value("displayName").toString());
+ eMap.insert("name", query.record().value("fileName").toString());
+ }
+ }
+ ambiences.insert(i, eMap);
+ }
+
+ /* Get file path from directory table */
+
+ for (i = 0; i < ambiences.size(); i++)
+ {
+ QVariantMap eMap = ambiences.at(i).value<QVariantMap>();
+ ambiences.removeAt(i);
+
+ query = QSqlQuery(QString("SELECT * FROM directory WHERE id=%1").arg(eMap.value("dirId").toInt()), *db);
+ if (query.exec())
+ {
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/src/settingsui.h
^
|
@@ -1,20 +1,20 @@
-#ifndef SETTINGSUI_H
-#define SETTINGSUI_H
-#include <QObject>
-#include <QVariantList>
-#include <QTimer>
-#include <QMap>
-
-class Q_DECL_EXPORT SettingsUi : public QObject
-{
- Q_OBJECT
-
-public:
- explicit SettingsUi(QObject *parent = 0);
- virtual ~SettingsUi();
-
- Q_INVOKABLE QVariantList getAmbiences();
-};
-
-
-#endif // SETTINGSUI_H
+#ifndef SETTINGSUI_H
+#define SETTINGSUI_H
+
+#include <QObject>
+#include <QVariantList>
+#include <QMap>
+
+
+class Q_DECL_EXPORT SettingsUi : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit SettingsUi(QObject *parent = 0);
+ virtual ~SettingsUi();
+
+ Q_INVOKABLE QVariantList getAmbiences();
+};
+
+#endif // SETTINGSUI_H
|
[-]
[+]
|
Changed |
_service:tar_git:onyx-triambience-settings-plugin-1.0.0.tar.bz2/src/src.pro
^
|
@@ -1,15 +1,17 @@
-TEMPLATE = lib
-TARGET = onyxtriambiencesettings-qt5
-CONFIG += qt hide_symbols
-QT += dbus qml quick sql
-QT -= gui
-
-SOURCES += \
- settingsui.cpp
-
-HEADERS += \
- settingsui.h
-
-target.path = $$[QT_INSTALL_LIBS]
-
-INSTALLS += target
+TEMPLATE = lib
+
+TARGET = onyxtriambiencesettings-qt5
+CONFIG += qt hide_symbols
+
+QT += dbus qml quick sql
+QT -= gui
+
+HEADERS += \
+ settingsui.h
+
+SOURCES += \
+ settingsui.cpp
+
+target.path = $$[QT_INSTALL_LIBS]
+
+INSTALLS += target
|