mirror of
https://github.com/clangen/musikcube.git
synced 2024-10-02 04:52:32 +00:00
Round out remaining browse filter work.
This commit is contained in:
parent
e156800c7a
commit
6a440c69e6
@ -4,8 +4,8 @@
|
|||||||
options
|
options
|
||||||
* added the ability to click transport metadata to display a context menu with
|
* added the ability to click transport metadata to display a context menu with
|
||||||
a list of actions for the current track/artist/album
|
a list of actions for the current track/artist/album
|
||||||
* added the ability to search/filter in browse view; focus the category list
|
* added the ability to search/filter in browse view; press `^F` to toggle the
|
||||||
and press `Shift+F`.
|
feature on and off.
|
||||||
* fixed a bug that could cause tracks to sort incorrectly if some tracks in
|
* fixed a bug that could cause tracks to sort incorrectly if some tracks in
|
||||||
the album have a disc number specified and others don't.
|
the album have a disc number specified and others don't.
|
||||||
* added the ability to use `libelogind` or `basu` instead of `libsystemd` for
|
* added the ability to use `libelogind` or `basu` instead of `libsystemd` for
|
||||||
|
@ -153,7 +153,7 @@ void BrowseLayout::OnLayout() {
|
|||||||
this->categoryList->MoveAndResize(x, y, categoryWidth, cy - categoryListBottomMargin);
|
this->categoryList->MoveAndResize(x, y, categoryWidth, cy - categoryListBottomMargin);
|
||||||
|
|
||||||
if (showFilter) {
|
if (showFilter) {
|
||||||
bool refocusFilter = !this->categoryListFilter->IsVisible();
|
const bool refocusFilter = !this->categoryListFilter->IsVisible();
|
||||||
this->categoryListFilter->Show();
|
this->categoryListFilter->Show();
|
||||||
this->categoryListFilter->MoveAndResize(
|
this->categoryListFilter->MoveAndResize(
|
||||||
x + kFilterPadding,
|
x + kFilterPadding,
|
||||||
@ -227,6 +227,13 @@ void BrowseLayout::LoadLastSession() {
|
|||||||
this->SwitchCategory(field);
|
this->SwitchCategory(field);
|
||||||
this->ScrollTo(field, id);
|
this->ScrollTo(field, id);
|
||||||
}
|
}
|
||||||
|
this->showCategoryListFilter = session->GetBool(keys::LastBrowseFilterVisible, false);
|
||||||
|
if (this->showCategoryListFilter) {
|
||||||
|
const std::string filter = session->GetString(keys::LastBrowseFilter);
|
||||||
|
if (filter != this->currentFilter) {
|
||||||
|
this->categoryListFilter->SetText(filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowseLayout::SaveSession() {
|
void BrowseLayout::SaveSession() {
|
||||||
@ -235,6 +242,8 @@ void BrowseLayout::SaveSession() {
|
|||||||
const double id = static_cast<double>(this->categoryList->GetSelectedId());
|
const double id = static_cast<double>(this->categoryList->GetSelectedId());
|
||||||
session->SetString(keys::LastBrowseCategoryType, type.c_str());
|
session->SetString(keys::LastBrowseCategoryType, type.c_str());
|
||||||
session->SetDouble(keys::LastBrowseCategoryId, id);
|
session->SetDouble(keys::LastBrowseCategoryId, id);
|
||||||
|
session->SetBool(keys::LastBrowseFilterVisible, this->showCategoryListFilter);
|
||||||
|
session->SetString(keys::LastBrowseFilter, this->currentFilter.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowseLayout::ProcessMessage(musik::core::runtime::IMessage &message) {
|
void BrowseLayout::ProcessMessage(musik::core::runtime::IMessage &message) {
|
||||||
@ -271,7 +280,7 @@ void BrowseLayout::ProcessMessage(musik::core::runtime::IMessage &message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case cube::message::RequeryCategoryList: {
|
case cube::message::RequeryCategoryList: {
|
||||||
this->categoryList->Requery(this->currentFilter);
|
this->categoryList->Requery(this->currentFilter, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,16 +400,7 @@ void BrowseLayout::ShowTrackSortOverlay() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool BrowseLayout::KeyPress(const std::string& key) {
|
bool BrowseLayout::KeyPress(const std::string& key) {
|
||||||
if (key == "^[" && this->showCategoryListFilter) {
|
if (key == "KEY_ENTER") {
|
||||||
if (this->GetFocus() == this->categoryList ||
|
|
||||||
this->GetFocus() == this->categoryListFilter)
|
|
||||||
{
|
|
||||||
this->showCategoryListFilter = false;
|
|
||||||
this->Layout();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (key == "KEY_ENTER") {
|
|
||||||
/* if the tracklist is NOT focused (i.e. the focus is on a
|
/* if the tracklist is NOT focused (i.e. the focus is on a
|
||||||
category window), start playback from the top. */
|
category window), start playback from the top. */
|
||||||
if (this->GetFocus() != this->trackList) {
|
if (this->GetFocus() != this->trackList) {
|
||||||
@ -412,21 +412,10 @@ bool BrowseLayout::KeyPress(const std::string& key) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Hotkeys::Is(Hotkeys::BrowseCategoryFilter, key)) {
|
else if (Hotkeys::Is(Hotkeys::BrowseCategoryFilter, key)) {
|
||||||
if (this->GetFocus() == this->categoryList ||
|
this->showCategoryListFilter = !this->showCategoryListFilter;
|
||||||
this->GetFocus() == this->categoryListFilter)
|
this->Layout();
|
||||||
{
|
return true;
|
||||||
/* if the filter is visible but the list is focused, focus the filter */
|
}
|
||||||
if (this->GetFocus() == this->categoryList && this->showCategoryListFilter) {
|
|
||||||
this->SetFocus(this->categoryListFilter);
|
|
||||||
}
|
|
||||||
/* otherwise, toggle the filter visibility */
|
|
||||||
else {
|
|
||||||
this->showCategoryListFilter = !this->showCategoryListFilter;
|
|
||||||
this->Layout();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (Hotkeys::Is(Hotkeys::TrackListChangeSortOrder, key)) {
|
else if (Hotkeys::Is(Hotkeys::TrackListChangeSortOrder, key)) {
|
||||||
this->ShowTrackSortOverlay();
|
this->ShowTrackSortOverlay();
|
||||||
return true;
|
return true;
|
||||||
|
@ -189,7 +189,7 @@ static std::unordered_map<Id, std::string, EnumHasher> ID_TO_DEFAULT = {
|
|||||||
{ Id::PlayQueueHotSwap, "M-a" },
|
{ Id::PlayQueueHotSwap, "M-a" },
|
||||||
{ Id::PlayQueueClear, "X" },
|
{ Id::PlayQueueClear, "X" },
|
||||||
|
|
||||||
{ Id::BrowseCategoryFilter, "F" },
|
{ Id::BrowseCategoryFilter, "^F" },
|
||||||
|
|
||||||
{ Id::BrowsePlaylistsSave, "M-s" },
|
{ Id::BrowsePlaylistsSave, "M-s" },
|
||||||
{ Id::BrowsePlaylistsNew, "M-n" },
|
{ Id::BrowsePlaylistsNew, "M-n" },
|
||||||
|
@ -50,6 +50,8 @@ namespace musik { namespace cube { namespace prefs {
|
|||||||
const std::string keys::LastBrowseCategoryType = "LastBrowseCategoryType";
|
const std::string keys::LastBrowseCategoryType = "LastBrowseCategoryType";
|
||||||
const std::string keys::LastBrowseCategoryId = "LastBrowseCategoryId";
|
const std::string keys::LastBrowseCategoryId = "LastBrowseCategoryId";
|
||||||
const std::string keys::LastBrowseDirectoryRoot = "LastBrowseDirectoryRoot";
|
const std::string keys::LastBrowseDirectoryRoot = "LastBrowseDirectoryRoot";
|
||||||
|
const std::string keys::LastBrowseFilterVisible = "LastBrowseFilterVisible";
|
||||||
|
const std::string keys::LastBrowseFilter = "LastBrowseFilter";
|
||||||
const std::string keys::LastCategoryFilter = "LastCategoryFilter";
|
const std::string keys::LastCategoryFilter = "LastCategoryFilter";
|
||||||
const std::string keys::LastCategoryFilterMatchType = "LastCategoryFilterMatchType";
|
const std::string keys::LastCategoryFilterMatchType = "LastCategoryFilterMatchType";
|
||||||
const std::string keys::LastTrackFilter = "LastTrackFilter";
|
const std::string keys::LastTrackFilter = "LastTrackFilter";
|
||||||
|
@ -52,6 +52,8 @@ namespace musik { namespace cube { namespace prefs {
|
|||||||
extern const std::string LastBrowseCategoryType;
|
extern const std::string LastBrowseCategoryType;
|
||||||
extern const std::string LastBrowseCategoryId;
|
extern const std::string LastBrowseCategoryId;
|
||||||
extern const std::string LastBrowseDirectoryRoot;
|
extern const std::string LastBrowseDirectoryRoot;
|
||||||
|
extern const std::string LastBrowseFilterVisible;
|
||||||
|
extern const std::string LastBrowseFilter;
|
||||||
extern const std::string LastCategoryFilter;
|
extern const std::string LastCategoryFilter;
|
||||||
extern const std::string LastCategoryFilterMatchType;
|
extern const std::string LastCategoryFilterMatchType;
|
||||||
extern const std::string LastTrackFilter;
|
extern const std::string LastTrackFilter;
|
||||||
|
@ -266,6 +266,9 @@ void CategoryListView::OnQueryCompleted(IQuery* query) {
|
|||||||
int selectedIndex = -1;
|
int selectedIndex = -1;
|
||||||
if (this->selectAfterQuery != -1LL) {
|
if (this->selectAfterQuery != -1LL) {
|
||||||
selectedIndex = active->GetIndexOf(this->selectAfterQuery);
|
selectedIndex = active->GetIndexOf(this->selectAfterQuery);
|
||||||
|
if (selectedIndex == -1) {
|
||||||
|
selectedIndex = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->activeQuery &&
|
if (this->activeQuery &&
|
||||||
|
Loading…
Reference in New Issue
Block a user