summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2005-06-02 20:45:01 +0000
committerdeva <deva>2005-06-02 20:45:01 +0000
commit64efd74ecfa761c83b70ec2374bf448b6e42e254 (patch)
tree607ccb672f904dd415a7b589bb80000753e76fe5
parenta17e42c900e2709444b12a5db2847e850f3dd6cd (diff)
Added clear button
Optimized the frame handling a little (very little!).
-rw-r--r--configure.in1
-rw-r--r--etc/miav.conf2
-rw-r--r--src/decoder.cc33
-rw-r--r--src/frame.cc9
-rw-r--r--src/mainwindow.cc43
-rw-r--r--src/mainwindow.h18
6 files changed, 83 insertions, 23 deletions
diff --git a/configure.in b/configure.in
index fba5a2b..8378fe7 100644
--- a/configure.in
+++ b/configure.in
@@ -8,7 +8,6 @@ AC_PROG_LIBTOOL
AM_PROG_LIBTOOL
AM_CONFIG_HEADER(config.h)
-AM_CXXFLAGS="-O2"
AC_STDC_HEADERS
AC_ARG_WITH(gui, [ --without-gui build without GUI support])
diff --git a/etc/miav.conf b/etc/miav.conf
index 1b5bb62..7e7ba7d 100644
--- a/etc/miav.conf
+++ b/etc/miav.conf
@@ -20,7 +20,7 @@ pixel_height = 768
player_skip_frames = 1
# How and where to connect to the miav server?
-server_addr = "127.0.0.1"
+server_addr = "192.168.0.10"
server_port = 18120
# Where top store the files recieved by the server
diff --git a/src/decoder.cc b/src/decoder.cc
index ec3f695..7b3dd97 100644
--- a/src/decoder.cc
+++ b/src/decoder.cc
@@ -39,6 +39,11 @@
/*
* $Log$
+ * Revision 1.31 2005/06/02 20:45:01 deva
+ *
+ * Added clear button
+ * Optimized the frame handling a little (very little!).
+ *
* Revision 1.30 2005/06/02 15:03:23 deva
*
* Fixed crash in network.cc if socket not connected.
@@ -171,21 +176,11 @@ void Decoder::decode()
pthread_mutex_unlock(&shot_mutex);
}
- if(local_record | (local_record != old_record) | local_shoot | local_freeze) {
- Frame *eframe = new Frame(ptr, DVPACKAGE_SIZE);
- eframe->shoot = local_shoot;
- eframe->freeze = local_freeze;
- eframe->record = local_record;
-
- encode_queue->push(eframe);
-
- sem_post(encode_sem);
- }
-
static int showframe = 1;
if(skip_frames != 0) showframe = 1 - showframe;
if(showframe) {
Frame *pframe = new Frame(ptr, DVPACKAGE_SIZE);
+
pframe->shoot = local_shoot;
pframe->freeze = local_freeze;
pframe->record = local_record;
@@ -200,7 +195,21 @@ void Decoder::decode()
SDL_PushEvent(&user_event);
}
- free(ptr);
+ if(local_record | (local_record != old_record) | local_shoot | local_freeze) {
+ Frame *eframe = new Frame(NULL, 0);
+ eframe->data = ptr;
+ eframe->size = DVPACKAGE_SIZE;
+
+ eframe->shoot = local_shoot;
+ eframe->freeze = local_freeze;
+ eframe->record = local_record;
+
+ encode_queue->push(eframe);
+
+ sem_post(encode_sem);
+ } else {
+ free(ptr);
+ }
}
// Kick the others so they wake up with empty queues
diff --git a/src/frame.cc b/src/frame.cc
index ee5451d..c6a2848 100644
--- a/src/frame.cc
+++ b/src/frame.cc
@@ -31,6 +31,11 @@
/*
* $Log$
+ * Revision 1.8 2005/06/02 20:45:01 deva
+ *
+ * Added clear button
+ * Optimized the frame handling a little (very little!).
+ *
* Revision 1.7 2005/05/22 15:49:22 deva
* Added multithreaded encoding support.
*
@@ -51,8 +56,8 @@
Frame::Frame(unsigned char *d, int sz)
{
- data = (unsigned char *)malloc(sz);
- if(d) memcpy(data, d, sz);
+ if(sz) data = (unsigned char *)malloc(sz);
+ if(sz && d) memcpy(data, d, sz);
size = sz;
number = 0;
}
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 4acf391..c127585 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -31,6 +31,11 @@
/*
* $Log$
+ * Revision 1.28 2005/06/02 20:45:01 deva
+ *
+ * Added clear button
+ * Optimized the frame handling a little (very little!).
+ *
* Revision 1.27 2005/05/23 19:30:36 deva
* Made some cleanup in the status bar.
*
@@ -133,15 +138,18 @@ MainWindow::MainWindow(QApplication *qApp, QWidget* parent, const char* name )
pix_cpr = new QPixmap();
pix_cpr->load( PIXMAP_CPR );
+ pix_clear = new QPixmap();
+ pix_clear->load( PIXMAP_CLEAR );
+
pix_snapshot = new QPixmap();
pix_snapshot->load( PIXMAP_SNAPSHOT );
- pix_dummy = new QPixmap();
- pix_dummy->load( PIXMAP_DUMMY );
-
pix_logo = new QPixmap();
pix_logo->load( PIXMAP_LOGO_SMALL );
+ pix_dummy = new QImage();
+ pix_dummy->load( PIXMAP_DUMMY );
+
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), SLOT(redraw_edge()));
rec_edge_counter = 0.0f;
@@ -231,11 +239,17 @@ void MainWindow::createGui()
btn_cpr->setPixmap(*pix_cpr);
QObject::connect( btn_cpr, SIGNAL(clicked()), this, SLOT(cpr_clicked()) );
// Will also be connected in the MGUI code
- g1->addWidget(btn_cpr, 1, 2);
+ g1->addWidget(btn_cpr, 1, 1);
lbl_name = createLabel("", 18, 2);
g1->addMultiCellWidget ( lbl_name, 2, 2, 0, 2);
+ btn_clear = createButton("Clear", 8, 3);
+ // btn_clear->setPixmap(*pix_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("", 8, 3);
btn_rec->setPixmap(*pix_record);
@@ -253,9 +267,11 @@ void MainWindow::createGui()
g1->addWidget(btn_freeze, 3, 2);
// History widgets
+ QImage dummy_resized = pix_dummy->smoothScale(240, 192);
+
for(int i = 0; i < NUM_HISTORY; i++) {
img_history[i] = new QLabel(gb);
- img_history[i]->setPixmap(*pix_dummy);
+ img_history[i]->setPixmap(dummy_resized);
img_history[i]->setFixedSize(240,192);
// g2->addWidget(img_history[i], i, 0, Qt::AlignHCenter & Qt::AlignVCenter);
// g2->addWidget(img_history[i]);
@@ -339,6 +355,23 @@ void MainWindow::message(char *msg)
status->message(msg);
}
+void MainWindow::clear_clicked()
+{
+ if(MessageBox(this,
+ TXT_ASK_CLEAR_SCREEN_TITLE,
+ TXT_ASK_CLEAR_SCREEN,
+ TYPE_YES_NO,
+ ICON_QUESTION).exec() == MSG_YES) {
+
+ // History widgets
+ QImage dummy_resized = pix_dummy->smoothScale(240, 192);
+
+ for(int i = 0; i < NUM_HISTORY; i++) {
+ img_history[i]->setPixmap(dummy_resized);
+ }
+ }
+}
+
void MainWindow::cpr_clicked()
{
char oldcpr[256];
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 1348b5f..790097e 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -31,6 +31,11 @@
/*
* $Log$
+ * Revision 1.15 2005/06/02 20:45:01 deva
+ *
+ * Added clear button
+ * Optimized the frame handling a little (very little!).
+ *
* Revision 1.14 2005/05/23 19:30:36 deva
* Made some cleanup in the status bar.
*
@@ -71,6 +76,8 @@ using namespace std;
#include <qpushbutton.h>
#include <qstatusbar.h>
#include <qtimer.h>
+#include <qpixmap.h>
+#include <qimage.h>
#include "videowidget.h"
#include "camera.h"
@@ -93,7 +100,9 @@ using namespace std;
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 "Tøm billedlisten"
+#define TXT_ASK_CLEAR_SCREEN "Er du sikker på at du vil tømme billedlisten?"
+
/**
* Images
*/
@@ -104,6 +113,7 @@ Optagelsen standses ved tryk på den røde cirkel med gul streg over."
#define PIXMAP_UNFREEZE PIXMAPS"/unfreeze.png"
#define PIXMAP_CPR PIXMAPS"/cpr.png"
+#define PIXMAP_CLEAR PIXMAPS"/clear.png"
#define PIXMAP_SNAPSHOT PIXMAPS"/snapshot.png"
#define PIXMAP_DUMMY PIXMAPS"/dummy.png"
@@ -120,6 +130,7 @@ public:
public slots:
void cpr_clicked();
+ void clear_clicked();
void rec_clicked();
void shoot_clicked();
void freeze_clicked();
@@ -138,10 +149,12 @@ private:
QPixmap *pix_freeze;
QPixmap *pix_snapshot;
QPixmap *pix_cpr;
+ QPixmap *pix_clear;
QPixmap *pix_record;
QPixmap *pix_stop;
- QPixmap *pix_dummy;
QPixmap *pix_logo;
+
+ QImage *pix_dummy;
QLabel *lbl_version;
QLabel *lbl_cpr;
@@ -159,6 +172,7 @@ private:
QLabel *img_history[NUM_HISTORY];
QPushButton *btn_logo;
+ QPushButton *btn_clear;
QPushButton *btn_cpr;
QPushButton *btn_rec;
QPushButton *btn_shoot;