summaryrefslogtreecommitdiff
path: root/src/miav.cc
diff options
context:
space:
mode:
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;
}