OSDN Git Service

add popup font pref.
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Mon, 27 Sep 2004 15:20:16 +0000 (15:20 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Mon, 27 Sep 2004 15:20:16 +0000 (15:20 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@1402 56b19765-1e22-0410-a548-a0f45d66c51a

kita/src/libkita/kitaconfig.cpp
kita/src/libkita/kitaconfig.h
kita/src/prefs/faceprefbase.ui
kita/src/prefs/prefs.cpp
kita/src/prefs/prefs.h

index fbea298..1b6e0d3 100644 (file)
@@ -29,6 +29,7 @@ KitaConfig::KitaConfig()
         m_popupBackgroundColor( KitaConfig::defaultPopupBackgroundColor() ),
         m_listFont( KitaConfig::defaultListFont() ),
         m_threadFont( KitaConfig::defaultThreadFont() ),
+        m_popupFont( KitaConfig::defaultPopupFont() ),
         // m_boardListURL
         // m_nameCompletion
         m_useStyleSheet( KitaConfig::defaultUseStyleSheet() ),
index e38a4c3..7f355a6 100644 (file)
@@ -36,6 +36,7 @@ private:
     QColor m_popupBackgroundColor;
     QFont m_listFont;
     QFont m_threadFont;
+    QFont m_popupFont;
     QString m_boardListURL;
     KCompletion m_nameCompletion;
     bool m_useStyleSheet;
@@ -78,6 +79,10 @@ public:
     static void setThreadFont( QFont font ) { getInstance() ->m_threadFont = font; }
     static QFont defaultThreadFont() { return QFont(); }
 
+    static QFont& popupFont() { return getInstance() ->m_popupFont; }
+    static void setPopupFont( QFont font ) { getInstance() ->m_popupFont = font; }
+    static QFont defaultPopupFont() { return QFont(); }
+
     static void setBoardListURL( QString url ) { getInstance() ->m_boardListURL = url; }
     static QString& boardListURL() { return getInstance() ->m_boardListURL; }
     static KCompletion* nameCompletion() { return & ( getInstance() ->m_nameCompletion ); }
index fa39312..146e8a5 100644 (file)
@@ -9,7 +9,7 @@
             <x>0</x>
             <y>0</y>
             <width>600</width>
-            <height>506</height>
+            <height>508</height>
         </rect>
     </property>
     <property name="caption">
                                 <property name="name">
                                     <cstring>popupFontButton</cstring>
                                 </property>
-                                <property name="enabled">
-                                    <bool>false</bool>
-                                </property>
                                 <property name="text">
                                     <string>set font</string>
                                 </property>
                                 <property name="name">
                                     <cstring>popupFontLabel</cstring>
                                 </property>
-                                <property name="enabled">
-                                    <bool>false</bool>
-                                </property>
                                 <property name="text">
                                     <string>font</string>
                                 </property>
index 1c956e8..386d34f 100644 (file)
@@ -268,6 +268,9 @@ FacePrefPage::FacePrefPage( QWidget* parent )
     connect( threadFontButton, SIGNAL( clicked() ),
              SLOT( slotThreadFontButtonClicked() ) );
 
+    connect( popupFontButton, SIGNAL( clicked() ),
+             SLOT( slotPopupFontButtonClicked() ) );
+
     Kita::SignalCollection* signalCollection = Kita::SignalCollection::getInstance();
     connect( this, SIGNAL( setFontOfHTMLPart() ),
              signalCollection, SIGNAL( setFontOfHTMLPart() ) );
@@ -315,6 +318,9 @@ void FacePrefPage::apply()
     }
     m_threadFontchanged = FALSE;
 
+    QFont popupFont = popupFontButton->font();
+    KitaConfig::setPopupFont( popupFont );
+
     // color
     if ( m_threadColorChanged ) {
         KitaConfig::setThreadColor( threadColorButton->color() );
@@ -348,6 +354,10 @@ void FacePrefPage::reset()
     threadFontButton->setFont( font );
     m_threadFontchanged = TRUE;
 
+    font = KitaConfig::defaultPopupFont();
+    popupFontButton->setText( font.family() + " " + QString::number( font.pointSize() ) );
+    popupFontButton->setFont( font );
+
     // color
     threadColorButton->setColor( KitaConfig::defaultThreadColor() );
     threadBackgroundColorButton->setColor( KitaConfig::defaultThreadBackgroundColor() );
@@ -369,6 +379,10 @@ void FacePrefPage::updateButtons()
     QFont threadFont = KitaConfig::threadFont();
     threadFontButton->setText( threadFont.family() + " " + QString::number( threadFont.pointSize() ) );
     threadFontButton->setFont( threadFont );
+
+    QFont popupFont = KitaConfig::popupFont();
+    popupFontButton->setText( popupFont.family() + " " + QString::number( popupFont.pointSize() ) );
+    popupFontButton->setFont( popupFont );
 }
 
 void FacePrefPage::slotThreadFontButtonClicked()
@@ -394,6 +408,17 @@ void FacePrefPage::slotFontButtonClicked()
     }
 }
 
+void FacePrefPage::slotPopupFontButtonClicked()
+{
+    QFont font = popupFontButton->font();
+
+    if ( KFontDialog::getFont( font, false, this ) == QDialog::Accepted ) {
+        popupFontButton->setText( font.family() + " " + QString::number( font.pointSize() ) );
+        popupFontButton->setFont( font );
+        emit changed();
+    }
+}
+
 void FacePrefPage::slotColorChanged()
 {
     m_threadColorChanged = TRUE;
index dbe2f62..8349d94 100644 (file)
@@ -117,6 +117,7 @@ namespace Kita
 
     public slots:
         void slotFontButtonClicked();
+        void slotPopupFontButtonClicked();
         void slotThreadFontButtonClicked();
         void slotColorChanged();