summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cprquerydialog.cc35
-rw-r--r--src/dv1394.cc14
-rw-r--r--src/info_gui.cc6
-rw-r--r--src/info_gui.h12
4 files changed, 31 insertions, 36 deletions
diff --git a/src/cprquerydialog.cc b/src/cprquerydialog.cc
index c58a8ed..6f33785 100644
--- a/src/cprquerydialog.cc
+++ b/src/cprquerydialog.cc
@@ -354,27 +354,24 @@ int CPRQueryDialog::test_cpr(const char *s)
*/
void CPRQueryDialog::cprSocket_error(QAbstractSocket::SocketError err)
{
- (void)err;
-
QString msg = QString("cprSocket encountered an error: ");
timer->stop();
lbl_name->setText(NAME_NOT_AVAILABLE);
- /* // TODO
// Print error message
- switch(errnum) {
- case QTcpSocket::ErrConnectionRefused: // if the connection was refused
+ switch(err) {
+ case QAbstractSocket::ConnectionRefusedError: // if the connection was refused
msg.append("ErrConnectionRefused");
break;
- case QTcpSocket::ErrHostNotFound: // if the host was not found
+ case QAbstractSocket::HostNotFoundError: // if the host was not found
msg.append("ErrHostNotFound");
break;
- case QTcpSocket::ErrSocketRead: // if a read from the socket failed
- msg.append("ErrSocketRead");
+ default:
+ msg.sprintf("Socket Error %d", (int)err);
break;
}
- */
+
if(statusbar) statusbar->showMessage(msg, 5000);
MessageBox(this, "Fejl", msg.toStdString().c_str(), TYPE_OK, ICON_ERROR).exec();
accept();
@@ -455,26 +452,28 @@ void CPRQueryDialog::cprSocket_timeout()
lbl_name->setText(NAME_NOT_AVAILABLE);
- /* // TODO
+ QAbstractSocket::SocketState state = cprSocket->state();
// Print connection status
- switch(cprSocket->state()) {
- case QTcpSocket::Idle: // if there is no connection
+ switch(state) {
+ case QAbstractSocket::UnconnectedState: // if there is no connection
msg.append("Idle");
break;
- case QTcpSocket::HostLookup: // during a DNS lookup
+ case QAbstractSocket::HostLookupState: // during a DNS lookup
msg.append("HostLookup");
break;
- case QTcpSocket::Connecting: // during TCP connection establishment
+ case QAbstractSocket::ConnectingState: // during TCP connection establishment
msg.append("Connecting");
break;
- case QTcpSocket::Connected: // when there is an operational connection
- msg.append("Conected");
+ case QAbstractSocket::ConnectedState: // when there is an operational connection
+ msg.append("Connected");
break;
- case QTcpSocket::Closing: // if the socket is closing down, but is not yet closed.
+ case QAbstractSocket::ClosingState: // if the socket is closing down, but is not yet closed.
msg.append("Closing");
break;
+ default:
+ msg.sprintf("Unknown state: %d", state);
+ break;
}
- */
if(statusbar) statusbar->showMessage(msg, 5000);
MessageBox(this, "Fejl", msg.toStdString().c_str(), TYPE_OK, ICON_ERROR).exec();
diff --git a/src/dv1394.cc b/src/dv1394.cc
index fe06a4d..0fde723 100644
--- a/src/dv1394.cc
+++ b/src/dv1394.cc
@@ -57,7 +57,7 @@ static int write_frame(unsigned char *data, int len, int complete,
dv1394::dv1394(Info *i, int p, int c)
{
- printf("dv1394::dv1394()\n");
+ //printf("dv1394::dv1394()\n");
info = i;
port = p;
channel = c;
@@ -65,7 +65,7 @@ dv1394::dv1394(Info *i, int p, int c)
dv1394::~dv1394()
{
- printf("dv1394::~dv1394()\n");
+ // printf("dv1394::~dv1394()\n");
iec61883_dv_fb_close (frame);
// Close firewire connection.
if(handle) raw1394_destroy_handle (handle);
@@ -73,20 +73,20 @@ dv1394::~dv1394()
bool dv1394::connect()
{
- printf("dv1394::connect()\n");
+ //printf("dv1394::connect()\n");
handle = raw1394_new_handle_on_port(port);
- printf(" handle: %p\n", handle);
+ //printf(" handle: %p\n", handle);
frame = iec61883_dv_fb_init(handle, write_frame, this);
- printf(" frame: %p\n", frame);
+ //printf(" frame: %p\n", frame);
if(frame && iec61883_dv_fb_start(frame, channel) == 0) {
// ok
- printf("frame ok\n");
+ //printf("frame ok\n");
} else {
// fail
- printf("frame fail\n");
+ //printf("frame fail\n");
return false;
}
diff --git a/src/info_gui.cc b/src/info_gui.cc
index f8072e1..adf5359 100644
--- a/src/info_gui.cc
+++ b/src/info_gui.cc
@@ -35,11 +35,9 @@ bool InfoEventHandler::eventFilter( QObject *o, QEvent *e )
{
if ( e->type() == TYPE_SHOW_MESSAGEBOX ) {
// fprintf(stderr, "Custom event!\n"); fflush(stderr);
- /* // TODO
MessageBox *msgbox = ((ShowMessageEvent*)e)->messagebox();
msgbox->exec();
delete msgbox;
- */
return TRUE; // eat event
} else {
// standard event processing
@@ -88,13 +86,11 @@ void InfoGui::showmsg(const char *msg, const char *title, msg_icon icon)
msg,
TYPE_OK,
icon);
- (void)msgbox;
- /* // TODO
ShowMessageEvent *event = new ShowMessageEvent( msgbox );
qapp->postEvent(parent, event);
- */
+
// End of safezone
pthread_mutex_unlock(&mutex);
}
diff --git a/src/info_gui.h b/src/info_gui.h
index 58fc67a..ca41e66 100644
--- a/src/info_gui.h
+++ b/src/info_gui.h
@@ -33,6 +33,7 @@
#include <QWidget>
#include <QApplication>
+#include <QEvent>
#include <pthread.h>
#include <semaphore.h>
@@ -43,18 +44,17 @@
#include "messagebox.h"
-#define TYPE_SHOW_MESSAGEBOX 65432
+#define TYPE_SHOW_MESSAGEBOX (enum QEvent::Type)(QEvent::User + 1)
-/* // TODO
-class ShowMessageEvent : public QCustomEvent {
+class ShowMessageEvent : public QEvent {
public:
ShowMessageEvent( MessageBox* msgbox )
- : QCustomEvent( TYPE_SHOW_MESSAGEBOX ), m( msgbox ) {}
+ : QEvent( TYPE_SHOW_MESSAGEBOX ), m( msgbox ) {}
MessageBox *messagebox() const { return m; }
private:
- MessageBox *m;;
+ MessageBox *m;
};
-*/
+
class InfoEventHandler : public QObject {
protected:
bool eventFilter( QObject *o, QEvent *e );