aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/Ui/skinned/listwidget.cpp40
-rw-r--r--src/plugins/Ui/skinned/listwidget.h2
-rw-r--r--src/plugins/Ui/skinned/playlist.cpp17
-rw-r--r--src/plugins/Ui/skinned/playlist.h3
4 files changed, 33 insertions, 29 deletions
diff --git a/src/plugins/Ui/skinned/listwidget.cpp b/src/plugins/Ui/skinned/listwidget.cpp
index 62051f16f..9a0587952 100644
--- a/src/plugins/Ui/skinned/listwidget.cpp
+++ b/src/plugins/Ui/skinned/listwidget.cpp
@@ -32,6 +32,7 @@
#include <qmmpui/playlistmodel.h>
#include <qmmpui/qmmpuisettings.h>
#include "listwidget.h"
+#include "playlistheader.h"
#include "skin.h"
#include "popupwidget.h"
#include "playlist.h"
@@ -41,26 +42,30 @@
ListWidget::ListWidget(QWidget *parent)
: QWidget(parent)
{
- m_update = false;
m_skin = Skin::instance();
+ m_ui_settings = QmmpUiSettings::instance();
+ m_menu = new QMenu(this);
+ m_timer = new QTimer(this);
+ m_timer->setInterval(50);
+
m_popupWidget = 0;
+ m_header = 0;
+ m_update = false;
m_drop_index = INVALID_INDEX;
- m_menu = new QMenu(this);
m_scroll_direction = NONE;
m_prev_y = 0;
m_anchor_index = INVALID_INDEX;
m_pressed_index = INVALID_INDEX;
- m_ui_settings = QmmpUiSettings::instance();
- connect (m_ui_settings, SIGNAL(repeatableTrackChanged(bool)), SLOT(updateRepeatIndicator()));
m_first = 0;
m_row_count = 0;
m_select_on_release = false;
- readSettings();
- connect(m_skin, SIGNAL(skinChanged()), this, SLOT(updateSkin()));
+
setAcceptDrops(true);
setMouseTracking(true);
- m_timer = new QTimer(this);
- m_timer->setInterval(50);
+
+ readSettings();
+ connect(m_skin, SIGNAL(skinChanged()), this, SLOT(updateSkin()));
+ connect(m_ui_settings, SIGNAL(repeatableTrackChanged(bool)), SLOT(updateRepeatIndicator()));
connect(m_timer, SIGNAL(timeout()), SLOT(autoscroll()));
}
@@ -76,10 +81,26 @@ void ListWidget::readSettings()
settings.beginGroup("Skinned");
m_show_protocol = settings.value ("pl_show_protocol", false).toBool();
bool show_popup = settings.value("pl_show_popup", false).toBool();
+ bool show_header = settings.value("pl_show_header", true).toBool();
- if (m_update)
+ if(m_update)
{
m_drawer.readSettings();
+ }
+
+ if(show_header && !m_header)
+ {
+ m_header = new PlayListHeader(this);
+ m_header->setGeometry(0,0,width(), m_drawer.rowHeight());
+ }
+ else if(!show_header && m_header)
+ {
+ m_header->deleteLater();
+ m_header = 0;
+ }
+
+ if (m_update)
+ {
m_row_count = height() / m_drawer.rowHeight();
updateList(PlayListModel::STRUCTURE);
if(m_popupWidget)
@@ -232,6 +253,7 @@ void ListWidget::mousePressEvent(QMouseEvent *e)
void ListWidget::resizeEvent(QResizeEvent *e)
{
+ m_header->setGeometry(0,0,width(), m_drawer.rowHeight());
m_row_count = e->size().height() / m_drawer.rowHeight();
updateList(PlayListModel::STRUCTURE);
QWidget::resizeEvent(e);
diff --git a/src/plugins/Ui/skinned/listwidget.h b/src/plugins/Ui/skinned/listwidget.h
index e87395fc3..1c0481f7f 100644
--- a/src/plugins/Ui/skinned/listwidget.h
+++ b/src/plugins/Ui/skinned/listwidget.h
@@ -35,6 +35,7 @@ class PlayListModel;
class Skin;
class PlayListItem;
class QmmpUiSettings;
+class PlayListHeader;
namespace PlayListPopup{
class PopupWidget;
}
@@ -127,6 +128,7 @@ private:
PlayListPopup::PopupWidget *m_popupWidget;
QTimer *m_timer;
ListWidgetDrawer m_drawer;
+ PlayListHeader *m_header;
};
#endif
diff --git a/src/plugins/Ui/skinned/playlist.cpp b/src/plugins/Ui/skinned/playlist.cpp
index bfb8e5e7a..27352ae0e 100644
--- a/src/plugins/Ui/skinned/playlist.cpp
+++ b/src/plugins/Ui/skinned/playlist.cpp
@@ -63,7 +63,6 @@ PlayList::PlayList (PlayListManager *manager, QWidget *parent)
m_shaded = false;
m_pl_browser = 0;
m_pl_selector = 0;
- m_pl_header = 0;
resize (275*m_ratio, 116*m_ratio);
setSizeIncrement (25*m_ratio, 29*m_ratio);
@@ -160,14 +159,6 @@ void PlayList::updatePositions()
pl_h -= m_pl_selector->height();
}
- if(m_pl_header)
- {
- m_pl_header->resize(243*m_ratio+25*sx, m_pl_header->height());
- m_pl_header->move(pl_x, pl_y);
- pl_y += m_pl_selector->height();
- pl_h -= m_pl_selector->height();
- }
-
m_listWidget->resize (pl_w, pl_h);
m_listWidget->move (pl_x, pl_y);
@@ -469,14 +460,6 @@ void PlayList::readSettings()
m_pl_selector = 0;
}
- if(!m_pl_header)
- {
- m_pl_header = new PlayListHeader(this);
- m_pl_header->setModel(m_pl_manager->currentPlayList());
- connect(m_pl_manager, SIGNAL(selectedPlayListChanged(PlayListModel*,PlayListModel*)),
- m_pl_header, SLOT(setModel(PlayListModel*,PlayListModel*)));
- }
-
if (m_update)
{
m_listWidget->readSettings();
diff --git a/src/plugins/Ui/skinned/playlist.h b/src/plugins/Ui/skinned/playlist.h
index 7528b1277..db3250dba 100644
--- a/src/plugins/Ui/skinned/playlist.h
+++ b/src/plugins/Ui/skinned/playlist.h
@@ -41,7 +41,6 @@ class PlayListManager;
class PlayListBrowser;
class PlayListSelector;
class QmmpUiSettings;
-class PlayListHeader;
/**
@author Ilya Kotov <forkotov02@hotmail.ru>
@@ -130,8 +129,6 @@ class PlayList : public QWidget
KeyboardManager* m_keyboardManager;
QPointer <PlayListBrowser> m_pl_browser;
PlayListSelector *m_pl_selector;
- PlayListHeader *m_pl_header;
-
};
#endif