Added NumberDisplay class
This commit is contained in:
parent
95d76f9a44
commit
45fd11151f
8 changed files with 110 additions and 41 deletions
|
@ -24,6 +24,12 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
|
|||
m_text = new TextScroller (this, 154, 15);
|
||||
m_text->move (109, 23);
|
||||
|
||||
m_number = new NumberDisplay (this, 33, 11);
|
||||
m_number->move (37, 26);
|
||||
|
||||
m_number2 = new NumberDisplay (this, 24, 0);
|
||||
m_number2->move (78, 26);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "Button.h"
|
||||
#include "TextBar.h"
|
||||
#include "MainWindow.h"
|
||||
#include "NumberDisplay.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -45,6 +46,9 @@ class MainDisplay : public SkinDisplay
|
|||
ToggleButton *m_repeat;
|
||||
|
||||
TextScroller *m_text;
|
||||
|
||||
NumberDisplay *m_number;
|
||||
NumberDisplay *m_number2;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
41
NumberDisplay.cpp
Normal file
41
NumberDisplay.cpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include "NumberDisplay.h"
|
||||
#include "MainWindow.h"
|
||||
|
||||
NumberDisplay::NumberDisplay (QWidget *parent, uint w, uint startpx) : PixWidget (parent)
|
||||
{
|
||||
m_w = w;
|
||||
m_startpx = startpx;
|
||||
|
||||
m_pixmap = QPixmap (m_w, 13);
|
||||
|
||||
setMinimumSize (m_w, 13);
|
||||
setMaximumSize (m_w, 13);
|
||||
|
||||
setNumber (0,0);
|
||||
}
|
||||
|
||||
void
|
||||
NumberDisplay::setNumber (uint n1, uint n2)
|
||||
{
|
||||
MainWindow *mw = (MainWindow *)((SkinDisplay *)parent ())->getMW();
|
||||
|
||||
m_n1 = n1;
|
||||
m_n2 = n2;
|
||||
|
||||
QBrush b (Qt::TexturePattern);
|
||||
b.setTexture (mw->getSkin ()->getNumber (10));
|
||||
|
||||
QPainter paint;
|
||||
paint.begin (&m_pixmap);
|
||||
paint.fillRect (m_pixmap.rect (), b);
|
||||
paint.drawPixmap (m_startpx, 0, mw->getSkin ()->getNumber (n1));
|
||||
paint.drawPixmap (m_startpx+12, 0, mw->getSkin ()->getNumber (n2));
|
||||
paint.end();
|
||||
|
||||
update ();
|
||||
}
|
||||
|
||||
NumberDisplay::~NumberDisplay ()
|
||||
{
|
||||
}
|
||||
|
30
NumberDisplay.h
Normal file
30
NumberDisplay.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
#ifndef __NUMBERDISPLAY_H__
|
||||
#define __NUMBERDISPLAY_H__
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QWidget>
|
||||
|
||||
#include "PixWidget.h"
|
||||
|
||||
class NumberDisplay : public PixWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
NumberDisplay (QWidget *parent, uint, uint);
|
||||
~NumberDisplay ();
|
||||
|
||||
void setNumber (uint, uint);
|
||||
|
||||
protected:
|
||||
int m_w;
|
||||
int m_startpx;
|
||||
|
||||
uint m_n1;
|
||||
uint m_n2;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -20,7 +20,7 @@ PixWidget::~PixWidget ()
|
|||
void
|
||||
PixWidget::paintEvent (QPaintEvent *event)
|
||||
{
|
||||
if (m_pixmap.isNull () || !m_pixmap) {
|
||||
if (m_pixmap.isNull ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
23
Skin.cpp
23
Skin.cpp
|
@ -3,12 +3,13 @@
|
|||
|
||||
Skin::Skin (string m_skinname) : m_skinname (m_skinname)
|
||||
{
|
||||
m_path = QString ("./Debian/");
|
||||
m_path = QString ("./CleanAMP/");
|
||||
|
||||
m_items = new QHash<uint, QPixmap>;
|
||||
m_volume_bar = new QHash<uint, QPixmap>;
|
||||
m_balance = new QHash<uint, QPixmap>;
|
||||
m_pledit_txt = new QHash<QByteArray, QByteArray>;
|
||||
m_numbers = new QHash<uint, QPixmap>;
|
||||
|
||||
BuildLetterMap();
|
||||
BuildButtons();
|
||||
|
@ -16,6 +17,7 @@ Skin::Skin (string m_skinname) : m_skinname (m_skinname)
|
|||
BuildSliders();
|
||||
BuildOther();
|
||||
BuildTitleBar();
|
||||
BuildNumbers();
|
||||
ParsePLEdit();
|
||||
}
|
||||
|
||||
|
@ -24,6 +26,25 @@ Skin::~Skin ()
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
Skin::BuildNumbers (void)
|
||||
{
|
||||
uint num = 11;
|
||||
|
||||
QPixmap *img = GetPixmap("numbers.bmp");
|
||||
if (!img) {
|
||||
num = 12;
|
||||
img = GetPixmap ("nums_ex.bmp");
|
||||
}
|
||||
|
||||
for (uint i = 0; i < num; i++) {
|
||||
m_numbers->insert (i, img->copy (i*9, 0, 9, 13));
|
||||
}
|
||||
|
||||
delete img;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
Skin::ParsePLEdit (void)
|
||||
{
|
||||
|
|
41
Skin.h
41
Skin.h
|
@ -26,12 +26,14 @@ class Skin : public QWidget
|
|||
void BuildTitleBar (void);
|
||||
void BuildSliders (void);
|
||||
void BuildOther (void);
|
||||
void BuildNumbers (void);
|
||||
void Skin::ParsePLEdit (void);
|
||||
|
||||
const QPixmap getItem (uint part) const { return m_items->value(part); }
|
||||
const QPixmap getVol (uint p) const { return m_volume_bar->value(p); }
|
||||
const QPixmap getBal (uint p) const { return m_balance->value(p); }
|
||||
const QPixmap getLetter (uint c) const { return m_letterMap->value(c); }
|
||||
const QPixmap getNumber (uint c) const { return m_numbers->value(c); }
|
||||
const QByteArray getPLeditValue (QByteArray c) const { return m_pledit_txt->value(c); }
|
||||
|
||||
enum Volume {
|
||||
|
@ -156,47 +158,12 @@ class Skin : public QWidget
|
|||
string m_skinname;
|
||||
QString m_path;
|
||||
|
||||
/* titlebar pixmaps */
|
||||
QPixmap *m_textbg;
|
||||
QPixmap *m_menubutton;
|
||||
QPixmap *m_minimize;
|
||||
QPixmap *m_close;
|
||||
QPixmap *m_shade;
|
||||
QPixmap *m_shade2;
|
||||
QPixmap *m_titlebar;
|
||||
QPixmap *m_statusbar;
|
||||
|
||||
/* toggle buttons */
|
||||
QPixmap *m_repeat_on;
|
||||
QPixmap *m_repeat_off;
|
||||
QPixmap *m_shuffle_on;
|
||||
QPixmap *m_shuffle_off;
|
||||
QPixmap *m_eq_on;
|
||||
QPixmap *m_eq_off;
|
||||
QPixmap *m_pls_on;
|
||||
QPixmap *m_pls_off;
|
||||
|
||||
/* sliders */
|
||||
QPixmap *m_seekbar;
|
||||
QPixmap *m_seekbar_pos;
|
||||
QPixmap *m_volume;
|
||||
|
||||
/* other */
|
||||
QPixmap *m_mono;
|
||||
QPixmap *m_stereo;
|
||||
QPixmap *m_mainwin;
|
||||
QPixmap m_about[2];
|
||||
QPixmap *m_pic_play;
|
||||
QPixmap *m_pic_pause;
|
||||
QPixmap *m_pic_stop;
|
||||
|
||||
/* numbers */
|
||||
QPixmap *m_numbers;
|
||||
|
||||
QHash<uint, QPixmap> *m_items;
|
||||
QHash<uint, QPixmap> *m_letterMap;
|
||||
QHash<uint, QPixmap> *m_volume_bar;
|
||||
QHash<uint, QPixmap> *m_balance;
|
||||
QHash<uint, QPixmap> *m_numbers;
|
||||
|
||||
QHash<QByteArray, QByteArray> *m_pledit_txt;
|
||||
QList<QPixmap *> m_buttons;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCES += XmmsQT4.cpp PixWidget.cpp Skin.cpp MainWindow.cpp Display.cpp MainDisplay.cpp TitleBar.cpp Button.cpp TextBar.cpp
|
||||
HEADERS += XmmsQT4.h PixWidget.h Skin.h MainWindow.h Display.h MainDisplay.h TitleBar.h Button.h TextBar.h
|
||||
SOURCES += XmmsQT4.cpp PixWidget.cpp Skin.cpp MainWindow.cpp Display.cpp MainDisplay.cpp TitleBar.cpp Button.cpp TextBar.cpp NumberDisplay.cpp
|
||||
HEADERS += XmmsQT4.h PixWidget.h Skin.h MainWindow.h Display.h MainDisplay.h TitleBar.h Button.h TextBar.h NumberDisplay.h
|
||||
CONFIG += link_pkgconfig
|
||||
CONFIG += debug
|
||||
QMAKE_CFLAGS_WARN_OFF += -Wno-unused-parameter
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue