[Freeciv-commits] r25930 - /branches/S2_5/client/gui-qt/
Author: mir3x Date: Mon Aug 18 20:02:31 2014 New Revision: 25930 URL: http://svn.gna.org/viewcvs/freeciv?rev=25930view=rev Log: Added diplomacy dialog to qt-client See http://gna.org/patch/?5042 Modified: branches/S2_5/client/gui-qt/Makefile.am branches/S2_5/client/gui-qt/cityrep.cpp branches/S2_5/client/gui-qt/diplodlg.cpp branches/S2_5/client/gui-qt/diplodlg.h branches/S2_5/client/gui-qt/fc_client.cpp branches/S2_5/client/gui-qt/fc_client.h branches/S2_5/client/gui-qt/pages.cpp branches/S2_5/client/gui-qt/plrdlg.cpp branches/S2_5/client/gui-qt/repodlgs.cpp [This mail would be too long, it was shortened to contain the URLs only.] Modified: branches/S2_5/client/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/Makefile.am?rev=25930r1=25929r2=25930view=diff Modified: branches/S2_5/client/gui-qt/cityrep.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/cityrep.cpp?rev=25930r1=25929r2=25930view=diff Modified: branches/S2_5/client/gui-qt/diplodlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/diplodlg.cpp?rev=25930r1=25929r2=25930view=diff Modified: branches/S2_5/client/gui-qt/diplodlg.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/diplodlg.h?rev=25930r1=25929r2=25930view=diff Modified: branches/S2_5/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=25930r1=25929r2=25930view=diff Modified: branches/S2_5/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.h?rev=25930r1=25929r2=25930view=diff Modified: branches/S2_5/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/pages.cpp?rev=25930r1=25929r2=25930view=diff Modified: branches/S2_5/client/gui-qt/plrdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/plrdlg.cpp?rev=25930r1=25929r2=25930view=diff Modified: branches/S2_5/client/gui-qt/repodlgs.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/repodlgs.cpp?rev=25930r1=25929r2=25930view=diff ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25936 - in /branches/S2_5/client/gui-qt: fc_client.cpp menu.cpp
Author: mir3x Date: Mon Aug 18 20:10:32 2014 New Revision: 25936 URL: http://svn.gna.org/viewcvs/freeciv?rev=25936view=rev Log: Fixed full screen mode, now should be working correctly. See http://gna.org/patch/?5039 Modified: branches/S2_5/client/gui-qt/fc_client.cpp branches/S2_5/client/gui-qt/menu.cpp Modified: branches/S2_5/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=25936r1=25935r2=25936view=diff == --- branches/S2_5/client/gui-qt/fc_client.cpp (original) +++ branches/S2_5/client/gui-qt/fc_client.cpp Mon Aug 18 20:10:32 2014 @@ -275,7 +275,12 @@ update_load_page(); break; case PAGE_GAME: -main_window-showMaximized(); +if (fullscreen_mode){ + gui()-main_window-showFullScreen(); + gui()-mapview_wdg-showFullScreen(); +} else { + main_window-showMaximized(); +} main_window-menuBar()-setVisible(true); show_dock_widget(static_castint(OUTPUT_DOCK_WIDGET), true); show_dock_widget(static_castint(MESSAGE_DOCK_WIDGET), true); Modified: branches/S2_5/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.cpp?rev=25936r1=25935r2=25936view=diff == --- branches/S2_5/client/gui-qt/menu.cpp(original) +++ branches/S2_5/client/gui-qt/menu.cppMon Aug 18 20:10:32 2014 @@ -1232,13 +1232,13 @@ ***/ void mr_menu::slot_fullscreen() { - /* FIXME - might not work on X11 ( according to qt-assistant -4.8.4 ) - * Fix should be to show as maximzed and borderless */ - if (fullscreen_mode) { + if (!fullscreen_mode){ gui()-main_window-showFullScreen(); +gui()-mapview_wdg-showFullScreen(); } else { gui()-main_window-showNormal(); } + fullscreen_mode = !fullscreen_mode; } / ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25938 - in /branches/S2_5/client/gui-qt: citydlg.cpp mapview.cpp
Author: mir3x Date: Mon Aug 18 20:12:11 2014 New Revision: 25938 URL: http://svn.gna.org/viewcvs/freeciv?rev=25938view=rev Log: When porting from qt4 to qt5, fromAscii was replaced by fromLatin, and it showed many characters incorectly (FromAscii(x) should be just replaced by QString(x)) See http://gna.org/patch/?5041 Modified: branches/S2_5/client/gui-qt/citydlg.cpp branches/S2_5/client/gui-qt/mapview.cpp Modified: branches/S2_5/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/citydlg.cpp?rev=25938r1=25937r2=25938view=diff == --- branches/S2_5/client/gui-qt/citydlg.cpp (original) +++ branches/S2_5/client/gui-qt/citydlg.cpp Mon Aug 18 20:12:11 2014 @@ -1649,13 +1649,13 @@ int j = 2*i; #if QT_VERSION = QT_VERSION_CHECK(5, 0, 0) -qlt[i]-setText(QString::fromLatin1(buf[2*i])); +qlt[i]-setText(QString(buf[2*i])); #else qlt[i]-setText(QString::fromAscii(buf[2*i])); #endif if (j != GROWTH j != GRANARY j!= WASTE j!= CORRUPTION){ #if QT_VERSION = QT_VERSION_CHECK(5, 0, 0) - qlt[i]-setToolTip(QString::fromLatin1(buf[2*i + 1])); + qlt[i]-setToolTip(QString(buf[2*i + 1])); #else qlt[i]-setToolTip(QString::fromAscii(buf[2*i + 1])); #endif @@ -1947,7 +1947,7 @@ const char *name = city_production_name_translation(pcity); int value = city_production_buy_gold_cost(pcity); #if QT_VERSION = QT_VERSION_CHECK(5, 0, 0) - const QString title = QString::fromUtf8(_(Buy)) + QString::fromLatin1( ? ); + const QString title = QString::fromUtf8(_(Buy)) + QString( ? ); #else const QString title = QString::fromUtf8(_(Buy)) + QString::fromAscii( ? ); #endif Modified: branches/S2_5/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapview.cpp?rev=25938r1=25937r2=25938view=diff == --- branches/S2_5/client/gui-qt/mapview.cpp (original) +++ branches/S2_5/client/gui-qt/mapview.cpp Mon Aug 18 20:12:11 2014 @@ -1109,7 +1109,7 @@ void update_info_label(void) { QString eco_info; - QString s = QString::fromLatin1(textyear(game.info.year)) + ( + QString s = QString(textyear(game.info.year)) + ( + _(Turn) + : + QString::number(game.info.turn) + ); gui()-game_info_label-set_turn_info(s); set_indicator_icons(client_research_sprite(), @@ -1157,7 +1157,7 @@ void qtg_update_timeout_label(void) { gui()-game_info_label-set_time_info ( -QString::fromLatin1(get_timeout_label_text())); +QString(get_timeout_label_text())); } / ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25939 - in /trunk/client/gui-qt: citydlg.cpp dialogs.cpp mapview.cpp
Author: mir3x Date: Mon Aug 18 20:12:23 2014 New Revision: 25939 URL: http://svn.gna.org/viewcvs/freeciv?rev=25939view=rev Log: When porting from qt4 to qt5, fromAscii was replaced by fromLatin, and it showed many characters incorectly (FromAscii(x) should be just replaced by QString(x)) See http://gna.org/patch/?5041 Modified: trunk/client/gui-qt/citydlg.cpp trunk/client/gui-qt/dialogs.cpp trunk/client/gui-qt/mapview.cpp Modified: trunk/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/citydlg.cpp?rev=25939r1=25938r2=25939view=diff == --- trunk/client/gui-qt/citydlg.cpp (original) +++ trunk/client/gui-qt/citydlg.cpp Mon Aug 18 20:12:23 2014 @@ -1644,10 +1644,10 @@ for (int i = 0; i NUM_INFO_FIELDS; i++) { int j = 2*i; -qlt[i]-setText(QString::fromLatin1(buf[2*i])); +qlt[i]-setText(QString(buf[2*i])); if (j != GROWTH j != GRANARY j!= WASTE j!= CORRUPTION){ - qlt[i]-setToolTip(QString::fromLatin1(buf[2*i + 1])); + qlt[i]-setToolTip(QString(buf[2*i + 1])); } } } @@ -1935,7 +1935,7 @@ int ret; const char *name = city_production_name_translation(pcity); int value = city_production_buy_gold_cost(pcity); - const QString title = QString::fromUtf8(_(Buy)) + QString::fromLatin1( ? ); + const QString title = QString::fromUtf8(_(Buy)) + QString( ? ); QMessageBox ask(this); if (!can_client_issue_orders()) { Modified: trunk/client/gui-qt/dialogs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.cpp?rev=25939r1=25938r2=25939view=diff == --- trunk/client/gui-qt/dialogs.cpp (original) +++ trunk/client/gui-qt/dialogs.cpp Mon Aug 18 20:12:23 2014 @@ -415,9 +415,9 @@ cw = new close_widget(this); cw-put_to_corner(); - qcaption = QString::fromLatin1(caption); - qheadline = QString::fromLatin1(headline); - qlines = QString::fromLatin1(lines); + qcaption = QString(caption); + qheadline = QString(headline); + qlines = QString(lines); qlist = qlines.split(\n); small_font =::gui()-fc_fonts.get_font(gui_qt_font_notify_label); x = 0; Modified: trunk/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=25939r1=25938r2=25939view=diff == --- trunk/client/gui-qt/mapview.cpp (original) +++ trunk/client/gui-qt/mapview.cpp Mon Aug 18 20:12:23 2014 @@ -1110,7 +1110,7 @@ void update_info_label(void) { QString eco_info; - QString s = QString::fromLatin1(textyear(game.info.year)) + ( + QString s = QString(textyear(game.info.year)) + ( + _(Turn) + : + QString::number(game.info.turn) + ); gui()-game_info_label-set_turn_info(s); set_indicator_icons(client_research_sprite(), ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25940 - /branches/S2_5/client/gui-qt/dialogs.cpp
Author: mir3x Date: Mon Aug 18 21:24:57 2014 New Revision: 25940 URL: http://svn.gna.org/viewcvs/freeciv?rev=25940view=rev Log: When porting from qt4 to qt5, fromAscii was replaced by fromLatin, and it showed many characters incorectly (FromAscii(x) should be just replaced by QString(x)) *Updated 1 more file See http://gna.org/patch/?5041 Modified: branches/S2_5/client/gui-qt/dialogs.cpp Modified: branches/S2_5/client/gui-qt/dialogs.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/dialogs.cpp?rev=25940r1=25939r2=25940view=diff == --- branches/S2_5/client/gui-qt/dialogs.cpp (original) +++ branches/S2_5/client/gui-qt/dialogs.cpp Mon Aug 18 21:24:57 2014 @@ -409,9 +409,9 @@ cw-put_to_corner(); #if QT_VERSION = QT_VERSION_CHECK(5, 0, 0) - qcaption = QString::fromLatin1(caption); - qheadline = QString::fromLatin1(headline); - qlines = QString::fromLatin1(lines); + qcaption = QString(caption); + qheadline = QString(headline); + qlines = QString(lines); #else qcaption = QString::fromAscii(caption); qheadline = QString::fromAscii(headline); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25946 - /branches/S2_5/client/gui-qt/cityrep.cpp
Author: mir3x Date: Tue Aug 19 19:47:23 2014 New Revision: 25946 URL: http://svn.gna.org/viewcvs/freeciv?rev=25946view=rev Log: typo fix in Diplomacy Dialog (There was unwanted string for translators) Modified: branches/S2_5/client/gui-qt/cityrep.cpp Modified: branches/S2_5/client/gui-qt/cityrep.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/cityrep.cpp?rev=25946r1=25945r2=25946view=diff == --- branches/S2_5/client/gui-qt/cityrep.cpp (original) +++ branches/S2_5/client/gui-qt/cityrep.cpp Tue Aug 19 19:47:23 2014 @@ -767,7 +767,7 @@ ***/ void city_report::init() { - gui()-gimme_place(this, _(CTS)); + gui()-gimme_place(this, CTS); index = gui()-add_game_tab(this, _(Cities)); gui()-game_tab_widget-setCurrentIndex(index); } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25947 - /trunk/client/gui-qt/cityrep.cpp
Author: mir3x Date: Tue Aug 19 19:47:33 2014 New Revision: 25947 URL: http://svn.gna.org/viewcvs/freeciv?rev=25947view=rev Log: typo fix in Diplomacy Dialog (There was unwanted string for translators) Modified: trunk/client/gui-qt/cityrep.cpp Modified: trunk/client/gui-qt/cityrep.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/cityrep.cpp?rev=25947r1=25946r2=25947view=diff == --- trunk/client/gui-qt/cityrep.cpp (original) +++ trunk/client/gui-qt/cityrep.cpp Tue Aug 19 19:47:33 2014 @@ -767,7 +767,7 @@ ***/ void city_report::init() { - gui()-gimme_place(this, _(CTS)); + gui()-gimme_place(this, CTS); index = gui()-add_game_tab(this, _(Cities)); gui()-game_tab_widget-setCurrentIndex(index); } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25956 - in /trunk/client/gui-qt: chatline.cpp fc_client.cpp fc_client.h gui_main.cpp pages.cpp
Author: mir3x Date: Wed Aug 20 11:08:51 2014 New Revision: 25956 URL: http://svn.gna.org/viewcvs/freeciv?rev=25956view=rev Log: Added options to start page: -starting game -loading game -loading scenarios -browsing files to locate saves/scenarios See patch #5053 Modified: trunk/client/gui-qt/chatline.cpp trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/fc_client.h trunk/client/gui-qt/gui_main.cpp trunk/client/gui-qt/pages.cpp [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/client/gui-qt/chatline.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/chatline.cpp?rev=25956r1=25955r2=25956view=diff Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=25956r1=25955r2=25956view=diff Modified: trunk/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.h?rev=25956r1=25955r2=25956view=diff Modified: trunk/client/gui-qt/gui_main.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/gui_main.cpp?rev=25956r1=25955r2=25956view=diff Modified: trunk/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/pages.cpp?rev=25956r1=25955r2=25956view=diff ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25957 - in /branches/S2_5/client/gui-qt: chatline.cpp fc_client.cpp fc_client.h gui_main.cpp pages.cpp
Author: mir3x Date: Wed Aug 20 11:09:06 2014 New Revision: 25957 URL: http://svn.gna.org/viewcvs/freeciv?rev=25957view=rev Log: Added options to start page: -starting game -loading game -loading scenarios -browsing files to locate saves/scenarios See patch #5053 Modified: branches/S2_5/client/gui-qt/chatline.cpp branches/S2_5/client/gui-qt/fc_client.cpp branches/S2_5/client/gui-qt/fc_client.h branches/S2_5/client/gui-qt/gui_main.cpp branches/S2_5/client/gui-qt/pages.cpp [This mail would be too long, it was shortened to contain the URLs only.] Modified: branches/S2_5/client/gui-qt/chatline.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/chatline.cpp?rev=25957r1=25956r2=25957view=diff Modified: branches/S2_5/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=25957r1=25956r2=25957view=diff Modified: branches/S2_5/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.h?rev=25957r1=25956r2=25957view=diff Modified: branches/S2_5/client/gui-qt/gui_main.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/gui_main.cpp?rev=25957r1=25956r2=25957view=diff Modified: branches/S2_5/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/pages.cpp?rev=25957r1=25956r2=25957view=diff ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25978 - in /branches/S2_5/client/gui-qt: cityrep.cpp plrdlg.cpp plrdlg.h repodlgs.cpp
Author: mir3x Date: Thu Aug 21 18:59:16 2014 New Revision: 25978 URL: http://svn.gna.org/viewcvs/freeciv?rev=25978view=rev Log: Corrected text in report dialogs. Nation dialog sorts players by score in right order now. Removed barbarians from nation dialog. See patch #5054 Modified: branches/S2_5/client/gui-qt/cityrep.cpp branches/S2_5/client/gui-qt/plrdlg.cpp branches/S2_5/client/gui-qt/plrdlg.h branches/S2_5/client/gui-qt/repodlgs.cpp Modified: branches/S2_5/client/gui-qt/cityrep.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/cityrep.cpp?rev=25978r1=25977r2=25978view=diff == --- branches/S2_5/client/gui-qt/cityrep.cpp (original) +++ branches/S2_5/client/gui-qt/cityrep.cpp Thu Aug 21 18:59:16 2014 @@ -46,14 +46,7 @@ const QStyleOptionViewItem option, const QModelIndex index) const { - QStyleOptionViewItemV3 opt = QItemDelegate::setOptions(index, option); - - painter-save(); -QItemDelegate::drawBackground(painter, opt, index); -opt.displayAlignment = Qt::AlignLeft; -QItemDelegate::drawDisplay(painter, opt, option.rect, - index.data().toString()); - painter-restore(); + QItemDelegate::paint(painter, option, index); } /*** Modified: branches/S2_5/client/gui-qt/plrdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/plrdlg.cpp?rev=25978r1=25977r2=25978view=diff == --- branches/S2_5/client/gui-qt/plrdlg.cpp (original) +++ branches/S2_5/client/gui-qt/plrdlg.cpp Thu Aug 21 18:59:16 2014 @@ -42,6 +42,17 @@ return QRect(check_box_point, check_box_rect.size()); } +/** + Slighty increase deafult cell height +**/ +QSize plr_item_delegate::sizeHint(const QStyleOptionViewItem option, + const QModelIndex index) const +{ + QSize r; + r = QItemDelegate::sizeHint(option, index); + r.setHeight(r.height() + 4); + return r; +} /** Paint evenet for custom player item delegation @@ -52,7 +63,10 @@ QStyleOptionButton but; QStyleOptionButton cbso; bool b; + QString str; + QRect rct; QPixmap pix(16, 16); + QStyleOptionViewItemV3 opt = QItemDelegate::setOptions(index, option); painter-save(); switch (player_dlg_columns[index.column()].type) { @@ -80,16 +94,22 @@ QApplication::style()-drawControl(QStyle::CE_CheckBox, cbso, painter); break; case COL_TEXT: -QItemDelegate::drawBackground(painter, opt, index); -opt.displayAlignment = Qt::AlignLeft; -QItemDelegate::drawDisplay(painter, opt, option.rect, - index.data().toString()); +QItemDelegate::paint(painter, option, index); break; case COL_RIGHT_TEXT: QItemDelegate::drawBackground(painter, opt, index); opt.displayAlignment = Qt::AlignRight; -QItemDelegate::drawDisplay(painter, opt, option.rect, - index.data().toString()); +rct = option.rect; +rct.setTop((rct.top() + rct.bottom()) / 2 + - opt.fontMetrics.height() / 2); +rct.setBottom((rct.top()+rct.bottom()) / 2 + + opt.fontMetrics.height() / 2); +if (index.data().toInt() == -1){ + str = ?; +} else { + str = index.data().toString(); +} +QItemDelegate::drawDisplay(painter, opt, rct, str); break; default: QItemDelegate::paint(painter, option, index); @@ -119,6 +139,7 @@ QVariant plr_item::data(int column, int role) const { QPixmap *pix; + QString str; struct player_dlg_column *pdc; if (role == Qt::UserRole) { @@ -140,8 +161,16 @@ return pdc-bool_func(ipplayer); break; case COL_TEXT: +return pdc-func(ipplayer); +break; case COL_RIGHT_TEXT: -return pdc-func(ipplayer); +str = pdc-func(ipplayer); +if (str.toInt() != 0){ + return str.toInt(); +} else if (str == ?){ + return -1; +} +return str; default: return QVariant(); } @@ -226,6 +255,9 @@ { plr_item *pi; players_iterate(pplayer) { +if ((is_barbarian(pplayer))){ + continue; +} pi = new plr_item(pplayer); plr_list pi; } players_iterate_end; Modified: branches/S2_5/client/gui-qt/plrdlg.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/plrdlg.h?rev=25978r1=25977r2=25978view=diff == --- branches/S2_5/client/gui-qt/plrdlg.h(original) +++ branches/S2_5/client/gui-qt/plrdlg.h
[Freeciv-commits] r25979 - in /trunk/client/gui-qt: cityrep.cpp plrdlg.cpp plrdlg.h repodlgs.cpp
Author: mir3x Date: Thu Aug 21 18:59:35 2014 New Revision: 25979 URL: http://svn.gna.org/viewcvs/freeciv?rev=25979view=rev Log: Corrected text in report dialogs. Nation dialog sorts players by score in right order now. Removed barbarians from nation dialog. See patch #5054 Modified: trunk/client/gui-qt/cityrep.cpp trunk/client/gui-qt/plrdlg.cpp trunk/client/gui-qt/plrdlg.h trunk/client/gui-qt/repodlgs.cpp Modified: trunk/client/gui-qt/cityrep.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/cityrep.cpp?rev=25979r1=25978r2=25979view=diff == --- trunk/client/gui-qt/cityrep.cpp (original) +++ trunk/client/gui-qt/cityrep.cpp Thu Aug 21 18:59:35 2014 @@ -46,14 +46,7 @@ const QStyleOptionViewItem option, const QModelIndex index) const { - QStyleOptionViewItemV3 opt = QItemDelegate::setOptions(index, option); - - painter-save(); -QItemDelegate::drawBackground(painter, opt, index); -opt.displayAlignment = Qt::AlignLeft; -QItemDelegate::drawDisplay(painter, opt, option.rect, - index.data().toString()); - painter-restore(); + QItemDelegate::paint(painter, option, index); } /*** Modified: trunk/client/gui-qt/plrdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/plrdlg.cpp?rev=25979r1=25978r2=25979view=diff == --- trunk/client/gui-qt/plrdlg.cpp (original) +++ trunk/client/gui-qt/plrdlg.cpp Thu Aug 21 18:59:35 2014 @@ -42,6 +42,17 @@ return QRect(check_box_point, check_box_rect.size()); } +/** + Slighty increase deafult cell height +**/ +QSize plr_item_delegate::sizeHint(const QStyleOptionViewItem option, + const QModelIndex index) const +{ + QSize r; + r = QItemDelegate::sizeHint(option, index); + r.setHeight(r.height() + 4); + return r; +} /** Paint evenet for custom player item delegation @@ -52,7 +63,10 @@ QStyleOptionButton but; QStyleOptionButton cbso; bool b; + QString str; + QRect rct; QPixmap pix(16, 16); + QStyleOptionViewItemV3 opt = QItemDelegate::setOptions(index, option); painter-save(); switch (player_dlg_columns[index.column()].type) { @@ -80,16 +94,22 @@ QApplication::style()-drawControl(QStyle::CE_CheckBox, cbso, painter); break; case COL_TEXT: -QItemDelegate::drawBackground(painter, opt, index); -opt.displayAlignment = Qt::AlignLeft; -QItemDelegate::drawDisplay(painter, opt, option.rect, - index.data().toString()); +QItemDelegate::paint(painter, option, index); break; case COL_RIGHT_TEXT: QItemDelegate::drawBackground(painter, opt, index); opt.displayAlignment = Qt::AlignRight; -QItemDelegate::drawDisplay(painter, opt, option.rect, - index.data().toString()); +rct = option.rect; +rct.setTop((rct.top() + rct.bottom()) / 2 + - opt.fontMetrics.height() / 2); +rct.setBottom((rct.top()+rct.bottom()) / 2 + + opt.fontMetrics.height() / 2); +if (index.data().toInt() == -1){ + str = ?; +} else { + str = index.data().toString(); +} +QItemDelegate::drawDisplay(painter, opt, rct, str); break; default: QItemDelegate::paint(painter, option, index); @@ -119,6 +139,7 @@ QVariant plr_item::data(int column, int role) const { QPixmap *pix; + QString str; struct player_dlg_column *pdc; if (role == Qt::UserRole) { @@ -140,8 +161,16 @@ return pdc-bool_func(ipplayer); break; case COL_TEXT: +return pdc-func(ipplayer); +break; case COL_RIGHT_TEXT: -return pdc-func(ipplayer); +str = pdc-func(ipplayer); +if (str.toInt() != 0){ + return str.toInt(); +} else if (str == ?){ + return -1; +} +return str; default: return QVariant(); } @@ -226,6 +255,9 @@ { plr_item *pi; players_iterate(pplayer) { +if ((is_barbarian(pplayer))){ + continue; +} pi = new plr_item(pplayer); plr_list pi; } players_iterate_end; Modified: trunk/client/gui-qt/plrdlg.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/plrdlg.h?rev=25979r1=25978r2=25979view=diff == --- trunk/client/gui-qt/plrdlg.h(original) +++ trunk/client/gui-qt/plrdlg.hThu Aug 21 18:59:35 2014 @@ -55,6 +55,8 @@ ~plr_item_delegate() {} void paint(QPainter *painter, const
[Freeciv-commits] r25980 - in /branches/S2_5/client/gui-qt: citydlg.cpp dialogs.cpp gui_main.cpp menu.cpp repodlgs.cpp
Author: mir3x Date: Thu Aug 21 19:06:10 2014 New Revision: 25980 URL: http://svn.gna.org/viewcvs/freeciv?rev=25980view=rev Log: QMessageBox wont open tabs on taskbar anymore See patch #5055 Modified: branches/S2_5/client/gui-qt/citydlg.cpp branches/S2_5/client/gui-qt/dialogs.cpp branches/S2_5/client/gui-qt/gui_main.cpp branches/S2_5/client/gui-qt/menu.cpp branches/S2_5/client/gui-qt/repodlgs.cpp Modified: branches/S2_5/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/citydlg.cpp?rev=25980r1=25979r2=25980view=diff == --- branches/S2_5/client/gui-qt/citydlg.cpp (original) +++ branches/S2_5/client/gui-qt/citydlg.cpp Thu Aug 21 19:06:10 2014 @@ -187,7 +187,7 @@ / void unit_item::disband() { - QMessageBox ask; + QMessageBox ask(this); int ret; ask.setText(_(Are you sure you want to disband that unit?)); @@ -1686,7 +1686,7 @@ / void city_dialog::dbl_click(QTableWidgetItem *item) { - QMessageBox ask; + QMessageBox ask(this); QString s; QVariant qvar; char buf[256]; Modified: branches/S2_5/client/gui-qt/dialogs.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/dialogs.cpp?rev=25980r1=25979r2=25980view=diff == --- branches/S2_5/client/gui-qt/dialogs.cpp (original) +++ branches/S2_5/client/gui-qt/dialogs.cpp Thu Aug 21 19:06:10 2014 @@ -1238,7 +1238,7 @@ incite_impossible.setText(QString(buf2)); incite_impossible.exec(); } else if (cost = client_player()-economic.gold) { -QMessageBox ask; +QMessageBox ask(gui()-central_wdg); fc_snprintf(buf2, ARRAY_SIZE(buf2), PL_(Incite a revolt for %d gold?\n%s, @@ -1277,7 +1277,7 @@ **/ void popup_bribe_dialog(struct unit *actor, struct unit *punit, int cost) { - QMessageBox ask; + QMessageBox ask(gui()-central_wdg); int ret; QString str; char buf[1024]; @@ -1473,7 +1473,7 @@ / void popup_disband_dialog(struct unit_list *punits) { - QMessageBox ask; + QMessageBox ask(gui()-central_wdg); int ret; QString str; @@ -1643,7 +1643,7 @@ void popup_upgrade_dialog(struct unit_list *punits) { char buf[512]; - QMessageBox ask; + QMessageBox ask(gui()-central_wdg); int ret; if (!punits || unit_list_size(punits) == 0) { Modified: branches/S2_5/client/gui-qt/gui_main.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/gui_main.cpp?rev=25980r1=25979r2=25980view=diff == --- branches/S2_5/client/gui-qt/gui_main.cpp(original) +++ branches/S2_5/client/gui-qt/gui_main.cppThu Aug 21 19:06:10 2014 @@ -316,13 +316,14 @@ **/ void popup_quit_dialog() { - QMessageBox ask; + QMessageBox ask(gui()-central_wdg); int ret; ask.setText(_(Are you sure you want to quit?)); ask.setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok); ask.setDefaultButton(QMessageBox::Cancel); ask.setIcon(QMessageBox::Warning); + ask.setWindowTitle(_(Quit?)); ret = ask.exec(); switch (ret) { Modified: branches/S2_5/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.cpp?rev=25980r1=25979r2=25980view=diff == --- branches/S2_5/client/gui-qt/menu.cpp(original) +++ branches/S2_5/client/gui-qt/menu.cppThu Aug 21 19:06:10 2014 @@ -862,7 +862,7 @@ / void mr_menu::slot_menu_copying() { - QMessageBox info; + QMessageBox info(this); QString s = QString::fromUtf8(_(Freeciv is covered by the GPL. )) + QString::fromUtf8(_(See file COPYING distributed with Freeciv for full license text.)); Modified: branches/S2_5/client/gui-qt/repodlgs.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/repodlgs.cpp?rev=25980r1=25979r2=25980view=diff == --- branches/S2_5/client/gui-qt/repodlgs.cpp(original) +++ branches/S2_5/client/gui-qt/repodlgs.cppThu Aug 21 19:06:10 2014 @@ -661,7 +661,7 @@ struct unit_type *upgrade; utype = utype_by_number(uid); int price; - QMessageBox ask; + QMessageBox ask(this); QString s1, s2; int ret; char buf[1024]; @@ -957,7 +957,7 @@ char buf[1024]; QString
[Freeciv-commits] r25981 - in /trunk/client/gui-qt: citydlg.cpp dialogs.cpp gui_main.cpp menu.cpp repodlgs.cpp
Author: mir3x Date: Thu Aug 21 19:06:22 2014 New Revision: 25981 URL: http://svn.gna.org/viewcvs/freeciv?rev=25981view=rev Log: QMessageBox wont open tabs on taskbar anymore See patch #5055 Modified: trunk/client/gui-qt/citydlg.cpp trunk/client/gui-qt/dialogs.cpp trunk/client/gui-qt/gui_main.cpp trunk/client/gui-qt/menu.cpp trunk/client/gui-qt/repodlgs.cpp Modified: trunk/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/citydlg.cpp?rev=25981r1=25980r2=25981view=diff == --- trunk/client/gui-qt/citydlg.cpp (original) +++ trunk/client/gui-qt/citydlg.cpp Thu Aug 21 19:06:22 2014 @@ -187,7 +187,7 @@ / void unit_item::disband() { - QMessageBox ask; + QMessageBox ask(this); int ret; ask.setText(_(Are you sure you want to disband that unit?)); @@ -1675,7 +1675,7 @@ / void city_dialog::dbl_click(QTableWidgetItem *item) { - QMessageBox ask; + QMessageBox ask(this); QString s; QVariant qvar; char buf[256]; Modified: trunk/client/gui-qt/dialogs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.cpp?rev=25981r1=25980r2=25981view=diff == --- trunk/client/gui-qt/dialogs.cpp (original) +++ trunk/client/gui-qt/dialogs.cpp Thu Aug 21 19:06:22 2014 @@ -1361,7 +1361,7 @@ incite_impossible.setText(QString(buf2)); incite_impossible.exec(); } else if (cost = client_player()-economic.gold) { -QMessageBox ask; +QMessageBox ask(gui()-central_wdg); fc_snprintf(buf2, ARRAY_SIZE(buf2), PL_(Incite a revolt for %d gold?\n%s, @@ -1402,7 +1402,7 @@ **/ void popup_bribe_dialog(struct unit *actor, struct unit *punit, int cost) { - QMessageBox ask; + QMessageBox ask(gui()-central_wdg); int ret; QString str; char buf[1024]; @@ -1573,7 +1573,7 @@ / void popup_disband_dialog(struct unit_list *punits) { - QMessageBox ask; + QMessageBox ask(gui()-central_wdg); int ret; QString str; @@ -1753,7 +1753,7 @@ void popup_upgrade_dialog(struct unit_list *punits) { char buf[512]; - QMessageBox ask; + QMessageBox ask(gui()-central_wdg); int ret; if (!punits || unit_list_size(punits) == 0) { Modified: trunk/client/gui-qt/gui_main.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/gui_main.cpp?rev=25981r1=25980r2=25981view=diff == --- trunk/client/gui-qt/gui_main.cpp(original) +++ trunk/client/gui-qt/gui_main.cppThu Aug 21 19:06:22 2014 @@ -316,13 +316,14 @@ **/ void popup_quit_dialog() { - QMessageBox ask; + QMessageBox ask(gui()-central_wdg); int ret; ask.setText(_(Are you sure you want to quit?)); ask.setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok); ask.setDefaultButton(QMessageBox::Cancel); ask.setIcon(QMessageBox::Warning); + ask.setWindowTitle(_(Quit?)); ret = ask.exec(); switch (ret) { Modified: trunk/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=25981r1=25980r2=25981view=diff == --- trunk/client/gui-qt/menu.cpp(original) +++ trunk/client/gui-qt/menu.cppThu Aug 21 19:06:22 2014 @@ -911,7 +911,7 @@ / void mr_menu::slot_menu_copying() { - QMessageBox info; + QMessageBox info(this); QString s = QString::fromUtf8(_(Freeciv is covered by the GPL. )) + QString::fromUtf8(_(See file COPYING distributed with Freeciv for full license text.)); Modified: trunk/client/gui-qt/repodlgs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/repodlgs.cpp?rev=25981r1=25980r2=25981view=diff == --- trunk/client/gui-qt/repodlgs.cpp(original) +++ trunk/client/gui-qt/repodlgs.cppThu Aug 21 19:06:22 2014 @@ -661,7 +661,7 @@ struct unit_type *upgrade; utype = utype_by_number(uid); int price; - QMessageBox ask; + QMessageBox ask(this); QString s1, s2; int ret; char buf[1024]; @@ -957,7 +957,7 @@ char buf[1024]; QString s; - QMessageBox ask; + QMessageBox ask(this); int ret; selected = cid_decode(uid); struct unit_type *putype = selected.value.utype; @@ -994,7 +994,7 @@ struct universal selected; char
[Freeciv-commits] r25983 - /trunk/client/gui-qt/cityrep.cpp
Author: mir3x Date: Thu Aug 21 19:11:02 2014 New Revision: 25983 URL: http://svn.gna.org/viewcvs/freeciv?rev=25983view=rev Log: Changed 1 string in cities report See patch #5056 Modified: trunk/client/gui-qt/cityrep.cpp Modified: trunk/client/gui-qt/cityrep.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/cityrep.cpp?rev=25983r1=25982r2=25983view=diff == --- trunk/client/gui-qt/cityrep.cpp (original) +++ trunk/client/gui-qt/cityrep.cpp Thu Aug 21 19:11:02 2014 @@ -392,7 +392,7 @@ QMenu list_menu(this); QAction *act; QAction cty_view(style()-standardIcon(QStyle::SP_CommandLink), - _(?verb:View), 0); + Q_(?verb:View), 0); QAction cty_buy(_(Buy), 0); QAction cty_center(style()-standardIcon(QStyle::SP_ArrowRight), _(Center), 0); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25982 - /branches/S2_5/client/gui-qt/cityrep.cpp
Author: mir3x Date: Thu Aug 21 19:10:49 2014 New Revision: 25982 URL: http://svn.gna.org/viewcvs/freeciv?rev=25982view=rev Log: Changed 1 string in cities report See patch #5056 Modified: branches/S2_5/client/gui-qt/cityrep.cpp Modified: branches/S2_5/client/gui-qt/cityrep.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/cityrep.cpp?rev=25982r1=25981r2=25982view=diff == --- branches/S2_5/client/gui-qt/cityrep.cpp (original) +++ branches/S2_5/client/gui-qt/cityrep.cpp Thu Aug 21 19:10:49 2014 @@ -392,7 +392,7 @@ QMenu list_menu(this); QAction *act; QAction cty_view(style()-standardIcon(QStyle::SP_CommandLink), - _(?verb:View), 0); + Q_(?verb:View), 0); QAction cty_buy(_(Buy), 0); QAction cty_center(style()-standardIcon(QStyle::SP_ArrowRight), _(Center), 0); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25985 - /trunk/client/gui-qt/cityrep.h
Author: mir3x Date: Thu Aug 21 19:15:55 2014 New Revision: 25985 URL: http://svn.gna.org/viewcvs/freeciv?rev=25985view=rev Log: In some cases, after unsuccessfull buying item, production could be changed to airport. Fixed. See patch #5057 Modified: trunk/client/gui-qt/cityrep.h Modified: trunk/client/gui-qt/cityrep.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/cityrep.h?rev=25985r1=25984r2=25985view=diff == --- trunk/client/gui-qt/cityrep.h (original) +++ trunk/client/gui-qt/cityrep.h Thu Aug 21 19:15:55 2014 @@ -136,7 +136,7 @@ QMenu select_menu; QMenu production_menu; enum menu_labels { -CHANGE_PROD_NOW, +CHANGE_PROD_NOW = 1, CHANGE_PROD_NEXT, CHANGE_PROD_LAST, CHANGE_PROD_BEF_LAST, ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25984 - /branches/S2_5/client/gui-qt/cityrep.h
Author: mir3x Date: Thu Aug 21 19:15:29 2014 New Revision: 25984 URL: http://svn.gna.org/viewcvs/freeciv?rev=25984view=rev Log: In some cases, after unsuccessfull buying item, production could be changed to airport. Fixed. See patch #5057 Modified: branches/S2_5/client/gui-qt/cityrep.h Modified: branches/S2_5/client/gui-qt/cityrep.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/cityrep.h?rev=25984r1=25983r2=25984view=diff == --- branches/S2_5/client/gui-qt/cityrep.h (original) +++ branches/S2_5/client/gui-qt/cityrep.h Thu Aug 21 19:15:29 2014 @@ -136,7 +136,7 @@ QMenu select_menu; QMenu production_menu; enum menu_labels { -CHANGE_PROD_NOW, +CHANGE_PROD_NOW = 1, CHANGE_PROD_NEXT, CHANGE_PROD_LAST, CHANGE_PROD_BEF_LAST, ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25990 - in /branches/S2_5/client/gui-qt: Makefile.am menu.cpp menu.h spaceshipdlg.cpp spaceshipdlg.h
Author: mir3x Date: Thu Aug 21 21:33:15 2014 New Revision: 25990 URL: http://svn.gna.org/viewcvs/freeciv?rev=25990view=rev Log: Added Spaceship report. See patch #5060 Modified: branches/S2_5/client/gui-qt/Makefile.am branches/S2_5/client/gui-qt/menu.cpp branches/S2_5/client/gui-qt/menu.h branches/S2_5/client/gui-qt/spaceshipdlg.cpp branches/S2_5/client/gui-qt/spaceshipdlg.h Modified: branches/S2_5/client/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/Makefile.am?rev=25990r1=25989r2=25990view=diff == --- branches/S2_5/client/gui-qt/Makefile.am (original) +++ branches/S2_5/client/gui-qt/Makefile.am Thu Aug 21 21:33:15 2014 @@ -24,7 +24,8 @@ meta_citydlg.cpp\ meta_cityrep.cpp\ meta_plrdlg.cpp \ - meta_diplodlg.cpp + meta_diplodlg.cpp \ + meta_spaceshipdlg.cpp libgui_qt_la_SOURCES = \ canvas.cpp \ Modified: branches/S2_5/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.cpp?rev=25990r1=25989r2=25990view=diff == --- branches/S2_5/client/gui-qt/menu.cpp(original) +++ branches/S2_5/client/gui-qt/menu.cppThu Aug 21 21:33:15 2014 @@ -39,6 +39,7 @@ #include plrdlg.h #include ratesdlg.h #include repodlgs.h +#include spaceshipdlg.h #include sprite.h #include menu.h @@ -402,6 +403,10 @@ act-setShortcut(QKeySequence(tr(F11))); connect(act, SIGNAL(triggered()), this, SLOT(slot_demographics())); + act = menu-addAction(_(Spaceship)); + act-setShortcut(QKeySequence(tr(F12))); + connect(act, SIGNAL(triggered()), this, SLOT(slot_spaceship())); + /* Help Menu */ menu = this-addMenu(_(Help)); act = menu-addAction(_(Copying)); @@ -884,6 +889,16 @@ } /*** + Slot for showing spaceship +***/ +void mr_menu::slot_spaceship() +{ + if (NULL != client.conn.playing) { +popup_spaceship_dialog(client.conn.playing); + } +} + +/*** Slot for showing economy tab ***/ void mr_menu::slot_show_eco_report() Modified: branches/S2_5/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.h?rev=25990r1=25989r2=25990view=diff == --- branches/S2_5/client/gui-qt/menu.h (original) +++ branches/S2_5/client/gui-qt/menu.h Thu Aug 21 21:33:15 2014 @@ -157,6 +157,7 @@ void slot_show_research_tab(); void slot_gov_change(const int target); void revolution(); + void slot_spaceship(); void slot_demographics(); void slot_top_five(); void slot_traveler(); Modified: branches/S2_5/client/gui-qt/spaceshipdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/spaceshipdlg.cpp?rev=25990r1=25989r2=25990view=diff == --- branches/S2_5/client/gui-qt/spaceshipdlg.cpp(original) +++ branches/S2_5/client/gui-qt/spaceshipdlg.cppThu Aug 21 21:33:15 2014 @@ -15,10 +15,94 @@ #include fc_config.h #endif +/* common */ +#include game.h + // gui-qt +#include canvas.h #include qtg_cxxside.h +#include spaceshipdlg.h -#include spaceshipdlg.h + +class QGridLayout; + +/ + Constructor for spaceship report +/ +ss_report::ss_report(struct player *pplayer) +{ + int w, h; + QSize size; + + setAttribute(Qt::WA_DeleteOnClose); + player = pplayer; + get_spaceship_dimensions(w, h); + can = qtg_canvas_create(w, h); + + QGridLayout *layout = new QGridLayout; + ss_pix_label = new QLabel; + ss_pix_label-setPixmap(can-map_pixmap); + layout-addWidget(ss_pix_label, 0, 0, 3, 3); + ss_label = new QLabel; + layout-addWidget(ss_label, 0, 3, 3, 1); + launch_button = new QPushButton(_(_Launch)); + connect(launch_button, SIGNAL(clicked()), SLOT(launch())); + layout-addWidget(launch_button, 4, 3, 1, 1); + setLayout(layout); + update_report(); +} + +/ + Destructor for spaceship report +/ +ss_report::~ss_report() +{ + gui()-remove_repo_dlg(SPS); +} + +/ + Initializes widget on game_tab_widget +/
[Freeciv-commits] r25991 - in /trunk/client/gui-qt: Makefile.am menu.cpp menu.h spaceshipdlg.cpp spaceshipdlg.h
Author: mir3x Date: Thu Aug 21 21:33:56 2014 New Revision: 25991 URL: http://svn.gna.org/viewcvs/freeciv?rev=25991view=rev Log: Added Spaceship report. See patch #5060 Modified: trunk/client/gui-qt/Makefile.am trunk/client/gui-qt/menu.cpp trunk/client/gui-qt/menu.h trunk/client/gui-qt/spaceshipdlg.cpp trunk/client/gui-qt/spaceshipdlg.h Modified: trunk/client/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/Makefile.am?rev=25991r1=25990r2=25991view=diff == --- trunk/client/gui-qt/Makefile.am (original) +++ trunk/client/gui-qt/Makefile.am Thu Aug 21 21:33:56 2014 @@ -24,7 +24,8 @@ meta_citydlg.cpp\ meta_cityrep.cpp\ meta_plrdlg.cpp \ - meta_diplodlg.cpp + meta_diplodlg.cpp \ + meta_spaceshipdlg.cpp libgui_qt_la_SOURCES = \ canvas.cpp \ Modified: trunk/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=25991r1=25990r2=25991view=diff == --- trunk/client/gui-qt/menu.cpp(original) +++ trunk/client/gui-qt/menu.cppThu Aug 21 21:33:56 2014 @@ -39,6 +39,7 @@ #include plrdlg.h #include ratesdlg.h #include repodlgs.h +#include spaceshipdlg.h #include sprite.h #include menu.h @@ -402,6 +403,10 @@ act-setShortcut(QKeySequence(tr(F11))); connect(act, SIGNAL(triggered()), this, SLOT(slot_demographics())); + act = menu-addAction(_(Spaceship)); + act-setShortcut(QKeySequence(tr(F12))); + connect(act, SIGNAL(triggered()), this, SLOT(slot_spaceship())); + act = menu-addAction(_(Achievements)); connect(act, SIGNAL(triggered()), this, SLOT(slot_achievements())); @@ -933,6 +938,16 @@ } /*** + Slot for showing spaceship +***/ +void mr_menu::slot_spaceship() +{ + if (NULL != client.conn.playing) { +popup_spaceship_dialog(client.conn.playing); + } +} + +/*** Slot for showing economy tab ***/ void mr_menu::slot_show_eco_report() Modified: trunk/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.h?rev=25991r1=25990r2=25991view=diff == --- trunk/client/gui-qt/menu.h (original) +++ trunk/client/gui-qt/menu.h Thu Aug 21 21:33:56 2014 @@ -157,6 +157,7 @@ void slot_show_research_tab(); void slot_gov_change(const int target); void revolution(); + void slot_spaceship(); void slot_demographics(); void slot_achievements(); void slot_top_five(); Modified: trunk/client/gui-qt/spaceshipdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/spaceshipdlg.cpp?rev=25991r1=25990r2=25991view=diff == --- trunk/client/gui-qt/spaceshipdlg.cpp(original) +++ trunk/client/gui-qt/spaceshipdlg.cppThu Aug 21 21:33:56 2014 @@ -15,10 +15,94 @@ #include fc_config.h #endif +/* common */ +#include game.h +#include victory.h + // gui-qt +#include canvas.h #include qtg_cxxside.h +#include spaceshipdlg.h -#include spaceshipdlg.h + +class QGridLayout; + +/ + Constructor for spaceship report +/ +ss_report::ss_report(struct player *pplayer) +{ + int w, h; + QSize size; + + setAttribute(Qt::WA_DeleteOnClose); + player = pplayer; + get_spaceship_dimensions(w, h); + can = qtg_canvas_create(w, h); + + QGridLayout *layout = new QGridLayout; + ss_pix_label = new QLabel; + ss_pix_label-setPixmap(can-map_pixmap); + layout-addWidget(ss_pix_label, 0, 0, 3, 3); + ss_label = new QLabel; + layout-addWidget(ss_label, 0, 3, 3, 1); + launch_button = new QPushButton(_(_Launch)); + connect(launch_button, SIGNAL(clicked()), SLOT(launch())); + layout-addWidget(launch_button, 4, 3, 1, 1); + setLayout(layout); + update_report(); +} + +/ + Destructor for spaceship report +/ +ss_report::~ss_report() +{ + gui()-remove_repo_dlg(SPS); +} + +/ + Initializes widget on game_tab_widget +/ +void ss_report::init() +{ + int index; + gui()-gimme_place(this, SPS); + index = gui()-add_game_tab(this,
[Freeciv-commits] r26017 - in /branches/S2_5/client/gui-qt: canvas.cpp gui_main.cpp
Author: mir3x Date: Sun Aug 24 17:47:29 2014 New Revision: 26017 URL: http://svn.gna.org/viewcvs/freeciv?rev=26017view=rev Log: Added callbacks to font options when city/production/research fonts are changed. Fixed drawing fonts on map view with correct font. Removed log_error from qtg_set_city_names_font_sizes in gui_main.cpp (font sizes are taken from options) See bug #22500 Modified: branches/S2_5/client/gui-qt/canvas.cpp branches/S2_5/client/gui-qt/gui_main.cpp Modified: branches/S2_5/client/gui-qt/canvas.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/canvas.cpp?rev=26017r1=26016r2=26017view=diff == --- branches/S2_5/client/gui-qt/canvas.cpp (original) +++ branches/S2_5/client/gui-qt/canvas.cpp Sun Aug 24 17:47:29 2014 @@ -22,6 +22,8 @@ #include canvas.h #include sprite.h #include colors.h + +QFont *get_font(enum client_font font); / Create a canvas of the given size. @@ -271,6 +273,33 @@ } / + Returns given font +/ +QFont *get_font(client_font font) +{ + QFont *qf; + switch (font) { + case FONT_CITY_NAME: +qf = gui()-fc_fonts.get_font(gui_qt_font_city_names); +break; + case FONT_CITY_PROD: +qf = gui()-fc_fonts.get_font(gui_qt_font_city_productions); +break; + case FONT_REQTREE_TEXT: +qf = gui()-fc_fonts.get_font(gui_qt_font_reqtree_text); +break; + case FONT_COUNT: +qf = NULL; +break; + default: +qf = NULL; +break; + } + return qf; +} + + +/ Return the size of the given text in the given font. This size should include the ascent and descent of the text. Either of width or height may be NULL in which case those values simply shouldn't be filled out. @@ -278,19 +307,19 @@ void qtg_get_text_size (int *width, int *height, enum client_font font, const char *text) { - /* FIXME - add font handling */ - QFont afont; - int fontheight = 12; - afont.setPixelSize(fontheight); - QFontMetrics fm(afont); - + QFont *afont; + QFontMetrics *fm; + + afont = get_font(font); + fm = new QFontMetrics(*afont); if (width) { -*width = fm.width(QString::fromUtf8(text)); +*width = fm-width(QString::fromUtf8(text)); } if (height) { -*height = fm.height(); - } +*height = fm-height(); + } + delete fm; } / @@ -304,17 +333,18 @@ { QPainter p; QPen pen; - QFont afont; - int fontheight = 12; + QFont *afont; QColor color(pcolor-qcolor); - + QFontMetrics *fm; + + afont = get_font(font); pen.setColor(color); - afont.setPixelSize(fontheight); + fm = new QFontMetrics(*afont); p.begin(pcanvas-map_pixmap); p.setPen(pen); - p.setFont(afont); - p.drawText(canvas_x, canvas_y + fontheight, QString::fromUtf8(text)); - p.end(); - /* FIXME */ /*ADD DIFFERENT FONT HANDLING */ -} + p.setFont(*afont); + p.drawText(canvas_x, canvas_y + fm-ascent(), QString::fromUtf8(text)); + p.end(); + delete fm; +} Modified: branches/S2_5/client/gui-qt/gui_main.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/gui_main.cpp?rev=26017r1=26016r2=26017view=diff == --- branches/S2_5/client/gui-qt/gui_main.cpp(original) +++ branches/S2_5/client/gui-qt/gui_main.cppSun Aug 24 17:47:29 2014 @@ -59,6 +59,7 @@ void reset_unit_table(void); static void populate_unit_pixmap_table(void); +static void apply_font(struct option *poption); / Return fc_client instance @@ -75,8 +76,6 @@ void qtg_set_city_names_font_sizes(int my_city_names_font_size, int my_city_productions_font_size) { - log_error(Unimplemented set_city_names_font_sizes.); - /* PORTME */ } /** @@ -119,7 +118,22 @@ / void qtg_gui_options_extra_init() { - /* Nothing to do. */ +struct option *poption; + +#define option_var_set_callback(var, callback) \ + if ((poption = optset_option_by_name(client_optset, #var))) { \ +option_set_changed_callback(poption, callback); \ + } else { \ +log_error(Didn't find option %s!, #var); \ + } + + option_var_set_callback(gui_qt_font_city_names, +
[Freeciv-commits] r26018 - in /trunk/client/gui-qt: canvas.cpp gui_main.cpp
Author: mir3x Date: Sun Aug 24 17:48:13 2014 New Revision: 26018 URL: http://svn.gna.org/viewcvs/freeciv?rev=26018view=rev Log: Added callbacks to font options when city/production/research fonts are changed. Fixed drawing fonts on map view with correct font. Removed log_error from qtg_set_city_names_font_sizes in gui_main.cpp (font sizes are taken from options) See bug #22500 Modified: trunk/client/gui-qt/canvas.cpp trunk/client/gui-qt/gui_main.cpp Modified: trunk/client/gui-qt/canvas.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/canvas.cpp?rev=26018r1=26017r2=26018view=diff == --- trunk/client/gui-qt/canvas.cpp (original) +++ trunk/client/gui-qt/canvas.cpp Sun Aug 24 17:48:13 2014 @@ -22,6 +22,8 @@ #include canvas.h #include sprite.h #include colors.h + +QFont *get_font(enum client_font font); / Create a canvas of the given size. @@ -265,6 +267,33 @@ } / + Returns given font +/ +QFont *get_font(client_font font) +{ + QFont *qf; + switch (font) { + case FONT_CITY_NAME: +qf = gui()-fc_fonts.get_font(gui_qt_font_city_names); +break; + case FONT_CITY_PROD: +qf = gui()-fc_fonts.get_font(gui_qt_font_city_productions); +break; + case FONT_REQTREE_TEXT: +qf = gui()-fc_fonts.get_font(gui_qt_font_reqtree_text); +break; + case FONT_COUNT: +qf = NULL; +break; + default: +qf = NULL; +break; + } + return qf; +} + + +/ Return the size of the given text in the given font. This size should include the ascent and descent of the text. Either of width or height may be NULL in which case those values simply shouldn't be filled out. @@ -272,19 +301,19 @@ void qtg_get_text_size (int *width, int *height, enum client_font font, const char *text) { - /* FIXME - add font handling */ - QFont afont; - int fontheight = 12; - afont.setPixelSize(fontheight); - QFontMetrics fm(afont); - + QFont *afont; + QFontMetrics *fm; + + afont = get_font(font); + fm = new QFontMetrics(*afont); if (width) { -*width = fm.width(QString::fromUtf8(text)); +*width = fm-width(QString::fromUtf8(text)); } if (height) { -*height = fm.height(); - } +*height = fm-height(); + } + delete fm; } / @@ -298,17 +327,18 @@ { QPainter p; QPen pen; - QFont afont; - int fontheight = 12; + QFont *afont; QColor color(pcolor-qcolor); - + QFontMetrics *fm; + + afont = get_font(font); pen.setColor(color); - afont.setPixelSize(fontheight); + fm = new QFontMetrics(*afont); p.begin(pcanvas-map_pixmap); p.setPen(pen); - p.setFont(afont); - p.drawText(canvas_x, canvas_y + fontheight, QString::fromUtf8(text)); - p.end(); - /* FIXME */ /*ADD DIFFERENT FONT HANDLING */ -} + p.setFont(*afont); + p.drawText(canvas_x, canvas_y + fm-ascent(), QString::fromUtf8(text)); + p.end(); + delete fm; +} Modified: trunk/client/gui-qt/gui_main.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/gui_main.cpp?rev=26018r1=26017r2=26018view=diff == --- trunk/client/gui-qt/gui_main.cpp(original) +++ trunk/client/gui-qt/gui_main.cppSun Aug 24 17:48:13 2014 @@ -59,6 +59,7 @@ void reset_unit_table(void); static void populate_unit_pixmap_table(void); +static void apply_font(struct option *poption); / Return fc_client instance @@ -75,8 +76,6 @@ void qtg_set_city_names_font_sizes(int my_city_names_font_size, int my_city_productions_font_size) { - log_error(Unimplemented set_city_names_font_sizes.); - /* PORTME */ } /** @@ -119,7 +118,22 @@ / void qtg_gui_options_extra_init() { - /* Nothing to do. */ +struct option *poption; + +#define option_var_set_callback(var, callback) \ + if ((poption = optset_option_by_name(client_optset, #var))) { \ +option_set_changed_callback(poption, callback); \ + } else { \ +log_error(Didn't find option %s!, #var); \ + } + + option_var_set_callback(gui_qt_font_city_names, + apply_font); + option_var_set_callback(gui_qt_font_city_productions, +
[Freeciv-commits] r26019 - /trunk/client/gui-qt/mapview.cpp
Author: mir3x Date: Sun Aug 24 18:23:55 2014 New Revision: 26019 URL: http://svn.gna.org/viewcvs/freeciv?rev=26019view=rev Log: Fixed vieport. See patch #5064 Modified: trunk/client/gui-qt/mapview.cpp Modified: trunk/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=26019r1=26018r2=26019view=diff == --- trunk/client/gui-qt/mapview.cpp (original) +++ trunk/client/gui-qt/mapview.cpp Sun Aug 24 18:23:55 2014 @@ -24,6 +24,7 @@ // common #include calendar.h #include game.h +#include map.h // client #include climisc.h @@ -359,46 +360,45 @@ /** Converts gui to overview position. **/ -static void gui_to_overview(int *map_x, int *map_y, int gui_x, int gui_y) -{ - const int W = tileset_tile_width(tileset); - const int H = tileset_tile_height(tileset); - const int HH = tileset_hex_height(tileset); - const int HW = tileset_hex_width(tileset); - int a, b; - - if (HH 0 || HW 0) { -int x, y, dx, dy; -int xmult, ymult, mod, compar; -x = DIVIDE(gui_x, W); -y = DIVIDE(gui_y, H); -dx = gui_x - x * W; -dy = gui_y - y * H; -xmult = (dx = W / 2) ? -1 : 1; -ymult = (dy = H / 2) ? -1 : 1; -dx = (dx = W / 2) ? (W - 1 - dx) : dx; -dy = (dy = H / 2) ? (H - 1 - dy) : dy; -if (HW 0) { - compar = (dx - HW / 2) * (H / 2) - (H / 2 - 1 - dy) * (W / 2 - HW); -} else { - compar = (dy - HH / 2) * (W / 2) - (W / 2 - 1 - dx) * (H / 2 - HH); -} -mod = (compar 0) ? -1 : 0; -*map_x = (x + y) + mod * (xmult + ymult) / 2; -*map_y = (y - x) + mod * (ymult - xmult) / 2; - } else if (tileset_is_isometric(tileset)) { -gui_x -= W / 2; -*map_x = DIVIDE(gui_x * H + gui_y * W, W * H); -*map_y = DIVIDE(gui_y * W - gui_x * H, W * H); +static void gui_to_overview(int *ovr_x, int *ovr_y, int gui_x, int gui_y) +{ + double ntl_x, ntl_y; + const double gui_xd = gui_x, gui_yd = gui_y; + const double W = tileset_tile_width(tileset); + const double H = tileset_tile_height(tileset); + double map_x, map_y; + + if (tileset_is_isometric(tileset)) { +map_x = (gui_xd * H + gui_yd * W) / (W * H); +map_y = (gui_yd * W - gui_xd * H) / (W * H); } else { -*map_x = DIVIDE(gui_x, W); -*map_y = DIVIDE(gui_y, H); - } - a = *map_x; - b = *map_y; - map_to_overview_pos(map_x, map_y, a, b); - *map_x = *map_x + 1; - *map_y = *map_y + 1; +map_x = gui_xd / W; +map_y = gui_yd / H; + } + + if (MAP_IS_ISOMETRIC) { +ntl_y = map_x + map_y - map.xsize; +ntl_x = 2 * map_x - ntl_y; + } else { +ntl_x = map_x; +ntl_y = map_y; + } + + *ovr_x = floor((ntl_x - (double)options.overview.map_x0) + * OVERVIEW_TILE_SIZE); + *ovr_y = floor((ntl_y - (double)options.overview.map_y0) + * OVERVIEW_TILE_SIZE); + + if (current_topo_has_flag(TF_WRAPX)) { +*ovr_x = FC_WRAP(*ovr_x, NATURAL_WIDTH * OVERVIEW_TILE_SIZE); + } else { +if (MAP_IS_ISOMETRIC) { + *ovr_x -= OVERVIEW_TILE_SIZE; +} + } + if (current_topo_has_flag(TF_WRAPY)) { +*ovr_y = FC_WRAP(*ovr_y, NATURAL_HEIGHT * OVERVIEW_TILE_SIZE); + } } /** ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26085 - /branches/S2_5/client/gui-qt/repodlgs.cpp
Author: mir3x Date: Wed Aug 27 16:43:57 2014 New Revision: 26085 URL: http://svn.gna.org/viewcvs/freeciv?rev=26085view=rev Log: Added check for NULL displayed sprites. Also unit sprites are scaled now to fit in cells. See patch #5087 Modified: branches/S2_5/client/gui-qt/repodlgs.cpp Modified: branches/S2_5/client/gui-qt/repodlgs.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/repodlgs.cpp?rev=26085r1=26084r2=26085view=diff == --- branches/S2_5/client/gui-qt/repodlgs.cpp(original) +++ branches/S2_5/client/gui-qt/repodlgs.cppWed Aug 27 16:43:57 2014 @@ -814,7 +814,10 @@ int h; QFontMetrics fm(f); h = fm.height() + 6; + QPixmap *pix; QPixmap pix_scaled; + struct sprite *sprite; + eco_widget-setRowCount(0); eco_widget-clearContents(); get_economy_report_data(building_entries, entries_used, @@ -822,8 +825,17 @@ for (i = 0; i entries_used; i++) { struct improvement_entry *pentry = building_entries + i; struct impr_type *pimprove = pentry-type; -QPixmap *pix = get_building_sprite(tileset, pimprove)-pm; -pix_scaled = pix-scaledToHeight(h); + +pix = NULL; +sprite = get_building_sprite(tileset, pimprove); +if (sprite != NULL){ + pix = sprite-pm; +} +if (pix != NULL){ + pix_scaled = pix-scaledToHeight(h); +} else { + pix_scaled.fill(); +} cid cid = cid_encode_building(pimprove); eco_widget-insertRow(i); @@ -860,8 +872,13 @@ for (i = 0; i entries_used; i++) { struct unit_entry *pentry = unit_entries + i; struct unit_type *putype = pentry-type; -QPixmap *pix = get_unittype_sprite(tileset, putype, - direction8_invalid(), true)-pm; + +pix = NULL; +sprite = get_unittype_sprite(tileset, putype, + direction8_invalid(), true); +if (sprite != NULL){ + pix = sprite-pm; +} cid cid = cid_encode_unit(putype); eco_widget-insertRow(i + max_row); @@ -870,7 +887,10 @@ item-setTextAlignment(Qt::AlignHCenter); switch (j) { case 0: -item-setData(Qt::DecorationRole, *pix); +if (pix != NULL){ + pix_scaled = pix-scaledToHeight(h); + item-setData(Qt::DecorationRole, pix_scaled); +} item-setData(Qt::UserRole, cid); break; case 1: ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26084 - /trunk/client/gui-qt/repodlgs.cpp
Author: mir3x Date: Wed Aug 27 16:43:37 2014 New Revision: 26084 URL: http://svn.gna.org/viewcvs/freeciv?rev=26084view=rev Log: Added check for NULL displayed sprites. Also unit sprites are scaled now to fit in cells. See patch #5087 Modified: trunk/client/gui-qt/repodlgs.cpp Modified: trunk/client/gui-qt/repodlgs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/repodlgs.cpp?rev=26084r1=26083r2=26084view=diff == --- trunk/client/gui-qt/repodlgs.cpp(original) +++ trunk/client/gui-qt/repodlgs.cppWed Aug 27 16:43:37 2014 @@ -814,7 +814,10 @@ int h; QFontMetrics fm(f); h = fm.height() + 6; + QPixmap *pix; QPixmap pix_scaled; + struct sprite *sprite; + eco_widget-setRowCount(0); eco_widget-clearContents(); get_economy_report_data(building_entries, entries_used, @@ -822,8 +825,17 @@ for (i = 0; i entries_used; i++) { struct improvement_entry *pentry = building_entries + i; struct impr_type *pimprove = pentry-type; -QPixmap *pix = get_building_sprite(tileset, pimprove)-pm; -pix_scaled = pix-scaledToHeight(h); + +pix = NULL; +sprite = get_building_sprite(tileset, pimprove); +if (sprite != NULL){ + pix = sprite-pm; +} +if (pix != NULL){ + pix_scaled = pix-scaledToHeight(h); +} else { + pix_scaled.fill(); +} cid cid = cid_encode_building(pimprove); eco_widget-insertRow(i); @@ -860,8 +872,13 @@ for (i = 0; i entries_used; i++) { struct unit_entry *pentry = unit_entries + i; struct unit_type *putype = pentry-type; -QPixmap *pix = get_unittype_sprite(tileset, putype, - direction8_invalid(), true)-pm; + +pix = NULL; +sprite = get_unittype_sprite(tileset, putype, + direction8_invalid(), true); +if (sprite != NULL){ + pix = sprite-pm; +} cid cid = cid_encode_unit(putype); eco_widget-insertRow(i + max_row); @@ -870,7 +887,10 @@ item-setTextAlignment(Qt::AlignHCenter); switch (j) { case 0: -item-setData(Qt::DecorationRole, *pix); +if (pix != NULL){ + pix_scaled = pix-scaledToHeight(h); + item-setData(Qt::DecorationRole, pix_scaled); +} item-setData(Qt::UserRole, cid); break; case 1: ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26089 - in /trunk/client: gui-qt/fc_client.cpp tilespec.c
Author: mir3x Date: Thu Aug 28 11:22:43 2014 New Revision: 26089 URL: http://svn.gna.org/viewcvs/freeciv?rev=26089view=rev Log: Remove player color hack in Qt client See patch #5112 Modified: trunk/client/gui-qt/fc_client.cpp trunk/client/tilespec.c Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=26089r1=26088r2=26089view=diff == --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Thu Aug 28 11:22:43 2014 @@ -42,8 +42,6 @@ / fc_client::fc_client() : QObject() { - struct rgbcolor *prgbcolor; - /** * Somehow freeciv-client-common asks to switch to page when all widgets * haven't been created yet by Qt, even constructor finished job, @@ -168,9 +166,6 @@ connect(switch_page_mapper, SIGNAL(mapped( int)), this, SLOT(switch_page(int))); fc_fonts.init_fonts(); - /* workaround for changing tileset from main page */ - prgbcolor = rgbcolor_new(0,0,0); - game.plr_bg_color = prgbcolor; main_window-setVisible(true); } Modified: trunk/client/tilespec.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/tilespec.c?rev=26089r1=26088r2=26089view=diff == --- trunk/client/tilespec.c (original) +++ trunk/client/tilespec.c Thu Aug 28 11:22:43 2014 @@ -1230,7 +1230,7 @@ const char *tileset_name = option_str_get(poption); fc_assert_ret(NULL != tileset_name tileset_name[0] != '\0'); - tilespec_reread(tileset_name, TRUE); + tilespec_reread(tileset_name, client.conn.established); menus_init(); } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26090 - in /branches/S2_5/client: gui-qt/fc_client.cpp tilespec.c
Author: mir3x Date: Thu Aug 28 11:22:57 2014 New Revision: 26090 URL: http://svn.gna.org/viewcvs/freeciv?rev=26090view=rev Log: Remove player color hack in Qt client See patch #5112 Modified: branches/S2_5/client/gui-qt/fc_client.cpp branches/S2_5/client/tilespec.c Modified: branches/S2_5/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=26090r1=26089r2=26090view=diff == --- branches/S2_5/client/gui-qt/fc_client.cpp (original) +++ branches/S2_5/client/gui-qt/fc_client.cpp Thu Aug 28 11:22:57 2014 @@ -42,8 +42,6 @@ / fc_client::fc_client() : QObject() { - struct rgbcolor *prgbcolor; - #if QT_VERSION QT_VERSION_CHECK(5, 0, 0) QTextCodec::setCodecForCStrings(QTextCodec::codecForName(UTF-8)); #endif @@ -170,9 +168,6 @@ connect(switch_page_mapper, SIGNAL(mapped( int)), this, SLOT(switch_page(int))); fc_fonts.init_fonts(); - /* workaround for changing tileset from main page */ - prgbcolor = rgbcolor_new(0,0,0); - game.plr_bg_color = prgbcolor; main_window-setVisible(true); } Modified: branches/S2_5/client/tilespec.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/tilespec.c?rev=26090r1=26089r2=26090view=diff == --- branches/S2_5/client/tilespec.c (original) +++ branches/S2_5/client/tilespec.c Thu Aug 28 11:22:57 2014 @@ -1213,7 +1213,7 @@ const char *tileset_name = option_str_get(poption); fc_assert_ret(NULL != tileset_name tileset_name[0] != '\0'); - tilespec_reread(tileset_name, TRUE); + tilespec_reread(tileset_name, client.conn.established); menus_init(); } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26128 - in /trunk/client: ./ gui-qt/
Author: mir3x Date: Fri Aug 29 10:24:01 2014 New Revision: 26128 URL: http://svn.gna.org/viewcvs/freeciv?rev=26128view=rev Log: Removed old dock widgets (chat and messages). Added new semitransparent widgets, added menu entries for them. Added event icons to messages widget. See patch #5133 Modified: trunk/client/gui-qt/Makefile.am trunk/client/gui-qt/chatline.cpp trunk/client/gui-qt/chatline.h trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/fc_client.h trunk/client/gui-qt/mapview.cpp trunk/client/gui-qt/menu.cpp trunk/client/gui-qt/menu.h trunk/client/gui-qt/messagewin.cpp trunk/client/gui-qt/messagewin.h trunk/client/gui-qt/pages.cpp trunk/client/options.h [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/client/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/Makefile.am?rev=26128r1=26127r2=26128view=diff Modified: trunk/client/gui-qt/chatline.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/chatline.cpp?rev=26128r1=26127r2=26128view=diff Modified: trunk/client/gui-qt/chatline.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/chatline.h?rev=26128r1=26127r2=26128view=diff Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=26128r1=26127r2=26128view=diff Modified: trunk/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.h?rev=26128r1=26127r2=26128view=diff Modified: trunk/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=26128r1=26127r2=26128view=diff Modified: trunk/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=26128r1=26127r2=26128view=diff Modified: trunk/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.h?rev=26128r1=26127r2=26128view=diff Modified: trunk/client/gui-qt/messagewin.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/messagewin.cpp?rev=26128r1=26127r2=26128view=diff Modified: trunk/client/gui-qt/messagewin.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/messagewin.h?rev=26128r1=26127r2=26128view=diff Modified: trunk/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/pages.cpp?rev=26128r1=26127r2=26128view=diff Modified: trunk/client/options.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/options.h?rev=26128r1=26127r2=26128view=diff ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26161 - in /trunk/client/gui-qt: cityrep.cpp cityrep.h
Author: mir3x Date: Mon Sep 1 14:27:09 2014 New Revision: 26161 URL: http://svn.gna.org/viewcvs/freeciv?rev=26161view=rev Log: After getting new info from server, current selection in cities report was lost. Added restoring selection in that case. See patch #5136 Modified: trunk/client/gui-qt/cityrep.cpp trunk/client/gui-qt/cityrep.h Modified: trunk/client/gui-qt/cityrep.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/cityrep.cpp?rev=26161r1=26160r2=26161view=diff == --- trunk/client/gui-qt/cityrep.cpp (original) +++ trunk/client/gui-qt/cityrep.cpp Mon Sep 1 14:27:09 2014 @@ -257,6 +257,35 @@ for (int i = 0; i city_list.count(); i++) { notify_city_changed(i); } +} + +/*** + Resores last selection +***/ +void city_widget::restore_selection() +{ + QItemSelection selection; + QItemSelection s; + QModelIndex i; + struct city *pcity; + QVariant qvar; + + if (selected_cities.isEmpty()) { +return; + } + for (int j = 0; j filter_model-rowCount(); j++) { +i = filter_model-index(j, 0); +qvar = i.data(Qt::UserRole); +if (qvar.isNull()) { + continue; +} +pcity = reinterpret_castcity *(qvar.valuevoid *()); +if (selected_cities.contains(pcity)) { + selection.append(QItemSelectionRange(i)); +} + } + selectionModel()-select(selection, QItemSelectionModel::Rows + | QItemSelectionModel::SelectCurrent); } /*** @@ -277,6 +306,7 @@ setAllColumnsShowFocus(true); setSortingEnabled(true); setSelectionMode(QAbstractItemView::ExtendedSelection); + setSelectionBehavior(QAbstractItemView::SelectRows); setItemsExpandable(false); setAutoScroll(true); header()-setContextMenuPolicy(Qt::CustomContextMenu); @@ -393,7 +423,13 @@ QAction *act; QAction cty_view(style()-standardIcon(QStyle::SP_CommandLink), Q_(?verb:View), 0); - QAction cty_buy(_(Buy), 0); + sell_gold = 0; + foreach (pcity, selected_cities) { +sell_gold = sell_gold + city_production_buy_gold_cost(pcity); + } + fc_snprintf(buf, sizeof(buf), %s %d %s, _(Buy ( Cost:), + sell_gold, )); + QAction cty_buy(QString(buf), 0); QAction cty_center(style()-standardIcon(QStyle::SP_ArrowRight), _(Center), 0); QAction wl_clear(_(Clear), 0); @@ -433,7 +469,7 @@ worklist_defined = false; } fill_data(WORKLIST_CHANGE, cma_labels, tmp2_menu); - some_menu = list_menu.addMenu(_(CMA)); + some_menu = list_menu.addMenu(_(Governor)); gen_cma_labels(cma_labels); fill_data(CMA, cma_labels, some_menu); some_menu = list_menu.addMenu(_(Sell)); @@ -638,6 +674,7 @@ void city_widget::update_city(city *pcity) { list_model-city_changed(pcity); + restore_selection(); } /*** @@ -645,7 +682,10 @@ ***/ void city_widget::update_model() { + setUpdatesEnabled(false); list_model-all_changed(); + restore_selection(); + setUpdatesEnabled(true); } /*** Modified: trunk/client/gui-qt/cityrep.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/cityrep.h?rev=26161r1=26160r2=26161view=diff == --- trunk/client/gui-qt/cityrep.h (original) +++ trunk/client/gui-qt/cityrep.h Mon Sep 1 14:27:09 2014 @@ -164,6 +164,7 @@ void center(); private: + void restore_selection(); void gen_cma_labels(QMapQString, int list); void gen_worklist_labels(QMapQString, int list); void gen_production_labels(menu_labels which, QMapQString, cid list, ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26162 - in /branches/S2_5/client/gui-qt: cityrep.cpp cityrep.h dialogs.cpp repodlgs.cpp
Author: mir3x Date: Mon Sep 1 14:27:23 2014 New Revision: 26162 URL: http://svn.gna.org/viewcvs/freeciv?rev=26162view=rev Log: After getting new info from server, current selection in cities report was lost. Added restoring selection in that case. See patch #5136 Modified: branches/S2_5/client/gui-qt/cityrep.cpp branches/S2_5/client/gui-qt/cityrep.h branches/S2_5/client/gui-qt/dialogs.cpp branches/S2_5/client/gui-qt/repodlgs.cpp Modified: branches/S2_5/client/gui-qt/cityrep.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/cityrep.cpp?rev=26162r1=26161r2=26162view=diff == --- branches/S2_5/client/gui-qt/cityrep.cpp (original) +++ branches/S2_5/client/gui-qt/cityrep.cpp Mon Sep 1 14:27:23 2014 @@ -257,6 +257,35 @@ for (int i = 0; i city_list.count(); i++) { notify_city_changed(i); } +} + +/*** + Resores last selection +***/ +void city_widget::restore_selection() +{ + QItemSelection selection; + QItemSelection s; + QModelIndex i; + struct city *pcity; + QVariant qvar; + + if (selected_cities.isEmpty()) { +return; + } + for (int j = 0; j filter_model-rowCount(); j++) { +i = filter_model-index(j, 0); +qvar = i.data(Qt::UserRole); +if (qvar.isNull()) { + continue; +} +pcity = reinterpret_castcity *(qvar.valuevoid *()); +if (selected_cities.contains(pcity)) { + selection.append(QItemSelectionRange(i)); +} + } + selectionModel()-select(selection, QItemSelectionModel::Rows + | QItemSelectionModel::SelectCurrent); } /*** @@ -277,6 +306,7 @@ setAllColumnsShowFocus(true); setSortingEnabled(true); setSelectionMode(QAbstractItemView::ExtendedSelection); + setSelectionBehavior(QAbstractItemView::SelectRows); setItemsExpandable(false); setAutoScroll(true); header()-setContextMenuPolicy(Qt::CustomContextMenu); @@ -393,7 +423,13 @@ QAction *act; QAction cty_view(style()-standardIcon(QStyle::SP_CommandLink), Q_(?verb:View), 0); - QAction cty_buy(_(Buy), 0); + sell_gold = 0; + foreach (pcity, selected_cities) { +sell_gold = sell_gold + city_production_buy_gold_cost(pcity); + } + fc_snprintf(buf, sizeof(buf), %s %d %s, _(Buy ( Cost:), + sell_gold, )); + QAction cty_buy(QString(buf), 0); QAction cty_center(style()-standardIcon(QStyle::SP_ArrowRight), _(Center), 0); QAction wl_clear(_(Clear), 0); @@ -433,7 +469,7 @@ worklist_defined = false; } fill_data(WORKLIST_CHANGE, cma_labels, tmp2_menu); - some_menu = list_menu.addMenu(_(CMA)); + some_menu = list_menu.addMenu(_(Governor)); gen_cma_labels(cma_labels); fill_data(CMA, cma_labels, some_menu); some_menu = list_menu.addMenu(_(Sell)); @@ -638,6 +674,7 @@ void city_widget::update_city(city *pcity) { list_model-city_changed(pcity); + restore_selection(); } /*** @@ -645,7 +682,10 @@ ***/ void city_widget::update_model() { + setUpdatesEnabled(false); list_model-all_changed(); + restore_selection(); + setUpdatesEnabled(true); } /*** Modified: branches/S2_5/client/gui-qt/cityrep.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/cityrep.h?rev=26162r1=26161r2=26162view=diff == --- branches/S2_5/client/gui-qt/cityrep.h (original) +++ branches/S2_5/client/gui-qt/cityrep.h Mon Sep 1 14:27:23 2014 @@ -164,6 +164,7 @@ void center(); private: + void restore_selection(); void gen_cma_labels(QMapQString, int list); void gen_worklist_labels(QMapQString, int list); void gen_production_labels(menu_labels which, QMapQString, cid list, Modified: branches/S2_5/client/gui-qt/dialogs.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/dialogs.cpp?rev=26162r1=26161r2=26162view=diff == --- branches/S2_5/client/gui-qt/dialogs.cpp (original) +++ branches/S2_5/client/gui-qt/dialogs.cpp Mon Sep 1 14:27:23 2014 @@ -1650,25 +1650,28 @@ return; } if (!get_units_upgrade_info(buf, sizeof(buf), punits)) { -ask.setText(QString(buf)); ask.setWindowTitle(_(Upgrade Unit!)); +ask.setStandardButtons(QMessageBox::Ok); +ask.setIcon(QMessageBox::Information); } else { ask.setWindowTitle(_(Upgrade Obsolete Units)); ask.setStandardButtons(QMessageBox::Cancel |
[Freeciv-commits] r26163 - /trunk/client/gui-qt/repodlgs.cpp
Author: mir3x Date: Mon Sep 1 14:31:42 2014 New Revision: 26163 URL: http://svn.gna.org/viewcvs/freeciv?rev=26163view=rev Log: Added soring in economy report See patch #5143 Modified: trunk/client/gui-qt/repodlgs.cpp Modified: trunk/client/gui-qt/repodlgs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/repodlgs.cpp?rev=26163r1=26162r2=26163view=diff == --- trunk/client/gui-qt/repodlgs.cpp(original) +++ trunk/client/gui-qt/repodlgs.cppMon Sep 1 14:31:42 2014 @@ -755,6 +755,7 @@ eco_widget-horizontalHeader()-resizeSections(QHeaderView::Stretch); eco_widget-verticalHeader()-setVisible(false); eco_widget-setSelectionMode(QAbstractItemView::SingleSelection); + eco_widget-setSortingEnabled(true); header = eco_widget-horizontalHeader(); header-setSectionResizeMode(1, QHeaderView::Stretch); header-setStretchLastSection(true); @@ -851,16 +852,16 @@ item-setText(improvement_name_translation(pimprove)); break; case 2: -item-setText(QString::number(pentry-redundant)); +item-setData(Qt::DisplayRole, pentry-redundant); break; case 3: -item-setText(QString::number(pentry-count)); +item-setData(Qt::DisplayRole, pentry-count); break; case 4: -item-setText(QString::number(pentry-cost)); +item-setData(Qt::DisplayRole, pentry-cost); break; case 5: -item-setText(QString::number(pentry-total_cost)); +item-setData(Qt::DisplayRole, pentry-total_cost); break; } item-setTextAlignment(Qt::AlignVCenter | Qt::AlignHCenter); @@ -898,16 +899,16 @@ item-setText(utype_name_translation(putype)); break; case 2: -item-setText(QString::number(0)); +item-setData(Qt::DisplayRole, 0); break; case 3: -item-setText(QString::number(pentry-count)); +item-setData(Qt::DisplayRole, pentry-count); break; case 4: -item-setText(QString::number(pentry-cost)); +item-setData(Qt::DisplayRole, pentry-cost); break; case 5: -item-setText(QString::number(pentry-total_cost)); +item-setData(Qt::DisplayRole, pentry-total_cost); break; } item-setTextAlignment(Qt::AlignVCenter | Qt::AlignHCenter); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26165 - in /branches/S2_5/client/gui-qt: pages.cpp plrdlg.cpp
Author: mir3x Date: Mon Sep 1 14:35:42 2014 New Revision: 26165 URL: http://svn.gna.org/viewcvs/freeciv?rev=26165view=rev Log: Removed barbarians from start page and intelligence report. See patch #5137 Modified: branches/S2_5/client/gui-qt/pages.cpp branches/S2_5/client/gui-qt/plrdlg.cpp Modified: branches/S2_5/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/pages.cpp?rev=26165r1=26164r2=26165view=diff == --- branches/S2_5/client/gui-qt/pages.cpp (original) +++ branches/S2_5/client/gui-qt/pages.cpp Mon Sep 1 14:35:42 2014 @@ -1177,7 +1177,9 @@ break; } } conn_list_iterate_end; - +if (is_barbarian(pplayer)) { + continue; +} if (pplayer-ai_controlled) { is_ready = true; } else { @@ -1539,9 +1541,11 @@ splayer = \ + splayer + \; if (!splayer.compare(s)) { -send_chat(str.toLocal8Bit().data()); -send_chat(/away); -return; +if (pplayer-ai_controlled) { + send_chat(str.toLocal8Bit().data()); + send_chat(/away); + return; +} } } players_iterate_end; } Modified: branches/S2_5/client/gui-qt/plrdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/plrdlg.cpp?rev=26165r1=26164r2=26165view=diff == --- branches/S2_5/client/gui-qt/plrdlg.cpp (original) +++ branches/S2_5/client/gui-qt/plrdlg.cpp Mon Sep 1 14:35:42 2014 @@ -432,7 +432,7 @@ } entry_exist = false; players_iterate_alive(other) { - if (other == pplayer) { + if (other == pplayer || is_barbarian(other)) { continue; } state = player_diplstate_get(pplayer, other); @@ -446,8 +446,7 @@ ally_str = ally_str + nation_plural_for_player(other) + , ; entry_exist = true; } -} -players_iterate_alive_end; +} players_iterate_alive_end; if (entry_exist) { ally_str.replace(ally_str.lastIndexOf(,), 1, .); } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26164 - in /trunk/client/gui-qt: pages.cpp plrdlg.cpp
Author: mir3x Date: Mon Sep 1 14:35:22 2014 New Revision: 26164 URL: http://svn.gna.org/viewcvs/freeciv?rev=26164view=rev Log: Removed barbarians from start page and intelligence report. See patch #5137 Modified: trunk/client/gui-qt/pages.cpp trunk/client/gui-qt/plrdlg.cpp Modified: trunk/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/pages.cpp?rev=26164r1=26163r2=26164view=diff == --- trunk/client/gui-qt/pages.cpp (original) +++ trunk/client/gui-qt/pages.cpp Mon Sep 1 14:35:22 2014 @@ -1177,7 +1177,9 @@ break; } } conn_list_iterate_end; - +if (is_barbarian(pplayer)) { + continue; +} if (pplayer-ai_controlled) { is_ready = true; } else { @@ -1535,9 +1537,11 @@ splayer = \ + splayer + \; if (!splayer.compare(s)) { -send_chat(str.toLocal8Bit().data()); -send_chat(/away); -return; +if (pplayer-ai_controlled) { + send_chat(str.toLocal8Bit().data()); + send_chat(/away); + return; +} } } players_iterate_end; } Modified: trunk/client/gui-qt/plrdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/plrdlg.cpp?rev=26164r1=26163r2=26164view=diff == --- trunk/client/gui-qt/plrdlg.cpp (original) +++ trunk/client/gui-qt/plrdlg.cpp Mon Sep 1 14:35:22 2014 @@ -433,7 +433,7 @@ } entry_exist = false; players_iterate_alive(other) { - if (other == pplayer) { + if (other == pplayer || is_barbarian(other)) { continue; } state = player_diplstate_get(pplayer, other); @@ -448,8 +448,7 @@ ally_str = ally_str + nation_plural_for_player(other) + , ; entry_exist = true; } -} -players_iterate_alive_end; +} players_iterate_alive_end; if (entry_exist) { ally_str.replace(ally_str.lastIndexOf(,), 1, .); } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26167 - in /branches/S2_5/client/gui-qt: mapview.cpp mapview.h
Author: mir3x Date: Mon Sep 1 14:41:21 2014 New Revision: 26167 URL: http://svn.gna.org/viewcvs/freeciv?rev=26167view=rev Log: Added tile pixmap to unit label (often useful when city labels take too much space and player doesnt see current terrain) See patch #5138 Modified: branches/S2_5/client/gui-qt/mapview.cpp branches/S2_5/client/gui-qt/mapview.h Modified: branches/S2_5/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapview.cpp?rev=26167r1=26166r2=26167view=diff == --- branches/S2_5/client/gui-qt/mapview.cpp (original) +++ branches/S2_5/client/gui-qt/mapview.cpp Mon Sep 1 14:41:21 2014 @@ -1432,6 +1432,7 @@ setParent(parent); pix = NULL; arrow_pix = NULL; + tile_pix = NULL; ufont = new QFont; w_width = 0; selection_area.setWidth(0); @@ -1451,9 +1452,10 @@ struct unit *punit = unit_list_get(punits, 0); struct player *owner; struct canvas *unit_pixmap; + struct canvas *tile_pixmap; one_unit = true; - setFixedHeight(50); + setFixedHeight(56); if (unit_list_size(punits) == 0) { unit_label1 = ; unit_label2 = ; @@ -1489,14 +1491,36 @@ }; punit = head_of_units_in_focus(); if (punit) { -unit_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset), -tileset_tile_height(tileset) * 3 / 2); +if (tileset_is_isometric(tileset)){ + unit_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset), + tileset_tile_height(tileset) * 3 / 2); +} else { + unit_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset), + tileset_tile_height(tileset)); +} unit_pixmap-map_pixmap.fill(Qt::transparent); put_unit(punit, unit_pixmap, 0, 0); pix = unit_pixmap-map_pixmap; *pix = pix-scaledToHeight(height()); w_width = pix-width() + 1; - } + +if (tile_pix != NULL) { + delete tile_pix; +}; +if (tileset_is_isometric(tileset)){ + tile_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset), + tileset_tile_height(tileset) * 2); +} else { + tile_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset), + tileset_tile_height(tileset)); +} +tile_pixmap-map_pixmap.fill(QColor(0 , 0 , 0 , 85)); +put_terrain(punit-tile, tile_pixmap, 0, 0); +tile_pix = tile_pixmap-map_pixmap; +*tile_pix = tile_pix-scaledToHeight(height()); + w_width = w_width + tile_pix-width() + 1; + } + QFontMetrics fm(*ufont); if (arrow_pix == NULL) { arrow_pix = get_arrow_sprite(tileset, ARROW_PLUS)-pm; @@ -1560,6 +1584,7 @@ int w; QPainter::CompositionMode comp_mode = painter-compositionMode(); QPen pen; + QFontMetrics fm(*ufont); selection_area.setWidth(0); pen.setWidth(1); @@ -1568,9 +1593,11 @@ painter-drawRect(0, 0, w_width, height()); painter-setFont(*ufont); painter-setPen(pen); + + w = 0; if (pix != NULL) { -painter-drawPixmap(0, (height() - pix-height()) / 2, *pix); -w = pix-width() + 1; +painter-drawPixmap(w, (height() - pix-height()) / 2, *pix); +w = w + pix-width() + 1; if (one_unit == false) { if (highlight_pix) { painter-setCompositionMode(QPainter::CompositionMode_HardLight); @@ -1583,6 +1610,11 @@ painter-setCompositionMode(comp_mode); painter-drawText(w, height() / 2.5, unit_label1); painter-drawText(w, height() - 8, unit_label2); +w = w + 5 + qMax(fm.width(unit_label1), fm.width(unit_label2)); +if (tile_pix != NULL) { + painter-drawPixmap(w, (height() - pix-height()) / 2, *tile_pix); + w = tile_pix-width() + 1; +} } else { painter-drawText(5, height() / 3 + 5, _(No units selected.)); } Modified: branches/S2_5/client/gui-qt/mapview.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapview.h?rev=26167r1=26166r2=26167view=diff == --- branches/S2_5/client/gui-qt/mapview.h (original) +++ branches/S2_5/client/gui-qt/mapview.h Mon Sep 1 14:41:21 2014 @@ -278,6 +278,7 @@ Q_OBJECT QPixmap *pix; QPixmap *arrow_pix; + QPixmap *tile_pix; QFont *ufont; public: unit_label(QWidget *parent); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26166 - in /trunk/client/gui-qt: mapview.cpp mapview.h
Author: mir3x Date: Mon Sep 1 14:41:10 2014 New Revision: 26166 URL: http://svn.gna.org/viewcvs/freeciv?rev=26166view=rev Log: Added tile pixmap to unit label (often useful when city labels take too much space and player doesnt see current terrain) See patch #5138 Modified: trunk/client/gui-qt/mapview.cpp trunk/client/gui-qt/mapview.h Modified: trunk/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=26166r1=26165r2=26166view=diff == --- trunk/client/gui-qt/mapview.cpp (original) +++ trunk/client/gui-qt/mapview.cpp Mon Sep 1 14:41:10 2014 @@ -1435,6 +1435,7 @@ setParent(parent); pix = NULL; arrow_pix = NULL; + tile_pix = NULL; ufont = new QFont; w_width = 0; selection_area.setWidth(0); @@ -1454,9 +1455,10 @@ struct unit *punit = unit_list_get(punits, 0); struct player *owner; struct canvas *unit_pixmap; + struct canvas *tile_pixmap; one_unit = true; - setFixedHeight(50); + setFixedHeight(56); if (unit_list_size(punits) == 0) { unit_label1 = ; unit_label2 = ; @@ -1499,7 +1501,19 @@ pix = unit_pixmap-map_pixmap; *pix = pix-scaledToHeight(height()); w_width = pix-width() + 1; - } + +if (tile_pix != NULL) { + delete tile_pix; +}; +tile_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset), +tileset_tile_height(tileset) * 2); +tile_pixmap-map_pixmap.fill(QColor(0 , 0 , 0 , 85)); +put_terrain(punit-tile, tile_pixmap, 1.0, 0, 0); +tile_pix = tile_pixmap-map_pixmap; +*tile_pix = tile_pix-scaledToHeight(height()); + w_width = w_width + tile_pix-width() + 1; + } + QFontMetrics fm(*ufont); if (arrow_pix == NULL) { arrow_pix = get_arrow_sprite(tileset, ARROW_PLUS)-pm; @@ -1563,6 +1577,7 @@ int w; QPainter::CompositionMode comp_mode = painter-compositionMode(); QPen pen; + QFontMetrics fm(*ufont); selection_area.setWidth(0); pen.setWidth(1); @@ -1571,9 +1586,11 @@ painter-drawRect(0, 0, w_width, height()); painter-setFont(*ufont); painter-setPen(pen); + + w = 0; if (pix != NULL) { -painter-drawPixmap(0, (height() - pix-height()) / 2, *pix); -w = pix-width() + 1; +painter-drawPixmap(w, (height() - pix-height()) / 2, *pix); +w = w + pix-width() + 1; if (one_unit == false) { if (highlight_pix) { painter-setCompositionMode(QPainter::CompositionMode_HardLight); @@ -1586,6 +1603,11 @@ painter-setCompositionMode(comp_mode); painter-drawText(w, height() / 2.5, unit_label1); painter-drawText(w, height() - 8, unit_label2); +w = w + 5 + qMax(fm.width(unit_label1), fm.width(unit_label2)); +if (tile_pix != NULL) { + painter-drawPixmap(w, (height() - pix-height()) / 2, *tile_pix); + w = tile_pix-width() + 1; +} } else { painter-drawText(5, height() / 3 + 5, _(No units selected.)); } Modified: trunk/client/gui-qt/mapview.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.h?rev=26166r1=26165r2=26166view=diff == --- trunk/client/gui-qt/mapview.h (original) +++ trunk/client/gui-qt/mapview.h Mon Sep 1 14:41:10 2014 @@ -278,6 +278,7 @@ Q_OBJECT QPixmap *pix; QPixmap *arrow_pix; + QPixmap *tile_pix; QFont *ufont; public: unit_label(QWidget *parent); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26169 - in /branches/S2_5/client/gui-qt: cityrep.cpp cityrep.h
Author: mir3x Date: Mon Sep 1 14:44:08 2014 New Revision: 26169 URL: http://svn.gna.org/viewcvs/freeciv?rev=26169view=rev Log: Added tile pixmap to unit label (often useful when city labels take too much space and player doesnt see current terrain) See patch #5138 Modified: branches/S2_5/client/gui-qt/cityrep.cpp branches/S2_5/client/gui-qt/cityrep.h Modified: branches/S2_5/client/gui-qt/cityrep.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/cityrep.cpp?rev=26169r1=26168r2=26169view=diff == --- branches/S2_5/client/gui-qt/cityrep.cpp (original) +++ branches/S2_5/client/gui-qt/cityrep.cpp Mon Sep 1 14:44:08 2014 @@ -26,6 +26,27 @@ static bool can_city_sell_universal(const struct city *pcity, struct universal target); + + +bool city_sort_model::lessThan(const QModelIndex left, + const QModelIndex right) const +{ + QVariant qleft; + QVariant qright; + int i; + + qleft = sourceModel()-data(left); + qright = sourceModel()-data(right); + i = cityrepfield_compare(qleft.toString().toLocal8Bit().data(), + qright.toString().toLocal8Bit().data()); + + if (i = 0) { +return true; + } else { +return false; + } +} + /*** City item delegate constructor @@ -297,7 +318,7 @@ c_i_d = new city_item_delegate(this); setItemDelegate(c_i_d); list_model = new city_model(this); - filter_model = new QSortFilterProxyModel(); + filter_model = new city_sort_model(); filter_model-setDynamicSortFilter(true); filter_model-setSourceModel(list_model); filter_model-setFilterRole(Qt::DisplayRole); Modified: branches/S2_5/client/gui-qt/cityrep.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/cityrep.h?rev=26169r1=26168r2=26169view=diff == --- branches/S2_5/client/gui-qt/cityrep.h (original) +++ branches/S2_5/client/gui-qt/cityrep.h Mon Sep 1 14:44:08 2014 @@ -40,6 +40,7 @@ // Qt #include QAbstractListModel #include QItemDelegate +#include QSortFilterProxyModel #include QTreeView #include QWidget #include QMenu @@ -56,6 +57,11 @@ class QTableWidget; class QVBoxLayout; class city_report; + +class city_sort_model:public QSortFilterProxyModel +{ + bool lessThan(const QModelIndex left, const QModelIndex right) const; +}; /*** Item delegate for painting in model of city table ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26168 - in /trunk/client/gui-qt: cityrep.cpp cityrep.h
Author: mir3x Date: Mon Sep 1 14:43:57 2014 New Revision: 26168 URL: http://svn.gna.org/viewcvs/freeciv?rev=26168view=rev Log: Added proper item sorting in city report. See patch #5142 Modified: trunk/client/gui-qt/cityrep.cpp trunk/client/gui-qt/cityrep.h Modified: trunk/client/gui-qt/cityrep.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/cityrep.cpp?rev=26168r1=26167r2=26168view=diff == --- trunk/client/gui-qt/cityrep.cpp (original) +++ trunk/client/gui-qt/cityrep.cpp Mon Sep 1 14:43:57 2014 @@ -26,6 +26,27 @@ static bool can_city_sell_universal(const struct city *pcity, struct universal target); + + +bool city_sort_model::lessThan(const QModelIndex left, + const QModelIndex right) const +{ + QVariant qleft; + QVariant qright; + int i; + + qleft = sourceModel()-data(left); + qright = sourceModel()-data(right); + i = cityrepfield_compare(qleft.toString().toLocal8Bit().data(), + qright.toString().toLocal8Bit().data()); + + if (i = 0) { +return true; + } else { +return false; + } +} + /*** City item delegate constructor @@ -297,7 +318,7 @@ c_i_d = new city_item_delegate(this); setItemDelegate(c_i_d); list_model = new city_model(this); - filter_model = new QSortFilterProxyModel(); + filter_model = new city_sort_model(); filter_model-setDynamicSortFilter(true); filter_model-setSourceModel(list_model); filter_model-setFilterRole(Qt::DisplayRole); Modified: trunk/client/gui-qt/cityrep.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/cityrep.h?rev=26168r1=26167r2=26168view=diff == --- trunk/client/gui-qt/cityrep.h (original) +++ trunk/client/gui-qt/cityrep.h Mon Sep 1 14:43:57 2014 @@ -40,6 +40,7 @@ // Qt #include QAbstractListModel #include QItemDelegate +#include QSortFilterProxyModel #include QTreeView #include QWidget #include QMenu @@ -56,6 +57,11 @@ class QTableWidget; class QVBoxLayout; class city_report; + +class city_sort_model:public QSortFilterProxyModel +{ + bool lessThan(const QModelIndex left, const QModelIndex right) const; +}; /*** Item delegate for painting in model of city table ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26170 - /trunk/client/gui-qt/dialogs.cpp
Author: mir3x Date: Mon Sep 1 14:58:58 2014 New Revision: 26170 URL: http://svn.gna.org/viewcvs/freeciv?rev=26170view=rev Log: Added missing text when upgrading units. See patch #5149 Modified: trunk/client/gui-qt/dialogs.cpp Modified: trunk/client/gui-qt/dialogs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.cpp?rev=26170r1=26169r2=26170view=diff == --- trunk/client/gui-qt/dialogs.cpp (original) +++ trunk/client/gui-qt/dialogs.cpp Mon Sep 1 14:58:58 2014 @@ -1759,25 +1759,28 @@ return; } if (!get_units_upgrade_info(buf, sizeof(buf), punits)) { -ask.setText(QString(buf)); ask.setWindowTitle(_(Upgrade Unit!)); +ask.setStandardButtons(QMessageBox::Ok); +ask.setIcon(QMessageBox::Information); } else { ask.setWindowTitle(_(Upgrade Obsolete Units)); ask.setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok); +ask.setIcon(QMessageBox::Question); ask.setDefaultButton(QMessageBox::Cancel); -ask.setIcon(QMessageBox::Question); -ret = ask.exec(); - -switch (ret) { -case QMessageBox::Cancel: - return; - break; -case QMessageBox::Ok: - unit_list_iterate(punits, punit) { -request_unit_upgrade(punit); - } unit_list_iterate_end; - break; + } + ask.setText(QString(buf)); + ret = ask.exec(); + + switch (ret) { + case QMessageBox::Cancel: +return; +break; + case QMessageBox::Ok: +unit_list_iterate(punits, punit) { + request_unit_upgrade(punit); } +unit_list_iterate_end; +break; } } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26211 - in /trunk/client/gui-qt: dialogs.cpp dialogs.h optiondlg.cpp
Author: mir3x Date: Thu Sep 4 00:31:14 2014 New Revision: 26211 URL: http://svn.gna.org/viewcvs/freeciv?rev=26211view=rev Log: Added support for nation sets to Qt-client See patch #4350 Modified: trunk/client/gui-qt/dialogs.cpp trunk/client/gui-qt/dialogs.h trunk/client/gui-qt/optiondlg.cpp Modified: trunk/client/gui-qt/dialogs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.cpp?rev=26211r1=26210r2=26211view=diff == --- trunk/client/gui-qt/dialogs.cpp (original) +++ trunk/client/gui-qt/dialogs.cpp Thu Sep 4 00:31:14 2014 @@ -22,7 +22,6 @@ #include QRadioButton #include QTableWidgetItem #include QTextEdit -#include QToolBox // utility #include astring.h @@ -49,6 +48,7 @@ #include dialogs.h #include qtg_cxxside.h #include sprite.h + static void diplomat_keep_moving_unit(QVariant data1, QVariant data2); static void diplomat_keep_moving_city(QVariant data1, QVariant data2); @@ -87,26 +87,28 @@ /*** Constructor for selecting nations ***/ -races_dialog::races_dialog(struct player *pplayer, QWidget * parent):QDialog(parent) -{ - struct nation_group *group; +races_dialog::races_dialog(struct player *pplayer, + QWidget *parent) : QDialog(parent) +{ int i; QGridLayout *qgroupbox_layout; QGroupBox *no_name; - QWidget *tab_widget; QTableWidgetItem *item; QPixmap *pix; QHeaderView *header; QSize size; QString title; + QLabel *ns_label; setAttribute(Qt::WA_DeleteOnClose); is_race_dialog_open = true; main_layout = new QGridLayout; - nation_tabs = new QToolBox(parent); selected_nation_tabs = new QTableWidget; + nation_tabs = new QTableWidget(); styles = new QTableWidget; ok_button = new QPushButton; + qnation_set = new QComboBox; + ns_label = new QLabel; tplayer = pplayer; selected_nation = -1; @@ -120,7 +122,18 @@ selected_nation_tabs-horizontalHeader()-setVisible(false); selected_nation_tabs-setProperty(showGrid, true); selected_nation_tabs-setEditTriggers(QAbstractItemView::NoEditTriggers); - + selected_nation_tabs-setShowGrid(false); + selected_nation_tabs-setAlternatingRowColors(true); + + nation_tabs-setRowCount(0); + nation_tabs-setColumnCount(1); + nation_tabs-setSelectionMode(QAbstractItemView::SingleSelection); + nation_tabs-verticalHeader()-setVisible(false); + nation_tabs-horizontalHeader()-setVisible(false); + nation_tabs-setProperty(showGrid, true); + nation_tabs-setEditTriggers(QAbstractItemView::NoEditTriggers); + nation_tabs-setShowGrid(false); + ns_label-setText(_(Nation Set:)); styles-setRowCount(0); styles-setColumnCount(2); styles-setSelectionMode(QAbstractItemView::SingleSelection); @@ -129,6 +142,7 @@ styles-setProperty(showGrid, false); styles-setProperty(selectionBehavior, SelectRows); styles-setEditTriggers(QAbstractItemView::NoEditTriggers); + styles-setShowGrid(false); qgroupbox_layout = new QGridLayout; no_name = new QGroupBox(parent); @@ -177,14 +191,13 @@ header-resizeSections(QHeaderView::ResizeToContents); header = styles-verticalHeader(); header-resizeSections(QHeaderView::ResizeToContents); - tab_widget = new QWidget(); - nation_tabs-addItem(tab_widget, _(All Nations)); - for (i = 0; i nation_group_count(); i++) { -group = nation_group_by_number(i); -tab_widget = new QWidget(); -nation_tabs-addItem(tab_widget, nation_group_name_translation(group)); - } - connect(nation_tabs, SIGNAL(currentChanged(int)), SLOT(set_index(int))); + nation_sets_iterate(pset) { +qnation_set-addItem(nation_set_name_translation(pset), + nation_set_rule_name(pset)); + } nation_sets_iterate_end; + /* create nation sets */ + refresh(); + connect(styles-selectionModel(), SIGNAL(selectionChanged(const QItemSelection , const QItemSelection )), @@ -197,11 +210,18 @@ const QItemSelection ))); connect(leader_name, SIGNAL(currentIndexChanged(int)), SLOT(leader_selected(int))); + connect(qnation_set, SIGNAL(currentIndexChanged(int)), + SLOT(nationset_changed(int))); + connect(nation_tabs-selectionModel(), + SIGNAL(selectionChanged(const QItemSelection , + const QItemSelection )), + SLOT(group_selected(const QItemSelection , + const QItemSelection ))); ok_button = new QPushButton; ok_button-setText(_(Cancel)); connect(ok_button, SIGNAL(pressed()), SLOT(cancel_pressed())); - main_layout-addWidget(ok_button, 8, 1, 1, 1); + main_layout-addWidget(ok_button, 8, 2, 1, 1); random_button = new QPushButton; random_button-setText(_(Random));
[Freeciv-commits] r26212 - in /trunk/client/gui-qt: citydlg.cpp cityrep.cpp dialogs.cpp mapview.cpp plrdlg.cpp ratesdlg.cpp spaceshipdlg.cpp
Author: mir3x Date: Thu Sep 4 11:28:13 2014 New Revision: 26212 URL: http://svn.gna.org/viewcvs/freeciv?rev=26212view=rev Log: Fixed strings in Qt-client unsuitable for i18n bug reported by Jacob Nevins jtn See bug #22314 Modified: trunk/client/gui-qt/citydlg.cpp trunk/client/gui-qt/cityrep.cpp trunk/client/gui-qt/dialogs.cpp trunk/client/gui-qt/mapview.cpp trunk/client/gui-qt/plrdlg.cpp trunk/client/gui-qt/ratesdlg.cpp trunk/client/gui-qt/spaceshipdlg.cpp Modified: trunk/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/citydlg.cpp?rev=26212r1=26211r2=26212view=diff == --- trunk/client/gui-qt/citydlg.cpp (original) +++ trunk/client/gui-qt/citydlg.cpp Thu Sep 4 11:28:13 2014 @@ -485,8 +485,9 @@ pix.fill(QColor(90, 90, 90, 90)); painter.drawPixmap(0,0, cutted_width, cutted_height, pix); painter.setPen(QColor(120,120,120)); -str = _(Governor) + QString( ) -+ QString(cmafec_get_short_descr_of_city(mcity)); +/* TRANS: %1 is custom string choosen by player. */ +str = QString(_(Governor %1)) + .arg(cmafec_get_short_descr_of_city(mcity)); painter.drawText(5,cutted_height-10,str); } painter.end(); @@ -1180,8 +1181,8 @@ Qt::IgnoreAspectRatio,Qt::SmoothTransformation ); cma_result_pix-setPixmap(pix); cma_result_pix-setAlignment(Qt::AlignRight | Qt::AlignVCenter); -cma_result-setText(QString(h3) + QString(_(Governor Enabled)) -+ QString( () + s + QString()/h3)); +/* TRANS: %1 is custom string chosen player */ +cma_result-setText(QString(_(h3Governor Enabled - %1/h3)).arg(s)); cma_result-setAlignment(Qt::AlignLeft | Qt::AlignVCenter); } else { pix = style()-standardPixmap(QStyle::SP_DialogCancelButton); @@ -1189,8 +1190,7 @@ Qt::IgnoreAspectRatio,Qt::SmoothTransformation ); cma_result_pix-setPixmap(pix); cma_result_pix-setAlignment(Qt::AlignRight | Qt::AlignVCenter); -cma_result-setText(QString(h3) + QString(_(Governor Disabled)) + -QString(/h3)); +cma_result-setText(QString(_(h3Governor Disabled/h3))); cma_result-setAlignment(Qt::AlignLeft | Qt::AlignVCenter); } if (cma_is_city_under_agent(pcity, NULL)) { @@ -1390,15 +1390,16 @@ buy_button-setDisabled(true); buy_button_p-setDisabled(true); - str = QString(_(Buy)); if (!client_is_observer() client.conn.playing != NULL) { value = city_production_buy_gold_cost(pcity); -str = str + QString(( ) + QString::number(value) + gold ); +str = QString(_(Buy (%1 gold))).arg(QString::number(value)); if (client.conn.playing-economic.gold = value value != 0) { buy_button-setEnabled(true); buy_button_p-setEnabled(true); } + } else { +str = QString(_(Buy)); } buy_button-setText(str); buy_button_p-setText(str); @@ -1958,7 +1959,7 @@ int ret; const char *name = city_production_name_translation(pcity); int value = city_production_buy_gold_cost(pcity); - const QString title = QString::fromUtf8(_(Buy)) + QString( ? ); + const QString title = _(Buy ?); QMessageBox ask(this); if (!can_client_issue_orders()) { @@ -2038,8 +2039,6 @@ qitem-setData(Qt::DecorationRole, pix_scaled); size.setHeight(h); size.setWidth(pix_scaled.width()+6); -} else { - qitem-setText(Sprite missing); } break; case 1: @@ -2092,8 +2091,6 @@ pix = sprite-pm; pix_scaled = pix-scaledToHeight(h); qitem-setData(Qt::DecorationRole, pix_scaled); -} else { - qitem-setText(_([Pixmap])); } break; case 1: @@ -2213,17 +2210,25 @@ + QString(/b/i )); pcity_name-setText(QString(ib) + QString(city_name(pcity)) + QString(/b/i )); - buf = QString::fromUtf8(city_name(pcity)) + - -+ QString::fromUtf8(population_to_text(city_population(pcity))) -+ + _(citizens); if (city_unhappy(pcity)) { -buf = buf + - + _(DISORDER); +/* TRANS: city dialog title */ +buf = QString(_(%1 - %2 citizens - DISORDER)).arg(city_name(pcity), +population_to_text(city_population(pcity))); } else if (city_celebrating(pcity)) { -buf = buf + - + _(celebrating); +/* TRANS: city dialog title */ +buf = QString(_(%1 - %2 citizens - celebrating)).arg(city_name(pcity), +population_to_text(city_population(pcity))); } else if (city_happy(pcity)) { -buf = buf + - + _(happy); - } +/* TRANS: city dialog title */ +buf = QString(_(%1 - %2 citizens - happy)).arg(city_name(pcity), +population_to_text(city_population(pcity))); + } else { +/* TRANS: city dialog title */ +buf = QString(_(%1 - %2 citizens -
[Freeciv-commits] r26237 - in /trunk/client/gui-qt: Makefile.am menu.cpp menu.h messagedlg.cpp messagedlg.h
Author: mir3x Date: Sat Sep 6 10:30:13 2014 New Revision: 26237 URL: http://svn.gna.org/viewcvs/freeciv?rev=26237view=rev Log: Added messages options to Qt-client See patch #5165 Modified: trunk/client/gui-qt/Makefile.am trunk/client/gui-qt/menu.cpp trunk/client/gui-qt/menu.h trunk/client/gui-qt/messagedlg.cpp trunk/client/gui-qt/messagedlg.h Modified: trunk/client/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/Makefile.am?rev=26237r1=26236r2=26237view=diff == --- trunk/client/gui-qt/Makefile.am (original) +++ trunk/client/gui-qt/Makefile.am Sat Sep 6 10:30:13 2014 @@ -27,7 +27,8 @@ meta_diplodlg.cpp \ meta_spaceshipdlg.cpp \ meta_messagewin.cpp \ - meta_chatline.cpp + meta_chatline.cpp \ + meta_messagedlg.cpp libgui_qt_la_SOURCES = \ canvas.cpp \ Modified: trunk/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=26237r1=26236r2=26237view=diff == --- trunk/client/gui-qt/menu.cpp(original) +++ trunk/client/gui-qt/menu.cppSat Sep 6 10:30:13 2014 @@ -36,6 +36,7 @@ #include cityrep.h #include dialogs.h #include gui_main.h +#include messagedlg.h #include plrdlg.h #include ratesdlg.h #include repodlgs.h @@ -111,6 +112,8 @@ connect(act, SIGNAL(triggered()), this, SLOT(local_options())); act = menu-addAction(_(Server Options)); connect(act, SIGNAL(triggered()), this, SLOT(server_options())); + act = menu-addAction(_(Messages)); + connect(act, SIGNAL(triggered()), this, SLOT(messages_options())); menu = pr; act = menu-addAction(_(Quit)); act-setIcon(style()-standardIcon(QStyle::SP_TitleBarCloseButton)); @@ -1594,6 +1597,14 @@ gui()-popup_server_options(); } +/ + Invoke dialog with server options +*/ +void mr_menu::messages_options() +{ + popup_messageopt_dialog(); +} + /*** Invoke popup for quiting game ***/ Modified: trunk/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.h?rev=26237r1=26236r2=26237view=diff == --- trunk/client/gui-qt/menu.h (original) +++ trunk/client/gui-qt/menu.h Sat Sep 6 10:30:13 2014 @@ -84,6 +84,7 @@ /* game menu */ void local_options(); void server_options(); + void messages_options(); void quit_game(); /* help menu */ Modified: trunk/client/gui-qt/messagedlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/messagedlg.cpp?rev=26237r1=26236r2=26237view=diff == --- trunk/client/gui-qt/messagedlg.cpp (original) +++ trunk/client/gui-qt/messagedlg.cpp Sat Sep 6 10:30:13 2014 @@ -15,6 +15,12 @@ #include fc_config.h #endif + +//Qt +#include QGridLayout +#include QTableWidget +#include QHeaderView + // client #include options.h @@ -24,9 +30,155 @@ #include messagedlg.h /** + Message widget constructor +**/ +message_dlg::message_dlg() +{ + int index; + QStringList slist; + QLabel *empty1, *empty2; + QPushButton *but1; + QPushButton *but2; + int len; + + setAttribute(Qt::WA_DeleteOnClose); + empty1 = new QLabel; + empty2 = new QLabel; + layout = new QGridLayout; + msgtab = new QTableWidget; + slist _(Event) _(Out) _(Mes) _(Pop); + msgtab-setColumnCount(slist.count()); + msgtab-setHorizontalHeaderLabels(slist); + msgtab-setProperty(showGrid, false); + msgtab-setEditTriggers(QAbstractItemView::NoEditTriggers); + msgtab-horizontalHeader()-resizeSections(QHeaderView:: + ResizeToContents); + msgtab-verticalHeader()-setVisible(false); + msgtab-setSelectionMode(QAbstractItemView::NoSelection); + msgtab-setSelectionBehavior(QAbstractItemView::SelectColumns); + + but1 = new QPushButton(style()-standardIcon( + QStyle::SP_DialogCancelButton), _(Cancel)); + connect(but1, SIGNAL(clicked()), SLOT(cancel_changes())); + layout-addWidget(but1, 1, 1, 1, 1); + but2 = new QPushButton(style()-standardIcon(QStyle::SP_DialogOkButton), + _(Ok)); + connect(but2, SIGNAL(clicked()), SLOT(apply_changes())); + layout-addWidget(but2, 1, 2, 1, 1, Qt::AlignRight); + layout-addWidget(empty1, 0, 0, 1, 1); + layout-addWidget(msgtab, 0, 1, 1, 2); + layout-addWidget(empty2,
[Freeciv-commits] r26239 - in /trunk/client/gui-qt: fc_client.cpp fc_client.h pages.cpp
Author: mir3x Date: Sat Sep 6 10:34:22 2014 New Revision: 26239 URL: http://svn.gna.org/viewcvs/freeciv?rev=26239view=rev Log: Now beta label is shown with correct font in qt-client See patch #5166 Modified: trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/fc_client.h trunk/client/gui-qt/pages.cpp Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=26239r1=26238r2=26239view=diff == --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Sat Sep 6 10:34:22 2014 @@ -89,16 +89,21 @@ current_file = ; status_bar_queue.clear(); quitting = false; - for (int i = 0; i = PAGE_GGZ; i++) { pages_layout[i] = NULL; pages[i] = NULL; } + init(); +} + +void fc_client::init() +{ main_window = new QMainWindow; central_wdg = new QWidget; central_layout = new QGridLayout; // General part not related to any single page + fc_fonts.init_fonts(); menu_bar = new mr_menu(); menu_bar-setup_menus(); main_window-setMenuBar(menu_bar); @@ -152,8 +157,8 @@ connect(switch_page_mapper, SIGNAL(mapped( int)), this, SLOT(switch_page(int))); - fc_fonts.init_fonts(); main_window-setVisible(true); + } / Modified: trunk/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.h?rev=26239r1=26238r2=26239view=diff == --- trunk/client/gui-qt/fc_client.h (original) +++ trunk/client/gui-qt/fc_client.h Sat Sep 6 10:34:22 2014 @@ -241,6 +241,7 @@ void handle_authentication_req( enum authentication_type type, const char *message); void update_obs_button(); + void init(); enum client_pages page; QMapQString, QWidget* opened_repo_dlgs; Modified: trunk/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/pages.cpp?rev=26239r1=26238r2=26239view=diff == --- trunk/client/gui-qt/pages.cpp (original) +++ trunk/client/gui-qt/pages.cpp Sat Sep 6 10:34:22 2014 @@ -89,12 +89,16 @@ char msgbuf[128]; const char *rev_ver; QFont f = QApplication::font(); + QFont *fe; QFontMetrics fm(f); QPalette warn_color; QLabel *experimental_warning = new QLabel(_(Qt-client is experimental!)); + fe = fc_fonts.get_font(gui_qt_font_beta_label); + experimental_warning-setFont(*fe); int row = 0; #if IS_BETA_VERSION QLabel *beta_label = new QLabel(beta_message()); + beta_label-setFont(*fe); #endif pages_layout[PAGE_MAIN] = new QGridLayout; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26240 - in /branches/S2_5/client/gui-qt: fc_client.cpp fc_client.h pages.cpp
Author: mir3x Date: Sat Sep 6 10:35:03 2014 New Revision: 26240 URL: http://svn.gna.org/viewcvs/freeciv?rev=26240view=rev Log: Now beta label is shown with correct font in qt-client See patch #5166 Modified: branches/S2_5/client/gui-qt/fc_client.cpp branches/S2_5/client/gui-qt/fc_client.h branches/S2_5/client/gui-qt/pages.cpp Modified: branches/S2_5/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=26240r1=26239r2=26240view=diff == --- branches/S2_5/client/gui-qt/fc_client.cpp (original) +++ branches/S2_5/client/gui-qt/fc_client.cpp Sat Sep 6 10:35:03 2014 @@ -94,16 +94,21 @@ current_file = ; status_bar_queue.clear(); quitting = false; - for (int i = 0; i = PAGE_GGZ; i++) { pages_layout[i] = NULL; pages[i] = NULL; } + init(); +} + +void fc_client::init() +{ main_window = new QMainWindow; central_wdg = new QWidget; central_layout = new QGridLayout; // General part not related to any single page + fc_fonts.init_fonts(); menu_bar = new mr_menu(); menu_bar-setup_menus(); main_window-setMenuBar(menu_bar); @@ -157,8 +162,8 @@ connect(switch_page_mapper, SIGNAL(mapped( int)), this, SLOT(switch_page(int))); - fc_fonts.init_fonts(); main_window-setVisible(true); + } / Modified: branches/S2_5/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.h?rev=26240r1=26239r2=26240view=diff == --- branches/S2_5/client/gui-qt/fc_client.h (original) +++ branches/S2_5/client/gui-qt/fc_client.h Sat Sep 6 10:35:03 2014 @@ -245,6 +245,7 @@ void handle_authentication_req( enum authentication_type type, const char *message); void update_obs_button(); + void init(); enum client_pages page; QMapQString, QWidget* opened_repo_dlgs; Modified: branches/S2_5/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/pages.cpp?rev=26240r1=26239r2=26240view=diff == --- branches/S2_5/client/gui-qt/pages.cpp (original) +++ branches/S2_5/client/gui-qt/pages.cpp Sat Sep 6 10:35:03 2014 @@ -89,12 +89,16 @@ char msgbuf[128]; const char *rev_ver; QFont f = QApplication::font(); + QFont *fe; QFontMetrics fm(f); QPalette warn_color; QLabel *experimental_warning = new QLabel(_(Qt-client is experimental!)); + fe = fc_fonts.get_font(gui_qt_font_beta_label); + experimental_warning-setFont(*fe); int row = 0; #if IS_BETA_VERSION QLabel *beta_label = new QLabel(beta_message()); + beta_label-setFont(*fe); #endif pages_layout[PAGE_MAIN] = new QGridLayout; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26278 - in /trunk/client/gui-qt: fc_client.cpp fc_client.h mapctrl.cpp mapview.cpp mapview.h
Author: mir3x Date: Sun Sep 7 15:18:11 2014 New Revision: 26278 URL: http://svn.gna.org/viewcvs/freeciv?rev=26278view=rev Log: Added animated curosrs See patch #5169 Modified: trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/fc_client.h trunk/client/gui-qt/mapctrl.cpp trunk/client/gui-qt/mapview.cpp trunk/client/gui-qt/mapview.h Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=26278r1=26277r2=26278view=diff == --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Sun Sep 7 15:18:11 2014 @@ -32,6 +32,7 @@ // gui-qt #include fc_client.h #include optiondlg.h +#include sprite.h extern QApplication *qapp; @@ -112,7 +113,7 @@ status_bar_label-setAlignment(Qt::AlignCenter); status_bar-addWidget(status_bar_label, 1); set_status_bar(_(Welcome to Freeciv)); - + create_cursors(); switch_page_mapper = new QSignalMapper; // PAGE_MAIN pages[PAGE_MAIN] = new QWidget(central_wdg); @@ -528,6 +529,26 @@ option_dialog_popup(_(Set server options), server_optset); } +void fc_client::create_cursors(void) +{ + enum cursor_type curs; + int cursor; + QPixmap *pix; + int hot_x, hot_y; + struct sprite *sprite; + int frame; + QCursor *c; + for (cursor = 0; cursor CURSOR_LAST; cursor++) { +for (frame = 0; frame NUM_CURSOR_FRAMES; frame++) { + curs = static_castcursor_type(cursor); + sprite = get_cursor_sprite(tileset, curs, hot_x, hot_y, frame); + pix = sprite-pm; + c = new QCursor(*pix, hot_x, hot_y); + fc_cursors[cursor][frame] = c; +} + } +} + / Returns desired font / Modified: trunk/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.h?rev=26278r1=26277r2=26278view=diff == --- trunk/client/gui-qt/fc_client.h (original) +++ trunk/client/gui-qt/fc_client.h Sun Sep 7 15:18:11 2014 @@ -182,6 +182,7 @@ fc_game_tab_widget *game_tab_widget; messagewdg *msgwdg; info_tab *infotab; + QCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]; void gimme_place(QWidget* widget, QString str); int gimme_index_of(QString str); void remove_repo_dlg(QString str); @@ -236,6 +237,7 @@ const struct server_list *); bool check_server_scan (server_scan*); void update_load_page(void); + void create_cursors(void); void update_scenarios_page(void); void set_connection_state(enum connection_state state); void handle_authentication_req( Modified: trunk/client/gui-qt/mapctrl.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapctrl.cpp?rev=26278r1=26277r2=26278view=diff == --- trunk/client/gui-qt/mapctrl.cpp (original) +++ trunk/client/gui-qt/mapctrl.cpp Sun Sep 7 15:18:11 2014 @@ -94,7 +94,7 @@ **/ void update_rect_at_mouse_pos(void) { - /* PORTME */ + /* PLS DONT PORT IT */ } /** @@ -196,6 +196,9 @@ if (event-button() == Qt::MiddleButton) { gui()-popdown_tile_info(); } + if (event-button() == Qt::LeftButton) { +release_goto_button(event-x(), event-y()); + } } /** @@ -204,6 +207,8 @@ void map_view::mouseMoveEvent(QMouseEvent *event) { update_line(event-pos().x(), event-pos().y()); + control_mouse_cursor(canvas_pos_to_tile(event-pos().x(), + event-pos().y())); } /** Modified: trunk/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=26278r1=26277r2=26278view=diff == --- trunk/client/gui-qt/mapview.cpp (original) +++ trunk/client/gui-qt/mapview.cpp Sun Sep 7 15:18:11 2014 @@ -97,7 +97,67 @@ **/ map_view::map_view() : QWidget() { + cursor = -1; + QTimer *timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(timer_event())); + timer-start(200); setMouseTracking(true); +} + +/** + Updates cursor +**/ +void map_view::update_cursor(enum cursor_type ct) +{ + int i; + + if (ct == CURSOR_DEFAULT) { +
[Freeciv-commits] r26279 - in /branches/S2_5/client/gui-qt: fc_client.cpp fc_client.h mapctrl.cpp mapview.cpp mapview.h
Author: mir3x Date: Sun Sep 7 15:18:22 2014 New Revision: 26279 URL: http://svn.gna.org/viewcvs/freeciv?rev=26279view=rev Log: Added animated curosrs See patch #5169 Modified: branches/S2_5/client/gui-qt/fc_client.cpp branches/S2_5/client/gui-qt/fc_client.h branches/S2_5/client/gui-qt/mapctrl.cpp branches/S2_5/client/gui-qt/mapview.cpp branches/S2_5/client/gui-qt/mapview.h Modified: branches/S2_5/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=26279r1=26278r2=26279view=diff == --- branches/S2_5/client/gui-qt/fc_client.cpp (original) +++ branches/S2_5/client/gui-qt/fc_client.cpp Sun Sep 7 15:18:22 2014 @@ -32,6 +32,7 @@ // gui-qt #include fc_client.h #include optiondlg.h +#include sprite.h extern QApplication *qapp; @@ -117,7 +118,7 @@ status_bar_label-setAlignment(Qt::AlignCenter); status_bar-addWidget(status_bar_label, 1); set_status_bar(_(Welcome to Freeciv)); - + create_cursors(); switch_page_mapper = new QSignalMapper; // PAGE_MAIN pages[PAGE_MAIN] = new QWidget(central_wdg); @@ -533,6 +534,26 @@ option_dialog_popup(_(Set server options), server_optset); } +void fc_client::create_cursors(void) +{ + enum cursor_type curs; + int cursor; + QPixmap *pix; + int hot_x, hot_y; + struct sprite *sprite; + int frame; + QCursor *c; + for (cursor = 0; cursor CURSOR_LAST; cursor++) { +for (frame = 0; frame NUM_CURSOR_FRAMES; frame++) { + curs = static_castcursor_type(cursor); + sprite = get_cursor_sprite(tileset, curs, hot_x, hot_y, frame); + pix = sprite-pm; + c = new QCursor(*pix, hot_x, hot_y); + fc_cursors[cursor][frame] = c; +} + } +} + / Returns desired font / Modified: branches/S2_5/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.h?rev=26279r1=26278r2=26279view=diff == --- branches/S2_5/client/gui-qt/fc_client.h (original) +++ branches/S2_5/client/gui-qt/fc_client.h Sun Sep 7 15:18:22 2014 @@ -186,6 +186,7 @@ fc_game_tab_widget *game_tab_widget; messagewdg *msgwdg; info_tab *infotab; + QCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]; void gimme_place(QWidget* widget, QString str); int gimme_index_of(QString str); void remove_repo_dlg(QString str); @@ -240,6 +241,7 @@ const struct server_list *); bool check_server_scan (server_scan*); void update_load_page(void); + void create_cursors(void); void update_scenarios_page(void); void set_connection_state(enum connection_state state); void handle_authentication_req( Modified: branches/S2_5/client/gui-qt/mapctrl.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapctrl.cpp?rev=26279r1=26278r2=26279view=diff == --- branches/S2_5/client/gui-qt/mapctrl.cpp (original) +++ branches/S2_5/client/gui-qt/mapctrl.cpp Sun Sep 7 15:18:22 2014 @@ -94,7 +94,7 @@ **/ void update_rect_at_mouse_pos(void) { - /* PORTME */ + /* PLS DONT PORT IT */ } /** @@ -196,6 +196,9 @@ if (event-button() == Qt::MiddleButton) { gui()-popdown_tile_info(); } + if (event-button() == Qt::LeftButton) { +release_goto_button(event-x(), event-y()); + } } /** @@ -204,6 +207,8 @@ void map_view::mouseMoveEvent(QMouseEvent *event) { update_line(event-pos().x(), event-pos().y()); + control_mouse_cursor(canvas_pos_to_tile(event-pos().x(), + event-pos().y())); } /** Modified: branches/S2_5/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapview.cpp?rev=26279r1=26278r2=26279view=diff == --- branches/S2_5/client/gui-qt/mapview.cpp (original) +++ branches/S2_5/client/gui-qt/mapview.cpp Sun Sep 7 15:18:22 2014 @@ -96,7 +96,67 @@ **/ map_view::map_view() : QWidget() { + cursor = -1; + QTimer *timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(timer_event())); + timer-start(200); setMouseTracking(true); +} + +/** + Updates cursor
[Freeciv-commits] r26281 - in /trunk/client/gui-qt: fc_client.cpp pages.cpp
Author: mir3x Date: Sun Sep 7 15:22:14 2014 New Revision: 26281 URL: http://svn.gna.org/viewcvs/freeciv?rev=26281view=rev Log: Removed margins around map view See patch #5170 Modified: trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/pages.cpp Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=26281r1=26280r2=26281view=diff == --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Sun Sep 7 15:22:14 2014 @@ -102,6 +102,7 @@ main_window = new QMainWindow; central_wdg = new QWidget; central_layout = new QGridLayout; + central_layout-setContentsMargins(2, 2, 2, 2); // General part not related to any single page fc_fonts.init_fonts(); Modified: trunk/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/pages.cpp?rev=26281r1=26280r2=26281view=diff == --- trunk/client/gui-qt/pages.cpp (original) +++ trunk/client/gui-qt/pages.cpp Sun Sep 7 15:22:14 2014 @@ -578,6 +578,8 @@ game_main_widget = new QWidget; game_layout = new QGridLayout; game_tab_widget = new fc_game_tab_widget; + game_layout-setContentsMargins(0, 0, 0, 0); + game_layout-setSpacing(0); game_tab_widget-setTabPosition(QTabWidget::South); game_tab_widget-setDocumentMode(false); mapview_wdg = new map_view(); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26282 - in /branches/S2_5/client/gui-qt: fc_client.cpp pages.cpp
Author: mir3x Date: Sun Sep 7 15:22:25 2014 New Revision: 26282 URL: http://svn.gna.org/viewcvs/freeciv?rev=26282view=rev Log: Removed margins around map view See patch #5170 Modified: branches/S2_5/client/gui-qt/fc_client.cpp branches/S2_5/client/gui-qt/pages.cpp Modified: branches/S2_5/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=26282r1=26281r2=26282view=diff == --- branches/S2_5/client/gui-qt/fc_client.cpp (original) +++ branches/S2_5/client/gui-qt/fc_client.cpp Sun Sep 7 15:22:25 2014 @@ -107,6 +107,7 @@ main_window = new QMainWindow; central_wdg = new QWidget; central_layout = new QGridLayout; + central_layout-setContentsMargins(2, 2, 2, 2); // General part not related to any single page fc_fonts.init_fonts(); Modified: branches/S2_5/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/pages.cpp?rev=26282r1=26281r2=26282view=diff == --- branches/S2_5/client/gui-qt/pages.cpp (original) +++ branches/S2_5/client/gui-qt/pages.cpp Sun Sep 7 15:22:25 2014 @@ -578,6 +578,8 @@ game_main_widget = new QWidget; game_layout = new QGridLayout; game_tab_widget = new fc_game_tab_widget; + game_layout-setContentsMargins(0, 0, 0, 0); + game_layout-setSpacing(0); game_tab_widget-setTabPosition(QTabWidget::South); game_tab_widget-setDocumentMode(false); mapview_wdg = new map_view(); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26283 - /trunk/client/gui-qt/repodlgs.cpp
Author: mir3x Date: Sun Sep 7 15:25:02 2014 New Revision: 26283 URL: http://svn.gna.org/viewcvs/freeciv?rev=26283view=rev Log: Added future tech handling See patch #5171 Modified: trunk/client/gui-qt/repodlgs.cpp Modified: trunk/client/gui-qt/repodlgs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/repodlgs.cpp?rev=26283r1=26282r2=26283view=diff == --- trunk/client/gui-qt/repodlgs.cpp(original) +++ trunk/client/gui-qt/repodlgs.cppSun Sep 7 15:25:02 2014 @@ -307,9 +307,10 @@ /** set current tech and goal */ qres = research-researching; - - if (qres == A_UNSET) { -researching_combo-insertItem(0, _(None), A_UNSET); + if (qres == A_UNSET || is_future_tech(research-researching)) { +researching_combo-insertItem(0, research_advance_name_translation( + research, research-researching ), + A_UNSET); researching_combo-setCurrentIndex(0); } else { for (int i = 0; i researching_combo-count(); i++) { ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26284 - /branches/S2_5/client/gui-qt/repodlgs.cpp
Author: mir3x Date: Sun Sep 7 15:25:12 2014 New Revision: 26284 URL: http://svn.gna.org/viewcvs/freeciv?rev=26284view=rev Log: Added future tech handling See patch #5171 Modified: branches/S2_5/client/gui-qt/repodlgs.cpp Modified: branches/S2_5/client/gui-qt/repodlgs.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/repodlgs.cpp?rev=26284r1=26283r2=26284view=diff == --- branches/S2_5/client/gui-qt/repodlgs.cpp(original) +++ branches/S2_5/client/gui-qt/repodlgs.cppSun Sep 7 15:25:12 2014 @@ -307,9 +307,10 @@ /** set current tech and goal */ qres = research-researching; - - if (qres == A_UNSET) { -researching_combo-insertItem(0, _(None), A_UNSET); + if (qres == A_UNSET || is_future_tech(research-researching)) { +researching_combo-insertItem(0, research_advance_name_translation( + research, research-researching ), + A_UNSET); researching_combo-setCurrentIndex(0); } else { for (int i = 0; i researching_combo-count(); i++) { ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26285 - /branches/S2_5/client/gui-qt/
Author: mir3x Date: Sun Sep 7 15:41:48 2014 New Revision: 26285 URL: http://svn.gna.org/viewcvs/freeciv?rev=26285view=rev Log: added vote bar See patch #5163 Modified: branches/S2_5/client/gui-qt/Makefile.am branches/S2_5/client/gui-qt/fc_client.cpp branches/S2_5/client/gui-qt/fc_client.h branches/S2_5/client/gui-qt/mapview.cpp branches/S2_5/client/gui-qt/pages.cpp branches/S2_5/client/gui-qt/voteinfo_bar.cpp branches/S2_5/client/gui-qt/voteinfo_bar.h Modified: branches/S2_5/client/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/Makefile.am?rev=26285r1=26284r2=26285view=diff == --- branches/S2_5/client/gui-qt/Makefile.am (original) +++ branches/S2_5/client/gui-qt/Makefile.am Sun Sep 7 15:41:48 2014 @@ -28,7 +28,8 @@ meta_spaceshipdlg.cpp \ meta_messagewin.cpp \ meta_chatline.cpp \ - meta_messagedlg.cpp + meta_messagedlg.cpp \ + meta_voteinfo_bar.cpp libgui_qt_la_SOURCES = \ canvas.cpp \ Modified: branches/S2_5/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=26285r1=26284r2=26285view=diff == --- branches/S2_5/client/gui-qt/fc_client.cpp (original) +++ branches/S2_5/client/gui-qt/fc_client.cpp Sun Sep 7 15:41:48 2014 @@ -95,6 +95,8 @@ current_file = ; status_bar_queue.clear(); quitting = false; + pre_vote = NULL; + x_vote = NULL; for (int i = 0; i = PAGE_GGZ; i++) { pages_layout[i] = NULL; pages[i] = NULL; @@ -275,6 +277,8 @@ case PAGE_MAIN: break; case PAGE_START: +pre_vote-hide(); +voteinfo_gui_update(); break; case PAGE_LOAD: update_load_page(); @@ -289,6 +293,7 @@ main_window-menuBar()-setVisible(true); mapview_wdg-setFocus(); center_on_something(); +voteinfo_gui_update(); break; case PAGE_SCENARIO: update_scenarios_page(); Modified: branches/S2_5/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.h?rev=26285r1=26284r2=26285view=diff == --- branches/S2_5/client/gui-qt/fc_client.h (original) +++ branches/S2_5/client/gui-qt/fc_client.h Sun Sep 7 15:41:48 2014 @@ -54,6 +54,7 @@ #include menu.h #include pages.h #include ratesdlg.h +#include voteinfo_bar.h enum connection_state { LOGIN_TYPE, @@ -186,6 +187,8 @@ fc_game_tab_widget *game_tab_widget; messagewdg *msgwdg; info_tab *infotab; + pregamevote *pre_vote; + xvote *x_vote; QCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]; void gimme_place(QWidget* widget, QString str); int gimme_index_of(QString str); Modified: branches/S2_5/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapview.cpp?rev=26285r1=26284r2=26285view=diff == --- branches/S2_5/client/gui-qt/mapview.cpp (original) +++ branches/S2_5/client/gui-qt/mapview.cpp Sun Sep 7 15:41:48 2014 @@ -282,9 +282,10 @@ gui()-infotab-move(0 , size.height() - gui()-infotab-height()); gui()-unitinfo_wdg-move(width() - gui()-unitinfo_wdg-width(), 0); gui()-game_info_label-move(size.width() - -gui()-game_info_label-width(), + -gui()-game_info_label-width(), size.height() -gui()-game_info_label-height()); +gui()-x_vote-move(width() / 2 - gui()-x_vote-width() / 2, 0); } } Modified: branches/S2_5/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/pages.cpp?rev=26285r1=26284r2=26285view=diff == --- branches/S2_5/client/gui-qt/pages.cpp (original) +++ branches/S2_5/client/gui-qt/pages.cpp Sun Sep 7 15:41:48 2014 @@ -37,6 +37,7 @@ #include dialogs.h #include pages.h #include sprite.h +#include voteinfo_bar.h static struct server_scan *meta_scan, *lan_scan; static bool holding_srv_list_mutex = false; @@ -560,9 +561,11 @@ pages_layout[PAGE_START]-addWidget(but, 5, 7); QObject::connect(but, SIGNAL(clicked()), this, SLOT(slot_pregame_start())); - + pre_vote = new pregamevote; + + pages_layout[PAGE_START]-addWidget(pre_vote, 4, 0, 1, 4); pages_layout[PAGE_START]-addWidget(chat_line, 5, 0, 1, 3); - pages_layout[PAGE_START]-addWidget(output_window, 3, 0, 2, 8); + pages_layout[PAGE_START]-addWidget(output_window, 3, 0, 1, 8); connect(chat_line, SIGNAL(returnPressed()), this, SLOT(chat())); } @@ -592,6 +595,8 @@ game_info_label-show();
[Freeciv-commits] r26286 - in /trunk/client/gui-qt: Makefile.am fc_client.cpp fc_client.h mapview.cpp pages.cpp voteinfo_bar.cpp voteinfo_bar.h
Author: mir3x Date: Sun Sep 7 15:41:59 2014 New Revision: 26286 URL: http://svn.gna.org/viewcvs/freeciv?rev=26286view=rev Log: added vote bar See patch #5163 Modified: trunk/client/gui-qt/Makefile.am trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/fc_client.h trunk/client/gui-qt/mapview.cpp trunk/client/gui-qt/pages.cpp trunk/client/gui-qt/voteinfo_bar.cpp trunk/client/gui-qt/voteinfo_bar.h Modified: trunk/client/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/Makefile.am?rev=26286r1=26285r2=26286view=diff == --- trunk/client/gui-qt/Makefile.am (original) +++ trunk/client/gui-qt/Makefile.am Sun Sep 7 15:41:59 2014 @@ -28,7 +28,8 @@ meta_spaceshipdlg.cpp \ meta_messagewin.cpp \ meta_chatline.cpp \ - meta_messagedlg.cpp + meta_messagedlg.cpp \ + meta_voteinfo_bar.cpp libgui_qt_la_SOURCES = \ canvas.cpp \ Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=26286r1=26285r2=26286view=diff == --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Sun Sep 7 15:41:59 2014 @@ -90,6 +90,8 @@ current_file = ; status_bar_queue.clear(); quitting = false; + pre_vote = NULL; + x_vote = NULL; for (int i = 0; i = PAGE_GGZ; i++) { pages_layout[i] = NULL; pages[i] = NULL; @@ -270,6 +272,8 @@ case PAGE_MAIN: break; case PAGE_START: +pre_vote-hide(); +voteinfo_gui_update(); break; case PAGE_LOAD: update_load_page(); @@ -284,6 +288,7 @@ main_window-menuBar()-setVisible(true); mapview_wdg-setFocus(); center_on_something(); +voteinfo_gui_update(); break; case PAGE_SCENARIO: update_scenarios_page(); Modified: trunk/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.h?rev=26286r1=26285r2=26286view=diff == --- trunk/client/gui-qt/fc_client.h (original) +++ trunk/client/gui-qt/fc_client.h Sun Sep 7 15:41:59 2014 @@ -54,6 +54,7 @@ #include menu.h #include pages.h #include ratesdlg.h +#include voteinfo_bar.h enum connection_state { LOGIN_TYPE, @@ -182,6 +183,8 @@ fc_game_tab_widget *game_tab_widget; messagewdg *msgwdg; info_tab *infotab; + pregamevote *pre_vote; + xvote *x_vote; QCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]; void gimme_place(QWidget* widget, QString str); int gimme_index_of(QString str); Modified: trunk/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=26286r1=26285r2=26286view=diff == --- trunk/client/gui-qt/mapview.cpp (original) +++ trunk/client/gui-qt/mapview.cpp Sun Sep 7 15:41:59 2014 @@ -283,9 +283,10 @@ gui()-infotab-move(0 , size.height() - gui()-infotab-height()); gui()-unitinfo_wdg-move(width() - gui()-unitinfo_wdg-width(), 0); gui()-game_info_label-move(size.width() - -gui()-game_info_label-width(), + -gui()-game_info_label-width(), size.height() -gui()-game_info_label-height()); +gui()-x_vote-move(width() / 2 - gui()-x_vote-width() / 2, 0); } } Modified: trunk/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/pages.cpp?rev=26286r1=26285r2=26286view=diff == --- trunk/client/gui-qt/pages.cpp (original) +++ trunk/client/gui-qt/pages.cpp Sun Sep 7 15:41:59 2014 @@ -37,6 +37,7 @@ #include dialogs.h #include pages.h #include sprite.h +#include voteinfo_bar.h static struct server_scan *meta_scan, *lan_scan; static bool holding_srv_list_mutex = false; @@ -560,9 +561,11 @@ pages_layout[PAGE_START]-addWidget(but, 5, 7); QObject::connect(but, SIGNAL(clicked()), this, SLOT(slot_pregame_start())); - + pre_vote = new pregamevote; + + pages_layout[PAGE_START]-addWidget(pre_vote, 4, 0, 1, 4); pages_layout[PAGE_START]-addWidget(chat_line, 5, 0, 1, 3); - pages_layout[PAGE_START]-addWidget(output_window, 3, 0, 2, 8); + pages_layout[PAGE_START]-addWidget(output_window, 3, 0, 1, 8); connect(chat_line, SIGNAL(returnPressed()), this, SLOT(chat())); } @@ -592,6 +595,8 @@ game_info_label-show(); infotab = new info_tab(mapview_wdg); infotab-show(); + x_vote = new xvote(mapview_wdg); + x_vote-hide(); game_layout-addWidget(mapview_wdg, 1, 0); game_main_widget-setLayout(game_layout); Modified:
[Freeciv-commits] r26287 - /trunk/client/gui-qt/mapview.cpp
Author: mir3x Date: Sun Sep 7 15:44:54 2014 New Revision: 26287 URL: http://svn.gna.org/viewcvs/freeciv?rev=26287view=rev Log: If gold income was negative it was shown as +-X, instead just -X. See patch #5172 Modified: trunk/client/gui-qt/mapview.cpp Modified: trunk/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=26287r1=26286r2=26287view=diff == --- trunk/client/gui-qt/mapview.cpp (original) +++ trunk/client/gui-qt/mapview.cpp Sun Sep 7 15:44:54 2014 @@ -1180,15 +1180,21 @@ { QString eco_info; QString s = QString(_(%1 (Turn:%2))).arg(textyear(game.info.year), - QString::number(game.info.turn)); + QString::number(game.info.turn)); gui()-game_info_label-set_turn_info(s); set_indicator_icons(client_research_sprite(), client_warming_sprite(), client_cooling_sprite(), client_government_sprite()); if (client.conn.playing != NULL) { -eco_info = QString(_(Gold:%1 (+%2))) - .arg(QString::number(client.conn.playing-economic.gold), +if (player_get_expected_income(client.conn.playing) 0) { + eco_info = QString(_(Gold:%1 (+%2))) + .arg(QString::number(client.conn.playing-economic.gold), QString::number(player_get_expected_income(client.conn.playing))); +} else { + eco_info = QString(_(Gold:%1 (%2))) + .arg(QString::number(client.conn.playing-economic.gold), + QString::number(player_get_expected_income(client.conn.playing))); +} gui()-game_info_label-set_eco_info(eco_info); } gui()-game_info_label-set_rates_pixmap(); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26297 - /trunk/client/gui-qt/messagewin.cpp
Author: mir3x Date: Tue Sep 9 14:22:54 2014 New Revision: 26297 URL: http://svn.gna.org/viewcvs/freeciv?rev=26297view=rev Log: Added horizontal scrolling to messages widget Added restoring chat/message stretch factor after unhiding widget. See patch #5186 Modified: trunk/client/gui-qt/messagewin.cpp Modified: trunk/client/gui-qt/messagewin.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/messagewin.cpp?rev=26297r1=26296r2=26297view=diff == --- trunk/client/gui-qt/messagewin.cpp (original) +++ trunk/client/gui-qt/messagewin.cpp Tue Sep 9 14:22:54 2014 @@ -44,7 +44,7 @@ chat_button = new QPushButton; chat_button-setText(_(Chat)); hide_button = new QPushButton( -style()-standardIcon(QStyle::SP_TitleBarMinButton), ); + style()-standardIcon(QStyle::SP_TitleBarMinButton), ); layout-addWidget(hide_button, 1, 0, 1, 1); layout-addWidget(msg_button, 1, 1, 1, 4); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26301 - in /trunk/client/gui-qt: chatline.cpp chatline.h fc_client.cpp fc_client.h pages.cpp
Author: mir3x Date: Tue Sep 9 14:33:46 2014 New Revision: 26301 URL: http://svn.gna.org/viewcvs/freeciv?rev=26301view=rev Log: Chat update: Added chat autocompletion, history, links and colors. See patch #5200 Modified: trunk/client/gui-qt/chatline.cpp trunk/client/gui-qt/chatline.h trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/fc_client.h trunk/client/gui-qt/pages.cpp Modified: trunk/client/gui-qt/chatline.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/chatline.cpp?rev=26301r1=26300r2=26301view=diff == --- trunk/client/gui-qt/chatline.cpp(original) +++ trunk/client/gui-qt/chatline.cppTue Sep 9 14:33:46 2014 @@ -17,8 +17,11 @@ // client #include climisc.h /* for write_chatline_content */ +#include climap.h +#include game.h // gui-qt +#include colors.h #include fc_client.h #include qtg_cxxside.h @@ -32,6 +35,8 @@ chatwdg::chatwdg(QWidget *parent) { QVBoxLayout *vb; + QHBoxLayout *hl; + QSpacerItem *si; setStyleSheet(QTextEdit {background-color: transparent;} QTextEdit {color: #cdcead;} QTextEdit {background-attachment: fixed;} @@ -48,20 +53,34 @@ QCheckBox {color: #5d4e4d;}); setParent(parent); + si = new QSpacerItem(0,0,QSizePolicy::Expanding); cb = new QCheckBox(_(Allies only)); cb-setChecked(options.gui_qt_allied_chat_only); vb = new QVBoxLayout; + hl = new QHBoxLayout; chat_line = new QLineEdit; - chat_output = new QTextEdit; + chat_output = new QTextBrowser; + remove_links = new QPushButton(_(Clear links)); + remove_links-setStyleSheet(QPushButton {color: #5d4e4d;}); vb-addWidget(chat_output); - vb-addWidget(cb); + hl-addWidget(cb); + hl-addItem(si); + hl-addWidget(remove_links); + vb-addLayout(hl); vb-addWidget(chat_line); setLayout(vb); chat_output-setReadOnly(true); chat_line-setReadOnly(false); chat_line-setVisible(true); + chat_line-installEventFilter(this); chat_output-setVisible(true); + chat_output-setAcceptRichText(true); + chat_output-setOpenLinks(false); + chat_output-setReadOnly(true); + connect(chat_output, SIGNAL(anchorClicked(const QUrl)), + this, SLOT(anchor_clicked(const QUrl))); connect(chat_line, SIGNAL(returnPressed()), this, SLOT(send())); + connect(remove_links, SIGNAL(clicked()), this, SLOT(rm_links())); connect(cb, SIGNAL(stateChanged(int)), this, SLOT(state_changed(int))); } @@ -78,11 +97,73 @@ } /*** + User clicked clear links button +***/ +void chatwdg::rm_links() +{ + link_marks_clear_all(); +} + +/*** + User clicked some custom link +***/ +void chatwdg::anchor_clicked(const QUrl link) +{ + int n; + QStringList sl; + int id; + enum text_link_type type; + sl = link.toString().split(,); + n = sl.at(0).toInt(); + id = sl.at(1).toInt(); + + type = static_casttext_link_type(n); + struct tile *ptile = NULL; + switch (type) { + case TLT_CITY: { +struct city *pcity = game_city_by_number(id); + +if (pcity) { + ptile = client_city_tile(pcity); +} else { + output_window_append(ftc_client, _(This city isn't known!)); +} + } + break; + case TLT_TILE: +ptile = index_to_tile(id); + +if (!ptile) { + output_window_append(ftc_client, + _(This tile doesn't exist in this game!)); +} +break; + case TLT_UNIT: { +struct unit *punit = game_unit_by_number(id); + +if (punit) { + ptile = unit_tile(punit); +} else { + output_window_append(ftc_client, _(This unit isn't known!)); +} + } + break; + } + if (ptile) { +center_tile_mapcanvas(ptile); + link_mark_restore(type, id); + } +} + + +/*** Adds news string to chatwdg ***/ void chatwdg::append(QString str) { chat_output-append(str); + chat_output-ensureCursorVisible(); + chat_line-setCompleter(gui()-chat_completer); } /*** @@ -93,6 +174,7 @@ const char *theinput; theinput = chat_line-text().toUtf8().data(); + gui()-chat_history.prepend(chat_line-text()); if (*theinput) { if (client_state() == C_S_RUNNING options.gui_qt_allied_chat_only is_plain_public_message(theinput)) { @@ -127,6 +209,147 @@ painter.end(); } +/*** + Processess history for chat +***/ +bool
[Freeciv-commits] r26303 - in /trunk/client/gui-qt: fc_client.cpp fc_client.h mapview.cpp mapview.h
Author: mir3x Date: Tue Sep 9 14:42:04 2014 New Revision: 26303 URL: http://svn.gna.org/viewcvs/freeciv?rev=26303view=rev Log: Added some destructors to keep valgrind happier. See patch #5202 Modified: trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/fc_client.h trunk/client/gui-qt/mapview.cpp trunk/client/gui-qt/mapview.h Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=26303r1=26302r2=26303view=diff == --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Tue Sep 9 14:42:04 2014 @@ -166,6 +166,7 @@ connect(switch_page_mapper, SIGNAL(mapped( int)), this, SLOT(switch_page(int))); main_window-setVisible(true); + } / @@ -173,6 +174,8 @@ / fc_client::~fc_client() { + status_bar_queue.clear(); + fc_fonts.release_fonts(); delete main_window; } @@ -664,6 +667,16 @@ } / + Deletes all fonts +/ +void fc_font::release_fonts() +{ + foreach (QFont *f, font_map) { +delete f; + } +} + +/ Adds new font or overwrite old one / void fc_font::set_font(QString name, QFont * qf) Modified: trunk/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.h?rev=26303r1=26302r2=26303view=diff == --- trunk/client/gui-qt/fc_client.h (original) +++ trunk/client/gui-qt/fc_client.h Tue Sep 9 14:42:04 2014 @@ -96,6 +96,7 @@ void set_font(QString name, QFont *qf); QFont* get_font(QString name); void init_fonts(); + void release_fonts(); }; class fc_client : public QObject Modified: trunk/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=26303r1=26302r2=26303view=diff == --- trunk/client/gui-qt/mapview.cpp (original) +++ trunk/client/gui-qt/mapview.cpp Tue Sep 9 14:42:04 2014 @@ -395,6 +395,16 @@ cw-put_to_corner(); pix = new QPixmap; scale_factor = 1.0; +} + +/** + Minimap_view destructor +**/ +minimap_view::~minimap_view() +{ + if (pix) { +delete pix; + } } /** @@ -762,6 +772,17 @@ end_button_area.setWidth(0); rates_area.setWidth(0); indicator_area.setWidth(0); +} + +/** + Destructor for information label +**/ +info_label::~info_label() +{ + if (end_turn_pix) +delete end_turn_pix; + if (rates_label) +delete rates_label; } /** Modified: trunk/client/gui-qt/mapview.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.h?rev=26303r1=26302r2=26303view=diff == --- trunk/client/gui-qt/mapview.h (original) +++ trunk/client/gui-qt/mapview.h Tue Sep 9 14:42:04 2014 @@ -206,6 +206,7 @@ Q_OBJECT public: minimap_view(QWidget * parent); + ~minimap_view(); void paint(QPainter * painter, QPaintEvent * event); virtual void update_menu(); void update_image(); @@ -255,6 +256,7 @@ public: info_label(QWidget *parent); + ~info_label(); void set_turn_info(QString); void set_time_info(QString); void set_eco_info(QString); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26353 - in /trunk/client/gui-qt: citydlg.cpp citydlg.h gui_main.cpp
Author: mir3x Date: Thu Sep 11 10:30:06 2014 New Revision: 26353 URL: http://svn.gna.org/viewcvs/freeciv?rev=26353view=rev Log: Fixed labels not changing in governor tab, Added forced dialog close when city_label font is changed. (otherwise they wouldnt change soon, cause city dialog in most cases is rather hided, not destroyed) See patch #5208 Modified: trunk/client/gui-qt/citydlg.cpp trunk/client/gui-qt/citydlg.h trunk/client/gui-qt/gui_main.cpp [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/citydlg.cpp?rev=26353r1=26352r2=26353view=diff Modified: trunk/client/gui-qt/citydlg.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/citydlg.h?rev=26353r1=26352r2=26353view=diff Modified: trunk/client/gui-qt/gui_main.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/gui_main.cpp?rev=26353r1=26352r2=26353view=diff ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26354 - in /branches/S2_5/client/gui-qt: chatline.cpp chatline.h mapctrl.cpp
Author: mir3x Date: Thu Sep 11 10:35:51 2014 New Revision: 26354 URL: http://svn.gna.org/viewcvs/freeciv?rev=26354view=rev Log: Added possibility of creating links by ctrl+alt+rightClick on map. See patch #5210 Modified: branches/S2_5/client/gui-qt/chatline.cpp branches/S2_5/client/gui-qt/chatline.h branches/S2_5/client/gui-qt/mapctrl.cpp Modified: branches/S2_5/client/gui-qt/chatline.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/chatline.cpp?rev=26354r1=26353r2=26354view=diff == --- branches/S2_5/client/gui-qt/chatline.cpp(original) +++ branches/S2_5/client/gui-qt/chatline.cppThu Sep 11 10:35:51 2014 @@ -18,6 +18,7 @@ // client #include climisc.h /* for write_chatline_content */ #include climap.h +#include control.h #include game.h // gui-qt @@ -247,6 +248,26 @@ } /*** + Makes link to tile/unit or city +***/ +void chatwdg::make_link(struct tile *ptile) +{ + struct unit *punit; + char buf[MAX_LEN_MSG]; + + punit = find_visible_unit(ptile); + if (tile_city(ptile)) { +sz_strlcpy(buf, city_link(tile_city(ptile))); + } else if (punit) { +sz_strlcpy(buf, unit_link(punit)); + } else { +sz_strlcpy(buf, tile_link(ptile)); + } + chat_line-insert(QString(buf)); + chat_line-setFocus(); +} + +/*** Applies tags to text ***/ QString apply_tags(QString str, const struct text_tag_list *tags) Modified: branches/S2_5/client/gui-qt/chatline.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/chatline.h?rev=26354r1=26353r2=26354view=diff == --- branches/S2_5/client/gui-qt/chatline.h (original) +++ branches/S2_5/client/gui-qt/chatline.h Thu Sep 11 10:35:51 2014 @@ -40,6 +40,7 @@ chatwdg(QWidget *parent); void append(QString str); QLineEdit *chat_line; + void make_link(struct tile *ptile); private slots: void send(); void state_changed(int state); Modified: branches/S2_5/client/gui-qt/mapctrl.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapctrl.cpp?rev=26354r1=26353r2=26354view=diff == --- branches/S2_5/client/gui-qt/mapctrl.cpp (original) +++ branches/S2_5/client/gui-qt/mapctrl.cpp Thu Sep 11 10:35:51 2014 @@ -168,13 +168,31 @@ void map_view::mousePressEvent(QMouseEvent *event) { struct tile *ptile = NULL; + bool alt; + bool ctrl; QPoint pos; + alt = false; + ctrl = false; + + if (event-modifiers() Qt::AltModifier) { +alt = true; + } + if (event-modifiers() Qt::ControlModifier) { +ctrl = true; + } pos = gui()-mapview_wdg-mapFromGlobal(QCursor::pos()); if (event-button() == Qt::RightButton) { -recenter_button_pressed(event-x(), event-y()); -::gui()-minimapview_wdg-update_image(); +if (alt ctrl){ + ptile = canvas_pos_to_tile(pos.x(), pos.y()); + if (ptile) { +gui()-infotab-chtwdg-make_link(ptile); + } +} else { + recenter_button_pressed(event-x(), event-y()); + ::gui()-minimapview_wdg-update_image(); +} } /* Left Button */ ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26359 - in /trunk/client/gui-qt: Makefile.am fc_client.cpp fc_client.h gotodlg.cpp gotodlg.h menu.cpp menu.h pages.cpp
Author: mir3x Date: Fri Sep 12 10:10:51 2014 New Revision: 26359 URL: http://svn.gna.org/viewcvs/freeciv?rev=26359view=rev Log: Added goto/airlift widget See patch #5213 Modified: trunk/client/gui-qt/Makefile.am trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/fc_client.h trunk/client/gui-qt/gotodlg.cpp trunk/client/gui-qt/gotodlg.h trunk/client/gui-qt/menu.cpp trunk/client/gui-qt/menu.h trunk/client/gui-qt/pages.cpp Modified: trunk/client/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/Makefile.am?rev=26359r1=26358r2=26359view=diff == --- trunk/client/gui-qt/Makefile.am (original) +++ trunk/client/gui-qt/Makefile.am Fri Sep 12 10:10:51 2014 @@ -29,7 +29,8 @@ meta_messagewin.cpp \ meta_chatline.cpp \ meta_messagedlg.cpp \ - meta_voteinfo_bar.cpp + meta_voteinfo_bar.cpp \ + meta_gotodlg.cpp libgui_qt_la_SOURCES = \ canvas.cpp \ Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=26359r1=26358r2=26359view=diff == --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Fri Sep 12 10:10:51 2014 @@ -94,6 +94,7 @@ quitting = false; pre_vote = NULL; x_vote = NULL; + gtd = NULL; for (int i = 0; i = PAGE_GGZ; i++) { pages_layout[i] = NULL; pages[i] = NULL; Modified: trunk/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.h?rev=26359r1=26358r2=26359view=diff == --- trunk/client/gui-qt/fc_client.h (original) +++ trunk/client/gui-qt/fc_client.h Fri Sep 12 10:10:51 2014 @@ -49,6 +49,7 @@ #include canvas.h #include chatline.h #include dialogs.h +#include gotodlg.h #include mapview.h #include messagewin.h #include menu.h @@ -190,6 +191,7 @@ info_tab *infotab; pregamevote *pre_vote; xvote *x_vote; + goto_dialog *gtd; QCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]; void gimme_place(QWidget* widget, QString str); int gimme_index_of(QString str); Modified: trunk/client/gui-qt/gotodlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/gotodlg.cpp?rev=26359r1=26358r2=26359view=diff == --- trunk/client/gui-qt/gotodlg.cpp (original) +++ trunk/client/gui-qt/gotodlg.cpp Fri Sep 12 10:10:51 2014 @@ -1,4 +1,4 @@ -/** +/** Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,17 +15,353 @@ #include fc_config.h #endif +//qt +#include QApplication +#include QHeaderView +#include QTableWidget + /* common */ #include game.h /* client */ #include client_main.h #include control.h +#include goto.h +#include text.h // gui-qt +#include sprite.h #include qtg_cxxside.h - #include gotodlg.h + +/*** + Constructor for goto_dialog +***/ +goto_dialog::goto_dialog(QWidget *parent) +{ + QStringList headers_lst; + QHBoxLayout *hb; + setStyleSheet(QPushButton {background-color: transparent;} +QPushButton {color: #ff;} +QPushButton:enabled {color: #ff;} +QPushButton:disabled {color: grey;} +QPushButton:hover:disabled {color: transparent;} +QPushButton:hover {background-color: blue;} +QPushButton {min-width: 80px;} +QPushButton {border: noborder;} +QScrollBar:vertical +{border: 1px solid #90A4FF; background: transparent;} +QScrollBar::sub-line:vertical {width: 0px;height: 0px} +QScrollBar::sub-page:vertical {width: 0px;height: 0px} +QScrollBar::add-line:vertical {width: 0px;height: 0px} +QScrollBar::add-page:vertical {width: 0px;height: 0px} +QScrollBar::handle:vertical {background: #90A4FF; +min-height: 20px} +QTableWidget {background-color: transparent;} +QTableWidget:item {color: white;} +QTableCornerButton::section +{background-color: transparent;} +QLabel {color: grey;} +QHeaderView::section { background-color: +QColor(90,90,90,90);}); +
[Freeciv-commits] r26358 - in /branches/S2_5/client/gui-qt: Makefile.am fc_client.cpp fc_client.h gotodlg.cpp gotodlg.h menu.cpp menu.h pages.cpp
Author: mir3x Date: Fri Sep 12 10:10:41 2014 New Revision: 26358 URL: http://svn.gna.org/viewcvs/freeciv?rev=26358view=rev Log: Added goto/airlift widget See patch #5213 Modified: branches/S2_5/client/gui-qt/Makefile.am branches/S2_5/client/gui-qt/fc_client.cpp branches/S2_5/client/gui-qt/fc_client.h branches/S2_5/client/gui-qt/gotodlg.cpp branches/S2_5/client/gui-qt/gotodlg.h branches/S2_5/client/gui-qt/menu.cpp branches/S2_5/client/gui-qt/menu.h branches/S2_5/client/gui-qt/pages.cpp [This mail would be too long, it was shortened to contain the URLs only.] Modified: branches/S2_5/client/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/Makefile.am?rev=26358r1=26357r2=26358view=diff Modified: branches/S2_5/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=26358r1=26357r2=26358view=diff Modified: branches/S2_5/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.h?rev=26358r1=26357r2=26358view=diff Modified: branches/S2_5/client/gui-qt/gotodlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/gotodlg.cpp?rev=26358r1=26357r2=26358view=diff Modified: branches/S2_5/client/gui-qt/gotodlg.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/gotodlg.h?rev=26358r1=26357r2=26358view=diff Modified: branches/S2_5/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.cpp?rev=26358r1=26357r2=26358view=diff Modified: branches/S2_5/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.h?rev=26358r1=26357r2=26358view=diff Modified: branches/S2_5/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/pages.cpp?rev=26358r1=26357r2=26358view=diff ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26360 - /branches/S2_5/client/gui-qt/repodlgs.cpp
Author: mir3x Date: Fri Sep 12 10:14:42 2014 New Revision: 26360 URL: http://svn.gna.org/viewcvs/freeciv?rev=26360view=rev Log: Updated units report: - updated layout - added icons to units and buttons See patch #5215 Modified: branches/S2_5/client/gui-qt/repodlgs.cpp Modified: branches/S2_5/client/gui-qt/repodlgs.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/repodlgs.cpp?rev=26360r1=26359r2=26360view=diff == --- branches/S2_5/client/gui-qt/repodlgs.cpp(original) +++ branches/S2_5/client/gui-qt/repodlgs.cppFri Sep 12 10:14:42 2014 @@ -403,10 +403,18 @@ **/ units_report::units_report(): QWidget() { + QLabel *empty1, *empty2; + int len; + QGridLayout *units_layout= new QGridLayout; units_widget = new QTableWidget; - find_button = new QPushButton; - upgrade_button = new QPushButton; + find_button = new QPushButton(style()-standardIcon( + QStyle::SP_ToolBarHorizontalExtensionButton), + _(Find Nearest)); + upgrade_button = new QPushButton(style()-standardIcon( + QStyle::SP_FileDialogToParent),_(Upgrade)); + empty1 = new QLabel; + empty2 = new QLabel; QStringList slist; slist _(Unit Type) Q_(?Upgradable unit [short]:U) _(In-Prog) _(Active) _(Shield) _(Food) _(Gold); @@ -419,13 +427,17 @@ ResizeToContents); units_widget-verticalHeader()-setVisible(false); units_widget-setSelectionMode(QAbstractItemView::SingleSelection); - find_button-setText(_(Find _Nearest)); find_button-setEnabled(false); upgrade_button-setText(_(Upgrade)); upgrade_button-setEnabled(false); - units_layout-addWidget(units_widget, 1, 0, 5, 5); - units_layout-addWidget(find_button, 0, 0, 1, 1); - units_layout-addWidget(upgrade_button, 0, 1, 1, 1); + units_layout-addWidget(empty1, 0, 0, 1, 1); + units_layout-addWidget(units_widget, 0, 1, 1, 2); + units_layout-addWidget(find_button, 1, 2, 1, 1, Qt::AlignRight); + units_layout-addWidget(upgrade_button, 1, 1, 1, 1); + units_layout-addWidget(empty2, 0, 3, 1, 1); + units_layout-setColumnStretch(0, 1); + units_layout-setColumnStretch(1, 10); + units_layout-setColumnStretch(3, 1); connect(find_button, SIGNAL(pressed()), SLOT(find_units())); connect(upgrade_button, SIGNAL(pressed()), SLOT(upgrade_units())); @@ -435,6 +447,10 @@ SLOT(selection_changed(const QItemSelection , const QItemSelection ))); setLayout(units_layout); + len = units_widget-horizontalHeader()-length() + 3; + units_widget-setFixedWidth(len); + find_button-setFixedWidth(len / 3); + upgrade_button-setFixedWidth(len / 3); } @@ -476,6 +492,14 @@ struct urd_info unit_totals; struct urd_info *info; QVariant qvar; + QPixmap *pix; + QPixmap pix_scaled; + struct sprite *sprite; + QFont f = QApplication::font(); + int h; + int len; + QFontMetrics fm(f); + h = fm.height() + 6; units_widget-setRowCount(0); units_widget-clearContents(); @@ -520,13 +544,22 @@ units_widget-setRowCount(row + 1); for (column = 0; column 7; column++) { unit_item = new QTableWidgetItem; - unit_item-setTextAlignment(Qt::AlignHCenter); + unit_item-setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); switch (column) { case 0: unit_item-setTextAlignment(Qt::AlignLeft); unit_item-setText(utype_name_translation(utype)); qvar = utype_id; unit_item-setData(Qt::UserRole, qvar); +sprite = get_unittype_sprite(tileset, utype, direction8_invalid(), + true); +if (sprite != NULL) { + pix = sprite-pm; + pix_scaled = pix-scaledToHeight(h); +} else { + pix_scaled.fill(); +} +unit_item-setData(Qt::DecorationRole, pix_scaled); break; case 1: if ((client_has_player() @@ -535,6 +568,7 @@ } else { unit_item-setCheckState(Qt::Unchecked); } +unit_item-setFlags(Qt::ItemIsSelectable); break; case 2: unit_item-setText(QString::number(info-building_count)); @@ -575,6 +609,7 @@ break; case 1: unit_item-setCheckState(Qt::Unchecked); + unit_item-setFlags(Qt::ItemIsSelectable); break; case 2: unit_item-setText(QString::number(unit_totals.building_count)); @@ -594,7 +629,11 @@ } units_widget-setItem(row - 1, column, unit_item); } - units_widget-resizeRowsToContents(); + units_widget-resizeColumnsToContents(); + len = units_widget-horizontalHeader()-length() + 3; + units_widget-setFixedWidth(len); + find_button-setFixedWidth(len / 3); + upgrade_button-setFixedWidth(len / 3); max_row = row - 1; }
[Freeciv-commits] r26361 - /trunk/client/gui-qt/repodlgs.cpp
Author: mir3x Date: Fri Sep 12 10:15:21 2014 New Revision: 26361 URL: http://svn.gna.org/viewcvs/freeciv?rev=26361view=rev Log: Updated units report: - updated layout - added icons to units and buttons See patch #5215 Modified: trunk/client/gui-qt/repodlgs.cpp Modified: trunk/client/gui-qt/repodlgs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/repodlgs.cpp?rev=26361r1=26360r2=26361view=diff == --- trunk/client/gui-qt/repodlgs.cpp(original) +++ trunk/client/gui-qt/repodlgs.cppFri Sep 12 10:15:21 2014 @@ -404,10 +404,18 @@ **/ units_report::units_report(): QWidget() { + QLabel *empty1, *empty2; + int len; + QGridLayout *units_layout= new QGridLayout; units_widget = new QTableWidget; - find_button = new QPushButton; - upgrade_button = new QPushButton; + find_button = new QPushButton(style()-standardIcon( + QStyle::SP_ToolBarHorizontalExtensionButton), + _(Find Nearest)); + upgrade_button = new QPushButton(style()-standardIcon( + QStyle::SP_FileDialogToParent),_(Upgrade)); + empty1 = new QLabel; + empty2 = new QLabel; QStringList slist; slist _(Unit Type) Q_(?Upgradable unit [short]:U) _(In-Prog) _(Active) _(Shield) _(Food) _(Gold); @@ -420,13 +428,17 @@ ResizeToContents); units_widget-verticalHeader()-setVisible(false); units_widget-setSelectionMode(QAbstractItemView::SingleSelection); - find_button-setText(_(Find _Nearest)); find_button-setEnabled(false); upgrade_button-setText(_(Upgrade)); upgrade_button-setEnabled(false); - units_layout-addWidget(units_widget, 1, 0, 5, 5); - units_layout-addWidget(find_button, 0, 0, 1, 1); - units_layout-addWidget(upgrade_button, 0, 1, 1, 1); + units_layout-addWidget(empty1, 0, 0, 1, 1); + units_layout-addWidget(units_widget, 0, 1, 1, 2); + units_layout-addWidget(find_button, 1, 2, 1, 1, Qt::AlignRight); + units_layout-addWidget(upgrade_button, 1, 1, 1, 1); + units_layout-addWidget(empty2, 0, 3, 1, 1); + units_layout-setColumnStretch(0, 1); + units_layout-setColumnStretch(1, 10); + units_layout-setColumnStretch(3, 1); connect(find_button, SIGNAL(pressed()), SLOT(find_units())); connect(upgrade_button, SIGNAL(pressed()), SLOT(upgrade_units())); @@ -436,6 +448,10 @@ SLOT(selection_changed(const QItemSelection , const QItemSelection ))); setLayout(units_layout); + len = units_widget-horizontalHeader()-length() + 3; + units_widget-setFixedWidth(len); + find_button-setFixedWidth(len / 3); + upgrade_button-setFixedWidth(len / 3); } @@ -477,6 +493,14 @@ struct urd_info unit_totals; struct urd_info *info; QVariant qvar; + QPixmap *pix; + QPixmap pix_scaled; + struct sprite *sprite; + QFont f = QApplication::font(); + int h; + int len; + QFontMetrics fm(f); + h = fm.height() + 6; units_widget-setRowCount(0); units_widget-clearContents(); @@ -521,13 +545,22 @@ units_widget-setRowCount(row + 1); for (column = 0; column 7; column++) { unit_item = new QTableWidgetItem; - unit_item-setTextAlignment(Qt::AlignHCenter); + unit_item-setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); switch (column) { case 0: unit_item-setTextAlignment(Qt::AlignLeft); unit_item-setText(utype_name_translation(utype)); qvar = utype_id; unit_item-setData(Qt::UserRole, qvar); +sprite = get_unittype_sprite(tileset, utype, direction8_invalid(), + true); +if (sprite != NULL) { + pix = sprite-pm; + pix_scaled = pix-scaledToHeight(h); +} else { + pix_scaled.fill(); +} +unit_item-setData(Qt::DecorationRole, pix_scaled); break; case 1: if ((client_has_player() @@ -536,6 +569,7 @@ } else { unit_item-setCheckState(Qt::Unchecked); } +unit_item-setFlags(Qt::ItemIsSelectable); break; case 2: unit_item-setText(QString::number(info-building_count)); @@ -576,6 +610,7 @@ break; case 1: unit_item-setCheckState(Qt::Unchecked); + unit_item-setFlags(Qt::ItemIsSelectable); break; case 2: unit_item-setText(QString::number(unit_totals.building_count)); @@ -595,7 +630,11 @@ } units_widget-setItem(row - 1, column, unit_item); } - units_widget-resizeRowsToContents(); + units_widget-resizeColumnsToContents(); + len = units_widget-horizontalHeader()-length() + 3; + units_widget-setFixedWidth(len); + find_button-setFixedWidth(len / 3); + upgrade_button-setFixedWidth(len / 3); max_row = row - 1; }
[Freeciv-commits] r26362 - /branches/S2_5/client/gui-qt/chatline.cpp
Author: mir3x Date: Fri Sep 12 10:19:37 2014 New Revision: 26362 URL: http://svn.gna.org/viewcvs/freeciv?rev=26362view=rev Log: Fixed some characters wrongly displayed in chat widget. See patch #5216 Modified: branches/S2_5/client/gui-qt/chatline.cpp Modified: branches/S2_5/client/gui-qt/chatline.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/chatline.cpp?rev=26362r1=26361r2=26362view=diff == --- branches/S2_5/client/gui-qt/chatline.cpp(original) +++ branches/S2_5/client/gui-qt/chatline.cppFri Sep 12 10:19:37 2014 @@ -152,8 +152,8 @@ break; } if (ptile) { -center_tile_mapcanvas(ptile); - link_mark_restore(type, id); +center_tile_mapcanvas(ptile); +link_mark_restore(type, id); } } @@ -278,7 +278,7 @@ QString color; QColor qc; QMultiMap int, QString mm; - qba = str.toLocal8Bit(); + qba = str.toUtf8(); if (tags == NULL) { return str; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26363 - /trunk/client/gui-qt/chatline.cpp
Author: mir3x Date: Fri Sep 12 10:20:06 2014 New Revision: 26363 URL: http://svn.gna.org/viewcvs/freeciv?rev=26363view=rev Log: Fixed some characters wrongly displayed in chat widget. See patch #5216 Modified: trunk/client/gui-qt/chatline.cpp Modified: trunk/client/gui-qt/chatline.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/chatline.cpp?rev=26363r1=26362r2=26363view=diff == --- trunk/client/gui-qt/chatline.cpp(original) +++ trunk/client/gui-qt/chatline.cppFri Sep 12 10:20:06 2014 @@ -151,8 +151,8 @@ break; } if (ptile) { -center_tile_mapcanvas(ptile); - link_mark_restore(type, id); +center_tile_mapcanvas(ptile); +link_mark_restore(type, id); } } @@ -277,7 +277,7 @@ QString color; QColor qc; QMultiMap int, QString mm; - qba = str.toLocal8Bit(); + qba = str.toUtf8(); if (tags == NULL) { return str; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26414 - /branches/S2_5/client/gui-qt/citydlg.cpp
Author: mir3x Date: Sun Sep 14 20:08:03 2014 New Revision: 26414 URL: http://svn.gna.org/viewcvs/freeciv?rev=26414view=rev Log: If there is no item selected on worklist, then it will be assumed its first item. See patch #5219 Modified: branches/S2_5/client/gui-qt/citydlg.cpp Modified: branches/S2_5/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/citydlg.cpp?rev=26414r1=26413r2=26414view=diff == --- branches/S2_5/client/gui-qt/citydlg.cpp (original) +++ branches/S2_5/client/gui-qt/citydlg.cpp Sun Sep 14 20:08:03 2014 @@ -2861,7 +2861,7 @@ break; case 1: /* Change current (selected on list)*/ if (curr_selection 0 || curr_selection worklist_length(queue)) { -return; +curr_selection = 0; } worklist_remove(queue, curr_selection); worklist_insert(queue, *target, curr_selection); @@ -2869,7 +2869,7 @@ break; case 2: /* Insert before */ if (curr_selection 0 || curr_selection worklist_length(queue)) { -return; +curr_selection = 0; } curr_selection--; curr_selection = qMax(0, curr_selection); @@ -2878,7 +2878,7 @@ break; case 3: /* Insert after */ if (curr_selection 0 || curr_selection worklist_length(queue)) { -return; +curr_selection = 0; } curr_selection++; worklist_insert(queue, *target, curr_selection); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26413 - /trunk/client/gui-qt/citydlg.cpp
Author: mir3x Date: Sun Sep 14 20:07:51 2014 New Revision: 26413 URL: http://svn.gna.org/viewcvs/freeciv?rev=26413view=rev Log: If there is no item selected on worklist, then it will be assumed its first item. See patch #5219 Modified: trunk/client/gui-qt/citydlg.cpp Modified: trunk/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/citydlg.cpp?rev=26413r1=26412r2=26413view=diff == --- trunk/client/gui-qt/citydlg.cpp (original) +++ trunk/client/gui-qt/citydlg.cpp Sun Sep 14 20:07:51 2014 @@ -2854,7 +2854,7 @@ break; case 1: /* Change current (selected on list)*/ if (curr_selection 0 || curr_selection worklist_length(queue)) { -return; +curr_selection = 0; } worklist_remove(queue, curr_selection); worklist_insert(queue, *target, curr_selection); @@ -2862,7 +2862,7 @@ break; case 2: /* Insert before */ if (curr_selection 0 || curr_selection worklist_length(queue)) { -return; +curr_selection = 0; } curr_selection--; curr_selection = qMax(0, curr_selection); @@ -2871,7 +2871,7 @@ break; case 3: /* Insert after */ if (curr_selection 0 || curr_selection worklist_length(queue)) { -return; +curr_selection = 0; } curr_selection++; worklist_insert(queue, *target, curr_selection); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26415 - /trunk/client/gui-qt/plrdlg.cpp
Author: mir3x Date: Sun Sep 14 20:10:27 2014 New Revision: 26415 URL: http://svn.gna.org/viewcvs/freeciv?rev=26415view=rev Log: Fixed crash when global observing tried to check technologies Added sorting technologies See patch #5220 Modified: trunk/client/gui-qt/plrdlg.cpp Modified: trunk/client/gui-qt/plrdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/plrdlg.cpp?rev=26415r1=26414r2=26415view=diff == --- trunk/client/gui-qt/plrdlg.cpp (original) +++ trunk/client/gui-qt/plrdlg.cpp Sun Sep 14 20:10:27 2014 @@ -364,6 +364,8 @@ QString res; QString sp = ; QString nl = br; + QStringList sorted_list_a; + QStringList sorted_list_b; struct player *pplayer; int a , b; bool added; @@ -410,7 +412,7 @@ + QString(nation_adjective_for_player(pplayer)) + QString(/tdtrtdb) + N_(Ruler:) + QString(/b/tdtd) + QString(ruler_title_for_player(pplayer, tbuf, sizeof(tbuf))) -+ QString(/td/trtrtdb) + N_(Government:) ++ QString(/td/trtrtdb) + N_(Government:) + QString(/b/tdtd) + QString(government_name_for_player(pplayer)) + QString(/td/trtrtdb) + N_(Capital:) + QString(/b/tdtd) @@ -455,46 +457,68 @@ } me = client_player(); my_research = research_get(me); - if ((player_has_embassy(me, pplayer) || client_is_global_observer()) - me != pplayer) { -a = 0; -b = 0; -techs_known = QString(_(bTechs unknown by %1:/b)). + if (!client_is_global_observer()) { +if (player_has_embassy(me, pplayer) me != pplayer) { + a = 0; + b = 0; + techs_known = QString(_(bTechs unknown by %1:/b)). arg(nation_plural_for_player(pplayer)); -techs_unknown = QString(_(bTechs unknown by you :/b)); - + techs_unknown = QString(_(bTechs unknown by you :/b)); + + advance_iterate(A_FIRST, padvance) { +tech_id = advance_number(padvance); +if (research_invention_state(my_research, tech_id) == TECH_KNOWN + (research_invention_state(research, tech_id) +== TECH_UNKNOWN)) { + a++; + sorted_list_a research_advance_name_translation(research, + tech_id); +} +if (research_invention_state(my_research, tech_id) == TECH_UNKNOWN + (research_invention_state(research, tech_id) == TECH_KNOWN)) { + b++; + sorted_list_b research_advance_name_translation(research, + tech_id); +} + } advance_iterate_end; + sorted_list_a.sort(Qt::CaseInsensitive); + sorted_list_b.sort(Qt::CaseInsensitive); + foreach (res, sorted_list_a) { +techs_known = techs_known + QString(i) + res + , + + QString(/i) + sp; + } + foreach (res, sorted_list_b) { +techs_unknown = techs_unknown + QString(i) + res + , ++ QString(/i) + sp; + } + if (a == 0) { +techs_known = techs_known + QString(i) + sp + + QString(_(None)) + QString(/i); + } else { +techs_known.replace(techs_known.lastIndexOf(,), 1, .); + } + if (b == 0) { +techs_unknown = techs_unknown + QString(i) + sp ++ QString(_(None)) + QString(/i); + } else { +techs_unknown.replace(techs_unknown.lastIndexOf(,), 1, .); + } + tech_str = techs_known + nl + techs_unknown; +} + } else { +tech_str = QString(_(bTechs known by %1:/b)). + arg(nation_plural_for_player(pplayer)); advance_iterate(A_FIRST, padvance) { tech_id = advance_number(padvance); - if (research_invention_state(my_research, tech_id) == TECH_KNOWN - (research_invention_state(research, tech_id) == TECH_UNKNOWN)) { -a++; -techs_known = techs_known + QString(i) - + research_advance_name_translation(research, tech_id) - + , + QString(/i) + sp; - } - if (research_invention_state(my_research, tech_id) == TECH_UNKNOWN - (research_invention_state(research, tech_id) == TECH_KNOWN)) { -b++; -techs_unknown = techs_unknown + QString(i) -+ research_advance_name_translation(research, -tech_id) -+ , + QString(/i) + sp; + if (research_invention_state(research, tech_id) == TECH_KNOWN) { +sorted_list_a research_advance_name_translation(research, tech_id); } } advance_iterate_end; - -if (a == 0) { - techs_known = techs_known + QString(i) + sp -+ QString(_(None)) + QString(/i); -} else { - techs_known.replace(techs_known.lastIndexOf(,), 1, .); -} -if (b == 0) { - techs_unknown = techs_unknown + QString(i) + sp -
[Freeciv-commits] r26416 - /branches/S2_5/client/gui-qt/plrdlg.cpp
Author: mir3x Date: Sun Sep 14 20:10:39 2014 New Revision: 26416 URL: http://svn.gna.org/viewcvs/freeciv?rev=26416view=rev Log: Fixed crash when global observing tried to check technologies Added sorting technologies See patch #5220 Modified: branches/S2_5/client/gui-qt/plrdlg.cpp Modified: branches/S2_5/client/gui-qt/plrdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/plrdlg.cpp?rev=26416r1=26415r2=26416view=diff == --- branches/S2_5/client/gui-qt/plrdlg.cpp (original) +++ branches/S2_5/client/gui-qt/plrdlg.cpp Sun Sep 14 20:10:39 2014 @@ -364,6 +364,8 @@ QString res; QString sp = ; QString nl = br; + QStringList sorted_list_a; + QStringList sorted_list_b; struct player *pplayer; int a , b; bool added; @@ -409,7 +411,7 @@ + QString(nation_adjective_for_player(pplayer)) + QString(/tdtrtdb) + N_(Ruler:) + QString(/b/tdtd) + QString(ruler_title_for_player(pplayer, tbuf, sizeof(tbuf))) -+ QString(/td/trtrtdb) + N_(Government:) ++ QString(/td/trtrtdb) + N_(Government:) + QString(/b/tdtd) + QString(government_name_for_player(pplayer)) + QString(/td/trtrtdb) + N_(Capital:) + QString(/b/tdtd) @@ -439,8 +441,8 @@ if (static_castint(state-type) == i) { if (added == false) { ally_str = ally_str + QString(b) - + QString(diplstate_text(static_castdiplstate_type(i))) - + : + QString(/b) + nl; + + QString(diplstate_text(static_castdiplstate_type(i))) + + : + QString(/b) + nl; added = true; } ally_str = ally_str + nation_plural_for_player(other) + , ; @@ -452,45 +454,63 @@ } } me = client_player(); - if ((player_has_embassy(me, pplayer) || client_is_global_observer()) - me != pplayer) { -a = 0; -b = 0; -techs_known = QString(_(bTechs unknown by %1:/b)). + if (!client_is_global_observer()) { +if (player_has_embassy(me, pplayer) me != pplayer) { + a = 0; + b = 0; + techs_known = QString(_(bTechs unknown by %1:/b)). arg(nation_plural_for_player(pplayer)); -techs_unknown = QString(_(bTechs unknown by you :/b)); - + techs_unknown = QString(_(bTechs unknown by you :/b)); + + advance_iterate(A_FIRST, padvance) { +tech_id = advance_number(padvance); +if (player_invention_state(me, tech_id) == TECH_KNOWN + (player_invention_state(pplayer, tech_id) == TECH_UNKNOWN)) { + a++; + sorted_list_a advance_name_for_player(pplayer, tech_id); +} +if (player_invention_state(me, tech_id) == TECH_UNKNOWN + (player_invention_state(pplayer, tech_id) == TECH_KNOWN)) { + b++; + sorted_list_b advance_name_for_player(pplayer, tech_id); +} + } advance_iterate_end; + sorted_list_a.sort(Qt::CaseInsensitive); + sorted_list_b.sort(Qt::CaseInsensitive); + foreach (res, sorted_list_a) { +techs_known = techs_known + QString(i) + res + , + + QString(/i) + sp; + } + foreach (res, sorted_list_b) { +techs_unknown = techs_unknown + QString(i) + res + , ++ QString(/i) + sp; + } + if (a == 0) { +techs_known = techs_known + QString(i) + sp + + QString(_(None)) + QString(/i); + } else { +techs_known.replace(techs_known.lastIndexOf(,), 1, .); + } + if (b == 0) { +techs_unknown = techs_unknown + QString(i) + sp ++ QString(_(None)) + QString(/i); + } else { +techs_unknown.replace(techs_unknown.lastIndexOf(,), 1, .); + } + tech_str = techs_known + nl + techs_unknown; +} + } else { +tech_str = QString(_(bTechs known by %1:/b)). + arg(nation_plural_for_player(pplayer)); advance_iterate(A_FIRST, padvance) { tech_id = advance_number(padvance); - if (player_invention_state(me, tech_id) == TECH_KNOWN - (player_invention_state(pplayer, tech_id) == TECH_UNKNOWN)) { -a++; -techs_known = techs_known + QString(i) - + advance_name_for_player(pplayer, tech_id) - + , + QString(/i) + sp; - } - if (player_invention_state(me, tech_id) == TECH_UNKNOWN - (player_invention_state(pplayer, tech_id) == TECH_KNOWN)) { -b++; -techs_unknown = techs_unknown + QString(i) -+ advance_name_for_player(pplayer, tech_id) -+ , + QString(/i) + sp; - } + sorted_list_a advance_name_for_player(pplayer, tech_id); } advance_iterate_end; - -if (a == 0) { - techs_known = techs_known + QString(i) + sp -+ QString(_(None)) + QString(/i); -} else { -
[Freeciv-commits] r26418 - /trunk/client/gui-qt/repodlgs.cpp
Author: mir3x Date: Sun Sep 14 20:13:21 2014 New Revision: 26418 URL: http://svn.gna.org/viewcvs/freeciv?rev=26418view=rev Log: Prevented observer changing current/goal technology. See patch #5221 Modified: trunk/client/gui-qt/repodlgs.cpp Modified: trunk/client/gui-qt/repodlgs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/repodlgs.cpp?rev=26418r1=26417r2=26418view=diff == --- trunk/client/gui-qt/repodlgs.cpp(original) +++ trunk/client/gui-qt/repodlgs.cppSun Sep 14 20:13:21 2014 @@ -340,6 +340,13 @@ researching_combo-blockSignals(false); goal_combo-blockSignals(false); + if (client_is_observer()) { +researching_combo-setDisabled(true); +goal_combo-setDisabled(true); + } else { +researching_combo-setDisabled(false); +goal_combo-setDisabled(false); + } update_reqtree(); } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26420 - /branches/S2_5/client/gui-qt/chatline.cpp
Author: mir3x Date: Sun Sep 14 20:16:14 2014 New Revision: 26420 URL: http://svn.gna.org/viewcvs/freeciv?rev=26420view=rev Log: replace fake html tags like (X) or X to [(X)] or [X] See patch #5222 Modified: branches/S2_5/client/gui-qt/chatline.cpp Modified: branches/S2_5/client/gui-qt/chatline.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/chatline.cpp?rev=26420r1=26419r2=26420view=diff == --- branches/S2_5/client/gui-qt/chatline.cpp(original) +++ branches/S2_5/client/gui-qt/chatline.cppSun Sep 14 20:16:14 2014 @@ -30,7 +30,7 @@ static bool gui_qt_allied_chat_only = false; static bool is_plain_public_message(const char *s); - +static QString replace_html(QString str); /*** Constructor for chatwdg ***/ @@ -373,6 +373,47 @@ } /** + Replace HTML tags first or it will be cut + Replace player + Replace (player) +**/ +static QString replace_html(QString str) +{ + QString s, s2; + conn_list_iterate(game.all_connections, pconn){ +s = pconn-username; +s = ( + s + ); +if (str.contains(s)) { + s2 = ([ + QString(pconn-username) + )]; + str = str.replace(s, s2); + break; +} +s = pconn-username; +s = + s + ; +if (str.contains(s)) { + s2 = [ + QString(pconn-username) + ]; + str = str.replace(s, s2); +} + } conn_list_iterate_end; + players_iterate(pplayer) { +s = pplayer-name; +s = ( + s + ); +if (str.contains(s)) { + s2 = ([ + QString(pplayer-name) + )]; + str = str.replace(s, s2); + break; +} +s = pplayer-name; +s = + s + ; +if (str.contains(s)) { + s2 = [ + QString(pplayer-name) + ]; + str = str.replace(s, s2); +} + } players_iterate_end; + return str; +} + +/** Helper function to determine if a given client input line is intended as a plain public message. **/ @@ -413,24 +454,11 @@ int conn_id) { QString str; - QString s, s2; str = QString::fromUtf8(astring); gui()-set_status_bar(str); gui()-update_completer(); - /* Replace HTML tags first or it will be cut - Replace player - */ - players_iterate(pplayer) { -s = pplayer-name; -s = + s + ; -if (str.contains(s)) { - s2 = [ + QString(pplayer-name) + ]; - str = str.replace(s, s2); -} - - } players_iterate_end; - + str = replace_html(str); str = apply_tags(str, tags); gui()-append_output_window(str); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26419 - /trunk/client/gui-qt/chatline.cpp
Author: mir3x Date: Sun Sep 14 20:16:01 2014 New Revision: 26419 URL: http://svn.gna.org/viewcvs/freeciv?rev=26419view=rev Log: replace fake html tags like (X) or X to [(X)] or [X] See patch #5222 Modified: trunk/client/gui-qt/chatline.cpp Modified: trunk/client/gui-qt/chatline.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/chatline.cpp?rev=26419r1=26418r2=26419view=diff == --- trunk/client/gui-qt/chatline.cpp(original) +++ trunk/client/gui-qt/chatline.cppSun Sep 14 20:16:01 2014 @@ -29,7 +29,7 @@ #include chatline.h static bool is_plain_public_message(const char *s); - +static QString replace_html(QString str); /*** Constructor for chatwdg ***/ @@ -372,6 +372,47 @@ } /** + Replace HTML tags first or it will be cut + Replace player + Replace (player) +**/ +static QString replace_html(QString str) +{ + QString s, s2; + conn_list_iterate(game.all_connections, pconn){ +s = pconn-username; +s = ( + s + ); +if (str.contains(s)) { + s2 = ([ + QString(pconn-username) + )]; + str = str.replace(s, s2); + break; +} +s = pconn-username; +s = + s + ; +if (str.contains(s)) { + s2 = [ + QString(pconn-username) + ]; + str = str.replace(s, s2); +} + } conn_list_iterate_end; + players_iterate(pplayer) { +s = pplayer-name; +s = ( + s + ); +if (str.contains(s)) { + s2 = ([ + QString(pplayer-name) + )]; + str = str.replace(s, s2); + break; +} +s = pplayer-name; +s = + s + ; +if (str.contains(s)) { + s2 = [ + QString(pplayer-name) + ]; + str = str.replace(s, s2); +} + } players_iterate_end; + return str; +} + +/** Helper function to determine if a given client input line is intended as a plain public message. **/ @@ -412,24 +453,11 @@ int conn_id) { QString str; - QString s, s2; str = QString::fromUtf8(astring); gui()-set_status_bar(str); gui()-update_completer(); - /* Replace HTML tags first or it will be cut - Replace player - */ - players_iterate(pplayer) { -s = pplayer-name; -s = + s + ; -if (str.contains(s)) { - s2 = [ + QString(pplayer-name) + ]; - str = str.replace(s, s2); -} - - } players_iterate_end; - + str = replace_html(str); str = apply_tags(str, tags); gui()-append_output_window(str); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26422 - in /branches/S2_5/client/gui-qt: chatline.cpp messagewin.cpp
Author: mir3x Date: Sun Sep 14 20:18:42 2014 New Revision: 26422 URL: http://svn.gna.org/viewcvs/freeciv?rev=26422view=rev Log: Forced default (fusion) style in chat and messages See patch #5223 Modified: branches/S2_5/client/gui-qt/chatline.cpp branches/S2_5/client/gui-qt/messagewin.cpp Modified: branches/S2_5/client/gui-qt/chatline.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/chatline.cpp?rev=26422r1=26421r2=26422view=diff == --- branches/S2_5/client/gui-qt/chatline.cpp(original) +++ branches/S2_5/client/gui-qt/chatline.cppSun Sep 14 20:18:42 2014 @@ -15,6 +15,9 @@ #include fc_config.h #endif +//Qt +#include QStyleFactory + // client #include climisc.h /* for write_chatline_content */ #include climap.h @@ -39,6 +42,7 @@ QVBoxLayout *vb; QHBoxLayout *hl; QSpacerItem *si; + setStyle(QStyleFactory::create(fusion)); setStyleSheet(QTextEdit {background-color: transparent;} QTextEdit {color: #cdcead;} QTextEdit {background-attachment: fixed;} Modified: branches/S2_5/client/gui-qt/messagewin.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/messagewin.cpp?rev=26422r1=26421r2=26422view=diff == --- branches/S2_5/client/gui-qt/messagewin.cpp (original) +++ branches/S2_5/client/gui-qt/messagewin.cpp Sun Sep 14 20:18:42 2014 @@ -18,6 +18,7 @@ // Qt #include QApplication #include QHeaderView +#include QStyleFactory // gui-qt #include fc_client.h @@ -317,6 +318,7 @@ { QPalette palette; layout = new QGridLayout; + setStyle(QStyleFactory::create(fusion)); setStyleSheet(QScrollBar:vertical {border: 1px solid #90A4FF; background: transparent;} QScrollBar::sub-line:vertical {width: 0px;height: 0px} ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26481 - in /branches/S2_5/client/gui-qt: citydlg.cpp citydlg.h
Author: mir3x Date: Wed Sep 17 09:40:27 2014 New Revision: 26481 URL: http://svn.gna.org/viewcvs/freeciv?rev=26481view=rev Log: Fixed double refresh of current and supported units Patched some memory leaks. See patch #5237 Modified: branches/S2_5/client/gui-qt/citydlg.cpp branches/S2_5/client/gui-qt/citydlg.h Modified: branches/S2_5/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/citydlg.cpp?rev=26481r1=26480r2=26481view=diff == --- branches/S2_5/client/gui-qt/citydlg.cpp (original) +++ branches/S2_5/client/gui-qt/citydlg.cpp Wed Sep 17 09:40:27 2014 @@ -77,8 +77,10 @@ / Class representing one unit, allows context menu, holds pixmap for it / -unit_item::unit_item(struct unit *punit, bool supp, int hppy_cost) : QLabel() -{ +unit_item::unit_item(QWidget *parent, struct unit *punit, + bool supp, int hppy_cost) : QLabel() +{ + setParent(parent); happy_cost = hppy_cost; supported = supp; unit_pixmap = NULL; @@ -402,9 +404,10 @@ / Class representing list of units ( unit_item 's) / -unit_info::unit_info(bool supp) : QWidget() -{ - layout = new QHBoxLayout; +unit_info::unit_info(QWidget *parent, bool supp) : QWidget() +{ + setParent(parent); + layout = new QHBoxLayout(this); init_layout(); supports = supp; } @@ -449,12 +452,16 @@ int i = unit_list.count(); int j; unit_item *ui; + setUpdatesEnabled(false); + hide(); for (j = 0; j i; j++) { ui = unit_list[j]; layout-addWidget(ui, 0, Qt::AlignVCenter); } + show(); setUpdatesEnabled(true); + layout-update(); } / @@ -465,7 +472,7 @@ int i = unit_list.count(); unit_item *ui; int j; - + setUpdatesEnabled(false); setMouseTracking(false); for (j = 0; j i; j++) { ui = unit_list[j]; @@ -476,7 +483,7 @@ unit_list.removeFirst(); } setMouseTracking(true); - + setUpdatesEnabled(true); } / @@ -681,9 +688,9 @@ /** Overview tab initiazlization */ { -QGroupBox *map_box = new QGroupBox; +QGroupBox *map_box = new QGroupBox(this); QVBoxLayout *v_layout = new QVBoxLayout; -QGroupBox *prod_box = new QGroupBox; +QGroupBox *prod_box = new QGroupBox(this); QGridLayout *prod_layout = new QGridLayout; QScrollArea *scroll; QScrollArea *scroll2; @@ -735,7 +742,7 @@ production_combo-setMinimumWidth(200); connect(production_table, SIGNAL(itemDoubleClicked(QTableWidgetItem *)), SLOT(dbl_click(QTableWidgetItem *))); -citizens_label = new city_label(FEELING_FINAL); +citizens_label = new city_label(FEELING_FINAL, this); citizen_pixmap = NULL; view = new city_map(this); v_layout-addWidget(view); @@ -743,13 +750,13 @@ map_box-setTitle(_(City map)); supp_units = new QLabel(); curr_units = new QLabel(); -supported_units = new unit_info(true); +supported_units = new unit_info(this, true); scroll = new QScrollArea; scroll-setWidgetResizable(true); scroll-setMaximumHeight(tileset_tile_height(tileset) * 2); scroll-setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); scroll-setWidget(supported_units); -current_units = new unit_info(false); +current_units = new unit_info(this, false); scroll2 = new QScrollArea; scroll2-setWidgetResizable(true); scroll2-setMaximumHeight(tileset_tile_height(tileset) * 2); @@ -929,9 +936,9 @@ N_(Nationality:) N_(Units:) N_(Wonders:); info_nr = info_list.count(); for (int i = 0; i info_list.count(); i++) { - lab_table[i] = new city_label(1 + i); + lab_table[i] = new city_label(1 + i, this); gridl-addWidget(lab_table[i], i, 1, 1, 1); - lab2 = new QLabel; + lab2 = new QLabel(this); lab2-setFont(*small_font); lab2-setAlignment(Qt::AlignRight | Qt::AlignVCenter); lab2-setText(info_list.at(i)); @@ -978,12 +985,8 @@ cma_table-setSelectionMode(QAbstractItemView::SingleSelection); cma_table-verticalHeader()-setVisible(false); cma_table-horizontalHeader()-setVisible(false); -#if QT_VERSION = QT_VERSION_CHECK(5, 0, 0) cma_table-horizontalHeader()-setSectionResizeMode( QHeaderView::Stretch); -#else -cma_table-horizontalHeader()-setResizeMode(QHeaderView::Stretch); -#endif connect(cma_table-selectionModel(), SIGNAL(selectionChanged(const
[Freeciv-commits] r26480 - in /trunk/client/gui-qt: citydlg.cpp citydlg.h
Author: mir3x Date: Wed Sep 17 09:40:18 2014 New Revision: 26480 URL: http://svn.gna.org/viewcvs/freeciv?rev=26480view=rev Log: Fixed double refresh of current and supported units Patched some memory leaks. See patch #5237 Modified: trunk/client/gui-qt/citydlg.cpp trunk/client/gui-qt/citydlg.h Modified: trunk/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/citydlg.cpp?rev=26480r1=26479r2=26480view=diff == --- trunk/client/gui-qt/citydlg.cpp (original) +++ trunk/client/gui-qt/citydlg.cpp Wed Sep 17 09:40:18 2014 @@ -77,8 +77,10 @@ / Class representing one unit, allows context menu, holds pixmap for it / -unit_item::unit_item(struct unit *punit, bool supp, int hppy_cost) : QLabel() -{ +unit_item::unit_item(QWidget *parent, struct unit *punit, + bool supp, int hppy_cost) : QLabel() +{ + setParent(parent); happy_cost = hppy_cost; supported = supp; unit_pixmap = NULL; @@ -401,9 +403,10 @@ / Class representing list of units ( unit_item 's) / -unit_info::unit_info(bool supp) : QWidget() -{ - layout = new QHBoxLayout; +unit_info::unit_info(QWidget *parent, bool supp) : QWidget() +{ + setParent(parent); + layout = new QHBoxLayout(this); init_layout(); supports = supp; } @@ -448,12 +451,16 @@ int i = unit_list.count(); int j; unit_item *ui; + setUpdatesEnabled(false); + hide(); for (j = 0; j i; j++) { ui = unit_list[j]; layout-addWidget(ui, 0, Qt::AlignVCenter); } + show(); setUpdatesEnabled(true); + layout-update(); } / @@ -464,7 +471,7 @@ int i = unit_list.count(); unit_item *ui; int j; - + setUpdatesEnabled(false); setMouseTracking(false); for (j = 0; j i; j++) { ui = unit_list[j]; @@ -475,7 +482,7 @@ unit_list.removeFirst(); } setMouseTracking(true); - + setUpdatesEnabled(true); } / @@ -680,9 +687,9 @@ /** Overview tab initiazlization */ { -QGroupBox *map_box = new QGroupBox; +QGroupBox *map_box = new QGroupBox(this); QVBoxLayout *v_layout = new QVBoxLayout; -QGroupBox *prod_box = new QGroupBox; +QGroupBox *prod_box = new QGroupBox(this); QGridLayout *prod_layout = new QGridLayout; QScrollArea *scroll; QScrollArea *scroll2; @@ -734,7 +741,7 @@ production_combo-setMinimumWidth(200); connect(production_table, SIGNAL(itemDoubleClicked(QTableWidgetItem *)), SLOT(dbl_click(QTableWidgetItem *))); -citizens_label = new city_label(FEELING_FINAL); +citizens_label = new city_label(FEELING_FINAL, this); citizen_pixmap = NULL; view = new city_map(this); v_layout-addWidget(view); @@ -742,13 +749,13 @@ map_box-setTitle(_(City map)); supp_units = new QLabel(); curr_units = new QLabel(); -supported_units = new unit_info(true); +supported_units = new unit_info(this, true); scroll = new QScrollArea; scroll-setWidgetResizable(true); scroll-setMaximumHeight(tileset_tile_height(tileset) * 2); scroll-setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); scroll-setWidget(supported_units); -current_units = new unit_info(false); +current_units = new unit_info(this, false); scroll2 = new QScrollArea; scroll2-setWidgetResizable(true); scroll2-setMaximumHeight(tileset_tile_height(tileset) * 2); @@ -928,9 +935,9 @@ N_(Nationality:) N_(Units:) N_(Wonders:); info_nr = info_list.count(); for (int i = 0; i info_list.count(); i++) { - lab_table[i] = new city_label(1 + i); + lab_table[i] = new city_label(1 + i, this); gridl-addWidget(lab_table[i], i, 1, 1, 1); - lab2 = new QLabel; + lab2 = new QLabel(this); lab2-setFont(*small_font); lab2-setAlignment(Qt::AlignRight | Qt::AlignVCenter); lab2-setText(info_list.at(i)); @@ -1001,7 +1008,7 @@ for (int i = 0; i str_list.count(); i++) { some_label = new QLabel(str_list.at(i)); slider_grid-addWidget(some_label, i + 1, 0, 1, 1); - some_label = new QLabel(0); + some_label = new QLabel(0, this); some_label-setMinimumWidth(25); if (i != str_list.count() - 1) { slider = new QSlider(Qt::Horizontal); @@ -1126,6 +1133,15 @@ city_dialog::~city_dialog() { + if (citizen_pixmap) { +delete citizen_pixmap; + } + cma_table-clear(); + production_table-clear(); + p_table_p-clear(); + nationality_table-clear();
[Freeciv-commits] r26502 - in /branches/S2_5/client/gui-qt: menu.cpp menu.h
Author: mir3x Date: Fri Sep 19 09:58:03 2014 New Revision: 26502 URL: http://svn.gna.org/viewcvs/freeciv?rev=26502view=rev Log: Added new dialog with full GPL license. See patch #5218 Modified: branches/S2_5/client/gui-qt/menu.cpp branches/S2_5/client/gui-qt/menu.h Modified: branches/S2_5/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.cpp?rev=26502r1=26501r2=26502view=diff == --- branches/S2_5/client/gui-qt/menu.cpp(original) +++ branches/S2_5/client/gui-qt/menu.cppFri Sep 19 09:58:03 2014 @@ -19,6 +19,7 @@ #include QApplication #include QMainWindow #include QMessageBox +#include QScrollArea // common #include game.h @@ -28,6 +29,7 @@ // client #include control.h +#include helpdata.h // gui-qt #include qtg_cxxside.h @@ -84,6 +86,36 @@ text = tile_get_info_text(newtile, FALSE, 0); tile_virtual_destroy(newtile); return text; +} + +/** + Displays dialog with scrollbars, like QMessageBox with ok button +**/ +void fc_message_box::info(QWidget *parent, const QString title, + const QString message) { + setParent(parent); + setWindowTitle(title); + setWindowFlags(Qt::Window); + QVBoxLayout *vb = new QVBoxLayout; + label = new QLabel; + label-setAlignment(Qt::AlignVCenter | Qt::AlignLeft); + label-setContentsMargins(2, 2, 2, 2); + label-setWordWrap(true); + label-setText(message); + scroll = new QScrollArea(this); + scroll-setWidget(label); + scroll-setWidgetResizable(true); + + ok_button = new QPushButton(this); + connect(ok_button, SIGNAL(clicked()), this, SLOT(close())); + ok_button-setText(_(Roger that)); + + vb-addWidget(scroll); + vb-addWidget(ok_button); + setLayout(vb); + setFixedHeight(400); + setFixedWidth(600); + show(); } / @@ -1081,17 +1113,20 @@ / void mr_menu::slot_menu_copying() { - QMessageBox info(this); - QString s = QString::fromUtf8(_(Freeciv is covered by the GPL. )) - + QString::fromUtf8(_(See file COPYING distributed with -Freeciv for full license text.)); - - info.setText(s); - info.setStandardButtons(QMessageBox::Ok); - info.setDefaultButton(QMessageBox::Cancel); - info.setIcon(QMessageBox::Information); - info.setWindowTitle(_(Copying)); - info.exec(); + fc_message_box *inf = new fc_message_box; + const struct help_item *pitem; + int idx; + QString s,ds; + + if (!(pitem = get_help_item_spec(Q_(HELP_COPYING_ITEM), + HELP_ANY , idx))) { +log_error(Failed to find %s entry in help, Q_(HELP_COPYING_ITEM)); +return; + } + ds = QString(pitem-text); + + s = QString(Q_(HELP_COPYING_ITEM)); + inf-info(gui()-central_wdg, s, ds); } /*** Modified: branches/S2_5/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.h?rev=26502r1=26501r2=26502view=diff == --- branches/S2_5/client/gui-qt/menu.h (original) +++ branches/S2_5/client/gui-qt/menu.h Fri Sep 19 09:58:03 2014 @@ -23,12 +23,16 @@ #endif // Qt +#include QDialog #include QMenuBar // client #include control.h +class QLabel; +class QPushButton; class QSignalMapper; +class QScrollArea; /** used for indicating menu about current option - for renaming * and enabling disbaling */ @@ -85,6 +89,23 @@ }; /** + Custom dialog to show information +**/ +class fc_message_box : public QDialog +{ + Q_OBJECT + +public: + fc_message_box() {}; + void info(QWidget *parent, const QString title, const QString mess); + +private: + QLabel *label; + QScrollArea *scroll; + QPushButton *ok_button; +}; + +/** Class representing global menus in gameview **/ class mr_menu : public QMenuBar ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26501 - in /trunk/client/gui-qt: menu.cpp menu.h
Author: mir3x Date: Fri Sep 19 09:57:23 2014 New Revision: 26501 URL: http://svn.gna.org/viewcvs/freeciv?rev=26501view=rev Log: Added new dialog with full GPL license. See patch #5218 Modified: trunk/client/gui-qt/menu.cpp trunk/client/gui-qt/menu.h Modified: trunk/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=26501r1=26500r2=26501view=diff == --- trunk/client/gui-qt/menu.cpp(original) +++ trunk/client/gui-qt/menu.cppFri Sep 19 09:57:23 2014 @@ -19,6 +19,7 @@ #include QApplication #include QMainWindow #include QMessageBox +#include QScrollArea // common #include game.h @@ -28,6 +29,7 @@ // client #include control.h +#include helpdata.h // gui-qt #include qtg_cxxside.h @@ -84,6 +86,36 @@ text = tile_get_info_text(newtile, FALSE, 0); tile_virtual_destroy(newtile); return text; +} + +/** + Displays dialog with scrollbars, like QMessageBox with ok button +**/ +void fc_message_box::info(QWidget *parent, const QString title, + const QString message) { + setParent(parent); + setWindowTitle(title); + setWindowFlags(Qt::Window); + QVBoxLayout *vb = new QVBoxLayout; + label = new QLabel; + label-setAlignment(Qt::AlignVCenter | Qt::AlignLeft); + label-setContentsMargins(2, 2, 2, 2); + label-setWordWrap(true); + label-setText(message); + scroll = new QScrollArea(this); + scroll-setWidget(label); + scroll-setWidgetResizable(true); + + ok_button = new QPushButton(this); + connect(ok_button, SIGNAL(clicked()), this, SLOT(close())); + ok_button-setText(_(Roger that)); + + vb-addWidget(scroll); + vb-addWidget(ok_button); + setLayout(vb); + setFixedHeight(400); + setFixedWidth(600); + show(); } / @@ -1133,17 +1165,20 @@ / void mr_menu::slot_menu_copying() { - QMessageBox info(this); - QString s = QString::fromUtf8(_(Freeciv is covered by the GPL. )) - + QString::fromUtf8(_(See file COPYING distributed with -Freeciv for full license text.)); - - info.setText(s); - info.setStandardButtons(QMessageBox::Ok); - info.setDefaultButton(QMessageBox::Cancel); - info.setIcon(QMessageBox::Information); - info.setWindowTitle(_(Copying)); - info.exec(); + fc_message_box *inf = new fc_message_box; + const struct help_item *pitem; + int idx; + QString s,ds; + + if (!(pitem = get_help_item_spec(Q_(HELP_COPYING_ITEM), + HELP_ANY , idx))) { +log_error(Failed to find %s entry in help, Q_(HELP_COPYING_ITEM)); +return; + } + ds = QString(pitem-text); + + s = QString(Q_(HELP_COPYING_ITEM)); + inf-info(gui()-central_wdg, s, ds); } /*** Modified: trunk/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.h?rev=26501r1=26500r2=26501view=diff == --- trunk/client/gui-qt/menu.h (original) +++ trunk/client/gui-qt/menu.h Fri Sep 19 09:57:23 2014 @@ -23,12 +23,16 @@ #endif // Qt +#include QDialog #include QMenuBar // client #include control.h +class QLabel; +class QPushButton; class QSignalMapper; +class QScrollArea; /** used for indicating menu about current option - for renaming * and enabling disbaling */ @@ -86,6 +90,23 @@ }; /** + Custom dialog to show information +**/ +class fc_message_box : public QDialog +{ + Q_OBJECT + +public: + fc_message_box() {}; + void info(QWidget *parent, const QString title, const QString mess); + +private: + QLabel *label; + QScrollArea *scroll; + QPushButton *ok_button; +}; + +/** Class representing global menus in gameview **/ class mr_menu : public QMenuBar ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26505 - in /branches/S2_5/client/gui-qt: dialogs.cpp dialogs.h
Author: mir3x Date: Fri Sep 19 10:06:47 2014 New Revision: 26505 URL: http://svn.gna.org/viewcvs/freeciv?rev=26505view=rev Log: Added popup notify goto dialog. See patch #5244 Modified: branches/S2_5/client/gui-qt/dialogs.cpp branches/S2_5/client/gui-qt/dialogs.h Modified: branches/S2_5/client/gui-qt/dialogs.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/dialogs.cpp?rev=26505r1=26504r2=26505view=diff == --- branches/S2_5/client/gui-qt/dialogs.cpp (original) +++ branches/S2_5/client/gui-qt/dialogs.cpp Fri Sep 19 10:06:47 2014 @@ -677,6 +677,59 @@ } /*** + Notify goto dialog constructor +***/ +notify_goto::notify_goto(const char *headline, const char *lines, + const struct text_tag_list *tags, tile *ptile, + QWidget *parent): QMessageBox(parent) +{ + setAttribute(Qt::WA_DeleteOnClose); + goto_but = this-addButton(_(Goto Location), QMessageBox::ActionRole); + goto_but-setIcon(style()-standardIcon( + QStyle::SP_ToolBarHorizontalExtensionButton)); + inspect_but = this-addButton(_(Inspect City), QMessageBox::ActionRole); + inspect_but-setIcon(style()-standardIcon(QStyle::SP_FileDialogToParent)); + + close_but = this-addButton(QMessageBox::Close); + gtile = ptile; + if (!gtile) { +goto_but-setDisabled(true); +inspect_but-setDisabled(true); + } else { +struct city *pcity = tile_city(gtile); +inspect_but-setEnabled(NULL != pcity + city_owner(pcity) == client.conn.playing); + } + setWindowTitle(headline); + setText(lines); + connect(goto_but, SIGNAL(pressed()), SLOT(goto_tile())); + connect(inspect_but, SIGNAL(pressed()), SLOT(inspect_city())); + connect(close_but, SIGNAL(pressed()), SLOT(close())); + show(); +} + +/*** + Clicked goto tile in notify goto dialog +***/ +void notify_goto::goto_tile() +{ + center_tile_mapcanvas(gtile); + close(); +} + +/*** + Clicked inspect city in notify goto dialog +***/ +void notify_goto::inspect_city() +{ + struct city *pcity = tile_city(gtile); + if (pcity) { +qtg_real_city_dialog_popup(pcity); + } + close(); +} + +/*** User changed nation_set ***/ void races_dialog::nationset_changed(int index) @@ -701,7 +754,9 @@ const struct text_tag_list *tags, struct tile *ptile) { - /* PORTME */ + notify_goto *ask = new notify_goto(headline, lines, tags, ptile, + gui()-central_wdg); + ask-show(); } /** @@ -709,7 +764,7 @@ **/ void popup_connect_msg(const char *headline, const char *message) { - /* PORTME */ + qDebug() Q_FUNC_INFO PORTME; } /** Modified: branches/S2_5/client/gui-qt/dialogs.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/dialogs.h?rev=26505r1=26504r2=26505view=diff == --- branches/S2_5/client/gui-qt/dialogs.h (original) +++ branches/S2_5/client/gui-qt/dialogs.h Fri Sep 19 10:06:47 2014 @@ -24,6 +24,7 @@ // Qt #include QDialog +#include QMessageBox #include QVariant // gui-qt @@ -43,6 +44,26 @@ typedef void (*pfcn_void)(QVariant, QVariant); void update_nationset_combo(); void popup_races_dialog(struct player *pplayer); + +/*** + Dialog for goto popup +***/ +class notify_goto : public QMessageBox +{ + Q_OBJECT + QPushButton *goto_but; + QPushButton *inspect_but; + QPushButton *close_but; + struct tile *gtile; +public: + notify_goto(const char *headline, const char *lines, + const struct text_tag_list *tags, struct tile *ptile, + QWidget *parent); + +private slots: + void goto_tile(); + void inspect_city(); +}; /*** Dialog for selecting nation, style and leader leader ___ Freeciv-commits mailing list
[Freeciv-commits] r26506 - in /trunk/client/gui-qt: dialogs.cpp dialogs.h
Author: mir3x Date: Fri Sep 19 10:10:07 2014 New Revision: 26506 URL: http://svn.gna.org/viewcvs/freeciv?rev=26506view=rev Log: Added popup notify goto dialog. See patch #5244 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=26506r1=26505r2=26506view=diff == --- trunk/client/gui-qt/dialogs.cpp (original) +++ trunk/client/gui-qt/dialogs.cpp Fri Sep 19 10:10:07 2014 @@ -667,6 +667,59 @@ } /*** + Notify goto dialog constructor +***/ +notify_goto::notify_goto(const char *headline, const char *lines, + const struct text_tag_list *tags, tile *ptile, + QWidget *parent): QMessageBox(parent) +{ + setAttribute(Qt::WA_DeleteOnClose); + goto_but = this-addButton(_(Goto Location), QMessageBox::ActionRole); + goto_but-setIcon(style()-standardIcon( + QStyle::SP_ToolBarHorizontalExtensionButton)); + inspect_but = this-addButton(_(Inspect City), QMessageBox::ActionRole); + inspect_but-setIcon(style()-standardIcon(QStyle::SP_FileDialogToParent)); + + close_but = this-addButton(QMessageBox::Close); + gtile = ptile; + if (!gtile) { +goto_but-setDisabled(true); +inspect_but-setDisabled(true); + } else { +struct city *pcity = tile_city(gtile); +inspect_but-setEnabled(NULL != pcity + city_owner(pcity) == client.conn.playing); + } + setWindowTitle(headline); + setText(lines); + connect(goto_but, SIGNAL(pressed()), SLOT(goto_tile())); + connect(inspect_but, SIGNAL(pressed()), SLOT(inspect_city())); + connect(close_but, SIGNAL(pressed()), SLOT(close())); + show(); +} + +/*** + Clicked goto tile in notify goto dialog +***/ +void notify_goto::goto_tile() +{ + center_tile_mapcanvas(gtile); + close(); +} + +/*** + Clicked inspect city in notify goto dialog +***/ +void notify_goto::inspect_city() +{ + struct city *pcity = tile_city(gtile); + if (pcity) { +qtg_real_city_dialog_popup(pcity); + } + close(); +} + +/*** User changed nation_set ***/ void races_dialog::nationset_changed(int index) @@ -691,7 +744,9 @@ const struct text_tag_list *tags, struct tile *ptile) { - /* PORTME */ + notify_goto *ask = new notify_goto(headline, lines, tags, ptile, + gui()-central_wdg); + ask-show(); } /** @@ -699,7 +754,7 @@ **/ void popup_connect_msg(const char *headline, const char *message) { - /* PORTME */ + qDebug() Q_FUNC_INFO PORTME; } /** Modified: trunk/client/gui-qt/dialogs.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.h?rev=26506r1=26505r2=26506view=diff == --- trunk/client/gui-qt/dialogs.h (original) +++ trunk/client/gui-qt/dialogs.h Fri Sep 19 10:10:07 2014 @@ -24,6 +24,7 @@ // Qt #include QDialog +#include QMessageBox #include QVariant // gui-qt @@ -43,6 +44,26 @@ typedef void (*pfcn_void)(QVariant, QVariant); void update_nationset_combo(); void popup_races_dialog(struct player *pplayer); + +/*** + Dialog for goto popup +***/ +class notify_goto : public QMessageBox +{ + Q_OBJECT + QPushButton *goto_but; + QPushButton *inspect_but; + QPushButton *close_but; + struct tile *gtile; +public: + notify_goto(const char *headline, const char *lines, + const struct text_tag_list *tags, struct tile *ptile, + QWidget *parent); + +private slots: + void goto_tile(); + void inspect_city(); +}; /*** Dialog for selecting nation, style and leader leader ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26507 - in /trunk/client/gui-qt: mapview.cpp mapview.h spaceshipdlg.cpp
Author: mir3x Date: Fri Sep 19 10:14:51 2014 New Revision: 26507 URL: http://svn.gna.org/viewcvs/freeciv?rev=26507view=rev Log: Fixed not freed canvases in mapview and spaceship dialog See patch #5245 Modified: trunk/client/gui-qt/mapview.cpp trunk/client/gui-qt/mapview.h trunk/client/gui-qt/spaceshipdlg.cpp Modified: trunk/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=26507r1=26506r2=26507view=diff == --- trunk/client/gui-qt/mapview.cpp (original) +++ trunk/client/gui-qt/mapview.cpp Fri Sep 19 10:14:51 2014 @@ -1527,9 +1527,7 @@ unit_label::unit_label(QWidget *parent) { setParent(parent); - pix = NULL; arrow_pix = NULL; - tile_pix = NULL; ufont = new QFont; w_width = 0; selection_area.setWidth(0); @@ -1537,6 +1535,8 @@ setMouseTracking(true); setFixedWidth(0); setFixedHeight(0); + tile_pix = new QPixmap(); + pix = new QPixmap(); } /** @@ -1550,16 +1550,13 @@ struct player *owner; struct canvas *unit_pixmap; struct canvas *tile_pixmap; - + no_units = false; one_unit = true; setFixedHeight(56); if (unit_list_size(punits) == 0) { unit_label1 = ; unit_label2 = ; -if (pix != NULL) { - delete pix; -}; -pix = NULL; +no_units = true; update(); return; } else if (unit_list_size(punits) == 1) { @@ -1584,30 +1581,23 @@ QString::number(punit-hp), QString::number(unit_type(punit)-hp)); - if (pix != NULL) { -delete pix; -pix = NULL; - }; punit = head_of_units_in_focus(); if (punit) { unit_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset), tileset_tile_height(tileset) * 3 / 2); unit_pixmap-map_pixmap.fill(Qt::transparent); put_unit(punit, unit_pixmap, 1.0, 0, 0); -pix = unit_pixmap-map_pixmap; -*pix = pix-scaledToHeight(height()); +*pix = (unit_pixmap-map_pixmap)-scaledToHeight(height()); w_width = pix-width() + 1; -if (tile_pix != NULL) { - delete tile_pix; -}; tile_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset), tileset_tile_height(tileset) * 2); tile_pixmap-map_pixmap.fill(QColor(0 , 0 , 0 , 85)); put_terrain(punit-tile, tile_pixmap, 1.0, 0, 0); -tile_pix = tile_pixmap-map_pixmap; -*tile_pix = tile_pix-scaledToHeight(height()); - w_width = w_width + tile_pix-width() + 1; +*tile_pix = (tile_pixmap-map_pixmap)-scaledToHeight(height()); +w_width = w_width + tile_pix-width() + 1; +qtg_canvas_free(tile_pixmap); +qtg_canvas_free(unit_pixmap); } QFontMetrics fm(*ufont); @@ -1684,7 +1674,7 @@ painter-setPen(pen); w = 0; - if (pix != NULL) { + if (!no_units) { painter-drawPixmap(w, (height() - pix-height()) / 2, *pix); w = w + pix-width() + 1; if (one_unit == false) { Modified: trunk/client/gui-qt/mapview.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.h?rev=26507r1=26506r2=26507view=diff == --- trunk/client/gui-qt/mapview.h (original) +++ trunk/client/gui-qt/mapview.h Fri Sep 19 10:14:51 2014 @@ -307,6 +307,7 @@ QString unit_label1, unit_label2; bool highlight_pix; bool one_unit; + bool no_units; int w_width; }; Modified: trunk/client/gui-qt/spaceshipdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/spaceshipdlg.cpp?rev=26507r1=26506r2=26507view=diff == --- trunk/client/gui-qt/spaceshipdlg.cpp(original) +++ trunk/client/gui-qt/spaceshipdlg.cppFri Sep 19 10:14:51 2014 @@ -59,6 +59,7 @@ ss_report::~ss_report() { gui()-remove_repo_dlg(SPS); + qtg_canvas_free(can); } / ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26508 - in /branches/S2_5/client/gui-qt: mapview.cpp mapview.h spaceshipdlg.cpp
Author: mir3x Date: Fri Sep 19 10:15:12 2014 New Revision: 26508 URL: http://svn.gna.org/viewcvs/freeciv?rev=26508view=rev Log: Fixed not freed canvases in mapview and spaceship dialog See patch #5245 Modified: branches/S2_5/client/gui-qt/mapview.cpp branches/S2_5/client/gui-qt/mapview.h branches/S2_5/client/gui-qt/spaceshipdlg.cpp Modified: branches/S2_5/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapview.cpp?rev=26508r1=26507r2=26508view=diff == --- branches/S2_5/client/gui-qt/mapview.cpp (original) +++ branches/S2_5/client/gui-qt/mapview.cpp Fri Sep 19 10:15:12 2014 @@ -1524,9 +1524,7 @@ unit_label::unit_label(QWidget *parent) { setParent(parent); - pix = NULL; arrow_pix = NULL; - tile_pix = NULL; ufont = new QFont; w_width = 0; selection_area.setWidth(0); @@ -1534,6 +1532,8 @@ setMouseTracking(true); setFixedWidth(0); setFixedHeight(0); + tile_pix = new QPixmap(); + pix = new QPixmap(); } /** @@ -1547,16 +1547,13 @@ struct player *owner; struct canvas *unit_pixmap; struct canvas *tile_pixmap; - + no_units = false; one_unit = true; setFixedHeight(56); if (unit_list_size(punits) == 0) { unit_label1 = ; unit_label2 = ; -if (pix != NULL) { - delete pix; -}; -pix = NULL; +no_units = true; update(); return; } else if (unit_list_size(punits) == 1) { @@ -1581,10 +1578,6 @@ QString::number(punit-hp), QString::number(unit_type(punit)-hp)); - if (pix != NULL) { -delete pix; -pix = NULL; - }; punit = head_of_units_in_focus(); if (punit) { if (tileset_is_isometric(tileset)){ @@ -1596,13 +1589,9 @@ } unit_pixmap-map_pixmap.fill(Qt::transparent); put_unit(punit, unit_pixmap, 0, 0); -pix = unit_pixmap-map_pixmap; -*pix = pix-scaledToHeight(height()); +*pix = (unit_pixmap-map_pixmap)-scaledToHeight(height()); w_width = pix-width() + 1; -if (tile_pix != NULL) { - delete tile_pix; -}; if (tileset_is_isometric(tileset)){ tile_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset), tileset_tile_height(tileset) * 2); @@ -1612,9 +1601,10 @@ } tile_pixmap-map_pixmap.fill(QColor(0 , 0 , 0 , 85)); put_terrain(punit-tile, tile_pixmap, 0, 0); -tile_pix = tile_pixmap-map_pixmap; -*tile_pix = tile_pix-scaledToHeight(height()); +*tile_pix = (tile_pixmap-map_pixmap)-scaledToHeight(height()); w_width = w_width + tile_pix-width() + 1; + qtg_canvas_free(tile_pixmap); + qtg_canvas_free(unit_pixmap); } QFontMetrics fm(*ufont); @@ -1691,7 +1681,7 @@ painter-setPen(pen); w = 0; - if (pix != NULL) { + if (!no_units) { painter-drawPixmap(w, (height() - pix-height()) / 2, *pix); w = w + pix-width() + 1; if (one_unit == false) { Modified: branches/S2_5/client/gui-qt/mapview.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapview.h?rev=26508r1=26507r2=26508view=diff == --- branches/S2_5/client/gui-qt/mapview.h (original) +++ branches/S2_5/client/gui-qt/mapview.h Fri Sep 19 10:15:12 2014 @@ -307,6 +307,7 @@ QString unit_label1, unit_label2; bool highlight_pix; bool one_unit; + bool no_units; int w_width; }; Modified: branches/S2_5/client/gui-qt/spaceshipdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/spaceshipdlg.cpp?rev=26508r1=26507r2=26508view=diff == --- branches/S2_5/client/gui-qt/spaceshipdlg.cpp(original) +++ branches/S2_5/client/gui-qt/spaceshipdlg.cppFri Sep 19 10:15:12 2014 @@ -58,6 +58,7 @@ ss_report::~ss_report() { gui()-remove_repo_dlg(SPS); + qtg_canvas_free(can); } / ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26523 - /branches/S2_5/client/gui-qt/citydlg.cpp
Author: mir3x Date: Mon Sep 22 09:50:08 2014 New Revision: 26523 URL: http://svn.gna.org/viewcvs/freeciv?rev=26523view=rev Log: Removed white spaces in city dialog on progress bar, and added better resizing for production widget. See patch #5254 Modified: branches/S2_5/client/gui-qt/citydlg.cpp Modified: branches/S2_5/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/citydlg.cpp?rev=26523r1=26522r2=26523view=diff == --- branches/S2_5/client/gui-qt/citydlg.cpp (original) +++ branches/S2_5/client/gui-qt/citydlg.cpp Mon Sep 22 09:50:08 2014 @@ -1009,7 +1009,7 @@ for (int i = 0; i str_list.count(); i++) { some_label = new QLabel(str_list.at(i)); slider_grid-addWidget(some_label, i + 1, 0, 1, 1); - some_label = new QLabel(0, this); + some_label = new QLabel(0); some_label-setMinimumWidth(25); if (i != str_list.count() - 1) { slider = new QSlider(Qt::Horizontal); @@ -2045,6 +2045,7 @@ { char buf[32]; QPixmap *pix; + QString str; struct sprite *sprite; int cost = city_production_build_shield_cost(pcity); @@ -2060,13 +2061,15 @@ } production_combo-setAlignment(Qt::AlignCenter); production_combo_p-setAlignment(Qt::AlignCenter); - production_combo-setFormat(QString((%p%) %2\n%1) + str = QString(buf); + str = str.simplified(); + production_combo-setFormat(QString((%p%) %1\n%2) .arg(city_production_name_translation(pcity), - QString(buf))); + str)); production_combo_p-setFormat(QString((%p%) %2\n%1) .arg(city_production_name_translation(pcity), - QString(buf))); + str)); if (VUT_UTYPE == pcity-production.kind) { sprite = get_unittype_sprite(tileset, pcity-production.value.utype, @@ -2554,10 +2557,10 @@ pixmap_put_x(pix_scaled); } } - opt = QItemDelegate::setOptions(index, option); painter-save(); opt.displayAlignment = Qt::AlignLeft; + opt.textElideMode = Qt::ElideMiddle; QItemDelegate::drawBackground(painter, opt, index); rect1 = option.rect; rect1.setWidth(pix_scaled.width() + 4); @@ -2739,7 +2742,8 @@ renegade = NULL; pi = new production_item(renegade, this); city_target_list pi; - sh.setX(sh.y() + sh.x()); + sh.setX(2 * sh.y() + sh.x()); + sh.setX(qMin(sh.x(), 250)); } / @@ -2823,6 +2827,9 @@ QAbstractItemView::mousePressEvent(event); } +/ + Event filter for production widget +/ bool production_widget::eventFilter(QObject *obj, QEvent *ev) { QRect pw_rect; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26524 - /trunk/client/gui-qt/citydlg.cpp
Author: mir3x Date: Mon Sep 22 09:52:32 2014 New Revision: 26524 URL: http://svn.gna.org/viewcvs/freeciv?rev=26524view=rev Log: Removed white spaces in city dialog on progress bar, and added better resizing for production widget. See patch #5254 Modified: trunk/client/gui-qt/citydlg.cpp Modified: trunk/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/citydlg.cpp?rev=26524r1=26523r2=26524view=diff == --- trunk/client/gui-qt/citydlg.cpp (original) +++ trunk/client/gui-qt/citydlg.cpp Mon Sep 22 09:52:32 2014 @@ -1008,7 +1008,7 @@ for (int i = 0; i str_list.count(); i++) { some_label = new QLabel(str_list.at(i)); slider_grid-addWidget(some_label, i + 1, 0, 1, 1); - some_label = new QLabel(0, this); + some_label = new QLabel(0); some_label-setMinimumWidth(25); if (i != str_list.count() - 1) { slider = new QSlider(Qt::Horizontal); @@ -2050,6 +2050,7 @@ { char buf[32]; QPixmap *pix; + QString str; struct sprite *sprite; int cost = city_production_build_shield_cost(pcity); @@ -2065,13 +2066,15 @@ } production_combo-setAlignment(Qt::AlignCenter); production_combo_p-setAlignment(Qt::AlignCenter); - production_combo-setFormat(QString((%p%) %2\n%1) + str = QString(buf); + str = str.simplified(); + production_combo-setFormat(QString((%p%) %1\n%2) .arg(city_production_name_translation(pcity), - QString(buf))); + str)); production_combo_p-setFormat(QString((%p%) %2\n%1) .arg(city_production_name_translation(pcity), - QString(buf))); + str)); if (VUT_UTYPE == pcity-production.kind) { sprite = get_unittype_sprite(tileset, pcity-production.value.utype, @@ -2559,10 +2562,10 @@ pixmap_put_x(pix_scaled); } } - opt = QItemDelegate::setOptions(index, option); painter-save(); opt.displayAlignment = Qt::AlignLeft; + opt.textElideMode = Qt::ElideMiddle; QItemDelegate::drawBackground(painter, opt, index); rect1 = option.rect; rect1.setWidth(pix_scaled.width() + 4); @@ -2744,7 +2747,8 @@ renegade = NULL; pi = new production_item(renegade, this); city_target_list pi; - sh.setX(sh.y() + sh.x()); + sh.setX(2 * sh.y() + sh.x()); + sh.setX(qMin(sh.x(), 250)); } / @@ -2828,6 +2832,9 @@ QAbstractItemView::mousePressEvent(event); } +/ + Event filter for production widget +/ bool production_widget::eventFilter(QObject *obj, QEvent *ev) { QRect pw_rect; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26525 - /branches/S2_5/client/gui-qt/mapview.cpp
Author: mir3x Date: Mon Sep 22 09:55:02 2014 New Revision: 26525 URL: http://svn.gna.org/viewcvs/freeciv?rev=26525view=rev Log: Patched badly initialized class in mapview.cpp See patch #5262 Modified: branches/S2_5/client/gui-qt/mapview.cpp Modified: branches/S2_5/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapview.cpp?rev=26525r1=26524r2=26525view=diff == --- branches/S2_5/client/gui-qt/mapview.cpp (original) +++ branches/S2_5/client/gui-qt/mapview.cpp Mon Sep 22 09:55:02 2014 @@ -74,7 +74,7 @@ **/ void mr_idle::idling() { - call_me_back* cb = new call_me_back; + call_me_back* cb; while (!callback_list.isEmpty()) { cb = callback_list.dequeue(); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26570 - in /trunk/client/gui-qt: citydlg.cpp citydlg.h
Author: mir3x Date: Wed Sep 24 21:31:02 2014 New Revision: 26570 URL: http://svn.gna.org/viewcvs/freeciv?rev=26570view=rev Log: Added 4 buttons to worklist ( add, move current production up, move down, delete ) See patch #5270 Modified: trunk/client/gui-qt/citydlg.cpp trunk/client/gui-qt/citydlg.h Modified: trunk/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/citydlg.cpp?rev=26570r1=26569r2=26570view=diff == --- trunk/client/gui-qt/citydlg.cpp (original) +++ trunk/client/gui-qt/citydlg.cpp Wed Sep 24 21:31:02 2014 @@ -804,7 +804,20 @@ QGroupBox *group_box = new QGroupBox(_(Worklist Option)); QGridLayout *qgrid = new QGridLayout; QPushButton *but2 = new QPushButton; - +QHBoxLayout *work_but_layout = new QHBoxLayout; +work_next_but = new QPushButton(style()- +standardIcon(QStyle::SP_ArrowDown), ); +work_prev_but = new QPushButton(style()- +standardIcon(QStyle::SP_ArrowUp), ); +work_add_but = new QPushButton(); +work_add_but-setIcon(QIcon(*(get_arrow_sprite(tileset, + ARROW_PLUS)-pm))); +work_rem_but = new QPushButton(style()-standardIcon( + QStyle::SP_DialogDiscardButton), ); +work_but_layout-addWidget(work_add_but); +work_but_layout-addWidget(work_next_but); +work_but_layout-addWidget(work_prev_but); +work_but_layout-addWidget(work_rem_but); but_menu_worklist = new QPushButton; item_button_p = new QPushButton; @@ -832,11 +845,11 @@ r3 = new QRadioButton(_(Insert After)); r4 = new QRadioButton(_(Add Last)); r4-setChecked(true); +vbox-addLayout(work_but_layout); vbox-addWidget(r1); vbox-addWidget(r2); vbox-addWidget(r3); vbox-addWidget(r4); -vbox-addStretch(1); group_box-setLayout(vbox); p_table_p-setColumnCount(3); @@ -903,6 +916,10 @@ connect(buy_button_p, SIGNAL(clicked()), SLOT(buy())); connect(production_combo_p, SIGNAL(clicked()), SLOT(show_targets_worklist())); +connect(work_add_but, SIGNAL(clicked()), SLOT(show_targets_worklist())); +connect(work_prev_but, SIGNAL(clicked()), SLOT(worklist_up())); +connect(work_next_but, SIGNAL(clicked()), SLOT(worklist_down())); +connect(work_rem_but, SIGNAL(clicked()), SLOT(worklist_del())); connect(item_button_p, SIGNAL(clicked()), SLOT(show_targets())); connect(p_table_p, @@ -1129,8 +1146,35 @@ } else { cma_enable_but-setDisabled(true); } -} - + update_prod_buttons(); +} + +/ + Update sensitivity of buttons in production tab +/ +void city_dialog::update_prod_buttons() +{ + work_next_but-setDisabled(true); + work_prev_but-setDisabled(true); + work_add_but-setDisabled(true); + work_rem_but-setDisabled(true); + if (client.conn.playing city_owner(pcity) == client.conn.playing) { +work_add_but-setEnabled(true); +if (selected_row_p = 0 selected_row_p p_table_p-rowCount()) { + work_rem_but-setEnabled(true); +} +if (selected_row_p = 0 selected_row_p p_table_p-rowCount() - 1) { + work_next_but-setEnabled(true); +} +if (selected_row_p 0 selected_row_p p_table_p-rowCount()) { + work_prev_but-setEnabled(true); +} + } +} + +/ + City dialog destructor +/ city_dialog::~city_dialog() { if (citizen_pixmap) { @@ -1986,6 +2030,7 @@ } index = indexes.at(0); selected_row_p = index.row(); + update_prod_buttons(); } / @@ -2326,6 +2371,68 @@ } worklist_init(empty); city_set_worklist(pcity, empty); +} + +/ + Move current item on worklist up +/ +void city_dialog::worklist_up() +{ + QModelIndex index; + struct worklist queue; + struct universal *target = new universal; + QVariant qvar; + + if (selected_row_p 1 || selected_row_p = p_table_p-rowCount()) { +return; + } + city_get_queue(pcity, queue); + worklist_peek_ith(queue, target, selected_row_p); + worklist_remove(queue, selected_row_p); + worklist_insert(queue, *target, selected_row_p - 1); + city_set_queue(pcity, queue); + index = p_table_p-model()-index(selected_row_p - 1, 0); + p_table_p-setCurrentIndex(index); + delete target; + +} + +/ + Remove
[Freeciv-commits] r26571 - in /branches/S2_5/client/gui-qt: citydlg.cpp citydlg.h
Author: mir3x Date: Wed Sep 24 21:33:37 2014 New Revision: 26571 URL: http://svn.gna.org/viewcvs/freeciv?rev=26571view=rev Log: Added 4 buttons to worklist ( add, move current production up, move down, delete ) See patch #5270 Modified: branches/S2_5/client/gui-qt/citydlg.cpp branches/S2_5/client/gui-qt/citydlg.h Modified: branches/S2_5/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/citydlg.cpp?rev=26571r1=26570r2=26571view=diff == --- branches/S2_5/client/gui-qt/citydlg.cpp (original) +++ branches/S2_5/client/gui-qt/citydlg.cpp Wed Sep 24 21:33:37 2014 @@ -805,7 +805,20 @@ QGroupBox *group_box = new QGroupBox(_(Worklist Option)); QGridLayout *qgrid = new QGridLayout; QPushButton *but2 = new QPushButton; - +QHBoxLayout *work_but_layout = new QHBoxLayout; +work_next_but = new QPushButton(style()- +standardIcon(QStyle::SP_ArrowDown), ); +work_prev_but = new QPushButton(style()- +standardIcon(QStyle::SP_ArrowUp), ); +work_add_but = new QPushButton(); +work_add_but-setIcon(QIcon(*(get_arrow_sprite(tileset, + ARROW_PLUS)-pm))); +work_rem_but = new QPushButton(style()-standardIcon( + QStyle::SP_DialogDiscardButton), ); +work_but_layout-addWidget(work_add_but); +work_but_layout-addWidget(work_next_but); +work_but_layout-addWidget(work_prev_but); +work_but_layout-addWidget(work_rem_but); but_menu_worklist = new QPushButton; item_button_p = new QPushButton; @@ -833,11 +846,11 @@ r3 = new QRadioButton(_(Insert After)); r4 = new QRadioButton(_(Add Last)); r4-setChecked(true); +vbox-addLayout(work_but_layout); vbox-addWidget(r1); vbox-addWidget(r2); vbox-addWidget(r3); vbox-addWidget(r4); -vbox-addStretch(1); group_box-setLayout(vbox); p_table_p-setColumnCount(3); @@ -904,6 +917,10 @@ connect(buy_button_p, SIGNAL(clicked()), SLOT(buy())); connect(production_combo_p, SIGNAL(clicked()), SLOT(show_targets_worklist())); +connect(work_add_but, SIGNAL(clicked()), SLOT(show_targets_worklist())); +connect(work_prev_but, SIGNAL(clicked()), SLOT(worklist_up())); +connect(work_next_but, SIGNAL(clicked()), SLOT(worklist_down())); +connect(work_rem_but, SIGNAL(clicked()), SLOT(worklist_del())); connect(item_button_p, SIGNAL(clicked()), SLOT(show_targets())); connect(p_table_p, @@ -1130,8 +1147,35 @@ } else { cma_enable_but-setDisabled(true); } -} - + update_prod_buttons(); +} + +/ + Update sensitivity of buttons in production tab +/ +void city_dialog::update_prod_buttons() +{ + work_next_but-setDisabled(true); + work_prev_but-setDisabled(true); + work_add_but-setDisabled(true); + work_rem_but-setDisabled(true); + if (client.conn.playing city_owner(pcity) == client.conn.playing) { +work_add_but-setEnabled(true); +if (selected_row_p = 0 selected_row_p p_table_p-rowCount()) { + work_rem_but-setEnabled(true); +} +if (selected_row_p = 0 selected_row_p p_table_p-rowCount() - 1) { + work_next_but-setEnabled(true); +} +if (selected_row_p 0 selected_row_p p_table_p-rowCount()) { + work_prev_but-setEnabled(true); +} + } +} + +/ + City dialog destructor +/ city_dialog::~city_dialog() { if (citizen_pixmap) { @@ -1981,6 +2025,7 @@ } index = indexes.at(0); selected_row_p = index.row(); + update_prod_buttons(); } / @@ -2321,6 +2366,68 @@ } worklist_init(empty); city_set_worklist(pcity, empty); +} + +/ + Move current item on worklist up +/ +void city_dialog::worklist_up() +{ + QModelIndex index; + struct worklist queue; + struct universal *target = new universal; + QVariant qvar; + + if (selected_row_p 1 || selected_row_p = p_table_p-rowCount()) { +return; + } + city_get_queue(pcity, queue); + worklist_peek_ith(queue, target, selected_row_p); + worklist_remove(queue, selected_row_p); + worklist_insert(queue, *target, selected_row_p - 1); + city_set_queue(pcity, queue); + index = p_table_p-model()-index(selected_row_p - 1, 0); + p_table_p-setCurrentIndex(index); + delete target; + +} +
[Freeciv-commits] r26576 - in /trunk: ./ data/themes/ data/themes/gui-qt/ data/themes/gui-qt/oxygen/
Author: mir3x Date: Thu Sep 25 10:10:43 2014 New Revision: 26576 URL: http://svn.gna.org/viewcvs/freeciv?rev=26576view=rev Log: Added 17 oxygen icons (32x32) to themes/gui-qt/oxygen/ for use in qt-client See patch #5277 Added: trunk/data/themes/gui-qt/ trunk/data/themes/gui-qt/Makefile.am trunk/data/themes/gui-qt/oxygen/ trunk/data/themes/gui-qt/oxygen/Makefile.am trunk/data/themes/gui-qt/oxygen/configure.png (with props) trunk/data/themes/gui-qt/oxygen/edit-delete.png (with props) trunk/data/themes/gui-qt/oxygen/edit-find.png (with props) trunk/data/themes/gui-qt/oxygen/flag.png (with props) trunk/data/themes/gui-qt/oxygen/fork.png (with props) trunk/data/themes/gui-qt/oxygen/go-down.png (with props) trunk/data/themes/gui-qt/oxygen/go-up.png (with props) trunk/data/themes/gui-qt/oxygen/help-donate.png (with props) trunk/data/themes/gui-qt/oxygen/list-add.png (with props) trunk/data/themes/gui-qt/oxygen/list-remove.png (with props) trunk/data/themes/gui-qt/oxygen/meeting-chair.png (with props) trunk/data/themes/gui-qt/oxygen/meeting-observer.png (with props) trunk/data/themes/gui-qt/oxygen/network-disconnect.png (with props) trunk/data/themes/gui-qt/oxygen/network-server.png (with props) trunk/data/themes/gui-qt/oxygen/object-locked.png (with props) trunk/data/themes/gui-qt/oxygen/preferences-other.png (with props) trunk/data/themes/gui-qt/oxygen/preferences-system.png (with props) Modified: trunk/configure.ac trunk/data/themes/Makefile.am Modified: trunk/configure.ac URL: http://svn.gna.org/viewcvs/freeciv/trunk/configure.ac?rev=26576r1=26575r2=26576view=diff == --- trunk/configure.ac (original) +++ trunk/configure.ac Thu Sep 25 10:10:43 2014 @@ -1579,6 +1579,8 @@ data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Spin/Makefile data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Tabs/Makefile data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Toolbar/Makefile + data/themes/gui-qt/Makefile + data/themes/gui-qt/oxygen/Makefile data/themes/gui-sdl/Makefile data/themes/gui-sdl/human/Makefile data/themes/gui-sdl2/Makefile Modified: trunk/data/themes/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/themes/Makefile.am?rev=26576r1=26575r2=26576view=diff == --- trunk/data/themes/Makefile.am (original) +++ trunk/data/themes/Makefile.am Thu Sep 25 10:10:43 2014 @@ -17,3 +17,7 @@ if CLIENT_GUI_SDL2 SUBDIRS += gui-sdl2 endif + +if CLIENT_GUI_QT +SUBDIRS += gui-qt +endif Added: trunk/data/themes/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/themes/gui-qt/Makefile.am?rev=26576view=auto == --- trunk/data/themes/gui-qt/Makefile.am(added) +++ trunk/data/themes/gui-qt/Makefile.amThu Sep 25 10:10:43 2014 @@ -0,0 +1,4 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = oxygen + Added: trunk/data/themes/gui-qt/oxygen/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/themes/gui-qt/oxygen/Makefile.am?rev=26576view=auto == --- trunk/data/themes/gui-qt/oxygen/Makefile.am (added) +++ trunk/data/themes/gui-qt/oxygen/Makefile.am Thu Sep 25 10:10:43 2014 @@ -0,0 +1,26 @@ +## Process this file with automake to produce Makefile.in + +## Override automake so that make install puts these in proper place: +pkgdatadir = $(datadir)/$(PACKAGE)/themes/gui-qt/oxygen + +pkgdata_DATA = \ + configure.png \ + edit-find.png \ + flag.png\ + go-up.png \ + list-remove.png \ + network-disconnect.png \ + preferences-other.png \ + edit-delete.png \ + fork.png\ + help-donate.png \ + meeting-chair.png \ + network-server.png \ + preferences-system.png \ + edit-find.png \ + go-down.png \ + list-add.png\ + meeting-observer.png\ + object-locked.png +EXTRA_DIST = $(pkgdata_DATA) + Added: trunk/data/themes/gui-qt/oxygen/configure.png URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/themes/gui-qt/oxygen/configure.png?rev=26576view=auto == Binary file - no diff available. Propchange: trunk/data/themes/gui-qt/oxygen/configure.png -- svn:mime-type = image/png Added: trunk/data/themes/gui-qt/oxygen/edit-delete.png URL:
[Freeciv-commits] r26575 - in /branches/S2_5: ./ data/themes/ data/themes/gui-qt/ data/themes/gui-qt/oxygen/
Author: mir3x Date: Thu Sep 25 10:10:17 2014 New Revision: 26575 URL: http://svn.gna.org/viewcvs/freeciv?rev=26575view=rev Log: Added 17 oxygen icons (32x32) to themes/gui-qt/oxygen/ for use in qt-client See patch #5277 Added: branches/S2_5/data/themes/gui-qt/ branches/S2_5/data/themes/gui-qt/Makefile.am branches/S2_5/data/themes/gui-qt/oxygen/ branches/S2_5/data/themes/gui-qt/oxygen/Makefile.am branches/S2_5/data/themes/gui-qt/oxygen/configure.png (with props) branches/S2_5/data/themes/gui-qt/oxygen/edit-delete.png (with props) branches/S2_5/data/themes/gui-qt/oxygen/edit-find.png (with props) branches/S2_5/data/themes/gui-qt/oxygen/flag.png (with props) branches/S2_5/data/themes/gui-qt/oxygen/fork.png (with props) branches/S2_5/data/themes/gui-qt/oxygen/go-down.png (with props) branches/S2_5/data/themes/gui-qt/oxygen/go-up.png (with props) branches/S2_5/data/themes/gui-qt/oxygen/help-donate.png (with props) branches/S2_5/data/themes/gui-qt/oxygen/list-add.png (with props) branches/S2_5/data/themes/gui-qt/oxygen/list-remove.png (with props) branches/S2_5/data/themes/gui-qt/oxygen/meeting-chair.png (with props) branches/S2_5/data/themes/gui-qt/oxygen/meeting-observer.png (with props) branches/S2_5/data/themes/gui-qt/oxygen/network-disconnect.png (with props) branches/S2_5/data/themes/gui-qt/oxygen/network-server.png (with props) branches/S2_5/data/themes/gui-qt/oxygen/object-locked.png (with props) branches/S2_5/data/themes/gui-qt/oxygen/preferences-other.png (with props) branches/S2_5/data/themes/gui-qt/oxygen/preferences-system.png (with props) Modified: branches/S2_5/configure.ac branches/S2_5/data/themes/Makefile.am Modified: branches/S2_5/configure.ac URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/configure.ac?rev=26575r1=26574r2=26575view=diff == --- branches/S2_5/configure.ac (original) +++ branches/S2_5/configure.ac Thu Sep 25 10:10:17 2014 @@ -1481,6 +1481,8 @@ data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Spin/Makefile data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Tabs/Makefile data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Toolbar/Makefile + data/themes/gui-qt/Makefile + data/themes/gui-qt/oxygen/Makefile data/themes/gui-sdl/Makefile data/themes/gui-sdl/human/Makefile data/wonders/Makefile Modified: branches/S2_5/data/themes/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/themes/Makefile.am?rev=26575r1=26574r2=26575view=diff == --- branches/S2_5/data/themes/Makefile.am (original) +++ branches/S2_5/data/themes/Makefile.am Thu Sep 25 10:10:17 2014 @@ -13,3 +13,7 @@ if CLIENT_GUI_SDL SUBDIRS += gui-sdl endif + +if CLIENT_GUI_QT +SUBDIRS += gui-qt +endif Added: branches/S2_5/data/themes/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/themes/gui-qt/Makefile.am?rev=26575view=auto == --- branches/S2_5/data/themes/gui-qt/Makefile.am(added) +++ branches/S2_5/data/themes/gui-qt/Makefile.amThu Sep 25 10:10:17 2014 @@ -0,0 +1,4 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = oxygen + Added: branches/S2_5/data/themes/gui-qt/oxygen/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/themes/gui-qt/oxygen/Makefile.am?rev=26575view=auto == --- branches/S2_5/data/themes/gui-qt/oxygen/Makefile.am (added) +++ branches/S2_5/data/themes/gui-qt/oxygen/Makefile.am Thu Sep 25 10:10:17 2014 @@ -0,0 +1,25 @@ +## Process this file with automake to produce Makefile.in + +## Override automake so that make install puts these in proper place: +pkgdatadir = $(datadir)/$(PACKAGE)/themes/gui-qt/oxygen + +pkgdata_DATA = \ + configure.png \ + edit-find.png \ + flag.png\ + go-up.png \ + list-remove.png \ + network-disconnect.png \ + preferences-other.png \ + edit-delete.png \ + fork.png\ + help-donate.png \ + meeting-chair.png \ + network-server.png \ + preferences-system.png \ + edit-find.png \ + go-down.png \ + list-add.png\ + meeting-observer.png\ + object-locked.png +EXTRA_DIST = $(pkgdata_DATA) Added: branches/S2_5/data/themes/gui-qt/oxygen/configure.png URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/themes/gui-qt/oxygen/configure.png?rev=26575view=auto
[Freeciv-commits] r26639 - in /branches/S2_5/client/gui-qt: citydlg.cpp fc_client.cpp fc_client.h pages.cpp
Author: mir3x Date: Wed Oct 1 09:36:20 2014 New Revision: 26639 URL: http://svn.gna.org/viewcvs/freeciv?rev=26639view=rev Log: Added few icons to start page and city dialog See patch #5289 Modified: branches/S2_5/client/gui-qt/citydlg.cpp branches/S2_5/client/gui-qt/fc_client.cpp branches/S2_5/client/gui-qt/fc_client.h branches/S2_5/client/gui-qt/pages.cpp Modified: branches/S2_5/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/citydlg.cpp?rev=26639r1=26638r2=26639view=diff == --- branches/S2_5/client/gui-qt/citydlg.cpp (original) +++ branches/S2_5/client/gui-qt/citydlg.cpp Wed Oct 1 09:36:20 2014 @@ -720,7 +720,7 @@ connect(production_combo, SIGNAL(clicked()), SLOT(show_targets())); buy_button = new QPushButton(); -buy_button-setIcon(style()-standardIcon(QStyle::SP_CommandLink)); +buy_button-setIcon(fc_icons::instance()-get_icon(help-donate)); connect(lcity_name, SIGNAL(clicked()), SLOT(city_rename())); connect(buy_button, SIGNAL(clicked()), SLOT(buy())); item_button = new QPushButton(); @@ -806,15 +806,14 @@ QGridLayout *qgrid = new QGridLayout; QPushButton *but2 = new QPushButton; QHBoxLayout *work_but_layout = new QHBoxLayout; -work_next_but = new QPushButton(style()- -standardIcon(QStyle::SP_ArrowDown), ); -work_prev_but = new QPushButton(style()- -standardIcon(QStyle::SP_ArrowUp), ); -work_add_but = new QPushButton(); -work_add_but-setIcon(QIcon(*(get_arrow_sprite(tileset, - ARROW_PLUS)-pm))); -work_rem_but = new QPushButton(style()-standardIcon( - QStyle::SP_DialogDiscardButton), ); +work_next_but = new QPushButton(fc_icons::instance()-get_icon( +go-down), ); +work_prev_but = new QPushButton(fc_icons::instance()-get_icon( +go-up), ); +work_add_but = new QPushButton(fc_icons::instance()-get_icon( +list-add), ); +work_rem_but = new QPushButton(fc_icons::instance()-get_icon( +edit-delete), ); work_but_layout-addWidget(work_add_but); work_but_layout-addWidget(work_next_but); work_but_layout-addWidget(work_prev_but); @@ -836,6 +835,7 @@ production_combo_p-setToolTip(_(Click to change worklist production)); p_table_p = new QTableWidget; buy_button_p = new QPushButton(parent); +buy_button_p-setIcon(fc_icons::instance()-get_icon(help-donate)); future_targets_p = new QCheckBox; future_targets_p-setChecked(false); show_units_p = new QCheckBox; Modified: branches/S2_5/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=26639r1=26638r2=26639view=diff == --- branches/S2_5/client/gui-qt/fc_client.cpp (original) +++ branches/S2_5/client/gui-qt/fc_client.cpp Wed Oct 1 09:36:20 2014 @@ -37,7 +37,7 @@ extern QApplication *qapp; - +fc_icons* fc_icons::m_instance = 0; / Constructor / @@ -690,12 +690,64 @@ font_map.insert(name,qf); } +/ + Game tab widget constructor +/ fc_game_tab_widget::fc_game_tab_widget(): QTabWidget() { connect(this, SIGNAL(currentChanged(int)), SLOT(restore_label_color(int))); } / + Icon provider constructor +/ +fc_icons::fc_icons() +{ +} + +/ + Returns instance of fc_icons +/ +fc_icons *fc_icons::instance() +{ + if (!m_instance) +m_instance = new fc_icons; + return m_instance; +} + +/ + Deletes fc_icons instance +/ +void fc_icons::drop() +{ + if (m_instance) { +delete m_instance; +m_instance = 0; + } +} + +/ + Returns icon by given name +/ +QIcon fc_icons::get_icon(const QString id) +{ + return QIcon(fileinfoname(get_data_dirs(), +
[Freeciv-commits] r26640 - in /trunk/client/gui-qt: citydlg.cpp fc_client.cpp fc_client.h pages.cpp
Author: mir3x Date: Wed Oct 1 09:36:31 2014 New Revision: 26640 URL: http://svn.gna.org/viewcvs/freeciv?rev=26640view=rev Log: Added few icons to start page and city dialog See patch #5289 Modified: trunk/client/gui-qt/citydlg.cpp trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/fc_client.h trunk/client/gui-qt/pages.cpp Modified: trunk/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/citydlg.cpp?rev=26640r1=26639r2=26640view=diff == --- trunk/client/gui-qt/citydlg.cpp (original) +++ trunk/client/gui-qt/citydlg.cpp Wed Oct 1 09:36:31 2014 @@ -719,7 +719,7 @@ connect(production_combo, SIGNAL(clicked()), SLOT(show_targets())); buy_button = new QPushButton(); -buy_button-setIcon(style()-standardIcon(QStyle::SP_CommandLink)); +buy_button-setIcon(fc_icons::instance()-get_icon(help-donate)); connect(lcity_name, SIGNAL(clicked()), SLOT(city_rename())); connect(buy_button, SIGNAL(clicked()), SLOT(buy())); item_button = new QPushButton(); @@ -805,15 +805,14 @@ QGridLayout *qgrid = new QGridLayout; QPushButton *but2 = new QPushButton; QHBoxLayout *work_but_layout = new QHBoxLayout; -work_next_but = new QPushButton(style()- -standardIcon(QStyle::SP_ArrowDown), ); -work_prev_but = new QPushButton(style()- -standardIcon(QStyle::SP_ArrowUp), ); -work_add_but = new QPushButton(); -work_add_but-setIcon(QIcon(*(get_arrow_sprite(tileset, - ARROW_PLUS)-pm))); -work_rem_but = new QPushButton(style()-standardIcon( - QStyle::SP_DialogDiscardButton), ); +work_next_but = new QPushButton(fc_icons::instance()-get_icon( +go-down), ); +work_prev_but = new QPushButton(fc_icons::instance()-get_icon( +go-up), ); +work_add_but = new QPushButton(fc_icons::instance()-get_icon( +list-add), ); +work_rem_but = new QPushButton(fc_icons::instance()-get_icon( +edit-delete), ); work_but_layout-addWidget(work_add_but); work_but_layout-addWidget(work_next_but); work_but_layout-addWidget(work_prev_but); @@ -835,6 +834,7 @@ production_combo_p-setToolTip(_(Click to change worklist production)); p_table_p = new QTableWidget; buy_button_p = new QPushButton(parent); +buy_button_p-setIcon(fc_icons::instance()-get_icon(help-donate)); future_targets_p = new QCheckBox; future_targets_p-setChecked(false); show_units_p = new QCheckBox; Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=26640r1=26639r2=26640view=diff == --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Wed Oct 1 09:36:31 2014 @@ -37,7 +37,7 @@ extern QApplication *qapp; - +fc_icons* fc_icons::m_instance = 0; / Constructor / @@ -682,12 +682,64 @@ font_map.insert(name,qf); } +/ + Game tab widget constructor +/ fc_game_tab_widget::fc_game_tab_widget(): QTabWidget() { connect(this, SIGNAL(currentChanged(int)), SLOT(restore_label_color(int))); } / + Icon provider constructor +/ +fc_icons::fc_icons() +{ +} + +/ + Returns instance of fc_icons +/ +fc_icons *fc_icons::instance() +{ + if (!m_instance) +m_instance = new fc_icons; + return m_instance; +} + +/ + Deletes fc_icons instance +/ +void fc_icons::drop() +{ + if (m_instance) { +delete m_instance; +m_instance = 0; + } +} + +/ + Returns icon by given name +/ +QIcon fc_icons::get_icon(const QString id) +{ + return QIcon(fileinfoname(get_data_dirs(), +QString(themes/gui-qt/oxygen/ ++ id +
[Freeciv-commits] r26641 - in /branches/S2_5/client/gui-qt: cityrep.cpp plrdlg.cpp repodlgs.cpp
Author: mir3x Date: Wed Oct 1 09:47:16 2014 New Revision: 26641 URL: http://svn.gna.org/viewcvs/freeciv?rev=26641view=rev Log: Visual changes to report dialogs Units report: - updated total upgradable units to int, instead checkbox Cities report: - changed font for city name to capitalized - added red color to production surplus if negative - menu is displayed only is there are any selected cities See patch #5290 Modified: branches/S2_5/client/gui-qt/cityrep.cpp branches/S2_5/client/gui-qt/plrdlg.cpp branches/S2_5/client/gui-qt/repodlgs.cpp Modified: branches/S2_5/client/gui-qt/cityrep.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/cityrep.cpp?rev=26641r1=26640r2=26641view=diff == --- branches/S2_5/client/gui-qt/cityrep.cpp (original) +++ branches/S2_5/client/gui-qt/cityrep.cpp Wed Oct 1 09:47:16 2014 @@ -27,7 +27,9 @@ static bool can_city_sell_universal(const struct city *pcity, struct universal target); - +/*** + Overriden compare for sorting items +***/ bool city_sort_model::lessThan(const QModelIndex left, const QModelIndex right) const { @@ -63,11 +65,37 @@ /*** City item delgate paint event ***/ -void city_item_delegate::paint(QPainter *painter, - const QStyleOptionViewItem option, +void city_item_delegate::paint(QPainter *painter, + const QStyleOptionViewItem option, const QModelIndex index) const { - QItemDelegate::paint(painter, option, index); + QStyleOptionViewItemV3 opt = QItemDelegate::setOptions(index, option); + QString txt; + QFont font; + QPalette palette; + struct city_report_spec *spec; + spec = city_report_specs + index.column(); + txt = spec-tagname; + if (txt == cityname) { +font.setCapitalization(QFont::SmallCaps); +font.setBold(true); +opt.font = font; + } + if (txt == hstate_verbose) { +font.setItalic(true); +opt.font = font; + } + if (txt == prodplus) { +txt = index.data().toString(); +if (txt.toInt() 0) { + font.setBold(true); + palette.setColor(QPalette::Text, QColor(255, 0, 0)); + opt.font = font; + opt.palette = palette; +} + } + + QItemDelegate::paint(painter, opt, index); } /*** @@ -78,7 +106,7 @@ { QSize s = QItemDelegate::sizeHint(option, index); - s.setHeight(item_height); + s.setHeight(item_height + 4); return s; } @@ -123,7 +151,6 @@ spec = city_report_specs+column; fc_snprintf(buf, sizeof(buf), %*s, NEG_VAL(spec-width), spec-func(i_city, spec-data)); - return QString(buf); } @@ -197,6 +224,10 @@ NEG_VAL(spec-width), spec-title1 ? spec-title1 : , NEG_VAL(spec-width), spec-title2 ? spec-title2 : ); return QString(buf); +} +if (role == Qt::ToolTipRole) { + spec = city_report_specs + section; + return QString(spec-explanation); } } return QVariant(); @@ -442,6 +473,9 @@ QAction cty_view(style()-standardIcon(QStyle::SP_CommandLink), Q_(?verb:View), 0); sell_gold = 0; + if (selected_cities.isEmpty()) { +return; + } foreach (pcity, selected_cities) { sell_gold = sell_gold + city_production_buy_gold_cost(pcity); } Modified: branches/S2_5/client/gui-qt/plrdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/plrdlg.cpp?rev=26641r1=26640r2=26641view=diff == --- branches/S2_5/client/gui-qt/plrdlg.cpp (original) +++ branches/S2_5/client/gui-qt/plrdlg.cpp Wed Oct 1 09:47:16 2014 @@ -285,6 +285,7 @@ setSelectionMode(QAbstractItemView::SingleSelection); setItemsExpandable(false); setAutoScroll(true); + setAlternatingRowColors(true); header()-setContextMenuPolicy(Qt::CustomContextMenu); hide_columns(); connect(header(), SIGNAL(customContextMenuRequested(const QPoint )), Modified: branches/S2_5/client/gui-qt/repodlgs.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/repodlgs.cpp?rev=26641r1=26640r2=26641view=diff == --- branches/S2_5/client/gui-qt/repodlgs.cpp(original) +++ branches/S2_5/client/gui-qt/repodlgs.cppWed Oct 1 09:47:16 2014 @@ -434,6 +434,7 @@ ResizeToContents);
[Freeciv-commits] r26642 - in /trunk/client/gui-qt: cityrep.cpp plrdlg.cpp repodlgs.cpp
Author: mir3x Date: Wed Oct 1 09:47:27 2014 New Revision: 26642 URL: http://svn.gna.org/viewcvs/freeciv?rev=26642view=rev Log: Visual changes to report dialogs Units report: - updated total upgradable units to int, instead checkbox Cities report: - changed font for city name to capitalized - added red color to production surplus if negative - menu is displayed only is there are any selected cities See patch #5290 Modified: trunk/client/gui-qt/cityrep.cpp trunk/client/gui-qt/plrdlg.cpp trunk/client/gui-qt/repodlgs.cpp Modified: trunk/client/gui-qt/cityrep.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/cityrep.cpp?rev=26642r1=26641r2=26642view=diff == --- trunk/client/gui-qt/cityrep.cpp (original) +++ trunk/client/gui-qt/cityrep.cpp Wed Oct 1 09:47:27 2014 @@ -27,7 +27,9 @@ static bool can_city_sell_universal(const struct city *pcity, struct universal target); - +/*** + Overriden compare for sorting items +***/ bool city_sort_model::lessThan(const QModelIndex left, const QModelIndex right) const { @@ -63,11 +65,37 @@ /*** City item delgate paint event ***/ -void city_item_delegate::paint(QPainter *painter, - const QStyleOptionViewItem option, +void city_item_delegate::paint(QPainter *painter, + const QStyleOptionViewItem option, const QModelIndex index) const { - QItemDelegate::paint(painter, option, index); + QStyleOptionViewItemV3 opt = QItemDelegate::setOptions(index, option); + QString txt; + QFont font; + QPalette palette; + struct city_report_spec *spec; + spec = city_report_specs + index.column(); + txt = spec-tagname; + if (txt == cityname) { +font.setCapitalization(QFont::SmallCaps); +font.setBold(true); +opt.font = font; + } + if (txt == hstate_verbose) { +font.setItalic(true); +opt.font = font; + } + if (txt == prodplus) { +txt = index.data().toString(); +if (txt.toInt() 0) { + font.setBold(true); + palette.setColor(QPalette::Text, QColor(255, 0, 0)); + opt.font = font; + opt.palette = palette; +} + } + + QItemDelegate::paint(painter, opt, index); } /*** @@ -78,7 +106,7 @@ { QSize s = QItemDelegate::sizeHint(option, index); - s.setHeight(item_height); + s.setHeight(item_height + 4); return s; } @@ -123,7 +151,6 @@ spec = city_report_specs+column; fc_snprintf(buf, sizeof(buf), %*s, NEG_VAL(spec-width), spec-func(i_city, spec-data)); - return QString(buf); } @@ -197,6 +224,10 @@ NEG_VAL(spec-width), spec-title1 ? spec-title1 : , NEG_VAL(spec-width), spec-title2 ? spec-title2 : ); return QString(buf); +} +if (role == Qt::ToolTipRole) { + spec = city_report_specs + section; + return QString(spec-explanation); } } return QVariant(); @@ -442,6 +473,9 @@ QAction cty_view(style()-standardIcon(QStyle::SP_CommandLink), Q_(?verb:View), 0); sell_gold = 0; + if (selected_cities.isEmpty()) { +return; + } foreach (pcity, selected_cities) { sell_gold = sell_gold + city_production_buy_gold_cost(pcity); } Modified: trunk/client/gui-qt/plrdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/plrdlg.cpp?rev=26642r1=26641r2=26642view=diff == --- trunk/client/gui-qt/plrdlg.cpp (original) +++ trunk/client/gui-qt/plrdlg.cpp Wed Oct 1 09:47:27 2014 @@ -285,6 +285,7 @@ setSelectionMode(QAbstractItemView::SingleSelection); setItemsExpandable(false); setAutoScroll(true); + setAlternatingRowColors(true); header()-setContextMenuPolicy(Qt::CustomContextMenu); hide_columns(); connect(header(), SIGNAL(customContextMenuRequested(const QPoint )), Modified: trunk/client/gui-qt/repodlgs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/repodlgs.cpp?rev=26642r1=26641r2=26642view=diff == --- trunk/client/gui-qt/repodlgs.cpp(original) +++ trunk/client/gui-qt/repodlgs.cppWed Oct 1 09:47:27 2014 @@ -435,6 +435,7 @@ ResizeToContents); units_widget-verticalHeader()-setVisible(false); units_widget-setSelectionMode(QAbstractItemView::SingleSelection); +
[Freeciv-commits] r27238 - in /branches/S2_5: client/gui-qt/ translations/freeciv/
Author: mir3x Date: Wed Dec 10 17:59:01 2014 New Revision: 27238 URL: http://svn.gna.org/viewcvs/freeciv?rev=27238view=rev Log: Added help dialog to qt-client. Patch by Louis Moureaux louis94 See bug #23009 Modified: branches/S2_5/client/gui-qt/Makefile.am branches/S2_5/client/gui-qt/gui_main.cpp branches/S2_5/client/gui-qt/helpdlg.cpp branches/S2_5/client/gui-qt/helpdlg.h branches/S2_5/client/gui-qt/menu.cpp branches/S2_5/client/gui-qt/menu.h branches/S2_5/translations/freeciv/POTFILES.in [This mail would be too long, it was shortened to contain the URLs only.] Modified: branches/S2_5/client/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/Makefile.am?rev=27238r1=27237r2=27238view=diff Modified: branches/S2_5/client/gui-qt/gui_main.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/gui_main.cpp?rev=27238r1=27237r2=27238view=diff Modified: branches/S2_5/client/gui-qt/helpdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/helpdlg.cpp?rev=27238r1=27237r2=27238view=diff Modified: branches/S2_5/client/gui-qt/helpdlg.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/helpdlg.h?rev=27238r1=27237r2=27238view=diff Modified: branches/S2_5/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.cpp?rev=27238r1=27237r2=27238view=diff Modified: branches/S2_5/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.h?rev=27238r1=27237r2=27238view=diff Modified: branches/S2_5/translations/freeciv/POTFILES.in URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/translations/freeciv/POTFILES.in?rev=27238r1=27237r2=27238view=diff ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r27239 - in /trunk: client/gui-qt/ translations/freeciv/
Author: mir3x Date: Wed Dec 10 18:08:23 2014 New Revision: 27239 URL: http://svn.gna.org/viewcvs/freeciv?rev=27239view=rev Log: Added help dialog to qt-client. Patch by Louis Moureaux louis94 See bug #23009 Modified: trunk/client/gui-qt/Makefile.am trunk/client/gui-qt/gui_main.cpp trunk/client/gui-qt/helpdlg.cpp trunk/client/gui-qt/helpdlg.h trunk/client/gui-qt/menu.cpp trunk/client/gui-qt/menu.h trunk/translations/freeciv/POTFILES.in [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/client/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/Makefile.am?rev=27239r1=27238r2=27239view=diff Modified: trunk/client/gui-qt/gui_main.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/gui_main.cpp?rev=27239r1=27238r2=27239view=diff Modified: trunk/client/gui-qt/helpdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/helpdlg.cpp?rev=27239r1=27238r2=27239view=diff Modified: trunk/client/gui-qt/helpdlg.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/helpdlg.h?rev=27239r1=27238r2=27239view=diff Modified: trunk/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=27239r1=27238r2=27239view=diff Modified: trunk/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.h?rev=27239r1=27238r2=27239view=diff Modified: trunk/translations/freeciv/POTFILES.in URL: http://svn.gna.org/viewcvs/freeciv/trunk/translations/freeciv/POTFILES.in?rev=27239r1=27238r2=27239view=diff ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r27297 - /branches/S2_5/client/gui-qt/helpdlg.cpp
Author: mir3x Date: Sun Dec 14 16:16:25 2014 New Revision: 27297 URL: http://svn.gna.org/viewcvs/freeciv?rev=27297view=rev Log: Fixed creating tree in qt-manual See bug #23052 Modified: branches/S2_5/client/gui-qt/helpdlg.cpp Modified: branches/S2_5/client/gui-qt/helpdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/helpdlg.cpp?rev=27297r1=27296r2=27297view=diff == --- branches/S2_5/client/gui-qt/helpdlg.cpp (original) +++ branches/S2_5/client/gui-qt/helpdlg.cpp Sun Dec 14 16:16:25 2014 @@ -171,35 +171,27 @@ void help_dialog::make_tree() { QTreeWidgetItem *item; - int d, depht = 0; - QStackQTreeWidgetItem * stack; + int dep; char *title; + QHashint, QTreeWidgetItem* hash; help_items_iterate(pitem) { +const char *s; +int last; title = pitem-topic; -for (d = 0; *title == ' '; ++title, ++d) { - // Do nothing +for (s = pitem-topic; *s == ' '; s++) { + /* nothing */ } item = new QTreeWidgetItem(QStringList(title)); topics_map[item] = pitem; -if (d 0 d == depht) { - // Same level in the tree - stack.pop(); -} else if (d 0 d depht) { - // Less deep - for ( ; d = depht; --depht) { -stack.pop(); - } - stack.top()-addChild(item); - stack.push(item); +dep = s - pitem-topic; +hash.insert(dep, item); +if (dep == 0) { + tree_wdg-addTopLevelItem(item); +} else { + last = dep - 1; + hash.value(last)-addChild(item); } -depht = d; -if (depht 0) { - stack.top()-addChild(item); -} else { - tree_wdg-addTopLevelItem(item); -} -stack.push(item); } help_items_iterate_end; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r27298 - /trunk/client/gui-qt/helpdlg.cpp
Author: mir3x Date: Sun Dec 14 16:17:27 2014 New Revision: 27298 URL: http://svn.gna.org/viewcvs/freeciv?rev=27298view=rev Log: Fixed creating tree in qt-manual See bug #23052 Modified: trunk/client/gui-qt/helpdlg.cpp Modified: trunk/client/gui-qt/helpdlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/helpdlg.cpp?rev=27298r1=27297r2=27298view=diff == --- trunk/client/gui-qt/helpdlg.cpp (original) +++ trunk/client/gui-qt/helpdlg.cpp Sun Dec 14 16:17:27 2014 @@ -164,35 +164,27 @@ void help_dialog::make_tree() { QTreeWidgetItem *item; - int d, depht = 0; - QStackQTreeWidgetItem * stack; + int dep; char *title; + QHashint, QTreeWidgetItem* hash; help_items_iterate(pitem) { +const char *s; +int last; title = pitem-topic; -for (d = 0; *title == ' '; ++title, ++d) { - // Do nothing +for (s = pitem-topic; *s == ' '; s++) { + /* nothing */ } item = new QTreeWidgetItem(QStringList(title)); topics_map[item] = pitem; -if (d 0 d == depht) { - // Same level in the tree - stack.pop(); -} else if (d 0 d depht) { - // Less deep - for ( ; d = depht; --depht) { -stack.pop(); - } - stack.top()-addChild(item); - stack.push(item); +dep = s - pitem-topic; +hash.insert(dep, item); +if (dep == 0) { + tree_wdg-addTopLevelItem(item); +} else { + last = dep - 1; + hash.value(last)-addChild(item); } -depht = d; -if (depht 0) { - stack.top()-addChild(item); -} else { - tree_wdg-addTopLevelItem(item); -} -stack.push(item); } help_items_iterate_end; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r27315 - /trunk/client/gui-qt/citydlg.cpp
Author: mir3x Date: Tue Dec 16 16:28:24 2014 New Revision: 27315 URL: http://svn.gna.org/viewcvs/freeciv?rev=27315view=rev Log: Fixed wrong city dialog title See patch #5552 Modified: trunk/client/gui-qt/citydlg.cpp Modified: trunk/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/citydlg.cpp?rev=27315r1=27314r2=27315view=diff == --- trunk/client/gui-qt/citydlg.cpp (original) +++ trunk/client/gui-qt/citydlg.cpp Tue Dec 16 16:28:24 2014 @@ -2479,7 +2479,7 @@ population_to_text(city_population(pcity))); } else { /* TRANS: city dialog title */ -buf = QString(_(%1 - %2 citizens - celebrating)).arg(city_name(pcity), +buf = QString(_(%1 - %2 citizens)).arg(city_name(pcity), population_to_text(city_population(pcity))); } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r27340 - /branches/S2_5/client/gui-qt/fc_client.cpp
Author: mir3x Date: Thu Dec 18 18:05:25 2014 New Revision: 27340 URL: http://svn.gna.org/viewcvs/freeciv?rev=27340view=rev Log: Fixed encoding in city names. See bug #23007 Modified: branches/S2_5/client/gui-qt/fc_client.cpp Modified: branches/S2_5/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=27340r1=27339r2=27340view=diff == --- branches/S2_5/client/gui-qt/fc_client.cpp (original) +++ branches/S2_5/client/gui-qt/fc_client.cpp Thu Dec 18 18:05:25 2014 @@ -47,6 +47,7 @@ #if QT_VERSION QT_VERSION_CHECK(5, 0, 0) QTextCodec::setCodecForCStrings(QTextCodec::codecForName(UTF-8)); #endif + QTextCodec::setCodecForLocale(QTextCodec::codecForName(UTF-8)); /** * Somehow freeciv-client-common asks to switch to page when all widgets * haven't been created yet by Qt, even constructor finished job, ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r27341 - /trunk/client/gui-qt/fc_client.cpp
Author: mir3x Date: Thu Dec 18 18:05:55 2014 New Revision: 27341 URL: http://svn.gna.org/viewcvs/freeciv?rev=27341view=rev Log: Fixed encoding in city names. See bug #23007 Modified: trunk/client/gui-qt/fc_client.cpp Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=27341r1=27340r2=27341view=diff == --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Thu Dec 18 18:05:55 2014 @@ -44,6 +44,7 @@ / fc_client::fc_client() : QMainWindow() { + QTextCodec::setCodecForLocale(QTextCodec::codecForName(UTF-8)); /** * Somehow freeciv-client-common asks to switch to page when all widgets * haven't been created yet by Qt, even constructor finished job, ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r27343 - in /branches/S2_5/client/gui-qt: menu.cpp menu.h
Author: mir3x Date: Thu Dec 18 18:26:52 2014 New Revision: 27343 URL: http://svn.gna.org/viewcvs/freeciv?rev=27343view=rev Log: Added 'Save', 'Save As' and 'Leave Game' menus to Qt-client See bug #23011 Modified: branches/S2_5/client/gui-qt/menu.cpp branches/S2_5/client/gui-qt/menu.h Modified: branches/S2_5/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.cpp?rev=27343r1=27342r2=27343view=diff == --- branches/S2_5/client/gui-qt/menu.cpp(original) +++ branches/S2_5/client/gui-qt/menu.cppThu Dec 18 18:26:52 2014 @@ -17,9 +17,13 @@ // Qt #include QApplication +#include QFileDialog #include QMainWindow #include QMessageBox #include QScrollArea + +// utility +#include string_vector.h // common #include game.h @@ -28,6 +32,7 @@ #include unit.h // client +#include connectdlg_common.h #include control.h #include helpdata.h @@ -287,6 +292,20 @@ act = menu-addAction(_(Messages)); connect(act, SIGNAL(triggered()), this, SLOT(messages_options())); menu = pr; + menu-addSeparator(); + act = menu-addAction(_(Save Game)); + act-setShortcut(QKeySequence(tr(Ctrl+s))); + act-setIcon(style()-standardIcon(QStyle::SP_DialogSaveButton)); + menu_list.insertMulti(SAVE, act); + connect(act, SIGNAL(triggered()), this, SLOT(save_game())); + act = menu-addAction(_(Save Game As...)); + menu_list.insertMulti(SAVE, act); + act-setIcon(style()-standardIcon(QStyle::SP_DialogSaveButton)); + connect(act, SIGNAL(triggered()), this, SLOT(save_game_as())); + menu-addSeparator(); + act = menu-addAction(_(Leave game)); + act-setIcon(style()-standardIcon(QStyle::SP_DialogDiscardButton)); + connect(act, SIGNAL(triggered()), this, SLOT(back_to_menu())); act = menu-addAction(_(Quit)); act-setIcon(style()-standardIcon(QStyle::SP_TitleBarCloseButton)); connect(act, SIGNAL(triggered()), this, SLOT(quit_game())); @@ -1099,7 +1118,11 @@ i.value()-setEnabled(true); } break; - + case SAVE: +if (can_client_access_hack() C_S_RUNNING = client_state()) { + i.value()-setEnabled(true); +} +break; default: break; } @@ -1916,3 +1939,65 @@ { popup_quit_dialog(); } + +/*** + Menu Save Game +***/ +void mr_menu::save_game() +{ + send_save_game(NULL); +} + +/*** + Menu Save Game As... +***/ +void mr_menu::save_game_as() +{ + QString str; + QString current_file; + QString location; + + strvec_iterate(get_save_dirs(), dirname) { +location = dirname; +// choose last location + } strvec_iterate_end; + + str = QString(_(Save Games)) ++ QString( (*.sav *.sav.bz2 *.sav.gz *.sav.xz)); + current_file = QFileDialog::getSaveFileName(gui()-central_wdg, + _(Save Game As...), + location, str); + if (current_file.isEmpty() == false) { +send_save_game(current_file.toLocal8Bit().data()); + } +} + +/*** + Back to Main Menu +***/ +void mr_menu::back_to_menu() +{ + QMessageBox ask(gui()-central_wdg); + int ret; + if (is_server_running()) { +ask.setText(_(Leaving a local game will end it!)); +ask.setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok); +ask.setDefaultButton(QMessageBox::Cancel); +ask.setIcon(QMessageBox::Warning); +ask.setWindowTitle(Leave game); +ret = ask.exec(); + +switch (ret) { +case QMessageBox::Cancel: + break; +case QMessageBox::Ok: + if (client.conn.used) { +disconnect_from_server(); + } + break; +} + } else { +disconnect_from_server(); + } +} + Modified: branches/S2_5/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.h?rev=27343r1=27342r2=27343view=diff == --- branches/S2_5/client/gui-qt/menu.h (original) +++ branches/S2_5/client/gui-qt/menu.h Thu Dec 18 18:26:52 2014 @@ -68,7 +68,8 @@ ORDER_DIPLOMAT_DLG, NUKE, UPGRADE, - SETTLER + SETTLER, + SAVE }; /** @@ -134,6 +135,9 @@ void local_options(); void server_options(); void messages_options(); + void save_game(); + void save_game_as(); + void back_to_menu(); void quit_game(); /* help menu */ ___ Freeciv-commits mailing list
[Freeciv-commits] r27342 - in /trunk/client/gui-qt: menu.cpp menu.h
Author: mir3x Date: Thu Dec 18 18:26:40 2014 New Revision: 27342 URL: http://svn.gna.org/viewcvs/freeciv?rev=27342view=rev Log: Added 'Save', 'Save As' and 'Leave Game' menus to Qt-client See bug #23011 Modified: trunk/client/gui-qt/menu.cpp trunk/client/gui-qt/menu.h Modified: trunk/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=27342r1=27341r2=27342view=diff == --- trunk/client/gui-qt/menu.cpp(original) +++ trunk/client/gui-qt/menu.cppThu Dec 18 18:26:40 2014 @@ -17,9 +17,13 @@ // Qt #include QApplication +#include QFileDialog #include QMainWindow #include QMessageBox #include QScrollArea + +// utility +#include string_vector.h // common #include game.h @@ -28,6 +32,7 @@ #include unit.h // client +#include connectdlg_common.h #include control.h #include helpdata.h @@ -284,6 +289,20 @@ act = menu-addAction(_(Messages)); connect(act, SIGNAL(triggered()), this, SLOT(messages_options())); menu = pr; + menu-addSeparator(); + act = menu-addAction(_(Save Game)); + act-setShortcut(QKeySequence(tr(Ctrl+s))); + act-setIcon(style()-standardIcon(QStyle::SP_DialogSaveButton)); + menu_list.insertMulti(SAVE, act); + connect(act, SIGNAL(triggered()), this, SLOT(save_game())); + act = menu-addAction(_(Save Game As...)); + menu_list.insertMulti(SAVE, act); + act-setIcon(style()-standardIcon(QStyle::SP_DialogSaveButton)); + connect(act, SIGNAL(triggered()), this, SLOT(save_game_as())); + menu-addSeparator(); + act = menu-addAction(_(Leave game)); + act-setIcon(style()-standardIcon(QStyle::SP_DialogDiscardButton)); + connect(act, SIGNAL(triggered()), this, SLOT(back_to_menu())); act = menu-addAction(_(Quit)); act-setIcon(style()-standardIcon(QStyle::SP_TitleBarCloseButton)); connect(act, SIGNAL(triggered()), this, SLOT(quit_game())); @@ -1148,7 +1167,11 @@ i.value()-setEnabled(true); } break; - + case SAVE: +if (can_client_access_hack() C_S_RUNNING = client_state()) { + i.value()-setEnabled(true); +} +break; default: break; } @@ -1981,3 +2004,65 @@ { popup_quit_dialog(); } + +/*** + Menu Save Game +***/ +void mr_menu::save_game() +{ + send_save_game(NULL); +} + +/*** + Menu Save Game As... +***/ +void mr_menu::save_game_as() +{ + QString str; + QString current_file; + QString location; + + strvec_iterate(get_save_dirs(), dirname) { +location = dirname; +// choose last location + } strvec_iterate_end; + + str = QString(_(Save Games)) ++ QString( (*.sav *.sav.bz2 *.sav.gz *.sav.xz)); + current_file = QFileDialog::getSaveFileName(gui()-central_wdg, + _(Save Game As...), + location, str); + if (current_file.isEmpty() == false) { +send_save_game(current_file.toLocal8Bit().data()); + } +} + +/*** + Back to Main Menu +***/ +void mr_menu::back_to_menu() +{ + QMessageBox ask(gui()-central_wdg); + int ret; + if (is_server_running()) { +ask.setText(_(Leaving a local game will end it!)); +ask.setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok); +ask.setDefaultButton(QMessageBox::Cancel); +ask.setIcon(QMessageBox::Warning); +ask.setWindowTitle(Leave game); +ret = ask.exec(); + +switch (ret) { +case QMessageBox::Cancel: + break; +case QMessageBox::Ok: + if (client.conn.used) { +disconnect_from_server(); + } + break; +} + } else { +disconnect_from_server(); + } +} + Modified: trunk/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.h?rev=27342r1=27341r2=27342view=diff == --- trunk/client/gui-qt/menu.h (original) +++ trunk/client/gui-qt/menu.h Thu Dec 18 18:26:40 2014 @@ -69,7 +69,8 @@ ORDER_DIPLOMAT_DLG, NUKE, UPGRADE, - SETTLER + SETTLER, + SAVE }; /** @@ -135,6 +136,9 @@ void local_options(); void server_options(); void messages_options(); + void save_game(); + void save_game_as(); + void back_to_menu(); void quit_game(); /* help menu */ ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r27347 - in /branches/S2_5: ./ client/gui-qt/ data/themes/gui-qt/ data/themes/gui-qt/icons/ data/themes/gui-qt/oxygen/
Author: mir3x Date: Fri Dec 19 15:50:58 2014 New Revision: 27347 URL: http://svn.gna.org/viewcvs/freeciv?rev=27347view=rev Log: Removed oxygen icons Patch submitted by Louis Moureaux louis94 See bug #23094 Added: branches/S2_5/data/themes/gui-qt/icons/ branches/S2_5/data/themes/gui-qt/icons/Makefile.am Removed: branches/S2_5/data/themes/gui-qt/oxygen/ Modified: branches/S2_5/client/gui-qt/fc_client.cpp branches/S2_5/configure.ac branches/S2_5/data/themes/gui-qt/Makefile.am Modified: branches/S2_5/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=27347r1=27346r2=27347view=diff == --- branches/S2_5/client/gui-qt/fc_client.cpp (original) +++ branches/S2_5/client/gui-qt/fc_client.cpp Fri Dec 19 15:50:58 2014 @@ -738,9 +738,10 @@ / QIcon fc_icons::get_icon(const QString id) { - return QIcon(fileinfoname(get_data_dirs(), -QString(themes/gui-qt/oxygen/ + QIcon fallback = QIcon(fileinfoname(get_data_dirs(), +QString(themes/gui-qt/icons/ + id + .png).toLocal8Bit().data())); + return QIcon::fromTheme(id, fallback); } / @@ -749,7 +750,7 @@ QString fc_icons::get_path(const QString id) { return fileinfoname(get_data_dirs(), - QString(themes/gui-qt/oxygen/ + QString(themes/gui-qt/icons/ + id + .png).toLocal8Bit().data()); } Modified: branches/S2_5/configure.ac URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/configure.ac?rev=27347r1=27346r2=27347view=diff == --- branches/S2_5/configure.ac (original) +++ branches/S2_5/configure.ac Fri Dec 19 15:50:58 2014 @@ -1468,7 +1468,7 @@ data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Tabs/Makefile data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Toolbar/Makefile data/themes/gui-qt/Makefile - data/themes/gui-qt/oxygen/Makefile + data/themes/gui-qt/icons/Makefile data/themes/gui-sdl/Makefile data/themes/gui-sdl/human/Makefile data/wonders/Makefile Modified: branches/S2_5/data/themes/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/themes/gui-qt/Makefile.am?rev=27347r1=27346r2=27347view=diff == --- branches/S2_5/data/themes/gui-qt/Makefile.am(original) +++ branches/S2_5/data/themes/gui-qt/Makefile.amFri Dec 19 15:50:58 2014 @@ -1,4 +1,3 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = oxygen - +SUBDIRS = icons Added: branches/S2_5/data/themes/gui-qt/icons/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/themes/gui-qt/icons/Makefile.am?rev=27347view=auto == --- branches/S2_5/data/themes/gui-qt/icons/Makefile.am (added) +++ branches/S2_5/data/themes/gui-qt/icons/Makefile.am Fri Dec 19 15:50:58 2014 @@ -0,0 +1,26 @@ +## Process this file with automake to produce Makefile.in + +## Override automake so that make install puts these in proper place: +pkgdatadir = $(datadir)/$(PACKAGE)/themes/gui-qt/oxygen + +## Uncomment those once we have icons +# pkgdata_DATA = \ +# configure.png \ +# edit-find.png \ +# flag.png\ +# go-up.png \ +# list-remove.png \ +# network-disconnect.png \ +# preferences-other.png \ +# edit-delete.png \ +# fork.png\ +# help-donate.png \ +# meeting-chair.png \ +# network-server.png \ +# preferences-system.png \ +# go-down.png \ +# list-add.png\ +# meeting-observer.png\ +# object-locked.png + +EXTRA_DIST = $(pkgdata_DATA) ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r27348 - in /trunk: ./ client/gui-qt/ data/themes/gui-qt/ data/themes/gui-qt/icons/ data/themes/gui-qt/oxygen/
Author: mir3x Date: Fri Dec 19 15:51:38 2014 New Revision: 27348 URL: http://svn.gna.org/viewcvs/freeciv?rev=27348view=rev Log: Removed oxygen icons Patch submitted by Louis Moureaux louis94 See bug #23094 Added: trunk/data/themes/gui-qt/icons/ trunk/data/themes/gui-qt/icons/Makefile.am Removed: trunk/data/themes/gui-qt/oxygen/ Modified: trunk/client/gui-qt/fc_client.cpp trunk/configure.ac trunk/data/themes/gui-qt/Makefile.am Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=27348r1=27347r2=27348view=diff == --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Fri Dec 19 15:51:38 2014 @@ -730,9 +730,10 @@ / QIcon fc_icons::get_icon(const QString id) { - return QIcon(fileinfoname(get_data_dirs(), -QString(themes/gui-qt/oxygen/ + QIcon fallback = QIcon(fileinfoname(get_data_dirs(), +QString(themes/gui-qt/icons/ + id + .png).toLocal8Bit().data())); + return QIcon::fromTheme(id, fallback); } / @@ -741,7 +742,7 @@ QString fc_icons::get_path(const QString id) { return fileinfoname(get_data_dirs(), - QString(themes/gui-qt/oxygen/ + QString(themes/gui-qt/icons/ + id + .png).toLocal8Bit().data()); } Modified: trunk/configure.ac URL: http://svn.gna.org/viewcvs/freeciv/trunk/configure.ac?rev=27348r1=27347r2=27348view=diff == --- trunk/configure.ac (original) +++ trunk/configure.ac Fri Dec 19 15:51:38 2014 @@ -1464,7 +1464,7 @@ data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Tabs/Makefile data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Toolbar/Makefile data/themes/gui-qt/Makefile - data/themes/gui-qt/oxygen/Makefile + data/themes/gui-qt/icons/Makefile data/themes/gui-sdl/Makefile data/themes/gui-sdl/human/Makefile data/themes/gui-sdl2/Makefile Modified: trunk/data/themes/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/themes/gui-qt/Makefile.am?rev=27348r1=27347r2=27348view=diff == --- trunk/data/themes/gui-qt/Makefile.am(original) +++ trunk/data/themes/gui-qt/Makefile.amFri Dec 19 15:51:38 2014 @@ -1,4 +1,3 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = oxygen - +SUBDIRS = icons Added: trunk/data/themes/gui-qt/icons/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/themes/gui-qt/icons/Makefile.am?rev=27348view=auto == --- trunk/data/themes/gui-qt/icons/Makefile.am (added) +++ trunk/data/themes/gui-qt/icons/Makefile.am Fri Dec 19 15:51:38 2014 @@ -0,0 +1,26 @@ +## Process this file with automake to produce Makefile.in + +## Override automake so that make install puts these in proper place: +pkgdatadir = $(datadir)/$(PACKAGE)/themes/gui-qt/icons + +## Uncomment those once we have icons +# pkgdata_DATA = \ +# configure.png \ +# edit-find.png \ +# flag.png\ +# go-up.png \ +# list-remove.png \ +# network-disconnect.png \ +# preferences-other.png \ +# edit-delete.png \ +# fork.png\ +# help-donate.png \ +# meeting-chair.png \ +# network-server.png \ +# preferences-system.png \ +# go-down.png \ +# list-add.png\ +# meeting-observer.png\ +# object-locked.png + +EXTRA_DIST = $(pkgdata_DATA) ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits