Changeset View
Changeset View
Standalone View
Standalone View
plasmoid/contents/ui/MsmView.qml
Property | Old Value | New Value |
---|---|---|
File Mode | 100755 | 100644 |
Show All 28 Lines | |||||
29 | 29 | | |||
30 | Rectangle { | 30 | Rectangle { | ||
31 | id: skillcontent | 31 | id: skillcontent | ||
32 | Layout.fillWidth: true; | 32 | Layout.fillWidth: true; | ||
33 | anchors { | 33 | anchors { | ||
34 | left: parent.left; | 34 | left: parent.left; | ||
35 | leftMargin: 0.5; | 35 | leftMargin: 0.5; | ||
36 | right: parent.right | 36 | right: parent.right | ||
37 | | ||||
38 | } | 37 | } | ||
39 | height: units.gridUnit * 4 | 38 | height: units.gridUnit * 4 | ||
40 | border.width: 1 | 39 | border.width: 1 | ||
41 | border.color: Qt.darker(theme.linkColor, 1.2) | 40 | border.color: Qt.darker(theme.linkColor, 1.2) | ||
42 | color: Qt.darker(theme.backgroundColor, 1.2) | 41 | color: Qt.darker(theme.backgroundColor, 1.2) | ||
43 | 42 | | |||
44 | function exec(msmparam) { | 43 | function exec(msmparam) { | ||
45 | var bscrpt = "/usr/share/plasma/plasmoids/org.kde.plasma.mycroftplasmoid/contents/code/msm.sh" | 44 | var bscrpt = "/usr/share/plasma/plasmoids/org.kde.plasma.mycroftplasmoid/contents/code/msm.sh" | ||
46 | return launchinstaller.msmapp("bash " + bscrpt + " install " + model.url) | 45 | return launchinstaller.msmapp("bash " + bscrpt + " install " + model.url) | ||
47 | } | 46 | } | ||
48 | 47 | | |||
48 | function getSkillInfoLocal() { | ||||
49 | var customFold = '/opt/mycroft/skills/' | ||||
50 | var skillPath = customFold + model.name | ||||
51 | if(PlasmaLa.FileReader.file_exists_local(skillPath)){ | ||||
52 | installLabl.text = "Installed" | ||||
53 | getskillviamsmRect.color = Qt.lighter(theme.textColor, 1.2) | ||||
54 | installLabl.color = Qt.darker(theme.backgroundColor, 1.2) | ||||
55 | skillcontent.border.color = Qt.lighter(theme.textColor, 1.2) | ||||
56 | } | ||||
57 | } | ||||
58 | | ||||
49 | PlasmaLa.MsmApp{ | 59 | PlasmaLa.MsmApp{ | ||
50 | id: launchinstaller | 60 | id: launchinstaller | ||
51 | } | 61 | } | ||
52 | 62 | | |||
53 | Component.onCompleted: { | 63 | Component.onCompleted: { | ||
54 | msmSkillInstallProgBar.visible = false; | 64 | msmSkillInstallProgBar.visible = false; | ||
65 | getSkillInfoLocal(); | ||||
55 | } | 66 | } | ||
56 | 67 | | |||
57 | PlasmaComponents.Label { | 68 | PlasmaComponents.Label { | ||
58 | id: skllname | 69 | id: skllname | ||
59 | font.capitalization: Font.AllUppercase | 70 | font.capitalization: Font.AllUppercase | ||
60 | anchors.top: parent.top | 71 | anchors.top: parent.top | ||
61 | anchors.left: parent.left | 72 | anchors.left: parent.left | ||
62 | anchors.leftMargin: units.gridUnit * 0.5 | 73 | anchors.leftMargin: units.gridUnit * 0.5 | ||
Show All 31 Lines | 101 | MouseArea{ | |||
94 | onClicked: {Qt.openUrlExternally(model.url)} | 105 | onClicked: {Qt.openUrlExternally(model.url)} | ||
95 | onEntered: { | 106 | onEntered: { | ||
96 | urlskllable.color = Qt.darker(theme.linkColor, 1.2) | 107 | urlskllable.color = Qt.darker(theme.linkColor, 1.2) | ||
97 | } | 108 | } | ||
98 | onExited: { | 109 | onExited: { | ||
99 | urlskllable.color = theme.textColor | 110 | urlskllable.color = theme.textColor | ||
100 | } | 111 | } | ||
101 | } | 112 | } | ||
102 | | ||||
103 | } | 113 | } | ||
104 | 114 | | |||
105 | Rectangle { | 115 | Rectangle { | ||
106 | id: getskillviamsmRect | 116 | id: getskillviamsmRect | ||
107 | width: parent.width | 117 | width: parent.width | ||
108 | height: units.gridUnit * 1 | 118 | height: units.gridUnit * 1 | ||
109 | anchors.bottom: parent.bottom | 119 | anchors.bottom: parent.bottom | ||
110 | color: Qt.darker(theme.linkColor, 1.2) | 120 | color: Qt.darker(theme.linkColor, 1.2) | ||
Show All 13 Lines | 130 | PlasmaComponents.ProgressBar { | |||
124 | visible: false | 134 | visible: false | ||
125 | indeterminate: false | 135 | indeterminate: false | ||
126 | } | 136 | } | ||
127 | 137 | | |||
128 | MouseArea { | 138 | MouseArea { | ||
129 | anchors.fill: parent | 139 | anchors.fill: parent | ||
130 | hoverEnabled: true | 140 | hoverEnabled: true | ||
131 | onEntered: { | 141 | onEntered: { | ||
142 | switch(installLabl.text){ | ||||
143 | case "Install": | ||||
132 | getskillviamsmRect.color = Qt.lighter(theme.backgroundColor, 1.2) | 144 | getskillviamsmRect.color = Qt.lighter(theme.backgroundColor, 1.2) | ||
133 | installLabl.color = Qt.darker(theme.linkColor, 1.2) | 145 | installLabl.color = Qt.darker(theme.linkColor, 1.2) | ||
134 | getskillviamsmRect.border.width = 1 | 146 | getskillviamsmRect.border.width = 1 | ||
135 | getskillviamsmRect.border.color = Qt.darker(theme.linkColor, 1.2) | 147 | getskillviamsmRect.border.color = Qt.darker(theme.linkColor, 1.2) | ||
148 | break | ||||
149 | case "Installed": | ||||
150 | getskillviamsmRect.color = Qt.lighter(theme.textColor, 1.2) | ||||
151 | installLabl.color = Qt.darker(theme.backgroundColor, 1.2) | ||||
152 | getskillviamsmRect.border.width = 0 | ||||
153 | getskillviamsmRect.border.color = Qt.darker(theme.backgroundColor, 1.2) | ||||
154 | skillcontent.border.color = Qt.darker(theme.textColor, 1.2) | ||||
155 | break | ||||
156 | } | ||||
136 | } | 157 | } | ||
137 | onExited: { | 158 | onExited: { | ||
159 | switch(installLabl.text){ | ||||
160 | case "Install": | ||||
138 | getskillviamsmRect.color = Qt.darker(theme.linkColor, 1.2) | 161 | getskillviamsmRect.color = Qt.darker(theme.linkColor, 1.2) | ||
139 | installLabl.color = Qt.darker(theme.backgroundColor, 1.2) | 162 | installLabl.color = Qt.darker(theme.backgroundColor, 1.2) | ||
140 | getskillviamsmRect.border.width = 0 | 163 | getskillviamsmRect.border.width = 0 | ||
164 | break | ||||
165 | case "Installed": | ||||
166 | getskillviamsmRect.color = Qt.lighter(theme.textColor, 1.2) | ||||
167 | installLabl.color = Qt.darker(theme.backgroundColor, 1.2) | ||||
168 | getskillviamsmRect.border.width = 0 | ||||
169 | getskillviamsmRect.color = Qt.lighter(theme.textColor, 1.2) | ||||
170 | skillcontent.border.color = Qt.lighter(theme.textColor, 1.2) | ||||
171 | break | ||||
172 | } | ||||
141 | } | 173 | } | ||
142 | onClicked: { | 174 | onClicked: { | ||
143 | console.log(model.url) | | |||
144 | var msmprogress = exec() | 175 | var msmprogress = exec() | ||
145 | var getcurrentprogress = msmprogress.split("\n") | 176 | var getcurrentprogress = msmprogress.split("\n") | ||
146 | console.log(getcurrentprogress); | | |||
147 | if(getcurrentprogress.indexOf("Cloning repository") != -1) | 177 | if(getcurrentprogress.indexOf("Cloning repository") != -1) | ||
148 | { | 178 | { | ||
149 | installLabl.visible = false | 179 | installLabl.visible = false | ||
150 | msmSkillInstallProgBar.visible = true; | 180 | msmSkillInstallProgBar.visible = true; | ||
151 | msmSkillInstallProgBar.indeterminate = true; | 181 | msmSkillInstallProgBar.indeterminate = true; | ||
152 | } | 182 | } | ||
153 | if(getcurrentprogress.indexOf("Skill installed!") != -1) | 183 | if(getcurrentprogress.indexOf("Skill installed!") != -1) | ||
154 | { | 184 | { | ||
155 | msmSkillInstallProgBar.visible = false | 185 | msmSkillInstallProgBar.visible = false | ||
156 | installLabl.visible = true | 186 | installLabl.visible = true | ||
157 | installLabl.text = "Installed" | 187 | installLabl.text = "Installed" | ||
188 | getSkillInfoLocal() | ||||
158 | } | 189 | } | ||
159 | } | 190 | } | ||
160 | } | 191 | } | ||
161 | } | 192 | } | ||
162 | } | 193 | } | ||
163 | 194 | |