Esempio n. 1
0
void currentAnalyzer::saveData( const QString& prefix, QString delimiter )
{
    QString path = getSavePath();
    if( path.isEmpty() )
    {
        return;
    }

    QString filename = path + "/" + prefix +
            _startDateTime.toString( "yyyy-MM-dd__hh-mm-ss" ) + ".csv";
    QFile file( filename );
    if( file.open( QIODevice::ReadWrite ) )
    {
        QTextStream stream( &file );
        for( unsigned int i = 0; i < _dataVector.size(); i++ )
        {
            stream << _dataVector[i].time.toString( "hh:mm:ss,zzz" )
                   << delimiter
                   << QString::number( _dataVector[i].compPosition )
                   << delimiter
                   << QString::number( _dataVector[i].compDepth )
                   << delimiter
                   << QString::number( _dataVector[i].ventVolume )
                   << "\r\n"; // \r so that it is readable on windows as well
        }
        emit infoText( "Daten gespeichert (" + filename + ")." );
    }
    else
    {
        emit infoText( "Fehler: Daten konnten nicht in " + path +
                       " gespeichert werden!" );
    }
}
Esempio n. 2
0
QString currentAnalyzer::getSavePath()
{
    // QStandardPaths did not work ...
    QString path = qgetenv( "EXTERNAL_STORAGE" );
    if( path.isEmpty() )
    {
        emit infoText( "Fehler: Pfad konnte nicht bestimmt werden!" );
        return path;
    }

    path += "/rat";

    QDir dir( path );
    if( !dir.exists() )
    {
        if( !dir.mkpath( path ) )
        {
            emit infoText( "Fehler: Dateiordner konnte nicht erstellt "
                           "werden!" );
            return "";
        }
    }

    return path;
}
Esempio n. 3
0
ffmpegFileInfo Ffmpeg::getInfo() {
  QString ffmpegCachePath = getFfmpegCache().getQString();
  QString tempPath = ffmpegCachePath + "//" + cleanPathSymbols() + ".txt";
  if (QFile::exists(tempPath)) {
    QFile infoText(tempPath);
    infoText.open(QIODevice::ReadOnly);
    QByteArray ba = infoText.readAll();
    infoText.close();
    QString text = QString::fromStdString(ba.toStdString());
    m_lx         = text.split(" ")[0].toInt();
    m_ly         = text.split(" ")[1].toInt();
    m_frameRate  = text.split(" ")[2].toDouble();
    m_frameCount = text.split(" ")[3].toInt();
  } else {
    QFile infoText(tempPath);
    getSize();
    getFrameRate();
    getFrameCount();
    infoText.open(QIODevice::WriteOnly);
    std::string infoToWrite =
        std::to_string(m_lx) + " " + std::to_string(m_ly) + " " +
        std::to_string(m_frameRate) + " " + std::to_string(m_frameCount);
    int infoLength = infoToWrite.length();
    infoText.write(infoToWrite.c_str(), infoLength);
    infoText.close();
  }
  ffmpegFileInfo info;
  info.m_lx         = m_lx;
  info.m_ly         = m_ly;
  info.m_frameRate  = m_frameRate;
  info.m_frameCount = m_frameCount;
  return info;
}
/**
 *if no BehaviourDescriptionFile was loaded (i.e. behaviourFile=="") then
 *the function reads the path of the BehaviourDescriptionFile, which is used last, out of the Config-XML-File. 
 *else it only returns the Name of the loaded BehaviourDescriptionFile (i. e. behaviourFile);
 */
void 
ConfigFile::readConfigFile()
{
  descriptionFiles_.clear();

  // try to open policy editor config file
  QFile file(configFile_);
  if (file.open(IO_ReadOnly)) {
    QDomDocument doc("MiroConfigDocument");
    if (doc.setContent(&file)) {

      QDomNode n = doc.documentElement().firstChild();
      while (!n.isNull()) {
	QDomElement e = n.toElement();
	if (e.tagName() == "config_item" &&
	    e.attribute("name") == "files") {
	  
	  QDomNode node = n.firstChild();
	  while (!node.isNull()) {
	    e = node.toElement();
	    if (e.tagName() == "parameter" &&
		e.attribute("name") == "file") {
	      //add behaviour description file to list
	      descriptionFiles_.append(node.toElement().attribute("value"));
	    } 	     
	    node = node.nextSibling();
	  }	
	}
	n = n.nextSibling();
      }
    }  
    else {
      QString infoText("Error parsing configuration file\n" + 
		       configFile_ +
		       "\nStarting with empty configuration.");
      QMessageBox::information(0, "Policy Editor", infoText);
    }
    file.close();
  }
  else {
    QString infoText("Error opening configuration file\n" + 
		     configFile_ +
		     "\nStarting with empty configuration.");
    QMessageBox::information(0, "Policy Editor", infoText);
    // create a minimal config file for the next run
    writeConfigFile();
  }

  parseDescriptionFiles();
}
void 
ConfigFile::parseDescriptionFiles()
{
  bool okay = false;
  while (!okay) {
    delete generator_;
    generator_ = new Miro::CFG::Generator;
    delete handler_;
    handler_ = new Miro::CFG::Parser(*generator_);
    
    QStringList::Iterator first, last = descriptionFiles_.end();
    for (first = descriptionFiles_.begin(); first != last ; ++first) {

      // kill previous namespace nesting
      generator_->clearNamespace();

      QString fileName = *first;
      QFile xmlFile( fileName );
      if (!xmlFile.exists()) {
      QString infoText("Error parsing behaviour description file: \n" +
		       fileName + "\n" +
		       "File not found.");
      QMessageBox::information(0, "Policy Editor", infoText);
      descriptionFiles_.remove(first);
      break;
      }
      QXmlInputSource source( xmlFile );
      QXmlSimpleReader reader;
      Miro::CFG::TextErrorHandler errorHandler;
      
      reader.setContentHandler( handler_ );
      reader.setErrorHandler( &errorHandler);

      if (!reader.parse( source )) {
	QString infoText("Error parsing behaviour description file:\n" +
			 fileName + "\n" +
			 errorHandler.errorString());
	QMessageBox::information(0, "Policy Editor", infoText);
	descriptionFiles_.remove(first);
	break;
      }
    }
    // parsing successfull
    okay = true;

    //    cout << "parsing complete. known types: " << endl;
    //    cout << *generator_ << endl;
  }
}
Esempio n. 6
0
void
LookAndFeelSettingsView::MessageReceived(BMessage *msg)
{
	switch (msg->what) {
		case kMsgSetDecor:
		{
			BString newDecor;
			if (msg->FindString("decor", &newDecor) == B_OK)
				_SetDecor(newDecor);
			break;
		}

		case kMsgDecorInfo:
		{
			DecorInfo* decor = fDecorUtility.FindDecorator(fCurrentDecor);
			if (decor == NULL)
				break;

			BString authorsText(decor->Authors().String());
			authorsText.ReplaceAll(", ", "\n\t");

			BString infoText(B_TRANSLATE("%decorName\n\n"
				"Authors:\n\t%decorAuthors\n\n"
				"URL: %decorURL\n"
				"License: %decorLic\n\n"
				"%decorDesc\n"));


			infoText.ReplaceFirst("%decorName", decor->Name().String());
			infoText.ReplaceFirst("%decorAuthors", authorsText.String());
			infoText.ReplaceFirst("%decorLic", decor->LicenseName().String());
			infoText.ReplaceFirst("%decorURL", decor->SupportURL().String());
			infoText.ReplaceFirst("%decorDesc", decor->ShortDescription().String());

			BAlert *infoAlert = new BAlert(B_TRANSLATE("About decorator"),
				infoText.String(), B_TRANSLATE("OK"));
			infoAlert->SetFlags(infoAlert->Flags() | B_CLOSE_ON_ESCAPE);
			infoAlert->Go();

			break;
		}

		case kMsgArrowStyleSingle:
			_SetDoubleScrollBarArrows(false);
			break;

		case kMsgArrowStyleDouble:
			_SetDoubleScrollBarArrows(true);
			break;

		default:
			BView::MessageReceived(msg);
			break;
	}
}
Esempio n. 7
0
int VellemanOut_Test::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: initial(); break;
        case 1: openClose(); break;
        case 2: infoText(); break;
        case 3: outputDMX(); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
void
DecorSettingsView::MessageReceived(BMessage *msg)
{
	switch (msg->what) {
		case kMsgSetDecor:
		{
			BString newDecor;
			if (msg->FindString("decor", &newDecor) == B_OK)
				_SetDecor(newDecor);
			break;
		}
		case kMsgDecorInfo:
		{
			DecorInfo* decor = fDecorUtility.FindDecorator(fCurrentDecor);
			if (decor == NULL)
				break;

			BString authorsText(decor->Authors().String());
			authorsText.ReplaceAll(", ", "\n    ");

			BString infoText("Name: %decorName\n"
				"Authors:\n    %decorAuthors\n"
				"URL: %decorURL\n"
				"License: %decorLic\n"
				"Description:\n    %decorDesc\n");

			infoText.ReplaceFirst("%decorName", decor->Name().String());
			infoText.ReplaceFirst("%decorAuthors", authorsText.String());
			infoText.ReplaceFirst("%decorLic", decor->LicenseName().String());
			infoText.ReplaceFirst("%decorURL", decor->SupportURL().String());
			infoText.ReplaceFirst("%decorDesc", decor->ShortDescription().String());

			BAlert *infoAlert = new BAlert(B_TRANSLATE("About Decorator"),
				infoText.String(), B_TRANSLATE("OK"));
			infoAlert->SetShortcut(0, B_ESCAPE); 
			infoAlert->Go(); 

			break;
		}

		default:
			BView::MessageReceived(msg);
			break;
	}
}
Esempio n. 9
0
    virtual QwtText trackerTextF( const QPointF &pos ) const
    {
        // the white text is hard to see over a light canvas background

        QColor bg( Qt::darkGray );
        bg.setAlpha( 160 );

        QwtText text;

        const int idx = dynamic_cast<const Plot*>( plot() )->frameAt( pos.x() );
        if ( idx >= 0 )
        {
            text = infoText( idx );
            text.setBackgroundBrush( QBrush( bg ) );
        }

        return text;
    }
Esempio n. 10
0
void currentAnalyzer::newDataString( const QString &dp )
{
    if( dp.indexOf( "<" ) != 0 || dp.indexOf( ">" ) != 4 )
    {
        if( dp.left( 3 ) != "aye" )
        {
            emit infoText( "Ungültiges Übertragunsprotokoll! "
                           "(Alte Programmversion?)" );
        }
        return;
    }

   // _mutex.lock();
   _tempDataPoint.time         = QTime::currentTime();
   _tempDataPoint.compPosition = dp.mid( 1, 1 ).toInt();
   _tempDataPoint.compDepth    = dp.mid( 2, 1 ).toInt();
   _tempDataPoint.ventVolume   = dp.mid( 3, 1 ).toInt();

   // start();
   run();
}
void GenericLinuxDeviceConfigurationWizardFinalPage::initializePage()
{
    d->infoLabel.setText(infoText());
}
//------------------------------------------------------------------------------
LHDictionary::LHDictionary(std::stringstream& fileIN)
{     
    ++numberOfDicts;
    std::string lastKey = "";
    int objCounter = 0;
    std::string objText;
    
    //printf("DICT START\n");
    //printf("........................................................\n");
    //std::cout << fileIN.str() << std::endl;
    //printf("................................................................\n");    
    //file needs to start with <dict> else its not a LHDictionary file
        
    while(!fileIN.eof())
    {
        std::string line;
        getline(fileIN,line);
            
        //printf("D: c:%d %s\n", objCounter, line.c_str());
            
        if (std::string::npos != line.find("<key>")){
            if(1 < objCounter){
                objText+= line+"\n";
            }else{
                lastKey = valueForField(line);                    
            }
        }
        else if (std::string::npos != line.find("<string>")){
                
            if(1 < objCounter){
                objText+= line+"\n";
            }else{
                setObjectForKey(new LHObject(valueForField(line)), lastKey);
            }
        }
        else if (std::string::npos != line.find("<real>")){
            if(1 < objCounter){
                objText+= line+"\n";
            }else{
                setObjectForKey(new LHObject(floatFromString(valueForField(line))), lastKey);
            }
        }
        else if (std::string::npos != line.find("<integer>")){
            if(1 < objCounter){
                objText+= line+"\n";
            }else{
                setObjectForKey(new LHObject(intFromString(valueForField(line))), lastKey);
            }
        }
        else if (std::string::npos != line.find("<true/>")){
            if(1 < objCounter){
                objText+= line+"\n";
            }else{
                setObjectForKey(new LHObject(true), lastKey);
            }
        }
        else if (std::string::npos != line.find("<false/>")){
            if(1 < objCounter){
                objText+= line+"\n";
            }else{
                setObjectForKey(new LHObject(false), lastKey);
            }
        }
        else if (std::string::npos != line.find("<dict>")){
            ++objCounter;
            if(1 < objCounter){
                objText+= line+"\n";
            }
        }
        else if (std::string::npos != line.find("</dict>")){
            if(1 < objCounter){
                objText+= line+"\n";
            }
                
            --objCounter;
            if(1 == objCounter)
            {
                std::stringstream infoText(objText);
                setObjectForKey(new LHObject(new LHDictionary(infoText)), lastKey);
                objText = "";
            }
                
            if(0 > objCounter)
            {
                objText = "";
                objCounter = 1;
            }
        }
        else if (std::string::npos != line.find("<dict/>")){
            std::stringstream dummyText;
            setObjectForKey(new LHObject(new LHDictionary(dummyText)), lastKey);
        }
        else if (std::string::npos != line.find("<array>")){
            ++objCounter;
            if(1 != objCounter){
                    objText+= line+"\n";
            }
        }
        else if (std::string::npos != line.find("</array>")){
            if(1 != objCounter){
                objText+= line+"\n";
            }
            
            --objCounter;
                
            if(1 == objCounter)
            {
                std::stringstream infoText(objText);
                setObjectForKey(new LHObject(new LHArray(infoText)), lastKey);
                objText = "";
            }
                
            if(0 > objCounter)
            {
                objText = "";
                objCounter = 1;
            }
        }
        else if (std::string::npos != line.find("<array/>")){
            setObjectForKey(new LHObject(new LHArray()), lastKey);
            //objText = "";
            //objCounter = 1;
        }
    }
    
    //printf("DICT END   ................................................................\n");    
}
Esempio n. 13
0
QString UnicodeDialog::unicodeInfo(QString unicode)
{
    QString infoText(i18n("<small>(no character selected)</small>"));
    if (unicode.length() == 0) return infoText;

    QString u = trimmedUnicodeNumber(unicode).toLower();

    if (controlCharacter(u)) {
        infoText = i18n("Control character. Cannot be inserted/printed. See <a href=\"http://en.wikipedia.org/wiki/Control_character\">Wikipedia:Control_character</a>");
    } else if (u == "a") {
        infoText = i18n("Line Feed (newline character, \\\\n)");
    } else if (u == "20") {
        infoText = i18n("Standard space character. (Other space characters: U+00a0, U+2000&#x2013;200b, U+202f)");
    } else if (u == "a0") {
        infoText = i18n("No-break space. &amp;nbsp; in HTML. See U+2009 and U+0020.");
    } else if (u == "ab" || u == "bb" || u == "2039" || u == "203a") {
        infoText = i18n("<p><strong>&laquo;</strong> (u+00ab, <code>&amp;lfquo;</code> in HTML) and <strong>&raquo;</strong> (u+00bb, <code>&amp;rfquo;</code> in HTML) are called Guillemets or angle quotes. Usage in different countries: France (with non-breaking Space 0x00a0), Switzerland, Germany, Finland and Sweden.</p><p><strong>&lsaquo;</strong> and <strong>&rsaquo;</strong> (U+2039/203a, <code>&amp;lsaquo;/&amp;rsaquo;</code>) are their single quote equivalents.</p><p>See <a href=\"http://en.wikipedia.org/wiki/Guillemets\">Wikipedia:Guillemets</a></p>");
    } else if (u == "2002") {
        infoText = i18n("En Space (width of an n)");
    } else if (u == "2003") {
        infoText = i18n("Em Space (width of an m)");
    } else if (u == "2004") {
        infoText = i18n("Three-Per-Em Space. Width: 1/3 of one <em>em</em>");
    } else if (u == "2005") {
        infoText = i18n("Four-Per-Em Space. Width: 1/4 of one <em>em</em>");
    } else if (u == "2006") {
        infoText = i18n("Six-Per-Em Space. Width: 1/6 of one <em>em</em>");
    } else if (u == "2007") {
        infoText = i18n("Figure space (non-breaking). Width of a digit if digits have fixed width in this font.");
    } else if (u == "2008") {
        infoText = i18n("Punctuation Space. Width the same as between a punctuation character and the next character.");
    } else if (u == "2009") {
        infoText = i18n("Thin space, in HTML also &amp;thinsp;. See U+202f and <a href=\"http://en.wikipedia.org/wiki/Space_(punctuation)\">Wikipedia:Space_(punctuation)</a>");
    } else if (u == "200a") {
        infoText = i18n("Hair Space. Thinner than U+2009.");
    } else if (u == "2019") {
        infoText = i18n("Punctuation Apostrophe. Should be used instead of U+0027. See <a href=\"http://en.wikipedia.org/wiki/Apostrophe\">Wikipedia:Apostrophe</a>");
    } else if (u == "2013") {
        infoText = i18n("<p>An en Dash (dash of the width of an n).</p><p>Usage examples: In English language for value ranges (1878&#x2013;1903), for relationships/connections (Zurich&#x2013;Dublin). In the German language it is also used (with spaces!) for showing thoughts: &ldquo;Es war &#x2013; wie immer in den Ferien &#x2013; ein regnerischer Tag.</p> <p>See <a href=\"http://en.wikipedia.org/wiki/Dash\">Wikipedia:Dash</a></p>");
    } else if (u == "2014") {
        infoText = i18n("<p>An em Dash (dash of the width of an m).</p><p>Usage examples: In English language to mark&#x2014;like here&#x2014;thoughts. Traditionally without spaces. </p><p>See <a href=\"http://en.wikipedia.org/wiki/Dash\">Wikipedia:Dash</a></p>");
    } else if (u == "202f") {
        infoText = i18n("<p>Narrow no-break space. Has the same width as U+2009.</p><p>Usage: For units (spaces are marked with U+2423, &#x2423;): 230&#x2423;V, &#x2212;21&#x2423;&deg;C, 50&#x2423;lb, <em>but</em> 90&deg; (no space). In German for abbreviations (like: i.&#x202f;d.&#x202f;R. instead of i.&#xa0;d.&#xa0;R. with U+00a0).</p><p>See <a href=\"http://de.wikipedia.org/wiki/Schmales_Leerzeichen\">Wikipedia:de:Schmales_Leerzeichen</a></p>");
    } else if (u == "2026") {
        infoText = i18n("Ellipsis: If text has been left o&#x2026; See <a href=\"http://en.wikipedia.org/wiki/Ellipsis\">Wikipedia:Ellipsis</a>");
    } else if (u == "2212") {
        infoText = i18n("Minus sign. For numbers: &#x2212;42");
    } else if (u == "2423") {
        infoText = i18n("Open box; stands for a space.");
    } else if (u == "2669") {
        infoText = i18n("Quarter note (Am.) or crochet (Brit.). See <a href=\"http://en.wikipedia.org/wiki/Quarter_note\">Wikipedia:Quarter_note</a>");
    } else if (u == "266a" || u == "266b") {
        infoText = i18n("Eighth note (Am.) or quaver (Brit.). Half as long as a quarter note (U+2669). See <a href=\"http://en.wikipedia.org/wiki/Eighth_note\">Wikipedia:Eighth_note</a>");
    } else if (u == "266c") {
        infoText = i18n("Sixteenth note (Am.) or semiquaver (Brit.). Half as long as an eighth note (U+266a). See <a href=\"http://en.wikipedia.org/wiki/Sixteenth_note\">Wikipedia:Sixteenth_note</a>");
    } else if (u == "1D162") {
        infoText = i18n("Thirty-second note (Am.) or demisemiquaver (Brit.). Half as long as a sixteenth note (U+266b). See <a href=\"http://en.wikipedia.org/wiki/Thirty-second_note\">Wikipedia:Thirty-second_note</a>");
    } else {
        infoText = i18n("<small>No additional information available for this character.</small>");
    }

    return infoText;
}