diff --git a/lib/lib.pro b/lib/lib.pro index 99aee24..2a71ea7 100644 --- a/lib/lib.pro +++ b/lib/lib.pro @@ -34,12 +34,12 @@ QT += network ;macx:QTPLUGIN += qjpeg QMAKE_LFLAGS += -L$$[QT_INSTALL_PLUGINS]/imageformats -CONFIG += link_pkgconfig QMAKE_CXXFLAGS += -g ;CONFIG += debug warn_on QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter -PKGCONFIG += xmms2-client xmms2-client-cpp +CONFIG += link_pkgconfig +PKGCONFIG += xmms2-client-cpp xmms2-client ;CONFIG += avahi diff --git a/src/Skin.cpp b/src/Skin.cpp index 808aab1..a50767b 100644 --- a/src/Skin.cpp +++ b/src/Skin.cpp @@ -56,9 +56,21 @@ Skin::setSizes () << QSize (46, 15) // BUTTON_MW_SHUFFLE << QSize (28, 15) // BUTTON_MW_REPEAT << QSize ( 9, 9) // BUTTON_MW_SHADED_SHADE + << QSize () // BUTTON_EQ_CLOSE + << QSize () // BUTTON_EQ_SHADE << QSize (25, 12) // BUTTON_EQ_ACTIVE << QSize (33, 12) // BUTTON_EQ_AUTO << QSize (44, 12) // BUTTON_EQ_PRESET + << QSize ( 9, 9) // BUTTON_PLS_CLOSE + << QSize ( 9, 9) // BUTTON_PLS_SHADE + << QSize () // SLIDER_POSBAR + << QSize (248, 10) // SLIDER_POSBAR_BGS + << QSize (14, 11) // SLIDER_VOLUMEBAR + << QSize (68, 13) // SLIDER_VOLUMEBAR_BGS + << QSize () // SLIDER_BALANCEBAR + << QSize (38, 13) // SLIDER_BALANCEBAR_BGS + << QSize () // SLIDER_EQUALIZER + << QSize (14, 63) // SLIDER_EQUALIZER_BGS ; } @@ -71,7 +83,7 @@ Skin::setPositions () << QPoint (264, 3) // BUTTON_MW_CLOSE << QPoint (254, 3) // BUTTON_MW_SHADE << QPoint ( 16, 88) // BUTTON_MW_PREV - << QPoint ( 39, 88) // BUTTON_MW_PLAY + << QPoint ( 39, 88) // BUTTON_MW_PLAY << QPoint ( 62, 88) // BUTTON_MW_PAUSE << QPoint ( 85, 88) // BUTTON_MW_STOP << QPoint (108, 88) // BUTTON_MW_NEXT @@ -81,9 +93,21 @@ Skin::setPositions () << QPoint (164, 89) // BUTTON_MW_SHUFFLE << QPoint (210, 89) // BUTTON_MW_REPEAT << QPoint (254, 3) // BUTTON_MW_SHADED_SHADE + << QPoint () // BUTTON_EQ_CLOSE + << QPoint () // BUTTON_EQ_SHADE << QPoint ( 14, 18) // BUTTON_EQ_ACTIVE << QPoint ( 39, 18) // BUTTON_EQ_AUTO << QPoint (217, 18) // BUTTON_EQ_PRESET + << QPoint () // BUTTON_PLS_CLOSE + << QPoint () // BUTTON_PLS_SHADE + << QPoint () // SLIDER_POSBAR + << QPoint ( 16, 72) // SLIDER_POSBAR_BGS + << QPoint () // SLIDER_VOLUMEBAR + << QPoint (107, 57) // SLIDER_VOLUMEBAR_BGS + << QPoint () // SLIDER_BALANCEBAR + << QPoint (177, 57) // SLIDER_BALANCEBAR_BGS + << QPoint () // SLIDER_EQUALIZER + << QPoint () // SLIDER_EQUALITER_BGS ; } @@ -115,12 +139,14 @@ Skin::BuildEqualizer (void) icon.addPixmap (img->copy (224, 176, 44, 12), QIcon::Active, QIcon::Off); m_icons[BUTTON_EQ_PRESET] = icon; + QPixmapList list; for (int i = 0; i < 14; i++) { - m_items[EQ_WIN_BAR_POS_0+i] = img->copy (13+15*i, 164, 14, 63); + list << img->copy (13+15*i, 164, 14, 63); } for (int i = 0; i < 14; i++) { - m_items[EQ_WIN_BAR_POS_14+i] = img->copy (13+15*i, 229, 14, 63); + list << img->copy (13+15*i, 229, 14, 63); } + m_backgrounds[SLIDER_EQUALIZER_BGS] = list; m_items[EQ_WIN_BAR_BTN_0] = img->copy (0, 164, 11, 11); m_items[EQ_WIN_BAR_BTN_1] = img->copy (0, 176, 11, 11); @@ -163,7 +189,7 @@ Skin::BuildPlaylist (void) m_playlist[PLS_RFILL3_0] = img->copy(44, 42, 7, 29); tmp = m_playlist[PLS_CORNER_UR_0]; - + m_playlist[PLS_CLOSE_BTN_0] = tmp.copy(14, 3, 9, 9); m_playlist[PLS_CLOSE_BTN_1] = img->copy(52, 42, 9, 9); @@ -601,6 +627,7 @@ Skin::BuildSliders (void) img = getPixmap("posbar"); if (img) { + m_sizes[SLIDER_POSBAR_BGS] = QSize (248, qMin (10, img->height ())); m_items[POSBAR] = img->copy (0, 0, 248, qMin (10, img->height ())); m_items[POSBAR_BTN_0] = img->copy (248, 0, 29, qMin (10, img->height ())); m_items[POSBAR_BTN_1] = img->copy (278, 0, 29, qMin (10, img->height ())); @@ -612,9 +639,11 @@ Skin::BuildSliders (void) img = getPixmap("volume"); if (img) { + QPixmapList list; for (int i = 0; i <= 27; i++) { - m_items[VOLUMEBAR_POS_0+i] = img->copy(0, i*15, 68, 13); + list << img->copy(0, i*15, 68, 13); } + m_backgrounds[SLIDER_VOLUMEBAR_BGS] = list; if (img->height() > 421) { m_items[VOLBAR_BTN_1] = img->copy (0, 422, 14, qMin (11, img->height () - 422)); @@ -632,13 +661,21 @@ Skin::BuildSliders (void) } if (img) { - for (int i = 0; i < 28; i++) { - m_items[BALANCE_POS_0+i] = img->copy(9, i*15, 38, 13); + QPixmapList list; + QPixmap p; + list << img->copy (9, 15, 38, 13); + for (int i = 1; i < 28; i++) { + // use p to make use of Qt implicit sharing (I think it will not + // work if appended and prepended Images are copied seperately) + p = img->copy(9, i*15, 38, 13); + list.append (p); + list.prepend (p); } + m_backgrounds[SLIDER_BALANCEBAR_BGS] = list; if (img->height() > 421) { - m_items[BALANCE_BTN_0] = img->copy(0, 422, 14, qMin (11, img->height () - 422));//11); - m_items[BALANCE_BTN_1] = img->copy(15, 422, 14, qMin (11, img->height () - 422)); //11); + m_items[BALANCE_BTN_1] = img->copy(0, 422, 14, qMin (11, img->height () - 422)); + m_items[BALANCE_BTN_0] = img->copy(15, 422, 14, qMin (11, img->height () - 422)); } delete img; diff --git a/src/Skin.h b/src/Skin.h index 63db820..4615547 100644 --- a/src/Skin.h +++ b/src/Skin.h @@ -37,10 +37,12 @@ class Skin : public QObject void setSkin (const QString& name); static QPixmap getPixmap (const QString&, QDir); - + const QSize getSize (uint item) const { return m_sizes[item]; }; const QPoint getPos (uint item) const { return m_positions[item]; }; const QIcon getIcon (uint item) const { return m_icons.value(item); }; + const QPixmapList getBackgrounds (uint item) const + { return m_backgrounds.value(item); }; const QPixmap getItem (uint part) const { return m_items[part]; } const QPixmap getPls (uint part) const { return m_playlist[part]; } @@ -49,7 +51,7 @@ class Skin : public QObject uint getNumberSize () { return m_numbers.size(); } const QByteArray getPLeditValue (QByteArray c) const { return m_pledit_txt[c]; } - enum Buttons { + enum Part { /* Mainwindow buttons */ BUTTON_MW_MENU, BUTTON_MW_MINIMIZE, @@ -65,16 +67,29 @@ class Skin : public QObject BUTTON_MW_PLS, BUTTON_MW_SHUFFLE, BUTTON_MW_REPEAT, - /* Mainwindow buttons shaded*/ + /* Mainwindow buttons shaded */ BUTTON_MW_SHADED_SHADE, /* Equalizer buttons */ + BUTTON_EQ_CLOSE, + BUTTON_EQ_SHADE, BUTTON_EQ_ACTIVE, BUTTON_EQ_AUTO, - BUTTON_EQ_PRESET + BUTTON_EQ_PRESET, /* Playlist buttons */ - }; - - enum Part { + BUTTON_PLS_CLOSE, + BUTTON_PLS_SHADE, + /* Sliders */ + SLIDER_POSBAR, + SLIDER_POSBAR_BGS, + SLIDER_VOLUMEBAR, + SLIDER_VOLUMEBAR_BGS, + SLIDER_BALANCEBAR, + SLIDER_BALANCEBAR_BGS, + SLIDER_EQUALIZER, + SLIDER_EQUALIZER_BGS, +// }; +// +// enum Part { // Old and not yet sorted enum NONE, MAIN_WINDOW, ABOUT_0, @@ -94,39 +109,6 @@ class Skin : public QObject PIC_PLAY, PIC_PAUSE, PIC_STOP, - POSBAR, - POSBAR_BTN_0, - POSBAR_BTN_1, - VOLUMEBAR_POS_0, - VOLUMEBAR_POS_1, - VOLUMEBAR_POS_2, - VOLUMEBAR_POS_3, - VOLUMEBAR_POS_4, - VOLUMEBAR_POS_5, - VOLUMEBAR_POS_6, - VOLUMEBAR_POS_7, - VOLUMEBAR_POS_8, - VOLUMEBAR_POS_9, - VOLUMEBAR_POS_10, - VOLUMEBAR_POS_11, - VOLUMEBAR_POS_12, - VOLUMEBAR_POS_13, - VOLUMEBAR_POS_14, - VOLUMEBAR_POS_15, - VOLUMEBAR_POS_16, - VOLUMEBAR_POS_17, - VOLUMEBAR_POS_18, - VOLUMEBAR_POS_19, - VOLUMEBAR_POS_20, - VOLUMEBAR_POS_21, - VOLUMEBAR_POS_22, - VOLUMEBAR_POS_23, - VOLUMEBAR_POS_24, - VOLUMEBAR_POS_25, - VOLUMEBAR_POS_26, - VOLUMEBAR_POS_27, - VOLBAR_BTN_0, - VOLBAR_BTN_1, CLUTTER_ON, CLUTTER_OFF, CLUTTER_O, @@ -136,64 +118,13 @@ class Skin : public QObject CLUTTER_V, EQ_WIN_BG, EQ_WIN_GRAPH_BG, - EQ_WIN_BAR_POS_0, - EQ_WIN_BAR_POS_1, - EQ_WIN_BAR_POS_2, - EQ_WIN_BAR_POS_3, - EQ_WIN_BAR_POS_4, - EQ_WIN_BAR_POS_5, - EQ_WIN_BAR_POS_6, - EQ_WIN_BAR_POS_7, - EQ_WIN_BAR_POS_8, - EQ_WIN_BAR_POS_9, - EQ_WIN_BAR_POS_10, - EQ_WIN_BAR_POS_11, - EQ_WIN_BAR_POS_12, - EQ_WIN_BAR_POS_13, - EQ_WIN_BAR_POS_14, - EQ_WIN_BAR_POS_15, - EQ_WIN_BAR_POS_16, - EQ_WIN_BAR_POS_17, - EQ_WIN_BAR_POS_18, - EQ_WIN_BAR_POS_19, - EQ_WIN_BAR_POS_20, - EQ_WIN_BAR_POS_21, - EQ_WIN_BAR_POS_22, - EQ_WIN_BAR_POS_23, - EQ_WIN_BAR_POS_24, - EQ_WIN_BAR_POS_25, - EQ_WIN_BAR_POS_26, - EQ_WIN_BAR_POS_27, EQ_WIN_BAR_BTN_0, EQ_WIN_BAR_BTN_1, - BALANCE_POS_0, - BALANCE_POS_1, - BALANCE_POS_2, - BALANCE_POS_3, - BALANCE_POS_4, - BALANCE_POS_5, - BALANCE_POS_6, - BALANCE_POS_7, - BALANCE_POS_8, - BALANCE_POS_9, - BALANCE_POS_10, - BALANCE_POS_11, - BALANCE_POS_12, - BALANCE_POS_13, - BALANCE_POS_14, - BALANCE_POS_15, - BALANCE_POS_16, - BALANCE_POS_17, - BALANCE_POS_18, - BALANCE_POS_19, - BALANCE_POS_20, - BALANCE_POS_21, - BALANCE_POS_22, - BALANCE_POS_23, - BALANCE_POS_24, - BALANCE_POS_25, - BALANCE_POS_26, - BALANCE_POS_27, + POSBAR, + POSBAR_BTN_0, + POSBAR_BTN_1, + VOLBAR_BTN_0, + VOLBAR_BTN_1, BALANCE_BTN_0, BALANCE_BTN_1, }; @@ -317,21 +248,14 @@ class Skin : public QObject QList m_sizes; QMap m_icons; - + QMap m_backgrounds; QMap m_items; QMap m_letterMap; - QMap m_volume_bar; - QMap m_balance; QMap m_numbers; QMap m_playlist; - QMap m_equalizer; QMap m_pledit_txt; - QList m_buttons; - - bool m_volbtn; - bool m_balbtn; signals: void skinChanged (Skin *skin); diff --git a/src/VolumeSlider.cpp b/src/VolumeSlider.cpp index 42462f6..f520176 100644 --- a/src/VolumeSlider.cpp +++ b/src/VolumeSlider.cpp @@ -25,7 +25,7 @@ Slider::Slider (QWidget *parent, uint name_min, uint name_max, connect (skin, SIGNAL (skinChanged (Skin *)), this, SLOT (setPixmaps(Skin *))); - setSliderOffset (1); + setSliderOffset (QPoint (0, 1)); m_name_min = name_min; m_name_max = name_max; diff --git a/src/equalizer/equalizerwidget.cpp b/src/equalizer/equalizerwidget.cpp index 929c7cd..f1ae1b6 100644 --- a/src/equalizer/equalizerwidget.cpp +++ b/src/equalizer/equalizerwidget.cpp @@ -20,20 +20,20 @@ #include "mainwindow.h" #include "pixmapbutton.h" +#include "pixmapslider.h" #include "Skin.h" -#include "VolumeSlider.h" #include -EqualizerSlider::EqualizerSlider (QWidget *parent, uint pix_min, uint pix_max, - uint pix_on, uint pix_off, int min, int max, - int id) : - Slider (parent, pix_min, pix_max, pix_on, - pix_off, min, max) +EqualizerSlider::EqualizerSlider (QWidget *parent, int id) : + PixmapSlider (parent) { m_id = id; connect ( this, SIGNAL (sliderMoved (int)), this, SLOT (on_self_slider_moved (int)) ); + setMinimum (-20); + setMaximum (20); + setSliderOffset (QPoint (1, 0)); setInvertedAppearance (true); setOrientation (Qt::Vertical); } @@ -83,20 +83,15 @@ EqualizerWidget::EqualizerWidget (QWidget *parent) : QWidget (parent) connect(m_preset, SIGNAL(clicked()), parent, SLOT(setEnabled())); - m_preamp = new Slider(this, Skin::EQ_WIN_BAR_POS_0, Skin::EQ_WIN_BAR_POS_27, - Skin::EQ_WIN_BAR_BTN_0, Skin::EQ_WIN_BAR_BTN_1, - -20, 20); + m_preamp = new EqualizerSlider(this, -1); + m_preamp->resize (skin->getSize (Skin::SLIDER_EQUALIZER_BGS)); m_preamp->move(21, 38); - m_preamp->setOrientation (Qt::Vertical); - m_preamp->setInvertedAppearance (true); connect (m_preamp, SIGNAL (sliderMoved (int)), this, SLOT (updateServerPreamp (int))); for (int i=0; i < 10; i++) { - m_bands[i] = new EqualizerSlider(this, Skin::EQ_WIN_BAR_POS_0, - Skin::EQ_WIN_BAR_POS_27, - Skin::EQ_WIN_BAR_BTN_0, - Skin::EQ_WIN_BAR_BTN_1, -20, 20, i); + m_bands[i] = new EqualizerSlider(this, i); + m_bands[i]->resize (skin->getSize (Skin::SLIDER_EQUALIZER_BGS)); m_bands[i]->move(78+i*18, 38); connect (m_bands[i], SIGNAL (numberedSliderMoved (int, int)), this, SLOT (updateServerBands (int, int))); @@ -141,10 +136,24 @@ EqualizerWidget::setPixmaps (Skin *skin) setMinimumSize (m_pixmap.size ()); setMaximumSize (m_pixmap.size ()); + /* Updade Buttons */ m_enable->setIcon (skin->getIcon (Skin::BUTTON_EQ_ACTIVE)); m_auto->setIcon (skin->getIcon (Skin::BUTTON_EQ_AUTO)); m_preset->setIcon (skin->getIcon (Skin::BUTTON_EQ_PRESET)); + /* Update Sliders */ + QPixmap normal = skin->getItem (Skin::EQ_WIN_BAR_BTN_0); + QPixmap pressed = skin->getItem (Skin::EQ_WIN_BAR_BTN_1); + QPixmapList bgslist = skin->getBackgrounds (Skin::SLIDER_EQUALIZER_BGS); + + m_preamp->setSliders (normal, pressed); + m_preamp->setBackground (bgslist); + + for (int i = 0; i < 10; i++) { + m_bands[i]->setSliders (normal, pressed); + m_bands[i]->setBackground (bgslist); + } + update(); } diff --git a/src/equalizer/equalizerwidget.h b/src/equalizer/equalizerwidget.h index 7069eba..2ca73ec 100644 --- a/src/equalizer/equalizerwidget.h +++ b/src/equalizer/equalizerwidget.h @@ -22,19 +22,19 @@ class QVariant; class QPixmap; class QPaintEvent; -#include "VolumeSlider.h" +#include "pixmapslider.h" class XConfig; class Skin; class PixmapButton; //#include -class EqualizerSlider : public Slider +class EqualizerSlider : public PixmapSlider { Q_OBJECT public: - EqualizerSlider (QWidget*, uint, uint, uint, uint, int, int, int); + EqualizerSlider (QWidget*, int); signals: void numberedSliderMoved (int value, int id); @@ -71,7 +71,7 @@ class EqualizerWidget : public QWidget PixmapButton *m_enable; PixmapButton *m_auto; PixmapButton *m_preset; - Slider *m_preamp; + PixmapSlider *m_preamp; EqualizerSlider *m_bands[10]; }; diff --git a/src/mainwindow/maindisplay.cpp b/src/mainwindow/maindisplay.cpp index 1c36b19..0abc144 100644 --- a/src/mainwindow/maindisplay.cpp +++ b/src/mainwindow/maindisplay.cpp @@ -23,6 +23,7 @@ #include "mainwindow.h" #include "pixmapbutton.h" +#include "pixmapslider.h" #include "TitleBar.h" #include "TextBar.h" #include "NumberDisplay.h" @@ -31,7 +32,6 @@ #include "stereomono.h" #include "posbar.h" #include "playstatus.h" -#include "VolumeSlider.h" #include "playlistwindow.h" #include "equalizerwindow.h" #include "clutterbar.h" @@ -44,6 +44,7 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent) { XMMSHandler &client = XMMSHandler::getInstance (); m_xconfig = client.xconfig (); + Skin* skin = Skin::getInstance (); m_tbar = new TitleBar(this, false); m_tbar->move(0, 0); @@ -78,25 +79,29 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent) m_posbar = new PosBar (this, Skin::POSBAR, Skin::POSBAR_BTN_0, Skin::POSBAR_BTN_1); - m_posbar->move (16, 72); + m_posbar->move (skin->getPos (Skin::SLIDER_POSBAR_BGS)); m_playstatus = new PlayStatus (this); m_playstatus->move (24, 28); - m_vslider = new Slider(this, Skin::VOLUMEBAR_POS_0, Skin::VOLUMEBAR_POS_27, - Skin::VOLBAR_BTN_0, Skin::VOLBAR_BTN_1, 0, 100); - m_vslider->move (107, 57); + m_vslider = new PixmapSlider(this); + m_vslider->setMinimum (0); + m_vslider->setMaximum (100); + m_vslider->setSliderOffset (QPoint (0, 1)); + m_vslider->resize (skin->getSize (Skin::SLIDER_VOLUMEBAR_BGS)); + m_vslider->move (skin->getPos (Skin::SLIDER_VOLUMEBAR_BGS)); - m_bslider = new Slider(this, Skin::BALANCE_POS_0, Skin::BALANCE_POS_27, - Skin::BALANCE_BTN_0, Skin::BALANCE_BTN_1, -20, 20); - m_bslider->move (177, 57); + m_bslider = new PixmapSlider (this); + m_bslider->setMinimum (-20); + m_bslider->setMaximum (20); + m_bslider->setSliderOffset (QPoint (0, 1)); + m_bslider->resize (skin->getSize (Skin::SLIDER_BALANCEBAR_BGS)); + m_bslider->move (skin->getPos (Skin::SLIDER_BALANCEBAR_BGS)); connect (&client, SIGNAL(currentSong (const Xmms::PropDict &)), this, SLOT(setMediainfo (const Xmms::PropDict &))); connect (&client, SIGNAL(playbackStatusChanged(Xmms::Playback::Status)), this, SLOT(setStatus(Xmms::Playback::Status))); -// connect (&xmmsh, SIGNAL(playtimeChanged(uint)), -// this, SLOT(setPlaytime(uint))); connect (client.cache () , SIGNAL (playtime (uint32_t)), this, SLOT (setPlaytime (uint32_t))); connect (&client, SIGNAL(getVolume(uint)), this, SLOT(updateVolume(uint))); @@ -142,6 +147,14 @@ MainDisplay::setPixmaps (Skin *skin) m_pls->setIcon (skin->getIcon (Skin::BUTTON_MW_PLS)); m_shuffle->setIcon (skin->getIcon (Skin::BUTTON_MW_SHUFFLE)); m_repeat->setIcon (skin->getIcon (Skin::BUTTON_MW_REPEAT)); + + /* update Sliders */ + m_vslider->setBackground (skin->getBackgrounds (Skin::SLIDER_VOLUMEBAR_BGS)); + m_vslider->setSliders (skin->getItem (Skin::VOLBAR_BTN_0), + skin->getItem (Skin::VOLBAR_BTN_1)); + m_bslider->setBackground (skin->getBackgrounds (Skin::SLIDER_BALANCEBAR_BGS)); + m_bslider->setSliders (skin->getItem (Skin::BALANCE_BTN_0), + skin->getItem (Skin::BALANCE_BTN_1)); } void diff --git a/src/mainwindow/maindisplay.h b/src/mainwindow/maindisplay.h index cdd6b91..9c125cf 100644 --- a/src/mainwindow/maindisplay.h +++ b/src/mainwindow/maindisplay.h @@ -33,6 +33,7 @@ class MainDisplay; #include "Display.h" class PixmapButton; +class PixmapSlider; class TextScroller; class TimeDisplay; class SmallNumberDisplay; @@ -59,8 +60,8 @@ class MainDisplay : public SkinDisplay StereoMono *m_stereo; PosBar *m_posbar; - Slider *m_vslider; - Slider *m_bslider; + PixmapSlider *m_vslider; + PixmapSlider *m_bslider; PlayStatus *m_playstatus; MainWindow *getMW(void) { return m_mw; } diff --git a/src/src.pri b/src/src.pri index 71134b4..84f7046 100644 --- a/src/src.pri +++ b/src/src.pri @@ -17,7 +17,6 @@ HEADERS += PixWidget.h \ SkinChooser.h \ settingsdialog.h \ basewindow.h \ - VolumeSlider.h \ FileDialog.h \ BrowseModel.h \ BrowseDialog.h @@ -36,7 +35,6 @@ SOURCES += main.cpp \ SkinChooser.cpp \ settingsdialog.cpp \ basewindow.cpp \ - VolumeSlider.cpp \ FileDialog.cpp \ BrowseModel.cpp \ BrowseDialog.cpp diff --git a/src/src.pro b/src/src.pro index 3715a10..b1f486f 100644 --- a/src/src.pro +++ b/src/src.pro @@ -23,12 +23,12 @@ QT += network ;macx:QTPLUGIN += qjpeg QMAKE_LFLAGS += -L$$[QT_INSTALL_PLUGINS]/imageformats -CONFIG += link_pkgconfig QMAKE_CXXFLAGS += -g ;CONFIG += debug warn_on QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter -PKGCONFIG += xmms2-client xmms2-client-cpp +CONFIG += link_pkgconfig +PKGCONFIG += xmms2-client-cpp xmms2-client ;CONFIG += avahi diff --git a/src/widgets/pixmapslider.cpp b/src/widgets/pixmapslider.cpp index 9eb3df5..3830955 100644 --- a/src/widgets/pixmapslider.cpp +++ b/src/widgets/pixmapslider.cpp @@ -25,7 +25,7 @@ PixmapSlider::PixmapSlider (QWidget *parent) : QAbstractSlider (parent) { setSliderDown (false); - m_slider_offset = 0; + m_slider_offset = QPoint (); } void @@ -144,11 +144,11 @@ PixmapSlider::paintEvent (QPaintEvent *event) QPixmap *slider = isSliderDown () ? &m_pressed : &m_normal; QRect rect (slider->rect ()); if (orientation () == Qt::Vertical) { - rect.moveTop (sliderPositionFromValue ()); - rect.moveLeft (m_slider_offset); + rect.moveTop (sliderPositionFromValue () + m_slider_offset.y ()); + rect.moveLeft (m_slider_offset.x ()); } else { - rect.moveLeft (sliderPositionFromValue ()); - rect.moveTop (m_slider_offset); + rect.moveLeft (sliderPositionFromValue () + m_slider_offset.x ()); + rect.moveTop (m_slider_offset.y ()); } p.drawPixmap (rect , *slider, slider->rect ()); p.end (); diff --git a/src/widgets/pixmapslider.h b/src/widgets/pixmapslider.h index 08105d3..f26d0f2 100644 --- a/src/widgets/pixmapslider.h +++ b/src/widgets/pixmapslider.h @@ -19,6 +19,7 @@ #include #include +#include class QWidget; class QPixmap; @@ -44,6 +45,8 @@ class PixmapSlider : public QAbstractSlider QPixmap normalSlider () const { return m_normal; } QPixmap pressedSlider () const { return m_pressed; } + void setSliderOffset (QPoint offset) { m_slider_offset = offset; } + protected slots: void paintEvent (QPaintEvent *event); @@ -58,17 +61,13 @@ class PixmapSlider : public QAbstractSlider int sliderValueFromPosition (int pos); int backgroundIndex (); - // horizontal offset in vertical sliders or - // vertical offset in horizontal sliders - void setSliderOffset (int offset) { m_slider_offset = offset; }; - private: QPixmapList m_backgrounds; QPixmap m_normal; QPixmap m_pressed; + QPoint m_slider_offset; int m_background_index; - int m_slider_offset; }; #endif