Author: sveinung Date: Sat Apr 26 23:49:40 2014 New Revision: 24807 URL: http://svn.gna.org/viewcvs/freeciv?rev=24807&view=rev Log: Qt client: Change the way spy action probabilities are displayed.
- Show "(?%)" in stead of a warning icon for "known to be unknown". - Remove the text after chance value percentage on the label it self. - Explain what the chance value percentage is in a tool tip. See patch #4666 Modified: trunk/client/gui-qt/dialogs.cpp trunk/client/gui-qt/dialogs.h Modified: trunk/client/gui-qt/dialogs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.cpp?rev=24807&r1=24806&r2=24807&view=diff ============================================================================== --- trunk/client/gui-qt/dialogs.cpp (original) +++ trunk/client/gui-qt/dialogs.cpp Sat Apr 26 23:49:40 2014 @@ -712,7 +712,7 @@ Adds new action for choice dialog ***************************************************************************/ void choice_dialog::add_item(QString title, pfcn_void func, QVariant data1, - QVariant data2, bool warn) + QVariant data2, QString tool_tip = "") { QPushButton *button = new QPushButton(title); connect(button, SIGNAL(clicked()), signal_mapper, SLOT(map())); @@ -721,10 +721,8 @@ data1_list.append(data1); data2_list.append(data2); - if (warn) { - button->setToolTip(QString(_("Starting to do this" - " may currently be impossible."))); - button->setIcon(QIcon::fromTheme("dialog-warning")); + if (!tool_tip.isEmpty()) { + button->setToolTip(tool_tip); } layout->addWidget(button); @@ -864,15 +862,15 @@ func = caravan_establish_trade; str = can_establish ? QString(_("Establish _Trade route")) : QString(_("Enter Marketplace")); - caravan_dialog->add_item(str, func, qv1, qv2, FALSE); + caravan_dialog->add_item(str, func, qv1, qv2); } if (can_wonder) { func = caravan_help_build; - caravan_dialog->add_item(wonder, func, qv1, qv2, FALSE); + caravan_dialog->add_item(wonder, func, qv1, qv2); } func = caravan_keep_moving; caravan_dialog->add_item(QString(_("Keep moving")), - func, qv1, qv2, FALSE); + func, qv1, qv2); caravan_dialog->set_layout(); caravan_dialog->show_me(); @@ -1024,15 +1022,15 @@ if (diplomat_can_do_action(punit, DIPLOMAT_MOVE, dest_tile)) { if (pcity) { func = diplomat_keep_moving_city; - cd->add_item(QString(_("Keep moving")), func, qv1, qv2, FALSE); + cd->add_item(QString(_("Keep moving")), func, qv1, qv2); } else { func = diplomat_keep_moving_unit; - cd->add_item(QString(_("Keep moving")), func, qv1, qv2, FALSE); + cd->add_item(QString(_("Keep moving")), func, qv1, qv2); } } func = keep_moving; - cd->add_item(QString(_("Do nothing")), func, qv1, qv2, FALSE); + cd->add_item(QString(_("Do nothing")), func, qv1, qv2); cd->set_layout(); cd->show_me(); @@ -1052,6 +1050,7 @@ { QString title; QString success; + double converted; action_probability success_propability = action_probabilities[act]; @@ -1064,13 +1063,14 @@ case ACTPROB_NOT_KNOWN: /* Unknown because the player don't have the required knowledge to * determine the probability of success for this action. */ - title = QString(action_prepare_ui_name(act, "&", "")); - cd->add_item(title, func, data1, data2, TRUE); + title = QString(action_prepare_ui_name(act, "&", " (?%)")); + cd->add_item(title, func, data1, data2, + QString(_("Starting to do this may currently be impossible."))); break; case ACTPROB_NOT_IMPLEMENTED: /* Unknown because of missing server support. */ title = QString(action_prepare_ui_name(act, "&", "")); - cd->add_item(title, func, data1, data2, FALSE); + cd->add_item(title, func, data1, data2); break; default: /* Should be in the range 1 (0.5%) to 200 (100%) */ @@ -1078,13 +1078,17 @@ "Diplomat action probability out of range"); /* TRANS: the probability that a diplomat action will succeed. */ - success = _(" (%1% chance of success)"); + success = _(" (%1%)"); /* The unit of success_propability is 0.5% chance of success. */ + converted = (double)success_propability / 2; + title = QString(action_prepare_ui_name(act, "&", - success.arg((double)success_propability / 2).toUtf8())); - - cd->add_item(title, func, data1, data2, FALSE); + success.arg(converted).toUtf8())); + + cd->add_item(title, func, data1, data2, + QString(_("The probability of success is %1%.")) + .arg(converted)); break; } @@ -1158,7 +1162,7 @@ player_invention_state(pplayer, i) == TECH_PREREQS_KNOWN)) { func = spy_steal_something; str = advance_name_for_player(client.conn.playing, i); - cd->add_item(str, func, qv1, i, FALSE); + cd->add_item(str, func, qv1, i); nr++; } } advance_index_iterate_end; @@ -1166,7 +1170,7 @@ unit_name_translation(game_unit_by_number(diplomat_id))); func = spy_steal_something; str = astr_str(&stra); - cd->add_item(str, func, qv1, A_UNSET, FALSE); + cd->add_item(str, func, qv1, A_UNSET); cd->set_layout(); cd->show_me(); } @@ -1513,13 +1517,13 @@ gui()->get_current_unit(&diplomat_id, &diplomat_target_id, ATK_CITY); qv1 = diplomat_id; func = spy_sabotage; - cd->add_item(QString(_("City Production")), func, qv1, -1, FALSE); + cd->add_item(QString(_("City Production")), func, qv1, -1); city_built_iterate(pcity, pimprove) { if (pimprove->sabotage > 0) { func = spy_sabotage; str = city_improvement_name_translation(pcity, pimprove); qv2 = nr; - cd->add_item(str, func, qv1, improvement_number(pimprove), FALSE); + cd->add_item(str, func, qv1, improvement_number(pimprove)); nr++; } } city_built_iterate_end; @@ -1527,7 +1531,7 @@ unit_name_translation(game_unit_by_number(diplomat_id))); func = spy_sabotage; str = astr_str(&stra); - cd->add_item(str, func, qv1, B_LAST, FALSE); + cd->add_item(str, func, qv1, B_LAST); cd->set_layout(); cd->show_me(); astr_free(&stra); @@ -1564,7 +1568,7 @@ func = pillage_something; str = get_infrastructure_text(what_extras); qv1 = what; - cd->add_item(str, func, qv1, qv2, FALSE); + cd->add_item(str, func, qv1, qv2); } cd->set_layout(); cd->show_me(); Modified: trunk/client/gui-qt/dialogs.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.h?rev=24807&r1=24806&r2=24807&view=diff ============================================================================== --- trunk/client/gui-qt/dialogs.h (original) +++ trunk/client/gui-qt/dialogs.h Sat Apr 26 23:49:40 2014 @@ -164,7 +164,7 @@ ~choice_dialog(); void set_layout(); void add_item(QString title, pfcn_void func, QVariant data1, - QVariant data2, bool warn); + QVariant data2, QString tool_tip); void show_me(); QVBoxLayout *get_layout(); QList<pfcn_void> func_list; _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits