[Freeciv-commits] r34834 - in /branches/S2_6/client/gui-qt: optiondlg.cpp optiondlg.h
Author: mir3x Date: Mon Jan 16 13:42:06 2017 New Revision: 34834 URL: http://svn.gna.org/viewcvs/freeciv?rev=34834&view=rev Log: Qt client - fixed heap-use-after-free in optiondlg See bug #25440 Modified: branches/S2_6/client/gui-qt/optiondlg.cpp branches/S2_6/client/gui-qt/optiondlg.h Modified: branches/S2_6/client/gui-qt/optiondlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/optiondlg.cpp?rev=34834&r1=34833&r2=34834&view=diff == --- branches/S2_6/client/gui-qt/optiondlg.cpp (original) +++ branches/S2_6/client/gui-qt/optiondlg.cpp Mon Jan 16 13:42:06 2017 @@ -225,8 +225,9 @@ / Return selected colors (for highlighting chat). / -struct ft_color option_dialog::get_color(struct option *poption) { - +void option_dialog::get_color(struct option *poption, QByteArray &a1, + QByteArray &a2) +{ QPalette pal; QColor col1, col2; QWidget *w; @@ -239,8 +240,8 @@ but = w->findChild("text_background"); pal = but->palette(); col2 = pal.color(QPalette::Button); - - return ft_color_construct(col1.name().toUtf8().data(), col2.name().toUtf8().data()); + a1 = col1.name().toUtf8(); + a2 = col2.name().toUtf8(); } / @@ -248,6 +249,8 @@ / void option_dialog::apply_options() { + QByteArray ba1, ba2; + options_iterate(curr_options, poption) { switch (option_type(poption)) { case OT_BOOLEAN: @@ -257,7 +260,7 @@ option_int_set(poption, get_int(poption)); break; case OT_STRING: - option_str_set(poption, get_string(poption)); + option_str_set(poption, get_string(poption).data()); break; case OT_ENUM: option_enum_set_int(poption, get_enum(poption)); @@ -266,10 +269,11 @@ option_bitwise_set(poption, get_bitwise(poption)); break; case OT_FONT: - option_font_set(poption, get_button_font(poption)); + option_font_set(poption, get_button_font(poption).data()); break; case OT_COLOR: - option_color_set(poption, get_color(poption)); + get_color(poption, ba1, ba2); + option_color_set(poption, ft_color_construct(ba1.data(), ba2.data())); break; case OT_VIDEO_MODE: log_error("Option type %s (%d) not supported yet.", @@ -383,17 +387,17 @@ / Get string for desired option from combobox or lineedit. / -char *option_dialog::get_string(struct option *poption) +QByteArray option_dialog::get_string(struct option *poption) { QComboBox *cb; QLineEdit *le; if (option_str_values(poption) != NULL) { cb = reinterpret_cast(option_get_gui_data(poption)); -return cb->currentText().toUtf8().data(); +return cb->currentText().toUtf8(); } else { le = reinterpret_cast(option_get_gui_data(poption)); -return le->displayText().toUtf8().data(); +return le->displayText().toUtf8(); } } @@ -812,14 +816,14 @@ / Get font from pushbutton. / -char *option_dialog::get_button_font(struct option *poption) +QByteArray option_dialog::get_button_font(struct option *poption) { QPushButton *qp; QFont f; qp = reinterpret_cast(option_get_gui_data(poption)); f = qp->font(); - return f.toString().toUtf8().data(); + return f.toString().toUtf8(); } / Modified: branches/S2_6/client/gui-qt/optiondlg.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/optiondlg.h?rev=34834&r1=34833&r2=34834&view=diff == --- branches/S2_6/client/gui-qt/optiondlg.h (original) +++ branches/S2_6/client/gui-qt/optiondlg.h Mon Jan 16 13:42:06 2017 @@ -65,12 +65,12 @@ void set_bitwise(struct option *poption, unsigned value); void set_color(struct option *poption, struct ft_color color); void set_font(struct option *poption, QString s); - struct ft_color get_color(struct option *poption); + void get_color(struct option *poption, QByteArray &a1, QByteArray &a2); bool get_bool(struct option *poption); int get_int(struct option *poption); - QFont get_font(struct option *poption); - char *get_button_font(struct option *poption); - char *get_string(struct option *poption); + QFont get_font(struct option *poption); + QByteArray get_button_
[Freeciv-commits] r34836 - in /trunk/client/gui-qt: optiondlg.cpp optiondlg.h
Author: mir3x Date: Mon Jan 16 13:42:36 2017 New Revision: 34836 URL: http://svn.gna.org/viewcvs/freeciv?rev=34836&view=rev Log: Qt client - fixed heap-use-after-free in optiondlg See bug #25440 Modified: trunk/client/gui-qt/optiondlg.cpp trunk/client/gui-qt/optiondlg.h Modified: trunk/client/gui-qt/optiondlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/optiondlg.cpp?rev=34836&r1=34835&r2=34836&view=diff == --- trunk/client/gui-qt/optiondlg.cpp (original) +++ trunk/client/gui-qt/optiondlg.cpp Mon Jan 16 13:42:36 2017 @@ -225,8 +225,9 @@ / Return selected colors (for highlighting chat). / -struct ft_color option_dialog::get_color(struct option *poption) { - +void option_dialog::get_color(struct option *poption, QByteArray &a1, + QByteArray &a2) +{ QPalette pal; QColor col1, col2; QWidget *w; @@ -239,8 +240,8 @@ but = w->findChild("text_background"); pal = but->palette(); col2 = pal.color(QPalette::Button); - - return ft_color_construct(col1.name().toUtf8().data(), col2.name().toUtf8().data()); + a1 = col1.name().toUtf8(); + a2 = col2.name().toUtf8(); } / @@ -248,6 +249,8 @@ / void option_dialog::apply_options() { + QByteArray ba1, ba2; + options_iterate(curr_options, poption) { switch (option_type(poption)) { case OT_BOOLEAN: @@ -257,7 +260,7 @@ option_int_set(poption, get_int(poption)); break; case OT_STRING: - option_str_set(poption, get_string(poption)); + option_str_set(poption, get_string(poption).data()); break; case OT_ENUM: option_enum_set_int(poption, get_enum(poption)); @@ -266,10 +269,11 @@ option_bitwise_set(poption, get_bitwise(poption)); break; case OT_FONT: - option_font_set(poption, get_button_font(poption)); + option_font_set(poption, get_button_font(poption).data()); break; case OT_COLOR: - option_color_set(poption, get_color(poption)); + get_color(poption, ba1, ba2); + option_color_set(poption, ft_color_construct(ba1.data(), ba2.data())); break; case OT_VIDEO_MODE: log_error("Option type %s (%d) not supported yet.", @@ -383,17 +387,17 @@ / Get string for desired option from combobox or lineedit. / -char *option_dialog::get_string(struct option *poption) +QByteArray option_dialog::get_string(struct option *poption) { QComboBox *cb; QLineEdit *le; if (option_str_values(poption) != NULL) { cb = reinterpret_cast(option_get_gui_data(poption)); -return cb->currentText().toUtf8().data(); +return cb->currentText().toUtf8(); } else { le = reinterpret_cast(option_get_gui_data(poption)); -return le->displayText().toUtf8().data(); +return le->displayText().toUtf8(); } } @@ -812,14 +816,14 @@ / Get font from pushbutton. / -char *option_dialog::get_button_font(struct option *poption) +QByteArray option_dialog::get_button_font(struct option *poption) { QPushButton *qp; QFont f; qp = reinterpret_cast(option_get_gui_data(poption)); f = qp->font(); - return f.toString().toUtf8().data(); + return f.toString().toUtf8(); } / Modified: trunk/client/gui-qt/optiondlg.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/optiondlg.h?rev=34836&r1=34835&r2=34836&view=diff == --- trunk/client/gui-qt/optiondlg.h (original) +++ trunk/client/gui-qt/optiondlg.h Mon Jan 16 13:42:36 2017 @@ -65,12 +65,12 @@ void set_bitwise(struct option *poption, unsigned value); void set_color(struct option *poption, struct ft_color color); void set_font(struct option *poption, QString s); - struct ft_color get_color(struct option *poption); + void get_color(struct option *poption, QByteArray &a1, QByteArray &a2); bool get_bool(struct option *poption); int get_int(struct option *poption); - QFont get_font(struct option *poption); - char *get_button_font(struct option *poption); - char *get_string(struct option *poption); + QFont get_font(struct option *poption); + QByteArray get_button_font(struct option *poption); + QByteArray get_string(struct option *poption);
[Freeciv-commits] r34835 - in /branches/S3_0/client/gui-qt: optiondlg.cpp optiondlg.h
Author: mir3x Date: Mon Jan 16 13:42:17 2017 New Revision: 34835 URL: http://svn.gna.org/viewcvs/freeciv?rev=34835&view=rev Log: Qt client - fixed heap-use-after-free in optiondlg See bug #25440 Modified: branches/S3_0/client/gui-qt/optiondlg.cpp branches/S3_0/client/gui-qt/optiondlg.h Modified: branches/S3_0/client/gui-qt/optiondlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-qt/optiondlg.cpp?rev=34835&r1=34834&r2=34835&view=diff == --- branches/S3_0/client/gui-qt/optiondlg.cpp (original) +++ branches/S3_0/client/gui-qt/optiondlg.cpp Mon Jan 16 13:42:17 2017 @@ -225,8 +225,9 @@ / Return selected colors (for highlighting chat). / -struct ft_color option_dialog::get_color(struct option *poption) { - +void option_dialog::get_color(struct option *poption, QByteArray &a1, + QByteArray &a2) +{ QPalette pal; QColor col1, col2; QWidget *w; @@ -239,8 +240,8 @@ but = w->findChild("text_background"); pal = but->palette(); col2 = pal.color(QPalette::Button); - - return ft_color_construct(col1.name().toUtf8().data(), col2.name().toUtf8().data()); + a1 = col1.name().toUtf8(); + a2 = col2.name().toUtf8(); } / @@ -248,6 +249,8 @@ / void option_dialog::apply_options() { + QByteArray ba1, ba2; + options_iterate(curr_options, poption) { switch (option_type(poption)) { case OT_BOOLEAN: @@ -257,7 +260,7 @@ option_int_set(poption, get_int(poption)); break; case OT_STRING: - option_str_set(poption, get_string(poption)); + option_str_set(poption, get_string(poption).data()); break; case OT_ENUM: option_enum_set_int(poption, get_enum(poption)); @@ -266,10 +269,11 @@ option_bitwise_set(poption, get_bitwise(poption)); break; case OT_FONT: - option_font_set(poption, get_button_font(poption)); + option_font_set(poption, get_button_font(poption).data()); break; case OT_COLOR: - option_color_set(poption, get_color(poption)); + get_color(poption, ba1, ba2); + option_color_set(poption, ft_color_construct(ba1.data(), ba2.data())); break; case OT_VIDEO_MODE: log_error("Option type %s (%d) not supported yet.", @@ -383,17 +387,17 @@ / Get string for desired option from combobox or lineedit. / -char *option_dialog::get_string(struct option *poption) +QByteArray option_dialog::get_string(struct option *poption) { QComboBox *cb; QLineEdit *le; if (option_str_values(poption) != NULL) { cb = reinterpret_cast(option_get_gui_data(poption)); -return cb->currentText().toUtf8().data(); +return cb->currentText().toUtf8(); } else { le = reinterpret_cast(option_get_gui_data(poption)); -return le->displayText().toUtf8().data(); +return le->displayText().toUtf8(); } } @@ -812,14 +816,14 @@ / Get font from pushbutton. / -char *option_dialog::get_button_font(struct option *poption) +QByteArray option_dialog::get_button_font(struct option *poption) { QPushButton *qp; QFont f; qp = reinterpret_cast(option_get_gui_data(poption)); f = qp->font(); - return f.toString().toUtf8().data(); + return f.toString().toUtf8(); } / Modified: branches/S3_0/client/gui-qt/optiondlg.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-qt/optiondlg.h?rev=34835&r1=34834&r2=34835&view=diff == --- branches/S3_0/client/gui-qt/optiondlg.h (original) +++ branches/S3_0/client/gui-qt/optiondlg.h Mon Jan 16 13:42:17 2017 @@ -65,12 +65,12 @@ void set_bitwise(struct option *poption, unsigned value); void set_color(struct option *poption, struct ft_color color); void set_font(struct option *poption, QString s); - struct ft_color get_color(struct option *poption); + void get_color(struct option *poption, QByteArray &a1, QByteArray &a2); bool get_bool(struct option *poption); int get_int(struct option *poption); - QFont get_font(struct option *poption); - char *get_button_font(struct option *poption); - char *get_string(struct option *poption); + QFont get_font(struct option *poption); + QByteArray get_button_
[Freeciv-commits] r34837 - in /branches/S2_6/client: control.c gui-qt/mapctrl.cpp
Author: mir3x Date: Mon Jan 16 13:44:48 2017 New Revision: 34837 URL: http://svn.gna.org/viewcvs/freeciv?rev=34837&view=rev Log: quickselect - return focused unit before unit count check for SELECT_FOCUS See bug #25425 Modified: branches/S2_6/client/control.c branches/S2_6/client/gui-qt/mapctrl.cpp Modified: branches/S2_6/client/control.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/control.c?rev=34837&r1=34836&r2=34837&view=diff == --- branches/S2_6/client/control.c (original) +++ branches/S2_6/client/control.c Mon Jan 16 13:44:48 2017 @@ -2580,6 +2580,10 @@ fc_assert_ret_val(qtype > SELECT_POPUP, NULL); + if (qtype == SELECT_FOCUS) { +return head_of_units_in_focus(); + } + if (listsize == 0) { return NULL; } else if (listsize == 1) { @@ -2587,9 +2591,6 @@ return (unit_owner(punit) == client.conn.playing) ? punit : NULL; } - if (qtype == SELECT_FOCUS) { -return head_of_units_in_focus(); - } /* Quickselect priorities. Units with moves left * before exhausted. Focus unit is excluded. * Modified: branches/S2_6/client/gui-qt/mapctrl.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/mapctrl.cpp?rev=34837&r1=34836&r2=34837&view=diff == --- branches/S2_6/client/gui-qt/mapctrl.cpp (original) +++ branches/S2_6/client/gui-qt/mapctrl.cpp Mon Jan 16 13:44:48 2017 @@ -385,7 +385,7 @@ } sc = fc_shortcuts::sc()->get_shortcut(SC_SELECT_BUTTON); if (((key && key == sc->key) || bt == sc->mouse) && md == sc->mod) { -if (goto_is_active() == false && pcity == nullptr) { +if (goto_is_active() == false) { action_button_pressed(pos.x(), pos.y(), SELECT_FOCUS); } return; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34838 - in /branches/S3_0/client: control.c gui-qt/mapctrl.cpp
Author: mir3x Date: Mon Jan 16 13:44:57 2017 New Revision: 34838 URL: http://svn.gna.org/viewcvs/freeciv?rev=34838&view=rev Log: quickselect - return focused unit before unit count check for SELECT_FOCUS See bug #25425 Modified: branches/S3_0/client/control.c branches/S3_0/client/gui-qt/mapctrl.cpp Modified: branches/S3_0/client/control.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/control.c?rev=34838&r1=34837&r2=34838&view=diff == --- branches/S3_0/client/control.c (original) +++ branches/S3_0/client/control.c Mon Jan 16 13:44:57 2017 @@ -2758,6 +2758,10 @@ fc_assert_ret_val(qtype > SELECT_POPUP, NULL); + if (qtype == SELECT_FOCUS) { +return head_of_units_in_focus(); + } + if (listsize == 0) { return NULL; } else if (listsize == 1) { @@ -2765,9 +2769,6 @@ return (unit_owner(punit) == client.conn.playing) ? punit : NULL; } - if (qtype == SELECT_FOCUS) { -return head_of_units_in_focus(); - } /* Quickselect priorities. Units with moves left * before exhausted. Focus unit is excluded. * Modified: branches/S3_0/client/gui-qt/mapctrl.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-qt/mapctrl.cpp?rev=34838&r1=34837&r2=34838&view=diff == --- branches/S3_0/client/gui-qt/mapctrl.cpp (original) +++ branches/S3_0/client/gui-qt/mapctrl.cpp Mon Jan 16 13:44:57 2017 @@ -387,7 +387,7 @@ } sc = fc_shortcuts::sc()->get_shortcut(SC_SELECT_BUTTON); if (((key && key == sc->key) || bt == sc->mouse) && md == sc->mod) { -if (goto_is_active() == false && pcity == nullptr) { +if (goto_is_active() == false) { action_button_pressed(pos.x(), pos.y(), SELECT_FOCUS); } return; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34839 - in /trunk/client: control.c gui-qt/mapctrl.cpp
Author: mir3x Date: Mon Jan 16 13:46:02 2017 New Revision: 34839 URL: http://svn.gna.org/viewcvs/freeciv?rev=34839&view=rev Log: quickselect - return focused unit before unit count check for SELECT_FOCUS See bug #25425 Modified: trunk/client/control.c trunk/client/gui-qt/mapctrl.cpp Modified: trunk/client/control.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/control.c?rev=34839&r1=34838&r2=34839&view=diff == --- trunk/client/control.c (original) +++ trunk/client/control.c Mon Jan 16 13:46:02 2017 @@ -2758,6 +2758,10 @@ fc_assert_ret_val(qtype > SELECT_POPUP, NULL); + if (qtype == SELECT_FOCUS) { +return head_of_units_in_focus(); + } + if (listsize == 0) { return NULL; } else if (listsize == 1) { @@ -2765,9 +2769,6 @@ return (unit_owner(punit) == client.conn.playing) ? punit : NULL; } - if (qtype == SELECT_FOCUS) { -return head_of_units_in_focus(); - } /* Quickselect priorities. Units with moves left * before exhausted. Focus unit is excluded. * Modified: trunk/client/gui-qt/mapctrl.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapctrl.cpp?rev=34839&r1=34838&r2=34839&view=diff == --- trunk/client/gui-qt/mapctrl.cpp (original) +++ trunk/client/gui-qt/mapctrl.cpp Mon Jan 16 13:46:02 2017 @@ -387,7 +387,7 @@ } sc = fc_shortcuts::sc()->get_shortcut(SC_SELECT_BUTTON); if (((key && key == sc->key) || bt == sc->mouse) && md == sc->mod) { -if (goto_is_active() == false && pcity == nullptr) { +if (goto_is_active() == false) { action_button_pressed(pos.x(), pos.y(), SELECT_FOCUS); } return; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34840 - /branches/S2_6/utility/fciconv.c
Author: mir3x Date: Mon Jan 16 13:54:00 2017 New Revision: 34840 URL: http://svn.gna.org/viewcvs/freeciv?rev=34840&view=rev Log: Fix building without iconv See bug #25430 Modified: branches/S2_6/utility/fciconv.c Modified: branches/S2_6/utility/fciconv.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/utility/fciconv.c?rev=34840&r1=34839&r2=34840&view=diff == --- branches/S2_6/utility/fciconv.c (original) +++ branches/S2_6/utility/fciconv.c Mon Jan 16 13:54:00 2017 @@ -41,10 +41,10 @@ static bool is_init = FALSE; static char convert_buffer[4096]; +static const char *transliteration_string; #ifdef HAVE_ICONV static const char *local_encoding, *data_encoding, *internal_encoding; -static const char *transliteration_string; #else /* HAVE_ICONV */ /* Hack to confuse the compiler into working. */ # define local_encoding get_local_encoding() @@ -61,11 +61,10 @@ void init_character_encodings(const char *my_internal_encoding, bool my_use_transliteration) { + transliteration_string = ""; #ifdef HAVE_ICONV if (my_use_transliteration) { transliteration_string = "//TRANSLIT"; - } else { -transliteration_string = ""; } /* Set the data encoding - first check $FREECIV_DATA_ENCODING, ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34842 - /trunk/utility/fciconv.c
Author: mir3x Date: Mon Jan 16 13:54:28 2017 New Revision: 34842 URL: http://svn.gna.org/viewcvs/freeciv?rev=34842&view=rev Log: Fix building without iconv See bug #25430 Modified: trunk/utility/fciconv.c Modified: trunk/utility/fciconv.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/fciconv.c?rev=34842&r1=34841&r2=34842&view=diff == --- trunk/utility/fciconv.c (original) +++ trunk/utility/fciconv.c Mon Jan 16 13:54:28 2017 @@ -41,10 +41,10 @@ static bool is_init = FALSE; static char convert_buffer[4096]; +static const char *transliteration_string; #ifdef HAVE_ICONV static const char *local_encoding, *data_encoding, *internal_encoding; -static const char *transliteration_string; #else /* HAVE_ICONV */ /* Hack to confuse the compiler into working. */ # define local_encoding get_local_encoding() @@ -61,11 +61,10 @@ void init_character_encodings(const char *my_internal_encoding, bool my_use_transliteration) { + transliteration_string = ""; #ifdef HAVE_ICONV if (my_use_transliteration) { transliteration_string = "//TRANSLIT"; - } else { -transliteration_string = ""; } /* Set the data encoding - first check $FREECIV_DATA_ENCODING, ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34841 - /branches/S3_0/utility/fciconv.c
Author: mir3x Date: Mon Jan 16 13:54:13 2017 New Revision: 34841 URL: http://svn.gna.org/viewcvs/freeciv?rev=34841&view=rev Log: Fix building without iconv See bug #25430 Modified: branches/S3_0/utility/fciconv.c Modified: branches/S3_0/utility/fciconv.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/utility/fciconv.c?rev=34841&r1=34840&r2=34841&view=diff == --- branches/S3_0/utility/fciconv.c (original) +++ branches/S3_0/utility/fciconv.c Mon Jan 16 13:54:13 2017 @@ -41,10 +41,10 @@ static bool is_init = FALSE; static char convert_buffer[4096]; +static const char *transliteration_string; #ifdef HAVE_ICONV static const char *local_encoding, *data_encoding, *internal_encoding; -static const char *transliteration_string; #else /* HAVE_ICONV */ /* Hack to confuse the compiler into working. */ # define local_encoding get_local_encoding() @@ -61,11 +61,10 @@ void init_character_encodings(const char *my_internal_encoding, bool my_use_transliteration) { + transliteration_string = ""; #ifdef HAVE_ICONV if (my_use_transliteration) { transliteration_string = "//TRANSLIT"; - } else { -transliteration_string = ""; } /* Set the data encoding - first check $FREECIV_DATA_ENCODING, ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34843 - /branches/S2_5/utility/fciconv.c
Author: mir3x Date: Mon Jan 16 13:54:48 2017 New Revision: 34843 URL: http://svn.gna.org/viewcvs/freeciv?rev=34843&view=rev Log: Fix building without iconv See bug #25430 Modified: branches/S2_5/utility/fciconv.c Modified: branches/S2_5/utility/fciconv.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/fciconv.c?rev=34843&r1=34842&r2=34843&view=diff == --- branches/S2_5/utility/fciconv.c (original) +++ branches/S2_5/utility/fciconv.c Mon Jan 16 13:54:48 2017 @@ -41,10 +41,10 @@ static bool is_init = FALSE; static char convert_buffer[4096]; +static const char *transliteration_string; #ifdef HAVE_ICONV static const char *local_encoding, *data_encoding, *internal_encoding; -static const char *transliteration_string; #else /* HAVE_ICONV */ /* Hack to confuse the compiler into working. */ # define local_encoding get_local_encoding() @@ -61,11 +61,10 @@ void init_character_encodings(const char *my_internal_encoding, bool my_use_transliteration) { + transliteration_string = ""; #ifdef HAVE_ICONV if (my_use_transliteration) { transliteration_string = "//TRANSLIT"; - } else { -transliteration_string = ""; } /* Set the data encoding - first check $FREECIV_DATA_ENCODING, ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34844 - /branches/S2_6/client/gui-qt/ratesdlg.cpp
Author: mir3x Date: Mon Jan 16 13:57:13 2017 New Revision: 34844 URL: http://svn.gna.org/viewcvs/freeciv?rev=34844&view=rev Log: Qt client - fix position of tax rates dialog See bug #25427 Modified: branches/S2_6/client/gui-qt/ratesdlg.cpp Modified: branches/S2_6/client/gui-qt/ratesdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/ratesdlg.cpp?rev=34844&r1=34843&r2=34844&view=diff == --- branches/S2_6/client/gui-qt/ratesdlg.cpp(original) +++ branches/S2_6/client/gui-qt/ratesdlg.cppMon Jan 16 13:57:13 2017 @@ -16,6 +16,8 @@ #endif // Qt +#include +#include #include #include @@ -229,12 +231,23 @@ void popup_rates_dialog(void) { QPoint p; + QRect rect; p = QCursor::pos(); + rect = QApplication::desktop()->availableGeometry(); tax_rates_dialog *trd = new tax_rates_dialog(gui()->central_wdg); + p.setY(p.y() - trd->height() / 2); + if (p.y() < 50) { +p.setY(50); + } + if (p.y() + trd->height() > rect.bottom()) { +p.setY(rect.bottom() - trd->height()); + } + if (p.x() + trd->width() > rect.right()) { +p.setX(rect.right() - trd->width()); + } + trd->move(p); trd->show(); - p.setX(p.x() - trd->width() /2); - trd->move(p); } /** ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34845 - /branches/S3_0/client/gui-qt/ratesdlg.cpp
Author: mir3x Date: Mon Jan 16 13:57:22 2017 New Revision: 34845 URL: http://svn.gna.org/viewcvs/freeciv?rev=34845&view=rev Log: Qt client - fix position of tax rates dialog See bug #25427 Modified: branches/S3_0/client/gui-qt/ratesdlg.cpp Modified: branches/S3_0/client/gui-qt/ratesdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-qt/ratesdlg.cpp?rev=34845&r1=34844&r2=34845&view=diff == --- branches/S3_0/client/gui-qt/ratesdlg.cpp(original) +++ branches/S3_0/client/gui-qt/ratesdlg.cppMon Jan 16 13:57:22 2017 @@ -16,6 +16,8 @@ #endif // Qt +#include +#include #include #include @@ -229,12 +231,23 @@ void popup_rates_dialog(void) { QPoint p; + QRect rect; p = QCursor::pos(); + rect = QApplication::desktop()->availableGeometry(); tax_rates_dialog *trd = new tax_rates_dialog(gui()->central_wdg); + p.setY(p.y() - trd->height() / 2); + if (p.y() < 50) { +p.setY(50); + } + if (p.y() + trd->height() > rect.bottom()) { +p.setY(rect.bottom() - trd->height()); + } + if (p.x() + trd->width() > rect.right()) { +p.setX(rect.right() - trd->width()); + } + trd->move(p); trd->show(); - p.setX(p.x() - trd->width() /2); - trd->move(p); } /** ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34846 - /trunk/client/gui-qt/ratesdlg.cpp
Author: mir3x Date: Mon Jan 16 13:57:46 2017 New Revision: 34846 URL: http://svn.gna.org/viewcvs/freeciv?rev=34846&view=rev Log: Qt client - fix position of tax rates dialog See bug #25427 Modified: trunk/client/gui-qt/ratesdlg.cpp Modified: trunk/client/gui-qt/ratesdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/ratesdlg.cpp?rev=34846&r1=34845&r2=34846&view=diff == --- trunk/client/gui-qt/ratesdlg.cpp(original) +++ trunk/client/gui-qt/ratesdlg.cppMon Jan 16 13:57:46 2017 @@ -16,6 +16,8 @@ #endif // Qt +#include +#include #include #include @@ -229,12 +231,23 @@ void popup_rates_dialog(void) { QPoint p; + QRect rect; p = QCursor::pos(); + rect = QApplication::desktop()->availableGeometry(); tax_rates_dialog *trd = new tax_rates_dialog(gui()->central_wdg); + p.setY(p.y() - trd->height() / 2); + if (p.y() < 50) { +p.setY(50); + } + if (p.y() + trd->height() > rect.bottom()) { +p.setY(rect.bottom() - trd->height()); + } + if (p.x() + trd->width() > rect.right()) { +p.setX(rect.right() - trd->width()); + } + trd->move(p); trd->show(); - p.setX(p.x() - trd->width() /2); - trd->move(p); } /** ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34848 - /branches/S3_0/client/gui-qt/menu.cpp
Author: mir3x Date: Mon Jan 16 14:00:51 2017 New Revision: 34848 URL: http://svn.gna.org/viewcvs/freeciv?rev=34848&view=rev Log: Qt client - fix build road/rail menu entry See bug #25428 Modified: branches/S3_0/client/gui-qt/menu.cpp Modified: branches/S3_0/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-qt/menu.cpp?rev=34848&r1=34847&r2=34848&view=diff == --- branches/S3_0/client/gui-qt/menu.cpp(original) +++ branches/S3_0/client/gui-qt/menu.cppMon Jan 16 14:00:51 2017 @@ -2001,8 +2001,26 @@ break; case ROAD: -if (can_units_do_any_road(punits)) { - i.value()->setEnabled(true); +{ + char road_item[500]; + struct extra_type *pextra = nullptr; + + if (can_units_do_any_road(punits)) { +i.value()->setEnabled(true); + } + unit_list_iterate(punits, punit) { +pextra = next_extra_for_tile(unit_tile(punit), EC_ROAD, +unit_owner(punit), punit); +if (pextra != nullptr) { + break; +} + } unit_list_iterate_end; + + if (pextra != nullptr) { +fc_snprintf(road_item, sizeof(road_item), _("Build %s"), +extra_name_translation(pextra)); +i.value()->setText(road_item); + } } break; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34847 - /branches/S2_6/client/gui-qt/menu.cpp
Author: mir3x Date: Mon Jan 16 14:00:42 2017 New Revision: 34847 URL: http://svn.gna.org/viewcvs/freeciv?rev=34847&view=rev Log: Qt client - fix build road/rail menu entry See bug #25428 Modified: branches/S2_6/client/gui-qt/menu.cpp Modified: branches/S2_6/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/menu.cpp?rev=34847&r1=34846&r2=34847&view=diff == --- branches/S2_6/client/gui-qt/menu.cpp(original) +++ branches/S2_6/client/gui-qt/menu.cppMon Jan 16 14:00:42 2017 @@ -1820,10 +1820,28 @@ break; case ROAD: + { +char road_item[500]; +struct extra_type *pextra = nullptr; + if (can_units_do_any_road(punits)) { i.value()->setEnabled(true); } -break; +unit_list_iterate(punits, punit) { + pextra = next_extra_for_tile(unit_tile(punit), EC_ROAD, + unit_owner(punit), punit); + if (pextra != nullptr) { +break; + } +} unit_list_iterate_end; + +if (pextra != nullptr) { + fc_snprintf(road_item, sizeof(road_item), _("Build %s"), + extra_name_translation(pextra)); + i.value()->setText(road_item); +} + } + break; case FORTIFY: if (can_units_do_activity(punits, ACTIVITY_FORTIFYING)) { ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34849 - /trunk/client/gui-qt/menu.cpp
Author: mir3x Date: Mon Jan 16 14:01:16 2017 New Revision: 34849 URL: http://svn.gna.org/viewcvs/freeciv?rev=34849&view=rev Log: Qt client - fix build road/rail menu entry See bug #25428 Modified: trunk/client/gui-qt/menu.cpp Modified: trunk/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=34849&r1=34848&r2=34849&view=diff == --- trunk/client/gui-qt/menu.cpp(original) +++ trunk/client/gui-qt/menu.cppMon Jan 16 14:01:16 2017 @@ -2001,8 +2001,26 @@ break; case ROAD: -if (can_units_do_any_road(punits)) { - i.value()->setEnabled(true); +{ + char road_item[500]; + struct extra_type *pextra = nullptr; + + if (can_units_do_any_road(punits)) { +i.value()->setEnabled(true); + } + unit_list_iterate(punits, punit) { +pextra = next_extra_for_tile(unit_tile(punit), EC_ROAD, +unit_owner(punit), punit); +if (pextra != nullptr) { + break; +} + } unit_list_iterate_end; + + if (pextra != nullptr) { +fc_snprintf(road_item, sizeof(road_item), _("Build %s"), +extra_name_translation(pextra)); +i.value()->setText(road_item); + } } break; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34850 - /branches/S2_6/client/gui-qt/themes.cpp
Author: mir3x Date: Mon Jan 16 14:03:22 2017 New Revision: 34850 URL: http://svn.gna.org/viewcvs/freeciv?rev=34850&view=rev Log: Qt client - fixed mismatched free/delete See bug #25431 Modified: branches/S2_6/client/gui-qt/themes.cpp Modified: branches/S2_6/client/gui-qt/themes.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/themes.cpp?rev=34850&r1=34849&r2=34850&view=diff == --- branches/S2_6/client/gui-qt/themes.cpp (original) +++ branches/S2_6/client/gui-qt/themes.cpp Mon Jan 16 14:03:22 2017 @@ -120,7 +120,9 @@ char *persistent = static_cast(fc_malloc(256)); *count = 1; - array = new char *[*count]; + /* array is deleted in C client code and shouln't + be allocated with new[] */ + array = static_cast(fc_malloc((*count) * sizeof(char *))); strncpy(persistent, fileinfoname(get_data_dirs(),""), 256); array[0] = persistent; return array; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34851 - /branches/S3_0/client/gui-qt/themes.cpp
Author: mir3x Date: Mon Jan 16 14:03:35 2017 New Revision: 34851 URL: http://svn.gna.org/viewcvs/freeciv?rev=34851&view=rev Log: Qt client - fixed mismatched free/delete See bug #25431 Modified: branches/S3_0/client/gui-qt/themes.cpp Modified: branches/S3_0/client/gui-qt/themes.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-qt/themes.cpp?rev=34851&r1=34850&r2=34851&view=diff == --- branches/S3_0/client/gui-qt/themes.cpp (original) +++ branches/S3_0/client/gui-qt/themes.cpp Mon Jan 16 14:03:35 2017 @@ -120,7 +120,9 @@ char *persistent = static_cast(fc_malloc(256)); *count = 1; - array = new char *[*count]; + /* array is deleted in C client code and shouln't + be allocated with new[] */ + array = static_cast(fc_malloc((*count) * sizeof(char *))); strncpy(persistent, fileinfoname(get_data_dirs(),""), 256); array[0] = persistent; return array; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34852 - /trunk/client/gui-qt/themes.cpp
Author: mir3x Date: Mon Jan 16 14:03:42 2017 New Revision: 34852 URL: http://svn.gna.org/viewcvs/freeciv?rev=34852&view=rev Log: Qt client - fixed mismatched free/delete See bug #25431 Modified: trunk/client/gui-qt/themes.cpp Modified: trunk/client/gui-qt/themes.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/themes.cpp?rev=34852&r1=34851&r2=34852&view=diff == --- trunk/client/gui-qt/themes.cpp (original) +++ trunk/client/gui-qt/themes.cpp Mon Jan 16 14:03:42 2017 @@ -120,7 +120,9 @@ char *persistent = static_cast(fc_malloc(256)); *count = 1; - array = new char *[*count]; + /* array is deleted in C client code and shouln't + be allocated with new[] */ + array = static_cast(fc_malloc((*count) * sizeof(char *))); strncpy(persistent, fileinfoname(get_data_dirs(),""), 256); array[0] = persistent; return array; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34853 - in /branches/S2_6: doc/README.packaging m4/qt5.m4
Author: mir3x Date: Mon Jan 16 14:17:16 2017 New Revision: 34853 URL: http://svn.gna.org/viewcvs/freeciv?rev=34853&view=rev Log: Decide minimum version of Qt supported Reported by Jacob Nevins See bug #25343 Modified: branches/S2_6/doc/README.packaging branches/S2_6/m4/qt5.m4 Modified: branches/S2_6/doc/README.packaging URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/doc/README.packaging?rev=34853&r1=34852&r2=34853&view=diff == --- branches/S2_6/doc/README.packaging (original) +++ branches/S2_6/doc/README.packaging Mon Jan 16 14:17:16 2017 @@ -18,6 +18,7 @@ generated by Freeciv version <= 2.1). * gtk3-client is now the default client * Minimum gtk3 requirement for building gtk3-client is now 3.8. +* Minimum qt requirement for building qt-client and freeciv-ruledit is 5.2. * There's new gtk3.22-client that has gtk+-3.22 as requirement. It can be built with --enable-client=gtk3.22 * There's new experimental sdl2-client. It can be built with Modified: branches/S2_6/m4/qt5.m4 URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/m4/qt5.m4?rev=34853&r1=34852&r2=34853&view=diff == --- branches/S2_6/m4/qt5.m4 (original) +++ branches/S2_6/m4/qt5.m4 Mon Jan 16 14:17:16 2017 @@ -62,10 +62,15 @@ done]) fi - AC_LANG_POP([C++]) - if test "x$qt5_libs" = "xyes" ; then AC_MSG_RESULT([found]) +AC_MSG_CHECKING([for Qt >= 5.2]) +FC_QT52_CHECK + fi + + AC_LANG_POP([C++]) + if test "x$fc_qt52" = "xyes" ; then +AC_MSG_RESULT([ok]) FC_QT5_VALIDATE_MOC([fc_qt5_usable=true], [fc_qt5_usable=false]) else AC_MSG_RESULT([not found]) @@ -99,6 +104,30 @@ CPPFLAGS="$CPPFLAGS_SAVE" ]) + +dnl Check if the included version of Qt is at least Qt5.2 +dnl Output: fc_qt52=yes|no +AC_DEFUN([FC_QT52_CHECK], +[ + CPPFLAGS_SAVE="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $FC_QT5_CPPFLAGS" + CXXFLAGS_SAVE="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $FC_QT5_CXXFLAGS" + LIBS_SAVE="$LIBS" + LIBS="${LIBS}${LIBSADD}" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[[#include ]],[[ + #if QT_VERSION < 0x050200 +fail + #endif +]])], +[fc_qt52=yes], +[fc_qt52=no]) + LIBS="$LIBS_SAVE" + CPPFLAGS="${CPPFLAGS_SAVE}" + CXXFLAGS="${CXXFLAGS_SAVE}" +]) + dnl Test Qt application linking with current flags AC_DEFUN([FC_QT5_LINKTEST], ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34855 - /trunk/m4/qt5.m4
Author: mir3x Date: Mon Jan 16 14:17:36 2017 New Revision: 34855 URL: http://svn.gna.org/viewcvs/freeciv?rev=34855&view=rev Log: Decide minimum version of Qt supported Reported by Jacob Nevins See bug #25343 Modified: trunk/m4/qt5.m4 Modified: trunk/m4/qt5.m4 URL: http://svn.gna.org/viewcvs/freeciv/trunk/m4/qt5.m4?rev=34855&r1=34854&r2=34855&view=diff == --- trunk/m4/qt5.m4 (original) +++ trunk/m4/qt5.m4 Mon Jan 16 14:17:36 2017 @@ -62,10 +62,15 @@ done]) fi - AC_LANG_POP([C++]) - if test "x$qt5_libs" = "xyes" ; then AC_MSG_RESULT([found]) +AC_MSG_CHECKING([for Qt >= 5.2]) +FC_QT52_CHECK + fi + + AC_LANG_POP([C++]) + if test "x$fc_qt52" = "xyes" ; then +AC_MSG_RESULT([ok]) FC_QT5_VALIDATE_MOC([fc_qt5_usable=true], [fc_qt5_usable=false]) else AC_MSG_RESULT([not found]) @@ -99,6 +104,30 @@ CPPFLAGS="$CPPFLAGS_SAVE" ]) + +dnl Check if the included version of Qt is at least Qt5.2 +dnl Output: fc_qt52=yes|no +AC_DEFUN([FC_QT52_CHECK], +[ + CPPFLAGS_SAVE="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $FC_QT5_CPPFLAGS" + CXXFLAGS_SAVE="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $FC_QT5_CXXFLAGS" + LIBS_SAVE="$LIBS" + LIBS="${LIBS}${LIBSADD}" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[[#include ]],[[ + #if QT_VERSION < 0x050200 +fail + #endif +]])], +[fc_qt52=yes], +[fc_qt52=no]) + LIBS="$LIBS_SAVE" + CPPFLAGS="${CPPFLAGS_SAVE}" + CXXFLAGS="${CXXFLAGS_SAVE}" +]) + dnl Test Qt application linking with current flags AC_DEFUN([FC_QT5_LINKTEST], ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34854 - /branches/S3_0/m4/qt5.m4
Author: mir3x Date: Mon Jan 16 14:17:28 2017 New Revision: 34854 URL: http://svn.gna.org/viewcvs/freeciv?rev=34854&view=rev Log: Decide minimum version of Qt supported Reported by Jacob Nevins See bug #25343 Modified: branches/S3_0/m4/qt5.m4 Modified: branches/S3_0/m4/qt5.m4 URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/m4/qt5.m4?rev=34854&r1=34853&r2=34854&view=diff == --- branches/S3_0/m4/qt5.m4 (original) +++ branches/S3_0/m4/qt5.m4 Mon Jan 16 14:17:28 2017 @@ -62,10 +62,15 @@ done]) fi - AC_LANG_POP([C++]) - if test "x$qt5_libs" = "xyes" ; then AC_MSG_RESULT([found]) +AC_MSG_CHECKING([for Qt >= 5.2]) +FC_QT52_CHECK + fi + + AC_LANG_POP([C++]) + if test "x$fc_qt52" = "xyes" ; then +AC_MSG_RESULT([ok]) FC_QT5_VALIDATE_MOC([fc_qt5_usable=true], [fc_qt5_usable=false]) else AC_MSG_RESULT([not found]) @@ -99,6 +104,30 @@ CPPFLAGS="$CPPFLAGS_SAVE" ]) + +dnl Check if the included version of Qt is at least Qt5.2 +dnl Output: fc_qt52=yes|no +AC_DEFUN([FC_QT52_CHECK], +[ + CPPFLAGS_SAVE="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $FC_QT5_CPPFLAGS" + CXXFLAGS_SAVE="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $FC_QT5_CXXFLAGS" + LIBS_SAVE="$LIBS" + LIBS="${LIBS}${LIBSADD}" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[[#include ]],[[ + #if QT_VERSION < 0x050200 +fail + #endif +]])], +[fc_qt52=yes], +[fc_qt52=no]) + LIBS="$LIBS_SAVE" + CPPFLAGS="${CPPFLAGS_SAVE}" + CXXFLAGS="${CXXFLAGS_SAVE}" +]) + dnl Test Qt application linking with current flags AC_DEFUN([FC_QT5_LINKTEST], ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34856 - in /branches/S2_6/client/gui-qt: menu.cpp shortcuts.cpp shortcuts.h
Author: mir3x Date: Mon Jan 16 14:22:46 2017 New Revision: 34856 URL: http://svn.gna.org/viewcvs/freeciv?rev=34856&view=rev Log: Qt client - add configurable shortcut to toggle city full bar See patch #8069 Modified: branches/S2_6/client/gui-qt/menu.cpp branches/S2_6/client/gui-qt/shortcuts.cpp branches/S2_6/client/gui-qt/shortcuts.h Modified: branches/S2_6/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/menu.cpp?rev=34856&r1=34855&r2=34856&view=diff == --- branches/S2_6/client/gui-qt/menu.cpp(original) +++ branches/S2_6/client/gui-qt/menu.cppMon Jan 16 14:22:46 2017 @@ -905,6 +905,8 @@ connect(act, SIGNAL(triggered()), this, SLOT(slot_native_tiles())); act = menu->addAction(_("City Full Bar")); act->setCheckable(true); + act->setShortcut(QKeySequence(shortcut_to_string( + fc_shortcuts::sc()->get_shortcut(SC_SHOW_FULLBAR; act->setChecked(gui_options.draw_full_citybar); connect(act, SIGNAL(triggered()), this, SLOT(slot_fullbar())); act = menu->addAction(_("City Names")); Modified: branches/S2_6/client/gui-qt/shortcuts.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/shortcuts.cpp?rev=34856&r1=34855&r2=34856&view=diff == --- branches/S2_6/client/gui-qt/shortcuts.cpp (original) +++ branches/S2_6/client/gui-qt/shortcuts.cpp Mon Jan 16 14:22:46 2017 @@ -52,7 +52,7 @@ RESPONSE_SAVE }; -static int num_shortcuts = 49; +static int num_shortcuts = 50; fc_shortcut default_shortcuts[] = { {SC_SCROLL_MAP, 0, Qt::RightButton, Qt::NoModifier, "Scroll map" }, {SC_CENTER_VIEW, Qt::Key_C, Qt::AllButtons, Qt::NoModifier, @@ -149,7 +149,9 @@ {SC_RELOAD_THEME, Qt::Key_F5, Qt::AllButtons, Qt::ControlModifier | Qt::ShiftModifier, _("Reload theme") }, {SC_RELOAD_TILESET, Qt::Key_F6, Qt::AllButtons, Qt::ControlModifier -| Qt::ShiftModifier, _("Reload tileset") } +| Qt::ShiftModifier, _("Reload tileset") }, + {SC_SHOW_FULLBAR, Qt::Key_F, Qt::AllButtons, Qt::ControlModifier, +_("Toggle city full bar visiblity") } }; Modified: branches/S2_6/client/gui-qt/shortcuts.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/shortcuts.h?rev=34856&r1=34855&r2=34856&view=diff == --- branches/S2_6/client/gui-qt/shortcuts.h (original) +++ branches/S2_6/client/gui-qt/shortcuts.h Mon Jan 16 14:22:46 2017 @@ -79,7 +79,8 @@ SC_PARADROP = 46, SC_POPUP_COMB_INF = 47, SC_RELOAD_THEME = 48, - SC_RELOAD_TILESET = 49 + SC_RELOAD_TILESET = 49, + SC_SHOW_FULLBAR = 50 }; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34858 - in /trunk/client/gui-qt: menu.cpp shortcuts.cpp shortcuts.h
Author: mir3x Date: Mon Jan 16 14:23:10 2017 New Revision: 34858 URL: http://svn.gna.org/viewcvs/freeciv?rev=34858&view=rev Log: Qt client - add configurable shortcut to toggle city full bar See patch #8069 Modified: trunk/client/gui-qt/menu.cpp trunk/client/gui-qt/shortcuts.cpp trunk/client/gui-qt/shortcuts.h Modified: trunk/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=34858&r1=34857&r2=34858&view=diff == --- trunk/client/gui-qt/menu.cpp(original) +++ trunk/client/gui-qt/menu.cppMon Jan 16 14:23:10 2017 @@ -1080,6 +1080,8 @@ connect(act, SIGNAL(triggered()), this, SLOT(slot_native_tiles())); act = menu->addAction(_("City Full Bar")); act->setCheckable(true); + act->setShortcut(QKeySequence(shortcut_to_string( + fc_shortcuts::sc()->get_shortcut(SC_SHOW_FULLBAR; act->setChecked(gui_options.draw_full_citybar); connect(act, SIGNAL(triggered()), this, SLOT(slot_fullbar())); act = menu->addAction(_("City Names")); Modified: trunk/client/gui-qt/shortcuts.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/shortcuts.cpp?rev=34858&r1=34857&r2=34858&view=diff == --- trunk/client/gui-qt/shortcuts.cpp (original) +++ trunk/client/gui-qt/shortcuts.cpp Mon Jan 16 14:23:10 2017 @@ -52,7 +52,7 @@ RESPONSE_SAVE }; -static int num_shortcuts = 49; +static int num_shortcuts = 50; fc_shortcut default_shortcuts[] = { {SC_SCROLL_MAP, 0, Qt::RightButton, Qt::NoModifier, "Scroll map" }, {SC_CENTER_VIEW, Qt::Key_C, Qt::AllButtons, Qt::NoModifier, @@ -149,7 +149,9 @@ {SC_RELOAD_THEME, Qt::Key_F5, Qt::AllButtons, Qt::ControlModifier | Qt::ShiftModifier, _("Reload theme") }, {SC_RELOAD_TILESET, Qt::Key_F6, Qt::AllButtons, Qt::ControlModifier -| Qt::ShiftModifier, _("Reload tileset") } +| Qt::ShiftModifier, _("Reload tileset") }, + {SC_SHOW_FULLBAR, Qt::Key_F, Qt::AllButtons, Qt::ControlModifier, +_("Toggle city full bar visiblity") } }; Modified: trunk/client/gui-qt/shortcuts.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/shortcuts.h?rev=34858&r1=34857&r2=34858&view=diff == --- trunk/client/gui-qt/shortcuts.h (original) +++ trunk/client/gui-qt/shortcuts.h Mon Jan 16 14:23:10 2017 @@ -79,7 +79,8 @@ SC_PARADROP = 46, SC_POPUP_COMB_INF = 47, SC_RELOAD_THEME = 48, - SC_RELOAD_TILESET = 49 + SC_RELOAD_TILESET = 49, + SC_SHOW_FULLBAR = 50 }; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34857 - in /branches/S3_0/client/gui-qt: menu.cpp shortcuts.cpp shortcuts.h
Author: mir3x Date: Mon Jan 16 14:22:58 2017 New Revision: 34857 URL: http://svn.gna.org/viewcvs/freeciv?rev=34857&view=rev Log: Qt client - add configurable shortcut to toggle city full bar See patch #8069 Modified: branches/S3_0/client/gui-qt/menu.cpp branches/S3_0/client/gui-qt/shortcuts.cpp branches/S3_0/client/gui-qt/shortcuts.h Modified: branches/S3_0/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-qt/menu.cpp?rev=34857&r1=34856&r2=34857&view=diff == --- branches/S3_0/client/gui-qt/menu.cpp(original) +++ branches/S3_0/client/gui-qt/menu.cppMon Jan 16 14:22:58 2017 @@ -1080,6 +1080,8 @@ connect(act, SIGNAL(triggered()), this, SLOT(slot_native_tiles())); act = menu->addAction(_("City Full Bar")); act->setCheckable(true); + act->setShortcut(QKeySequence(shortcut_to_string( + fc_shortcuts::sc()->get_shortcut(SC_SHOW_FULLBAR; act->setChecked(gui_options.draw_full_citybar); connect(act, SIGNAL(triggered()), this, SLOT(slot_fullbar())); act = menu->addAction(_("City Names")); Modified: branches/S3_0/client/gui-qt/shortcuts.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-qt/shortcuts.cpp?rev=34857&r1=34856&r2=34857&view=diff == --- branches/S3_0/client/gui-qt/shortcuts.cpp (original) +++ branches/S3_0/client/gui-qt/shortcuts.cpp Mon Jan 16 14:22:58 2017 @@ -52,7 +52,7 @@ RESPONSE_SAVE }; -static int num_shortcuts = 49; +static int num_shortcuts = 50; fc_shortcut default_shortcuts[] = { {SC_SCROLL_MAP, 0, Qt::RightButton, Qt::NoModifier, "Scroll map" }, {SC_CENTER_VIEW, Qt::Key_C, Qt::AllButtons, Qt::NoModifier, @@ -149,7 +149,9 @@ {SC_RELOAD_THEME, Qt::Key_F5, Qt::AllButtons, Qt::ControlModifier | Qt::ShiftModifier, _("Reload theme") }, {SC_RELOAD_TILESET, Qt::Key_F6, Qt::AllButtons, Qt::ControlModifier -| Qt::ShiftModifier, _("Reload tileset") } +| Qt::ShiftModifier, _("Reload tileset") }, + {SC_SHOW_FULLBAR, Qt::Key_F, Qt::AllButtons, Qt::ControlModifier, +_("Toggle city full bar visiblity") } }; Modified: branches/S3_0/client/gui-qt/shortcuts.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-qt/shortcuts.h?rev=34857&r1=34856&r2=34857&view=diff == --- branches/S3_0/client/gui-qt/shortcuts.h (original) +++ branches/S3_0/client/gui-qt/shortcuts.h Mon Jan 16 14:22:58 2017 @@ -79,7 +79,8 @@ SC_PARADROP = 46, SC_POPUP_COMB_INF = 47, SC_RELOAD_THEME = 48, - SC_RELOAD_TILESET = 49 + SC_RELOAD_TILESET = 49, + SC_SHOW_FULLBAR = 50 }; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34859 - /branches/S2_6/client/cityrepdata.c
Author: mir3x Date: Mon Jan 16 14:25:43 2017 New Revision: 34859 URL: http://svn.gna.org/viewcvs/freeciv?rev=34859&view=rev Log: Added city report columns for culture and history Submitted by Jacob Nevins See patch #7669 Modified: branches/S2_6/client/cityrepdata.c Modified: branches/S2_6/client/cityrepdata.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/cityrepdata.c?rev=34859&r1=34858&r2=34859&view=diff == --- branches/S2_6/client/cityrepdata.c (original) +++ branches/S2_6/client/cityrepdata.c Mon Jan 16 14:25:43 2017 @@ -140,6 +140,28 @@ static char buf[8]; fc_snprintf(buf, sizeof(buf), "%2d", pcity->feel[CITIZEN_HAPPY][FEELING_FINAL]); + return buf; +} + +/ + Returns city culture written to string +*/ +static const char *cr_entry_culture(const struct city *pcity, +const void *data) +{ + static char buf[8]; + fc_snprintf(buf, sizeof(buf), "%3d", pcity->client.culture); + return buf; +} + +/ + Returns city history written to string +*/ +static const char *cr_entry_history(const struct city *pcity, +const void *data) +{ + static char buf[8]; + fc_snprintf(buf, sizeof(buf), "%3d", pcity->history); return buf; } @@ -716,6 +738,10 @@ NULL, FUNC_TAG(luxury) }, { FALSE, 3, 1, NULL, N_("?Science:S"), N_("Economy: Science"), NULL, FUNC_TAG(science) }, + { FALSE, 3, 1, NULL, N_("?Culture:Clt"), N_("Culture"), +NULL, FUNC_TAG(culture) }, + { FALSE, 3, 1, NULL, N_("?History:Hst"), N_("History"), +NULL, FUNC_TAG(history) }, { FALSE, 3, 1, NULL, N_("?Continent:C"), N_("Continent number"), NULL, FUNC_TAG(continent) }, { FALSE, 1, 1, N_("?number_trade_routes:n"), N_("?number_trade_routes:R"), ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34861 - /trunk/client/cityrepdata.c
Author: mir3x Date: Mon Jan 16 14:26:06 2017 New Revision: 34861 URL: http://svn.gna.org/viewcvs/freeciv?rev=34861&view=rev Log: Added city report columns for culture and history Submitted by Jacob Nevins See patch #7669 Modified: trunk/client/cityrepdata.c Modified: trunk/client/cityrepdata.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/cityrepdata.c?rev=34861&r1=34860&r2=34861&view=diff == --- trunk/client/cityrepdata.c (original) +++ trunk/client/cityrepdata.c Mon Jan 16 14:26:06 2017 @@ -140,6 +140,28 @@ static char buf[8]; fc_snprintf(buf, sizeof(buf), "%2d", pcity->feel[CITIZEN_HAPPY][FEELING_FINAL]); + return buf; +} + +/ + Returns city culture written to string +*/ +static const char *cr_entry_culture(const struct city *pcity, +const void *data) +{ + static char buf[8]; + fc_snprintf(buf, sizeof(buf), "%3d", pcity->client.culture); + return buf; +} + +/ + Returns city history written to string +*/ +static const char *cr_entry_history(const struct city *pcity, +const void *data) +{ + static char buf[8]; + fc_snprintf(buf, sizeof(buf), "%3d", pcity->history); return buf; } @@ -714,6 +736,10 @@ NULL, FUNC_TAG(luxury) }, { FALSE, 3, 1, NULL, N_("?Science:S"), N_("Economy: Science"), NULL, FUNC_TAG(science) }, + { FALSE, 3, 1, NULL, N_("?Culture:Clt"), N_("Culture"), +NULL, FUNC_TAG(culture) }, + { FALSE, 3, 1, NULL, N_("?History:Hst"), N_("History"), +NULL, FUNC_TAG(history) }, { FALSE, 3, 1, NULL, N_("?Continent:C"), N_("Continent number"), NULL, FUNC_TAG(continent) }, { FALSE, 1, 1, N_("?number_trade_routes:n"), N_("?number_trade_routes:R"), ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34860 - /branches/S3_0/client/cityrepdata.c
Author: mir3x Date: Mon Jan 16 14:25:57 2017 New Revision: 34860 URL: http://svn.gna.org/viewcvs/freeciv?rev=34860&view=rev Log: Added city report columns for culture and history Submitted by Jacob Nevins See patch #7669 Modified: branches/S3_0/client/cityrepdata.c Modified: branches/S3_0/client/cityrepdata.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/cityrepdata.c?rev=34860&r1=34859&r2=34860&view=diff == --- branches/S3_0/client/cityrepdata.c (original) +++ branches/S3_0/client/cityrepdata.c Mon Jan 16 14:25:57 2017 @@ -140,6 +140,28 @@ static char buf[8]; fc_snprintf(buf, sizeof(buf), "%2d", pcity->feel[CITIZEN_HAPPY][FEELING_FINAL]); + return buf; +} + +/ + Returns city culture written to string +*/ +static const char *cr_entry_culture(const struct city *pcity, +const void *data) +{ + static char buf[8]; + fc_snprintf(buf, sizeof(buf), "%3d", pcity->client.culture); + return buf; +} + +/ + Returns city history written to string +*/ +static const char *cr_entry_history(const struct city *pcity, +const void *data) +{ + static char buf[8]; + fc_snprintf(buf, sizeof(buf), "%3d", pcity->history); return buf; } @@ -714,6 +736,10 @@ NULL, FUNC_TAG(luxury) }, { FALSE, 3, 1, NULL, N_("?Science:S"), N_("Economy: Science"), NULL, FUNC_TAG(science) }, + { FALSE, 3, 1, NULL, N_("?Culture:Clt"), N_("Culture"), +NULL, FUNC_TAG(culture) }, + { FALSE, 3, 1, NULL, N_("?History:Hst"), N_("History"), +NULL, FUNC_TAG(history) }, { FALSE, 3, 1, NULL, N_("?Continent:C"), N_("Continent number"), NULL, FUNC_TAG(continent) }, { FALSE, 1, 1, N_("?number_trade_routes:n"), N_("?number_trade_routes:R"), ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34862 - /trunk/common/metaknowledge.c
Author: sveinung Date: Tue Jan 17 06:31:39 2017 New Revision: 34862 URL: http://svn.gna.org/viewcvs/freeciv?rev=34862&view=rev Log: Improve the comment header clarity... ...of the mke_can_see_city_externals() function. Modified: trunk/common/metaknowledge.c Modified: trunk/common/metaknowledge.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/metaknowledge.c?rev=34862&r1=34861&r2=34862&view=diff == --- trunk/common/metaknowledge.c(original) +++ trunk/common/metaknowledge.cTue Jan 17 06:31:39 2017 @@ -710,8 +710,9 @@ Returns TRUE iff pow_player can see externally visible features of target_city. - Those are visible to its owner, to players that currently sees its city - tile and to players that has it as a trade partner. + A city's external features are visible to its owner, to players that + currently sees the tile it is located at and to players that has it as + a trade partner. **/ bool mke_can_see_city_externals(const struct player *pow_player, const struct city *target_city) { ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34863 - /branches/S3_0/common/metaknowledge.c
Author: sveinung Date: Tue Jan 17 06:32:04 2017 New Revision: 34863 URL: http://svn.gna.org/viewcvs/freeciv?rev=34863&view=rev Log: Improve the comment header clarity... ...of the mke_can_see_city_externals() function. Modified: branches/S3_0/common/metaknowledge.c Modified: branches/S3_0/common/metaknowledge.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/metaknowledge.c?rev=34863&r1=34862&r2=34863&view=diff == --- branches/S3_0/common/metaknowledge.c(original) +++ branches/S3_0/common/metaknowledge.cTue Jan 17 06:32:04 2017 @@ -710,8 +710,9 @@ Returns TRUE iff pow_player can see externally visible features of target_city. - Those are visible to its owner, to players that currently sees its city - tile and to players that has it as a trade partner. + A city's external features are visible to its owner, to players that + currently sees the tile it is located at and to players that has it as + a trade partner. **/ bool mke_can_see_city_externals(const struct player *pow_player, const struct city *target_city) { ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34864 - /branches/S2_6/common/metaknowledge.c
Author: sveinung Date: Tue Jan 17 06:32:33 2017 New Revision: 34864 URL: http://svn.gna.org/viewcvs/freeciv?rev=34864&view=rev Log: Improve the comment header clarity... ...of the mke_can_see_city_externals() function. Modified: branches/S2_6/common/metaknowledge.c Modified: branches/S2_6/common/metaknowledge.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/metaknowledge.c?rev=34864&r1=34863&r2=34864&view=diff == --- branches/S2_6/common/metaknowledge.c(original) +++ branches/S2_6/common/metaknowledge.cTue Jan 17 06:32:33 2017 @@ -691,8 +691,9 @@ Returns TRUE iff pow_player can see externally visible features of target_city. - Those are visible to its owner, to players that currently sees its city - tile and to players that has it as a trade partner. + A city's external features are visible to its owner, to players that + currently sees the tile it is located at and to players that has it as + a trade partner. **/ bool mke_can_see_city_externals(const struct player *pow_player, const struct city *target_city) { ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits