diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-02-02 00:50:04 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-02-02 00:50:04 +0100 |
commit | 6d40b2fcdbc2b66fcb0a62b48151035e3aa293d5 (patch) | |
tree | f7ca40d36c9df79adaf0089ddeb9fdd7ba7c9e5c /logic | |
parent | 615ff19cd9c0532084fb5ce64005d99d0b2f19f1 (diff) |
api/plugin: add explicit to module_status error ctor
Diffstat (limited to 'logic')
-rw-r--r-- | logic/runtime-libraries.cpp | 33 | ||||
-rw-r--r-- | logic/runtime-libraries.hpp | 2 |
2 files changed, 17 insertions, 18 deletions
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 { |