Пример #1
0
QString CallInstruction::toString() const
{
    return QString("%1: %2.%3(...)")
            .arg(instructionId())
            .arg(instanceName())
            .arg(methodName());
}
Пример #2
0
/**
 * Reimplemented from UMLWidget::updateTextItemGroups() to
 * calculate the texts and also show/hide the texts based on current
 * state.
 */
void NodeWidget::updateTextItemGroups()
{
    TextItemGroup *grp = textItemGroupAt(GroupIndex);
    grp->setTextItemCount(NodeWidget::TextItemCount);

    if(umlObject()) {
        UMLNode *node = static_cast<UMLNode*>(umlObject());

        TextItem *stereo = grp->textItemAt(NodeWidget::StereoItemIndex);
        stereo->setText(node->stereotype(true));
        stereo->setBold(true);
        stereo->setExplicitVisibility(!node->stereotype(false).isEmpty());

        TextItem *nameItem = grp->textItemAt(NodeWidget::NameItemIndex);
        QString nameText = name();
        bool underline = false;
        if(isInstance()) {
            nameText.prepend(':');
            nameText.prepend(instanceName());
            underline = true;
        }
        nameItem->setBold(true);
        nameItem->setUnderline(underline);
        nameItem->setText(nameText);
    }

    UMLWidget::updateTextItemGroups();
}
Пример #3
0
bool os_gal2other::construct(const Config &cfg, otable &t, opipeline &pipe)
{
	//if(!cfg.count("FeH")) { THROW(EAny, "Keyword 'filename' must exist in config file"); }
	std::string cs, msg;
	cfg.get(cs, "coordsys", "gal");
	     if(cs == "gal") { coordsys = GAL; /* -- noop -- */; msg = "Galactic coordinates in column lb"; }
	else if(cs == "equ") { coordsys = EQU; prov.insert("radec[2]"); msg = "Equatorial coordinates in column radec"; }
	else { THROW(EAny, "Unknown coordinate system (" + cs + ") requested."); }

	MLOG(verb1) << "Astrometry: " << msg << "   ## " << instanceName();

	return true;
}
Пример #4
0
void I8KPlugin::showAbout()
{
  QString version = kapp->aboutData()->version();

  KAboutData aboutData(instanceName(),
     I18N_NOOP("KSim I8K Plugin"), version.latin1(),
     I18N_NOOP("Dell I8K Hardware Monitor plugin"),
     KAboutData::License_GPL, "(C) 2003 Nadeem Hasan");

  aboutData.addAuthor("Nadeem Hasan", I18N_NOOP("Author"),
     "*****@*****.**");

  KAboutApplication(&aboutData).exec();
}
Пример #5
0
void CpuPlugin::showAbout()
{
  TQString version = kapp->aboutData()->version();

  TDEAboutData aboutData(instanceName(),
     I18N_NOOP("KSim CPU Plugin"), version.latin1(),
     I18N_NOOP("A cpu monitor plugin for KSim"),
     TDEAboutData::License_GPL, "(C) 2001 Robbie Ward");

  aboutData.addAuthor("Robbie Ward", I18N_NOOP("Author"),
     "*****@*****.**");

  TDEAboutApplication(&aboutData).exec();
}
Пример #6
0
void PluginModule::showAbout()
{
  QString version = kapp->aboutData()->version();

  KAboutData aboutData(instanceName(),
     I18N_NOOP("KSim FileSystem Plugin"), version.latin1(),
     I18N_NOOP("A filesystem plugin for KSim"),
     KAboutData::License_GPL, "(C) 2001 Robbie Ward");

  aboutData.addAuthor("Robbie Ward", I18N_NOOP("Author"),
     "*****@*****.**");
  aboutData.addAuthor("Jason Katz-Brown", I18N_NOOP("Some Fixes"),
     "*****@*****.**");
  aboutData.addAuthor("Heitham Omar", I18N_NOOP("FreeBSD ports"),
     "*****@*****.**");

  KAboutApplication(&aboutData).exec();
}
void ComputerSystemProvider::enumerateInstances(
    const OperationContext& context,
    const CIMObjectPath& ref,
    const Boolean includeQualifiers,
    const Boolean includeClassOrigin,
    const CIMPropertyList& propertyList,
    InstanceResponseHandler& handler)
{
    CIMName className = ref.getClassName();
    _checkClass(className);

    handler.processing();

    // Deliver instance only if request was for leaf class
    if (className.equal (CLASS_EXTENDED_COMPUTER_SYSTEM))
    {
        Array<CIMKeyBinding> keys;
        keys.append(CIMKeyBinding(
            PROPERTY_CREATION_CLASS_NAME,
            CLASS_EXTENDED_COMPUTER_SYSTEM,
            CIMKeyBinding::STRING));
        keys.append(CIMKeyBinding(
            PROPERTY_NAME,
            _cs.getHostName(),
            CIMKeyBinding::STRING));
        CIMObjectPath instanceName(
            String::EMPTY,       // Hostname not required
            CIMNamespaceName(),  // Namespace not required
            CLASS_EXTENDED_COMPUTER_SYSTEM,
            keys);
        CIMInstance instance =
            _cs.buildInstance(CLASS_EXTENDED_COMPUTER_SYSTEM);
        instance.setPath(instanceName);
        handler.deliver(instance);
    }

    handler.complete();
    return;
}
Пример #8
0
bool os_GaussianFeH::construct(const Config &cfg, otable &t, opipeline &pipe)
{
	read_component_map(applyToComponents, cfg);

	mean  = cfg.get("mean");
	sigma = cfg.get("sigma");

	// Output model parameters
	MLOG(verb1) << "Metallicity: Gaussian for components " << applyToComponents << "   ## " << instanceName();
	MLOG(verb2) << "           : (mu, sigma) = " << mean      << ", " << sigma;

	return true;
}
Пример #9
0
I8KPlugin::I8KPlugin(const char *name)
   : KSim::PluginObject(name)
{
  setConfigFileName(instanceName());
}
void GraphComponent::nodePopupMenuSelected (GraphNodeComponent* node)
{
    DBG ("GraphComponent::nodePopupMenuSelected");

    jassert (node != 0);

    currentClickedNode = node;

    bool addFirstSeparator = false;
    PopupMenu menu, subMenu, synthMidiChanMenu, midiChanMenu;

    BasePlugin* plugin = (BasePlugin*) node->getUserData ();

    if (plugin->hasEditor ()
        || plugin->wantsEditor ()
        || plugin->isEditorInternal ())
    {
        menu.addItem (1, "Open editor");
        menu.addItem (2, "Prefer MIDI binding editor", true, plugin->getBoolValue(PROP_WINDOWPREFERGENERIC, false));
        addFirstSeparator = true;
    }

    if (node != inputs && node != outputs)
    {
        menu.addItem (3, "Remove " + plugin->getName() + String(" \"") + plugin->getInstanceName() + String("\""));
        addFirstSeparator = true;
    }

    if (addFirstSeparator)
        menu.addSeparator ();

    menu.addItem (4, "Lock", true, node->isLocked ());

    // node colour..
    ColourSelector colourSelector;
    colourSelector.setName (T("background"));
    colourSelector.setCurrentColour (node->getNodeColour ());
    colourSelector.addChangeListener (this);

    subMenu.addCustomItem (1234, &colourSelector, 300, 300, false);
    menu.addSubMenu (T("Colour"), subMenu);
    menu.addSeparator ();

    menu.addItem (5, "Mute", true, plugin->isMuted ());
    menu.addItem (6, "Bypass", true, plugin->isBypass ());
    menu.addItem (7, "Solo", false, false);
    menu.addSeparator ();

   synthMidiChanMenu.addItem(2020, "Omni", true, !plugin->getSynthInputChannelFilter() || plugin->getSynthInputChannel() == -1);
   midiChanMenu.addItem(1020, "Omni", true, !plugin->getMidiOutputChannelFilter() || plugin->getMidiOutputChannel() == -1);
   for (int i=1; i<17; i++)
   {
      synthMidiChanMenu.addItem(2000+i, String("Ch ") + String(i), true, plugin->getSynthInputChannelFilter() && plugin->getSynthInputChannel() == i);
      midiChanMenu.addItem(1000+i, String("Ch ") + String(i), true, plugin->getMidiOutputChannelFilter() && plugin->getMidiOutputChannel() == i);
   }
   menu.addSubMenu (T("Filter synth input MIDI channel"), synthMidiChanMenu);
   menu.addSubMenu (T("Filter output MIDI channel"), midiChanMenu);
   menu.addSeparator ();

    int inputLinks = node->getInputLinksCount ();
    int outputLinks = node->getOutputLinksCount ();

    if (inputLinks > 0 && outputLinks > 0)
        menu.addItem (8, "Disconnect all");
    if (inputLinks > 0)
        menu.addItem (9, "Disconnect inputs");
    if (outputLinks > 0)
        menu.addItem (10, "Disconnect outputs");

   menu.addItem (11, String("Rename \"") + plugin->getInstanceName() + String("\""));
   menu.addItem (12, "Render stem", true, plugin->getBoolValue(PROP_RENDERSTEM, false)); // only allow changing this if stems aren't rendering right now (i.e. files aren't opened)
   
    const int result = menu.show();
    switch (result)
    {
    case 1: // Open editor
        {
            owner->openPluginEditorWindow (plugin);
            break;
        }
    case 2: // set preferred editor
      plugin->setValue(PROP_WINDOWPREFERGENERIC, !plugin->getBoolValue(PROP_WINDOWPREFERGENERIC, false));
      break;
    case 12: // set stem render option
      plugin->setValue(PROP_RENDERSTEM, !plugin->getBoolValue(PROP_RENDERSTEM, false));
      break;
    case 3: // Close
        {
            if (owner->isPluginEditorWindowOpen (plugin))
                owner->closePluginEditorWindow (plugin);

            if (plugin)
            {
                host->closePlugin (plugin);

                selectedNodes.deselect (node);
                deletePluginNode (node);

                graphChanged ();
            }

            break;
        }
    case 4: // Lock / unlock
        {
            bool lockedState = ! node->isLocked ();

            if (plugin)
                plugin->setValue (PROP_GRAPHLOCKED, lockedState);

            node->setLocked (lockedState);
            node->repaint ();
        }
        break;
    case 5: // Mute
        {
            if (plugin)
                plugin->setMuted (! plugin->isMuted());
        }
        break;
    case 6: // Bypass
        {
            if (plugin)
                plugin->setBypass (! plugin->isBypass());
        }
        break;
    case 7: // Solo (TODO)
        break;
    case 8: // Disconnect all
        node->breakAllLinks();
        break;
    case 9: // Disconnect inputs
        node->breakInputLinks();
        break;
    case 10: // Disconnect outputs
        node->breakOutputLinks();
        break;
    case 11: // Rename instance
    {
      TextEditor instanceName(String("renamePluginInstance"));
      instanceName.setSize(400, 30);
      instanceName.setText(plugin->getInstanceName());
      DialogWindow::showModalDialog(String("Rename " + plugin->getInstanceName()), &instanceName, node, Colours::yellow, true);
      String newName = instanceName.getText();
      if (newName.isNotEmpty())
         setNodeDisplayName(plugin, node, newName);
    }
      break;
   case 1020:
      plugin->clearMidiOutputFilter();
      break;
   case 2020:
      plugin->clearSynthInputFilter();
      break;
    default:
      if (result >= 1001 && result <= 1016)
         plugin->setMidiOutputChannelFilter(result - 1000);
      if (result >= 2001 && result <= 2016)
         plugin->setSynthInputChannelFilter(result - 2000);
      break;
    }
    
    currentClickedNode = 0;
}
Пример #11
0
bool KoApplication::start()
{
    ResetStarting resetStarting; // reset m_starting to false when we're done
    Q_UNUSED( resetStarting );

    // Find the *.desktop file corresponding to the kapp instance name
    KoDocumentEntry entry = KoDocumentEntry( KoDocument::readNativeService() );
    if ( entry.isEmpty() )
    {
        kdError( 30003 ) << instanceName() << "part.desktop not found." << endl;
        kdError( 30003 ) << "Run 'kde-config --path services' to see which directories were searched, assuming kde startup had the same environment as your current shell." << endl;
        kdError( 30003 ) << "Check your installation (did you install KOffice in a different prefix than KDE, without adding the prefix to /etc/kderc ?)" << endl;
        return false;
    }

    // Get the command line arguments which we have to parse
    KCmdLineArgs *args= KCmdLineArgs::parsedArgs();
    int argsCount = args->count();

    KCmdLineArgs *koargs = KCmdLineArgs::parsedArgs("koffice");
    QCString dpiValues = koargs->getOption( "dpi" );
    if ( !dpiValues.isEmpty() ) {
        int sep = dpiValues.find( QRegExp( "[x, ]" ) );
        int dpiX;
        int dpiY = 0;
        bool ok = true;
        if ( sep != -1 ) {
            dpiY = dpiValues.mid( sep+1 ).toInt( &ok );
            dpiValues.truncate( sep );
        }
        if ( ok ) {
            dpiX = dpiValues.toInt( &ok );
            if ( ok ) {
                if ( !dpiY ) dpiY = dpiX;
                KoGlobal::setDPI( dpiX, dpiY );
            }
        }
    }

    // No argument -> create an empty document
    if ( !argsCount ) {
        KoDocument* doc = entry.createDoc( 0, "Document" );
        if ( !doc )
            return false;
        KoMainWindow *shell = new KoMainWindow( doc->instance() );
        shell->show();
        QObject::connect(doc, SIGNAL(sigProgress(int)), shell, SLOT(slotProgress(int)));
        // for initDoc to fill in the recent docs list
        // and for KoDocument::slotStarted
        doc->addShell( shell );

        if ( doc->checkAutoSaveFile() ) {
          shell->setRootDocument( doc );
        } else {
          doc->showStartUpWidget( shell );
        }

        // FIXME This needs to be moved someplace else
	QObject::disconnect(doc, SIGNAL(sigProgress(int)), shell, SLOT(slotProgress(int)));
    } else {
        bool print = koargs->isSet("print");
	bool doTemplate = koargs->isSet("template");
        koargs->clear();

        // Loop through arguments

        short int n=0; // number of documents open
        short int nPrinted = 0;
        for(int i=0; i < argsCount; i++ )
        {
            // For now create an empty document
            KoDocument* doc = entry.createDoc( 0 );
            if ( doc )
            {
                // show a shell asap
                KoMainWindow *shell = new KoMainWindow( doc->instance() );
                if (!print)
                    shell->show();
		// are we just trying to open a template?
		if ( doTemplate ) {
		  QStringList paths;
		  if ( args->url(i).isLocalFile() && QFile::exists(args->url(i).path()) )
		  {
		    paths << QString(args->url(i).path());
		    kdDebug(30003) << "using full path..." << endl;
		  } else {
		     QString desktopName(args->arg(i));
		     QString appName = KGlobal::instance()->instanceName();

		     paths = KGlobal::dirs()->findAllResources("data", appName +"/templates/*/" + desktopName );
		     if ( paths.isEmpty()) {
			   paths = KGlobal::dirs()->findAllResources("data", appName +"/templates/" + desktopName );
	             }
		     if ( paths.isEmpty()) {
		        KMessageBox::error(0L, i18n("No template found for: %1 ").arg(desktopName) );
		        delete shell;
		     } else if ( paths.count() > 1 ) {
		        KMessageBox::error(0L,  i18n("Too many templates found for: %1").arg(desktopName) );
		        delete shell;
		     }
		  }

                  if ( !paths.isEmpty() ) {
		     KURL templateBase;
		     templateBase.setPath(paths[0]);
		     KDesktopFile templateInfo(paths[0]);

		     QString templateName = templateInfo.readURL();
		     KURL templateURL;
		     templateURL.setPath( templateBase.directory() + "/" + templateName );
		     if ( shell->openDocument(doc, templateURL )) {
		       doc->resetURL();
		       doc->setEmpty();
                       doc->setTitleModified();
		       kdDebug(30003) << "Template loaded..." << endl;
		       n++;
		     } else {
		        KMessageBox::error(0L, i18n("Template %1 failed to load.").arg(templateURL.prettyURL()) );
 		        delete shell;
		     }
		  }
                // now try to load
                } else if ( shell->openDocument( doc, args->url(i) ) ) {
                    if ( print ) {
                        shell->print(false /*we want to get the dialog*/);
                        // delete shell; done by ~KoDocument
                        nPrinted++;
		    } else {
                        // Normal case, success
                        n++;
                    }
                } else {
                    // .... if failed
                    // delete doc; done by openDocument
                    // delete shell; done by ~KoDocument
                }
            }
        }
        if ( print )
            return nPrinted > 0;
        if (n == 0) // no doc, e.g. all URLs were malformed
            return false;
    }

    args->clear();
    // not calling this before since the program will quit there.
    return true;
}
Пример #12
0
void ConfigSettingProvider::enumerateInstances(
    const OperationContext & context,
    const CIMObjectPath & ref,
    const Boolean includeQualifiers,
    const Boolean includeClassOrigin,
    const CIMPropertyList& propertyList,
    InstanceResponseHandler & handler)
    {
        PEG_METHOD_ENTER(TRC_CONFIG,
                         "ConfigSettingProvider::enumerateInstances()");

        Array<CIMInstance> instanceArray;
        Array<String> propertyNames;

        //
        // check if the class name requested is PG_ConfigSetting
        //
        if (!ref.getClassName().equal (PG_CONFIG_SETTING))
        {
            PEG_METHOD_EXIT();
            throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
                                        ref.getClassName().getString());
        }

        // begin processing the request
        handler.processing();

        try
        {
            _configManager->getAllPropertyNames(propertyNames, false);


            for (Uint32 i = 0; i < propertyNames.size(); i++)
            {
                Array<String> propertyInfo;

                CIMInstance        instance(PG_CONFIG_SETTING);

                propertyInfo.clear();

                _configManager->getPropertyInfo(
                propertyNames[i], propertyInfo);

                Array<CIMKeyBinding> keyBindings;
                keyBindings.append(CIMKeyBinding(PROPERTY_NAME,
                    propertyInfo[0], CIMKeyBinding::STRING));
                CIMObjectPath instanceName(ref.getHost(),
                    ref.getNameSpace(),
                PG_CONFIG_SETTING, keyBindings);

                // construct the instance
                instance.addProperty(CIMProperty(PROPERTY_NAME,
                                     propertyInfo[0]));
                instance.addProperty(CIMProperty(DEFAULT_VALUE,
                                     propertyInfo[1]));
                instance.addProperty(CIMProperty(CURRENT_VALUE,
                                     propertyInfo[2]));
                instance.addProperty(CIMProperty(PLANNED_VALUE,
                                     propertyInfo[3]));
                instance.addProperty(CIMProperty(DYNAMIC_PROPERTY,
                   Boolean(propertyInfo[4]=="true"?true:false)));
                if (propertyInfo.size() > 6)
                {
                    instance.addProperty(
                        CIMProperty(DESCRIPTION, propertyInfo[6]));
                }

                instance.setPath(instanceName);
                instanceArray.append(instance);
            }
        }
        catch(Exception& e)
        {
            PEG_METHOD_EXIT();
            throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, e.getMessage());
        }

        handler.deliver(instanceArray);

        // complete processing the request
        handler.complete();

        PEG_METHOD_EXIT();
    }
Пример #13
0
int main(int argc, char** argv)
{
    try
    {
        CIMClient client;
        client.connectLocal();

        // Define instance name:

        CIMObjectPath instanceName("Methods.key=7777");

        // Define input arguments:

        Array<CIMParamValue> in;
        Array<CIMParamValue> out;

        // Invoke the method:

        const String NAMESPACE = "root/cimv2";
        const String methodName = "foo5";

        Uint32 in_arg = 234567;
        Uint32 in_out_arg = 123456;
        in.append(CIMParamValue("in_arg", in_arg));
        in.append(CIMParamValue("in_out_arg", in_out_arg));

        CIMValue value = client.invokeMethod(
            NAMESPACE,
            instanceName,
            methodName,
            in,
            out);

        {
            assert(value.getType() == CIMTYPE_UINT32);
            Uint32 t;
            value.get(t);
            assert(t == 1200);
        }

        // Check output argument:

        assert(out.size() == 2);
        {
            Uint32 pos = 0;
            assert((pos = findParam(out, "in_out_arg")) != -1);
            assert(out[pos].getParameterName() == "in_out_arg");
            CIMValue value = out[0].getValue();
            Uint32 in_out_arg_rtn;
            value.get(in_out_arg_rtn);
            assert(in_out_arg_rtn == in_out_arg);

            assert((pos = findParam(out, "out_arg")) != -1);
            assert(out[pos].getParameterName() == "out_arg");
            CIMValue value1 = out[1].getValue();
            Uint32 out_arg_rtn;
            value1.get(out_arg_rtn);
            assert(out_arg_rtn == in_arg);
        }

    }
    catch(Exception& e)
    {
        PEGASUS_STD(cerr) << "Error: " << e.getMessage() << PEGASUS_STD(endl);
        exit(1);
    }

    PEGASUS_STD(cout) << "+++++ passed all tests" << PEGASUS_STD(endl);

    return 0;
}
Пример #14
0
PluginModule::PluginModule(const char *name)
           : KSim::PluginObject(name)
{
  setConfigFileName(instanceName());
}