diff options
Diffstat (limited to 'src-qt5/desktop-utils/lumina-mediaplayer')
-rw-r--r-- | src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp | 39 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-mediaplayer/mainUI.h | 2 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-mediaplayer/mainUI.ui | 49 |
3 files changed, 86 insertions, 4 deletions
diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp b/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp index f56fbd3f..65fa7319 100644 --- a/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp +++ b/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp @@ -152,7 +152,8 @@ void MainUI::setupConnections(){ connect(ui->tool_local_rm, SIGNAL(clicked()), this, SLOT(rmLocalMedia()) ); connect(ui->tool_local_shuffle, SIGNAL(clicked()), PLAYLIST, SLOT(shuffle()) ); connect(ui->tool_local_repeat, SIGNAL(toggled(bool)), this, SLOT(localPlaybackSettingsChanged()) ); - + connect(ui->tool_local_moveup, SIGNAL(clicked()), this, SLOT(upLocalMedia()) ); + connect(ui->tool_local_movedown, SIGNAL(clicked()), this, SLOT(downLocalMedia()) ); connect(ui->push_pandora_apply, SIGNAL(clicked()), this, SLOT(applyPandoraSettings()) ); connect(ui->combo_pandora_station, SIGNAL(activated(QString)), this, SLOT(changePandoraStation(QString)) ); @@ -194,6 +195,8 @@ void MainUI::setupIcons(){ ui->tool_local_rm->setIcon( LXDG::findIcon("list-remove","") ); ui->tool_local_shuffle->setIcon( LXDG::findIcon("media-playlist-shuffle","") ); ui->tool_local_repeat->setIcon( LXDG::findIcon("media-playlist-repeat","") ); + ui->tool_local_moveup->setIcon( LXDG::findIcon("go-up", "arrow-up") ); + ui->tool_local_movedown->setIcon( LXDG::findIcon("go-down", "arrow-down") ); //Pandora Pages ui->push_pandora_apply->setIcon( LXDG::findIcon("dialog-ok-apply","dialog-ok") ); @@ -335,6 +338,28 @@ void MainUI::rmLocalMedia(){ } } +void MainUI::upLocalMedia(){ + //NOTE: Only a single selection is possible at the present time + QList<QListWidgetItem*> sel = ui->list_local->selectedItems(); + for(int i=0; i<sel.length(); i++){ + int row = ui->list_local->row(sel[i]); + PLAYLIST->moveMedia(row, row-1 ); + QApplication::processEvents(); //this runs the inserted/removed functions + ui->list_local->setCurrentRow(row-1); + } +} + +void MainUI::downLocalMedia(){ + //NOTE: Only a single selection is possible at the present time + QList<QListWidgetItem*> sel = ui->list_local->selectedItems(); + for(int i=0; i<sel.length(); i++){ + int row = ui->list_local->row(sel[i]); + PLAYLIST->moveMedia(row, row+1 ); + QApplication::processEvents(); //this runs the inserted/removed functions + ui->list_local->setCurrentRow(row+1); + } +} + void MainUI::localPlaybackSettingsChanged(){ if(ui->tool_local_shuffle->isChecked()){ PLAYLIST->setPlaybackMode(QMediaPlaylist::Random); } else if(ui->tool_local_repeat->isChecked()){ PLAYLIST->setPlaybackMode(QMediaPlaylist::Loop); } @@ -355,13 +380,22 @@ void MainUI::LocalListIndexChanged(int current){ } void MainUI::LocalListMediaChanged(int start, int end){ + //qDebug() << "List Media Changed"; + QList<QListWidgetItem*> sel = ui->list_local->selectedItems(); + QString selItem; + if(!sel.isEmpty()){ sel.first()->text(); } + for(int i=start; i<end+1; i++){ QUrl url = PLAYLIST->media(i).canonicalUrl(); ui->list_local->item(i)->setText(url.toLocalFile().section("/",-1).simplified()); + if(ui->list_local->item(i)->text()==selItem){ + ui->list_local->setCurrentItem(ui->list_local->item(i)); + } } } void MainUI::LocalListMediaInserted(int start, int end){ + // qDebug() << "Media Inserted"; for(int i=start; i<end+1; i++){ QUrl url = PLAYLIST->media(i).canonicalUrl(); ui->list_local->insertItem(i, url.toLocalFile().section("/",-1).simplified()); @@ -369,6 +403,7 @@ void MainUI::LocalListMediaInserted(int start, int end){ } void MainUI::LocalListMediaRemoved(int start, int end){ + //qDebug() << "Media Removed"; for(int i=end; i>=start; i--){ delete ui->list_local->takeItem(i); } @@ -547,7 +582,7 @@ void MainUI::PandoraStationChanged(QString station){ } } -void MainUI::PandoraSongChanged(bool isLoved, QString title, QString artist, QString album, QString detailsURL, QString fromStation){ +void MainUI::PandoraSongChanged(bool isLoved, QString title, QString artist, QString album, QString detailsURL, QString){ // fromStation){ //qDebug() << "[SONG CHANGE]" << isLoved << title << artist << album << detailsURL << fromStation; ui->tool_pandora_info->setWhatsThis(detailsURL); ui->tool_pandora_love->setChecked(isLoved); diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.h b/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.h index b616c8f5..5856b257 100644 --- a/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.h +++ b/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.h @@ -66,6 +66,8 @@ private slots: void setLocalPosition(int pos){ PLAYER->setPosition(pos); } void addLocalMedia(); void rmLocalMedia(); + void upLocalMedia(); + void downLocalMedia(); void localPlaybackSettingsChanged(); //Local Playlist Feedback diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.ui b/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.ui index d545e90a..385c534e 100644 --- a/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.ui +++ b/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.ui @@ -84,14 +84,14 @@ <item> <widget class="QStackedWidget" name="stackedWidget"> <property name="currentIndex"> - <number>1</number> + <number>0</number> </property> <widget class="QWidget" name="page_local"> <layout class="QVBoxLayout" name="verticalLayout_6"> <item> <widget class="QTabWidget" name="tabWidget_local"> <property name="currentIndex"> - <number>0</number> + <number>1</number> </property> <widget class="QWidget" name="tab_local_playing"> <attribute name="title"> @@ -204,6 +204,51 @@ </spacer> </item> <item> + <widget class="QToolButton" name="tool_local_moveup"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>up</string> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_local_movedown"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>down</string> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer_4"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> <widget class="QToolButton" name="tool_local_shuffle"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> |