diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/newview/llpanelgroupvoting.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/newview/llpanelgroupvoting.cpp')
-rw-r--r-- | linden/indra/newview/llpanelgroupvoting.cpp | 107 |
1 files changed, 50 insertions, 57 deletions
diff --git a/linden/indra/newview/llpanelgroupvoting.cpp b/linden/indra/newview/llpanelgroupvoting.cpp index d58af78..b1e3e15 100644 --- a/linden/indra/newview/llpanelgroupvoting.cpp +++ b/linden/indra/newview/llpanelgroupvoting.cpp | |||
@@ -72,7 +72,7 @@ public: | |||
72 | 72 | ||
73 | void sendGroupProposalsRequest(const LLUUID& group_id); | 73 | void sendGroupProposalsRequest(const LLUUID& group_id); |
74 | void sendStartGroupProposal(); | 74 | void sendStartGroupProposal(); |
75 | void sendGroupProposalBallot(const char* vote); | 75 | void sendGroupProposalBallot(const std::string& vote); |
76 | void sendGroupVoteHistoryRequest(const LLUUID& group_id); | 76 | void sendGroupVoteHistoryRequest(const LLUUID& group_id); |
77 | 77 | ||
78 | void setEnableCreateProposal(); | 78 | void setEnableCreateProposal(); |
@@ -307,7 +307,7 @@ void LLPanelGroupVoting::impl::setEnableVoteProposal() | |||
307 | } | 307 | } |
308 | else | 308 | else |
309 | { // Something's wrong... should have some text | 309 | { // Something's wrong... should have some text |
310 | mProposalText->setText(LLString()); | 310 | mProposalText->setText(LLStringUtil::null); |
311 | } | 311 | } |
312 | 312 | ||
313 | proposal_cell = item->getColumn(2); | 313 | proposal_cell = item->getColumn(2); |
@@ -318,7 +318,7 @@ void LLPanelGroupVoting::impl::setEnableVoteProposal() | |||
318 | } | 318 | } |
319 | else | 319 | else |
320 | { // Something's wrong... should have some text | 320 | { // Something's wrong... should have some text |
321 | mEndDate->setText(LLString()); | 321 | mEndDate->setText(LLStringUtil::null); |
322 | } | 322 | } |
323 | 323 | ||
324 | // col 3: Vote Type | 324 | // col 3: Vote Type |
@@ -341,7 +341,7 @@ void LLPanelGroupVoting::impl::setEnableVoteProposal() | |||
341 | } | 341 | } |
342 | else | 342 | else |
343 | { // Something's wrong... should have some text | 343 | { // Something's wrong... should have some text |
344 | mStartDate->setText(LLString()); | 344 | mStartDate->setText(LLStringUtil::null); |
345 | } | 345 | } |
346 | 346 | ||
347 | proposal_cell = item->getColumn(6); | 347 | proposal_cell = item->getColumn(6); |
@@ -461,7 +461,7 @@ void LLPanelGroupVoting::impl::setEnableCreateProposal() | |||
461 | mProposals->setVisible(FALSE); | 461 | mProposals->setVisible(FALSE); |
462 | mProposalText->setEnabled(TRUE); | 462 | mProposalText->setEnabled(TRUE); |
463 | mProposalText->setVisible(TRUE); | 463 | mProposalText->setVisible(TRUE); |
464 | mProposalText->setText(LLString::null); | 464 | mProposalText->setText(LLStringUtil::null); |
465 | mBtnYes->setEnabled(FALSE); | 465 | mBtnYes->setEnabled(FALSE); |
466 | mBtnYes->setVisible(FALSE); | 466 | mBtnYes->setVisible(FALSE); |
467 | mBtnNo->setEnabled(FALSE); | 467 | mBtnNo->setEnabled(FALSE); |
@@ -556,7 +556,7 @@ void LLPanelGroupVoting::impl::setEnableHistoryItem() | |||
556 | } | 556 | } |
557 | else | 557 | else |
558 | { // Something's wrong... | 558 | { // Something's wrong... |
559 | mVoteHistoryText->setText(LLString()); | 559 | mVoteHistoryText->setText(LLStringUtil::null); |
560 | } | 560 | } |
561 | mVotesHistoryLbl->setVisible(FALSE); | 561 | mVotesHistoryLbl->setVisible(FALSE); |
562 | mVotesHistory->setVisible(FALSE); | 562 | mVotesHistory->setVisible(FALSE); |
@@ -631,7 +631,7 @@ void LLPanelGroupVoting::handleResponse( | |||
631 | 631 | ||
632 | if (response == BALLOT) | 632 | if (response == BALLOT) |
633 | { | 633 | { |
634 | LLString::format_map_t args; | 634 | LLStringUtil::format_map_t args; |
635 | 635 | ||
636 | if (success) | 636 | if (success) |
637 | { | 637 | { |
@@ -791,7 +791,7 @@ void LLPanelGroupVoting::impl::sendStartGroupProposal() | |||
791 | msg->addF32Fast(_PREHASH_Majority, majority ); | 791 | msg->addF32Fast(_PREHASH_Majority, majority ); |
792 | msg->addS32Fast(_PREHASH_Quorum, quorum ); | 792 | msg->addS32Fast(_PREHASH_Quorum, quorum ); |
793 | msg->addS32Fast(_PREHASH_Duration, duration_seconds ); | 793 | msg->addS32Fast(_PREHASH_Duration, duration_seconds ); |
794 | msg->addStringFast(_PREHASH_ProposalText, mProposalText->getText().c_str()); | 794 | msg->addStringFast(_PREHASH_ProposalText, mProposalText->getText()); |
795 | 795 | ||
796 | gAgent.sendReliableMessage(); | 796 | gAgent.sendReliableMessage(); |
797 | 797 | ||
@@ -801,7 +801,7 @@ void LLPanelGroupVoting::impl::sendStartGroupProposal() | |||
801 | } | 801 | } |
802 | } | 802 | } |
803 | 803 | ||
804 | void LLPanelGroupVoting::impl::sendGroupProposalBallot(const char* vote) | 804 | void LLPanelGroupVoting::impl::sendGroupProposalBallot(const std::string& vote) |
805 | { | 805 | { |
806 | if ( !gAgent.hasPowerInGroup(mGroupID, GP_PROPOSAL_VOTE) ) | 806 | if ( !gAgent.hasPowerInGroup(mGroupID, GP_PROPOSAL_VOTE) ) |
807 | return; | 807 | return; |
@@ -904,13 +904,13 @@ void LLPanelGroupVoting::impl::addPendingActiveScrollListItem(unsigned int curre | |||
904 | void LLPanelGroupVoting::impl::addNoActiveScrollListItem(EAddPosition pos) | 904 | void LLPanelGroupVoting::impl::addNoActiveScrollListItem(EAddPosition pos) |
905 | { | 905 | { |
906 | //*TODO: translate | 906 | //*TODO: translate |
907 | mProposals->addCommentText("There are currently no active proposals", pos); | 907 | mProposals->addCommentText(std::string("There are currently no active proposals"), pos); |
908 | } | 908 | } |
909 | 909 | ||
910 | void LLPanelGroupVoting::impl::addNoHistoryScrollListItem(EAddPosition pos) | 910 | void LLPanelGroupVoting::impl::addNoHistoryScrollListItem(EAddPosition pos) |
911 | { | 911 | { |
912 | //*TODO: translate | 912 | //*TODO: translate |
913 | mVotesHistory->addCommentText("There are currently no archived proposals", pos); | 913 | mVotesHistory->addCommentText(std::string("There are currently no archived proposals"), pos); |
914 | } | 914 | } |
915 | 915 | ||
916 | void LLPanelGroupVoting::impl::addPendingHistoryScrollListItem(unsigned int current, | 916 | void LLPanelGroupVoting::impl::addPendingHistoryScrollListItem(unsigned int current, |
@@ -958,16 +958,15 @@ void LLPanelGroupVoting::impl::processGroupActiveProposalItemReply(LLMessageSyst | |||
958 | 958 | ||
959 | 959 | ||
960 | U32 num_expected; | 960 | U32 num_expected; |
961 | const S32 MAX_STRING_NUM_LEN = 20; | 961 | std::string item_num_string; |
962 | char item_num_string[DB_TERSE_DATETIME_BUF_SIZE]; /*Flawfinder: ignore*/ | 962 | std::string proposal_text; |
963 | char proposal_text[DB_VOTE_TEXT_BUF_SIZE]; /*Flawfinder: ignore*/ | 963 | std::string vote_cast; |
964 | char vote_cast[DB_VOTE_RESULT_BUF_SIZE]; /*Flawfinder: ignore*/ | 964 | std::string start_datetime; |
965 | char start_datetime[DB_DATETIME_BUF_SIZE]; /*Flawfinder: ignore*/ | 965 | std::string end_datetime; |
966 | char end_datetime[DB_DATETIME_BUF_SIZE]; /*Flawfinder: ignore*/ | 966 | std::string vote_type; |
967 | char vote_type[DB_VOTE_TYPE_BUF_SIZE]; /*Flawfinder: ignore*/ | 967 | std::string majority_text; |
968 | char majority_text[MAX_STRING_NUM_LEN]; /*Flawfinder: ignore*/ | 968 | std::string quorum_text; |
969 | char quorum_text[MAX_STRING_NUM_LEN]; /*Flawfinder: ignore*/ | 969 | std::string vote_initiator_string; |
970 | char vote_initiator_string[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ | ||
971 | 970 | ||
972 | LLUUID vote_id; | 971 | LLUUID vote_id; |
973 | LLUUID vote_initiator; | 972 | LLUUID vote_initiator; |
@@ -989,20 +988,20 @@ void LLPanelGroupVoting::impl::processGroupActiveProposalItemReply(LLMessageSyst | |||
989 | 988 | ||
990 | for (int i = 0; i < num_proposals; i++) | 989 | for (int i = 0; i < num_proposals; i++) |
991 | { | 990 | { |
992 | msg->getStringFast(_PREHASH_ProposalData, _PREHASH_TerseDateID, DB_TERSE_DATETIME_BUF_SIZE, item_num_string, i ); | 991 | msg->getStringFast(_PREHASH_ProposalData, _PREHASH_TerseDateID, item_num_string, i ); |
993 | msg->getUUIDFast(_PREHASH_ProposalData, _PREHASH_VoteID, vote_id, i ); | 992 | msg->getUUIDFast(_PREHASH_ProposalData, _PREHASH_VoteID, vote_id, i ); |
994 | msg->getStringFast(_PREHASH_ProposalData, _PREHASH_StartDateTime, DB_DATETIME_BUF_SIZE, start_datetime, i ); | 993 | msg->getStringFast(_PREHASH_ProposalData, _PREHASH_StartDateTime, start_datetime, i ); |
995 | msg->getStringFast(_PREHASH_ProposalData, _PREHASH_EndDateTime, DB_DATETIME_BUF_SIZE, end_datetime, i ); | 994 | msg->getStringFast(_PREHASH_ProposalData, _PREHASH_EndDateTime, end_datetime, i ); |
996 | msg->getUUIDFast(_PREHASH_ProposalData, _PREHASH_VoteInitiator, vote_initiator, i ); | 995 | msg->getUUIDFast(_PREHASH_ProposalData, _PREHASH_VoteInitiator, vote_initiator, i ); |
997 | msg->getBOOLFast(_PREHASH_ProposalData,_PREHASH_AlreadyVoted, already_voted, i ); | 996 | msg->getBOOLFast(_PREHASH_ProposalData,_PREHASH_AlreadyVoted, already_voted, i ); |
998 | msg->getStringFast(_PREHASH_ProposalData,_PREHASH_VoteCast, DB_VOTE_RESULT_BUF_SIZE, vote_cast, i ); | 997 | msg->getStringFast(_PREHASH_ProposalData,_PREHASH_VoteCast, vote_cast, i ); |
999 | msg->getStringFast(_PREHASH_ProposalData, _PREHASH_ProposalText, DB_VOTE_TEXT_BUF_SIZE, proposal_text, i ); | 998 | msg->getStringFast(_PREHASH_ProposalData, _PREHASH_ProposalText, proposal_text, i ); |
1000 | msg->getF32Fast(_PREHASH_ProposalData, _PREHASH_Majority, majority, i ); | 999 | msg->getF32Fast(_PREHASH_ProposalData, _PREHASH_Majority, majority, i ); |
1001 | msg->getS32Fast(_PREHASH_ProposalData, _PREHASH_Quorum, quorum, i ); | 1000 | msg->getS32Fast(_PREHASH_ProposalData, _PREHASH_Quorum, quorum, i ); |
1002 | 1001 | ||
1003 | vote_initiator.toString(vote_initiator_string); | 1002 | vote_initiator.toString(vote_initiator_string); |
1004 | snprintf(majority_text, MAX_STRING_NUM_LEN, "%f", majority); /* Flawfinder: ignore */ | 1003 | majority_text = llformat("%f", majority); |
1005 | snprintf(quorum_text, MAX_STRING_NUM_LEN, "%i", quorum); /* Flawfinder: ignore */ | 1004 | quorum_text = llformat("%i", quorum); |
1006 | 1005 | ||
1007 | LLSD row; | 1006 | LLSD row; |
1008 | S32 index = 0; | 1007 | S32 index = 0; |
@@ -1139,15 +1138,14 @@ void LLPanelGroupVoting::impl::processGroupVoteHistoryItemReply(LLMessageSystem | |||
1139 | return; | 1138 | return; |
1140 | } | 1139 | } |
1141 | 1140 | ||
1142 | const S32 ITEM_NUM_MAX_BUF_LEN = 15; | 1141 | std::string item_num_string; |
1143 | char item_num_string[ITEM_NUM_MAX_BUF_LEN]; /*Flawfinder: ignore*/ | 1142 | std::string proposal_text; |
1144 | char proposal_text[DB_VOTE_TEXT_BUF_SIZE]; /*Flawfinder: ignore*/ | 1143 | std::string vote_result; |
1145 | char vote_result[MAX_STRING]; /*Flawfinder: ignore*/ | 1144 | std::string start_datetime; |
1146 | char start_datetime[DB_DATETIME_BUF_SIZE]; /*Flawfinder: ignore*/ | 1145 | std::string end_datetime; |
1147 | char end_datetime[DB_DATETIME_BUF_SIZE]; /*Flawfinder: ignore*/ | 1146 | std::string vote_type; |
1148 | char vote_type[DB_VOTE_TYPE_BUF_SIZE]; /*Flawfinder: ignore*/ | ||
1149 | 1147 | ||
1150 | LLString vote_text; | 1148 | std::string vote_text; |
1151 | LLUUID vote_id; | 1149 | LLUUID vote_id; |
1152 | LLUUID vote_initiator; | 1150 | LLUUID vote_initiator; |
1153 | LLUUID winner_id; | 1151 | LLUUID winner_id; |
@@ -1155,14 +1153,14 @@ void LLPanelGroupVoting::impl::processGroupVoteHistoryItemReply(LLMessageSystem | |||
1155 | F32 majority; | 1153 | F32 majority; |
1156 | S32 quorum; | 1154 | S32 quorum; |
1157 | 1155 | ||
1158 | msg->getStringFast(_PREHASH_HistoryItemData, _PREHASH_TerseDateID, ITEM_NUM_MAX_BUF_LEN, item_num_string ); | 1156 | msg->getStringFast(_PREHASH_HistoryItemData, _PREHASH_TerseDateID, item_num_string ); |
1159 | msg->getUUIDFast(_PREHASH_HistoryItemData, _PREHASH_VoteID, vote_id ); | 1157 | msg->getUUIDFast(_PREHASH_HistoryItemData, _PREHASH_VoteID, vote_id ); |
1160 | msg->getStringFast(_PREHASH_HistoryItemData, _PREHASH_StartDateTime, DB_DATETIME_BUF_SIZE, start_datetime ); | 1158 | msg->getStringFast(_PREHASH_HistoryItemData, _PREHASH_StartDateTime, start_datetime ); |
1161 | msg->getStringFast(_PREHASH_HistoryItemData, _PREHASH_EndDateTime, DB_DATETIME_BUF_SIZE, end_datetime ); | 1159 | msg->getStringFast(_PREHASH_HistoryItemData, _PREHASH_EndDateTime, end_datetime ); |
1162 | msg->getUUIDFast(_PREHASH_HistoryItemData, _PREHASH_VoteInitiator, vote_initiator); | 1160 | msg->getUUIDFast(_PREHASH_HistoryItemData, _PREHASH_VoteInitiator, vote_initiator); |
1163 | msg->getStringFast(_PREHASH_HistoryItemData, _PREHASH_VoteType, DB_VOTE_TYPE_BUF_SIZE, vote_type); | 1161 | msg->getStringFast(_PREHASH_HistoryItemData, _PREHASH_VoteType, vote_type); |
1164 | msg->getStringFast(_PREHASH_HistoryItemData,_PREHASH_VoteResult, DB_VOTE_RESULT_BUF_SIZE, vote_result); | 1162 | msg->getStringFast(_PREHASH_HistoryItemData,_PREHASH_VoteResult, vote_result); |
1165 | msg->getStringFast(_PREHASH_HistoryItemData, _PREHASH_ProposalText, DB_VOTE_TEXT_BUF_SIZE, proposal_text ); | 1163 | msg->getStringFast(_PREHASH_HistoryItemData, _PREHASH_ProposalText, proposal_text ); |
1166 | msg->getF32Fast(_PREHASH_HistoryItemData, _PREHASH_Majority, majority); | 1164 | msg->getF32Fast(_PREHASH_HistoryItemData, _PREHASH_Majority, majority); |
1167 | msg->getS32Fast(_PREHASH_HistoryItemData, _PREHASH_Quorum, quorum); | 1165 | msg->getS32Fast(_PREHASH_HistoryItemData, _PREHASH_Quorum, quorum); |
1168 | 1166 | ||
@@ -1170,7 +1168,7 @@ void LLPanelGroupVoting::impl::processGroupVoteHistoryItemReply(LLMessageSystem | |||
1170 | 1168 | ||
1171 | if (vote_items > 0) | 1169 | if (vote_items > 0) |
1172 | { | 1170 | { |
1173 | if (!strcmp(vote_type, "Proposal")) | 1171 | if (vote_type == "Proposal") |
1174 | { | 1172 | { |
1175 | LLSD row; | 1173 | LLSD row; |
1176 | row["id"] = vote_id; | 1174 | row["id"] = vote_id; |
@@ -1183,7 +1181,7 @@ void LLPanelGroupVoting::impl::processGroupVoteHistoryItemReply(LLMessageSystem | |||
1183 | 1181 | ||
1184 | vote_text.assign(proposal_text); | 1182 | vote_text.assign(proposal_text); |
1185 | vote_text.append("\n\n--\n"); | 1183 | vote_text.append("\n\n--\n"); |
1186 | if (!strcmp(vote_result, "Success")) | 1184 | if (vote_result == "Success") |
1187 | { | 1185 | { |
1188 | vote_text.append("Proposal PASSED."); | 1186 | vote_text.append("Proposal PASSED."); |
1189 | } | 1187 | } |
@@ -1193,25 +1191,20 @@ void LLPanelGroupVoting::impl::processGroupVoteHistoryItemReply(LLMessageSystem | |||
1193 | } | 1191 | } |
1194 | vote_text.append(" Votes->\n"); | 1192 | vote_text.append(" Votes->\n"); |
1195 | 1193 | ||
1196 | char vote_result[DB_VOTE_RESULT_BUF_SIZE]; /*Flawfinder: ignore*/ | 1194 | std::string vote_result; |
1197 | char result_msg[MAX_STRING]; /*Flawfinder: ignore*/ | ||
1198 | S32 num_votes; | 1195 | S32 num_votes; |
1199 | 1196 | ||
1200 | for (S32 i = 0; i < vote_items; ++i) | 1197 | for (S32 i = 0; i < vote_items; ++i) |
1201 | { | 1198 | { |
1202 | msg->getStringFast(_PREHASH_VoteItem, _PREHASH_VoteCast, DB_VOTE_RESULT_BUF_SIZE, vote_result, i); | 1199 | msg->getStringFast(_PREHASH_VoteItem, _PREHASH_VoteCast, vote_result, i); |
1203 | msg->getS32Fast(_PREHASH_VoteItem, _PREHASH_NumVotes, num_votes, i); | 1200 | msg->getS32Fast(_PREHASH_VoteItem, _PREHASH_NumVotes, num_votes, i); |
1204 | snprintf(result_msg, MAX_STRING, /* Flawfinder: ignore */ | 1201 | vote_text.append(llformat(" %s: %d\n", vote_result.c_str(), num_votes)); |
1205 | " %s: %d\n", | ||
1206 | vote_result, | ||
1207 | num_votes); | ||
1208 | vote_text.append(result_msg); | ||
1209 | } | 1202 | } |
1210 | 1203 | ||
1211 | vote_text.append("\n"); | 1204 | vote_text.append("\n"); |
1212 | 1205 | ||
1213 | LLString vote_text_stripped = vote_text; | 1206 | std::string vote_text_stripped = vote_text; |
1214 | LLString::stripNonprintable(vote_text_stripped); | 1207 | LLStringUtil::stripNonprintable(vote_text_stripped); |
1215 | 1208 | ||
1216 | row["columns"][1]["column"] = "vote_text_stripped"; | 1209 | row["columns"][1]["column"] = "vote_text_stripped"; |
1217 | row["columns"][1]["value"] = vote_text_stripped; | 1210 | row["columns"][1]["value"] = vote_text_stripped; |
@@ -1328,7 +1321,7 @@ void LLPanelGroupVoting::impl::onClickSubmitProposal(void *userdata) | |||
1328 | if ( self->mProposalText->getText().empty() ) | 1321 | if ( self->mProposalText->getText().empty() ) |
1329 | { | 1322 | { |
1330 | //throw up an error dialog | 1323 | //throw up an error dialog |
1331 | LLString::format_map_t args; | 1324 | LLStringUtil::format_map_t args; |
1332 | args["[MESSAGE]"] = self->mPanel.getString("empty_proposal_txt"); | 1325 | args["[MESSAGE]"] = self->mPanel.getString("empty_proposal_txt"); |
1333 | gViewerWindow->alertXml("GenericAlert", args); | 1326 | gViewerWindow->alertXml("GenericAlert", args); |
1334 | return; | 1327 | return; |
@@ -1596,12 +1589,12 @@ void LLPanelGroupVoting::activate() | |||
1596 | mImpl->setEnableHistoryList(); | 1589 | mImpl->setEnableHistoryList(); |
1597 | } | 1590 | } |
1598 | 1591 | ||
1599 | bool LLPanelGroupVoting::needsApply(LLString& mesg) | 1592 | bool LLPanelGroupVoting::needsApply(std::string& mesg) |
1600 | { | 1593 | { |
1601 | return false; | 1594 | return false; |
1602 | } | 1595 | } |
1603 | 1596 | ||
1604 | bool LLPanelGroupVoting::apply(LLString& mesg) | 1597 | bool LLPanelGroupVoting::apply(std::string& mesg) |
1605 | { | 1598 | { |
1606 | return true; | 1599 | return true; |
1607 | } | 1600 | } |