277 labelDesc->setTextInteractionFlags(Qt::TextSelectableByMouse | |
277 labelDesc->setTextInteractionFlags(Qt::TextSelectableByMouse | |
278 Qt::TextSelectableByKeyboard | |
278 Qt::TextSelectableByKeyboard | |
279 Qt::LinksAccessibleByMouse | |
279 Qt::LinksAccessibleByMouse | |
280 Qt::LinksAccessibleByKeyboard); |
280 Qt::LinksAccessibleByKeyboard); |
281 labelDesc->setTextFormat(Qt::RichText); |
281 labelDesc->setTextFormat(Qt::RichText); |
|
282 labelDesc->setOpenExternalLinks(true); |
282 pTopDescLayout->addWidget(labelDesc, 1); |
283 pTopDescLayout->addWidget(labelDesc, 1); |
283 |
284 |
284 // buttons: play and delete |
285 // buttons: play and delete |
285 btnPlay = new QPushButton(QPushButton::tr("Play"), pDescGroup); |
286 btnPlay = new QPushButton(QPushButton::tr("Play"), pDescGroup); |
286 btnPlay->setEnabled(false); |
287 btnPlay->setEnabled(false); |
319 connect(filesTable, SIGNAL(currentCellChanged(int,int,int,int)), this, SLOT(currentCellChanged(int,int,int,int))); |
320 connect(filesTable, SIGNAL(currentCellChanged(int,int,int,int)), this, SLOT(currentCellChanged(int,int,int,int))); |
320 connect(btnPlay, SIGNAL(clicked()), this, SLOT(playSelectedFile())); |
321 connect(btnPlay, SIGNAL(clicked()), this, SLOT(playSelectedFile())); |
321 connect(btnDelete, SIGNAL(clicked()), this, SLOT(deleteSelectedFiles())); |
322 connect(btnDelete, SIGNAL(clicked()), this, SLOT(deleteSelectedFiles())); |
322 connect(btnToYouTube, SIGNAL(clicked()), this, SLOT(uploadToYouTube())); |
323 connect(btnToYouTube, SIGNAL(clicked()), this, SLOT(uploadToYouTube())); |
323 connect(btnOpenDir, SIGNAL(clicked()), this, SLOT(openVideosDirectory())); |
324 connect(btnOpenDir, SIGNAL(clicked()), this, SLOT(openVideosDirectory())); |
324 connect(labelDesc, SIGNAL(linkActivated(const QString&)), this, SLOT(linkActivated(const QString&))); |
325 } |
325 } |
|
326 |
326 |
327 PageVideos::PageVideos(QWidget* parent) : AbstractPage(parent), |
327 PageVideos::PageVideos(QWidget* parent) : AbstractPage(parent), |
328 config(0), netManager(0) |
328 config(0), netManager(0) |
329 { |
329 { |
330 nameChangedFromCode = false; |
330 nameChangedFromCode = false; |
734 // extract prefix (original name) from description (it is enclosed in prefix[???]prefix) |
734 // extract prefix (original name) from description (it is enclosed in prefix[???]prefix) |
735 int prefixBegin = item->desc.indexOf("prefix["); |
735 int prefixBegin = item->desc.indexOf("prefix["); |
736 int prefixEnd = item->desc.indexOf("]prefix"); |
736 int prefixEnd = item->desc.indexOf("]prefix"); |
737 if (prefixBegin != -1 && prefixEnd != -1) |
737 if (prefixBegin != -1 && prefixEnd != -1) |
738 { |
738 { |
739 item->prefix = desc.mid(prefixBegin + 7, prefixEnd - (prefixBegin + 7)); |
739 item->prefix = item->desc.mid(prefixBegin + 7, prefixEnd - (prefixBegin + 7)); |
740 item->desc.remove(prefixBegin, prefixEnd + 7 - prefixBegin); |
740 item->desc.remove(prefixBegin, prefixEnd + 7 - prefixBegin); |
741 } |
741 } |
742 } |
742 } |
743 desc += item->desc + '\n'; |
743 desc += item->desc + '\n'; |
744 } |
744 } |
769 file->close(); |
769 file->close(); |
770 item->uploadUrl = QString::fromUtf8(data.data()); |
770 item->uploadUrl = QString::fromUtf8(data.data()); |
771 } |
771 } |
772 } |
772 } |
773 if (item->uploadUrl != "no") |
773 if (item->uploadUrl != "no") |
774 desc += QString("<a href=\"%1\">%1</a>").arg(item->uploadUrl); |
774 desc += QString("<a href=\"%1\" style=\"color: white;\">%1</a>").arg(item->uploadUrl); |
775 desc.replace("\n", "<br/>"); |
775 desc.replace("\n", "<br/>"); |
776 |
776 |
777 labelDesc->setText(desc); |
777 labelDesc->setText(desc); |
778 |
778 |
779 if (!item->prefix.isEmpty()) |
779 if (!item->prefix.isEmpty()) |
803 void PageVideos::play(int row) |
803 void PageVideos::play(int row) |
804 { |
804 { |
805 VideoItem * item = nameItem(row); |
805 VideoItem * item = nameItem(row); |
806 if (item && item->ready()) |
806 if (item && item->ready()) |
807 QDesktopServices::openUrl(QUrl("file:///" + QDir::toNativeSeparators(item->path()))); |
807 QDesktopServices::openUrl(QUrl("file:///" + QDir::toNativeSeparators(item->path()))); |
808 } |
|
809 |
|
810 void PageVideos::linkActivated(const QString & link) |
|
811 { |
|
812 QDesktopServices::openUrl(QUrl(link)); |
|
813 } |
808 } |
814 |
809 |
815 void PageVideos::playSelectedFile() |
810 void PageVideos::playSelectedFile() |
816 { |
811 { |
817 int index = filesTable->currentRow(); |
812 int index = filesTable->currentRow(); |
1129 // make it different from progress-bar used during encoding (use blue color) |
1124 // make it different from progress-bar used during encoding (use blue color) |
1130 progressBar->setStyleSheet("* {color: #00ccff; selection-background-color: #00ccff;}" ); |
1125 progressBar->setStyleSheet("* {color: #00ccff; selection-background-color: #00ccff;}" ); |
1131 filesTable->setCellWidget(row, vcProgress, progressBar); |
1126 filesTable->setCellWidget(row, vcProgress, progressBar); |
1132 |
1127 |
1133 QNetworkReply* reply = netManager->put(request, file); |
1128 QNetworkReply* reply = netManager->put(request, file); |
|
1129 file->setParent(reply); // automatically close file when needed |
1134 item->pUploading = reply; |
1130 item->pUploading = reply; |
1135 connect(reply, SIGNAL(uploadProgress(qint64, qint64)), this, SLOT(uploadProgress(qint64, qint64))); |
1131 connect(reply, SIGNAL(uploadProgress(qint64, qint64)), this, SLOT(uploadProgress(qint64, qint64))); |
1136 connect(reply, SIGNAL(finished()), this, SLOT(uploadFinished())); |
1132 connect(reply, SIGNAL(finished()), this, SLOT(uploadFinished())); |
1137 numUploads++; |
1133 numUploads++; |
1138 |
1134 |