summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-12-24 19:01:59 +0100
committerStanislaw Halik <sthalik@misaki.pl>2018-12-24 19:32:10 +0100
commitb03a3b22f60bcd5223321ba8f2a4a65e5aeec69b (patch)
tree7a251d154e1c8b42b08c81ef32fafdf261040c9b
parent55907f6ce27520a5e596395b73a307b6ec2aeddc (diff)
tracker/pt: don't hang the app on camera start
Move camera open to worker thread.
-rw-r--r--tracker-pt/ftnoir_tracker_pt.cpp10
-rw-r--r--tracker-pt/lang/nl_NL.ts7
-rw-r--r--tracker-pt/lang/ru_RU.ts7
-rw-r--r--tracker-pt/lang/stub.ts7
-rw-r--r--tracker-pt/lang/zh_CN.ts7
-rw-r--r--tracker-pt/module/camera.cpp1
6 files changed, 1 insertions, 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
@@ -281,13 +281,6 @@ Don&apos;t roll or change position.</source>
</message>
</context>
<context>
- <name>pt_module::Tracker_PT</name>
- <message>
- <source>Can&apos;t open camera</source>
- <translation type="unfinished"></translation>
- </message>
-</context>
-<context>
<name>pt_module::metadata_pt</name>
<message>
<source>PointTracker 1.1</source>
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
@@ -286,13 +286,6 @@ ROLL или X/Y-смещения.</translation>
</message>
</context>
<context>
- <name>pt_module::Tracker_PT</name>
- <message>
- <source>Can&apos;t open camera</source>
- <translation type="unfinished"></translation>
- </message>
-</context>
-<context>
<name>pt_module::metadata_pt</name>
<message>
<source>PointTracker 1.1</source>
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
@@ -281,13 +281,6 @@ Don&apos;t roll or change position.</source>
</message>
</context>
<context>
- <name>pt_module::Tracker_PT</name>
- <message>
- <source>Can&apos;t open camera</source>
- <translation type="unfinished"></translation>
- </message>
-</context>
-<context>
<name>pt_module::metadata_pt</name>
<message>
<source>PointTracker 1.1</source>
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
@@ -281,13 +281,6 @@ Don&apos;t roll or change position.</source>
</message>
</context>
<context>
- <name>pt_module::Tracker_PT</name>
- <message>
- <source>Can&apos;t open camera</source>
- <translation type="unfinished">无法打开摄像头</translation>
- </message>
-</context>
-<context>
<name>pt_module::metadata_pt</name>
<message>
<source>PointTracker 1.1</source>
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 <cstdlib>
-using namespace pt_module;
namespace pt_module {
Camera::Camera(const QString& module_name) : s { module_name }