Skip to content

Commit

Permalink
feat(graph): allow it to take all panel
Browse files Browse the repository at this point in the history
This also revert to the previous behavior.

fix #74 (comment)
  • Loading branch information
orblazer committed Mar 31, 2024
1 parent a53206b commit f4b9caa
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
4 changes: 4 additions & 0 deletions package/contents/config/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
</group>

<group name="Appearance">
<entry name="fillPanel" type="Bool">
<default>false</default>
</entry>

<entry name="historyAmount" type="Int">
<default>10</default>
</entry>
Expand Down
9 changes: 9 additions & 0 deletions package/contents/ui/config/ConfigAppearance.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ KCM.AbstractKCM {
Kirigami.ColumnView.fillWidth: true

// Chart
property alias cfg_fillPanel: fillPanel.checked
property alias cfg_historyAmount: historyAmount.realValue
property alias cfg_customGraphWidth: graphWidth.customized
property alias cfg_graphWidth: graphWidth.value
Expand Down Expand Up @@ -68,6 +69,14 @@ KCM.AbstractKCM {

// Charts
Kirigami.FormLayout {
QQC2.CheckBox {
id: fillPanel
text: i18n("Fill panel?")

QQC2.ToolTip.visible: hovered
QQC2.ToolTip.text: i18nc("@info:tooltip", "This allow graphs to take all panel with /height")
}

RMControls.PredefinedSpinBox {
id: historyAmount
Kirigami.FormData.label: i18n("History amount:")
Expand Down
2 changes: 1 addition & 1 deletion package/contents/ui/config/ConfigGraph.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ KCM.ScrollViewKCM {
// TODO: handle "_v" changes

//#region // HACK: Present to suppress errors (https://bugs.kde.org/show_bug.cgi?id=484541)
property var cfg_verticalLayout
property var cfg_fillPanel
property var cfg_historyAmount
property var cfg_customGraphWidth
property var cfg_graphWidth
Expand Down
2 changes: 1 addition & 1 deletion package/contents/ui/config/ConfigMisc.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ KCM.SimpleKCM {

//#region // HACK: Present to suppress errors (https://bugs.kde.org/show_bug.cgi?id=484541)
property var cfg_graphs
property var cfg_verticalLayout
property var cfg_fillPanel
property var cfg_historyAmount
property var cfg_customGraphWidth
property var cfg_graphWidth
Expand Down
9 changes: 5 additions & 4 deletions package/contents/ui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import org.kde.plasma.plasma5support as Plasma5Support

PlasmoidItem {
id: root
// Margin for prevent "invsible" 0 and full lines
anchors.topMargin: 1
anchors.bottomMargin: 1

readonly property int graphVersion: 1 //? Bump when some settings changes in "graphs" structure
readonly property bool isVertical: {
Expand Down Expand Up @@ -39,7 +36,11 @@ PlasmoidItem {
Plasmoid.backgroundHints: PlasmaCore.Types.DefaultBackground | PlasmaCore.Types.ConfigurableBackground
Plasmoid.configurationRequired: graphsModel.length === 0 // Check if graphs is valid and have some items
preferredRepresentation: Plasmoid.configurationRequired ? compactRepresentation : fullRepresentation // Show graphs only if at least 1 is present, otherwise ask to configure
Plasmoid.constraintHints: Plasmoid.CanFillArea // Allow widget to take all height/width
Plasmoid.constraintHints: Plasmoid.configuration.fillPanel ? Plasmoid.CanFillArea : Plasmoid.NoHint// Allow widget to take all height/width

// Margin for prevent "invsible" 0 and full lines when fill panel
anchors.topMargin: Plasmoid.configuration.fillPanel ? 1 : 0
anchors.bottomMargin: Plasmoid.configuration.fillPanel ? 1 : 0

// Content
fullRepresentation: MouseArea {
Expand Down

0 comments on commit f4b9caa

Please sign in to comment.