List of widgets, not just toolbuttons
This commit is contained in:
committed by
Craig Drummond
parent
2d80fa74db
commit
7c092c8a8f
@@ -49,7 +49,7 @@ PodcastWidget::PodcastWidget(PodcastService *s, QWidget *p)
|
||||
|
||||
ToolButton *addSub=new ToolButton(this);
|
||||
addSub->setDefaultAction(subscribeAction);
|
||||
init(All, QList<ToolButton *>(), QList<ToolButton *>() <<addSub);
|
||||
init(All, QList<QWidget *>(), QList<QWidget *>() << addSub);
|
||||
view->alwaysShowHeader();
|
||||
connect(view, SIGNAL(headerClicked(int)), SLOT(headerClicked(int)));
|
||||
|
||||
|
||||
@@ -53,17 +53,17 @@ SinglePageWidget::SinglePageWidget(QWidget *p)
|
||||
connect(this, SIGNAL(addSongsToPlaylist(const QString &, const QStringList &)), MPDConnection::self(), SLOT(addToPlaylist(const QString &, const QStringList &)));
|
||||
}
|
||||
|
||||
void SinglePageWidget::init(int flags, const QList<ToolButton *> &leftXtra, const QList<ToolButton *> &rightXtra)
|
||||
void SinglePageWidget::init(int flags, const QList<QWidget *> &leftXtra, const QList<QWidget *> &rightXtra)
|
||||
{
|
||||
if (0!=btnFlags) {
|
||||
return;
|
||||
}
|
||||
btnFlags=flags;
|
||||
QList<ToolButton *> left;
|
||||
QList<ToolButton *> right=rightXtra;
|
||||
QList<QWidget *> left;
|
||||
QList<QWidget *> right=rightXtra;
|
||||
|
||||
if (!right.isEmpty()) {
|
||||
right << 0;
|
||||
right << new SpacerWidget(this);
|
||||
}
|
||||
if (flags&AddToPlayQueue) {
|
||||
ToolButton *addToPlayQueue=new ToolButton(this);
|
||||
@@ -105,23 +105,15 @@ void SinglePageWidget::init(int flags, const QList<ToolButton *> &leftXtra, cons
|
||||
|
||||
if (!left.isEmpty()) {
|
||||
QHBoxLayout *ll=new QHBoxLayout();
|
||||
foreach (ToolButton *b, left) {
|
||||
if (!b) {
|
||||
ll->addWidget(new SpacerWidget(this));
|
||||
} else {
|
||||
ll->addWidget(b);
|
||||
}
|
||||
foreach (QWidget *b, left) {
|
||||
ll->addWidget(b);
|
||||
}
|
||||
static_cast<QGridLayout *>(layout())->addItem(ll, 1, 0, 1, 1);
|
||||
}
|
||||
if (!right.isEmpty()) {
|
||||
QHBoxLayout *rl=new QHBoxLayout();
|
||||
foreach (ToolButton *b, right) {
|
||||
if (!b) {
|
||||
rl->addWidget(new SpacerWidget(this));
|
||||
} else {
|
||||
rl->addWidget(b);
|
||||
}
|
||||
foreach (QWidget *b, right) {
|
||||
rl->addWidget(b);
|
||||
}
|
||||
static_cast<QGridLayout *>(layout())->addItem(rl, 1, 4, 1, 1);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "gui/page.h"
|
||||
|
||||
class ItemView;
|
||||
class ToolButton;
|
||||
class Action;
|
||||
|
||||
class SinglePageWidget : public QWidget, public Page
|
||||
@@ -47,7 +46,7 @@ public:
|
||||
SinglePageWidget(QWidget *p);
|
||||
virtual void setView(int v);
|
||||
void focusSearch();
|
||||
void init(int flags=All, const QList<ToolButton *> &leftXtra=QList<ToolButton *>(), const QList<ToolButton *> &rightXtra=QList<ToolButton *>());
|
||||
void init(int flags=All, const QList<QWidget *> &leftXtra=QList<QWidget *>(), const QList<QWidget *> &rightXtra=QList<QWidget *>());
|
||||
virtual QStringList selectedFiles(bool allowPlaylists=false) const { Q_UNUSED(allowPlaylists); return QStringList(); }
|
||||
virtual QList<Song> selectedSongs(bool allowPlaylists=false) const { Q_UNUSED(allowPlaylists); return QList<Song>(); }
|
||||
void addSelectionToPlaylist(const QString &name, bool replace, quint8 priorty);
|
||||
|
||||
Reference in New Issue
Block a user