source: src-qt4/pc-netmanager/src/NetworkManager/main.cpp @ c9d1400

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

Update NetworkManager?, now it runs via single-instance and has a '-installer' mode option,
for use during the system installer

  • Property mode set to 100644
File size: 1.2 KB
Line 
1#include <QApplication>
2#include <qlocale.h>
3#include <qtsingleapplication.h>
4#include <QDebug>
5#include <QFile>
6#include <QObject>
7#include <QString>
8#include <QTranslator>
9#include "networkman.h"
10#include "../../../config.h"
11
12int main( int argc, char ** argv )
13{
14    QtSingleApplication a(argc, argv);
15    if (a.isRunning())
16      return !(a.sendMessage("show"));
17
18    QTranslator translator;
19    QLocale mylocale;
20    QString langCode = mylocale.name();
21    if ( ! QFile::exists(PREFIX + "/share/pcbsd/i18n/NetworkManager_" + langCode + ".qm" ) )
22      langCode.truncate(langCode.indexOf("_"));
23    translator.load( QString("NetworkManager_") + langCode, PREFIX + "/share/pcbsd/i18n/" );
24    a.installTranslator( &translator );
25    qDebug() << "Locale:" << langCode;
26
27    NetworkMan w;
28
29    w.Init();
30
31    // Are we running via the system-installer?
32    if ( argc == 2 ) {
33       QString tmp = argv[1];
34       if ( tmp == "-installer" )
35         w.setInstallerMode();
36    }
37
38    w.show();
39
40    a.connect( &a, SIGNAL( messageReceived(const QString &) ), &w, SLOT( slotSingleInstance() ) );
41    a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
42    return a.exec();
43}
Note: See TracBrowser for help on using the repository browser.