0001-Add-support-for-toggling-infobar-album-art.patch
src/qtui/info_bar.cc | ||
---|---|---|
188 | 188 |
m_stopped(true) |
189 | 189 |
{ |
190 | 190 |
update_vis(); |
191 | 191 |
setFixedHeight(ps.Height); |
192 | 192 | |
193 |
m_art_enabled = aud_get_bool("qtui", "infoarea_show_art"); |
|
194 | ||
193 | 195 |
for (SongData & d : sd) |
194 | 196 |
{ |
195 | 197 |
d.title.setTextFormat(Qt::PlainText); |
196 | 198 |
d.artist.setTextFormat(Qt::PlainText); |
197 | 199 |
d.album.setTextFormat(Qt::PlainText); |
... | ... | |
225 | 227 | |
226 | 228 |
for (SongData & d : sd) |
227 | 229 |
{ |
228 | 230 |
p.setOpacity((qreal)d.alpha / FadeSteps); |
229 | 231 | |
230 |
if (!d.art.isNull()) |
|
232 |
if (m_art_enabled && !d.art.isNull())
|
|
231 | 233 |
{ |
232 | 234 |
auto sz = d.art.size() / d.art.devicePixelRatio(); |
233 | 235 |
int left = ps.Spacing + (ps.IconSize - sz.width()) / 2; |
234 | 236 |
int top = ps.Spacing + (ps.IconSize - sz.height()) / 2; |
235 | 237 |
p.drawPixmap(left, top, d.art); |
... | ... | |
245 | 247 |
d.title = QStaticText(metrics.elidedText( |
246 | 248 |
d.orig_title, Qt::ElideRight, |
247 | 249 |
width() - ps.VisWidth - ps.Height - ps.Spacing)); |
248 | 250 |
} |
249 | 251 | |
252 |
int height = ps.Height; |
|
253 |
if (!m_art_enabled) |
|
254 |
{ |
|
255 |
height -= ps.IconSize; |
|
256 |
} |
|
257 | ||
250 | 258 |
p.setPen(QColor(255, 255, 255)); |
251 |
p.drawStaticText(ps.Height, ps.Spacing, d.title);
|
|
259 |
p.drawStaticText(height, ps.Spacing, d.title);
|
|
252 | 260 | |
253 | 261 |
font.setPointSize(9); |
254 | 262 |
p.setFont(font); |
255 | 263 | |
256 |
p.drawStaticText(ps.Height, ps.Spacing + ps.IconSize / 2, d.artist);
|
|
264 |
p.drawStaticText(height, ps.Spacing + ps.IconSize / 2, d.artist);
|
|
257 | 265 | |
258 | 266 |
p.setPen(QColor(179, 179, 179)); |
259 |
p.drawStaticText(ps.Height, ps.Spacing + ps.IconSize * 3 / 4, d.album);
|
|
267 |
p.drawStaticText(height, ps.Spacing + ps.IconSize * 3 / 4, d.album);
|
|
260 | 268 |
} |
261 | 269 |
} |
262 | 270 | |
263 | 271 |
void InfoBar::update_title() |
264 | 272 |
{ |
... | ... | |
329 | 337 | |
330 | 338 |
void InfoBar::update_vis() |
331 | 339 |
{ |
332 | 340 |
m_vis->enable(aud_get_bool("qtui", "infoarea_show_vis")); |
333 | 341 |
} |
342 | ||
343 |
void InfoBar::update_art() |
|
344 |
{ |
|
345 |
m_art_enabled = aud_get_bool("qtui", "infoarea_show_art"); |
|
346 |
update(); |
|
347 |
} |
src/qtui/info_bar.h | ||
---|---|---|
43 | 43 |
void do_fade(); |
44 | 44 | |
45 | 45 |
void playback_ready_cb(); |
46 | 46 |
void playback_stop_cb(); |
47 | 47 |
void update_vis(); |
48 |
void update_art(); |
|
48 | 49 | |
49 | 50 |
const HookReceiver<InfoBar> hook1{"tuple change", this, |
50 | 51 |
&InfoBar::update_title}, |
51 | 52 |
hook2{"playback ready", this, &InfoBar::playback_ready_cb}, |
52 | 53 |
hook3{"playback stop", this, &InfoBar::playback_stop_cb}, |
53 |
hook4{"qtui toggle infoarea_vis", this, &InfoBar::update_vis}; |
|
54 |
hook4{"qtui toggle infoarea_vis", this, &InfoBar::update_vis}, |
|
55 |
hook5{"qtui toggle infoarea_art", this, &InfoBar::update_art}; |
|
54 | 56 | |
55 | 57 |
const Timer<InfoBar> fade_timer{TimerRate::Hz30, this, &InfoBar::do_fade}; |
56 | 58 | |
57 | 59 |
InfoVis * m_vis; |
58 | 60 |
const PixelSizes & ps; |
... | ... | |
71 | 73 |
Cur = 1 |
72 | 74 |
}; /* index into SongData array */ |
73 | 75 | |
74 | 76 |
SongData sd[2]; |
75 | 77 |
bool m_stopped; |
78 |
bool m_art_enabled; |
|
76 | 79 |
}; |
77 | 80 | |
78 | 81 |
#endif |
src/qtui/menus.cc | ||
---|---|---|
89 | 89 |
static void toggle_infoarea() { hook_call("qtui toggle infoarea", nullptr); } |
90 | 90 |
static void toggle_infoarea_vis() |
91 | 91 |
{ |
92 | 92 |
hook_call("qtui toggle infoarea_vis", nullptr); |
93 | 93 |
} |
94 |
static void toggle_infoarea_art() |
|
95 |
{ |
|
96 |
hook_call("qtui toggle infoarea_art", nullptr); |
|
97 |
} |
|
94 | 98 |
static void toggle_statusbar() { hook_call("qtui toggle statusbar", nullptr); } |
95 | 99 |
static void toggle_remaining_time() |
96 | 100 |
{ |
97 | 101 |
hook_call("qtui toggle remaining time", nullptr); |
98 | 102 |
} |
... | ... | |
247 | 251 |
{"qtui", "menu_visible"}, toggle_menubar), |
248 | 252 |
audqt::MenuToggle({N_("Show I_nfo Bar"), nullptr, "Shift+Ctrl+I"}, |
249 | 253 |
{"qtui", "infoarea_visible"}, toggle_infoarea), |
250 | 254 |
audqt::MenuToggle({N_("Show Info Bar Vis_ualization")}, |
251 | 255 |
{"qtui", "infoarea_show_vis"}, toggle_infoarea_vis), |
256 |
audqt::MenuToggle({N_("Show Info Bar Album Art")}, |
|
257 |
{"qtui", "infoarea_show_art"}, toggle_infoarea_art), |
|
252 | 258 |
audqt::MenuToggle({N_("Show _Status Bar"), nullptr, "Shift+Ctrl+S"}, |
253 | 259 |
{"qtui", "statusbar_visible"}, toggle_statusbar), |
254 | 260 |
audqt::MenuSep(), |
255 | 261 |
audqt::MenuToggle( |
256 | 262 |
{N_("Show _Remaining Time"), nullptr, "Shift+Ctrl+R"}, |
src/qtui/settings.cc | ||
---|---|---|
27 | 27 |
#include <QDesktopWidget> |
28 | 28 | |
29 | 29 |
const char * const qtui_defaults[] = { |
30 | 30 |
// clang-format off |
31 | 31 |
"infoarea_show_vis", "TRUE", |
32 |
"infoarea_show_art", "TRUE", |
|
32 | 33 |
"infoarea_visible", "TRUE", |
33 | 34 |
"menu_visible", "TRUE", |
34 | 35 |
"playlist_tabs_visible", aud::numeric_string<PlaylistTabVisibility::AutoHide>::str, |
35 | 36 |
"statusbar_visible", "TRUE", |
36 | 37 |
"entry_count_visible", "FALSE", |
37 |
- |