QTfrontend/ui/dialog/upload_video.cpp
changeset 7531 0adcad8714c4
parent 7528 f8cf277dca36
child 7631 01b599d6f72d
equal deleted inserted replaced
7528:f8cf277dca36 7531:0adcad8714c4
    53 
    53 
    54     setWindowTitle(tr("Upload video"));
    54     setWindowTitle(tr("Upload video"));
    55 
    55 
    56     // Google requires us to display this, see https://developers.google.com/youtube/terms
    56     // Google requires us to display this, see https://developers.google.com/youtube/terms
    57     QString GoogleNotice =
    57     QString GoogleNotice =
    58         "By clicking 'upload,' you certify that you own all rights to the content or that "
    58         "<p>By clicking 'upload,' you certify that you own all rights to the content or that "
    59         "you are authorized by the owner to make the content publicly available on YouTube, "
    59         "you are authorized by the owner to make the content publicly available on YouTube, "
    60         "and that it otherwise complies with the YouTube Terms of Service located at "
    60         "and that it otherwise complies with the YouTube Terms of Service located at "
    61         "http://www.youtube.com/t/terms.";
    61         "<a href=\"http://www.youtube.com/t/terms\" style=\"color: white;\">http://www.youtube.com/t/terms</a>.</p>";
    62 
    62 
    63     // youtube doesn't understand this characters, even when they are properly escaped
    63     // youtube doesn't understand this characters, even when they are properly escaped
    64     // (either with CDATA or with &lt or &gt)
    64     // (either with CDATA or with &lt or &gt)
    65     QRegExp rx("[^<>]*");
    65     QRegExp rx("[^<>]*");
    66 
    66 
    67     int row = 0;
    67     int row = 0;
    68 
    68 
    69     QGridLayout * layout = new QGridLayout(this);
    69     QGridLayout * layout = new QGridLayout(this);
       
    70     layout->setColumnStretch(0, 1);
       
    71     layout->setColumnStretch(1, 2);
    70 
    72 
    71     QLabel * lbLabel = new QLabel(this);
    73     QLabel * lbLabel = new QLabel(this);
    72     lbLabel->setWordWrap(true);
    74     lbLabel->setWordWrap(true);
    73     lbLabel->setText(QLabel::tr(
    75     lbLabel->setText(QLabel::tr(
    74                          "Please provide either the YouTube account name "
    76                          "Please provide either the YouTube account name "
   136         hr->setFixedHeight(10);
   138         hr->setFixedHeight(10);
   137         layout->addWidget(hr, row++, 0, 1, 2);
   139         layout->addWidget(hr, row++, 0, 1, 2);
   138 
   140 
   139     lbLabel = new QLabel(this);
   141     lbLabel = new QLabel(this);
   140     lbLabel->setWordWrap(true);
   142     lbLabel->setWordWrap(true);
       
   143     lbLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
       
   144     lbLabel->setTextFormat(Qt::RichText);
       
   145     lbLabel->setOpenExternalLinks(true);
   141     lbLabel->setText(GoogleNotice);
   146     lbLabel->setText(GoogleNotice);
   142     layout->addWidget(lbLabel, row++, 0, 1, 2);
   147     layout->addWidget(lbLabel, row++, 0, 1, 2);
   143 
   148 
   144     QDialogButtonBox* dbbButtons = new QDialogButtonBox(this);
   149     QDialogButtonBox* dbbButtons = new QDialogButtonBox(this);
   145     btnUpload = dbbButtons->addButton(tr("Upload"), QDialogButtonBox::ActionRole);
   150     btnUpload = dbbButtons->addButton(tr("Upload"), QDialogButtonBox::ActionRole);
   152         hr->setFixedHeight(10);
   157         hr->setFixedHeight(10);
   153         layout->addWidget(hr, row++, 0, 1, 2);*/
   158         layout->addWidget(hr, row++, 0, 1, 2);*/
   154 
   159 
   155     connect(btnUpload, SIGNAL(clicked()), this, SLOT(upload()));
   160     connect(btnUpload, SIGNAL(clicked()), this, SLOT(upload()));
   156     connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject()));
   161     connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject()));
       
   162 }
       
   163 
       
   164 void HWUploadVideoDialog::showEvent(QShowEvent * event)
       
   165 {
       
   166     QDialog::showEvent(event);
       
   167 
       
   168     // set width to the same value as height (otherwise dialog has too small width)
       
   169     QSize s = size();
       
   170     QPoint p = pos();
       
   171     resize(s.height(), s.height());
       
   172     move(p.x() - (s.height() - s.width())/2, p.y());
   157 }
   173 }
   158 
   174 
   159 void HWUploadVideoDialog::setEditable(bool editable)
   175 void HWUploadVideoDialog::setEditable(bool editable)
   160 {
   176 {
   161     leTitle->setEnabled(editable);
   177     leTitle->setEnabled(editable);