| 106 | } // namespace |
| 107 | |
| 108 | int main(int argc, char * argv[]) |
| 109 | { |
| 110 | // Our double parsing code (base/string_utils.hpp) needs dots as a floating point delimiters, not commas. |
| 111 | // TODO: Refactor our doubles parsing code to use locale-independent delimiters. |
| 112 | // For example, https://github.com/google/double-conversion can be used. |
| 113 | // See http://dbaron.org/log/20121222-locale for more details. |
| 114 | (void)::setenv("LC_NUMERIC", "C", 1); |
| 115 | |
| 116 | Platform & platform = GetPlatform(); |
| 117 | |
| 118 | LOG(LINFO, ("CoMaps", platform.Version(), "built with QT:", QT_VERSION_STR, "runtime QT:", qVersion(), |
| 119 | "detected CPU cores:", platform.CpuCores())); |
| 120 | |
| 121 | gflags::SetUsageMessage("Desktop application."); |
| 122 | gflags::SetVersionString(platform.Version()); |
| 123 | gflags::ParseCommandLineFlags(&argc, &argv, true); |
| 124 | |
| 125 | if (!FLAGS_resources_path.empty()) |
| 126 | platform.SetResourceDir(FLAGS_resources_path); |
| 127 | if (!FLAGS_data_path.empty()) |
| 128 | platform.SetWritableDirForTests(FLAGS_data_path); |
| 129 | |
| 130 | if (auto const logLevel = base::FromString(FLAGS_log_abort_level); logLevel) |
| 131 | base::g_LogAbortLevel = *logLevel; |
| 132 | else |
| 133 | LOG(LCRITICAL, ("Invalid log level:", FLAGS_log_abort_level)); |
| 134 | |
| 135 | Q_INIT_RESOURCE(resources_common); |
| 136 | |
| 137 | InitializeFinalize mainGuard; |
| 138 | UNUSED_VALUE(mainGuard); |
| 139 | |
| 140 | QApplication app(argc, argv); |
| 141 | app.setDesktopFileName("app.comaps.comaps"); |
| 142 | platform.SetupMeasurementSystem(); |
| 143 | |
| 144 | #ifdef BUILD_DESIGNER |
| 145 | QApplication::setApplicationName("CoMaps Designer"); |
| 146 | #else |
| 147 | QApplication::setApplicationName("CoMaps"); |
| 148 | #endif |
| 149 | |
| 150 | #ifdef DEBUG |
| 151 | static bool constexpr developerMode = true; |
| 152 | #else |
| 153 | static bool constexpr developerMode = false; |
| 154 | #endif |
| 155 | bool outvalue; |
| 156 | if (!settings::Get(settings::kDeveloperMode, outvalue)) |
| 157 | settings::Set(settings::kDeveloperMode, developerMode); |
| 158 | |
| 159 | // Display EULA if needed. |
| 160 | char const * settingsEULA = "EulaAccepted"; |
| 161 | bool eulaAccepted = false; |
| 162 | if (!settings::Get(settingsEULA, eulaAccepted) || !eulaAccepted) |
| 163 | { |
| 164 | std::string buffer; |
| 165 | { |
nothing calls this directly
no test coverage detected