]> git.nothing2do.fr Git - diary-mobile.git/commitdiff
I've changed "down" in action (now, "down URL file") and attempt to add
authorNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Sat, 7 Jun 2014 22:51:18 +0000 (00:51 +0200)
committerNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Sat, 7 Jun 2014 22:51:18 +0000 (00:51 +0200)
multimedia

mainwindow.cpp

index a95cb5a987832bc4a2b43b7af84c5aa097ce9062..e04d39e9c0402b145c9b3177d97eb1a7d9203801 100644 (file)
@@ -235,7 +235,23 @@ void MainWindow::action(const QString &a){
         connect(m, SIGNAL(downloaded()), SLOT(writeUi()));
     }
     else if(b[0]==QString("down")){
-        download(b[1], b[2]);
+        QString a,aa;
+        bool ok;
+        int bs=b.size();
+        if(bs==1){
+            a=QInputDialog::getText(this, trUtf8("URL", "title to download a custom file from URL"), trUtf8("Enter the URL of the file", "label to download a custom file"), QLineEdit::Normal, QString(""), &ok);
+            if(!ok)return;
+            aa=QInputDialog::getText(this, trUtf8("File", "title to write a file downloaded from URL"), trUtf8("Enter the name of the file", "label to write the downloaded data"), QLineEdit::Normal, QString(""), &ok);
+            if(!ok)return;
+        }else if(bs==2){
+            a=b[1];
+            aa=QInputDialog::getText(this, trUtf8("File", "title to write a file downloaded from URL"), trUtf8("Enter the name of the file", "label to write the downloaded data"), QLineEdit::Normal, QString(""), &ok);
+            if(!ok)return;
+        }else if(bs==3){
+            a=b[1];
+            aa=b[2];
+        }
+        download(a, aa);
     }
     else if(b[0]==QString("vid")){
         addMedia(c);
@@ -758,20 +774,22 @@ void MainWindow::writeFile(){
 }
 void MainWindow::addMedia(const QString & a){
     if((video)&&(playlist)){
-        playlist->addMedia(QUrl(a));
+        playlist->addMedia(QMediaResource(a));
     }else{
         flush();
-        videoWidget=new QVideoWidget;
-        video=new QMediaPlayer;
-        playlist=new QMediaPlaylist;
+        video=new QMediaPlayer(this);
+        videoWidget=new QVideoWidget(this);
+        playlist=new QMediaPlaylist(this);
         video->setVideoOutput(videoWidget);
         video->setPlaylist(playlist);
-        playlist->addMedia(QUrl(a));
+        playlist->load(QUrl(a));
         int c=grid->count();
         int maxc=conf->value(QString("maxcolumn")).toInt();
-        if(!orientation)grid->addWidget(videoWidget, c/maxc, c%maxc, 1, -1, Qt::AlignJustify| Qt::AlignVCenter | Qt::AlignHCenter);
-        else grid->addWidget(videoWidget, c/maxc, c%maxc, -1, 1, Qt::AlignJustify| Qt::AlignVCenter | Qt::AlignHCenter);
+        //if(!orientation)
+        grid->addWidget(videoWidget, c/maxc, c%maxc, 1, -1, Qt::AlignJustify| Qt::AlignVCenter | Qt::AlignHCenter);
+        //else grid->addWidget(videoWidget, c/maxc, c%maxc, -1, 1, Qt::AlignJustify| Qt::AlignVCenter | Qt::AlignHCenter);
         label->setText(QString("video"));
+        video->play();
 
     }
 }