Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
E
etwrp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
e
tools
etwrp
Commits
a8a89d19
Commit
a8a89d19
authored
Dec 30, 2016
by
Matt Mower
Committed by
Dees Troy
Jan 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Whitespace cleanup
Change-Id: I93c65973679894bb8587da4b38b410d38036b8bd
parent
55f2bdac
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
238 additions
and
240 deletions
+238
-240
data.cpp
data.cpp
+33
-33
exclude.cpp
exclude.cpp
+2
-2
gui/action.cpp
gui/action.cpp
+18
-18
gui/animation.cpp
gui/animation.cpp
+2
-2
gui/console.cpp
gui/console.cpp
+7
-4
gui/fileselector.cpp
gui/fileselector.cpp
+2
-2
gui/fill.cpp
gui/fill.cpp
+1
-1
gui/gui.cpp
gui/gui.cpp
+8
-8
gui/input.cpp
gui/input.cpp
+2
-2
gui/listbox.cpp
gui/listbox.cpp
+2
-2
gui/mousecursor.cpp
gui/mousecursor.cpp
+13
-13
gui/object.cpp
gui/object.cpp
+3
-3
gui/objects.hpp
gui/objects.hpp
+0
-2
gui/pages.cpp
gui/pages.cpp
+11
-11
gui/partitionlist.cpp
gui/partitionlist.cpp
+4
-4
gui/patternpassword.cpp
gui/patternpassword.cpp
+41
-41
gui/progressbar.cpp
gui/progressbar.cpp
+3
-3
gui/resources.cpp
gui/resources.cpp
+4
-4
gui/scrolllist.cpp
gui/scrolllist.cpp
+6
-6
gui/slider.cpp
gui/slider.cpp
+3
-3
gui/slidervalue.cpp
gui/slidervalue.cpp
+16
-16
gui/terminal.cpp
gui/terminal.cpp
+7
-4
gui/textbox.cpp
gui/textbox.cpp
+1
-1
gui/theme/common/portrait.xml
gui/theme/common/portrait.xml
+2
-2
gui/twmsg.cpp
gui/twmsg.cpp
+1
-1
openrecoveryscript.cpp
openrecoveryscript.cpp
+5
-5
partition.cpp
partition.cpp
+1
-1
partitionmanager.cpp
partitionmanager.cpp
+3
-7
twrp-functions.cpp
twrp-functions.cpp
+28
-28
twrp.cpp
twrp.cpp
+2
-2
twrpTar.cpp
twrpTar.cpp
+7
-7
twrpTar.h
twrpTar.h
+0
-1
twrpTar.hpp
twrpTar.hpp
+0
-1
No files found.
data.cpp
View file @
a8a89d19
...
...
@@ -253,7 +253,7 @@ int DataManager::LoadValues(const string& filename)
pthread_mutex_unlock
(
&
m_valuesLock
);
string
current
=
GetCurrentStoragePath
();
TWPartition
*
Part
=
PartitionManager
.
Find_Partition_By_Path
(
current
);
if
(
!
Part
)
if
(
!
Part
)
Part
=
PartitionManager
.
Get_Default_Storage_Partition
();
if
(
Part
&&
current
!=
Part
->
Storage_Path
&&
Part
->
Mount
(
false
))
{
LOGINFO
(
"LoadValues setting storage path to '%s'
\n
"
,
Part
->
Storage_Path
.
c_str
());
...
...
@@ -536,7 +536,7 @@ void DataManager::SetDefaultValues()
mPersist
.
SetValue
(
"tw_action_vibrate"
,
"160"
);
TWPartition
*
store
=
PartitionManager
.
Get_Default_Storage_Partition
();
if
(
store
)
if
(
store
)
mPersist
.
SetValue
(
"tw_storage_path"
,
store
->
Storage_Path
);
else
mPersist
.
SetValue
(
"tw_storage_path"
,
"/"
);
...
...
@@ -753,7 +753,7 @@ void DataManager::SetDefaultValues()
string
maxbrightpath
=
findbright
.
insert
(
findbright
.
rfind
(
'/'
)
+
1
,
"max_"
);
if
(
TWFunc
::
Path_Exists
(
maxbrightpath
))
{
ifstream
maxVal
(
maxbrightpath
.
c_str
());
if
(
maxVal
>>
maxBrightness
)
{
if
(
maxVal
>>
maxBrightness
)
{
LOGINFO
(
"Got max brightness %s from '%s'
\n
"
,
maxBrightness
.
c_str
(),
maxbrightpath
.
c_str
());
}
else
{
// Something went wrong, set that to indicate error
...
...
@@ -873,38 +873,38 @@ int DataManager::GetMagicValue(const string& varName, string& value)
}
else
if
(
varName
==
"tw_cpu_temp"
)
{
int
tw_no_cpu_temp
;
GetValue
(
"tw_no_cpu_temp"
,
tw_no_cpu_temp
);
if
(
tw_no_cpu_temp
==
1
)
return
-
1
;
string
cpu_temp_file
;
static
unsigned
long
convert_temp
=
0
;
static
time_t
cpuSecCheck
=
0
;
int
divisor
=
0
;
struct
timeval
curTime
;
string
results
;
gettimeofday
(
&
curTime
,
NULL
);
if
(
curTime
.
tv_sec
>
cpuSecCheck
)
{
int
tw_no_cpu_temp
;
GetValue
(
"tw_no_cpu_temp"
,
tw_no_cpu_temp
);
if
(
tw_no_cpu_temp
==
1
)
return
-
1
;
string
cpu_temp_file
;
static
unsigned
long
convert_temp
=
0
;
static
time_t
cpuSecCheck
=
0
;
int
divisor
=
0
;
struct
timeval
curTime
;
string
results
;
gettimeofday
(
&
curTime
,
NULL
);
if
(
curTime
.
tv_sec
>
cpuSecCheck
)
{
#ifdef TW_CUSTOM_CPU_TEMP_PATH
cpu_temp_file
=
EXPAND
(
TW_CUSTOM_CPU_TEMP_PATH
);
if
(
TWFunc
::
read_file
(
cpu_temp_file
,
results
)
!=
0
)
return
-
1
;
cpu_temp_file
=
EXPAND
(
TW_CUSTOM_CPU_TEMP_PATH
);
if
(
TWFunc
::
read_file
(
cpu_temp_file
,
results
)
!=
0
)
return
-
1
;
#else
cpu_temp_file
=
"/sys/class/thermal/thermal_zone0/temp"
;
if
(
TWFunc
::
read_file
(
cpu_temp_file
,
results
)
!=
0
)
return
-
1
;
cpu_temp_file
=
"/sys/class/thermal/thermal_zone0/temp"
;
if
(
TWFunc
::
read_file
(
cpu_temp_file
,
results
)
!=
0
)
return
-
1
;
#endif
convert_temp
=
strtoul
(
results
.
c_str
(),
NULL
,
0
)
/
1000
;
if
(
convert_temp
<=
0
)
convert_temp
=
strtoul
(
results
.
c_str
(),
NULL
,
0
);
if
(
convert_temp
>=
150
)
convert_temp
=
strtoul
(
results
.
c_str
(),
NULL
,
0
)
/
10
;
cpuSecCheck
=
curTime
.
tv_sec
+
5
;
}
value
=
TWFunc
::
to_string
(
convert_temp
);
return
0
;
convert_temp
=
strtoul
(
results
.
c_str
(),
NULL
,
0
)
/
1000
;
if
(
convert_temp
<=
0
)
convert_temp
=
strtoul
(
results
.
c_str
(),
NULL
,
0
);
if
(
convert_temp
>=
150
)
convert_temp
=
strtoul
(
results
.
c_str
(),
NULL
,
0
)
/
10
;
cpuSecCheck
=
curTime
.
tv_sec
+
5
;
}
value
=
TWFunc
::
to_string
(
convert_temp
);
return
0
;
}
else
if
(
varName
==
"tw_battery"
)
{
...
...
@@ -924,7 +924,7 @@ int DataManager::GetMagicValue(const string& varName, string& value)
#else
FILE
*
cap
=
fopen
(
"/sys/class/power_supply/battery/capacity"
,
"rt"
);
#endif
if
(
cap
){
if
(
cap
)
{
fgets
(
cap_s
,
4
,
cap
);
fclose
(
cap
);
lastVal
=
atoi
(
cap_s
);
...
...
exclude.cpp
View file @
a8a89d19
...
...
@@ -100,8 +100,8 @@ bool TWExclude::check_absolute_skip_dirs(const string& path) {
bool
TWExclude
::
check_skip_dirs
(
const
string
&
path
)
{
string
normalized
=
TWFunc
::
Remove_Trailing_Slashes
(
path
);
size_t
slashIdx
=
normalized
.
find_last_of
(
'/'
);
if
(
slashIdx
!=
std
::
string
::
npos
&&
slashIdx
+
1
<
normalized
.
size
())
{
if
(
check_relative_skip_dirs
(
normalized
.
substr
(
slashIdx
+
1
)))
if
(
slashIdx
!=
std
::
string
::
npos
&&
slashIdx
+
1
<
normalized
.
size
())
{
if
(
check_relative_skip_dirs
(
normalized
.
substr
(
slashIdx
+
1
)))
return
true
;
}
return
check_absolute_skip_dirs
(
normalized
);
...
...
gui/action.cpp
View file @
a8a89d19
...
...
@@ -107,7 +107,7 @@ ActionThread::ActionThread()
ActionThread
::~
ActionThread
()
{
pthread_mutex_lock
(
&
m_act_lock
);
if
(
m_thread_running
)
{
if
(
m_thread_running
)
{
pthread_mutex_unlock
(
&
m_act_lock
);
pthread_join
(
m_thread
,
NULL
);
}
else
{
...
...
@@ -262,7 +262,7 @@ GUIAction::GUIAction(xml_node<>* node)
if
(
attr
)
{
std
::
vector
<
std
::
string
>
keys
=
TWFunc
::
Split_String
(
attr
->
value
(),
"+"
);
for
(
size_t
i
=
0
;
i
<
keys
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
keys
.
size
();
++
i
)
{
const
int
key
=
getKeyByName
(
keys
[
i
]);
mKeys
[
key
]
=
false
;
...
...
@@ -297,7 +297,7 @@ int GUIAction::NotifyTouch(TOUCH_STATE state, int x __unused, int y __unused)
int
GUIAction
::
NotifyKey
(
int
key
,
bool
down
)
{
std
::
map
<
int
,
bool
>::
iterator
itr
=
mKeys
.
find
(
key
);
if
(
itr
==
mKeys
.
end
())
if
(
itr
==
mKeys
.
end
())
return
1
;
bool
prevState
=
itr
->
second
;
...
...
@@ -307,20 +307,20 @@ int GUIAction::NotifyKey(int key, bool down)
// doesn't trigger with multi-key actions.
// Else, check if all buttons are pressed, then consume their release events
// so they don't trigger one-button actions and reset mKeys pressed status
if
(
mKeys
.
size
()
==
1
)
{
if
(
!
down
&&
prevState
)
{
if
(
mKeys
.
size
()
==
1
)
{
if
(
!
down
&&
prevState
)
{
doActions
();
return
0
;
}
}
else
if
(
down
)
{
for
(
itr
=
mKeys
.
begin
();
itr
!=
mKeys
.
end
();
++
itr
)
{
if
(
!
itr
->
second
)
}
else
if
(
down
)
{
for
(
itr
=
mKeys
.
begin
();
itr
!=
mKeys
.
end
();
++
itr
)
{
if
(
!
itr
->
second
)
return
1
;
}
// Passed, all req buttons are pressed, reset them and consume release events
HardwareKeyboard
*
kb
=
PageManager
::
GetHardwareKeyboard
();
for
(
itr
=
mKeys
.
begin
();
itr
!=
mKeys
.
end
();
++
itr
)
{
for
(
itr
=
mKeys
.
begin
();
itr
!=
mKeys
.
end
();
++
itr
)
{
kb
->
ConsumeKeyRelease
(
itr
->
first
);
itr
->
second
=
false
;
}
...
...
@@ -338,7 +338,7 @@ int GUIAction::NotifyVarChange(const std::string& varName, const std::string& va
if
(
varName
.
empty
()
&&
!
isConditionValid
()
&&
mKeys
.
empty
()
&&
!
mActionW
)
doActions
();
else
if
((
varName
.
empty
()
||
IsConditionVariable
(
varName
))
&&
isConditionValid
()
&&
isConditionTrue
())
else
if
((
varName
.
empty
()
||
IsConditionVariable
(
varName
))
&&
isConditionValid
()
&&
isConditionTrue
())
doActions
();
return
0
;
...
...
@@ -707,7 +707,7 @@ int GUIAction::compute(std::string arg)
int
divide_by
=
atoi
(
divide_by_str
.
c_str
());
int
value
;
if
(
divide_by
!=
0
)
if
(
divide_by
!=
0
)
{
DataManager
::
GetValue
(
varName
,
value
);
DataManager
::
SetValue
(
varName
,
value
/
divide_by
);
...
...
@@ -855,7 +855,7 @@ int GUIAction::checkpartitionlist(std::string arg)
}
else
{
DataManager
::
SetValue
(
"tw_check_partition_list"
,
0
);
}
return
0
;
return
0
;
}
int
GUIAction
::
getpartitiondetails
(
std
::
string
arg
)
...
...
@@ -943,19 +943,19 @@ int GUIAction::screenshot(std::string arg __unused)
gid_t
gid
=
-
1
;
struct
passwd
*
pwd
=
getpwnam
(
"media_rw"
);
if
(
pwd
)
{
if
(
pwd
)
{
uid
=
pwd
->
pw_uid
;
gid
=
pwd
->
pw_gid
;
}
const
std
::
string
storage
=
DataManager
::
GetCurrentStoragePath
();
if
(
PartitionManager
.
Is_Mounted_By_Path
(
storage
))
{
if
(
PartitionManager
.
Is_Mounted_By_Path
(
storage
))
{
snprintf
(
path
,
sizeof
(
path
),
"%s/Pictures/Screenshots/"
,
storage
.
c_str
());
}
else
{
strcpy
(
path
,
"/tmp/"
);
}
if
(
!
TWFunc
::
Create_Dir_Recursive
(
path
,
0775
,
uid
,
gid
))
if
(
!
TWFunc
::
Create_Dir_Recursive
(
path
,
0775
,
uid
,
gid
))
return
0
;
tm
=
time
(
NULL
);
...
...
@@ -965,7 +965,7 @@ int GUIAction::screenshot(std::string arg __unused)
strftime
(
path
+
path_len
,
sizeof
(
path
)
-
path_len
,
"Screenshot_%Y-%m-%d-%H-%M-%S.png"
,
localtime
(
&
tm
));
int
res
=
gr_save_screenshot
(
path
);
if
(
res
==
0
)
{
if
(
res
==
0
)
{
chmod
(
path
,
0666
);
chown
(
path
,
uid
,
gid
);
...
...
@@ -1388,7 +1388,7 @@ int GUIAction::terminalcommand(std::string arg)
struct
timeval
timeout
;
fd_set
fdset
;
while
(
keep_going
)
while
(
keep_going
)
{
FD_ZERO
(
&
fdset
);
FD_SET
(
fd
,
&
fdset
);
...
...
@@ -1406,7 +1406,7 @@ int GUIAction::terminalcommand(std::string arg)
keep_going
=
0
;
}
else
{
// Try to read output
if
(
fgets
(
line
,
sizeof
(
line
),
fp
)
!=
NULL
)
if
(
fgets
(
line
,
sizeof
(
line
),
fp
)
!=
NULL
)
gui_print
(
"%s"
,
line
);
// Display output
else
keep_going
=
0
;
// Done executing
...
...
gui/animation.cpp
View file @
a8a89d19
...
...
@@ -88,7 +88,7 @@ GUIAnimation::GUIAnimation(xml_node<>* node) : GUIObject(node)
int
GUIAnimation
::
Render
(
void
)
{
if
(
!
isConditionTrue
())
if
(
!
isConditionTrue
())
return
0
;
if
(
!
mAnimation
||
!
mAnimation
->
GetResource
(
mFrame
))
return
-
1
;
...
...
@@ -99,7 +99,7 @@ int GUIAnimation::Render(void)
int
GUIAnimation
::
Update
(
void
)
{
if
(
!
isConditionTrue
())
if
(
!
isConditionTrue
())
return
0
;
if
(
!
mAnimation
)
return
-
1
;
...
...
gui/console.cpp
View file @
a8a89d19
...
...
@@ -78,7 +78,7 @@ extern "C" void __gui_print(const char *color, char *buf)
}
// The text after last \n (or whole string if there is no \n)
if
(
*
start
)
{
if
(
*
start
)
{
gConsole
.
push_back
(
start
);
gConsoleColor
.
push_back
(
color
);
}
...
...
@@ -205,7 +205,10 @@ GUIConsole::GUIConsole(xml_node<>* node) : GUIScrollList(node)
if
(
!
node
)
{
mRenderX
=
0
;
mRenderY
=
0
;
mRenderW
=
gr_fb_width
();
mRenderH
=
gr_fb_height
();
mRenderX
=
0
;
mRenderY
=
0
;
mRenderW
=
gr_fb_width
();
mRenderH
=
gr_fb_height
();
}
else
{
...
...
@@ -276,7 +279,7 @@ int GUIConsole::RenderConsole(void)
int
GUIConsole
::
Render
(
void
)
{
if
(
!
isConditionTrue
())
if
(
!
isConditionTrue
())
return
0
;
if
(
mSlideout
&&
mSlideoutState
==
hidden
)
...
...
@@ -346,7 +349,7 @@ int GUIConsole::IsInRegion(int x, int y)
// Return 0 on success, >0 to ignore remainder of touch, and <0 on error
int
GUIConsole
::
NotifyTouch
(
TOUCH_STATE
state
,
int
x
,
int
y
)
{
if
(
!
isConditionTrue
())
if
(
!
isConditionTrue
())
return
-
1
;
if
(
mSlideout
&&
x
>=
mSlideoutX
&&
x
<
mSlideoutX
+
mSlideoutW
&&
y
>=
mSlideoutY
&&
y
<
mSlideoutY
+
mSlideoutH
)
{
...
...
gui/fileselector.cpp
View file @
a8a89d19
...
...
@@ -127,7 +127,7 @@ GUIFileSelector::~GUIFileSelector()
int
GUIFileSelector
::
Update
(
void
)
{
if
(
!
isConditionTrue
())
if
(
!
isConditionTrue
())
return
0
;
GUIScrollList
::
Update
();
...
...
@@ -155,7 +155,7 @@ int GUIFileSelector::NotifyVarChange(const std::string& varName, const std::stri
{
GUIScrollList
::
NotifyVarChange
(
varName
,
value
);
if
(
!
isConditionTrue
())
if
(
!
isConditionTrue
())
return
0
;
if
(
varName
.
empty
())
{
...
...
gui/fill.cpp
View file @
a8a89d19
...
...
@@ -42,7 +42,7 @@ GUIFill::GUIFill(xml_node<>* node) : GUIObject(node)
int
GUIFill
::
Render
(
void
)
{
if
(
!
isConditionTrue
())
if
(
!
isConditionTrue
())
return
0
;
gr_color
(
mColor
.
red
,
mColor
.
green
,
mColor
.
blue
,
mColor
.
alpha
);
...
...
gui/gui.cpp
View file @
a8a89d19
...
...
@@ -300,15 +300,15 @@ void InputHandler::process_EV_KEY(input_event& ev)
// Handle key-press here
LOGEVENT
(
"TOUCH_KEY: %d
\n
"
,
ev
.
code
);
// Left mouse button is treated as a touch
if
(
ev
.
code
==
BTN_LEFT
)
if
(
ev
.
code
==
BTN_LEFT
)
{
MouseCursor
*
cursor
=
PageManager
::
GetMouseCursor
();
if
(
ev
.
value
==
1
)
if
(
ev
.
value
==
1
)
{
cursor
->
GetPos
(
x
,
y
);
doTouchStart
();
}
else
if
(
touch_status
)
else
if
(
touch_status
)
{
// Left mouse button was previously pressed and now is
// being released so send a TOUCH_RELEASE
...
...
@@ -323,9 +323,9 @@ void InputHandler::process_EV_KEY(input_event& ev)
}
}
// side mouse button, often used for "back" function
else
if
(
ev
.
code
==
BTN_SIDE
)
else
if
(
ev
.
code
==
BTN_SIDE
)
{
if
(
ev
.
value
==
1
)
if
(
ev
.
value
==
1
)
kb
->
KeyDown
(
KEY_BACK
);
else
kb
->
KeyUp
(
KEY_BACK
);
...
...
@@ -366,12 +366,12 @@ void InputHandler::process_EV_REL(input_event& ev)
// Mouse movement
MouseCursor
*
cursor
=
PageManager
::
GetMouseCursor
();
LOGEVENT
(
"EV_REL %d %d
\n
"
,
ev
.
code
,
ev
.
value
);
if
(
ev
.
code
==
REL_X
)
if
(
ev
.
code
==
REL_X
)
cursor
->
Move
(
ev
.
value
,
0
);
else
if
(
ev
.
code
==
REL_Y
)
else
if
(
ev
.
code
==
REL_Y
)
cursor
->
Move
(
0
,
ev
.
value
);
if
(
touch_status
)
{
if
(
touch_status
)
{
cursor
->
GetPos
(
x
,
y
);
LOGEVENT
(
"Mouse TOUCH_DRAG: %d, %d
\n
"
,
x
,
y
);
key_status
=
KS_NONE
;
...
...
gui/input.cpp
View file @
a8a89d19
...
...
@@ -236,7 +236,7 @@ void GUIInput::HandleCursorByTouch(int x) {
unsigned
index
=
0
,
displaySize
=
displayValue
.
size
();
int
prevX
=
mRenderX
+
scrollingX
;
for
(
index
=
0
;
index
<=
displaySize
;
index
++
)
{
for
(
index
=
0
;
index
<=
displaySize
;
index
++
)
{
cursorString
=
displayValue
.
substr
(
0
,
index
);
cursorX
=
gr_ttf_measureEx
(
cursorString
.
c_str
(),
fontResource
)
+
mRenderX
+
scrollingX
;
if
(
cursorX
>
x
)
{
...
...
@@ -263,7 +263,7 @@ void GUIInput::HandleCursorByTouch(int x) {
}
void
GUIInput
::
HandleCursorByText
()
{
// Uses mCursorLocation to find cursorX
// Uses mCursorLocation to find cursorX
if
(
!
DrawCursor
)
return
;
...
...
gui/listbox.cpp
View file @
a8a89d19
...
...
@@ -123,7 +123,7 @@ GUIListBox::~GUIListBox()
int
GUIListBox
::
Update
(
void
)
{
if
(
!
isConditionTrue
())
if
(
!
isConditionTrue
())
return
0
;
GUIScrollList
::
Update
();
...
...
@@ -140,7 +140,7 @@ int GUIListBox::NotifyVarChange(const std::string& varName, const std::string& v
{
GUIScrollList
::
NotifyVarChange
(
varName
,
value
);
if
(
!
isConditionTrue
())
if
(
!
isConditionTrue
())
return
0
;
// Check to see if the variable that we are using to store the list selected value has been updated
...
...
gui/mousecursor.cpp
View file @
a8a89d19
...
...
@@ -52,15 +52,15 @@ void MouseCursor::LoadData(xml_node<>* node)
xml_node
<>*
child
;
child
=
FindNode
(
node
,
"placement"
);
if
(
child
)
if
(
child
)
LoadPlacement
(
child
,
&
mRenderX
,
&
mRenderY
,
&
mRenderW
,
&
mRenderH
);
child
=
FindNode
(
node
,
"background"
);
if
(
child
)
if
(
child
)
{
m_color
=
LoadAttrColor
(
child
,
"color"
,
m_color
);
m_image
=
LoadAttrImage
(
child
,
"resource"
);
if
(
m_image
)
if
(
m_image
)
{
mRenderW
=
m_image
->
GetWidth
();
mRenderH
=
m_image
->
GetHeight
();
...
...
@@ -68,20 +68,20 @@ void MouseCursor::LoadData(xml_node<>* node)
}
child
=
FindNode
(
node
,
"speed"
);
if
(
child
)
if
(
child
)
{
attr
=
child
->
first_attribute
(
"multiplier"
);
if
(
attr
)
if
(
attr
)
m_speedMultiplier
=
atof
(
attr
->
value
());
}
}
int
MouseCursor
::
Render
(
void
)
{
if
(
!
m_present
)
if
(
!
m_present
)
return
0
;
if
(
m_image
)
if
(
m_image
)
{
gr_blit
(
m_image
->
GetResource
(),
0
,
0
,
mRenderW
,
mRenderH
,
mRenderX
,
mRenderY
);
}
...
...
@@ -95,15 +95,15 @@ int MouseCursor::Render(void)
int
MouseCursor
::
Update
(
void
)
{
if
(
m_present
!=
ev_has_mouse
())
if
(
m_present
!=
ev_has_mouse
())
{
m_present
=
ev_has_mouse
();
if
(
m_present
)
if
(
m_present
)
SetRenderPos
(
m_resX
/
2
,
m_resY
/
2
);
return
2
;
}
if
(
m_present
&&
m_moved
)
if
(
m_present
&&
m_moved
)
{
m_moved
=
false
;
return
2
;
...
...
@@ -113,7 +113,7 @@ int MouseCursor::Update(void)
int
MouseCursor
::
SetRenderPos
(
int
x
,
int
y
,
int
w
,
int
h
)
{
if
(
x
==
mRenderX
&&
y
==
mRenderY
)
if
(
x
==
mRenderX
&&
y
==
mRenderY
)
m_moved
=
true
;
return
RenderObject
::
SetRenderPos
(
x
,
y
,
w
,
h
);
...
...
@@ -121,7 +121,7 @@ int MouseCursor::SetRenderPos(int x, int y, int w, int h)
void
MouseCursor
::
Move
(
int
deltaX
,
int
deltaY
)
{
if
(
deltaX
!=
0
)
if
(
deltaX
!=
0
)
{
mRenderX
+=
deltaX
*
m_speedMultiplier
;
mRenderX
=
(
std
::
min
)(
mRenderX
,
m_resX
);
...
...
@@ -130,7 +130,7 @@ void MouseCursor::Move(int deltaX, int deltaY)
m_moved
=
true
;
}
if
(
deltaY
!=
0
)
if
(
deltaY
!=
0
)
{
mRenderY
+=
deltaY
*
m_speedMultiplier
;
mRenderY
=
(
std
::
min
)(
mRenderY
,
m_resY
);
...
...
gui/object.cpp
View file @
a8a89d19
...
...
@@ -159,7 +159,7 @@ bool GUIObject::UpdateConditions(std::vector<Condition>& conditions, const std::
std
::
vector
<
Condition
>::
iterator
iter
;
for
(
iter
=
conditions
.
begin
();
iter
!=
conditions
.
end
();
++
iter
)
{
if
(
varNameEmpty
&&
iter
->
mCompareOp
==
"modified"
)
if
(
varNameEmpty
&&
iter
->
mCompareOp
==
"modified"
)
{
string
val
;
...
...
@@ -172,10 +172,10 @@ bool GUIObject::UpdateConditions(std::vector<Condition>& conditions, const std::
iter
->
mLastVal
=
val
;
}
if
(
varNameEmpty
||
iter
->
mVar1
==
varName
||
iter
->
mVar2
==
varName
)
if
(
varNameEmpty
||
iter
->
mVar1
==
varName
||
iter
->
mVar2
==
varName
)
iter
->
mLastResult
=
isConditionTrue
(
&
(
*
iter
));
if
(
!
iter
->
mLastResult
)
if
(
!
iter
->
mLastResult
)
result
=
false
;
}
return
result
;
...
...
gui/objects.hpp
View file @
a8a89d19
...
...
@@ -1234,8 +1234,6 @@ COLOR LoadAttrColor(xml_node<>* element, const char* attrname, COLOR defaultvalu
FontResource
*
LoadAttrFont
(
xml_node
<>*
element
,
const
char
*
attrname
);
ImageResource
*
LoadAttrImage
(
xml_node
<>*
element
,
const
char
*
attrname
);
AnimationResource
*
LoadAttrAnimation
(
xml_node
<>*
element
,
const
char
*
attrname
);
bool
LoadPlacement
(
xml_node
<>*
node
,
int
*
x
,
int
*
y
,
int
*
w
=
NULL
,
int
*
h
=
NULL
,
Placement
*
placement
=
NULL
);
#endif // _OBJECTS_HEADER
gui/pages.cpp
View file @
a8a89d19
...
...
@@ -1009,7 +1009,7 @@ int PageSet::LoadVariables(xml_node<>* vars)
name
=
child
->
first_attribute
(
"name"
);
value
=
child
->
first_attribute
(
"value"
);
persist
=
child
->
first_attribute
(
"persist"
);
if
(
name
&&
value
)
if
(
name
&&
value
)
{
if
(
strcmp
(
name
->
value
(),
"tw_x_offset"
)
==
0
)
{
tw_x_offset
=
atoi
(
value
->
value
());
...
...
@@ -1193,7 +1193,7 @@ char* PageManager::LoadFileToBuffer(std::string filename, ZipArchive* package) {
// We can try to load the XML directly...
LOGINFO
(
"PageManager::LoadFileToBuffer loading filename: '%s' directly
\n
"
,
filename
.
c_str
());
struct
stat
st
;
if
(
stat
(
filename
.
c_str
(),
&
st
)
!=
0
)
{
if
(
stat
(
filename
.
c_str
(),
&
st
)
!=
0
)
{
// This isn't always an error, sometimes we request files that don't exist.
return
NULL
;
}
...
...
@@ -1471,7 +1471,7 @@ int PageManager::ReloadPackage(std::string name, std::string package)
if
(
iter
==
mPageSets
.
end
())
return
-
1
;
if
(
mMouseCursor
)
if
(
mMouseCursor
)
mMouseCursor
->
ResetData
(
gr_fb_width
(),
gr_fb_height
());
PageSet
*
set
=
(
*
iter
).
second
;
...
...
@@ -1589,18 +1589,18 @@ int PageManager::IsCurrentPage(Page* page)
int
PageManager
::
Render
(
void
)
{
if
(
blankTimer
.
isScreenOff
())
if
(
blankTimer
.
isScreenOff
())
return
0
;
int
res
=
(
mCurrentSet
?
mCurrentSet
->
Render
()
:
-
1
);
if
(
mMouseCursor
)
if
(
mMouseCursor
)
mMouseCursor
->
Render
();
return
res
;
}
HardwareKeyboard
*
PageManager
::
GetHardwareKeyboard
()
{
if
(
!
mHardwareKeyboard
)
if
(
!
mHardwareKeyboard
)
mHardwareKeyboard
=
new
HardwareKeyboard
();
return
mHardwareKeyboard
;
}
...
...
@@ -1630,14 +1630,14 @@ xml_node<>* PageManager::FindStyle(std::string name)
MouseCursor
*
PageManager
::
GetMouseCursor
()
{
if
(
!
mMouseCursor
)
if
(
!
mMouseCursor
)
mMouseCursor
=
new
MouseCursor
(
gr_fb_width
(),
gr_fb_height
());
return
mMouseCursor
;
}
void
PageManager
::
LoadCursorData
(
xml_node
<>*
node
)
{
if
(
!
mMouseCursor
)
if
(
!
mMouseCursor
)
mMouseCursor
=
new
MouseCursor
(
gr_fb_width
(),
gr_fb_height
());
mMouseCursor
->
LoadData
(
node
);
...
...
@@ -1645,7 +1645,7 @@ void PageManager::LoadCursorData(xml_node<>* node)
int
PageManager
::
Update
(
void
)
{
if
(
blankTimer
.
isScreenOff
())
if
(
blankTimer
.
isScreenOff
())
return
0
;
if
(
RunReload
())
...
...
@@ -1653,10 +1653,10 @@ int PageManager::Update(void)
int
res
=
(
mCurrentSet
?
mCurrentSet
->
Update
()
:
-
1
);
if
(
mMouseCursor
)
if
(
mMouseCursor
)
{
int
c_res
=
mMouseCursor
->
Update
();
if
(
c_res
>
res
)
if
(
c_res
>
res
)
res
=
c_res
;
}
return
res
;
...
...
gui/partitionlist.cpp
View file @
a8a89d19
...
...
@@ -79,7 +79,7 @@ GUIPartitionList::~GUIPartitionList()
int
GUIPartitionList
::
Update
(
void
)
{
if
(
!
isConditionTrue
())
if
(
!
isConditionTrue
())
return
0
;
// Check for changes in mount points if the list type is mount and update the list and render if needed
...
...
@@ -101,8 +101,8 @@ int GUIPartitionList::Update(void)
if
(
updateList
)
{
int
listSize
=
0
;
// Completely update the list if needed -- Used primarily for
// restore as the list for restore will change depending on what
// Completely update the list if needed -- Used primarily for
// restore as the list for restore will change depending on what
// partitions were backed up
mList
.
clear
();
PartitionManager
.
Get_Partition_List
(
ListType
,
&
mList
);
...
...
@@ -126,7 +126,7 @@ int GUIPartitionList::NotifyVarChange(const std::string& varName, const std::str
{
GUIScrollList
::
NotifyVarChange
(
varName
,
value
);
if
(
!
isConditionTrue
())
if
(
!
isConditionTrue
())
return
0
;
if
(
varName
==
mVariable
&&
!
mUpdate
)
...
...