Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 97802684 authored by Nicolas Carion's avatar Nicolas Carion

effect list filter by type + fix description showing

parent 2c7000be
......@@ -22,7 +22,6 @@
#include "effectlistwidget.hpp"
#include "../model/effecttreemodel.hpp"
#include "../model/effectfilter.hpp"
#include "effects/effectsrepository.hpp"
#include <KDeclarative/KDeclarative>
#include <QStandardPaths>
......@@ -31,6 +30,7 @@
EffectListWidget::EffectListWidget(QWidget *parent)
: QQuickWidget(parent)
{
QString effectCategory = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("kdenliveeffectscategory.rc"));
m_model.reset(new EffectTreeModel(effectCategory, this));
......@@ -69,3 +69,16 @@ void EffectListWidget::setFilterName(const QString& pattern)
{
m_proxyModel->setFilterName(!pattern.isEmpty(), pattern);
}
void EffectListWidget::setFilterType(const QString& type)
{
if (type == "video") {
m_proxyModel->setFilterType(true, EffectType::Video);
} else if (type == "audio") {
m_proxyModel->setFilterType(true, EffectType::Audio);
} else if (type == "custom") {
m_proxyModel->setFilterType(true, EffectType::Custom);
} else {
m_proxyModel->setFilterType(false, EffectType::Video);
}
}
......@@ -25,6 +25,7 @@
#include <QQuickWidget>
#include <memory>
#include "qmltypes/effecticonprovider.hpp"
#include "effects/effectsrepository.hpp"
/* @brief This class is a widget that display the list of available effects
*/
......@@ -42,6 +43,7 @@ public:
Q_INVOKABLE QString getName(const QModelIndex& index) const;
Q_INVOKABLE QString getDescription(const QModelIndex& index) const;
Q_INVOKABLE void setFilterName(const QString& pattern);
Q_INVOKABLE void setFilterType(const QString& type);
private:
std::unique_ptr<EffectTreeModel> m_model;
EffectFilter *m_proxyModel;
......
......@@ -43,10 +43,12 @@ Rectangle {
implicitWidth: 40
implicitHeight: 40
iconName: "show-all-effects"
onClicked: console.log("show dshow-all-effects")
checkable:true
exclusiveGroup: filterGroup
tooltip: i18n('Show all effects')
onClicked: {
effectlist.setFilterType("")
}
}
ToolButton {
id: showVideo
......@@ -54,10 +56,12 @@ Rectangle {
implicitHeight: 40
iconName: "kdenlive-show-video"
iconSource: 'qrc:///pics/kdenlive-show-video.svgz'
onClicked: console.log("show dshow video")
checkable:true
exclusiveGroup: filterGroup
tooltip: i18n('Show all video effects')
onClicked: {
effectlist.setFilterType("video")
}
}
ToolButton {
id: showAudio
......@@ -65,10 +69,24 @@ Rectangle {
implicitHeight: 40
iconName: "kdenlive-show-audio"
iconSource: 'qrc:///pics/kdenlive-show-audio.svgz'
onClicked: console.log("show dshow audio")
checkable:true
exclusiveGroup: filterGroup
tooltip: i18n('Show all audio effects')
onClicked: {
effectlist.setFilterType("audio")
}
}
ToolButton {
id: showCustom
implicitWidth: 40
implicitHeight: 40
iconName: "kdenlive-custom-effect"
checkable:true
exclusiveGroup: filterGroup
tooltip: i18n('Show all custom effects')
onClicked: {
effectlist.setFilterType("custom")
}
}
Rectangle {
//This is a spacer
......@@ -81,9 +99,14 @@ Rectangle {
implicitWidth: 40
implicitHeight: 40
iconName: "help-about"
onClicked: console.log("show description")
checkable:true
checked: true
tooltip: i18n('Show/hide description of the effects')
onCheckedChanged:{
if (!checked) {
effectDescription.visible = false
}
}
}
}
......@@ -154,8 +177,8 @@ Rectangle {
visible: false
Layout.fillWidth: true
states: State {
name: "hasDescription"; when: effectDescription.text != ''
PropertyChanges { target: effectDescription; visible: true }
name: "hasDescription"; when: effectDescription.text != '' && showDescription.checked
PropertyChanges { target: effectDescription; visible: true}
}
}
......
......@@ -40,6 +40,7 @@ enum class EffectType {
Custom
};
Q_DECLARE_METATYPE(EffectType)
class AbstractEffectModel;
class EffectsRepository
......
Markdown is supported
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