Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Sailfish.Pickers.FolderPickerPage to configure music directories #33

Merged
merged 2 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions FlowPlayer.pro
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ OTHER_FILES += \
qml/pages/SongsPage.qml \
qml/pages/ManageFolders.qml \
qml/pages/AddFolder.qml \
qml/pages/PickFolder.qml \
qml/pages/AboutPage.qml \
qml/pages/SelectPreset.qml \
qml/pages/LastFM.qml \
Expand Down
2 changes: 1 addition & 1 deletion qml/pages/ManageFolders.qml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Page {
PullDownMenu {
MenuItem {
text: qsTr("Add folder")
onClicked: pageStack.push("AddFolder.qml")
onClicked: pageStack.push(hasPickers ? "PickFolder.qml" : "AddFolder.qml")
}
}

Expand Down
12 changes: 12 additions & 0 deletions qml/pages/PickFolder.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import Sailfish.Pickers 1.0
import FlowPlayer 1.0

FolderPickerPage {
dialogTitle: qsTr("Select folder")
showSystemFiles: false
onSelectedPathChanged: {
utils.addFolderToList(selectedPath)
}
}
5 changes: 5 additions & 0 deletions src/FlowPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ int main(int argc, char *argv[])

window->engine()->addImportPath("/usr/share/flowplayer/qml");
window->rootContext()->setContextProperty("appVersion", VERSION);
bool hasPickers = false;
for (const QString &path : window->engine()->importPathList()) {
hasPickers = hasPickers || QFile::exists(path + "/Sailfish/Pickers");
}
window->rootContext()->setContextProperty("hasPickers", hasPickers);

qmlRegisterType<Utils>("FlowPlayer", 1, 0, "Utils");
qmlRegisterType<CoverSearch>("FlowPlayer", 1, 0, "CoverSearch");
Expand Down
Loading