Exemple #1
0
    DaemonApp::DaemonApp(int argc, char **argv) : QCoreApplication(argc, argv) {
        // log message
        qDebug() << " DAEMON: Initializing...";

        // create configuration
        m_configuration = new Configuration(CONFIG_FILE, this);

        // create power manager
        m_powerManager = new PowerManager(this);

        // create signal handler
        m_signalHandler = new SignalHandler(this);

        // initialize signal signalHandler
        SignalHandler::initialize();

        // quit when SIGHUP or SIGINT received
        connect(m_signalHandler, SIGNAL(sighupReceived()), this, SLOT(stop()));
        connect(m_signalHandler, SIGNAL(sigintReceived()), this, SLOT(stop()));

        // start the main loop
        QTimer::singleShot(1, this, SLOT(start()));

#if !TEST
        // add a display
        addDisplay(":0");
#else
        // add a display
        addDisplay(":1");
#endif
    }
/**
 * Adds the element to the configuration.
 *
 * @pre configCanHandle(element) == true
 * @post (display of same name already loaded) ==> old display closed, new one opened<br>
 *       (display is new) ==> (new display is added)<br>
 *       Draw Manager is notified of the display change.
 */
bool DisplayManager::configAddDisplay(jccl::ConfigElementPtr element)
{
   vprASSERT(configCanHandle(element)); // We must be able to handle it first of all

   vprDEBUG_BEGIN(vrjDBG_DISP_MGR,vprDBG_STATE_LVL) << "------- DisplayManager::configAddDisplay -------\n" << vprDEBUG_FLUSH;

   // Find out if we already have a window of this name
   // If so, then close it before we open a new one of the same name
   // This basically allows re-configuration of a window
   DisplayPtr cur_disp = findDisplayNamed(element->getName());
   if (cur_disp != NULL)                         // We have an old display
   {
      vprDEBUG(vrjDBG_DISP_MGR,vprDBG_CONFIG_LVL) << "Removing old window: " << cur_disp->getName().c_str() << vprDEBUG_FLUSH;
      closeDisplay(cur_disp,true);              // Close the display and notify the draw manager to close the window
   }

   // --- Add a display (of the correct type) ---- //
   if (element->getID() == std::string("display_window"))       // Display window
   {
      DisplayPtr newDisp = Display::create();      // Create the display
      newDisp->config(element);
      addDisplay(newDisp,true);                    // Add it
      vprDEBUG(vrjDBG_DISP_MGR,vprDBG_STATE_LVL) << "Adding display: " << newDisp->getName().c_str() << std::endl << vprDEBUG_FLUSH;
      vprDEBUG(vrjDBG_DISP_MGR,vprDBG_STATE_LVL) << "Display: "  << newDisp << std::endl << vprDEBUG_FLUSH;
   }

   vprDEBUG_END(vrjDBG_DISP_MGR,vprDBG_STATE_LVL) << "------- DisplayManager::configAddDisplay Done. --------\n" << vprDEBUG_FLUSH;
   return true;
}
Exemple #3
0
string ClsFEGroupPlot::addStateVariableDisplay(ClsFEGroup* _clsFEGroup, string /* strRange */) {
#ifdef DEBUG_CLSFEGROUPPLOT
    cout << "ClsFEGroupPlot::addStateVariableDisplay(ClsFEGroup* _clsFEGroup, string /* strRange */)" << endl;
#endif
    strGroupID = _clsFEGroup->getGroupID();
//    cout << "addStateVariableDisplay(..):strGroupID: " << strGroupID << endl;


    string strDisplayID = _clsFEGroup->getGroupID() + ClsIDGenerator::Instance()->Next();

    strTitle = "Space Plot for \"" + _clsFEGroup->getGroupName() + "\"";
    setCaption(strTitle.c_str());


    if(clsQBaseStateVariableDisplay!=NULL){
	boxlayoutBase->remove(clsQBaseStateVariableDisplay); 
    }

    clsQBaseStateVariableDisplay = 
	new ClsQNeuronStateVariableDisplay(this, strDisplayID, this, _clsFEGroup, "",false, false, true, false, false);

    connect(dynamic_cast<ClsQNeuronStateVariableDisplay*>(clsQBaseStateVariableDisplay), 
	    SIGNAL(addDisplay(string, list<string>, string )),
	    this, SLOT(addStateVariableDisplay(string, list<string>, string)));


    iGroupWidth = _clsFEGroup->getNrCellsHorizontal();
    iGroupHeight = _clsFEGroup->getNrCellsVertical();
    getCellIndices(_clsFEGroup);
    wSpacePlot->setSize(QSize(iGroupWidth,iGroupHeight));

    boxlayoutBase->addWidget(clsQBaseStateVariableDisplay, 0, 2, Qt::AlignTop); 
    return strDisplayID;
};
Exemple #4
0
int GLDisplay::addLayer(HyPerLayer * l)
{
   int status = addDisplay(l);
   if (status == 0) {
      status = l->insertProbe(this);
   }

   return status;
}
void MythScreenWizardCommandLineParser::LoadArguments(void)
{
    addHelp();
    addSettingsOverride();
    addVersion();
    addLogging();
    addMouse();
    addDisplay();
}
Display* VisualizationManager::createDisplay( const QString& class_lookup_name,
        const QString& name,
        bool enabled )
{
    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
    Display* new_display = root_display_group_->createDisplay( class_lookup_name );
    addDisplay( new_display, enabled );
    new_display->setName( name );
    QApplication::restoreOverrideCursor();
    return new_display;
}
Exemple #7
0
void CpuView::reparseConfig()
{
  CpuList cpus = createList();
  if (m_cpus != cpus) {
    if (m_timer->isActive())
      m_timer->stop();

    cleanup(m_cpus);
    m_cpus = cpus;
    addDisplay();
    m_timer->start(CPU_SPEED);
  }
}
void SoldierTk::runWalkAction()
{
	string bodyName = "";
	string headName = "";
	switch (m_direction)
	{
	case e_battle_dir_east :
		bodyName = "01_walk03";
		headName = "01_head05";
		break;
	case e_battle_dir_es :
		bodyName = "01_walk02";
		headName = "01_head07";
		break;
	case e_battle_dir_south :
		bodyName = "01_walk01";
		headName = "01_head10";
		break;
	case e_battle_dir_ws :
		bodyName = "01_walk04";
		headName = "01_head13";
		break;
	case e_battle_dir_west :
		bodyName = "01_walk01";
		headName = "01_head10";
		break;
	case e_battle_dir_wn :
		bodyName = "01_walk02";
		headName = "01_head07";
		break;
	case e_battle_dir_north :
		bodyName = "01_walk03";
		headName = "01_head05";
		break;
	case e_battle_dir_en :
		bodyName = "01_walk05";
		headName = "01_head01";
		break;
	default:
		break;
	}

	getBody()->getAnimation()->play(bodyName);
	auto head = getHead();
	auto bone = getBody()->getBone("head");
	bone->addDisplay(head,0);
	bone->changeDisplayWithIndex(0,true);
	head->getAnimation()->play(headName);
}
Exemple #9
0
string ClsFETimePlot::addStateVariableDisplay(ClsFEGroup* _clsFEGroup, string strRange) {
#ifdef DEBUG_CLSFETIMEPLOT
    cout << "ClsFETimePlot::addStateVariableDisplay(ClsFEGroup* _clsFEGroup, string strRange)" << endl;
#endif

    string strDisplayID = _clsFEGroup->getGroupID() + ClsIDGenerator::Instance()->Next();

    ClsQNeuronStateVariableDisplay * clsQNeuronStateVariableDisplay = new ClsQNeuronStateVariableDisplay(this, strDisplayID, qframeStateVariableDisplays, _clsFEGroup, strRange, true, false, false, true, true);
    connect(clsQNeuronStateVariableDisplay,SIGNAL(addDisplay(string, list<string>, string )),this, SLOT(addStateVariableDisplay(string, list<string>, string)));
    connect(clsQNeuronStateVariableDisplay,SIGNAL(sigClose(string)),this, SLOT(removeStateVariableDisplay(string)));

    pair<string, ClsQNeuronStateVariableDisplay*> pairTemp(strDisplayID, clsQNeuronStateVariableDisplay);
    mapStateVariableDisplays.insert(pairTemp);

    boxlayoutStateFrames->addWidget(clsQNeuronStateVariableDisplay);
    return strDisplayID;
};
void MythFrontendCommandLineParser::LoadArguments(void)
{
    addHelp();
    addVersion();
    addWindowed();
    addMouse();
    addSettingsOverride();
    addGeometry();
    addDisplay();
    addUPnP();
    addLogging();

    add(QStringList( QStringList() << "-r" << "--reset" ), "reset", false,
        "Resets appearance settings and language.", "");
    add(QStringList( QStringList() << "-p" << "--prompt" ), "prompt", false,
        "Always prompt for backend selection.", "");
    add(QStringList( QStringList() << "-d" << "--disable-autodiscovery" ),
        "noautodiscovery", false,
        "Prevent frontend from using UPnP autodiscovery.", "");

    add("--jumppoint", "jumppoint", "",
        "Start the frontend at specified jump point.", "")
            ->SetGroup("Startup Behavior");
    add("--runplugin", "runplugin", "",
        "Start the frontend within specified plugin.", "")
            ->SetGroup("Startup Behavior")
            ->SetBlocks("jumppoint");

    add(QStringList( QStringList() << "-G" << "--get-setting" ),
        "getsetting", "", "", "")
            ->SetRemoved("Use the Services API instead.", "0.25");
    add(QStringList( QStringList() << "-u" << "--upgrade-schema" ),
        "upgradeschema", "", "", "")
            ->SetRemoved("The frontend is no longer allowed to update\n"
               "          the primary database schema. Use mythtv-setup\n"
               "          or restart your primary backend to have it\n"
               "          perform the task automatically.", "0.25");
}
Exemple #11
0
CpuView::CpuView(KSim::PluginObject *parent, const char *name)
   : KSim::PluginView(parent, name)
{
#ifdef Q_OS_LINUX
  m_procStream = 0L;
  if ((m_procFile = fopen("/proc/stat", "r")))
    m_procStream = new TQTextStream(m_procFile, IO_ReadOnly);
#endif

  m_mainLayout = new TQVBoxLayout(this);
  TQSpacerItem *item = new TQSpacerItem(0, 0, TQSizePolicy::Expanding, TQSizePolicy::Expanding);
  m_mainLayout->addItem(item);
  
  m_firstTime = true;

  m_cpus = createList();
  addDisplay();

  m_timer = new TQTimer(this);
  connect(m_timer, TQT_SIGNAL(timeout()), TQT_SLOT(updateView()));
  m_timer->start(CPU_SPEED);
  updateView();
}
Exemple #12
0
EINTERN int
compiz_main(void)
{
   CompIOCtx ctx;
   char *displayName = 0;
   char *plugin[256];
   int i, nPlugin = 0;
   Bool disableSm = FALSE;
   char *clientId = NULL;
   char *refreshRateArg = NULL;

   ecore_app_args_get(&programArgc, &programArgv);
   programName = programArgv[0];

   emptyRegion.rects = &emptyRegion.extents;
   emptyRegion.numRects = 0;
   emptyRegion.extents.x1 = 0;
   emptyRegion.extents.y1 = 0;
   emptyRegion.extents.x2 = 0;
   emptyRegion.extents.y2 = 0;
   emptyRegion.size = 0;

   infiniteRegion.rects = &infiniteRegion.extents;
   infiniteRegion.numRects = 1;
   infiniteRegion.extents.x1 = MINSHORT;
   infiniteRegion.extents.y1 = MINSHORT;
   infiniteRegion.extents.x2 = MAXSHORT;
   infiniteRegion.extents.y2 = MAXSHORT;

   memset(&ctx, 0, sizeof (ctx));

   if (!clientId)
     {
        clientId = getenv("DESKTOP_AUTOSTART_ID");
     }

   if (refreshRateArg)
     {
        ctx.refreshRateData = malloc(strlen(refreshRateArg) + 256);
        if (ctx.refreshRateData)
          sprintf(ctx.refreshRateData,
                  "<min>1</min><default>%s</default>",
                  refreshRateArg);
     }

   plugin[nPlugin++] = "ccp";
   if (nPlugin)
     {
        int size = 256;

        for (i = 0; i < nPlugin; i++)
          size += strlen(plugin[i]) + 16;

        ctx.pluginData = malloc(size);
        if (ctx.pluginData)
          {
             char *ptr = ctx.pluginData;

             ptr += sprintf(ptr, "<type>string</type><default>");

             for (i = 0; i < nPlugin; i++)
               ptr += sprintf(ptr, "<value>%s</value>", plugin[i]);

             ptr += sprintf(ptr, "</default>");
          }

        initialPlugins = malloc(nPlugin * sizeof (char *));
        if (initialPlugins)
          {
             memcpy(initialPlugins, plugin, nPlugin * sizeof (char *));
             nInitialPlugins = nPlugin;
          }
        else
          {
             nInitialPlugins = 0;
          }
     }

   xmlInitParser();

   LIBXML_TEST_VERSION;

   if (!compInitMetadata(&coreMetadata))
     {
        compLogMessage("core", CompLogLevelFatal,
                       "Couldn't initialize core metadata");
        return 1;
     }

   if (!compAddMetadataFromIO(&coreMetadata,
                              readCoreXmlCallback, NULL,
                              &ctx))
     return 1;

   if (ctx.refreshRateData)
     free(ctx.refreshRateData);

   if (ctx.pluginData)
     free(ctx.pluginData);

   compAddMetadataFromFile(&coreMetadata, "core");

   if (!initCore())
     return 1;

   coreInitialized = TRUE;

   if (!addDisplay(displayName))
     return 1;
   return 0;
}
Exemple #13
0
void CiaoClass::addDisplay(char *label) {
  addDisplay(label, label);
}
Exemple #14
0
int GLDisplay::setImage(Image * image)
{
   this->image = image;
   return addDisplay(image);
}
Exemple #15
0
int
main (int argc, char **argv)
{
    CompIOCtx ctx;
    char      *displayName = 0;
    char      *plugin[256];
    int	      i, nPlugin = 0;
    Bool      disableSm = FALSE;
    char      *clientId = NULL;
    char      *refreshRateArg = NULL;

    programName = argv[0];
    programArgc = argc;
    programArgv = argv;

    signal (SIGHUP, signalHandler);
    signal (SIGCHLD, signalHandler);
    signal (SIGINT, signalHandler);
    signal (SIGTERM, signalHandler);
    signal (SIGSEGV, signalHandler);

    emptyRegion.rects = &emptyRegion.extents;
    emptyRegion.numRects = 0;
    emptyRegion.extents.x1 = 0;
    emptyRegion.extents.y1 = 0;
    emptyRegion.extents.x2 = 0;
    emptyRegion.extents.y2 = 0;
    emptyRegion.size = 0;

    infiniteRegion.rects = &infiniteRegion.extents;
    infiniteRegion.numRects = 1;
    infiniteRegion.extents.x1 = MINSHORT;
    infiniteRegion.extents.y1 = MINSHORT;
    infiniteRegion.extents.x2 = MAXSHORT;
    infiniteRegion.extents.y2 = MAXSHORT;

    memset (&ctx, 0, sizeof (ctx));

    for (i = 1; i < argc; i++)
    {
	if (!strcmp (argv[i], "--help"))
	{
	    usage ();
	    return 0;
	}
	else if (!strcmp (argv[i], "--version"))
	{
	    printf (PACKAGE_STRING "\n");
	    return 0;
	}
	else if (!strcmp (argv[i], "--debug"))
	{
	    debugOutput = TRUE;
	}
	else if (!strcmp (argv[i], "--display"))
	{
	    if (i + 1 < argc)
		displayName = argv[++i];
	}
	else if (!strcmp (argv[i], "--refresh-rate"))
	{
	    if (i + 1 < argc)
	    {
		refreshRateArg = programArgv[++i];
		defaultRefreshRate = atoi (refreshRateArg);
		defaultRefreshRate = RESTRICT_VALUE (defaultRefreshRate,
						     1, 1000);
	    }
	}
	else if (!strcmp (argv[i], "--fast-filter"))
	{
	    ctx.textureFilterData = "<default>Fast</default>";
	    defaultTextureFilter = "Fast";
	}
	else if (!strcmp (argv[i], "--indirect-rendering"))
	{
	    /* force Mesa libGL into indirect rendering mode, because
	       glXQueryExtensionsString is context-independant */
	    setenv ("LIBGL_ALWAYS_INDIRECT", "1", True);
	    indirectRendering = TRUE;
	}
	else if (!strcmp (argv[i], "--loose-binding"))
	{
	    strictBinding = FALSE;
	}
	else if (!strcmp (argv[i], "--ignore-desktop-hints"))
	{
	    /* keep command line parameter for backward compatibility */
	    useDesktopHints = FALSE;
	}
	else if (!strcmp (argv[i], "--keep-desktop-hints"))
	{
	    useDesktopHints = TRUE;
	}
	else if (!strcmp (argv[i], "--only-current-screen"))
	{
	    onlyCurrentScreen = TRUE;
	}
	else if (!strcmp (argv[i], "--no-fbo"))
	{
		noFBO = TRUE;
	}

#ifdef USE_COW
	else if (!strcmp (argv[i], "--use-root-window"))
	{
	    useCow = FALSE;
	}
#endif

	else if (!strcmp (argv[i], "--replace"))
	{
	    replaceCurrentWm = TRUE;
	}
	else if (!strcmp (argv[i], "--sm-disable"))
	{
	    disableSm = TRUE;
	}
	else if (!strcmp (argv[i], "--sm-client-id"))
	{
	    if (i + 1 < argc)
		clientId = argv[++i];
	}
	else if (!strcmp (argv[i], "--no-detection"))
	{
	    noDetection = TRUE;
	}
	else if (!strcmp (argv[i], "--bg-image"))
	{
	    if (i + 1 < argc)
		backgroundImage = argv[++i];
	}
	else if (*argv[i] == '-')
	{
	    compLogMessage ("core", CompLogLevelWarn,
			    "Unknown option '%s'\n", argv[i]);
	}
	else
	{
	    if (nPlugin < 256)
		plugin[nPlugin++] = argv[i];
	}
    }

    /* add in default plugins if none are given */
    if (nPlugin == 0)
    {
        plugin[nPlugin++] = "ccp";
        plugin[nPlugin++] = "move";
        plugin[nPlugin++] = "resize";
        plugin[nPlugin++] = "place";
        plugin[nPlugin++] = "decoration";
    }

    if (refreshRateArg)
    {
	ctx.refreshRateData = malloc (strlen (refreshRateArg) + 256);
	if (ctx.refreshRateData)
	    sprintf (ctx.refreshRateData,
		     "<min>1</min><default>%s</default>",
		     refreshRateArg);
    }

    if (nPlugin)
    {
	int size = 256;

	for (i = 0; i < nPlugin; i++)
	    size += strlen (plugin[i]) + 16;

	ctx.pluginData = malloc (size);
	if (ctx.pluginData)
	{
	    char *ptr = ctx.pluginData;

	    ptr += sprintf (ptr, "<type>string</type><default>");

	    for (i = 0; i < nPlugin; i++)
		ptr += sprintf (ptr, "<value>%s</value>", plugin[i]);

	    ptr += sprintf (ptr, "</default>");
	}

	initialPlugins = malloc (nPlugin * sizeof (char *));
	if (initialPlugins)
	{
	    memcpy (initialPlugins, plugin, nPlugin * sizeof (char *));
	    nInitialPlugins = nPlugin;
	}
	else
	{
	    nInitialPlugins = 0;
	}
    }

    xmlInitParser ();

    LIBXML_TEST_VERSION;

    if (!compInitMetadata (&coreMetadata))
    {
	compLogMessage ("core", CompLogLevelFatal,
			"Couldn't initialize core metadata");
	return 1;
    }

    if (!compAddMetadataFromIO (&coreMetadata,
				readCoreXmlCallback, NULL,
				&ctx))
	return 1;

    if (ctx.refreshRateData)
	free (ctx.refreshRateData);

    if (ctx.pluginData)
	free (ctx.pluginData);

    compAddMetadataFromFile (&coreMetadata, "core");

    if (!initCore ())
	return 1;

    coreInitialized = TRUE;

    if (!disableSm)
    {
	if (clientId == NULL)
	{
	    char *desktop_autostart_id = getenv ("DESKTOP_AUTOSTART_ID");
	    if (desktop_autostart_id != NULL)
		clientId = strdup (desktop_autostart_id);
	    unsetenv ("DESKTOP_AUTOSTART_ID");
	}

	initSession (clientId);
    }

    if (!addDisplay (displayName))
	return 1;

    eventLoop ();

    if (!disableSm)
	closeSession ();

    coreInitialized = FALSE;

    finiCore ();
    compFiniMetadata (&coreMetadata);

    xmlCleanupParser ();

    if (initialPlugins)
        free (initialPlugins);

    if (restartSignal)
    {
	execvp (programName, programArgv);
	return 1;
    }

    return 0;
}