summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authordeva <deva>2006-03-07 10:37:59 +0000
committerdeva <deva>2006-03-07 10:37:59 +0000
commit1390ddfe6afe41dba141f8170f9b277573ebe8cd (patch)
treefd6861f3eab3a4721f2445540279a8223d7cd1a3 /client
parent19ade36987f86c9b4cd4c5ec3fc6c499205c61ec (diff)
*** empty log message ***
Diffstat (limited to 'client')
-rw-r--r--client/.cvsignore6
-rw-r--r--client/Makefile.am2
-rw-r--r--client/cprlisten.cc15
-rw-r--r--client/cprlisten.h5
-rw-r--r--client/cprquerydialog.cc7
-rw-r--r--client/cprquerydialog.h7
-rw-r--r--client/decoder.cc6
-rw-r--r--client/dv1394.cc11
-rw-r--r--client/dv1394.h3
-rw-r--r--client/dvfile.cc7
-rw-r--r--client/dvfile.h3
-rw-r--r--client/info_gui.cc50
-rw-r--r--client/info_gui.h22
-rw-r--r--client/mainwindow.cc76
-rw-r--r--client/mainwindow.h9
-rw-r--r--client/messagebox.cc6
-rw-r--r--client/messagebox.h4
-rw-r--r--client/miav_client.cc32
-rw-r--r--client/miav_client.h42
-rw-r--r--client/networksender.cc6
-rw-r--r--client/player.cc6
-rw-r--r--client/player.h2
-rw-r--r--client/videowidget.cc9
-rw-r--r--client/videowidget.h6
-rw-r--r--client/yuv_draw.cc3
25 files changed, 140 insertions, 205 deletions
diff --git a/client/.cvsignore b/client/.cvsignore
new file mode 100644
index 0000000..7d0bef6
--- /dev/null
+++ b/client/.cvsignore
@@ -0,0 +1,6 @@
+*.moc.cc
+Makefile
+Makefile.in
+.deps
+.libs
+miav_client
diff --git a/client/Makefile.am b/client/Makefile.am
index 001916c..803bf51 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -28,7 +28,6 @@ EXTRA_DIST = \
config.h \
cprlisten.h \
cprquerydialog.h \
- debug.h \
decoder.h \
dv1394.h \
dvfile.h \
@@ -37,7 +36,6 @@ EXTRA_DIST = \
info_gui.h \
mainwindow.h \
messagebox.h \
- miav_client.h \
player.h \
videowidget.h \
yuv_draw.h
diff --git a/client/cprlisten.cc b/client/cprlisten.cc
index 0a4958e..4c1272e 100644
--- a/client/cprlisten.cc
+++ b/client/cprlisten.cc
@@ -32,11 +32,12 @@
#include <string>
using namespace std;
+#include "info.h"
+
#define MAGIC_STOP_STRING "SHUTTHEFUCKUP"
-CPRListen::CPRListen(Info *info, unsigned short port)
+CPRListen::CPRListen(unsigned short port)
{
- this->info = info;
this->port = port;
cpr = "N/A";
cprchanged = false;
@@ -55,13 +56,13 @@ void CPRListen::stop()
socket.connect("localhost", port);
socket.send_string(MAGIC_STOP_STRING);
} catch(Network_error &e) {
- info->error("In stop(): %s.", e.error.c_str());
+ gInfo::info->error("In stop(): %s.", e.error.c_str());
}
}
void CPRListen::thread_main()
{
- info->log("Listening for CPRs.");
+ gInfo::info->log("Listening for CPRs.");
while(running) {
try {
string newcpr;
@@ -76,15 +77,15 @@ void CPRListen::thread_main()
cprchanged = true;
cpr = newcpr;
mutex.unlock();
- info->log("Got CPR: %s.", cpr.c_str());
+ gInfo::info->log("Got CPR: %s.", cpr.c_str());
}
} catch(Network_error &e) {
- info->error("In thread_main(): %s.", e.error.c_str());
+ gInfo::info->error("In thread_main(): %s.", e.error.c_str());
running = false;
}
}
- info->log("Stopped listening for CPRs.");
+ gInfo::info->log("Stopped listening for CPRs.");
}
bool CPRListen::cprChanged()
diff --git a/client/cprlisten.h b/client/cprlisten.h
index 012fe4c..22cc742 100644
--- a/client/cprlisten.h
+++ b/client/cprlisten.h
@@ -34,11 +34,10 @@
#include "mutex.h"
#include "aa_socket.h"
-#include "info.h"
class CPRListen: public Thread {
public:
- CPRListen(Info *info, unsigned short port);
+ CPRListen(unsigned short port);
~CPRListen();
bool cprChanged();
@@ -48,8 +47,6 @@ public:
void stop(); // Stops the call to listen
private:
- Info *info;
-
volatile bool running;
AASocket *socket;
diff --git a/client/cprquerydialog.cc b/client/cprquerydialog.cc
index 15e00d1..1461943 100644
--- a/client/cprquerydialog.cc
+++ b/client/cprquerydialog.cc
@@ -33,8 +33,7 @@
#include "cprquerydialog.h"
#include "miav_config.h"
-CPRQueryDialog::CPRQueryDialog(Info *info,
- QLabel *lcpr,
+CPRQueryDialog::CPRQueryDialog(QLabel *lcpr,
QLabel *lname,
QWidget *parent,
const char *name,
@@ -42,7 +41,6 @@ CPRQueryDialog::CPRQueryDialog(Info *info,
: QDialog(parent)
{
setModal(true);
- this->info = info;
setWindowTitle(name);
// Load image
@@ -118,7 +116,7 @@ CPRQueryDialog::CPRQueryDialog(Info *info,
this->move(175,150);
- listen = new CPRListen(info, config->readInt("cprlisten_port"));
+ listen = new CPRListen(config->readInt("cprlisten_port"));
listen_timer = new QTimer(this);
connect(listen_timer, SIGNAL(timeout()), SLOT(listen_timeout()));
listen->run();
@@ -381,7 +379,6 @@ void CPRQueryDialog::cprSocket_error(int errnum)
if(statusbar) statusbar->showMessage(msg, 5000);
MessageBox(this, "Fejl", msg.toStdString().c_str(), TYPE_OK, ICON_ERROR).exec();
- //info->error(msg.c_str());
accept();
}
diff --git a/client/cprquerydialog.h b/client/cprquerydialog.h
index c70206e..1c4d67b 100644
--- a/client/cprquerydialog.h
+++ b/client/cprquerydialog.h
@@ -71,13 +71,10 @@ using namespace std;
#include "cprlisten.h"
-#include "info.h"
-
class CPRQueryDialog : public QDialog {
Q_OBJECT
public:
- CPRQueryDialog(Info *info,
- QLabel *lcpr,
+ CPRQueryDialog(QLabel *lcpr,
QLabel *lname,
QWidget * parent = 0,
const char * name = 0,
@@ -98,8 +95,6 @@ public slots:
private:
- Info *info;
-
CPRListen *listen;
QTimer *listen_timer;
diff --git a/client/decoder.cc b/client/decoder.cc
index f99dd00..f90e1dd 100644
--- a/client/decoder.cc
+++ b/client/decoder.cc
@@ -27,6 +27,8 @@
#include "config.h"
#include "decoder.h"
+#include "info.h"
+
Decoder::Decoder()
{}
@@ -34,5 +36,7 @@ Decoder::~Decoder()
{}
void Decoder::run()
-{}
+{
+ gInfo::info->info("The decoder thread is running.");
+}
diff --git a/client/dv1394.cc b/client/dv1394.cc
index 270da2e..611d815 100644
--- a/client/dv1394.cc
+++ b/client/dv1394.cc
@@ -40,7 +40,7 @@
#include <fcntl.h>
#include <errno.h>
-
+#include "info.h"
/**
* Callback function for the firewire interface.
@@ -107,9 +107,8 @@ static int raw_reader( raw1394handle_t handle, int channel, size_t length, quadl
return 0;
}
-dv1394::dv1394(Info *i, int p, int c)
+dv1394::dv1394(int p, int c)
{
- info = i;
port = p;
channel = c;
}
@@ -128,13 +127,13 @@ bool dv1394::connect()
// Get handle to firewire channels
handle = raw1394_new_handle();
if(!handle) {
- info->error("raw1394 - failed to get handle: %s.", strerror( errno ) );
+ gInfo::info->error("raw1394 - failed to get handle: %s.", strerror( errno ) );
return false;
}
// how many adapters are hooked in?
if((n_ports = raw1394_get_port_info(handle, pinf, 16)) < 0 ) {
- info->error("raw1394 - failed to get port info: %s.", strerror( errno ) );
+ gInfo::info->error("raw1394 - failed to get port info: %s.", strerror( errno ) );
raw1394_destroy_handle(handle);
handle = NULL;
return false;
@@ -142,7 +141,7 @@ bool dv1394::connect()
// Tell raw1394 which host adapter to use
if(raw1394_set_port(handle, port) < 0 ) {
- info->error("raw1394 - failed to set port: %s.", strerror( errno ) );
+ gInfo::info->error("raw1394 - failed to set port: %s.", strerror( errno ) );
raw1394_destroy_handle(handle);
handle = NULL;
return false;
diff --git a/client/dv1394.h b/client/dv1394.h
index 7cea9d0..c7f0711 100644
--- a/client/dv1394.h
+++ b/client/dv1394.h
@@ -37,7 +37,7 @@
class dv1394 : public frame_stream {
public:
- dv1394(Info* info, int port = 0, int channel = 63); // 63 is default channel... sucks.
+ dv1394(int port = 0, int channel = 63); // 63 is default channel... sucks.
~dv1394();
bool connect();
@@ -46,7 +46,6 @@ public:
private:
raw1394handle_t handle;
- Info *info;
int port;
int channel;
};
diff --git a/client/dvfile.cc b/client/dvfile.cc
index 7d83255..8caecc0 100644
--- a/client/dvfile.cc
+++ b/client/dvfile.cc
@@ -30,11 +30,12 @@
#include "dv.h"
#include "util.h"
-dvfile::dvfile(Info* i)
+#include "info.h"
+
+dvfile::dvfile()
{
- info = i;
fp = fopen(TEST_MOVIE, "r");
- if(!fp) info->error("Couldn't open %s for reading.", TEST_MOVIE);
+ if(!fp) gInfo::info->error("Couldn't open %s for reading.", TEST_MOVIE);
}
dvfile::~dvfile()
diff --git a/client/dvfile.h b/client/dvfile.h
index dc91a14..72d4bec 100644
--- a/client/dvfile.h
+++ b/client/dvfile.h
@@ -38,13 +38,12 @@
class dvfile : public frame_stream {
public:
- dvfile(Info* info);
+ dvfile();
~dvfile();
unsigned char *readFrame();
private:
- Info* info;
FILE* fp;
};
diff --git a/client/info_gui.cc b/client/info_gui.cc
index aa831b6..f836a92 100644
--- a/client/info_gui.cc
+++ b/client/info_gui.cc
@@ -37,10 +37,13 @@
bool InfoEventHandler::eventFilter( QObject *o, QEvent *e )
{
if ( e->type() == TYPE_SHOW_MESSAGEBOX ) {
- // fprintf(stderr, "Custom event!\n"); fflush(stderr);
- MessageBox *msgbox = ((ShowMessageEvent*)e)->messagebox();
- msgbox->exec();
- delete msgbox;
+ ShowMessageEvent *msgevt = (ShowMessageEvent*)e;
+ MessageBox msgbox(NULL,
+ msgevt->title(),
+ msgevt->message(),
+ TYPE_OK,
+ msgevt->icon());
+ msgbox.exec();
return TRUE; // eat event
} else {
// standard event processing
@@ -48,54 +51,33 @@ bool InfoEventHandler::eventFilter( QObject *o, QEvent *e )
}
}
-InfoGui::InfoGui(QApplication *a, QWidget *p, MiavConfig *c): Info()
+InfoGui::InfoGui(MiavConfig *c): Info()
{
this->config = c;
log_filename = *(this->config->readString("client_log_file"));
- qapp = a;
- parent = p;
+ InfoEventHandler *eventhandler = new InfoEventHandler();
+ qApp->installEventFilter( eventhandler );
- pthread_mutex_init (&mutex, NULL);
+ // pthread_mutex_init (&mutex, NULL);
}
InfoGui::~InfoGui()
{
- pthread_mutex_destroy(&mutex);
-}
-
-void InfoGui::setParent(QWidget *p)
-{
- parent = p;
+ // pthread_mutex_destroy(&mutex);
}
void InfoGui::showmsg(char *msg, char *title, msg_icon icon)
{
- pthread_mutex_lock(&mutex);
+ // pthread_mutex_lock(&mutex);
// Beginning of safezone
- fprintf(stderr, "%s: %s\n", title, msg); fflush(stderr);
-
- while( !parent ) {
- struct timespec ts;
-
- ts.tv_sec = 0;
- ts.tv_nsec = 200000000L; // 200ms
- nanosleep(&ts, NULL);
- }
-
- MessageBox *msgbox = new MessageBox(parent,
- title,
- msg,
- TYPE_OK,
- icon);
-
- ShowMessageEvent *event = new ShowMessageEvent( msgbox );
+ ShowMessageEvent *event = new ShowMessageEvent(msg, title, icon);
- qapp->postEvent(parent, event);
+ qApp->postEvent(qApp, event);
// End of safezone
- pthread_mutex_unlock(&mutex);
+ // pthread_mutex_unlock(&mutex);
}
void InfoGui::error(char *fmt, ...)
diff --git a/client/info_gui.h b/client/info_gui.h
index a607c0f..e429e87 100644
--- a/client/info_gui.h
+++ b/client/info_gui.h
@@ -51,13 +51,18 @@
class ShowMessageEvent : public QEvent {
public:
- ShowMessageEvent( MessageBox* msgbox ) :
+ ShowMessageEvent(QString message, QString title, msg_icon icon) :
QEvent((QEvent::Type)TYPE_SHOW_MESSAGEBOX),
- m( msgbox ) {}
- MessageBox *messagebox() const { return m; }
- // Type type() const { return TYPE_SHOW_MESSAGEBOX; }
+ m(message), t(title), i(icon) {}
+
+ QString message() const { return m; }
+ QString title() const { return t; }
+ msg_icon icon() const { return i; }
+
private:
- MessageBox *m;;
+ QString m;
+ QString t;
+ msg_icon i;
};
class InfoEventHandler : public QObject {
@@ -68,20 +73,15 @@ protected:
class InfoGui: public Info {
public:
- InfoGui(QApplication *a, QWidget *p, MiavConfig *config);
+ InfoGui(MiavConfig *config);
~InfoGui();
void error(char* fmt, ...);
void warn(char* fmt, ...);
void info(char* fmt, ...);
- void setParent(QWidget *p);
-
private:
void showmsg(char *msg, char *title, msg_icon icon);
-
- QApplication *qapp;
- QWidget *parent;
};
#endif/*__MIAV_INFO_GUI_H__*/
diff --git a/client/mainwindow.cc b/client/mainwindow.cc
index e813d00..8efcad0 100644
--- a/client/mainwindow.cc
+++ b/client/mainwindow.cc
@@ -42,6 +42,8 @@
#include <math.h>
+#include "info.h"
+
//#include "mgui_alert.h"
//#include "mgui_datasocket.h"
@@ -54,9 +56,9 @@
MainWindow::MainWindow(QWidget* parent )
: QWidget( parent, Qt::FramelessWindowHint )
{
- info = new InfoGui(qApp, this, config);
+ // info = new InfoGui(qApp, this, config);
- info->log("Starting MIaV v. %s.", VERSION);
+ gInfo::info->info("Starting MIaV v. %s.", VERSION);
video_width = config->readInt("video_width");
video_height = config->readInt("video_height");
@@ -90,15 +92,16 @@ MainWindow::MainWindow(QWidget* parent )
rec_edge_counter = 0.0f;
// This must be defined before the gui i created (img_live uses it as parameter)
- camera = new Camera(info);
+ // camera = new Camera(info);
createGui();
show();
+ /*
camera->connect(config->readString("server_addr")->c_str(),
config->readInt("server_port"),
img_live->width(), img_live->height());
-
+ */
// Make sure this is created *after* the camera object!
taskbartimer = new QTimer(this);
connect(taskbartimer, SIGNAL(timeout()), SLOT(taskbar_update()));
@@ -108,7 +111,7 @@ MainWindow::MainWindow(QWidget* parent )
frozen = false;
muted = false;
- info->log("MIaV is ready.");
+ gInfo::info->log("MIaV is ready.");
// Open the CPR Dialog
cpr_clicked();
@@ -117,13 +120,13 @@ MainWindow::MainWindow(QWidget* parent )
MainWindow::~MainWindow()
{
- info->log("MIaV is shutting down.");
+ gInfo::info->log("MIaV is shutting down.");
delete img_history;
- delete camera;
+ // delete camera;
delete btn_cpr;
- info->log("MIaV is shut down.");
+ gInfo::info->log("MIaV is shut down.");
}
QImage *MainWindow::loadButtonIcon( char *name, int height )
@@ -215,7 +218,7 @@ void MainWindow::createGui()
img_recedge->setPalette(palette);
img_recedge->setFixedSize(output_width, output_height);
- img_live = new VideoWidget(img_recedge, camera);
+ img_live = new VideoWidget(img_recedge);
img_live->setFixedSize(output_width - 20, output_height - 20);
img_live->move(10,10);
g1->addWidget( img_recedge, 0, 0, 1, 3, Qt::AlignHCenter);
@@ -362,9 +365,10 @@ void MainWindow::taskbar_update()
watchdog++;
if(recording) {
+ /*
if((watchdog % 300 == 0) || ((camera->getQueueLength() > 1000) && (watchdog % 50 == 0)))
info->log("Queue length: %d (active)", camera->getQueueLength());
-
+ */
gettimeofday(&time, NULL);
s = time.tv_sec - starttime.tv_sec;
@@ -374,13 +378,15 @@ void MainWindow::taskbar_update()
m = s / 60;
s -= m * 60;
} else {
+ /*
if((camera->getQueueLength() > 0) && (watchdog % 300 == 0))
info->log("Queue length: %d (passive)", camera->getQueueLength());
+ */
gettimeofday(&starttime, NULL);
}
char msg[256];
- int l = camera->getQueueLength();
+ int l = 0;//camera->getQueueLength();
sprintf(msg, TXT_TIME " %.02d:%.02d:%.02d " TXT_QUEUELENGTH " %d", h, m, s, l);
lbl_recordtime->setText(msg);
}
@@ -402,12 +408,12 @@ void MainWindow::redraw_edge()
void MainWindow::message(char *msg)
{
status->showMessage(msg);
- info->log("Message: %s", msg);
+ gInfo::info->log("Message: %s", msg);
}
void MainWindow::clear()
{
- info->log("Clearing screen.");
+ gInfo::info->log("Clearing screen.");
// History widgets
@@ -451,7 +457,7 @@ void MainWindow::cpr_clicked()
ICON_WARNING).exec();
return;
}
- info->log("Activated CPR chooser.");
+ gInfo::info->log("Activated CPR chooser.");
// Save CPR and name, from the labels.
strcpy(oldname, lbl_name->text().toStdString().c_str());
@@ -460,22 +466,22 @@ void MainWindow::cpr_clicked()
clear();
// Create and call the CPRQueryDialog.
- CPRQueryDialog dlg(info, lbl_cpr, lbl_name, this, TXT_CPRDLG_TITLE, status);
+ CPRQueryDialog dlg(lbl_cpr, lbl_name, this, TXT_CPRDLG_TITLE, status);
if(dlg.exec() == 0) {
// Restore old CPR and name, in the labels.
lbl_name->setText(oldname);
lbl_cpr->setText(oldcpr);
- info->log("Cancelled CPR chooser.");
+ gInfo::info->log("Cancelled CPR chooser.");
} else {
// Change CPR camera.
- info->log("New CPR %s (old %s).", (char*)lbl_cpr->text().toStdString().c_str(), oldcpr);
+ gInfo::info->log("New CPR %s (old %s).", (char*)lbl_cpr->text().toStdString().c_str(), oldcpr);
strcpy(oldname, lbl_name->text().toStdString().c_str());
strcpy(oldcpr, lbl_cpr->text().toStdString().c_str());
clear();
lbl_name->setText(oldname);
lbl_cpr->setText(oldcpr);
- camera->setCpr((char*)lbl_cpr->text().toStdString().c_str(), (char*)lbl_name->text().toStdString().c_str());
+ // camera->setCpr((char*)lbl_cpr->text().toStdString().c_str(), (char*)lbl_name->text().toStdString().c_str());
}
}
@@ -485,14 +491,14 @@ void MainWindow::rec_clicked()
QPixmap pixmap;
if(!recording) {
- info->log("Start recording.");
+ gInfo::info->log("Start recording.");
recording = 1;
// Start flashing the edge
rec_edge_counter = 0.0f;
timer->start(100);
pixmap.fromImage(*img_stop);
btn_rec->setIcon(pixmap);
- camera->start();
+ // camera->start();
} else {
switch(MessageBox(this,
TXT_ASK_SAVE_TITLE,
@@ -500,9 +506,9 @@ void MainWindow::rec_clicked()
TYPE_YES_NO_MAYBE_CANCEL,
ICON_QUESTION).exec()) {
case MSG_YES:
- info->log("Stop recording (Said yes to save).");
+ gInfo::info->log("Stop recording (Said yes to save).");
recording = 0;
- camera->stop(SAVE);
+ // camera->stop(SAVE);
timer->stop();
palette.setColor(img_recedge->backgroundRole(), QColor(160,160,160));
img_recedge->setPalette(palette);
@@ -511,9 +517,9 @@ void MainWindow::rec_clicked()
break;
case MSG_NO:
- info->log("Stop recording (Said no to save).");
+ gInfo::info->log("Stop recording (Said no to save).");
recording = 0;
- camera->stop(DELETE);
+ // camera->stop(DELETE);
timer->stop();
palette.setColor(img_recedge->backgroundRole(), QColor(160,160,160));
img_recedge->setPalette(palette);
@@ -522,9 +528,9 @@ void MainWindow::rec_clicked()
break;
case MSG_MAYBE:
- info->log("Stop recording (Said maybe to save).");
+ gInfo::info->log("Stop recording (Said maybe to save).");
recording = 0;
- camera->stop(LATER);
+ // camera->stop(LATER);
timer->stop();
palette.setColor(img_recedge->backgroundRole(), QColor(160,160,160));
img_recedge->setPalette(palette);
@@ -533,7 +539,7 @@ void MainWindow::rec_clicked()
break;
case MSG_CANCEL:
- info->log("Didn't stop recording (canceled).");
+ gInfo::info->log("Didn't stop recording (canceled).");
break;
}
}
@@ -542,11 +548,11 @@ void MainWindow::rec_clicked()
void MainWindow::shoot_clicked()
{
// unsigned char pixels[720*576*3];
- info->log("Snapshot (%s).", frozen?"frozen":"unfrozen");
+ gInfo::info->log("Snapshot (%s).", frozen?"frozen":"unfrozen");
QImage screenshot(720, 576, QImage::Format_RGB32);
- camera->snapshot(screenshot.bits());
+ // camera->snapshot(screenshot.bits());
QImage *image;
for(int cnt = (num_history-1); cnt > 0; cnt--) {
@@ -556,7 +562,7 @@ void MainWindow::shoot_clicked()
img_history[0]->set_image(&screenshot);
if(frozen) {
- camera->unfreeze();
+ // camera->unfreeze();
QPixmap pixmap;
pixmap.fromImage(*img_freeze);
@@ -570,8 +576,8 @@ void MainWindow::shoot_clicked()
void MainWindow::freeze_clicked()
{
if(frozen) {
- info->log("Unfreeze.");
- camera->unfreeze();
+ gInfo::info->log("Unfreeze.");
+ // camera->unfreeze();
QPixmap pixmap;
pixmap.fromImage(*img_freeze);
@@ -580,8 +586,8 @@ void MainWindow::freeze_clicked()
btn_freeze->setDown(false);
frozen = false;
} else {
- info->log("Freeze.");
- camera->freeze();
+ gInfo::info->log("Freeze.");
+ // camera->freeze();
QPixmap pixmap;
pixmap.fromImage(*img_freeze);
@@ -605,7 +611,7 @@ void MainWindow::mute_clicked()
btn_mute->setIcon(pixmap);
}
- camera->setMute(muted);
+ // camera->setMute(muted);
}
#endif /*USE_GUI*/
diff --git a/client/mainwindow.h b/client/mainwindow.h
index 435d20d..627b431 100644
--- a/client/mainwindow.h
+++ b/client/mainwindow.h
@@ -42,12 +42,9 @@ using namespace std;
#include <QImage>
#include "videowidget.h"
-#include "camera.h"
#include "cprquerydialog.h"
#include "historywidget.h"
-#include "info_gui.h"
-
#define INCH_IN_CM 2.54f
/**
@@ -120,14 +117,8 @@ private:
unsigned int num_history;
void clear();
-
- Info *info;
-
void createGui();
- Camera *camera;
- Info *cam_info;
-
// Image loading routines.
QImage *loadButtonIcon( char *name, int height = BUTTON_HEIGHT );
QImage *loadImage( char *name );
diff --git a/client/messagebox.cc b/client/messagebox.cc
index abd7479..f4797ab 100644
--- a/client/messagebox.cc
+++ b/client/messagebox.cc
@@ -39,8 +39,8 @@
*/
MessageBox::MessageBox(QWidget* parent,
- const char* name,
- const char* text,
+ const QString name,
+ const QString text,
msg_type type,
msg_icon icon)
: QDialog(parent)
@@ -49,7 +49,7 @@ MessageBox::MessageBox(QWidget* parent,
//int resolution_h = config->readInt("pixel_height");
unit = ((float)resolution_w / config->readFloat("screensize")) / INCH_IN_CM;
-
+ setModal(true);
setWindowTitle(name);
QFrame *topf = new QFrame(this);
topf->setFrameStyle(QFrame::Box | QFrame::Raised);
diff --git a/client/messagebox.h b/client/messagebox.h
index e2c576c..2ac1d12 100644
--- a/client/messagebox.h
+++ b/client/messagebox.h
@@ -88,8 +88,8 @@ class MessageBox : public QDialog
Q_OBJECT
public:
MessageBox(QWidget* parent = 0,
- const char* name = "",
- const char* text = "",
+ const QString name = "",
+ const QString text = "",
msg_type type = TYPE_OK,
msg_icon icon = ICON_DEFAULT);
~MessageBox();
diff --git a/client/miav_client.cc b/client/miav_client.cc
index f8ea6d2..29826ef 100644
--- a/client/miav_client.cc
+++ b/client/miav_client.cc
@@ -1,6 +1,6 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/***************************************************************************
- * miav.cc
+ * miav_client.cc
*
* Sat Aug 21 17:32:24 2004
* Copyright 2004 deva
@@ -26,35 +26,37 @@
*/
#include <config.h>
-#include "miav_client.h"
-
#include <QApplication>
-#include <stdio.h>
#include "mainwindow.h"
#include "miav_config.h"
#include "info_gui.h"
+// The threads
+#include "decoder.h"
+#include "player.h"
+#include "networksender.h"
-QApplication *miav_app;
-
-/**
- * This function starts the MIaV gui.
- */
int main(int argc, char *argv[])
{
QApplication miav_grab( argc, argv );
- miav_app = &miav_grab;
MiavConfig cfg(ETC"/miav.conf", NULL);
- InfoGui info(&miav_grab, NULL, &cfg);
+
+ InfoGui info(&cfg);
+ gInfo::initInfo(&info);
+
config = new MiavConfig(ETC"/miav.conf", &info);
- InfoEventHandler *eventhandler = new InfoEventHandler( );
- miav_grab.installEventFilter( eventhandler );
-
MainWindow mainwindow;
- info.setParent(&mainwindow);
+ Decoder decoder;
+ Player player;
+ NetworkSender sender;
+
+ decoder.start();
+ player.start();
+ sender.start();
+
return miav_grab.exec();
}
diff --git a/client/miav_client.h b/client/miav_client.h
deleted file mode 100644
index 7b14912..0000000
--- a/client/miav_client.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/***************************************************************************
- * miav.h
- *
- * Mon Nov 8 09:59:24 CET 2004
- * Copyright 2004 Bent Bisballe
- * deva@aasimon.org
- ****************************************************************************/
-
-/*
- * This file is part of MIaV.
- *
- * MIaV is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MIaV is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * 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"
-#ifndef __LIBMIAV_H__
-#define __LIBMIAV_H__
-
-#include "util.h"
-
-#include "network.h"
-#include "socket.h"
-#include "queue.h"
-
-#ifdef USE_GUI
-#include <QApplication>
-extern QApplication *miav_app;
-#endif/*USE_GUI*/
-
-#endif/*__LIBMIAV_H__*/
diff --git a/client/networksender.cc b/client/networksender.cc
index 1755cda..19df3f3 100644
--- a/client/networksender.cc
+++ b/client/networksender.cc
@@ -27,6 +27,8 @@
#include "config.h"
#include "networksender.h"
+#include "info.h"
+
NetworkSender::NetworkSender()
{}
@@ -34,4 +36,6 @@ NetworkSender::~NetworkSender()
{}
void NetworkSender::run()
-{}
+{
+ gInfo::info->info("The NetworkSender thread is running.");
+}
diff --git a/client/player.cc b/client/player.cc
index b54767e..cec7b0f 100644
--- a/client/player.cc
+++ b/client/player.cc
@@ -27,6 +27,8 @@
#include "config.h"
#include "player.h"
+#include "info.h"
+
Player::Player()
{}
@@ -34,4 +36,6 @@ Player::~Player()
{}
void Player::run()
-{}
+{
+ gInfo::info->info("The player thread is running.");
+}
diff --git a/client/player.h b/client/player.h
index 6e3fe73..97b08a0 100644
--- a/client/player.h
+++ b/client/player.h
@@ -37,6 +37,6 @@ public:
~Player();
void run();
-}
+};
#endif/*__MIAV_PLAYER_H__*/
diff --git a/client/videowidget.cc b/client/videowidget.cc
index a2d5a14..8f733d5 100644
--- a/client/videowidget.cc
+++ b/client/videowidget.cc
@@ -32,9 +32,8 @@
#include "miav_config.h"
-VideoWidget::VideoWidget(QWidget *p, Camera *c, QWidget* old) : QWidget(p)
+VideoWidget::VideoWidget(QWidget *p, QWidget* old) : QWidget(p)
{
- camera = c;
parent = p;
oldWindow = old;
@@ -60,16 +59,16 @@ void VideoWidget::mouseReleaseEvent(QMouseEvent *event)
if(!parent) { // We are a fullscreen window
QString ids;
setenv("SDL_WINDOWID", ids.setNum(oldWindow->winId()).toStdString().c_str(), 1);
- camera->resize(oldWindow->width(), oldWindow->height(), false);
+ // camera->resize(oldWindow->width(), oldWindow->height(), false);
destroy();
} else { // We are a nested window
// first delete old instance (if any)
if(fs) delete fs;
- fs = new VideoWidget(NULL, camera, this);
+ fs = new VideoWidget(NULL, this);
fs->showFullScreen();
fs->setFixedWidth(config->readInt("pixel_width"));
fs->setFixedHeight(config->readInt("pixel_height"));
- camera->resize(fs->width(), fs->height(), true);
+ //camera->resize(fs->width(), fs->height(), true);
}
}
diff --git a/client/videowidget.h b/client/videowidget.h
index f088bfc..3ccbd97 100644
--- a/client/videowidget.h
+++ b/client/videowidget.h
@@ -33,19 +33,15 @@
#include <QWidget>
#include <QPixmap>
-#include "camera.h"
-
class VideoWidget : public QWidget {
Q_OBJECT
public:
- VideoWidget(QWidget *parent, Camera *camera, QWidget *old = NULL);
+ VideoWidget(QWidget *parent, QWidget *old = NULL);
~VideoWidget();
QPixmap getScreenshot();
void mouseReleaseEvent(QMouseEvent *event);
private:
- Camera *camera;
-
QWidget *parent;
// Reassign SDL to this when closing (if non-NULL)
diff --git a/client/yuv_draw.cc b/client/yuv_draw.cc
index 156c705..74f8dcf 100644
--- a/client/yuv_draw.cc
+++ b/client/yuv_draw.cc
@@ -28,9 +28,6 @@
#ifdef USE_GUI
#include "yuv_draw.h"
-// for miav_app
-#include "miav_client.h"
-
#include <string.h>
#define TEXT_MARGIN 10