From c8c71156d1b4617125d4eaf3d8aef35f41a47eea Mon Sep 17 00:00:00 2001 From: Scott Klum Date: Tue, 13 Aug 2013 16:37:59 -0400 Subject: [PATCH] Removed redundant code in DisplayGUI --- openbr/plugins/format.cpp | 17 +++++++++++++++-- openbr/plugins/gui.cpp | 23 ++--------------------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/openbr/plugins/format.cpp b/openbr/plugins/format.cpp index ec6b2f3..63bc36d 100644 --- a/openbr/plugins/format.cpp +++ b/openbr/plugins/format.cpp @@ -706,8 +706,21 @@ class xmlFormat : public Format void write(const Template &t) const { - (void) t; - qFatal("Not supported."); + QStringList lines; + lines.append(""); + lines.append(""); + lines.append("\t"); + foreach (const QString &key, t.file.localKeys()) { + if ((key == "Index") || (key == "Label")) continue; + lines.append("\t\t<"+key+">"+QtUtils::toString(t.file.value(key))+""); + } + std::vector data; + imencode(".jpg",t.m(),data); + QByteArray byteArray = QByteArray::fromRawData((const char*)data.data(), data.size()); + lines.append("\t\t"+byteArray.toBase64()+""); + lines.append("\t"); + lines.append(""); + QtUtils::writeFile(file, lines); } }; diff --git a/openbr/plugins/gui.cpp b/openbr/plugins/gui.cpp index cd56e7a..2f4a617 100644 --- a/openbr/plugins/gui.cpp +++ b/openbr/plugins/gui.cpp @@ -523,33 +523,26 @@ BR_REGISTER(Transform, ManualTransform) * \brief Elicits metadata for templates in a pretty GUI * \author Scott Klum \cite sklum */ -class ElicitTransform : public TimeVaryingTransform +class ElicitTransform : public ShowTransform { Q_PROPERTY(QStringList keys READ get_keys WRITE set_keys RESET reset_keys STORED false) BR_PROPERTY(QStringList, keys, QStringList()) Q_OBJECT - MainThreadCreator creator; DisplayGUI *gui; - QImage qImageBuffer; - QPixmap *displayBuffer; public: - ElicitTransform() : TimeVaryingTransform(false, false) + ElicitTransform() : ShowTransform() { - displayBuffer = NULL; gui = NULL; } ~ElicitTransform() { - delete displayBuffer; delete gui; } - void train(const TemplateList &data) { (void) data; } - void project(const TemplateList &src, TemplateList &dst) const { Transform * non_const = (ElicitTransform *) this; @@ -575,12 +568,6 @@ public: } } - void finalize(TemplateList & output) - { - (void) output; - emit hideWindow(); - } - void init() { initActual(); @@ -608,12 +595,6 @@ public: connect(this, SIGNAL(updateImage(QPixmap)), gui,SLOT(showImage(QPixmap))); connect(this, SIGNAL(hideWindow()), gui, SLOT(hide())); } - -signals: - - void updateImage(const QPixmap & input); - void hideWindow(); - }; BR_REGISTER(Transform, ElicitTransform) -- libgit2 0.21.4