Git commit 1ac705b47940e859dde2cbccd24dabc8bb181ff3 by Montel Laurent. Committed on 08/12/2016 at 12:29. Pushed by mlaurent into branch 'master'. Fix signal/slot. Make sure to delete dialog. Clean up M +14 -19 src/qt-oauth-lib/logindialog.cpp M +7 -5 src/qt-oauth-lib/logindialog.h M +2 -2 src/qt-oauth-lib/oauth2.cpp M +2 -1 src/utils/resourcewidget.cpp https://commits.kde.org/kdenlive/1ac705b47940e859dde2cbccd24dabc8bb181ff3 diff --git a/src/qt-oauth-lib/logindialog.cpp b/src/qt-oauth-lib/logindialo= g.cpp index e6f2660cf..8222fbb63 100644 --- a/src/qt-oauth-lib/logindialog.cpp +++ b/src/qt-oauth-lib/logindialog.cpp @@ -40,14 +40,16 @@ #include "kdenlive_debug.h" #include = -LoginDialog::LoginDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::LoginDialog) +LoginDialog::LoginDialog(QWidget *parent) + : QDialog(parent), + ui(new Ui::LoginDialog) { ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + setWindowTitle(i18n("Freesound Login")); + connect(ui->CancelButton, &QPushButton::clicked, this, &LoginDialog::s= lotRejected); connect(ui->GetHQpreview, &QPushButton::clicked, this, &LoginDialog::s= lotGetHQPreview); - setWindowTitle(i18n("Freesound Login")); ui->FreeSoundLoginLabel->setText(i18n("Enter your freesound account de= tails to download the highest quality version of this file. Or use the High= Quality preview file instead (no freesound account required).")); // ui->textBrowser connect(ui->webView, &QWebView::urlChanged, this, &LoginDialog::urlCha= nged); @@ -60,7 +62,7 @@ LoginDialog::~LoginDialog() = void LoginDialog::slotGetHQPreview() { - emit UseHQPreview(); + emit useHQPreview(); QDialog::accept(); } = @@ -79,40 +81,33 @@ void LoginDialog::slotRejected() void LoginDialog::urlChanged(const QUrl &url) { //qCDebug(KDENLIVE_LOG) << "URL =3D" << url; - QString str =3D url.toString(); - int posCode =3D str.indexOf(QLatin1String("&code=3D")); - int posErr =3D str.indexOf(QLatin1String("&error=3D")); + const QString str =3D url.toString(); + const int posCode =3D str.indexOf(QLatin1String("&code=3D")); + const int posErr =3D str.indexOf(QLatin1String("&error=3D")); if(posCode !=3D -1) { - - m_strAuthCode =3Dstr.mid(posCode+6) ; - emit AuthCodeObtained(); + m_strAuthCode =3Dstr.mid(posCode+6); + emit authCodeObtained(); QDialog::accept(); - - } - if(posErr !=3D -1) + } else if(posErr !=3D -1) { - QString sError =3Dstr.mid(posErr+7) ; if (sError=3D=3DQLatin1String("access_denied") ) { emit accessDenied(); } QDialog::accept(); - } } = = = -QString LoginDialog::authCode() +QString LoginDialog::authCode() const { return m_strAuthCode; } = - void LoginDialog::setLoginUrl(const QUrl& url) { ui->webView->setUrl(url); - } diff --git a/src/qt-oauth-lib/logindialog.h b/src/qt-oauth-lib/logindialog.h index b936bdbb9..2e4e410d8 100644 --- a/src/qt-oauth-lib/logindialog.h +++ b/src/qt-oauth-lib/logindialog.h @@ -60,14 +60,15 @@ public: explicit LoginDialog(QWidget *parent =3D Q_NULLPTR); ~LoginDialog(); void setLoginUrl(const QUrl& url); - QString authCode(); + + QString authCode() const; = signals: /** - * @brief AuthCodeObtained - emited when freesound gives us an Authori= sation code \n + * @brief authCodeObtained - emited when freesound gives us an Authori= sation code \n * Authorisation codes last 10mins and must be exchanged for an access= token in that time */ - void AuthCodeObtained(); + void authCodeObtained(); /** * @brief accessDenied -signal emmited if freesound denies acess - eg = bad password or user has denied access to Kdenlive app. */ @@ -77,15 +78,16 @@ signals: */ void canceled(); /** - * @brief UseHQPreview - signal emmited when user clicks the "use HQ p= review" button in the logon dialog + * @brief useHQPreview - signal emmited when user clicks the "use HQ p= review" button in the logon dialog */ - void UseHQPreview(); + void useHQPreview(); = private slots: void urlChanged(const QUrl& url); = void slotGetHQPreview(); void slotRejected(); + private: Ui::LoginDialog *ui; QString m_strAuthCode; diff --git a/src/qt-oauth-lib/oauth2.cpp b/src/qt-oauth-lib/oauth2.cpp index 84417d0a5..82353003e 100644 --- a/src/qt-oauth-lib/oauth2.cpp +++ b/src/qt-oauth-lib/oauth2.cpp @@ -78,11 +78,11 @@ OAuth2::OAuth2(QWidget* parent) m_bAccessTokenRec=3Dtrue; m_strAccessToken=3DstrAccessTokenFromSettings; } - connect(m_pLoginDialog, &LoginDialog::AuthCodeObtained, this, &OAuth2:= :SlotAuthCodeObtained); + connect(m_pLoginDialog, &LoginDialog::authCodeObtained, this, &OAuth2:= :SlotAuthCodeObtained); = connect(m_pLoginDialog, &LoginDialog::accessDenied, this, &OAuth2::Slo= tAccessDenied); connect(m_pLoginDialog, &LoginDialog::canceled, this, &OAuth2::SlotCan= celed); - connect(m_pLoginDialog, &LoginDialog::UseHQPreview, this, &OAuth2::Slo= tDownloadHQPreview); + connect(m_pLoginDialog, &LoginDialog::useHQPreview, this, &OAuth2::Slo= tDownloadHQPreview); connect(this, &OAuth2::AuthCodeObtained, this, &OAuth2::SlotAuthCodeOb= tained); } /** diff --git a/src/utils/resourcewidget.cpp b/src/utils/resourcewidget.cpp index ffcfec794..35cea8aba 100644 --- a/src/utils/resourcewidget.cpp +++ b/src/utils/resourcewidget.cpp @@ -56,6 +56,7 @@ = ResourceWidget::ResourceWidget(const QString &folder, QWidget *parent) : QDialog(parent), + m_pOAuth2(Q_NULLPTR), m_folder(folder), m_currentService(Q_NULLPTR), m_movie(Q_NULLPTR) @@ -805,7 +806,7 @@ QString ResourceWidget::GetSaveFileNameAndPathS(const Q= String &path, const QStri QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (ret =3D=3D QMessageBox::No) { - return QLatin1String(""); + return QString(); } } return saveUrlstring;