int main(int argc, char * argv[]) { // Our double parsing code (base/string_utils.hpp) needs dots as a floating point delimiters, not commas. // TODO: Refactor our doubles parsing code to use locale-independent delimiters. // For example, https://github.com/google/double-conversion can be used. // See http://dbaron.org/log/20121222-locale for more details. (void)::setenv("LC_NUMERIC", "C", 1); InitializeFinalize mainGuard; UNUSED_VALUE(mainGuard); QApplication a(argc, argv); #ifdef DEBUG alohalytics::Stats::Instance().SetDebugMode(true); #endif GetPlatform().SetupMeasurementSystem(); // display EULA if needed char const * settingsEULA = "EulaAccepted"; bool eulaAccepted = false; if (!Settings::Get(settingsEULA, eulaAccepted) || !eulaAccepted) { QStringList buttons; buttons << "Accept" << "Decline"; string buffer; { ReaderPtr<Reader> reader = GetPlatform().GetReader("eula.html"); reader.ReadAsString(buffer); } qt::InfoDialog eulaDialog("MAPS.ME End User Licensing Agreement", buffer.c_str(), NULL, buttons); eulaAccepted = (eulaDialog.exec() == 1); Settings::Set(settingsEULA, eulaAccepted); } int returnCode = -1; if (eulaAccepted) // User has accepted EULA { qt::MainWindow w; w.show(); returnCode = a.exec(); } dbg::ObjectTracker::PrintLeaks(); LOG_SHORT(LINFO, ("MapsWithMe finished with code", returnCode)); return returnCode; }
// --------------------------------------------------------------------------- // Name: gdUpdateEulaAcceptence() // Description: Shows the EULA dialog and updates the user's revision number if the user accepted. // In case the user didn't accept the EULA License terms - a proper dialog pops. // Return Val: bool - User accepted / Didn't accept. // Author: Guy Ilany // Date: 2007/12/22 // --------------------------------------------------------------------------- bool gdUpdateEulaAcceptence() { bool retVal = false; // Show the EULA Dialog afEulaDialog eulaDialog(nullptr); // Call the show modal function for the eula dialog: int rc1 = eulaDialog.execute(); // If the user accepted the EULA License terms then we can continue if (QDialog::Accepted == rc1) { retVal = true; } else { // Pop a Message Box telling the user he/she must accept the terms acMessageBox::instance().warning(AF_STR_ErrorA, AC_STR_EULANotAcceptedMessage, QMessageBox::Ok); } return retVal; }