Пример #1
0
void PMXMLParser::quickParse( QStringList& list )
{
   if( initDocument( ) )
   {
      QDomElement e = m_pDoc->documentElement( );
      if( ( e.tagName( ) == "objects" ) || ( e.tagName( ) == "scene" ) )
      {
         QDomNode c = e.firstChild( );

         while( !c.isNull( ) )
         {
            if( c.isElement( ) )
            {
               QDomElement ce = c.toElement( );
               QString type = m_pPart->prototypeManager( )->className( ce.tagName( ) );
               if( !type.isNull( ) )
                  list.append( type );
            }
            c = c.nextSibling( );
         }
      }
      else
         printError( i18n( "Wrong top level tag" ) );
   }
}
Пример #2
0
KVerbosApp::KVerbosApp(QWidget* , const char* name):KMainWindow (0, name)
{
  // als erstes das Logo starten
  KStartupLogo* start_logo = new KStartupLogo(0);
  start_logo->show();
  start_logo->raise();

  // die Instanzen von kverbos zählen
  kverbosCounter++;

  config=kapp->config();

  ///////////////////////////////////////////////////////////////////
  // call inits to invoke all other construction parts
  initStatusBar();
  initActions();
  initDocument();
  initView();

  readOptions();

  ///////////////////////////////////////////////////////////////////
  // disable actions at startup
  // Mir ist nicht klar, warum die Autoren des Frameworks diese
  // Menuoptionen deaktivieren.
  // Ich werde hier jedenfalls gleich einmal einige auskommentieren.
  // fileSave->setEnabled(false);
  // fileSaveAs->setEnabled(false);
  filePrint->setEnabled(false);
  editCut->setEnabled(false);
  editCopy->setEnabled(false);
  editPaste->setEnabled(false);
  userResults->setEnabled(false);

  // El programa ha leído las opciones del programa. Entonces puedo iniciar el objeto
  // por la control de KFeeder.
  if (useKFeeder)
  {
    kfeederControl = new KFeederControl(kverbosCounter, showKFeederSplash, automaticKFeeder);
    useKFeeder = kfeederControl->isActive();
    if (!useKFeeder)
    {
      // the KFeeder didn't start so it isn't installed. Delete the control object
      delete kfeederControl;
      kfeederControl = 0;
    };
  }
  else
    kfeederControl = 0;

  // das Logo wieder löschen
  delete start_logo;
}
Пример #3
0
void PMXMLParser::topParse( )
{
   if( initDocument( ) )
   {
      QDomElement e = m_pDoc->documentElement( );
      // read the format number
      // assume 1.0 on error
      QString fstring = e.attribute( "majorFormat", "1" );
      bool ok = true;
      int format = fstring.toInt( &ok );
      if( !ok || ( format < 1 ) )
         format = 1;
      m_majorDocumentFormat = format;

      fstring = e.attribute( "minorFormat", "0" );
      ok = true;
      format = fstring.toInt( &ok );
      if( !ok || ( format < 0 ) )
         format = 0;
      m_minorDocumentFormat = format;

      if( ( m_majorDocumentFormat > c_majorDocumentFormat )
          || ( m_majorDocumentFormat == c_majorDocumentFormat )
          && ( m_minorDocumentFormat > c_minorDocumentFormat ) )
         printWarning( i18n( "This document was created with a newer version of KPovModeler. "
                             "The whole document may not be loaded correctly." ) );

      if( e.tagName( ) == "objects" )
      {
         parseChildObjects( e, 0 );
      }
      else if( e.tagName( ) == "scene" )
      {
         PMScene* scene = new PMScene( m_pPart );
         insertChild( scene, 0 );
         PMXMLHelper hlp( e, m_pPart, this,
                          m_majorDocumentFormat, m_minorDocumentFormat );
         scene->readAttributes( hlp );
         parseChildObjects( e, scene );
      }
      else
      {
         printError( i18n( "Wrong top level tag" ) );
         setFatalError( );
      }
   }
}
Пример #4
0
String OMLView::processHtml(shared_ptr<OMLItem> i, shared_ptr<OMLContext> context) const
{	
	if(context->checkPortalPageAvailable(i) == false) 
		return String::EMPTY;

	shared_ptr<IPortalPage> page = context->getPortalPage();
	if(page == nullptr) return String::EMPTY;

	mapDefaultParamTo(i, _S("mode"));

	String id = i->getHtmlChilds(context);

	String mode = i->getParam(_S("mode"));
	if(mode.empty())
	{
		mode = _S("row");
		i->setParam(_S("mode"), mode);
	}

	if( (mode != _S("row")) && (mode != _S("lite")) && (mode != _S("full")) )
	{
		context->addWarning(String::format(_S("%S doesn't support the mode '%S'.").c_str(), context->getFriendlyName(i).c_str(), mode.c_str()));
		return String::EMPTY;
	}

	shared_ptr<XMLDocument> doc = initDocument(i, context);
		
	XMLPortalExporter::ExportMode exportMode = (mode != _S("row")) ? XMLPortalExporter::emFull : XMLPortalExporter::emLite;
	bool withStats = (mode != _S("row"));

	shared_ptr<XMLNode> nodeUser = doc->getRoot()->addChild(_S("object"));
	shared_ptr<XMLPortalExporter> exporter(OS_NEW XMLPortalExporter(nodeUser, page, exportMode, withStats));
	shared_ptr<ObjectsIObject> object = page->getObject(id.to_ascii());
	if(object != nullptr)
	{
		object->exportXML(exporter);
	}

	return processDocument(doc, i, context);	
}
Пример #5
0
KstApp::KstApp(QWidget *parent, const char* name)
: KMainWindow(parent, name) {

  clearWFlags(WDestructiveClose);

  stopping = false;
  config = kapp->config();
  initStatusBar();

  initDocument();
  initView();

  /* create dialogs */
  debugDialog = new KstDebugDialogI(this);
  plotDialog = new KstPlotDialogI(doc, this);
  dataManager = new KstDataManagerI(doc, this);
  filterListEditor = new FilterListEditor(this);
  viewScalarsDialog = new KstViewScalarsDialogI(this);
  viewVectorsDialog = new KstViewVectorsDialogI(this);
  changeFileDialog = new KstChangeFileDialogI(this);
  changeNptsDialog = new KstChangeNptsDialogI(this);
  quickCurvesDialog = new KstQuickCurvesDialogI(this);
  quickPSDDialog = new KstQuickPSDDialogI(this);
  graphFileDialog = new KstGraphFileDialogI(this);
  vectorSaveDialog = new VectorSaveDialog(this);
  
  connect(KstVectorDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified()));
  connect(KstCurveDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified()));
  connect(KstEqDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified()));
  connect(KstHsDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified()));
  connect(KstPsdDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified()));
  connect(KstPluginDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified()));
  connect(KstEventMonitorI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified()));
  
  initActions();

  readOptions();

  _updateThread = new UpdateThread(doc);
  _updateThread->setUpdateTime(KstSettings::globalSettings()->plotUpdateTimer);
  _updateThread->start();

  connect(doc,  SIGNAL(newFrameMsg(int)),
          this, SLOT(slotUpdateFrameMsg(int)));
  connect(view, SIGNAL(newStatusMsg(const QString &)),
          this, SLOT(slotUpdateStatusMsg(const QString &)));
  connect(view, SIGNAL(newDataMsg(const QString &)),
          this, SLOT(slotUpdateDataMsg(const QString &)));

  /*** Plot Dialog signals */
  connect(changeFileDialog, SIGNAL(docChanged()),
          this,             SLOT(registerDocChange()));
  connect(changeNptsDialog, SIGNAL(docChanged()),
          this,             SLOT(registerDocChange()));
  connect(quickCurvesDialog,SIGNAL(docChanged()),
          this,             SLOT(registerDocChange()));
  connect(quickPSDDialog,   SIGNAL(docChanged()),
          this,             SLOT(registerDocChange()));
  connect(filterListEditor, SIGNAL(docChanged()),
          this,             SLOT(registerDocChange()));
  connect(graphFileDialog,  SIGNAL(graphFileReq(const QString &,int,int)),
          view,             SLOT(printToGraphicsFile(const QString &,int,int)));

  /*** label dialog ***/
  connect(view->labelDialog, SIGNAL(applied()),
          this, SLOT(registerDocChange()));

  /*** plot dialog ***/
  connect(plotDialog, SIGNAL(docChanged()), this, SLOT(registerDocChange()));

  /*** ***/
  connect(doc, SIGNAL(dataChanged()), this, SLOT(updateDialogs()));

  connect(dataManager, SIGNAL(editDataVector(const QString &)),
          KstVectorDialogI::globalInstance(), SLOT(show_I(const QString &)));

  connect(dataManager->OpenPlotDialog, SIGNAL(clicked()),
          this, SLOT(showPlotDialog()));

  setAutoSaveSettings("KST-KMainWindow", true);
  _dcopIface = new KstIfaceImpl(doc, this);
  view->forceUpdate();

  connect(this, SIGNAL(settingsChanged()), this, SLOT(slotSettingsChanged()));

  QTimer::singleShot(0, this, SLOT(updateActions()));

  // Load any extensions
  ExtensionMgr *mgr = ExtensionMgr::self();
  mgr->setWindow(this);
  KService::List sl = KServiceType::offers("Kst Extension");
  for (KService::List::ConstIterator it = sl.begin(); it != sl.end(); ++it) {
    KService::Ptr service = *it;
    QString name = service->property("Name").toString();
    if (!mgr->enabled(name) && !service->property("X-Kst-Enabled").toBool()) {
      continue;
    }
    mgr->loadExtension(service);
  }
}