@@ -192,6 +192,8 @@ InfoBar::InfoBar(QWidget * parent)
192
192
update_vis ();
193
193
setFixedHeight (ps.Height );
194
194
195
+ m_art_enabled = aud_get_bool (" qtui" , " infoarea_show_art" );
196
+
195
197
for (SongData & d : sd)
196
198
{
197
199
d.title .setTextFormat (Qt::PlainText);
@@ -213,10 +215,7 @@ InfoBar::InfoBar(QWidget * parent)
213
215
214
216
void InfoBar::resizeEvent (QResizeEvent *)
215
217
{
216
- // re-ellipsize text on next paintEvent
217
- for (SongData & d : sd)
218
- d.title .setText (QString ());
219
-
218
+ reellipsize_title ();
220
219
m_vis->move (width () - ps.VisWidth , 0 );
221
220
}
222
221
@@ -225,13 +224,15 @@ void InfoBar::paintEvent(QPaintEvent *)
225
224
QPainter p (this );
226
225
227
226
int viswidth = m_vis->isVisible () ? ps.VisWidth : 0 ;
227
+ int offset = m_art_enabled ? ps.Height : ps.Spacing ;
228
+
228
229
p.fillRect (0 , 0 , width () - viswidth, ps.Height , m_vis->gradient ());
229
230
230
231
for (SongData & d : sd)
231
232
{
232
233
p.setOpacity ((qreal)d.alpha / FadeSteps);
233
234
234
- if (!d.art .isNull ())
235
+ if (m_art_enabled && !d.art .isNull ())
235
236
{
236
237
auto sz = d.art .size () / d.art .devicePixelRatio ();
237
238
int left = ps.Spacing + (ps.IconSize - sz.width ()) / 2 ;
@@ -248,19 +249,19 @@ void InfoBar::paintEvent(QPaintEvent *)
248
249
QFontMetrics metrics = p.fontMetrics ();
249
250
d.title = QStaticText (metrics.elidedText (
250
251
d.orig_title , Qt::ElideRight,
251
- width () - viswidth - ps. Height - ps.Spacing ));
252
+ width () - viswidth - offset - ps.Spacing ));
252
253
}
253
254
254
255
p.setPen (QColor (255 , 255 , 255 ));
255
- p.drawStaticText (ps. Height , ps.Spacing , d.title );
256
+ p.drawStaticText (offset , ps.Spacing , d.title );
256
257
257
258
font.setPointSize (9 );
258
259
p.setFont (font);
259
260
260
- p.drawStaticText (ps. Height , ps.Spacing + ps.IconSize / 2 , d.artist );
261
+ p.drawStaticText (offset , ps.Spacing + ps.IconSize / 2 , d.artist );
261
262
262
263
p.setPen (QColor (179 , 179 , 179 ));
263
- p.drawStaticText (ps. Height , ps.Spacing + ps.IconSize * 3 / 4 , d.album );
264
+ p.drawStaticText (offset , ps.Spacing + ps.IconSize * 3 / 4 , d.album );
264
265
}
265
266
}
266
267
@@ -331,12 +332,23 @@ void InfoBar::playback_stop_cb()
331
332
fade_timer.start ();
332
333
}
333
334
334
- void InfoBar::update_vis ()
335
+ void InfoBar::reellipsize_title ()
335
336
{
336
337
// re-ellipsize text on next paintEvent
337
338
for (SongData & d : sd)
338
339
d.title .setText (QString ());
340
+ }
339
341
342
+ void InfoBar::update_vis ()
343
+ {
344
+ reellipsize_title ();
340
345
m_vis->enable (aud_get_bool (" qtui" , " infoarea_show_vis" ));
341
346
update ();
342
347
}
348
+
349
+ void InfoBar::update_art ()
350
+ {
351
+ reellipsize_title ();
352
+ m_art_enabled = aud_get_bool (" qtui" , " infoarea_show_art" );
353
+ update ();
354
+ }
0 commit comments