QTfrontend/ui/page/pagevideos.cpp
changeset 7531 0adcad8714c4
parent 7507 3032a5739fe1
child 7631 01b599d6f72d
--- a/QTfrontend/ui/page/pagevideos.cpp	Thu Aug 09 01:24:38 2012 +0400
+++ b/QTfrontend/ui/page/pagevideos.cpp	Thu Aug 09 03:00:24 2012 +0400
@@ -279,6 +279,7 @@
                                            Qt::LinksAccessibleByMouse |
                                            Qt::LinksAccessibleByKeyboard);
         labelDesc->setTextFormat(Qt::RichText);
+        labelDesc->setOpenExternalLinks(true);
         pTopDescLayout->addWidget(labelDesc, 1);
 
         // buttons: play and delete
@@ -321,8 +322,7 @@
     connect(btnDelete, SIGNAL(clicked()), this, SLOT(deleteSelectedFiles()));
     connect(btnToYouTube, SIGNAL(clicked()), this, SLOT(uploadToYouTube()));
     connect(btnOpenDir, SIGNAL(clicked()), this, SLOT(openVideosDirectory()));
-    connect(labelDesc, SIGNAL(linkActivated(const QString&)), this, SLOT(linkActivated(const QString&)));
- }
+}
 
 PageVideos::PageVideos(QWidget* parent) : AbstractPage(parent),
     config(0), netManager(0)
@@ -736,7 +736,7 @@
             int prefixEnd   = item->desc.indexOf("]prefix");
             if (prefixBegin != -1 && prefixEnd != -1)
             {
-                item->prefix = desc.mid(prefixBegin + 7, prefixEnd - (prefixBegin + 7));
+                item->prefix = item->desc.mid(prefixBegin + 7, prefixEnd - (prefixBegin + 7));
                 item->desc.remove(prefixBegin, prefixEnd + 7 - prefixBegin);
             }
         }
@@ -771,7 +771,7 @@
         }
     }
     if (item->uploadUrl != "no")
-        desc += QString("<a href=\"%1\">%1</a>").arg(item->uploadUrl);
+        desc += QString("<a href=\"%1\" style=\"color: white;\">%1</a>").arg(item->uploadUrl);
     desc.replace("\n", "<br/>");
 
     labelDesc->setText(desc);
@@ -807,11 +807,6 @@
         QDesktopServices::openUrl(QUrl("file:///" + QDir::toNativeSeparators(item->path())));
 }
 
-void PageVideos::linkActivated(const QString & link)
-{
-    QDesktopServices::openUrl(QUrl(link));
-}
-
 void PageVideos::playSelectedFile()
 {
     int index = filesTable->currentRow();
@@ -1131,6 +1126,7 @@
     filesTable->setCellWidget(row, vcProgress, progressBar);
 
     QNetworkReply* reply = netManager->put(request, file);
+    file->setParent(reply); // automatically close file when needed
     item->pUploading = reply;
     connect(reply, SIGNAL(uploadProgress(qint64, qint64)), this, SLOT(uploadProgress(qint64, qint64)));
     connect(reply, SIGNAL(finished()), this, SLOT(uploadFinished()));