int main(int argc, char** argv) { bool d = (argc > 1 && strcmp(argv[1], "-d") == 0) ? true : false; QApplication *app = new QApplication(argc, argv); app->setOrganizationName("F-list.net"); app->setOrganizationDomain("www.f-list.net"); app->setApplicationName("F-list Messenger"); globalInit(); QFile stylefile("default.qss"); stylefile.open(QFile::ReadOnly); QString stylesheet = QLatin1String(stylefile.readAll()); app->setStyleSheet(stylesheet); flist_messenger::init(); flist_messenger *fmessenger = new flist_messenger(d); fmessenger->show(); return app->exec(); //todo: globalQuit(); }
/*---------------------------------------------------------------------------- ** Function : showSplashScreen ** Description : This function shows Show splash - on starting ** Precondition: None ** Postcondition: Splash Screen is shown onto the screen ** Parameters : refrence to QApplication &a refrence to MainWindow& w ** Return value: None **--------------------------------------------------------------------------*/ void MainWindow::showSplashScreen(QApplication& a, MainWindow& w) { //QPixmap pixmap(":/Images/Images/designer.png"); QPixmap pixmap(":/Images/Images/vscp_bumblebee.png"); QSplashScreen splash(pixmap); splash.show(); splash.showMessage(QObject::tr(" uiMagician .. \n Author : Dinesh Guleria"), Qt::AlignLeft | Qt::AlignTop, Qt::black); //This line represents the alignment of text, color and position // Add a delay SleepTimerDelay::sleep(1); // Clear the splash mesage splash.clearMessage(); //Display Another message splash.showMessage(QObject::tr("Initiating your program now..."), Qt::AlignRight | Qt::AlignBottom, Qt::black); //This line represents the alignment of text, color and position //This is used to accept a click on the screen so that user can cancel the screen a.processEvents(); // Add a delay SleepTimerDelay::sleep(1); //Splash finished splash.finish(&w); }
int test_run(void *papp) { QApplication *app = (QApplication *)papp; return app->exec(); }
int main (int argc, char **argv) { int opt; int temp_int; int option_index = 0; bool bOptionHelp = false; /* Create application instance */ // QApplication::setStyle( new QWindowsStyle ); QApplication qapp (argc, argv); /* Print the version number */ displayVersion(); // create the data location manager (with user data under ~/.showeq DataLocationMgr dataLocMgr(".showeq"); /* Initialize the parameters with default values */ QFileInfo configFileDefInfo = dataLocMgr.findExistingFile(".", "seqdef.xml", true, false); if (!configFileDefInfo.exists()) { fprintf(stderr, "Fatal: Couldn't find seqdef.xml!\n" "\tDid you remember to do 'make install'\n"); exit(-1); } QString configFileDef = configFileDefInfo.absFilePath(); QFileInfo configFileInfo = dataLocMgr.findWriteFile(".", "showeq.xml", true, true); // deal with funky border case since we may be running setuid QString configFile; if (configFileInfo.dir() != QDir::root()) configFile = configFileInfo.absFilePath(); else configFile = QFileInfo(dataLocMgr.userDataDir(".").absPath(), "showeq.xml").absFilePath(); // scan command line arguments for a specified config file int i = 1; while (i < argc) { if ((argv[i][0] == '-') && (argv[i][1] == 'o')) configFile = argv[i + 1]; i ++; } /* NOTE: See preferencefile.cpp for info on how to use prefrences class */ printf("Using config file '%s'\n", (const char*)configFile); pSEQPrefs = new XMLPreferences(configFileDef, configFile); showeq_params = new ShowEQParams; QString section; section = "Interface"; /* Allow map depth filtering */ showeq_params->retarded_coords = pSEQPrefs->getPrefBool("RetardedCoords", section, 0); showeq_params->systime_spawntime = pSEQPrefs->getPrefBool("SystimeSpawntime", section, false); showeq_params->pvp = pSEQPrefs->getPrefBool("PvPTeamColoring", section, false); showeq_params->deitypvp = pSEQPrefs->getPrefBool("DeityPvPTeamColoring", section, false); showeq_params->keep_selected_visible = pSEQPrefs->getPrefBool("KeepSelected", section, true); section = "Misc"; showeq_params->fast_machine = pSEQPrefs->getPrefBool("FastMachine", section, true); showeq_params->createUnknownSpawns = pSEQPrefs->getPrefBool("CreateUnknownSpawns", section, true); showeq_params->walkpathrecord = pSEQPrefs->getPrefBool("WalkPathRecording", section, false); showeq_params->walkpathlength = pSEQPrefs->getPrefInt("WalkPathLength", section, 25); /* Tells SEQ whether or not to display casting messages (Turn this off if you're on a big raid) */ section = "SpawnList"; showeq_params->showRealName = pSEQPrefs->getPrefBool("ShowRealName", section, false); /* Different files for different kinds of raw data */ section = "SaveState"; showeq_params->saveZoneState = pSEQPrefs->getPrefBool("ZoneState", section, 1); showeq_params->savePlayerState = pSEQPrefs->getPrefBool("PlayerState", section, 1); showeq_params->saveSpawns = pSEQPrefs->getPrefBool("Spawns", section, false); showeq_params->saveSpawnsFrequency = pSEQPrefs->getPrefInt("SpawnsFrequency", section, (120 * 1000)); showeq_params->restorePlayerState = false; showeq_params->restoreZoneState = false; showeq_params->restoreSpawns = false; showeq_params->saveRestoreBaseFilename = dataLocMgr.findWriteFile("tmp", pSEQPrefs->getPrefString("BaseFilename", section, "last")).absFilePath(); /* Parse the commandline for commandline parameters */ while ((opt = getopt_long( argc, argv, OPTION_LIST, option_list, &option_index )) != -1 ) { switch (opt) { /* Set the request to use a despawn list based off the spawn alert list. */ /* Set the interface */ case 'i': { pSEQPrefs->setPrefString("Device", "Network", optarg, XMLPreferences::Runtime); break; } /* Set pcap thread to realtime */ case 'r': { pSEQPrefs->setPrefBool("RealTimeThread", "Network", true, XMLPreferences::Runtime); break; } /* Set the spawn filter file */ case 'f': { pSEQPrefs->setPrefString("FilterFile", "Filters", optarg, XMLPreferences::Runtime); break; } /* Packet playback mode */ case 'j': { if (optarg) pSEQPrefs->setPrefString("Filename", "VPacket", optarg, XMLPreferences::Runtime); pSEQPrefs->setPrefBool("Playback", "VPacket", true, XMLPreferences::Runtime); pSEQPrefs->setPrefBool("Record", "VPacket", false, XMLPreferences::Runtime); break; } /* Packet record mode */ case 'g': { if (optarg) pSEQPrefs->setPrefString("Filename", "VPacket", optarg, XMLPreferences::Runtime); pSEQPrefs->setPrefBool("Playback", "VPacket", false, XMLPreferences::Runtime); pSEQPrefs->setPrefBool("Record", "VPacket", true, XMLPreferences::Runtime); break; } /* Config file was already taken care of, ignore */ case 'o': break; /* Make filter case sensitive */ case 'C': { pSEQPrefs->setPrefBool("IsCaseSensitive", "Filters", true, XMLPreferences::Runtime); break; } /* Use retarded coordinate system yxz */ case 'c': { showeq_params->retarded_coords = 1; break; } /* Fast machine updates.. framerate vs packet based */ case 'F': { showeq_params->fast_machine = 1; break; } /* Show unknown spawns */ case 'K': { showeq_params->createUnknownSpawns = 1; break; } /* Select spawn on 'Consider' */ case 'S': { pSEQPrefs->setPrefBool("SelectOnCon", "Interface", true, XMLPreferences::Runtime); break; } /* Select spawn on 'Target' */ case 'e': { pSEQPrefs->setPrefBool("SelectOnTarget", "Interface", true, XMLPreferences::Runtime); break; } /* Show net info */ case 'N': { pSEQPrefs->getPrefBool("ShowNetStats", section, true, XMLPreferences::Runtime); break; } /* 't'rack pathing for mobs */ case 't': { showeq_params->walkpathrecord = 1; break; } /* Maximum spawn path tracking length */ case 'L': { showeq_params->walkpathlength = atoi(optarg); break; } /* Log spawns! */ case 'x': { pSEQPrefs->setPrefBool("LogSpawns", "Misc", true, XMLPreferences::Runtime); break; } /* Display the version info... */ case 'V': case 'v': { exit(0); break; } /* Don't autodetect character settings */ case 'W': { pSEQPrefs->getPrefBool("AutoDetectCharSettings", "Defaults", false, XMLPreferences::Runtime); break; } /* Set default player level */ case 'X': { temp_int = atoi(optarg); if (temp_int < 1 || temp_int > 70) { printf ("Invalid default level. Valid range is 1 - 70.\n"); exit(0); } pSEQPrefs->setPrefInt("DefaultLevel", "Defaults", temp_int, XMLPreferences::Runtime); break; } /* Set default player race */ case 'Y': { temp_int = atoi(optarg); if ((temp_int < 1 || temp_int > 12) && (temp_int != 128) && (temp_int != 130) && (temp_int != 26) && (temp_int != 330)) { printf ("Invalid default race, please use showeq -h to list valid race options.\n"); exit(0); } pSEQPrefs->setPrefInt("DefaultRace", "Defaults", temp_int, XMLPreferences::Runtime); break; } /* Set default player class */ case 'Z': { temp_int = atoi(optarg); if (temp_int < 1 || temp_int > 16) { printf ("Invalid default class, please use showeq -h to list valid class options.\n"); exit(0); } pSEQPrefs->setPrefInt("DefaultClass", "Defaults", temp_int); break; } /* IP address to track */ case IPADDR_OPTION: { pSEQPrefs->setPrefString("IP", "Network", optarg, XMLPreferences::Runtime); break; } /* MAC address to track for those on DHCP */ case MACADDR_OPTION: { pSEQPrefs->setPrefString("MAC", "Network", optarg, XMLPreferences::Runtime); break; } /* Filename for logging all packets */ case GLOBAL_LOG_FILENAME_OPTION: { pSEQPrefs->setPrefString("GlobalLogFilename", "PacketLogging", optarg, XMLPreferences::Runtime); break; } /* Filename for logging world change packets */ case WORLD_LOG_FILENAME_OPTION: { pSEQPrefs->setPrefString("WorldLogFilename", "PacketLogging", optarg, XMLPreferences::Runtime); break; } /* Filename for logging zone change packets */ case ZONE_LOG_FILENAME_OPTION: { pSEQPrefs->setPrefString("ZoneLogFilename", "PacketLogging", optarg, XMLPreferences::Runtime); break; } /* Filename for logging unknown zone change packets */ case UNKNOWN_LOG_FILENAME_OPTION: { pSEQPrefs->setPrefString("UnknownZoneLogFilename", "PacketLogging", optarg, XMLPreferences::Runtime); break; } /* Log everything */ case GLOBAL_LOG_OPTION: { pSEQPrefs->setPrefBool("LogAllPackets", "PacketLogging", true, XMLPreferences::Runtime); break; } /* Log all zone change packets */ case ZONE_LOG_OPTION: { pSEQPrefs->setPrefBool("LogZonePackets", "PacketLogging", true, XMLPreferences::Runtime); break; } /* Log only unfamiliar zone change packets */ case UNKNOWN_ZONE_LOG_OPTION: { pSEQPrefs->setPrefBool("LogUnknownZonePackets", "PacketLogging", true, XMLPreferences::Runtime); break; } case PLAYBACK_SPEED_OPTION: { pSEQPrefs->setPrefInt("PlaybackRate", "VPacket", atoi(optarg), XMLPreferences::Runtime); break; } /* Enable logging of raw packets... */ case RAW_LOG_OPTION: { pSEQPrefs->setPrefBool("LogRawPackets", "PacketLogging", true, XMLPreferences::Runtime); break; } /* Display spawntime in UNIX time (time_t) instead of hh:mm format */ case SYSTIME_SPAWNTIME_OPTION: { showeq_params->systime_spawntime = 1; break; } case SPAWNLOG_FILENAME_OPTION: { pSEQPrefs->setPrefString("SpawnLogFilename", "Misc", optarg, XMLPreferences::Runtime); break; } case ITEMDB_DATA_FILENAME_OPTION: { pSEQPrefs->setPrefString("DataDBFilename", "ItemDB", optarg, XMLPreferences::Runtime); break; } case ITEMDB_RAW_FILENAME_OPTION: { pSEQPrefs->setPrefString("RawDataDBFilename", "ItemDB", optarg, XMLPreferences::Runtime); break; } case ITEMDB_DATABASES_ENABLED: { pSEQPrefs->setPrefInt("DatabasesEnabled", "ItemDB", atoi(optarg), XMLPreferences::Runtime); break; } case ITEMDB_DISABLE: { pSEQPrefs->setPrefBool("Enabled", "ItemDB", false, XMLPreferences::Runtime); break; } case ITEMDB_ENABLE: { pSEQPrefs->setPrefBool("Enabled", "ItemDB", true, XMLPreferences::Runtime); break; } case RESTORE_PLAYER_STATE: { showeq_params->restorePlayerState = true; break; } case RESTORE_ZONE_STATE: { showeq_params->restoreZoneState = true; break; } case RESTORE_SPAWNS: { showeq_params->restoreSpawns = true; break; } case RESTORE_ALL: { showeq_params->restorePlayerState = true; showeq_params->restoreZoneState = true; showeq_params->restoreSpawns = true; break; } /* Spit out the help */ case 'h': /* Fall through */ default: { bOptionHelp = true; break; } } } if (bOptionHelp) { displayOptions(argv[0]); exit (0); } /* Set up individual files for logging selected packet types based on a common filename base. The types to log were found by following where pre_worked was a precondition for further analysis. */ int ret; // just to add a scope to better control when the main interface gets // destroyed if (1) { /* The main interface widget */ EQInterface intf(&dataLocMgr, 0, "interface"); qapp.setMainWidget (&intf); /* Start the main loop */ ret = qapp.exec (); } // delete the preferences data delete pSEQPrefs; // delete the showeq_params data delete showeq_params; return ret; }
int saisieAppuisInitQT_main(QApplication &app, int argc, char *argv[]) { app.setApplicationName("SaisieAppuisInitQT"); app.setOrganizationName("Culture3D"); QStringList cmdline_args = QCoreApplication::arguments(); if (cmdline_args.back().contains("help")) { QString help = "Mandatory unnamed args :\n" "* string :: {Full name (Dir+Pattern)}\n" "* string :: {Orientation ; NONE if not used}\n" "* string :: {Point name, or point file name}\n" "* string :: {Output}\n\n" "Named args :\n" "* [Name=SzW] Pt2di :: {Sz of window}\n" "* [Name=NbF] Pt2di :: {Nb of sub window}\n" "* [Name=NameAuto] string :: {Prefix for automatic point creation}\n" //"* [Name=Pref2Add] string :: {Prefix to add during import (for bug correction ?)}\n" "* [Name=ForceGray] bool :: {Force gray image, def=false}\n" "* [Name=OriMode] string :: {Orientation type (GRID) (Def=Std)}\n" "* [Name=ZMoy] REAL :: {Average Z, Mandatory in PB}\n" "* [Name=ZInc] REAL :: {Incertitude on Z, Mandatory in PB}\n\n" "Example:\nmm3d " + app.applicationName() + " IMG_558{0-9}[1].tif RadialBasic 100 measures.xml\n\n" "NB: visual interface for argument edition available with command:\n\n mm3d v" + app.applicationName() + "\n\n"; return helpMessage(app, help); } loadTranslation(app); QSettings settings(QApplication::organizationName(), QApplication::applicationName()); if ((argc>0)&&(string(argv[0]).find("SaisieQT")!= string::npos)) { argv++; argc--; } Pt2di aSzWin(800,800); Pt2di aNbFen(-1,-1); string aFullName, aDir, aName, aNamePt, aNameOut; //mandatory arguments string aNameOri, aModeOri, aNameAuto, aPrefix2Add; //named args aPrefix2Add = ""; bool aForceGray = false; settings.beginGroup("Misc"); aNameAuto = settings.value("defPtName", QString("100")).toString().toStdString(); settings.endGroup(); settings.beginGroup("Drawing settings"); aForceGray = settings.value("forceGray", false ).toBool(); settings.endGroup(); double aZInc, aZMoy; if (argv[0][0] == 'v') { MMVisualMode = true; argv[0] = (char*) "SaisieAppuisInitQT"; } std::string aInputSec; SaisieAppuisInit(argc, argv, aSzWin, aNbFen, aFullName, aDir, aName, aNamePt, aNameOri, aModeOri, aNameOut, aNameAuto, aPrefix2Add, aForceGray, aZMoy, aZInc,aInputSec); if (!MMVisualMode) { if (!checkNamePt( QString (aNamePt.c_str()))) return -1; QStringList filenames = getFilenames(aDir, aName); int aNbW = aNbFen.x * aNbFen.y; if (filenames.size() < aNbW) { aNbW = filenames.size(); cVirtualInterface::ComputeNbFen(aNbFen, aNbW); } updateSettings(settings, aSzWin,aNbFen, aForceGray); settings.beginGroup("Misc"); settings.setValue("defPtName", QString(aNameAuto.c_str())); settings.endGroup(); QStringList input; input << QString(MMDir().c_str()) + QString("bin/SaisiePts") << QString(MMDir().c_str()) + QString("include/XML_MicMac/SaisieInitiale.xml") << QString("DirectoryChantier=") + QString(aDir.c_str()) << QString("+Image=") + QString(aName.c_str()) << QString("+Ori=") + QString(aNameOri.c_str()) << QString("+NamePt=") + QString(aNamePt.c_str()) << QString("+NameAuto=") + QString(aNameAuto.c_str()) << QString("+Sauv=") + QString(aNameOut.c_str()) << QString("+SzWx=") + QString::number(aSzWin.x) << QString("+SzWy=") + QString::number(aSzWin.y) << QString("+NbFx=") + QString::number(aNbFen.x) << QString("+NbFy=") + QString::number(aNbFen.y); if (aModeOri == "GRID") { input << QString("+ModeOriIm=eGeomImageGrille") << QString("+Conik=false") << QString("+ZIncIsProp=false") //<< QString(+PostFixOri=GRIBin") << QString("+Px1Inc=") + QString::number(aZInc) << QString("+Px1Moy=") + QString::number(aZMoy); //<< QString("+Geom=eGeomMNTFaisceauIm1ZTerrain_Px1D"); } if (EAMIsInit(&aForceGray)) input << QString("+ForceGray=") + QString(((string)(ToString(aForceGray))).c_str()); if (EAMIsInit(&aPrefix2Add)) input << QString("+Pref2Add=") + QString(aPrefix2Add.c_str()); char **output; // Copy input to output output = new char*[input.size() + 1]; for (int i = 0; i < input.size(); i++) { output[i] = new char[strlen(input.at(i).toStdString().c_str())+1]; memcpy(output[i], input.at(i).toStdString().c_str(), strlen(input.at(i).toStdString().c_str())+1); } output[input.size()] = ((char*)NULL); cResultSubstAndStdGetFile<cParamSaisiePts> aP2( input.size()-2,output+2, output[1], StdGetFileXMLSpec("ParamSaisiePts.xml"), "ParamSaisiePts", "ParamSaisiePts", "DirectoryChantier", "FileChantierNameDescripteur" ); cAppli_SaisiePts anAppli (aP2,false); SaisieQtWindow w(POINT2D_INIT); new cQT_Interface(anAppli,&w); w.show(); w.addFiles(filenames, false); return app.exec(); } else return EXIT_SUCCESS; }
int main (int argc, char *argv[]) { QApplication app (argc, argv); QStringList args = app.arguments (); if (!args.isEmpty ()) args.pop_front (); // The command itself qputenv ("DESKTOP_STARTUP_ID", qgetenv ("STARTUP_ID_COPY")); // for startup notifications (set via rkward.desktop) qputenv ("STARTUP_ID_COPY", ""); // Parse arguments that need handling in the wrapper bool usage = false; QStringList debugger_args; QStringList file_args; bool reuse = false; bool warn_external = true; QString r_exe_arg; int debug_level = 2; for (int i=0; i < args.size (); ++i) { if (args[i] == "--debugger") { args.removeAt (i); while (i < args.size ()) { QString arg = args.takeAt (i); if (arg == "--") break; debugger_args.append (arg); } if (debugger_args.isEmpty ()) usage = true; } else if (args[i] == "--r-executable") { if ((i+1) < args.size ()) { r_exe_arg = args.takeAt (i + 1); } else usage = true; args.removeAt (i); --i; } else if (args[i] == "--debug-level") { if ((i+1) < args.size ()) { debug_level = args[i+1].toInt (); } } else if (args[i] == "--reuse") { reuse = true; } else if (args[i] == "--nowarn-external") { warn_external = false; } else if (args[i].startsWith ("--")) { // all RKWard and KDE options (other than --reuse) are of the for --option <value>. So skip over the <value> i++; } else { QUrl url (args[i]); if (url.isRelative ()) { file_args.append (QDir::current ().absoluteFilePath (url.toLocalFile ())); } else { file_args.append (args[i]); } } } if (reuse) { if (!QDBusConnection::sessionBus ().isConnected ()) { if (debug_level > 2) qDebug ("Could not connect to session dbus"); } else { QDBusInterface iface (RKDBUS_SERVICENAME, "/", "", QDBusConnection::sessionBus ()); if (iface.isValid ()) { QDBusReply<void> reply = iface.call ("openAnyUrl", file_args, warn_external); if (!reply.isValid ()) { if (debug_level > 2) qDebug ("Error while placing dbus call: %s", qPrintable (reply.error ().message ())); return 1; } return 0; } } } // MacOS may need some path adjustments, first #ifdef Q_WS_MAC QString oldpath = qgetenv ("PATH"); if (!oldpath.contains (INSTALL_PATH)) { //ensure that PATH is set to include what we deliver with the bundle qputenv ("PATH", QString ("%1/bin:%1/sbin:%2").arg (INSTALL_PATH).arg (oldpath).toLocal8Bit ()); if (debug_level > 3) qDebug ("Adjusting system path to %s", qPrintable (qgetenv ("PATH"))); } // ensure that RKWard finds its own packages qputenv ("R_LIBS", R_LIBS); QProcess::execute ("launchctl", QStringList () << "load" << "-w" << INSTALL_PATH "/Library/LaunchAgents/org.freedesktop.dbus-session.plist"); #endif // Locate KDE and RKWard installations QString kde4_config_exe = findExeAtPath ("kde4-config", QDir::currentPath ()); if (kde4_config_exe.isNull ()) kde4_config_exe = findExeAtPath ("kde4-config", app.applicationDirPath ()); if (kde4_config_exe.isNull ()) kde4_config_exe = findExeAtPath ("kde4-config", QDir (app.applicationDirPath ()).filePath ("KDE/bin")); if (kde4_config_exe.isNull ()) { #ifdef Q_WS_WIN QStringList syspath = QString (qgetenv ("PATH")).split (';'); #else QStringList syspath = QString (qgetenv ("PATH")).split (':'); #endif for (int i = 0; i < syspath.size (); ++i) { kde4_config_exe = findExeAtPath ("kde4-config", syspath[i]); if (!kde4_config_exe.isNull ()) break; } } if (kde4_config_exe.isNull ()) { QMessageBox::critical (0, "Could not find KDE installation", "The KDE installation could not be found (kde4-config). When moving / copying RKWard, make sure to copy the whole application folder, or create a shorcut / link, instead."); exit (1); } QDir kde_dir (QFileInfo (kde4_config_exe).absolutePath ()); kde_dir.makeAbsolute (); QString kde_dir_safe_path = quoteCommand (kde_dir.path ()); #ifdef Q_WS_WIN QString kdeinit4_exe = findExeAtPath ("kdeinit4", kde_dir.path ()); qputenv ("PATH", QString (kde_dir_safe_path + ';' + qgetenv ("PATH")).toLocal8Bit ()); if (debug_level > 3) qDebug ("Adding %s to the system path", qPrintable (kde_dir_safe_path)); #endif // important if RKWard is not in KDEPREFIX/bin but e.g. KDEPREFIX/lib/libexec qputenv ("RKWARD_ENSURE_PREFIX", kde_dir_safe_path.toLocal8Bit ()); if (debug_level > 3) qDebug ("Setting environment variable RKWARD_ENSURE_PREFIX=%s", qPrintable (kde_dir_safe_path)); QString rkward_frontend_exe = findRKWardAtPath (app.applicationDirPath ()); // this is for running directly from a build tree #ifdef Q_WS_MAC if (rkward_frontend_exe.isNull ()) rkward_frontend_exe = findRKWardAtPath (app.applicationDirPath () + "/rkward.frontend.app/Contents/MacOS"); // this is for running directly from a build tree #endif if (rkward_frontend_exe.isNull ()) rkward_frontend_exe = findRKWardAtPath (RKWARD_FRONTEND_LOCATION); if (rkward_frontend_exe.isNull ()) rkward_frontend_exe = findRKWardAtPath (kde_dir.absoluteFilePath ("bin")); if (rkward_frontend_exe.isNull ()) rkward_frontend_exe = findRKWardAtPath (kde_dir.absoluteFilePath ("../lib/libexec")); if (rkward_frontend_exe.isNull ()) { QMessageBox::critical (0, "RKWard frontend binary missing", "RKWard frontend binary could not be found. When moving / copying RKWard, make sure to copy the whole application folder, or create a shorcut / link, instead."); exit (1); } if (usage) { QProcess::execute (rkward_frontend_exe, QStringList ("--help")); exit (1); } #ifdef Q_WS_WIN // Explicit initialization of KDE, in case Windows 7 asks for admin privileges if (kdeinit4_exe.isNull ()) { kdeinit4_exe = findExeAtPath ("kdeinit4", QFileInfo (rkward_frontend_exe).absolutePath ()); } if (!kdeinit4_exe.isNull ()) QProcess::execute (kdeinit4_exe, QStringList ()); #endif // Look for R: //- command line parameter //- Specified in cfg file next to rkward executable //- compile-time default QString r_exe = r_exe_arg; if (!r_exe.isNull ()) { if (!QFileInfo (r_exe).isExecutable ()) { QMessageBox::critical (0, "Specified R executable does not exist", QString ("The R executable specified on the command line (%1) does not exist or is not executable.").arg (r_exe)); exit (1); } if (debug_level > 3) qDebug ("Using R specified on command line"); } else { QFileInfo frontend_info (rkward_frontend_exe); QDir frontend_path = frontend_info.absoluteDir (); QFileInfo rkward_ini_file (frontend_path.absoluteFilePath ("rkward.ini")); if (rkward_ini_file.isReadable ()) { QSettings rkward_ini (rkward_ini_file.absoluteFilePath (), QSettings::IniFormat); r_exe = rkward_ini.value ("R executable").toString (); if (!r_exe.isNull ()) { if (QDir::isRelativePath (r_exe)) { r_exe = frontend_path.absoluteFilePath (r_exe); } if (!QFileInfo (r_exe).isExecutable ()) { QMessageBox::critical (0, "Specified R executable does not exist", QString ("The R executable specified in the rkward.ini file (%1) does not exist or is not executable.").arg (rkward_ini_file.absoluteFilePath ())); exit (1); } } if (debug_level > 3) qDebug ("Using R as configured in config file %s", qPrintable (rkward_ini_file.absoluteFilePath ())); } if (r_exe.isNull ()) { r_exe = R_EXECUTABLE; if (!QFileInfo (r_exe).isExecutable ()) { QMessageBox::critical (0, "Specified R executable does not exist", QString ("The R executable specified at compile time (%1) does not exist or is not executable. Probably the installation of R has moved. You can use the command line parameter '--R', or supply an rkward.ini file to specify the new location.").arg (r_exe)); exit (1); } if (debug_level > 3) qDebug ("Using R as configured at compile time"); } } qputenv ("R_BINARY", r_exe.toLocal8Bit ()); QStringList call_args ("CMD"); call_args.append (debugger_args); call_args.append (quoteCommand (rkward_frontend_exe)); if (!args.isEmpty ()) { // NOTE: QProcess quotes its arguments, *but* properly passing all spaces and quotes through the R CMD wrapper, seems near(?) impossible on Windows. Instead, we use percent encoding, internally. for (int i = 0; i < args.size (); ++i) { call_args.append (QString::fromUtf8 (QUrl::toPercentEncoding (args[i], QByteArray (), " \""))); } } if (debug_level > 2) qDebug ("Starting frontend: %s %s", qPrintable (r_exe), qPrintable (call_args.join (" "))); InteractiveProcess proc; #ifdef Q_WS_WIN if (debugger_args.isEmpty ()) { // start _without_ opening an annoying console window QTemporaryFile *vbsf = new QTemporaryFile (QDir::tempPath () + "/rkwardlaunchXXXXXX.vbs"); vbsf->setAutoRemove (false); if (vbsf->open ()) { QTextStream vbs (vbsf); vbs << "Dim WinScriptHost\r\nSet WinScriptHost = CreateObject(\"WScript.Shell\")\r\nWinScriptHost.Run \"" << quoteCommand (r_exe); for (int i = 0; i < call_args.length (); ++i) { vbs << " " << call_args[i]; } vbs << "\", 0\r\nSet WomScriptHost = Nothing\r\n"; vbsf->close (); QString filename = vbsf->fileName (); delete (vbsf); // somehow, if creating vbsf on the stack, we cannot launch it, because "file is in use by another process", despite we have closed it. proc.start ("WScript.exe", QStringList (filename)); bool ok = proc.waitForFinished (-1); if (proc.exitCode () || !ok) { QMessageBox::critical (0, "Error starting RKWard", QString ("Starting RKWard failed with error \"%1\"").arg (proc.errorString ())); } QFile (filename).remove (); return (0); } } // if that did not work or not on windows: #endif proc.setProcessChannelMode (QProcess::ForwardedChannels); proc.start (quoteCommand (r_exe), call_args); bool ok = proc.waitForFinished (-1); if (proc.exitCode () || !ok) { QMessageBox::critical (0, "Error starting RKWard", QString ("Starting RKWard failed with error \"%1\"").arg (proc.errorString ())); } return (0); }
// This is our main function. Will be called periodically every getPeriod() seconds. bool updateModule() { //qa->processEvents(); qa->exec(); return false; }
int main(int argc, char **argv){ QApplication *app = new QApplication(argc,argv); gomokugame *main = new gomokugame(); main->show(); return app->exec(); }
int main(int argc, char** argv) { QApplication app (argc, argv); InitWindow init_window; init_window.show(); return app.exec(); }
void onQuit(GtkMenu *menu, gpointer data) { Q_UNUSED(menu); QApplication *self = static_cast<QApplication *>(data); self->quit(); }
Q_DECL_EXPORT #endif int main(int argc, char **argv) { QApplication *application; QDeclarativeView *view; #ifdef HAS_BOOSTER application = MDeclarativeCache::qApplication(argc, argv); view = MDeclarativeCache::qDeclarativeView(); #else qWarning() << Q_FUNC_INFO << "Warning! Running without booster. This may be a bit slower."; QApplication stackApp(argc, argv); QDeclarativeView stackView; application = &stackApp; view = &stackView; #endif QString path; QString urlstring; bool isFullscreen = false; QStringList arguments = application->arguments(); for (int i = 0; i < arguments.count(); ++i) { QString parameter = arguments.at(i); if (parameter == "-path") { if (i + 1 >= arguments.count()) qFatal("-path requires an argument"); path = arguments.at(i + 1); i++; } else if (parameter == "-url") { if (i + 1 >= arguments.count()) qFatal("-path requires an argument"); urlstring = arguments.at(i + 1); i++; } else if (parameter == "-fullscreen") { isFullscreen = true; } else if (parameter == "-help") { qDebug() << "Fast QML-only application launcher"; qDebug() << "-fullscreen - show QML fullscreen"; qDebug() << "-path - path to cd to before launching -url"; qDebug() << "-url - file to launch (default: main.qml inside -path)"; exit(0); } } if (!path.isEmpty()) QDir::setCurrent(path); QUrl url; if (urlstring.isEmpty()) url = QUrl::fromLocalFile("main.qml"); else url = QUrl::fromUserInput(urlstring); QObject::connect(view->engine(), SIGNAL(quit()), application, SLOT(quit())); view->setSource(url); view->setAttribute(Qt::WA_OpaquePaintEvent); view->setAttribute(Qt::WA_NoSystemBackground); view->viewport()->setAttribute(Qt::WA_OpaquePaintEvent); view->viewport()->setAttribute(Qt::WA_NoSystemBackground); if (isFullscreen) view->showFullScreen(); else view->show(); return application->exec(); }
extern "C" DECLEXPORT(int) TrustedMain (int argc, char **argv, char ** /*envp*/) { LogFlowFuncEnter(); # if defined(RT_OS_DARWIN) ShutUpAppKit(); # endif for (int i=0; i<argc; i++) if ( !strcmp(argv[i], "-h") || !strcmp(argv[i], "-?") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) { showHelp(); return 0; } #if defined(DEBUG) && defined(Q_WS_X11) && defined(RT_OS_LINUX) /* install our signal handler to backtrace the call stack */ struct sigaction sa; sa.sa_sigaction = bt_sighandler; sigemptyset (&sa.sa_mask); sa.sa_flags = SA_RESTART | SA_SIGINFO; sigaction (SIGSEGV, &sa, NULL); sigaction (SIGBUS, &sa, NULL); sigaction (SIGUSR1, &sa, NULL); #endif #ifdef QT_MAC_USE_COCOA /* Instantiate our NSApplication derivative before QApplication * forces NSApplication to be instantiated. */ UICocoaApplication::instance(); #endif qInstallMsgHandler (QtMessageOutput); int rc = 1; /* failure */ /* scope the QApplication variable */ { #ifdef Q_WS_X11 /* Qt has a complex algorithm for selecting the right visual which * doesn't always seem to work. So we naively choose a visual - the * default one - ourselves and pass that to Qt. This means that we * also have to open the display ourselves. * We check the Qt parameter list and handle Qt's -display argument * ourselves, since we open the display connection. We also check the * to see if the user has passed Qt's -visual parameter, and if so we * assume that the user wants Qt to handle visual selection after all, * and don't supply a visual. */ char *pszDisplay = NULL; bool useDefaultVisual = true; for (int i = 0; i < argc; ++i) { if (!::strcmp(argv[i], "-display") && (i + 1 < argc)) /* What if it isn't? Rely on QApplication to complain? */ { pszDisplay = argv[i + 1]; ++i; } else if (!::strcmp(argv[i], "-visual")) useDefaultVisual = false; } Display *pDisplay = XOpenDisplay(pszDisplay); if (!pDisplay) { RTPrintf(pszDisplay ? "Failed to open the X11 display \"%s\"!\n" : "Failed to open the X11 display!\n", pszDisplay); return 0; } Visual *pVisual = useDefaultVisual ? DefaultVisual(pDisplay, DefaultScreen(pDisplay)) : NULL; /* Now create the application object */ QApplication a (pDisplay, argc, argv, (Qt::HANDLE) pVisual); #else /* Q_WS_X11 */ QApplication a (argc, argv); #endif /* Q_WS_X11 */ /* Qt4.3 version has the QProcess bug which freezing the application * for 30 seconds. This bug is internally used at initialization of * Cleanlooks style. So we have to change this style to another one. * See http://trolltech.com/developer/task-tracker/index_html?id=179200&method=entry * for details. */ if (VBoxGlobal::qtRTVersionString().startsWith ("4.3") && qobject_cast <QCleanlooksStyle*> (QApplication::style())) QApplication::setStyle (new QPlastiqueStyle); #ifdef Q_OS_SOLARIS /* Use plastique look 'n feel for Solaris instead of the default motif (Qt 4.7.x) */ QApplication::setStyle (new QPlastiqueStyle); #endif #ifdef Q_WS_X11 /* This patch is not used for now on Solaris & OpenSolaris because * there is no anti-aliasing enabled by default, Qt4 to be rebuilt. */ #ifndef Q_OS_SOLARIS /* Cause Qt4 has the conflict with fontconfig application as a result * sometimes substituting some fonts with non scaleable-anti-aliased * bitmap font we are reseting substitutes for the current application * font family if it is non scaleable-anti-aliased. */ QFontDatabase fontDataBase; QString currentFamily (QApplication::font().family()); bool isCurrentScaleable = fontDataBase.isScalable (currentFamily); /* LogFlowFunc (("Font: Current family is '%s'. It is %s.\n", currentFamily.toLatin1().constData(), isCurrentScaleable ? "scalable" : "not scalable")); QStringList subFamilies (QFont::substitutes (currentFamily)); foreach (QString sub, subFamilies) { bool isSubScalable = fontDataBase.isScalable (sub); LogFlowFunc (("Font: Substitute family is '%s'. It is %s.\n", sub.toLatin1().constData(), isSubScalable ? "scalable" : "not scalable")); } */ QString subFamily (QFont::substitute (currentFamily)); bool isSubScaleable = fontDataBase.isScalable (subFamily); if (isCurrentScaleable && !isSubScaleable) QFont::removeSubstitution (currentFamily); #endif /* Q_OS_SOLARIS */ #endif #ifdef Q_WS_WIN /* Drag in the sound drivers and DLLs early to get rid of the delay taking * place when the main menu bar (or any action from that menu bar) is * activated for the first time. This delay is especially annoying if it * happens when the VM is executing in real mode (which gives 100% CPU * load and slows down the load process that happens on the main GUI * thread to several seconds). */ PlaySound (NULL, NULL, 0); #endif #ifdef Q_WS_MAC ::darwinDisableIconsInMenus(); #endif /* Q_WS_MAC */ #ifdef Q_WS_X11 /* version check (major.minor are sensitive, fix number is ignored) */ if (VBoxGlobal::qtRTVersion() < (VBoxGlobal::qtCTVersion() & 0xFFFF00)) { QString msg = QApplication::tr ("Executable <b>%1</b> requires Qt %2.x, found Qt %3.") .arg (qAppName()) .arg (VBoxGlobal::qtCTVersionString().section ('.', 0, 1)) .arg (VBoxGlobal::qtRTVersionString()); QMessageBox::critical ( 0, QApplication::tr ("Incompatible Qt Library Error"), msg, QMessageBox::Abort, 0); qFatal ("%s", msg.toAscii().constData()); } #endif /* load a translation based on the current locale */ VBoxGlobal::loadLanguage(); do { if (!vboxGlobal().isValid()) break; if (vboxGlobal().processArgs()) return 0; msgCenter().checkForMountedWrongUSB(); VBoxGlobalSettings settings = vboxGlobal().settings(); /* Process known keys */ bool noSelector = settings.isFeatureActive ("noSelector"); if (vboxGlobal().isVMConsoleProcess()) { #ifdef VBOX_GUI_WITH_SYSTRAY if (vboxGlobal().trayIconInstall()) { /* Nothing to do here yet. */ } #endif if (vboxGlobal().startMachine (vboxGlobal().managedVMUuid())) { vboxGlobal().setMainWindow (vboxGlobal().vmWindow()); rc = a.exec(); } } else if (noSelector) { msgCenter().cannotRunInSelectorMode(); } else { #ifdef VBOX_BLEEDING_EDGE msgCenter().showBEBWarning(); #else # ifndef DEBUG /* Check for BETA version */ QString vboxVersion (vboxGlobal().virtualBox().GetVersion()); if (vboxVersion.contains ("BETA")) { /* Allow to prevent this message */ QString str = vboxGlobal().virtualBox(). GetExtraData(GUI_PreventBetaWarning); if (str != vboxVersion) msgCenter().showBETAWarning(); } # endif #endif vboxGlobal().setMainWindow (&vboxGlobal().selectorWnd()); #ifdef VBOX_GUI_WITH_SYSTRAY if (vboxGlobal().trayIconInstall()) { /* Nothing to do here yet. */ } if (false == vboxGlobal().isTrayMenu()) { #endif vboxGlobal().selectorWnd().show(); #ifdef VBOX_WITH_REGISTRATION_REQUEST vboxGlobal().showRegistrationDialog (false /* aForce */); #endif #ifdef VBOX_GUI_WITH_SYSTRAY } do { #endif rc = a.exec(); #ifdef VBOX_GUI_WITH_SYSTRAY } while (vboxGlobal().isTrayMenu()); #endif } } while (0); } LogFlowFunc (("rc=%d\n", rc)); LogFlowFuncLeave(); return rc; }
int main(int argc, char **argv) { #ifdef Q_WS_WIN // Make sure Windows doesn't load DLLs from the current working directory SetDllDirectoryA(""); SetSearchPathMode(BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE); #endif setlocale(LC_CTYPE, ""); #if defined(Q_WS_X11) && defined(AUTOTYPE) QApplication* app = new KeepassApplication(argc,argv); #else QApplication* app = new QApplication(argc,argv); #endif EventListener* eventListener = new EventListener(); app->installEventFilter(eventListener); QApplication::setQuitOnLastWindowClosed(false); AppDir = QApplication::applicationFilePath(); AppDir.truncate(AppDir.lastIndexOf("/")); #if defined(Q_WS_X11) DataDir = AppDir+"/../share/keepassx"; if (!QFile::exists(DataDir) && QFile::exists(AppDir+"/share")) DataDir = AppDir+"/share"; const char* env = getenv("XDG_CONFIG_HOME"); if (!env) { HomeDir = QDir::homePath() + "/.config"; } else { QString qenv = QTextCodec::codecForLocale()->toUnicode(env); if (qenv[0] == '/') HomeDir = qenv; else HomeDir = QDir::homePath() + '/' + qenv; } HomeDir += "/keepassx"; #elif defined(Q_WS_MAC) HomeDir = QDir::homePath()+"/.keepassx"; DataDir = AppDir+"/../Resources/keepassx"; #else //Q_WS_WIN HomeDir = qtWindowsConfigPath(CSIDL_APPDATA); if(!HomeDir.isEmpty() && QFile::exists(HomeDir)) HomeDir = QDir::fromNativeSeparators(HomeDir)+"/KeePassX"; else HomeDir = QDir::homePath()+"/KeePassX"; DataDir = AppDir+"/share"; #endif DataDir = QDir::cleanPath(DataDir); CmdLineArgs args; if ( !args.parse(QApplication::arguments()) ){ qCritical("%s\n", CSTR( args.error() )); args.printHelp(); return 1; } if (args.help()){ args.printHelp(); return 1; } //Load Config QString IniFilename; if(args.configLocation().isEmpty()){ if(!QDir(HomeDir).exists()){ QDir conf(QDir::homePath()); if(!QDir().mkpath(HomeDir)) qWarning("Warning: Could not create directory '%s'", CSTR(HomeDir)); } IniFilename=HomeDir+"/config.ini"; } else IniFilename=args.configLocation(); #ifdef Q_WS_X11 { QString OldHomeDir = QDir::homePath()+"/.keepassx"; if (args.configLocation().isEmpty() && QFile::exists(OldHomeDir+"/config") && !QFile::exists(HomeDir+"/config")) { QFile::rename(OldHomeDir+"/config", HomeDir+"/config.ini"); if (QDir(OldHomeDir).entryList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System).count()==0) QDir().rmdir(OldHomeDir); } } #else if (args.configLocation().isEmpty() && QFile::exists(HomeDir+"/config") && !QFile::exists(HomeDir+"/config.ini")) QFile::rename(HomeDir+"/config", HomeDir+"/config.ini"); #endif config = new KpxConfig(IniFilename); fileDlgHistory.load(); // PlugIns /* #ifdef Q_WS_X11 if(config->integrPlugin()!=KpxConfig::NoIntegr){ QString LibName="libkeepassx-"; if(config->integrPlugin()==KpxConfig::KDE) LibName+="kde.so"; else if(config->integrPlugin()==KpxConfig::Gnome) LibName+="gnome.so"; QString filename=findPlugin(LibName); if(filename!=QString()){ QPluginLoader plugin(filename); if(!plugin.load()){ PluginLoadError=plugin.errorString(); qWarning("Could not load desktop integration plugin:"); qWarning("%s", CSTR(PluginLoadError)); } else{ QObject *plugininstance=plugin.instance(); IFileDialog* fdlg=qobject_cast<IFileDialog*>(plugininstance); IconLoader=qobject_cast<IIconTheme*>(plugininstance); if(IconLoader==NULL){ qWarning("Error: Integration Plugin: Could not initialize IconTheme interface."); } KpxFileDialogs::setPlugin(fdlg); if(config->integrPlugin()==KpxConfig::KDE){ IKdeInit* kdeinit=qobject_cast<IKdeInit*>(plugin.instance()); app=kdeinit->getMainAppObject(argc,argv); if(!app) PluginLoadError = "Initialization failed."; } if(config->integrPlugin()==KpxConfig::Gnome){ IGnomeInit* ginit=qobject_cast<IGnomeInit*>(plugin.instance()); if(!ginit->init(argc,argv)){ KpxFileDialogs::setPlugin(NULL); qWarning("GtkIntegrPlugin: Gtk init failed."); PluginLoadError = "Initialization failed."; } } } } else{ qWarning(CSTR(QString("Could not load desktop integration plugin: File '%1' not found.").arg(LibName))); PluginLoadError=QApplication::translate("Main", "Could not locate library file."); } } #endif */ DetailViewTemplate=config->detailViewTemplate(); loadImages(); KpxBookmarks::load(); initYarrow(); //init random number generator SecString::generateSessionKey(); installTranslator(); #ifdef Q_WS_MAC QApplication::processEvents(); if (args.file().isEmpty() && !eventListener->file().isEmpty()) { args.setFile(eventListener->file()); } #endif KeepassMainWindow *mainWin = new KeepassMainWindow(args.file(), args.startMinimized(), args.startLocked()); #ifdef Q_WS_MAC eventListener->setMainWin(mainWin); #endif int r=app->exec(); delete mainWin; delete eventListener; fileDlgHistory.save(); SecString::deleteSessionKey(); delete app; delete config; return r; }
int mainAdapterWidget(QApplication& a, osg::ArgumentParser& arguments) { // load the scene. osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments); if (!loadedModel) { std::cout << arguments[0] <<": No data loaded." << std::endl; return 1; } std::cout<<"Using AdapterWidget - QGLWidget subclassed to integrate with osgViewer using its embedded graphics window support."<<std::endl; if (arguments.read("--CompositeViewer")) { CompositeViewerQT* viewerWindow = new CompositeViewerQT; unsigned int width = viewerWindow->width(); unsigned int height = viewerWindow->height(); { osgViewer::View* view1 = new osgViewer::View; view1->getCamera()->setGraphicsContext(viewerWindow->getGraphicsWindow()); view1->getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width)/static_cast<double>(height/2), 1.0, 1000.0); view1->getCamera()->setViewport(new osg::Viewport(0,0,width,height/2)); view1->setCameraManipulator(new osgGA::TrackballManipulator); view1->setSceneData(loadedModel.get()); viewerWindow->addView(view1); } { osgViewer::View* view2 = new osgViewer::View; view2->getCamera()->setGraphicsContext(viewerWindow->getGraphicsWindow()); view2->getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width)/static_cast<double>(height/2), 1.0, 1000.0); view2->getCamera()->setViewport(new osg::Viewport(0,height/2,width,height/2)); view2->setCameraManipulator(new osgGA::TrackballManipulator); view2->setSceneData(loadedModel.get()); viewerWindow->addView(view2); } viewerWindow->show(); } else if (arguments.read("--mdi")) { std::cout<<"Using ViewetQT MDI version"<<std::endl; /* Following problems are found here: - miminize causes loaded model to disappear (some problem with Camera matrix? - clampProjectionMatrix is invalid) */ ViewerQT* viewerWindow = new ViewerQT; viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator); viewerWindow->setSceneData(loadedModel.get()); QMainWindow* mw = new QMainWindow(); QMdiArea* mdiArea = new QMdiArea(mw); mw->setCentralWidget(mdiArea); QMdiSubWindow *subWindow = mdiArea->addSubWindow(viewerWindow); subWindow->showMaximized(); subWindow->setWindowTitle("New Window"); mw->show(); } else { ViewerQT* viewerWindow = new ViewerQT; viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator); viewerWindow->setSceneData(loadedModel.get()); viewerWindow->show(); } a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) ); return a.exec(); }
int main (int argc, char** argv) { arg_base::set_help_option("-h"); arg_parse(argc, argv); ntk_debug_level = 1; cv::setBreakOnError(true); QApplication::setGraphicsSystem("raster"); QApplication app (argc, argv); const char* fake_dir = opt::image(); bool is_directory = opt::directory() != 0; if (opt::directory()) fake_dir = opt::directory(); ntk::RGBDProcessor* processor = 0; RGBDGrabber* grabber = 0; bool use_openni = !opt::freenect(); #ifndef USE_OPENNI use_openni = false; #endif if (opt::image() || opt::directory()) { std::string path = opt::image() ? opt::image() : opt::directory(); FileGrabber* file_grabber = new FileGrabber(path, opt::directory() != 0); grabber = file_grabber; } else if (use_openni) { NiteRGBDGrabber* k_grabber = new NiteRGBDGrabber(); if (opt::high_resolution()) k_grabber->setHighRgbResolution(true); k_grabber->initialize(); grabber = k_grabber; } else { KinectGrabber* k_grabber = new KinectGrabber(); k_grabber->initialize(); k_grabber->setIRMode(false); grabber = k_grabber; } if (use_openni) { processor = new ntk::NiteProcessor(); } else { processor = new ntk::KinectProcessor(); } if (opt::sync()) grabber->setSynchronous(true); RGBDFrameRecorder frame_recorder (opt::dir_prefix()); frame_recorder.setSaveOnlyRaw(false); ntk::RGBDCalibration* calib_data = 0; if (use_openni) { calib_data = grabber->calibrationData(); } else if (opt::calibration_file()) { calib_data = new RGBDCalibration(); calib_data->loadFromFile(opt::calibration_file()); } else if (QDir::current().exists("kinect_calibration.yml")) { { ntk_dbg(0) << "[WARNING] Using kinect_calibration.yml in current directory"; ntk_dbg(0) << "[WARNING] use --calibration to specify a different file."; } calib_data = new RGBDCalibration(); calib_data->loadFromFile("kinect_calibration.yml"); } ntk_ensure(calib_data, "You must specify a calibration file (--calibration)"); grabber->setCalibrationData(*calib_data); GuiController gui_controller (*grabber, *processor); grabber->addEventListener(&gui_controller); gui_controller.setFrameRecorder(frame_recorder); if (opt::sync()) gui_controller.setPaused(true); SurfelsRGBDModeler modeler; modeler.setMinViewsPerSurfel(1); processor->setFilterFlag(RGBDProcessor::ComputeNormals, 1); processor->setMaxNormalAngle(90); ModelAcquisitionController* acq_controller = 0; acq_controller = new ModelAcquisitionController (gui_controller, modeler); RelativePoseEstimator* pose_estimator = 0; FeatureSetParams params ("FAST", "BRIEF64", true); pose_estimator = new RelativePoseEstimatorFromImage(params); acq_controller->setPoseEstimator(pose_estimator); gui_controller.setModelAcquisitionController(*acq_controller); grabber->start(); app.exec(); delete acq_controller; }
//----------------------------------------------------------------------------- int transitionTest(ctkWorkflow* workflow, int defaultTime, QApplication& app, ctkWorkflowStep* expectedStep, ctkExampleWorkflowStepUsingSignalsAndSlots* step1, int step1Entry, int step1Exit, ctkExampleWorkflowStepUsingSignalsAndSlots* step2, int step2Entry, int step2Exit, ctkExampleWorkflowStepUsingSignalsAndSlots* step3=0, int step3Entry=0, int step3Exit=0, ctkExampleWorkflowStepUsingSignalsAndSlots* step4=0, int step4Entry=0, int step4Exit=0) { QTimer::singleShot(defaultTime, &app, SLOT(quit())); app.exec(); return currentStepAndNumberOfTimesEntryExitTest(workflow, expectedStep, step1, step1Entry, step1Exit, step2, step2Entry, step2Exit, step3, step3Entry, step3Exit, step4, step4Entry, step4Exit); }
void MainWindow::on_actionExit_triggered() { QApplication * app; app->exit(0); }
int main (int argc, char **argv) { int opt; int temp_int; int option_index = 0; bool bOptionHelp = false; /* Print the version number */ printf ("ShowEQ %s, released under the GPL.\n", VERSION); printf (" SINS 0.5, released under the GPL.\n"); printf ("All ShowEQ source code is Copyright (C) 2000, 2001, 2002 by the respective ShowEQ Developers\n"); printf ("Binary distribution without source code and resale are explictily NOT authorized by ANY party.\n"); printf ("If you have paid for this software in any way, shape, or form, the person selling the\n"); printf ("software is doing so in violation of the express wishes and intents of the authors of this product.\n\n"); printf ("Please see http://seq.sourceforge.net for further information\n\n"); /* Create application instance */ QApplication::setStyle( new QWindowsStyle ); QApplication qapp (argc, argv); /* Initialize the parameters with default values */ char *configfile = LOGDIR "/showeq.xml"; // scan command line arguments for a specified config file int i = 1; while (i < argc) { if ((argv[i][0] == '-') && (argv[i][1] == 'o')) configfile = strdup(argv[i + 1]); i ++; } /* NOTE: See preferencefile.cpp for info on how to use prefrences class */ printf("Using config file '%s'\n", configfile); pSEQPrefs = new XMLPreferences(LOGDIR "/seqdef.xml", configfile); showeq_params = new ShowEQParams; QString section; /* TODO: Add some sanity checks to the MAC address option. cpphack */ section = "Network"; showeq_params->device = pSEQPrefs->getPrefString("Device", section, "eth0"); showeq_params->ip = strdup(pSEQPrefs->getPrefString("IP", section, AUTOMATIC_CLIENT_IP)); showeq_params->mac_address = strdup(pSEQPrefs->getPrefString("MAC", section, "0")); showeq_params->realtime = pSEQPrefs->getPrefBool("RealTimeThread", section, false); showeq_params->promisc = pSEQPrefs->getPrefBool("NoPromiscuous", section, true); showeq_params->arqSeqGiveUp = pSEQPrefs->getPrefInt("ArqSeqGiveUp", section, 96); showeq_params->session_tracking = pSEQPrefs->getPrefBool("SessionTracking", section, 0); #if HAVE_LIBEQ showeq_params->broken_decode = pSEQPrefs->getPrefBool("BrokenDecode", section, 0); if (showeq_params->broken_decode) printf("Disabling decoder due to showeq.xml preferences\n"); #else /* Default to broken decoder if libEQ not present */ showeq_params->broken_decode = 1; printf("Disabling decoder due to missing libEQ.a\n"); #endif section = "Interface"; /* Allow map depth filtering */ showeq_params->retarded_coords = pSEQPrefs->getPrefBool("RetardedCoords", section, 0); showeq_params->con_select = pSEQPrefs->getPrefBool("SelectOnCon", section, false); showeq_params->tar_select = pSEQPrefs->getPrefBool("SelectOnTarget", section, false); showeq_params->net_stats = pSEQPrefs->getPrefBool("NetStats", section, false); showeq_params->systime_spawntime = pSEQPrefs->getPrefBool("SystimeSpawntime", section, false); showeq_params->pvp = pSEQPrefs->getPrefBool("PvPTeamColoring", section, false); showeq_params->deitypvp = pSEQPrefs->getPrefBool("DeityPvPTeamColoring", section, false); showeq_params->keep_selected_visible = pSEQPrefs->getPrefBool("KeepSelected", section, true); showeq_params->no_bank = pSEQPrefs->getPrefBool("NoBank", section, true); section = "Interface_StatusBar"; showeq_params->showEQTime = pSEQPrefs->getPrefBool("ShowEQTime",section,false); section = "Misc"; showeq_params->fast_machine = pSEQPrefs->getPrefBool("FastMachine", section, true); showeq_params->createUnknownSpawns = pSEQPrefs->getPrefBool("CreateUnknownSpawns", section, false); showeq_params->walkpathrecord = pSEQPrefs->getPrefBool("WalkPathRecording", section, false); showeq_params->walkpathlength = pSEQPrefs->getPrefInt("WalkPathLength", section, 25); showeq_params->logSpawns = pSEQPrefs->getPrefBool("LogSpawns", section, false); showeq_params->logItems = pSEQPrefs->getPrefBool("LogItems", section, false); /* Tells SEQ whether or not to display casting messages (Turn this off if you're on a big raid) */ showeq_params->showSpellMsgs = pSEQPrefs->getPrefBool("ShowSpellMessages", section, true); /* Spawn logging preferences */ showeq_params->SpawnLogFilename = pSEQPrefs->getPrefString("SpawnLogFilename", section, LOGDIR "/spawnlog.txt"); showeq_params->spawnlog_enabled = pSEQPrefs->getPrefBool("SpawnLogEnabled", section, true); /* Decoder override for coping with encryption changes */ section = "Filters"; showeq_params->filterfile = pSEQPrefs->getPrefString("FilterFile", section, LOGDIR "/filters.conf"); showeq_params->spawnfilter_audio = pSEQPrefs->getPrefBool("Audio", section, false); showeq_params->spawnfilter_loglocates = pSEQPrefs->getPrefBool("LogLocates", section, 0); showeq_params->spawnfilter_logcautions = pSEQPrefs->getPrefBool("LogCautions", section, 0); showeq_params->spawnfilter_loghunts = pSEQPrefs->getPrefBool("LogHunts", section, 0); showeq_params->spawnfilter_logdangers = pSEQPrefs->getPrefBool("LogDangers", section, 0); showeq_params->spawnfilter_case = pSEQPrefs->getPrefBool("IsCaseSensitive", section, 0); showeq_params->spawn_alert_plus_plus = pSEQPrefs->getPrefBool("AlertInfo", section, 0); /* Default Level / Race / Class preferences */ section = "Defaults"; showeq_params->AutoDetectCharSettings = pSEQPrefs->getPrefBool("AutoDetectCharSettings", section, 1); showeq_params->defaultName = pSEQPrefs->getPrefString("DefaultName", section, "You"); showeq_params->defaultLastName = pSEQPrefs->getPrefString("DefaultLastName", section, ""); showeq_params->defaultLevel = pSEQPrefs->getPrefInt("DefaultLevel", section, 1); showeq_params->defaultRace = pSEQPrefs->getPrefInt("DefaultRace", section, 1); showeq_params->defaultClass = pSEQPrefs->getPrefInt("DefaultClass", section, 1); showeq_params->defaultDeity = pSEQPrefs->getPrefInt("DefaultDeity", section, DEITY_AGNOSTIC); /* VPacket (Packet Recording / Playback) */ section = "VPacket"; showeq_params->playbackpackets = pSEQPrefs->getPrefBool("Playback", section, false); showeq_params->recordpackets = pSEQPrefs->getPrefBool("Record", section, false); showeq_params->playbackspeed = pSEQPrefs->getPrefBool("PlaybackRate", section, false); section = "SpawnList"; showeq_params->showRealName = pSEQPrefs->getPrefBool("ShowRealName", section, false); /* OpCode monitoring preferences */ section = "OpCodeMonitoring"; showeq_params->monitorOpCode_Usage = pSEQPrefs->getPrefBool("Enable", section, false); /* Disabled */ showeq_params->monitorOpCode_List = pSEQPrefs->getPrefString("OpCodeList", section, ""); /* NONE */ showeq_params->monitorOpCode_Log = pSEQPrefs->getPrefBool("Log", section, false); showeq_params->monitorOpCode_Filename = pSEQPrefs->getPrefString("LogFilename", section, LOGDIR "/opcodemonitor.log"); /* Packet logging preferences */ section = "PacketLogging"; showeq_params->logAllPackets = pSEQPrefs->getPrefBool("LogAllPackets", section, 0); showeq_params->logZonePackets = pSEQPrefs->getPrefBool("LogZonePackets", section, 0); showeq_params->logUnknownZonePackets = pSEQPrefs->getPrefBool("LogUnknownZonePackets", section, 0); showeq_params->GlobalLogFilename = pSEQPrefs->getPrefString("GlobalLogFilename", section, LOGDIR "/global.log") ; showeq_params->ZoneLogFilename = pSEQPrefs->getPrefString("ZoneLogFilename", section, LOGDIR "/zone.log"); showeq_params->UnknownZoneLogFilename = pSEQPrefs->getPrefString("UnknownZoneLogFilename", section, LOGDIR "/unknownzone.log") ; /* Different files for different kinds of encrypted data */ showeq_params->logEncrypted = pSEQPrefs->getPrefBool("LogEncrypted", section, 0); showeq_params->EncryptedLogFilenameBase = pSEQPrefs->getPrefString("EncryptedLogFilenameBase", section, LOGDIR "/encrypted") ; showeq_params->PktLoggerMask = pSEQPrefs->getPrefString("PktLoggerMask", section, ""); showeq_params->PktLoggerFilename = pSEQPrefs->getPrefString("PktLoggerFilename", section, LOGDIR "/packet.log") ; // item database parameters section = "ItemDB"; showeq_params->ItemLoreDBFilename = pSEQPrefs->getPrefString("LoreDBFilename", section, LOGDIR "/itemlore"); showeq_params->ItemNameDBFilename = pSEQPrefs->getPrefString("NameDBFilename", section, LOGDIR "/itemname"); showeq_params->ItemDataDBFilename = pSEQPrefs->getPrefString("DataDBFilename", section, LOGDIR "/itemdata"); showeq_params->ItemRawDataDBFileName = pSEQPrefs->getPrefString("RawDataDBFilename", section, LOGDIR "/itemrawdata"); showeq_params->ItemDBTypes = pSEQPrefs->getPrefInt("DatabasesEnabled", section, (EQItemDB::LORE_DB | EQItemDB::NAME_DB | EQItemDB::DATA_DB)); showeq_params->ItemDBEnabled = pSEQPrefs->getPrefBool("Enabled", section, 1); section = "SaveState"; showeq_params->saveDecodeKey = pSEQPrefs->getPrefBool("DecodeKey", section, 1); showeq_params->saveZoneState = pSEQPrefs->getPrefBool("ZoneState", section, 1); showeq_params->savePlayerState = pSEQPrefs->getPrefBool("PlayerState", section, 1); showeq_params->saveSpawns = pSEQPrefs->getPrefBool("Spawns", section, false); showeq_params->saveSpawnsFrequency = pSEQPrefs->getPrefInt("SpawnsFrequency", section, (120 * 1000)); showeq_params->restoreDecodeKey = false; showeq_params->restorePlayerState = false; showeq_params->restoreZoneState = false; showeq_params->restoreSpawns = false; showeq_params->saveRestoreBaseFilename = pSEQPrefs->getPrefString("BaseFilename", section, LOGDIR "/last"); /* Parse the commandline for commandline parameters */ while ((opt = getopt_long( argc, argv, OPTION_LIST, option_list, &option_index )) != -1 ) { switch (opt) { /* Set the request to use a despawn list based off the spawn alert list. */ /* Set the interface */ case 'i': { showeq_params->device = optarg; break; } /* Set pcap thread to realtime */ case 'r': { showeq_params->realtime = 1; break; } /* Set the spawn filter file */ case 'f': { showeq_params->filterfile = optarg; break; } /* Packet playback mode */ case 'j': { if (optarg) pSEQPrefs->setPrefString("Filename", "VPacket", optarg, XMLPreferences::Runtime); showeq_params->playbackpackets = 1; showeq_params->recordpackets = 0; break; } /* Packet record mode */ case 'g': { if (optarg) pSEQPrefs->setPrefString("Filename", "VPacket", optarg, XMLPreferences::Runtime); showeq_params->recordpackets = 1; showeq_params->playbackpackets = 0; break; } /* Config file was already taken care of, ignore */ case 'o': break; /* Enable use of enlightenment audio */ case 'a': { showeq_params->spawnfilter_audio = 1; break; } /* Make filter case sensitive */ case 'C': { showeq_params->spawnfilter_case = 1; break; } /* Use retarded coordinate system yxz */ case 'c': { showeq_params->retarded_coords = 1; break; } /* Fast machine updates.. framerate vs packet based */ case 'F': { showeq_params->fast_machine = 1; break; } /* Cool spawn alert */ case 'A': { showeq_params->spawn_alert_plus_plus = 1; break; } /* Show unknown spawns */ case 'K': { showeq_params->createUnknownSpawns = 1; break; } /* Select spawn on 'Consider' */ case 'S': { showeq_params->con_select = 1; break; } /* Select spawn on 'Target' */ case 'e': { showeq_params->tar_select = 1; break; } /* Don't force the selected spawn to be visible in scrollbox */ case 'V': { showeq_params->keep_selected_visible = 0; break; } /* Don't use Promiscuous mode on sniffing */ case 'P': { showeq_params->promisc = 0; break; } /* Show net info */ case 'N': { showeq_params->net_stats = 1; break; } /* 'b'roken decode -- don't deal with spawn packets */ case 'b': { showeq_params->broken_decode = 1; printf("Disabling decoder due to command-line parameter\n"); break; } /* 't'rack pathing for mobs */ case 't': { showeq_params->walkpathrecord = 1; break; } /* Maximum spawn path tracking length */ case 'L': { showeq_params->walkpathlength = atoi(optarg); break; } /* Log spawns! */ case 'x': { showeq_params->logSpawns = 1; break; } /* Don't autodetect character settings */ case 'W': { showeq_params->AutoDetectCharSettings = 0; break; } /* Set default player level */ case 'X': { temp_int = atoi(optarg); if (temp_int < 1 || temp_int > 60) { printf ("Invalid default level. Valid range is 1 - 60.\n"); exit(0); } showeq_params->defaultLevel = temp_int; break; } /* Set default player race */ case 'Y': { temp_int = atoi(optarg); if ((temp_int < 1 || temp_int > 12) && temp_int != 128) { printf ("Invalid default race, please use showeq -h to list valid race options.\n"); exit(0); } showeq_params->defaultRace = temp_int; break; } /* Set default player class */ case 'Z': { temp_int = atoi(optarg); if (temp_int < 1 || temp_int > 14) { printf ("Invalid default class, please use showeq -h to list valid class options.\n"); exit(0); } showeq_params->defaultClass = temp_int; break; } /* Display the version info... */ case VERSION_OPTION: { printf ("ShowEQ %s\n",VERSION); printf ("Copyright (C) 1999-2001 ShowEQ Contributors\n\n"); printf ("ShowEQ comes with NO WARRANTY.\n\n"); printf ("You may redistribute copies of ShowEQ under the terms of\n"); printf ("The GNU General Public License.\n"); printf ("See: http://www.gnu.org/copyleft/gpl.html for more details...\n\n"); printf ("For updates and information, please visit http://seq.sourceforge.net/\n"); exit(0); break; } /* IP address to track */ case IPADDR_OPTION: { showeq_params->ip = strdup(optarg); break; } /* MAC address to track for those on DHCP */ case MACADDR_OPTION: { showeq_params->mac_address = optarg; break; } /* Filename for logging all packets */ case GLOBAL_LOG_FILENAME_OPTION: { showeq_params->GlobalLogFilename = optarg; break; } /* Filename for logging zone change packets */ case ZONE_LOG_FILENAME_OPTION: { showeq_params->ZoneLogFilename = optarg; break; } /* Filename for logging unknown zone change packets */ case UNKNOWN_LOG_FILENAME_OPTION: { showeq_params->UnknownZoneLogFilename = optarg; break; } /* Log everything */ case GLOBAL_LOG_OPTION: { showeq_params->logAllPackets = 1; break; } /* Log all zone change packets */ case ZONE_LOG_OPTION: { showeq_params->logZonePackets = 1; break; } /* Log only unfamiliar zone change packets */ case UNKNOWN_ZONE_LOG_OPTION: { showeq_params->logUnknownZonePackets = 1; break; } case PLAYBACK_SPEED_OPTION: { showeq_params->playbackspeed = atoi(optarg); break; } /* Enable logging of encrypted packets... */ case ENCRYPTED_LOG_OPTION: { showeq_params->logEncrypted = 1; break; } /* Log encrypted packets to this file... */ case ENCRYPTED_LOG_FILE_OPTION: { showeq_params->EncryptedLogFilenameBase = optarg; break; } /* Display spawntime in UNIX time (time_t) instead of hh:mm format */ case SYSTIME_SPAWNTIME_OPTION: { showeq_params->systime_spawntime = 1; break; } case SPAWNLOG_FILENAME_OPTION: { showeq_params->SpawnLogFilename = optarg; break; } case DISABLE_SPAWNLOG_OPTION: { showeq_params->spawnlog_enabled = FALSE; break; } case NO_BANK_INFO: { showeq_params->no_bank = TRUE; break; } case ITEMDB_LORE_FILENAME_OPTION: { showeq_params->ItemLoreDBFilename = optarg; break; } case ITEMDB_NAME_FILENAME_OPTION: { showeq_params->ItemNameDBFilename = optarg; break; } case ITEMDB_DATA_FILENAME_OPTION: { showeq_params->ItemDataDBFilename = optarg; break; } case ITEMDB_RAW_FILENAME_OPTION: { showeq_params->ItemRawDataDBFileName = optarg; break; } case ITEMDB_DATABASES_ENABLED: { showeq_params->ItemDBTypes = atoi(optarg); break; } case ITEMDB_DISABLE: { showeq_params->ItemDBEnabled = false; break; } case RESTORE_DECODE_KEY: { showeq_params->restoreDecodeKey = true; break; } case RESTORE_PLAYER_STATE: { showeq_params->restorePlayerState = true; break; } case RESTORE_ZONE_STATE: { showeq_params->restoreZoneState = true; break; } case RESTORE_SPAWNS: { showeq_params->restoreSpawns = true; break; } case RESTORE_ALL: { showeq_params->restoreDecodeKey = true; showeq_params->restorePlayerState = true; showeq_params->restoreZoneState = true; showeq_params->restoreSpawns = true; break; } /* Spit out the help */ case 'h': /* Fall through */ default: { bOptionHelp = true; break; } } } if (bOptionHelp) { /* The default help text */ printf ("Usage:\n %s [<options>] [<client IP address>]\n\n", argv[0]); printf (" -h, --help Shows this help\n"); printf (" -o CONFIGFILE Alternate showeq.xml pathname\n"); printf (" --version Prints ShowEQ version number\n"); printf (" -i, --net-interface=DEVICE Specify which network device to bind to\n"); printf (" -r, --realtime Set the network thread realtime\n"); printf (" -f, --filter-file=FILENAME Sets spawn filter file\n"); printf (" -s, --spawn-file=FILENAME Sets spawn alert file\n"); printf (" -C, --filter-case-sensitive Spawn alert and filter is case sensitive\n"); printf (" -a, --enlightenment-audio Use ESD to play alert during spawn alert\n"); printf (" -c, --use-retarded-coords Use \"retarded\" YXZ coordinates\n"); printf (" -F, --fast-machine Fast machine - perform more accurate vs. \n"); printf (" less accurate calculations.\n"); printf (" -A, --spawn-alert Use name/race/class/light/equipment for \n"); printf (" spawn matching\n"); printf (" -K, --create-unknown-spawns create unknown spawns\n"); printf (" -S, --select-on-consider Select the spawn considered\n"); printf (" -e, --select-on-target Select the spawn targetted\n"); printf (" -V, --no-keep-selected-visible Don't force the listbox to keep selected\n"); printf (" spawn visible\n"); printf (" -P, --no-promiscuous Don't sniff the network in promiscuous\n"); printf (" mode (Don't process packets bound for\n"); printf (" other machines).\n"); printf (" -N, --show-packet-numbers Show network info dialog\n"); printf (" -j, --playback-file=FILENAME Playback packets in FILENAME, previously\n"); printf (" recorded with -g option\n"); printf (" --playback-speed=SPEED -1 = Paused, 0 = Max, 1 = Slow, 9 = Fast\n"); printf (" -g, --record-file=FILENAME Record packets to FILENAME to playback\n"); printf (" with the -j option\n"); printf (" -b, --broken-decode Broken decode -- Don't attempt to decode\n"); printf (" the spawn packets (i.e. Your CPU is VERY\n"); printf (" slow)\n"); printf (" -t, --show-selected Track spawn movements (no path trace)\n"); printf (" -L, --spawn-path-length=### Track spawn maximum track length (min:3)\n"); printf (" -x, --log-spawns Log spawns into spawns.db\n"); printf (" --systime-spawntime Show spawn time using UNIX systtem time\n"); printf (" --ip-address=IP Client IP address\n"); printf (" --mac-address=MAC Client MAC address as 00:00:00:00:00:00\n"); printf (" --log-all Log all packets to global logfile\n"); printf (" --global-log-filename=FILE Use FILE for above packet logging\n"); printf (" --log-zone Like --log-all, but only zone data\n"); printf (" --zone-log-filename=FILE Use FILE for above packet logging\n"); printf (" --log-unknown-zone Log only unrecognized zone data\n"); printf (" --unknown-zone-log-filename=FILE Use FILE for above packet logging\n"); printf (" --log-encrypted Log some unprocessed encrypted data\n"); printf (" --encrypted-log-filebase=FILE Use FILE as base for above logging\n"); printf (" --disable-spawnlog Disable spawn logging to spawnlog.txt\n"); printf (" --spawnlog-filename=FILE Use FILE instead of spawnlog.txt\n"); printf (" --itemdb-lore-filename=FILE Use FILE instead of itemlore\n"); printf (" --itemdb-name-filename=FILE Use FILE instead of itemname\n"); printf (" --itemdb-data-filename=FILE Use FILE instead of itemdata\n"); printf (" --itemdb-raw-data-filename=FILE Use FILE instead of itemrawdata\n"); printf (" --itemdb-databases-enabled=DBS Use DBS to enable different item\n"); printf (" databases.\n"); printf (" --itemdb-disable Disable use of the item DB.\n"); printf (" -W, --dont-autodetectcharsettings Don't auto-detect your character's\n"); printf (" Level/Race/Class.\n"); printf (" -X, --default-level=## Default player level. (1-60)\n"); printf (" -Y, --default-race=## Default player race:"); printf ("\n\t HUM 1, BAR 2, ERU 3"); printf ("\n\t ELF 4, HIE 5, DEF 6"); printf ("\n\t HEF 7, DWF 8, TRL 9"); printf ("\n\t OGR 10, HFL 11, GNM 12"); printf ("\n\t GNM 12, IKS 128\n"); printf (" -Z, --default-class=## Default player class:"); printf ("\n\t WAR 1, CLR 2, PAL 3"); printf ("\n\t RNG 4, SHD 5, DRU 6"); printf ("\n\t MNK 7, BRD 8, ROG 9"); printf ("\n\t SHM 10, NEC 11, WIZ 12"); printf ("\n\t MAG 13, ENC 14\n"); printf (" \n"); printf (" \n"); printf (" The following four options should be used with extreme care! \n"); printf (" --restore-decode-key Restores the decode key from\n"); printf (" a previous session \n"); printf (" --restore-player-state Restores the player state\n"); printf (" from a previous session \n"); printf (" --restore-zone-state Restores the zone state\n"); printf (" from a previous session \n"); printf (" --restore-spawns Restores the spawns\n"); printf (" from a previous session \n"); printf (" --restore-all Restores decode key, \n"); printf (" player state, and spawns \n"); printf (" from a previous session \n"); exit (0); } /* Set up individual files for logging selected packet types based on a common filename base. The types to log were found by following where pre_worked was a precondition for further analysis. */ /* NewSpawnCode */ showeq_params->NewSpawnCodeFilename = showeq_params->EncryptedLogFilenameBase + QString("_NewSpawnCode.log"); /* ZoneSpawnsCode */ showeq_params->ZoneSpawnsCodeFilename = showeq_params->EncryptedLogFilenameBase + QString("_ZoneSpawnsCode.log"); /* CharProfileCode */ showeq_params->CharProfileCodeFilename = showeq_params->EncryptedLogFilenameBase + QString ("CharProfileCode.log"); if (showeq_params->logEncrypted) { printf("Logging CharProfileCode packets to: %s\n", (const char*)showeq_params->CharProfileCodeFilename); printf("Logging ZoneSpawnsCode packets to: %s\n", (const char*)showeq_params->ZoneSpawnsCodeFilename); printf("Logging NewSpawnCode packets to: %s\n", (const char*)showeq_params->NewSpawnCodeFilename); } if (showeq_params->broken_decode) printf( "***DECRYPTION DISABLED***\n\n" "Decoder has been manually disabled by either -b, the BrokenDecode option,\n" "or a missing libEQ.a library.\n\n" "(There should be a more detailed message above)\n" ); /* Verify OpCode Monitor settings... */ if (showeq_params->monitorOpCode_Usage) { if (!(showeq_params->monitorOpCode_List.isEmpty())) printf( "\nOpCode monitoring ENABLED...\n" "Using list:\t%s\n\n", (const char*)showeq_params->monitorOpCode_List ); else { showeq_params->monitorOpCode_Usage = false; printf( "\nOpCode monitoring COULD NOT BE ENABLED!\n" ">> Please check your ShowEQ.xml file for a list entry under [OpCodeMonitoring]\n\n" ); } } int ret; // just to add a scope to better control when the main interface gets // destroyed if (1) { /* The main interface widget */ EQInterface intf (0, "interface"); qapp.setMainWidget (&intf); /* Start the main loop */ ret = qapp.exec (); } // delete the preferences data delete pSEQPrefs; // delete the showeq_params data delete showeq_params; return ret; }
int launcher(const QApplication&app,int argc, char *argv[]) { //StartupOptions::Type options; QSet<StartupOptions::Type> opts; QString inputFile; AbstractProcessor *processor; if (argc == 1) { MainWindow *win=new MainWindow; win->show(); return app.exec(); // return; } else { if (argc == 2) { if (QString(argv[1]) == "--help") { printHelp(); // qDebug()<<"W"; } else { cout << "illegal argument. GTFO1"; } return 0; } bool fileSpecified=false; for (int i = 1; i < argc; ++i) { QString s(argv[i]); // qDebug()<<""; if (s.startsWith("-input")) { inputFile = s.split("=")[1]; // qDebug()<<"q"; fileSpecified=true; } else if (s == "--tim") { // options=options | StartupOptions::WRITE_TIM; opts.insert(StartupOptions::WRITE_TIM); } else if (s=="--tmo") { // options=options | StartupOptions::WRITE_TMO; opts.insert(StartupOptions::WRITE_TMO); } else if (s=="--file") { qDebug()<<"File mode"; // options=options | StartupOptions::FILE_OUTPUT; opts.insert(StartupOptions::FILE_OUTPUT); } else if (s=="--console") { qDebug()<<"Console mode"; // options=options | StartupOptions::CONSOLE_OUTPUT; opts.insert(StartupOptions::CONSOLE_OUTPUT); } else { cout << "illegal argument. GTFO2"; return 0; } }//cout<<options<<endl; if(opts.contains(StartupOptions::CONSOLE_OUTPUT)&&opts.contains(StartupOptions::FILE_OUTPUT)){ cout << "illegal argument. GTFO3"; return 0; } if(!fileSpecified){ cout << "Input file wasn't specified. GTFO"; return 0; } processor = new ConsoleMacroProcessor(inputFile, opts); processor->start(); return app.exec(); } }
int main(int argc, char *argv[]) { //QTextStream out (stdout); QApplication* app = new QApplication(argc,argv); //////////// Handling of drag and drop events //////////////// EventListener* eventListener = new EventListener(); app->installEventFilter(eventListener); app->processEvents(); //////////// End of handling of drag and drop events //////////////// // Splash screen QPixmap pixmap(":/icons/STAsplash.png"); QSplashScreen splash(pixmap, Qt::Tool); splash.resize(550, 326); splash.show(); QCoreApplication::setOrganizationName(QObject::tr("STA Steering Board")); QCoreApplication::setApplicationName("STA"); QCoreApplication::setOrganizationName("stasb"); // 'stasb' means STA Steering Board QCoreApplication::setOrganizationDomain("org"); // Patched by Guillermo QCoreApplication::setApplicationVersion("4.0"); QCoreApplication::setOrganizationDomain("STASB"); // Patched by Guillermo //QString ApplicationPath = QDir::currentPath (); //QString ResourcesPath = ApplicationPath + "/sta-data"; //QString ApplicationPath = QApplication::applicationFilePath(); // ApplicationPath.truncate(ApplicationPath.lastIndexOf("/")); //QString ResourcesPath = ApplicationPath + "/sta-data"; ParseCommandLine(); QString staResourcesPath = findDataFolder(); #if defined(Q_WS_MAC) if (!QDir::setCurrent(staResourcesPath)) { QMessageBox::warning(NULL, QObject::tr("STA Resources Not Found"), QObject::tr("STA resources folder wasn't found. This probably means that STA was not properly installed")); exit(0); } #else if (!QDir::setCurrent(staResourcesPath)) // Patched by Guillermo { QMessageBox::warning(NULL, QObject::tr("STA Resources Not Found"), QObject::tr("STA resources folder wasn't found. This probably means that STA was not properly installed")); exit(0); } #endif // Initialize the astro core SolarSystemBodyDictionary::Create(); // Initialize SPICE SpiceEphemeris* spiceEphem = SpiceEphemeris::InitializeSpice(QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/spice"); if (spiceEphem) { qDebug() << "Using SPICE ephemeris"; SolarSystemBodyDictionary::UseEphemeris(spiceEphem); qDebug() << "OK"; } else { qDebug() << "SPICE kernels for solar system ephemeris not located or incomplete. JPL DE405 ephemeris"; qDebug() << "will be instead. This is only a problem when analyzing missions to natural satellites"; qDebug() << "other than the Moon."; QString ephemerisFilename("ephemerides/de406_1800-2100.dat"); QFile ephemerisFile(ephemerisFilename); if (!ephemerisFile.open(QFile::ReadOnly)) { QMessageBox::critical(NULL, QObject::tr("Ephemeris Data Missing"), QObject::tr("Ephemeris data file %1 not found.").arg(ephemerisFilename)); exit(0); } sta::JPLEphemeris* ephemeris = sta::JPLEphemeris::load(&ephemerisFile); if (!ephemeris) { QMessageBox::critical(NULL, QObject::tr("Error Reading Ephemeris"), QObject::tr("Ephemeris file %1 is corrupted.").arg(ephemerisFilename)); exit(0); } SolarSystemBodyDictionary::UseEphemeris(ephemeris); } // end astro core initialization MainWindow* mainwindow = new MainWindow(); #if defined (Q_WS_MAC) eventListener->setMainWin(mainwindow); QString fileToOpen = eventListener->file(); mainwindow->openFileFromAEvent(fileToOpen); #else QString fileToOpen = ":/untitled.stas"; const QStringList args = QCoreApplication::arguments(); if (args.count() == 2) { fileToOpen = args.at(1); mainwindow->openFileFromAEvent(fileToOpen); } #endif mainwindow->show(); splash.hide(); int result = app->exec(); delete mainwindow; delete eventListener; delete app; return result; } ////////////////////////// End of Main.CPP /////////////////////
int main(int argc, char **argv) { //resource finder yarp::os::ResourceFinder rf; rf.setVerbose(); rf.setDefaultContext("portScope/conf"); rf.setDefaultConfigFile("portScope.ini"); rf.configure("ICUB_ROOT",argc,argv); rf.setDefault ("local", "/portScope/vector:i"); rf.setDefault ("remote", ""); rf.setDefault ("robot", "icub"); rf.setDefault ("part", "head"); //Yarp network initialization yarp::os::Network yarp; if (!yarp.checkNetwork()) return -1; //create your module MyModule module; MainWindow *mainWindow; QApplication *qtApp; //QEventLoop *qel; if(rf.check("verbose")) { VERBOSE = true; if (VERBOSE) fprintf(stderr, "MESSAGE: will now be VERBOSE\n"); } else VERBOSE = false; qtApp = new QApplication(argc, argv); if (VERBOSE) fprintf(stderr, "MESSAGE: starting the configuration \n"); mainWindow = new MainWindow(&rf); if (VERBOSE) fprintf(stderr, "MESSAGE: main window initialized\n"); if(rf.find("dx").isInt() && rf.find("dy").isInt()) { mainWindow->resize(rf.find("dx").asInt(), rf.find("dy").asInt()); if (VERBOSE) fprintf(stderr, "MESSAGE: forcing window size %d %d\n", rf.find("dx").asInt(), rf.find("dy").asInt()); } else mainWindow->resize(600, 400); if(rf.find("x").isInt() && rf.find("y").isInt()) mainWindow->move(rf.find("x").asInt(), rf.find("y").asInt()); else mainWindow->move(0, 0); #if QT_VERSION < 0x040000 qtApp->setMainWidget(mainWindow); #endif if(rf.find("title").isString()) mainWindow->setCaption(rf.find("title").asString().c_str()); mainWindow->show(); // prepare and configure the resource finder module.setGtkVars(mainWindow, qtApp); module.configure(rf); module.runModule(); if (VERBOSE) fprintf(stderr, "MESSAGE: runModule terminated\n"); if (VERBOSE) fprintf(stderr, "MESSAGE: network closed\n"); delete mainWindow; delete qtApp; if (VERBOSE) fprintf(stderr, "MESSAGE: main window and qApp deleted\n"); yarp.fini(); return 0; }
int main(int argc, char *argv[]) { qRegisterMetaType<JoyButtonSlot*>(); qRegisterMetaType<InputDevice*>(); qRegisterMetaType<AutoProfileInfo*>(); QTextStream outstream(stdout); QTextStream errorstream(stderr); // If running Win version, check if an explicit style // was defined on the command-line. If so, make a note // of it. #ifdef Q_OS_WIN bool styleChangeFound = false; for (int i=0; i < argc && !styleChangeFound; i++) { char *tempchrstr = argv[i]; QString temp = QString::fromUtf8(tempchrstr); if (temp == "-style") { styleChangeFound = true; } } #endif CommandLineUtility cmdutility; QStringList cmdarguments = PadderCommon::arguments(argc, argv); cmdarguments.removeFirst(); cmdutility.parseArguments(cmdarguments); Logger appLogger(&outstream, &errorstream); if (cmdutility.hasError()) { appLogger.LogError(cmdutility.getErrorText()); return 1; } else if (cmdutility.isHelpRequested()) { appLogger.LogInfo(cmdutility.generateHelpString(), false); //cmdutility.printHelp(); return 0; } else if (cmdutility.isVersionRequested()) { appLogger.LogInfo(cmdutility.generateVersionString()); //cmdutility.printVersionString(); return 0; } if (cmdutility.getCurrentLogLevel() != appLogger.getCurrentLogLevel()) { appLogger.setLogLevel(cmdutility.getCurrentLogLevel()); } Q_INIT_RESOURCE(resources); QDir configDir(PadderCommon::configPath); if (!configDir.exists()) { configDir.mkpath(PadderCommon::configPath); } QMap<SDL_JoystickID, InputDevice*> *joysticks = new QMap<SDL_JoystickID, InputDevice*>(); // Cross-platform way of performing IPC. Currently, // only establish a connection and then disconnect. // In the future, there might be a reason to actually send // messages to the QLocalServer. QLocalSocket socket; socket.connectToServer(PadderCommon::localSocketKey); socket.waitForConnected(1000); if (socket.state() == QLocalSocket::ConnectedState) { // An instance of this program is already running. // Save app config and exit. QApplication a(argc, argv); AntiMicroSettings settings(PadderCommon::configFilePath, QSettings::IniFormat); InputDaemon *joypad_worker = new InputDaemon(joysticks, &settings, false); MainWindow w(joysticks, &cmdutility, &settings, false); if (!cmdutility.hasError() && cmdutility.hasProfile()) { w.saveAppConfig(); } joypad_worker->quit(); w.removeJoyTabs(); settings.sync(); socket.disconnectFromServer(); deleteInputDevices(joysticks); delete joysticks; joysticks = 0; delete joypad_worker; joypad_worker = 0; return 0; } LocalAntiMicroServer *localServer = 0; QApplication *a = 0; #ifndef Q_OS_WIN if (cmdutility.launchAsDaemon()) { pid_t pid, sid; //Fork the Parent Process pid = fork(); if (pid == 0) { appLogger.LogInfo(QObject::tr("Daemon launched")); //outstream << QObject::tr("Daemon launched") << endl; a = new QApplication(argc, argv); localServer = new LocalAntiMicroServer(); localServer->startLocalServer(); } else if (pid < 0) { appLogger.LogError(QObject::tr("Failed to launch daemon")); //errorstream << QObject::tr("Failed to launch daemon") << endl; deleteInputDevices(joysticks); delete joysticks; joysticks = 0; exit(EXIT_FAILURE); } //We got a good pid, Close the Parent Process else if (pid > 0) { appLogger.LogInfo(QObject::tr("Launching daemon")); //outstream << QObject::tr("Launching daemon") << endl; deleteInputDevices(joysticks); delete joysticks; joysticks = 0; exit(EXIT_SUCCESS); } #ifdef WITH_X11 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) if (QApplication::platformName() == QStringLiteral("xcb")) { #endif if (cmdutility.getDisplayString().isEmpty()) { X11Extras::getInstance()->syncDisplay(); } else { X11Extras::getInstance()->syncDisplay(cmdutility.getDisplayString()); if (X11Extras::getInstance()->display() == NULL) { appLogger.LogError(QObject::tr("Display string \"%1\" is not valid.").arg(cmdutility.getDisplayString())); //errorstream << QObject::tr("Display string \"%1\" is not valid.").arg(cmdutility.getDisplayString()) << endl; deleteInputDevices(joysticks); delete joysticks; joysticks = 0; delete localServer; localServer = 0; X11Extras::deleteInstance(); exit(EXIT_FAILURE); } } #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) } #endif #endif //Change File Mask umask(0); //Create a new Signature Id for our child sid = setsid(); if (sid < 0) { appLogger.LogError(QObject::tr("Failed to set a signature id for the daemon")); //errorstream << QObject::tr("Failed to set a signature id for the daemon") << endl; deleteInputDevices(joysticks); delete joysticks; joysticks = 0; delete localServer; localServer = 0; #ifdef WITH_X11 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) if (QApplication::platformName() == QStringLiteral("xcb")) { #endif X11Extras::deleteInstance(); #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) } #endif #endif exit(EXIT_FAILURE); } if ((chdir("/")) < 0) { appLogger.LogError(QObject::tr("Failed to change working directory to /")); //errorstream << QObject::tr("Failed to change working directory to /") // << endl; deleteInputDevices(joysticks); delete joysticks; joysticks = 0; delete localServer; localServer = 0; #ifdef WITH_X11 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) if (QApplication::platformName() == QStringLiteral("xcb")) { #endif X11Extras::deleteInstance(); #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) } #endif #endif exit(EXIT_FAILURE); } //Close Standard File Descriptors close(STDIN_FILENO); close(STDOUT_FILENO); close(STDERR_FILENO); } else { a = new QApplication(argc, argv); localServer = new LocalAntiMicroServer(); localServer->startLocalServer(); #ifdef WITH_X11 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) if (QApplication::platformName() == QStringLiteral("xcb")) { #endif if (!cmdutility.getDisplayString().isEmpty()) { X11Extras::getInstance()->syncDisplay(cmdutility.getDisplayString()); if (X11Extras::getInstance()->display() == NULL) { appLogger.LogError(QObject::tr("Display string \"%1\" is not valid.").arg(cmdutility.getDisplayString())); //errorstream << QObject::tr("Display string \"%1\" is not valid.").arg(cmdutility.getDisplayString()) << endl; deleteInputDevices(joysticks); delete joysticks; joysticks = 0; delete localServer; localServer = 0; X11Extras::deleteInstance(); exit(EXIT_FAILURE); } } #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) } #endif #endif } #else a = new QApplication (argc, argv); localServer = new LocalAntiMicroServer(); localServer->startLocalServer(); #endif a->setQuitOnLastWindowClosed(false); //QString defaultStyleName = qApp->style()->objectName(); // If running Win version and no explicit style was // defined, use the style Fusion by default. I find the // windowsvista style a tad ugly #ifdef Q_OS_WIN if (!styleChangeFound) { qApp->setStyle(QStyleFactory::create("Fusion")); } QIcon::setThemeName("/"); #endif AntiMicroSettings settings(PadderCommon::configFilePath, QSettings::IniFormat); settings.importFromCommandLine(cmdutility); QString targetLang = QLocale::system().name(); if (settings.contains("Language")) { targetLang = settings.value("Language").toString(); } QTranslator qtTranslator; qtTranslator.load(QString("qt_").append(targetLang), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); a->installTranslator(&qtTranslator); QTranslator myappTranslator; #if defined(Q_OS_UNIX) myappTranslator.load(QString("antimicro_").append(targetLang), QApplication::applicationDirPath().append("/../share/antimicro/translations")); #elif defined(Q_OS_WIN) myappTranslator.load(QString("antimicro_").append(targetLang), QApplication::applicationDirPath().append("\\share\\antimicro\\translations")); #endif a->installTranslator(&myappTranslator); InputDaemon *joypad_worker = new InputDaemon(joysticks, &settings); #ifndef Q_OS_WIN // Have program handle SIGTERM struct sigaction termaction; termaction.sa_handler = &termSignalTermHandler; sigemptyset(&termaction.sa_mask); termaction.sa_flags = 0; sigaction(SIGTERM, &termaction, 0); // Have program handle SIGINT struct sigaction termint; termint.sa_handler = &termSignalIntHandler; sigemptyset(&termint.sa_mask); termint.sa_flags = 0; sigaction(SIGINT, &termint, 0); #endif if (cmdutility.shouldListControllers()) { AppLaunchHelper mainAppHelper(&settings, false); mainAppHelper.printControllerList(joysticks); joypad_worker->quit(); deleteInputDevices(joysticks); delete joysticks; joysticks = 0; delete joypad_worker; joypad_worker = 0; delete localServer; localServer = 0; #ifdef WITH_X11 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) if (QApplication::platformName() == QStringLiteral("xcb")) { #endif X11Extras::deleteInstance(); #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) } #endif #endif delete a; a = 0; return 0; } #ifdef USE_SDL_2 else if (cmdutility.shouldMapController()) { MainWindow *w = new MainWindow(joysticks, &cmdutility, &settings); QObject::connect(a, SIGNAL(aboutToQuit()), w, SLOT(removeJoyTabs())); QObject::connect(a, SIGNAL(aboutToQuit()), joypad_worker, SLOT(quit())); int app_result = a->exec(); deleteInputDevices(joysticks); delete joysticks; joysticks = 0; delete joypad_worker; joypad_worker = 0; delete localServer; localServer = 0; #ifdef WITH_X11 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) if (QApplication::platformName() == QStringLiteral("xcb")) { #endif X11Extras::deleteInstance(); #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) } #endif #endif delete w; w = 0; delete a; a = 0; return app_result; } #endif #ifdef Q_OS_UNIX bool status = true; EventHandlerFactory *factory = EventHandlerFactory::getInstance(cmdutility.getEventGenerator()); if (!factory) { status = false; } else { status = factory->handler()->init(); } #if defined(WITH_UINPUT) && defined(WITH_XTEST) // Use xtest as a fallback. if (!status && cmdutility.getEventGenerator() != EventHandlerFactory::fallBackIdentifier()) { QString eventDisplayName = EventHandlerFactory::handlerDisplayName( EventHandlerFactory::fallBackIdentifier()); appLogger.LogInfo(QObject::tr("Attempting to use fallback option %1 for event generation.") .arg(eventDisplayName)); //outstream << QObject::tr("Attempting to use fallback option %1 for event generation.") // .arg(eventDisplayName) << endl; factory->deleteInstance(); factory = EventHandlerFactory::getInstance(EventHandlerFactory::fallBackIdentifier()); if (!factory) { status = false; } else { status = factory->handler()->init(); } } #endif if (!status) { appLogger.LogError(QObject::tr("Failed to open event generator. Exiting.")); //errorstream << QObject::tr("Failed to open event generator. Exiting.") << endl; joypad_worker->quit(); deleteInputDevices(joysticks); delete joysticks; joysticks = 0; delete joypad_worker; joypad_worker = 0; delete localServer; localServer = 0; #ifdef WITH_X11 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) if (QApplication::platformName() == QStringLiteral("xcb")) { #endif X11Extras::deleteInstance(); #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) } #endif #endif delete a; a = 0; return EXIT_FAILURE; } else { appLogger.LogInfo(QObject::tr("Using %1 as the event generator.").arg(factory->handler()->getName())); //outstream << QObject::tr("Using %1 as the event generator.").arg(factory->handler()->getName()) // << endl; factory->handler()->printPostMessages(); } #endif AntKeyMapper::getInstance(cmdutility.getEventGenerator()); MainWindow *w = new MainWindow(joysticks, &cmdutility, &settings); FirstRunWizard *runWillard = 0; if (w->getGraphicalStatus() && FirstRunWizard::shouldDisplay(&settings)) { runWillard = new FirstRunWizard(&settings, &qtTranslator, &myappTranslator); QObject::connect(runWillard, SIGNAL(finished(int)), w, SLOT(changeWindowStatus())); runWillard->show(); } else { w->changeWindowStatus(); } w->setAppTranslator(&qtTranslator); w->setTranslator(&myappTranslator); AppLaunchHelper mainAppHelper(&settings, w->getGraphicalStatus()); mainAppHelper.initRunMethods(); QObject::connect(joypad_worker, SIGNAL(joysticksRefreshed(QMap<SDL_JoystickID, InputDevice*>*)), w, SLOT(fillButtons(QMap<SDL_JoystickID, InputDevice*>*))); QObject::connect(w, SIGNAL(joystickRefreshRequested()), joypad_worker, SLOT(refresh())); QObject::connect(joypad_worker, SIGNAL(joystickRefreshed(InputDevice*)), w, SLOT(fillButtons(InputDevice*))); QObject::connect(a, SIGNAL(aboutToQuit()), localServer, SLOT(close())); QObject::connect(a, SIGNAL(aboutToQuit()), w, SLOT(saveAppConfig())); QObject::connect(a, SIGNAL(aboutToQuit()), w, SLOT(removeJoyTabs())); QObject::connect(a, SIGNAL(aboutToQuit()), joypad_worker, SLOT(quit())); #ifdef Q_OS_WIN QObject::connect(a, SIGNAL(aboutToQuit()), &mainAppHelper, SLOT(appQuitPointerPrecision())); #endif QObject::connect(localServer, SIGNAL(clientdisconnect()), w, SLOT(handleInstanceDisconnect())); #ifdef USE_SDL_2 QObject::connect(w, SIGNAL(mappingUpdated(QString,InputDevice*)), joypad_worker, SLOT(refreshMapping(QString,InputDevice*))); QObject::connect(joypad_worker, SIGNAL(deviceUpdated(int,InputDevice*)), w, SLOT(testMappingUpdateNow(int,InputDevice*))); QObject::connect(joypad_worker, SIGNAL(deviceRemoved(SDL_JoystickID)), w, SLOT(removeJoyTab(SDL_JoystickID))); QObject::connect(joypad_worker, SIGNAL(deviceAdded(InputDevice*)), w, SLOT(addJoyTab(InputDevice*))); #endif #ifdef Q_OS_WIN // Raise process priority. Helps reduce timer delays caused by // the running of other processes. bool raisedPriority = WinExtras::raiseProcessPriority(); if (!raisedPriority) { appLogger.LogInfo(QObject::tr("Could not raise process priority.")); //outstream << QObject::tr("Could not raise process priority.") << endl; } #else // Raise main thread prority. Helps reduce timer delays caused by // the running of other processes. QThread::currentThread()->setPriority(QThread::HighPriority); #endif int app_result = a->exec(); appLogger.LogInfo(QObject::tr("Quitting Program")); deleteInputDevices(joysticks); delete joysticks; joysticks = 0; delete joypad_worker; joypad_worker = 0; delete localServer; localServer = 0; AntKeyMapper::getInstance()->deleteInstance(); #ifdef Q_OS_UNIX #ifdef WITH_X11 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) if (QApplication::platformName() == QStringLiteral("xcb")) { #endif X11Extras::deleteInstance(); #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) } #endif #endif EventHandlerFactory::getInstance()->handler()->cleanup(); EventHandlerFactory::getInstance()->deleteInstance(); #endif delete w; w = 0; delete a; a = 0; return app_result; }
int main (int argc, char** argv) { arg_base::set_help_option("-h"); arg_parse(argc, argv); ntk_debug_level = opt::debug_level(); cv::setBreakOnError(true); QApplication app (argc, argv); // Config dir is supposed to be next to the binaries. QDir prev_dir = QDir::current(); QDir::setCurrent(QApplication::applicationDirPath()); MultipleGrabber* multi_grabber = new MultipleGrabber(); MultiKinectScanner scanner; RGBDGrabberFactory& grabber_factory = RGBDGrabberFactory::instance(); RGBDGrabberFactory::Params params; if (opt::directory()) params.directory = opt::directory(); if (opt::openni()) params.default_type = RGBDGrabberFactory::OPENNI; if (opt::freenect()) params.default_type = RGBDGrabberFactory::FREENECT; if (opt::kin4win()) params.default_type = RGBDGrabberFactory::KIN4WIN; if (opt::softkinetic()) params.default_type = RGBDGrabberFactory::SOFTKINETIC; if (opt::pmd()) params.default_type = RGBDGrabberFactory::PMD; if (opt::calibration_dir()) params.calibration_dir = opt::calibration_dir(); if (opt::high_resolution()) params.high_resolution = true; if (opt::no_registration()) params.hardware_registration = false; if (opt::sync()) params.synchronous = true; std::vector<RGBDGrabberFactory::GrabberData> grabbers; grabbers = grabber_factory.createGrabbers(params); ntk_dbg_print(grabbers.size(), 1); for (int i = 0; i < grabbers.size(); ++i) { RGBDGrabber* grabber = grabbers[i].grabber; bool ok = grabber->connectToDevice(); if (!ok) { ntk_dbg(0) << "WARNING: connectToDevice failed."; continue; } multi_grabber->addGrabber(grabber); scanner.addGrabber(grabber); } QDir::setCurrent(prev_dir.absolutePath()); GuiMultiKinectController* controller = new GuiMultiKinectController(&scanner); if (opt::bbox()) { ntk::Rect3f bbox = readBoundingBoxFromYamlFile(opt::bbox()); controller->setBoundingBox(bbox, true); } scanner.plugController(controller); controller->scanner().calibratorBlock().setCalibrationPattern(0.034, 10, 7); if (opt::sync()) controller->scanner().setPaused(true); scanner.start(); return app.exec(); }
int main(int argc, char *argv[]) { int ret=2; // return code from qapplication, default to error // // PROCESS COMMAND LINE SWITCHES // // snaffle arguments into a stringlist we can play with into sargs // and only keep non-switch args in the args string list QStringList sargs, args; for (int i=0; i<argc; i++) sargs << argv[i]; #ifdef GC_DEBUG bool debug = true; #else bool debug = false; #endif bool help = false; // honour command line switches foreach (QString arg, sargs) { // help or version requested if (arg == "--help" || arg == "--version") { help = true; fprintf(stderr, "GoldenCheetah %s (%d)\nusage: GoldenCheetah [[directory] athlete]\n\n", VERSION_STRING, VERSION_LATEST); fprintf(stderr, "--help or --version to print this message and exit\n"); #ifdef GC_DEBUG fprintf(stderr, "--debug to turn on redirection of messages to goldencheetah.log [debug build]\n"); #else fprintf(stderr, "--debug to direct diagnostic messages to the terminal instead of goldencheetah.log\n"); #endif fprintf (stderr, "\nSpecify the folder and/or athlete to open on startup\n"); fprintf(stderr, "If no parameters are passed it will reopen the last athlete.\n\n"); } else if (arg == "--debug") { #ifdef GC_DEBUG // debug, so don't redirect stderr! debug = false; #else debug = true; #endif } else { // not switches ! args << arg; } } // help or version printed so just exit now if (help) { exit(0); } // // INITIALISE ONE TIME OBJECTS // #ifdef Q_OS_X11 XInitThreads(); #endif #ifdef Q_OS_MACX if ( QSysInfo::MacintoshVersion > QSysInfo::MV_10_8 ) { // fix Mac OS X 10.9 (mavericks) font issue // https://bugreports.qt-project.org/browse/QTBUG-32789 QFont::insertSubstitution("LucidaGrande", "Lucida Grande"); } #endif // create the application -- only ever ONE regardless of restarts QApplication *application = new QApplication(argc, argv); #ifdef Q_OS_MAC // get an autorelease pool setup static CocoaInitializer cocoaInitializer; #endif // set defaultfont QFont font; font.fromString(appsettings->value(NULL, GC_FONT_DEFAULT, QFont().toString()).toString()); font.setPointSize(appsettings->value(NULL, GC_FONT_DEFAULT_SIZE, 10).toInt()); application->setFont(font); // set default font // set default colors GCColor::setupColors(); GCColor::readConfig(); // // OPEN FIRST MAINWINDOW // do { // lets not restart endlessly restarting = false; //this is the path within the current directory where GC will look for //files to allow USB stick support QString localLibraryPath="Library/GoldenCheetah"; //this is the path that used to be used for all platforms //now different platforms will use their own path //this path is checked first to make things easier for long-time users QString oldLibraryPath=QDir::home().canonicalPath()+"/Library/GoldenCheetah"; //these are the new platform-dependent library paths #if defined(Q_OS_MACX) QString libraryPath="Library/GoldenCheetah"; #elif defined(Q_OS_WIN) #if QT_VERSION > 0x050000 // windows and qt5 QStringList paths=QStandardPaths::standardLocations(QStandardPaths::DataLocation); QString libraryPath = paths.at(0); #else // windows not qt5 QString libraryPath=QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/GoldenCheetah"; #endif // qt5 #else // not windows or osx (must be Linux or OpenBSD) // Q_OS_LINUX et al QString libraryPath=".goldencheetah"; #endif // // or did we override in settings? QString sh; if ((sh=appsettings->value(NULL, GC_HOMEDIR, "").toString()) != QString("")) localLibraryPath = sh; // lets try the local library we've worked out... QDir home = QDir(); if(QDir(localLibraryPath).exists() || home.exists(localLibraryPath)) { home.cd(localLibraryPath); } else { // YIKES !! The directory we should be using doesn't exist! home = QDir::home(); if (home.exists(oldLibraryPath)) { // there is an old style path, lets fo there home.cd(oldLibraryPath); } else { if (!home.exists(libraryPath)) { if (!home.mkpath(libraryPath)) { // tell user why we aborted ! QMessageBox::critical(NULL, "Exiting", QString("Cannot create library directory (%1)").arg(libraryPath)); exit(0); } } home.cd(libraryPath); } } // set global root directory gcroot = home.canonicalPath(); // now redirect stderr #ifndef WIN32 if (!debug) nostderr(home.canonicalPath()); #endif // install QT Translator to enable QT Dialogs translation // we may have restarted JUST to get this! QTranslator qtTranslator; qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); application->installTranslator(&qtTranslator); // Language setting (default to system locale) QVariant lang = appsettings->value(NULL, GC_LANG, QLocale::system().name()); // Load specific translation QTranslator gcTranslator; gcTranslator.load(":translations/gc_" + lang.toString() + ".qm"); application->installTranslator(&gcTranslator); // Initialize metrics once the translator is installed RideMetricFactory::instance().initialize(); // Initialize global registry once the translator is installed GcWindowRegistry::initialize(); // initialise the trainDB trainDB = new TrainDB(home); // lets do what the command line says ... QVariant lastOpened; if(args.count() == 2) { // $ ./GoldenCheetah Mark // athlete lastOpened = args.at(1); } else if (args.count() == 3) { // $ ./GoldenCheetah ~/Athletes Mark // first parameter is a folder that exists? if (QFileInfo(args.at(1)).isDir()) { home.cd(args.at(1)); } // folder and athlete lastOpened = args.at(2); } else { // no parameters passed lets open the last athlete we worked with lastOpened = appsettings->value(NULL, GC_SETTINGS_LAST); // but hang on, did they crash? if so we need to open with a menu if(appsettings->cvalue(lastOpened.toString(), GC_SAFEEXIT, true).toBool() != true) lastOpened = QVariant(); } // lets attempt to open as asked/remembered bool anyOpened = false; if (lastOpened != QVariant()) { QStringList list = lastOpened.toStringList(); QStringListIterator i(list); while (i.hasNext()) { QString cyclist = i.next(); if (home.cd(cyclist)) { GcUpgrade v3; if (v3.upgradeConfirmedByUser(home)) { MainWindow *mainWindow = new MainWindow(home); mainWindow->show(); mainWindow->ridesAutoImport(); home.cdUp(); anyOpened = true; } else { delete trainDB; return ret; } } } } // ack, didn't manage to open an athlete // and the upgradeWarning was // lets ask the user which / create a new one if (!anyOpened) { ChooseCyclistDialog d(home, true); d.setModal(true); // choose cancel? if ((ret=d.exec()) != QDialog::Accepted) { delete trainDB; return ret; } // chosen, so lets get the choice.. home.cd(d.choice()); if (!home.exists()) { delete trainDB; exit(0); } // .. and open a mainwindow GcUpgrade v3; if (v3.upgradeConfirmedByUser(home)) { MainWindow *mainWindow = new MainWindow(home); mainWindow->show(); mainWindow->ridesAutoImport(); } else { delete trainDB; return ret; } } ret=application->exec(); // close trainDB delete trainDB; // clear web caches (stop warning of WebKit leaks) QWebSettings::clearMemoryCaches(); } while (restarting); return ret; }
int main(int argc, char** argv){ QApplication* app = new QApplication(argc, argv); return app->exec(); }
int main (int argc, char** argv) { arg_base::set_help_option("-h"); arg_parse(argc, argv); ntk_debug_level = opt::debug_level(); cv::setBreakOnError(true); QApplication::setGraphicsSystem("raster"); QApplication app (argc, argv); const char* fake_dir = opt::image(); bool is_directory = opt::directory() != 0; if (opt::directory()) fake_dir = opt::directory(); ntk::RGBDProcessor* processor = 0; RGBDGrabber* grabber = 0; #ifdef NESTK_USE_OPENNI OpenniDriver* ni_driver = 0; #endif bool use_openni = !opt::freenect(); #ifndef NESTK_USE_OPENNI use_openni = false; #endif if (opt::image() || opt::directory()) { std::string path = opt::image() ? opt::image() : opt::directory(); FileGrabber* file_grabber = new FileGrabber(path, opt::directory() != 0); grabber = file_grabber; } #ifdef NESTK_USE_OPENNI else if (use_openni) { // Config dir is supposed to be next to the binaries. QDir prev = QDir::current(); QDir::setCurrent(QApplication::applicationDirPath()); if (!ni_driver) ni_driver = new OpenniDriver(); OpenniGrabber* k_grabber = new OpenniGrabber(*ni_driver); k_grabber->setTrackUsers(false); // k_grabber->setCustomBayerDecoding(true); if (opt::high_resolution()) k_grabber->setHighRgbResolution(true); k_grabber->initialize(); QDir::setCurrent(prev.absolutePath()); grabber = k_grabber; } #endif #ifdef NESTK_USE_FREENECT else { FreenectGrabber* k_grabber = new FreenectGrabber(); k_grabber->initialize(); k_grabber->setIRMode(false); grabber = k_grabber; } #endif ntk_ensure(grabber, "Could not create any grabber. Kinect support built?"); if (use_openni) { processor = new ntk::OpenniRGBDProcessor(); } else { processor = new ntk::FreenectRGBDProcessor(); } if (opt::sync()) grabber->setSynchronous(true); RGBDFrameRecorder frame_recorder (opt::dir_prefix()); frame_recorder.setSaveOnlyRaw(false); ntk::RGBDCalibration* calib_data = 0; if (opt::calibration_file()) { calib_data = new RGBDCalibration(); calib_data->loadFromFile(opt::calibration_file()); } else if (use_openni) { calib_data = grabber->calibrationData(); } else if (QDir::current().exists("kinect_calibration.yml")) { { ntk_dbg(0) << "[WARNING] Using kinect_calibration.yml in current directory"; ntk_dbg(0) << "[WARNING] use --calibration to specify a different file."; } calib_data = new RGBDCalibration(); calib_data->loadFromFile("kinect_calibration.yml"); } ntk_ensure(calib_data, "You must specify a calibration file (--calibration)"); grabber->setCalibrationData(*calib_data); GuiController gui_controller (*grabber, *processor); grabber->addEventListener(&gui_controller); gui_controller.setFrameRecorder(frame_recorder); if (opt::sync()) gui_controller.setPaused(true); SurfelsRGBDModeler modeler; modeler.setMinViewsPerSurfel(1); processor->setFilterFlag(RGBDProcessorFlags::ComputeNormals, 1); processor->setMaxNormalAngle(90); processor->setFilterFlag(RGBDProcessorFlags::ComputeMapping, true); ModelAcquisitionController* acq_controller = 0; acq_controller = new ModelAcquisitionController (gui_controller, modeler); IncrementalPoseEstimatorFromImage* pose_estimator = 0; // FeatureSetParams params ("FAST", "BRIEF64", true); FeatureSetParams params ("SURF", "SURF64", true); pose_estimator = new IncrementalPoseEstimatorFromRgbFeatures(params, opt::use_icp()); acq_controller->setPoseEstimator(pose_estimator); gui_controller.setModelAcquisitionController(*acq_controller); grabber->start(); app.exec(); delete acq_controller; }
/** * \brief Entry function. * \param[in] argc - number of arguments * \param[in] argv[] - argumnet list * \return true if all went well */ int main(int argc, char *argv[]) { bool debug = false; bool remoteServers = true; QStringList localModules; QVector<MainWindow::Module> remoteModules; //process arguments for(int i=1; i<argc; i++) { QString cmd(argv[i]); if(cmd=="--debug") { debug = true; } else if(cmd=="--localMode") { remoteServers = false; } else if(cmd=="--localModules") // e.g. --localModules som,mtrnn,esn,tracker,era { QString module = argv[i+1]; //read modules if(!module.contains("--") || !module.isEmpty()) { localModules = module.split(","); i++; } } else if(cmd=="--remoteModules") // e.g. --remoteModules 1=som,mtrnn,esn 2=tracker,era { QString command = argv[i+1]; bool isNumber; //check if any modules were added at all if(!command.contains("--")) { //read modules until new parameter is found or no more parameters exist while(!command.contains("--") && i<argc-1) { i++; QStringList modules = command.split("="); if(!modules.empty()) { MainWindow::Module serverModule; modules.at(0).toInt(&isNumber); //check if the argument starts with server id if(isNumber) { serverModule.serverID = modules.at(0); serverModule.modules = modules.at(1).split(","); remoteModules.push_back(serverModule); } } command = argv[i+1]; } } } } //initialises message handeler if(!debug) { qInstallMsgHandler(customMessageHandler); } //current Aquila verions QString version = "Aquila 2.0"; //localhost name QString hostName = QHostInfo::localHostName(); //minimum version of YARP required for full support QString yarpVersion = "2.3.20"; //add active developers to the list QStringList developers; developers<<" Martin Peniak"<<" & Anthony Morse"; //initialise YARP yarp::os::Network yarp; //initialises Aquila and loads its icon QApplication *a = new QApplication(argc, argv); a->setWindowIcon(QPixmap(":/images/icon.png")); a->setAttribute(Qt::AA_X11InitThreads); //initialise splash screen QPixmap pixmap(":/images/splash.png"); SplashScreen *splash = new SplashScreen(pixmap, 4); splash->setFont(QFont("Ariel", 8, QFont::Bold)); splash->show(); //initialise GUI, probe yarpservers, its modules and add local modules to GUI MainWindow *w = new MainWindow(0, version, hostName, yarpVersion); splash->showMessage(QString("Initialising ")+version,Qt::AlignLeft | Qt::AlignBottom,Qt::white); QObject::connect(a, SIGNAL(aboutToQuit()), w, SLOT(aboutToQuit())); a->processEvents(); splash->showMessage(QObject::tr("Detecting available modules on the local network"),Qt::AlignLeft | Qt::AlignBottom,Qt::white); w->probeServers(remoteServers); a->processEvents(); //start local modules if(!localModules.isEmpty()) { splash->showMessage(QObject::tr("Starting local modules"),Qt::AlignLeft | Qt::AlignBottom,Qt::white); w->addLocalModules(localModules); a->processEvents(); } //start remote modules if(!remoteModules.isEmpty()) { if(remoteServers) { splash->showMessage(QObject::tr("Starting remote modules"),Qt::AlignLeft | Qt::AlignBottom,Qt::white); w->addRemoteModules(remoteModules); a->processEvents(); } else { qWarning(" - main_gui: '--localMode' argument prevented remote modules from loading during startup"); } } //load graphial user interface, show credits and close the splash splash->showMessage(QObject::tr("Loading graphical user interface"),Qt::AlignLeft | Qt::AlignBottom,Qt::white); a->processEvents(); QString credits("Developed by"); for(int i=0; i<developers.size(); i++) { credits.append(developers.at(i)); } splash->showMessage(credits,Qt::AlignLeft | Qt::AlignBottom,Qt::white); a->processEvents(); splash->finish(w); //show graphial user interface w->show(); return a->exec(); }
int main (int argc, char *argv[]) { QCoreApplication::setOrganizationName ("BerndStramm"); QCoreApplication::setOrganizationDomain ("bernd-stramm.com"); QCoreApplication::setApplicationName ("navi"); deliberate::ProgramVersion pv ("Navi"); QCoreApplication::setApplicationVersion (pv.Version()); deliberate::DSettings settings; deliberate::SetSettings (settings); deliberate::Settings().SetPrefix ("collect_"); settings.setValue ("program",pv.MyName()); QStringList configMessages; deliberate::CmdOptions opts ("navi"); opts.AddSoloOption ("debug","D",QObject::tr("show Debug log window")); opts.AddStringOption ("logdebug","L",QObject::tr("write Debug log to file")); deliberate::UseMyOwnMessageHandler (); bool optsOk = opts.Parse (argc, argv); if (!optsOk) { opts.Usage (); exit(1); } if (opts.WantHelp ()) { opts.Usage (); exit (0); } configMessages.append (QString("Built on %1 %2") .arg (__DATE__).arg(__TIME__)); configMessages.append (QObject::tr("Build with Qt %1").arg(QT_VERSION_STR)); configMessages.append (QObject::tr("Running with Qt %1").arg(qVersion())); if (opts.WantVersion ()) { exit (0); } bool showDebug = opts.SeenOpt ("debug"); int result; QApplication app (argc, argv); #if DELIBERATE_DEBUG_NOT_NOW deliberate::StartDebugLog (showDebug); bool logDebug = opts.SeenOpt ("logdebug"); if (logDebug) { QString logfile ("/dev/null"); opts.SetStringOpt ("logdebug",logfile); deliberate::StartFileLog (logfile); } #endif navi::Collect collect; app.setWindowIcon (collect.windowIcon()); collect.Init (app); collect.AddConfigMessages (configMessages); collect.Run (opts.Arguments()); result = app.exec (); qDebug () << " QApplication exec finished " << result; return result; }
void *TUIMod::Task( void * ) { vector<string> list; bool first_ent = true; QImage ico_t; time_t st_time = time(NULL); vector<TMess::SRec> recs; //> Init locale setLocale QLocale::setDefault(QLocale(Mess->lang().c_str())); //> Qt application object init QApplication *QtApp = new QApplication(mod->qtArgC, (char**)&mod->qtArgV); QtApp->setApplicationName(PACKAGE_STRING); QtApp->setQuitOnLastWindowClosed(false); mod->run_st = true; //> Create I18N translator I18NTranslator translator; QtApp->installTranslator(&translator); //> Start splash create if(!ico_t.load(TUIS::icoGet(SYS->id()+"_splash",NULL,true).c_str())) ico_t.load(":/images/splash.png"); QSplashScreen *splash = new QSplashScreen(QPixmap::fromImage(ico_t)); splash->show(); QFont wFnt = splash->font(); wFnt.setPixelSize(10); splash->setFont(wFnt); while(!mod->startCom() && !mod->endRun()) { SYS->archive().at().messGet(st_time, time(NULL), recs, "", TMess::Debug, BUF_ARCH_NM); QString mess; for(int i_m = recs.size()-1; i_m >= 0 && i_m > ((int)recs.size()-10); i_m--) mess += QString("\n%1: %2").arg(recs[i_m].categ.c_str()).arg(recs[i_m].mess.c_str()); recs.clear(); splash->showMessage(mess,Qt::AlignBottom|Qt::AlignLeft); QtApp->processEvents(); TSYS::sysSleep(0.5); } //> Start external modules WinControl *winCntr = new WinControl( ); int op_wnd = 0; mod->owner().modList(list); for(unsigned i_l = 0; i_l < list.size(); i_l++) if(mod->owner().modAt(list[i_l]).at().modInfo("SubType") == "QT" && mod->owner().modAt(list[i_l]).at().modFuncPresent("QMainWindow *openWindow();")) { //>> Search module into start list int i_off = 0; string s_el; while((s_el=TSYS::strSepParse(mod->start_mod,0,';',&i_off)).size()) if(s_el == list[i_l]) break; if(!s_el.empty() || !i_off) if(winCntr->callQTModule(list[i_l])) op_wnd++; } delete splash; //> Start call dialog if(QApplication::topLevelWidgets().isEmpty()) winCntr->startDialog( ); QObject::connect(QtApp, SIGNAL(lastWindowClosed()), winCntr, SLOT(lastWinClose())); QtApp->exec(); delete winCntr; //> Stop splash create if(!ico_t.load(TUIS::icoGet(SYS->id()+"_splash_exit",NULL,true).c_str())) ico_t.load(":/images/splash.png"); splash = new QSplashScreen(QPixmap::fromImage(ico_t)); splash->show(); splash->setFont(wFnt); st_time = time(NULL); while(!mod->endRun()) { SYS->archive().at().messGet( st_time, time(NULL), recs, "", TMess::Debug, BUF_ARCH_NM ); QString mess; for(int i_m = recs.size()-1; i_m >= 0 && i_m > ((int)recs.size()-10); i_m--) mess += QString("\n%1: %2").arg(recs[i_m].categ.c_str()).arg(recs[i_m].mess.c_str()); recs.clear(); splash->showMessage(mess,Qt::AlignBottom|Qt::AlignLeft); QtApp->processEvents(); TSYS::sysSleep(0.5); } delete splash; //> Qt application object free delete QtApp; first_ent = false; mod->run_st = false; return NULL; }
int main (int argc, char * argv []) { // apply default settings QucsSettings.x = 200; QucsSettings.y = 100; QucsSettings.font = QFont("Helvetica", 12); // is application relocated? char * var = getenv ("QUCSDIR"); QDir QucsDir; if (var != NULL) { QucsDir = QDir (var); QString QucsDirStr = QucsDir.canonicalPath (); QucsSettings.LangDir = QDir::convertSeparators (QucsDirStr + "/share/qucs/lang/"); } else { QString QucsApplicationPath = QCoreApplication::applicationDirPath(); #ifdef __APPLE__ QucsDir = QDir(QucsApplicationPath.section("/bin",0,0)); #else QucsDir = QDir(QucsApplicationPath); QucsDir.cdUp(); #endif QucsSettings.LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/"; } loadSettings(); QApplication app (argc, argv); qf_spec* spec_p; int result = 0; app.setFont( QucsSettings.font ); QTranslator tor( 0 ); QString lang = QucsSettings.Language; if(lang.isEmpty()) lang = QTextCodec::locale(); tor.load( QString("qucs_") + lang, QucsSettings.LangDir); app.installTranslator( &tor ); qf_box Filterbox; Filterbox.setFont (QucsSettings.font); Filterbox.move (QucsSettings.x, QucsSettings.y); Filterbox.show (); Filterbox.FilterName->setCurrentItem (QucsSettings.type); Filterbox.on_FilterName_activated (QucsSettings.form); Filterbox.TformName->setCurrentItem (QucsSettings.form); Filterbox.on_TformName_activated (QucsSettings.type); Filterbox.EnterCutoff->setText (QString::number (QucsSettings.cutoff)); Filterbox.CutoffCombo->setCurrentItem (QucsSettings.cutoff_unit); Filterbox.EnterZin->setText (QString::number (QucsSettings.zin)); Filterbox.EnterZout->setText (QString::number (QucsSettings.zout)); Filterbox.OrderBox->setChecked (QucsSettings.specify); Filterbox.OrderCombo->setCurrentItem (QucsSettings.ord); Filterbox.SubOrderCombo->setCurrentItem (QucsSettings.subord); Filterbox.EnterBandwidth->setText (QString::number (QucsSettings.bw)); Filterbox.BandwidthCombo->setCurrentItem (QucsSettings.bw_unit); Filterbox.EnterStopband->setText (QString::number (QucsSettings.sb)); Filterbox.StopbandCombo->setCurrentItem (QucsSettings.sb_unit); Filterbox.EnterRipple->setText (QString::number (QucsSettings.ripple)); Filterbox.EnterAngle->setText (QString::number (QucsSettings.angle)); Filterbox.EnterAttenuation->setText (QString::number (QucsSettings.atten)); while (true) { if (Filterbox. exec () != QDialog::Accepted) break; spec_p = Filterbox. get_spec (); QByteArray buf; Q3TextStream s (buf, QIODevice::ReadWrite); compute_lumped (spec_p, s); // FIXME #warning s. device () -> flush (); QClipboard *cb = QApplication::clipboard(); cb->setText(buf); } saveSettings (&Filterbox); saveXmlSettings (&Filterbox); return result; }