Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Update NetworkManager, now it runs via single-instance and has a '-in…
…staller' mode option,

for use during the system installer
  • Loading branch information
Kris Moore committed Aug 21, 2013
1 parent ea4b713 commit c9d1400
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
20 changes: 17 additions & 3 deletions 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;
Expand All @@ -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();
}
17 changes: 16 additions & 1 deletion src-qt4/pc-netmanager/src/NetworkManager/networkman.cpp
Expand Up @@ -33,6 +33,7 @@ using namespace std;

void NetworkMan::Init()
{
InstallerMode = false;
Changed = FALSE;

colourWhite = QColor(255, 255, 255);
Expand Down Expand Up @@ -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]);
}
Expand Down Expand Up @@ -1087,3 +1089,16 @@ void NetworkMan::slotIPV6DNS2Clicked()
slotCheckGlobalText();
}
}

void NetworkMan::slotSingleInstance()
{
this->show();
}


void NetworkMan::setInstallerMode()
{
checkSysTray->setHidden(true);
groupBoxMisc->setHidden(true);
InstallerMode = true;
}
3 changes: 3 additions & 0 deletions src-qt4/pc-netmanager/src/NetworkManager/networkman.h
Expand Up @@ -24,6 +24,7 @@ class NetworkMan : public QDialog, private Ui::NetworkMan

public slots:
void Init();
void setInstallerMode();

private slots:
void detectDev();
Expand All @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion src-qt4/pc-netmanager/src/NetworkManager/networkman.ui
Expand Up @@ -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>
Expand Down

0 comments on commit c9d1400

Please sign in to comment.