[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdetoys/amor
From:       Gerardo Puga <gpuga () gioia ! ing ! unlp ! edu ! ar>
Date:       2004-03-06 20:14:19
Message-ID: 20040306201419.36091997E () office ! kde ! org
[Download RAW message or body]

CVS commit by gpuga: 


Fix partially based on a patch sent by Jakob Schroeter to include an Apply 
button in the configuration dialog.


  M +8 -12     amor.cpp   1.35
  M +1 -1      amoranim.cpp   1.13
  M +13 -2     amordialog.cpp   1.15
  M +1 -0      amordialog.h   1.9
  M +7 -2      amorwidget.cpp   1.7


--- kdetoys/amor/amor.cpp  #1.34:1.35
@@ -266,27 +266,23 @@ void Amor::showMessage( QString message 
 void Amor::reset()
 {
-    mTimer->stop();
+    hideBubble();
+
+    mAmor->setPixmap(0L);       // get rid of your old copy of the pixmap
 
     AmorPixmapManager::manager()->reset();
     mTips.reset();
-    delete mAmor;
 
-    mTipsQueue.clear();
+//    mTipsQueue.clear();       Why had I chosen to clean the tips queue? insane!
 
     readConfig();
 
-    mTargetWin  = 0;
-    mNextTarget = 0;
     mCurrAnim   = mBaseAnim;
     mPosition   = mCurrAnim->hotspot().x();
     mState      = Normal;
 
-    mAmor = new AmorWidget();
-    mForceHideAmorWidget = false;
-    connect(mAmor, SIGNAL(mouseClicked(const QPoint &)),
-                    SLOT(slotMouseClicked(const QPoint &)));
-    connect(mAmor, SIGNAL(dragged(const QPoint &, bool)),
-                    SLOT(slotWidgetDragged(const QPoint &, bool)));
     mAmor->resize(mTheme.maximumSize());
+    mCurrAnim->reset();
+
+    mTimer->start(0, true);
 }
 

--- kdetoys/amor/amoranim.cpp  #1.12:1.13
@@ -97,5 +97,5 @@ void AmorAnim::readConfig(KConfigBase &c
     entries = config.readListEntry("Movement",list);
     mMovement.resize(frames);
-    for (int i = 0; i < entries; i++)
+    for (int i = 0; i < entries && i < frames; i++)
     {
         mMovement[i] = atoi(list.at(i));

--- kdetoys/amor/amordialog.cpp  #1.14:1.15
@@ -44,5 +44,5 @@
 //
 AmorDialog::AmorDialog()
-    : KDialogBase(0, "amordlg", false, i18n("Options"), Ok|Cancel, Ok )
+    : KDialogBase(0, "amordlg", false, i18n("Options"), Ok|Apply|Cancel, Ok )
 {
     mConfig.read();
@@ -85,5 +85,5 @@ AmorDialog::AmorDialog()
     checkBox = new QCheckBox(i18n("Show random tips"), mainwidget);
     connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotRandomTips(bool)));
-    checkBox->setChecked(mConfig.mTips);
+    checkBox->setChecked(mConfig.mTips); // always keep this one after the connect, \
or the QList would not be grayed when it should  
     checkBox = new QCheckBox(i18n("Use a random character"), mainwidget);
@@ -206,4 +206,5 @@ void AmorDialog::slotRandomTips(bool tip
 void AmorDialog::slotRandomTheme(bool randomTheme)
 {
+    mThemeListBox->setEnabled(!randomTheme);
     mConfig.mRandomTheme = randomTheme;
 }
@@ -231,4 +232,14 @@ void AmorDialog::slotOk()
 //---------------------------------------------------------------------------
 //
+// User clicked Ok
+//
+void AmorDialog::slotApply()
+{
+    mConfig.write();
+    emit changed();
+}
+
+//---------------------------------------------------------------------------
+//
 // User clicked Cancel
 //

--- kdetoys/amor/amordialog.h  #1.8:1.9
@@ -68,4 +68,5 @@ protected slots:
     void slotOffset(int);
     void slotOk();
+    void slotApply();
     void slotCancel();
 

--- kdetoys/amor/amorwidget.cpp  #1.6:1.7
@@ -57,7 +57,8 @@ AmorWidget::~AmorWidget()
 void AmorWidget::setPixmap(const QPixmap *pixmap)
 {
-    if (pixmap)
-    {
         mPixmap = pixmap;
+
+    if (mPixmap)
+    {
         if (mPixmap->mask())
         {
@@ -66,4 +67,6 @@ void AmorWidget::setPixmap(const QPixmap
             repaint(false);
         }
+    
+        update();
     }
 }
@@ -77,4 +80,6 @@ void AmorWidget::paintEvent(QPaintEvent 
     if (mPixmap)
         bitBlt( this, 0, 0, mPixmap );
+    else
+        erase();
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic