Page MenuHomeWildfire Games

Implement placeholder text for input fields and get rid of hack with mod filter
Changes PlannedPublic

Authored by Angen on Dec 9 2019, 10:47 PM.

Details

Reviewers
vladislavbelov
Summary
  • different font colour
  • no need to delete the text, when one wants to write there something
  • text displayed is not a value so field is technically empty
  • will disappear when user writes some character
  • will appear when user deletes all characters
  • we can get rid of text value "Filter" in mod selection screen and ugly hack around it
Test Plan

check functionality

Event Timeline

Angen created this revision.Dec 9 2019, 10:47 PM
Angen added a reviewer: Restricted Owners Package.

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/728/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/gui/ObjectTypes/CInput.h
|  34| class·CInput·:·public·IGUIObject,·public·IGUIScrollBarOwner
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCInput:' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/mod/gui/modmod/modmod.js
|    |++++| /zpool0/trunk/binaries/data/mods/mod/gui/modmod/modmod.js
| 349| 349| 
| 350| 350| 	g_ModsEnabled.sort((folder1, folder2) =>
| 351| 351| 		dependencies[folder1].indexOf(g_Mods[folder2].name) != -1 ? 1 :
| 352|    |-		dependencies[folder2].indexOf(g_Mods[folder1].name) != -1 ? -1 : 0);
|    | 352|+			dependencies[folder2].indexOf(g_Mods[folder1].name) != -1 ? -1 : 0);
| 353| 353| 
| 354| 354| 	displayModList("modsEnabledList", g_ModsEnabled);
| 355| 355| }
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1244/display/redirect

Angen updated this revision to Diff 10584.Dec 14 2019, 2:59 PM

make translatable attribute work

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/755/display/redirect

vladislavbelov added inline comments.
source/gui/ObjectTypes/CInput.cpp
1498

I prefer if (m_Caption.empty() && !m_PlaceholderText.empty()).

vladislavbelov added inline comments.Dec 14 2019, 3:13 PM
source/gui/ObjectTypes/CInput.cpp
1501

That's not a correct usage, usually we pass m_PlaceholderText.c_str(), but after C++11 we might also pass m_PlaceholderText.data().

vladislavbelov added inline comments.Dec 14 2019, 3:16 PM
source/gui/ObjectTypes/CInput.cpp
1501

Also you it on each frame, which means that the textRenderer recalculate glyphs/sizes for each frame. Which means a not needed work that costs time.

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/gui/ObjectTypes/CInput.h
|  34| class·CInput·:·public·IGUIObject,·public·IGUIScrollBarOwner
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCInput:' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/mod/gui/modmod/modmod.js
|    |++++| /zpool0/trunk/binaries/data/mods/mod/gui/modmod/modmod.js
| 348| 348| 
| 349| 349| 	g_ModsEnabled.sort((folder1, folder2) =>
| 350| 350| 		dependencies[folder1].indexOf(g_Mods[folder2].name) != -1 ? 1 :
| 351|    |-		dependencies[folder2].indexOf(g_Mods[folder1].name) != -1 ? -1 : 0);
|    | 351|+			dependencies[folder2].indexOf(g_Mods[folder1].name) != -1 ? -1 : 0);
| 352| 352| 
| 353| 353| 	displayModList("modsEnabledList", g_ModsEnabled);
| 354| 354| }
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1271/display/redirect

Angen updated this revision to Diff 10589.Dec 14 2019, 3:20 PM

user empty() and c_str()

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/758/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/gui/ObjectTypes/CInput.h
|  34| class·CInput·:·public·IGUIObject,·public·IGUIScrollBarOwner
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCInput:' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/mod/gui/modmod/modmod.js
|    |++++| /zpool0/trunk/binaries/data/mods/mod/gui/modmod/modmod.js
| 348| 348| 
| 349| 349| 	g_ModsEnabled.sort((folder1, folder2) =>
| 350| 350| 		dependencies[folder1].indexOf(g_Mods[folder2].name) != -1 ? 1 :
| 351|    |-		dependencies[folder2].indexOf(g_Mods[folder1].name) != -1 ? -1 : 0);
|    | 351|+			dependencies[folder2].indexOf(g_Mods[folder1].name) != -1 ? -1 : 0);
| 352| 352| 
| 353| 353| 	displayModList("modsEnabledList", g_ModsEnabled);
| 354| 354| }
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1274/display/redirect

Angen planned changes to this revision.Dec 20 2019, 10:34 PM

needs rebase anyway

Vulcan added a comment.Feb 8 2020, 5:38 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/gui/ObjectTypes/CInput.h
|  36| class·CInput·:·public·IGUIObject,·public·IGUIScrollBarOwner,·public·IGUITextOwner
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCInput:' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/mod/gui/modmod/modmod.js
|    |++++| /zpool0/trunk/binaries/data/mods/mod/gui/modmod/modmod.js
| 378| 378| 
| 379| 379| 	g_ModsEnabled.sort((folder1, folder2) =>
| 380| 380| 		dependencies[folder1].indexOf(g_Mods[folder2].name) != -1 ? 1 :
| 381|    |-		dependencies[folder2].indexOf(g_Mods[folder1].name) != -1 ? -1 : 0);
|    | 381|+			dependencies[folder2].indexOf(g_Mods[folder1].name) != -1 ? -1 : 0);
| 382| 382| 
| 383| 383| 	g_ModsEnabledFiltered = displayModList("modsEnabledList", g_ModsEnabled);
| 384| 384| }
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1729/display/redirect

Angen planned changes to this revision.Mon, Mar 16, 7:06 PM

Needs rework,
caption change event is triggering rebuild, so solution would be possibly override.

Angen removed a reviewer: Restricted Owners Package.Mon, Mar 16, 7:06 PM