source: src-qt4/qsudo/main.cpp @ 7cc177e

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2
Last change on this file since 7cc177e was 7cc177e, checked in by Kris Moore <kris@…>, 11 months ago

Fix up all the last bits of clang / HEAD fussiness

  • Property mode set to 100644
File size: 904 bytes
Line 
1#include <qtranslator.h>
2#include <qlocale.h>
3#include <QApplication>
4#include <QDebug>
5#include <QFile>
6#include <unistd.h>
7#include <sys/types.h>
8#include "mainwindow.h"
9#include "../config.h"
10
11int main(int argc, char *argv[])
12{   
13    QApplication a(argc, argv);
14
15    if ( qApp->argc() <= 1 ) {
16       qDebug() << "Error: Need to specify argument to run!";
17       exit(1);
18    }
19
20    QTranslator translator;
21    QLocale mylocale;
22    QString langCode = mylocale.name();
23    if ( ! QFile::exists(PREFIX + "/share/pcbsd/i18n/qsudo_" + langCode + ".qm" ) )
24        langCode.truncate(langCode.indexOf("_"));
25
26    if ( QFile::exists(PREFIX + "/share/pcbsd/i18n/qsudo_" + langCode + ".qm" ) ) {
27      translator.load( QString("qsudo_") + langCode, PREFIX + "/share/pcbsd/i18n/" );
28      a.installTranslator( &translator );
29    }
30
31    MainWindow w;
32    w.ProgramInit();
33    w.show();
34
35    return a.exec();
36}
Note: See TracBrowser for help on using the repository browser.