From 495330ce3cfb6b168d2fb9b56aa125bbc7ff6e7d Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 10 Jan 2006 10:03:41 +0000 Subject: *** empty log message *** --- src/cprquerydialog.cc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/cprquerydialog.cc') diff --git a/src/cprquerydialog.cc b/src/cprquerydialog.cc index 4506e42..552aeb6 100644 --- a/src/cprquerydialog.cc +++ b/src/cprquerydialog.cc @@ -114,11 +114,40 @@ CPRQueryDialog::CPRQueryDialog(QLabel *lcpr, connect(bca,SIGNAL(clicked()), SLOT(b_c_clicked())); this->move(175,150); + + listen = new CPRListen(config->readInt("cprlisten_port")); + listen_timer = new QTimer(this); + connect(listen_timer, SIGNAL(timeout()), SLOT(listen_timeout())); + listen->run(); + listen_timer->start(500); // Check every 500 ms + show(); } CPRQueryDialog::~CPRQueryDialog() { + // Cleanup + // delete timer; + // delete cprSocket + + // Cleanup after cpr listen + listen->stop(); + // listen->wait_stop(); + delete listen; + // delete listen_timer; +} + +void CPRQueryDialog::listen_timeout() +{ + string newcpr; + if(listen->cprChanged()) { + char newcpr_buf[32]; + newcpr = listen->getCpr(); + sprintf(newcpr_buf, "%s-%s", newcpr.substr(0,6).c_str(), newcpr.substr(6,4).c_str()); + // printf("cprbuf[%s]\n", newcpr_buf); + lbl_cpr->setText(newcpr_buf); + verifycpr(newcpr_buf); + } } /** -- cgit v1.2.3