mirror of
https://github.com/clangen/musikcube.git
synced 2025-02-13 15:41:26 +00:00
CategoryListView widgets can now requery themselves automatically using
visibility events, instead of relying on their parent. This fixes bugs related to "JumpTo".
This commit is contained in:
parent
14c73d9dee
commit
13d8b3b6c4
src/musikcube/app
@ -228,15 +228,6 @@ void BrowseLayout::ScrollTo(const std::string& fieldType, int64_t fieldId) {
|
||||
this->categoryList->SetFrameTitle(getTitleForCategory(fieldType));
|
||||
}
|
||||
|
||||
void BrowseLayout::OnVisibilityChanged(bool visible) {
|
||||
LayoutBase::OnVisibilityChanged(visible);
|
||||
|
||||
if (visible) {
|
||||
this->categoryList->Requery(
|
||||
this->categoryList->GetSelectedId());
|
||||
}
|
||||
}
|
||||
|
||||
void BrowseLayout::OnIndexerProgress(int count) {
|
||||
this->Post(message::IndexerProgress);
|
||||
}
|
||||
@ -370,6 +361,7 @@ bool BrowseLayout::ProcessPlaylistOperation(const std::string& key) {
|
||||
this->categoryList->Requery(this->categoryList->GetFilter(), id);
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (Hotkeys::Is(Hotkeys::BrowsePlaylistsDelete, key)) {
|
||||
if (this->GetFocus() == this->categoryList) {
|
||||
@ -382,6 +374,7 @@ bool BrowseLayout::ProcessPlaylistOperation(const std::string& key) {
|
||||
});
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,6 @@ namespace musik {
|
||||
|
||||
virtual ~BrowseLayout();
|
||||
|
||||
virtual void OnVisibilityChanged(bool visible) override;
|
||||
virtual bool KeyPress(const std::string& key) override;
|
||||
virtual void ProcessMessage(musik::core::runtime::IMessage &message) override;
|
||||
|
||||
|
@ -334,8 +334,8 @@ static void handleJumpTo(
|
||||
IMessageQueue& messageQueue,
|
||||
TrackPtr track)
|
||||
{
|
||||
int64_t type;
|
||||
int64_t id;
|
||||
int64_t type = -1LL;
|
||||
int64_t id = -1LL;
|
||||
|
||||
if (index == 0) {
|
||||
type = cube::message::category::Album;
|
||||
@ -350,8 +350,10 @@ static void handleJumpTo(
|
||||
id = track->GetInt64(library::constants::Track::GENRE_ID);
|
||||
}
|
||||
|
||||
messageQueue.Broadcast(runtime::Message::Create(
|
||||
nullptr, cube::message::JumpToCategory, type, id));
|
||||
if (type != -1LL && id != -1LL) {
|
||||
messageQueue.Broadcast(runtime::Message::Create(
|
||||
nullptr, cube::message::JumpToCategory, type, id));
|
||||
}
|
||||
}
|
||||
|
||||
static void showAddCategorySelectionToPlaylistOverlay(
|
||||
|
@ -92,6 +92,14 @@ CategoryListView::~CategoryListView() {
|
||||
delete adapter;
|
||||
}
|
||||
|
||||
void CategoryListView::OnVisibilityChanged(bool visible) {
|
||||
ListWindow::OnVisibilityChanged(visible);
|
||||
|
||||
if (visible && !this->activeQuery) {
|
||||
this->Requery(this->GetSelectedId());
|
||||
}
|
||||
}
|
||||
|
||||
void CategoryListView::RequeryWithField(
|
||||
const std::string& fieldName,
|
||||
const std::string& filter,
|
||||
|
@ -83,6 +83,8 @@ namespace musik {
|
||||
std::string GetFieldName();
|
||||
void SetFieldName(const std::string& fieldName);
|
||||
|
||||
virtual void OnVisibilityChanged(bool visible) override;
|
||||
|
||||
protected:
|
||||
virtual cursespp::IScrollAdapter& GetScrollAdapter();
|
||||
virtual bool OnEntryContextMenu(size_t index);
|
||||
|
Loading…
x
Reference in New Issue
Block a user