Effect list: remove favorites folder, make custom filters work again, always show search bar

parent 69fabb00
Pipeline #9828 passed with stage
in 13 minutes and 13 seconds
......@@ -51,9 +51,6 @@ bool AssetFilter::lessThan(const QModelIndex &left,
{
QString leftData = sourceModel()->data(left).toString();
QString rightData = sourceModel()->data(right).toString();
if (rightData == i18n("Favorites")) {
return false;
}
return QString::localeAwareCompare(leftData, rightData) < 0;
}
......
......@@ -76,7 +76,6 @@ bool AssetListWidget::isFavorite(const QModelIndex &index) const
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
......@@ -109,16 +108,3 @@ void AssetListWidget::activate(const QModelIndex &ix)
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);
}
}
......@@ -69,10 +69,6 @@ public:
/* @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<AssetTreeModel> m_model;
......
......@@ -59,22 +59,6 @@ Rectangle {
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"
......@@ -161,7 +145,6 @@ Rectangle {
TextField {
id: searchInput
Layout.fillWidth:true
visible: false
Image {
id: clear
source: 'image://icon/edit-clear'
......@@ -171,7 +154,7 @@ Rectangle {
opacity: 0
MouseArea {
anchors.fill: parent
onClicked: { searchInput.text = ''; searchInput.focus = true; /*searchList.checked = false;*/ }
onClicked: { searchInput.text = ''; searchInput.focus = true; }
}
}
states: State {
......@@ -216,10 +199,11 @@ Rectangle {
treeView.expand(sel.currentIndex.parent)
treeView.__listView.positionViewAtIndex(rowPosition(assetListModel, sel.currentIndex), ListView.Visible)
}
Keys.onReturnPressed: {
if (sel.hasSelection) {
Keys.onPressed: {
if (sel.hasSelection && (event.key === Qt.Key_Return || event.key === Qt.Key_Enter )) {
assetlist.activate(sel.currentIndex)
treeView.focus = true
searchInput.text = '';
}
}
}
......
......@@ -59,6 +59,9 @@ bool EffectFilter::filterType(const std::shared_ptr<TreeItem> &item) const
if (m_type_value == EffectType::Preferred) {
return item->dataColumn(AssetTreeModel::preferredCol).toBool();
}
if (m_type_value == EffectType::Custom) {
return itemType == m_type_value || itemType == EffectType::CustomAudio;
}
return itemType == m_type_value;
}
......
......@@ -56,11 +56,6 @@ std::shared_ptr<EffectTreeModel> EffectTreeModel::construct(const QString &categ
doc.setContent(&file, false);
file.close();
QDomNodeList groups = doc.documentElement().elementsByTagName(QStringLiteral("group"));
// Create favorite group
auto groupFav = self->rootItem->appendChild(QList<QVariant>{i18n("Favorites"), QStringLiteral("root"), -1});
effectCategory[QStringLiteral("kdenlive:favorites")] = groupFav;
auto groupLegacy = self->rootItem->appendChild(QList<QVariant>{i18n("Legacy"), QStringLiteral("root")});
for (int i = 0; i < groups.count(); i++) {
......@@ -159,19 +154,10 @@ void EffectTreeModel::setFavorite(const QModelIndex &index, bool favorite, bool
qDebug()<<"Trying to reparent unknown asset: "<<id;
return;
}
int max = rootItem->childCount();
QStringList favs = KdenliveSettings::favorite_effects();
if (!favorite) {
int ix = item->dataColumn(4).toInt();
item->changeParent(rootItem->child(ix));
favs.removeAll(id);
} else {
for (int i = 0; i < max; i++) {
if (rootItem->child(i)->dataColumn(2).toInt() == -1) {
item->changeParent(rootItem->child(i));
break;
}
}
favs << id;
}
KdenliveSettings::setFavorite_effects(favs);
......
......@@ -70,9 +70,7 @@ void EffectListWidget::setFilterType(const QString &type)
static_cast<EffectFilter *>(m_proxyModel.get())->setFilterType(true, EffectType::Video);
} else if (type == "audio") {
static_cast<EffectFilter *>(m_proxyModel.get())->setFilterType(true, EffectType::Audio);
} else if (type == "customAudio") {
static_cast<EffectFilter *>(m_proxyModel.get())->setFilterType(true, EffectType::CustomAudio);
} else if (type == "customVideo") {
} else if (type == "custom") {
static_cast<EffectFilter *>(m_proxyModel.get())->setFilterType(true, EffectType::Custom);
} else if (type == "favorites") {
static_cast<EffectFilter *>(m_proxyModel.get())->setFilterType(true, EffectType::Favorites);
......
......@@ -84,8 +84,6 @@ 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 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)
......
......@@ -123,17 +123,6 @@
<label>Default OpenGL backend.</label>
<default>0</default>
</entry>
<entry name="showEffectSearchBar" type="Bool">
<label>Show effect search bar by default.</label>
<default>true</default>
</entry>
<entry name="showCompoSearchBar" type="Bool">
<label>Show composition search bar by default.</label>
<default>true</default>
</entry>
</group>
<group name="project">
......
......@@ -78,8 +78,6 @@ 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 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(); }
......
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