Skip to content

Commit 7a0381d

Browse files
committed
changing back stuff from otherfunctions
1 parent ff30604 commit 7a0381d

File tree

8 files changed

+94
-47
lines changed

8 files changed

+94
-47
lines changed

assets/.assets.index

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ About.qml
44
backgrounds/1.jpg
55
CamSettings.qml
66
DynamicFrame.qml
7-
images/battery-full-icon.png
87
images/battery-full-icon0.png
98
images/battery-full-icon1.png
109
images/battery-full-icon2.png
10+
images/battery-full-icon3.png
1111
images/battery-full-icon4.png
1212
images/dialogframe.png
1313
images/rec.png

assets/Start.qml

+50-28
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,29 @@ import "asset:///otherfunctions.js" as CamFunctions
88
Page {
99
id: startpage
1010
attachedObjects: [
11+
Timer {
12+
id: sxTimer
13+
interval: 5500
14+
onTimeout: {
15+
getThis.StatRequest(Settings.getSettings("password", ""),"sx")
16+
17+
}
18+
},
19+
//SE TIMER every 10 seconds
20+
Timer {
21+
id: seTimer
22+
interval: 5000
23+
24+
onTimeout: {
25+
getThis.StatRequest(Settings.getSettings("password", ""),"se")
26+
console.debug("seTimer")
27+
if (responseArea.text = "Connecting...")
28+
{
29+
responseArea.text = "Connected!"
30+
}
31+
}
32+
visible: false
33+
},
1134
SystemToast {
1235
id: cancelledAlert
1336
body: "You will need to restart the app if you want to connect it later on"
@@ -24,23 +47,45 @@ Page {
2447

2548
onStatsReceived: {
2649
//reset NoStat counter
27-
CamFunctions.StatsReceived(response, batterypercent, batteryBars, mode)
50+
CamFunctions.StatsReceived(response, batterypercent, mode)
51+
}
52+
53+
onStatSXReceived: {
54+
CamFunctions.StatSXReceived(batteryBars)
55+
2856
}
2957

3058
onPasswordReceived: {
3159
inProcess.stop()
3260
seTimer.start()
33-
sxTimer.Start()
61+
sxTimer.start()
3462
responseArea.text = "Connecting..."
3563
}
3664

3765
onTimerTimesOut: {
3866
seTimer.stop()
39-
//sxTimer.stop()
67+
sxTimer.stop()
4068
}
4169

4270
onSignalNotGetPassword: {
43-
CamFunctions.NotGetPassword()
71+
//CamFunctions.NotGetPassword()
72+
var pcount = Settings.getSettings("GetPassword", 0);
73+
//console.debug("pcount:", pcount)
74+
pcount++;
75+
Settings.setSettings("GetPassword", pcount);
76+
77+
if (pcount != 3) {
78+
//console.debug("pcount:", pcount)
79+
//console.debug("2nd or 3rd Getpassword")
80+
GetPassword();
81+
responseArea.text = "Attempt to get password...";
82+
}
83+
if (pcount == 3) {
84+
//console.debug("Start retryDialog and pcount=",pcount)
85+
inProcess.stop();
86+
retryDialog.open();
87+
responseArea.text = "Cannot connect to GoPro";
88+
}
4489

4590
}
4691

@@ -49,14 +94,6 @@ Page {
4994
}
5095

5196
},
52-
Timer {
53-
id: sxTimer
54-
interval: 35000
55-
onTimeout: {
56-
getThis.StatRequest(Settings.getSettings("password", ""),"sx")
57-
58-
}
59-
},
6097
RetryConnectionDialog {
6198
id: retryDialog
6299
onSendRestart: {
@@ -74,21 +111,6 @@ Page {
74111
Container {
75112
id: rootContainer
76113
layout: DockLayout {}
77-
//SE TIMER every 10 seconds
78-
Timer {
79-
id: seTimer
80-
interval: 5000
81-
82-
onTimeout: {
83-
getThis.StatRequest(Settings.getSettings("password", ""),"se")
84-
console.debug("seTimer")
85-
if (responseArea.text = "Connecting...")
86-
{
87-
responseArea.text = "Connected!"
88-
}
89-
}
90-
visible: false
91-
}
92114

93115
ImageView {
94116
imageSource: "asset:///backgrounds/1.jpg"
@@ -163,7 +185,7 @@ Page {
163185
}
164186
ImageView {
165187
id: batteryImage
166-
imageSource: "asset:///images/battery-full-icon.png"
188+
imageSource: "asset:///images/battery-full-icon3.png"
167189
scaleX: 0.75
168190
scaleY: 0.75
169191
translationY: -30.0
File renamed without changes.

assets/otherfunctions.js

+28-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
//When onStatsReceived emitted
66
//
7-
function StatsReceived(response, batterypercent, batteryBars, mode)
7+
function StatsReceived(response, batterypercent, mode)
88
{
99
Settings.setSettings("GetStats", 0);
1010

@@ -18,6 +18,31 @@ function StatsReceived(response, batterypercent, batteryBars, mode)
1818

1919
}
2020

21+
function StatSXReceived(batterybars)
22+
{
23+
switch(batterybars) {
24+
case 0:
25+
batteryImage.imageSource = "asset:///images/battery-full-icon0.png";
26+
break;
27+
case 1:
28+
batteryImage.imageSource = "asset:///images/battery-full-icon1.png";
29+
break;
30+
case 2:
31+
batteryImage.imageSource = "asset:///images/battery-full-icon2.png";
32+
break;
33+
case 3:
34+
batteryImage.imageSource = "asset:///images/battery-full-icon3.png";
35+
break;
36+
case 4:
37+
batteryImage.imageSource = "asset:///images/battery-full-icon4.png";
38+
break;
39+
default:
40+
batteryImage.imageSource = null;
41+
break;
42+
43+
}
44+
}
45+
2146
//When the onSignalNotGetStats is emitted, it then calls this function
2247
//
2348
function NotGetStats()
@@ -42,7 +67,7 @@ function NotGetStats()
4267

4368
//When the onSignalNotGetPassword is emitted, it then calls this function
4469
//
45-
function NoGetPassword()
70+
function NotGetPassword()
4671
{
4772
var pcount = Settings.getSettings("GetPassword", 0);
4873
//console.debug("pcount:", pcount)
@@ -52,7 +77,7 @@ function NoGetPassword()
5277
if (pcount != 3) {
5378
//console.debug("pcount:", pcount)
5479
//console.debug("2nd or 3rd Getpassword")
55-
GetPassword();
80+
getThis.GetPassword();
5681
responseArea.text = "Attempt to get password...";
5782
}
5883
if (pcount == 3) {

assets/settings.qml

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ Sheet {
2121
Container {
2222
//Todo: fill me with QML
2323
DropDown {
24-
topPadding: 20
2524
id: themeDropDown
2625
title: qsTr("Theme Selection:") + Retranslate.onLocaleOrLanguageChanged
2726

src/GetterRequest.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,10 @@ void GetterRequest::onGetStats()
230230
emit statsReceived(response, batteryLevel, camMode);
231231
break;
232232
case 401:
233-
emit signalNotGetStats(401);
233+
emit signalNotGetStats(statusCode.toInt());
234234
break;
235235
default:
236-
emit signalNotGetStats(0);
236+
emit signalNotGetStats(statusCode.toInt());
237237
break;
238238
}
239239

@@ -251,13 +251,13 @@ void GetterRequest::onGetStats()
251251
case 202:
252252
case 203:
253253
case 204:
254-
emit statsReceived(response, batteryLevel, batteryIcon, camMode);
254+
emit statSXReceived(batteryIcon);
255255
break;
256256
case 401:
257-
emit signalNotGetStats(401);
257+
emit signalNotGetStats(statusCode.toInt());
258258
break;
259259
default:
260-
emit signalNotGetStats(0);
260+
emit signalNotGetStats(statusCode.toInt());
261261
break;
262262
}
263263

src/GetterRequest.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public Q_SLOTS:
2727

2828
Q_SIGNALS:
2929
void responseReceived(const QString &info);
30-
void statsReceived(const QString &response, const int &batterypercent,const int &batteryBars, const QString &mode);
30+
void statsReceived(const QString &response, const int &batterypercent, const QString &mode);
31+
void statSXReceived(const int &batteryBars);
3132
void passwordReceived(const QString &pass);
3233
void commandSent(const QUrl &commandSent);
3334
void timerTimesOut(const QString &requestName);

translations/DoIt.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -13,49 +13,49 @@
1313
<name>GetterRequest</name>
1414
<message>
1515
<location filename="../src/GetterRequest.cpp" line="126"/>
16-
<location filename="../src/GetterRequest.cpp" line="229"/>
16+
<location filename="../src/GetterRequest.cpp" line="267"/>
1717
<source>Error: %1 status: %2</source>
1818
<translation type="unfinished"></translation>
1919
</message>
2020
<message>
2121
<location filename="../src/GetterRequest.cpp" line="134"/>
22-
<location filename="../src/GetterRequest.cpp" line="237"/>
22+
<location filename="../src/GetterRequest.cpp" line="275"/>
2323
<source>Unable to retrieve request headers</source>
2424
<translation type="unfinished"></translation>
2525
</message>
2626
<message>
27-
<location filename="../src/GetterRequest.cpp" line="393"/>
27+
<location filename="../src/GetterRequest.cpp" line="415"/>
2828
<source>Error: %1 Status: %2</source>
2929
<translation type="unfinished"></translation>
3030
</message>
3131
</context>
3232
<context>
3333
<name>Settings</name>
3434
<message>
35-
<location filename="../assets/Settings.qml" line="26"/>
35+
<location filename="../assets/Settings.qml" line="25"/>
3636
<source>Theme Selection:</source>
3737
<translation type="unfinished"></translation>
3838
</message>
3939
<message>
40-
<location filename="../assets/Settings.qml" line="29"/>
40+
<location filename="../assets/Settings.qml" line="28"/>
4141
<source>Bright</source>
4242
<translation type="unfinished"></translation>
4343
</message>
4444
<message>
45-
<location filename="../assets/Settings.qml" line="34"/>
45+
<location filename="../assets/Settings.qml" line="33"/>
4646
<source>Dark</source>
4747
<translation type="unfinished"></translation>
4848
</message>
4949
</context>
5050
<context>
5151
<name>Start</name>
5252
<message>
53-
<location filename="../assets/Start.qml" line="116"/>
53+
<location filename="../assets/Start.qml" line="138"/>
5454
<source>DoIt GoPro</source>
5555
<translation type="unfinished"></translation>
5656
</message>
5757
<message>
58-
<location filename="../assets/Start.qml" line="323"/>
58+
<location filename="../assets/Start.qml" line="345"/>
5959
<source>Not Connected</source>
6060
<translation type="unfinished"></translation>
6161
</message>

0 commit comments

Comments
 (0)