diff --git a/src/assets/assetlist/view/assetlistwidget.cpp b/src/assets/assetlist/view/assetlistwidget.cpp
index 4d6769d8d..979d3bb01 100644
--- a/src/assets/assetlist/view/assetlistwidget.cpp
+++ b/src/assets/assetlist/view/assetlistwidget.cpp
@@ -1,110 +1,124 @@
/***************************************************************************
* Copyright (C) 2017 by Nicolas Carion *
* This file is part of Kdenlive. See www.kdenlive.org. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) version 3 or any later version accepted by the *
* membership of KDE e.V. (or its successor approved by the membership *
* of KDE e.V.), which shall act as a proxy defined in Section 14 of *
* version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see . *
***************************************************************************/
#include "assetlistwidget.hpp"
#include "assets/assetlist/model/assetfilter.hpp"
#include "assets/assetlist/model/assettreemodel.hpp"
#include "assets/assetlist/view/qmltypes/asseticonprovider.hpp"
#include
#include
#include
#include
#include
AssetListWidget::AssetListWidget(QWidget *parent)
: QQuickWidget(parent)
{
KDeclarative::KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(engine());
#if KDECLARATIVE_VERSION >= QT_VERSION_CHECK(5, 45, 0)
kdeclarative.setupEngine(engine());
kdeclarative.setupContext();
#else
kdeclarative.setupBindings();
#endif
}
AssetListWidget::~AssetListWidget()
{
// clear source
setSource(QUrl());
}
void AssetListWidget::setup()
{
setResizeMode(QQuickWidget::SizeRootObjectToView);
engine()->addImageProvider(QStringLiteral("asseticon"), m_assetIconProvider);
setSource(QUrl(QStringLiteral("qrc:/qml/assetList.qml")));
setFocusPolicy(Qt::StrongFocus);
}
void AssetListWidget::reset()
{
setSource(QUrl(QStringLiteral("qrc:/qml/assetList.qml")));
}
QString AssetListWidget::getName(const QModelIndex &index) const
{
return m_model->getName(m_proxyModel->mapToSource(index));
}
bool AssetListWidget::isFavorite(const QModelIndex &index) const
{
return m_model->isFavorite(m_proxyModel->mapToSource(index));
}
void AssetListWidget::setFavorite(const QModelIndex &index, bool favorite, bool isEffect)
{
m_model->setFavorite(m_proxyModel->mapToSource(index), favorite, isEffect);
m_proxyModel->sort(0);
}
QString AssetListWidget::getDescription(const QModelIndex &index) const
{
return m_model->getDescription(m_proxyModel->mapToSource(index));
}
void AssetListWidget::setFilterName(const QString &pattern)
{
m_proxyModel->setFilterName(!pattern.isEmpty(), pattern);
if (!pattern.isEmpty()) {
QVariantList mapped = m_proxyModel->getCategories();
QMetaObject::invokeMethod(rootObject(), "expandNodes", Qt::DirectConnection, Q_ARG(QVariant, mapped));
}
}
QVariantMap AssetListWidget::getMimeData(const QString &assetId) const
{
QVariantMap mimeData;
mimeData.insert(getMimeType(assetId), assetId);
return mimeData;
}
void AssetListWidget::activate(const QModelIndex &ix)
{
if (!ix.isValid()) {
return;
}
const QString assetId = m_model->data(m_proxyModel->mapToSource(ix), AssetTreeModel::IdRole).toString();
emit activateAsset(getMimeData(assetId));
}
+
+bool AssetListWidget::showSearchBar(bool isEffectList) const
+{
+ return isEffectList ? KdenliveSettings::showEffectSearchBar() : KdenliveSettings::showCompoSearchBar();
+}
+
+void AssetListWidget::setShowSearchBar(bool isEffectList, bool show)
+{
+ if (isEffectList) {
+ KdenliveSettings::setShowEffectSearchBar(show);
+ } else {
+ KdenliveSettings::setShowCompoSearchBar(show);
+ }
+}
diff --git a/src/assets/assetlist/view/assetlistwidget.hpp b/src/assets/assetlist/view/assetlistwidget.hpp
index 3059d3ff3..fc4a1fe11 100644
--- a/src/assets/assetlist/view/assetlistwidget.hpp
+++ b/src/assets/assetlist/view/assetlistwidget.hpp
@@ -1,83 +1,87 @@
/***************************************************************************
* Copyright (C) 2017 by Nicolas Carion *
* This file is part of Kdenlive. See www.kdenlive.org. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) version 3 or any later version accepted by the *
* membership of KDE e.V. (or its successor approved by the membership *
* of KDE e.V.), which shall act as a proxy defined in Section 14 of *
* version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see . *
***************************************************************************/
#ifndef ASSETLISTWIDGET_H
#define ASSETLISTWIDGET_H
#include "effects/effectsrepository.hpp"
#include
#include
/* @brief This class is a generic widget that display the list of available assets
*/
class AssetIconProvider;
class AssetFilter;
class AssetTreeModel;
class AssetListWidget : public QQuickWidget
{
Q_OBJECT
/* @brief Should the descriptive info box be displayed
*/
public:
AssetListWidget(QWidget *parent = Q_NULLPTR);
~AssetListWidget() override;
/* @brief Returns the name of the asset given its model index */
QString getName(const QModelIndex &index) const;
/* @brief Returns true if this effect belongs to favorites */
bool isFavorite(const QModelIndex &index) const;
/* @brief Sets whether this effect belongs to favorites */
void setFavorite(const QModelIndex &index, bool favorite = true, bool isEffect = true);
/* @brief Returns the description of the asset given its model index */
QString getDescription(const QModelIndex &index) const;
/* @brief Sets the pattern against which the assets' names are filtered */
void setFilterName(const QString &pattern);
/*@brief Return mime type used for drag and drop. It can be kdenlive/effect,
kdenlive/composition or kdenlive/transition*/
virtual QString getMimeType(const QString &assetId) const = 0;
QVariantMap getMimeData(const QString &assetId) const;
void activate(const QModelIndex &ix);
/* @brief Rebuild the view by resetting the source. Is there a better way? */
void reset();
+
+ /* @brief Show search bar on opening */
+ bool showSearchBar(bool isEffectList) const;
+ void setShowSearchBar(bool isEffectList, bool show);
protected:
void setup();
std::shared_ptr m_model;
std::unique_ptr m_proxyModel;
// the QmlEngine takes ownership of the image provider
AssetIconProvider *m_assetIconProvider{nullptr};
signals:
void activateAsset(const QVariantMap data);
};
#endif
diff --git a/src/assets/assetlist/view/qml/assetList.qml b/src/assets/assetlist/view/qml/assetList.qml
index bcb825696..a0ccb2635 100644
--- a/src/assets/assetlist/view/qml/assetList.qml
+++ b/src/assets/assetlist/view/qml/assetList.qml
@@ -1,378 +1,380 @@
/***************************************************************************
* Copyright (C) 2017 by Nicolas Carion *
* This file is part of Kdenlive. See www.kdenlive.org. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) version 3 or any later version accepted by the *
* membership of KDE e.V. (or its successor approved by the membership *
* of KDE e.V.), which shall act as a proxy defined in Section 14 of *
* version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see . *
***************************************************************************/
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 1.5
import QtQuick.Controls.Styles 1.4
import QtQuick.Window 2.2
import QtQml.Models 2.2
Rectangle {
id: listRoot
SystemPalette { id: activePalette }
color: activePalette.window
function expandNodes(indexes) {
for(var i = 0; i < indexes.length; i++) {
if (indexes[i].valid) {
treeView.expand(indexes[i]);
}
}
}
function rowPosition(model, index) {
var pos = 0;
for(var i = 0; i < index.parent.row; i++) {
var catIndex = model.getCategory(i);
if (treeView.isExpanded(catIndex)) {
pos += model.rowCount(catIndex);
}
pos ++;
}
pos += index.row + 2;
return pos;
}
ColumnLayout {
anchors.fill: parent
spacing: 0
RowLayout {
Layout.fillWidth: true
Layout.fillHeight: false
spacing: 4
ExclusiveGroup { id: filterGroup}
ToolButton {
id: searchList
iconName: "edit-find"
checkable: true
+ checked: assetlist.showSearchBar(isEffectList)
tooltip: isEffectList ? i18n("Find effect") : i18n("Find composition")
onCheckedChanged: {
+ assetlist.setShowSearchBar(isEffectList, searchList.checked)
searchInput.visible = searchList.checked
searchInput.focus = searchList.checked
if (!searchList.checked) {
searchInput.text = ''
treeView.focus = true
}
}
}
ToolButton {
id: showAll
iconName: "show-all-effects"
checkable: true
checked: true
exclusiveGroup: filterGroup
tooltip: isEffectList ? i18n("Main effects") : i18n("Main compositions")
onClicked: {
assetlist.setFilterType("")
}
}
ToolButton {
id: showVideo
visible: isEffectList
iconName: "kdenlive-show-video"
iconSource: 'qrc:///pics/kdenlive-show-video.svgz'
checkable:true
exclusiveGroup: filterGroup
tooltip: i18n("Show all video effects")
onClicked: {
assetlist.setFilterType("video")
}
}
ToolButton {
id: showAudio
visible: isEffectList
iconName: "kdenlive-show-audio"
iconSource: 'qrc:///pics/kdenlive-show-audio.svgz'
checkable:true
exclusiveGroup: filterGroup
tooltip: i18n("Show all audio effects")
onClicked: {
assetlist.setFilterType("audio")
}
}
ToolButton {
id: showCustom
visible: isEffectList
iconName: "kdenlive-custom-effect"
checkable:true
exclusiveGroup: filterGroup
tooltip: i18n("Show all custom effects")
onClicked: {
assetlist.setFilterType("custom")
}
}
ToolButton {
id: showFavorites
iconName: "favorite"
checkable:true
exclusiveGroup: filterGroup
tooltip: i18n("Show favorite items")
onClicked: {
assetlist.setFilterType("favorites")
}
}
ToolButton {
id: downloadTransitions
visible: !isEffectList
iconName: "edit-download"
tooltip: i18n("Download New Wipes...")
onClicked: {
assetlist.downloadNewLumas()
}
}
Rectangle {
//This is a spacer
Layout.fillHeight: false
Layout.fillWidth: true
color: "transparent"
}
ToolButton {
id: showDescription
iconName: "help-about"
checkable:true
tooltip: isEffectList ? i18n("Show/hide description of the effects") : i18n("Show/hide description of the compositions")
onCheckedChanged:{
assetlist.showDescription = checked
}
Component.onCompleted: checked = assetlist.showDescription
}
}
TextField {
id: searchInput
Layout.fillWidth:true
visible: false
Image {
id: clear
source: 'image://icon/edit-clear'
width: parent.height * 0.8
height: width
anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter }
opacity: 0
MouseArea {
anchors.fill: parent
- onClicked: { searchInput.text = ''; searchInput.focus = true; searchList.checked = false; }
+ onClicked: { searchInput.text = ''; searchInput.focus = true; /*searchList.checked = false;*/ }
}
}
states: State {
name: "hasText"; when: searchInput.text != ''
PropertyChanges { target: clear; opacity: 1 }
}
transitions: [
Transition {
from: ""; to: "hasText"
NumberAnimation { properties: "opacity" }
},
Transition {
from: "hasText"; to: ""
NumberAnimation { properties: "opacity" }
}
]
onTextChanged: {
var current = sel.currentIndex
var rowModelIndex = assetListModel.getModelIndex(sel.currentIndex);
assetlist.setFilterName(text)
if (text.length > 0) {
sel.setCurrentIndex(assetListModel.firstVisibleItem(current), ItemSelectionModel.ClearAndSelect)
} else {
sel.clearCurrentIndex()
sel.setCurrentIndex(assetListModel.getProxyIndex(rowModelIndex), ItemSelectionModel.ClearAndSelect)
}
treeView.__listView.positionViewAtIndex(rowPosition(assetListModel, sel.currentIndex), ListView.Visible)
}
/*onEditingFinished: {
if (!assetContextMenu.isDisplayed) {
searchList.checked = false
}
}*/
Keys.onDownPressed: {
sel.setCurrentIndex(assetListModel.getNextChild(sel.currentIndex), ItemSelectionModel.ClearAndSelect)
treeView.expand(sel.currentIndex.parent)
treeView.__listView.positionViewAtIndex(rowPosition(assetListModel, sel.currentIndex), ListView.Visible)
}
Keys.onUpPressed: {
sel.setCurrentIndex(assetListModel.getPreviousChild(sel.currentIndex), ItemSelectionModel.ClearAndSelect)
treeView.expand(sel.currentIndex.parent)
treeView.__listView.positionViewAtIndex(rowPosition(assetListModel, sel.currentIndex), ListView.Visible)
}
Keys.onReturnPressed: {
if (sel.hasSelection) {
assetlist.activate(sel.currentIndex)
- searchList.checked = false
+ treeView.focus = true
}
}
}
ItemSelectionModel {
id: sel
model: assetListModel
onSelectionChanged: {
assetDescription.text = i18n(assetlist.getDescription(sel.currentIndex))
}
}
SplitView {
orientation: Qt.Vertical
Layout.fillHeight: true
Layout.fillWidth: true
TreeView {
id: treeView
Layout.fillHeight: true
Layout.fillWidth: true
alternatingRowColors: false
headerVisible: false
selection: sel
selectionMode: SelectionMode.SingleSelection
itemDelegate: Rectangle {
id: assetDelegate
// These anchors are important to allow "copy" dragging
anchors.verticalCenter: parent ? parent.verticalCenter : undefined
anchors.right: parent ? parent.right : undefined
property bool isItem : styleData.value !== "root" && styleData.value !== ""
property string mimeType : isItem ? assetlist.getMimeType(styleData.value) : ""
height: assetText.implicitHeight
color: dragArea.containsMouse ? activePalette.highlight : "transparent"
Drag.active: isItem ? dragArea.drag.active : false
Drag.dragType: Drag.Automatic
Drag.supportedActions: Qt.CopyAction
Drag.mimeData: isItem ? assetlist.getMimeData(styleData.value) : {}
Drag.keys:[
isItem ? assetlist.getMimeType(styleData.value) : ""
]
Row {
anchors.fill:parent
anchors.leftMargin: 1
anchors.topMargin: 1
anchors.bottomMargin: 1
spacing: 4
Image{
id: assetThumb
anchors.verticalCenter: parent.verticalCenter
visible: assetDelegate.isItem
property bool isFavorite: model == undefined || model.favorite === undefined ? false : model.favorite
height: parent.height * 0.8
width: height
source: 'image://asseticon/' + styleData.value
}
Label {
id: assetText
font.bold : assetThumb.isFavorite
text: i18n(assetlist.getName(styleData.index))
}
}
MouseArea {
id: dragArea
anchors.fill: assetDelegate
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
drag.target: undefined
onReleased: {
drag.target = undefined
}
onPressed: {
if (assetDelegate.isItem) {
//sel.select(styleData.index, ItemSelectionModel.Select)
sel.setCurrentIndex(styleData.index, ItemSelectionModel.ClearAndSelect)
if (mouse.button === Qt.LeftButton) {
drag.target = parent
parent.grabToImage(function(result) {
parent.Drag.imageSource = result.url
})
} else {
drag.target = undefined
assetContextMenu.isItemFavorite = assetThumb.isFavorite
assetContextMenu.popup()
mouse.accepted = false
}
console.log(parent.Drag.keys)
} else {
if (treeView.isExpanded(styleData.index)) {
treeView.collapse(styleData.index)
} else {
treeView.expand(styleData.index)
}
}
treeView.focus = true
}
onDoubleClicked: {
if (isItem) {
assetlist.activate(styleData.index)
}
}
}
}
Menu {
id: assetContextMenu
property bool isItemFavorite
property bool isDisplayed: false
MenuItem {
id: favMenu
text: assetContextMenu.isItemFavorite ? i18n("Remove from favorites") : i18n("Add to favorites")
property url thumbSource
onTriggered: {
assetlist.setFavorite(sel.currentIndex, !assetContextMenu.isItemFavorite)
}
}
onAboutToShow: {
isDisplayed = true;
}
onAboutToHide: {
isDisplayed = false;
}
}
TableViewColumn { role: "identifier"; title: i18n("Name"); }
model: assetListModel
Keys.onDownPressed: {
sel.setCurrentIndex(assetListModel.getNextChild(sel.currentIndex), ItemSelectionModel.ClearAndSelect)
treeView.expand(sel.currentIndex.parent)
treeView.__listView.positionViewAtIndex(rowPosition(assetListModel, sel.currentIndex), ListView.Visible)
}
Keys.onUpPressed: {
sel.setCurrentIndex(assetListModel.getPreviousChild(sel.currentIndex), ItemSelectionModel.ClearAndSelect)
treeView.expand(sel.currentIndex.parent)
treeView.__listView.positionViewAtIndex(rowPosition(assetListModel, sel.currentIndex), ListView.Visible)
}
Keys.onReturnPressed: {
if (sel.hasSelection) {
assetlist.activate(sel.currentIndex)
}
}
}
TextArea {
id: assetDescription
text: ""
visible: showDescription.checked
readOnly: true
Layout.fillWidth: true
states: State {
name: "hasDescription"; when: assetDescription.text != '' && showDescription.checked
PropertyChanges { target: assetDescription; visible: true}
}
}
}
}
}
diff --git a/src/effects/effectlist/view/effectlistwidget.hpp b/src/effects/effectlist/view/effectlistwidget.hpp
index 2fc64db88..39868692e 100644
--- a/src/effects/effectlist/view/effectlistwidget.hpp
+++ b/src/effects/effectlist/view/effectlistwidget.hpp
@@ -1,101 +1,103 @@
/***************************************************************************
* Copyright (C) 2017 by Nicolas Carion *
* This file is part of Kdenlive. See www.kdenlive.org. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) version 3 or any later version accepted by the *
* membership of KDE e.V. (or its successor approved by the membership *
* of KDE e.V.), which shall act as a proxy defined in Section 14 of *
* version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see . *
***************************************************************************/
#ifndef EFFECTLISTWIDGET_H
#define EFFECTLISTWIDGET_H
#include "assets/assetlist/view/assetlistwidget.hpp"
#include "kdenlivesettings.h"
/* @brief This class is a widget that display the list of available effects
*/
class EffectFilter;
class EffectTreeModel;
class EffectListWidgetProxy;
class KActionCategory;
class QMenu;
class EffectListWidget : public AssetListWidget
{
Q_OBJECT
public:
EffectListWidget(QWidget *parent = Q_NULLPTR);
~EffectListWidget() override;
void setFilterType(const QString &type);
/*@brief Return mime type used for drag and drop. It will be kdenlive/effect*/
QString getMimeType(const QString &assetId) const override;
void updateFavorite(const QModelIndex &index);
void reloadEffectMenu(QMenu *effectsMenu, KActionCategory *effectActions);
public slots:
void reloadCustomEffect(const QString &path);
private:
EffectListWidgetProxy *m_proxy;
signals:
void reloadFavorites();
};
// see https://bugreports.qt.io/browse/QTBUG-57714, don't expose a QWidget as a context property
class EffectListWidgetProxy : public QObject
{
Q_OBJECT
Q_PROPERTY(bool showDescription READ showDescription WRITE setShowDescription NOTIFY showDescriptionChanged)
public:
EffectListWidgetProxy(EffectListWidget *parent)
: QObject(parent)
, q(parent)
{
}
Q_INVOKABLE QString getName(const QModelIndex &index) const { return q->getName(index); }
Q_INVOKABLE bool isFavorite(const QModelIndex &index) const { return q->isFavorite(index); }
Q_INVOKABLE void setFavorite(const QModelIndex &index, bool favorite) const
{
q->setFavorite(index, favorite, true);
q->updateFavorite(index);
}
Q_INVOKABLE QString getDescription(const QModelIndex &index) const { return q->getDescription(index); }
Q_INVOKABLE QVariantMap getMimeData(const QString &assetId) const { return q->getMimeData(assetId); }
Q_INVOKABLE void activate(const QModelIndex &ix) { q->activate(ix); }
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 bool showSearchBar(bool isEffectList) const { return q->showSearchBar(isEffectList); }
+ Q_INVOKABLE void setShowSearchBar(bool isEffectList, bool show) { q->setShowSearchBar(isEffectList, show); }
bool showDescription() const { return KdenliveSettings::showeffectinfo(); }
void setShowDescription(bool show)
{
KdenliveSettings::setShoweffectinfo(show);
emit showDescriptionChanged();
}
signals:
void showDescriptionChanged();
private:
EffectListWidget *q; // NOLINT
};
#endif
diff --git a/src/kdenlivesettings.kcfg b/src/kdenlivesettings.kcfg
index daf9bba1d..730a041dc 100644
--- a/src/kdenlivesettings.kcfg
+++ b/src/kdenlivesettings.kcfg
@@ -1,1020 +1,1031 @@
04falsetrue1truetruefalse00:00:05:0000:00:05:0000:00:00:0100:00:03:00falsefalsefalsefalsefalse00:00:05:0000:00:01:00true0
+
+
+
+ true
+
+
+
+
+ true
+
+
22falsefalsefalsefalse1000200080000truefalsefalsefalse140125falsetruetruetruefalsefalsetruefalse01truetruetruefalsesdl2_audio0sdl2_audio0#999999100true1false0121/tmp/falsetrue$HOMEtruedefault:10024800000/dev/video02default0truefalse000false00128072015.0truefalsefalse00capturefalse3falsetrue0true025truefalsefalsefalsetruetruetruefalsefalsefalsefalse0x150x0500false0x07truetruefalsetrue#000000true320240truefalsefalsefalsetrue53falsefalsefalse100falsefalsetruefalsefalsetruetruetrue0onefieldnearestvolume,lift_gamma_gain,qtblendwipe,qtblend0falsefalsetruefalse23#ff00000
diff --git a/src/transitions/transitionlist/view/transitionlistwidget.hpp b/src/transitions/transitionlist/view/transitionlistwidget.hpp
index 3f84c80aa..a1b14fe4c 100644
--- a/src/transitions/transitionlist/view/transitionlistwidget.hpp
+++ b/src/transitions/transitionlist/view/transitionlistwidget.hpp
@@ -1,96 +1,98 @@
/***************************************************************************
* Copyright (C) 2017 by Nicolas Carion *
* This file is part of Kdenlive. See www.kdenlive.org. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) version 3 or any later version accepted by the *
* membership of KDE e.V. (or its successor approved by the membership *
* of KDE e.V.), which shall act as a proxy defined in Section 14 of *
* version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see . *
***************************************************************************/
#ifndef TRANSITIONLISTWIDGET_H
#define TRANSITIONLISTWIDGET_H
#include "assets/assetlist/view/assetlistwidget.hpp"
#include "kdenlivesettings.h"
class TransitionListWidgetProxy;
/* @brief This class is a widget that display the list of available effects
*/
class TransitionListWidget : public AssetListWidget
{
Q_OBJECT
public:
TransitionListWidget(QWidget *parent = Q_NULLPTR);
~TransitionListWidget() override;
void setFilterType(const QString &type);
/*@brief Return mime type used for drag and drop. It will be kdenlive/composition
or kdenlive/transition*/
QString getMimeType(const QString &assetId) const override;
void updateFavorite(const QModelIndex &index);
void downloadNewLumas();
private:
TransitionListWidgetProxy *m_proxy;
int getNewStuff(const QString &configFile);
signals:
void reloadFavorites();
};
// see https://bugreports.qt.io/browse/QTBUG-57714, don't expose a QWidget as a context property
class TransitionListWidgetProxy : public QObject
{
Q_OBJECT
Q_PROPERTY(bool showDescription READ showDescription WRITE setShowDescription NOTIFY showDescriptionChanged)
public:
TransitionListWidgetProxy(TransitionListWidget *parent)
: QObject(parent)
, q(parent)
{
}
Q_INVOKABLE QString getName(const QModelIndex &index) const { return q->getName(index); }
Q_INVOKABLE bool isFavorite(const QModelIndex &index) const { return q->isFavorite(index); }
Q_INVOKABLE void setFavorite(const QModelIndex &index, bool favorite) const
{
q->setFavorite(index, favorite, false);
q->updateFavorite(index);
}
Q_INVOKABLE void setFilterType(const QString &type) { q->setFilterType(type); }
Q_INVOKABLE QString getDescription(const QModelIndex &index) const { return q->getDescription(index); }
Q_INVOKABLE QVariantMap getMimeData(const QString &assetId) const { return q->getMimeData(assetId); }
Q_INVOKABLE void activate(const QModelIndex &ix) { q->activate(ix); }
Q_INVOKABLE void setFilterName(const QString &pattern) { q->setFilterName(pattern); }
Q_INVOKABLE QString getMimeType(const QString &assetId) const { return q->getMimeType(assetId); }
+ Q_INVOKABLE bool showSearchBar(bool isEffectList) const { return q->showSearchBar(isEffectList); }
+ Q_INVOKABLE void setShowSearchBar(bool isEffectList, bool show) { q->setShowSearchBar(isEffectList, show); }
Q_INVOKABLE void downloadNewLumas() { q->downloadNewLumas(); }
bool showDescription() const { return KdenliveSettings::showeffectinfo(); }
void setShowDescription(bool show)
{
KdenliveSettings::setShoweffectinfo(show);
emit showDescriptionChanged();
}
signals:
void showDescriptionChanged();
private:
TransitionListWidget *q; // NOLINT
};
#endif