Commit a8a89d19 authored by Matt Mower's avatar Matt Mower Committed by Dees Troy

Whitespace cleanup

Change-Id: I93c65973679894bb8587da4b38b410d38036b8bd
parent 55f2bdac
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
......@@ -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;
......
......@@ -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) {
......
......@@ -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()) {
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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);
......
......@@ -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;
......
......@@ -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
......@@ -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;
......
......@@ -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)
......
......@@ -54,7 +54,7 @@ GUIPatternPassword::GUIPatternPassword(xml_node<>* node)
mAction = new GUIAction(node);
child = FindNode(node, "dot");
if(child)
if (child)
{
mDotColor = LoadAttrColor(child, "color", mDotColor);
mActiveDotColor = LoadAttrColor(child, "activecolor", mActiveDotColor);
......@@ -65,18 +65,18 @@ GUIPatternPassword::GUIPatternPassword(xml_node<>* node)
}
child = FindNode(node, "line");
if(child)
if (child)
{
mLineColor = LoadAttrColor(child, "color", mLineColor);
mLineWidth = LoadAttrIntScaleX(child, "width", mLineWidth);
}
child = FindNode(node, "data");
if(child)
if (child)
mPassVar = LoadAttrString(child, "name", "");
child = FindNode(node, "size");
if(child) {
if (child) {
mSizeVar = LoadAttrString(child, "name", "");
// Use the configured default, if set.
......@@ -84,7 +84,7 @@ GUIPatternPassword::GUIPatternPassword(xml_node<>* node)
Resize(size);
}
if(!mDotImage || !mDotImage->GetResource() || !mActiveDotImage || !mActiveDotImage->GetResource())
if (!mDotImage || !mDotImage->GetResource() || !mActiveDotImage || !mActiveDotImage->GetResource())
{
mDotCircle = gr_render_circle(mDotRadius, mDotColor.red, mDotColor.green, mDotColor.blue, mDotColor.alpha);
mActiveDotCircle = gr_render_circle(mDotRadius/2, mActiveDotColor.red, mActiveDotColor.green, mActiveDotColor.blue, mActiveDotColor.alpha);
......@@ -104,10 +104,10 @@ GUIPatternPassword::~GUIPatternPassword()
delete[] mDots;
delete[] mConnectedDots;
if(mDotCircle)
if (mDotCircle)
gr_free_surface(mDotCircle);
if(mActiveDotCircle)
if (mActiveDotCircle)
gr_free_surface(mActiveDotCircle);
}
......@@ -115,7 +115,7 @@ void GUIPatternPassword::ResetActiveDots()
{
mConnectedDotsLen = 0;
mCurLineX = mCurLineY = -1;
for(size_t i = 0; i < mGridSize * mGridSize; ++i)
for (size_t i = 0; i < mGridSize * mGridSize; ++i)
mDots[i].active = false;
}
......@@ -155,9 +155,9 @@ void GUIPatternPassword::CalculateDotPositions(void)
* n*n-1
*/
for(size_t r = 0; r < mGridSize; ++r)
for (size_t r = 0; r < mGridSize; ++r)
{
for(size_t c = 0; c < mGridSize; ++c)
for (size_t c = 0; c < mGridSize; ++c)
{
mDots[mGridSize*r + c].x = x;
mDots[mGridSize*r + c].y = y;
......@@ -170,29 +170,29 @@ void GUIPatternPassword::CalculateDotPositions(void)
int GUIPatternPassword::Render(void)
{
if(!isConditionTrue())
if (!isConditionTrue())
return 0;