]> git.sur5r.net Git - minitube/blobdiff - src/MediaView.cpp
Keyboard shortcuts for the sortBar
[minitube] / src / MediaView.cpp
index 45282b8e018a158f9d686e4adfaa77a057069871..10160658c224238c83653f67b877bfbff215d680 100644 (file)
@@ -19,25 +19,31 @@ MediaView::MediaView(QWidget *parent) : QWidget(parent) {
     splitter->setChildrenCollapsible(false);
 
     sortBar = new THBlackBar(this);
-    mostRelevantAction = new THAction(tr("Most relevant"), this);
+    mostRelevantAction = new QAction(tr("Most relevant"), this);
+    mostRelevantAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_1));
+    addAction(mostRelevantAction);
     connect(mostRelevantAction, SIGNAL(triggered()), this, SLOT(searchMostRelevant()), Qt::QueuedConnection);
     sortBar->addAction(mostRelevantAction);
-    mostRecentAction = new THAction(tr("Most recent"), this);
+    mostRecentAction = new QAction(tr("Most recent"), this);
+    mostRecentAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_2));
+    addAction(mostRecentAction);
     connect(mostRecentAction, SIGNAL(triggered()), this, SLOT(searchMostRecent()), Qt::QueuedConnection);
     sortBar->addAction(mostRecentAction);
-    mostViewedAction = new THAction(tr("Most viewed"), this);
+    mostViewedAction = new QAction(tr("Most viewed"), this);
+    mostViewedAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_3));
+    addAction(mostViewedAction);
     connect(mostViewedAction, SIGNAL(triggered()), this, SLOT(searchMostViewed()), Qt::QueuedConnection);
     sortBar->addAction(mostViewedAction);
 
     listView = new QListView(this);
-    listView->setItemDelegate(new Playlist::PrettyItemDelegate(this));
+    listView->setItemDelegate(new PrettyItemDelegate(this));
     listView->setSelectionMode(QAbstractItemView::ExtendedSelection);
 
     // dragndrop
     listView->setDragEnabled(true);
     listView->setAcceptDrops(true);
     listView->setDropIndicatorShown(true);
-    listView->setDragDropMode(QAbstractItemView::InternalMove);
+    listView->setDragDropMode(QAbstractItemView::DragDrop);
 
     // cosmetics
     listView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
@@ -67,6 +73,7 @@ MediaView::MediaView(QWidget *parent) : QWidget(parent) {
 
     videoWidget = new Phonon::VideoWidget(this);
     videoAreaWidget->setVideoWidget(videoWidget);
+    videoAreaWidget->setListModel(listModel);
 
     loadingWidget = new LoadingWidget(this);
     videoAreaWidget->setLoadingWidget(loadingWidget);
@@ -128,6 +135,7 @@ void MediaView::stateChanged(Phonon::State newState, Phonon::State /*oldState*/)
 
          case Phonon::ErrorState:
         qDebug() << "Phonon error:" << mediaObject->errorString() << mediaObject->errorType();
+        videoAreaWidget->showError(mediaObject->errorString());
         // recover from errors by skipping to the next video
         skip();
         break;
@@ -168,6 +176,7 @@ void MediaView::stateChanged(Phonon::State newState, Phonon::State /*oldState*/)
 }
 
 void MediaView::pause() {
+    // qDebug() << "pause() called" << mediaObject->state();
     switch( mediaObject->state() ) {
     case Phonon::PlayingState:
         mediaObject->pause();