summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordeva <deva>2005-05-03 09:22:12 +0000
committerdeva <deva>2005-05-03 09:22:12 +0000
commit2bef4cb3d3230915e5e673f10910ff8f520a0c19 (patch)
treecb027efa35cc46c63ece8b60116b70e6680516c3 /src
parentfc6b6c4981bfeb94055a43c4b9eebc979f0370b8 (diff)
Implemented the gui part of the info object.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/info_gui.cc34
-rw-r--r--src/info_gui.h12
-rw-r--r--src/mainwindow.cc7
-rw-r--r--src/mainwindow.h5
-rw-r--r--src/miav.cc11
6 files changed, 62 insertions, 8 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index ce9cf72..b934ed1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,6 +2,7 @@
## TODO: Move ffmpeg, libxml and libsdl into configure.in
AM_CXXFLAGS := $(CXXFLAGS) $(EXTRA_CXXFLAGS) -I../include $(QT_CXXFLAGS) \
+ -DQT_THREAD_SUPPORT \
-DPIXMAPS=\"$(datadir)/pixmaps\" \
-DETC=\"$(prefix)/etc/miav\" \
-I/usr/include/ffmpeg
diff --git a/src/info_gui.cc b/src/info_gui.cc
index 0718021..376a19f 100644
--- a/src/info_gui.cc
+++ b/src/info_gui.cc
@@ -39,8 +39,12 @@
#include <stdio.h>
#include <stdarg.h>
-InfoGui::InfoGui(): Info()
+#include "messagebox.h"
+
+InfoGui::InfoGui(QApplication *a, QWidget *p): Info()
{
+ qapp = a;
+ parent = p;
}
InfoGui::~InfoGui()
@@ -60,6 +64,18 @@ void InfoGui::error(char *fmt, ...)
vsprintf(buf, fmt, argp);
va_end(argp);
+ fprintf(stderr, "<!"); fflush(stderr);
+ qapp->lock();
+ fprintf(stderr, "!"); fflush(stderr);
+ MessageBox(parent,
+ TXT_ERROR_TITLE,
+ buf,
+ TYPE_OK,
+ ICON_ERROR).exec();
+ fprintf(stderr, "!"); fflush(stderr);
+ qapp->unlock();
+ fprintf(stderr, "!>"); fflush(stderr);
+
// End of safezone
pthread_mutex_unlock(&mutex);
}
@@ -77,6 +93,14 @@ void InfoGui::warn(char *fmt, ...)
vsprintf(buf, fmt, argp);
va_end(argp);
+ qapp->lock();
+ MessageBox(parent,
+ TXT_WARNING_TITLE,
+ buf,
+ TYPE_OK,
+ ICON_WARNING).exec();
+ qapp->unlock();
+
// End of safezone
pthread_mutex_unlock(&mutex);
}
@@ -94,6 +118,14 @@ void InfoGui::info(char *fmt, ...)
vsprintf(buf, fmt, argp);
va_end(argp);
+ qapp->lock();
+ MessageBox(parent,
+ TXT_INFO_TITLE,
+ buf,
+ TYPE_OK,
+ ICON_INFO).exec();
+ qapp->unlock();
+
// End of safezone
pthread_mutex_unlock(&mutex);
}
diff --git a/src/info_gui.h b/src/info_gui.h
index 28860b6..269f827 100644
--- a/src/info_gui.h
+++ b/src/info_gui.h
@@ -37,14 +37,22 @@
#ifndef __MIAV_INFO_GUI_H__
#define __MIAV_INFO_GUI_H__
+#define TXT_ERROR_TITLE "Der er opstået en fejl!"
+#define TXT_WARNING_TITLE "Advarsel"
+#define TXT_INFO_TITLE "Information"
+
+
#include "info.h"
+#include <qwidget.h>
+#include <qapplication.h>
+
#include <pthread.h>
#include <semaphore.h>
class InfoGui: public Info {
public:
- InfoGui();
+ InfoGui(QApplication *a, QWidget *p);
~InfoGui();
void error(char* fmt, ...);
@@ -52,6 +60,8 @@ public:
void info(char* fmt, ...);
private:
+ QApplication *qapp;
+ QWidget *parent;
pthread_mutex_t mutex;
};
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index eda7dc9..577058f 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -31,6 +31,9 @@
/*
* $Log$
+ * Revision 1.25 2005/05/03 09:22:12 deva
+ * Implemented the gui part of the info object.
+ *
* Revision 1.24 2005/05/03 08:31:59 deva
* Removed the error object, and replaced it with a more generic info object.
*
@@ -91,10 +94,10 @@
//#define WITH_DV
-MainWindow::MainWindow( QWidget* parent, const char* name )
+MainWindow::MainWindow(QApplication *qApp, QWidget* parent, const char* name )
: QWidget( parent, name, WStyle_Customize | WStyle_NoBorder )
{
- info = new InfoGui();
+ info = new InfoGui(qApp, this);
video_width = config->readInt("video_width");
video_height = config->readInt("video_height");
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 78bdd75..5f0fe93 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -31,6 +31,9 @@
/*
* $Log$
+ * Revision 1.12 2005/05/03 09:22:12 deva
+ * Implemented the gui part of the info object.
+ *
* Revision 1.11 2005/05/03 08:31:59 deva
* Removed the error object, and replaced it with a more generic info object.
*
@@ -101,7 +104,7 @@ class MainWindow : public QWidget
{
Q_OBJECT
public:
- MainWindow(QWidget* parent = 0, const char* name = 0);
+ MainWindow(QApplication *qApp, QWidget* parent = 0, const char* name = 0);
~MainWindow();
void message(char* msg);
diff --git a/src/miav.cc b/src/miav.cc
index daac99d..1518795 100644
--- a/src/miav.cc
+++ b/src/miav.cc
@@ -31,6 +31,9 @@
/*
* $Log$
+ * Revision 1.8 2005/05/03 09:22:12 deva
+ * Implemented the gui part of the info object.
+ *
* Revision 1.7 2005/05/03 08:31:59 deva
* Removed the error object, and replaced it with a more generic info object.
*
@@ -72,7 +75,11 @@ enum {
int grab(int argc, char *argv[]) {
#ifdef USE_GUI
QApplication miav_grab( argc, argv );
- MainWindow mainwindow;
+
+ InfoGui info(&miav_grab, NULL);
+ config = new MiavConfig(ETC"/miav.conf", &info);
+
+ MainWindow mainwindow(&miav_grab);
miav_grab.setMainWidget( &mainwindow );
return miav_grab.exec();
#else /* USE_GUI */
@@ -138,8 +145,6 @@ int main(int argc, char *argv[])
switch(mode) {
case MODE_GRAB:
{
- InfoGui info;
- config = new MiavConfig(ETC"/miav.conf", &info);
return grab(argc - 2, &argv[2]);
}
case MODE_SERVER: