コード例 #1
0
void MainWindow::createActions()
{
  QString s;

  OEG::Qt::MainWindow::createActions();

  a_add_word = new QAction(_("&Add word ..."), this);
  a_add_translation = new QAction(_("Add t&ranslation ..."), this);
  a_translate = new QAction(_("&Translate"), this);
  a_toggle_direction = new QAction(_("Toggle &direction"), this);

  s = _("Add one or more words to the dictionary.");
  a_add_word->setToolTip(s);
  a_add_word->setStatusTip(s);
  s = _("Add a new word combination to the dictionary.");
  a_add_translation->setToolTip(s);
  a_add_translation->setStatusTip(s);
  s = _("Translate input text.");
  a_translate->setToolTip(s);
  a_translate->setStatusTip(s);
  s = _("Toggle translation direction.");
  a_toggle_direction->setToolTip(s);
  a_toggle_direction->setStatusTip(s);

  connect(a_add_word,         SIGNAL(triggered()),
          this,               SLOT(addWord()));
  connect(a_add_translation,  SIGNAL(triggered()),
          this,               SLOT(addTranslation()));
  connect(a_translate,        SIGNAL(triggered()),
          this,               SLOT(translate()));
  connect(a_toggle_direction, SIGNAL(triggered()),
          this,               SLOT(toggleDirection()));
}
コード例 #2
0
ファイル: main.c プロジェクト: palmyman/pa1-hw6
TNODE * newDictionary(const char * (*replace)[2]) {
    TNODE * dictionary = NULL;
    unsigned int i = 0;
    while (replace[i][0] != NULL && replace[i][1] != NULL) {
        if (!addTranslation(&dictionary, replace[i][0], replace[i][1])) {
            freeDictionary(dictionary);
            return NULL;
        }
        i++;
    }
    return dictionary;
}
コード例 #3
0
void EntityTransform::beginDraw()
{
	SceneManager::PassMode passMode = graphicsEngine->getSceneManager()->passMode;

	//Si se ha modificado algo, toca generarla de nuevo
	if(dirty)
	{
		// Aplicamos la identidad primero ya que la traslacion indica directamente
		// la posicion final, no un desplazamiento
		transformMatrix.setIdentity();
		addTranslation(translation);
		addRotation(rotation);
		addScale(scale);
	}
	
		
	// Solo apilamos en el dibujado de mallas, etc
	if (passMode == SceneManager::PassMode::OBJECTS)
	{
		// Apilar matriz actual
		glPushMatrix();
	}
	// Camaras, aplicamos la inversa
	else if (passMode == SceneManager::PassMode::CAMERAS)
	{
		if(dirty)
		{
			transformMatrix = transformMatrix.inverse();
		}
	}

	// La posicion de las luces se aplican en la entidad de la hoja
	if (passMode != SceneManager::PassMode::LIGHTS)
	{
		// Para camaras y resto de objetos
		// Multiplicar matriz actual por la de transformacion
		addOpenGLMatrix();
	}

	dirty = false;
}
コード例 #4
0
TranslationHandler::TranslationHandler(QObject *parent) :
    QObject(parent),
    mCurrentLanguage("en"),
    mTranslator(NULL)
{
    // Add our available languages
    // Keep this list sorted
    addTranslation("Chinese (Simplified)", "cppcheck_zh_CN");
    addTranslation("Dutch", "cppcheck_nl");
    addTranslation("English", "cppcheck_en");
    addTranslation("Finnish", "cppcheck_fi");
    addTranslation("French", "cppcheck_fr");
    addTranslation("German", "cppcheck_de");
    addTranslation("Italian", "cppcheck_it");
    addTranslation("Japanese", "cppcheck_ja");
    addTranslation("Korean", "cppcheck_ko");
    addTranslation("Russian", "cppcheck_ru");
    addTranslation("Serbian", "cppcheck_sr");
    addTranslation("Spanish", "cppcheck_es");
    addTranslation("Swedish", "cppcheck_sv");
}
コード例 #5
0
ファイル: msg2qm.cpp プロジェクト: aroraujjwal/qt3
void translate( const QString& filename, const QString& qmfile )
{
    QFile f(filename);
    if ( !f.open( IO_ReadOnly) )
	return;
    QTranslator* translator = new QTranslator(0);
    QTextCodec *codec = 0;
    for (int pass =  0; pass < 2; pass++) {
	f.at(0);
	QTextStream t( &f );
	QString line;
	QString msgid;
	QString msgstr;
	if ( codec != 0 ) {
	    t.setCodec( codec );
	}
	while ( !t.atEnd() || !line.isEmpty() ) {
	    if (line.isEmpty()) {
		t.skipWhiteSpace();
		line = t.readLine();
	    }
	    if ( hasHandle( line, "msgid") ) {
		msgstr = QString::null;
		msgid = extractContents( line );
		if (!t.atEnd()) {
		    t.skipWhiteSpace();
		    line = t.readLine();
		}
		else
		    line = QString::null;
		while ( hasHandle( line, "\"") ) {
		    msgid += extractContents( line );
		    if (!t.atEnd()) {
			t.skipWhiteSpace();
			line = t.readLine();
		    }
		    else
			line = QString::null;
		}
	    }
	    else if ( hasHandle( line, "msgstr") ) {
		msgstr = extractContents( line );
		if (!t.atEnd()) {
		    t.skipWhiteSpace();
		    line = t.readLine();
		}
		else
		    line = QString::null;
		while ( hasHandle( line, "\"") ) {
		    msgstr += extractContents( line );
		    if (!t.atEnd()) {
			t.skipWhiteSpace();
			line = t.readLine();
		    }
		    else
			line = QString::null;
		}
		if ( pass == 1 )
		    addTranslation( translator, msgid, msgstr);

		if ( pass == 0 && msgid.isEmpty() ) {
		    // Check for the encoding.
		    int cpos = msgstr.find( "charset=" );
		    if ( cpos >= 0 ) {
			cpos = cpos + 8; //skip "charset="
			int i = cpos;
			int len = msgstr.length();
			while ( i < len && !msgstr[i].isSpace() )
			    i++;
			QString charset = msgstr.mid( cpos, i-cpos );
			codec = QTextCodec::codecForName( charset.ascii() );
			if ( codec ) {
			    debug( "PO file character set: %s. Codec: %s",
				   charset.ascii(), codec->name() );
			} else {
			    debug( "No codec for %s", charset.ascii() );
			}
		    }
		    break;
		}
	    }
	    else
		line = QString::null;
	}
    }
    f.close();
    translator->save( qmfile );
}
コード例 #6
0
void KinematicMotion::addKinematicMotion(const KinematicMotion *kinematicMotion) {
    addRotation(kinematicMotion->getRotationMatrix()); // step 1
    addTranslation(kinematicMotion->getTranslationVector()); // step 2, order must not be changed
}