MCPcopy Create free account
hub / github.com/OneMoreGres/ScreenTranslator / Manager

Method Manager

src/manager.cpp:34–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32using Loader = update::Loader;
33
34Manager::Manager()
35 : models_(std::make_unique<CommonModels>())
36 , settings_(std::make_unique<Settings>())
37 , updater_(std::make_unique<update::Updater>(QVector<QUrl>{{updatesUrl}}))
38{
39 SOFT_ASSERT(settings_, return );
40
41 // updater components
42 (void)QT_TRANSLATE_NOOP("QObject", "app");
43 (void)QT_TRANSLATE_NOOP("QObject", "recognizers");
44 (void)QT_TRANSLATE_NOOP("QObject", "correction");
45 (void)QT_TRANSLATE_NOOP("QObject", "translators");
46
47 tray_ = std::make_unique<TrayIcon>(*this, *settings_);
48 capturer_ = std::make_unique<Capturer>(*this, *settings_, *models_);
49 recognizer_ = std::make_unique<Recognizer>(*this, *settings_);
50 translator_ = std::make_unique<Translator>(*this, *settings_);
51 corrector_ = std::make_unique<Corrector>(*this, *settings_);
52 representer_ =
53 std::make_unique<Representer>(*this, *tray_, *settings_, *models_);
54 qRegisterMetaType<TaskPtr>();
55
56 settings_->load();
57 updateSettings();
58
59 if (settings_->showMessageOnStart)
60 tray_->showInformation(QObject::tr("Screen translator started"));
61
62 warnIfOutdated();
63
64 QObject::connect(updater_.get(), &update::Updater::error, //
65 tray_.get(), &TrayIcon::showError);
66 QObject::connect(updater_.get(), &update::Updater::updatesAvailable, //
67 tray_.get(), [this] {
68 tray_->showInformation(QObject::tr("Updates available"));
69 });
70}
71
72Manager::~Manager()
73{

Callers

nothing calls this directly

Calls 2

loadMethod · 0.80
showInformationMethod · 0.80

Tested by

no test coverage detected