summaryrefslogtreecommitdiff
path: root/src/cprquerydialog.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cprquerydialog.cc')
-rw-r--r--src/cprquerydialog.cc29
1 files changed, 29 insertions, 0 deletions
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);
+ }
}
/**