bool JUCEApplicationBase::sendCommandLineToPreexistingInstance() { jassert (multipleInstanceHandler == nullptr); // this must only be called once! multipleInstanceHandler.reset (new MultipleInstanceHandler (getApplicationName())); return multipleInstanceHandler->sendCommandLineToPreexistingInstance(); }
StandaloneFilterWindow *SqueezerStandalone::createWindow() { // load settings of stand-alone; this includes the directory in // which the current state is to be stored PropertiesFile::Options settings; #ifdef SQUEEZER_MONO settings.applicationName = "squeezer_mono"; #else settings.applicationName = "squeezer_stereo"; #endif settings.filenameSuffix = "ini"; settings.folderName = ".config"; settings.osxLibrarySubFolder = "Application Support"; PropertiesFile *propertiesFile = new PropertiesFile(settings); // instantiate GUI StandaloneFilterWindow *filterWindow = new StandaloneFilterWindow( getApplicationName(), Colours::lightgrey, propertiesFile, true); // GUI cannot be resized filterWindow->setResizable(false, true); return filterWindow; }
//============================================================================== void initialise(const String& /*commandLine*/) override { mainWindow = new MainWindow(getApplicationName()); // Check for latest version _versionChecker.startThread(); }
//============================================================================== void initialise (const String& commandLine) override { ignoreUnused (commandLine); // This method is where you should put your application's initialisation code.. mainWindow = new MainWindow (getApplicationName()); }
//============================================================================== void initialise (const String& commandLine) override { // This method is where you should put your application's initialisation code.. UnitTestRunner testRunner; testRunner.runAllTests(); ScopedPointer<Component> c(new ModeSelect()); int retval = DialogWindow::showModalDialog("Select Mode", c, nullptr, Colours::grey, false); mainWindow = new MainWindow (getApplicationName()); if (0 == retval) { // server mode... mainWindow->SetText("SERVER"); ServerController* c = new ServerController(); mainWindow->SetController(c); fRpcServer = new RpcServer(c); this->RunServer(); } else { // client mode. mainWindow->SetText("client"); RpcClient* ipc = new RpcClient(); fClientController = new ClientController(ipc); mainWindow->SetController(fClientController); this->RunClient(); } }
int MainWindow::checkXmlFolder( const QString &s_XmlPath, const int n ) { bool b_hasXsd = false; QStringList sl_FilenameList; QStringList sl_baseNames; // ********************************************************************************************** listDir( sl_FilenameList, s_XmlPath, false ); if ( sl_FilenameList.count() != 2*n+1 ) { QMessageBox::critical( this, getApplicationName( true ), tr( "Number of files is wrong" ) ); return( -60 ); } else { for ( int i=0; i<2*n+1; i++ ) { QFileInfo fi( sl_FilenameList.at( i ) ); if ( fi.fileName() != "article-doi_v3.2.xsd" ) sl_baseNames.append( fi.completeBaseName() ); else b_hasXsd = true; } if ( b_hasXsd == false ) { QMessageBox::critical( this, getApplicationName( true ), tr( "File article-doi_v3.2.xsd is missing" ) ); return( -60 ); } for ( int i=0; i<2*n; i++ ) { if ( sl_baseNames.count( sl_baseNames.at( i ) ) != 2 ) { QMessageBox::critical( this, getApplicationName( true ), tr( "File name is wrong. Please check\n\n " ).append( sl_baseNames.at( i ) ).append( tr( ".*" ) ) ); return( -60 ); } } } return( _NOERROR_ ); }
void MainWindow::onError( const int err ) { switch ( err ) { case _APPBREAK_: // Progress aborted break; case _ERROR_: // Error break; case _NOERROR_: // No error break; case _CHOOSEABORTED_: // Choose aborted break; case _FILENOTEXISTS_: // File not exists QMessageBox::information( this, getApplicationName(), tr( "Import file not exists" ) ); break; case _DONE_: QMessageBox::information( this, getApplicationName(), tr( "Done" ) ); break; case -3: // Progress aborted break; case -10: QMessageBox::information( this, getApplicationName(), tr( "Can't open import file.\nPossible locked by another application." ) ); break; case -20: QMessageBox::information( this, getApplicationName(), tr( "Can't create export file.\nFile is already open." ) ); break ; case -30: QMessageBox::information( this, getApplicationName(), tr( "hssrv2 account not set" ) ); break ; case -40: QMessageBox::information( this, getApplicationName(), tr( "pangaea-mw1 account not set" ) ); break ; case -45: QMessageBox::information( this, getApplicationName(), tr( "not files from Jubany selected" ) ); break ; case -50: QMessageBox::information( this, getApplicationName(), tr( "Only one file selected" ) ); break ; case -60: QMessageBox::information( this, getApplicationName(), tr( "No parameter selected" ) ); break ; default : QMessageBox::information( this, getApplicationName(), tr( "Unknown error.\nPlease contact [email protected]" ) ); break ; } }
int MainWindow::startProgram( const QString &s_Program, const QString &s_Filename ) { QProcess process; QStringList sl_args; QString s_ProgramFilePath = ""; // *********************************************************************************************** QFileInfo fi( s_Program ); if ( fi.exists() == false ) { QString s_Message = "Cannot find the program\n\n " + QDir::toNativeSeparators( s_Program ) + "\n\n Please start the program manually from your shell."; QMessageBox::warning( this, getApplicationName( true ), s_Message ); return( _ERROR_ ); } else { #if defined(Q_OS_LINUX) s_ProgramFilePath = s_Program; #endif #if defined(Q_OS_WIN) s_ProgramFilePath = s_Program; #endif #if defined(Q_OS_MAC) s_ProgramFilePath = QDir::toNativeSeparators( fi.absoluteFilePath() ); s_ProgramFilePath.append( "/Contents/MacOS/odv4" ); #endif sl_args.append( QDir::toNativeSeparators( s_Filename ) ); if ( process.startDetached( s_ProgramFilePath, sl_args ) == false ) { QString s_Message = "Cannot start the program\n\n " + QDir::toNativeSeparators( s_Program ) + "\n\n Please start the program manually from your shell."; QMessageBox::warning( this, getApplicationName( true ), s_Message ); return( _ERROR_ ); } } return( _NOERROR_ ); }
XN_C_API XnStatus XN_C_DECL xnOSGetApplicationLibDir(XnChar* cpDirName, const XnUInt32 nBufferSize) { char strAppName[1024]; getApplicationName(strAppName, sizeof(strAppName)); snprintf(cpDirName, nBufferSize, "/data/data/%s/lib/", strAppName); return (XN_STATUS_OK); }
virtual StandaloneFilterWindow* createWindow() { return new StandaloneFilterWindow (getApplicationName(), LookAndFeel::getDefaultLookAndFeel().findColour (ResizableWindow::backgroundColourId), appProperties.getUserSettings(), false, {}, nullptr #ifdef JucePlugin_PreferredChannelConfigurations , { JucePlugin_PreferredChannelConfigurations } #endif ); }
//============================================================================== void initialise (const String& commandLine) override { ignoreUnused (commandLine); String err = deviceManager.initialiseWithDefaultDevices (1, 1); jassert (err.isEmpty()); deviceManager.addAudioCallback (&player); deviceManager.addMidiInputCallback (String(), &player); mainWindow = new MainWindow (player, getApplicationName()); }
void ossimArgumentParser::writeErrorMessages(std::ostream& output, ossimErrorSeverity severity) { for(ossimErrorMessageMap::iterator itr=theErrorMessageMap.begin(); itr!=theErrorMessageMap.end(); ++itr) { if (itr->second>=severity) { output<< getApplicationName() << ": " << itr->first << std::endl; } } }
//============================================================================== void initialise (const String& commandLine) override { // This method is where you should put your application's initialisation code.. try { const char* headers[] = { "Connection", "close", "Content-type", "application/x-www-form-urlencoded", "Accept", "text/plain", 0 }; const char* body = "answer=42&name=Bubba"; happyhttp::Connection conn1( "posttestserver.com", 80 ); conn1.setcallbacks( OnBegin, OnData, OnComplete, 0 ); conn1.request( "PUT", "/post.php", headers, (const unsigned char*)body, strlen(body) ); while( conn1.outstanding() ) { conn1.pump(); } const char* cbliteHeaders[] = { "Connection", "close", "Authorization", "Basic Y2JsaXRlOnBhc3N3b3Jk", 0 }; happyhttp::Connection conn2( "localhost", 5984 ); conn2.setcallbacks( OnBegin, OnData, OnComplete, 0 ); conn2.request( "GET", "/", cbliteHeaders, 0, 0 ); while( conn2.outstanding() ) conn2.pump(); } catch( happyhttp::Wobbly& e ) { DBG ("Exception:\n" << e.what() ); } mainWindow = new MainWindow (getApplicationName()); }
QString Zpublic::getDataPath(const QString &finderName, bool autoCreatePath) { QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); if(path.isEmpty()) { path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); } path = path+"/" + getApplicationName() + "/"+finderName; if(autoCreatePath) { QDir dir(path); dir.mkpath(path); } return path; }
//============================================================================== void initialise (const String&) override { /*laf = new ParkingLotLaF(); LookAndFeel::setDefaultLookAndFeel (laf);*/ LookAndFeel* laf = &LookAndFeel::getDefaultLookAndFeel (); #if JUCE_WINDOWS laf->setDefaultSansSerifTypefaceName ("Microsoft Yahei Light"); #elif JUCE_MAC laf->setDefaultSansSerifTypefaceName ("Microsoft Yahei"); // little small //laf->setDefaultSansSerifTypefaceName ("Hiragino Sans GB"); // little big //laf->setDefaultSansSerifTypefaceName ("Pingfang SC"); // too small #endif mainWindow = new MainWindow (getApplicationName()); }
//============================================================================== bool JUCEApplication::initialiseApp (const String& commandLine) { commandLineParameters = commandLine.trim(); #if ! (JUCE_IOS || JUCE_ANDROID) jassert (appLock == nullptr); // initialiseApp must only be called once! if (! moreThanOneInstanceAllowed()) { appLock = new InterProcessLock ("juceAppLock_" + getApplicationName()); if (! appLock->enter(0)) { appLock = nullptr; MessageManager::broadcastMessage (getApplicationName() + "/" + commandLineParameters); DBG ("Another instance is running - quitting..."); return false; } } #endif // let the app do its setting-up.. initialise (commandLineParameters); #if JUCE_MAC juce_initialiseMacMainMenu(); // needs to be called after the app object has created, to get its name #endif #if ! (JUCE_IOS || JUCE_ANDROID) broadcastCallback = new AppBroadcastCallback(); #endif stillInitialising = false; return true; }
virtual StandaloneFilterWindow* createWindow() { #ifdef JucePlugin_PreferredChannelConfigurations StandalonePluginHolder::PluginInOuts channels[] = { JucePlugin_PreferredChannelConfigurations }; #endif return new StandaloneFilterWindow (getApplicationName(), LookAndFeel::getDefaultLookAndFeel().findColour (ResizableWindow::backgroundColourId), appProperties.getUserSettings(), false, {}, nullptr #ifdef JucePlugin_PreferredChannelConfigurations , juce::Array<StandalonePluginHolder::PluginInOuts> (channels, juce::numElementsInArray (channels)) #endif ); }
int MainWindow::startGoogleEarth( const QString &s_FilenameGoogleEarthProgram, const QString &s_FilenameGoogleEarth ) { int err = _NOERROR_; if ( ( s_FilenameGoogleEarth.contains( " " ) == true ) && ( s_FilenameGoogleEarthProgram.contains( "googleearth" ) == true ) ) { QString s_Message = "The file name\n\n " + QDir::toNativeSeparators( s_FilenameGoogleEarth ) + "\n\n contains spaces. Google Earth cannot open files in directories with spaces."; QMessageBox::warning( this, getApplicationName( true ), s_Message ); } else { err = startProgram( s_FilenameGoogleEarthProgram, s_FilenameGoogleEarth ); } return( err ); }
StandaloneFilterApp() { PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_Standalone; PropertiesFile::Options options; options.applicationName = getApplicationName(); options.filenameSuffix = ".settings"; options.osxLibrarySubFolder = "Application Support"; #if JUCE_LINUX options.folderName = "~/.config"; #else options.folderName = ""; #endif appProperties.setStorageParameters (options); }
bool ProjucerApplication::initialiseLogger (const char* filePrefix) { if (logger == nullptr) { #if JUCE_LINUX String folder = "~/.config/Projucer/Logs"; #else String folder = "com.juce.projucer"; #endif logger = FileLogger::createDateStampedLogger (folder, filePrefix, ".txt", getApplicationName() + " " + getApplicationVersion() + " --- Build date: " __DATE__); Logger::setCurrentLogger (logger); } return logger != nullptr; }
void PokeLaunchApplication::initialise(const String &commandLine) { StringArray args; args.addTokens(commandLine, true); if (args.contains("--help")) { std::cerr << "arguments:" << std::endl; std::cerr << " --help: Print usage help" << std::endl; std::cerr << " --fakewifi: Use fake WifiStatus" << std::endl; quit(); } auto configFile = assetFile("config.json"); if (!configFile.exists()) { std::cerr << "Missing config file: " << configFile.getFullPathName() << std::endl; quit(); } auto configJson = JSON::parse(configFile); if (!configJson) { std::cerr << "Could not parse config file: " << configFile.getFullPathName() << std::endl; quit(); } // open sound handle if(!sound()) DBG("Sound failed to initialize"); // Populate with dummy data { if (args.contains("--fakewifi")) wifiStatus = &wifiStatusJson; else wifiStatus = &wifiStatusNM; wifiStatus->initializeStatus(); auto deviceListFile = assetFile("bluetooth.json"); bluetoothStatus.populateFromJson(JSON::parse(deviceListFile)); } mainWindow = new MainWindow(getApplicationName(), configJson); }
void initialise( const String& commandLine ) { try { // Initialize logger String appName(getApplicationName()); _logger = FileLogger::createDefaultAppLogger(appName, appName + "Log.txt", appName + " " + getApplicationVersion()); Logger::setCurrentLogger(_logger); Log::write("Initializing..."); // Setup app context AppContext::getInstance()->initialise(); // Load default skin //File skinpath = File::getCurrentWorkingDirectory().getChildFile("Skins/Default/"); //SkinManager::getInstance()->initialise( skinpath ); // *** TODO: This is temp test code that needs to be changed! // Login dialog should not be shown here. User needs to add music services and // we will try to login to all of them at this point without any prompt. checkLogin(); // Initialize main window _mainWindow = new MainWindow(); //_mainWindow->centreWithSize(350, 170); //_mainWindow->setVisible(true); // Testing the animator //_animator = new ComponentAnimator(); //_animator->animateComponent(_mainWindow, Rectangle(_mainWindow->getX(), _mainWindow->getY(), 500, 600), 1000, 3, 0); Log::write("Entering main loop"); } catch(Exception& ex) { if(_logger != NULL) Log::write(ex.getFullMessage()); quit(); } }
void StandaloneApplication::initialise(const String& commandLineParameters) { PropertiesFile::Options options; #ifdef TRAKMETER_MULTI options.applicationName = "trakmeter_multi"; #else options.applicationName = "trakmeter_stereo"; #endif options.folderName = ".config"; options.filenameSuffix = "ini"; options.osxLibrarySubFolder = "Application Support"; PropertiesFile* pPropertiesFile = new PropertiesFile(options); String strApplicationName = getApplicationName(); filterWindow = new StandaloneFilterWindow(strApplicationName, Colours::black, pPropertiesFile); filterWindow->setTitleBarButtonsRequired(DocumentWindow::allButtons, false); filterWindow->setVisible(true); filterWindow->setResizable(false, true); }
void ossimArgumentParser::reportRemainingOptionsAsUnrecognized(ossimErrorSeverity severity) { std::set<std::string> options; if (theUsage) { // parse the usage options to get all the option that the application can potential handle. for(ossimApplicationUsage::UsageMap::const_iterator itr=theUsage->getCommandLineOptions().begin(); itr!=theUsage->getCommandLineOptions().end(); ++itr) { const std::string& option = itr->first; std::string::size_type prevpos = 0, pos = 0; while ((pos=option.find(' ',prevpos))!=std::string::npos) { if (option[prevpos]=='-') { options.insert(std::string(option,prevpos,pos-prevpos)); } prevpos=pos+1; } if (option[prevpos]=='-') { options.insert(std::string(option,prevpos,std::string::npos)); } } } for(int pos=1;pos<argc();++pos) { // if an option and havn't been previous querried for report as unrecognized. if (isOption(pos) && options.find(theArgv[pos])==options.end()) { reportError(getApplicationName() +": unrecognized option "+theArgv[pos],severity); } } }
//============================================================================== void initialise (const String& commandLine) override { mainWindow = new MainWindow(getApplicationName(), options_); }
Application::Application(const std::vector<CL_String> &args, lua_State *luaState) : mUpdated(false), mCompanyName(""), mApplicationName("bmgui"), mApplicationVersion(""), mQuit(false) { GAME_ASSERT(!args.empty()); #ifdef WIN32 // bind main thread to the first core for correct timings on some multicore systems SetThreadAffinityMask(GetCurrentThread(), 0x01); #endif // parse the command line arguments std::vector<char *> argv; for (std::vector<CL_String>::const_iterator it = args.begin(); it != args.end(); ++it) argv.push_back(const_cast<char *>(it->c_str())); CL_CommandLine commandLine; commandLine.set_help_indent(40); commandLine.add_doc("Graphical interface for Sibek balance machines"); commandLine.add_usage("[OPTION...]\n"); commandLine.add_option('g', "gateway", "ADDR", "Default gateway address"); commandLine.add_option('a', "local_addr", "ADDR", "Local address"); commandLine.add_option('m', "netmask", "ADDR", "Subnet mask"); commandLine.add_option('d', "dns", "ADDR", "DNS server address"); commandLine.add_option('i', "input_dev", "TYPE", "Input device type"); commandLine.add_option('s', "server_status", "FLAG", "Server status"); commandLine.add_option('u', "available_update_version", "VERSION", "Available update version"); commandLine.add_option('U', "updated", "FLAG", "Software update flag"); commandLine.add_option('W', "updatedfw", "FLAG", "Firmware update flag"); commandLine.add_option('D', "datadir", "PATH", "Path to the data directory"); commandLine.add_option('h', "help", "", "Show this help"); commandLine.parse_args(argv.size(), &argv[0]); #if defined(WIN32) || defined(__APPLE__) mDataDirectory = CL_Directory::get_resourcedata("bmgui", "data"); #else mDataDirectory = CL_PathHelp::add_trailing_slash(GAME_DATA_DIR); #endif while (commandLine.next()) { switch (commandLine.get_key()) { case 'g': mGateway = commandLine.get_argument(); break; case 'a': mLocalAddr = commandLine.get_argument(); break; case 'm': mNetmask = commandLine.get_argument(); break; case 'd': mDNS = commandLine.get_argument(); break; case 'i': mInputDev = commandLine.get_argument(); break; case 's': mServerStatus = commandLine.get_argument(); break; case 'u': mAvailableUpdateVersion = commandLine.get_argument(); break; case 'U': mUpdated = CL_StringHelp::text_to_bool(commandLine.get_argument()); break; case 'W': mFirmwareUpdated = commandLine.get_argument(); break; case 'D': mDataDirectory = CL_PathHelp::add_trailing_slash(commandLine.get_argument()); break; case 'h': commandLine.print_help(); quit(); return; } } /*CL_Console::write_line(cl_format("mGateway = %1", mGateway)); CL_Console::write_line(cl_format("mLocalAddr = %1", mLocalAddr)); CL_Console::write_line(cl_format("mNetmask = %1", mNetmask)); CL_Console::write_line(cl_format("mDNS = %1", mDNS)); CL_Console::write_line(cl_format("mInputDev = %1", mInputDev)); CL_Console::write_line(cl_format("mServerStatus = %1", mServerStatus)); CL_Console::write_line(cl_format("mAvailableUpdateVersion = %1", mAvailableUpdateVersion)); CL_Console::write_line(cl_format("mDataDirectory = %1", mDataDirectory));*/ // load the system profile Profile profile(""); CL_Console::write_line(cl_format("gateway = %1", profile.getString("gateway"))); CL_Console::write_line(cl_format("local_addr = %1", profile.getString("local_addr"))); CL_Console::write_line(cl_format("netmask = %1", profile.getString("netmask"))); CL_Console::write_line(cl_format("dns = %1", profile.getString("dns"))); CL_Console::write_line(cl_format("input_dev = %1", profile.getInt("input_dev"))); CL_Console::write_line(cl_format("server_status = %1", profile.getBool("server_status"))); CL_Console::write_line(cl_format("available_update_version = %1", profile.getString("available_update_version"))); CL_Console::write_line(cl_format("server_addr = %1", profile.getString("server_addr"))); CL_Console::write_line(cl_format("remote_control = %1", profile.getBool("remote_control"))); CL_Console::write_line(cl_format("ignored_update_version = %1", profile.getString("ignored_update_version"))); CL_Console::write_line(cl_format("cal_command = %1", profile.getString("cal_command"))); CL_Console::write_line(cl_format("language = %1", profile.getInt("language"))); CL_Console::write_line(cl_format("fullscreen = %1", profile.getBool("fullscreen"))); CL_Console::write_line(cl_format("width = %1", profile.getInt("width"))); CL_Console::write_line(cl_format("height = %1", profile.getInt("height"))); CL_Console::write_line(cl_format("sound_level = %1", profile.getInt("sound_level"))); // initialize all game subsystems mBalance = CL_SharedPtr<Balance>(new Balance(profile)); mDatabase = CL_SharedPtr<Database>(new Database(getConfigDirectory() + getApplicationName() + ".db")); mResourceManager = CL_SharedPtr<ResourceManager>(new ResourceManager()); mResourceQueue = CL_SharedPtr<ResourceQueue>(new ResourceQueue()); mGraphics = CL_SharedPtr<Graphics>(new Graphics(profile)); mKeyboard = CL_SharedPtr<Keyboard>(new Keyboard()); mMouse = CL_SharedPtr<Mouse>(new Mouse()); mSoundOutput = CL_SoundOutput(44100); mLuaScript = CL_SharedPtr<LuaScript>(new LuaScript("main.lua", luaState)); }
void initialise (const String& commandLine) override { mainWindow = new MainWindow (getApplicationName()); LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); }
void MainWindow::onError( const int err ) { switch ( err ) { case _APPBREAK_: // Progress aborted break; case _ERROR_: // Error break; case _NOERROR_: // No error break; case _CHOOSEABORTED_: // Choose aborted break; case _FILENOEXISTS_: // File not exists QMessageBox::information( this, getApplicationName( true ), tr( "Import file not exists" ) ); break; case -3: // Progress aborted break; case -10: QMessageBox::information( this, getApplicationName( true ), tr( "Can't open import file.\nPossible locked by another application." ) ); break; case -20: QMessageBox::information( this, getApplicationName( true ), tr( "Can't create export file.\nFile is already open." ) ); break ; case -30: QMessageBox::information( this, getApplicationName( true ), tr( "Converter was canceled" ) ); break ; case -40: QMessageBox::information( this, getApplicationName( true ), tr( "Wrong format" ) ); break ; case -41: QMessageBox::information( this, getApplicationName( true ), tr( "Third GEOCODE is missing.\n(e.g. depth, height, or date/time)" ) ); break ; case -50: QMessageBox::information( this, getApplicationName( true ), tr( "Only one file selected" ) ); break ; case -60: QMessageBox::information( this, getApplicationName( true ), tr( "No parameter selected" ) ); break ; case -70: QMessageBox::information( this, getApplicationName( true ), tr( "Latitude/longitude not given.\nWe need a position." ) ); break ; case -71: QMessageBox::information( this, getApplicationName( true ), tr( "Latitude not given.\nWe need a position." ) ); break ; case -72: QMessageBox::information( this, getApplicationName( true ), tr( "Longitude given.\nWe need a position." ) ); break ; default : QMessageBox::information( this, getApplicationName( true ), tr( "Unknown error.\nPlease contact [email protected]" ) ); break ; } }
virtual StandaloneFilterWindow* createWindow() { return new StandaloneFilterWindow (getApplicationName(), Colours::white, nullptr, true); }
//========================================================================== void initialise (const String&) override { mainWindow = new MainWindow (getApplicationName()); }