FilterEffectEditWidget::FilterEffectEditWidget(QWidget *parent) : QWidget(parent), m_scene(new FilterEffectScene(this)) , m_shape(0), m_canvas(0), m_effects(0) { setupUi(this); FilterResourceServerProvider * serverProvider = FilterResourceServerProvider::instance(); KoResourceServer<FilterEffectResource> * server = serverProvider->filterEffectServer(); KoAbstractResourceServerAdapter * adapter = new KoResourceServerAdapter<FilterEffectResource>(server, this); presets->setResourceAdapter(adapter); presets->setDisplayMode(KoResourceSelector::TextMode); presets->setColumnCount(1); connect(presets, SIGNAL(resourceSelected(KoResource*)), this, SLOT(presetSelected(KoResource*))); connect(presets, SIGNAL(resourceApplied(KoResource*)), this, SLOT(presetSelected(KoResource*))); KoGenericRegistryModel<KFilterEffectFactoryBase*> * filterEffectModel = new KoGenericRegistryModel<KFilterEffectFactoryBase*>(KFilterEffectRegistry::instance()); effectSelector->setModel(filterEffectModel); removeEffect->setIcon(KIcon("list-remove")); connect(removeEffect, SIGNAL(clicked()), this, SLOT(removeSelectedItem())); addEffect->setIcon(KIcon("list-add")); addEffect->setToolTip(i18n("Add effect to current filter stack")); connect(addEffect, SIGNAL(clicked()), this, SLOT(addSelectedEffect())); raiseEffect->setIcon(KIcon("arrow-up")); lowerEffect->setIcon(KIcon("arrow-down")); addPreset->setIcon(KIcon("list-add")); addPreset->setToolTip(i18n("Add to filter presets")); connect(addPreset, SIGNAL(clicked()), this, SLOT(addToPresets())); removePreset->setIcon(KIcon("list-remove")); removePreset->setToolTip(i18n("Remove filter preset")); view->setScene(m_scene); view->setRenderHint(QPainter::Antialiasing, true); view->setResizeAnchor(QGraphicsView::AnchorViewCenter); connect(m_scene, SIGNAL(connectionCreated(ConnectionSource,ConnectionTarget)), this, SLOT(connectionCreated(ConnectionSource,ConnectionTarget))); connect(m_scene, SIGNAL(selectionChanged()), this, SLOT(sceneSelectionChanged())); QSet<ConnectionSource::SourceType> inputs; inputs << ConnectionSource::SourceGraphic; inputs << ConnectionSource::SourceAlpha; inputs << ConnectionSource::BackgroundImage; inputs << ConnectionSource::BackgroundAlpha; inputs << ConnectionSource::FillPaint; inputs << ConnectionSource::StrokePaint; m_defaultSourceSelector = new KComboBox(this); foreach(ConnectionSource::SourceType source, inputs) { m_defaultSourceSelector->addItem(ConnectionSource::typeToString(source)); }
SelectionAnimator::SelectionAnimator(QGraphicsScene * scene) { // Connect to graphics scene //--------- this->scene = scene; this->connect(this->scene,SIGNAL(selectionChanged()),SLOT(sceneSelectionChanged())); // Selection timer //------------------------- this->selectionEffectTimeline = new QTimeLine(2000,this); this->connect(this->selectionEffectTimeline, SIGNAL(valueChanged(qreal)), SLOT(selectionTimelineValue(qreal))); this->selectionEffectTimeline->setFrameRange(0, 100); this->selectionEffectTimeline->setLoopCount(0); this->selectionEffectTimeline->setCurveShape(QTimeLine::LinearCurve); // this->selectionEffectTimeline->setUpdateInterval(20); this->selectionEffectTimeline->start(); }