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);
}
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();
}
}