--- a/src/main.cpp Mon Jun 01 17:06:13 2015 +0300 +++ b/src/main.cpp Fri Jun 05 18:33:51 2015 +0300 @@ -1,6 +1,6 @@ /* * ZCinema: Zandronum demo launcher - * Copyright (C) 2013 Santeri Piippo + * Copyright (C) 2013-2015 Teemu Piippo * * 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 @@ -22,61 +22,57 @@ #include "demo.h" #include "prompts.h" -// ============================================================================= -// ----------------------------------------------------------------------------- -int main (int argc, char* argv[]) { +// +// ------------------------------------------------------------------------------------------------- +// + +int main (int argc, char* argv[]) +{ QApplication app (argc, argv); app.setApplicationName (UNIXNAME); app.setOrganizationName (UNIXNAME); app.setApplicationVersion (versionString()); - - cfg::load(); - - for (int i = 1; i < argc; ++i) { - str arg = argv[i]; + + for (int i = 1; i < argc; ++i) + { + QString arg = argv[i]; - if (arg == "--config") { - ConfigBox dlg; + if (arg == "--config") + { + ConfigWindow dlg; return dlg.exec(); } } - if (argc != 2) { - FindFilePrompt* dlg = new FindFilePrompt (null); - if (!dlg->exec()) - return 255; - + if (argc > 1) + { + return launchDemo (argv[1]); + } + else + { + FindFilePrompt* dlg = new FindFilePrompt (NULL); + + if (not dlg->exec()) + return 0; + return launchDemo (dlg->path()); } - - return launchDemo (argv[1]); } -// ============================================================================= -// ----------------------------------------------------------------------------- -str versionString() { - str text = fmt ("v%1.%2", VERSION_MAJOR, VERSION_MINOR); -#if VERSION_PATCH != 0 - text += fmt (".%1", VERSION_PATCH); -#endif - -#if BUILD_ID == BUILD_INTERNAL - text += "-intern"; -#elif BUILD_ID == BUILD_ALPHA - text += "-alpha"; -#elif BUILD_ID == BUILD_BETA - text += "-beta"; -#elif BUILD_ID == BUILD_RC - text += fmt ("-rc%1", RC_ID); -#elif BUILD_ID == BUILD_RELEASE - text += "-rel"; -#else -# error Invalid build code! -#endif // BUILD_ID - - return text; +// +// ------------------------------------------------------------------------------------------------- +// + +QString versionString() +{ + return VERSION_STRING; } -QString versionSignature() { +// +// ------------------------------------------------------------------------------------------------- +// + +QString versionSignature() +{ return QString (APPNAME) + " " + versionString(); } \ No newline at end of file