Commit 69ec5ec0 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Create resource loaders for all resource types

parent dea66447
......@@ -257,6 +257,16 @@ void KisMimeDatabase::fillMimeData()
mimeType.suffixes = QStringList() << "kws";
s_mimeDatabase << mimeType;
mimeType.mimeType = "application/x-krita-windowlayout";
mimeType.description = i18nc("description of a file type", "Krita Window Layout");
mimeType.suffixes = QStringList() << "ksn";
s_mimeDatabase << mimeType;
mimeType.mimeType = "application/x-krita-session";
mimeType.description = i18nc("description of a file type", "Krita Session");
mimeType.suffixes = QStringList() << "ksn";
s_mimeDatabase << mimeType;
mimeType.mimeType = "application/x-krita-taskset";
mimeType.description = i18nc("description of a file type", "Krita Taskset");
mimeType.suffixes = QStringList() << "kts";
......
......@@ -46,6 +46,7 @@
#include <QSysInfo>
#include <QTimer>
#include <QWidget>
#include <QImageReader>
#include <klocalizedstring.h>
#include <kdesktopfile.h>
......@@ -92,10 +93,26 @@
#include "KisViewManager.h"
#include "kis_workspace_resource.h"
#include <KisAutoSaveRecoveryDialog.h>
#include <KisResourceCacheDb.h>
#include <KritaVersionWrapper.h>
#include <dialogs/KisSessionManagerDialog.h>
#include <KisResourceLocator.h>
#include <KisResourceLoader.h>
#include <KisResourceLoaderRegistry.h>
#include <kis_gbr_brush.h>
#include <kis_png_brush.h>
#include <kis_svg_brush.h>
#include <kis_imagepipe_brush.h>
#include <KoColorSet.h>
#include <KoSegmentGradient.h>
#include <KoStopGradient.h>
#include <KoPattern.h>
#include <kis_workspace_resource.h>
#include <KisSessionResource.h>
#include <resources/KoSvgSymbolCollectionResource.h>
namespace {
const QTime appStartTime(QTime::currentTime());
}
......@@ -108,7 +125,6 @@ public:
KisAutoSaveRecoveryDialog *autosaveDialog {0};
QPointer<KisMainWindow> mainWindow; // The first mainwindow we create on startup
bool batchRun {false};
KisResourceCacheDb resourceDatabase;
};
class KisApplication::ResetStarting
......@@ -298,6 +314,42 @@ void KisApplication::addResourceTypes()
void KisApplication::loadResources()
{
KisResourceLoaderRegistry *reg = KisResourceLoaderRegistry::instance();
reg->add(new KisResourceLoader<KisPaintOpPreset>("kis_paintoppresets", "paintoppresets", QStringList() << "application/x-krita-paintoppreset"));
reg->add(new KisResourceLoader<KisResourceBundle>("kis_resourcebundles", "bundles", QStringList() << "application/x-krita-bundle"));
reg->add(new KisResourceLoader<KisGbrBrush>("gbr_brushes", "brushes", QStringList() << "image/x-gimp-brush"));
reg->add(new KisResourceLoader<KisImagePipeBrush>("gih_brushes", "brushes", QStringList() << "image/x-gimp-brush-animated"));
reg->add(new KisResourceLoader<KisSvgBrush>("gbr_brushes", "brushes", QStringList() << "image/svg+xml"));
reg->add(new KisResourceLoader<KisPngBrush>("png_brushes", "brushes", QStringList() << "image/png"));
reg->add(new KisResourceLoader<KoSegmentGradient>("segmented_gradients", "gradients", QStringList() << "application/x-gimp-gradient"));
reg->add(new KisResourceLoader<KoStopGradient>("stop_gradients", "gradients", QStringList() << "application/x-karbon-gradient" << "image/svg+xml"));
reg->add(new KisResourceLoader<KoColorSet>("kopalettes", "palettes",
QStringList() << KisMimeDatabase::mimeTypeForSuffix("kpl")
<< KisMimeDatabase::mimeTypeForSuffix("gpl")
<< KisMimeDatabase::mimeTypeForSuffix("pal")
<< KisMimeDatabase::mimeTypeForSuffix("act")
<< KisMimeDatabase::mimeTypeForSuffix("aco")
<< KisMimeDatabase::mimeTypeForSuffix("css")
<< KisMimeDatabase::mimeTypeForSuffix("colors")
<< KisMimeDatabase::mimeTypeForSuffix("xml")
<< KisMimeDatabase::mimeTypeForSuffix("sbz")));
QList<QByteArray> src = QImageReader::supportedMimeTypes();
QStringList allImageMimes;
Q_FOREACH(const QByteArray ba, src) {
allImageMimes << QString::fromUtf8(ba);
}
reg->add(new KisResourceLoader<KoPattern>("ko_patterns", "patterns", allImageMimes));
reg->add(new KisResourceLoader<KisWorkspaceResource>("workspaces", "workspaces", QStringList() << "application/x-krita-workspace"));
reg->add(new KisResourceLoader<KoSvgSymbolCollectionResource>("symbols", "symbols", QStringList() << "image/svg+xml"));
reg->add(new KisResourceLoader<KisSessionResource>("windowlayouts", "sessions", QStringList() << "application/x-krita-windowlayout"));
reg->add(new KisResourceLoader<KisSessionResource>("sessions", "sessions", QStringList() << "application/x-krita-session"));
// qDebug() << "loadResources();";
setSplashScreenLoadingText(i18n("Loading Resources..."));
......@@ -377,8 +429,6 @@ bool KisApplication::start(const KisApplicationArguments &args)
{
KisConfig cfg;
d->resourceDatabase.initialize(cfg.readEntry<QString>(KisResourceCacheDb::dbLocationKey, QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)));
#if defined(Q_OS_WIN)
#ifdef ENV32BIT
......
......@@ -34,7 +34,8 @@
#include <KoResourceItemChooser.h>
#include <KoResourceServerAdapter.h>
#include <KoResourceServerProvider.h>
#include <KisResourceLoader.h>
#include <KisResourceLoaderRegistry.h>
#include <KisResourceServerProvider.h>
#include <KisViewManager.h>
#include <kis_canvas2.h>
......@@ -98,6 +99,8 @@ TasksetDockerDock::TasksetDockerDock( ) : QDockWidget(i18n("Task Sets")), m_canv
chooserButton->setIcon(KisIconUtils::loadIcon("edit-copy"));
KisResourceLoaderRegistry::instance()->add(new KisResourceLoader<TasksetResource>("taskset", "taskset", QStringList() << "application/x-krita-taskset"));
m_rserver = new KoResourceServerSimpleConstruction<TasksetResource>("kis_taskset", "*.kts");
if (!QFileInfo(m_rserver->saveLocation()).exists()) {
QDir().mkpath(m_rserver->saveLocation());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment