mirror of
https://github.com/clangen/musikcube.git
synced 2025-02-11 09:40:26 +00:00
A few improvements to the new info line.
This commit is contained in:
parent
1d1c3a18bd
commit
6d600dd2e0
@ -115,6 +115,27 @@ void LibraryLayout::ChangeMainLayout(std::shared_ptr<cursespp::LayoutBase> newLa
|
|||||||
if (this->IsVisible()) {
|
if (this->IsVisible()) {
|
||||||
this->BringToTop();
|
this->BringToTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->OnLayoutChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibraryLayout::OnLayoutChanged() {
|
||||||
|
this->UpdateShortcutsWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibraryLayout::UpdateShortcutsWindow() {
|
||||||
|
if (this->visibleLayout == this->browseLayout) {
|
||||||
|
this->shortcuts->SetActive("ALT+b");
|
||||||
|
}
|
||||||
|
else if (this->visibleLayout == nowPlayingLayout) {
|
||||||
|
this->shortcuts->SetActive("ALT+p");
|
||||||
|
}
|
||||||
|
else if (this->visibleLayout == searchLayout) {
|
||||||
|
this->shortcuts->SetActive("ALT+f");
|
||||||
|
}
|
||||||
|
else if (this->visibleLayout == trackSearch) {
|
||||||
|
this->shortcuts->SetActive("ALT+t");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,6 +172,7 @@ void LibraryLayout::InitializeWindows() {
|
|||||||
this->shortcuts->AddShortcut("ALT+t", "tracks");
|
this->shortcuts->AddShortcut("ALT+t", "tracks");
|
||||||
this->shortcuts->AddShortcut("ALT+p", "play queue");
|
this->shortcuts->AddShortcut("ALT+p", "play queue");
|
||||||
this->shortcuts->AddShortcut("ALT+s", "settings");
|
this->shortcuts->AddShortcut("ALT+s", "settings");
|
||||||
|
this->UpdateShortcutsWindow();
|
||||||
|
|
||||||
this->AddWindow(this->transportView);
|
this->AddWindow(this->transportView);
|
||||||
this->AddWindow(this->shortcuts);
|
this->AddWindow(this->shortcuts);
|
||||||
|
@ -81,6 +81,8 @@ namespace musik {
|
|||||||
void ShowTrackSearch();
|
void ShowTrackSearch();
|
||||||
|
|
||||||
void ChangeMainLayout(std::shared_ptr<cursespp::LayoutBase> newLayout);
|
void ChangeMainLayout(std::shared_ptr<cursespp::LayoutBase> newLayout);
|
||||||
|
void OnLayoutChanged();
|
||||||
|
void UpdateShortcutsWindow();
|
||||||
|
|
||||||
PlaybackService& playback;
|
PlaybackService& playback;
|
||||||
musik::core::audio::ITransport& transport;
|
musik::core::audio::ITransport& transport;
|
||||||
|
@ -44,6 +44,7 @@ using namespace musik::box;
|
|||||||
ShortcutsWindow::ShortcutsWindow()
|
ShortcutsWindow::ShortcutsWindow()
|
||||||
: Window(nullptr) {
|
: Window(nullptr) {
|
||||||
this->SetFrameVisible(false);
|
this->SetFrameVisible(false);
|
||||||
|
this->SetContentColor(CURSESPP_SELECTED_LIST_ITEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShortcutsWindow::~ShortcutsWindow() {
|
ShortcutsWindow::~ShortcutsWindow() {
|
||||||
@ -55,37 +56,30 @@ void ShortcutsWindow::AddShortcut(
|
|||||||
{
|
{
|
||||||
this->entries.push_back(
|
this->entries.push_back(
|
||||||
std::shared_ptr<Entry>(new Entry(key, description)));
|
std::shared_ptr<Entry>(new Entry(key, description)));
|
||||||
|
|
||||||
|
this->Repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutsWindow::Show() {
|
void ShortcutsWindow::Repaint() {
|
||||||
Window::Show();
|
Window::Repaint();
|
||||||
this->Redraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShortcutsWindow::Redraw() {
|
this->Clear();
|
||||||
std::string value;
|
|
||||||
|
|
||||||
int64 active = COLOR_PAIR(CURSESPP_HIGHLIGHTED_SELECTED_LIST_ITEM);
|
int64 normalAttrs = COLOR_PAIR(CURSESPP_HIGHLIGHTED_SELECTED_LIST_ITEM);
|
||||||
|
int64 activeAttrs = COLOR_PAIR(CURSESPP_HIGHLIGHTED_LIST_ITEM);
|
||||||
|
|
||||||
WINDOW* c = this->GetContent();
|
WINDOW* c = this->GetContent();
|
||||||
werase(c);
|
|
||||||
wbkgd(c, COLOR_PAIR(CURSESPP_SELECTED_LIST_ITEM));
|
|
||||||
|
|
||||||
for (size_t i = 0; i < this->entries.size(); i++) {
|
for (size_t i = 0; i < this->entries.size(); i++) {
|
||||||
auto e = this->entries[i];
|
auto e = this->entries[i];
|
||||||
|
int64 keyAttrs = (e->key == this->activeKey) ? activeAttrs : normalAttrs;
|
||||||
|
|
||||||
wprintw(c, " ");
|
wprintw(c, " ");
|
||||||
|
|
||||||
wattron(c, active);
|
wattron(c, keyAttrs);
|
||||||
wprintw(c, " %s ", e->key.c_str());
|
wprintw(c, " %s ", e->key.c_str());
|
||||||
wattroff(c, active);
|
wattroff(c, keyAttrs);
|
||||||
|
|
||||||
wprintw(c, " %s ", e->description.c_str());
|
wprintw(c, " %s ", e->description.c_str());
|
||||||
|
|
||||||
//if (i != this->entries.size() - 1) {
|
|
||||||
// //wattron(c, separator);
|
|
||||||
// wprintw(c, " ▪ ");
|
|
||||||
// //wattroff(c, separator);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,13 +49,17 @@ namespace musik {
|
|||||||
virtual ~ShortcutsWindow();
|
virtual ~ShortcutsWindow();
|
||||||
|
|
||||||
void AddShortcut(
|
void AddShortcut(
|
||||||
const std::string& key,
|
const std::string& key,
|
||||||
const std::string& description);
|
const std::string& description);
|
||||||
|
|
||||||
virtual void Show();
|
void SetActive(const std::string& key) {
|
||||||
|
this->activeKey = key;
|
||||||
|
this->Repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void Repaint();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Redraw();
|
|
||||||
|
|
||||||
struct Entry {
|
struct Entry {
|
||||||
Entry(const std::string& key, const std::string& desc) {
|
Entry(const std::string& key, const std::string& desc) {
|
||||||
@ -70,6 +74,7 @@ namespace musik {
|
|||||||
typedef std::vector<std::shared_ptr<Entry> > EntryList;
|
typedef std::vector<std::shared_ptr<Entry> > EntryList;
|
||||||
|
|
||||||
EntryList entries;
|
EntryList entries;
|
||||||
|
std::string activeKey;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -436,6 +436,23 @@ IWindow* Window::GetParent() const {
|
|||||||
|
|
||||||
void Window::Clear() {
|
void Window::Clear() {
|
||||||
werase(this->content);
|
werase(this->content);
|
||||||
|
wmove(this->content, 0, 0);
|
||||||
|
|
||||||
|
if (this->content == this->frame) {
|
||||||
|
if (this->contentColor != -1) {
|
||||||
|
wbkgd(this->frame, COLOR_PAIR(this->contentColor));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wbkgd(this->frame, COLOR_PAIR(this->frameColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wbkgd(this->frame, COLOR_PAIR(this->frameColor));
|
||||||
|
|
||||||
|
if (this->content != this->frame) {
|
||||||
|
wbkgd(this->content, COLOR_PAIR(this->contentColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::Repaint() {
|
void Window::Repaint() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user