rework PlaylistWindow: move handling of visibilitychanges into Playlistwindow
and rely on signals and slots to get rid of MainWindow::togglePL(). cleaned up some unnecessary includes
This commit is contained in:
parent
b10ef97cfc
commit
a228d7a01b
14 changed files with 121 additions and 106 deletions
2
TODO
2
TODO
|
@ -24,3 +24,5 @@ Todo:
|
||||||
* Textbox
|
* Textbox
|
||||||
* redraw text in textbox when switching skin.
|
* redraw text in textbox when switching skin.
|
||||||
* figure out something smart on osx.
|
* figure out something smart on osx.
|
||||||
|
* xclient:
|
||||||
|
* connect disconnected callback, so that it emits 'disconnected ()'
|
||||||
|
|
|
@ -81,7 +81,9 @@ void XClient::disconnect ()
|
||||||
{
|
{
|
||||||
delete m_client;
|
delete m_client;
|
||||||
m_client = NULL;
|
m_client = NULL;
|
||||||
m_isconnected = false;
|
m_isconnected = false;
|
||||||
|
|
||||||
|
emit disconnected (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -94,7 +94,7 @@ class XClient : public QObject {
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void gotConnection (XClient *);
|
void gotConnection (XClient *);
|
||||||
|
void disconnected (XClient *);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Xmms::Client *m_client;
|
Xmms::Client *m_client;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of Promoe, an XMMS2 Client
|
* This file is a part of Promoe, an XMMS2 Client
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Thomas Frauendorfer
|
* Copyright (C) 2007,2008 Thomas Frauendorfer
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -22,42 +22,59 @@
|
||||||
|
|
||||||
XSettings::XSettings (QObject *parent, XClient *client) : QObject (parent)
|
XSettings::XSettings (QObject *parent, XClient *client) : QObject (parent)
|
||||||
{
|
{
|
||||||
connect (client, SIGNAL(gotConnection (XClient *)),
|
connect (client, SIGNAL (gotConnection (XClient *)),
|
||||||
this, SLOT (got_connection (XClient *)));
|
this, SLOT (on_connect (XClient *)));
|
||||||
|
|
||||||
|
connect (client, SIGNAL (disconnected (XClient *)),
|
||||||
|
this, SLOT (on_disconnect (XClient *)));
|
||||||
|
|
||||||
if (client->isConnected ()) {
|
if (client->isConnected ()) {
|
||||||
got_connection (client);
|
on_connect (client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
XSettings::value_get (QString key)
|
XSettings::value_get (QString key)
|
||||||
{
|
{
|
||||||
/* local cache should be identical to serverside config */
|
/* if XSettings is ready, the local cache should be in sync with the
|
||||||
|
* serverside settings, otherwise the cache is empty */
|
||||||
|
if (!m_ready) {
|
||||||
|
return QString ();
|
||||||
|
}
|
||||||
return m_config_cache.value (key);
|
return m_config_cache.value (key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
XSettings::value_set (QString key, QString val)
|
XSettings::value_set (QString key, QString val)
|
||||||
{
|
{
|
||||||
/* Only send change request to server here
|
/* Only send change request to server here
|
||||||
* update of local cache will be done through handle_config_value_changed
|
* update of local cache will be done through handle_config_value_changed
|
||||||
*/
|
*/
|
||||||
|
if (!m_client->isConnected ()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
m_client->config ()->valueSet (key.toStdString (), val.toStdString ());
|
m_client->config ()->valueSet (key.toStdString (), val.toStdString ());
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
XSettings::value_register (QString key, QString defval)
|
XSettings::value_register (QString key, QString defval)
|
||||||
{
|
{
|
||||||
|
if (!m_client->isConnected ()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
m_client->config ()->valueRegister (key.toStdString (),
|
m_client->config ()->valueRegister (key.toStdString (),
|
||||||
defval.toStdString ());
|
defval.toStdString ());
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
XSettings::got_connection (XClient *client)
|
XSettings::on_connect (XClient *client)
|
||||||
{
|
{
|
||||||
client->config ()->valueList ()
|
client->config ()->valueList ()
|
||||||
(Xmms::bind (&XSettings::handle_config_value_changed, this));
|
(Xmms::bind (&XSettings::handle_config_value, this));
|
||||||
|
|
||||||
client->config ()->broadcastValueChanged ()
|
client->config ()->broadcastValueChanged ()
|
||||||
(Xmms::bind (&XSettings::handle_config_value_changed, this));
|
(Xmms::bind (&XSettings::handle_config_value_changed, this));
|
||||||
|
@ -65,6 +82,27 @@ XSettings::got_connection (XClient *client)
|
||||||
m_client = client;
|
m_client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
XSettings::on_disconnect (XClient *client)
|
||||||
|
{
|
||||||
|
/* We don't emit any signals here, as every class must be able to
|
||||||
|
* react on the configChanged signal, which will be fired for every
|
||||||
|
* configvalue on reonnect
|
||||||
|
*/
|
||||||
|
m_ready = false;
|
||||||
|
m_config_cache.clear ();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
XSettings::handle_config_value (const Xmms::Dict &value)
|
||||||
|
{
|
||||||
|
bool ok = handle_config_value_changed (value);
|
||||||
|
if (ok) {
|
||||||
|
m_ready = true;
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
XSettings::handle_config_value_changed (const Xmms::Dict &value)
|
XSettings::handle_config_value_changed (const Xmms::Dict &value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of Promoe, an XMMS2 Client
|
* This file is a part of Promoe, an XMMS2 Client
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Thomas Frauendorfer
|
* Copyright (C) 2007,2008 Thomas Frauendorfer
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -32,18 +32,23 @@ class XSettings : public QObject
|
||||||
XSettings (QObject *parent, XClient *client);
|
XSettings (QObject *parent, XClient *client);
|
||||||
|
|
||||||
QString value_get (QString key);
|
QString value_get (QString key);
|
||||||
void value_set (QString key, QString value);
|
bool value_set (QString key, QString value);
|
||||||
void value_register (QString key, QString defval);
|
bool value_register (QString key, QString defval);
|
||||||
|
|
||||||
|
bool isReady (void) {return m_ready;}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void configChanged(QString key, QString value);
|
void configChanged(QString key, QString value);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void got_connection(XClient *);
|
void on_connect (XClient *);
|
||||||
|
void on_disconnect (XClient *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool handle_config_value (const Xmms::Dict &value);
|
||||||
bool handle_config_value_changed (const Xmms::Dict &value);
|
bool handle_config_value_changed (const Xmms::Dict &value);
|
||||||
|
|
||||||
|
bool m_ready;
|
||||||
QHash < QString, QString > m_config_cache;
|
QHash < QString, QString > m_config_cache;
|
||||||
XClient *m_client;
|
XClient *m_client;
|
||||||
};
|
};
|
||||||
|
|
|
@ -121,6 +121,3 @@ ToggleButton::setPixmaps(Skin *skin)
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
ToggleButton::~ToggleButton ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ToggleButton : public PixmapButton
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ToggleButton (QWidget *parent, uint, uint, uint, uint);
|
ToggleButton (QWidget *parent, uint, uint, uint, uint);
|
||||||
~ToggleButton ();
|
~ToggleButton () {}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setPixmaps(Skin *skin);
|
void setPixmaps(Skin *skin);
|
||||||
|
|
16
src/main.cpp
16
src/main.cpp
|
@ -49,7 +49,6 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
MainWindow *mw = new MainWindow (NULL);
|
MainWindow *mw = new MainWindow (NULL);
|
||||||
|
|
||||||
PlaylistWindow *playlistwin = new PlaylistWindow (mw);
|
|
||||||
EqualizerWindow *eqwin = new EqualizerWindow (mw);
|
EqualizerWindow *eqwin = new EqualizerWindow (mw);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -65,23 +64,8 @@ main (int argc, char **argv)
|
||||||
Skin::getInstance()->setSkin (settings.value("skin/path").toString ());
|
Skin::getInstance()->setSkin (settings.value("skin/path").toString ());
|
||||||
|
|
||||||
mw->show ();
|
mw->show ();
|
||||||
mw->setPL (playlistwin);
|
|
||||||
mw->setEQ (eqwin);
|
mw->setEQ (eqwin);
|
||||||
|
|
||||||
if (!settings.contains ("playlist/pos"))
|
|
||||||
settings.setValue ("playlist/pos", QPoint (mw->pos().x(),
|
|
||||||
mw->pos().y()+mw->size().height()));
|
|
||||||
playlistwin->move (settings.value("playlist/pos").toPoint ());
|
|
||||||
|
|
||||||
if (!settings.contains ("playlist/hidden"))
|
|
||||||
settings.setValue ("playlist/hidden", true);
|
|
||||||
|
|
||||||
if (settings.value("playlist/hidden").toBool ())
|
|
||||||
playlistwin->hide ();
|
|
||||||
else
|
|
||||||
playlistwin->show ();
|
|
||||||
|
|
||||||
|
|
||||||
if (!settings.contains ("equalizer/pos"))
|
if (!settings.contains ("equalizer/pos"))
|
||||||
settings.setValue ("equalizer/pos", QPoint (mw->pos().x(),
|
settings.setValue ("equalizer/pos", QPoint (mw->pos().x(),
|
||||||
mw->pos().y()+mw->size().height()));
|
mw->pos().y()+mw->size().height()));
|
||||||
|
|
|
@ -219,10 +219,12 @@ MainDisplay::SetupToggleButtons (void)
|
||||||
m_pls = new ToggleButton (this, Skin::PLS_ON_0, Skin::PLS_ON_1,
|
m_pls = new ToggleButton (this, Skin::PLS_ON_0, Skin::PLS_ON_1,
|
||||||
Skin::PLS_OFF_0, Skin::PLS_OFF_1);
|
Skin::PLS_OFF_0, Skin::PLS_OFF_1);
|
||||||
m_pls->move(242, 58);
|
m_pls->move(242, 58);
|
||||||
if (!s.value ("playlist/hidden").toBool ())
|
m_pls->setChecked (m_mw->getPL ()->isVisible ());
|
||||||
m_pls->toggle ();
|
connect (m_pls, SIGNAL (toggled (bool)),
|
||||||
|
m_mw->getPL (), SLOT (setVisible (bool)));
|
||||||
|
connect (m_mw->getPL (), SIGNAL (visibilityChanged (bool)),
|
||||||
|
m_pls, SLOT (setChecked (bool)));
|
||||||
|
|
||||||
connect (m_pls, SIGNAL(clicked()), this, SLOT(togglePL()));
|
|
||||||
|
|
||||||
m_eq = new ToggleButton (this, Skin::EQ_ON_0, Skin::EQ_ON_1,
|
m_eq = new ToggleButton (this, Skin::EQ_ON_0, Skin::EQ_ON_1,
|
||||||
Skin::EQ_OFF_0, Skin::EQ_OFF_1);
|
Skin::EQ_OFF_0, Skin::EQ_OFF_1);
|
||||||
|
@ -244,12 +246,6 @@ MainDisplay::SetupToggleButtons (void)
|
||||||
m_repeat->setEnabled(false); // FIXME: Disabled button for now, not yet implemented
|
m_repeat->setEnabled(false); // FIXME: Disabled button for now, not yet implemented
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
MainDisplay::togglePL (void)
|
|
||||||
{
|
|
||||||
m_mw->togglePL(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MainDisplay::toggleEQ (void)
|
MainDisplay::toggleEQ (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,7 +87,6 @@ class MainDisplay : public SkinDisplay
|
||||||
void setStatus (Xmms::Playback::Status status);
|
void setStatus (Xmms::Playback::Status status);
|
||||||
void setPlaytime (uint32_t time);
|
void setPlaytime (uint32_t time);
|
||||||
void setMediainfo (const Xmms::PropDict &);
|
void setMediainfo (const Xmms::PropDict &);
|
||||||
void togglePL(void);
|
|
||||||
void toggleEQ(void);
|
void toggleEQ(void);
|
||||||
void toggleTime(void);
|
void toggleTime(void);
|
||||||
void updateVolume (uint volume);
|
void updateVolume (uint volume);
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
MainWindow::MainWindow (QWidget *parent) : QMainWindow (parent)
|
MainWindow::MainWindow (QWidget *parent) : QMainWindow (parent)
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings s;
|
||||||
|
|
||||||
setWindowFlags(Qt::FramelessWindowHint);
|
setWindowFlags(Qt::FramelessWindowHint);
|
||||||
setGeometry(100, 100, 275, 116);
|
setGeometry(100, 100, 275, 116);
|
||||||
|
@ -40,11 +40,25 @@ MainWindow::MainWindow (QWidget *parent) : QMainWindow (parent)
|
||||||
setWindowIcon (QIcon (":icon.png"));
|
setWindowIcon (QIcon (":icon.png"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!settings.contains ("mainwindow/shaded"))
|
if (!s.contains ("mainwindow/shaded"))
|
||||||
setShaded (true);
|
setShaded (true);
|
||||||
else
|
else
|
||||||
setShaded (!isShaded ());
|
setShaded (!isShaded ());
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Setup PlaylistWindow
|
||||||
|
*/
|
||||||
|
m_playlistwin = new PlaylistWindow (this);
|
||||||
|
if (!s.contains ("playlist/pos")) {
|
||||||
|
s.setValue ("playlist/pos", QPoint (pos().x(),
|
||||||
|
pos().y()+size().height()));
|
||||||
|
}
|
||||||
|
m_playlistwin->move (s.value("playlist/pos").toPoint ());
|
||||||
|
// FIXME: this should be done in PlaylistWindow.
|
||||||
|
// But promoe segfaults if done so
|
||||||
|
m_playlistwin->setVisible (s.value("playlist/visible",
|
||||||
|
false).toBool ());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The MainDisplay is the mainwindow non-shaded mode
|
* The MainDisplay is the mainwindow non-shaded mode
|
||||||
*/
|
*/
|
||||||
|
@ -60,12 +74,10 @@ MainWindow::MainWindow (QWidget *parent) : QMainWindow (parent)
|
||||||
|
|
||||||
switchDisplay ();
|
switchDisplay ();
|
||||||
|
|
||||||
m_playlistwin = NULL;
|
if (!s.contains ("mainwindow/pos"))
|
||||||
|
s.setValue ("mainwindow/pos", QPoint (100, 100));
|
||||||
|
|
||||||
if (!settings.contains ("mainwindow/pos"))
|
move (s.value("mainwindow/pos").toPoint ());
|
||||||
settings.setValue ("mainwindow/pos", QPoint (100, 100));
|
|
||||||
|
|
||||||
move (settings.value("mainwindow/pos").toPoint ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow ()
|
MainWindow::~MainWindow ()
|
||||||
|
@ -107,28 +119,6 @@ MainWindow::moveEvent (QMoveEvent *event)
|
||||||
s.setValue ("mainwindow/pos", pos ());
|
s.setValue ("mainwindow/pos", pos ());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
MainWindow::togglePL (bool UpdateButton)
|
|
||||||
{
|
|
||||||
QSettings s;
|
|
||||||
|
|
||||||
if(UpdateButton)
|
|
||||||
{
|
|
||||||
getMD()->GetPls()->toggle();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (s.value ("playlist/hidden").toBool ()) {
|
|
||||||
m_playlistwin->move (s.value("playlist/pos").toPoint ());
|
|
||||||
m_playlistwin->show ();
|
|
||||||
s.setValue ("playlist/hidden", false);
|
|
||||||
} else {
|
|
||||||
m_playlistwin->hide ();
|
|
||||||
s.setValue ("playlist/hidden", true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWindow::toggleEQ (bool UpdateButton)
|
MainWindow::toggleEQ (bool UpdateButton)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,30 +16,13 @@
|
||||||
#ifndef __MAINWINDOW_H__
|
#ifndef __MAINWINDOW_H__
|
||||||
#define __MAINWINDOW_H__
|
#define __MAINWINDOW_H__
|
||||||
|
|
||||||
class MainWindow;
|
|
||||||
|
|
||||||
#include "XMMSHandler.h"
|
#include "XMMSHandler.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QPixmap>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QHash>
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
#include "xmmsqt4.h"
|
class QWidget;
|
||||||
|
|
||||||
/*
|
|
||||||
#include "Skin.h"
|
|
||||||
#include "MainDisplay.h"
|
|
||||||
#include "ShadedDisplay.h"
|
|
||||||
#include "Playlist.h"
|
|
||||||
*/
|
|
||||||
|
|
||||||
class XmmsQT4;
|
|
||||||
class Skin;
|
|
||||||
class MainDisplay;
|
class MainDisplay;
|
||||||
class ShadedDisplay;
|
class ShadedDisplay;
|
||||||
class PlaylistWindow;
|
class PlaylistWindow;
|
||||||
|
@ -56,13 +39,11 @@ class MainWindow : public QMainWindow
|
||||||
ShadedDisplay *getSD () { return m_shaded; }
|
ShadedDisplay *getSD () { return m_shaded; }
|
||||||
PlaylistWindow *getPL () { return m_playlistwin; }
|
PlaylistWindow *getPL () { return m_playlistwin; }
|
||||||
|
|
||||||
void setPL (PlaylistWindow *p) { m_playlistwin = p; }
|
|
||||||
void setEQ (EqualizerWindow *e) { m_equalizer = e; }
|
void setEQ (EqualizerWindow *e) { m_equalizer = e; }
|
||||||
|
|
||||||
void raisePL (void);
|
void raisePL (void);
|
||||||
void moveEvent (QMoveEvent *event);
|
void moveEvent (QMoveEvent *event);
|
||||||
|
|
||||||
void togglePL (bool UpdateButton);
|
|
||||||
void toggleEQ (bool UpdateButton);
|
void toggleEQ (bool UpdateButton);
|
||||||
bool isTimemodeReverse(void) { QSettings s; return s.value("MainWindow/timemodereverse").toBool(); }
|
bool isTimemodeReverse(void) { QSettings s; return s.value("MainWindow/timemodereverse").toBool(); }
|
||||||
void setTimemodeReverse(bool b) { QSettings s; return s.setValue("MainWindow/timemodereverse",b); }
|
void setTimemodeReverse(bool b) { QSettings s; return s.setValue("MainWindow/timemodereverse",b); }
|
||||||
|
@ -75,8 +56,8 @@ class MainWindow : public QMainWindow
|
||||||
void setShaded (bool b) { QSettings s; return s.setValue("MainWindow/shaded", b); }
|
void setShaded (bool b) { QSettings s; return s.setValue("MainWindow/shaded", b); }
|
||||||
MainDisplay *m_display;
|
MainDisplay *m_display;
|
||||||
ShadedDisplay *m_shaded;
|
ShadedDisplay *m_shaded;
|
||||||
PlaylistWindow *m_playlistwin;
|
|
||||||
EqualizerWindow *m_equalizer;
|
EqualizerWindow *m_equalizer;
|
||||||
|
PlaylistWindow *m_playlistwin;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This file is a part of Prome, an XMMS2 Client.
|
* This file is a part of Prome, an XMMS2 Client.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2007 XMMS2 Team
|
* Copyright (C) 2005-2007 XMMS2 Team
|
||||||
* Copyright (C) 2007 Thomas Frauendorfer
|
* Copyright (C) 2008 Thomas Frauendorfer
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -43,7 +43,7 @@ PlaylistWindow::PlaylistWindow (QWidget *parent) : QMainWindow (parent)
|
||||||
if (!s.contains ("size")) {
|
if (!s.contains ("size")) {
|
||||||
s.setValue ("size", QSize (275, 350));
|
s.setValue ("size", QSize (275, 350));
|
||||||
}
|
}
|
||||||
resize (s.value("size").toSize ());
|
resize (s.value ("size").toSize ());
|
||||||
|
|
||||||
m_playlist = new PlaylistWidget (this);
|
m_playlist = new PlaylistWidget (this);
|
||||||
setCentralWidget (m_playlist);
|
setCentralWidget (m_playlist);
|
||||||
|
@ -54,7 +54,7 @@ PlaylistWindow::PlaylistWindow (QWidget *parent) : QMainWindow (parent)
|
||||||
m_shadebtn->move(size().width() - 21, 3);
|
m_shadebtn->move(size().width() - 21, 3);
|
||||||
|
|
||||||
m_closebtn = new Button (this, Skin::PLS_CLOSE_BTN_0, Skin::PLS_CLOSE_BTN_1, true);
|
m_closebtn = new Button (this, Skin::PLS_CLOSE_BTN_0, Skin::PLS_CLOSE_BTN_1, true);
|
||||||
connect (m_closebtn, SIGNAL (clicked()), this, SLOT (togglePL ()));
|
connect (m_closebtn, SIGNAL (clicked()), this, SLOT (hide ()));
|
||||||
m_closebtn->move(size().width() - 11, 3);
|
m_closebtn->move(size().width() - 11, 3);
|
||||||
|
|
||||||
if (!s.contains ("shaded"))
|
if (!s.contains ("shaded"))
|
||||||
|
@ -70,12 +70,25 @@ PlaylistWindow::PlaylistWindow (QWidget *parent) : QMainWindow (parent)
|
||||||
//setSizeIncrement (25, 29);
|
//setSizeIncrement (25, 29);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PlaylistWindow::togglePL (void)
|
PlaylistWindow::hideEvent (QHideEvent *event)
|
||||||
{
|
{
|
||||||
m_mw->togglePL(true);
|
QSettings s;
|
||||||
|
s.setValue ("playlist/visible", false);
|
||||||
|
|
||||||
|
emit visibilityChanged (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PlaylistWindow::showEvent (QShowEvent *event)
|
||||||
|
{
|
||||||
|
QSettings s;
|
||||||
|
s.setValue ("playlist/visible", true);
|
||||||
|
|
||||||
|
emit visibilityChanged (true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PlaylistWindow::switchDisplay (void)
|
PlaylistWindow::switchDisplay (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This file is a part of Prome, an XMMS2 Client.
|
* This file is a part of Prome, an XMMS2 Client.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2007 XMMS2 Team
|
* Copyright (C) 2005-2007 XMMS2 Team
|
||||||
|
* Copyright (C) 2008 Thomas Frauendorfer
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -17,12 +18,14 @@
|
||||||
#define _PLAYLISTWINDOW_
|
#define _PLAYLISTWINDOW_
|
||||||
|
|
||||||
// Qt classes
|
// Qt classes
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
|
||||||
class QEvent;
|
class QEvent;
|
||||||
class QMouseEvent;
|
class QMouseEvent;
|
||||||
class QMoveEvent;
|
class QMoveEvent;
|
||||||
class QResizeEvent;
|
class QResizeEvent;
|
||||||
|
class QHideEvent;
|
||||||
|
class QShowEvent;
|
||||||
|
|
||||||
// our own classes
|
// our own classes
|
||||||
class Button;
|
class Button;
|
||||||
|
@ -39,6 +42,15 @@ class PlaylistWindow : public QMainWindow {
|
||||||
|
|
||||||
void setActive (bool);
|
void setActive (bool);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void visibilityChanged(bool visible);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void switchDisplay (void);
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void hideEvent (QHideEvent *event);
|
||||||
|
void showEvent (QShowEvent *event);
|
||||||
void mousePressEvent (QMouseEvent *event);
|
void mousePressEvent (QMouseEvent *event);
|
||||||
void mouseMoveEvent (QMouseEvent *event);
|
void mouseMoveEvent (QMouseEvent *event);
|
||||||
void enterEvent (QEvent *event);
|
void enterEvent (QEvent *event);
|
||||||
|
@ -46,9 +58,6 @@ class PlaylistWindow : public QMainWindow {
|
||||||
void moveEvent (QMoveEvent *event);
|
void moveEvent (QMoveEvent *event);
|
||||||
void resizeEvent (QResizeEvent *event);
|
void resizeEvent (QResizeEvent *event);
|
||||||
|
|
||||||
public slots:
|
|
||||||
void switchDisplay (void);
|
|
||||||
void togglePL (void);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PlaylistWidget *m_playlist;
|
PlaylistWidget *m_playlist;
|
||||||
|
@ -59,7 +68,6 @@ class PlaylistWindow : public QMainWindow {
|
||||||
|
|
||||||
Button *m_shadebtn;
|
Button *m_shadebtn;
|
||||||
Button *m_closebtn;
|
Button *m_closebtn;
|
||||||
uint getOffset (void);
|
|
||||||
MainWindow *m_mw;
|
MainWindow *m_mw;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue