Exemple #1
0
SetupPlugins::SetupPlugins(QWidget* parent)
    : QScrollArea(parent), d(new SetupPluginsPriv)
{
    QWidget* panel = new QWidget(viewport());
    setWidget(panel);
    setWidgetResizable(true);

    QVBoxLayout* layout = new QVBoxLayout(panel);
    d->pluginsNumber    = new QLabel(panel);

    if (KIPI::PluginLoader::instance())
    {
        d->kipiConfig = KIPI::PluginLoader::instance()->configWidget(panel);
        d->kipiConfig->setWhatsThis(i18n("A list of available Kipi plugins appears below."));
    }

    layout->addWidget(d->pluginsNumber);
    layout->addWidget(d->kipiConfig);
    layout->setMargin(KDialog::spacingHint());
    layout->setSpacing(KDialog::spacingHint());

    if (KIPI::PluginLoader::instance())
    {
        KIPI::PluginLoader::PluginList list = KIPI::PluginLoader::instance()->pluginList();
        initPlugins((int)list.count());
    }

    // --------------------------------------------------------

    setAutoFillBackground(false);
    viewport()->setAutoFillBackground(false);
    panel->setAutoFillBackground(false);
}
int configbuttonInit(CONFIGBUTTON *c) {
	c->icon = gtk_status_icon_new_from_stock(GTK_STOCK_PREFERENCES);

	g_signal_connect(G_OBJECT(c->icon), "activate", G_CALLBACK(configbuttonSpawnMenu), c);
	c->menu = NULL;
	initPlugins(c);

	return 0;
}
Exemple #3
0
void Doc::init()
{
  QString outputPlugin;
  _app->settings()->get("OutputPlugin", outputPlugin);

  initDMXChannels();
  initPlugins();

  readDeviceClasses();
}
Exemple #4
0
PluginData::PluginData(const Page* page)
{
    initPlugins(page);

    for (unsigned i = 0; i < m_plugins.size(); ++i) {
        const PluginInfo& plugin = m_plugins[i];
        for (unsigned j = 0; j < plugin.mimes.size(); ++j) {
            m_mimes.append(plugin.mimes[j]);
            m_mimePluginIndices.append(i);
        }
    }
}
Exemple #5
0
int main(int argc, char *argv[]) {  

    void *hdlarr[100];
    initPlugins(hdlarr);
    
    handleArgs(hdlarr, argc, argv);

    if (background) {
        createProccess(hdlarr);
    }
    else {
        keylogger(hdlarr);
    }
}
Exemple #6
0
/**
* @brief Initializes the subsystems needed by the application
*/
void Application::initSubSystems()
{
	// The class is now initialized (it is called now to avoid recursion lock if this function is called from
	// any of the subsystems initialized below).
	m_bIsValid = true;

	// Load user resource locations
	ResourceManager::getSingleton().loadUserResourceLocations();

	// Init plugins that require it at this point
	initPlugins( INIT_BEFORE_GRAPHICS );

	// Create app window (and init graphics engine)    
	GraphicsManager::getSingleton().createWindow( m_ogreView );

	// Init plugins that require it at this point
	initPlugins( INIT_BEFORE_RESOURCE_INIT );

	// Init graphics manager's resources
	GraphicsManager::getSingleton().initReSources();

	// Init plugins that require it at this point
	initPlugins( INIT_AFTER_GRAPHICS );

	// Init input manager
	InputManager::getSingleton().init();

	// Register the application as listener for mouse and keyboard
	InputManager::getSingleton().getMouse().addListener( this );
	InputManager::getSingleton().getKeyboard().addListener( this );

	// Init GUI Manager
	//GUIManagerCEGUI::getSingleton().init( GraphicsManager::getSingleton().getMainWindow().getOgreWindow(),&GraphicsManager::getSingleton().getSceneManager() );

	// Init plugins that require it at this point
	initPlugins( INIT_AFTER_SUBSYSTEMS );
}
void
CalamaresApplication::init()
{
    qDebug() << "CalamaresApplication thread:" << thread();

    //TODO: Icon loader
    Logger::setupLogfile();

    setQuitOnLastWindowClosed( false );

    initSettings();

    initBranding();

    setWindowIcon( QIcon( "from branding" ) );

    initPlugins();
}
void
CalamaresApplication::init()
{
    cDebug() << "CalamaresApplication thread:" << thread();

    //TODO: Icon loader
    Logger::setupLogfile();

    setQuitOnLastWindowClosed( false );

    initSettings();

    initBranding();

    setWindowIcon( QIcon( Calamares::Branding::instance()->
                          imagePath( Calamares::Branding::ProductIcon ) ) );

    initPlugins();
}
Exemple #9
0
Kolf::Kolf()
    : KMainWindow(0, "Kolf")
{
	competition = false;
	game = 0;
	editor = 0;
	spacer = 0;
	scoreboard = 0;
	isTutorial = false;

	initGUI();

	obj = new ObjectList;
	initPlugins();

	filename = QString::null;
	dummy = new QWidget(this);
	setCentralWidget(dummy);
	layout = new QGridLayout(dummy, 3, 1);

	resize(420, 480);
}
Exemple #10
0
void LiteApp::load(bool bUseSession)
{
    QSplashScreen *splash = 0;
    bool bSplash = m_settings->value(LITEAPP_SPLASHVISIBLE,true).toBool();
    if (bSplash) {
        splash = new QSplashScreen(QPixmap::fromImage(makeSplashImage(this)),Qt::WindowStaysOnTopHint);
    }
    if (bSplash) {
        splash->show();
    }

    if (bSplash) {
        splash->showMessage("liteide scan plugins ...",Qt::AlignLeft|Qt::AlignBottom);
    }

    qApp->processEvents();

    loadMimeType();
    loadPlugins();

    if (bSplash) {
        splash->showMessage("liteide load plugins ...",Qt::AlignLeft|Qt::AlignBottom);
    }

    qApp->processEvents();
    initPlugins();

    if (bSplash) {
        splash->showMessage("liteide load state ...",Qt::AlignLeft|Qt::AlignBottom);
    }

    qApp->processEvents();

    loadState();
    m_mainwindow->show();

    emit loaded();
    m_projectManager->setCurrentProject(0);

    if (bSplash) {
        splash->showMessage("liteide load session ...",Qt::AlignLeft|Qt::AlignBottom);
    }

    qApp->processEvents();

    appendLog("LiteApp","loaded");
    bool b = m_settings->value(LITEAPP_AUTOLOADLASTSESSION,true).toBool();
    if (b && bUseSession) {
        loadSession("default");
    }

    if (bSplash) {
        m_mainwindow->raise();
        splash->finish(m_mainwindow);
        splash->deleteLater();
    }

    this->appendLog("HtmlWidgetFactory",m_htmlWidgetManager->classNameList().join(" "));
    this->appendLog("DefaultHtmlWidgetFactory",m_htmlWidgetManager->defaultClassName());

    m_goProxy->call("version");
    m_goProxy->call("cmdlist");    
}
int main (int argc, char ** argv)
{
	printf ("STORAGE     TESTS\n");
	printf ("==================\n\n");

	init (argc, argv);

	initPlugins ();

	for (size_t plugin = 0; plugin < numPlugins; ++plugin)
	{
		const char * tmpFile = elektraFilename ();

		printf ("Testing plugin %s\n", pluginNames[plugin]);
		fprintf (stdout, "Tmp-file: %s\n", tmpFile);

		// KeySet API tests
		clearStorage (plugin, tmpFile);
		test_ksDupFun (plugin, tmpFile, ksDup);

		clearStorage (plugin, tmpFile);
		test_ksDupFun (plugin, tmpFile, ksDeepDup);

		clearStorage (plugin, tmpFile);
		test_ksCopy (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_ksGetSize (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_double_get (plugin, tmpFile); // regression test

		clearStorage (plugin, tmpFile);
		test_ksAppendKey (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_ksAppend (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_ksCut (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_ksPop (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_ksLookup (plugin, tmpFile, 0);

		clearStorage (plugin, tmpFile);
		test_ksLookup (plugin, tmpFile, KDB_O_POP);

		clearStorage (plugin, tmpFile);
		test_ksLookupByName (plugin, tmpFile, 0);

		clearStorage (plugin, tmpFile);
		test_ksLookupByName (plugin, tmpFile, KDB_O_POP);

		// Key API tests
		clearStorage (plugin, tmpFile);
		test_keyFlags (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_keyDup (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_keyCopy_newKey (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_keyCopy_clearOverwriteKey (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_keyDel (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_keyClear (plugin, tmpFile);

		// Key Name API tests
		clearStorage (plugin, tmpFile);
		test_keyName (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_keySetName (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_keyGetFullName (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_keyGetBaseName (plugin, tmpFile);

		// Key Value API tests
		clearStorage (plugin, tmpFile);
		test_keyValue (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_keyString (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_keyGetBinary (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_keyGetString (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_keySetBinary (plugin, tmpFile);

		clearStorage (plugin, tmpFile);
		test_keySetString (plugin, tmpFile);
	}

	printf ("\ntest_storage RESULTS: %d test(s) done. %d error(s).\n", nbTest, nbError);

	return nbError;
}
void Cordova::appLoaded() {
    initPlugins();
    for (QSharedPointer<CPlugin> &plugin: _plugins) {
        plugin->onAppLoaded();
    }
}
Exemple #13
0
//////////////////////////////////////////////////////////////////////
// Main initialization function                                     //
//                                                                  //
// This creates all items that are not saved in workspace files     //
//////////////////////////////////////////////////////////////////////
void App::init(QString openFile)
{
  //
  // Default size
  //
  resize(maximumSize());

  //
  // Settings has to be first
  //
  initSettings();

  //
  // Menus, toolbar, statusbar
  //
  initMenuBar();
  initStatusBar();
  initToolBar();

  //
  // The main view
  //
  initWorkspace();

  //
  // Plugins
  //
  initPlugins();

  //
  // Device classes
  //
  initDeviceClasses();

  //
  // Submasters & values
  //
  initSubmasters();
  initValues();

  //
  // Function consumer
  //
  initFunctionConsumer();

  //
  // Buses
  //
  Bus::init();

  //
  // Document
  //
  initDoc();

  //
  // Views
  //
  initDeviceManagerView();
  initVirtualConsole();


  // Trying to load workspace files
  // Either specified on command line or the last active workspace
  bool success = false;
  if (openFile != "")
    {
       success = doc()->loadWorkspaceAs(openFile);
       if (!success)
         {
            QString msg = "File: " + openFile + "\ncould'nt be opened. Please check path and spelling!\n";
	            msg += "We revert to the previously used workspace.";
	    QMessageBox::warning(this, KApplicationNameShort, msg,
			       QMessageBox::Ok, 0);
         }
    }
  //
  // Load the previous workspace
  //
  if (!success)
    {
      QString config;
      if (settings()->get(KEY_OPEN_LAST_WORKSPACE, config))
       {
         if (config == Settings::trueValue())
	  {
	    if (settings()->get(KEY_LAST_WORKSPACE_NAME, config))
	      {
	         success =  doc()->loadWorkspaceAs(config);
		 if (!success)
		   {
                      QString msg = "Previously used workspace file: " + config + "\ncould'nt be opened.";
	                      msg += "We start over with a new workspace.";
	              QMessageBox::warning(this, KApplicationNameShort, msg, QMessageBox::Ok, 0);
		   }
	      }
	  }
       }
    }
  if (!success)
    {
      newDocument();
    }
}
Exemple #14
0
int main(int argc, const char *argv[])
{
    poptContext optCon;   /* context for parsing command-line options */

    int rc, version = 0, debugMask = 0, pipeFD[2] = {-1, -1}, magic = FORKMAGIC;
    char *logdest = NULL, *configfile = "/etc/parastation.conf";
    FILE *logfile = NULL;

    struct poptOption optionsTable[] = {
	{ "debug", 'd', POPT_ARG_INT, &debugMask, 0,
	  "enable debugging with mask <mask>", "mask"},
	{ "configfile", 'f', POPT_ARG_STRING, &configfile, 0,
	  "use <file> as config-file (default is /etc/parastation.conf)",
	  "file"},
	{ "logfile", 'l', POPT_ARG_STRING, &logdest, 0,
	  "use <file> for logging (default is syslog(3))."
	  " <file> may be 'stderr' or 'stdout'", "file"},
	{ "version", 'v', POPT_ARG_NONE, &version, 0,
	  "output version information and exit", NULL},
	POPT_AUTOHELP
	{ NULL, '\0', 0, NULL, 0, NULL, NULL}
    };

    optCon = poptGetContext(NULL, argc, argv, optionsTable, 0);
    rc = poptGetNextOpt(optCon);

    /* Store arguments for later modification in forwarders, etc. */
    PSID_argc = argc;
    PSID_argv = argv;

    if (version) {
	printVersion();
	return 0;
    }

    if (logdest) {
	if (strcasecmp(logdest, "stderr")==0) {
	    logfile = stderr;
	} else if (strcasecmp(logdest, "stdout")==0) {
	    logfile = stdout;
	} else {
	    logfile = fopen(logdest, "a+");
	    if (!logfile) {
		char *errstr = strerror(errno);
		fprintf(stderr, "Cannot open logfile '%s': %s\n", logdest,
			errstr ? errstr : "UNKNOWN");
		exit(1);
	    }
	}
    }

    if (!logfile) {
	openlog("psid", LOG_PID|LOG_CONS, LOG_DAEMON);
    }
    PSID_initLogs(logfile);

    printWelcome();

    if (rc < -1) {
	/* an error occurred during option processing */
	poptPrintUsage(optCon, stderr, 0);
	PSID_log(-1, "%s: %s\n",
		 poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
		 poptStrerror(rc));
	if (!logfile)
	    fprintf(stderr, "%s: %s\n",
		    poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
		    poptStrerror(rc));

	return 1;
    }

    /* Save some space in order to modify the cmdline later on */
    PSC_saveTitleSpace(PSID_argc, PSID_argv, 1);

    if (logfile!=stderr && logfile!=stdout) {
	/* Daemonize only if neither stdout nor stderr is used for logging */
	if (pipe(pipeFD) < 0) {
	    PSID_exit(errno, "unable to create pipe");
	}

	/* Start as daemon */
	switch (fork()) {
	case -1:
	    PSID_exit(errno, "unable to fork server process");
	    break;
	case 0: /* I'm the child (and running further) */
	    close (pipeFD[0]);
	    break;
	default: /* I'm the parent and exiting */
	    close (pipeFD[1]);

	    /* Wait for child's magic data */
	    rc = read(pipeFD[0], &magic, sizeof(magic));
	    if (rc != sizeof(magic) || magic != (FORKMAGIC)) return -1;

	    return 0;
       }
    }

#define _PATH_TTY "/dev/tty"
    /* First disconnect from the old controlling tty. */
    {
	int fd = open(_PATH_TTY, O_RDWR | O_NOCTTY);
	if (fd >= 0) {
	    if (ioctl(fd, TIOCNOTTY, NULL)) {
		PSID_warn(-1, errno, "%s: ioctl(TIOCNOTTY)", __func__);
	    }
	    close(fd);
	}
    }


    /*
     * Disable stdin,stdout,stderr and install dummy replacement
     * Take care if stdout/stderr is used for logging
     */
    {
	int dummy_fd;

	dummy_fd=open("/dev/null", O_WRONLY , 0);
	dup2(dummy_fd, STDIN_FILENO);
	if (logfile!=stdout) dup2(dummy_fd, STDOUT_FILENO);
	if (logfile!=stderr) dup2(dummy_fd, STDERR_FILENO);
	close(dummy_fd);
    }

    /* Forget about inherited window sizes */
    unsetenv("LINES");
    unsetenv("COLUMNS");

    if (debugMask) {
	PSID_setDebugMask(debugMask);
	PSC_setDebugMask(debugMask);
	PSID_log(-1, "Debugging mode (mask 0x%x) enabled\n", debugMask);
    }

    /* Init the Selector facility as soon as possible */
    if (!Selector_isInitialized()) Selector_init(logfile);
    PSID_registerLoopAct(Selector_gc);

    /* Initialize timer facility explicitely to ensure correct logging */
    if (!Timer_isInitialized()) Timer_init(logfile);

    /*
     * Create the Local Service Port as early as possible. Actual
     * handling is enabled later. This gives psiadmin the chance to
     * connect. Additionally, this will guarantee exclusiveness
     */
    PSID_createMasterSock(PSmasterSocketName);

    PSID_checkMaxPID();

    /* read the config file */
    PSID_readConfigFile(logfile, configfile);
    /* Now we can rely on the config structure */

    {
	in_addr_t addr;

	PSID_log(-1, "My ID is %d\n", PSC_getMyID());

	addr = PSIDnodes_getAddr(PSC_getMyID());
	PSID_log(-1, "My IP is %s\n", inet_ntoa(*(struct in_addr *) &addr));
    }

    if (!logfile && PSID_config->logDest!=LOG_DAEMON) {
	PSID_log(-1, "Changing logging dest from LOG_DAEMON to %s\n",
		 PSID_config->logDest==LOG_KERN ? "LOG_KERN":
		 PSID_config->logDest==LOG_LOCAL0 ? "LOG_LOCAL0" :
		 PSID_config->logDest==LOG_LOCAL1 ? "LOG_LOCAL1" :
		 PSID_config->logDest==LOG_LOCAL2 ? "LOG_LOCAL2" :
		 PSID_config->logDest==LOG_LOCAL3 ? "LOG_LOCAL3" :
		 PSID_config->logDest==LOG_LOCAL4 ? "LOG_LOCAL4" :
		 PSID_config->logDest==LOG_LOCAL5 ? "LOG_LOCAL5" :
		 PSID_config->logDest==LOG_LOCAL6 ? "LOG_LOCAL6" :
		 PSID_config->logDest==LOG_LOCAL7 ? "LOG_LOCAL7" :
		 "UNKNOWN");
	closelog();

	openlog("psid", LOG_PID|LOG_CONS, PSID_config->logDest);
	printWelcome();
    }

    /* call startupScript, if any */
    if (PSID_config->startupScript && *PSID_config->startupScript) {
	int ret = PSID_execScript(PSID_config->startupScript, NULL, NULL, NULL);

	if (ret > 1) {
	    PSID_log(-1, "startup script '%s' failed. Exiting...\n",
		     PSID_config->startupScript);
	    PSID_finalizeLogs();
	    exit(1);
	}
    }

    /* Setup handling of signals */
    initSigHandlers();

    if (PSID_config->coreDir) {
	if (chdir(PSID_config->coreDir) < 0) {
	    PSID_warn(-1, errno, "Unable to chdir() to coreDirectory '%s'",
		      PSID_config->coreDir);
	}
    }

    PSIDnodes_setProtoV(PSC_getMyID(), PSProtocolVersion);
    PSIDnodes_setDmnProtoV(PSC_getMyID(), PSDaemonProtocolVersion);
    PSIDnodes_setHWStatus(PSC_getMyID(), 0);
    PSIDnodes_setKillDelay(PSC_getMyID(), PSID_config->killDelay);
    PSIDnodes_setAcctPollI(PSC_getMyID(), PSID_config->acctPollInterval);

    /* Bring node up with correct numbers of CPUs */
    declareNodeAlive(PSC_getMyID(), PSID_getPhysCPUs(), PSID_getVirtCPUs());

    /* Initialize timeouts, etc. */
    PSID_initStarttime();

    /* initialize various modules */
    PSIDcomm_init();  /* This has to be first since it gives msgHandler hash */

    PSIDclient_init();
    initState();
    initOptions();
    initStatus();
    initSignal();
    PSIDspawn_init();
    initPartition();
    initHW();
    initAccount();
    initInfo();
    initEnvironment();
    /* Plugins shall be last since they use most of the ones before */
    initPlugins();

    /* Now we start all the hardware -- this might include the accounter */
    PSID_log(PSID_LOG_HW, "%s: starting up the hardware\n", __func__);
    PSID_startAllHW();

    /*
     * Prepare hostlist to initialize RDP and MCast
     */
    {
	in_addr_t *hostlist;
	int i;

	hostlist = malloc(PSC_getNrOfNodes() * sizeof(unsigned int));
	if (!hostlist) {
	    PSID_exit(errno, "Failed to get memory for hostlist");
	}

	for (i=0; i<PSC_getNrOfNodes(); i++) {
	    hostlist[i] = PSIDnodes_getAddr(i);
	}

	if (PSID_config->useMCast) {
	    /* Initialize MCast */
	    int MCastSock = initMCast(PSC_getNrOfNodes(),
				      PSID_config->MCastGroup,
				      PSID_config->MCastPort,
				      logfile, hostlist,
				      PSC_getMyID(), MCastCallBack);
	    if (MCastSock<0) {
		PSID_exit(errno, "Error while trying initMCast");
	    }
	    setDeadLimitMCast(PSID_config->deadInterval);

	    PSID_log(-1, "MCast and ");
	} else {
	    setStatusTimeout(PSID_config->statusTimeout);
	    setMaxStatBCast(PSID_config->statusBroadcasts);
	    setDeadLimit(PSID_config->deadLimit);
	    setTmOutRDP(PSID_config->RDPTimeout);
	}

	/* Initialize RDP */
	RDPSocket = RDP_init(PSC_getNrOfNodes(),
			     PSIDnodes_getAddr(PSC_getMyID()),
			     PSID_config->RDPPort, logfile, hostlist,
			     PSIDRDP_handleMsg, RDPCallBack);
	if (RDPSocket<0) {
	    PSID_exit(errno, "Error while trying initRDP");
	}

	PSID_log(-1, "RDP (%d) initialized.\n", RDPSocket);

	free(hostlist);
    }

    /* Now start to listen for clients */
    PSID_enableMasterSock();

    /* Once RDP and the master socket are ready parents might be released */
    if (pipeFD[1] > -1) {
	if (write(pipeFD[1], &magic, sizeof(magic)) <= 0) {
	    /* We don't care */
	}
	close(pipeFD[1]);
    }

    PSID_log(-1, "SelectTime=%d sec    DeadInterval=%d\n",
	     PSID_config->selectTime, PSID_config->deadInterval);

    /* Trigger status stuff, if necessary */
    if (PSID_config->useMCast) {
	declareMaster(PSC_getMyID());
    } else {
	int id = 0;
	while (id < PSC_getMyID()
	       && (send_DAEMONCONNECT(id) < 0 && errno == EHOSTUNREACH)) {
	    id++;
	}
	if (id == PSC_getMyID()) declareMaster(id);
    }

    /*
     * Main loop
     */
    while (1) {
	int res = Swait(PSID_config->selectTime * 1000);

	if (res < 0) PSID_warn(-1, errno, "Error while Swait()");

	/* Handle actions registered to main-loop */
	PSID_handleLoopActions();
    }
}
Exemple #15
0
void Kolf::initGUI()
{
	newAction = KStdGameAction::gameNew(this, SLOT(newGame()), actionCollection());
	newAction->setText(newAction->text() + QString("..."));

	endAction = KStdGameAction::end(this, SLOT(closeGame()), actionCollection());
	printAction = KStdGameAction::print(this, SLOT(print()), actionCollection());

	(void) KStdGameAction::quit(this, SLOT(close()), actionCollection());
	saveAction = KStdAction::save(this, SLOT(save()), actionCollection(), "game_save");
	saveAction->setText(i18n("Save &Course"));
	saveAsAction = KStdAction::saveAs(this, SLOT(saveAs()), actionCollection(), "game_save_as");
	saveAsAction->setText(i18n("Save &Course As..."));

	saveGameAction = new KAction(i18n("&Save Game"), 0, this, SLOT(saveGame()), actionCollection(), "savegame");
	saveGameAsAction = new KAction(i18n("&Save Game As..."), 0, this, SLOT(saveGameAs()), actionCollection(), "savegameas");

	loadGameAction = KStdGameAction::load(this, SLOT(loadGame()), actionCollection());
	loadGameAction->setText(i18n("Load Saved Game..."));

	highScoreAction = KStdGameAction::highscores(this, SLOT(showHighScores()), actionCollection());

	editingAction = new KToggleAction(i18n("&Edit"), "pencil", CTRL+Key_E, this, SLOT(emptySlot()), actionCollection(), "editing");
	newHoleAction = new KAction(i18n("&New"), "filenew", CTRL+SHIFT+Key_N, this, SLOT(emptySlot()), actionCollection(), "newhole");
	clearHoleAction = new KAction(KStdGuiItem::clear().text(), "locationbar_erase", CTRL+Key_Delete, this, SLOT(emptySlot()), actionCollection(), "clearhole");
	resetHoleAction = new KAction(i18n("&Reset"), CTRL+Key_R, this, SLOT(emptySlot()), actionCollection(), "resethole");
	undoShotAction = KStdAction::undo(this, SLOT(emptySlot()), actionCollection(), "undoshot");
	undoShotAction->setText(i18n("&Undo Shot"));
	//replayShotAction = new KAction(i18n("&Replay Shot"), 0, this, SLOT(emptySlot()), actionCollection(), "replay");

	holeAction = new KListAction(i18n("Switch to Hole"), 0, this, SLOT(emptySlot()), actionCollection(), "switchhole");
	nextAction = new KAction(i18n("&Next Hole"), "forward", KStdAccel::shortcut(KStdAccel::Forward), this, SLOT(emptySlot()), actionCollection(), "nexthole");
	prevAction = new KAction(i18n("&Previous Hole"), "back", KStdAccel::shortcut(KStdAccel::Back), this, SLOT(emptySlot()), actionCollection(), "prevhole");
	firstAction = new KAction(i18n("&First Hole"), "gohome", KStdAccel::shortcut(KStdAccel::Home), this, SLOT(emptySlot()), actionCollection(), "firsthole");
	lastAction = new KAction(i18n("&Last Hole"), CTRL+SHIFT+Key_End, this, SLOT(emptySlot()), actionCollection(), "lasthole");
	randAction = new KAction(i18n("&Random Hole"), "goto", 0, this, SLOT(emptySlot()), actionCollection(), "randhole");

	useMouseAction = new KToggleAction(i18n("Enable &Mouse for Moving Putter"), 0, this, SLOT(emptySlot()), actionCollection(), "usemouse");
	useMouseAction->setCheckedState(i18n("Disable &Mouse for Moving Putter"));
	connect(useMouseAction, SIGNAL(toggled(bool)), this, SLOT(useMouseChanged(bool)));
	KConfig *config = kapp->config();
	config->setGroup("Settings");
	useMouseAction->setChecked(config->readBoolEntry("useMouse", true));

	useAdvancedPuttingAction = new KToggleAction(i18n("Enable &Advanced Putting"), 0, this, SLOT(emptySlot()), actionCollection(), "useadvancedputting");
	useAdvancedPuttingAction->setCheckedState(i18n("Disable &Advanced Putting"));
	connect(useAdvancedPuttingAction, SIGNAL(toggled(bool)), this, SLOT(useAdvancedPuttingChanged(bool)));
	useAdvancedPuttingAction->setChecked(config->readBoolEntry("useAdvancedPutting", false));

	showInfoAction = new KToggleAction(i18n("Show &Info"), "info", CTRL+Key_I, this, SLOT(emptySlot()), actionCollection(), "showinfo");
	showInfoAction->setCheckedState(i18n("Hide &Info"));
	connect(showInfoAction, SIGNAL(toggled(bool)), this, SLOT(showInfoChanged(bool)));
	showInfoAction->setChecked(config->readBoolEntry("showInfo", false));

	showGuideLineAction = new KToggleAction(i18n("Show Putter &Guideline"), 0, this, SLOT(emptySlot()), actionCollection(), "showguideline");
	showGuideLineAction->setCheckedState(i18n("Hide Putter &Guideline"));
	connect(showGuideLineAction, SIGNAL(toggled(bool)), this, SLOT(showGuideLineChanged(bool)));
	showGuideLineAction->setChecked(config->readBoolEntry("showGuideLine", true));

	KToggleAction *act=new KToggleAction(i18n("Enable All Dialog Boxes"), 0, this, SLOT(enableAllMessages()), actionCollection(), "enableAll");
	act->setCheckedState(i18n("Disable All Dialog Boxes"));

	soundAction = new KToggleAction(i18n("Play &Sounds"), 0, this, SLOT(emptySlot()), actionCollection(), "sound");
	connect(soundAction, SIGNAL(toggled(bool)), this, SLOT(soundChanged(bool)));
	soundAction->setChecked(config->readBoolEntry("sound", true));

	(void) new KAction(i18n("&Reload Plugins"), 0, this, SLOT(initPlugins()), actionCollection(), "reloadplugins");
	(void) new KAction(i18n("Show &Plugins"), 0, this, SLOT(showPlugins()), actionCollection(), "showplugins");

	aboutAction = new KAction(i18n("&About Course"), 0, this, SLOT(emptySlot()), actionCollection(), "aboutcourse");
	tutorialAction = new KAction(i18n("&Tutorial"), 0, this, SLOT(tutorial()), actionCollection(), "tutorial");

	statusBar();
	setupGUI();
}
Exemple #16
0
void LiteApp::load(bool bUseSession, IApplication *baseApp)
{
    QSplashScreen *splash = 0;
    bool bSplash = m_settings->value(LITEAPP_SPLASHVISIBLE,true).toBool();
    if (baseApp) {
        bSplash = false;
    }
    if (bSplash) {
        splash = new QSplashScreen(QPixmap::fromImage(makeSplashImage(this)),Qt::WindowStaysOnTopHint);
    }
    if (bSplash) {
        splash->show();
    }

    if (bSplash) {
        splash->showMessage("Scanning plugins...",Qt::AlignLeft|Qt::AlignBottom);
    }

    qApp->processEvents();

    loadMimeType();
    loadPlugins();

    if (bSplash) {
        splash->showMessage("Loading plugins...",Qt::AlignLeft|Qt::AlignBottom);
    }

    qApp->processEvents();
    initPlugins();

    if (bSplash) {
        splash->showMessage("Loading state...",Qt::AlignLeft|Qt::AlignBottom);
    }

    qApp->processEvents();
    loadState();
    if (baseApp) {
        if (baseApp->mainWindow()->isMaximized()) {
            m_mainwindow->resize(800,600);
            m_mainwindow->show();
        } else {
            QRect rc = baseApp->mainWindow()->geometry();
            rc.adjust(20,20,20,20);
            m_mainwindow->setGeometry(rc);
            m_mainwindow->show();
        }
    } else {
        m_mainwindow->show();
    }

    emit loaded();
    m_projectManager->setCurrentProject(0);

    if (bSplash) {
        splash->showMessage("Loading session...",Qt::AlignLeft|Qt::AlignBottom);
    }

    qApp->processEvents();

    bool b = m_settings->value(LITEAPP_AUTOLOADLASTSESSION,true).toBool();
    if (b && bUseSession) {
        loadSession("default");
    }

    if (bSplash) {
        m_mainwindow->raise();
        splash->finish(m_mainwindow);
        splash->deleteLater();
    }

    this->appendLog("HtmlWidgetFactory",m_htmlWidgetManager->classNameList().join(" "));
    this->appendLog("DefaultHtmlWidgetFactory",m_htmlWidgetManager->defaultClassName());

    m_goProxy->call("version");
	
    appendLog("LiteApp","Finished loading");
}
Exemple #17
0
int import_model(char *filename)
{
#ifdef USING_PYTHON
	Vector <char *> pyPluginDirectories;
	FreyjaFileReader reader;
	int ret = -1;
	FILE *f;
	//char *plugin = "/usr/local/lib/freyja/modules/model/python/import.py";
	char *plugin;
	PyObject *module, *dict, *tmp;
	unsigned long i;


	pyPluginDirectories.pushBack("/usr/lib/freyja/modules/model/python");
	pyPluginDirectories.pushBack("/usr/local/lib/freyja/modules/model/python");
#ifdef unix
	char rc[1024];
	char *env = getenv("HOME");

	if (env && env[0])
	{
		snprintf(rc, 1024, "%s/.freyja/plugins/python", env);
		pyPluginDirectories.pushBack(rc);
	}
#endif

	/* Check for python plugins! */
	for (i = pyPluginDirectories.begin(); i < pyPluginDirectories.end(); ++i)
	{
		if (!reader.openDirectory(pyPluginDirectories[i]))
		{
			freyjaPrintError("Couldn't access python plugin directory[%d].", i);
			continue;
		}

		while ((plugin = reader.getNextDirectoryListing()))
		{
			if (reader.isDirectory(plugin))
				continue;

			gPYTHON_PLUGIN_SUCCESS = -1;

			freyjaPrintMessage("[Module '%s' invoked.]", plugin);
			f = fopen(plugin, "r");

			if (!f)
			{
				freyjaPrintError("[Module '%s' failed to load.]", plugin);
				perror(plugin);
			}
			else
			{
				/* Start up python */
				Py_Initialize();
				module = initPlugins();
				dict = PyModule_GetDict(module);

				/* Append gobal constants */
				tmp = PyString_FromFormat(filename);
				PyDict_SetItemString(dict, "FreyjaImportFilename", tmp);
				Py_DECREF(tmp);

				freyjaPrintMessage("[Module '%s' opened.]", plugin);
				PyRun_SimpleFile(f, plugin);
				Py_Finalize();
			}

			ret = gPYTHON_PLUGIN_SUCCESS;
			//printf("%li\n", gPYTHON_PLUGIN_SUCCESS);

			if (ret == 0)
			{
				return 0;
			}
		}
	}
#endif

	return -1;
}
void Cordova::loadFinished(bool ok) {
    Q_UNUSED(ok)

    initPlugins();
}