Пример #1
0
NATRON_NAMESPACE_USING

int
main(int argc,
     char *argv[])
{
    CLArgs::printBackGroundWelcomeMessage();

    CLArgs args(argc,argv,false);
    if (args.getError() > 0) {
        return 1;
    }

    if (args.isBackgroundMode()) {
        
        AppManager manager;

        // coverity[tainted_data]
        if (!manager.load(argc,argv,args) ) {
            return 1;
        } else {
            return 0;
        }
    } else {
        
        GuiApplicationManager manager;
        
        // coverity[tainted_data]
        return manager.load(argc,argv,args);
        
        //exec() is called within the GuiApplicationManager
    }
} // main
Пример #2
0
void
FSettings::OnActionPerformed(const Osp::Ui::Control& source, int actionId)
{
	if (actionId == ASAVE) {
		int tmpval;
		int setlimit = 0;
		int setday = 1;
		Osp::Ui::Controls::EditField * tmpef;
		tmpef = static_cast<Osp::Ui::Controls::EditField *>(this->GetControl(L"limitel", true));
		if (Osp::Base::Integer::Parse(tmpef->GetText(), setlimit) != E_SUCCESS) {
			setlimit = 0;
		}
		if (Application::GetInstance()->GetAppRegistry()->Get(L"limit", tmpval) == E_KEY_NOT_FOUND) {
			Application::GetInstance()->GetAppRegistry()->Add(L"limit", setlimit);
		} else {
			Application::GetInstance()->GetAppRegistry()->Set(L"limit", setlimit);
		}
		tmpef = static_cast<Osp::Ui::Controls::EditField *>(this->GetControl(L"dayel", true));
		if (Osp::Base::Integer::Parse(tmpef->GetText(), setday) != E_SUCCESS) {
			setday = 1;
		}
		if (Application::GetInstance()->GetAppRegistry()->Get(L"day", tmpval) == E_KEY_NOT_FOUND) {
			Application::GetInstance()->GetAppRegistry()->Add(L"day", setday);
		} else {
			Application::GetInstance()->GetAppRegistry()->Set(L"day", setday);
		}
		Application::GetInstance()->GetAppRegistry()->Save();
		Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->TransitionDirection = pFormMgr->TRANSITIONRIGHT;
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
	} else if (actionId == ACANCEL) {
		Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->TransitionDirection = pFormMgr->TRANSITIONLEFT;
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
	}

	DateTime today, nextrundate;

	Osp::System::SystemTime::GetCurrentTime(Osp::System::WALL_TIME, today);
	int dayinm = 1;
	if (Application::GetInstance()->GetAppRegistry()->Get(L"day", dayinm) != E_SUCCESS) {
		dayinm = 1;
	}
	nextrundate.SetValue(today.GetYear(),today.GetMonth(),dayinm,0,0,0);
	if (today.GetDay() >= dayinm) {
		nextrundate.AddMonths(1);
	}

	AppManager * appmgr = Osp::App::AppManager::GetInstance();
	if (appmgr->IsAppLaunchRegistered() == true) {
		appmgr->UnregisterAppLaunch();
	}
	appmgr->RegisterAppLaunch(L"DateTime='" + nextrundate.ToString() + "'", null, AppManager::LAUNCH_OPTION_DEFAULT);

	AppLog("set next run %S", nextrundate.ToString().GetPointer());

}
Пример #3
0
int main(int argc, const char * argv[])
{
    argc-=(argc>0); argv+=(argc>0); // skip program name argv[0] if present
    option::Stats  stats(usage, argc, argv);
    option::Option* options = new option::Option[stats.options_max];
    option::Option* buffer = new option::Option[stats.buffer_max];
    option::Parser parse(usage, argc, argv, options, buffer);
    
    if (parse.error())
        return 1;
    
    if (options[HELP]) {
        option::printUsage(std::cout, usage);
        return 0;
    }
    
    if (options[SOLVER] == NULL || options[SOLVER].arg == NULL) {
        std::cout << std::endl << "\tSolver type is required!" << std::endl << std::endl;
        option::printUsage(std::cout, usage);
        return 0;
    }
    
    for (option::Option* opt = options[UNKNOWN]; opt; opt = opt->next()){
        std::cout << "Unknown option: " << opt->name << "\n";
    }
    
    float time;
    size_t Nx, Ny, N;
    
    time    = setValue<float>(options,TIME,0.2f);
    Nx      = setValue<size_t>(options,X_SIZE,128);
    Ny      = setValue<size_t>(options,Y_SIZE,128);
    N       = setValue<size_t>(options,N_SIZE,150);
    
    
    AppManager* manager = NULL;
    try {
        manager = new AppManager();
        manager->init(Nx,Ny,stringToEnum(options[SOLVER].arg),options[DEVICE].arg);
        manager->begin(N,time);
        
    } catch (std::exception& e) {
        std::cerr << e.what() << std::endl;
    }
    delete manager;
    
    delete [] options;
    delete [] buffer;
    
    return 0;
}
Пример #4
0
//view next or previous apps that match criterias
void AppManager::cycleApps(WindowApp *theApp){

	gtk_widget_destroy(theApp->killThisWindow);

		Application *app = (*theApp->cycle)[theApp->cycler];
//	
		theApp->canEdit = false;

		AppManager *appMan = new AppManager(theApp->cyclerTypes[theApp->cycler],theApp);
		if(theApp->cyclerTypes[theApp->cycler]){
			appMan->fillInData(app, theApp);
		}
		else{
			appMan->fillInUData(app, theApp);
		}

}
Пример #5
0
void
InfoForm::GetProduct(int index)
{
	result r = E_SUCCESS;
	String samsungapps;
	// get appId of Samsung Apps
	r = SystemInfo::GetValue("SamsungAppsAppId", samsungapps);
	AppLog("SamsungAppsAppId %s", r);

	ArrayList *pArrayList = new ArrayList();
	pArrayList->Construct();
	String *uri= new String();
	uri->Append(L"samsungapps://ProductDetail/"+*__pProducts[index][0]);
	pArrayList->Add(*uri);

	AppManager *pAppManager = AppManager::GetInstance();
	// Launch Samsung Apps with uri
	pAppManager->LaunchApplication(samsungapps, pArrayList, AppManager::LAUNCH_OPTION_DEFAULT);
}
result VKUServiceProxy::Construct(const AppId& appId, const String& remotePortName) {
	result r = E_FAILURE;

	this->appId = appId;

	AppManager* pAppManager = AppManager::GetInstance();
	TryReturn(pAppManager != null, E_FAILURE, "VKU : Fail to get AppManager instance.");

	AppLog("VKU : Checking service status for time out 5 sec...");

	for (int i = 0; i < 5; ++i) {
		if (pAppManager->IsRunning(appId)) {
			AppLog("VKU : Service is ready");
			break;
		} else {
			AppLog("VKU : Service is not ready. try to launch.");
			r = pAppManager->LaunchApplication(appId, null);
			TryReturn(!IsFailed(r), r, "VKU : [%s]", GetErrorMessage(r));
			Thread::Sleep(CHECK_INTERVAL);
		}
	}

	TryReturn(pAppManager->IsRunning(appId), E_FAILURE, "VKU : The service is not working.");

	pLocalMessagePort = MessagePortManager::RequestLocalMessagePort(LOCAL_MESSAGE_PORT_NAME);
	TryReturn(pLocalMessagePort != null, E_FAILURE, "[E_FAILURE] Failed to get LocalMessagePort instance.");

	pLocalMessagePort->AddMessagePortListener(*this);

	pRemoteMessagePort = MessagePortManager::RequestRemoteMessagePort(appId, remotePortName);
	TryReturn(pRemoteMessagePort != null, E_FAILURE, "[E_FAILURE] Failed to get LocalMessagePort instance.");

	AppLog("LocalMessagePort(\"%ls\") is ready", pLocalMessagePort->GetName().GetPointer());

	// send connect request
	HashMap *pMap =	new HashMap(SingleObjectDeleter);
	pMap->Construct();
	pMap->Add(new String(L"request"), new String(L"connect"));
	r = SendMessage(pMap);
	delete pMap;

	return E_SUCCESS;
}
Пример #7
0
int main(int argc, char *argv[])
{
#if defined (Q_OS_MAC)
    /*
     Avoid 'Too many open files' on Mac

     Increase the number of file descriptors that the process can open to the maximum allowed.
     By default, Mac OS X only allows 256 file descriptors, which can easily be reached.
     */
    // see also https://qt.gitorious.org/qt-creator/qt-creator/commit/7f1f9e1
    // increase maximum numbers of file descriptors
	struct rlimit rl;
	getrlimit(RLIMIT_NOFILE, &rl);
 	rl.rlim_cur = qMin((rlim_t)OPEN_MAX, rl.rlim_max);
	setrlimit(RLIMIT_NOFILE, &rl);
#endif

    bool isBackground;
    QString projectName,mainProcessServerName;
    QStringList writers;
    AppManager::parseCmdLineArgs(argc,argv,&isBackground,projectName,writers,mainProcessServerName);
#ifdef Q_OS_UNIX
    projectName = AppManager::qt_tildeExpansion(projectName);
#endif
    
    ///auto-background without a project name is not valid.
    if (projectName.isEmpty()) {
        AppManager::printUsage();
        return 1;
    }
    AppManager manager;
    if (!manager.load(argc,argv,projectName,writers,mainProcessServerName)) {
        AppManager::printUsage();
        return 1;
    } else {
        return 0;
    }
    return 0;
}
Пример #8
0
int main(int argc, const char * argv[])
{
    argc-=(argc>0); argv+=(argc>0); // skip program name argv[0] if present
    option::Stats  stats(usage, argc, argv);
    option::Option* options = new option::Option[stats.options_max];
    option::Option* buffer = new option::Option[stats.buffer_max];
    option::Parser parse(usage, argc, argv, options, buffer);
    
    if (parse.error())
        return 1;
    
    if (options[HELP]) {
        option::printUsage(std::cout, usage);
        return 0;
    }
    
    for (option::Option* opt = options[UNKNOWN]; opt; opt = opt->next()){
        std::cout << "Unknown option: " << opt->name << "\n";
    }
    
    AppManager* manager = NULL;
    try {
        manager = new AppManager();
        manager->init();
        manager->begin();
        
    } catch (std::exception& e) {
        std::cerr << e.what() << std::endl;
    }
    delete manager;
    
    delete [] options;
    delete [] buffer;
    
    return 0;
}
Пример #9
0
NATRON_NAMESPACE_USING

int
main(int argc,
     char *argv[])
{
#if defined(Q_OS_UNIX) && defined(RLIMIT_NOFILE)
    /*
     Avoid 'Too many open files' on Unix.

     Increase the number of file descriptors that the process can open to the maximum allowed.
     - By default, Mac OS X only allows 256 file descriptors, which can easily be reached.
     - On Linux, the default limit is usually 1024.

     Note that due to a bug in stdio on OS X, the limit on the number of files opened using fopen()
     cannot be changed after the first call to stdio (e.g. printf() or fopen()).
     Consequently, this has to be the first thing to do in main().
     */
    struct rlimit rl;
    if (getrlimit(RLIMIT_NOFILE, &rl) == 0) {
        if (rl.rlim_max > rl.rlim_cur) {
            rl.rlim_cur = rl.rlim_max;
            if (setrlimit(RLIMIT_NOFILE, &rl) != 0) {
#             if defined(__APPLE__) && defined(OPEN_MAX)
                // On Mac OS X, setrlimit(RLIMIT_NOFILE, &rl) fails to set
                // rlim_cur above OPEN_MAX even if rlim_max > OPEN_MAX.
                if (rl.rlim_cur > OPEN_MAX) {
                    rl.rlim_cur = OPEN_MAX;
                    setrlimit(RLIMIT_NOFILE, &rl);
                }
#             endif
            }
        }
    }
#endif
    
    CLArgs::printBackGroundWelcomeMessage();
    CLArgs args(argc, argv, false);

    if (args.getError() > 0) {
        return 1;
    }

    if ( args.isBackgroundMode() ) {
        AppManager manager;

        // coverity[tainted_data]
        if ( !manager.load(argc, argv, args) ) {
            return 1;
        } else {
            return 0;
        }
    } else {
        GuiApplicationManager manager;

        // coverity[tainted_data]
        return manager.load(argc, argv, args);

        //exec() is called within the GuiApplicationManager
    }
} // main