KViewEffects::KViewEffects( QObject* parent, const char* name, const QStringList & )
	: Plugin( parent, name )
	, m_gamma( 0.5 ), m_lastgamma( -1.0 )
	, m_opacity( 50 ), m_lastopacity( -1 )
	, m_intensity( 50 ), m_lastintensity( -1 )
	, m_color( white )
	, m_image( 0 )
{
	QObjectList * viewerList = parent->queryList( 0, "KImageViewer Part", false, false );
	m_pViewer = static_cast<KImageViewer::Viewer *>( viewerList->getFirst() );
	delete viewerList;
	if( m_pViewer )
	{
		KAction * gammaaction = new KAction( i18n( "&Gamma Correction..." ), 0, 0,
				this, SLOT( gamma() ),
				actionCollection(), "plugin_effects_gamma" );
		KAction * blendaction = new KAction( i18n( "&Blend Color..." ), 0, 0,
				this, SLOT( blend() ),
				actionCollection(), "plugin_effects_blend" );
		KAction * intensityaction = new KAction( i18n( "Change &Intensity (Brightness)..." ), 0, 0,
				this, SLOT( intensity() ),
				actionCollection(), "plugin_effects_intensity" );
		gammaaction->setEnabled( m_pViewer->canvas()->image() != 0 );
		blendaction->setEnabled( m_pViewer->canvas()->image() != 0 );
		intensityaction->setEnabled( m_pViewer->canvas()->image() != 0 );
		connect( m_pViewer->widget(), SIGNAL( hasImage( bool ) ), gammaaction, SLOT( setEnabled( bool ) ) );
		connect( m_pViewer->widget(), SIGNAL( hasImage( bool ) ), blendaction, SLOT( setEnabled( bool ) ) );
		connect( m_pViewer->widget(), SIGNAL( hasImage( bool ) ), intensityaction, SLOT( setEnabled( bool ) ) );
	}
	else
Exemple #2
0
void SpinBox::init()
{
	int step = QSpinBox::lineStep();
	mLineStep        = step;
	mLineShiftStep   = step;
	mCurrentButton   = NO_BUTTON;
	mShiftMouse      = false;
	mShiftMinBound   = false;
	mShiftMaxBound   = false;
	mSelectOnStep    = true;
	mReadOnly        = false;
	mSuppressSignals = false;
	mEdited          = false;

	// Find the spin widgets which are part of the spin boxes, in order to
	// handle their shift-button presses.
	QObjectList* spinwidgets = queryList("QSpinWidget", 0, false, true);
	QSpinWidget* spin = (QSpinWidget*)spinwidgets->getFirst();
	if (spin)
		spin->installEventFilter(this);   // handle shift-button presses
	delete spinwidgets;
	editor()->installEventFilter(this);   // handle shift-up/down arrow presses

#if KDE_IS_VERSION(3,1,90)
	// Detect when the text field is edited
	connect(editor(), SIGNAL(textChanged(const QString&)), SLOT(textEdited()));
#endif
}