Skip to content

Commit

Permalink
de::App|Refactor: More explicit "GUI enabled" argument
Browse files Browse the repository at this point in the history
It is a good idea to avoid plain bools in APIs for improved
code readability.
  • Loading branch information
skyjake committed Jul 19, 2012
1 parent 2d354a5 commit 553ea3b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/dd_init.cpp
Expand Up @@ -133,7 +133,7 @@ int main(int argc, char** argv)
}

// Application core.
de::App dengApp(argc, argv, useGUI);
de::App dengApp(argc, argv, useGUI? de::App::GUIEnabled : de::App::GUIDisabled);

// Override the system locale (affects number/time formatting).
QLocale::setDefault(QLocale("en_US.UTF-8"));
Expand Down
7 changes: 6 additions & 1 deletion doomsday/libdeng2/include/de/core/app.h
Expand Up @@ -46,8 +46,13 @@ namespace de
/// The object or resource that was being looked for was not found. @ingroup errors
DENG2_ERROR(NotFoundError);

enum GUIMode {
GUIDisabled = 0,
GUIEnabled = 1
};

public:
App(int& argc, char** argv, bool useGUI);
App(int& argc, char** argv, GUIMode guiMode);

/**
* Initializes all the application's subsystems. This includes Config and FS.
Expand Down
4 changes: 2 additions & 2 deletions doomsday/libdeng2/src/core/app.cpp
Expand Up @@ -29,8 +29,8 @@

using namespace de;

App::App(int& argc, char** argv, bool useGUI)
: QApplication(argc, argv, useGUI),
App::App(int& argc, char** argv, GUIMode guiMode)
: QApplication(argc, argv, guiMode == GUIEnabled),
_cmdLine(argc, argv),
_config(0)
{
Expand Down

0 comments on commit 553ea3b

Please sign in to comment.