From 72df64f423d579bcd2fd156e48007055faf57ca7 Mon Sep 17 00:00:00 2001 From: Niklas Date: Thu, 22 Sep 2011 13:49:46 +0200 Subject: the html gui is working now. problem solved: LogReceiver/NetworkDiscovery started to early. so javascript jquery was not usable. also put the js code into the html file. it seems that qt has a problem using the code if it is not in the html file. also implemented the fast version. if one interface is usable we now go on directly to the continue boot screen --- LogReceiver/logreceiver.cpp | 69 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 11 deletions(-) (limited to 'LogReceiver/logreceiver.cpp') diff --git a/LogReceiver/logreceiver.cpp b/LogReceiver/logreceiver.cpp index 7f573bf..011d5f3 100644 --- a/LogReceiver/logreceiver.cpp +++ b/LogReceiver/logreceiver.cpp @@ -1,4 +1,3 @@ - #include "logreceiver.h" #include "../common/fbgui.h" @@ -15,6 +14,9 @@ LogReceiver::~LogReceiver() { void LogReceiver::initAndRun(QString serverPath, QString pathToExe, QStringList* args) { + _userChoice = false; + _blocked = false; + if (serverPath != DEFAULT_QTSOCKETADDRESS) { dhcpcdArguments.append("-q"); dhcpcdArguments.append(serverPath); @@ -179,7 +181,7 @@ void LogReceiver::runDHCPCD(QString interface) { dhcpcdArguments.removeLast(); } -void LogReceiver::checkConnectivity(QString ifName) { +bool LogReceiver::checkConnectivity(QString ifName) { int metric = 0; // get gateway address @@ -197,16 +199,24 @@ void LogReceiver::checkConnectivity(QString ifName) { if (!tcpSocket->waitForConnected(500)) { qDebug() << "no internet connection with interface" << ifName; qDebug() << tcpSocket->errorString(); - emit updateStatusLabel(ifName, "connection not possible"); + emit + updateStatusLabel(ifName, "connection not possible"); + return false; } else { qDebug() << "internet: check passed! for interface" << ifName; - emit - updateStatusLabel(ifName, "connection possible"); - emit connectionEstablished(&ifConf); + emit updateStatusLabel(ifName, "connection possible"); + if (!_userChoice) { + // blockiere jeden weiteren check + // emite continueBoot + _blocked = true; + emit continueBoot(ifName); + } else { + emit connectionEstablished(&ifConf); + } + return true; } } - /** * */ @@ -346,7 +356,7 @@ void LogReceiver::handleNewInputLine(QLocalSocket * client, QString data) { emit changeProgressBarValue(interface, 80); break; case DHCPCD_EXIT: - //emit changeProgressBarValue(interface, 100); + emit changeProgressBarValue(interface, 100); break; case DHCPCD_LOG: @@ -355,7 +365,7 @@ void LogReceiver::handleNewInputLine(QLocalSocket * client, QString data) { } break; case LOG_ERR: - qDebug() << "received stat_error"; + qDebug() << "received error:" << msg; break; default: //qDebug() << logMsg; @@ -391,6 +401,7 @@ void LogReceiver::handleNewInputLine(QLocalSocket * client, QString data) { * * @see LogReceiver::getListOfNetworkInterfaces() */ +/* void LogReceiver::handleProcessFinished(int exitCode, QProcess::ExitStatus exitStatus) { QProcess* p = qobject_cast (QObject::sender()); @@ -412,8 +423,6 @@ void LogReceiver::handleProcessFinished(int exitCode, changeProgressBarValue(ifName, 100); emit updateStatusLabel(ifName, "check connectivity"); - //checkInternetConnection(ifName); - //checkInternetConnectionViaTCP(ifName); checkConnectivity(ifName); } } @@ -426,6 +435,44 @@ void LogReceiver::handleProcessFinished(int exitCode, emit allProcessesFinished(); } } +*/ +void LogReceiver::handleProcessFinished(int exitCode, + QProcess::ExitStatus exitStatus) { + + QProcess* p = qobject_cast (QObject::sender()); + QString ifName = clientProcessToIfNameMap.value(p, "ifName"); + if (!_blocked) { + if (ifName.compare("ifName") == 0) { + qDebug() + << "--- \t [LogReceiver::handleProcessFinished] haven't found process!"; + } else { + qDebug() << "process for interface" << ifName << "finished" + << exitCode << exitStatus; + if (exitCode > 0) { + qDebug() << "process exited unexpected"; + emit updateStatusLabel(ifName, "process exited unexpected"); + } else { + qDebug() << "process normal exit"; + emit changeProgressBarValue(ifName, 100); + emit updateStatusLabel(ifName, "check connectivity"); + checkConnectivity(ifName); + } + } + if (!_blocked) { + QLocalSocket *client = ifNameToClient.value(ifName, 0); + if (client != 0) { + handleNewInput(client); + } + numberOfProcesses = numberOfProcesses - 1; + if (numberOfProcesses <= 0 && _userChoice) { + emit allProcessesFinished(); + } + } + } else { + qDebug() << "already blocked"; + emit updateStatusLabel(ifName, "finished DHCP"); + } +} /** * This Method is called when a process is started. * -- cgit v1.2.3-55-g7522