Permalink
Browse files

Update NetworkManager, now it runs via single-instance and has a '-in…

…staller' mode option,

for use during the system installer
  • Loading branch information...
1 parent ea4b713 commit c9d14007a991964944ca6e4bdc555bdbfe6cf47f @kmoore134 kmoore134 committed Aug 21, 2013
View
20 src-qt4/pc-netmanager/src/NetworkManager/main.cpp
@@ -1,14 +1,19 @@
-#include <qtranslator.h>
+#include <QApplication>
#include <qlocale.h>
+#include <qtsingleapplication.h>
#include <QDebug>
#include <QFile>
-#include <QApplication>
+#include <QObject>
+#include <QString>
+#include <QTranslator>
#include "networkman.h"
#include "../../../config.h"
int main( int argc, char ** argv )
{
- QApplication a(argc, argv);
+ QtSingleApplication a(argc, argv);
+ if (a.isRunning())
+ return !(a.sendMessage("show"));
QTranslator translator;
QLocale mylocale;
@@ -23,7 +28,16 @@ int main( int argc, char ** argv )
w.Init();
+ // Are we running via the system-installer?
+ if ( argc == 2 ) {
+ QString tmp = argv[1];
+ if ( tmp == "-installer" )
+ w.setInstallerMode();
+ }
+
w.show();
+
+ a.connect( &a, SIGNAL( messageReceived(const QString &) ), &w, SLOT( slotSingleInstance() ) );
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
return a.exec();
}
View
17 src-qt4/pc-netmanager/src/NetworkManager/networkman.cpp
@@ -33,6 +33,7 @@ using namespace std;
void NetworkMan::Init()
{
+ InstallerMode = false;
Changed = FALSE;
colourWhite = QColor(255, 255, 255);
@@ -410,7 +411,8 @@ void NetworkMan::DevSelectionChanged()
textStatus2->setText(SSID);
} else {
- checkSysTray->setVisible(TRUE);
+ if ( ! InstallerMode )
+ checkSysTray->setVisible(TRUE);
textStatusLabel2->setText(tr("MAC Address:"));
textStatus2->setText(DevsMAC[sel]);
}
@@ -1087,3 +1089,16 @@ void NetworkMan::slotIPV6DNS2Clicked()
slotCheckGlobalText();
}
}
+
+void NetworkMan::slotSingleInstance()
+{
+ this->show();
+}
+
+
+void NetworkMan::setInstallerMode()
+{
+ checkSysTray->setHidden(true);
+ groupBoxMisc->setHidden(true);
+ InstallerMode = true;
+}
View
3 src-qt4/pc-netmanager/src/NetworkManager/networkman.h
@@ -24,6 +24,7 @@ class NetworkMan : public QDialog, private Ui::NetworkMan
public slots:
void Init();
+ void setInstallerMode();
private slots:
void detectDev();
@@ -47,9 +48,11 @@ private slots:
void slotPublicDNS2Clicked();
void slotIPV6DNS1Clicked();
void slotIPV6DNS2Clicked();
+ void slotSingleInstance();
private:
+ bool InstallerMode;
QString Devs[100];
QString DevsParent[100];
QString DevsIP[100];
View
2 src-qt4/pc-netmanager/src/NetworkManager/networkman.ui
@@ -219,7 +219,7 @@
</attribute>
<layout class="QGridLayout" name="gridLayout_8">
<item row="4" column="0">
- <widget class="QGroupBox" name="groupBox">
+ <widget class="QGroupBox" name="groupBoxMisc">
<property name="title">
<string>Misc</string>
</property>

0 comments on commit c9d1400

Please sign in to comment.