summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--api/plugin-api.cpp3
-rw-r--r--api/plugin-api.hpp3
-rw-r--r--logic/runtime-libraries.cpp33
-rw-r--r--logic/runtime-libraries.hpp2
4 files changed, 21 insertions, 20 deletions
diff --git a/api/plugin-api.cpp b/api/plugin-api.cpp
index 3630beae..b2329f4b 100644
--- a/api/plugin-api.cpp
+++ b/api/plugin-api.cpp
@@ -56,7 +56,8 @@ bool module_status::is_ok() const
}
module_status_mixin::~module_status_mixin() = default;
-module_status::module_status(QString error) : error(std::move(error)) {}
+module_status::module_status(const QString& error) : error(error) {}
+module_status::module_status() = default;
module_status module_status_mixin::status_ok() { return {}; }
module_status module_status_mixin::error(const QString& error)
diff --git a/api/plugin-api.hpp b/api/plugin-api.hpp
index 1bfce7d5..137ee46d 100644
--- a/api/plugin-api.hpp
+++ b/api/plugin-api.hpp
@@ -97,7 +97,8 @@ struct OTR_API_EXPORT module_status final
QString error;
bool is_ok() const;
- module_status(QString error = {});
+ module_status();
+ explicit module_status(const QString& error);
};
/*
diff --git a/logic/runtime-libraries.cpp b/logic/runtime-libraries.cpp
index 82a148fe..754f52cd 100644
--- a/logic/runtime-libraries.cpp
+++ b/logic/runtime-libraries.cpp
@@ -3,20 +3,21 @@
#include <QMessageBox>
#include <QDebug>
+#ifdef __clang__
+# pragma clang diagnostic ignored "-Wcomma"
+#endif
+
runtime_libraries::runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f)
{
+ auto error = [](const QString& msg) { return module_status_mixin::error(msg); };
+
module_status status =
- module_status_mixin::error(tr("Library load failure"));
+ error(tr("Library load failure"));
using namespace options;
with_tracker_teardown sentinel;
-#ifdef __clang__
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Wcomma"
-#endif
-
pProtocol = make_dylib_instance<IProtocol>(p);
if (!pProtocol)
@@ -27,8 +28,8 @@ runtime_libraries::runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dyli
if(status = pProtocol->initialize(), !status.is_ok())
{
- status = tr("Error occurred while loading protocol %1\n\n%2\n")
- .arg(p->name, status.error);
+ status = error(tr("Error occurred while loading protocol %1\n\n%2\n")
+ .arg(p->name, status.error));
goto end;
}
@@ -50,22 +51,18 @@ runtime_libraries::runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dyli
if (pFilter)
if(status = pFilter->initialize(), !status.is_ok())
{
- status = tr("Error occurred while loading filter %1\n\n%2\n")
- .arg(f->name, status.error);
+ status = error(tr("Error occurred while loading filter %1\n\n%2\n")
+ .arg(f->name, status.error));
goto end;
}
if (status = pTracker->start_tracker(frame), !status.is_ok())
{
- status = tr("Error occurred while loading tracker %1\n\n%2\n")
- .arg(t->name, status.error);
+ status = error(tr("Error occurred while loading tracker %1\n\n%2\n")
+ .arg(t->name, status.error));
goto end;
}
-#ifdef __clang__
-# pragma clang diagnostic pop
-#endif
-
correct = true;
return;
@@ -75,6 +72,8 @@ end:
pProtocol = nullptr;
if (!status.is_ok())
- QMessageBox::critical(nullptr, tr("Startup failure"), status.error, QMessageBox::Cancel, QMessageBox::NoButton);
+ QMessageBox::critical(nullptr,
+ tr("Startup failure"), status.error,
+ QMessageBox::Cancel, QMessageBox::NoButton);
}
diff --git a/logic/runtime-libraries.hpp b/logic/runtime-libraries.hpp
index 08226c5d..8c7fedd1 100644
--- a/logic/runtime-libraries.hpp
+++ b/logic/runtime-libraries.hpp
@@ -12,7 +12,7 @@
#include "compat/tr.hpp"
#include "export.hpp"
-#include <QFrame>
+class QFrame;
class OTR_LOGIC_EXPORT runtime_libraries final : public TR
{