[uim-commit] r278 - trunk/qt/uim-kdehelper/src/pref
kzk@freedesktop.org
kzk@freedesktop.org
Thu Jan 13 16:16:30 PST 2005
Author: kzk
Date: 2005-01-13 16:16:27 -0800 (Thu, 13 Jan 2005)
New Revision: 278
Modified:
trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp
trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h
Log:
* handle encoding of uim-pref-qt
* qt/uim-kdehelper/src/pref/uim-pref-qt.h
- (addCustomTypeOrderedList): new function
* qt/uim-kdehelper/src/pref/uim-pref-qt.cpp
- (main): call bind_textdomain_codeset for ensuring
the encoding of custom variable is UTF-8. But now
PACKAGE is hardcoded as "uim", so once this is
merged into uim, need to include "uim/config.h"
and "uim/gettext.h"
- (addCustomTypeOrderedList): new function
- (_FU8): new macro
- replace qFatal with qWarning
- update Comment
Modified: trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp 2005-01-13 23:45:14 UTC (rev 277)
+++ trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp 2005-01-14 00:16:27 UTC (rev 278)
@@ -51,7 +51,18 @@
#include <qfiledialog.h>
#include <qcombobox.h>
+/*
+ * FIXME! : 2004-01-14 Kazuki Ohta <mover@hct.zaq.ne.jp>
+ * After uim-kdehelper is merged to uim, please include these files
+ * instead of including <libintl.h>
+ *
+ * #include "uim/config.h"
+ * #include "uim/gettext.h"
+ */
+#include <libintl.h>
+#define _FU8(String) QString::fromUtf8(String)
+
UimPrefDialog::UimPrefDialog( QWidget *parent, const char *name )
: QDialog( parent, name ),
m_isValueChanged( false )
@@ -67,6 +78,9 @@
uim_quit();
}
+/*
+ * Building up GUI
+ */
void UimPrefDialog::setupWidgets()
{
createMainWidgets();
@@ -168,6 +182,9 @@
return vbox;
}
+/*
+ * Building up GUI in accordance with Custom Type.
+ */
void UimPrefDialog::addCustom( QVBox *vbox, const char *custom_sym )
{
struct uim_custom *custom = uim_custom_get( custom_sym );
@@ -190,23 +207,26 @@
case UCustom_Choice:
addCustomTypeChoice( vbox, custom );
break;
+ case UCustom_OrderedList:
+ addCustomTypeOrderedList( vbox, custom );
+ break;
case UCustom_Key:
addCustomTypeKey( vbox, custom );
break;
default:
- qFatal( "Invalid custom type: %d\n", custom->type );
+ qWarning( "Invalid custom type: %d\n", custom->type );
uim_custom_free( custom );
break;
}
} else {
- qFatal( "Failed to get uim_custom object for %s.", custom_sym );
+ qWarning( "Failed to get uim_custom object for %s.", custom_sym );
}
}
void UimPrefDialog::addCustomTypeBool( QVBox *vbox, struct uim_custom *custom )
{
CustomCheckBox *checkBox = new CustomCheckBox( custom, vbox );
- checkBox->setText( custom->label );
+ checkBox->setText( _FU8(custom->label) );
checkBox->setChecked( custom->value->as_bool );
QObject::connect( checkBox, SIGNAL(customValueChanged()),
this, SLOT(slotCustomValueChanged()) );
@@ -216,7 +236,7 @@
{
QHBox *hbox = new QHBox( vbox );
hbox->setSpacing( 6 );
- QLabel *label = new QLabel( custom->label, hbox );
+ QLabel *label = new QLabel( _FU8(custom->label), hbox );
CustomSpinBox *spinBox = new CustomSpinBox( custom, hbox );
spinBox->setValue( custom->value->as_int );
spinBox->setMinValue( custom->range->as_int.min );
@@ -231,9 +251,9 @@
{
QHBox *hbox = new QHBox( vbox );
hbox->setSpacing( 6 );
- QLabel *label = new QLabel( custom->label, hbox );
+ QLabel *label = new QLabel( _FU8(custom->label), hbox );
CustomLineEdit *lineEdit = new CustomLineEdit( custom, hbox );
- lineEdit->setText( custom->value->as_str );
+ lineEdit->setText( _FU8(custom->value->as_str) );
label->setBuddy( lineEdit );
QObject::connect( lineEdit, SIGNAL(customValueChanged()),
@@ -244,9 +264,9 @@
{
QHBox *hbox = new QHBox( vbox );
hbox->setSpacing( 6 );
- QLabel *label = new QLabel( custom->label, hbox );
+ QLabel *label = new QLabel( _FU8(custom->label), hbox );
CustomPathnameEdit *pathnameEdit = new CustomPathnameEdit( custom, hbox );
- pathnameEdit->setText( custom->value->as_pathname );
+ pathnameEdit->setText( _FU8(custom->value->as_pathname) );
label->setBuddy( pathnameEdit );
QObject::connect( pathnameEdit, SIGNAL(customValueChanged()),
@@ -257,7 +277,7 @@
{
QHBox *hbox = new QHBox( vbox );
hbox->setSpacing( 6 );
- QLabel *label = new QLabel( custom->label, hbox );
+ QLabel *label = new QLabel( _FU8(custom->label), hbox );
CustomChoiceCombo *choiceCombo = new CustomChoiceCombo( custom, hbox );
char *default_symbol = NULL;
@@ -267,7 +287,7 @@
while( *item )
{
int count = choiceCombo->count();
- choiceCombo->insertItem( (*item)->label, count - 1 ); // insert item at last
+ choiceCombo->insertItem( _FU8((*item)->label), count - 1 ); // insert item at last
if( QString::compare( default_symbol, (*item)->symbol ) == 0 )
default_index = index;
@@ -283,12 +303,21 @@
this, SLOT(slotCustomValueChanged()) );
}
+void UimPrefDialog::addCustomTypeOrderedList( QVBox *vbox, struct uim_custom *custom )
+{
+ // FIXME: not implemented yet
+ ;
+}
+
void UimPrefDialog::addCustomTypeKey( QVBox *vbox, struct uim_custom *custom )
{
// FIXME: not implemented yet
;
}
+/*
+ * GUI event handling
+ */
void UimPrefDialog::slotSelectionChanged( QListViewItem * item )
{
/* confirm if save the change */
@@ -315,17 +344,6 @@
}
}
-int main( int argc, char **argv )
-{
- QApplication a( argc, argv );
-
- UimPrefDialog *dlg = new UimPrefDialog();
- a.setMainWidget( dlg );
- dlg->show();
-
- return a.exec();
-}
-
void UimPrefDialog::slotApply()
{
if( !m_isValueChanged )
@@ -354,6 +372,7 @@
reject();
}
+//-------------------------------------------------------------------------------------
QConfirmDialog::QConfirmDialog( const QString &msg, QWidget *parent, const char *name )
: QDialog( parent, name )
{
@@ -372,3 +391,23 @@
QObject::connect( cancelButton, SIGNAL(clicked()),
this, SLOT(reject()) );
}
+
+//--------------------------------------------------------------------------
+int main( int argc, char **argv )
+{
+ /*
+ * FIXME! : 2004-01-14 Kazuki Ohta <mover@hct.zaq.ne.jp>
+ * After uim-kdehelper is merged to uim, please use PACKAGE
+ * instead of "uim"
+ */
+ // ensure code encoding is UTF-8
+ bind_textdomain_codeset( "uim", "UTF-8" );
+
+ QApplication a( argc, argv );
+
+ UimPrefDialog *dlg = new UimPrefDialog();
+ a.setMainWidget( dlg );
+ dlg->show();
+
+ return a.exec();
+}
Modified: trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h 2005-01-13 23:45:14 UTC (rev 277)
+++ trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h 2005-01-14 00:16:27 UTC (rev 278)
@@ -67,6 +67,7 @@
void addCustomTypeString( QVBox *vbox, struct uim_custom *custom );
void addCustomTypePathname( QVBox *vbox, struct uim_custom *custom );
void addCustomTypeChoice( QVBox *vbox, struct uim_custom *custom );
+ void addCustomTypeOrderedList( QVBox *vbox, struct uim_custom *custom );
void addCustomTypeKey( QVBox *vbox, struct uim_custom *custom );
void confirmChange();
More information about the Uim-commit
mailing list