summaryrefslogtreecommitdiff
path: root/src/miav.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2014-05-14 14:24:34 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2014-05-14 14:24:34 +0200
commit0ff825e0e6fe5fc7238e3964d24779a07cb53518 (patch)
tree7b47a9fe58a09e12ed99fdfacc84fff198ce5ce1 /src/miav.cc
parent29ae5ac36d4ffc520232ff393b2455130ec0227e (diff)
Split miav server and client apart. Port client to Qt4. Replace libraw1994 with libiec61883. Add unit tests for multiplexer and fix some bugs in it.
Diffstat (limited to 'src/miav.cc')
-rw-r--r--src/miav.cc94
1 files changed, 8 insertions, 86 deletions
diff --git a/src/miav.cc b/src/miav.cc
index 24d6fe1..2217809 100644
--- a/src/miav.cc
+++ b/src/miav.cc
@@ -24,42 +24,19 @@
* along with MIaV; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#include <config.h>
-
-#ifdef USE_GUI
-#include <qapplication.h>
-#include "mainwindow.h"
-#include "miav.h"
-#endif /* USE_GUI */
-
-#include "miav_daemon.h"
-
-#include "miav_config.h"
-
-#include "info_gui.h"
-#include "info_console.h"
+#include <QApplication>
#include <stdio.h>
#include <string.h>
-typedef enum {
- MODE_UNKNOWN,
- MODE_GRAB,
- MODE_SERVER
-} run_mode;
-
-#ifdef USE_GUI
-QApplication *miav_app;
-#endif/*USE_GUI*/
-
-/**
- * This function starts the MIaV gui.
- */
-int grab(int argc, char *argv[]) {
-#ifdef USE_GUI
+#include "mainwindow.h"
+#include "miav_config.h"
+#include "info_gui.h"
+#include "debug.h"
- QApplication miav_grab( argc, argv );
- miav_app = &miav_grab;
+int main(int argc, char *argv[])
+{
+ QApplication miav_grab(argc, argv);
MiavConfig cfg(ETC"/miav.conf", NULL);
InfoGui info(&miav_grab, NULL, &cfg);
@@ -69,62 +46,7 @@ int grab(int argc, char *argv[]) {
miav_grab.installEventFilter( eventhandler );
MainWindow mainwindow( &miav_grab );
- miav_grab.setMainWidget( &mainwindow );
info.setParent(&mainwindow);
return miav_grab.exec();
-
-#else /* USE_GUI */
-
- fprintf(stderr, "Error: MIaV was not compiled with GUI support...\n");
- return 0;
-
-#endif /* USE_GUI */
-}
-
-
-
-/**
- * This function starts the MIaV server.
- */
-int server(int argc, char *argv[])
-{
- MiavDaemon daemon;
-
- MiavConfig cfg(ETC"/miav.conf", NULL);
-
- string *user = cfg.readString("server_user");
- string *group = cfg.readString("server_group");
-
- return daemon.run(user->c_str(), group->c_str());
-}
-
-#include "debug.h"
-
-int main(int argc, char *argv[])
-{
- run_mode mode = MODE_UNKNOWN;
-
- if(argc >= 2) {
- if(!strcmp(argv[1], "grab")) mode = MODE_GRAB;
- if(!strcmp(argv[1], "server")) mode = MODE_SERVER;
- }
-
- switch(mode) {
- case MODE_GRAB:
- {
- return grab(argc - 2, &argv[2]);
- }
- case MODE_SERVER:
- {
- return server(argc - 2, &argv[2]);
- }
- case MODE_UNKNOWN:
- {
- printf("Usage: %s [mode] [mode options]\n", argv[0]);
- printf("[mode] can be one of the following: grab or server.\n");
- return 1;
- }
- }
- return 0;
}