summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authordeva <deva>2006-03-07 19:12:18 +0000
committerdeva <deva>2006-03-07 19:12:18 +0000
commit4f84ffc811d93371f395f11a0e0f42000eaa99fc (patch)
treeb562b6c55f2a825dbbc12646df9741b51e1dff79 /client
parent1390ddfe6afe41dba141f8170f9b277573ebe8cd (diff)
*** empty log message ***
Diffstat (limited to 'client')
-rw-r--r--client/Makefile.am4
-rw-r--r--client/aboutwindow.h2
-rw-r--r--client/cprlisten.cc10
-rw-r--r--client/cprquerydialog.cc8
-rw-r--r--client/decoder.cc2
-rw-r--r--client/dv1394.cc6
-rw-r--r--client/dvfile.cc2
-rw-r--r--client/historyframe.cc68
-rw-r--r--client/historyframe.h50
-rw-r--r--client/historywidget.cc34
-rw-r--r--client/historywidget.h7
-rw-r--r--client/mainwindow.cc585
-rw-r--r--client/mainwindow.h120
-rw-r--r--client/messagebox.cc10
-rw-r--r--client/miav_client.cc13
-rw-r--r--client/networksender.cc2
-rw-r--r--client/player.cc2
-rw-r--r--client/splashscreen.cc55
-rw-r--r--client/splashscreen.h52
-rw-r--r--client/videowidget.cc40
-rw-r--r--client/videowidget.h19
21 files changed, 369 insertions, 722 deletions
diff --git a/client/Makefile.am b/client/Makefile.am
index 803bf51..a89f214 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -15,11 +15,13 @@ miav_client_SOURCES = $(shell if [ $QT_CXXFLAGS ] ; then ../tools/MocList cc; f
dv1394.cc \
dvfile.cc \
networksender.cc \
+ historyframe.cc \
historywidget.cc \
info_gui.cc \
mainwindow.cc \
messagebox.cc \
player.cc \
+ splashscreen.cc \
videowidget.cc \
yuv_draw.cc
@@ -32,11 +34,13 @@ EXTRA_DIST = \
dv1394.h \
dvfile.h \
networksender.h \
+ historyframe.h \
historywidget.h \
info_gui.h \
mainwindow.h \
messagebox.h \
player.h \
+ splashscreen.h \
videowidget.h \
yuv_draw.h
diff --git a/client/aboutwindow.h b/client/aboutwindow.h
index 25fb6f0..a062302 100644
--- a/client/aboutwindow.h
+++ b/client/aboutwindow.h
@@ -41,7 +41,7 @@ Official homepage:\n\
http://www.aasimon.org/miav\n\
Author:\n\
Bent Bisballe (deva@aasimon.org)\n\
-Copyright (c) 2004"
+Copyright (c) 2004-2006"
#define GPL_LICENSE "\
This program is free software; you can\n\
diff --git a/client/cprlisten.cc b/client/cprlisten.cc
index 4c1272e..035269a 100644
--- a/client/cprlisten.cc
+++ b/client/cprlisten.cc
@@ -56,13 +56,13 @@ void CPRListen::stop()
socket.connect("localhost", port);
socket.send_string(MAGIC_STOP_STRING);
} catch(Network_error &e) {
- gInfo::info->error("In stop(): %s.", e.error.c_str());
+ MIaV::info->error("In stop(): %s.", e.error.c_str());
}
}
void CPRListen::thread_main()
{
- gInfo::info->log("Listening for CPRs.");
+ MIaV::info->log("Listening for CPRs.");
while(running) {
try {
string newcpr;
@@ -77,15 +77,15 @@ void CPRListen::thread_main()
cprchanged = true;
cpr = newcpr;
mutex.unlock();
- gInfo::info->log("Got CPR: %s.", cpr.c_str());
+ MIaV::info->log("Got CPR: %s.", cpr.c_str());
}
} catch(Network_error &e) {
- gInfo::info->error("In thread_main(): %s.", e.error.c_str());
+ MIaV::info->error("In thread_main(): %s.", e.error.c_str());
running = false;
}
}
- gInfo::info->log("Stopped listening for CPRs.");
+ MIaV::info->log("Stopped listening for CPRs.");
}
bool CPRListen::cprChanged()
diff --git a/client/cprquerydialog.cc b/client/cprquerydialog.cc
index 1461943..47224f0 100644
--- a/client/cprquerydialog.cc
+++ b/client/cprquerydialog.cc
@@ -52,9 +52,9 @@ CPRQueryDialog::CPRQueryDialog(QLabel *lcpr,
statusbar = status;
//Read configuration
- CPR_HOST = config->readString("cpr_host");
- CPR_PORT = config->readInt("cpr_port");
- CPR_TIMEOUT = config->readInt("cpr_timeout");
+ CPR_HOST = MIaV::config->readString("cpr_host");
+ CPR_PORT = MIaV::config->readInt("cpr_port");
+ CPR_TIMEOUT = MIaV::config->readInt("cpr_timeout");
cpr[0] = '\0';
internalCpr[0] = '\0';
@@ -116,7 +116,7 @@ CPRQueryDialog::CPRQueryDialog(QLabel *lcpr,
this->move(175,150);
- listen = new CPRListen(config->readInt("cprlisten_port"));
+ listen = new CPRListen(MIaV::config->readInt("cprlisten_port"));
listen_timer = new QTimer(this);
connect(listen_timer, SIGNAL(timeout()), SLOT(listen_timeout()));
listen->run();
diff --git a/client/decoder.cc b/client/decoder.cc
index f90e1dd..85661ca 100644
--- a/client/decoder.cc
+++ b/client/decoder.cc
@@ -37,6 +37,6 @@ Decoder::~Decoder()
void Decoder::run()
{
- gInfo::info->info("The decoder thread is running.");
+ // MIaV::info->info("The decoder thread is running.");
}
diff --git a/client/dv1394.cc b/client/dv1394.cc
index 611d815..ea32f7a 100644
--- a/client/dv1394.cc
+++ b/client/dv1394.cc
@@ -127,13 +127,13 @@ bool dv1394::connect()
// Get handle to firewire channels
handle = raw1394_new_handle();
if(!handle) {
- gInfo::info->error("raw1394 - failed to get handle: %s.", strerror( errno ) );
+ MIaV::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 ) {
- gInfo::info->error("raw1394 - failed to get port info: %s.", strerror( errno ) );
+ MIaV::info->error("raw1394 - failed to get port info: %s.", strerror( errno ) );
raw1394_destroy_handle(handle);
handle = NULL;
return false;
@@ -141,7 +141,7 @@ bool dv1394::connect()
// Tell raw1394 which host adapter to use
if(raw1394_set_port(handle, port) < 0 ) {
- gInfo::info->error("raw1394 - failed to set port: %s.", strerror( errno ) );
+ MIaV::info->error("raw1394 - failed to set port: %s.", strerror( errno ) );
raw1394_destroy_handle(handle);
handle = NULL;
return false;
diff --git a/client/dvfile.cc b/client/dvfile.cc
index 8caecc0..2f13e5e 100644
--- a/client/dvfile.cc
+++ b/client/dvfile.cc
@@ -35,7 +35,7 @@
dvfile::dvfile()
{
fp = fopen(TEST_MOVIE, "r");
- if(!fp) gInfo::info->error("Couldn't open %s for reading.", TEST_MOVIE);
+ if(!fp) MIaV::info->error("Couldn't open %s for reading.", TEST_MOVIE);
}
dvfile::~dvfile()
diff --git a/client/historyframe.cc b/client/historyframe.cc
new file mode 100644
index 0000000..ad9154b
--- /dev/null
+++ b/client/historyframe.cc
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/***************************************************************************
+ * historyframe.cc
+ *
+ * Tue Mar 7 17:50:00 CET 2006
+ * Copyright 2006 Bent Bisballe Nyeng
+ * 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"
+#include "historyframe.h"
+
+#include <QVBoxLayout>
+#include <QResizeEvent>
+
+HistoryFrame::HistoryFrame()
+{
+ QVBoxLayout *layout = new QVBoxLayout();
+ setLayout(layout);
+}
+
+HistoryFrame::~HistoryFrame()
+{
+}
+
+void HistoryFrame::addHistoryItem(HistoryWidget *item)
+{
+ widgets.append(item);
+}
+
+void HistoryFrame::resizeEvent(QResizeEvent *event)
+{
+ int w = event->size().width();
+ int h = event->size().height();
+
+ int widget_height = h / 10;
+
+ int num_widgets = h / widget_height;
+ int top = num_widgets<widgets.size()?num_widgets:widgets.size();
+
+ while(layout()->count()) {
+ layout()->removeItem(layout()->itemAt(0)); // Remove all widgets
+ }
+
+ for(int i = 0; i < top; i++) {
+ HistoryWidget *history = widgets.at(i);
+ history->resize(w, widget_height);
+ layout()->addWidget(history);
+ }
+
+}
diff --git a/client/historyframe.h b/client/historyframe.h
new file mode 100644
index 0000000..39366a9
--- /dev/null
+++ b/client/historyframe.h
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/***************************************************************************
+ * historyframe.h
+ *
+ * Tue Mar 7 17:49:59 CET 2006
+ * Copyright 2006 Bent Bisballe Nyeng
+ * 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 __MIAV_HISTORYFRAME_H__
+#define __MIAV_HISTORYFRAME_H__
+
+#include <QFrame>
+#include <QList>
+#include "historywidget.h"
+
+class HistoryFrame : public QFrame
+{
+public:
+ HistoryFrame();
+ ~HistoryFrame();
+
+ void addHistoryItem(HistoryWidget *item);
+
+protected:
+ void resizeEvent(QResizeEvent *event);
+
+private:
+ QList<HistoryWidget*> widgets;
+};
+
+#endif/*__MIAV_HISTORYFRAME_H__*/
diff --git a/client/historywidget.cc b/client/historywidget.cc
index 55fb178..ba768eb 100644
--- a/client/historywidget.cc
+++ b/client/historywidget.cc
@@ -24,18 +24,20 @@
* 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 "historywidget.h"
#include "miav_config.h"
#include <QPixmap>
+#include <QResizeEvent>
-HistoryWidget::HistoryWidget(QWidget *p) : QLabel(p)
+#define PIXMAP_DUMMY PIXMAPS"/dummy.png"
+HistoryWidget::HistoryWidget() : QLabel()
{
- parent = p;
image = NULL;
+ // set_image(new QImage(PIXMAP_DUMMY));
+ setLineWidth(1);
+ setFrameStyle(QFrame::Plain);
}
HistoryWidget::~HistoryWidget()
@@ -44,7 +46,7 @@ HistoryWidget::~HistoryWidget()
}
void HistoryWidget::set_image(QImage *i)
-{
+{/*
if(image) delete image;
image = new QImage(*i);
@@ -53,6 +55,7 @@ void HistoryWidget::set_image(QImage *i)
QPixmap pixmap;
pixmap.fromImage(resized);
setPixmap(pixmap);
+ */
}
QImage * HistoryWidget::get_image()
@@ -60,10 +63,11 @@ QImage * HistoryWidget::get_image()
return image;
}
-static HistoryWidget *fs = NULL;
+//static HistoryWidget *fs = NULL;
void HistoryWidget::mouseReleaseEvent(QMouseEvent *event)
{
+ /*
if(!parent) { // We are a fullscreen window
destroy();
} else { // We are a nested window
@@ -72,10 +76,22 @@ void HistoryWidget::mouseReleaseEvent(QMouseEvent *event)
fs = new HistoryWidget(NULL);
fs->showFullScreen();
- fs->setFixedWidth(config->readInt("pixel_width"));
- fs->setFixedHeight(config->readInt("pixel_height"));
+ fs->setFixedWidth(MIaV::config->readInt("pixel_width"));
+ fs->setFixedHeight(MIaV::config->readInt("pixel_height"));
fs->set_image(image);
}
+ */
}
-#endif/*USE_GUI*/
+void HistoryWidget::resizeEvent(QResizeEvent *event)
+{
+ /*
+ QImage resized = image->scaled(event->size().width(),
+ event->size().height(),
+ Qt::KeepAspectRatio,
+ Qt::SmoothTransformation);
+ QPixmap pixmap;
+ pixmap.fromImage(resized);
+ setPixmap(pixmap);
+ */
+}
diff --git a/client/historywidget.h b/client/historywidget.h
index b798ddb..dd2345d 100644
--- a/client/historywidget.h
+++ b/client/historywidget.h
@@ -25,7 +25,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#include "config.h"
-#ifdef USE_GUI
#ifndef __MIAV_HISTORYWIDGET_H__
#define __MIAV_HISTORYWIDGET_H__
@@ -35,7 +34,7 @@
class HistoryWidget : public QLabel {
Q_OBJECT
public:
- HistoryWidget(QWidget *parent);
+ HistoryWidget();
~HistoryWidget();
void set_image(QImage *image);
@@ -43,10 +42,12 @@ public:
void mouseReleaseEvent(QMouseEvent *event);
+protected:
+ void resizeEvent(QResizeEvent *event);
+
private:
QImage *image;
QWidget *parent;
};
#endif/*__MIAV_HISTORYWIDGET_H__*/
-#endif/*USE_GUI*/
diff --git a/client/mainwindow.cc b/client/mainwindow.cc
index 8efcad0..3a0eeab 100644
--- a/client/mainwindow.cc
+++ b/client/mainwindow.cc
@@ -25,407 +25,96 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#include <config.h>
-#ifdef USE_GUI
#include "mainwindow.h"
-
-#include <QPainter>
-#include <QPicture>
-#include <QPushButton>
-#include <QFont>
-#include <QPixmap>
-#include <QBitmap>
-#include <QImage>
-#include <QLayout>
-#include <QGroupBox>
-#include <QStatusBar>
-
-#include <math.h>
-
#include "info.h"
-
-//#include "mgui_alert.h"
-//#include "mgui_datasocket.h"
-
#include "miav_config.h"
+#include "splashscreen.h"
+#include "aboutwindow.h"
-#include <config.h>
-//"miav-grab.h"
-
-//#define WITH_DV
-MainWindow::MainWindow(QWidget* parent )
- : QWidget( parent, Qt::FramelessWindowHint )
-{
- // info = new InfoGui(qApp, this, config);
-
- gInfo::info->info("Starting MIaV v. %s.", VERSION);
-
- video_width = config->readInt("video_width");
- video_height = config->readInt("video_height");
-
- int resolution_w = config->readInt("pixel_width");
- int resolution_h = config->readInt("pixel_height");
-
- unit = ((float)resolution_w / config->readFloat("screensize")) / INCH_IN_CM;
-
- printf("Unit: %f\n", unit);
-
- move(0,0);
- resize(resolution_w, resolution_h);
-
- // Load icons
- img_record = loadButtonIcon( PIXMAP_RECORD );
- img_stop = loadButtonIcon( PIXMAP_STOP );
- img_freeze = loadButtonIcon( PIXMAP_FREEZE );
- img_unfreeze = loadButtonIcon( PIXMAP_UNFREEZE );
- img_cpr = loadButtonIcon( PIXMAP_CPR );
- img_clear = loadButtonIcon( PIXMAP_CLEAR );
- img_snapshot = loadButtonIcon( PIXMAP_SNAPSHOT );
- img_logo = loadButtonIcon( PIXMAP_LOGO_SMALL, 1 );
- img_mute = loadButtonIcon( PIXMAP_MUTE );
- img_unmute = loadButtonIcon( PIXMAP_UNMUTE );
-
- img_dummy = loadImage( PIXMAP_DUMMY );
-
- timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), SLOT(redraw_edge()));
- rec_edge_counter = 0.0f;
-
- // This must be defined before the gui i created (img_live uses it as parameter)
- // 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()));
- taskbartimer->start(200);
-
- recording = false;
- frozen = false;
- muted = false;
-
- gInfo::info->log("MIaV is ready.");
-
- // Open the CPR Dialog
- cpr_clicked();
-
-}
-
-MainWindow::~MainWindow()
-{
- gInfo::info->log("MIaV is shutting down.");
-
- delete img_history;
- // delete camera;
- delete btn_cpr;
+#include <QGridLayout>
- gInfo::info->log("MIaV is shut down.");
-}
+#include "videowidget.h"
+#include "historyframe.h"
+#include "historywidget.h"
-QImage *MainWindow::loadButtonIcon( char *name, int height )
+// Macro for creating buttons
+static QPushButton *createButton(char* icon)
{
+ QPixmap pixmap(icon);
- QImage scaled;
- QImage *img;
-
- img = new QImage();
- img->load( name );
+ Qt::AspectRatioMode aspect = pixmap.width()<pixmap.height()?
+ Qt::KeepAspectRatio:Qt::KeepAspectRatioByExpanding;
- int h = (int)(height * unit);
- int w = (int)((float)img->width() / (float)(img->height() / (float)h));
+ pixmap = pixmap.scaled(50, 50, aspect, Qt::SmoothTransformation);
+ QPushButton *btn = new QPushButton();
+ btn->setIconSize(pixmap.size());
+ btn->setIcon(pixmap);
- scaled = img->scaled(w, h, Qt::KeepAspectRatio, Qt::SmoothTransformation);
- delete img;
- img = new QImage(scaled);
-
- return img;
+ return btn;
}
-QImage *MainWindow::loadImage( char *name )
+MainWindow::MainWindow(): QWidget()
{
- QImage *img;
+ MIaV::info->log("Starting MIaV v. %s.", VERSION);
- img = new QImage();
- img->load( name );
+ // Create the overlaying splashscreen
+ // SplashScreen splash;
- return img;
-}
+ // Create layout
+ QGridLayout *layout = new QGridLayout(this);
+ setLayout(layout);
-void MainWindow::createGui()
-{
- // Layout widgets
-
- /* __________________________________________________
- *(0) ___________________________ | ______________ |
- * | | | | | | | | | |
- * |(1) | | | | |(2) | |
- * | | | | | | | | | |
- * | | | | | | | | | |
- * | | | | | | | |______________| |
- * | | | | | | | | | |
- * | | | | | | | | | |
- * | | | | | | | | | |
- * | |______|______|______|______| | | | |
- * | | | | | | | |______________| |
- * | |______|______|______|______| | | | |
- * | | | | | | | | | |
- * | |______|______|______|______| | | | |
- * | | | | | | | | | |
- * | |______|______|______|______| | |______________| |
- * |_______________________________|__________________|
- * |_______________________________|__________________|
- */
-
- QPixmap pixmap;
-
- QGridLayout *g0 = new QGridLayout(this);
- QGridLayout *g1 = new QGridLayout();
- g0->addLayout(g1, 0, 0);
-
- QGroupBox *gb = new QGroupBox();
- /*
- gb->setColumns(1);
- gb->setInsideMargin(HISTORY_LIST_MARGIN);
- gb->setInsideSpacing(HISTORY_LIST_SPACING);
- gb->setFlat(true);
- g0->addWidget(gb, 0, 1);
- */
-
- int resolution_w = config->readInt("pixel_width");
- int resolution_h = config->readInt("pixel_height");
-
- int output_width = resolution_w - // this->width() -
- (int)(BUTTON_WIDTH * unit) -
- /* (gb->insideMargin() * 2) - */
- g1->margin() * 2 -
- g0->margin() * 2;
-
- int output_height = resolution_h - // this->height() -
- (int)(3 * BUTTON_HEIGHT * unit) -
- g1->margin() * 5 -
- g0->margin() * 3;
-
- img_recedge = new QLabel();
- QPalette palette;
- palette.setColor(img_recedge->backgroundRole(), QColor(160,160,160));
- img_recedge->setPalette(palette);
- img_recedge->setFixedSize(output_width, output_height);
-
- 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);
-
- // CPR/NAME LABEL + CPR button
- lbl_cpr = createLabel("", output_width - (int)(BUTTON_WIDTH * unit), BUTTON_HEIGHT);
- g1->addWidget( lbl_cpr, 1, 0, 1, 2);
-
- btn_cpr = createButton("");
- btn_cpr->setFocus();
- pixmap.fromImage(*img_cpr);
- btn_cpr->setIcon(pixmap);
- QObject::connect( btn_cpr, SIGNAL(clicked()), this, SLOT(cpr_clicked()) );
- // Will also be connected in the MGUI code
- g1->addWidget(btn_cpr, 1, 3);
-
- lbl_name = createLabel("", output_width, (int)(BUTTON_HEIGHT * 0.8f));
- g1->addWidget( lbl_name, 2, 0, 1, 2);
-/*
- btn_clear = createButton("");
- btn_clear->setPixmap(*img_clear);
- QObject::connect( btn_clear, SIGNAL(clicked()), this, SLOT(clear_clicked()) );
- // Will also be connected in the MGUI code
- g1->addWidget(btn_clear, 1, 2);
-*/
- // Rec + Shot + Freeze buttons
- btn_rec = createButton("");
- pixmap.fromImage(*img_record);
- btn_rec->setIcon(pixmap);
- QObject::connect( btn_rec, SIGNAL(clicked()), this, SLOT(rec_clicked()) );
- g1->addWidget(btn_rec, 3, 0);
-
- btn_shoot = createButton("");
- pixmap.fromImage(*img_snapshot);
- btn_shoot->setIcon(pixmap);
- QObject::connect( btn_shoot, SIGNAL(clicked()), this, SLOT(shoot_clicked()) );
- g1->addWidget(btn_shoot, 3, 1);
-
- btn_freeze = createButton("");
- pixmap.fromImage(*img_freeze);
- btn_freeze->setIcon(pixmap);
- QObject::connect( btn_freeze, SIGNAL(clicked()), this, SLOT(freeze_clicked()) );
- g1->addWidget(btn_freeze, 3, 2);
-
- btn_mute = createButton("");
- pixmap.fromImage(*img_unmute);
- btn_mute->setIcon(pixmap);
- QObject::connect( btn_mute, SIGNAL(clicked()), this, SLOT(mute_clicked()) );
- g1->addWidget(btn_mute, 3, 3);
-
- // History widgets
- int w = (int)((float)BUTTON_WIDTH * unit);
- int h = (int)(576.0f / (720.0f / ((float)BUTTON_WIDTH * unit)));
-
- int window_height = config->readInt("pixel_height");
- this->num_history = (window_height -
- ((int)unit * BUTTON_HEIGHT + HISTORY_LIST_SPACING ) -
- (2 * HISTORY_LIST_MARGIN)) / (h + HISTORY_LIST_SPACING);
- img_history = new HistoryWidget*[this->num_history];
-
- for(unsigned int i = 0; i < num_history; i++) {
- img_history[i] = new HistoryWidget(gb);
- img_history[i]->set_image(img_dummy);
- img_history[i]->setFixedSize(w, h);
- }
-
- // Clear button
- btn_clear = createButton("", gb);
- pixmap.fromImage(*img_clear);
- btn_clear->setIcon(pixmap);
- QObject::connect( btn_clear, SIGNAL(clicked()), this, SLOT(clear_clicked()) );
-
- // Statusbar
- status = new QStatusBar(this);
- status->setSizeGripEnabled(FALSE);
- // status->setFont(QFont( "Sans Serif", (int)(unit * height / 3), QFont::Normal ));
- g0->addWidget(status, 4, 0, 4, 1);
-
- lbl_recordtime = createLabel("", BUTTON_WIDTH, 1);
- lbl_recordtime->setFixedWidth((int)(BUTTON_WIDTH * unit) +
- /* (gb->insideMargin() * 2) + */
- g1->margin() * 2 +
- g0->margin() * 2);
- status->addWidget(lbl_recordtime, 0);
-
- // About button
- btn_about = new QPushButton();
- btn_about->setFixedHeight((int)unit);
- pixmap.fromImage(*img_logo);
- btn_about->setIcon(pixmap);
- QObject::connect( btn_about, SIGNAL(clicked()), this, SLOT(about_clicked()) );
- status->addWidget(btn_about, 0);
-
- // Version label
- lbl_version = createLabel("MIaV-Grab v" VERSION, BUTTON_WIDTH, 1);
- lbl_version->setFixedWidth((int)(BUTTON_WIDTH * unit) +
- /* (gb->insideMargin() * 2) + */
- g1->margin() * 2 +
- g0->margin() * 2);
- status->addWidget(lbl_version, 0);
-
- status->showMessage( TXT_READY );
-}
+ // Create the videoarea
+ VideoWidget *video = new VideoWidget();
+ layout->addWidget(video, 0,0, 1,4);
+ // Create the control buttons
+ QPushButton *button;
-QPushButton *MainWindow::createButton(char *caption, int width, int height)
-{
- return createButton(caption, this);//, width, height);
-}
+ button = createButton(PIXMAP_CPR);
+ layout->addWidget(button, 1,3, 1,1);
+ connect(button, SIGNAL(clicked()), this, SLOT(cpr_clicked()));
+ button = createButton(PIXMAP_RECORD);
+ layout->addWidget(button, 2,0, 1,1);
+ connect(button, SIGNAL(clicked()), this, SLOT(record_clicked()));
-QPushButton *MainWindow::createButton(char *caption, QWidget *parent, int width, int height)
-{
- QPushButton *btn = new QPushButton(caption, parent);
- btn->setFont( QFont( "Sans Serif", (int)(unit * height / 2), QFont::Bold ) );
- btn->setFixedHeight((int)(unit * height));
- // btn->setFixedWidth((int)(unit * width));
- return btn;
-}
+ button = createButton(PIXMAP_SNAPSHOT);
+ layout->addWidget(button, 2,1, 1,1);
+ connect(button, SIGNAL(clicked()), this, SLOT(snapshot_clicked()));
+ button = createButton(PIXMAP_FREEZE);
+ layout->addWidget(button, 2,2, 1,1);
+ connect(button, SIGNAL(clicked()), this, SLOT(freeze_clicked()));
-QLabel *MainWindow::createLabel(char *caption, int width, int height)
-{
- QLabel *lbl = new QLabel(caption, this);
- lbl->setFont( QFont( "Sans Serif",
- //(height>1)?(int)(unit * height / 2):(int)(unit * height / 2),
- (int)(unit * height / 2),
- (height>1)?QFont::Bold:QFont::Normal ) );
- lbl->setFixedHeight((int)(unit * height));
- // lbl->setFixedWidth((int)(unit * width));
- return lbl;
-}
+ button = createButton(PIXMAP_MUTE);
+ layout->addWidget(button, 2,3, 1,1);
+ connect(button, SIGNAL(clicked()), this, SLOT(mute_clicked()));
-#include <sys/time.h>
-static struct timeval starttime;
-static int h = 0;
-static int m = 0;
-static int s = 0;
-static int watchdog = 0;
+ // Create history bar
+ HistoryFrame *frame = new HistoryFrame();
+ layout->addWidget(frame, 0,4, 3,1);
+ frame->addHistoryItem(new HistoryWidget());
+ frame->addHistoryItem(new HistoryWidget());
+ frame->addHistoryItem(new HistoryWidget());
-void MainWindow::taskbar_update()
-{
- struct timeval time;
- 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;
-
- h = s / (60 * 60);
- s -= h * (60 * 60);
- 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 = 0;//camera->getQueueLength();
- sprintf(msg, TXT_TIME " %.02d:%.02d:%.02d " TXT_QUEUELENGTH " %d", h, m, s, l);
- lbl_recordtime->setText(msg);
-}
-#define GREY 160
-#define SPEED 0.07f
-void MainWindow::redraw_edge()
-{
- rec_edge_counter += SPEED;
- float val = fabs(sin(rec_edge_counter));
-
- QPalette palette;
- palette.setColor(img_recedge->backgroundRole(), QColor((int) ((255 - GREY) * val + GREY),
- (int) (GREY - (GREY * val)),
- (int) (GREY - (GREY * val))));
- img_recedge->setPalette(palette);
-}
+ // Create statusbar
-void MainWindow::message(char *msg)
-{
- status->showMessage(msg);
- gInfo::info->log("Message: %s", msg);
+ show();
+ // setWindowState(Qt::WindowFullScreen);
+
+ MIaV::info->log("MIaV is ready.");
}
-void MainWindow::clear()
+MainWindow::~MainWindow()
{
- gInfo::info->log("Clearing screen.");
-
+ MIaV::info->log("MIaV is shutting down.");
- // History widgets
- for(unsigned int i = 0; i < num_history; i++) {
- img_history[i]->set_image(img_dummy);
- }
-
- lbl_name->setText("");
- lbl_cpr->setText("");
+ MIaV::info->log("MIaV is shut down.");
}
-#include "aboutwindow.h"
void MainWindow::about_clicked()
{
AboutWindow about;
@@ -434,184 +123,24 @@ void MainWindow::about_clicked()
void MainWindow::clear_clicked()
{
- if(MessageBox(this,
- TXT_ASK_CLEAR_SCREEN_TITLE,
- TXT_ASK_CLEAR_SCREEN,
- TYPE_YES_NO,
- ICON_QUESTION).exec() == MSG_YES) {
- clear();
- }
}
void MainWindow::cpr_clicked()
{
- char oldcpr[256];
- char oldname[256];
-
- // If recording, stop recording before changingcpr
- if(recording) {
- MessageBox(this,
- TXT_STOP_RECORDING_TITLE,
- TXT_STOP_RECORDING,
- TYPE_OK,
- ICON_WARNING).exec();
- return;
- }
- gInfo::info->log("Activated CPR chooser.");
-
- // Save CPR and name, from the labels.
- strcpy(oldname, lbl_name->text().toStdString().c_str());
- strcpy(oldcpr, lbl_cpr->text().toStdString().c_str());
-
- clear();
-
- // Create and call the CPRQueryDialog.
- 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);
- gInfo::info->log("Cancelled CPR chooser.");
- } else {
- // Change CPR camera.
- 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());
- }
}
void MainWindow::rec_clicked()
{
- QPalette palette;
- QPixmap pixmap;
-
- if(!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();
- } else {
- switch(MessageBox(this,
- TXT_ASK_SAVE_TITLE,
- TXT_ASK_SAVE,
- TYPE_YES_NO_MAYBE_CANCEL,
- ICON_QUESTION).exec()) {
- case MSG_YES:
- gInfo::info->log("Stop recording (Said yes to save).");
- recording = 0;
- // camera->stop(SAVE);
- timer->stop();
- palette.setColor(img_recedge->backgroundRole(), QColor(160,160,160));
- img_recedge->setPalette(palette);
- pixmap.fromImage(*img_record);
- btn_rec->setIcon(pixmap);
- break;
-
- case MSG_NO:
- gInfo::info->log("Stop recording (Said no to save).");
- recording = 0;
- // camera->stop(DELETE);
- timer->stop();
- palette.setColor(img_recedge->backgroundRole(), QColor(160,160,160));
- img_recedge->setPalette(palette);
- pixmap.fromImage(*img_record);
- btn_rec->setIcon(pixmap);
- break;
-
- case MSG_MAYBE:
- gInfo::info->log("Stop recording (Said maybe to save).");
- recording = 0;
- // camera->stop(LATER);
- timer->stop();
- palette.setColor(img_recedge->backgroundRole(), QColor(160,160,160));
- img_recedge->setPalette(palette);
- pixmap.fromImage(*img_record);
- btn_rec->setIcon(pixmap);
- break;
-
- case MSG_CANCEL:
- gInfo::info->log("Didn't stop recording (canceled).");
- break;
- }
- }
}
void MainWindow::shoot_clicked()
{
- // unsigned char pixels[720*576*3];
- gInfo::info->log("Snapshot (%s).", frozen?"frozen":"unfrozen");
-
- QImage screenshot(720, 576, QImage::Format_RGB32);
-
- // camera->snapshot(screenshot.bits());
-
- QImage *image;
- for(int cnt = (num_history-1); cnt > 0; cnt--) {
- image = img_history[cnt-1]->get_image();
- img_history[cnt]->set_image(image);
- }
- img_history[0]->set_image(&screenshot);
-
- if(frozen) {
- // camera->unfreeze();
-
- QPixmap pixmap;
- pixmap.fromImage(*img_freeze);
- btn_freeze->setIcon(pixmap);
-
- btn_freeze->setDown(false);
- frozen = false;
- }
}
void MainWindow::freeze_clicked()
{
- if(frozen) {
- gInfo::info->log("Unfreeze.");
- // camera->unfreeze();
-
- QPixmap pixmap;
- pixmap.fromImage(*img_freeze);
- btn_freeze->setIcon(pixmap);
-
- btn_freeze->setDown(false);
- frozen = false;
- } else {
- gInfo::info->log("Freeze.");
- // camera->freeze();
-
- QPixmap pixmap;
- pixmap.fromImage(*img_freeze);
- btn_freeze->setIcon(pixmap);
-
- btn_freeze->setDown(true);
- frozen = true;
- }
}
void MainWindow::mute_clicked()
{
- QPixmap pixmap;
-
- muted = !muted;
- if(muted) {
- pixmap.fromImage(*img_mute);
- btn_mute->setIcon(pixmap);
- } else {
- pixmap.fromImage(*img_unmute);
- btn_mute->setIcon(pixmap);
- }
-
- // camera->setMute(muted);
}
-
-#endif /*USE_GUI*/
diff --git a/client/mainwindow.h b/client/mainwindow.h
index 627b431..acba62c 100644
--- a/client/mainwindow.h
+++ b/client/mainwindow.h
@@ -25,56 +25,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#include "config.h"
-#ifdef USE_GUI
-
-#ifndef __MAINWINDOW_H__
-#define __MAINWINDOW_H__
-
-#include <string>
-using namespace std;
+#ifndef __MIAV_MAINWINDOW_H__
+#define __MIAV_MAINWINDOW_H__
#include <QWidget>
-#include <QLabel>
-#include <QPushButton>
-#include <QStatusBar>
-#include <QTimer>
-#include <QPixmap>
-#include <QImage>
-
-#include "videowidget.h"
-#include "cprquerydialog.h"
-#include "historywidget.h"
-
-#define INCH_IN_CM 2.54f
-
-/**
- * First some GUI specs
- */
-//#define NUM_HISTORY 3 // moved to a genuine variable
-// Button sizes in cm (metric)
-#define BUTTON_WIDTH 7
-#define BUTTON_HEIGHT 2
-
-#define HISTORY_LIST_MARGIN 25
-#define HISTORY_LIST_SPACING 5
/**
- * Textstrings
- */
-#define TXT_ERROR_TITLE "Der er opstået en fejl!"
-#define TXT_READY "Klar..."
-#define TXT_CPRDLG_TITLE "CPRQueryDialog"
-#define TXT_ASK_SAVE_TITLE "Vil du gemme filmen?"
-#define TXT_ASK_SAVE "Vil du gemme filmen permanent?"
-#define TXT_STOP_RECORDING_TITLE "Stop optagelsen"
-#define TXT_STOP_RECORDING "Optagelsen skal standses, inden et nyt cpr nummer kan indtastes.\n\
-Optagelsen standses ved tryk på den røde cirkel med gul streg over."
-#define TXT_TIME "Tid:"
-#define TXT_QUEUELENGTH "Buffer størelse:"
-#define TXT_ASK_CLEAR_SCREEN_TITLE "Fjerne data fra skærmen?"
-#define TXT_ASK_CLEAR_SCREEN "Er du sikker på at du vil dataene fra skærmen (billeder, CPR nummer og navn)?"
-
-/**
* Images
*/
#define PIXMAP_MUTE PIXMAPS"/mute.png"
@@ -97,88 +53,20 @@ class MainWindow : public QWidget
{
Q_OBJECT
public:
- MainWindow(QWidget* parent = 0);
+ MainWindow();
~MainWindow();
- void message(char* msg);
-
public slots:
void cpr_clicked();
void clear_clicked();
void rec_clicked();
void shoot_clicked();
void freeze_clicked();
- void redraw_edge();
- void taskbar_update();
void about_clicked();
void mute_clicked();
private:
- unsigned int num_history;
-
- void clear();
- void createGui();
-
- // Image loading routines.
- QImage *loadButtonIcon( char *name, int height = BUTTON_HEIGHT );
- QImage *loadImage( char *name );
-
- QImage *img_unfreeze;
- QImage *img_freeze;
- QImage *img_snapshot;
- QImage *img_cpr;
- QImage *img_clear;
- QImage *img_record;
- QImage *img_stop;
- QImage *img_logo;
- QImage *img_mute;
- QImage *img_unmute;
- QImage *img_dummy;
-
- QLabel *lbl_version;
- QLabel *lbl_cpr;
- QLabel *lbl_name;
- QLabel *lbl_recordtime;
-
- QTimer *taskbartimer;
-
- // Used for the check_for_error_once_per_2_seconds (very ugly)
- QTimer *errtimer;
-
- float rec_edge_counter;
- QTimer *timer;
- QLabel *img_recedge;
- HistoryWidget **img_history;
-
- QPushButton *btn_logo;
- QPushButton *btn_clear;
- QPushButton *btn_cpr;
- QPushButton *btn_rec;
- QPushButton *btn_shoot;
- QPushButton *btn_freeze;
- QPushButton *btn_mute;
-
- QPushButton *btn_about;
-
- QStatusBar *status;
-
- VideoWidget *img_live;
-
- bool recording;
- bool frozen;
- bool muted;
-
- // Configuration values
- float unit;
- int video_width;
- int video_height;
-
- QPushButton *createButton(char *caption, int width = BUTTON_WIDTH, int height = BUTTON_HEIGHT);
- QPushButton *createButton(char *caption, QWidget *parent, int width = BUTTON_WIDTH, int height = BUTTON_HEIGHT);
- QLabel *createLabel(char *caption, int width, int height);
};
-#endif
-
-#endif /*USE_GUI*/
+#endif/*__MIAV_MAINWINDOW_H__*/
diff --git a/client/messagebox.cc b/client/messagebox.cc
index f4797ab..11686c7 100644
--- a/client/messagebox.cc
+++ b/client/messagebox.cc
@@ -29,9 +29,9 @@
#include "messagebox.h"
#include "miav_config.h"
-// For button sizes!
-#include "mainwindow.h"
-
+#define INCH_IN_CM 2
+#define BUTTON_HEIGHT 1
+#define BUTTON_WIDTH 3
////////////////////////////////////////////////////////////////////////////////////////
/* If the cpr input by the user is not valid, this dialog
* ask the user what to do. Edit the number, use it as it is,
@@ -45,9 +45,9 @@ MessageBox::MessageBox(QWidget* parent,
msg_icon icon)
: QDialog(parent)
{
- int resolution_w = config->readInt("pixel_width");
+ int resolution_w = MIaV::config->readInt("pixel_width");
//int resolution_h = config->readInt("pixel_height");
- unit = ((float)resolution_w / config->readFloat("screensize")) / INCH_IN_CM;
+ unit = ((float)resolution_w / MIaV::config->readFloat("screensize")) / INCH_IN_CM;
setModal(true);
setWindowTitle(name);
diff --git a/client/miav_client.cc b/client/miav_client.cc
index 29826ef..eea9cdf 100644
--- a/client/miav_client.cc
+++ b/client/miav_client.cc
@@ -39,14 +39,13 @@
int main(int argc, char *argv[])
{
- QApplication miav_grab( argc, argv );
+ QApplication app(argc, argv);
- MiavConfig cfg(ETC"/miav.conf", NULL);
+ MiavConfig config(ETC"/miav.conf");
+ MIaV::initConfig(&config);
- InfoGui info(&cfg);
- gInfo::initInfo(&info);
-
- config = new MiavConfig(ETC"/miav.conf", &info);
+ InfoGui info(MIaV::config);
+ MIaV::initInfo(&info);
MainWindow mainwindow;
@@ -58,5 +57,5 @@ int main(int argc, char *argv[])
player.start();
sender.start();
- return miav_grab.exec();
+ return app.exec();
}
diff --git a/client/networksender.cc b/client/networksender.cc
index 19df3f3..7e367f1 100644
--- a/client/networksender.cc
+++ b/client/networksender.cc
@@ -37,5 +37,5 @@ NetworkSender::~NetworkSender()
void NetworkSender::run()
{
- gInfo::info->info("The NetworkSender thread is running.");
+ // MIaV::info->info("The NetworkSender thread is running.");
}
diff --git a/client/player.cc b/client/player.cc
index cec7b0f..143279f 100644
--- a/client/player.cc
+++ b/client/player.cc
@@ -37,5 +37,5 @@ Player::~Player()
void Player::run()
{
- gInfo::info->info("The player thread is running.");
+ // MIaV::info->info("The player thread is running.");
}
diff --git a/client/splashscreen.cc b/client/splashscreen.cc
new file mode 100644
index 0000000..c4acb25
--- /dev/null
+++ b/client/splashscreen.cc
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/***************************************************************************
+ * splashscreen.cc
+ *
+ * Tue Mar 7 14:50:09 CET 2006
+ * Copyright 2006 Bent Bisballe Nyeng
+ * 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"
+#include "splashscreen.h"
+
+SplashScreen::SplashScreen()
+{
+ start();
+}
+
+SplashScreen::~SplashScreen()
+{
+}
+
+void SplashScreen::setProgress(QString text, unsigned int pct)
+{
+ // progbartext->text = text;
+ // progbar->setValue(pct);
+}
+
+void SplashScreen::run()
+{
+ /*
+ QDialog splash;
+ splash.setModal(true);
+ progbar = new QProgressBar(&splash);
+ progbar->setRange(0, 100);
+ progbar->setTextVisible(true);
+ splash.exec();
+ */
+}
diff --git a/client/splashscreen.h b/client/splashscreen.h
new file mode 100644
index 0000000..95de335
--- /dev/null
+++ b/client/splashscreen.h
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/***************************************************************************
+ * splashscreen.h
+ *
+ * Tue Mar 7 14:50:08 CET 2006
+ * Copyright 2006 Bent Bisballe Nyeng
+ * 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 __MIAV_SPLASHSCREEN_H__
+#define __MIAV_SPLASHSCREEN_H__
+
+#include <QThread>
+#include <QDialog>
+#include <QProgressBar>
+#include <QString>
+
+class SplashScreen : public QThread
+{
+public:
+ SplashScreen();
+ ~SplashScreen();
+
+ void setProgress(QString text, unsigned int pct);
+
+ void run();
+
+private:
+ QDialog *splash;
+ QProgressBar *progbar;
+};
+
+
+#endif/*__MIAV_SPLASHSCREEN_H__*/
diff --git a/client/videowidget.cc b/client/videowidget.cc
index 8f733d5..6ff062d 100644
--- a/client/videowidget.cc
+++ b/client/videowidget.cc
@@ -24,38 +24,33 @@
* 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 "videowidget.h"
-
#include "miav_config.h"
-VideoWidget::VideoWidget(QWidget *p, QWidget* old) : QWidget(p)
+VideoWidget::VideoWidget() : QFrame()
{
- parent = p;
+ // A welltested hack to force SDL to draw in the QWidget
- oldWindow = old;
+ // QString ids;
+ // setenv("SDL_WINDOWID", ids.setNum(winId()).toStdString().c_str(), 1);
+
+ // Make it visible
+ QPalette palette;
+ palette.setColor(backgroundRole(), Qt::blue);
+ setPalette(palette);
+
+ setLineWidth(1);
+ setFrameStyle(QFrame::Plain);
- // A welltested hack to force SDL to draw in the QWidget
- QString ids;
- setenv("SDL_WINDOWID", ids.setNum(winId()).toStdString().c_str(), 1);
}
VideoWidget::~VideoWidget()
{
}
-QPixmap VideoWidget::getScreenshot()
-{
- return QPixmap::grabWindow (winId());
-}
-
-static VideoWidget *fs = NULL;
-
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);
@@ -64,12 +59,11 @@ void VideoWidget::mouseReleaseEvent(QMouseEvent *event)
} else { // We are a nested window
// first delete old instance (if any)
if(fs) delete fs;
- fs = new VideoWidget(NULL, this);
+ fs = new VideoWidget();
fs->showFullScreen();
- fs->setFixedWidth(config->readInt("pixel_width"));
- fs->setFixedHeight(config->readInt("pixel_height"));
+ fs->setFixedWidth(MIaV::config->readInt("pixel_width"));
+ fs->setFixedHeight(MIaV::config->readInt("pixel_height"));
//camera->resize(fs->width(), fs->height(), true);
}
+ */
}
-
-#endif /* USE_GUI */
diff --git a/client/videowidget.h b/client/videowidget.h
index 3ccbd97..25f5bed 100644
--- a/client/videowidget.h
+++ b/client/videowidget.h
@@ -25,29 +25,20 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#include "config.h"
-#ifdef USE_GUI
-
#ifndef __VIDEOWIDGET_H__
#define __VIDEOWIDGET_H__
-#include <QWidget>
+#include <QFrame>
#include <QPixmap>
-class VideoWidget : public QWidget {
+class VideoWidget : public QFrame
+{
Q_OBJECT
public:
- VideoWidget(QWidget *parent, QWidget *old = NULL);
+ VideoWidget();
~VideoWidget();
- QPixmap getScreenshot();
- void mouseReleaseEvent(QMouseEvent *event);
-
-private:
- QWidget *parent;
- // Reassign SDL to this when closing (if non-NULL)
- QWidget *oldWindow;
+ void mouseReleaseEvent(QMouseEvent *event);
};
#endif /* __VIDEOWIDGET_H__ */
-
-#endif /* USE_GUI */