Commit 34ddc5a5 authored by Julius Künzel's avatar Julius Künzel Committed by Jean-Baptiste Mardelle
Browse files

Improve and fix ressource manager, add option to add license attribution

to project notes
parent b4e2e0d7
Pipeline #47555 passed with stage
in 10 minutes and 38 seconds
......@@ -2899,6 +2899,11 @@ void MainWindow::slotAddProjectClip(const QUrl &url, const QString &folderInfo)
pCore->bin()->droppedUrls(QList<QUrl>() << url, folderInfo);
}
void MainWindow::slotAddTextNote(const QString &text)
{
pCore->projectManager()->slotAddTextNote(text);
}
void MainWindow::slotAddProjectClipList(const QList<QUrl> &urls)
{
pCore->bin()->droppedUrls(urls);
......@@ -3734,7 +3739,10 @@ void MainWindow::slotDownloadResources()
}
auto *d = new ResourceWidget(currentFolder);
connect(d, &ResourceWidget::addClip, this, &MainWindow::slotAddProjectClip);
connect(d, &ResourceWidget::addLicenseInfo, this, &MainWindow::slotAddTextNote);
d->show();
d->raise();
d->activateWindow();
}
void MainWindow::slotProcessImportKeyframes(GraphicsRectItem type, const QString &tag, const QString &keyframes)
......
......@@ -380,6 +380,7 @@ private slots:
void slotAddEffect(QAction *result);
void slotAddTransition(QAction *result);
void slotAddProjectClip(const QUrl &url, const QString &folderInfo);
void slotAddTextNote(const QString &text);
void slotAddProjectClipList(const QList<QUrl> &urls);
void slotChangeTool(QAction *action);
void slotChangeEdit(QAction *action);
......
......@@ -215,6 +215,15 @@ void NotesWidget::addProjectNote()
emit insertNotesTimecode();
}
void NotesWidget::addTextNote(const QString &text)
{
if (!textCursor().atBlockStart()) {
textCursor().movePosition(QTextCursor::EndOfBlock);
insertPlainText(QStringLiteral("\n"));
}
emit insertTextNote(text);
}
void NotesWidget::insertFromMimeData(const QMimeData *source)
{
QString pastedText = source->text();
......
......@@ -36,6 +36,10 @@ public:
~NotesWidget() override;
/** @brief insert current timeline timecode and focus widget to allow entering quick note */
void addProjectNote();
/** @brief insert given text and focus widget to allow entering quick note
* @param text the text
*/
void addTextNote(const QString &text);
protected:
void mouseMoveEvent(QMouseEvent *e) override;
......@@ -54,6 +58,7 @@ private:
signals:
void insertNotesTimecode();
void insertTextNote(const QString &text);
void seekProject(int);
void reAssign(QStringList anchors, QList <QPoint> points);
};
......
......@@ -35,6 +35,8 @@ NotesPlugin::NotesPlugin(ProjectManager *projectManager)
lay->addWidget(m_widget);
container->setLayout(lay);
connect(m_widget, &NotesWidget::insertNotesTimecode, this, &NotesPlugin::slotInsertTimecode);
connect(m_widget, &NotesWidget::insertTextNote, this, &NotesPlugin::slotInsertText);
connect(m_widget, &NotesWidget::reAssign, this, &NotesPlugin::slotReAssign);
m_widget->setTabChangesFocus(true);
m_widget->setPlaceholderText(i18n("Enter your project notes here ..."));
......@@ -126,6 +128,11 @@ void NotesPlugin::slotReAssign(QStringList anchors, QList <QPoint> points)
}
}
void NotesPlugin::slotInsertText(const QString &text)
{
m_widget->insertHtml(text);
}
NotesWidget *NotesPlugin::widget()
{
return m_widget;
......
......@@ -42,6 +42,8 @@ private slots:
void slotInsertTimecode();
/** @brief Re-assign timestamps to current Bin Clip. */
void slotReAssign(QStringList anchors, QList <QPoint> points);
/** @brief Insert the given text into the widget. */
void slotInsertText(const QString &text);
private:
NotesWidget *m_widget;
......
......@@ -743,6 +743,14 @@ void ProjectManager::slotAddProjectNote()
m_notesPlugin->widget()->addProjectNote();
}
void ProjectManager::slotAddTextNote(const QString &text)
{
m_notesPlugin->showDock();
m_notesPlugin->widget()->raise();
m_notesPlugin->widget()->setFocus();
m_notesPlugin->widget()->addTextNote(text);
}
void ProjectManager::prepareSave()
{
pCore->projectItemModel()->saveDocumentProperties(pCore->window()->getMainTimeline()->controller()->documentProperties(), m_project->metadata(),
......
......@@ -169,6 +169,8 @@ public slots:
void activateAsset(const QVariantMap &effectData);
/** @brief insert current timeline timecode in notes widget and focus widget to allow entering quick note */
void slotAddProjectNote();
/** @brief insert license text in notes widget and focus widget to allow entering quick note */
void slotAddTextNote(const QString &text);
private slots:
void slotRevert();
......
......@@ -47,7 +47,6 @@ LoginDialog::LoginDialog(QWidget *parent)
m_ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
setWindowTitle(i18n("Freesound Login"));
connect(m_ui->CancelButton, &QPushButton::clicked, this, &LoginDialog::slotRejected);
connect(m_ui->GetHQpreview, &QPushButton::clicked, this, &LoginDialog::slotGetHQPreview);
m_ui->FreeSoundLoginLabel->setText(
......@@ -55,6 +54,10 @@ LoginDialog::LoginDialog(QWidget *parent)
"preview file instead (no freesound account required)."));
// m_ui->textBrowser
connect(m_ui->webView, &QWebEngineView::urlChanged, this, &LoginDialog::urlChanged);
connect(m_ui->webView, &QWebEngineView::loadFinished, this, [&](){
qDebug() << "LoginDialog: loadFinished";
this->setEnabled(true);
});
}
LoginDialog::~LoginDialog()
......@@ -62,6 +65,12 @@ LoginDialog::~LoginDialog()
delete m_ui;
}
void LoginDialog::open()
{
QDialog::open();
setEnabled(false);
}
void LoginDialog::slotGetHQPreview()
{
emit useHQPreview();
......
......@@ -82,6 +82,9 @@ signals:
*/
void useHQPreview();
public slots:
void open();
private slots:
void urlChanged(const QUrl &url);
......
......@@ -82,7 +82,6 @@ void OAuth2::buildLoginDialog()
{
m_pLoginDialog = new LoginDialog(m_pParent);
connect(m_pLoginDialog, &LoginDialog::authCodeObtained, this, &OAuth2::SlotAuthCodeObtained);
connect(m_pLoginDialog, &LoginDialog::accessDenied, this, &OAuth2::SlotAccessDenied);
connect(m_pLoginDialog, &LoginDialog::canceled, this, &OAuth2::SlotCanceled);
connect(m_pLoginDialog, &LoginDialog::useHQPreview, this, &OAuth2::SlotDownloadHQPreview);
......@@ -144,19 +143,16 @@ QString OAuth2::loginUrl()
*/
void OAuth2::obtainAccessToken()
{
if (m_bAccessTokenRec) {
emit accessTokenReceived(m_strAccessToken);
// if we already have the access token then carry on as if we have already logged on and have the access token
emit accessTokenReceived(m_strAccessToken); // if we already have the access token then carry on as if we have already logged on and have the access token
} else {
// login to free sound via our login dialog
// login to free sound via our login dialog
QUrl vUrl(loginUrl());
if (!m_pLoginDialog) {
buildLoginDialog();
}
m_pLoginDialog->setLoginUrl(vUrl);
m_pLoginDialog->exec();
m_pLoginDialog->open();
}
}
......@@ -167,6 +163,7 @@ void OAuth2::SlotAccessDenied()
{
qCDebug(KDENLIVE_LOG) << "access denied";
emit accessDenied();
m_pLoginDialog = nullptr;
}
/**
* @brief OAuth2::SlotAuthCodeObtained - fires when the LogonDialog has obtained an Auth Code and has sent the LogonDialog::AuthCodeObtained signal
......@@ -177,6 +174,7 @@ void OAuth2::SlotAccessDenied()
void OAuth2::SlotAuthCodeObtained()
{
m_strAuthorizationCode = m_pLoginDialog->authCode(); // get the Auth code we have obtained
m_pLoginDialog = nullptr;
// has a lifetime of 10 minutes
OAuth2::RequestAccessCode(false, m_strAuthorizationCode);
}
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>519</width>
<height>368</height>
<height>420</height>
</rect>
</property>
<property name="windowTitle">
......@@ -131,20 +131,6 @@
<string/>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="1" colspan="2">
<widget class="QPushButton" name="button_import">
<property name="text">
<string>Import</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QPushButton" name="button_preview">
<property name="text">
<string>Preview</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="KUrlLabel" name="item_license">
<property name="text">
......@@ -171,10 +157,10 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label">
<item row="6" column="1" colspan="2">
<widget class="QPushButton" name="button_import">
<property name="text">
<string>License</string>
<string>Import</string>
</property>
</widget>
</item>
......@@ -185,6 +171,33 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QPushButton" name="button_preview">
<property name="text">
<string>Preview</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>License</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="cb_licenseTitle">
<property name="text">
<string>Add attribution text to project notes</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
......
......@@ -47,6 +47,7 @@ struct OnlineItemInfo
QString author;
QString authorUrl;
QString description;
int filesize;
QString fileType;
QString HQpreview;
};
......
......@@ -122,7 +122,6 @@ void FreeSound::slotShowResults(KJob *job)
QVariant authorInfo = soundmap.value(QStringLiteral("username"));
item->setData(authorRole, authorInfo);
item->setData(authorUrl,
QStringLiteral("http://freesound.org/people/") + soundmap.value(QStringLiteral("username")).toString());
item->setData(licenseRole, soundmap.value(QStringLiteral("license")));
......@@ -221,6 +220,7 @@ void FreeSound::slotParseResults(KJob *job)
QStringLiteral("</td></tr>");
}
if (info.contains(QStringLiteral("filesize"))) {
m_metaInfo.insert(QStringLiteral("filesize"), info.value(QStringLiteral("filesize")).toString());
html += QLatin1String("<tr class=\"cellone\">");
KIO::filesize_t fSize = info.value(QStringLiteral("filesize")).toDouble();
html += QStringLiteral("<td>") + i18n("File size") + QStringLiteral("</td><td>") + KIO::convertSize(fSize) + QStringLiteral("</td></tr>");
......@@ -260,6 +260,9 @@ void FreeSound::slotParseResults(KJob *job)
if (info.contains(QStringLiteral("type"))) { // wav, aif, mp3 etc
m_metaInfo.insert(QStringLiteral("fileType"), info.value(QStringLiteral("type")).toString());
}
if (info.contains(QStringLiteral("url"))) {
m_metaInfo.insert(QStringLiteral("url"), info.value(QStringLiteral("url")).toString());
}
}
emit gotMetaInfo(html);
......
......@@ -33,6 +33,7 @@
#include <QNetworkConfigurationManager>
#include <QPushButton>
#include <QTemporaryFile>
#include <QProgressDialog>
#include <KConfigGroup>
#include <KFileItem>
......@@ -88,6 +89,7 @@ ResourceWidget::ResourceWidget(QString folder, QWidget *parent)
connect(info_browser, &QTextBrowser::anchorClicked, this, &ResourceWidget::slotOpenLink);
m_networkAccessManager = new QNetworkAccessManager(this);
connect(m_networkAccessManager, &QNetworkAccessManager::finished, this, &ResourceWidget::DownloadRequestFinished);
m_autoPlay = new QAction(i18n("Auto Play"), this);
m_autoPlay->setCheckable(true);
......@@ -171,6 +173,9 @@ void ResourceWidget::slotStartSearch(int page)
*/
void ResourceWidget::slotUpdateCurrentSound()
{
// sound_box is the group of objects in the Online resources window on the RHS with the preview and import buttons and the details about the currently selected item.
sound_box->setEnabled(false);
if (!m_autoPlay->isChecked()) {
m_currentService->stopItemPreview(nullptr);
button_preview->setText(i18n("Preview"));
......@@ -183,9 +188,6 @@ void ResourceWidget::slotUpdateCurrentSound()
m_meta.clear();
QListWidgetItem *item = search_results->currentItem(); // get the item the user selected
if (!item) {
sound_box->setEnabled(false); // sound_box is the group of objects in the Online resources window on the RHS with the
// preview and import buttons and the details about the currently selected item.
// if nothing is selected then we disable all these
return;
}
m_currentInfo = m_currentService->displayItemDetails(item); // Not so much displaying the items details
......@@ -194,7 +196,6 @@ void ResourceWidget::slotUpdateCurrentSound()
if (m_autoPlay->isChecked() && m_currentService->hasPreview) {
m_currentService->startItemPreview(item);
}
sound_box->setEnabled(true); // enable the group with the preview and import buttons
QString title = "<h3>" + m_currentInfo.itemName; // title is not just a title. It is a whole lot of HTML for displaying the
// the info for the current item.
// updateLayout() adds m_image,m_desc and m_meta to the title to make up the html that displays on the widget
......@@ -225,6 +226,8 @@ void ResourceWidget::slotUpdateCurrentSound()
if (!m_currentInfo.license.isEmpty()) {
parseLicense(m_currentInfo.license);
}
sound_box->setEnabled(true); //enable the group with the preview and import buttons
}
/**
......@@ -315,6 +318,12 @@ void ResourceWidget::slotDisplayMetaInfo(const QMap<QString, QString> &metaInfo)
if (metaInfo.contains(QStringLiteral("HQpreview"))) {
m_currentInfo.HQpreview = metaInfo.value(QStringLiteral("HQpreview"));
}
if (metaInfo.contains(QStringLiteral("filesize"))) {
m_currentInfo.filesize = metaInfo.value(QStringLiteral("filesize")).toInt();
}
if (metaInfo.contains(QStringLiteral("url"))) {
m_currentInfo.infoUrl = metaInfo.value(QStringLiteral("url"));
}
}
/**
......@@ -397,11 +406,10 @@ void ResourceWidget::slotSaveItem(const QString &originalUrl)
if (m_currentService->serviceType != AbstractService::FREESOUND) {
saveUrl = QUrl::fromLocalFile(m_saveLocation);
}
slotSetDescription(QString());
button_import->setEnabled(false); // disable buttons while download runs. enabled in slotGotFile
#ifdef QT5_USE_WEBENGINE
if (m_currentService->serviceType == AbstractService::FREESOUND) { // open a dialog to authenticate with free sound and download the file
m_pOAuth2->obtainAccessToken(); // when job finished ResourceWidget::slotAccessTokenReceived will be called
m_pOAuth2->obtainAccessToken(); // when job finished ResourceWidget::slotAccessTokenReceived will be called
} else { // not freesound - do file download via a KIO file copy job
DoFileDownload(srcUrl, QUrl(saveUrl));
}
......@@ -544,6 +552,7 @@ void ResourceWidget::slotChangeService()
button_preview->setVisible(m_currentService->hasPreview);
button_import->setVisible(!m_currentService->inlineDownload);
cb_licenseTitle->setVisible(!m_currentService->inlineDownload);
search_info->setText(QString());
if (!search_text->text().isEmpty()) {
......@@ -600,33 +609,77 @@ void ResourceWidget::slotPreviousPage()
* @param licenseUrl
*/
void ResourceWidget::parseLicense(const QString &licenseUrl)
{
QString licenseName = licenseNameFromUrl(licenseUrl, false);
item_license->setText(licenseName);
item_license->setUrl(licenseUrl);
}
/**
* @brief ResourceWidget::licenseNameFromUrl returns a name for the licence based on the license URL
* @param licenseUrl
* @param shortName wether the like "Attribution-NonCommercial-ShareAlike 3.0" or the short name like "CC BY-ND-SA 3.0" should be returned
* @return the license name
*/
QString ResourceWidget::licenseNameFromUrl(const QString &licenseUrl, const bool shortName)
{
QString licenseName;
QString licenseShortName;
// TODO translate them ?
if (licenseUrl.contains(QStringLiteral("/sampling+/"))) {
licenseName = QStringLiteral("Sampling+");
} else if (licenseUrl.contains(QStringLiteral("/by/"))) {
licenseName = QStringLiteral("Attribution");
licenseShortName = QStringLiteral("CC BY");
} else if (licenseUrl.contains(QStringLiteral("/by-nd/"))) {
licenseName = QStringLiteral("Attribution-NoDerivs");
licenseShortName = QStringLiteral("CC BY-ND");
} else if (licenseUrl.contains(QStringLiteral("/by-nc-sa/"))) {
licenseName = QStringLiteral("Attribution-NonCommercial-ShareAlike");
licenseShortName = QStringLiteral("CC BY-ND-SA");
} else if (licenseUrl.contains(QStringLiteral("/by-sa/"))) {
licenseName = QStringLiteral("Attribution-ShareAlike");
licenseShortName = QStringLiteral("CC BY-SA");
} else if (licenseUrl.contains(QStringLiteral("/by-nc/"))) {
licenseName = QStringLiteral("Attribution-NonCommercial");
licenseShortName = QStringLiteral("CC BY-NC");
} else if (licenseUrl.contains(QStringLiteral("/by-nc-nd/"))) {
licenseName = QStringLiteral("Attribution-NonCommercial-NoDerivs");
licenseShortName = QStringLiteral("CC BY-NC-ND");
} else if (licenseUrl.contains(QLatin1String("/publicdomain/zero/"))) {
licenseName = QStringLiteral("Creative Commons 0");
licenseShortName = QStringLiteral("CC 0");
} else if (licenseUrl.endsWith(QLatin1String("/publicdomain")) || licenseUrl.contains(QLatin1String("openclipart.org/share"))) {
licenseName = QStringLiteral("Public Domain");
} else {
licenseName = i18n("Unknown");
licenseShortName = i18n("Unknown");
}
if (licenseUrl.contains(QStringLiteral("/1.0"))) {
licenseName.append(QStringLiteral(" 1.0"));
licenseShortName.append(QStringLiteral(" 1.0"));
} else if (licenseUrl.contains(QStringLiteral("/2.0"))) {
licenseName.append(QStringLiteral(" 2.0"));
licenseShortName.append(QStringLiteral(" 2.0"));
} else if (licenseUrl.contains(QStringLiteral("/2.5"))) {
licenseName.append(QStringLiteral(" 2.5"));
licenseShortName.append(QStringLiteral(" 2.5"));
} else if (licenseUrl.contains(QStringLiteral("/3.0"))) {
licenseName.append(QStringLiteral(" 3.0"));
licenseShortName.append(QStringLiteral(" 3.0"));
} else if (licenseUrl.contains(QStringLiteral("/4.0"))) {
licenseName.append(QStringLiteral(" 4.0"));
licenseShortName.append(QStringLiteral(" 4.0"));
}
if(shortName) {
return licenseShortName;
} else {
return licenseName;
}
item_license->setText(licenseName);
item_license->setUrl(licenseUrl);
}
/**
......@@ -666,7 +719,7 @@ void ResourceWidget::slotSetDescription(const QString &desc)
* @param desc /n
* The meta data is info on the sounds length, samplerate, filesize and number of channels. This is called when gotMetaInfo(Qstring) signal fires. That signal
* is passing html in the parameter
* This function is updating the html (m_meta) in the ResourceWidget and then calls updateLayout()
* This function is updating the html (m_meta) in the ResourceWidget and then calls updateLayout()
* which updates actual widget
*/
void ResourceWidget::slotSetMetadata(const QString &metadata)
......@@ -732,9 +785,7 @@ void ResourceWidget::slotPreviewFinished()
void ResourceWidget::slotFreesoundAccessDenied()
{
button_import->setEnabled(true);
info_browser->setHtml(QStringLiteral("<html>") +
i18n("Access Denied from Freesound. Have you authorised the Kdenlive application on your freesound account?") +
QStringLiteral("</html>"));
KMessageBox::sorry(this, i18n("Access Denied from Freesound. Have you authorised the Kdenlive application on your freesound account?"));
}
/**
......@@ -757,19 +808,16 @@ void ResourceWidget::slotAccessTokenReceived(const QString &sAccessToken)
// eg https://www.freesound.org/apiv2/sounds/39206/download/
request.setRawHeader(QByteArray("Authorization"), QByteArray("Bearer ").append(sAccessToken.toUtf8())); //Space after "Bearer" is necessary
m_meta = QString();
m_desc = QStringLiteral("<br><b>") + i18n("Starting File Download") + QStringLiteral("</b><br>");
updateLayout();
QProgressDialog *pd = new QProgressDialog(i18n("Download in progress"), i18n("Cancel"), 0, m_currentInfo.filesize, this);
pd->setWindowModality(Qt::WindowModal);
QNetworkReply *reply2 = m_networkAccessManager->get(request);
connect(reply2, &QIODevice::readyRead, this, &ResourceWidget::slotReadyRead);
connect(m_networkAccessManager, &QNetworkAccessManager::finished, this, &ResourceWidget::DownloadRequestFinished);
connect(pd, &QProgressDialog::canceled, reply2, &QNetworkReply::abort);
connect(reply2, &QIODevice::readyRead, this, [reply2, pd](){
int pos = static_cast<int> (reply2->bytesAvailable());
pd->setValue(pos);
});
} else {
m_meta = QString();
m_desc = QStringLiteral("<br><b>") + i18n("Error Getting Access Token from Freesound.") + QStringLiteral("</b>");
m_desc.append(QStringLiteral("<br><b>") + i18n("Try importing again to obtain a new freesound connection") + QStringLiteral("</b>"));
updateLayout();
KMessageBox::error(this, i18n("Try importing again to obtain a new freesound connection"), i18n("Error Getting Access Token from Freesound."));
}
}
/**
......@@ -789,26 +837,9 @@ QString ResourceWidget::GetSaveFileNameAndPathS(const QString &path, const QStri
{
return saveUrlstring;
}
if (QFile::exists(saveUrlstring)) {
int ret = QMessageBox::warning(this, i18n("File Exists"), i18n("Do you want to overwrite the existing file?"), QMessageBox::Yes | QMessageBox::No,
QMessageBox::No);
if (ret == QMessageBox::No) {
return QString();
}
}
return saveUrlstring;
}
/**
* @brief ResourceWidget::slotReadyRead
* Fires each time the download of the freesound file grabs some more data.
* Prints dots to the dialog indicating download is progressing.
*/
void ResourceWidget::slotReadyRead()
{
m_desc.append(QLatin1Char('.'));
updateLayout();
}
/**
* @brief ResourceWidget::DownloadRequestFinished
* @param reply
......@@ -834,16 +865,16 @@ void ResourceWidget::DownloadRequestFinished(QNetworkReply *reply)
KMessageBox::information(this, i18n("Resource saved to %1", m_saveLocation), i18n("Data Imported"));
emit addClip(QUrl::fromLocalFile(m_saveLocation), QString()); // MainWindow::slotDownloadResources() links this signal to MainWindow::slotAddProjectClip
if(cb_licenseTitle->isChecked()) {
const QString licenseText("This video uses \"" + m_currentInfo.itemName + "\" (" + m_currentInfo.infoUrl+ ") by \"" + m_currentInfo.author + "\" licensed under " + ResourceWidget::licenseNameFromUrl(m_currentInfo.license, true) + ". To view a copy of this license, visit " + m_currentInfo.license);
emit addLicenseInfo(licenseText); // MainWindow::slotDownloadResources() links this signal to MainWindow::slotAddProjectClip
}
m_desc.append(QStringLiteral("<br>") + i18n("Saved file to") + QStringLiteral("<br>"));
m_desc.append(m_saveLocation);
updateLayout();
} else {
#ifdef QT5_USE_WEBENGINE
m_pOAuth2->ForgetAccessToken();
#endif
m_desc.append(QStringLiteral("<br>") + i18n("Error Saving File"));
updateLayout();
KMessageBox::sorry(this, i18n("Error Saving File"));
}
} else {
......@@ -855,9 +886,7 @@ void ResourceWidget::DownloadRequestFinished(QNetworkReply *reply)
#ifdef QT5_USE_WEBENGINE
m_pOAuth2->ForgetAccessToken();
#endif
m_desc.append(QStringLiteral("<br>") + i18n("Error Downloading File. Error code: %1", reply->error()) + QStringLiteral("<br>"));
m_desc.append(QStringLiteral("<br><b>") + i18n("Try importing again to obtain a new freesound connection") + QStringLiteral("</b>"));
updateLayout();
KMessageBox::sorry(this, i18n("Try importing again to obtain a new freesound connection\nError code: %1", reply->error()), i18n("Error Downloading File"));
}
}
}
......
......@@ -51,6 +51,7 @@ class ResourceWidget : public QDialog, public Ui::FreeSound_UI
public:
explicit ResourceWidget(QString folder, QWidget *parent = nullptr);
~ResourceWidget() override;
QString licenseNameFromUrl(const QString &licenseUrl, const bool shortName);
private slots:
void slotStartSearch(int page = 0);
......@@ -79,7 +80,6 @@ private slots:
void slotSetMaximum(int max);
void slotPreviewFinished();
void slotFreesoundAccessDenied();
void slotReadyRead();
void DownloadRequestFinished(QNetworkReply *reply);