Example #1
0
int main(int argc, char *argv[])
{
    QString Lang,LangDir;
    QSettings settings("qucs","qucs");
    if(settings.contains("Language")) {
        Lang=settings.value("Language").toString();
    }

    char * var = getenv ("QUCSDIR");
    if (var != NULL) {
      QDir QucsDir = QDir (var);
      QString QucsDirStr = QucsDir.canonicalPath ();
      LangDir =
        QDir::convertSeparators (QucsDirStr + "/share/qucs/lang/");
    } else {
      LangDir = LANGUAGEDIR;
    }

    QApplication a(argc, argv);

    QTranslator tor( 0 );
    if(Lang.isEmpty())
      Lang = QString(QLocale::system().name());
    tor.load( QString("qucs_") + Lang, LangDir);
    a.installTranslator( &tor );

    QucsActiveFilter w;
    w.show();
    
    return a.exec();
}
Example #2
0
File: main.cpp Project: Qucs/qucs
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QString LangDir;
    // apply default settings
    QucsSettings.x = 200;
    QucsSettings.y = 100;
    QucsSettings.font = QFont("Helvetica", 12);
    QucsSettings.showConsole = true;

    // is application relocated?
    char * var = getenv ("QUCSDIR");
    QDir QucsDir;
    if (var != NULL) {
      QucsDir = QDir (var);
      QString QucsDirStr = QucsDir.canonicalPath ();
      LangDir =
        QDir::toNativeSeparators(QucsDirStr + "/share/qucs/lang/");
    } else {
      QString QucsApplicationPath = QCoreApplication::applicationDirPath();
#ifdef __APPLE__
      QucsDir = QDir(QucsApplicationPath.section("/bin",0,0));
#else
      QucsDir = QDir(QucsApplicationPath);
      QucsDir.cdUp();
#endif
      LangDir = QucsDir.canonicalPath() + "/share/qucs/lang/";
    }

    loadSettings();

    a.setFont(QucsSettings.font);

    QTranslator tor( 0 );
    QString Lang = QucsSettings.Language;
    if(Lang.isEmpty())
      Lang = QString(QLocale::system().name());
    tor.load( QString("qucs_") + Lang, LangDir);
    a.installTranslator( &tor );

    QucsActiveFilter *w = new QucsActiveFilter();
    w->raise();
    w->move(QucsSettings.x, QucsSettings.y);  // position before "show" !!!
    w->show();
    
    int result = a.exec();
    saveApplSettings(w);
    return result;
}