summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--video-ps3eye/lang/nl_NL.ts15
-rw-r--r--video-ps3eye/lang/ru_RU.ts15
-rw-r--r--video-ps3eye/lang/stub.ts15
-rw-r--r--video-ps3eye/lang/zh_CN.ts15
-rw-r--r--video-ps3eye/module.cpp14
-rw-r--r--video-ps3eye/module.hpp1
6 files changed, 72 insertions, 3 deletions
diff --git a/video-ps3eye/lang/nl_NL.ts b/video-ps3eye/lang/nl_NL.ts
index c98370ec..81ffc826 100644
--- a/video-ps3eye/lang/nl_NL.ts
+++ b/video-ps3eye/lang/nl_NL.ts
@@ -20,4 +20,19 @@
<translation type="unfinished"></translation>
</message>
</context>
+<context>
+ <name>dialog</name>
+ <message>
+ <source>Can&apos;t open camera</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>PS3 Eye driver error: %1</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Unknown error</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
</TS>
diff --git a/video-ps3eye/lang/ru_RU.ts b/video-ps3eye/lang/ru_RU.ts
index c98370ec..81ffc826 100644
--- a/video-ps3eye/lang/ru_RU.ts
+++ b/video-ps3eye/lang/ru_RU.ts
@@ -20,4 +20,19 @@
<translation type="unfinished"></translation>
</message>
</context>
+<context>
+ <name>dialog</name>
+ <message>
+ <source>Can&apos;t open camera</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>PS3 Eye driver error: %1</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Unknown error</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
</TS>
diff --git a/video-ps3eye/lang/stub.ts b/video-ps3eye/lang/stub.ts
index c98370ec..81ffc826 100644
--- a/video-ps3eye/lang/stub.ts
+++ b/video-ps3eye/lang/stub.ts
@@ -20,4 +20,19 @@
<translation type="unfinished"></translation>
</message>
</context>
+<context>
+ <name>dialog</name>
+ <message>
+ <source>Can&apos;t open camera</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>PS3 Eye driver error: %1</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Unknown error</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
</TS>
diff --git a/video-ps3eye/lang/zh_CN.ts b/video-ps3eye/lang/zh_CN.ts
index c98370ec..81ffc826 100644
--- a/video-ps3eye/lang/zh_CN.ts
+++ b/video-ps3eye/lang/zh_CN.ts
@@ -20,4 +20,19 @@
<translation type="unfinished"></translation>
</message>
</context>
+<context>
+ <name>dialog</name>
+ <message>
+ <source>Can&apos;t open camera</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>PS3 Eye driver error: %1</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Unknown error</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
</TS>
diff --git a/video-ps3eye/module.cpp b/video-ps3eye/module.cpp
index 34987241..25d82170 100644
--- a/video-ps3eye/module.cpp
+++ b/video-ps3eye/module.cpp
@@ -190,13 +190,13 @@ bool ps3eye_camera::start(info& args)
}
if (ptr.out.error_string[0] == '\0')
- error = "Unknown error";
+ error = QString{};
else
error = QString::fromLatin1((const char*)ptr.out.error_string,
strnlen((const char*)ptr.out.error_string, sizeof(ptr.out.error_string)));
- run_in_thread_async(qApp, [=]() {
- QMessageBox::critical(nullptr, "Can't open camera", "PS3 Eye driver error: " + error, QMessageBox::Close);
+ run_in_thread_async(qApp, [error = std::move(error)] {
+ dialog::show_open_failure_msgbox(error);
});
return false;
@@ -267,6 +267,14 @@ dialog::dialog(QWidget* parent) : QWidget(parent)
connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &dialog::do_cancel);
connect(&t, &QTimer::timeout, this, [this] { s.set_exposure(); s.set_gain(); });
}
+void dialog::show_open_failure_msgbox(const QString& error)
+{
+ const QString& error_ = error.isNull() ? tr("Unknown error") : error;
+ QMessageBox::critical(nullptr,
+ tr("Can't open camera"),
+ tr("PS3 Eye driver error: %1").arg(error_),
+ QMessageBox::Close);
+}
// XXX copypasta -sh 20200329
void settings::set_gain()
diff --git a/video-ps3eye/module.hpp b/video-ps3eye/module.hpp
index 6dcec66a..595d446a 100644
--- a/video-ps3eye/module.hpp
+++ b/video-ps3eye/module.hpp
@@ -47,6 +47,7 @@ protected:
public:
explicit dialog(QWidget* parent = nullptr);
+ static void show_open_failure_msgbox(const QString& error);
};
struct ps3eye_camera final : video::impl::camera