Skip to content

Commit

Permalink
Implement Search
Browse files Browse the repository at this point in the history
  • Loading branch information
vicr123 committed Jul 29, 2024
1 parent 680825d commit b6cf977
Show file tree
Hide file tree
Showing 15 changed files with 111 additions and 17 deletions.
9 changes: 7 additions & 2 deletions application/ControlStrip.qml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Layer {
}

Button {
Layout.alignment: Qt.AlignCenter
id: shuffleButton
flat: true
icon.name: "media-playlist-shuffle"
Expand All @@ -68,6 +69,7 @@ Layer {
}
}
Button {
Layout.alignment: Qt.AlignCenter
id: repeatOneButton
flat: true
icon.name: "media-repeat-single"
Expand All @@ -79,6 +81,7 @@ Layer {
}
}
Button {
Layout.alignment: Qt.AlignCenter
flat: true
icon.name: "media-skip-backward"
implicitWidth: height
Expand All @@ -87,17 +90,19 @@ Layer {
}
}
Button {
Layout.alignment: Qt.AlignCenter
id: playPauseButton
flat: true
icon.name: PlaylistManager.state === PlaylistManager.Playing ? "media-playback-pause" : "media-playback-start"
icon.height: 32
icon.width: 32
icon.height: 40
icon.width: 40
implicitWidth: height
onClicked: () => {
PlaylistManager.playPause();
}
}
Button {
Layout.alignment: Qt.AlignCenter
flat: true
icon.name: "media-skip-forward"
implicitWidth: height
Expand Down
35 changes: 26 additions & 9 deletions application/TracksPane.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,44 @@ Item {
color: layer1.color
}

LibraryModel {
id: model
}

Pager {
anchors.top: grandstand.bottom
anchors.topMargin: 6
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottomMargin: SafeZone.bottom

currentAnimation: Pager.Fade

LibraryListing {
ColumnLayout {
anchors.fill: parent
id: trackList

TextField {
id: searchBox
Layout.fillWidth: true
placeholderText: qsTr("Search")

background: Rectangle {
implicitHeight: 40
color: Contemporary.background
}

z: 1
}

LibraryListing {
id: trackList
Layout.fillHeight: true
Layout.fillWidth: true
}
}
}

Component.onCompleted: () => {
trackList.model = LibraryManager.allTracks()
trackList.model = Qt.binding(() => {
if (searchBox.text !== "") {
return LibraryManager.searchTracks(searchBox.text);
}
return LibraryManager.allTracks();
});
}
}
12 changes: 6 additions & 6 deletions application/library/librarymanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ class LibraryManager : public QObject {
int trackPlayCount(QString path);

Q_SCRIPTABLE LibraryModel* allTracks();
LibraryModel* searchTracks(QString query);
int countTracks();
Q_SCRIPTABLE LibraryModel* searchTracks(QString query);
Q_SCRIPTABLE int countTracks();

QStringList artists();
QStringList albums();
Q_SCRIPTABLE QStringList artists();
Q_SCRIPTABLE QStringList albums();

LibraryModel* tracksByArtist(QString artist);
LibraryModel* tracksByAlbum(QString album);
Q_SCRIPTABLE LibraryModel* tracksByArtist(QString artist);
Q_SCRIPTABLE LibraryModel* tracksByAlbum(QString album);

int createPlaylist(QString playlistName);
QList<QPair<int, QString>> playlists();
Expand Down
6 changes: 6 additions & 0 deletions application/translations/ar_SA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,12 @@ theBeat ستتم إعادة التشغيل بمجرد اكتمال إعادة ا
<source>Tracks in Library</source>
<translation type="unfinished">المسارات في المكتبة</translation>
</message>
<message>
<location line="+18"/>
<location filename="../../../build-theBeat-Desktop_ARM-Debug/application/com/vicr123/thebeat/TracksPane.qml" line="+18"/>
<source>Search</source>
<translation type="unfinished">بحث</translation>
</message>
</context>
<context>
<name>TracksWidget</name>
Expand Down
6 changes: 6 additions & 0 deletions application/translations/cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,12 @@ theBeat will restart once the reset is complete. This action is irreversible.</s
<source>Tracks in Library</source>
<translation type="unfinished">Stopy v knihovně</translation>
</message>
<message>
<location line="+18"/>
<location filename="../../../build-theBeat-Desktop_ARM-Debug/application/com/vicr123/thebeat/TracksPane.qml" line="+18"/>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TracksWidget</name>
Expand Down
6 changes: 6 additions & 0 deletions application/translations/da_DK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,12 @@ theBeat vil genstarte når nulstillingen er færdig. Dette kan ikke fortrydes.</
<source>Tracks in Library</source>
<translation type="unfinished">Sange i bibliotek</translation>
</message>
<message>
<location line="+18"/>
<location filename="../../../build-theBeat-Desktop_ARM-Debug/application/com/vicr123/thebeat/TracksPane.qml" line="+18"/>
<source>Search</source>
<translation type="unfinished">Søg</translation>
</message>
</context>
<context>
<name>TracksWidget</name>
Expand Down
6 changes: 6 additions & 0 deletions application/translations/de_DE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,12 @@ theBeat wird nach dem beenden des Vorganges neustarten. Dieser Vorgang ist irrev
<source>Tracks in Library</source>
<translation type="unfinished">Titel in der Bibliothek</translation>
</message>
<message>
<location line="+18"/>
<location filename="../../../build-theBeat-Desktop_ARM-Debug/application/com/vicr123/thebeat/TracksPane.qml" line="+18"/>
<source>Search</source>
<translation type="unfinished">Suchen</translation>
</message>
</context>
<context>
<name>TracksWidget</name>
Expand Down
6 changes: 6 additions & 0 deletions application/translations/en_GB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,12 @@ theBeat will restart once the reset is complete. This action is irreversible.</t
<source>Tracks in Library</source>
<translation type="unfinished">Tracks in Library</translation>
</message>
<message>
<location line="+18"/>
<location filename="../../../build-theBeat-Desktop_ARM-Debug/application/com/vicr123/thebeat/TracksPane.qml" line="+18"/>
<source>Search</source>
<translation type="unfinished">Search</translation>
</message>
</context>
<context>
<name>TracksWidget</name>
Expand Down
6 changes: 6 additions & 0 deletions application/translations/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,12 @@ theBeat will restart once the reset is complete. This action is irreversible.</s
<source>Tracks in Library</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+18"/>
<location filename="../../../build-theBeat-Desktop_ARM-Debug/application/com/vicr123/thebeat/TracksPane.qml" line="+18"/>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TracksWidget</name>
Expand Down
6 changes: 6 additions & 0 deletions application/translations/fr_CA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,12 @@ theBeat will restart once the reset is complete. This action is irreversible.</s
<source>Tracks in Library</source>
<translation type="unfinished">Pistes dans la Biblio</translation>
</message>
<message>
<location line="+18"/>
<location filename="../../../build-theBeat-Desktop_ARM-Debug/application/com/vicr123/thebeat/TracksPane.qml" line="+18"/>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TracksWidget</name>
Expand Down
6 changes: 6 additions & 0 deletions application/translations/id_ID.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,12 @@ theBeat akan restart seusai penyetelan ulang. Aksi ini tidak dapat dikembalikan.
<source>Tracks in Library</source>
<translation type="unfinished">Trek dalam Pustaka</translation>
</message>
<message>
<location line="+18"/>
<location filename="../../../build-theBeat-Desktop_ARM-Debug/application/com/vicr123/thebeat/TracksPane.qml" line="+18"/>
<source>Search</source>
<translation type="unfinished">Cari</translation>
</message>
</context>
<context>
<name>TracksWidget</name>
Expand Down
6 changes: 6 additions & 0 deletions application/translations/nl_NL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,12 @@ theBeat zal opnieuw starten zodra de reset klaar is. Deze actie is niet terug te
<source>Tracks in Library</source>
<translation type="unfinished">Nummers in Bibliotheek</translation>
</message>
<message>
<location line="+18"/>
<location filename="../../../build-theBeat-Desktop_ARM-Debug/application/com/vicr123/thebeat/TracksPane.qml" line="+18"/>
<source>Search</source>
<translation type="unfinished">Zoeken</translation>
</message>
</context>
<context>
<name>TracksWidget</name>
Expand Down
6 changes: 6 additions & 0 deletions application/translations/tr_TR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,12 @@ Sıfırlama tamamlandığında theBeat yeniden başlayacaktır. Bu eylem geri al
<source>Tracks in Library</source>
<translation type="unfinished">Kitaplıktaki Şarkılar</translation>
</message>
<message>
<location line="+18"/>
<location filename="../../../build-theBeat-Desktop_ARM-Debug/application/com/vicr123/thebeat/TracksPane.qml" line="+18"/>
<source>Search</source>
<translation type="unfinished">Ara</translation>
</message>
</context>
<context>
<name>TracksWidget</name>
Expand Down
6 changes: 6 additions & 0 deletions application/translations/ur_PK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,12 @@ theBeat will restart once the reset is complete. This action is irreversible.</s
<source>Tracks in Library</source>
<translation type="unfinished">لائبریری میں پٹریوں</translation>
</message>
<message>
<location line="+18"/>
<location filename="../../../build-theBeat-Desktop_ARM-Debug/application/com/vicr123/thebeat/TracksPane.qml" line="+18"/>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TracksWidget</name>
Expand Down
6 changes: 6 additions & 0 deletions application/translations/vi_VN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,12 @@ theBeat sẽ khởi chạy lại sau khi việc đặt lại hoàn tất. Hoạt
<source>Tracks in Library</source>
<translation type="unfinished">Bài hát trong thư viện</translation>
</message>
<message>
<location line="+18"/>
<location filename="../../../build-theBeat-Desktop_ARM-Debug/application/com/vicr123/thebeat/TracksPane.qml" line="+18"/>
<source>Search</source>
<translation type="unfinished">Tìm kiếm</translation>
</message>
</context>
<context>
<name>TracksWidget</name>
Expand Down

0 comments on commit b6cf977

Please sign in to comment.