implemented repeatbutton

This commit is contained in:
Thomas Frauendorfer 2008-02-12 21:10:24 +01:00
parent f10cd0465a
commit 0369b3aa37
16 changed files with 95 additions and 13 deletions

View file

@ -20,10 +20,10 @@
#include "Skin.h"
#include "TitleBar.h"
#include "FileDialog.h"
#include <QMouseEvent>
#include <QPainter>
SkinDisplay::SkinDisplay (QWidget *parent) : QWidget(parent)
{

View file

@ -18,6 +18,8 @@
#include "TimeDisplay.h"
#include "Skin.h"
#include <QPainter>
NumberDisplay::NumberDisplay (QWidget *parent, TimeDisplay *td,uint w, uint startpx) : PixWidget (parent)
{
m_td = td;

View file

@ -28,12 +28,10 @@ class PixWidget : public QWidget
PixWidget(QWidget *parent = 0);
~PixWidget();
void paintEvent (QPaintEvent *event);
QWidget *getMW (void) { return m_mw; }
public slots:
virtual void setPixmaps(Skin *skin);
protected:
QPixmap m_pixmap;
QWidget *m_mw;
};
#endif

View file

@ -15,6 +15,9 @@
#include "Skin.h"
#include <QDir>
#include <QPainter>
Skin *Skin::singleton = NULL;
Skin *Skin::getInstance (void)

View file

@ -19,10 +19,9 @@
#include <iostream>
#include <QPixmap>
#include <QPainter>
#include <QWidget>
#include <QMap>
#include <QDir>
class QDir;
class Skin : public QWidget
{

View file

@ -17,11 +17,13 @@
#include <math.h>
#include "VolumeSlider.h"
#include <QMouseEvent>
#include "Skin.h"
#include "Button.h"
#include <QMouseEvent>
#include <QPainter>
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
Slider::Slider (QWidget *parent, uint name_min, uint name_max,

View file

@ -23,6 +23,7 @@
#include "Skin.h"
#include "VolumeSlider.h"
#include <QPainter>
EqualizerSlider::EqualizerSlider (QWidget *parent, uint pix_min, uint pix_max,
uint pix_on, uint pix_off, int min, int max,
@ -108,7 +109,9 @@ EqualizerWidget::EqualizerWidget (QWidget *parent) : QWidget (parent)
value = m_xconfig->value_get (key);
serverConfigChanged (key, value);
// set preamp
key = QString ("equalizer.preamp");
value = m_xconfig->value_get (key);
serverConfigChanged (key, value);
// Set band-sliders
for (int i=0; i < 10; i++) {
key = QString ("equalizer.legacy%1").arg(i);

View file

@ -17,6 +17,7 @@
#include "XMMSHandler.h"
#include "xclientcache.h"
#include "xplayback.h"
#include "xconfig.h"
#include "maindisplay.h"
#include "mainwindow.h"
@ -40,6 +41,9 @@
MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
{
XMMSHandler &client = XMMSHandler::getInstance ();
m_xconfig = client.xconfig ();
m_tbar = new TitleBar(this, false);
m_tbar->move(0, 0);
m_tbar->resize(275, 14);
@ -86,7 +90,6 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
Skin::BALANCE_BTN_0, Skin::BALANCE_BTN_1, -20, 20);
m_bslider->move (177, 57);
XMMSHandler &client = XMMSHandler::getInstance ();
connect (&client, SIGNAL(currentSong (const Xmms::PropDict &)),
this, SLOT(setMediainfo (const Xmms::PropDict &)));
connect (&client, SIGNAL(playbackStatusChanged(Xmms::Playback::Status)),
@ -98,6 +101,8 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
connect (&client, SIGNAL(getVolume(uint)), this, SLOT(updateVolume(uint)));
connect (m_vslider, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int)));
client.volumeGet();
setupServerConfig ();
}
@ -249,7 +254,9 @@ MainDisplay::SetupToggleButtons (void)
m_repeat = new ToggleButton (this, Skin::REPEAT_ON_0, Skin::REPEAT_ON_1,
Skin::REPEAT_OFF_0, Skin::REPEAT_OFF_1);
m_repeat->move(210, 89);
m_repeat->setEnabled(false); // FIXME: Disabled button for now, not yet implemented
connect (m_repeat, SIGNAL (clicked (bool)),
this, SLOT (setRepeatAllEnabled (bool)));
//m_repeat->setEnabled(false); // FIXME: Disabled button for now, not yet implemented
}
@ -291,3 +298,43 @@ MainDisplay::SetupPushButtons (void)
}
/*
* Methods for interaction with the server configuration
*/
void
MainDisplay::setupServerConfig ()
{
connect (m_xconfig, SIGNAL (configChanged (QString, QString)),
this, SLOT (serverConfigChanged (QString, QString)));
if (m_xconfig->isReady ()) {
QString key;
QString value;
// set repeat button
key = QString ("playlist.repeat_all");
value = m_xconfig->value_get (key);
serverConfigChanged (key, value);
}
}
void
MainDisplay::serverConfigChanged (QString key, QString value)
{
if (key == "playlist.repeat_all") {
if (value != "0") {
m_repeat->setChecked (true);
} else {
m_repeat->setChecked (false);
}
}
}
void
MainDisplay::setRepeatAllEnabled (bool enabled) {
if (enabled) {
m_xconfig->value_set ("playlist.repeat_all", "1");
} else {
m_xconfig->value_set ("playlist.repeat_all", "0");
}
}

View file

@ -43,6 +43,7 @@ class Slider;
class PlayStatus;
class MainWindow;
class ClutterBar;
class XConfig;
class MainDisplay : public SkinDisplay
{
@ -76,6 +77,10 @@ class MainDisplay : public SkinDisplay
void updateVolume (uint volume);
void setVolume (int volume);
protected slots:
void serverConfigChanged (QString key, QString value);
void setRepeatAllEnabled (bool enabled);
protected:
void SetupPushButtons (void);
void SetupToggleButtons (void);
@ -96,6 +101,11 @@ class MainDisplay : public SkinDisplay
ClutterBar *m_clutterbar;
private:
void setupServerConfig ();
XConfig *m_xconfig;
};
#endif

View file

@ -16,6 +16,8 @@
#include "stereomono.h"
#include "Skin.h"
#include <QPainter>
StereoMono::StereoMono (QWidget *parent) : PixWidget (parent)
{
setMinimumSize (56, 12);

View file

@ -19,6 +19,7 @@
#include <QMouseEvent>
#include <QWidget>
#include <QPoint>
#include <QPainter>
PlaylistMenuButton::PlaylistMenuButton (PlaylistMenu *menu,
uint pix1, uint pix2) : QWidget (menu)
@ -54,6 +55,10 @@ PlaylistMenuButton::setPixmaps (Skin *skin)
m_pixmap = m_pixmap1;
}
/*
* PlaylistMenu
*/
PlaylistMenu::PlaylistMenu (QWidget *parent, uint pix,
uint decoration) : PixWidget (parent)
{

View file

@ -18,13 +18,11 @@
class PlaylistMenu;
#include "XMMSHandler.h"
//#include "XMMSHandler.h"
#include "PixWidget.h"
#include "Skin.h"
class PlaylistMenu;
#include <QObject>
class QWidget;
#include <QWidget>
class PlaylistMenuBar : public PixWidget {
Q_OBJECT

View file

@ -20,6 +20,7 @@
#include "playlistwindow.h"
#include <QSettings>
#include <QPainter>
PlaylistShade::PlaylistShade (QWidget *parent) : QWidget (parent)
{

View file

@ -27,6 +27,7 @@
#include <QColor>
#include <QMenu>
#include <QPaintEvent>
#include <QPainter>
#include <QPalette>
#include <QSettings>
#include <QFontMetrics>

View file

@ -36,6 +36,7 @@
#include <QApplication>
#include <QSettings>
#include <QFileDialog>
#include <QPainter>
/*
*

View file

@ -22,6 +22,16 @@
class QPaintEvent;
class QWidget;
/*
* QIcon::Normal for normal apperance
* QIcon::Active for pressed state
*
* QIcon::Off for uncecked state
* QIcon::On for checked state
*
* only QIcon::Normal QIcon::Off combination is necessary
*/
class PixmapButton : public QAbstractButton {
Q_OBJECT