source: src-qt4/warden-gui/main.cpp @ 1f0939e

9.1-release9.2-releasereleng/10.0releng/10.0.1releng/10.0.2
Last change on this file since 1f0939e was 1f0939e, checked in by Kris Moore <kris@…>, 16 months ago
  • Initial merge of code from PC-BSD SVN repo for my private (pre-release) hacking
  • Property mode set to 100644
File size: 949 bytes
Line 
1#include <QApplication>
2#include <QDebug>
3#include <QTranslator>
4#include <qtsingleapplication.h>
5#include <err.h>
6#include "dialogwarden.h"
7
8int main( int argc, char ** argv )
9{
10    QtSingleApplication a(argc, argv);
11    if ( a.isRunning() )
12      return !(a.sendMessage("show"));
13
14    QTranslator translator;
15    QLocale mylocale;
16    QString langCode = mylocale.name();
17    if ( ! QFile::exists( "/usr/local/share/warden/i18n/Warden_" + langCode + ".qm" ) )
18      langCode.truncate(langCode.indexOf("_"));
19    translator.load( QString("Warden_") + langCode, "/usr/local/share/warden/i18n/" );
20    a.installTranslator( &translator );
21    qDebug() << "Locale:" << langCode;
22
23
24    dialogWarden *w = new dialogWarden();
25    w->programInit();
26    w->show();
27    QObject::connect(&a, SIGNAL(messageReceived(const QString&)), w, SLOT(slotSingleInstance()) );
28    a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
29    return a.exec();
30}
Note: See TracBrowser for help on using the repository browser.