Commit 899951e9 authored by Julius Künzel's avatar Julius Künzel 💬
Browse files

Port away from deprecated KNS methods, use QQC1 only for TreeView

parent deacd43c
Pipeline #246233 failed with stage
in 5 minutes and 50 seconds
......@@ -163,7 +163,6 @@ target_link_libraries(kdenliveLib
KF5::KIOFileWidgets
KF5::KIOWidgets
KF5::NotifyConfig
KF5::NewStuff
KF5::XmlGui
KF5::GuiAddons
KF5::Notifications
......@@ -180,6 +179,14 @@ target_link_libraries(kdenliveLib
${CMAKE_THREAD_LIBS_INIT}
kiss_fft)
if(KF5NewStuff_VERSION VERSION_LESS "5.90")
target_link_libraries(kdenliveLib
KF5::NewStuff)
else()
target_link_libraries(kdenliveLib
KF5::NewStuffWidgets)
endif()
if(USE_VERSIONLESS_TARGETS)
target_link_libraries(kdenliveLib
Qt::Svg
......
This diff is collapsed.
......@@ -31,13 +31,29 @@ UrlListParamWidget::UrlListParamWidget(std::shared_ptr<AssetParameterModel> mode
m_list->setIconSize(QSize(50, 30));
setMinimumHeight(m_list->sizeHint().height());
// setup download
m_download->setHidden(configFile.isEmpty());
if (!configFile.isEmpty()) {
#if KNEWSTUFF_VERSION >= QT_VERSION_CHECK(5, 91, 0)
// TODO: ones we require at least KF 5.91 move this to the *.ui file
m_knsbutton = new KNSWidgets::Button(QString(), configFile, this);
connect(m_knsbutton, &KNSWidgets::Button::dialogFinished, this, [&](const QList<KNSCore::Entry> &changedEntries) {
if (changedEntries.count() > 0) {
if (configFile.contains(QStringLiteral("kdenlive_wipes.knsrc"))) {
MltConnection::refreshLumas();
}
slotRefresh();
}
});
#else
m_knsbutton = new QToolButton(this);
m_knsbutton->setIcon(QIcon::fromTheme(QStringLiteral("edit-download"));
connect(m_knsbutton, &QToolButton::clicked, this, &UrlListParamWidget::downloadNewItems);
#endif
m_value_box->layout()->addWidget(m_knsbutton);
}
// setup the name
m_labelName->setText(m_model->data(m_index, Qt::DisplayRole).toString());
m_isLutList = m_model->getAssetId().startsWith(QLatin1String("avfilter.lut3d"));
slotRefresh();
connect(m_download, &QToolButton::clicked, this, &UrlListParamWidget::downloadNewItems);
UrlListParamWidget::slotRefresh();
// emit the signal of the base class when appropriate
// The connection is ugly because the signal "currentIndexChanged" is overloaded in QComboBox
......@@ -252,6 +268,7 @@ void UrlListParamWidget::openFile()
m_list->setCurrentIndex(m_currentIndex);
}
#if KNEWSTUFF_VERSION < QT_VERSION_CHECK(5, 91, 0)
void UrlListParamWidget::downloadNewItems()
{
const QString configFile = m_model->data(m_index, AssetParameterModel::NewStuffRole).toString();
......@@ -266,3 +283,4 @@ void UrlListParamWidget::downloadNewItems()
slotRefresh();
}
}
#endif
......@@ -9,6 +9,10 @@
#include "ui_urllistparamwidget_ui.h"
#include <QVariant>
#include <QWidget>
#include <knewstuff_version.h>
#if KNEWSTUFF_VERSION >= QT_VERSION_CHECK(5, 91, 0)
#include <KNSWidgets/Button>
#endif
class AssetParameterModel;
......@@ -62,6 +66,11 @@ private:
int m_currentIndex;
bool m_isLutList;
bool m_isLumaList;
#if KNEWSTUFF_VERSION >= QT_VERSION_CHECK(5, 91, 0)
KNSWidgets::Button *m_knsbutton;
#else
QToolButton *m_knsbutton;
#endif
/** @brief Reads the first 30 lines of a .cube LUT file and check for validity
*/
bool isValidCubeFile(const QString &path);
......@@ -79,8 +88,9 @@ public slots:
*/
void openFile();
#if KNEWSTUFF_VERSION < QT_VERSION_CHECK(5, 91, 0)
/** @brief Open KNewStuff dialog to download new LUTs
*/
void downloadNewItems();
#endif
};
......@@ -1268,10 +1268,12 @@ void Core::cleanup()
}
}
#if KNEWSTUFF_VERSION < QT_VERSION_CHECK(5, 98, 0)
int Core::getNewStuff(const QString &config)
{
return m_mainWindow->getNewStuff(config);
}
#endif
void Core::addBin(const QString &id)
{
......
......@@ -9,17 +9,18 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
#include "jobs/taskmanager.h"
#include "kdenlivecore_export.h"
#include "undohelper.hpp"
#include "utils/timecode.h"
#include <KSharedDataCache>
#include <QColor>
#include <QMutex>
#include <QObject>
#include <QColor>
#include <QUrl>
#include <memory>
#include <QPoint>
#include <QThreadPool>
#include <QTextEdit>
#include <KSharedDataCache>
#include <QThreadPool>
#include <QUrl>
#include <knewstuff_version.h>
#include <memory>
#include <unordered_set>
#include "utils/timecode.h"
#include <mlt++/MltProfile.h>
#include <mlt++/MltPlaylist.h>
......@@ -273,10 +274,12 @@ public:
MixAlignment getMixAlign(int cid) const;
/** @brief Closing current document, do some cleanup */
void cleanup();
#if KNEWSTUFF_VERSION < QT_VERSION_CHECK(5, 98, 0)
/** @brief Instantiates a "Get Hot New Stuff" dialog.
* @param configFile configuration file for KNewStuff
* @return number of installed items */
int getNewStuff(const QString &configFile);
#endif
/** @brief Get the frame size of the clip above a composition */
const QSize getCompositionSizeOnTrack(const ObjectId &id);
void loadTimelinePreview(const QString &chunks, const QString &dirty, int enablePreview, Mlt::Playlist &playlist);
......
......@@ -37,6 +37,7 @@
#include <KMessageBox>
#include <KNotification>
#include <kio_version.h>
#include <knewstuff_version.h>
#include <knotifications_version.h>
#include "kdenlive_debug.h"
......@@ -153,7 +154,6 @@ RenderWidget::RenderWidget(bool enableProxy, QWidget *parent)
m_view.buttonEdit->setIconSize(iconSize);
m_view.buttonNew->setIconSize(iconSize);
m_view.buttonSaveAs->setIconSize(iconSize);
m_view.buttonDownload->setIconSize(iconSize);
m_view.buttonRender->setEnabled(false);
m_view.buttonGenerateScript->setEnabled(false);
......@@ -174,11 +174,29 @@ RenderWidget::RenderWidget(bool enableProxy, QWidget *parent)
refreshView();
});
connect(m_view.buttonSaveAs, &QAbstractButton::clicked, this, &RenderWidget::slotSavePresetAs);
#if KNEWSTUFF_VERSION >= QT_VERSION_CHECK(5, 91, 0)
// TODO: ones we require at least KF 5.91 move this to the *.ui file
m_knsbutton = new KNSWidgets::Button(QString(), QStringLiteral(":data/kdenlive_renderprofiles.knsrc"), this);
m_knsbutton->setFlat(true);
connect(m_knsbutton, &KNSWidgets::Button::dialogFinished, this, [&](const QList<KNSCore::Entry> &changedEntries) {
if (changedEntries.count() > 0) {
parseProfiles();
}
});
#else
m_knsbutton = new QToolButton(this);
m_knsbutton->setIcon(QIcon::fromTheme(QStringLiteral("edit-download"));
m_knsbutton->setAutoRaise(true);
connect(m_view.buttonDownload, &QAbstractButton::clicked, this, [&]() {
if (pCore->getNewStuff(QStringLiteral(":data/kdenlive_renderprofiles.knsrc")) > 0) {
parseProfiles();
}
});
#endif
m_knsbutton->setIconSize(iconSize);
m_knsbutton->setToolTip(i18n("Download New Render Presets…"));
m_view.downloadButtonBox->addWidget(m_knsbutton);
m_view.optionsGroup->setVisible(m_view.options->isChecked());
m_view.optionsGroup->setMinimumWidth(m_view.optionsGroup->width() + m_view.optionsGroup->verticalScrollBar()->width());
connect(m_view.options, &QAbstractButton::toggled, m_view.optionsGroup, &QWidget::setVisible);
......
......@@ -16,10 +16,14 @@ class Menu;
}
#endif
#include "definitions.h"
#include "bin/model/markerlistmodel.hpp"
#include "ui_renderwidget_ui.h"
#include "definitions.h"
#include "renderpresets/tree/renderpresettreemodel.hpp"
#include "ui_renderwidget_ui.h"
#include <knewstuff_version.h>
#if KNEWSTUFF_VERSION >= QT_VERSION_CHECK(5, 91, 0)
#include <KNSWidgets/Button>
#endif
class QDomElement;
class QKeyEvent;
......@@ -211,6 +215,11 @@ private:
QString m_renderer;
QMap<int, QString> m_errorMessages;
std::weak_ptr<MarkerListModel> m_guidesModel;
#if KNEWSTUFF_VERSION >= QT_VERSION_CHECK(5, 91, 0)
KNSWidgets::Button *m_knsbutton;
#else
QToolButton *m_knsbutton;
#endif
std::shared_ptr<RenderPresetTreeModel> m_treeModel;
QString m_currentProfile;
......
......@@ -21,6 +21,8 @@
#include <QQmlContext>
#include <QStandardPaths>
#include <QTextEdit>
#include <knewstuff_version.h>
#include <memory>
EffectListWidget::EffectListWidget(QWidget *parent)
......@@ -92,13 +94,6 @@ void EffectListWidget::reloadCustomEffect(const QString &path)
m_proxyModel->sort(0, Qt::AscendingOrder);
}
void EffectListWidget::downloadNewEffects()
{
if (pCore->getNewStuff(QStringLiteral(":data/kdenlive_effects.knsrc")) > 0) {
// reloadCustomEffect();
}
}
void EffectListWidget::reloadEffectMenu(QMenu *effectsMenu, KActionCategory *effectActions)
{
m_model->reloadAssetMenu(effectsMenu, effectActions);
......
......@@ -30,7 +30,6 @@ public:
QString getMimeType(const QString &assetId) const override;
void updateFavorite(const QModelIndex &index);
void reloadEffectMenu(QMenu *effectsMenu, KActionCategory *effectActions);
void downloadNewEffects();
void reloadCustomEffectIx(const QModelIndex &index) override;
void editCustomAsset(const QModelIndex &index) override;
void exportCustomEffect(const QModelIndex &index);
......@@ -74,7 +73,7 @@ public:
Q_INVOKABLE void setFilterType(const QString &type) { q->setFilterType(type); }
Q_INVOKABLE void setFilterName(const QString &pattern) { q->setFilterName(pattern); }
Q_INVOKABLE QString getMimeType(const QString &assetId) const { return q->getMimeType(assetId); }
Q_INVOKABLE void downloadNewEffects() { q->downloadNewEffects(); }
bool showDescription() const { return KdenliveSettings::showeffectinfo(); }
void setShowDescription(bool show)
......
......@@ -2374,9 +2374,10 @@ void MainWindow::slotEditKeys()
KShortcutsDialog dialog(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, this);
#if KXMLGUI_VERSION >= QT_VERSION_CHECK(5, 98, 0)
QAction *downloadKeybordSchemes = new QAction(QIcon::fromTheme(QStringLiteral("download")), i18n("Download New Keyboard Schemes…"), &dialog);
connect(downloadKeybordSchemes, &QAction::triggered, this, [&]() {
if (getNewStuff(QStringLiteral(":data/kdenlive_keyboardschemes.knsrc")) > 0) {
KNSWidgets::Action *downloadKeybordSchemes =
new KNSWidgets::Action(i18n("Download New Keyboard Schemes…"), QStringLiteral(":data/kdenlive_keyboardschemes.knsrc"), this);
connect(downloadKeybordSchemes, &KNSWidgets::Action::dialogFinished, this, [&](const KNS3::Entry::List &changedEntries) {
if (changedEntries.count() > 0) {
dialog.refreshSchemes();
}
});
......@@ -3407,9 +3408,9 @@ void MainWindow::slotResizeItemEnd()
getMainTimeline()->controller()->setOutPoint(m_activeTool == ToolType::RippleTool);
}
#if KXMLGUI_VERSION < QT_VERSION_CHECK(5, 98, 0)
int MainWindow::getNewStuff(const QString &configFile)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
KNS3::QtQuickDialogWrapper dialog(configFile);
const QList<KNSCore::EntryInternal> entries = dialog.exec();
for (const auto &entry : qAsConst(entries)) {
......@@ -3418,11 +3419,8 @@ int MainWindow::getNewStuff(const QString &configFile)
}
}
return entries.size();
#else
// TODO: qt6
return 0;
#endif
}
#endif
#if KXMLGUI_VERSION < QT_VERSION_CHECK(5, 98, 0)
void MainWindow::slotGetNewKeyboardStuff(QComboBox *schemesList)
......
......@@ -18,14 +18,15 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
#include <QString>
#include <QUndoView>
#include <kxmlgui_version.h>
#include <KActionCategory>
#include <KColorSchemeManager>
#include <KSelectAction>
#include <KXmlGuiWindow>
#include <kautosavefile.h>
#include <utility>
#include <knewstuff_version.h>
#include <kxmlgui_version.h>
#include <mlt++/Mlt.h>
#include <utility>
#include "bin/bin.h"
#include "definitions.h"
......@@ -164,10 +165,12 @@ public:
/** @brief Show a key binding in status bar */
void showKeyBinding(const QString &text = QString());
#if KNEWSTUFF_VERSION < QT_VERSION_CHECK(5, 98, 0)
/** @brief Instantiates a "Get Hot New Stuff" dialog.
* @param configFile configuration file for KNewStuff
* @return number of installed items */
int getNewStuff(const QString &configFile);
#endif
/** @brief Check if the maximum cached data size is not exceeded. */
void checkMaxCacheSize();
......
......@@ -411,11 +411,24 @@ TitleWidget::TitleWidget(const QUrl &url, QString projectTitlePath, Monitor *mon
m_buttonSave->setToolTip(i18n("Save As") + QLatin1Char(' ') + m_buttonSave->shortcut().toString());
connect(m_buttonSave, SIGNAL(triggered()), this, SLOT(saveTitle()));
#if KNEWSTUFF_VERSION < QT_VERSION_CHECK(5, 90, 0)
m_buttonDownload = m_toolbar->addAction(QIcon::fromTheme(QStringLiteral("edit-download")), i18n("Download New Title Templates..."));
m_buttonDownload->setCheckable(false);
m_buttonDownload->setShortcut(Qt::ALT | Qt::Key_D);
m_buttonDownload->setToolTip(i18n("Download New Title Templates...") + QLatin1Char(' ') + m_buttonDownload->shortcut().toString());
connect(m_buttonDownload, &QAction::triggered, this, &TitleWidget::downloadTitleTemplates);
#else
m_buttonDownload = new KNSWidgets::Action(i18n("Download New Title Templates..."), QStringLiteral(":data/kdenlive_titles.knsrc"), this);
m_buttonDownload->setShortcut(Qt::ALT | Qt::Key_D);
m_buttonDownload->setToolTip(i18n("Download New Title Templates...") + QLatin1Char(' ') + m_buttonDownload->shortcut().toString());
m_toolbar->addAction(m_buttonDownload);
connect(m_buttonDownload, &KNSWidgets::Action::dialogFinished, this, [&](const KNS3::Entry::List &changedEntries) {
if (changedEntries.count() > 0) {
refreshTitleTemplates(m_projectTitlePath);
refreshTemplateBoxContents();
}
});
#endif
layout->addWidget(m_toolbar);
......@@ -2190,6 +2203,7 @@ QUrl TitleWidget::saveTitle(QUrl url)
return QUrl();
}
#if KNEWSTUFF_VERSION < QT_VERSION_CHECK(5, 90, 0)
void TitleWidget::downloadTitleTemplates()
{
if (pCore->getNewStuff(QStringLiteral(":data/kdenlive_titles.knsrc")) > 0) {
......@@ -2197,6 +2211,7 @@ void TitleWidget::downloadTitleTemplates()
refreshTemplateBoxContents();
}
}
#endif
QDomDocument TitleWidget::xml()
{
......
......@@ -19,9 +19,13 @@
#include "titler/unicodedialog.h"
#include "ui_titlewidget_ui.h"
#include <knewstuff_version.h>
#if KNEWSTUFF_VERSION >= QT_VERSION_CHECK(5, 90, 0)
#include <KNSWidgets/Action>
#endif
#include <QMap>
#include <QSignalMapper>
#include <QModelIndex>
#include <QSignalMapper>
class PatternsModel;
......@@ -135,7 +139,11 @@ private:
QAction *m_buttonCursor;
QAction *m_buttonSave;
QAction *m_buttonLoad;
#if KNEWSTUFF_VERSION < QT_VERSION_CHECK(5, 90, 0)
QAction *m_buttonDownload;
#else
KNSWidgets::Action *m_buttonDownload;
#endif
QAction *m_unicodeAction;
QAction *m_zUp;
......@@ -230,8 +238,10 @@ private:
void loadGradients();
void storeGradient(const QString &gradientData);
#if KNEWSTUFF_VERSION < QT_VERSION_CHECK(5, 90, 0)
/** @brief Open title download dialog */
void downloadTitleTemplates();
#endif
/** @brief Read patterns from config file
*/
......
......@@ -66,12 +66,10 @@ void TransitionListWidget::setFilterType(const QString &type)
}
}
void TransitionListWidget::downloadNewLumas()
void TransitionListWidget::refreshLumas()
{
if (pCore->getNewStuff(QStringLiteral(":data/kdenlive_wipes.knsrc")) > 0) {
MltConnection::refreshLumas();
// TODO: refresh currently displayed trans ?
}
MltConnection::refreshLumas();
// TODO: refresh currently displayed trans ?
}
void TransitionListWidget::reloadCustomEffectIx(const QModelIndex &) {}
......
......@@ -7,6 +7,7 @@
#include "assets/assetlist/view/assetlistwidget.hpp"
#include "kdenlivesettings.h"
#include <knewstuff_version.h>
class TransitionListWidgetProxy;
......@@ -26,7 +27,7 @@ public:
or kdenlive/transition*/
QString getMimeType(const QString &assetId) const override;
void updateFavorite(const QModelIndex &index);
void downloadNewLumas();
void refreshLumas();
void reloadCustomEffectIx(const QModelIndex &path) override;
void editCustomAsset(const QModelIndex &index) override;
......@@ -64,7 +65,7 @@ public:
Q_INVOKABLE void setFilterName(const QString &pattern) { q->setFilterName(pattern); }
Q_INVOKABLE QString getMimeType(const QString &assetId) const { return q->getMimeType(assetId); }
Q_INVOKABLE void downloadNewLumas() { q->downloadNewLumas(); }
Q_INVOKABLE void refreshLumas() { q->refreshLumas(); }
bool showDescription() const { return KdenliveSettings::showeffectinfo(); }
void setShowDescription(bool show)
......
......@@ -227,21 +227,11 @@
</widget>
</item>
<item>
<widget class="QToolButton" name="buttonDownload">
<property name="toolTip">
<string>Download New Render Presets…</string>
</property>
<property name="text">
<string>&amp;Download</string>
</property>
<property name="icon">
<iconset theme="edit-download">
<normaloff>.</normaloff>.</iconset>
<layout class="QHBoxLayout" name="downloadButtonBox">
<property name="spacing">
<number>0</number>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</layout>
</item>
<item>
<widget class="KSeparator" name="kseparator">
......@@ -1122,7 +1112,6 @@
<tabstop>tabWidget</tabstop>
<tabstop>optionsGroup</tabstop>
<tabstop>buttonNew</tabstop>
<tabstop>buttonDownload</tabstop>
<tabstop>buttonSaveAs</tabstop>
<tabstop>buttonEdit</tabstop>
<tabstop>buttonDelete</tabstop>
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>156</width>
<height>44</height>
<width>183</width>
<height>54</height>
</rect>
</property>
<layout class="QGridLayout">
......@@ -80,7 +80,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QWidget" name="widget" native="true">
<widget class="QWidget" name="m_value_box" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>1</horstretch>
......@@ -113,17 +113,6 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="m_download">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="edit-download">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment