AstRawDark
Manage your astrophoto dark frames
 All Classes Functions Variables Enumerations Enumerator Pages
dataStore.h
1 /*
2  * AstRawDark
3  *
4  * Copyright (C) 2015 - Frédéric CORNU
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef DATASTORE_H
21 #define DATASTORE_H
22 
23 #include <QObject>
24 #include <QStandardItemModel>
25 
26 #include "dto/imageInfo.h"
27 #include "commands/abstractCommand.h"
28 
34 class DataStore : public QObject
35 {
36  Q_OBJECT
37 
38 private:
42  DataStore();
43 
45  static DataStore* _instance;
46 public:
51  static DataStore* getInstance();
52 
57  QStandardItemModel* getDarkModel() const {return _darkListModel;}
58 
59 
64  QStandardItemModel* getLightsModel() const {return _lightsListModel;}
65 
70  QStandardItemModel* getDarkTreeModel() const {return _darkTreeModel;}
71 
76  QStandardItemModel* getCommandListModel() const {return _commandListModel;}
77 
82  QStringList& getDarkSources() {return _darkSources;}
83 
88  bool getRememberWindowGeometry() const {return _rememberWindowGeometry;}
89 
94  void setRememberWindowGeometry(bool remember);
95 
100  void setScanDarkOnStartup(bool scan);
101 
106  void setDarkCopyFolderPath(const QString copyFolder);
107 
112  bool getScanDarkOnStartup() const {return _scanDarksOnStartup;}
113 
118  void setDarkDisplayFilter(const QString filter);
119 
124  int getDarkLibrarySize() const {return _scannedDarks.count();}
125 
130  int getLightsCount() const {return _scannedLights.count();}
131 
136  const QList<ImageInfo>& getScannedDarks() const {return _scannedDarks;}
137 
142  const QList<ImageInfo>& getScannedLights() const {return _scannedLights;}
143 
148  const QList<ImageInfo>& getFilteredDarks() const {return _filteredDarks;}
149 
154  const QList<ImageInfo>& getMatchedDarks() const {return _matchedDarks;}
155 
160  const QString& getLightsFolder() const {return _lightsFolder; }
161 
166  const QString& getDarkCopyFolderPath() { return _darksCopyFolder; }
167 
172  void setLightsFolder(const QString lights) { _lightsFolder = lights;}
173 
179  int getNeededDarks4Matching() const { return _neededDarks4Matching; }
180 
186  void setNeededDarks4Matching(int neededDarks4Matching) { _neededDarks4Matching = neededDarks4Matching; }
187 
188 private:
189  static QString _S_DarkDisplayFilter;
190 
191  QStandardItemModel* _darkListModel;
192  QStandardItemModel* _lightsListModel;
193  QStandardItemModel* _commandListModel;
194  QStandardItemModel* _darkTreeModel;
195  QStringList _darkSources;
196  QList<ImageInfo> _scannedDarks;
197  QList<ImageInfo> _filteredDarks;
198  QList<ImageInfo> _scannedLights;
199  QList<ImageInfo> _matchedDarks;
200  bool _rememberWindowGeometry;
201  bool _scanDarksOnStartup;
202  QString _lightsFolder;
203  QString _darksCopyFolder;
204  int _neededDarks4Matching;
205 
212  void updateCommandModelRow(int row, AbstractCommand* command);
213 
218  void populateDarkFiltersTreeView(QList<ImageInfo> imageInfos);
219 
225  void populateFrameListModel(QStandardItemModel* model, QList<ImageInfo> frames);
226 
232  static bool filterDark(ImageInfo dark);
233 
237  void filterDarks();
238 
239 signals:
240 
244  void darkListModelChanged();
245 
246 public slots:
247 
249  void on_newDarkScanStarted();
250 
253 
258  void on_newDarkScanResult(QList<ImageInfo> darks);
259 
264  void on_newLightsScanResult(QList<ImageInfo> lights);
265 
271 
276  void on_CommandCreated(AbstractCommand* command);
277 
282  void on_newDarkSources(QStringList paths);
283 
288  void on_matchFound(QList<ImageInfo> matchedDarks);
289 
290 };
291 
292 #endif // DATASTORE_H