diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-05-02 18:24:27 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-05-02 18:24:27 +0200 |
commit | 5ea61a6b6f2cc587cf3aeb0cf16f2f492b20b52f (patch) | |
tree | 51340656683e9c3764810771104d92b596b3758a | |
parent | 31c8c2e8ee6686b55456c58ecc880e7e1874ac9b (diff) |
tracker/fusion: fix logic error
Debugged-by: @Artyrm
Issue: #775
-rw-r--r-- | tracker-fusion/fusion.cpp | 22 | ||||
-rw-r--r-- | tracker-fusion/fusion.h | 11 |
2 files changed, 11 insertions, 22 deletions
diff --git a/tracker-fusion/fusion.cpp b/tracker-fusion/fusion.cpp index 98e2465e..d1b866c7 100644 --- a/tracker-fusion/fusion.cpp +++ b/tracker-fusion/fusion.cpp @@ -13,7 +13,7 @@ #include <QMessageBox> #include <QApplication> -static const QString own_name = QStringLiteral("fusion"); +static const char* own_name = "fusion"; static auto get_modules() { @@ -32,13 +32,6 @@ fusion_tracker::~fusion_tracker() rot_dylib = nullptr; pos_dylib = nullptr; - - if (other_frame) - { - if (other_frame->layout()) - delete other_frame->layout(); - other_frame = nullptr; - } } const QString& fusion_tracker::caption() @@ -110,7 +103,6 @@ module_status fusion_tracker::start_tracker(QFrame* frame) if (frame->layout() == nullptr) { status = rot_tracker->start_tracker(frame); - other_frame = nullptr; if (!status.is_ok()) { err = rot_dylib->name + QStringLiteral(":\n ") + status.error; @@ -119,16 +111,10 @@ module_status fusion_tracker::start_tracker(QFrame* frame) } else { - other_frame->setVisible(false); other_frame->setFixedSize(320, 240); // XXX magic frame size + other_frame->setVisible(false); rot_tracker->start_tracker(other_frame.get()); - - if (other_frame->layout() == nullptr) - other_frame = nullptr; - else - other_frame->hide(); - } end: @@ -159,8 +145,8 @@ fusion_dialog::fusion_dialog() connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - ui.rot_tracker->addItem(""); - ui.pos_tracker->addItem(""); + ui.rot_tracker->addItem({}); + ui.pos_tracker->addItem({}); Modules libs = get_modules(); diff --git a/tracker-fusion/fusion.h b/tracker-fusion/fusion.h index 9b199487..daadf27d 100644 --- a/tracker-fusion/fusion.h +++ b/tracker-fusion/fusion.h @@ -1,13 +1,16 @@ #pragma once + #include "api/plugin-api.hpp" #include "api/plugin-support.hpp" +#include "options/options.hpp" +using namespace options; + +#include <memory> + #include <QObject> #include <QFrame> #include <QCoreApplication> -#include "options/options.hpp" -using namespace options; - struct fusion_settings final : opts { value<QVariant> rot_tracker_name, pos_tracker_name; @@ -21,7 +24,7 @@ class fusion_tracker : public QObject, public ITracker double rot_tracker_data[6] {}, pos_tracker_data[6] {}; - std::unique_ptr<QFrame> other_frame; + std::unique_ptr<QFrame> other_frame { std::make_unique<QFrame>() }; std::shared_ptr<dylib> rot_dylib, pos_dylib; std::shared_ptr<ITracker> rot_tracker, pos_tracker; |