90 lines
2.8 KiB
QML
90 lines
2.8 KiB
QML
/*
|
|
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
|
*
|
|
* 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 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* 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 <https://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
|
|
import QtQuick 2.12
|
|
import QtQuick.Layouts 1.12
|
|
import QtQuick.Controls 2.5
|
|
import AppControls2 1.0 as AppControls2
|
|
import org.ukui.menu.core 1.0
|
|
import org.ukui.menu.utils 1.0
|
|
|
|
Item {
|
|
id: appPageHeaderRoot
|
|
property string title: ""
|
|
property Item focusToPageContent
|
|
property Component content: null
|
|
clip: true
|
|
|
|
Loader {
|
|
id: loader
|
|
anchors.fill: parent
|
|
property string title: appPageHeaderRoot.title
|
|
sourceComponent: {
|
|
return appPageHeaderRoot.content === null ? defaultComponent : appPageHeaderRoot.content
|
|
}
|
|
}
|
|
|
|
Component {
|
|
id: defaultComponent
|
|
Item {
|
|
id: root
|
|
|
|
Item {
|
|
id: pluginSelectionBar
|
|
width: parent.width
|
|
height: parent.height
|
|
RowLayout {
|
|
anchors.fill: parent
|
|
anchors.leftMargin: 16
|
|
spacing: 12
|
|
AppControls2.StyleText {
|
|
Layout.fillWidth: true
|
|
Layout.fillHeight: true
|
|
verticalAlignment: Qt.AlignVCenter
|
|
text: appPageHeaderRoot.title
|
|
font.bold: true
|
|
}
|
|
|
|
PluginSelectButton {
|
|
id: pluginSelectButton
|
|
Layout.preferredWidth: 64
|
|
Layout.preferredHeight: 32
|
|
Layout.maximumHeight: 32
|
|
Layout.minimumWidth: 64
|
|
Layout.rightMargin: 8
|
|
Layout.alignment: Qt.AlignVCenter
|
|
}
|
|
}
|
|
}
|
|
|
|
function updateTitle(id) {
|
|
appPageHeaderRoot.title = appPageHeaderUtils.getPluginTitle(id);
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
updateTitle("");
|
|
appPageHeaderUtils.pluginChanged.connect(updateTitle);
|
|
}
|
|
|
|
Component.onDestruction: {
|
|
appPageHeaderUtils.pluginChanged.disconnect(updateTitle);
|
|
}
|
|
}
|
|
}
|
|
}
|