void LLFloaterDisplayName::onOpen() { getChild<LLUICtrl>("display_name_editor")->clear(); getChild<LLUICtrl>("display_name_confirm")->clear(); LLAvatarName av_name; LLAvatarNameCache::get(gAgent.getID(), &av_name); F64 now_secs = LLDate::now().secondsSinceEpoch(); if (now_secs < av_name.mNextUpdate) { // ...can't update until some time in the future F64 next_update_local_secs = av_name.mNextUpdate ; LLDate next_update_local(next_update_local_secs); // display as "July 18 12:17 PM" // std::string next_update_string = // next_update_local.toHTTPDateString("%B %d %I:%M %p"); std::string year = next_update_local.asString().substr(0,4); std::string month = next_update_local.asString().substr(5,2); std::string day = next_update_local.asString().substr(8,2); std::string hour = next_update_local.asString().substr(11,2); std::string minute = next_update_local.asString().substr(14,2); std::string second = next_update_local.asString().substr(17,2); std::string next_update_string_date = llformat("%s/%s/%s",year.c_str(),month.c_str(), day.c_str()); std::string next_update_string_time = llformat("%s:%s:%s",hour.c_str(),minute.c_str(), second.c_str()); getChild<LLUICtrl>("lockout_text")->setTextArg("[DATE]", next_update_string_date); getChild<LLUICtrl>("lockout_text")->setTextArg("[TIME]", next_update_string_time); getChild<LLUICtrl>("lockout_text")->setVisible(true); getChild<LLUICtrl>("save_btn")->setEnabled(false); getChild<LLUICtrl>("display_name_editor")->setEnabled(false); getChild<LLUICtrl>("display_name_confirm")->setEnabled(false); getChild<LLUICtrl>("cancel_btn")->setFocus(TRUE); } else { getChild<LLUICtrl>("lockout_text")->setVisible(false); getChild<LLUICtrl>("save_btn")->setEnabled(true); getChild<LLUICtrl>("display_name_editor")->setEnabled(true); getChild<LLUICtrl>("display_name_confirm")->setEnabled(true); } }
void LLFloaterDisplayName::onOpen(const LLSD& key) { getChild<LLUICtrl>("display_name_editor")->clear(); getChild<LLUICtrl>("display_name_confirm")->clear(); LLAvatarName av_name; LLAvatarNameCache::get(gAgent.getID(), &av_name); F64 now_secs = LLDate::now().secondsSinceEpoch(); if (now_secs < av_name.mNextUpdate) { // ...can't update until some time in the future F64 next_update_local_secs = av_name.mNextUpdate - LLStringOps::getLocalTimeOffset(); LLDate next_update_local(next_update_local_secs); // display as "July 18 12:17 PM" std::string next_update_string = next_update_local.toHTTPDateString("%B %d %I:%M %p"); getChild<LLUICtrl>("lockout_text")->setTextArg("[TIME]", next_update_string); getChild<LLUICtrl>("lockout_text")->setVisible(true); getChild<LLUICtrl>("save_btn")->setEnabled(false); getChild<LLUICtrl>("display_name_editor")->setEnabled(false); getChild<LLUICtrl>("display_name_confirm")->setEnabled(false); getChild<LLUICtrl>("cancel_btn")->setFocus(TRUE); } else { getChild<LLUICtrl>("lockout_text")->setVisible(false); getChild<LLUICtrl>("save_btn")->setEnabled(true); getChild<LLUICtrl>("display_name_editor")->setEnabled(true); getChild<LLUICtrl>("display_name_confirm")->setEnabled(true); } }