From b03a3b22f60bcd5223321ba8f2a4a65e5aeec69b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 24 Dec 2018 19:01:59 +0100 Subject: tracker/pt: don't hang the app on camera start Move camera open to worker thread. --- tracker-pt/ftnoir_tracker_pt.cpp | 10 +--------- tracker-pt/lang/nl_NL.ts | 7 ------- tracker-pt/lang/ru_RU.ts | 7 ------- tracker-pt/lang/stub.ts | 7 ------- tracker-pt/lang/zh_CN.ts | 7 ------- tracker-pt/module/camera.cpp | 1 - 6 files changed, 1 insertion(+), 38 deletions(-) diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index 0d99ccd0..cafc973a 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -49,11 +49,7 @@ Tracker_PT::~Tracker_PT() void Tracker_PT::run() { -#ifdef PT_PERF_LOG - QFile log_file(OPENTRACK_BASE_PATH + "/PointTrackerPerformance.txt"); - if (!log_file.open(QIODevice::WriteOnly | QIODevice::Text)) return; - QTextStream log_stream(&log_file); -#endif + maybe_reopen_camera(); while(!isInterruptionRequested()) { @@ -120,7 +116,6 @@ void Tracker_PT::run() center_flag.clear(); } } - qDebug() << "pt: thread stopped"; } bool Tracker_PT::maybe_reopen_camera() @@ -149,9 +144,6 @@ module_status Tracker_PT::start_tracker(QFrame* video_frame) //video_widget->resize(video_frame->width(), video_frame->height()); video_frame->show(); - if (!maybe_reopen_camera()) - return { tr("Can't open camera") }; - start(QThread::HighPriority); return {}; diff --git a/tracker-pt/lang/nl_NL.ts b/tracker-pt/lang/nl_NL.ts index efa66875..c20f12d0 100644 --- a/tracker-pt/lang/nl_NL.ts +++ b/tracker-pt/lang/nl_NL.ts @@ -280,13 +280,6 @@ Don't roll or change position. - - pt_module::Tracker_PT - - Can't open camera - - - pt_module::metadata_pt diff --git a/tracker-pt/lang/ru_RU.ts b/tracker-pt/lang/ru_RU.ts index 44ccffc1..494a5a17 100644 --- a/tracker-pt/lang/ru_RU.ts +++ b/tracker-pt/lang/ru_RU.ts @@ -285,13 +285,6 @@ ROLL или X/Y-смещения. - - pt_module::Tracker_PT - - Can't open camera - - - pt_module::metadata_pt diff --git a/tracker-pt/lang/stub.ts b/tracker-pt/lang/stub.ts index f5ebbb49..a1b9819f 100644 --- a/tracker-pt/lang/stub.ts +++ b/tracker-pt/lang/stub.ts @@ -280,13 +280,6 @@ Don't roll or change position. - - pt_module::Tracker_PT - - Can't open camera - - - pt_module::metadata_pt diff --git a/tracker-pt/lang/zh_CN.ts b/tracker-pt/lang/zh_CN.ts index c2f1d910..38fd40b1 100644 --- a/tracker-pt/lang/zh_CN.ts +++ b/tracker-pt/lang/zh_CN.ts @@ -280,13 +280,6 @@ Don't roll or change position. - - pt_module::Tracker_PT - - Can't open camera - 无法打开摄像头 - - pt_module::metadata_pt diff --git a/tracker-pt/module/camera.cpp b/tracker-pt/module/camera.cpp index 1b948932..3dd0df7b 100644 --- a/tracker-pt/module/camera.cpp +++ b/tracker-pt/module/camera.cpp @@ -18,7 +18,6 @@ #include -using namespace pt_module; namespace pt_module { Camera::Camera(const QString& module_name) : s { module_name } -- cgit v1.2.3