summaryrefslogtreecommitdiff
path: root/client/info_gui.cc
diff options
context:
space:
mode:
authordeva <deva>2006-03-07 10:37:59 +0000
committerdeva <deva>2006-03-07 10:37:59 +0000
commit1390ddfe6afe41dba141f8170f9b277573ebe8cd (patch)
treefd6861f3eab3a4721f2445540279a8223d7cd1a3 /client/info_gui.cc
parent19ade36987f86c9b4cd4c5ec3fc6c499205c61ec (diff)
*** empty log message ***
Diffstat (limited to 'client/info_gui.cc')
-rw-r--r--client/info_gui.cc50
1 files changed, 16 insertions, 34 deletions
diff --git a/client/info_gui.cc b/client/info_gui.cc
index aa831b6..f836a92 100644
--- a/client/info_gui.cc
+++ b/client/info_gui.cc
@@ -37,10 +37,13 @@
bool InfoEventHandler::eventFilter( QObject *o, QEvent *e )
{
if ( e->type() == TYPE_SHOW_MESSAGEBOX ) {
- // fprintf(stderr, "Custom event!\n"); fflush(stderr);
- MessageBox *msgbox = ((ShowMessageEvent*)e)->messagebox();
- msgbox->exec();
- delete msgbox;
+ ShowMessageEvent *msgevt = (ShowMessageEvent*)e;
+ MessageBox msgbox(NULL,
+ msgevt->title(),
+ msgevt->message(),
+ TYPE_OK,
+ msgevt->icon());
+ msgbox.exec();
return TRUE; // eat event
} else {
// standard event processing
@@ -48,54 +51,33 @@ bool InfoEventHandler::eventFilter( QObject *o, QEvent *e )
}
}
-InfoGui::InfoGui(QApplication *a, QWidget *p, MiavConfig *c): Info()
+InfoGui::InfoGui(MiavConfig *c): Info()
{
this->config = c;
log_filename = *(this->config->readString("client_log_file"));
- qapp = a;
- parent = p;
+ InfoEventHandler *eventhandler = new InfoEventHandler();
+ qApp->installEventFilter( eventhandler );
- pthread_mutex_init (&mutex, NULL);
+ // pthread_mutex_init (&mutex, NULL);
}
InfoGui::~InfoGui()
{
- pthread_mutex_destroy(&mutex);
-}
-
-void InfoGui::setParent(QWidget *p)
-{
- parent = p;
+ // pthread_mutex_destroy(&mutex);
}
void InfoGui::showmsg(char *msg, char *title, msg_icon icon)
{
- pthread_mutex_lock(&mutex);
+ // pthread_mutex_lock(&mutex);
// Beginning of safezone
- fprintf(stderr, "%s: %s\n", title, msg); fflush(stderr);
-
- while( !parent ) {
- struct timespec ts;
-
- ts.tv_sec = 0;
- ts.tv_nsec = 200000000L; // 200ms
- nanosleep(&ts, NULL);
- }
-
- MessageBox *msgbox = new MessageBox(parent,
- title,
- msg,
- TYPE_OK,
- icon);
-
- ShowMessageEvent *event = new ShowMessageEvent( msgbox );
+ ShowMessageEvent *event = new ShowMessageEvent(msg, title, icon);
- qapp->postEvent(parent, event);
+ qApp->postEvent(qApp, event);
// End of safezone
- pthread_mutex_unlock(&mutex);
+ // pthread_mutex_unlock(&mutex);
}
void InfoGui::error(char *fmt, ...)