From 4e1b9faba7503f99ee2fbcd7458f66ade42fa309 Mon Sep 17 00:00:00 2001 From: Niklas Date: Thu, 1 Sep 2011 09:31:39 +0200 Subject: tried to clean the git. deleted old unused files and folders. moved customdhcpcd and LogReceiver to the fbgui folder --- LogReceiver/LogReceiver | Bin 0 -> 122376 bytes LogReceiver/LogReceiver.pro | 19 ++ LogReceiver/Makefile | 278 +++++++++++++++++++++ LogReceiver/Makefile.Debug | 178 ++++++++++++++ LogReceiver/Makefile.Release | 178 ++++++++++++++ LogReceiver/abortbootdialog.cpp | 98 ++++++++ LogReceiver/abortbootdialog.h | 46 ++++ LogReceiver/chooseinterfacedialog.cpp | 98 ++++++++ LogReceiver/chooseinterfacedialog.h | 44 ++++ LogReceiver/logreceiver.cpp | 448 ++++++++++++++++++++++++++++++++++ LogReceiver/logreceiver.h | 74 ++++++ LogReceiver/logreceiver.ui | 25 ++ LogReceiver/main.cpp | 12 + LogReceiver/ndgui.cpp | 184 ++++++++++++++ LogReceiver/ndgui.h | 67 +++++ LogReceiver/ndgui.ui | 19 ++ 16 files changed, 1768 insertions(+) create mode 100755 LogReceiver/LogReceiver create mode 100644 LogReceiver/LogReceiver.pro create mode 100644 LogReceiver/Makefile create mode 100644 LogReceiver/Makefile.Debug create mode 100644 LogReceiver/Makefile.Release create mode 100644 LogReceiver/abortbootdialog.cpp create mode 100644 LogReceiver/abortbootdialog.h create mode 100644 LogReceiver/chooseinterfacedialog.cpp create mode 100644 LogReceiver/chooseinterfacedialog.h create mode 100644 LogReceiver/logreceiver.cpp create mode 100644 LogReceiver/logreceiver.h create mode 100644 LogReceiver/logreceiver.ui create mode 100644 LogReceiver/main.cpp create mode 100644 LogReceiver/ndgui.cpp create mode 100644 LogReceiver/ndgui.h create mode 100644 LogReceiver/ndgui.ui (limited to 'LogReceiver') diff --git a/LogReceiver/LogReceiver b/LogReceiver/LogReceiver new file mode 100755 index 0000000..a16897b Binary files /dev/null and b/LogReceiver/LogReceiver differ diff --git a/LogReceiver/LogReceiver.pro b/LogReceiver/LogReceiver.pro new file mode 100644 index 0000000..19300fa --- /dev/null +++ b/LogReceiver/LogReceiver.pro @@ -0,0 +1,19 @@ +TEMPLATE = app +TARGET = LogReceiver +QT += core \ + gui \ + network +LIBS += -lsysfs +INCLUDEPATH += ../customdhcpcd/src +HEADERS += ndgui.h \ + logreceiver.h \ + abortbootdialog.h \ + chooseinterfacedialog.h +SOURCES += ndgui.cpp \ + main.cpp \ + logreceiver.cpp \ + abortbootdialog.cpp \ + chooseinterfacedialog.cpp +FORMS += ndgui.ui \ + logreceiver.ui +RESOURCES += diff --git a/LogReceiver/Makefile b/LogReceiver/Makefile new file mode 100644 index 0000000..cd541af --- /dev/null +++ b/LogReceiver/Makefile @@ -0,0 +1,278 @@ +############################################################################# +# Makefile for building: LogReceiver +# Generated by qmake (2.01a) (Qt 4.7.2) on: Wed Aug 24 10:11:58 2011 +# Project: LogReceiver.pro +# Template: app +# Command: /usr/local/Trolltech/QtEmbedded-4.7.2/bin/qmake -o Makefile LogReceiver.pro +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) +CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) +INCPATH = -I/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/qws/linux-x86-g++ -I. -I/usr/local/Trolltech/QtEmbedded-4.7.2/include/QtCore -I/usr/local/Trolltech/QtEmbedded-4.7.2/include/QtNetwork -I/usr/local/Trolltech/QtEmbedded-4.7.2/include/QtGui -I/usr/local/Trolltech/QtEmbedded-4.7.2/include -I../customdhcpcd/src -I. -I. +LINK = g++ +LFLAGS = -Wl,-O1 -Wl,-rpath,/usr/local/Trolltech/QtEmbedded-4.7.2/lib +LIBS = $(SUBLIBS) -L/usr/local/Trolltech/QtEmbedded-4.7.2/lib -lsysfs -lQtGui -L/usr/local/Trolltech/QtEmbedded-4.7.2/lib -lQtNetwork -lQtCore -lpthread +AR = ar cqs +RANLIB = +QMAKE = /usr/local/Trolltech/QtEmbedded-4.7.2/bin/qmake +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -r +STRIP = strip +INSTALL_FILE = install -m 644 -p +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = install -m 755 -p +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = ./ + +####### Files + +SOURCES = ndgui.cpp \ + main.cpp \ + logreceiver.cpp \ + abortbootdialog.cpp \ + chooseinterfacedialog.cpp moc_ndgui.cpp \ + moc_logreceiver.cpp \ + moc_abortbootdialog.cpp \ + moc_chooseinterfacedialog.cpp +OBJECTS = ndgui.o \ + main.o \ + logreceiver.o \ + abortbootdialog.o \ + chooseinterfacedialog.o \ + moc_ndgui.o \ + moc_logreceiver.o \ + moc_abortbootdialog.o \ + moc_chooseinterfacedialog.o +DIST = /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/common/g++.conf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/common/unix.conf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/common/linux.conf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/common/qws.conf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/qconfig.pri \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/modules/qt_webkit_version.pri \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/qt_functions.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/qt_config.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/exclusive_builds.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/default_pre.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/release.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/default_post.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/warn_on.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/qt.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/unix/thread.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/moc.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/resources.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/uic.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/yacc.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/lex.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/include_source_dir.prf \ + LogReceiver.pro +QMAKE_TARGET = LogReceiver +DESTDIR = +TARGET = LogReceiver + +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile $(TARGET) + +$(TARGET): ui_ndgui.h ui_logreceiver.h $(OBJECTS) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) + +Makefile: LogReceiver.pro /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/qws/linux-x86-g++/qmake.conf /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/common/g++.conf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/common/unix.conf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/common/linux.conf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/common/qws.conf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/qconfig.pri \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/modules/qt_webkit_version.pri \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/qt_functions.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/qt_config.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/exclusive_builds.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/default_pre.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/release.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/default_post.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/warn_on.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/qt.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/unix/thread.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/moc.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/resources.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/uic.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/yacc.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/lex.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/include_source_dir.prf \ + /usr/local/Trolltech/QtEmbedded-4.7.2/lib/libQtGui.prl \ + /usr/local/Trolltech/QtEmbedded-4.7.2/lib/libQtNetwork.prl \ + /usr/local/Trolltech/QtEmbedded-4.7.2/lib/libQtCore.prl + $(QMAKE) -o Makefile LogReceiver.pro +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/common/g++.conf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/common/unix.conf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/common/linux.conf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/common/qws.conf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/qconfig.pri: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/modules/qt_webkit_version.pri: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/qt_functions.prf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/qt_config.prf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/exclusive_builds.prf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/default_pre.prf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/release.prf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/default_post.prf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/warn_on.prf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/qt.prf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/unix/thread.prf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/moc.prf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/resources.prf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/uic.prf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/yacc.prf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/lex.prf: +/usr/local/Trolltech/QtEmbedded-4.7.2/mkspecs/features/include_source_dir.prf: +/usr/local/Trolltech/QtEmbedded-4.7.2/lib/libQtGui.prl: +/usr/local/Trolltech/QtEmbedded-4.7.2/lib/libQtNetwork.prl: +/usr/local/Trolltech/QtEmbedded-4.7.2/lib/libQtCore.prl: +qmake: FORCE + @$(QMAKE) -o Makefile LogReceiver.pro + +dist: + @$(CHK_DIR_EXISTS) .tmp/LogReceiver1.0.0 || $(MKDIR) .tmp/LogReceiver1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/LogReceiver1.0.0/ && $(COPY_FILE) --parents ndgui.h logreceiver.h abortbootdialog.h chooseinterfacedialog.h .tmp/LogReceiver1.0.0/ && $(COPY_FILE) --parents ndgui.cpp main.cpp logreceiver.cpp abortbootdialog.cpp chooseinterfacedialog.cpp .tmp/LogReceiver1.0.0/ && $(COPY_FILE) --parents ndgui.ui logreceiver.ui .tmp/LogReceiver1.0.0/ && (cd `dirname .tmp/LogReceiver1.0.0` && $(TAR) LogReceiver1.0.0.tar LogReceiver1.0.0 && $(COMPRESS) LogReceiver1.0.0.tar) && $(MOVE) `dirname .tmp/LogReceiver1.0.0`/LogReceiver1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/LogReceiver1.0.0 + + +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile + + +check: first + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +compiler_moc_header_make_all: moc_ndgui.cpp moc_logreceiver.cpp moc_abortbootdialog.cpp moc_chooseinterfacedialog.cpp +compiler_moc_header_clean: + -$(DEL_FILE) moc_ndgui.cpp moc_logreceiver.cpp moc_abortbootdialog.cpp moc_chooseinterfacedialog.cpp +moc_ndgui.cpp: ui_ndgui.h \ + logreceiver.h \ + chooseinterfacedialog.h \ + abortbootdialog.h \ + ndgui.h + /usr/local/Trolltech/QtEmbedded-4.7.2/bin/moc $(DEFINES) $(INCPATH) ndgui.h -o moc_ndgui.cpp + +moc_logreceiver.cpp: logreceiver.h + /usr/local/Trolltech/QtEmbedded-4.7.2/bin/moc $(DEFINES) $(INCPATH) logreceiver.h -o moc_logreceiver.cpp + +moc_abortbootdialog.cpp: abortbootdialog.h + /usr/local/Trolltech/QtEmbedded-4.7.2/bin/moc $(DEFINES) $(INCPATH) abortbootdialog.h -o moc_abortbootdialog.cpp + +moc_chooseinterfacedialog.cpp: chooseinterfacedialog.h + /usr/local/Trolltech/QtEmbedded-4.7.2/bin/moc $(DEFINES) $(INCPATH) chooseinterfacedialog.h -o moc_chooseinterfacedialog.cpp + +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: ui_ndgui.h ui_logreceiver.h +compiler_uic_clean: + -$(DEL_FILE) ui_ndgui.h ui_logreceiver.h +ui_ndgui.h: ndgui.ui + /usr/local/Trolltech/QtEmbedded-4.7.2/bin/uic ndgui.ui -o ui_ndgui.h + +ui_logreceiver.h: logreceiver.ui + /usr/local/Trolltech/QtEmbedded-4.7.2/bin/uic logreceiver.ui -o ui_logreceiver.h + +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_header_clean compiler_uic_clean + +####### Compile + +ndgui.o: ndgui.cpp ndgui.h \ + ui_ndgui.h \ + logreceiver.h \ + chooseinterfacedialog.h \ + abortbootdialog.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ndgui.o ndgui.cpp + +main.o: main.cpp ndgui.h \ + ui_ndgui.h \ + logreceiver.h \ + chooseinterfacedialog.h \ + abortbootdialog.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp + +logreceiver.o: logreceiver.cpp logreceiver.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o logreceiver.o logreceiver.cpp + +abortbootdialog.o: abortbootdialog.cpp abortbootdialog.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o abortbootdialog.o abortbootdialog.cpp + +chooseinterfacedialog.o: chooseinterfacedialog.cpp chooseinterfacedialog.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o chooseinterfacedialog.o chooseinterfacedialog.cpp + +moc_ndgui.o: moc_ndgui.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_ndgui.o moc_ndgui.cpp + +moc_logreceiver.o: moc_logreceiver.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_logreceiver.o moc_logreceiver.cpp + +moc_abortbootdialog.o: moc_abortbootdialog.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_abortbootdialog.o moc_abortbootdialog.cpp + +moc_chooseinterfacedialog.o: moc_chooseinterfacedialog.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_chooseinterfacedialog.o moc_chooseinterfacedialog.cpp + +####### Install + +install: FORCE + +uninstall: FORCE + +FORCE: + diff --git a/LogReceiver/Makefile.Debug b/LogReceiver/Makefile.Debug new file mode 100644 index 0000000..29db2ad --- /dev/null +++ b/LogReceiver/Makefile.Debug @@ -0,0 +1,178 @@ +############################################################################# +# Makefile for building: LogReceiver +# Generated by qmake (2.01a) (Qt 4.7.2) on: Wed Jul 6 13:39:02 2011 +# Project: LogReceiver.pro +# Template: app +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES) +CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES) +INCPATH = -I/usr/local/Trolltech/Qt-4.7.2/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.7.2/include/QtCore -I/usr/local/Trolltech/Qt-4.7.2/include/QtNetwork -I/usr/local/Trolltech/Qt-4.7.2/include/QtGui -I/usr/local/Trolltech/Qt-4.7.2/include -Idebug -I. +LINK = g++ +LFLAGS = -Wl,-rpath,/usr/local/Trolltech/Qt-4.7.2/lib +LIBS = $(SUBLIBS) -L/usr/local/Trolltech/Qt-4.7.2/lib -lQtGui -L/usr/local/Trolltech/Qt-4.7.2/lib -L/usr/X11R6/lib -lQtNetwork -lQtCore -lpthread +AR = ar cqs +RANLIB = +QMAKE = /usr/local/Trolltech/Qt-4.7.2/bin/qmake +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -r +STRIP = strip +INSTALL_FILE = install -m 644 -p +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = install -m 755 -p +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = debug/ + +####### Files + +SOURCES = main.cpp \ + logreceiver.cpp debug/moc_logreceiver.cpp +OBJECTS = debug/main.o \ + debug/logreceiver.o \ + debug/moc_logreceiver.o +DIST = /usr/local/Trolltech/Qt-4.7.2/mkspecs/common/g++.conf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/common/unix.conf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/common/linux.conf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/qconfig.pri \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/modules/qt_webkit_version.pri \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/qt_functions.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/qt_config.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/exclusive_builds.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/default_pre.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/debug.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/debug_and_release.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/default_post.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/build_pass.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/warn_on.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/qt.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/unix/thread.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/moc.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/resources.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/uic.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/yacc.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/lex.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/include_source_dir.prf \ + LogReceiver.pro +QMAKE_TARGET = LogReceiver +DESTDIR = +TARGET = LogReceiver + +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile.Debug $(TARGET) + +$(TARGET): ui_logreceiver.h $(OBJECTS) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) + +qmake: FORCE + @$(QMAKE) CONFIG+=debug_and_release -o Makefile.Debug LogReceiver.pro + +dist: + @$(CHK_DIR_EXISTS) debug/LogReceiver1.0.0 || $(MKDIR) debug/LogReceiver1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) debug/LogReceiver1.0.0/ && $(COPY_FILE) --parents logreceiver.h debug/LogReceiver1.0.0/ && $(COPY_FILE) --parents main.cpp logreceiver.cpp debug/LogReceiver1.0.0/ && $(COPY_FILE) --parents logreceiver.ui debug/LogReceiver1.0.0/ && (cd `dirname debug/LogReceiver1.0.0` && $(TAR) LogReceiver1.0.0.tar LogReceiver1.0.0 && $(COMPRESS) LogReceiver1.0.0.tar) && $(MOVE) `dirname debug/LogReceiver1.0.0`/LogReceiver1.0.0.tar.gz . && $(DEL_FILE) -r debug/LogReceiver1.0.0 + + +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile.Debug + + +check: first + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +compiler_moc_header_make_all: debug/moc_logreceiver.cpp +compiler_moc_header_clean: + -$(DEL_FILE) debug/moc_logreceiver.cpp +debug/moc_logreceiver.cpp: ui_logreceiver.h \ + logreceiver.h + /usr/local/Trolltech/Qt-4.7.2/bin/moc $(DEFINES) $(INCPATH) logreceiver.h -o debug/moc_logreceiver.cpp + +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: ui_logreceiver.h +compiler_uic_clean: + -$(DEL_FILE) ui_logreceiver.h +ui_logreceiver.h: logreceiver.ui + /usr/local/Trolltech/Qt-4.7.2/bin/uic logreceiver.ui -o ui_logreceiver.h + +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_header_clean compiler_uic_clean + +####### Compile + +debug/main.o: main.cpp logreceiver.h \ + ui_logreceiver.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/main.o main.cpp + +debug/logreceiver.o: logreceiver.cpp logreceiver.h \ + ui_logreceiver.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/logreceiver.o logreceiver.cpp + +debug/moc_logreceiver.o: debug/moc_logreceiver.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/moc_logreceiver.o debug/moc_logreceiver.cpp + +####### Install + +install: FORCE + +uninstall: FORCE + +FORCE: + diff --git a/LogReceiver/Makefile.Release b/LogReceiver/Makefile.Release new file mode 100644 index 0000000..64e6a9f --- /dev/null +++ b/LogReceiver/Makefile.Release @@ -0,0 +1,178 @@ +############################################################################# +# Makefile for building: LogReceiver +# Generated by qmake (2.01a) (Qt 4.7.2) on: Wed Jul 6 13:39:02 2011 +# Project: LogReceiver.pro +# Template: app +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) +CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) +INCPATH = -I/usr/local/Trolltech/Qt-4.7.2/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.7.2/include/QtCore -I/usr/local/Trolltech/Qt-4.7.2/include/QtNetwork -I/usr/local/Trolltech/Qt-4.7.2/include/QtGui -I/usr/local/Trolltech/Qt-4.7.2/include -Irelease -I. +LINK = g++ +LFLAGS = -Wl,-O1 -Wl,-rpath,/usr/local/Trolltech/Qt-4.7.2/lib +LIBS = $(SUBLIBS) -L/usr/local/Trolltech/Qt-4.7.2/lib -lQtGui -L/usr/local/Trolltech/Qt-4.7.2/lib -L/usr/X11R6/lib -lQtNetwork -lQtCore -lpthread +AR = ar cqs +RANLIB = +QMAKE = /usr/local/Trolltech/Qt-4.7.2/bin/qmake +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -r +STRIP = strip +INSTALL_FILE = install -m 644 -p +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = install -m 755 -p +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = release/ + +####### Files + +SOURCES = main.cpp \ + logreceiver.cpp release/moc_logreceiver.cpp +OBJECTS = release/main.o \ + release/logreceiver.o \ + release/moc_logreceiver.o +DIST = /usr/local/Trolltech/Qt-4.7.2/mkspecs/common/g++.conf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/common/unix.conf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/common/linux.conf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/qconfig.pri \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/modules/qt_webkit_version.pri \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/qt_functions.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/qt_config.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/exclusive_builds.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/default_pre.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/release.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/debug_and_release.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/default_post.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/build_pass.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/warn_on.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/qt.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/unix/thread.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/moc.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/resources.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/uic.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/yacc.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/lex.prf \ + /usr/local/Trolltech/Qt-4.7.2/mkspecs/features/include_source_dir.prf \ + LogReceiver.pro +QMAKE_TARGET = LogReceiver +DESTDIR = +TARGET = LogReceiver + +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile.Release $(TARGET) + +$(TARGET): ui_logreceiver.h $(OBJECTS) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) + +qmake: FORCE + @$(QMAKE) CONFIG+=debug_and_release -o Makefile.Release LogReceiver.pro + +dist: + @$(CHK_DIR_EXISTS) release/LogReceiver1.0.0 || $(MKDIR) release/LogReceiver1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) release/LogReceiver1.0.0/ && $(COPY_FILE) --parents logreceiver.h release/LogReceiver1.0.0/ && $(COPY_FILE) --parents main.cpp logreceiver.cpp release/LogReceiver1.0.0/ && $(COPY_FILE) --parents logreceiver.ui release/LogReceiver1.0.0/ && (cd `dirname release/LogReceiver1.0.0` && $(TAR) LogReceiver1.0.0.tar LogReceiver1.0.0 && $(COMPRESS) LogReceiver1.0.0.tar) && $(MOVE) `dirname release/LogReceiver1.0.0`/LogReceiver1.0.0.tar.gz . && $(DEL_FILE) -r release/LogReceiver1.0.0 + + +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile.Release + + +check: first + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +compiler_moc_header_make_all: release/moc_logreceiver.cpp +compiler_moc_header_clean: + -$(DEL_FILE) release/moc_logreceiver.cpp +release/moc_logreceiver.cpp: ui_logreceiver.h \ + logreceiver.h + /usr/local/Trolltech/Qt-4.7.2/bin/moc $(DEFINES) $(INCPATH) logreceiver.h -o release/moc_logreceiver.cpp + +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: ui_logreceiver.h +compiler_uic_clean: + -$(DEL_FILE) ui_logreceiver.h +ui_logreceiver.h: logreceiver.ui + /usr/local/Trolltech/Qt-4.7.2/bin/uic logreceiver.ui -o ui_logreceiver.h + +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_header_clean compiler_uic_clean + +####### Compile + +release/main.o: main.cpp logreceiver.h \ + ui_logreceiver.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/main.o main.cpp + +release/logreceiver.o: logreceiver.cpp logreceiver.h \ + ui_logreceiver.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/logreceiver.o logreceiver.cpp + +release/moc_logreceiver.o: release/moc_logreceiver.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/moc_logreceiver.o release/moc_logreceiver.cpp + +####### Install + +install: FORCE + +uninstall: FORCE + +FORCE: + diff --git a/LogReceiver/abortbootdialog.cpp b/LogReceiver/abortbootdialog.cpp new file mode 100644 index 0000000..1614f6b --- /dev/null +++ b/LogReceiver/abortbootdialog.cpp @@ -0,0 +1,98 @@ +#include + +#include "abortbootdialog.h" + +AbortBootDialog::AbortBootDialog(QWidget *parent) : + QDialog(parent) +{ + oneMinuteCountdown = 60; + + createContentGroupBox(); + createButtonGroupBox(); + + createTimer(); + + mainLayout = new QVBoxLayout; + mainLayout->addWidget(contentGroupBox); + mainLayout->addWidget(buttonGroupBox); + + setLayout(mainLayout); + setWindowTitle(tr("Abort Boot")); +} +void AbortBootDialog::createContentGroupBox() +{ + contentGroupBox = new QGroupBox; + timerLabel = new QLabel(QString::number(oneMinuteCountdown)); + QHBoxLayout *layout = new QHBoxLayout; + + + layout->addWidget(new QLabel(tr("test"))); + layout->addWidget(timerLabel); + contentGroupBox->setLayout(layout); +} + +void AbortBootDialog::createButtonGroupBox() +{ + buttonGroupBox = new QGroupBox; + QHBoxLayout *layout = new QHBoxLayout; + + QPushButton *shutDownButton = new QPushButton(tr("Shut Down")); + shutDownButton->setDefault(true); + QPushButton *restartButton = new QPushButton(tr("Restart")); + restartButton->setAutoDefault(false); + QPushButton *showLogButton = new QPushButton(tr("Show Log")); + showLogButton->setAutoDefault(false); + + connect(showLogButton, SIGNAL(clicked()),this, SLOT(showLogButtonClicked())); + connect(shutDownButton, SIGNAL(clicked()), this, SLOT(shutDownButtonClicked())); + connect(restartButton, SIGNAL(clicked()), this, SLOT(restartButtonClicked())); + + layout->addWidget(showLogButton); + layout->addWidget(restartButton); + layout->addWidget(shutDownButton); + buttonGroupBox->setLayout(layout); +} + +void AbortBootDialog::createTimer() +{ + timer = new QTimer(this); + connect(timer, SIGNAL(timeout()),this, SLOT(timerLabelUpdate())); + timer->start(1000); +} + +void AbortBootDialog::showLogButtonClicked() +{ + qDebug() << "show log button clicked"; + emit showLogSignal(); +} + +void AbortBootDialog::shutDownButtonClicked() +{ + qDebug() << "shut down button clicked"; + emit shutDownSignal(); +} + +void AbortBootDialog::restartButtonClicked() +{ + qDebug() << "restart button clicked"; + emit restartSignal(); +} + +void AbortBootDialog::timerLabelUpdate() +{ + oneMinuteCountdown = oneMinuteCountdown -1; + timerLabel->setText(QString::number(oneMinuteCountdown)); + if(oneMinuteCountdown <= 0) + { + timer->stop(); + emit shutDownSignal(); + } + +} + +void AbortBootDialog::closeDialog() +{ + this->hide(); + this->killTimer(timer->timerId()); + this->close(); +} diff --git a/LogReceiver/abortbootdialog.h b/LogReceiver/abortbootdialog.h new file mode 100644 index 0000000..157331b --- /dev/null +++ b/LogReceiver/abortbootdialog.h @@ -0,0 +1,46 @@ +#ifndef ABORTBOOTDIALOG_H +#define ABORTBOOTDIALOG_H + +#include +#include "qboxlayout.h" +#include "qgroupbox.h" +#include "qcombobox.h" +#include "qlabel.h" + + +class AbortBootDialog : public QDialog +{ + Q_OBJECT +public: + explicit AbortBootDialog(QWidget *parent = 0); + + void closeDialog(); +private slots: + void showLogButtonClicked(); + void shutDownButtonClicked(); + void restartButtonClicked(); + void timerLabelUpdate(); + +private: + QVBoxLayout *mainLayout; + QGroupBox *contentGroupBox; + QGroupBox *buttonGroupBox; + QLabel *timerLabel; + QTimer *timer; + int oneMinuteCountdown; + + void createContentGroupBox(); + void createButtonGroupBox(); + void createTimer(); + + +signals: + void showLogSignal(); + void shutDownSignal(); + void restartSignal(); + +public slots: + +}; + +#endif // ABORTBOOTDIALOG_H diff --git a/LogReceiver/chooseinterfacedialog.cpp b/LogReceiver/chooseinterfacedialog.cpp new file mode 100644 index 0000000..b7a37e8 --- /dev/null +++ b/LogReceiver/chooseinterfacedialog.cpp @@ -0,0 +1,98 @@ +#include + +#include "chooseinterfacedialog.h" + +ChooseInterfaceDialog::ChooseInterfaceDialog(QStringList &interfaces, QWidget *parent) : + QDialog(parent) +{ + oneMinuteCountdown = 60; + + createContentGroupBox(interfaces); + createButtonGroupBox(); + + createTimer(); + + mainLayout = new QVBoxLayout; + mainLayout->addWidget(contentGroupBox); + mainLayout->addWidget(buttonGroupBox); + + setLayout(mainLayout); + setWindowTitle(tr("Choose Interface")); +} + +void ChooseInterfaceDialog::createContentGroupBox(QStringList &interfaces) +{ + contentGroupBox = new QGroupBox; + timerLabel = new QLabel(QString::number(oneMinuteCountdown)); + QVBoxLayout *groupBoxLayout = new QVBoxLayout; + QHBoxLayout *layout = new QHBoxLayout; + + comboBox = new QComboBox; + comboBox->addItems(interfaces); + + layout->addWidget(new QLabel(tr("test"))); + layout->addWidget(comboBox); + + groupBoxLayout->addWidget(timerLabel); + groupBoxLayout->addLayout(layout); + contentGroupBox->setLayout(groupBoxLayout); +} + +void ChooseInterfaceDialog::createButtonGroupBox() +{ + buttonGroupBox = new QGroupBox; + QHBoxLayout *layout = new QHBoxLayout; + + QPushButton *continueButton = new QPushButton(tr("Continue")); + continueButton->setDefault(true); + QPushButton *shutDownButton = new QPushButton(tr("Shut Down")); + shutDownButton->setAutoDefault(false); + QPushButton *restartButton = new QPushButton(tr("Restart")); + restartButton->setAutoDefault(false); + + connect(continueButton, SIGNAL(clicked()),this, SLOT(continueButtonClicked())); + connect(shutDownButton, SIGNAL(clicked()), this, SLOT(shutDownButtonClicked())); + connect(restartButton, SIGNAL(clicked()), this, SLOT(restartButtonClicked())); + + layout->addWidget(restartButton); + layout->addWidget(shutDownButton); + layout->addWidget(continueButton); + buttonGroupBox->setLayout(layout); +} + +void ChooseInterfaceDialog::createTimer() +{ + timer = new QTimer(this); + connect(timer, SIGNAL(timeout()),this, SLOT(timerLabelUpdate())); + timer->start(1000); +} + +void ChooseInterfaceDialog::continueButtonClicked() +{ + qDebug() << "continue button clicked"; + emit continueSignal(comboBox->currentText()); +} + +void ChooseInterfaceDialog::shutDownButtonClicked() +{ + qDebug() << "shut down button clicked"; + emit shutDownSignal(); +} + +void ChooseInterfaceDialog::restartButtonClicked() +{ + qDebug() << "restart button clicked"; + emit restartSignal(); +} + +void ChooseInterfaceDialog::timerLabelUpdate() +{ + oneMinuteCountdown = oneMinuteCountdown -1; + timerLabel->setText(QString::number(oneMinuteCountdown)); + if(oneMinuteCountdown <= 0) + { + timer->stop(); + emit continueSignal(comboBox->currentText()); + } + +} diff --git a/LogReceiver/chooseinterfacedialog.h b/LogReceiver/chooseinterfacedialog.h new file mode 100644 index 0000000..48ee038 --- /dev/null +++ b/LogReceiver/chooseinterfacedialog.h @@ -0,0 +1,44 @@ +#ifndef CHOOSEINTERFACEDIALOG_H +#define CHOOSEINTERFACEDIALOG_H + +#include +#include "qboxlayout.h" +#include "qgroupbox.h" +#include "qcombobox.h" +#include "qlabel.h" + +class ChooseInterfaceDialog : public QDialog +{ + Q_OBJECT +public: + explicit ChooseInterfaceDialog(QStringList &interfaces, QWidget *parent = 0); +private slots: + void continueButtonClicked(); + void shutDownButtonClicked(); + void restartButtonClicked(); + void timerLabelUpdate(); + +private: + QVBoxLayout *mainLayout; + QGroupBox *contentGroupBox; + QGroupBox *buttonGroupBox; + QComboBox *comboBox; + QLabel *timerLabel; + QTimer *timer; + int oneMinuteCountdown; + + void createContentGroupBox(QStringList &interfaces); + void createButtonGroupBox(); + void createTimer(); + +signals: + void continueSignal(QString ifName); + void shutDownSignal(); + void restartSignal(); + + +public slots: + +}; + +#endif // CHOOSEINTERFACEDIALOG_H diff --git a/LogReceiver/logreceiver.cpp b/LogReceiver/logreceiver.cpp new file mode 100644 index 0000000..802f442 --- /dev/null +++ b/LogReceiver/logreceiver.cpp @@ -0,0 +1,448 @@ +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "logreceiver.h" +#include +#include +#include "status.h" +#include "dhcp.h" + +LogReceiver::LogReceiver() { + + server = new QLocalServer(this); +} + +LogReceiver::~LogReceiver() { + +} + +void LogReceiver::initAndRun(QString serverPath, QString pathToExe, + QStringList* args) { + + if (serverPath != DEFAULT_QTSOCKETADDRESS) { + dhcpcdArguments.append("-q"); + dhcpcdArguments.append(serverPath); + } + if (!server->listen(serverPath)) { + /* + QMessageBox::critical(this, tr("LogReceiver"), tr( + "Unable to start the server: %1.") .arg(server->errorString())); + close(); + */ + // emit signal to the gui that a critial error occoured + QString errorInfo("Unable to start server: "); + qDebug() << "--- \t [LogReceiver::initAndRun] " + errorInfo + << server->errorString(); + emit + abortBoot(errorInfo + server->errorString()); + return; + } + + connect(server, SIGNAL(newConnection()), this, SLOT(handleNewConnection())); + + pathToDhcpcdExe = pathToExe; + // check if the path to the customdhcpcd file is correct + QFileInfo fInfo(pathToDhcpcdExe); + if (!fInfo.exists()) { + qDebug() + << "couldn't find customdhcpcd exe. Please check the path to this file."; + emit + abortBoot( + "couldn't find customdhcpcd exe. Please check the path to this file."); + return; + } + + if (args != NULL && !args->isEmpty()) { + qDebug() << "--- \t [LogReceiver::initAndRun] added additional args"; + dhcpcdArguments.append(*args); + } + + numberOfProcesses = 0; + + // start the main work: + + QList list = getListOfNetworkInterfaces(); + + if (list.size() > 0) { + + //list = checkCarrierState(list); + + + //dhcpcdArguments.append("-d"); + QString ifName("eth0"); + numberOfProcesses = list.size(); + runDHCPCD(list); + } else { + qDebug() << "list is empty. Haven't found usable interface."; + emit + abortBoot("Haven't found usable interface"); + return; + } + +} + +QList LogReceiver::getListOfNetworkInterfaces() { + QList nIList = QNetworkInterface::allInterfaces(); + QList result; + + if (nIList.size() > 0) { + foreach(QNetworkInterface nI, nIList) + { + if (((!(nI.flags() & QNetworkInterface::CanBroadcast) + || nI.flags() & QNetworkInterface::IsLoopBack) + || nI.flags() & QNetworkInterface::IsPointToPoint) + || checkBlackList(nI.humanReadableName())) { + continue; + } + if (!checkCarrierState(nI.humanReadableName())) { + continue; + } + result.append(nI.humanReadableName()); + emit addNewInterface(nI.humanReadableName()); + } + } else { + qDebug() << "no interfaces found!"; + } + return result; +} + +QList LogReceiver::checkCarrierState(QList &interfaces) { + QList result; + foreach(QString nI, interfaces) + { + if (checkCarrierState(nI)) { + // everything is fine, cable is plugged, + // go on with the next interface + //continue; + result.append(nI); + } + } + return result; +} + +bool LogReceiver::checkCarrierState(QString interface) { + + qDebug() << "check carrier state for interface " << interface; + QByteArray ba = interface.toAscii(); + const char * iface = ba.data(); + + struct sysfs_class_device *class_device = sysfs_open_class_device("net", + iface); + struct dlist *attrlist = sysfs_get_classdev_attributes(class_device); + if (attrlist != NULL) { + struct sysfs_attribute *attr = NULL; + dlist_for_each_data(attrlist, attr, struct sysfs_attribute) { + if (strcmp("carrier", attr->name) == 0) { + QString value(attr->value); + bool ok = false; + bool * pok = &ok; + int v = value.toInt(pok); + if (*pok) { + if (v == 1) { + qDebug() + << "carrier is 1. Cable is plugged. return true"; + return true; + } else { + qDebug() + << "carrier is 0. Cable is unplugged. return false"; + return false; + } + } else { + qDebug() << "conversion error"; + } + } + } + } else { + qDebug() << "attrlist is Null"; + } + sysfs_close_class_device(class_device); + + return true; +} + +void LogReceiver::runDHCPCD(QList &interfaces) { + foreach(QString nI, interfaces) + { + runDHCPCD(nI); + } +} + +void LogReceiver::runDHCPCD(QString interface) { + emit updateStatusLabel(interface, "start DHCP"); + dhcpcdArguments.append(interface); + QProcess * p = new QProcess(this); + + qDebug() << dhcpcdArguments; + + clientProcessToIfNameMap.insert(p, interface); + qDebug() << clientProcessToIfNameMap; + p->start(pathToDhcpcdExe, dhcpcdArguments); + connect(p, SIGNAL(started()), this, SLOT(handleProcessStarted())); + connect(p, SIGNAL(finished(int, QProcess::ExitStatus)), this, + SLOT(handleProcessFinished(int, QProcess::ExitStatus))); + dhcpcdArguments.removeLast(); +} + +void LogReceiver::checkInternetConnection(QString ifName) { + QString command("ping"); + QStringList argList; + QString timeout("1"); + QString total("2"); + int exitCode = -1; + QString destination("www.google.de"); + argList << "-I" << "ifName" << "-W" << timeout << "-c" << total + << destination; + argList.replace(1, ifName); + QProcess * p = new QProcess(this); + p->start(command, argList); + p->waitForFinished(); + exitCode = p->exitCode(); + if (exitCode > 0) { + qDebug() << "no internet connection with interface" << ifName; + //remove interface from list and inform user via debug console + emit updateStatusLabel(ifName, "connection not possible"); + } else if (exitCode == 0) { + qDebug() << "internet: check passed! for interface" << ifName; + emit + updateStatusLabel(ifName, "connection possible"); + emit connectionEstablished(ifName); + } +} + +void LogReceiver::checkInternetConnection(QList &interfaces) { + foreach(QString nI, interfaces) + { + checkInternetConnection(nI); + } +} +void LogReceiver::checkInternetConnectionViaTCP(QString ifName) { + + const bool canStartIAP = (configurationManager.capabilities() + & QNetworkConfigurationManager::CanStartAndStopInterfaces); + QList configs = + configurationManager.allConfigurations(); + QNetworkConfiguration cfg; + foreach(QNetworkConfiguration nC, configs) + { + if (nC.name() == ifName) { + qDebug() << "found config" << nC.name(); + cfg = nC; + break; + } + } + if (!cfg.isValid() || (!canStartIAP && cfg.state() + != QNetworkConfiguration::Active)) { + qDebug() << "config is not valid" << cfg.name(); + return; + } + QNetworkSession *session = new QNetworkSession(cfg, this); + session->open(); + if (session->waitForOpened(-1)) { + + qDebug () << "used interface for connectivity check:" <interface().humanReadableName(); + QTcpSocket *tcpSocket = new QTcpSocket(this); + tcpSocket->connectToHost(QString("209.85.148.105"), 80); + if (!tcpSocket->waitForConnected(2000)) { + qDebug() << tcpSocket->errorString(); + emit updateStatusLabel(ifName, "connection not possible"); + } else { + emit updateStatusLabel(ifName, "connection possible"); + emit connectionEstablished(ifName); + } + } else { + qDebug() << "couldn't open session"; + } + session->close(); +} + +void LogReceiver::handleNewConnection() { + qDebug() << "New Connection arrived"; + + /*QLocalSocket **/ + client = server ->nextPendingConnection(); + clients.insert(client, client); + connect(client, SIGNAL(disconnected()), this, + SLOT(handleClientDisconnect())); + connect(client, SIGNAL(readyRead()), this, SLOT(handleNewInput())); +} + +void LogReceiver::handleClientDisconnect() { + QLocalSocket* socket = qobject_cast (QObject::sender()); + + QLocalSocket * client = clients.value(socket); + + qDebug() << "disconnect client"; + handleNewInput(client); + client->deleteLater(); +} + +void LogReceiver::handleNewInput(QLocalSocket * client) { + qDebug() << "last read before exit"; + while (client->canReadLine()) { + QString data(client->readLine()); + + data = data.trimmed(); + qDebug() << data; + QStringList lines = data.split("\n"); + + for (int i = 0; i < lines.length(); i++) { + handleNewInputLine(client, lines.at(i)); + } + } +} + +void LogReceiver::handleNewInput() { + QLocalSocket* socket = qobject_cast (QObject::sender()); + + QLocalSocket * client = clients.value(socket); + + while(!client->atEnd()) { + QString data(client->readLine()); + + data = data.trimmed(); + //qDebug() << data; + QStringList lines = data.split("\n"); + + for (int i = 0; i < lines.length(); i++) { + handleNewInputLine(client, lines.at(i)); + } + } +/* + QString data(client->readAll()); + + data = data.trimmed(); + qDebug() << data; + QStringList lines = data.split("\n"); + + for (int i = 0; i < lines.length(); i++) { + handleNewInputLine(client, lines.at(i)); + } + */ +} + +void LogReceiver::handleNewInputLine(QLocalSocket * client, QString data) { + + QString logMsg(data); + QString interface = logMsg.section(";", 0, 0); + QString s_state = logMsg.section(";", 1, 1); + QString s_subState = logMsg.section(";", 2, 2); + QString msg = logMsg.section(";", 3, 3); + int st = s_state.trimmed().toInt(); + int sst = s_subState.trimmed().toInt(); + //qDebug() << logMsg; + + if (ifNameToClient.size() < numberOfProcesses && !ifNameToClient.contains( + interface)) { + ifNameToClient.insert(interface, client); + } + + switch (st) { + case LOG_INFO: + switch (sst) { + case DHCP_DISCOVER: + emit changeProgressBarValue(interface, 10); + break; + case DHCP_OFFER: + emit changeProgressBarValue(interface, 20); + break; + case DHCP_REQUEST: + emit changeProgressBarValue(interface, 30); + break; + case DHCP_ACK: + emit changeProgressBarValue(interface, 40); + break; + case DHCP_NAK: + emit changeProgressBarValue(interface, 40); + break; + case DHCPCD_ARP_TEST: + emit changeProgressBarValue(interface, 50); + break; + case DHCP_DECLINE: + emit changeProgressBarValue(interface, 60); + break; + case DHCP_RELEASE: + + break; + case DHCP_INFORM: + break; + case DHCPCD_CONFIGURE: + emit changeProgressBarValue(interface, 70); + break; + case DHCPCD_WRITE: + emit changeProgressBarValue(interface, 80); + break; + case DHCPCD_EXIT: + //emit changeProgressBarValue(interface, 100); + break; + case DHCPCD_LOG: + + default: + break; + } + break; + case LOG_ERR: + qDebug() << "received stat_error"; + break; + default: + //qDebug() << logMsg; + break; + } +} + +void LogReceiver::handleProcessFinished(int exitCode, + QProcess::ExitStatus exitStatus) { + QProcess* p = qobject_cast (QObject::sender()); + QString ifName = clientProcessToIfNameMap.value(p, "ifName"); + + 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"; + qDebug() << "check internet connction"; + emit + changeProgressBarValue(ifName, 100); + emit + updateStatusLabel(ifName, "check connectivity"); + //checkInternetConnection(ifName); + checkInternetConnectionViaTCP(ifName); + } + } + QLocalSocket *client = ifNameToClient.value(ifName, 0); + if(client != 0) { + handleNewInput(client); + } + numberOfProcesses = numberOfProcesses - 1; + if (numberOfProcesses <= 0) { + emit allProcessesFinished(); + } +} + +void LogReceiver::handleProcessStarted() { + QProcess* p = qobject_cast (QObject::sender()); + QString ifName = clientProcessToIfNameMap.value(p, "ifName"); + qDebug() << "process started for interface:" << ifName; +} + +bool LogReceiver::checkBlackList(QString i) { + if (i.startsWith("v", Qt::CaseInsensitive)) { + return true; + } else if (i.startsWith("d", Qt::CaseInsensitive)) { + return true; + } else { + return false; + } +} diff --git a/LogReceiver/logreceiver.h b/LogReceiver/logreceiver.h new file mode 100644 index 0000000..ce6d070 --- /dev/null +++ b/LogReceiver/logreceiver.h @@ -0,0 +1,74 @@ +#ifndef LOGRECEIVER_H +#define LOGRECEIVER_H + +#include +#include +#include +#include +#include +#include +#include + +class QLocalServer; +class QLocalSocket; + +class LogReceiver: public QObject { +Q_OBJECT + +#define DEFAULT_QTSOCKETADDRESS "/var/tmp/qt_c_socket_default" +#define DEFAULT_PATHTODHCPCDEXE "/home/niklas/fbgui/workspace/customdhcpcd/src/customdhcpcd" + +public: + LogReceiver(); + ~LogReceiver(); + + void initAndRun(QString serverPath = DEFAULT_QTSOCKETADDRESS, + QString pathToExe = DEFAULT_PATHTODHCPCDEXE, + QStringList* args = NULL); + +private slots: + void handleNewConnection(); + void handleNewInput(); + void handleNewInputLine(QLocalSocket * client, QString data); + void handleProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); + void handleProcessStarted(); + void handleClientDisconnect(); + +signals: + void addNewInterface(QString ifName); + void changeProgressBarValue(QString ifName, int newValue); + void connectionEstablished(QString ifName); + void abortBoot(QString msg); + void updateStatusLabel(QString ifName, QString status); + void allProcessesFinished(); + +private: + QLocalServer *server; + quint16 blockSize; + //QMap interfacesMap; + //QMap indexToIfaceNameMap; + QMap clients; + QLocalSocket * client; + QMap ifNameToClient; + QMap clientProcessToIfNameMap; + QString pathToDhcpcdExe; + QStringList dhcpcdArguments; + QNetworkConfigurationManager configurationManager; + QNetworkAccessManager *accessManager; + int numberOfProcesses; + + void handleNewInput(QLocalSocket * client); + + void runDHCPCD(QList &interfaces); + void runDHCPCD(QString interface); + QListcheckCarrierState(QList &interfaces); + bool checkCarrierState(QString interface); + void checkInternetConnection(QString ifName); + void checkInternetConnection(QList &interfaces); + void checkInternetConnectionViaTCP(QString ifName); + QList getListOfNetworkInterfaces(); + bool checkBlackList(QString i); + +}; + +#endif // LOGRECEIVER_H diff --git a/LogReceiver/logreceiver.ui b/LogReceiver/logreceiver.ui new file mode 100644 index 0000000..0010c64 --- /dev/null +++ b/LogReceiver/logreceiver.ui @@ -0,0 +1,25 @@ + + + LogReceiverClass + + + + 0 + 0 + 572 + 385 + + + + LogReceiver + + + #LogReceiverClass{ +background:grey; +} + + + + + + diff --git a/LogReceiver/main.cpp b/LogReceiver/main.cpp new file mode 100644 index 0000000..a8cd960 --- /dev/null +++ b/LogReceiver/main.cpp @@ -0,0 +1,12 @@ +#include "ndgui.h" + +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + ndgui w; + w.show(); + return a.exec(); +} diff --git a/LogReceiver/ndgui.cpp b/LogReceiver/ndgui.cpp new file mode 100644 index 0000000..a839aef --- /dev/null +++ b/LogReceiver/ndgui.cpp @@ -0,0 +1,184 @@ +#include "ndgui.h" +#include "chooseinterfacedialog.h" +#include "abortbootdialog.h" + +ndgui::ndgui(QWidget *parent) + : QWidget(parent) +{ + ui.setupUi(this); + + connect(&logReceiver, SIGNAL(addNewInterface(QString)), this, SLOT(addNewInterface(QString))); + connect(&logReceiver, SIGNAL(changeProgressBarValue(QString , int )), this, SLOT(handleProgress(QString, int))); + connect(&logReceiver, SIGNAL(connectionEstablished(QString)), this, SLOT(handleConnectionEstablished(QString))); + connect(&logReceiver, SIGNAL(abortBoot(QString)), this, SLOT(handleAbortBoot(QString))); + connect(&logReceiver, SIGNAL(updateStatusLabel(QString,QString)), this, SLOT(handleUpdateStatusLabel(QString, QString))); + connect(&logReceiver, SIGNAL(allProcessesFinished()), this, SLOT(handleAllProcessesFinished())); + + buildGui(); + + logReceiver.initAndRun("/var/tmp/qt_c_socket_custom"); + numberOfInterfaces = 0; + + + setWindowTitle(tr("NetD")); +} + +ndgui::~ndgui() +{ + +} + +void ndgui::buildGui() { + + ndStatusLabel = new QLabel(tr("test")); + ndStatusLabel->setSizePolicy(QSizePolicy::Expanding, + QSizePolicy::Expanding); + ndStatusLabel->setAlignment(Qt::AlignCenter); + ndStatusLabel->setMinimumSize(100, 20); + + // create interface group box + createInterfaceGroupBox(); + + + + mainLayout = new QVBoxLayout; + mainLayout->addWidget(ndStatusLabel); + mainLayout->addWidget(interfaceGroupBox); + + setLayout(mainLayout); +} + +void ndgui::createInterfaceGroupBox(){ + interfaceGroupBox = new QGroupBox(tr("Interfaces")); + + interfaceGroupBoxLayout = new QVBoxLayout; + /* add interfaces via addInterfacesToGroupBox()*/ + + interfaceGroupBox->setLayout(interfaceGroupBoxLayout); +} + +void ndgui::addNewInterface(QString ifName) { + qDebug() << "receive interface to add:" << ifName; + QHBoxLayout *hBoxLayout = new QHBoxLayout; + QLabel *label = new QLabel(ifName); + QLabel *labelStatus = new QLabel("waiting"); + QProgressBar *pBar = new QProgressBar(this); + pBar->setRange(1, 100); + pBar->setMaximumSize(200, 20); + + statusLabels.insert(ifName, labelStatus); + progressBars.insert(ifName, pBar); + + hBoxLayout->addWidget(label, Qt::AlignLeft); + hBoxLayout->addWidget(labelStatus, Qt::AlignCenter); + hBoxLayout->addWidget(pBar, Qt::AlignRight); + + numberOfInterfaces++; + + interfaceGroupBoxLayout->addLayout(hBoxLayout, 2); +} + +void ndgui::handleProgress(QString ifName, int newValue) { + qDebug() << "<[---]> SLOT handleProgress activated with: " << ifName << newValue; + QProgressBar * pBar = progressBars.value(ifName); + if(newValue >= pBar->value()) { + pBar->setValue(newValue); + } + else { + qDebug() << "Error: new value is smaller than the old value!"; + } +} + +void ndgui::handleConnectionEstablished(QString ifName) { + finalUsableInterfaces.append(ifName); +} + +void ndgui::handleAbortBoot(QString msg) { + qDebug() << "abort boot. reason:" << msg; + showAbortBootDialog(); +} + +void ndgui::handleUpdateStatusLabel(QString ifName, QString status) { + QLabel* label = statusLabels.value(ifName); + label->setText(status); +} + +void ndgui::handleAllProcessesFinished() { + qDebug() << "all Processes finished"; + + if (finalUsableInterfaces.size() > 0) { + showChooseInterfaceDialog(); + } else { + showAbortBootDialog(); + } +} + +void ndgui::showAbortBootDialog() { + aBD = new AbortBootDialog(this); + connect(aBD, SIGNAL(showLogSignal()), this, SLOT(showLog())); + connect(aBD, SIGNAL(restartSignal()), this, SLOT(restartSystem())); + connect(aBD, SIGNAL(shutDownSignal()), this, SLOT(shutDownSystem())); + aBD->setModal(true); + aBD->show(); +} + +void ndgui::showChooseInterfaceDialog() { + cID = new ChooseInterfaceDialog(finalUsableInterfaces, this); + connect(cID, SIGNAL(continueSignal(QString)), this, + SLOT(continueBoot(QString))); + connect(cID, SIGNAL(restartSignal()), this, SLOT(restartSystem())); + connect(cID, SIGNAL(shutDownSignal()), this, SLOT(shutDownSystem())); + cID->setModal(true); + cID->show(); +} + +void ndgui::restartSystem() +{ + + if(qobject_cast(QObject::sender())>0) + { + qDebug() << "received Signal restart abd"; + aBD->closeDialog(); + } + else if(qobject_cast(QObject::sender())>0) + { + qDebug() << "received Signal restart cid"; + cID->close(); + } + else + { + qDebug() << "unknown sender" << QObject::sender(); + } + + +} + +void ndgui::shutDownSystem() +{ + if(qobject_cast(QObject::sender())>0) + { + + aBD->closeDialog(); + } + else if(qobject_cast(QObject::sender())>0) + { + + cID->close(); + } + else + { + qDebug() << "unknown sender" << QObject::sender(); + } + +} + +void ndgui::continueBoot(QString ifName) +{ + QString text = "continue with interface: " + ifName; + cID->close(); +} + +void ndgui::showLog() +{ + qDebug() << "show log"; +} diff --git a/LogReceiver/ndgui.h b/LogReceiver/ndgui.h new file mode 100644 index 0000000..e8b0b85 --- /dev/null +++ b/LogReceiver/ndgui.h @@ -0,0 +1,67 @@ +#ifndef NDGUI_H +#define NDGUI_H + +#include +#include "qprogressbar.h" +#include "qlabel.h" +#include "qgroupbox.h" +#include "qboxlayout.h" +#include "ui_ndgui.h" +#include "logreceiver.h" +#include "chooseinterfacedialog.h" +#include "abortbootdialog.h" + +class ndgui: public QWidget { +Q_OBJECT + +public: + ndgui(QWidget *parent = 0); + ~ndgui(); + +public slots: + void handleProgress(QString ifName, int newValue); + void addNewInterface(QString ifName); + void handleConnectionEstablished(QString ifName); + void handleAbortBoot(QString msg); + void handleUpdateStatusLabel(QString ifName, QString status); + void handleAllProcessesFinished(); + + void restartSystem(); + void shutDownSystem(); + void continueBoot(QString ifName); + void showLog(); + + void showAbortBootDialog(); + void showChooseInterfaceDialog(); + +private: + Ui::ndguiClass ui; + + LogReceiver logReceiver; + + QStringList finalUsableInterfaces; + + int numberOfInterfaces; + + ChooseInterfaceDialog *cID; + AbortBootDialog *aBD; + + /*gui elements*/ + QMap progressBars; + QMap statusLabels; + QLabel *ndStatusLabel; + QGroupBox *interfaceGroupBox; + QVBoxLayout *mainLayout; + QVBoxLayout *interfaceGroupBoxLayout; + /**/ + + + + + /*gui functions*/ + void buildGui(); + void createInterfaceGroupBox(); + +}; + +#endif // NDGUI_H diff --git a/LogReceiver/ndgui.ui b/LogReceiver/ndgui.ui new file mode 100644 index 0000000..4a4c466 --- /dev/null +++ b/LogReceiver/ndgui.ui @@ -0,0 +1,19 @@ + + ndguiClass + + + + 0 + 0 + 400 + 300 + + + + ndgui + + + + + + -- cgit v1.2.3-55-g7522