[uim-commit] r503 - trunk/qt

kzk at freedesktop.org kzk at freedesktop.org
Thu Feb 3 06:05:11 PST 2005


Author: kzk
Date: 2005-02-03 06:05:07 -0800 (Thu, 03 Feb 2005)
New Revision: 503

Modified:
   trunk/qt/pref-customwidgets.cpp
   trunk/qt/pref-qt.cpp
   trunk/qt/qtgettext.h
Log:
* qt/pref-qt.cpp
  - disable subgrouping feature because it makes pref unstable
    and cause crash in uncertain reason.
* qt/pref-customwidgets.cpp
  - (update): set the contents before calling
    setEnabled( custom->is_active ) to show the contents when
    it is inactive at startup time.
* qt/qtgettext.h
  - (N_): convert from UTF-8


Modified: trunk/qt/pref-customwidgets.cpp
===================================================================
--- trunk/qt/pref-customwidgets.cpp	2005-02-03 08:23:29 UTC (rev 502)
+++ trunk/qt/pref-customwidgets.cpp	2005-02-03 14:05:07 UTC (rev 503)
@@ -54,13 +54,10 @@
     if( !m_custom || m_custom->type != UCustom_Bool )
         return;
     
-    setEnabled( m_custom->is_active );
+    setText( _FU8(m_custom->label) );
+    setChecked( m_custom->value->as_bool );
 
-    if( m_custom->is_active )
-    {
-        setText( _FU8(m_custom->label) );
-        setChecked( m_custom->value->as_bool );
-    }
+    setEnabled( m_custom->is_active );
 }
 
 void CustomCheckBox::setDefault()
@@ -94,14 +91,11 @@
     if( !m_custom || m_custom->type != UCustom_Int )
         return;
 
-    setEnabled( m_custom->is_active );
+    setValue( m_custom->value->as_int );
+    setMinValue( m_custom->range->as_int.min );
+    setMaxValue( m_custom->range->as_int.max );
 
-    if( m_custom->is_active )
-    {
-        setValue( m_custom->value->as_int );
-        setMinValue( m_custom->range->as_int.min );
-        setMaxValue( m_custom->range->as_int.max );
-    }
+    setEnabled( m_custom->is_active );
 }
 
 void CustomSpinBox::setDefault()
@@ -135,13 +129,10 @@
 {
     if( !m_custom || m_custom->type != UCustom_Str )
         return;
-    
-    setEnabled( m_custom->is_active );
+   
+    setText( _FU8(m_custom->value->as_str) );
 
-    if( m_custom->is_active )
-    {
-        setText( _FU8(m_custom->value->as_str) );
-    }
+    setEnabled( m_custom->is_active );
 }
 
 void CustomLineEdit::setDefault()
@@ -186,13 +177,10 @@
     if( !m_custom || m_custom->type != UCustom_Pathname )
         return;
     
+    m_lineEdit->setText( _FU8(m_custom->value->as_pathname) );
+
     m_lineEdit->setEnabled( m_custom->is_active );
     m_fileButton->setEnabled( m_custom->is_active );
-
-    if( m_custom->is_active )
-    {
-        m_lineEdit->setText( _FU8(m_custom->value->as_pathname) );
-    }
 }
 
 void CustomPathnameEdit::setDefault()
@@ -241,28 +229,25 @@
     if( !m_custom || m_custom->type != UCustom_Choice )
         return;
 
-    setEnabled( m_custom->is_active );
-
     clear();
-    if( m_custom->is_active )
+    char *default_symbol = m_custom->value->as_choice->symbol;
+    int default_index = -1;
+    int index = 0;
+    struct uim_custom_choice **item = m_custom->range->as_choice.valid_items;
+    while( *item )
     {
-        char *default_symbol = m_custom->value->as_choice->symbol;
-        int default_index = -1;
-        int index = 0;
-        struct uim_custom_choice **item = m_custom->range->as_choice.valid_items;
-        while( *item )
-        {
-            int count = this->count();
-            insertItem( _FU8((*item)->label), count ); // insert item at last
-
-            if( QString::compare( default_symbol, (*item)->symbol ) == 0 )
-                default_index = index;
-
-            index++;
-            item++;
-        }
-        setCurrentItem( default_index );
+        int count = this->count();
+        insertItem( _FU8((*item)->label), count ); // insert item at last
+        
+        if( QString::compare( default_symbol, (*item)->symbol ) == 0 )
+            default_index = index;
+        
+        index++;
+        item++;
     }
+    setCurrentItem( default_index );
+
+    setEnabled( m_custom->is_active );
 }
 
 void CustomChoiceCombo::setDefault()
@@ -328,13 +313,10 @@
     if( !m_custom || m_custom->type != UCustom_OrderedList )
         return;
     
+    updateText();
+
     m_lineEdit->setEnabled( m_custom->is_active );
     m_editButton->setEnabled( m_custom->is_active );
-
-    if( m_custom->is_active )
-    {
-        updateText();
-    }
 }
 
 void CustomOrderedListEdit::setDefault()
@@ -611,13 +593,10 @@
     if( !m_custom || m_custom->type != UCustom_Key )
         return;
 
+    updateText();
+
     m_lineEdit->setEnabled( m_custom->is_active );
     m_editButton->setEnabled( m_custom->is_active );
-
-    if( m_custom->is_active )
-    {
-        updateText();
-    }
 }
 
 void CustomKeyEdit::updateText()

Modified: trunk/qt/pref-qt.cpp
===================================================================
--- trunk/qt/pref-qt.cpp	2005-02-03 08:23:29 UTC (rev 502)
+++ trunk/qt/pref-qt.cpp	2005-02-03 14:05:07 UTC (rev 503)
@@ -295,9 +295,13 @@
 
     /* default QVGroupBox */
     QVGroupBox *defaultGroupVBox = new QVGroupBox( this );
+    vLayout->addWidget( defaultGroupVBox );    
 
-    /* subgroup data */
-    SubgroupData *sd = new SubgroupData( this, group_name );
+    /* 2004-02-03 Kazuki Ohta <mover at hct.zaq.ne.jp>
+     * subgrouping feature seems to unstable and cause the crash in some reason.
+     *
+     * SubgroupData *sd = new SubgroupData( this, group_name );
+     */
 
     /* add various widgets to the vbox */
     char **custom_syms = uim_custom_collect_by_group( group_name );
@@ -305,16 +309,15 @@
     {
         for( char **custom_sym = custom_syms; *custom_sym; custom_sym++ )
         {
+            /*
             QVGroupBox *vbox = sd->searchGroupVBoxByCustomSym( *custom_sym );
             if( vbox == NULL )
             {
-                /* 2004-02-02 Kazuki Ohta <mover at hct.zaq.ne.jp>
-                 *
-                 * If no QVGroup box is found, let's use DefaultVBox!
-                 */
                 vbox = defaultGroupVBox;
             }
+            */
             
+            QVGroupBox *vbox = defaultGroupVBox;
             UimCustomItemIface *iface = addCustom( vbox, *custom_sym );
             if( iface )
                 m_customIfaceList.append( iface );
@@ -328,13 +331,13 @@
      * This is very adhoc hack!!
      * if "main" subgroup's gvbox dosn't have child, hides it!
      */
-    if( defaultGroupVBox && !defaultGroupVBox->children()->isEmpty() )
+    if( defaultGroupVBox && defaultGroupVBox->children()->isEmpty() )
     {
         defaultGroupVBox->hide();
     }
 
     /* free */
-    delete sd;
+//    delete sd;
     uim_custom_group_free( group );
 
     /* bottom up */
@@ -471,21 +474,15 @@
 
 UimCustomItemIface *GroupPageWidget::addCustomTypeKey( QVGroupBox *vbox, struct uim_custom *custom )
 {
-    // Crash. Why?
-    /*
     QHBox *hbox = new QHBox( vbox );
     hbox->setSpacing( 6 );
     QLabel *label = new QLabel( _FU8(custom->label), hbox );
-    CustomKeyEdit *keyEditBox = new CustomKeyEdit( custom, vbox );
-    CustomChoiceCombo *c = new CustomChoiceCombo( custom, vbox );
+    CustomKeyEdit *keyEditBox = new CustomKeyEdit( custom, hbox );
     label->setBuddy( keyEditBox );
     QObject::connect( keyEditBox, SIGNAL(customValueChanged()),
                       this, SLOT(slotCustomValueChanged()) );
-    */
-    
-    
 
-    return NULL;
+    return keyEditBox;
 }
 
 void GroupPageWidget::setDefault()
@@ -522,16 +519,16 @@
         parentWidget->layout()->add( gvbox );
         
         char **custom_syms = uim_custom_collect_by_group( *sgrp );
-        if( custom_syms )
+        if( !custom_syms )
+            continue;
+
+        for( char **custom_sym = custom_syms; *custom_sym; custom_sym++ )
         {
-            for( char **custom_sym = custom_syms; *custom_sym; custom_sym++ )
-            {
-                gvboxMap[QString(*custom_sym)] = gvbox;
-            }
-        
-            uim_custom_symbol_list_free( custom_syms );
+            gvboxMap[QString(*custom_sym)] = gvbox;
         }
+        uim_custom_symbol_list_free( custom_syms );
 
+
         uim_custom_group_free( sgroup_custom );
     }
     uim_custom_symbol_list_free( sub_groups );

Modified: trunk/qt/qtgettext.h
===================================================================
--- trunk/qt/qtgettext.h	2005-02-03 08:23:29 UTC (rev 502)
+++ trunk/qt/qtgettext.h	2005-02-03 14:05:07 UTC (rev 503)
@@ -17,7 +17,7 @@
 #undef N_
 #endif
 #ifdef gettext_noop
-#define N_(String) gettext_noop(String)
+#define N_(String) QString::fromUtf8( gettext_noop(String) )
 #else
 #define N_(String) (String)
 #endif /* gettext_noop */



More information about the Uim-commit mailing list