diff --git a/effects/mousemark.cpp b/effects/mousemark.cpp index a0de241886..254b886d85 100644 --- a/effects/mousemark.cpp +++ b/effects/mousemark.cpp @@ -18,6 +18,7 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include +#include #include @@ -36,9 +37,12 @@ MouseMarkEffect::MouseMarkEffect() { KActionCollection* actionCollection = new KActionCollection( this ); KAction* a = static_cast< KAction* >( actionCollection->addAction( "ClearMouseMarks" )); - a->setText( i18n( "ClearMouseMarks" )); + a->setText( i18n( "Clear Mouse Marks" )); a->setGlobalShortcut( KShortcut( Qt::SHIFT + Qt::META + Qt::Key_F11 )); connect( a, SIGNAL( triggered( bool )), this, SLOT( clear())); + + KConfigGroup conf = EffectsHandler::effectConfig("MouseMark"); + width = conf.readEntry( "LineWidth", 3 ); } void MouseMarkEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) @@ -49,7 +53,7 @@ void MouseMarkEffect::paintScreen( int mask, QRegion region, ScreenPaintData& da glPushAttrib( GL_ENABLE_BIT | GL_CURRENT_BIT | GL_LINE_BIT ); glColor4f( 1, 0, 0, 1 ); // red glEnable( GL_LINE_SMOOTH ); - glLineWidth( 3 ); + glLineWidth( width ); foreach( const Mark& mark, marks ) { glBegin( GL_LINE_STRIP ); @@ -78,8 +82,10 @@ void MouseMarkEffect::mouseChanged( const QPoint& pos, const QPoint&, return; QPoint pos2 = drawing.last(); drawing.append( pos ); - effects->addRepaint( QRect( qMin( pos.x(), pos2.x()), qMin( pos.y(), pos2.y()), - qMax( pos.x(), pos2.x()), qMax( pos.y(), pos2.y()))); + QRect repaint = QRect( qMin( pos.x(), pos2.x()), qMin( pos.y(), pos2.y()), + qMax( pos.x(), pos2.x()), qMax( pos.y(), pos2.y())); + repaint.adjust( -width, -width, width, width ); + effects->addRepaint( repaint ); } else if( !drawing.isEmpty()) { diff --git a/effects/mousemark.h b/effects/mousemark.h index f189aedc29..1d79038a97 100644 --- a/effects/mousemark.h +++ b/effects/mousemark.h @@ -32,6 +32,7 @@ class MouseMarkEffect typedef QVector< QPoint > Mark; QVector< Mark > marks; Mark drawing; + int width; }; } // namespace diff --git a/effects/mousemark_config.cpp b/effects/mousemark_config.cpp index 16187268c6..245026339d 100644 --- a/effects/mousemark_config.cpp +++ b/effects/mousemark_config.cpp @@ -52,12 +52,11 @@ MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList // Shortcut config KGlobalAccel::self()->overrideMainComponentData(componentData()); m_actionCollection = new KActionCollection( this, componentData() ); - m_actionCollection->setConfigGroup("MouseMark"); - m_actionCollection->setConfigGlobal(true); KAction* a = static_cast< KAction* >( m_actionCollection->addAction( "ClearMouseMarks" )); a->setText( i18n( "Clear Mouse Marks" )); a->setGlobalShortcut( KShortcut( Qt::SHIFT + Qt::META + Qt::Key_F11 )); + m_ui->editor->addCollection(m_actionCollection); load(); } @@ -69,14 +68,11 @@ void MouseMarkEffectConfig::load() KConfigGroup conf = EffectsHandler::effectConfig("MouseMark"); - int width = conf.readEntry("LineWidth", 200); + int width = conf.readEntry("LineWidth", 3); QColor color = conf.readEntry("Color", QColor(255, 0, 0)); m_ui->spinWidth->setValue(width); //m_ui->spinHeight->setValue(height); - m_actionCollection->readSettings(); - m_ui->editor->addCollection(m_actionCollection); - emit changed(false); } @@ -90,12 +86,10 @@ void MouseMarkEffectConfig::save() conf.writeEntry("LineWidth", m_ui->spinWidth->value()); //conf.writeEntry("Color", m_ui->spinHeight->value()); - m_actionCollection->writeSettings(); - conf.sync(); emit changed(false); - EffectsHandler::sendReloadMessage( "magnifier" ); + EffectsHandler::sendReloadMessage( "mousemark" ); } void MouseMarkEffectConfig::defaults()