Add setting for music folder - allows covers to be retrieved via HTTP.

This commit is contained in:
craig.p.drummond
2014-04-13 19:49:44 +00:00
parent 26a09bfbdd
commit 5d2ea24a79
3 changed files with 33 additions and 4 deletions

View File

@@ -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();

View File

@@ -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();

View File

@@ -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)
}
}