Commit 902801ca5926922feb724c1eeda50895f8bf1e04
1 parent
14afc4ea
Promote modelSearch to a member of br::Context
Showing
3 changed files
with
10 additions
and
9 deletions
openbr/core/core.cpp
| @@ -142,11 +142,8 @@ struct AlgorithmCore | @@ -142,11 +142,8 @@ struct AlgorithmCore | ||
| 142 | // assuming it is not already present. | 142 | // assuming it is not already present. |
| 143 | QFileInfo finfo(model); | 143 | QFileInfo finfo(model); |
| 144 | QString path = finfo.absolutePath(); | 144 | QString path = finfo.absolutePath(); |
| 145 | - QList<QString> paths = Globals->file.getList("modelSearch",QList<QString>() ); | ||
| 146 | - if (!paths.contains(path)) { | ||
| 147 | - paths.append(path); | ||
| 148 | - Globals->file.setList("modelSearch", paths); | ||
| 149 | - } | 145 | + if (!Globals->modelSearch.contains(path)) |
| 146 | + Globals->modelSearch.append(path); | ||
| 150 | 147 | ||
| 151 | QtUtils::BlockCompression compressedRead; | 148 | QtUtils::BlockCompression compressedRead; |
| 152 | QFile inFile(model); | 149 | QFile inFile(model); |
| @@ -777,9 +774,7 @@ class pathInitializer : public Initializer | @@ -777,9 +774,7 @@ class pathInitializer : public Initializer | ||
| 777 | Q_OBJECT | 774 | Q_OBJECT |
| 778 | void initialize() const | 775 | void initialize() const |
| 779 | { | 776 | { |
| 780 | - QList<QString> paths = Globals->file.getList("modelSearch",QList<QString>()); | ||
| 781 | - paths.append(Globals->sdkPath + "/share/openbr/models/transforms/"); | ||
| 782 | - Globals->file.setList("modelSearch", paths); | 777 | + Globals->modelSearch.append(Globals->sdkPath + "/share/openbr/models/transforms/"); |
| 783 | } | 778 | } |
| 784 | 779 | ||
| 785 | }; | 780 | }; |
openbr/openbr_plugin.h
| @@ -754,6 +754,12 @@ public: | @@ -754,6 +754,12 @@ public: | ||
| 754 | Q_PROPERTY(int crossValidate READ get_crossValidate WRITE set_crossValidate RESET reset_crossValidate) | 754 | Q_PROPERTY(int crossValidate READ get_crossValidate WRITE set_crossValidate RESET reset_crossValidate) |
| 755 | BR_PROPERTY(int, crossValidate, 0) | 755 | BR_PROPERTY(int, crossValidate, 0) |
| 756 | 756 | ||
| 757 | + /*! | ||
| 758 | + * \brief List of paths sub-models will be searched for on | ||
| 759 | + */ | ||
| 760 | + Q_PROPERTY(QList<QString> modelSearch READ get_modelSearch WRITE set_modelSearch RESET reset_modelSearch) | ||
| 761 | + BR_PROPERTY(QList<QString>, modelSearch, QList<QString>() ) | ||
| 762 | + | ||
| 757 | QHash<QString,QString> abbreviations; /*!< \brief Used by br::Transform::make() to expand abbreviated algorithms into their complete definitions. */ | 763 | QHash<QString,QString> abbreviations; /*!< \brief Used by br::Transform::make() to expand abbreviated algorithms into their complete definitions. */ |
| 758 | QTime startTime; /*!< \brief Used to estimate timeRemaining(). */ | 764 | QTime startTime; /*!< \brief Used to estimate timeRemaining(). */ |
| 759 | 765 |
openbr/plugins/core/loadstore.cpp
| @@ -130,7 +130,7 @@ private: | @@ -130,7 +130,7 @@ private: | ||
| 130 | { | 130 | { |
| 131 | if (QFileInfo(fileName).exists()) return fileName; | 131 | if (QFileInfo(fileName).exists()) return fileName; |
| 132 | 132 | ||
| 133 | - foreach(const QString &path, Globals->file.getList("modelSearch",QList<QString>())) { | 133 | + foreach(const QString &path, Globals->modelSearch) { |
| 134 | const QString file = path + "/" + fileName; | 134 | const QString file = path + "/" + fileName; |
| 135 | if (QFileInfo(file).exists()) | 135 | if (QFileInfo(file).exists()) |
| 136 | return file; | 136 | return file; |