summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2005-07-27 12:40:47 +0000
committerdeva <deva>2005-07-27 12:40:47 +0000
commit6046ed450a83f509c4e5f2923ae4f8fcda9fd669 (patch)
treecee3b8aaed9e63d5458325cba118569d3f4c42f8
parentaa76292f4ceb8bfa94066bd035dda81c95bc9052 (diff)
*** empty log message ***
-rw-r--r--src/Makefile.am2
-rw-r--r--src/historywidget.cc87
-rw-r--r--src/historywidget.h62
-rw-r--r--src/mainwindow.cc25
-rw-r--r--src/mainwindow.h6
-rw-r--r--src/player.cc10
-rw-r--r--src/videowidget.cc15
7 files changed, 181 insertions, 26 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index a611de5..2f4c151 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,6 +15,7 @@ miav_SOURCES = $(shell if [ $QT_CXXFLAGS ] ; then ../tools/MocList cc; fi ) \
encoder.cc \
file.cc \
frame.cc \
+ historywidget.cc \
img_encoder.cc \
info.cc \
info_console.cc \
@@ -50,6 +51,7 @@ EXTRA_DIST = \
encoder.h \
file.h \
frame.h \
+ historywidget.h \
img_encoder.h \
info.h \
info_console.h \
diff --git a/src/historywidget.cc b/src/historywidget.cc
new file mode 100644
index 0000000..d213cd2
--- /dev/null
+++ b/src/historywidget.cc
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/***************************************************************************
+ * historywidget.cc
+ *
+ * Wed Jul 27 14:00:37 CEST 2005
+ * Copyright 2005 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.
+ */
+
+/*
+ * $Id$
+ */
+
+/*
+ * $Log$
+ * Revision 1.1 2005/07/27 12:40:47 deva
+ * *** empty log message ***
+ *
+ */
+
+#include <config.h>
+#include "historywidget.h"
+
+#include "miav_config.h"
+
+HistoryWidget::HistoryWidget(QWidget *p) : QLabel(p)
+{
+ parent = p;
+ image = NULL;
+}
+
+HistoryWidget::~HistoryWidget()
+{
+ if(image) delete image;
+}
+
+void HistoryWidget::set_image(QImage *i)
+{
+ if(image) delete image;
+
+ image = new QImage(*i);
+
+ QImage resized = image->smoothScale(width(), height());
+ setPixmap(resized);
+}
+
+QImage * HistoryWidget::get_image()
+{
+ return image;
+}
+
+static HistoryWidget *fs = NULL;
+
+void HistoryWidget::mouseReleaseEvent(QMouseEvent *event)
+{
+ if(!parent) { // We are a fullscreen window
+ destroy();
+ } else { // We are a nested window
+ // Delete old instances before going fullscreen.
+ if(fs) delete fs;
+
+ fs = new HistoryWidget(NULL);
+ fs->showFullScreen();
+ fs->setFixedWidth(config->readInt("pixel_width"));
+ fs->setFixedHeight(config->readInt("pixel_height"));
+ fs->set_image(image);
+ }
+}
+
diff --git a/src/historywidget.h b/src/historywidget.h
new file mode 100644
index 0000000..d6f2c1f
--- /dev/null
+++ b/src/historywidget.h
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/***************************************************************************
+ * historywidget.h
+ *
+ * Wed Jul 27 14:00:37 CEST 2005
+ * Copyright 2005 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.
+ */
+
+/*
+ * $Id$
+ */
+
+/*
+ * $Log$
+ * Revision 1.1 2005/07/27 12:40:47 deva
+ * *** empty log message ***
+ *
+ */
+
+#include <config.h>
+#ifndef __MIAV_HISTORYWIDGET_H__
+#define __MIAV_HISTORYWIDGET_H__
+
+#include <qlabel.h>
+#include <qimage.h>
+
+class HistoryWidget : public QLabel {
+Q_OBJECT
+public:
+ HistoryWidget(QWidget *parent);
+ ~HistoryWidget();
+
+ void set_image(QImage *image);
+ QImage *get_image();
+
+ void mouseReleaseEvent(QMouseEvent *event);
+
+private:
+ QImage *image;
+ QWidget *parent;
+};
+
+#endif/*__MIAV_HISTORYWIDGET_H__*/
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 548f323..696ce97 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -31,6 +31,9 @@
/*
* $Log$
+ * Revision 1.43 2005/07/27 12:40:47 deva
+ * *** empty log message ***
+ *
* Revision 1.42 2005/07/25 15:56:27 deva
* *** empty log message ***
*
@@ -300,7 +303,7 @@ void MainWindow::createGui()
img_live->setFixedSize(output_width - 20, output_height - 20);
img_live->move(10,10);
g1->addMultiCellWidget ( img_recedge, 0, 0, 0, 2, Qt::AlignHCenter);
- QObject::connect( img_live, SIGNAL(clicked()), this, SLOT(live_clicked()) );
+ // QObject::connect( img_live, SIGNAL(clicked()), this, SLOT(live_clicked()) );
// CPR/NAME LABEL + CPR button
lbl_cpr = createLabel("", output_width - (int)(BUTTON_WIDTH * unit), BUTTON_HEIGHT);
@@ -342,11 +345,9 @@ void MainWindow::createGui()
int w = (int)((float)BUTTON_WIDTH * unit);
int h = (int)(576.0f / (720.0f / ((float)BUTTON_WIDTH * unit)));
- QImage dummy_resized = img_dummy->smoothScale(w, h);
-
for(int i = 0; i < NUM_HISTORY; i++) {
- img_history[i] = new QLabel(gb);
- img_history[i]->setPixmap(dummy_resized);
+ img_history[i] = new HistoryWidget(gb);
+ img_history[i]->set_image(img_dummy);
img_history[i]->setFixedSize(w, h);
}
@@ -581,18 +582,16 @@ void MainWindow::shoot_clicked()
// unsigned char pixels[720*576*3];
info->log("Snapshot (%s).", frozen?"frozen":"unfrozen");
- QImage image(720, 576, 32);
-
- camera->snapshot(image.bits());
+ QImage screenshot(720, 576, 32);
- image = image.smoothScale(img_history[0]->width(), img_history[0]->height());
+ camera->snapshot(screenshot.bits());
- QPixmap pixmap;
+ QImage *image;
for(int cnt = (NUM_HISTORY-1); cnt > 0; cnt--) {
- pixmap = *img_history[cnt-1]->pixmap();
- img_history[cnt]->setPixmap(pixmap);
+ image = img_history[cnt-1]->get_image();
+ img_history[cnt]->set_image(image);
}
- img_history[0]->setPixmap(image);
+ img_history[0]->set_image(&screenshot);
if(frozen) {
camera->unfreeze();
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 9c7ba39..0443d13 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -31,6 +31,9 @@
/*
* $Log$
+ * Revision 1.21 2005/07/27 12:40:47 deva
+ * *** empty log message ***
+ *
* Revision 1.20 2005/07/25 14:27:14 deva
* *** empty log message ***
*
@@ -96,6 +99,7 @@ using namespace std;
#include "videowidget.h"
#include "camera.h"
#include "cprquerydialog.h"
+#include "historywidget.h"
#include "info_gui.h"
@@ -198,7 +202,7 @@ private:
float rec_edge_counter;
QTimer *timer;
QLabel *img_recedge;
- QLabel *img_history[NUM_HISTORY];
+ HistoryWidget *img_history[NUM_HISTORY];
QPushButton *btn_logo;
QPushButton *btn_clear;
diff --git a/src/player.cc b/src/player.cc
index f98b9a0..42b4f5d 100644
--- a/src/player.cc
+++ b/src/player.cc
@@ -39,6 +39,9 @@
/*
* $Log$
+ * Revision 1.32 2005/07/27 12:40:47 deva
+ * *** empty log message ***
+ *
* Revision 1.31 2005/07/26 16:16:56 deva
*
* Added fullscreen functionality.
@@ -127,15 +130,12 @@ void Player::reinitSDL()
void Player::deinitSDL()
{
- printf("Deinit SDL...");
SDL_FreeYUVOverlay(overlay);
SDL_Quit();
- printf("done!\n");
}
void Player::initSDL()
{
- printf("Init SDL...");
if(SDL_Init(SDL_INIT_VIDEO) < 0) {
info->error("Unable to init SDL: %s.", SDL_GetError());
noErrors = false;
@@ -174,8 +174,6 @@ void Player::initSDL()
rect.y = 0;
rect.w = width;
rect.h = height;
-
- printf("done!\n");
}
void Player::player()
@@ -288,8 +286,6 @@ void Player::stop()
// of SDL, while calling it.!
void Player::resize(int w, int h)
{
- printf("Resizing to: %d x %d\n", w, h);
-
// Tell loop to stop
bypass = true;
diff --git a/src/videowidget.cc b/src/videowidget.cc
index 8160833..04eb271 100644
--- a/src/videowidget.cc
+++ b/src/videowidget.cc
@@ -31,6 +31,9 @@
/*
* $Log$
+ * Revision 1.9 2005/07/27 12:40:47 deva
+ * *** empty log message ***
+ *
* Revision 1.8 2005/07/26 16:16:56 deva
*
* Added fullscreen functionality.
@@ -82,17 +85,19 @@ QPixmap VideoWidget::getScreenshot()
return QPixmap::grabWindow (winId());
}
+static VideoWidget *fs = NULL;
+
void VideoWidget::mouseReleaseEvent(QMouseEvent *event)
{
- if(!parent) {
- // We are a fullscreen window
+ if(!parent) { // We are a fullscreen window
QString ids;
setenv("SDL_WINDOWID", ids.setNum(oldWindow->winId()), 1);
camera->resize(oldWindow->width(), oldWindow->height());
destroy();
- } else {
- // We are a nested window
- VideoWidget *fs = new VideoWidget(NULL, camera, this);
+ } else { // We are a nested window
+ // first delete old instance (if any)
+ if(fs) delete fs;
+ fs = new VideoWidget(NULL, camera, this);
fs->showFullScreen();
fs->setFixedWidth(config->readInt("pixel_width"));
fs->setFixedHeight(config->readInt("pixel_height"));