-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PackageManager provides a GUI to manage packages.
- Loading branch information
Showing
59 changed files
with
6,783 additions
and
1,782 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
//////// new for PackageManager | ||
|
||
import QtQuick 1.1 | ||
import com.victron.velib 1.0 | ||
import "utils.js" as Utils | ||
|
||
MbItem { | ||
id: root | ||
|
||
property int defaultIndex | ||
property string servicePrefix | ||
|
||
VBusItem { id: packageName; bind: getServiceBind ("PackageName") } | ||
|
||
|
||
onClicked: rootWindow.pageStack.push ("/opt/victronenergy/gui/qml/PageSettingsPackageAdd.qml", {defaultIndex: defaultIndex}) | ||
|
||
|
||
function getServiceBind(param) | ||
{ | ||
return Utils.path(servicePrefix, "/Default/", defaultIndex, "/", param) | ||
} | ||
|
||
|
||
MbRowSmall | ||
{ | ||
description: "" | ||
|
||
anchors.verticalCenter: parent.verticalCenter | ||
Column | ||
{ | ||
width: root.width - gitHubUser.width - gitHubBranch.width - 20 | ||
Text // puts a bit of space above package name | ||
{ | ||
text: " " | ||
font.pixelSize: 6 | ||
} | ||
Text | ||
{ | ||
text:packageName.valid ? packageName.value : "" | ||
font.pixelSize: 14 | ||
horizontalAlignment: Text.AlignLeft | ||
} | ||
Text | ||
{ | ||
text: "" | ||
font.pixelSize: 10 | ||
horizontalAlignment: Text.AlignLeft | ||
} | ||
} | ||
Column | ||
{ | ||
Text // puts a bit of space above version boxes | ||
{ | ||
text: " " | ||
font.pixelSize: 3 | ||
} | ||
Text | ||
{ | ||
text: "GitHub User" | ||
font.pixelSize: 10 | ||
} | ||
MbTextBlock | ||
{ | ||
id: gitHubUser | ||
item { bind: getServiceBind("GitHubUser") } | ||
height: 20; width: 120 | ||
} | ||
Text // puts a bit of space below version boxes - only needed in one column | ||
{ | ||
text: " " | ||
font.pixelSize: 6 | ||
} | ||
} | ||
Column | ||
{ | ||
Text // puts a bit of space above version boxes | ||
{ | ||
text: " " | ||
font.pixelSize: 3 | ||
} | ||
Text | ||
{ | ||
text: qsTr ("GitHub Tag") | ||
font.pixelSize: 10 | ||
} | ||
MbTextBlock | ||
{ | ||
id: gitHubBranch | ||
item { bind: getServiceBind("GitHubBranch") } | ||
height: 20; width: 120 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,165 @@ | ||
//////// new for PackageManager | ||
|
||
import QtQuick 1.1 | ||
import com.victron.velib 1.0 | ||
import "utils.js" as Utils | ||
|
||
MbItem { | ||
id: root | ||
|
||
property int versionIndex | ||
property string bindPrefix | ||
property int packageIndex | ||
property string servicePrefix | ||
property string settingsPrefix | ||
|
||
VBusItem { id: packageName; bind: getSettingsBind ("PackageName") } | ||
property VBusItem rebootNeededItem: VBusItem { bind: getServiceBind ( "RebootNeeded") } | ||
property VBusItem guiRestartNeededItem: VBusItem { bind: getServiceBind ( "GuiRestartNeeded") } | ||
property bool rebootNeeded: rebootNeededItem.valid && rebootNeededItem.value == 1 | ||
property bool guiRestartNeeded: guiRestartNeededItem.valid && guiRestartNeededItem.value == 1 | ||
|
||
VBusItem { id: platformItem; bind: Utils.path("com.victronenergy.packageManager", "/Platform" ) } | ||
VBusItem { id: incompatibleItem; bind: getServiceBind ( "Incompatible" ) } | ||
property string incompatibleReason: incompatibleItem.valid ? incompatibleItem.value : "" | ||
property bool compatible: incompatibleReason == "" | ||
property string platform: platformItem.valid ? platformItem.value : "??" | ||
|
||
onClicked: rootWindow.pageStack.push ("/opt/victronenergy/gui/qml/PageSettingsPackageEdit.qml", {packageIndex: packageIndex}) | ||
|
||
function getBind(param) | ||
|
||
function statusText () | ||
{ | ||
return Utils.path(bindPrefix, "/", versionIndex, "/", param) | ||
if (rebootNeeded) | ||
return qsTr (" REBOOT needed") | ||
if (guiRestartNeeded) | ||
return qsTr (" GUI restart needed") | ||
else if (incompatibleReason == 'PLATFORM') | ||
return qsTr ( " not compatible with " + platform ) | ||
else if (incompatibleReason == 'VERSION') | ||
return qsTr ( " not compatible with " + vePlatform.version ) | ||
else if (incompatibleReason == 'CMDLINE' && installedVersion.item.value == "") | ||
return qsTr ( " must install from command line" ) | ||
else | ||
return "" | ||
} | ||
|
||
VBusItem { id: packageName; bind: getBind ("PackageName") } | ||
function getSettingsBind(param) | ||
{ | ||
return Utils.path(settingsPrefix, "/", packageIndex, "/", param) | ||
} | ||
function getServiceBind(param) | ||
{ | ||
return Utils.path(servicePrefix, "/Package/", packageIndex, "/", param) | ||
} | ||
|
||
function versionToNumber (item) | ||
{ | ||
var parts=["x", "x", "x", "x", "x"] | ||
var versionNumber = 0 | ||
|
||
if (item.valid && item.value.substring (0,1) == "v") | ||
{ | ||
parts = item.value.split (/[v.~]+/ , 4) | ||
{ | ||
if (parts.length >= 2) | ||
versionNumber += parseInt(parts[1]) * 1000000 | ||
if (parts.length >= 3) | ||
versionNumber += parseInt(parts[2]) * 1000 | ||
if (parts.length >= 4) | ||
versionNumber += parseInt(parts[3]) | ||
else | ||
versionNumber += 999 | ||
} | ||
} | ||
return versionNumber | ||
} | ||
|
||
MbRowSmall | ||
{ | ||
description: "" | ||
|
||
anchors.verticalCenter: parent.verticalCenter | ||
height: 20 | ||
|
||
isCurrentItem: root.isCurrentItem | ||
description: packageName.valid ? packageName.value : "" | ||
MbTextBlock | ||
{ | ||
id: gitUser | ||
item { bind: getBind("GitHubUser") } | ||
width: 100 | ||
show: packageName.valid && item.valid | ||
} | ||
MbTextBlock | ||
{ | ||
item { bind: getBind("GitHubBranch") } | ||
show: packageName.valid && gitUser.item.valid | ||
width: 80 | ||
} | ||
MbTextBlock | ||
{ | ||
item { bind: getBind("PackageVersion") } | ||
width: 80 | ||
show: packageName.valid | ||
Column | ||
{ | ||
width: root.width - gitHubVersion.width - packageVersion.width - installedVersion.width - 20 | ||
Text // puts a bit of space above package name | ||
{ | ||
text: " " | ||
font.pixelSize: 6 | ||
} | ||
Text | ||
{ | ||
text:packageName.valid ? packageName.value : "" | ||
font.pixelSize: 14 | ||
horizontalAlignment: Text.AlignLeft | ||
} | ||
Text | ||
{ | ||
text: statusText () | ||
font.pixelSize: 10 | ||
horizontalAlignment: Text.AlignLeft | ||
} | ||
} | ||
Column | ||
{ | ||
Text // puts a bit of space above version boxes | ||
{ | ||
text: " " | ||
font.pixelSize: 3 | ||
} | ||
Text | ||
{ | ||
text: "GitHub" | ||
font.pixelSize: 10 | ||
} | ||
MbTextBlock | ||
{ | ||
id: gitHubVersion | ||
item { bind: getServiceBind("GitHubVersion") } | ||
height: 20; width: 80 | ||
} | ||
Text // puts a bit of space below version boxes - only needed in one column | ||
{ | ||
text: " " | ||
font.pixelSize: 6 | ||
} | ||
} | ||
Column | ||
{ | ||
Text // puts a bit of space above version boxes | ||
{ | ||
text: " " | ||
font.pixelSize: 3 | ||
} | ||
Text | ||
{ | ||
text: qsTr ("Stored") | ||
font.pixelSize: 10 | ||
} | ||
MbTextBlock | ||
{ | ||
id: packageVersion | ||
item { bind: getServiceBind("PackageVersion") } | ||
height: 20; width: 80 | ||
} | ||
} | ||
Column | ||
{ | ||
Text // puts a bit of space above version boxes | ||
{ | ||
text: " " | ||
font.pixelSize: 3 | ||
} | ||
Text | ||
{ | ||
text: qsTr ("Installed") | ||
font.pixelSize: 10 | ||
} | ||
MbTextBlock | ||
{ | ||
id: installedVersion | ||
item { bind: getServiceBind("InstalledVersion") } | ||
height: 20; width: 80 | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.