summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authordeva <deva>2006-05-29 09:24:27 +0000
committerdeva <deva>2006-05-29 09:24:27 +0000
commit33583f49150216f3bc84520b63bf4be16ace076d (patch)
tree00f75da9204fffd681c808863492a7e8c4a9e636 /client
parentd86028ba3e6c0db3c1f56077f481b3bebf883d86 (diff)
*** empty log message ***
Diffstat (limited to 'client')
-rw-r--r--client/Makefile.am2
-rw-r--r--client/control.cc23
-rw-r--r--client/control.h6
-rw-r--r--client/decoder.cc8
-rw-r--r--client/mainwindow.cc52
-rw-r--r--client/mainwindow.h13
-rw-r--r--client/networksender.cc2
-rw-r--r--client/status.h2
-rw-r--r--client/xvaccelrenderer.cc2
9 files changed, 47 insertions, 63 deletions
diff --git a/client/Makefile.am b/client/Makefile.am
index 4a49d35..07b217e 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -24,6 +24,7 @@ miav_client_SOURCES = $(shell ../tools/MocList cc ) \
messagebox.cc \
player.cc \
splashscreen.cc \
+ statusbar.cc \
svgloader.cc \
videowidget.cc \
yuv_draw.cc \
@@ -47,6 +48,7 @@ EXTRA_DIST = \
messagebox.h \
player.h \
splashscreen.h \
+ statusbar.h \
svgloader.h \
videowidget.h \
yuv_draw.h \
diff --git a/client/control.cc b/client/control.cc
index d634039..4b5d2fa 100644
--- a/client/control.cc
+++ b/client/control.cc
@@ -33,6 +33,9 @@ Control::Control()
recording = false;
muted = false;
cpr = "";
+
+ getfreeze = false;
+ getshot = false;
}
Control::~Control()
@@ -59,6 +62,7 @@ void Control::freeze()
{
mutex.lock();
frozen = true;
+ getfreeze = true;
mutex.unlock();
}
@@ -73,6 +77,7 @@ void Control::shoot()
{
mutex.lock();
frozen = false;
+ getshot = true;
mutex.unlock();
}
@@ -131,6 +136,24 @@ bool Control::isMuted()
return ismuted;
}
+bool Control::getShot()
+{
+ mutex.lock();
+ bool ret = getshot;
+ getshot = false;
+ mutex.unlock();
+ return ret;
+}
+
+bool Control::getFreeze()
+{
+ mutex.lock();
+ bool ret = getfreeze;
+ getfreeze = false;
+ mutex.unlock();
+ return ret;
+}
+
// Global control object
Control MIaV::control;
diff --git a/client/control.h b/client/control.h
index cdc8bc4..b2baba5 100644
--- a/client/control.h
+++ b/client/control.h
@@ -58,6 +58,9 @@ public:
// bool isScreenshot();
// void takeScreenshot();
+ bool getShot();
+ bool getFreeze();
+
private:
bool frozen;
bool recording;
@@ -66,6 +69,9 @@ private:
QMutex mutex;
QString cpr;
+
+ bool getfreeze;
+ bool getshot;
};
namespace MIaV {
diff --git a/client/decoder.cc b/client/decoder.cc
index d8bf430..11cee08 100644
--- a/client/decoder.cc
+++ b/client/decoder.cc
@@ -93,8 +93,8 @@ void Decoder::run()
sendersmutex.lock();
if(senders.isEmpty() == false)
senders.back()->pushFrame(frame,
- MIaV::control.isFrozen(),
- false);
+ MIaV::control.getShot(),
+ MIaV::control.getFreeze());
sendersmutex.unlock();
} else {
@@ -171,8 +171,8 @@ Status Decoder::status()
// Get the server disk status etc.
if(senders.isEmpty() == false) senders.back()->getServerStatus(&s);
- fprintf(stderr, "Load: %d of %d - ", s.server_load, s.server_load_max);
- fprintf(stderr, "Space: %d of %d\n", s.server_diskspace, s.server_diskspace_max);
+ // fprintf(stderr, "Load: %d of %d - ", s.server_load, s.server_load_max);
+ // fprintf(stderr, "Space: %d of %d\n", s.server_diskspace, s.server_diskspace_max);
// Read out the queue sizes
QLinkedList<NetworkSender*>::iterator i;
diff --git a/client/mainwindow.cc b/client/mainwindow.cc
index a158c09..88eae63 100644
--- a/client/mainwindow.cc
+++ b/client/mainwindow.cc
@@ -131,25 +131,10 @@ MainWindow::MainWindow(Decoder *d)
layout->addWidget(history, 0,4, 3,1);
// Create statusbar
- statusbar = new QStatusBar(this);
+ statusbar = new StatusBar(this, decoder);
outerlayout->addWidget(statusbar, 1,0, 1,1);
- server_diskspace = new QProgressBar(statusbar);
- server_diskspace->setRange(0, 100);
- server_diskspace->setValue(0);
-
- server_load = new QProgressBar(statusbar);
- server_load->setRange(0, 100);
- server_load->setValue(0);
-
- messagefield = new QLabel(statusbar);
-
- statusbar->addWidget(messagefield, 80);
- statusbar->addWidget(server_diskspace, 10);
- statusbar->addWidget(server_load, 10);
-
- // statusbar->showMessage("Ready!");
- startTimer(100);
+ statusbar->message("Ready");
show();
// setWindowState(Qt::WindowFullScreen);
@@ -167,37 +152,6 @@ MainWindow::~MainWindow()
MIaV::info->log("MIaV is shut down.");
}
-void MainWindow::timerEvent(QTimerEvent *event)
-{
- Status s = decoder->status();
- QString statusmsg;
-
- for(int cnt = 0; cnt < s.queue_sizes.size(); cnt++) {
- QString next;
- next.sprintf("(%d)", s.queue_sizes[cnt]);
- statusmsg.prepend(next);
- }
-
- messagefield->setText(statusmsg);
-
- if(s.server_diskspace_max != 0xffffffff) {
- server_diskspace->setRange(0, s.server_diskspace_max);
- server_diskspace->setValue(s.server_diskspace);
- server_diskspace->setEnabled(true);
- } else {
- server_diskspace->setRange(0, 0);
- server_diskspace->setEnabled(false);
- }
-
- if(s.server_load_max != 0xffffffff) {
- server_load->setRange(0, s.server_load_max);
- server_load->setValue(s.server_load);
- server_load->setEnabled(true);
- } else {
- server_load->setRange(0, 0);
- server_load->setEnabled(false);
- }
-}
void MainWindow::about_clicked()
@@ -220,9 +174,11 @@ void MainWindow::record_clicked()
if(MIaV::control.isRecording()) {
MIaV::control.stop();
btn_record->setIcon(*Icons::record);
+ statusbar->message("Stopped");
} else {
MIaV::control.record();
btn_record->setIcon(*Icons::stop);
+ statusbar->message("Recording");
}
}
diff --git a/client/mainwindow.h b/client/mainwindow.h
index 5b38397..250a8be 100644
--- a/client/mainwindow.h
+++ b/client/mainwindow.h
@@ -31,15 +31,14 @@
#include <QPushButton>
#include <QLabel>
-#include <QStatusBar>
-
-#include <QProgressBar>
#include "historyframe.h"
#include "videowidget.h"
#include "decoder.h"
+#include "statusbar.h"
+
class MainWindow : public QWidget
{
Q_OBJECT
@@ -49,9 +48,6 @@ public:
QWidget *getVideoWidget() { return video; }
-protected:
- void timerEvent(QTimerEvent *event);
-
public slots:
void cpr_clicked();
void clear_clicked();
@@ -82,10 +78,7 @@ private:
QLabel *lbl_name;
// Statusbar
- QStatusBar *statusbar;
- QLabel *messagefield;
- QProgressBar *server_diskspace;
- QProgressBar *server_load;
+ StatusBar *statusbar;
};
#endif/*__MIAV_MAINWINDOW_H__*/
diff --git a/client/networksender.cc b/client/networksender.cc
index dcb1919..11eb259 100644
--- a/client/networksender.cc
+++ b/client/networksender.cc
@@ -62,6 +62,8 @@ NetworkSender::~NetworkSender()
void NetworkSender::pushFrame(char* framedata, bool freeze, bool snapshot)
{
+ printf("F: %d S %d\n", freeze, snapshot);
+
Frame *frame = new Frame((unsigned char*)framedata);
frame->freeze = freeze;
frame->shoot = snapshot;
diff --git a/client/status.h b/client/status.h
index 6a7bca2..a3ccad7 100644
--- a/client/status.h
+++ b/client/status.h
@@ -27,6 +27,8 @@
#ifndef __MIAV_STATUS_H__
#define __MIAV_STATUS_H__
+#define UNKNOWN 0xffffffff
+
class Status {
public:
QList<unsigned int> queue_sizes;
diff --git a/client/xvaccelrenderer.cc b/client/xvaccelrenderer.cc
index 984c57a..208ea04 100644
--- a/client/xvaccelrenderer.cc
+++ b/client/xvaccelrenderer.cc
@@ -208,7 +208,7 @@ uint8_t XvAccelRender::GUI_XvInit(QWidget * window, uint32_t w, uint32_t h)
for (k = 0; (k < curai->num_ports) && !port; k++)
{
if (GUI_XvList(WDN, k + curai->base_id, &xv_format))
- port = k + curai->base_id + 1; // FIXME: TODO: HACK: It works when +1 is applied! But why!?
+ port = k + curai->base_id + 0; // FIXME: TODO: HACK: It works when +1 is applied! But why!?
}