From: Norbert Moutarde Date: Sat, 7 Jun 2014 22:51:18 +0000 (+0200) Subject: I've changed "down" in action (now, "down URL file") and attempt to add X-Git-Url: https://git.nothing2do.fr/?a=commitdiff_plain;h=4c7642777d7e69d5cfe7a5937c85719b1341cf62;p=diary-mobile.git I've changed "down" in action (now, "down URL file") and attempt to add multimedia --- diff --git a/mainwindow.cpp b/mainwindow.cpp index a95cb5a..e04d39e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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(); } }