Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Scott Petrovic
Krita
Commits
60e641ef
Commit
60e641ef
authored
Jan 15, 2021
by
Halla Rempt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Notify the resource models if storages are enabled or disabled
parent
93b6c70e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
3 deletions
+23
-3
libs/resources/KisResourceLocator.cpp
libs/resources/KisResourceLocator.cpp
+2
-1
libs/resources/KisResourceModel.cpp
libs/resources/KisResourceModel.cpp
+7
-2
libs/resources/KisStorageModel.cpp
libs/resources/KisStorageModel.cpp
+9
-0
libs/resources/KisStorageModel.h
libs/resources/KisStorageModel.h
+5
-0
No files found.
libs/resources/KisResourceLocator.cpp
View file @
60e641ef
...
...
@@ -407,6 +407,8 @@ void KisResourceLocator::purge()
bool
KisResourceLocator
::
addStorage
(
const
QString
&
storageLocation
,
KisResourceStorageSP
storage
)
{
qDebug
()
<<
"addStorage"
<<
storageLocation
<<
storage
;
Q_ASSERT
(
!
d
->
storages
.
contains
(
storageLocation
));
d
->
storages
[
storageLocation
]
=
storage
;
...
...
@@ -416,7 +418,6 @@ bool KisResourceLocator::addStorage(const QString &storageLocation, KisResourceS
return
false
;
}
emit
storageAdded
(
storage
->
location
());
return
true
;
}
...
...
libs/resources/KisResourceModel.cpp
View file @
60e641ef
...
...
@@ -16,8 +16,11 @@
#include <KisResourceCacheDb.h>
#include <KisResourceModelProvider.h>
#include <KisStorageModel.h>
#include <KisTagModel.h>
#include <kis_debug.h>
#include "KisResourceQueryMapper.h"
struct
KisAllResourcesModel
::
Private
{
...
...
@@ -34,6 +37,8 @@ KisAllResourcesModel::KisAllResourcesModel(const QString &resourceType, QObject
connect
(
KisResourceLocator
::
instance
(),
SIGNAL
(
storageAdded
(
const
QString
&
)),
this
,
SLOT
(
addStorage
(
const
QString
&
)));
connect
(
KisResourceLocator
::
instance
(),
SIGNAL
(
storageRemoved
(
const
QString
&
)),
this
,
SLOT
(
removeStorage
(
const
QString
&
)));
connect
(
KisStorageModel
::
instance
(),
SIGNAL
(
storageEnabled
(
const
QString
&
)),
this
,
SLOT
(
addStorage
(
const
QString
&
)));
connect
(
KisStorageModel
::
instance
(),
SIGNAL
(
storageDisabled
(
const
QString
&
)),
this
,
SLOT
(
removeStorage
(
const
QString
&
)));
d
->
resourceType
=
resourceType
;
...
...
@@ -443,7 +448,7 @@ int KisAllResourcesModel::rowCount(const QModelIndex &) const
}
void
KisAllResourcesModel
::
addStorage
(
const
QString
&
/*
location
*/
)
void
KisAllResourcesModel
::
addStorage
(
const
QString
&
location
)
{
beginResetModel
();
resetQuery
();
...
...
@@ -451,7 +456,7 @@ void KisAllResourcesModel::addStorage(const QString &/*location*/)
}
void
KisAllResourcesModel
::
removeStorage
(
const
QString
&
/*
location
*/
)
void
KisAllResourcesModel
::
removeStorage
(
const
QString
&
location
)
{
beginResetModel
();
resetQuery
();
...
...
libs/resources/KisStorageModel.cpp
View file @
60e641ef
...
...
@@ -229,7 +229,16 @@ bool KisStorageModel::setData(const QModelIndex &index, const QVariant &value, i
}
}
emit
dataChanged
(
index
,
index
,
{
role
});
if
(
value
.
toBool
())
{
emit
storageEnabled
(
data
(
index
,
Qt
::
UserRole
+
Location
).
toString
());
}
else
{
emit
storageDisabled
(
data
(
index
,
Qt
::
UserRole
+
Location
).
toString
());
}
return
true
;
}
...
...
libs/resources/KisStorageModel.h
View file @
60e641ef
...
...
@@ -52,6 +52,11 @@ public:
QVariant
headerData
(
int
section
,
Qt
::
Orientation
orientation
,
int
role
=
Qt
::
DisplayRole
)
const
override
;
Q_SIGNALS:
void
storageEnabled
(
const
QString
&
storage
);
void
storageDisabled
(
const
QString
&
storage
);
private
Q_SLOTS
:
/// Called whenever a storage is added
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment