QTfrontend/ui/dialog/upload_video.cpp
author Stepan777 <stepik-777@mail.ru>
Mon, 06 Aug 2012 00:44:32 +0400
changeset 7507 3032a5739fe1
parent 7447 01111960a48d
child 7528 f8cf277dca36
permissions -rw-r--r--
improve video uploading
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     1
/*
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     3
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     4
 *
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     8
 *
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    12
 * GNU General Public License for more details.
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    13
 *
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    17
 */
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    18
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    19
#include <QLineEdit>
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    20
#include <QDialogButtonBox>
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    21
#include <QPushButton>
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    22
#include <QGridLayout>
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    23
#include <QCheckBox>
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    24
#include <QLabel>
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    25
#include <QFrame>
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    26
#include <QPlainTextEdit>
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    27
#include <QSslError>
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    28
#include <QUrl>
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    29
#include <QNetworkAccessManager>
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    30
#include <QNetworkRequest>
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    31
#include <QNetworkReply>
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    32
#include <QMessageBox>
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    33
#include <QRegExp>
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    34
#include <QRegExpValidator>
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    35
#include <QMessageBox>
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    36
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    37
#include "upload_video.h"
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    38
#include "hwconsts.h"
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    39
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    40
// User-agent string used in http requests.
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    41
static const QByteArray UserAgent = ("Hedgewars-QtFrontend/" + *cVersionString).toAscii();
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    42
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    43
// This is developer key obtained from http://code.google.com/apis/youtube/dashboard/
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    44
// If you are reusing this code outside Hedgewars, don't use this developer key,
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    45
// obtain you own at http://code.google.com/apis/youtube/dashboard/
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    46
static const QByteArray devKey = "AI39si5pKjxR0XgNIlmrEFF-LyYD31rps4g2O5dZTxLgD0fvJ2rHxrMrNFY8FYTZrzeI3VlaFVQLKfFnSBugvdZmy8vFzRDefQ";
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    47
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    48
HWUploadVideoDialog::HWUploadVideoDialog(QWidget* parent, const QString &filename, QNetworkAccessManager* netManager) : QDialog(parent)
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    49
{
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    50
    this->filename = filename;
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    51
    this->netManager = netManager;
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    52
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    53
    setWindowTitle(tr("Upload video"));
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    54
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    55
    // Google requires us to display this, see https://developers.google.com/youtube/terms
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    56
    QString GoogleNotice =
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    57
        "By clicking 'upload,' you certify that you own all rights to the content or that "
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    58
        "you are authorized by the owner to make the content publicly available on YouTube, "
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    59
        "and that it otherwise complies with the YouTube Terms of Service located at "
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    60
        "http://www.youtube.com/t/terms.";
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    61
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    62
    // youtube doesn't understand this characters, even when they are properly escaped
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    63
    // (either with CDATA or with &lt or &gt)
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    64
    QRegExp rx("[^<>]*");
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    65
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    66
    int row = 0;
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    67
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    68
    QGridLayout * layout = new QGridLayout(this);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    69
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    70
    QLabel * lbLabel = new QLabel(this);
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    71
    lbLabel->setWordWrap(true);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    72
    lbLabel->setText(QLabel::tr(
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    73
                         "Please provide either the YouTube account name "
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    74
                         "or the email address associated with the Google Account."));
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    75
    layout->addWidget(lbLabel, row++, 0, 1, 2);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    76
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    77
    lbLabel = new QLabel(this);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    78
    lbLabel->setText(QLabel::tr("Account name (or email): "));
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    79
    layout->addWidget(lbLabel, row, 0);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    80
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    81
    leAccount = new QLineEdit(this);
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    82
    layout->addWidget(leAccount, row++, 1);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    83
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    84
    lbLabel = new QLabel(this);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    85
    lbLabel->setText(QLabel::tr("Password: "));
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    86
    layout->addWidget(lbLabel, row, 0);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    87
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    88
    lePassword = new QLineEdit(this);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    89
    lePassword->setEchoMode(QLineEdit::Password);
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    90
    layout->addWidget(lePassword, row++, 1);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    91
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    92
    cbSave = new QCheckBox(this);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    93
    cbSave->setText(QCheckBox::tr("Save account name and password"));
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
    94
    layout->addWidget(cbSave, row++, 0, 1, 2);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    95
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    96
    QFrame * hr = new QFrame(this);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    97
    hr->setFrameStyle(QFrame::HLine);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    98
    hr->setLineWidth(3);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    99
    hr->setFixedHeight(10);
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   100
    layout->addWidget(hr, row++, 0, 1, 2);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   101
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   102
    lbLabel = new QLabel(this);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   103
    lbLabel->setText(QLabel::tr("Video title: "));
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   104
    layout->addWidget(lbLabel, row, 0);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   105
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   106
    leTitle = new QLineEdit(this);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   107
    leTitle->setText(filename);
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   108
    leTitle->setValidator(new QRegExpValidator(rx));
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   109
    layout->addWidget(leTitle, row++, 1);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   110
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   111
    lbLabel = new QLabel(this);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   112
    lbLabel->setText(QLabel::tr("Video description: "));
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   113
    layout->addWidget(lbLabel, row++, 0, 1, 2);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   114
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   115
    teDescription = new QPlainTextEdit(this);
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   116
    layout->addWidget(teDescription, row++, 0, 1, 2);
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   117
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   118
    lbLabel = new QLabel(this);
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   119
    lbLabel->setText(QLabel::tr("Tags (comma separated): "));
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   120
    layout->addWidget(lbLabel, row, 0);
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   121
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   122
    leTags = new QLineEdit(this);
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   123
    leTags->setText("hedgewars");
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   124
    leTags->setMaxLength(500);
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   125
    leTags->setValidator(new QRegExpValidator(rx));
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   126
    layout->addWidget(leTags, row++, 1);
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   127
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   128
    cbPrivate = new QCheckBox(this);
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   129
    cbPrivate->setText(QCheckBox::tr("Video is private"));
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   130
    layout->addWidget(cbPrivate, row++, 0, 1, 2);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   131
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   132
    hr = new QFrame(this);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   133
        hr->setFrameStyle(QFrame::HLine);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   134
        hr->setLineWidth(3);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   135
        hr->setFixedHeight(10);
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   136
        layout->addWidget(hr, row++, 0, 1, 2);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   137
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   138
    lbLabel = new QLabel(this);
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   139
    lbLabel->setWordWrap(true);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   140
    lbLabel->setText(GoogleNotice);
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   141
    layout->addWidget(lbLabel, row++, 0, 1, 2);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   142
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   143
    QDialogButtonBox* dbbButtons = new QDialogButtonBox(this);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   144
    btnUpload = dbbButtons->addButton(tr("Upload"), QDialogButtonBox::ActionRole);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   145
    QPushButton * pbCancel = dbbButtons->addButton(QDialogButtonBox::Cancel);
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   146
    layout->addWidget(dbbButtons, row++, 0, 1, 2);
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   147
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   148
   /* hr = new QFrame(this);
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   149
        hr->setFrameStyle(QFrame::HLine);
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   150
        hr->setLineWidth(3);
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   151
        hr->setFixedHeight(10);
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   152
        layout->addWidget(hr, row++, 0, 1, 2);*/
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   153
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   154
    connect(btnUpload, SIGNAL(clicked()), this, SLOT(upload()));
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   155
    connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject()));
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   156
}
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   157
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   158
void HWUploadVideoDialog::setEditable(bool editable)
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   159
{
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   160
    leTitle->setEnabled(editable);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   161
    leAccount->setEnabled(editable);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   162
    lePassword->setEnabled(editable);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   163
    btnUpload->setEnabled(editable);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   164
}
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   165
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   166
void HWUploadVideoDialog::upload()
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   167
{
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   168
    setEditable(false);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   169
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   170
    // Documentation is at https://developers.google.com/youtube/2.0/developers_guide_protocol_clientlogin#ClientLogin_Authentication
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   171
    QNetworkRequest request;
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   172
    request.setUrl(QUrl("https://www.google.com/accounts/ClientLogin"));
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   173
    request.setRawHeader("User-Agent", UserAgent);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   174
    request.setRawHeader("Content-Type", "application/x-www-form-urlencoded");
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   175
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   176
    QString account(QUrl::toPercentEncoding(leAccount->text()));
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   177
    QString pass(QUrl::toPercentEncoding(lePassword->text()));
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   178
    QByteArray data = QString("Email=%1&Passwd=%2&service=youtube&source=Hedgewars").arg(account).arg(pass).toAscii();
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   179
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   180
    QNetworkReply *reply = netManager->post(request, data);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   181
    connect(reply, SIGNAL(finished()), this, SLOT(authFinished()));
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   182
}
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   183
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   184
static QString XmlEscape(const QString& str)
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   185
{
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   186
    QString str2 = str;
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   187
    // youtube doesn't understand this characters, even when they are properly escaped
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   188
    // (either with CDATA or with &lt; &gt;)
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   189
    str2.replace('<', ' ').replace('>', ' ');
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   190
    return "<![CDATA[" + str2.replace("]]>", "]]]]><![CDATA[>") + "]]>";
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   191
}
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   192
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   193
void HWUploadVideoDialog::authFinished()
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   194
{
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   195
    QNetworkReply *reply = (QNetworkReply*)sender();
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   196
    reply->deleteLater();
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   197
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   198
    int HttpCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   199
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   200
    QByteArray answer = reply->readAll();
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   201
    QString authToken = "";
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   202
    QList<QByteArray> lines = answer.split('\n');
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   203
    foreach (const QByteArray& line, lines)
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   204
    {
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   205
        QString str(line);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   206
        if (!str.startsWith("Auth=", Qt::CaseInsensitive))
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   207
            continue;
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   208
        str.remove(0, 5);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   209
        authToken = str;
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   210
        break;
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   211
    }
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   212
    if (authToken.isEmpty())
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   213
    {
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   214
        QString errorStr = QMessageBox::tr("Error while authenticating at google.com:\n");
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   215
        if (HttpCode == 403)
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   216
            errorStr += QMessageBox::tr("Login or password is incorrect");
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   217
        else
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   218
            errorStr += reply->errorString();
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   219
        QMessageBox::warning(this, QMessageBox::tr("Error"), errorStr);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   220
        setEditable(true);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   221
        return;
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   222
    }
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   223
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   224
    QByteArray auth = ("GoogleLogin auth=" + authToken).toAscii();
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   225
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   226
    // We have authenticated, now we can send metadata and start upload
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   227
    // Documentation is here: https://developers.google.com/youtube/2.0/developers_guide_protocol_resumable_uploads#Resumable_uploads
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   228
    QByteArray body =
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   229
            "<?xml version=\"1.0\"?>"
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   230
            "<entry xmlns=\"http://www.w3.org/2005/Atom\" "
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   231
                "xmlns:media=\"http://search.yahoo.com/mrss/\" "
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   232
                "xmlns:yt=\"http://gdata.youtube.com/schemas/2007\">"
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   233
                "<media:group>"
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   234
                  //  "<yt:incomplete/>"
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   235
                    "<media:category "
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   236
                        "scheme=\"http://gdata.youtube.com/schemas/2007/categories.cat\">Games"
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   237
                    "</media:category>"
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   238
                    "<media:title type=\"plain\">"
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   239
                        + XmlEscape(leTitle->text()).toUtf8() +
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   240
                    "</media:title>"
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   241
                    "<media:description type=\"plain\">"
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   242
                        + XmlEscape(teDescription->toPlainText()).toUtf8() +
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   243
                    "</media:description>"
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   244
                    "<media:keywords type=\"plain\">"
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   245
                        + XmlEscape(leTags->text()).toUtf8() +
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   246
                    "</media:keywords>"
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   247
                    + (cbPrivate->isChecked()? "<yt:private/>" : "") +
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   248
                "</media:group>"
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   249
            "</entry>";
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   250
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   251
    QNetworkRequest request;
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   252
    request.setUrl(QUrl("http://uploads.gdata.youtube.com/resumable/feeds/api/users/default/uploads"));
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   253
    request.setRawHeader("User-Agent", UserAgent);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   254
    request.setRawHeader("Authorization", auth);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   255
    request.setRawHeader("GData-Version", "2");
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   256
    request.setRawHeader("X-GData-Key", "key=" + devKey);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   257
    request.setRawHeader("Slug", filename.toUtf8());
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   258
    request.setRawHeader("Content-Type", "application/atom+xml; charset=UTF-8");
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   259
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   260
    reply = netManager->post(request, body);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   261
    connect(reply, SIGNAL(finished()), this, SLOT(startUpload()));
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   262
}
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   263
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   264
void HWUploadVideoDialog::startUpload()
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   265
{
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   266
    QNetworkReply *reply = (QNetworkReply*)sender();
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   267
    reply->deleteLater();
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   268
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   269
    location = QString::fromAscii(reply->rawHeader("Location"));
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   270
    if (location.isEmpty())
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   271
    {
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   272
        QString errorStr = QMessageBox::tr("Error while sending metadata to youtube.com:\n");
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   273
        errorStr += reply->errorString();
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7447
diff changeset
   274
        QMessageBox::warning(this, QMessageBox::tr("Error"), errorStr);
7447
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   275
        setEditable(true);
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   276
        return;
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   277
    }
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   278
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   279
    accept();
01111960a48d uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   280
}