summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-10-18 18:16:37 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-10-19 14:46:30 +0200
commit17ff32c097eeb9ad786039c83e6845444957468f (patch)
treec4682d34fe921ad06366376aab06690c4d8614dd /tracker-pt
parentfda9c90a547a88861d167a1c37beb40bd457018c (diff)
tracker/pt: poll for tracker info only when it could change
Diffstat (limited to 'tracker-pt')
-rw-r--r--tracker-pt/ftnoir_tracker_pt_dialog.cpp16
-rw-r--r--tracker-pt/ftnoir_tracker_pt_dialog.h6
2 files changed, 13 insertions, 9 deletions
diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp
index df0da31a..6d49f1c2 100644
--- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp
+++ b/tracker-pt/ftnoir_tracker_pt_dialog.cpp
@@ -62,7 +62,7 @@ TrackerDialog_PT::TrackerDialog_PT()
tie_setting(s.auto_threshold, ui.auto_threshold);
- connect( ui.tcalib_button,SIGNAL(toggled(bool)), this,SLOT(startstop_trans_calib(bool)) );
+ connect( ui.tcalib_button,SIGNAL(toggled(bool)), this,SLOT(startstop_trans_calib(bool)));
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK()));
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel()));
@@ -71,13 +71,15 @@ TrackerDialog_PT::TrackerDialog_PT()
set_camera_settings_available(ui.camdevice_combo->currentText());
connect(ui.camera_settings, &QPushButton::clicked, this, &TrackerDialog_PT::show_camera_settings);
- connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info()));
- timer.start(250);
+ connect(&timer, &QTimer::timeout, this, &TrackerDialog_PT::poll_tracker_info_impl);
+ timer.setInterval(250);
connect(&calib_timer, &QTimer::timeout, this, &TrackerDialog_PT::trans_calib_step);
calib_timer.setInterval(100);
- poll_tracker_info();
+ poll_tracker_info_impl();
+
+ connect(this, &TrackerDialog_PT::poll_tracker_info, this, &TrackerDialog_PT::poll_tracker_info_impl, Qt::QueuedConnection);
}
void TrackerDialog_PT::startstop_trans_calib(bool start)
@@ -193,13 +195,15 @@ void TrackerDialog_PT::register_tracker(ITracker *t)
{
tracker = static_cast<Tracker_PT*>(t);
ui.tcalib_button->setEnabled(true);
- //ui.center_button->setEnabled(true);
+ poll_tracker_info();
+ timer.start();
}
void TrackerDialog_PT::unregister_tracker()
{
tracker = NULL;
ui.tcalib_button->setEnabled(false);
- //ui.center_button->setEnabled(false);
+ poll_tracker_info();
+ timer.stop();
}
diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.h b/tracker-pt/ftnoir_tracker_pt_dialog.h
index e6b1cf30..2932252c 100644
--- a/tracker-pt/ftnoir_tracker_pt_dialog.h
+++ b/tracker-pt/ftnoir_tracker_pt_dialog.h
@@ -31,15 +31,15 @@ public slots:
void startstop_trans_calib(bool start);
void trans_calib_step();
- void poll_tracker_info();
+ void poll_tracker_info_impl();
void set_camera_settings_available(const QString& camera_name);
void show_camera_settings();
-
+signals:
+ void poll_tracker_info();
private:
settings_pt s;
Tracker_PT* tracker;
QTimer timer, calib_timer;
-
TranslationCalibrator trans_calib;
Ui::UICPTClientControls ui;