Krita Source Code Documentation
Loading...
Searching...
No Matches
KisStorageModel.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2019 Boudewijn Rempt <boud@valdyas.org>
3 * SPDX-FileCopyrightText: 2023 L. E. Segovia <amy@amyspark.me>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7#ifndef KISSTORAGEMODEL_H
8#define KISSTORAGEMODEL_H
9
10#include <QAbstractTableModel>
11#include <QObject>
12#include <QScopedPointer>
13
14#include "KisResourceStorage.h"
15#include "kritaresources_export.h"
16
17class QSqlQuery;
18
24class KRITARESOURCES_EXPORT KisStorageModel : public QAbstractTableModel
25{
26 Q_OBJECT
27public:
28
40
46
47 KisStorageModel(QObject *parent = 0);
48 ~KisStorageModel() override;
49
50 static KisStorageModel * instance();
51
52 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
53 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
54 QVariant data(const QModelIndex &index, int role) const override;
55
57 bool setData(const QModelIndex &index, const QVariant &value, int role) override;
58 Qt::ItemFlags flags(const QModelIndex &index) const override;
59
60 KisResourceStorageSP storageForIndex(const QModelIndex &index) const;
61 KisResourceStorageSP storageForId(const int storageId) const;
62
63 bool importStorage(QString filename, StorageImportOption importOption) const;
64
65 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
66
67Q_SIGNALS:
68
69 void storageEnabled(const QString &storage);
70 void storageDisabled(const QString &storage);
71
73 void storageResynchronized(const QString &storage, bool isBulkResynchronization);
74
77
78private Q_SLOTS:
79
81 void addStorage(const QString &location);
82
84 void removeStorage(const QString &location);
85
87 void slotStoragesBulkSynchronizationFinished();
88
89private :
90 void resetQuery();
91
92 static QImage getThumbnailFromQuery(const QSqlQuery &query);
93
94 struct Private;
95 QScopedPointer<Private> d;
96};
97
98#endif // KISSTORAGEMODEL_H
float value(const T *src, size_t ch)
PythonPluginManager * instance
void storageDisabled(const QString &storage)
QScopedPointer< Private > d
void storageEnabled(const QString &storage)
void storageResynchronized(const QString &storage, bool isBulkResynchronization)
Emitted when an individual storage is initialized.
void storagesBulkSynchronizationFinished()
Emitted on loading when all the storages are finished initialization.