1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-24 17:33:50 +03:00

update indicators to primary config singleton

This commit is contained in:
Michail Vourlakos 2020-07-04 15:31:53 +03:00
parent fcde318d7a
commit 6652cb9a15
3 changed files with 14 additions and 82 deletions

View File

@ -267,6 +267,11 @@ void PrimaryConfigView::initView(Latte::View *view)
QObject::disconnect(var);
}
if (m_latteView && m_latteView->indicator()) {
//! destroy indicator config ui when the configuration window is closed
m_latteView->indicator()->releaseConfigUi();
}
m_latteView = view;
viewconnections << connect(this, &PrimaryConfigView::inAdvancedModeChanged, m_latteView, &Latte::View::inSettingsAdvancedModeChanged);

View File

@ -53,88 +53,6 @@ PlasmaComponents.Page {
anchors.horizontalCenter: parent.horizontalCenter
Layout.leftMargin: units.smallSpacing * 2
//! BEGIN: Layout
ColumnLayout {
Layout.fillWidth: true
Layout.topMargin: units.smallSpacing
spacing: units.smallSpacing
visible: false
LatteComponents.Header {
text: i18n("Layout")
}
RowLayout {
Layout.fillWidth: true
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
spacing: units.smallSpacing
LatteComponents.ComboBox {
id: layoutCmb
Layout.fillWidth: true
property var layoutTexts: [];
property var layouts;
Component.onCompleted: loadLayouts();
Connections {
target:layoutsManager
onMenuLayoutsChanged: layoutCmb.loadLayouts();
}
function loadLayouts(){
layouts = layoutsManager.menuLayouts;
layoutTexts = [];
//if current layout isnt at the menu layouts
if (layouts.indexOf(layoutsManager.currentLayoutName) === -1) {
if (Qt.application.layoutDirection === Qt.RightToLeft) {
layoutTexts.push( layoutsManager.currentLayoutName + " ✔ ");
} else {
layoutTexts.push( " ✔ "+layoutsManager.currentLayoutName);
}
}
var activeLayout = 0;
for(var i=0; i<layouts.length; ++i){
var selText1 = " ";
var selText2 = " ";
if (layouts[i] === layoutsManager.currentLayoutName) {
selText1 = " ✔ ";
activeLayout = i;
}
if (Qt.application.layoutDirection === Qt.RightToLeft) {
layoutTexts.push(selText2+layouts[i]+selText1);
} else {
layoutTexts.push(selText1+layouts[i]+selText2);
}
}
model = layoutTexts;
currentIndex = activeLayout;
}
onActivated: {
layoutsManager.switchToLayout(layouts[index]);
}
}
PlasmaComponents.Button {
text: i18nc("opens the layout manager window","Configure...")
iconSource: "document-edit"
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
onClicked: layoutsManager.showLatteSettingsDialog()
}
}
}
//! END: Layout
//! BEGIN: Items
ColumnLayout {
Layout.fillWidth: true

View File

@ -486,6 +486,15 @@ PlasmaComponents.Page {
target: latteView.indicator
onPluginChanged: latteView.indicator.configUiFor(latteView.indicator.type, indicatorSpecificOptions);
}
Connections {
target: viewConfig
onIsReadyChanged: {
if (viewConfig.isReady) {
latteView.indicator.configUiFor(latteView.indicator.type, indicatorSpecificOptions);
}
}
}
}
//! END: Indicator specific sub-options
}