OTHER: Update ShadedDisplay to use new SmallTimeDisplay

split Timedisplay into a common class and a specialised class and make
new SmallTimeDisplay inherit from the common class. Thus as much code as
possible is reused in SmallTimeDisplay
This commit is contained in:
Thomas Frauendorfer 2008-05-19 21:16:32 +02:00
parent 1fa72bd3f0
commit 221e1255d0
9 changed files with 115 additions and 54 deletions

View file

@ -25,16 +25,17 @@ class QPixmap;
typedef QMap<int, QPixmap> PixmapMap;
class TimeDisplay : public QWidget
// This class is not really abstract, but named so anyway
class AbstractTimeDisplay : public QWidget
{
Q_OBJECT
public:
TimeDisplay (QWidget *parent);
~TimeDisplay () {};
AbstractTimeDisplay (QWidget *parent) : QWidget (parent) {};
~AbstractTimeDisplay () {};
void setTime (int);
public slots:
void setPixmaps (const PixmapMap &p) {m_pixmaps = p;}
void setPixmaps (const PixmapMap &p);
signals:
void clicked(void);
@ -44,8 +45,28 @@ class TimeDisplay : public QWidget
void mouseReleaseEvent (QMouseEvent *event);
void paintEvent (QPaintEvent *event);
// positions for the digits, numbered from left to right
int m_d1_x_pos;
int m_d2_x_pos;
int m_d3_x_pos;
int m_d4_x_pos;
int m_time;
PixmapMap m_pixmaps;
};
class TimeDisplay : public AbstractTimeDisplay
{
Q_OBJECT
public:
TimeDisplay (QWidget *parent);
};
class SmallTimeDisplay : public AbstractTimeDisplay
{
Q_OBJECT
public:
SmallTimeDisplay (QWidget *parent);
};
#endif