void KisCanvasResourceProvider::setPreviousPaintOpPreset(const KisPaintOpPresetSP preset) { Q_ASSERT(preset->valid()); Q_ASSERT(!preset->paintOp().id().isEmpty()); Q_ASSERT(preset->settings()); if (!preset) return; dbgUI << "setPreviousPaintOpPreset" << preset->paintOp(); QVariant v; v.setValue(preset); m_resourceManager->setResource(PreviousPaintOpPreset, v); }
KisPaintOpPresetSP defaultPreset(const KoID& paintOp) { QString defaultName = paintOp.id() + ".kpp"; QString path = KGlobal::mainComponent().dirs()->findResource("kis_defaultpresets", defaultName); KisPaintOpPresetSP preset = new KisPaintOpPreset(path); if (!preset->load()) preset = KisPaintOpRegistry::instance()->defaultPreset(paintOp); Q_ASSERT(preset); Q_ASSERT(preset->valid()); return preset; }
void KisCanvasResourceProvider::slotPaintOpPresetActivated(const KisPaintOpPresetSP preset) { Q_ASSERT(preset->valid()); Q_ASSERT(!preset->paintOp().id().isEmpty()); Q_ASSERT(preset->settings()); if (!preset) return; dbgUI << "slotPaintOpPresetActivated" << preset->paintOp(); QVariant v; v.setValue(preset); m_resourceManager->setResource(CurrentPaintOpPreset, v); emit sigPaintOpPresetChanged(preset); }
int main(int argc, char** argv) { KAboutData aboutData("scratchpad", 0, ki18n("scratchpad"), "1.0", ki18n("Test application for the single paint device scratchpad canvas"), KAboutData::License_LGPL, ki18n("(c) 2010 Boudewijn Rempt"), KLocalizedString(), "www.krita.org", "*****@*****.**"); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineOptions options; options.add("+preset", ki18n("preset to load")); KCmdLineArgs::addCmdLineOptions(options); KApplication app; KisScratchPad *scratchpad = new KisScratchPad(); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); if (args->count() > 0 ) { QString fileName = args->arg(0); if (QFile::exists(fileName)) { KisPaintOpPresetSP preset = new KisPaintOpPreset(fileName); preset->load(); if (preset->valid()) { scratchpad->setPreset(preset); } } } const KoColorProfile* profile = KoColorSpaceRegistry::instance()->rgb8()->profile(); scratchpad->setColorSpace(KoColorSpaceRegistry::instance()->rgb16()); scratchpad->setDisplayProfile(profile); scratchpad->setCanvasColor(Qt::white); scratchpad->setPaintColor(Qt::black); scratchpad->show(); return app.exec(); }