Updated plugins page

This commit is contained in:
Eism 2022-02-11 15:52:11 +02:00
parent 97e71c3f34
commit ad70cad86b
4 changed files with 87 additions and 43 deletions

View file

@ -65,23 +65,38 @@ FocusScope {
color: ui.theme.backgroundSecondaryColor color: ui.theme.backgroundSecondaryColor
} }
RowLayout { NavigationPanel {
id: navTopPanel
name: "PluginsTopPanel"
section: navSec
order: 1
accessible.name: qsTrc("appshell", "Plugins")
}
Column {
id: topLayout id: topLayout
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: prv.sideMargin anchors.topMargin: prv.sideMargin
anchors.left: parent.left
anchors.leftMargin: prv.sideMargin
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: prv.sideMargin anchors.rightMargin: prv.sideMargin
spacing: 24
RowLayout {
width: parent.width
spacing: 12 spacing: 12
NavigationPanel { StyledTextLabel {
id: navSearchPanel id: pageTitle
name: "PluginsSearch" Layout.fillWidth: true
enabled: topLayout.enabled && topLayout.visible
section: navSec text: qsTrc("project", "Plugins")
order: 1 font: ui.theme.titleBoldFont
accessible.name: qsTrc("appshell", "Plugins") horizontalAlignment: Text.AlignLeft
} }
SearchField { SearchField {
@ -90,7 +105,7 @@ FocusScope {
Layout.preferredWidth: 220 Layout.preferredWidth: 220
navigation.name: "PluginsSearch" navigation.name: "PluginsSearch"
navigation.panel: navSearchPanel navigation.panel: navTopPanel
navigation.order: 1 navigation.order: 1
accessible.name: qsTrc("appshell", "Plugins search") accessible.name: qsTrc("appshell", "Plugins search")
@ -105,7 +120,7 @@ FocusScope {
width: searchField.width width: searchField.width
navigation.name: "CategoryComboBox" navigation.name: "CategoryComboBox"
navigation.panel: navSearchPanel navigation.panel: navTopPanel
navigation.order: 2 navigation.order: 2
readonly property string allCategoryValue: "ALL_CATEGORY" readonly property string allCategoryValue: "ALL_CATEGORY"
@ -115,7 +130,7 @@ FocusScope {
currentIndex: indexOfValue(allCategoryValue) currentIndex: indexOfValue(allCategoryValue)
function initModel() { function initModel() {
var categories = pluginsComp.categories() var categories = pluginsPage.categories()
var result = [] var result = []
result.push({ "text": qsTrc("appshell", "All"), "value": allCategoryValue }) result.push({ "text": qsTrc("appshell", "All"), "value": allCategoryValue })
@ -134,11 +149,30 @@ FocusScope {
} }
} }
FlatButton {
id: reloadButton
anchors.right: parent.right
text: qsTrc("plugins", "Reload plugins")
icon: IconCode.UPDATE
orientation: Qt.Horizontal
navigation.name: "PluginsReloadButton"
navigation.panel: navTopPanel
navigation.order: 3
onClicked: {
pluginsPage.reloadPlugins()
}
}
}
PluginsPage { PluginsPage {
id: pluginsComp id: pluginsPage
anchors.top: topLayout.bottom anchors.top: topLayout.bottom
anchors.topMargin: 36 anchors.topMargin: 24
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom

View file

@ -43,6 +43,10 @@ Item {
return pluginsModel.categories() return pluginsModel.categories()
} }
function reloadPlugins() {
pluginsModel.reloadPlugins()
}
PluginsModel { PluginsModel {
id: pluginsModel id: pluginsModel

View file

@ -162,6 +162,11 @@ void PluginsModel::editShortcut(QString codeKey)
} }
} }
void PluginsModel::reloadPlugins()
{
service()->reloadPlugins();
}
QStringList PluginsModel::categories() const QStringList PluginsModel::categories() const
{ {
QSet<QString> result; QSet<QString> result;

View file

@ -49,6 +49,7 @@ public:
Q_INVOKABLE void load(); Q_INVOKABLE void load();
Q_INVOKABLE void setEnable(const QString& codeKey, bool enable); Q_INVOKABLE void setEnable(const QString& codeKey, bool enable);
Q_INVOKABLE void editShortcut(QString codeKey); Q_INVOKABLE void editShortcut(QString codeKey);
Q_INVOKABLE void reloadPlugins();
Q_INVOKABLE QStringList categories() const; Q_INVOKABLE QStringList categories() const;