summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2005-03-27 18:16:31 +0000
committerdeva <deva>2005-03-27 18:16:31 +0000
commit088296e7e6e5fd6c837ae08b826c8b56baa0eb4b (patch)
tree58c119a46aab42d2bb3b7feb43d16a40d7e67dd1
parent3392d8657f6f6ebc341709d5f500040ed4f559ef (diff)
Fixed pixmap path and dist taget in Makefiles.
-rw-r--r--Makefile.am4
-rw-r--r--TODO12
-rw-r--r--configure.in4
-rw-r--r--src/Makefile.am30
-rw-r--r--src/cprquerydialog.cc36
-rw-r--r--src/cprquerydialog.h6
-rw-r--r--src/mainwindow.cc59
-rw-r--r--src/mainwindow.h9
8 files changed, 89 insertions, 71 deletions
diff --git a/Makefile.am b/Makefile.am
index bd780f0..1353b08 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,3 @@
AUTOMAKE_OPTIONS = gnu
-SUBDIRS = src
-DISTDIRS = pixmaps ffmpeg src \ No newline at end of file
+SUBDIRS = pixmaps tools src
+DISTDIRS = pixmaps tools src
diff --git a/TODO b/TODO
index b11ff3f..ff29c05 100644
--- a/TODO
+++ b/TODO
@@ -14,7 +14,7 @@ SplashScreen:
Mainwindow:
[x] - Clean out mgui code.
[x] - Make generic gui layout code.
- [/] - Make icons.
+ [x] - Make icons.
[x] - Make statusbar.
[ ] - Show network connection in statusbar.
[ ] - Show camera connection in statusbar.
@@ -22,9 +22,11 @@ Mainwindow:
CPRQueryDialog:
[x] - Make it!
- [ ] - Clean out unnessecary code.
+ [x] - Clean out unnesessary code.
[ ] - Make cancel posibility (return code 0 should do something useful)
- [ ] - Make icons.
+ [x] - Insert timer for network connection timeout.
+ [x] - Send connection status info to mainwindow.
+ [ ] - Make icons?
[ ] - Test it.
Decoder:
@@ -61,8 +63,8 @@ MiavConfig:
ErrorObject:
[x] - Make it.
- [ ] - Maintain error string stack, instead of appending.
- [ ] - Make thread safe.
+ [x] - Maintain error string stack, instead of appending.
+ [x] - Make it thread safe.
FFMpegWrapper:
[ ] - Make it.
diff --git a/configure.in b/configure.in
index 1df3ba6..3932dd6 100644
--- a/configure.in
+++ b/configure.in
@@ -150,7 +150,9 @@ AC_SUBST(LDFLAGS)
AC_OUTPUT(
Makefile
- src/Makefile)
+ src/Makefile
+ tools/Makefile
+ pixmaps/Makefile)
# ffmpeg/Makefile
# ffmpeg/libavformat/Makefile
# ffmpeg/libavcodec/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 9d574e4..24c6972 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,8 +2,8 @@
## TODO: Move ffmpeg, libxml and libsdl into configure.in
AM_CXXFLAGS := $(CXXFLAGS) $(EXTRA_CXXFLAGS) -I../include $(QT_CXXFLAGS) \
+ -DPIXMAPS=\"$(datadir)/pixmaps\" \
-I/usr/include/ffmpeg
-# -I/usr/include/SDL
bin_PROGRAMS = miav
@@ -30,9 +30,35 @@ miav_SOURCES = $(shell if [ $QT_CXXFLAGS ] ; then ../tools/MocList cc; fi ) \
server.cc \
error.cc
+EXTRA_DIST = \
+ miav.conf \
+ cprquery.conf \
+ aboutwindow.h \
+ camera.h \
+ cprquerydialog.h \
+ decoder.h \
+ dvframe.h \
+ encoder.h \
+ error.h \
+ ffframe.h \
+ img_encoder.h \
+ mainwindow.h \
+ messagebox.h \
+ miav.h \
+ miav_config.h \
+ mov_encoder.h \
+ network.h \
+ package.h \
+ player.h \
+ queue.h \
+ server.h \
+ socket.h \
+ thread.h \
+ util.h \
+ videowidget.h
+
miav_LDADD := $(shell if [ $QT_CXXFLAGS ] ; then ../tools/MocList o; fi ) \
-lavcodec -lavformat
-# -lSDL
miav_MOC = $(shell if [ $QT_CXXFLAGS ] ; then ../tools/MocList cc; fi )
diff --git a/src/cprquerydialog.cc b/src/cprquerydialog.cc
index e5a722f..14b7950 100644
--- a/src/cprquerydialog.cc
+++ b/src/cprquerydialog.cc
@@ -34,13 +34,15 @@
CPRQueryDialog::CPRQueryDialog(QLabel *lcpr,
QLabel *lname,
QWidget *parent,
- const char *name)
+ const char *name,
+ QStatusBar *status)
: QDialog(parent, name, TRUE)
{
MiavConfig cfg("cprquery.conf");
lbl_name = lname;
lbl_cpr = lcpr;
+ statusbar = status;
//Read configuration
CPR_HOST = cfg.readString("cpr_host");
@@ -317,6 +319,7 @@ int CPRQueryDialog::test_cpr(const char *s)
*/
void CPRQueryDialog::cprSocket_error(int errnum)
{
+ QString msg = QString("cprSocket encountered an error: ");
timer->stop();
lbl_name->setText(NAME_NOT_AVAILABLE);
@@ -324,16 +327,18 @@ void CPRQueryDialog::cprSocket_error(int errnum)
// Print error message
switch(errnum) {
case QSocket::ErrConnectionRefused: // if the connection was refused
- printf("ErrConnectionRefused\n");
+ msg.append("ErrConnectionRefused");
break;
case QSocket::ErrHostNotFound: // if the host was not found
- printf("ErrHostNotFound\n");
+ msg.append("ErrHostNotFound");
break;
case QSocket::ErrSocketRead: // if a read from the socket failed
- printf("ErrSocketRead\n");
+ msg.append("ErrSocketRead");
break;
}
+ if(statusbar) statusbar->message(msg);
+ MessageBox(this, "Fejl", msg, TYPE_OK, ICON_ERROR).exec();
accept();
}
@@ -350,10 +355,12 @@ void CPRQueryDialog::cprSocket_readyRead()
QString lastname;
int timeout = 0;
- timer->stop();
-
if (!cprSocket->canReadLine()) return;
+ QString msg = QString("Recieving name from cpr database...");
+ if(statusbar) statusbar->message(msg);
+ timer->stop();
+
while(cprSocket->canReadLine()) {
QString s = cprSocket->readLine();
if (s.startsWith("0001")) {
@@ -391,7 +398,10 @@ void CPRQueryDialog::cprSocket_readyRead()
*/
void CPRQueryDialog::cprSocket_connected()
{
+ QString msg = QString("Connected to cpr database, sending cpr number...");
+ if(statusbar) statusbar->message(msg);
timer->stop();
+
cprSocket->writeBlock(internalCpr, 10);
cprSocket->writeBlock("\n", 1);
}
@@ -402,31 +412,33 @@ void CPRQueryDialog::cprSocket_connected()
*/
void CPRQueryDialog::cprSocket_timeout()
{
+ QString msg = QString("cprSocket timed out doing: ");
timer->stop();
lbl_name->setText(NAME_NOT_AVAILABLE);
- printf("cprSocket timed out tryning to:\n");
// Print connection status
switch(cprSocket->state()) {
case QSocket::Idle: // if there is no connection
- printf("Idle\n");
+ msg.append("Idle");
break;
case QSocket::HostLookup: // during a DNS lookup
- printf("HostLookup\n");
+ msg.append("HostLookup");
break;
case QSocket::Connecting: // during TCP connection establishment
- printf("Connecting\n");
+ msg.append("Connecting");
break;
case QSocket::Connected: // when there is an operational connection
- printf("Conected\n");
+ msg.append("Conected");
break;
case QSocket::Closing: // if the socket is closing down, but is not yet closed.
- printf("Closing\n");
+ msg.append("Closing");
break;
}
+ if(statusbar) statusbar->message(msg);
+ MessageBox(this, "Fejl", msg, TYPE_OK, ICON_ERROR).exec();
accept();
}
diff --git a/src/cprquerydialog.h b/src/cprquerydialog.h
index 2f492f1..dfba59b 100644
--- a/src/cprquerydialog.h
+++ b/src/cprquerydialog.h
@@ -69,6 +69,7 @@ using namespace std;
#include <qlabel.h>
#include <qsocket.h>
#include <qtimer.h>
+#include <qstatusbar.h>
#include "messagebox.h"
@@ -78,7 +79,8 @@ public:
CPRQueryDialog(QLabel *lcpr,
QLabel *lname,
QWidget * parent = 0,
- const char * name = 0);
+ const char * name = 0,
+ QStatusBar *status = NULL);
~CPRQueryDialog();
public slots:
@@ -93,6 +95,8 @@ public slots:
void cprSocket_timeout();
private:
+ QStatusBar *statusbar;
+
QLabel *lbl_cpr;
QLabel *lbl_name;
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 8164981..dc5b5e2 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -50,10 +50,6 @@
MainWindow::MainWindow( QWidget* parent, const char* name )
: QWidget( parent, name, WStyle_Customize | WStyle_NoBorder )
{
- // statusBar();
- // statusBar()->message("fisk");
- // statusBar()->setSizeGripEnabled(false);
-
MiavConfig cfg("miav.conf");
int resolution_w = cfg.readInt("pixel_width");
int resolution_h = cfg.readInt("pixel_height");
@@ -64,7 +60,7 @@ MainWindow::MainWindow( QWidget* parent, const char* name )
// Load images
pix_record = new QPixmap();
- pix_record->load( "record.png" );
+ pix_record->load( PIXMAPS"/record.png" );
/*
QPainter *paint = new QPainter();
QPicture *pic = new QPicture();
@@ -76,16 +72,16 @@ MainWindow::MainWindow( QWidget* parent, const char* name )
*/
pix_stop = new QPixmap();
- pix_stop->load( "stop.png" );
+ pix_stop->load( PIXMAPS"/stop.png" );
pix_camera = new QPixmap();
- pix_camera->load( "camera.png" );
+ pix_camera->load( PIXMAPS"/camera.png" );
pix_dummy = new QPixmap();
- pix_dummy->load( "dummy.png" );
+ pix_dummy->load( PIXMAPS"/dummy.png" );
pix_logo = new QPixmap();
- pix_logo->load( "miav-logo-64x64.png" );
+ pix_logo->load( PIXMAPS"/miav-logo-64x64.png" );
createGui();
show();
@@ -102,8 +98,6 @@ MainWindow::MainWindow( QWidget* parent, const char* name )
recording = false;
frozen = false;
- aboutwindow = NULL;
-
// Open the CPR Dialog
cpr_clicked();
}
@@ -112,7 +106,6 @@ MainWindow::~MainWindow()
{
if(camera) delete camera;
delete btn_cpr;
- if(aboutwindow) delete aboutwindow;
}
void MainWindow::createGui()
@@ -157,7 +150,7 @@ void MainWindow::createGui()
g1->addMultiCellWidget ( img_recedge, 0, 0, 0, 2, Qt::AlignHCenter);
// CPR/NAME LABEL + CPR button
- lbl_cpr = createLabel("200379-1613", 18, 3);
+ lbl_cpr = createLabel("", 18, 3);
g1->addMultiCellWidget ( lbl_cpr, 1, 1, 0, 1);
btn_cpr = createButton("NYT CPR", 8, 3);
@@ -166,7 +159,7 @@ void MainWindow::createGui()
// Will also be connected in the MGUI code
g1->addWidget(btn_cpr, 1, 2);
- lbl_name = createLabel("Bent Bisballe Kjær Nyeng Jensen", 18, 2);
+ lbl_name = createLabel("", 18, 2);
g1->addMultiCellWidget ( lbl_name, 2, 2, 0, 2);
// Rec + Shot + Freeze buttons
@@ -194,29 +187,15 @@ void MainWindow::createGui()
}
// Statusbar
- lbl_status = createLabel("STATUS", 18, 1);
- lbl_status->setFrameStyle(QFrame::TabWidgetPanel | QFrame::Sunken);
- lbl_status->setLineWidth(1);
- g0->addWidget(lbl_status, 4, 0);
+ status = new QStatusBar(this);
+ status->setSizeGripEnabled(FALSE);
+ g0->addMultiCellWidget(status, 4, 4, 0, 1);
lbl_version = createLabel("MIaV-Grab v" VERSION, 18, 1);
- lbl_version->setFrameStyle(QFrame::TabWidgetPanel | QFrame::Sunken);
- lbl_version->setLineWidth(1);
- lbl_version->setFixedHeight((int)unit);
- g0->addWidget(lbl_version, 4, 1);
-
- /* // About icon
- btn_logo = new QPushButton("", this);
- btn_logo->setPixmap(*pix_logo);
- btn_logo->setFixedSize(74,74);
- btn_logo->move(940,10);
- btn_logo->setFlat(true);
- QObject::connect( btn_logo, SIGNAL(clicked()), this, SLOT(logo_clicked()) );
- */
- //lbl_version->setFont( QFont( "Arial", 8, QFont::Light ) );
- //lbl_version->setFixedSize(90,10);
- //lbl_version->move(928,81);
+ lbl_version->setFixedWidth(300);
+ status->addWidget(lbl_version, 0, TRUE);
+ status->message("Klar...");
}
QPushButton *MainWindow::createButton(char *caption, int width, int height)
@@ -237,14 +216,8 @@ QLabel *MainWindow::createLabel(char *caption, int width, int height)
void MainWindow::message(char *msg)
{
- lbl_status->setText(msg);
-}
-
-void MainWindow::logo_clicked()
-{
- if(aboutwindow)
- delete aboutwindow;
- aboutwindow = new AboutWindow(0, "About MIAV-Grab");
+ // lbl_status->setText(msg);
+ status->message(msg);
}
void MainWindow::cpr_clicked()
@@ -254,7 +227,7 @@ void MainWindow::cpr_clicked()
}
// Create and call the CPRQueryDialog.
- CPRQueryDialog dlg(lbl_cpr, lbl_name, this, "CPRQueryDialog");
+ CPRQueryDialog dlg(lbl_cpr, lbl_name, this, "CPRQueryDialog", status);
if(dlg.exec() == 0) {
printf("Cancel!\n");
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 9955cb4..88e924e 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -34,8 +34,8 @@ using namespace std;
#include <qwidget.h>
#include <qlabel.h>
#include <qpushbutton.h>
+#include <qstatusbar.h>
-#include "aboutwindow.h"
#include "videowidget.h"
#include "camera.h"
#include "cprquerydialog.h"
@@ -55,7 +55,6 @@ public:
public slots:
void cpr_clicked();
- void logo_clicked();
void rec_clicked();
void shoot_clicked();
void freeze_clicked();
@@ -66,8 +65,6 @@ private:
Camera *camera;
Error *cam_error;
- AboutWindow *aboutwindow;
-
QPixmap *pix_camera;
QPixmap *pix_record;
QPixmap *pix_stop;
@@ -75,7 +72,7 @@ private:
QPixmap *pix_logo;
QLabel *lbl_version;
- QLabel *lbl_status;
+ // QLabel *lbl_status;
QLabel *lbl_cpr;
QLabel *lbl_name;
@@ -87,6 +84,8 @@ private:
QPushButton *btn_rec;
QPushButton *btn_shoot;
QPushButton *btn_freeze;
+
+ QStatusBar *status;
VideoWidget *img_live;