###################################
Table of contents
1. Preface - Name, Prolog, Author and License
2. Files
3. Programm structure
4. Known Issues
5. Programm flow

###################################
###################################



1. Preface - Name, Prolog, Author and License

nw-test

A tool to test several network device settings and functions.
Based on an Qt gui interface and three seperate bash scripts to 
exercise to test jobs. Output will also be stored in human-readable 
text files

Build static to be available without needing further Qt librarys 
on the system to test.

Author: Nanuk Krinner <nkrinner@suse.de> for SUSE Linux Products GmbH 
        in Nuernberg

License:GPL3?


###################################
###################################


2. Files

included files:
main.cpp
\-> where everything begins

tabwidget.h
tabwidget.cpp
\-> class that manages the testing process and the specific subclasses
    also runs tests itself

gtclass.h
gtclass.cpp
\-> class to find out about the systems network devices

devtestclass.h
devtestclass.cpp
\-> class to test devices - seperate QThread

pgreadclass.h
pgreadclass.cpp
\-> reads test script output file while tests are conducted - seperate QThread


#####################################
#####################################



3. Programm structure

- Main class tabwidget is initialized in main.cpp
- Constructor sets up first gui buttons and calls Tabwidget::startuptest()
    function
- Tabwidget::startuptest() tests if needed bash scripts are available. If so
    it calls Tabwidget::createview(); if not it displays a error message

- Tabwidget::createview() shows Layout and calls Tabwidget::showstartmessage()

- Tabwidget::showstartmessage() displays start button, initial message, 
    calls Tabwidget::rungetdevicenumber

- Tabwidget::rungetdevicenumber() instantiates instantiates getterclass 
    (class Gtclass).
    getterclass ->gt_rungetdevicenumber() calls a bash script (devicefinder)
    which writes its results to devices.txt.
    The function calls Tabwidget::getdevicenumber() via connect(...).

- Tabwidget::getdevicenumbe() Sets global variable i_ndevices, which stores 
    the number of network devices the system has to null. Then reads the 
    file devices.txt where the devices names are saved. The device names are 
    stored in the Qstring array namestring[i_ndevices]. For every device 
    i_ndevices gets increased by one. When this is done Tabwidget::runtests()
    is called.

- Tabwidget::runtests()
    Defines the step size of the progressbar changes in the variable 
    i_pgstepsize. Instantiates the classes devtester (class Devtestclass) 
    and pgreader (Pgreadclass).
    devtester manages the test of certain devices (using a bash script) and 
    writes the results to a textfile (nw-test-<devicename>). pgreader reads
    the output of the devtester and updates the progressbar whenever the size
    of nw-test-<devicename> changes.
    devtester and pgreader both take as arguments the number of devices a 
    system has (i_ndevices), the QString array with the names of the network
    devices as pointers.
    devtester and pgreader run in separate Threads to avoid programm freezes 
    while QProcess runs.
    In the end Tabwidget::parseorganizer gets called which manages the tests 
    of the devices.

- Tabwidget::parseorganizer()
    Gets called fron Tabwidget::runtests() and via Devtestclass::dt_runtest()
    by a connector located in Tabwidget::runtests(). Tells pgreader instance
    of Pgreaderclass which device is currently tested (via variable 
    i_nextdevice) and hence which file to monitor. 
    Starts Tabwidget::parsetimer(), which controls the tme intervalls of the 
    output file size change checks.  
    When all devices are tested Tabwidget::gettests() gets called. 

- Tabwidget::parsetimer()
    Controls the time intervals of the device test output file 
    the connector calls Tabwidget::parsedvicefile everytime is to be 
    conducted.

- Tabwidget::parsedevicefile()
    This thread starts a file size comparison test.
    If the size change of the device test output file was detected, the 
    progressbar is raised by the connector via Tabwidget::raisepgbar().

- Tabwidget::raisepgbar()
    Raises the progressbar whenever it is called. The amount of the raise 
    depends on the number of network devices and is calculated earlier in 
    Tabwidget::runtests() and stored in the int variable i_pgstepsize.

-Tabwidget::gettests()
    Gets called after the devicetest process is finished that is initiated by
    Tabwidget::runtests() and done by Tabwidget::parseorganiser(), and the 
    functions responsible fr the progressbar movement.
    The function reads the device test output files and stores the content of
    each file in a separate QTextEdit textfield[i]. The textfield[i] are 
    associated to a QWidget tab[i], and the tab[i] are associaiated to 
    QTabWidget instance tabwindow.
    Then the programm proceeds to Tabwidget::testdevicelessfunction()
 
- Tabwidget::testdevicelessfunction()
    Runs the bash script 'devicelesstest' which conducts network setting 
    tests that don't rely on a network interface (e.g.if a nfs mount is 
    available. 
    When finished it calls Tabwidget::getdeviceless().


- Tabwidget::getdeviceless()
    Reads to output of the testdevicelessfunction into a separate textwindow 
    and tab.
    Calls Tabwidget::createtabs() afterwards.

- Tabwidget::createtabs()
    Deletes the initial start message, progressbar and displays the test 
    results plus the Rerun and the Quit buttons

- Tabwidget::initiatererun()
    Resets gui, shows a rerun message. 
    Starts testing process again via calling Tabwidget::rungetdevicenumber()


###################################
###################################



4. Known issues

- Progress bar development is not optimal - as output per device is generated 
 in basically two big steps, there is onlz one event that triggers progressbar 
 movement. This should be improved. Idea: Use the ping events of the bash 
 script to initiate progress bar movement.

- Once encounterd a bug: When number of detected devices changed during runtime,
 devicetest froze. Bug was not reproducable so far. A simple program restart 
 should fix the issue anyway.


###################################
###################################



5. Programm flow

There are only 2 buttons - rerun and quit. Rather self-explaining.
The programm runs a number of bash scripts which write their output to text 
files. The output is displayed by the program. The bash files can be run on 
their own too, without using the GUI.

