diff --git a/ubuntu/backend/mpdbackend.cpp b/ubuntu/backend/mpdbackend.cpp index dbb9eac11..7bdf06177 100644 --- a/ubuntu/backend/mpdbackend.cpp +++ b/ubuntu/backend/mpdbackend.cpp @@ -99,11 +99,12 @@ MPDBackend::MPDBackend(QObject *parent) : QObject(parent) MPDConnection::self()->start(); } -void MPDBackend::connectTo(QString hostname, quint16 port, QString password) { +void MPDBackend::connectTo(QString hostname, quint16 port, QString password, QString folder) { MPDConnectionDetails details; details.hostname = hostname; details.port = port; details.password = password; + details.dir = folder.isEmpty() ? folder : Utils::fixPath(folder); emit setDetails(details); MusicLibraryModel::self()->clear(); //emit loadLibrary(); diff --git a/ubuntu/backend/mpdbackend.h b/ubuntu/backend/mpdbackend.h index 171bffce5..920cb10ae 100644 --- a/ubuntu/backend/mpdbackend.h +++ b/ubuntu/backend/mpdbackend.h @@ -62,7 +62,7 @@ class MPDBackend : public QObject public: explicit MPDBackend(QObject *parent = 0); - Q_INVOKABLE void connectTo(QString hostname, quint16 port, QString password); + Q_INVOKABLE void connectTo(QString hostname, quint16 port, QString password, QString folder); Q_INVOKABLE void playPause(); Q_INVOKABLE void nextSong(); Q_INVOKABLE void previousSong(); diff --git a/ubuntu/qml/cantata/HostSettingsPage.qml b/ubuntu/qml/cantata/HostSettingsPage.qml index f355cc539..ddad9c2d3 100644 --- a/ubuntu/qml/cantata/HostSettingsPage.qml +++ b/ubuntu/qml/cantata/HostSettingsPage.qml @@ -64,7 +64,8 @@ Page { defaults: { "host": "", "port": "", - "password": "" + "password": "", + "musicfolder": "" } } @@ -86,6 +87,7 @@ Page { hostTextField.text = contents["host"] portTextField.text = contents["port"] passwordTextField.text = contents["password"] + musicfolderTextField.text = contents["musicfolder"] } function saveDataToU1db() { @@ -93,6 +95,7 @@ Page { contents["host"] = hostTextField.text contents["port"] = portTextField.text contents["password"] = passwordTextField.text + contents["musicfolder"] = musicfolderTextField.text connectionDocument.contents = contents } @@ -162,6 +165,7 @@ Page { } KeyNavigation.priority: KeyNavigation.BeforeItem + KeyNavigation.tab: musicfolderTextField KeyNavigation.backtab: portTextField echoMode: TextInput.Password @@ -171,6 +175,30 @@ Page { } } + Label { + id: musicfolderLabel + text: i18n.tr("Music Folder:") + anchors { + left: connectionDetailsColumn.left; + right: connectionDetailsColumn.right; + } + + fontSize: "medium" + } + + TextField { + id: musicfolderTextField + color: textFieldColor + anchors { + left: connectionDetailsColumn.left; + right: connectionDetailsColumn.right; + } + + KeyNavigation.priority: KeyNavigation.BeforeItem + KeyNavigation.backtab: passwordTextField + placeholderText: "http://HOST/music" // TODO: Update this when hostTextField changes? + } + Item { height: units.gu(0.5) anchors { @@ -196,6 +224,6 @@ Page { } function tryToConnect() { - backend.connectTo(hostTextField.text, (portTextField.text === "")?6600:portTextField.text, passwordTextField.text) + backend.connectTo(hostTextField.text, (portTextField.text === "")?6600:portTextField.text, passwordTextField.text, musicfolderTextField.text) } }