source: src-qt4/pc-servicemanager/main.cpp @ 1620346

9.1-release9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1releng/10.1.1releng/10.1.2
Last change on this file since 1620346 was 1620346, checked in by Kris Moore <kris@…>, 2 years ago

Initial import of PC-BSD /current/ SVN repo

  • Property mode set to 100644
File size: 1.3 KB
Line 
1#include <qapplication.h>
2#include <qtranslator.h>
3#include <qtextcodec.h>
4#include <qstylefactory.h>
5#include <qdesktopwidget.h>
6#include <QDebug>
7#include "servicemanager.h"
8#include "../config.h"
9
10int main( int argc, char ** argv )
11{
12   QApplication a(argc, argv);
13
14    QTranslator translator;
15    QLocale mylocale;
16    QString langCode = mylocale.name();
17    if ( ! QFile::exists( PREFIX + "/share/pcbsd/i18n/ServiceManager_" + langCode + ".qm" ) )
18      langCode.truncate(langCode.indexOf("_"));
19    translator.load( QString("ServiceManager_") + langCode, PREFIX + "/share/pcbsd/i18n/" );
20    a.installTranslator( &translator );
21    qDebug() << "Locale:" << langCode;
22
23    QString chroot, ip;
24    if ( argc >= 2)
25    {
26       QString chkarg = argv[1];
27       // Running in a warden jail?
28       if ( chkarg == "-warden" )
29         if ( argc == 4 ) {
30           chroot = argv[2];
31           ip = argv[3];
32         } else {
33           qDebug() << "Usage: -warden <directory> <ip>";
34           exit(1);
35         }
36    }
37
38    // Make sure we are running as root
39    if (getuid() != 0) {
40       qDebug("Error, needs to be run as root");
41       exit(1);
42    }
43
44    //Init GUI
45    ServiceManager w;
46
47    w.ProgramInit(chroot, ip);
48
49    w.show();
50    a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
51    return a.exec();
52}
Note: See TracBrowser for help on using the repository browser.