Merge lp:~qcumber-some/widelands/bug704637_2 into lp:widelands

Proposed by Jens Beyer
Status: Merged
Merged at revision: 6528
Proposed branch: lp:~qcumber-some/widelands/bug704637_2
Merge into: lp:widelands
Diff against target: 68 lines (+19/-1)
3 files modified
src/graphic/graphic.cc (+8/-1)
src/graphic/graphic.h (+3/-0)
src/wlapplication.cc (+8/-0)
To merge this branch: bzr merge lp:~qcumber-some/widelands/bug704637_2
Reviewer Review Type Date Requested Status
Nicolai Hähnle Approve
Review via email: mp+151828@code.launchpad.net

Description of the change

Additional commit regarding bug704637 - show message in case this happens.

I hope I've done everything correct. Just nitpick in case I could do something in a better way :-)

To post a comment you must log in.
Revision history for this message
Nicolai Hähnle (nha) wrote :

The overall design looks perfectly good to me, but let me pick some nits ;)

1. I think you forgot to set the messagetitle, or was that on purpose?
2. Please use either m_xxx or xxx_ for member variables.
3. I would usually prefer to initialize a member variable in the initializer list of the constructor.

review: Approve
Revision history for this message
Jens Beyer (qcumber-some) wrote :

Thanks for the quick review.

1. No, I forgot. The way it is now, it will lead to errors with subsequent messages. I will fix it. Thanks for spotting this.
2. I will use m_fallback_settings_in_effect.
3. I will move it to the constructor.

After fixing this, I will push it to trunk.

Thanks for the review, this is the way I am learning this ;-)

Revision history for this message
SirVer (sirver) wrote :

I picked another nit and fixed it in trunk: The ordering of the items in the constructor must be the same as the ordering of the items in the class in the header - otherwise an error will be thrown.

Good feature, thanks for adding this in!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/graphic/graphic.cc'
2--- src/graphic/graphic.cc 2013-03-04 10:43:03 +0000
3+++ src/graphic/graphic.cc 2013-03-06 17:57:24 +0000
4@@ -73,7 +73,8 @@
5 m_update_fullscreen(true),
6 image_loader_(new ImageLoaderImpl()),
7 surface_cache_(create_surface_cache(SURFACE_CACHE_SIZE)),
8- image_cache_(create_image_cache(image_loader_.get(), surface_cache_.get()))
9+ image_cache_(create_image_cache(image_loader_.get(), surface_cache_.get())),
10+ m_fallback_settings_in_effect (false)
11 {
12 ImageTransformations::initialize();
13
14@@ -133,6 +134,7 @@
15 flags &= ~SDL_FULLSCREEN;
16 sdlsurface = SDL_SetVideoMode
17 (FALLBACK_GRAPHICS_WIDTH, FALLBACK_GRAPHICS_HEIGHT, FALLBACK_GRAPHICS_DEPTH, flags);
18+ m_fallback_settings_in_effect = true;
19 if (!sdlsurface)
20 throw wexception
21 ("Graphics: could not set video mode: %s", SDL_GetError());
22@@ -303,6 +305,11 @@
23 m_rendertarget = new RenderTarget(screen_.get());
24 }
25
26+bool Graphic::check_fallback_settings_in_effect()
27+{
28+ return m_fallback_settings_in_effect;
29+}
30+
31 /**
32 * Free the surface
33 */
34
35=== modified file 'src/graphic/graphic.h'
36--- src/graphic/graphic.h 2013-03-01 18:43:44 +0000
37+++ src/graphic/graphic.h 2013-03-06 17:57:24 +0000
38@@ -130,8 +130,11 @@
39
40 const GraphicCaps& caps() const throw () {return m_caps;}
41
42+ bool check_fallback_settings_in_effect();
43+
44 private:
45 void save_png_(Surface & surf, StreamWrite*) const;
46+ bool m_fallback_settings_in_effect;
47
48 protected:
49 // Static helper function for png writing
50
51=== modified file 'src/wlapplication.cc'
52--- src/wlapplication.cc 2013-02-16 01:05:43 +0000
53+++ src/wlapplication.cc 2013-03-06 17:57:24 +0000
54@@ -1534,6 +1534,14 @@
55 std::string messagetitle;
56 std::string message;
57
58+ if (g_gr->check_fallback_settings_in_effect())
59+ {
60+ messagetitle = _("Fallback settings in effect");
61+ message = _
62+ ("Your video settings could not be enabled, and fallback settings are in effect. "
63+ "Please check the graphics options!");
64+ }
65+
66 for (;;) {
67 // Refresh graphics system in case we just changed resolution.
68 refresh_graphics();

Subscribers

People subscribed via source and target branches

to status/vote changes: