diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-04-03 12:26:38 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-04-05 03:23:13 +0200 |
commit | eb32a2ac02c6d1adcfeb0a1a5522f8aaea442489 (patch) | |
tree | b15b4ab34600e9c5d5da17eac33ea687167bbfc7 /logic | |
parent | 22a853b388597e9549125df69508c1c38706dd1d (diff) |
i18n: provide for non-QObject classes
See compat/tr.hpp for comment.
Diffstat (limited to 'logic')
-rw-r--r-- | logic/extensions.cpp | 2 | ||||
-rw-r--r-- | logic/extensions.hpp | 2 | ||||
-rw-r--r-- | logic/runtime-libraries.cpp | 12 | ||||
-rw-r--r-- | logic/runtime-libraries.hpp | 6 | ||||
-rw-r--r-- | logic/work.cpp | 8 | ||||
-rw-r--r-- | logic/work.hpp | 6 |
6 files changed, 22 insertions, 14 deletions
diff --git a/logic/extensions.cpp b/logic/extensions.cpp index 22eef6df..438f6dde 100644 --- a/logic/extensions.cpp +++ b/logic/extensions.cpp @@ -39,7 +39,7 @@ event_handler::event_handler(Modules::dylib_list const& extensions) : ext_bundle { std::shared_ptr<IExtension> ext(reinterpret_cast<IExtension*>(lib->Constructor())); std::shared_ptr<IExtensionDialog> dlg(reinterpret_cast<IExtensionDialog*>(lib->Dialog())); - std::shared_ptr<Metadata> m(reinterpret_cast<Metadata*>(lib->Meta())); + std::shared_ptr<Metadata_> m(reinterpret_cast<Metadata_*>(lib->Meta())); const ext_mask mask = ext->hook_types(); diff --git a/logic/extensions.hpp b/logic/extensions.hpp index 4d6763b2..3368b118 100644 --- a/logic/extensions.hpp +++ b/logic/extensions.hpp @@ -23,7 +23,7 @@ struct OTR_LOGIC_EXPORT event_handler final { using ext = std::shared_ptr<IExtension>; using dlg = std::shared_ptr<IExtensionDialog>; - using m = std::shared_ptr<Metadata>; + using m = std::shared_ptr<Metadata_>; ext logic; dlg dialog; diff --git a/logic/runtime-libraries.cpp b/logic/runtime-libraries.cpp index d05e90c2..aa38b032 100644 --- a/logic/runtime-libraries.cpp +++ b/logic/runtime-libraries.cpp @@ -6,7 +6,7 @@ runtime_libraries::runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f) { module_status status = - module_status_mixin::error(otr_tr("Library load failure")); + module_status_mixin::error(tr("Library load failure")); using namespace options; @@ -19,8 +19,8 @@ runtime_libraries::runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dyli if(status = pProtocol->initialize(), !status.is_ok()) { - status = _("Error occurred while loading protocol %1\n\n%2\n") - .arg(p->name).arg(status.error); + status = tr("Error occurred while loading protocol %1\n\n%2\n") + .arg(p->name).arg(status.error); goto end; } @@ -36,14 +36,14 @@ runtime_libraries::runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dyli if (pFilter) if(status = pFilter->initialize(), !status.is_ok()) { - status = _("Error occurred while loading filter %1\n\n%2\n") + status = tr("Error occurred while loading filter %1\n\n%2\n") .arg(f->name).arg(status.error); goto end; } if (status = pTracker->start_tracker(frame), !status.is_ok()) { - status = _("Error occurred while loading tracker %1\n\n%2\n") + status = tr("Error occurred while loading tracker %1\n\n%2\n") .arg(t->name).arg(status.error); goto end; } @@ -57,6 +57,6 @@ end: pProtocol = nullptr; if (!status.is_ok()) - QMessageBox::critical(nullptr, "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 1105c179..acf5bf30 100644 --- a/logic/runtime-libraries.hpp +++ b/logic/runtime-libraries.hpp @@ -9,12 +9,16 @@ #pragma once #include "api/plugin-support.hpp" +#include "compat/tr.hpp" #include "export.hpp" #include <QFrame> -struct OTR_LOGIC_EXPORT runtime_libraries final +class OTR_LOGIC_EXPORT runtime_libraries final : public TR { + Q_OBJECT + +public: using dylibptr = std::shared_ptr<dylib>; std::shared_ptr<ITracker> pTracker; diff --git a/logic/work.cpp b/logic/work.cpp index 090158eb..16538382 100644 --- a/logic/work.cpp +++ b/logic/work.cpp @@ -16,9 +16,9 @@ QString Work::browse_datalogging_file(main_settings &s) Since the freeze is apparently random, I'm not sure it helped. */ QString newfilename = QFileDialog::getSaveFileName(nullptr, - otr_tr("Select filename"), + tr("Select filename"), filename, - otr_tr("CSV File (*.csv)"), + tr("CSV File (*.csv)"), nullptr); if (!newfilename.isEmpty()) { @@ -45,8 +45,8 @@ std::shared_ptr<TrackLogger> Work::make_logger(main_settings &s) { logger = nullptr; QMessageBox::warning(nullptr, - otr_tr("Logging error"), - otr_tr("Unable to open file '%1'. Proceeding without logging.").arg(s.tracklogging_filename), + tr("Logging error"), + tr("Unable to open file '%1'. Proceeding without logging.").arg(s.tracklogging_filename), QMessageBox::Ok, QMessageBox::NoButton); } else diff --git a/logic/work.hpp b/logic/work.hpp index a0033f62..d5bb201e 100644 --- a/logic/work.hpp +++ b/logic/work.hpp @@ -16,6 +16,7 @@ #include "tracklogger.hpp" #include "logic/runtime-libraries.hpp" #include "api/plugin-support.hpp" +#include "compat/tr.hpp" #include <QObject> #include <QFrame> @@ -24,8 +25,11 @@ #include <tuple> #include <functional> -struct OTR_LOGIC_EXPORT Work final +class OTR_LOGIC_EXPORT Work final : public TR { + Q_OBJECT + +public: using fn_t = std::function<void(bool)>; using key_tuple = std::tuple<key_opts&, fn_t, bool>; main_settings s; // tracker needs settings, so settings must come before it |