summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--src/cprquerydialog.cc1
-rw-r--r--src/mainwindow.cc54
-rw-r--r--src/mainwindow.h28
-rw-r--r--src/messagebox.cc112
-rw-r--r--src/messagebox.h22
6 files changed, 103 insertions, 116 deletions
diff --git a/TODO b/TODO
index ff29c05..5133296 100644
--- a/TODO
+++ b/TODO
@@ -56,6 +56,8 @@ Makesystem:
[x] - Make LibJpeg detection in configure script
[ ] - Make ffmpeg detection in configure script
[x] - Make server standalone compilable (through flag to configure)
+ [x] - Include pixmaps and tools in distdir.
+ [x] - Make pixmaps correctly intalled.
MiavConfig:
[x] - Integrate file parser.
diff --git a/src/cprquerydialog.cc b/src/cprquerydialog.cc
index 14b7950..07a4df6 100644
--- a/src/cprquerydialog.cc
+++ b/src/cprquerydialog.cc
@@ -38,6 +38,7 @@ CPRQueryDialog::CPRQueryDialog(QLabel *lcpr,
QStatusBar *status)
: QDialog(parent, name, TRUE)
{
+ setCaption(name);
MiavConfig cfg("cprquery.conf");
lbl_name = lname;
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 212dfe7..5da340b 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -59,8 +59,6 @@ MainWindow::MainWindow( QWidget* parent, const char* name )
resize(resolution_w, resolution_h);
// Load images
- pix_record = new QPixmap();
- pix_record->load( PIXMAPS"/record.png" );
/*
QPainter *paint = new QPainter();
QPicture *pic = new QPicture();
@@ -71,17 +69,29 @@ MainWindow::MainWindow( QWidget* parent, const char* name )
paint->end();
*/
+ pix_record = new QPixmap();
+ pix_record->load( PIXMAP_RECORD );
+
pix_stop = new QPixmap();
- pix_stop->load( PIXMAPS"/stop.png" );
+ pix_stop->load( PIXMAP_STOP );
+
+ pix_freeze = new QPixmap();
+ pix_freeze->load( PIXMAP_FREEZE );
- pix_camera = new QPixmap();
- pix_camera->load( PIXMAPS"/camera.png" );
+ pix_unfreeze = new QPixmap();
+ pix_unfreeze->load( PIXMAP_UNFREEZE );
+
+ pix_cpr = new QPixmap();
+ pix_cpr->load( PIXMAP_CPR );
+
+ pix_snapshot = new QPixmap();
+ pix_snapshot->load( PIXMAP_SNAPSHOT );
pix_dummy = new QPixmap();
- pix_dummy->load( PIXMAPS"/dummy.png" );
+ pix_dummy->load( PIXMAP_DUMMY );
pix_logo = new QPixmap();
- pix_logo->load( PIXMAPS"/miav-logo-64x64.png" );
+ pix_logo->load( PIXMAP_LOGO_SMALL );
createGui();
show();
@@ -92,7 +102,7 @@ MainWindow::MainWindow( QWidget* parent, const char* name )
cam_error = camera->errorObject();
while(cam_error->hasError()) {
- MessageBox(this, "", cam_error->popErrorString().c_str(),
+ MessageBox(this, TXT_ERROR_TITLE, cam_error->popErrorString().c_str(),
TYPE_OK, ICON_ERROR).exec();
}
@@ -134,10 +144,10 @@ void MainWindow::createGui()
* |______________________________|__________________|
*/
- QGridLayout *g0 = new QGridLayout(this, 2, 2, 0, -1, "g0");
- QGridLayout *g1 = new QGridLayout(3, 4, -1, "g1");
+ QGridLayout *g0 = new QGridLayout(this, 2, 2, 0, -1);
+ QGridLayout *g1 = new QGridLayout(3, 4, -1);
g0->addLayout(g1, 0, 0);
- QGridLayout *g2 = new QGridLayout(1, NUM_HISTORY, -1, "g2");
+ QGridLayout *g2 = new QGridLayout(1, NUM_HISTORY, -1);
g0->addLayout(g2, 0, 1);
img_recedge = new QLabel(this);
@@ -154,8 +164,9 @@ void MainWindow::createGui()
lbl_cpr = createLabel("", 18, 3);
g1->addMultiCellWidget ( lbl_cpr, 1, 1, 0, 1);
- btn_cpr = createButton("NYT CPR", 8, 3);
+ btn_cpr = createButton("", 8, 3);
btn_cpr->setFocus();
+ 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);
@@ -170,12 +181,12 @@ void MainWindow::createGui()
g1->addWidget(btn_rec, 3, 0);
btn_shoot = createButton("", 8, 3);
- btn_shoot->setPixmap(*pix_camera);
+ btn_shoot->setPixmap(*pix_snapshot);
QObject::connect( btn_shoot, SIGNAL(clicked()), this, SLOT(shoot_clicked()) );
g1->addWidget(btn_shoot, 3, 1);
- btn_freeze = createButton("FREEZE", 8, 3);
- // btn_freeze->setPixmap(*pix_logo);
+ btn_freeze = createButton("", 8, 3);
+ btn_freeze->setPixmap(*pix_freeze);
QObject::connect( btn_freeze, SIGNAL(clicked()), this, SLOT(freeze_clicked()) );
g1->addWidget(btn_freeze, 3, 2);
@@ -196,7 +207,7 @@ void MainWindow::createGui()
lbl_version->setFixedWidth(300);
status->addWidget(lbl_version, 0, TRUE);
- status->message("Klar...");
+ status->message( TXT_READY );
}
QPushButton *MainWindow::createButton(char *caption, int width, int height)
@@ -228,13 +239,11 @@ void MainWindow::cpr_clicked()
}
// Create and call the CPRQueryDialog.
- CPRQueryDialog dlg(lbl_cpr, lbl_name, this, "CPRQueryDialog", status);
+ CPRQueryDialog dlg(lbl_cpr, lbl_name, this, TXT_CPRDLG_TITLE, status);
if(dlg.exec() == 0) {
- printf("Cancel!\n");
// TODO: Restore old CPR and name, in the labels.
} else {
- printf("CPR changed\n");
// TODO: Change CPR camera.
}
}
@@ -242,7 +251,7 @@ void MainWindow::cpr_clicked()
void MainWindow::checkErrors()
{
while(cam_error->hasError()) {
- MessageBox(this, "", cam_error->popErrorString().c_str(),
+ MessageBox(this, TXT_ERROR_TITLE, cam_error->popErrorString().c_str(),
TYPE_OK, ICON_ERROR).exec();
}
}
@@ -282,6 +291,7 @@ void MainWindow::shoot_clicked()
if(frozen) {
camera->unfreeze();
+ btn_freeze->setPixmap(*pix_freeze);
checkErrors();
btn_freeze->setOn(false);
frozen = false;
@@ -292,11 +302,15 @@ void MainWindow::freeze_clicked()
{
if(frozen) {
camera->unfreeze();
+ btn_freeze->setPixmap(*pix_freeze);
checkErrors();
+ btn_freeze->setOn(false);
frozen = false;
} else {
camera->freeze();
+ btn_freeze->setPixmap(*pix_unfreeze);
checkErrors();
+ btn_freeze->setOn(true);
frozen = true;
}
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 443ef83..18f616d 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -44,6 +44,28 @@ using namespace std;
#define NUM_HISTORY 3
+/**
+ * Textstrings
+ */
+#define TXT_ERROR_TITLE "Der er opstået en fejl!"
+#define TXT_READY "Klar..."
+#define TXT_CPRDLG_TITLE "CPRQueryDialog"
+
+/**
+ * Images
+ */
+#define PIXMAP_RECORD PIXMAPS"/record.png"
+#define PIXMAP_STOP PIXMAPS"/stop.png"
+
+#define PIXMAP_FREEZE PIXMAPS"/freeze.png"
+#define PIXMAP_UNFREEZE PIXMAPS"/unfreeze.png"
+
+#define PIXMAP_CPR PIXMAPS"/cpr.png"
+
+#define PIXMAP_SNAPSHOT PIXMAPS"/snapshot.png"
+#define PIXMAP_DUMMY PIXMAPS"/dummy.png"
+#define PIXMAP_LOGO_SMALL PIXMAPS"/miav_small.png"
+
class MainWindow : public QWidget
{
Q_OBJECT
@@ -66,14 +88,16 @@ private:
Camera *camera;
Error *cam_error;
- QPixmap *pix_camera;
+ QPixmap *pix_unfreeze;
+ QPixmap *pix_freeze;
+ QPixmap *pix_snapshot;
+ QPixmap *pix_cpr;
QPixmap *pix_record;
QPixmap *pix_stop;
QPixmap *pix_dummy;
QPixmap *pix_logo;
QLabel *lbl_version;
- // QLabel *lbl_status;
QLabel *lbl_cpr;
QLabel *lbl_name;
diff --git a/src/messagebox.cc b/src/messagebox.cc
index fe255ae..fe5420f 100644
--- a/src/messagebox.cc
+++ b/src/messagebox.cc
@@ -38,6 +38,7 @@ MessageBox::MessageBox(QWidget* parent,
msg_icon icon)
: QDialog(parent, name, TRUE)
{
+ setCaption(name);
QFrame *topf = new QFrame(this);
topf->setFrameStyle(QFrame::Box | QFrame::Raised);
topf->setLineWidth(3);
@@ -46,7 +47,7 @@ MessageBox::MessageBox(QWidget* parent,
QLabel *lbl_text = new QLabel(topf);
lbl_text->setText(text);
- lbl_text->setFont(QFont("Lucida", 18));
+ lbl_text->setFont(QFont("Arial", 18));
QFrame *f = new QFrame(topf);
QVBoxLayout *blayout = new QVBoxLayout(topf, 20, 20);
@@ -64,38 +65,38 @@ MessageBox::MessageBox(QWidget* parent,
{
switch(type) {
case TYPE_OK:
- pix_icon->load( "info.png" );
+ pix_icon->load( PIXMAP_INFO );
break;
case TYPE_OK_CANCEL:
- pix_icon->load( "warning.png" );
+ pix_icon->load( PIXMAP_WARNING );
break;
case TYPE_YES_NO:
- pix_icon->load( "question.png" );
+ pix_icon->load( PIXMAP_QUESTION );
break;
case TYPE_YES_NO_CANCEL:
- pix_icon->load( "question.png" );
+ pix_icon->load( PIXMAP_QUESTION );
break;
}
break;
}
case ICON_INFO: // An info icon (matching the ok button)
{
- pix_icon->load( "info.png" );
+ pix_icon->load( PIXMAP_INFO );
break;
}
- case ICON_WARN: // An warning icon (matching the ok/cancel button)
+ case ICON_WARNING: // An warning icon (matching the ok/cancel button)
{
- pix_icon->load( "warning.png" );
+ pix_icon->load( PIXMAP_WARNING );
break;
}
case ICON_ERROR: // An critical error icon
{
- pix_icon->load( "error.png" );
+ pix_icon->load( PIXMAP_ERROR );
break;
}
case ICON_QUESTION:// An question icon (matching the yes/no and yes/no/cancel buttons)
{
- pix_icon->load( "question.png" );
+ pix_icon->load( PIXMAP_QUESTION );
break;
}
}
@@ -104,7 +105,7 @@ MessageBox::MessageBox(QWidget* parent,
switch(type) {
case TYPE_OK:
{
- QPushButton *bok = createButton(f, "Ok");
+ QPushButton *bok = createButton(f, TXT_OK );
QGridLayout *glayout = new QGridLayout(f, 1, 1, 20, 20);
glayout->addWidget(bok, 0, 0);
connect(bok, SIGNAL( clicked() ), SLOT(bok_clicked()));
@@ -112,8 +113,8 @@ MessageBox::MessageBox(QWidget* parent,
}
case TYPE_OK_CANCEL:
{
- QPushButton *bok = createButton(f, "Ok");
- QPushButton *bcancel = createButton(f, "Cancel");
+ QPushButton *bok = createButton(f, TXT_OK );
+ QPushButton *bcancel = createButton(f, TXT_CANCEL );
QGridLayout *glayout = new QGridLayout(f, 1, 2, 20, 20);
glayout->addWidget(bcancel, 0, 1);
glayout->addWidget(bok, 0, 2);
@@ -123,8 +124,8 @@ MessageBox::MessageBox(QWidget* parent,
}
case TYPE_YES_NO:
{
- QPushButton *byes = createButton(f, "Ja");
- QPushButton *bno = createButton(f, "Nej");
+ QPushButton *byes = createButton(f, TXT_YES );
+ QPushButton *bno = createButton(f, TXT_NO );
QGridLayout *glayout = new QGridLayout(f, 1, 2, 20, 20);
glayout->addWidget(bno, 0, 0);
glayout->addWidget(byes, 0, 1);
@@ -134,9 +135,9 @@ MessageBox::MessageBox(QWidget* parent,
}
case TYPE_YES_NO_CANCEL:
{
- QPushButton *byes = createButton(f, "Ja");
- QPushButton *bcancel = createButton(f, "Cancel");
- QPushButton *bno = createButton(f, "Nej");
+ QPushButton *byes = createButton(f, TXT_YES );
+ QPushButton *bcancel = createButton(f, TXT_CANCEL );
+ QPushButton *bno = createButton(f, TXT_NO );
QGridLayout *glayout = new QGridLayout(f, 1, 3, 20, 20);
glayout->addWidget(bno, 0, 0);
glayout->addWidget(bcancel, 0, 1);
@@ -159,7 +160,7 @@ QPushButton *MessageBox::createButton(QWidget *parent, const char *text)
{
QPushButton *q = new QPushButton(parent);
q->setText(text);
- q->setFont(QFont("Lucida", 18));
+ q->setFont(QFont("Arial", 18));
q->setFixedSize(200, 75);
return q;
}
@@ -183,76 +184,3 @@ void MessageBox::bno_clicked()
{
done(MSG_NO);
}
-
-
-/*
-////////////////////////////////////////////////////////////////////////////////////////
-// A generic alert dialog that can either give the user a choice
-// (yes or no - returns true or false) or simply give a statement and await the users
-// acknowledgement (OK - returns true)
-//
-
-Alert::Alert(QWidget *parent, const char *text, bool single, const char* name, bool mode)
-: QDialog(parent, name, mode)
-// Sets up the dialog. Two buttons if mode=true otherwise one button
-{
-
- QPushButton *b_true; ;
- QPushButton *b_false;
-
- QFrame *topf = new QFrame(this);
- topf->setFrameStyle(QFrame::Box | QFrame::Raised);
- topf->setLineWidth(3);
- QVBoxLayout *bl1 = new QVBoxLayout(topf, 20, 20);
-
- QLabel *l_text = new QLabel(topf);
- QFont font("Lucida", 18);
- l_text->setText(text);
- l_text->setFont(font);
-
- QFrame *f = new QFrame(topf);
- QHBoxLayout *bl2 = new QHBoxLayout(f, 20, 20);
-
-
- QVBoxLayout *toplayout = new QVBoxLayout(this);
- toplayout->addWidget(topf);
- bl1->addWidget(l_text);
- bl1->addWidget(f);
- if(!single)
- {
- b_true = createButton(f, M_YES);
- b_false = createButton(f, M_NO);
- bl2->addWidget(b_false);
- bl2->addWidget(b_true);
- connect(b_false, SIGNAL(clicked()), SLOT(false_clicked()));
- connect(b_true, SIGNAL(clicked()), SLOT(true_clicked()));
- }
- else
- {
- b_true = createButton(f, M_OK);
- bl2->addWidget(b_true);
- connect(b_true, SIGNAL(clicked()), SLOT(true_clicked()));
- }
-
-}
-
-QPushButton *Alert::createButton(QWidget *parent, const char *text)
-{
- QPushButton *q = new QPushButton(parent);
- QFont font("Lucida", 18);
- q->setFont(font);
- q->setText(text);
- q->setFixedSize(200,75);
- return q;
-}
-
-void Alert::true_clicked()
-{
- accept();
-}
-
-void Alert::false_clicked()
-{
- reject();
-}
-*/
diff --git a/src/messagebox.h b/src/messagebox.h
index 28b06a8..5cb2bd8 100644
--- a/src/messagebox.h
+++ b/src/messagebox.h
@@ -38,8 +38,8 @@ typedef enum {
ICON_NONE, // No icon is used
ICON_DEFAULT, // An icon matching the buttons is used
ICON_INFO, // An info icon (matching the ok button)
- ICON_WARN, // An warning icon (matching the ok/cancel button)
- ICON_ERROR, // An critical error icon
+ ICON_WARNING, // An warning icon (matching the ok/cancel button)
+ ICON_ERROR, // An critical error icon
ICON_QUESTION // An question icon (matching the yes/no and yes/no/cancel buttons)
} msg_icon;
@@ -57,6 +57,24 @@ typedef enum {
TYPE_YES_NO_CANCEL,
} msg_type;
+
+/**
+ * Textstrings
+ */
+#define TXT_OK "Ok"
+#define TXT_CANCEL "Annuler"
+#define TXT_YES "Ja"
+#define TXT_NO "Nej"
+
+/**
+ * Images
+ */
+#define PIXMAP_INFO PIXMAPS"/info.png"
+#define PIXMAP_WARNING PIXMAPS"/warning.png"
+#define PIXMAP_QUESTION PIXMAPS"/question.png"
+#define PIXMAP_ERROR PIXMAPS"/error.png"
+
+
class MessageBox : public QDialog
{
Q_OBJECT