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

List:       kde-commits
Subject:    kdeartwork/kscreensaver/kdesavers
From:       Chris Howells <howells () kde ! org>
Date:       2003-04-18 2:59:55
[Download RAW message or body]

CVS commit by howells: 

Fix wishlist 53307 by comitting the included patch, with slight enhancements

CCMAIL: 53307-done@bugs.kde.org


  M +36 -10    banner.cpp   1.14
  M +1 -0      banner.h   1.6


--- kdeartwork/kscreensaver/kdesavers/banner.cpp  #1.13:1.14
@@ -36,4 +36,5 @@
 #include <kcolorbutton.h>
 #include <kfontcombo.h>
+#include <kdebug.h>
 
 #include "banner.h"
@@ -98,8 +99,10 @@ KBannerSetup::KBannerSetup( QWidget *par
         gl->addWidget(label, 2, 0);
 
-        comboSizes = new QComboBox( FALSE, group );
+        comboSizes = new QComboBox( TRUE, group );
         fillFontSizes();
         gl->addWidget(comboSizes, 2, 1);
         connect( comboSizes, SIGNAL( activated( int ) ), SLOT( slotSize( int ) ) );
+        connect( comboSizes, SIGNAL( textChanged( const QString & ) ),
+                        SLOT( slotSizeEdit( const QString &  ) ) );
 
         QCheckBox *cb = new QCheckBox( i18n("Bold"),
@@ -219,5 +222,5 @@ void KBannerSetup::fillFontSizes()
     int i = 0;
     sizes = QFontDatabase().pointSizes( fontFamily );
-    sizes << 96 << 0;
+    sizes << 96 << 128 << 156 << 0;
     int current = 0;
     while ( sizes[i] )
@@ -226,10 +229,19 @@ void KBannerSetup::fillFontSizes()
         num.setNum( sizes[i] );
         comboSizes->insertItem( num, i );
-        if ( fontSize >= sizes[i] )
+        if ( fontSize == sizes[i] ) // fontsize equals one of the defined ones
+            {
                 current = i;
-        i++;
-        }
     comboSizes->setCurrentItem( current );
     slotSize( current );
+            }
+        i++;
+        }
+    if ( current == 0 ) // fontsize seems to be entered by hand
+        {
+        QString fsize;
+        fsize.setNum( fontSize );
+        comboSizes->setEditText(fsize);
+        slotSizeEdit( fsize );
+        }
     comboSizes->blockSignals( block );
 }
@@ -250,4 +262,13 @@ void KBannerSetup::slotSize( int indx )
 }
 
+void KBannerSetup::slotSizeEdit( const QString& fs )
+{
+        bool ok;
+        fontSize = fs.toInt( &ok, 10 );
+        if ( ok )
+                if ( saver )
+                        saver->setFont( fontFamily, fontSize, fontColor, bold, italic );
+}
+
 void KBannerSetup::slotColor( const QColor &col )
 {
@@ -322,5 +343,10 @@ void KBannerSetup::slotOkPressed()
         config->writeEntry( "FontFamily", fontFamily );
 
+        kdDebug() << "fontSize " << fontSize << endl;
         QString fsize;
+        if (fontSize == 0) // an non-number was entered in the font size combo
+        {
+                fontSize = 48;
+        }
         fsize.setNum( fontSize );
         config->writeEntry( "FontSize", fsize );

--- kdeartwork/kscreensaver/kdesavers/banner.h  #1.5:1.6
@@ -79,4 +79,5 @@ private slots:
     void slotFamily( const QString & );
     void slotSize( int );
+    void slotSizeEdit(const QString &);
     void slotColor(const QColor &);
     void slotCyclingColor(bool on);


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

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