]> git.sur5r.net Git - minitube/blobdiff - src/MediaView.cpp
Imported Upstream version 1.5
[minitube] / src / MediaView.cpp
index c9ae47f90b4ae4f2246ea55f4e31cfee6356831f..d41c69eae29e8970cd34ec805be6f986b639d5cc 100644 (file)
@@ -124,7 +124,6 @@ MediaView::MediaView(QWidget *parent) : QWidget(parent) {
 #ifdef APP_DEMO
     demoTimer = new QTimer(this);
     demoTimer->setSingleShot(true);
-    demoTimer->setInterval(30000);
     connect(demoTimer, SIGNAL(timeout()), SLOT(demoMessage()));
 #endif
 
@@ -178,7 +177,7 @@ void MediaView::search(SearchParams *searchParams) {
 
     QString keyword = searchParams->keywords();
     QString display = keyword;
-    if (keyword.startsWith("http://")) {
+    if (keyword.startsWith("http://") || keyword.startsWith("https://")) {
         int separator = keyword.indexOf("|");
         if (separator > 0 && separator + 1 < keyword.length()) {
             display = keyword.mid(separator+1);
@@ -196,15 +195,17 @@ void MediaView::disappear() {
 }
 
 void MediaView::handleError(QString message) {
-    if (message.indexOf("movie atom") != -1 || message.indexOf("Could not open") != -1) {
+    // if (message.indexOf("movie atom") != -1 || message.indexOf("Could not open") != -1) {
         QTimer::singleShot(1000, this, SLOT(startPlaying()));
         return;
-    }
+    // }
 
+    /*
     videoAreaWidget->showError(message);
     skippedVideo = listModel->activeVideo();
     // recover from errors by skipping to the next video
     errorTimer->start(2000);
+    */
 }
 
 void MediaView::stateChanged(Phonon::State newState, Phonon::State /*oldState*/)
@@ -322,6 +323,13 @@ void MediaView::activeRowChanged(int row) {
 
     The::globalActions()->value("download")->setEnabled(DownloadManager::instance()->itemForVideo(video) == 0);
 
+    // ensure active item is visible
+    // int row = listModel->activeRow();
+    if (row != -1) {
+        QModelIndex index = listModel->index(row, 0, QModelIndex());
+        listView->scrollTo(index, QAbstractItemView::EnsureVisible);
+    }
+
     // see you in gotStreamUrl...
 
 }
@@ -413,6 +421,10 @@ void MediaView::downloadStatusChanged() {
 
 void MediaView::startPlaying() {
     if (reallyStopped) return;
+    if (!downloadItem) {
+        skip();
+        return;
+    }
 
     // go!
     qDebug() << "Playing" << downloadItem->currentFilename();
@@ -599,11 +611,13 @@ void MediaView::demoMessage() {
     if (mediaObject->state() != Phonon::PlayingState) return;
     mediaObject->pause();
 
-    QMessageBox msgBox;
+    QMessageBox msgBox(this);
     msgBox.setIconPixmap(QPixmap(":/images/app.png").scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation));
     msgBox.setText(tr("This is just the demo version of %1.").arg(Constants::APP_NAME));
     msgBox.setInformativeText(tr("It allows you to test the application and see if it works for you."));
     msgBox.setModal(true);
+    // make it a "sheet" on the Mac
+    msgBox.setWindowModality(Qt::WindowModal);
 
     QPushButton *quitButton = msgBox.addButton(tr("Continue"), QMessageBox::RejectRole);
     QPushButton *buyButton = msgBox.addButton(tr("Get the full version"), QMessageBox::ActionRole);