Be more like C++, please.

This commit is contained in:
Lirusaito
2019-03-13 20:27:52 -04:00
parent 9b6c34213b
commit 3b654a0986

View File

@@ -173,7 +173,7 @@ void HippoPanelGridsImpl::refresh()
LLComboBox *grids = getChild<LLComboBox>("grid_selector"); LLComboBox *grids = getChild<LLComboBox>("grid_selector");
S32 selectIndex = -1, i = 0; S32 selectIndex = -1, i = 0;
grids->removeall(); grids->removeall();
if (defaultGrid != "") { if (!defaultGrid.empty()) {
grids->add(defaultGrid); grids->add(defaultGrid);
selectIndex = i++; selectIndex = i++;
} }
@@ -193,10 +193,10 @@ void HippoPanelGridsImpl::refresh()
if (selectIndex >= 0) { if (selectIndex >= 0) {
grids->setCurrentByIndex(selectIndex); grids->setCurrentByIndex(selectIndex);
} else { } else {
grids->setLabel(LLStringExplicit("")); // LLComboBox::removeall() does not clear the label grids->setLabel(LLStringUtil::null); // LLComboBox::removeall() does not clear the label
} }
childSetTextArg("default_grid", "[DEFAULT]", (defaultGrid != "")? defaultGrid: " "); childSetTextArg("default_grid", "[DEFAULT]", !defaultGrid.empty() ? defaultGrid : " ");
childSetEnabled("btn_delete", (selectIndex >= 0) && mIsEditable ); childSetEnabled("btn_delete", (selectIndex >= 0) && mIsEditable );
childSetEnabled("btn_copy", (mState == NORMAL) && (selectIndex >= 0)); childSetEnabled("btn_copy", (mState == NORMAL) && (selectIndex >= 0));
@@ -250,7 +250,7 @@ void HippoPanelGridsImpl::loadCurGrid()
childSetValue("render_compat", gridInfo->isRenderCompat()); childSetValue("render_compat", gridInfo->isRenderCompat());
enableEditing(!gridInfo->getLocked()); enableEditing(!gridInfo->getLocked());
} else { } else {
std::string empty = ""; const std::string& empty = LLStringUtil::null;
LLComboBox *platform = getChild<LLComboBox>("platform"); LLComboBox *platform = getChild<LLComboBox>("platform");
if (platform) platform->setCurrentByIndex(HippoGridInfo::PLATFORM_OTHER); if (platform) platform->setCurrentByIndex(HippoGridInfo::PLATFORM_OTHER);
childSetText("gridname", empty); childSetText("gridname", empty);
@@ -291,9 +291,9 @@ bool HippoPanelGridsImpl::saveCurGrid()
refresh(); refresh();
std::string gridname = childGetValue("gridname"); std::string gridname = childGetValue("gridname");
if (gridname == "<required>") gridname = ""; if (gridname == "<required>") gridname.clear();
std::string loginuri = childGetValue("loginuri"); std::string loginuri = childGetValue("loginuri");
if (loginuri == "<required>") loginuri = ""; if (loginuri == "<required>") loginuri.clear();
if (gridname.empty() && !loginuri.empty()) if (gridname.empty() && !loginuri.empty())
this->retrieveGridInfo(); this->retrieveGridInfo();
@@ -302,8 +302,8 @@ bool HippoPanelGridsImpl::saveCurGrid()
// check nickname // check nickname
std::string gridname = childGetValue("gridname"); std::string gridname = childGetValue("gridname");
childSetValue("gridname", (gridname != "")? gridname: "<required>"); childSetValue("gridname", !gridname.empty() ? gridname : "<required>");
if (gridname == "") { if (gridname.empty()) {
LLNotificationsUtil::add("GridsNoNick"); LLNotificationsUtil::add("GridsNoNick");
return false; return false;
} }
@@ -315,7 +315,7 @@ bool HippoPanelGridsImpl::saveCurGrid()
} }
// check login URI // check login URI
if (loginuri == "") { if (loginuri.empty()) {
LLSD args; LLSD args;
args["NAME"] = gridname; args["NAME"] = gridname;
LLNotificationsUtil::add("GridsNoLoginUri", args); LLNotificationsUtil::add("GridsNoLoginUri", args);
@@ -388,7 +388,7 @@ void HippoPanelGridsImpl::reset()
void HippoPanelGridsImpl::retrieveGridInfo() void HippoPanelGridsImpl::retrieveGridInfo()
{ {
std::string loginuri = childGetValue("loginuri"); std::string loginuri = childGetValue("loginuri");
if ((loginuri == "") || (loginuri == "<required>")) { if ((loginuri.empty()) || (loginuri == "<required>")) {
LLNotificationsUtil::add("GridInfoNoLoginUri"); LLNotificationsUtil::add("GridInfoNoLoginUri");
return; return;
} }
@@ -398,7 +398,7 @@ void HippoPanelGridsImpl::retrieveGridInfo()
if (mState == NORMAL) { if (mState == NORMAL) {
grid = gHippoGridManager->getGrid(mCurGrid); grid = gHippoGridManager->getGrid(mCurGrid);
} else if ((mState == ADD_NEW) || (mState == ADD_COPY)) { } else if ((mState == ADD_NEW) || (mState == ADD_COPY)) {
grid = new HippoGridInfo(""); grid = new HippoGridInfo(LLStringUtil::null);
cleanupGrid = true; cleanupGrid = true;
} else { } else {
LL_ERRS() << "Illegal state " << mState << '.' << LL_ENDL; LL_ERRS() << "Illegal state " << mState << '.' << LL_ENDL;
@@ -416,17 +416,17 @@ void HippoPanelGridsImpl::retrieveGridInfo()
if (grid->getPlatform() != HippoGridInfo::PLATFORM_OTHER) if (grid->getPlatform() != HippoGridInfo::PLATFORM_OTHER)
getChild<LLComboBox>("platform")->setCurrentByIndex(grid->getPlatform()); getChild<LLComboBox>("platform")->setCurrentByIndex(grid->getPlatform());
if (grid->getGridName() != "") childSetText("gridname", grid->getGridName()); if (!grid->getGridName().empty()) childSetText("gridname", grid->getGridName());
if (grid->getLoginUri() != "") childSetText("loginuri", grid->getLoginUri()); if (!grid->getLoginUri().empty()) childSetText("loginuri", grid->getLoginUri());
if (grid->getLoginPage() != "") childSetText("loginpage", grid->getLoginPage()); if (!grid->getLoginPage().empty()) childSetText("loginpage", grid->getLoginPage());
if (grid->getHelperUri() != "") childSetText("helperuri", grid->getHelperUri()); if (!grid->getHelperUri().empty()) childSetText("helperuri", grid->getHelperUri());
if (grid->getWebSite() != "") childSetText("website", grid->getWebSite()); if (!grid->getWebSite().empty()) childSetText("website", grid->getWebSite());
if (grid->getSupportUrl() != "") childSetText("support", grid->getSupportUrl()); if (!grid->getSupportUrl().empty()) childSetText("support", grid->getSupportUrl());
if (grid->getRegisterUrl() != "") childSetText("register", grid->getRegisterUrl()); if (!grid->getRegisterUrl().empty()) childSetText("register", grid->getRegisterUrl());
if (grid->getPartnerUrl() != "") childSetText("partner", grid->getPartnerUrl()); if (!grid->getPartnerUrl().empty()) childSetText("partner", grid->getPartnerUrl());
if (grid->getPasswordUrl() != "") childSetText("password", grid->getPasswordUrl()); if (!grid->getPasswordUrl().empty()) childSetText("password", grid->getPasswordUrl());
if (grid->getSearchUrl() != "") childSetText("search", grid->getSearchUrl()); if (!grid->getSearchUrl().empty()) childSetText("search", grid->getSearchUrl());
if (grid->getGridMessage() != "") childSetText("gridmessage", grid->getGridMessage()); if (!grid->getGridMessage().empty()) childSetText("gridmessage", grid->getGridMessage());
} }
catch(AIAlert::ErrorCode const& error) catch(AIAlert::ErrorCode const& error)
{ {