# HG changeset patch # User Stepan777 # Date 1344466824 -14400 # Node ID 0adcad8714c4e5808d73302a0cb09ae43ea09ede # Parent f8cf277dca366fdfa7d867ced6d7ee2c63c16fab improve html links + small bugfixes diff -r f8cf277dca36 -r 0adcad8714c4 QTfrontend/ui/dialog/upload_video.cpp --- a/QTfrontend/ui/dialog/upload_video.cpp Thu Aug 09 01:24:38 2012 +0400 +++ b/QTfrontend/ui/dialog/upload_video.cpp Thu Aug 09 03:00:24 2012 +0400 @@ -55,10 +55,10 @@ // Google requires us to display this, see https://developers.google.com/youtube/terms QString GoogleNotice = - "By clicking 'upload,' you certify that you own all rights to the content or that " + "

By clicking 'upload,' you certify that you own all rights to the content or that " "you are authorized by the owner to make the content publicly available on YouTube, " "and that it otherwise complies with the YouTube Terms of Service located at " - "http://www.youtube.com/t/terms."; + "http://www.youtube.com/t/terms.

"; // youtube doesn't understand this characters, even when they are properly escaped // (either with CDATA or with < or >) @@ -67,6 +67,8 @@ int row = 0; QGridLayout * layout = new QGridLayout(this); + layout->setColumnStretch(0, 1); + layout->setColumnStretch(1, 2); QLabel * lbLabel = new QLabel(this); lbLabel->setWordWrap(true); @@ -138,6 +140,9 @@ lbLabel = new QLabel(this); lbLabel->setWordWrap(true); + lbLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse); + lbLabel->setTextFormat(Qt::RichText); + lbLabel->setOpenExternalLinks(true); lbLabel->setText(GoogleNotice); layout->addWidget(lbLabel, row++, 0, 1, 2); @@ -156,6 +161,17 @@ connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject())); } +void HWUploadVideoDialog::showEvent(QShowEvent * event) +{ + QDialog::showEvent(event); + + // set width to the same value as height (otherwise dialog has too small width) + QSize s = size(); + QPoint p = pos(); + resize(s.height(), s.height()); + move(p.x() - (s.height() - s.width())/2, p.y()); +} + void HWUploadVideoDialog::setEditable(bool editable) { leTitle->setEnabled(editable); diff -r f8cf277dca36 -r 0adcad8714c4 QTfrontend/ui/dialog/upload_video.h --- a/QTfrontend/ui/dialog/upload_video.h Thu Aug 09 01:24:38 2012 +0400 +++ b/QTfrontend/ui/dialog/upload_video.h Thu Aug 09 03:00:24 2012 +0400 @@ -52,6 +52,10 @@ void setEditable(bool editable); + protected: + // virtual from QWidget + void showEvent(QShowEvent * event); + private slots: void upload(); void authFinished(); diff -r f8cf277dca36 -r 0adcad8714c4 QTfrontend/ui/page/pagevideos.cpp --- 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("%1").arg(item->uploadUrl); + desc += QString("%1").arg(item->uploadUrl); desc.replace("\n", "
"); 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())); diff -r f8cf277dca36 -r 0adcad8714c4 QTfrontend/ui/page/pagevideos.h --- a/QTfrontend/ui/page/pagevideos.h Thu Aug 09 01:24:38 2012 +0400 +++ b/QTfrontend/ui/page/pagevideos.h Thu Aug 09 03:00:24 2012 +0400 @@ -120,7 +120,6 @@ void uploadToYouTube(); void uploadProgress(qint64 bytesSent, qint64 bytesTotal); void uploadFinished(); - void linkActivated(const QString & link); }; #endif // PAGE_VIDEOS_H