source: src-qt4/pc-gdmconf/main.cpp @ e49ab68

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

Switch us back to GDM for the time being. PCDM is not mature enough at this point. Will
revisit it down the road.

  • Property mode set to 100644
File size: 1.0 KB
Line 
1#include <QMessageBox>
2#include <qtranslator.h>
3#include <qlocale.h>
4#include <qtsingleapplication.h>
5#include <QFile>
6#include "mainwindow.h"
7#include "../config.h"
8
9int main(int argc, char *argv[])
10{   
11    QtSingleApplication a(argc, argv);
12
13    if ( a.isRunning() )
14          return !(a.sendMessage("show"));
15
16    QTranslator translator;
17    QLocale mylocale;
18    QString langCode = mylocale.name();
19    if ( ! QFile::exists(PREFIX + "/share/pcbsd/i18n/pc-gdmconf_" + langCode + ".qm" ) )
20        langCode.truncate(langCode.indexOf("_"));
21    translator.load( QString("pc-gdmconf_") + langCode, PREFIX + "/share/pcbsd/i18n/" );
22    a.installTranslator( &translator );   
23
24    MainWindow w;
25    w.show();
26
27    //Check for root
28    if (0 != geteuid())
29    {
30        QMessageBox msg;
31        msg.setText(w.tr("You should run this application as root"));
32        msg.exec();
33        exit(2);
34    }
35
36    QObject::connect(&a, SIGNAL(messageReceived(const QString &)), &w, SLOT(slotSingleInstance()));
37
38    return a.exec();
39}
Note: See TracBrowser for help on using the repository browser.