Merge lp:~widelands-dev/widelands/chat-messages-overlap into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 7940
Proposed branch: lp:~widelands-dev/widelands/chat-messages-overlap
Merge into: lp:widelands
Diff against target: 54 lines (+12/-4)
2 files modified
src/wui/interactive_base.cc (+11/-4)
src/wui/interactive_base.h (+1/-0)
To merge this branch: bzr merge lp:~widelands-dev/widelands/chat-messages-overlap
Reviewer Review Type Date Requested Status
GunChleoc Needs Resubmitting
Miroslav Remák Approve
Review via email: mp+290834@code.launchpad.net

Commit message

Shifted chat overlay up so it won't overlap with the menu buttons.

Description of the change

See commit message - it's a problem at 800x600 resolution.

To post a comment you must log in.
Revision history for this message
Miroslav Remák (miroslavr256) wrote :

Change the height here as well, so it doesn't shift back down on resolution change:

 graphic_resolution_changed_subscriber_ = Notifications::subscribe<GraphicResolutionChanged>(
    [this](const GraphicResolutionChanged& message) {
     set_size(message.width, message.height);

     chat_overlay_->set_size(get_w() / 2, get_h() - 25);
     chat_overlay_->recompute();
     adjust_toolbar_position();
  });

review: Needs Fixing
Revision history for this message
Miroslav Remák (miroslavr256) wrote :

LGTM.

review: Approve
Revision history for this message
GunChleoc (gunchleoc) wrote :

I decided to refactor this into a function. What do you think?

review: Needs Resubmitting
Revision history for this message
Miroslav Remák (miroslavr256) wrote :

Fine with me. Could you also fix the inconsistent indentation of that lambda?

Revision history for this message
Miroslav Remák (miroslavr256) wrote :

The constructor would probably need prettifying as well.

Revision history for this message
GunChleoc (gunchleoc) wrote :

What would you suggest regarding the prettyfying?

Indents are a problem with my IDE - we will run clang-format over the codebase before branching Build 19 to fix these issues.

Revision history for this message
Miroslav Remák (miroslavr256) wrote :

I don't have any experience with automatic formatting tools besides auto-indent in my IDE. I was suggesting doing it manually for these few lines (the rest is OK), but it can be done later. I think you can go ahead and merge it as it is then.

Revision history for this message
GunChleoc (gunchleoc) wrote :

OK, thanks!

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/wui/interactive_base.cc'
2--- src/wui/interactive_base.cc 2016-03-08 15:21:41 +0000
3+++ src/wui/interactive_base.cc 2016-04-04 08:33:07 +0000
4@@ -83,7 +83,7 @@
5 : MapView(nullptr, 0, 0, g_gr->get_xres(), g_gr->get_yres(), *this),
6 // Initialize chatoveraly before the toolbar so it is below
7 show_workarea_preview_(global_s.get_bool("workareapreview", true)),
8- chat_overlay_(new ChatOverlay(this, 10, 25, get_w() / 2, get_h() - 25)),
9+ chat_overlay_(new ChatOverlay(this, 10, 25, get_w() / 2, get_h() - 25)),
10 toolbar_(this, 0, 0, UI::Box::Horizontal),
11 m(new InteractiveBaseInternals(new QuickNavigation(the_egbase, get_w(), get_h()))),
12 field_overlay_manager_(new FieldOverlayManager()),
13@@ -110,12 +110,12 @@
14 g_gr->images().get("images/wui/overlays/workarea2.png"),
15 g_gr->images().get("images/wui/overlays/workarea1.png")} {
16
17+ resize_chat_overlay();
18+
19 graphic_resolution_changed_subscriber_ = Notifications::subscribe<GraphicResolutionChanged>(
20 [this](const GraphicResolutionChanged& message) {
21 set_size(message.width, message.height);
22-
23- chat_overlay_->set_size(get_w() / 2, get_h() - 25);
24- chat_overlay_->recompute();
25+ resize_chat_overlay();
26 adjust_toolbar_position();
27 });
28
29@@ -725,6 +725,13 @@
30 }
31
32
33+// Repositions the chat overlay
34+void InteractiveBase::resize_chat_overlay() {
35+ // 34 is the button height of the bottom menu
36+ chat_overlay_->set_size(get_w() / 2, get_h() - 25 - 34);
37+ chat_overlay_->recompute();
38+}
39+
40
41 /*
42 ===============
43
44=== modified file 'src/wui/interactive_base.h'
45--- src/wui/interactive_base.h 2016-02-09 16:29:48 +0000
46+++ src/wui/interactive_base.h 2016-04-04 08:33:07 +0000
47@@ -171,6 +171,7 @@
48 UI::Box toolbar_;
49
50 private:
51+ void resize_chat_overlay();
52 void roadb_add_overlay ();
53 void roadb_remove_overlay();
54 void cmd_map_object(const std::vector<std::string> & args);

Subscribers

People subscribed via source and target branches

to status/vote changes: