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 dc1fe1eb authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Remember searchbar visibility, related to #350

parent a0d528ca
Pipeline #9716 passed with stage
in 13 minutes
......@@ -108,3 +108,17 @@ void AssetListWidget::activate(const QModelIndex &ix)
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);
}
}
......@@ -68,6 +68,10 @@ 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();
......
......@@ -63,8 +63,10 @@ Rectangle {
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) {
......@@ -169,7 +171,7 @@ Rectangle {
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 {
......@@ -217,7 +219,7 @@ Rectangle {
Keys.onReturnPressed: {
if (sel.hasSelection) {
assetlist.activate(sel.currentIndex)
searchList.checked = false
treeView.focus = true
}
}
}
......
......@@ -84,6 +84,8 @@ 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,6 +123,17 @@
<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>
......
......@@ -78,6 +78,8 @@ 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