Krita Source Code Documentation
Loading...
Searching...
No Matches
KisResourceUserOperations.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021 Agata Cacko <cacko.azh@gmail.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef KIS_RESOURCE_OVERWRITE_DIALOG_H
8#define KIS_RESOURCE_OVERWRITE_DIALOG_H
9
10#include <QWidget>
11#include "kritaresourcewidgets_export.h"
12#include <KoResource.h>
13#include <KisResourceModel.h>
14
15
16class KRITARESOURCEWIDGETS_EXPORT KisResourceUserOperations
17{
18
19public:
20 // used when the user tries to import or create a new resource that already exists
21 // for example if they import the same resource file (the filename matches)
22 // or when they try to create a new resource with the same name and filename
23 static bool userAllowsOverwrite(QWidget* widgetParent, QString resourceFilepath);
24 static bool resourceNameIsAlreadyUsed(KisResourceModel* resourceModel, QString resourceName, int resourceIdToIgnore = -1);
25
26 // used when the user tries to rename a resource to a name that already exists
27 // (it's permitted but can confuse the user later)
28 static bool userAllowsRename(QWidget* widgetParent, QString name);
29
30
31
32 static KoResourceSP importResourceFileWithUserInput(QWidget *widgetParent, QString storageLocation, QString resourceType, QString resourceFilepath);
33 static bool renameResourceWithUserInput(QWidget* widgetParent, KoResourceSP resource, QString resourceName);
34 static bool addResourceWithUserInput(QWidget* widgetParent, KoResourceSP resource, QString storageLocation = "");
35 static bool updateResourceWithUserInput(QWidget* widgetParent, KoResourceSP resource);
36
37
38
39
40};
41
42#endif // KIS_RESOURCE_OVERWRITE_DIALOG_H
The KisResourceModel class provides the main access to resources. It is possible to filter the resour...
static bool userAllowsRename(QWidget *widgetParent, QString name)