16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 */ |
17 */ |
18 |
18 |
19 #include <QSettings> |
19 #include <QSettings> |
20 #include "libraries.h" |
20 #include "libraries.h" |
21 #include "configuration.h" |
21 #include "settings.h" |
22 |
22 |
23 /** |
23 /** |
24 * @brief Constructs a new library manager |
24 * @brief Constructs a new library manager |
25 * @param parent Parent object |
25 * @param parent Parent object |
26 */ |
26 */ |
27 LibraryManager::LibraryManager(QObject* parent): |
27 LibraryManager::LibraryManager(QObject* parent): |
28 QAbstractTableModel{parent} |
28 QAbstractTableModel{parent} |
29 { |
29 { |
30 } |
|
31 |
|
32 /** |
|
33 * @brief Constructs a library manager from settings |
|
34 * @param settings Settings to construct from |
|
35 * @param parent Parent object |
|
36 */ |
|
37 LibraryManager::LibraryManager(Configuration* settings, QObject* parent) : |
|
38 QAbstractTableModel{parent} |
|
39 { |
|
40 this->restoreFromSettings(settings); |
|
41 } |
30 } |
42 |
31 |
43 /** |
32 /** |
44 * @brief Yields a begin-terator for the libraries |
33 * @brief Yields a begin-terator for the libraries |
45 * @return iterator |
34 * @return iterator |
159 /** |
148 /** |
160 * @brief Restores the libraries from the specified settings object. All unsaved |
149 * @brief Restores the libraries from the specified settings object. All unsaved |
161 * changes are lost. |
150 * changes are lost. |
162 * @param settings Settings object to restore from. |
151 * @param settings Settings object to restore from. |
163 */ |
152 */ |
164 void LibraryManager::restoreFromSettings(Configuration* settings) |
153 void LibraryManager::restoreFromSettings() |
165 { |
154 { |
166 this->libraries = settings->libraries(); |
155 this->libraries = setting<Setting::Libraries>(); |
167 } |
156 } |
168 |
157 |
169 /** |
158 /** |
170 * @brief Saves the libraries to the specified settings object. |
159 * @brief Saves the libraries to the specified settings object. |
171 * @param settings Settings object to modify. |
160 * @param settings Settings object to modify. |
172 */ |
161 */ |
173 void LibraryManager::storeToSettings(Configuration* settings) |
162 void LibraryManager::storeToSettings() |
174 { |
163 { |
175 settings->setLibraries(this->libraries); |
164 setSetting<Setting::Libraries>(this->libraries); |
176 } |
165 } |
177 |
166 |
178 /** |
167 /** |
179 * @returns the amount of libraries |
168 * @returns the amount of libraries |
180 */ |
169 */ |