From c8ef18525863612736706edb685aef4fcfc06966 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Mon, 16 Dec 2013 12:35:56 -0500 Subject: [PATCH] added TemplateList::fromBuffer --- openbr/openbr_plugin.cpp | 12 ++++++++++++ openbr/openbr_plugin.h | 3 +++ openbr/plugins/gallery.cpp | 3 +++ 3 files changed, 18 insertions(+), 0 deletions(-) diff --git a/openbr/openbr_plugin.cpp b/openbr/openbr_plugin.cpp index f36780f..f0e0e9c 100644 --- a/openbr/openbr_plugin.cpp +++ b/openbr/openbr_plugin.cpp @@ -476,6 +476,18 @@ TemplateList TemplateList::fromGallery(const br::File &gallery) return templates; } +TemplateList TemplateList::fromBuffer(const QByteArray &buffer) +{ + TemplateList templateList; + QDataStream stream(buffer); + while (!stream.atEnd()) { + Template t; + stream >> t; + templateList.append(t); + } + return templateList; +} + // indexes some property, assigns an integer id to each unique value of propName // stores the index values in "Label" of the output template list TemplateList TemplateList::relabel(const TemplateList &tl, const QString &propName, bool preserveIntegers) diff --git a/openbr/openbr_plugin.h b/openbr/openbr_plugin.h index f983238..1d9f7cd 100644 --- a/openbr/openbr_plugin.h +++ b/openbr/openbr_plugin.h @@ -437,6 +437,9 @@ struct TemplateList : public QList