Commit a475eb45 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use more readonly property

parent 9f577dc3
......@@ -36,7 +36,7 @@ import org.kde.plasma.components 2.0 as Components
Item {
id: main
property real w1: (main.height-5*units.smallSpacing)*dots/4
readonly property real w1: (main.height-5*units.smallSpacing)*dots/4
Layout.minimumWidth: w1 < 20 ? 20 : w1
Layout.maximumWidth: Infinity
......@@ -47,30 +47,30 @@ Item {
//Layout.preferredHeight: Layout.minimumHeight
property int formFactor: plasmoid.formFactor
readonly property int formFactor: plasmoid.formFactor
property bool constrained: formFactor == PlasmaCore.Types.Vertical || formFactor == PlasmaCore.Types.Horizontal
readonly property bool constrained: formFactor == PlasmaCore.Types.Vertical || formFactor == PlasmaCore.Types.Horizontal
property bool showSeconds: root.showSeconds
readonly property bool showSeconds: root.showSeconds
property int hours:root.hours
property int minutes:root.minutes
property int seconds:root.seconds
readonly property int hours: root.hours
readonly property int minutes: root.minutes
readonly property int seconds: root.seconds
property bool showOffLeds: plasmoid.configuration.showOffLeds
property bool showGrid: plasmoid.configuration.showGrid
property int base: plasmoid.configuration.showBcdFormat? 10:16
readonly property bool showOffLeds: plasmoid.configuration.showOffLeds
readonly property bool showGrid: plasmoid.configuration.showGrid
property int dots: showSeconds? 6:4
readonly property int base: plasmoid.configuration.showBcdFormat? 10:16
property color onColor: plasmoid.configuration.useCustomColorForActive?plasmoid.configuration.customColorForActive: theme.textColor
property color offColor: plasmoid.configuration.useCustomColorForInactive?plasmoid.configuration.customColorForInactive:Qt.rgba(onColor.r,onColor.g,onColor.b,0.4)
property color gridColor: plasmoid.configuration.useCustomColorForGrid?plasmoid.configuration.customColorForGrid:Qt.rgba(onColor.r,onColor.g,onColor.b,0.6)
readonly property int dots: showSeconds? 6:4
property real dotSize: Math.min((height-5*units.smallSpacing)/4,(width-(dots+1)*units.smallSpacing)/dots)
property real displayTop: (height - 4*dotSize-3*units.smallSpacing) /2
property real displayLeft: (width - dots*dotSize-(dots-1)*units.smallSpacing) /2
readonly property color onColor: plasmoid.configuration.useCustomColorForActive?plasmoid.configuration.customColorForActive: theme.textColor
readonly property color offColor: plasmoid.configuration.useCustomColorForInactive?plasmoid.configuration.customColorForInactive:Qt.rgba(onColor.r,onColor.g,onColor.b,0.4)
readonly property color gridColor: plasmoid.configuration.useCustomColorForGrid?plasmoid.configuration.customColorForGrid:Qt.rgba(onColor.r,onColor.g,onColor.b,0.6)
readonly property real dotSize: Math.min((height-5*units.smallSpacing)/4,(width-(dots+1)*units.smallSpacing)/dots)
readonly property real displayTop: (height - 4*dotSize-3*units.smallSpacing) /2
readonly property real displayLeft: (width - dots*dotSize-(dots-1)*units.smallSpacing) /2
MouseArea {
id: mouseArea
......
......@@ -51,10 +51,10 @@ Item {
property int decimals: 0;
property int inputSize: 0;
property int maxInputLength: 18; // More than that and the number notation
// turns scientific (i.e.: 1.32324e+12).
// When calculating 1/3 the answer is
// 18 characters long.
readonly property int maxInputLength: 18; // More than that and the number notation
// turns scientific (i.e.: 1.32324e+12).
// When calculating 1/3 the answer is
// 18 characters long.
Keys.onDigit0Pressed: { digitClicked(0); }
Keys.onDigit1Pressed: { digitClicked(1); }
......
......@@ -26,8 +26,8 @@ import org.kde.kquickcontrolsaddons 2.0
Item {
id: mainWindow
property int implicitWidth: units.gridUnit * 40
property int implicitHeight: units.gridUnit * 15
readonly property int implicitWidth: units.gridUnit * 40
readonly property int implicitHeight: units.gridUnit * 15
Plasmoid.switchWidth: {
if (centerLayout.comicData.image) {
return Math.max(minimumWidth, Math.min(centerLayout.comicData.image.nativeWidth * 0.6, implicitWidth));
......@@ -47,12 +47,12 @@ Item {
width: implicitWidth
height: implicitHeight
property int minimumWidth: units.gridUnit * 8
property int minimumHeight: units.gridUnit * 8
property bool showComicAuthor: plasmoid.nativeInterface.showComicAuthor
property bool showComicTitle: plasmoid.nativeInterface.showComicTitle
property bool showErrorPicture: plasmoid.nativeInterface.showErrorPicture
property bool middleClick: plasmoid.nativeInterface.middleClick
readonly property int minimumWidth: units.gridUnit * 8
readonly property int minimumHeight: units.gridUnit * 8
readonly property bool showComicAuthor: plasmoid.nativeInterface.showComicAuthor
readonly property bool showComicTitle: plasmoid.nativeInterface.showComicTitle
readonly property bool showErrorPicture: plasmoid.nativeInterface.showErrorPicture
readonly property bool middleClick: plasmoid.nativeInterface.middleClick
Connections {
target: plasmoid.nativeInterface
......@@ -118,8 +118,8 @@ Item {
delegate: PlasmaComponents.TabButton {
id: tabButton
property string key: model.key
property bool highlighted: model.highlight
readonly property string key: model.key
readonly property bool highlighted: model.highlight
text: model.title
iconSource: model.icon
......
......@@ -27,7 +27,7 @@ Item {
Layout.minimumWidth: Math.max(boardSize * 10, controlsRow.width)
Layout.preferredWidth: Math.max(boardSize * 10, controlsRow.width)
property int boardSize: plasmoid.configuration.boardSize
readonly property int boardSize: plasmoid.configuration.boardSize
property Component piece: Piece {}
property var pieces: []
......
......@@ -41,12 +41,12 @@ Rectangle {
signal activated(int position)
property int boardSize: plasmoid.configuration.boardSize
property int margin: units.smallSpacing
property int pieceWidth: (parent.width - (margin * boardSize)) / boardSize
property int pieceHeight: (parent.height - (margin * boardSize)) / boardSize
property int boardColumn: (position % boardSize)
property int boardRow: Math.floor(position / boardSize)
readonly property int boardSize: plasmoid.configuration.boardSize
readonly property int margin: units.smallSpacing
readonly property int pieceWidth: (parent.width - (margin * boardSize)) / boardSize
readonly property int pieceHeight: (parent.height - (margin * boardSize)) / boardSize
readonly property int boardColumn: (position % boardSize)
readonly property int boardRow: Math.floor(position / boardSize)
property int number
property int position
......
......@@ -35,9 +35,9 @@ Item {
Layout.maximumHeight: vertical ? Layout.minimumHeight : Infinity
Layout.preferredHeight: vertical ? Layout.minimumHeight : theme.mSize(theme.defaultFont).height * 2
property bool vertical: plasmoid.formFactor == PlasmaCore.Types.Vertical
readonly property bool vertical: plasmoid.formFactor == PlasmaCore.Types.Vertical
property int fuzzyness: plasmoid.configuration.fuzzyness
readonly property int fuzzyness: plasmoid.configuration.fuzzyness
readonly property var hourNames: [
[ i18n("One o’clock"),
......
......@@ -52,7 +52,7 @@ Item {
property string activeSource: ""
property string transitionSource: ""
property bool pause: overlayMouseArea.containsMouse
readonly property bool pause: overlayMouseArea.containsMouse
readonly property int itemCount: (items.count + items.futureLength())
readonly property bool hasItems: ((itemCount > 0) || (items.futureLength() > 0))
......
......@@ -51,8 +51,8 @@ PlasmaCore.SvgItem {
Plasmoid.backgroundHints: PlasmaCore.Types.NoBackground
//this isn't a frameSVG, the default SVG margins take up around 7% of the frame size, so we use that
property real horizontalMargins: width * 0.07
property real verticalMargins: height * 0.07
readonly property real horizontalMargins: width * 0.07
readonly property real verticalMargins: height * 0.07
//note is of type Note
property QtObject note: noteManager.loadNote(plasmoid.configuration.noteId);
......
......@@ -25,7 +25,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore
ColumnLayout {
property bool vertical: plasmoid.formFactor == PlasmaCore.Types.Vertical || (plasmoid.formFactor == PlasmaCore.Types.Planar && plasmoid.height > plasmoid.width)
readonly property bool vertical: plasmoid.formFactor == PlasmaCore.Types.Vertical || (plasmoid.formFactor == PlasmaCore.Types.Planar && plasmoid.height > plasmoid.width)
property alias cfg_maxSectionCount: maxSectionCount.value
property alias cfg_showLauncherNames: showLauncherNames.checked
......
......@@ -28,11 +28,11 @@ import "layout.js" as LayoutManager
Item {
id: iconItem
property int itemIndex : index
readonly property int itemIndex : index
property bool dragging : false
property bool isPopupItem : false
property var launcher : logic.launcherData(url)
property string iconName : launcher.iconName || "fork"
readonly property var launcher : logic.launcherData(url)
readonly property string iconName : launcher.iconName || "fork"
width: isPopupItem ? LayoutManager.popupItemWidth() : grid.cellWidth
height: isPopupItem ? LayoutManager.popupItemHeight() : grid.cellHeight
......
......@@ -31,12 +31,12 @@ import "layout.js" as LayoutManager
Item {
id: root
property int maxSectionCount: plasmoid.configuration.maxSectionCount
property bool showLauncherNames : plasmoid.configuration.showLauncherNames
property bool enablePopup : plasmoid.configuration.enablePopup
property string title : plasmoid.formFactor == PlasmaCore.Types.Planar ? plasmoid.configuration.title : ""
property bool vertical : plasmoid.formFactor == PlasmaCore.Types.Vertical || (plasmoid.formFactor == PlasmaCore.Types.Planar && height > width)
property bool horizontal : plasmoid.formFactor == PlasmaCore.Types.Horizontal
readonly property int maxSectionCount: plasmoid.configuration.maxSectionCount
readonly property bool showLauncherNames : plasmoid.configuration.showLauncherNames
readonly property bool enablePopup : plasmoid.configuration.enablePopup
readonly property string title : plasmoid.formFactor == PlasmaCore.Types.Planar ? plasmoid.configuration.title : ""
readonly property bool vertical : plasmoid.formFactor == PlasmaCore.Types.Vertical || (plasmoid.formFactor == PlasmaCore.Types.Planar && height > width)
readonly property bool horizontal : plasmoid.formFactor == PlasmaCore.Types.Horizontal
property bool dragging : false
Layout.minimumWidth: LayoutManager.minimumWidth()
......
......@@ -35,10 +35,10 @@ Item {
Canvas {
id: canvas
property int lineWidth: 1
property bool fill: true
property bool stroke: true
property real alpha: 1.0
readonly property int lineWidth: 1
readonly property bool fill: true
readonly property bool stroke: true
readonly property real alpha: 1.0
property var proportions
property var colors
......
......@@ -23,7 +23,7 @@ import QtQuick 2.2
Rectangle {
property Rectangle borderRectangle
property real borderHeight: borderRectangle.height
readonly property real borderHeight: borderRectangle.height
radius: borderRectangle.radius
......
......@@ -36,41 +36,39 @@ Item {
readonly property int borderRounding: 3
readonly property int headingLevel: 2
property bool setColorsManually: plasmoid.configuration.setColorsManually
property var cpuColors: setColorsManually ? [plasmoid.configuration.cpuSysColor,
plasmoid.configuration.cpuUserColor,
plasmoid.configuration.cpuNiceColor,
plasmoid.configuration.cpuIOWaitColor]
: [theme.buttonFocusColor,
theme.highlightColor,
theme.visitedLinkColor,
theme.linkColor]
property var memoryColors: setColorsManually ? [plasmoid.configuration.memApplicationColor,
plasmoid.configuration.memBuffersColor]
: [theme.buttonFocusColor,
theme.visitedLinkColor]
property var swapColors: setColorsManually ? [plasmoid.configuration.swapUsedColor]
: [theme.highlightColor]
property var cacheColors: setColorsManually ? [plasmoid.configuration.cacheDirtyColor,
plasmoid.configuration.cacheWritebackColor]
: [theme.buttonFocusColor,
theme.visitedLinkColor]
readonly property bool setColorsManually: plasmoid.configuration.setColorsManually
readonly property var cpuColors: setColorsManually ? [plasmoid.configuration.cpuSysColor,
plasmoid.configuration.cpuUserColor,
plasmoid.configuration.cpuNiceColor,
plasmoid.configuration.cpuIOWaitColor]
: [theme.buttonFocusColor,
theme.highlightColor,
theme.visitedLinkColor,
theme.linkColor]
readonly property var memoryColors: setColorsManually ? [plasmoid.configuration.memApplicationColor,
plasmoid.configuration.memBuffersColor]
: [theme.buttonFocusColor,
theme.visitedLinkColor]
readonly property var swapColors: setColorsManually ? [plasmoid.configuration.swapUsedColor]
: [theme.highlightColor]
readonly property var cacheColors: setColorsManually ? [plasmoid.configuration.cacheDirtyColor,
plasmoid.configuration.cacheWritebackColor]
: [theme.buttonFocusColor,
theme.visitedLinkColor]
// Make labels visible first time so that the
// user knows which monitor is which.
implicitWidth: widestLabelWidth()*1.3 * columnCount()
implicitHeight: implicitWidth / 2
property bool circularMonitorsInUse: plasmoid.configuration.monitorType == 1
property bool compactBarMonitorsInUse: plasmoid.configuration.monitorType == 2
property bool allCPUsShown: plasmoid.configuration.cpuAllActivated
readonly property bool circularMonitorsInUse: plasmoid.configuration.monitorType == 1
readonly property bool compactBarMonitorsInUse: plasmoid.configuration.monitorType == 2
readonly property bool allCPUsShown: plasmoid.configuration.cpuAllActivated
property double barsWidth: compactBarMonitorsInUse ? main.height * 0.35 * columnCount()
: main.height * 0.5 * columnCount()
readonly property double barsWidth: compactBarMonitorsInUse ? main.height * 0.35 * columnCount()
: main.height * 0.5 * columnCount()
// Don't show icon in panel.
......@@ -126,25 +124,25 @@ Item {
id: dataSource
engine: "systemmonitor"
property string cpuSystem: "cpu/system/"
property string niceLoad: cpuSystem + "nice"
property string userLoad: cpuSystem + "user"
property string sysLoad: cpuSystem + "sys"
property string ioWait: cpuSystem + "wait"
property string averageClock: cpuSystem + "AverageClock"
property string totalLoad: cpuSystem + "TotalLoad"
property string memPhysical: "mem/physical/"
property string memFree: memPhysical + "free"
property string memApplication: memPhysical + "application"
property string memBuffers: memPhysical + "buf"
property string memUsed: memPhysical + "used"
property string swap: "mem/swap/"
property string swapUsed: swap + "used"
property string swapFree: swap + "free"
property string cache: "mem/cache/"
property string cacheDirty: cache + "dirty"
property string cacheWriteback: cache + "writeback"
property string cores: "system/cores"
readonly property string cpuSystem: "cpu/system/"
readonly property string niceLoad: cpuSystem + "nice"
readonly property string userLoad: cpuSystem + "user"
readonly property string sysLoad: cpuSystem + "sys"
readonly property string ioWait: cpuSystem + "wait"
readonly property string averageClock: cpuSystem + "AverageClock"
readonly property string totalLoad: cpuSystem + "TotalLoad"
readonly property string memPhysical: "mem/physical/"
readonly property string memFree: memPhysical + "free"
readonly property string memApplication: memPhysical + "application"
readonly property string memBuffers: memPhysical + "buf"
readonly property string memUsed: memPhysical + "used"
readonly property string swap: "mem/swap/"
readonly property string swapUsed: swap + "used"
readonly property string swapFree: swap + "free"
readonly property string cache: "mem/cache/"
readonly property string cacheDirty: cache + "dirty"
readonly property string cacheWriteback: cache + "writeback"
readonly property string cores: "system/cores"
property var totalCpuLoadProportions: [.0, .0, .0, .0]
property int maxCpuIndex: 0
......@@ -425,8 +423,8 @@ Item {
RowLayout {
id: cpusRow
property int minCpuWidth: memColumn.minWidth * 0.33
property int minWidth : Math.max(memColumn.minWidth * 2, cpuRepeater.count * minCpuWidth)
readonly property int minCpuWidth: memColumn.minWidth * 0.33
readonly property int minWidth : Math.max(memColumn.minWidth * 2, cpuRepeater.count * minCpuWidth)
visible: plasmoid.configuration.cpuActivated && plasmoid.configuration.cpuAllActivated
Layout.minimumWidth: minWidth
Layout.preferredWidth: height * 2
......@@ -438,7 +436,7 @@ Item {
delegate: ColumnLayout {
Layout.minimumWidth: cpusRow.minCpuWidth
property int cpuIndex: index
readonly property int cpuIndex: index
PlasmaExtras.Heading {
id: cpuLabel
......@@ -448,11 +446,11 @@ Item {
}
ConditionallyLoadedMonitors {
colors: cpuColors
property string niceLoad: "cpu/cpu" + cpuIndex + "/nice"
property string userLoad: "cpu/cpu" + cpuIndex + "/user"
property string sysLoad: "cpu/cpu" + cpuIndex + "/sys"
property string ioWait: "cpu/cpu" + cpuIndex + "/wait"
property var cpuLoadProportions: dataSource.data[ioWait] ? [
readonly property string niceLoad: "cpu/cpu" + cpuIndex + "/nice"
readonly property string userLoad: "cpu/cpu" + cpuIndex + "/user"
readonly property string sysLoad: "cpu/cpu" + cpuIndex + "/sys"
readonly property string ioWait: "cpu/cpu" + cpuIndex + "/wait"
readonly property var cpuLoadProportions: dataSource.data[ioWait] ? [
fitCpuLoad(dataSource.data[sysLoad].value),
fitCpuLoad(dataSource.data[userLoad].value),
fitCpuLoad(dataSource.data[niceLoad].value),
......@@ -466,7 +464,7 @@ Item {
ColumnLayout {
id: cpuColumn
property double minWidth: memColumn.minWidth
readonly property double minWidth: memColumn.minWidth
visible: plasmoid.configuration.cpuActivated && !plasmoid.configuration.cpuAllActivated
Layout.minimumWidth: minWidth
Layout.preferredWidth: height
......@@ -486,7 +484,7 @@ Item {
ColumnLayout {
id: memColumn
property double minWidth: units.gridUnit * 0.7
readonly property double minWidth: units.gridUnit * 0.7
visible: plasmoid.configuration.memoryActivated
Layout.minimumWidth: minWidth
Layout.preferredWidth: height
......@@ -506,7 +504,7 @@ Item {
ColumnLayout {
id: swapColumn
property double minWidth: memColumn.minWidth
readonly property double minWidth: memColumn.minWidth
visible: plasmoid.configuration.swapActivated
Layout.minimumWidth: minWidth
Layout.preferredWidth: height
......@@ -526,7 +524,7 @@ Item {
ColumnLayout {
id: cacheColumn
property double minWidth: memColumn.minWidth
readonly property double minWidth: memColumn.minWidth
visible: plasmoid.configuration.cacheActivated
Layout.minimumWidth: minWidth
Layout.preferredWidth: height
......
......@@ -28,21 +28,21 @@ import org.kde.plasma.private.timer 0.1 as TimerPlasmoid
Item {
id: main
property date savedAt: plasmoid.configuration.savedAt;
readonly property date savedAt: plasmoid.configuration.savedAt;
// display seconds in addition to hours and minutes (default: enabled)
property bool showSeconds: plasmoid.configuration.showSeconds;
readonly property bool showSeconds: plasmoid.configuration.showSeconds;
// show notification on timer completion (default: enabled)
property bool showNotification: plasmoid.configuration.showNotification;
readonly property bool showNotification: plasmoid.configuration.showNotification;
// run custom command on timer completion (default: disabled)
property bool runCommand: plasmoid.configuration.runCommand;
property string command: plasmoid.configuration.command;
readonly property bool runCommand: plasmoid.configuration.runCommand;
readonly property string command: plasmoid.configuration.command;
property real digits: (showSeconds) ? 7 : 4.5;
property int digitH: ((height / 2) * digits < width ? height : ((width - (digits - 1)) / digits) * 2);
property int digitW: digitH / 2;
readonly property real digits: (showSeconds) ? 7 : 4.5;
readonly property int digitH: ((height / 2) * digits < width ? height : ((width - (digits - 1)) / digits) * 2);
readonly property int digitW: digitH / 2;
PlasmaCore.Svg {
id: timerSvg
......
......@@ -25,17 +25,17 @@ import org.kde.kquickcontrolsaddons 2.0 as QtExtra
Item {
id: root;
property variant predefinedTimers: plasmoid.configuration.predefinedTimers;
readonly property variant predefinedTimers: plasmoid.configuration.predefinedTimers;
property int seconds : restoreToSeconds(plasmoid.configuration.running, plasmoid.configuration.savedAt, plasmoid.configuration.seconds);
// show title (can be customized in the settings dialog, default: disabled)
property bool showTitle: plasmoid.configuration.showTitle;
property string title: plasmoid.configuration.title;
readonly property bool showTitle: plasmoid.configuration.showTitle;
readonly property string title: plasmoid.configuration.title;
property bool running: (plasmoid.configuration.running > 0) ? true : false;
property bool suspended: false;
property string notificationText: plasmoid.configuration.notificationText;
readonly property string notificationText: plasmoid.configuration.notificationText;
Plasmoid.toolTipMainText: {
var timerName = "";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment