Commit eab30459 authored by kempe's avatar kempe

Set default settings

parent 18a71f62
......@@ -29,11 +29,10 @@ DockedPanel {
}
Component.onCompleted: {
var sourceBaseName = settings.value("playerLayout") ? settings.value("playerLayout") : "DockedAudioPlayer"
dockedAudioPlayer.source = Qt.resolvedUrl(sourceBaseName + ".qml")
updateDockedAudioPlayerSource()
}
function playerLayoutUpdated() {
function updateDockedAudioPlayerSource() {
dockedAudioPlayer.source = Qt.resolvedUrl(settings.value("playerLayout") + ".qml")
}
......
......@@ -44,7 +44,7 @@ ApplicationWindow
}
function playerLayoutUpdated() {
player.playerLayoutUpdated()
player.updateDockedAudioPlayerSource();
}
}
......
......@@ -43,6 +43,17 @@
#include "src/settings.h"
#include "src/audioplayer.h"
void setupSettings(Settings &settings) {
if (settings.value("playerLayout").toString().isEmpty()) {
settings.setValue("playerLayout", "DockedAudioPlayerSmall");
}
if (settings.value("apiUrl").toString().isEmpty()) {
settings.setValue("apiUrl", "http://www.rad.io");
}
}
int main(int argc, char *argv[])
{
......@@ -53,6 +64,7 @@ int main(int argc, char *argv[])
qmlRegisterSingletonType<AudioPlayer>("it.kempe.AudioPlayer", 1, 0, "AudioPlayer", audioPlayerProvider);
Settings settings;
setupSettings(settings);
view->rootContext()->setContextProperty("settings", &settings);
view->setSource(SailfishApp::pathTo("qml/harbour-received.qml"));
view->showFullScreen();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment