Author: mir3x Date: Sat Oct 15 00:52:55 2016 New Revision: 34139 URL: http://svn.gna.org/viewcvs/freeciv?rev=34139&view=rev Log: Qt client - control unit selection dialog colors from theme
See patch #7829 Modified: trunk/client/gui-qt/dialogs.cpp trunk/client/gui-qt/dialogs.h trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/fc_client.h trunk/data/themes/gui-qt/Classic/resource.qss trunk/data/themes/gui-qt/Necrophos/resource.qss trunk/data/themes/gui-qt/NightStalker/resource.qss trunk/data/themes/gui-qt/System/resource.qss Modified: trunk/client/gui-qt/dialogs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.cpp?rev=34139&r1=34138&r2=34139&view=diff ============================================================================== --- trunk/client/gui-qt/dialogs.cpp (original) +++ trunk/client/gui-qt/dialogs.cpp Sat Oct 15 00:52:55 2016 @@ -2763,9 +2763,9 @@ } /**************************************************************** - Contructor for unit_select + Contructor for units_select *****************************************************************/ -unit_select::unit_select(tile *ptile, QWidget *parent) +units_select::units_select(tile *ptile, QWidget *parent) { QPoint p, final_p; @@ -2797,7 +2797,7 @@ /**************************************************************** Destructor for unit select *****************************************************************/ -unit_select::~unit_select() +units_select::~units_select() { delete h_pix; delete pix; @@ -2807,7 +2807,7 @@ /**************************************************************** Create pixmap of whole widget except borders (pix) *****************************************************************/ -void unit_select::create_pixmap() +void units_select::create_pixmap() { struct unit *punit; QPixmap *tmp_pix; @@ -2832,10 +2832,11 @@ item_size.setWidth(tileset_full_tile_width(tileset)); item_size.setHeight(tileset_tile_height(tileset) * 3 / 2); more = false; - if (h_pix == NULL) { - h_pix = new QPixmap(item_size.width(), item_size.height()); - h_pix->fill(QColor(100, 100, 100, 140)); - } + if (h_pix != nullptr) { + delete h_pix; + } + h_pix = new QPixmap(item_size.width(), item_size.height()); + h_pix->fill(palette().color(QPalette::HighlightedText)); if (unit_list.size() < 5) { row_count = 1; pix = new QPixmap((unit_list.size()) * item_size.width(), @@ -2863,7 +2864,7 @@ p.begin(pix); ufont.setPixelSize(a); p.setFont(ufont); - pen.setColor(QColor(232, 255, 0)); + pen.setColor(palette().color(QPalette::Text)); p.setPen(pen); while (!pix_list.isEmpty()) { @@ -2903,9 +2904,9 @@ } /**************************************************************** - Event for mouse moving around unit_select + Event for mouse moving around units_select *****************************************************************/ -void unit_select::mouseMoveEvent(QMouseEvent *event) +void units_select::mouseMoveEvent(QMouseEvent *event) { int a, b; int old_h; @@ -2929,11 +2930,11 @@ } /**************************************************************** - Mouse pressed event for unit_select. + Mouse pressed event for units_select. Left Button - chooses units Right Button - closes widget *****************************************************************/ -void unit_select::mousePressEvent(QMouseEvent *event) +void units_select::mousePressEvent(QMouseEvent *event) { struct unit *punit; if (event->button() == Qt::RightButton) { @@ -2957,7 +2958,7 @@ /**************************************************************** Redirected paint event *****************************************************************/ -void unit_select::paint(QPainter *painter, QPaintEvent *event) +void units_select::paint(QPainter *painter, QPaintEvent *event) { QFontMetrics fm(info_font); int h, i; @@ -2995,11 +2996,9 @@ } } h = fm.height(); - painter->setBrush(QColor(0, 0, 0, 135)); - painter->drawRect(0, 0, width(), height()); if (pix != NULL) { painter->drawPixmap(10, h + 3, *pix); - pen.setColor(QColor(232, 255, 0)); + pen.setColor(palette().color(QPalette::Text)); painter->setPen(pen); painter->setFont(info_font); painter->drawText(10, h, str); @@ -3017,7 +3016,7 @@ /**************************************************************** Paint event, redirects to paint(...) *****************************************************************/ -void unit_select::paintEvent(QPaintEvent *event) +void units_select::paintEvent(QPaintEvent *event) { QPainter painter; @@ -3030,7 +3029,7 @@ Function from abstract fcwidget to update menu, its not needed cause widget is easy closable via right mouse click *****************************************************************/ -void unit_select::update_menu() +void units_select::update_menu() { was_destroyed = true; close(); @@ -3040,7 +3039,7 @@ /**************************************************************** Updates unit list on tile *****************************************************************/ -void unit_select::update_units() +void units_select::update_units() { int i = 1; struct unit_list *punit_list; @@ -3068,18 +3067,18 @@ } /**************************************************************** - Close event for unit_select, restores focus to map + Close event for units_select, restores focus to map *****************************************************************/ -void unit_select::closeEvent(QCloseEvent* event) +void units_select::closeEvent(QCloseEvent* event) { gui()->mapview_wdg->setFocus(); QWidget::closeEvent(event); } /**************************************************************** - Mouse wheel event for unit_select + Mouse wheel event for units_select *****************************************************************/ -void unit_select::wheelEvent(QWheelEvent *event) +void units_select::wheelEvent(QWheelEvent *event) { int nr; @@ -3101,9 +3100,9 @@ } /**************************************************************** - Keyboard handler for unit_select + Keyboard handler for units_select *****************************************************************/ -void unit_select::keyPressEvent(QKeyEvent *event) +void units_select::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_Escape) { was_destroyed = true; @@ -3116,7 +3115,7 @@ /*************************************************************************** Change the fonts when needed ***************************************************************************/ -void unit_select::update_font(const QString& name, const QFont& font) +void units_select::update_font(const QString& name, const QFont& font) { // FIXME Updating fonts isn't practical because the size of the widget // will change -> its position too. Modified: trunk/client/gui-qt/dialogs.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.h?rev=34139&r1=34138&r2=34139&view=diff ============================================================================== --- trunk/client/gui-qt/dialogs.h (original) +++ trunk/client/gui-qt/dialogs.h Sat Oct 15 00:52:55 2016 @@ -161,7 +161,7 @@ TODO Add some simple scrollbars (just paint it during paint event, if 'more' is true->scroll visible and would depend on show_line ***************************************************************************/ -class unit_select: public fcwidget +class units_select: public fcwidget { Q_OBJECT QPixmap *pix; @@ -174,8 +174,8 @@ int row_count; close_widget *cw; public: - unit_select(struct tile *ptile, QWidget *parent); - ~unit_select(); + units_select(struct tile *ptile, QWidget *parent); + ~units_select(); void update_menu(); void update_units(); void create_pixmap(); Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=34139&r1=34138&r2=34139&view=diff ============================================================================== --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Sat Oct 15 00:52:55 2016 @@ -630,10 +630,10 @@ if (unit_sel != NULL) { unit_sel->close(); delete unit_sel; - unit_sel = new unit_select(ptile, gui()->mapview_wdg); + unit_sel = new units_select(ptile, gui()->mapview_wdg); unit_sel->show(); } else { - unit_sel = new unit_select(ptile, gui()->mapview_wdg); + unit_sel = new units_select(ptile, gui()->mapview_wdg); unit_sel->show(); } } Modified: trunk/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.h?rev=34139&r1=34138&r2=34139&view=diff ============================================================================== --- trunk/client/gui-qt/fc_client.h (original) +++ trunk/client/gui-qt/fc_client.h Sat Oct 15 00:52:55 2016 @@ -246,7 +246,7 @@ messagewdg *msgwdg; info_tab *infotab; pregamevote *pre_vote; - unit_select *unit_sel; + units_select *unit_sel; xvote *x_vote; goto_dialog *gtd; QCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]; Modified: trunk/data/themes/gui-qt/Classic/resource.qss URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/themes/gui-qt/Classic/resource.qss?rev=34139&r1=34138&r2=34139&view=diff ============================================================================== --- trunk/data/themes/gui-qt/Classic/resource.qss (original) +++ trunk/data/themes/gui-qt/Classic/resource.qss Sat Oct 15 00:52:55 2016 @@ -549,6 +549,13 @@ color: black; } +units_select { + background-color: rgba(0, 0, 0,175); + color: #e8ff00; + selection-color: rgba(221, 204, 161, 140); + border: 1px solid black; +} + chatwdg QTextBrowser { background-color: transparent; Modified: trunk/data/themes/gui-qt/Necrophos/resource.qss URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/themes/gui-qt/Necrophos/resource.qss?rev=34139&r1=34138&r2=34139&view=diff ============================================================================== --- trunk/data/themes/gui-qt/Necrophos/resource.qss (original) +++ trunk/data/themes/gui-qt/Necrophos/resource.qss Sat Oct 15 00:52:55 2016 @@ -448,6 +448,13 @@ background-image:url(LittleFingersun.jpg); } +units_select { + background-color: rgba(0, 0, 0,175); + color: #dcffcf; + selection-color: rgba(0, 100, 0, 140); + border: 1px solid black; +} + science_report QScrollArea QWidget { background-image:url(LittleFingersun.jpg); } Modified: trunk/data/themes/gui-qt/NightStalker/resource.qss URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/themes/gui-qt/NightStalker/resource.qss?rev=34139&r1=34138&r2=34139&view=diff ============================================================================== --- trunk/data/themes/gui-qt/NightStalker/resource.qss (original) +++ trunk/data/themes/gui-qt/NightStalker/resource.qss Sat Oct 15 00:52:55 2016 @@ -572,6 +572,13 @@ color: white; } +units_select { + background-color: rgba(0, 0, 0, 135); + color: white; + selection-color: rgba(25, 25, 95, 135); + border: 2px solid #0000AA; +} + chatwdg QTextBrowser { background-color: transparent; Modified: trunk/data/themes/gui-qt/System/resource.qss URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/themes/gui-qt/System/resource.qss?rev=34139&r1=34138&r2=34139&view=diff ============================================================================== --- trunk/data/themes/gui-qt/System/resource.qss (original) +++ trunk/data/themes/gui-qt/System/resource.qss Sat Oct 15 00:52:55 2016 @@ -42,6 +42,13 @@ background-color: transparent; } +units_select { + background-color: rgba(0, 0, 0, 135); + color: #e8ff00; + selection-color: rgba(100, 100, 100, 140); + border: 1px solid black; +} + messagewdg QTableWidget::item:hover { color: #3399FF; background-color: rgba(55, 55, 54, 225); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits