improve vastly user interaction with indicators uis

work/spdx
Michail Vourlakos 4 years ago
parent 810fd7e3cd
commit c777fca05a

@ -147,12 +147,32 @@ void Factory::reload(const QString &indicatorPath)
&& (metadata.pluginId() != "org.kde.latte.plasma")
&& (metadata.pluginId() != "org.kde.latte.plasmatabstyle")) {
//! find correct alphabetical position
int newPos = -1;
if (!m_customPluginIds.contains(metadata.pluginId())) {
for (int i=0; i<m_customPluginNames.count(); ++i) {
if (QString::compare(metadata.name(), m_customPluginNames[i], Qt::CaseInsensitive)<=0) {
newPos = i;
break;
}
}
}
if (!m_customPluginIds.contains(metadata.pluginId())) {
m_customPluginIds << metadata.pluginId();
if (newPos == -1) {
m_customPluginIds << metadata.pluginId();
} else {
m_customPluginIds.insert(newPos, metadata.pluginId());
}
}
if (!m_customPluginNames.contains(metadata.name())) {
m_customPluginNames << metadata.name();
if (newPos == -1) {
m_customPluginNames << metadata.name();
} else {
m_customPluginNames.insert(newPos, metadata.name());
}
}
}

@ -151,6 +151,21 @@ void Indicator::setPluginIsReady(bool ready)
emit pluginIsReadyChanged();
}
int Indicator::index(const QString &type)
{
if (type == "org.kde.latte.default") {
return 0;
} else if (type == "org.kde.latte.plasma") {
return 1;
} else if (type == "org.kde.latte.plasmatabstyle") {
return 2;
} else if (customPluginIds().contains(type)){
return 3 + customPluginIds().indexOf(type);
}
return -1;
}
QString Indicator::type() const
{
return m_type;

@ -101,6 +101,8 @@ public:
bool pluginIsReady();
int index(const QString &type);
QString type() const;
void setType(QString type);

@ -22,6 +22,7 @@
// local
#include "primaryconfigview.h"
#include "../view.h"
#include "../indicator/indicator.h"
#include "../../lattecorona.h"
#include "../../indicator/factory.h"
@ -70,7 +71,6 @@ int IndicatorUiManager::index(const QString &type)
return -1;
}
void IndicatorUiManager::setParentItem(QQuickItem *parentItem)
{
m_parentItem = parentItem;
@ -89,13 +89,32 @@ void IndicatorUiManager::hideAllUi()
}
}
void IndicatorUiManager::showNextIndicator()
{
if (!m_parentItem) {
return;
}
if (auto *metaObject = m_parentItem->metaObject()) {
int methodIndex = metaObject->indexOfMethod("showNextIndicator()");
if (methodIndex == -1) {
qDebug() << "indicator parent page function showNextIndicator() was not found...";
return;
}
QMetaMethod method = metaObject->method(methodIndex);
method.invoke(m_parentItem);
}
}
void IndicatorUiManager::ui(const QString &type, Latte::View *view)
{
if (!m_parentItem) {
return;
}
hideAllUi();
// hideAllUi();
int typeIndex = index(type);
@ -106,7 +125,9 @@ void IndicatorUiManager::ui(const QString &type, Latte::View *view)
//! config ui has already been created and can be provided again
QQuickItem *qmlItem = qobject_cast<QQuickItem*>(m_uidata[typeIndex].ui->rootObject());
if (qmlItem) {
qmlItem->setVisible(true);
qmlItem->setParentItem(m_parentItem);
showNextIndicator();
//qmlItem->setVisible(true);
}
return;
}
@ -133,12 +154,29 @@ void IndicatorUiManager::ui(const QString &type, Latte::View *view)
uidata.ui->rootContext()->setContextProperty(QStringLiteral("indicator"), view->indicator());
uidata.ui->completeInitialization();
int newTypeIndex = view->indicator()->index(type);
int newPos = -1;
for (int i=0; i<m_uidata.count(); ++i) {
int oldTypeIndex = view->indicator()->index(m_uidata[i].type);
if (oldTypeIndex > newTypeIndex) {
newPos = i;
break;
}
}
if (newPos == -1) {
m_uidata << uidata;
} else {
m_uidata.insert(newPos, uidata);
}
QQuickItem *qmlItem = qobject_cast<QQuickItem*>(uidata.ui->rootObject());
if (qmlItem) {
qmlItem->setParentItem(m_parentItem);
showNextIndicator();
}
m_uidata << uidata;
}
}
}

@ -49,6 +49,7 @@ struct IndicatorUiData
{
QString type;
QString pluginPath;
QString name;
QPointer<Latte::View> view;
QPointer<KDeclarative::QmlObjectSharedEngine> ui;
};
@ -68,11 +69,12 @@ public slots:
Q_INVOKABLE void setParentItem(QQuickItem *parentItem);
Q_INVOKABLE void ui(const QString &type, Latte::View *view);
Q_INVOKABLE int index(const QString &type);
private:
bool contains(const QString &type);
int index(const QString &type);
void hideAllUi();
void showNextIndicator();
private:
QQuickItem *m_parentItem{nullptr};

@ -22,10 +22,12 @@ import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtQuick.Dialogs 1.2
import QtQuick.Controls 2.12 as QtQuickControls212
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.latte.core 0.2 as LatteCore
import org.kde.latte.components 1.0 as LatteComponents
@ -35,468 +37,471 @@ import "../../controls" as LatteExtraControls
PlasmaComponents.Page {
Layout.maximumWidth: content.width + content.Layout.leftMargin * 2
Layout.maximumHeight: content.height + units.smallSpacing * 2
Layout.maximumHeight: content.height + units.smallSpacing
ColumnLayout {
id: content
width: (dialog.appliedWidth - units.smallSpacing * 2) - Layout.leftMargin * 2
spacing: dialog.subGroupSpacing
anchors.horizontalCenter: parent.horizontalCenter
Layout.leftMargin: units.smallSpacing * 2
//! BEGIN: Shadows
ColumnLayout {
id: contentStatic
Layout.fillWidth: true
Layout.topMargin: units.smallSpacing
spacing: units.smallSpacing
spacing: dialog.subGroupSpacing
LatteComponents.HeaderSwitch {
id: showAppletShadow
//! BEGIN: Shadows
ColumnLayout {
Layout.fillWidth: true
Layout.minimumHeight: implicitHeight
Layout.topMargin: units.smallSpacing
checked: plasmoid.configuration.appletShadowsEnabled
text: i18n("Shadows")
tooltip: i18n("Enable/disable applet shadows")
spacing: units.smallSpacing
onPressed: plasmoid.configuration.appletShadowsEnabled = !plasmoid.configuration.appletShadowsEnabled;
}
LatteComponents.HeaderSwitch {
id: showAppletShadow
Layout.fillWidth: true
Layout.minimumHeight: implicitHeight
Layout.topMargin: units.smallSpacing
ColumnLayout {
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
spacing: 0
checked: plasmoid.configuration.appletShadowsEnabled
text: i18n("Shadows")
tooltip: i18n("Enable/disable applet shadows")
RowLayout{
enabled: showAppletShadow.checked
onPressed: plasmoid.configuration.appletShadowsEnabled = !plasmoid.configuration.appletShadowsEnabled;
}
PlasmaComponents.Label {
enabled: showAppletShadow.checked
text: i18n("Size")
horizontalAlignment: Text.AlignLeft
}
ColumnLayout {
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
spacing: 0
LatteComponents.Slider {
id: shadowSizeSlider
Layout.fillWidth: true
RowLayout{
enabled: showAppletShadow.checked
value: plasmoid.configuration.shadowSize
from: 0
to: 100
stepSize: 5
wheelEnabled: false
function updateShadowSize() {
if (!pressed)
plasmoid.configuration.shadowSize = value;
PlasmaComponents.Label {
enabled: showAppletShadow.checked
text: i18n("Size")
horizontalAlignment: Text.AlignLeft
}
onPressedChanged: {
updateShadowSize();
}
LatteComponents.Slider {
id: shadowSizeSlider
Layout.fillWidth: true
enabled: showAppletShadow.checked
Component.onCompleted: {
valueChanged.connect(updateShadowSize);
}
value: plasmoid.configuration.shadowSize
from: 0
to: 100
stepSize: 5
wheelEnabled: false
Component.onDestruction: {
valueChanged.disconnect(updateShadowSize);
}
}
function updateShadowSize() {
if (!pressed)
plasmoid.configuration.shadowSize = value;
}
PlasmaComponents.Label {
enabled: showAppletShadow.checked
text: i18nc("number in percentage, e.g. 85 %","%0 %").arg(shadowSizeSlider.value)
horizontalAlignment: Text.AlignRight
Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4
Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4
}
}
onPressedChanged: {
updateShadowSize();
}
Component.onCompleted: {
valueChanged.connect(updateShadowSize);
}
RowLayout{
enabled: showAppletShadow.checked
Component.onDestruction: {
valueChanged.disconnect(updateShadowSize);
}
}
PlasmaComponents.Label {
enabled: showAppletShadow.checked
text: i18n("Opacity")
horizontalAlignment: Text.AlignLeft
PlasmaComponents.Label {
enabled: showAppletShadow.checked
text: i18nc("number in percentage, e.g. 85 %","%0 %").arg(shadowSizeSlider.value)
horizontalAlignment: Text.AlignRight
Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4
Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4
}
}
LatteComponents.Slider {
id: shadowOpacitySlider
Layout.fillWidth: true
value: plasmoid.configuration.shadowOpacity
from: 0
to: 100
stepSize: 5
wheelEnabled: false
RowLayout{
enabled: showAppletShadow.checked
function updateShadowOpacity() {
if (!pressed)
plasmoid.configuration.shadowOpacity = value;
PlasmaComponents.Label {
enabled: showAppletShadow.checked
text: i18n("Opacity")
horizontalAlignment: Text.AlignLeft
}
onPressedChanged: {
updateShadowOpacity();
}
LatteComponents.Slider {
id: shadowOpacitySlider
Layout.fillWidth: true
Component.onCompleted: {
valueChanged.connect(updateShadowOpacity);
}
value: plasmoid.configuration.shadowOpacity
from: 0
to: 100
stepSize: 5
wheelEnabled: false
Component.onDestruction: {
valueChanged.disconnect(updateShadowOpacity);
}
}
PlasmaComponents.Label {
enabled: showAppletShadow.checked
text: i18nc("number in percentage, e.g. 85 %","%0 %").arg(shadowOpacitySlider.value)
horizontalAlignment: Text.AlignRight
Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4
Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4
}
}
function updateShadowOpacity() {
if (!pressed)
plasmoid.configuration.shadowOpacity = value;
}
LatteComponents.SubHeader {
isFirstSubCategory: true
text: i18n("Color")
}
onPressedChanged: {
updateShadowOpacity();
}
RowLayout {
id: shadowColorRow
Layout.fillWidth: true
spacing: 2
enabled: showAppletShadow.checked
Component.onCompleted: {
valueChanged.connect(updateShadowOpacity);
}
readonly property string defaultShadow: "080808"
readonly property string themeShadow: {
var strC = String(theme.textColor);
Component.onDestruction: {
valueChanged.disconnect(updateShadowOpacity);
}
}
return strC.indexOf("#") === 0 ? strC.substr(1) : strC;
PlasmaComponents.Label {
enabled: showAppletShadow.checked
text: i18nc("number in percentage, e.g. 85 %","%0 %").arg(shadowOpacitySlider.value)
horizontalAlignment: Text.AlignRight
Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4
Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4
}
}
ExclusiveGroup {
id: shadowColorGroup
LatteComponents.SubHeader {
isFirstSubCategory: true
text: i18n("Color")
}
PlasmaComponents.Button {
id: defaultShadowBtn
RowLayout {
id: shadowColorRow
Layout.fillWidth: true
spacing: 2
enabled: showAppletShadow.checked
text: i18nc("default shadow", "Default")
checked: plasmoid.configuration.shadowColorType === type
checkable: false
exclusiveGroup: shadowColorGroup
tooltip: i18n("Default shadow for applets")
readonly property string defaultShadow: "080808"
readonly property string themeShadow: {
var strC = String(theme.textColor);
readonly property int type: LatteContainment.Types.DefaultColorShadow
return strC.indexOf("#") === 0 ? strC.substr(1) : strC;
}
onPressedChanged: {
if (pressed) {
plasmoid.configuration.shadowColorType = type;
}
ExclusiveGroup {
id: shadowColorGroup
}
}
PlasmaComponents.Button {
id: themeShadowBtn
Layout.fillWidth: true
PlasmaComponents.Button {
id: defaultShadowBtn
Layout.fillWidth: true
text: i18nc("theme shadow", "Theme")
checked: plasmoid.configuration.shadowColorType === type
checkable: false
exclusiveGroup: shadowColorGroup
tooltip: i18n("Shadow from theme color palette")
text: i18nc("default shadow", "Default")
checked: plasmoid.configuration.shadowColorType === type
checkable: false
exclusiveGroup: shadowColorGroup
tooltip: i18n("Default shadow for applets")
readonly property int type: LatteContainment.Types.ThemeColorShadow
readonly property int type: LatteContainment.Types.DefaultColorShadow
onPressedChanged: {
if (pressed) {
plasmoid.configuration.shadowColorType = type;
onPressedChanged: {
if (pressed) {
plasmoid.configuration.shadowColorType = type;
}
}
}
}
//overlayed button
PlasmaComponents.Button {
id: userShadowBtn
Layout.fillWidth: true
height: parent.height
text: " "
PlasmaComponents.Button {
id: themeShadowBtn
Layout.fillWidth: true
checkable: false
checked: plasmoid.configuration.shadowColorType === type
tooltip: i18n("Use set shadow color")
exclusiveGroup: shadowColorGroup
text: i18nc("theme shadow", "Theme")
checked: plasmoid.configuration.shadowColorType === type
checkable: false
exclusiveGroup: shadowColorGroup
tooltip: i18n("Shadow from theme color palette")
readonly property int type: LatteContainment.Types.UserColorShadow
readonly property int type: LatteContainment.Types.ThemeColorShadow
onPressedChanged: {
if (pressed) {
plasmoid.configuration.shadowColorType = type;
onPressedChanged: {
if (pressed) {
plasmoid.configuration.shadowColorType = type;
}
}
}
Rectangle{
anchors.fill: parent
anchors.margins: 1.5*units.smallSpacing
//overlayed button
PlasmaComponents.Button {
id: userShadowBtn
Layout.fillWidth: true
height: parent.height
text: " "
color: "#" + plasmoid.configuration.shadowColor;
checkable: false
checked: plasmoid.configuration.shadowColorType === type
tooltip: i18n("Use set shadow color")
exclusiveGroup: shadowColorGroup
opacity: shadowColorRow.enabled ? 1 : 0.6
readonly property int type: LatteContainment.Types.UserColorShadow
Rectangle{
anchors.fill: parent
color: "transparent"
border.width: 1
border.color: theme.textColor
opacity: parent.opacity - 0.4
onPressedChanged: {
if (pressed) {
plasmoid.configuration.shadowColorType = type;
}
}
MouseArea{
Rectangle{
anchors.fill: parent
onClicked: {
shadowColorGroup.current = userShadowBtn;
viewConfig.setSticker(true);
colorDialogLoader.showDialog = true;
anchors.margins: 1.5*units.smallSpacing
color: "#" + plasmoid.configuration.shadowColor;
opacity: shadowColorRow.enabled ? 1 : 0.6
Rectangle{
anchors.fill: parent
color: "transparent"
border.width: 1
border.color: theme.textColor
opacity: parent.opacity - 0.4
}
MouseArea{
anchors.fill: parent
onClicked: {
shadowColorGroup.current = userShadowBtn;
viewConfig.setSticker(true);
colorDialogLoader.showDialog = true;
}
}
}
}
Loader{
id:colorDialogLoader
property bool showDialog: false
active: showDialog
Loader{
id:colorDialogLoader
property bool showDialog: false
active: showDialog
sourceComponent: ColorDialog {
title: i18n("Please choose shadow color")
showAlphaChannel: false
sourceComponent: ColorDialog {
title: i18n("Please choose shadow color")
showAlphaChannel: false
onAccepted: {
//console.log("You chose: " + String(color));
var strC = String(color);
if (strC.indexOf("#") === 0) {
plasmoid.configuration.shadowColor = strC.substr(1);
}
onAccepted: {
//console.log("You chose: " + String(color));
var strC = String(color);
if (strC.indexOf("#") === 0) {
plasmoid.configuration.shadowColor = strC.substr(1);
}
colorDialogLoader.showDialog = false;
viewConfig.setSticker(false);
}
onRejected: {
colorDialogLoader.showDialog = false;
viewConfig.setSticker(false);
}
Component.onCompleted: {
color = String("#" + plasmoid.configuration.shadowColor);
visible = true;
colorDialogLoader.showDialog = false;
viewConfig.setSticker(false);
}
onRejected: {
colorDialogLoader.showDialog = false;
viewConfig.setSticker(false);
}
Component.onCompleted: {
color = String("#" + plasmoid.configuration.shadowColor);
visible = true;
}
}
}
}
}
}
}
}
//! END: Shadows
//! END: Shadows
//! BEGIN: Animations
ColumnLayout {
Layout.fillWidth: true
Layout.topMargin: units.smallSpacing
spacing: units.smallSpacing
LatteComponents.HeaderSwitch {
id: animationsHeader
//! BEGIN: Animations
ColumnLayout {
Layout.fillWidth: true
Layout.minimumHeight: implicitHeight
Layout.topMargin: units.smallSpacing
spacing: units.smallSpacing
checked: plasmoid.configuration.animationsEnabled
text: i18n("Animations")
tooltip: i18n("Enable/disable all animations")
onPressed: {
plasmoid.configuration.animationsEnabled = !plasmoid.configuration.animationsEnabled;
}
}
LatteComponents.HeaderSwitch {
id: animationsHeader
Layout.fillWidth: true
Layout.minimumHeight: implicitHeight
Layout.topMargin: units.smallSpacing
ColumnLayout {
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
spacing: 0
enabled: plasmoid.configuration.animationsEnabled
checked: plasmoid.configuration.animationsEnabled
text: i18n("Animations")
tooltip: i18n("Enable/disable all animations")
LatteComponents.SubHeader {
isFirstSubCategory: true
text: i18n("Speed")
onPressed: {
plasmoid.configuration.animationsEnabled = !plasmoid.configuration.animationsEnabled;
}
}
ColumnLayout {
Layout.fillWidth: true
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
spacing: 0
enabled: plasmoid.configuration.animationsEnabled
RowLayout {
Layout.fillWidth: true
spacing: 2
property int duration: plasmoid.configuration.durationTime
LatteComponents.SubHeader {
isFirstSubCategory: true
text: i18n("Speed")
}
ExclusiveGroup {
id: animationsGroup
}
ColumnLayout {
Layout.fillWidth: true
spacing: 0
PlasmaComponents.Button {
RowLayout {
Layout.fillWidth: true
text: i18n("x1")
checked: parent.duration === duration
checkable: false
exclusiveGroup: animationsGroup
spacing: 2
readonly property int duration: 3
property int duration: plasmoid.configuration.durationTime
onPressedChanged: {
if (pressed) {
plasmoid.configuration.durationTime = duration;
}
ExclusiveGroup {
id: animationsGroup
}
}
PlasmaComponents.Button {
Layout.fillWidth: true
text: i18n("x2")
checked: parent.duration === duration
checkable: false
exclusiveGroup: animationsGroup
readonly property int duration: 2
PlasmaComponents.Button {
Layout.fillWidth: true
text: i18n("x1")
checked: parent.duration === duration
checkable: false
exclusiveGroup: animationsGroup
onPressedChanged: {
if (pressed) {
plasmoid.configuration.durationTime = duration;
readonly property int duration: 3
onPressedChanged: {
if (pressed) {
plasmoid.configuration.durationTime = duration;
}
}
}
}
PlasmaComponents.Button {
Layout.fillWidth: true
text: i18n("x3")
checked: parent.duration === duration
checkable: false
exclusiveGroup: animationsGroup
readonly property int duration: 1
onPressedChanged: {
if (pressed) {
plasmoid.configuration.durationTime = duration;
PlasmaComponents.Button {
Layout.fillWidth: true
text: i18n("x2")
checked: parent.duration === duration
checkable: false
exclusiveGroup: animationsGroup
readonly property int duration: 2
onPressedChanged: {
if (pressed) {
plasmoid.configuration.durationTime = duration;
}
}
}
PlasmaComponents.Button {
Layout.fillWidth: true
text: i18n("x3")
checked: parent.duration === duration
checkable: false
exclusiveGroup: animationsGroup
readonly property int duration: 1
onPressedChanged: {
if (pressed) {
plasmoid.configuration.durationTime = duration;
}
}
}
}
}
}
}
}
//! END: Animations
//! END: Animations
//! BEGIN: Active Indicator General Settings
ColumnLayout{
spacing: units.smallSpacing
//! BEGIN: Active Indicator General Settings
ColumnLayout{
spacing: units.smallSpacing
LatteComponents.HeaderSwitch {
id: indicatorsSwitch
Layout.fillWidth: true
Layout.minimumHeight: implicitHeight
LatteComponents.HeaderSwitch {
id: indicatorsSwitch
Layout.fillWidth: true
Layout.minimumHeight: implicitHeight
checked: latteView.indicator.enabled
text: i18n("Indicators")
tooltip: i18n("Enable/disable indicators")
checked: latteView.indicator.enabled
text: i18n("Indicators")
tooltip: i18n("Enable/disable indicators")
onPressed: {
latteView.indicator.enabled = !latteView.indicator.enabled;
onPressed: {
latteView.indicator.enabled = !latteView.indicator.enabled;
}
}
}
ColumnLayout {
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
spacing: units.smallSpacing
enabled: indicatorsSwitch.checked
ColumnLayout {
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
spacing: units.smallSpacing
enabled: indicatorsSwitch.checked
/* LatteComponents.SubHeader {
/* LatteComponents.SubHeader {
text: i18n("Style")
}*/
Item {
Layout.fillWidth: true
Layout.minimumHeight: tabBar.height
Item {
Layout.fillWidth: true
Layout.minimumHeight: tabBar.height
PlasmaComponents.TabBar {
id: tabBar
width: parent.width
PlasmaComponents.TabBar {
id: tabBar
width: parent.width
property string type: latteView.indicator.type
property string type: latteView.indicator.type
PlasmaComponents.TabButton {
id: latteBtn
text: i18nc("latte indicator style", "Latte")
readonly property string type: "org.kde.latte.default"
PlasmaComponents.TabButton {
id: latteBtn
text: i18nc("latte indicator style", "Latte")
readonly property string type: "org.kde.latte.default"
onCheckedChanged: {
if (checked) {
latteView.indicator.type = type;
onCheckedChanged: {
if (checked) {
latteView.indicator.type = type;
}
}
}
}
PlasmaComponents.TabButton {
id: plasmaBtn
text: i18nc("plasma indicator style", "Plasma")
readonly property string type: "org.kde.latte.plasma"
onCheckedChanged: {
if (checked) {
latteView.indicator.type = type;
PlasmaComponents.TabButton {
id: plasmaBtn
text: i18nc("plasma indicator style", "Plasma")
readonly property string type: "org.kde.latte.plasma"
onCheckedChanged: {
if (checked) {
latteView.indicator.type = type;
}
}
}
}
PlasmaComponents.TabButton {
id: customBtn
PlasmaComponents.TabButton {
id: customBtn
onCheckedChanged: {
if (checked) {
customIndicator.onButtonIsPressed();
onCheckedChanged: {
if (checked) {
customIndicator.onButtonIsPressed();
}
}
}
LatteExtraControls.CustomIndicatorButton {
id: customIndicator
anchors.fill: parent
implicitWidth: latteBtn.implicitWidth
implicitHeight: latteBtn.implicitHeight
LatteExtraControls.CustomIndicatorButton {
id: customIndicator
anchors.fill: parent
implicitWidth: latteBtn.implicitWidth
implicitHeight: latteBtn.implicitHeight
checked: parent.checked
comboBoxMinimumPopUpWidth: 1.5 * customIndicator.width
checked: parent.checked
comboBoxMinimumPopUpWidth: 1.5 * customIndicator.width
}
}
}
}
Rectangle {
anchors.bottom: tabBar.bottom
anchors.left: tabBar.left
anchors.leftMargin: 2
width: tabBar.width - 2*2
height: 2
color: theme.textColor
opacity: 0.25
Rectangle {
anchors.bottom: tabBar.bottom
anchors.left: tabBar.left
anchors.leftMargin: 2
width: tabBar.width - 2*2
height: 2
color: theme.textColor
opacity: 0.25
}
}
}
//! BEGIN: Indicator specific sub-options
ColumnLayout {
//! BEGIN: Indicator specific sub-options
/* ColumnLayout {
id: indicatorSpecificOptions
Layout.fillWidth: true
Layout.topMargin: units.smallSpacing * 2
@ -526,10 +531,185 @@ PlasmaComponents.Page {
}
}
}
}*/
//! END: Indicator specific sub-options
}
//! END: Indicator specific sub-options
}
}
//! END: Active Indicator General Settings
}
//! END: Active Indicator General Settings
} //Static properties column
ColumnLayout {
id: contentDynamic
Layout.fillWidth: true
height: pagesBackground.height - contentStatic.height - 3*units.smallSpacing
spacing: dialog.subGroupSpacing
Rectangle {
id: indicatorsBackground
Layout.fillWidth: true
Layout.minimumHeight: parent.height
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
color: "transparent"
PlasmaExtras.ScrollArea {
id: scrollArea
anchors.fill: parent
verticalScrollBarPolicy: Qt.ScrollBarAsNeeded
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
flickableItem.flickableDirection: Flickable.VerticalFlick
QtQuickControls212.StackView {
id: indicatorsStackView
width: Math.max(currentItem.Layout.maximumWidth, currentItem.width)
height: Math.max(currentItem.Layout.maximumHeight, currentItem.height)
enabled: latteView.indicator.enabled
property bool forwardSliding: true
readonly property int optionsWidth: dialog.optionsWidth
readonly property bool deprecatedOptionsAreHidden: true // @since 0.10.0
replaceEnter: Transition {
ParallelAnimation {
PropertyAnimation {
property: "x"
from: indicatorsStackView.forwardSliding ? -indicatorsBackground.width : indicatorsBackground.width
to: 0
duration: 350
}
PropertyAnimation {
property: "opacity"
from: 0
to: 1
duration: 350
}
}
}
replaceExit: Transition {
ParallelAnimation {
PropertyAnimation {
property: "x"
from: 0
to: indicatorsStackView.forwardSliding ? indicatorsBackground.width : -indicatorsBackground.width
duration: 350
}
PropertyAnimation {
property: "opacity"
from: 1
to: 0
duration: 350
}
}
}
}
}
Item {
id: hiddenIndicatorPage
anchors.fill: parent
visible: false
readonly property int optionsWidth: dialog.optionsWidth
readonly property bool deprecatedOptionsAreHidden: true // @since 0.10.0
readonly property Item nextPage: indicatorsStackView.currentItem === page1 ? page2 : page1
readonly property Item previousPage: nextPage === page1 ? page2 : page1
function showNextIndicator() {
console.log("show next indicator in qml called, children:: " + children.length);
if (children.length===1) {
var nextIndicator = children[0];
if (nextIndicator && (!indicatorsStackView.currentItem || !indicatorsStackView.currentItem.isCurrent)) {
//!empty nextPage by moving its pages into hiddenPages
var childrenCount = nextPage.children.length;
for (var i=0; i<childrenCount; ++i) {
var previousIndicator = nextPage.children[0];
previousIndicator.visible = false;
previousIndicator.parent = hiddenPages;
}
nextIndicator.parent = nextPage;
nextIndicator.visible = true;
nextPage.type = latteView.indicator.type;
var currentIndex = -1;
if (indicatorsStackView.currentItem) {
currentIndex = viewConfig.indicatorUiManager.index(indicatorsStackView.currentItem.type);
}
var nextIndex = viewConfig.indicatorUiManager.index(latteView.indicator.type);
indicatorsStackView.forwardSliding = (nextIndex<currentIndex);
indicatorsStackView.replace(indicatorsStackView.currentItem, nextPage);
}
}
}
Component.onCompleted: {
viewConfig.indicatorUiManager.setParentItem(hiddenIndicatorPage);
viewConfig.indicatorUiManager.ui(latteView.indicator.type, latteView);
}
Connections {
target: latteView.indicator
onPluginChanged: viewConfig.indicatorUiManager.ui(latteView.indicator.type, latteView);
}
Connections {
target: viewConfig
onIsReadyChanged: {
if (viewConfig.isReady) {
viewConfig.indicatorUiManager.ui(latteView.indicator.type, latteView);
}
}
}
}
Item {
id: hidden
visible: false
ColumnLayout {
id: page1
width: indicatorsBackground.width
height: childrenRect.height
readonly property bool isCurrent: latteView.indicator.type === type
readonly property bool deprecatedOptionsAreHidden: true // @since 0.10.0
readonly property int optionsWidth: dialog.optionsWidth
property string type: ""
}
ColumnLayout {
id: page2
width: indicatorsBackground.width
height: childrenRect.height
readonly property bool isCurrent: latteView.indicator.type === type
readonly property bool deprecatedOptionsAreHidden: true // @since 0.10.0
readonly property int optionsWidth: dialog.optionsWidth
property string type: ""
}
ColumnLayout {
id: hiddenPages
width: indicatorsBackground.width
height: childrenRect.height
readonly property bool isCurrent: latteView.indicator.type === type
readonly property bool deprecatedOptionsAreHidden: true // @since 0.10.0
readonly property int optionsWidth: dialog.optionsWidth
property string type: ""
}
}
}
}//! END of Dynamic content
} //! END of ALL content
}

Loading…
Cancel
Save