diff --git a/lib/xsettings.cpp b/lib/xsettings.cpp index 90922c3..b0fb508 100644 --- a/lib/xsettings.cpp +++ b/lib/xsettings.cpp @@ -38,7 +38,7 @@ XSettings::value_get (QString key) } void -XSettings::value_get (QString key, QString val) +XSettings::value_set (QString key, QString val) { /* Only send change request to server here * update of local cache will be done through handle_config_value_changed diff --git a/src/Playlist.cpp b/src/Playlist.cpp index 23fbdd4..5ce1ff6 100644 --- a/src/Playlist.cpp +++ b/src/Playlist.cpp @@ -339,6 +339,7 @@ PlaylistWidget::addButtons (void) { PlaylistMenuButton *b; + /* Add menu */ m_add = new PlaylistMenu (this, Skin::PLS_ADD, Skin::PLS_ADD_DEC); b = new PlaylistMenuButton (m_add, Skin::PLS_ADD_URL_0, @@ -351,7 +352,7 @@ PlaylistWidget::addButtons (void) Skin::PLS_ADD_FIL_1); connect (b, SIGNAL(activated ()), this, SLOT (menuAddFile ())); - + /* Del menu */ m_del = new PlaylistMenu (this, Skin::PLS_DEL, Skin::PLS_DEL_DEC); b = new PlaylistMenuButton (m_del, Skin::PLS_MSC_BTN_0, @@ -366,15 +367,23 @@ PlaylistWidget::addButtons (void) Skin::PLS_DEL_FIL_1); // connect (b, SIGNAL(activated ()), m_list, SLOT (deleteFiles ())); + /* Selection menu */ m_sel = new PlaylistMenu (this, Skin::PLS_SEL, Skin::PLS_SEL_DEC); b = new PlaylistMenuButton (m_sel, Skin::PLS_SEL_INV_0, Skin::PLS_SEL_INV_1); + connect (b, SIGNAL (activated ()), + m_view, SLOT (invertSelection ())); b = new PlaylistMenuButton (m_sel, Skin::PLS_SEL_NIL_0, Skin::PLS_SEL_NIL_1); + connect (b, SIGNAL (activated ()), + m_view, SLOT (clearSelection ())); b = new PlaylistMenuButton (m_sel, Skin::PLS_SEL_ALL_0, Skin::PLS_SEL_ALL_1); + connect (b, SIGNAL (activated ()), + m_view, SLOT (selectAll ())); + /* misc menu */ m_msc = new PlaylistMenu (this, Skin::PLS_MSC, Skin::PLS_MSC_DEC); b = new PlaylistMenuButton (m_msc, Skin::PLS_MSC_SRT_0, @@ -383,7 +392,7 @@ PlaylistWidget::addButtons (void) Skin::PLS_MSC_INF_1); b = new PlaylistMenuButton (m_msc, Skin::PLS_MSC_OPT_0, Skin::PLS_MSC_OPT_1); - + /* playlist menu */ m_lst = new PlaylistMenu (this, Skin::PLS_LST, Skin::PLS_LST_DEC); b = new PlaylistMenuButton (m_lst, Skin::PLS_LST_NEW_0, diff --git a/src/PlaylistView.cpp b/src/PlaylistView.cpp index 9d52062..44a4c5b 100644 --- a/src/PlaylistView.cpp +++ b/src/PlaylistView.cpp @@ -109,6 +109,16 @@ PlaylistView::PlaylistView (QWidget *parent) : QListView (parent) this, SLOT(handleStatus(Xmms::Playback::Status))); } +void +PlaylistView::invertSelection () { + QItemSelection selection = QItemSelection (model ()->index (0, 0), + model ()->index (model ()->rowCount ()-1, 0)); + selectionModel ()->select (selection, QItemSelectionModel::Toggle | + QItemSelectionModel::Columns); + selectionModel()->setCurrentIndex(model ()->index (0, 0), + QItemSelectionModel::NoUpdate); +} + void PlaylistView::setModel (QAbstractItemModel *model) { QListView::setModel (model); diff --git a/src/PlaylistView.h b/src/PlaylistView.h index 5b48da2..daed5cc 100644 --- a/src/PlaylistView.h +++ b/src/PlaylistView.h @@ -37,6 +37,7 @@ class PlaylistView : public QListView { void contextMenuEvent (QContextMenuEvent *e); void handleStatus (const Xmms::Playback::Status st); + void invertSelection (void); void settingsSaved (void); void setPixmaps (Skin *skin);