Skip to content

Commit

Permalink
Add auto reload feature and correct zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
Cqoicebordel committed May 4, 2015
1 parent 4ae27f0 commit 8acd7bc
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
3 changes: 3 additions & 0 deletions cqcb.plasma.webslice/contents/config/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<group name="General">
<entry name="websliceUrl" type="String">
<default>http://www.cqoicebordel.net</default>
</entry>
<entry name="enableReload" type="Bool">
<default>false</default>
</entry>
<entry name="reloadIntervalMin" type="Int">
<default>60</default>
Expand Down
16 changes: 12 additions & 4 deletions cqcb.plasma.webslice/contents/ui/ConfigGeneral.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import QtQuick.Layouts 1.0
Item {

property alias cfg_websliceUrl: websliceUrl.text
//property alias cfg_reloadIntervalMin: reloadIntervalMin.value
property alias cfg_enableReload: enableReload.checked
property alias cfg_reloadIntervalMin: reloadIntervalMin.value

property int textfieldWidth: theme.defaultFont.pointSize * 30

Expand All @@ -23,15 +24,22 @@ Item {
Layout.preferredWidth: textfieldWidth
}

/*Label {
CheckBox {
id: enableReload
Layout.columnSpan: 2
text: i18n('Enable auto reload')
}

Label {
text: i18n('Reload interval :')
//Layout.alignment: Qt.AlignRight
}

SpinBox {
id: reloadIntervalMin
suffix: i18nc('Abbreviation for minutes', 'min')
}*/
enabled: enableReload.checked
minimumValue: 1
}

}

Expand Down
16 changes: 14 additions & 2 deletions cqcb.plasma.webslice/contents/ui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,36 @@
import QtQuick 2.0
import QtWebKit 3.0
import QtQuick.Layouts 1.1
import QtWebKit.experimental 1.0

Item {
id: main

property string websliceUrl: plasmoid.configuration.websliceUrl
property bool enableReload: plasmoid.configuration.enableReload
property int reloadIntervalMin: plasmoid.configuration.reloadIntervalMin

Layout.fillWidth: true
//Layout.fillHeight: true
Layout.fillHeight: true

WebView {
id: webview
url: websliceUrl
anchors.fill: parent
experimental.preferredMinimumContentsWidth: 100
}

Component.onCompleted: {
plasmoid.setAction("reload", i18n("Refresh"), "view-refresh")
webview.reload()
}

Timer {
interval: 1000 * 60 * reloadIntervalMin
running: enableReload
repeat: true
onTriggered: {
webview.reload()
}
}
}

0 comments on commit 8acd7bc

Please sign in to comment.