OTHER: Fix timedisplay for playtimes >= 100 minutes

If the playtime is bigger or equal to 100 minutes, timedisplay shows
hours and minutes now, if playtime is bigger or equal to 100 hours,
timedisplay gives up and only showes '--:--'
This commit is contained in:
Thomas Frauendorfer 2008-05-18 14:04:05 +02:00
parent fb264e8d0e
commit 18bcad6f99
4 changed files with 44 additions and 14 deletions

4
TODO
View file

@ -4,7 +4,8 @@ General:
+ Feature Requests and Bugs on tracker
+ Mainwindow
+ enable random play (will have to wait for a randomplay service client)
+ enable random play (will have to wait for a randomplay service client),
has to wait for bug 1598 before even considering
* Playlist
+ Make displayed Information configurable
+ Add scrollbuttons to slider
@ -13,7 +14,6 @@ General:
* jump to entry when it's played.
* accept drops from other applications
* Skin
+ Numbers in playtime display can have variable height
* Compressed file reader
* Manage with faulty skins
* make cool effects when switching skin?

View file

@ -122,8 +122,10 @@ void
Skin::BuildEqualizer (void)
{
QPixmap *img = getPixmap ("eqmain");
// eq_ex is optional, so this Pointer can be null. check before using it
QPixmap *imgex = getPixmap ("eq_ex");
if (img && imgex) {
if (img) {
m_items[EQ_WIN_BG] = img->copy (0, 0, 275, 116);
if (img->height () > 294) {
@ -139,7 +141,9 @@ Skin::BuildEqualizer (void)
icon = QIcon ();
icon.addPixmap (img->copy (254, 3, 9, 9), QIcon::Normal, QIcon::Off);
icon.addPixmap (imgex->copy ( 1, 38, 9, 9), QIcon::Active, QIcon::Off);
if (imgex) {
icon.addPixmap (imgex->copy ( 1, 38, 9, 9), QIcon::Active, QIcon::Off);
}
m_icons[BUTTON_EQ_SHADE] = icon;
icon = QIcon ();

View file

@ -167,10 +167,20 @@ MainDisplay::setStatus (Xmms::Playback::Status status)
m_playstatus->setStatus (status);
if (status == Xmms::Playback::STOPPED) {
m_time->setTime(0);
//m_time->setTime(0);
m_time->hide ();
m_kbps->hide ();
m_khz->hide ();
m_posbar->setValue (0);
m_posbar->hide ();
m_stereo->setStereoMono (false, false);
} else if (status == Xmms::Playback::PLAYING) {
m_time->show ();
m_kbps->show ();
m_khz->show ();
// m_posbar will be shown when fetching metadata
// m_stereo is set there too
}
}

View file

@ -20,14 +20,22 @@
#include <QMap>
//TimeDisplay::TimeDisplay (QWidget *parent) : PixWidget (parent)
TimeDisplay::TimeDisplay (QWidget *parent) : QWidget (parent)
{
setFixedSize (63, 13);
}
/*
* This method takes the playtime in seconds
*/
void TimeDisplay::setTime (int time)
{
// Hack to make display hours and seconds instead of seconds and minutes
// if time (or reversetime) is 100 Minutes or longer
if ((time >= 6000) || (time <= -6000)) {
time /= 60;
}
if (m_time == time) return;
m_time = time;
@ -52,15 +60,23 @@ TimeDisplay::paintEvent (QPaintEvent *event)
paint.drawPixmap (0, 0, m_pixmaps[10]);
}
uint showtime = abs(m_time);
// draw minutes
uint min = showtime / 60;
paint.drawPixmap (12, 0, m_pixmaps[min/10]);
paint.drawPixmap (24, 0, m_pixmaps[min%10]);
// draw seconds
uint sec = showtime % 60;
paint.drawPixmap (42, 0, m_pixmaps[sec/10]);
paint.drawPixmap (54, 0, m_pixmaps[sec%10]);
if (showtime < 6000) {
// draw minutes
uint min = showtime / 60;
paint.drawPixmap (12, 0, m_pixmaps[min/10]);
paint.drawPixmap (24, 0, m_pixmaps[min%10]);
// draw seconds
uint sec = showtime % 60;
paint.drawPixmap (42, 0, m_pixmaps[sec/10]);
paint.drawPixmap (54, 0, m_pixmaps[sec%10]);
} else {
// Just give up and draw '-' if min would become 100 or bigger
paint.drawPixmap (12, 0, m_pixmaps[11]);
paint.drawPixmap (24, 0, m_pixmaps[11]);
paint.drawPixmap (42, 0, m_pixmaps[11]);
paint.drawPixmap (54, 0, m_pixmaps[11]);
}
paint.end ();
}