Exemple #1
0
Boolean launchServer (OSType serverid) {
	
	/*
	if the application whose creator id is serverid is running, return true.
	
	if not, we look for the application and try to launch it. we wait until it's 
	actually running and ready to receive Apple Events.
	*/
	
	FSSpec fs;
	
	if (appRunning (serverid))
		return (true);
		
	if (!findApp (serverid, &fs))
		return (false);
		
	if (!launchApp (&fs))
		return (false);
		
	while (!appRunning (serverid)) {
		
		EventRecord ev;
		
		EventAvail (everyEvent, &ev);
		} /*while*/
		
	return (true);
	} /*launchServer*/
Exemple #2
0
void TrayUI::slotTrayClicked(QSystemTrayIcon::ActivationReason reason){
  if(reason == QSystemTrayIcon::Context){
    this->contextMenu()->popup(QCursor::pos());
  }else{
    launchApp();
  }
}
Exemple #3
0
int theMain(int argc, char **argv){
	obj.screenLog = TEMP_EN_LOG; //initially disable logging to screen.
		
	//Define the quit handler;
	signal(SIGTERM,exitHandle);
	initSDL();


	//JS_Init(); //SETUP SPIDERMONKEY -> NEW VERSION!!

	if(!(runtime = JS_NewRuntime(8L *1024*1024L * 8,JS_USE_HELPER_THREADS /*JS_NO_HELPER_THREADS*/ ))){
		fprint(stderr,"Could not setup runtime\n");
		exit(EXIT_FAILURE);
	}
	
	init_video_libraries(&argc,&argv);
	
	while(1){
		char *appPath = NULL;
		appPath = launchApp(MENU_SCRIPT,1);
		if(appPath == NULL)
			continue;
		loadApp(appPath);
	}
	return EXIT_SUCCESS;
}
Exemple #4
0
void loadApp(char *appName){
	char *pathBack = NULL;
	pathBack = launchApp(appName,0);
	if(appName)free(appName);
	if(pathBack)free(pathBack);
	return;
}
Exemple #5
0
void IconBase::mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event)
{
    if (m_launchMode == DesktopPlugin::DoubleClick
        && event->button() == Qt::LeftButton)
    {
        launchApp();
    }
}
Exemple #6
0
void GlobalAccel::bindDefault()
{
    foreach(const QKeySequence & keySequence , mapping.keys())
    {
        qDebug() << "Binding: " << keySequence << mapping.value(keySequence);

        QxtGlobalShortcut *sc = new QxtGlobalShortcut(this);
        sc->setShortcut(keySequence);
        connect(sc , SIGNAL(activated()) , SLOT(launchApp()));
    }
}
Exemple #7
0
OSStatus LSOpenCFURLRef(CFURLRef inURL, CFURLRef *outLaunchedURL)
{
	// TODO: use 'xdg-mime query' and 'xdg-mime default' to determine the app?

    const char *str = CFStringGetCStringPtr(CFURLGetString(inURL),CFStringGetSystemEncoding());
    std::vector<std::string> args;
    args.push_back(str);
    launchApp(g_scXdgOpenPath,args);
    outLaunchedURL = nullptr;
	return unimpErr;
}
void IconBase::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
{
    if (m_launchMode == DesktopPlugin::DoubleClick)
        return;
//    qDebug() << "IconBase::mouseReleaseEvent" << event;
    switch (event->button())
    {
        case Qt::LeftButton:
            launchApp();
            break;
        default:
            // ignored
            break;
    }
}
Exemple #9
0
void TrayUI::slotItemClicked(QAction* act){
  QString code = act->whatsThis();
  if(code=="quit"){
    //Close the tray
    slotClose();
  }else if(code=="update"){
    //Re-check for updates by syscache
    BackendResync();
  }else if(code.isEmpty()){
    return;
  }else{
    //Launch one of the external applications
    launchApp(code);
  }
  
}
Exemple #10
0
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setIso(); break;
        case 1: launchApp(); break;
        case 2: updateForces(); break;
        case 3: deleteCells(); break;
        case 4: clearQGview(); break;
        case 5: redrawQGview(); break;
        case 6: selectContainer((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 7;
    }
    return _id;
}
Exemple #11
0
void Britepad::begin() {

  // assumes that the splashapp has been created and added to list
  launchApp(SplashApp::ID, SCREENSAVER_MODE);
  setApp(getAppByID(SplashApp::ID), SCREENSAVER_MODE);

  // initialize apps
  BritepadApp* anApp = appList;
  while (anApp != nullptr) {
    anApp->init();
    anApp = anApp->getNextApp();
  }

  screen.setBacklight(screen.maxbrightness);
  backlightTimer.setMillis(ambientUpdateInterval, backlightCallback, (void*)this, true);
  statusBarUpdateTimer.setMillis(1000, statusBarCallback, (void*)this, true);

	usbHost.begin();
	usbMouse.begin();
}
Exemple #12
0
void IconBase::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
{
    if (m_launchMode == DesktopPlugin::DoubleClick)
        return;

    // do not launch app when it's in "drag" mode
    if ((event->pos() - m_oldPosition).manhattanLength() > QApplication::startDragDistance())
    {
        return;
    }

    switch (event->button())
    {
        case Qt::LeftButton:
            launchApp();
            break;
        default:
            // ignored
            break;
    }
}
Exemple #13
0
int main(int argc, char *argv[])
{
	configureSandbox();
	createCrashFile();
	registerExtensions();
	
	//Initialisation
	MUTEX_CREATE(DBRefreshMutex);
	
	loadEmailProfile();
	initializeDNSCache();
	
#ifdef VERBOSE_DB_MANAGEMENT
	removeFolder("log");
	mkdirR("log");
#endif
	
	atexit(cleanup);
	createNewThread(networkAndVersionTest, NULL); //On met le test dans un nouveau thread pour pas ralentir le démarrage
	setupBDDCache();
	return launchApp(argc, argv);
}
Exemple #14
0
static
LRESULT CALLBACK
mainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message) {
	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDCANCEL:
			// test for unsaved data
			if (ARG->m_config != ARG->m_oldConfig) {
				if (!askVerify(hwnd, getString(IDS_UNSAVED_DATA_REALLY_QUIT))) {
					return 0;
				}
			}

			// quit
			PostQuitMessage(0);
			return 0;

		case IDOK:
		case IDC_MAIN_TEST: {
			// note if testing
			const bool testing = (LOWORD(wParam) == IDC_MAIN_TEST);

			// save data
			if (ARG->m_config != ARG->m_oldConfig) {
				if (!saveConfig(ARG->m_config, false)) {
					showError(hwnd, CStringUtil::format(
								getString(IDS_SAVE_FAILED).c_str(),
								getErrorString(GetLastError()).c_str()));
					return 0;
				}
				ARG->m_oldConfig = ARG->m_config;
				enableSaveControls(hwnd);
			}

			// launch child app
			DWORD threadID;
			HANDLE thread = launchApp(hwnd, testing, &threadID);
			if (thread == NULL) {
				return 0;
			}

			// handle child program
			if (testing) {
				// wait for process to stop, allowing the user to kill it
				waitForChild(hwnd, thread, threadID);

				// clean up
				CloseHandle(thread);
			}
			else {
				// don't need thread handle
				CloseHandle(thread);

				// notify of success
				askOkay(hwnd, getString(IDS_STARTED_TITLE),
								getString(IDS_STARTED));

				// quit
				PostQuitMessage(0);
			}
			return 0;
		}

		case IDC_MAIN_AUTOSTART: {
			// construct command line
			CString cmdLine = getCommandLine(hwnd, false);
			if (!cmdLine.empty()) {
				// run dialog
				CAutoStart autoStart(hwnd,
							isClientChecked(hwnd) ? NULL : &ARG->m_config,
							cmdLine);
				autoStart.doModal();
				if (autoStart.wasUserConfigSaved()) {
					ARG->m_oldConfig = ARG->m_config;
					enableSaveControls(hwnd);
				}
			}
			return 0;
		}

		case IDC_MAIN_SAVE:
			if (!saveConfig(ARG->m_config, false)) {
				showError(hwnd, CStringUtil::format(
								getString(IDS_SAVE_FAILED).c_str(),
								getErrorString(GetLastError()).c_str()));
			}
			else {
				ARG->m_oldConfig = ARG->m_config;
				enableSaveControls(hwnd);
			}
			return 0;

		case IDC_MAIN_CLIENT_RADIO:
		case IDC_MAIN_SERVER_RADIO:
			enableMainWindowControls(hwnd);
			return 0;

		case IDC_MAIN_SERVER_ADD_BUTTON:
			addScreen(hwnd);
			return 0;

		case IDC_MAIN_SERVER_EDIT_BUTTON:
			editScreen(hwnd);
			return 0;

		case IDC_MAIN_SERVER_REMOVE_BUTTON:
			removeScreen(hwnd);
			return 0;

		case IDC_MAIN_SERVER_SCREENS_LIST:
			if (HIWORD(wParam) == LBN_SELCHANGE) {
				enableScreensControls(hwnd);
				updateNeighbors(hwnd);
			}
			else if (HIWORD(wParam) == LBN_DBLCLK) {
				editScreen(hwnd);
				return 0;
			}
			break;

		case IDC_MAIN_SERVER_LEFT_COMBO:
			if (HIWORD(wParam) == CBN_SELENDOK) {
				changeNeighbor(hwnd, (HWND)lParam, kLeft);
				return 0;
			}
			break;

		case IDC_MAIN_SERVER_RIGHT_COMBO:
			if (HIWORD(wParam) == CBN_SELENDOK) {
				changeNeighbor(hwnd, (HWND)lParam, kRight);
				return 0;
			}
			break;

		case IDC_MAIN_SERVER_TOP_COMBO:
			if (HIWORD(wParam) == CBN_SELENDOK) {
				changeNeighbor(hwnd, (HWND)lParam, kTop);
				return 0;
			}
			break;

		case IDC_MAIN_SERVER_BOTTOM_COMBO:
			if (HIWORD(wParam) == CBN_SELENDOK) {
				changeNeighbor(hwnd, (HWND)lParam, kBottom);
				return 0;
			}
			break;

		case IDC_MAIN_OPTIONS:
			s_globalOptions->doModal();
			enableSaveControls(hwnd);
			break;

		case IDC_MAIN_ADVANCED:
			s_advancedOptions->doModal(isClientChecked(hwnd));
			enableSaveControls(hwnd);
			break;
		}

	default:
		break;
	}
	return DefDlgProc(hwnd, message, wParam, lParam);
}
Exemple #15
0
static
LRESULT CALLBACK
mainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message) {
	case WM_ACTIVATE:
		if (LOWORD(wParam) != WA_INACTIVE) {
			// activated

			// see if the configuration changed
			if (isConfigNewer(s_configTime, s_userConfig)) {
				CString message2 = getString(IDS_CONFIG_CHANGED);
				if (askVerify(hwnd, message2)) {
					time_t configTime;
					bool userConfig;
					CConfig newConfig;
					if (loadConfig(newConfig, configTime, userConfig) &&
						userConfig == s_userConfig) {
						ARG->m_config = newConfig;
						s_lastConfig  = ARG->m_config;
					}
					else {
						message2 = getString(IDS_LOAD_FAILED);
						showError(hwnd, message2);
						s_lastConfig = CConfig();
					}
				}
			}
		}
		else {
			// deactivated;  write configuration
			if (!isShowingDialog()) {
				saveMainWindow(hwnd, SAVE_QUIET);
			}
		}
		break;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDCANCEL:
			// save data
			if (saveMainWindow(hwnd, SAVE_QUITING)) {
				// quit
				PostQuitMessage(0);
			}
			return 0;

		case IDOK:
		case IDC_MAIN_TEST: {
			// note if testing
			const bool testing = (LOWORD(wParam) == IDC_MAIN_TEST);

			// save data
			if (saveMainWindow(hwnd, SAVE_NORMAL)) {
				// launch child app
				DWORD threadID;
				HANDLE thread;
				if (!launchApp(hwnd, testing, &thread, &threadID)) {
					return 0;
				}

				// handle child program
				if (testing) {
					// wait for process to stop, allowing the user to kill it
					waitForChild(hwnd, thread, threadID);

					// clean up
					CloseHandle(thread);
				}
				else {
					// don't need thread handle
					if (thread != NULL) {
						CloseHandle(thread);
					}

					// notify of success: now disabled - it's silly to notify a success
					//askOkay(hwnd, getString(IDS_STARTED_TITLE), getString(IDS_STARTED));

					// quit
					PostQuitMessage(0);
				}
			}
			return 0;
		}

		case IDC_MAIN_AUTOSTART: {
			CString cmdLine;
			if (saveMainWindow(hwnd, SAVE_NORMAL, &cmdLine)) {
				// run dialog
				CAutoStart autoStart(hwnd, !isClientChecked(hwnd), cmdLine);
				autoStart.doModal();
			}
			return 0;
		}

		case IDC_MAIN_CLIENT_RADIO:
		case IDC_MAIN_SERVER_RADIO:
			enableMainWindowControls(hwnd);
			return 0;

		case IDC_MAIN_SCREENS:
			s_screensLinks->doModal();
			break;

		case IDC_MAIN_OPTIONS:
			s_globalOptions->doModal();
			break;

		case IDC_MAIN_ADVANCED:
			s_advancedOptions->doModal(isClientChecked(hwnd));
			break;

		case IDC_MAIN_HOTKEYS:
			s_hotkeyOptions->doModal();
			break;

		case IDC_MAIN_INFO:
			s_info->doModal();
			break;
		}

	default:
		break;
	}
	return DefDlgProc(hwnd, message, wParam, lParam);
}
bool ProjectContentComponent::perform (const InvocationInfo& info)
{
    switch (info.commandID)
    {
        case CommandIDs::saveProject:
        case CommandIDs::closeProject:
        case CommandIDs::saveDocument:
        case CommandIDs::saveDocumentAs:
        case CommandIDs::closeDocument:
        case CommandIDs::goToPreviousDoc:
        case CommandIDs::goToNextDoc:
        case CommandIDs::goToCounterpart:
        case CommandIDs::saveAndOpenInIDE:
            if (reinvokeCommandAfterCancellingModalComps (info))
            {
                grabKeyboardFocus(); // to force any open labels to close their text editors
                return true;
            }

            break;

        default:
            break;
    }

    if (isCurrentlyBlockedByAnotherModalComponent())
        return false;

    switch (info.commandID)
    {
        case CommandIDs::saveProject:               saveProject();      break;
        case CommandIDs::closeProject:              closeProject();     break;
        case CommandIDs::saveDocument:              saveDocument();     break;
        case CommandIDs::saveDocumentAs:            saveAs();           break;
        case CommandIDs::closeDocument:             closeDocument();    break;
        case CommandIDs::goToPreviousDoc:           goToPreviousFile(); break;
        case CommandIDs::goToNextDoc:               goToNextFile();     break;
        case CommandIDs::goToCounterpart:           goToCounterpart();  break;

        case CommandIDs::showProjectSettings:       showProjectSettings();         break;
        case CommandIDs::showProjectTab:            showProjectTab();              break;
        case CommandIDs::showBuildTab:              showBuildTab();                break;
        case CommandIDs::showFileExplorerPanel:     showFilesPanel();              break;
        case CommandIDs::showModulesPanel:          showModulesPanel();            break;
        case CommandIDs::showExportersPanel:        showExportersPanel();          break;
        case CommandIDs::showExporterSettings:      showCurrentExporterSettings(); break;

        case CommandIDs::openInIDE:                 openInSelectedIDE (false); break;
        case CommandIDs::saveAndOpenInIDE:          openInSelectedIDE (true);  break;

        case CommandIDs::createNewExporter:         showNewExporterMenu(); break;

        case CommandIDs::deleteSelectedItem:        deleteSelectedTreeItems(); break;

        case CommandIDs::showTranslationTool:       showTranslationTool(); break;

        case CommandIDs::cleanAll:                  cleanAll();                           break;
        case CommandIDs::toggleBuildEnabled:        setBuildEnabled (! isBuildEnabled()); break;
        case CommandIDs::buildNow:                  rebuildNow();                         break;
        case CommandIDs::toggleContinuousBuild:     setContinuousRebuildEnabled (! isContinuousRebuildEnabled()); break;
        case CommandIDs::launchApp:                 launchApp();                          break;
        case CommandIDs::killApp:                   killApp();                            break;
        case CommandIDs::reinstantiateComp:         reinstantiateLivePreviewWindows();    break;
        case CommandIDs::showWarnings:              toggleWarnings();                     break;
        case CommandIDs::nextError:                 showNextError();                      break;
        case CommandIDs::prevError:                 showPreviousError();                  break;

        default:
            return false;
    }

    return true;
}
Exemple #17
0
int main(void)
{    

    char strInput[20];    
    char *strCommand;
    char *Args1;
    char *Args2;
    char *space = " \t\r\n\a";

    int n;    

    printf("\n****************************************************************************************");     
    printf("\n********\t\t\tHello! Welcome to the C Shell!\t\t\t********");     
     printf("\n**************************************************************************************** \n\n");     
     do{
         printf("\nEnter a command: \n> ");
         //scanf("%s",strCommand);     
         fgets(strInput,sizeof(strInput),stdin);

        strCommand = strtok(strInput, space);
        Args1 = strtok(NULL, space);
        Args2 = strtok(NULL, space);

        /*
        printf("\nThe command you entered : >>%s<<", strCommand);
        printf("\nThe Args1 you entered : >>%s<<", Args1);
        printf("\nThe Args2 you entered : >>%s<<", Args2);

        if(strchr(Args1,'\n') != 0){
            //printf("\n>>>>> String has new line\n");
            strncpy(Args1,Args1,sizeof(Args1)-1);
            //printf("\nAfter StrCopy :  >%s<",Args1);
        }        
        
        printf("\nThe command evaluated : %s\n", strCommand);
        */
         if(strcmp(strCommand,TYPE_CMD) == 0){
            //Validate if the argument is passed
             displayFile(strCommand,Args1,Args2);
         }                 
         else{
             if(strcmp(strCommand,COPY_CMD) == 0){
                //Validate if both the argument are passed
                 copyFile(strCommand,Args1,Args2);                 
             }                 
             else {
                  if(strcmp(strCommand,DEL_CMD) == 0){
                    //Validate if the argument is passed
                     deleteFile(strCommand,Args1,Args2);                     
                  }                    
                  else{
                      if(strncmp(strCommand,EXIT_CMD,4) != 0){                        
                        //Validate if the argument is passed
                        launchApp(strCommand,Args1,Args2);                                            
                      }                          
                  }
             }
         } 



     }    while(strncmp(strCommand,EXIT_CMD,4) != 0);        


    printf("\n****************************************************************************************");     
    printf("\n********\t\t\t   Exiting the Shell!   \t\t\t********");     
     printf("\n**************************************************************************************** \n\n");     
    return 0;

}
Exemple #18
0
int main(int argc, char **argv)
{
    int argi = 1;

    while((argi < argc) && (argv[argi][0] == '-'))
    {
        switch(argv[argi][1])
        {
            case 'l':
                bLaunchApp = true;
                break;
            case 'a':
                bAppIdOnly = true;
                break;
            default:
                usage();
        }
        argi++;
    }

    if(argc <= argi)
        usage();

    DCOPClient client;
    client.attach();
    dcop = &client;

    QCString app;
    QCString objid;
    QCString function;
    char **args = 0;
    if((argc > argi) && (strncmp(argv[argi], "DCOPRef(", 8)) == 0)
    {
        char *delim = strchr(argv[argi], ',');
        if(!delim)
        {
            fprintf(stderr, "Error: '%s' is not a valid DCOP reference.\n", argv[argi]);
            return 1;
        }
        *delim = 0;
        app = argv[argi++] + 8;
        delim++;
        delim[strlen(delim) - 1] = 0;
        objid = delim;
    }
    else
    {
        if(argc > argi)
            app = argv[argi++];
        if(argc > argi)
            objid = argv[argi++];
    }
    if(argc > argi)
        function = argv[argi++];

    if(argc > argi)
    {
        args = &argv[argi];
        argc = argc - argi;
    }
    else
    {
        argc = 0;
    }

    KStringList params;
    for(int i = 0; i < argc; i++)
        params.append(args[i]);
    bool ok = findObject(app, objid, function, params);
    if(ok)
        return 0;
    if(bLaunchApp)
    {
        ok = launchApp(app);
        if(!ok)
            return 2;
        ok = findObject(app, objid, function, params);
    }

    return 1;
}
Exemple #19
0
static
LRESULT CALLBACK
mainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message) {
	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDCANCEL:
			// save data
			if (saveMainWindow(hwnd, true)) {
				// quit
				PostQuitMessage(0);
			}
			return 0;

		case IDOK:
		case IDC_MAIN_TEST: {
			// note if testing
			const bool testing = (LOWORD(wParam) == IDC_MAIN_TEST);

			// save data
			if (saveMainWindow(hwnd, false)) {
				// launch child app
				DWORD threadID;
				HANDLE thread = launchApp(hwnd, testing, &threadID);
				if (thread == NULL) {
					return 0;
				}

				// handle child program
				if (testing) {
					// wait for process to stop, allowing the user to kill it
					waitForChild(hwnd, thread, threadID);

					// clean up
					CloseHandle(thread);
				}
				else {
					// don't need thread handle
					CloseHandle(thread);

					// notify of success
					askOkay(hwnd, getString(IDS_STARTED_TITLE),
									getString(IDS_STARTED));

					// quit
					PostQuitMessage(0);
				}
			}
			return 0;
		}

		case IDC_MAIN_AUTOSTART: {
			CString cmdLine;
			if (saveMainWindow(hwnd, false, &cmdLine)) {
				// run dialog
				CAutoStart autoStart(hwnd, !isClientChecked(hwnd), cmdLine);
				autoStart.doModal();
			}
			return 0;
		}

		case IDC_MAIN_CLIENT_RADIO:
		case IDC_MAIN_SERVER_RADIO:
			enableMainWindowControls(hwnd);
			return 0;

		case IDC_MAIN_SCREENS:
			s_screensLinks->doModal();
			break;

		case IDC_MAIN_OPTIONS:
			s_globalOptions->doModal();
			break;

		case IDC_MAIN_ADVANCED:
			s_advancedOptions->doModal(isClientChecked(hwnd));
			break;
		}

	default:
		break;
	}
	return DefDlgProc(hwnd, message, wParam, lParam);
}
Exemple #20
0
void Britepad::loop() {

  pad.update();

  if (pad.touched(ANY_PAD)) {
    resetScreensaver();
  }

  if (!currApp) {
      console.debugln("No currapp!");
      launchApp(LauncherApp::ID);
  }

  if (pad.pressed(TOP_PAD)) {
    currApp->exit();
  } else if (currApp->isAppMode(SCREENSAVER_MODE) && (pad.pressed(SCREEN_PAD) || ((pad.pressed(ANY_PAD) && !currApp->canBeInteractive())))) {
    console.debugln("waking screensaver");
    // waking goes back to the mouse in the case that the user touched the screen (or any touch pad if it's not interactive)
    if (currApp->canBeMouse() && currApp->getEnabled(MOUSE_MODE) && usbActive()) {
      console.debugln("switching current app to MOUSE_MODE");
      currApp->switchAppMode(MOUSE_MODE);
    } else if (usbActive()) {
      console.debugln("launching A_MOUSE_APP");
      launchApp(BritepadApp::A_MOUSE_APP, MOUSE_MODE);
    } else {
      launchApp(LauncherApp::ID);
    }

  } else  {
   // check if somebody wants to be screensaver
   if (currApp->isAppMode(SCREENSAVER_MODE) &&
       !currApp->wantsToRun() &&
       wantsToRun()) {

      launchApp(BritepadApp::A_SCREENSAVER_APP, SCREENSAVER_MODE);

  // let's check to see if we should run a screensaver
  } else if (pad.time() > disableScreensaversUntil && !currApp->disablesScreensavers()) {

    if ( pad.pressed(PROXIMITY_SENSOR) &&
         currApp->isAppMode(SCREENSAVER_MODE) &&
         !currApp->displaysClock() &&
         getAppByID(ClockApp::ID))
    {
      launchApp(ClockApp::ID, SCREENSAVER_MODE);
      resetScreensaver(showClockDur);  // disable screensavers for a little while
      sound.click();
      console.debugln("Proximity detected: showing clock");

    } else if (currApp->isAppMode(SCREENSAVER_MODE) && getScreensaverSwitchInterval() && (pad.time() - screensaverStartedTime) > getScreensaverSwitchInterval()*1000) {
        launchApp(BritepadApp::A_SCREENSAVER_APP, SCREENSAVER_MODE);

      // is it time for the screensaver to kick in?
      } else if (!currApp->isAppMode(SCREENSAVER_MODE) && (pad.time() > disableScreensaversUntil)
        && !(currApp->canBeScreensaver() && currApp->isAppMode(MOUSE_MODE))) {
        launchApp(BritepadApp::A_SCREENSAVER_APP, SCREENSAVER_MODE);
      }
    }
  }

  setApp(getLaunchedApp(), getLaunchedAppMode());

  launchApp(BritepadApp::STAY_IN_APP);

  currApp->run();
  theFPSCommand.newFrame();

  idle();
}
Exemple #21
0
//PUBLIC
TrayUI::TrayUI() : QSystemTrayIcon(){
  qDebug() << "Starting Up System Updater Tray...";
  //Set all the initial flags ( <0 means do initial checks if appropriate)
  PKGSTATUS=-1;
  SYSSTATUS=-1;
  WARDENSTATUS=-1;
  noInternet = false; //assume internet is available until we get a failure
  wasworking = false;
  //Load the tray settings file
  settings = new QSettings("PCBSD");
    settings->sync(); //make sure to load it right away
  //Setup the checktimer
  chktime = new QTimer(this);
	chktime->setInterval(1000 * 60 * 60 * 24); //every 24 hours
	connect(chktime, SIGNAL(timeout()), this, SLOT(checkForUpdates()) );
  //Generate the Menu
  menu = new QMenu(0);
  this->setContextMenu(menu);
  connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(slotItemClicked(QAction*)) );
  //Now fill the menu with items
    // - System Update Manager
  QAction* act = new QAction( QIcon(":/images/sysupdater.png"), tr("Start the Update Manager"), this);
	act->setWhatsThis("sys"); //system updater code
	menu->addAction(act);
    // - Separator
  menu->addSeparator();
    // - AppCafe
  act = new QAction( QIcon(":/images/appcafe.png"), tr("Start the AppCafe"), this);
	act->setWhatsThis("pkg"); // PKG code
	menu->addAction(act);
    // - Warden
  act = new QAction( QIcon(":/images/warden.png"), tr("Start the Warden"), this);
	act->setWhatsThis("warden"); //warden code
	menu->addAction(act);
    // - Separator
  menu->addSeparator();
    // - Check for Updates
  act = new QAction( QIcon(":/images/view-refresh.png"), tr("Check For Updates"), this);
	act->setWhatsThis("update"); //update check code
	menu->addAction(act);
    // - Separator
  menu->addSeparator();
    // - Run At Startup Checkbox
  runAtStartup = new QCheckBox(tr("Run At Startup"), 0);
    runAtStartup->setChecked( settings->value("/PC-BSD/SystemUpdater/runAtStartup",true).toBool() );
    connect(runAtStartup, SIGNAL(clicked()), this, SLOT(slotRunAtStartupClicked()) );
  rasAct = new QWidgetAction(this);
    rasAct->setDefaultWidget(runAtStartup);
    menu->addAction(rasAct);
    // - Display Notifications Checkbox
  showNotifications = new QCheckBox(tr("Display Notifications"), 0);
    showNotifications->setChecked( settings->value("/PC-BSD/SystemUpdater/displayPopup",true).toBool() );
    connect(showNotifications, SIGNAL(clicked()), this, SLOT(slotShowMessagesClicked()) );
  snAct = new QWidgetAction(this);
    snAct->setDefaultWidget(showNotifications);
    menu->addAction(snAct);   

  makeScheduleMenu();
  menu->addAction(tr("Automatic updates check"))->setMenu(schedule_menu);

    // - Separator
  menu->addSeparator();
    // - Warden
  act = new QAction( tr("Quit"), this);
	act->setWhatsThis("quit"); //system updater code
	menu->addAction(act);

  //Now Update the tray visuals
  updateTrayIcon();
  updateToolTip();
  //Start up the system flag watcher and connect the signals/slots
  watcher = new SystemFlagWatcher(this);
	connect(watcher,SIGNAL(FlagChanged(SystemFlags::SYSFLAG, SystemFlags::SYSMESSAGE)),this,SLOT(watcherMessage(SystemFlags::SYSFLAG, SystemFlags::SYSMESSAGE)) );
  //watcher->checkForRecent(10); //Check for flags in the last 10 minutes
  
  //Now connect the tray clicked signal
  connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotTrayClicked(QSystemTrayIcon::ActivationReason)) );
  connect(this, SIGNAL(messageClicked()), this, SLOT(launchApp()) );
  
  //Startup the initial checks in 1 minute
  QTimer::singleShot(60000, this, SLOT(startupChecks()));

  //Periodically check timer start
  checkTimer=new QTimer(this);
  checkTimer->setInterval(60000); // 1min
  connect(checkTimer, SIGNAL(timeout()), this, SLOT(slotCheckTimer()));
  checkTimer->start();

}
Exemple #22
0
void Britepad::launchApp(appid_t id, AppMode mode) {
  launchApp(getAppByID(id), mode);
}
Exemple #23
0
/** Точка входа. */
int main(int argc, char *argv[])
{
	return launchApp(argc, argv);
}
void StartTimerApp::run() {
  if (theTimerApp.getTime() != getDuration() || theTimerApp.isReset()) {
    theTimerApp.setTime(getDuration());
  }
  launchApp(&theTimerApp);
};