[uim-commit] r188 - trunk/qt/uim-kdehelper/src/pref
kzk@freedesktop.org
kzk@freedesktop.org
Sun Jan 9 06:39:12 PST 2005
Author: kzk
Date: 2005-01-09 06:39:10 -0800 (Sun, 09 Jan 2005)
New Revision: 188
Removed:
trunk/qt/uim-kdehelper/src/pref/uimconfig/
trunk/qt/uim-kdehelper/src/pref/uimqtconfig/
Modified:
trunk/qt/uim-kdehelper/src/pref/Makefile.am
trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp
trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h
Log:
* initial commit of uim-pref-qt which doesn't depend on KDE products.
* uim-kdehelper/src/pref/uimconfig
* uim-kdehelper/src/pref/uimqtconfig
- deleted because of KDE dependency
* pref/uim-pref-qt.h
* pref/uim-pref-qt.cpp
* Makefile.am
- initial commit
* but this version causes SEGV by just calling uim_custom_primary_groups()
please check, Yamaken.
My Environment:
uim trunk r187
./configure --enable-debug
backtrace:
#0 0x41aeb47e in _IO_str_overflow () from /lib/libc.so.6
#1 0x41aea488 in _IO_default_xsputn () from /lib/libc.so.6
#2 0x41ac4efc in vfprintf () from /lib/libc.so.6
#3 0x41adffeb in vsprintf () from /lib/libc.so.6
#4 0x41acd94d in sprintf () from /lib/libc.so.6
#5 0x4002215d in my_err (message=0x4003786c "wta(non-symbol) to setvar", x=0x0) at slib.c:381
#6 0x40021f49 in setvar (var=0x0, val=0x0, env=0x0) at slib.c:326
#7 0x40022236 in my_err (message=0x4003786c "wta(non-symbol) to setvar", x=0x0) at slib.c:399
#8 0x40021f49 in setvar (var=0x0, val=0x0, env=0x0) at slib.c:326
#9 0x40022236 in my_err (message=0x4003786c "wta(non-symbol) to setvar", x=0x0) at slib.c:399
#10 0x40021f49 in setvar (var=0x0, val=0x0, env=0x0) at slib.c:326
#11 0x40022236 in my_err (message=0x4003786c "wta(non-symbol) to setvar", x=0x0) at slib.c:399
#12 0x40021f49 in setvar (var=0x0, val=0x0, env=0x0) at slib.c:326
#13 0x40022236 in my_err (message=0x4003786c "wta(non-symbol) to setvar", x=0x0) at slib.c:399
#14 0x40021f49 in setvar (var=0x0, val=0x0, env=0x0) at slib.c:326
#15 0x40022236 in my_err (message=0x4003786c "wta(non-symbol) to setvar", x=0x0) at slib.c:399
#16 0x40021f49 in setvar (var=0x0, val=0x0, env=0x0) at slib.c:326
#17 0x40022236 in my_err (message=0x4003786c "wta(non-symbol) to setvar", x=0x0) at slib.c:399
#18 0x40021f49 in setvar (var=0x0, val=0x0, env=0x0) at slib.c:326
#19 0x40022236 in my_err (message=0x4003786c "wta(non-symbol) to setvar", x=0x0) at slib.c:399
#20 0x40021f49 in setvar (var=0x0, val=0x0, env=0x0) at slib.c:326
Modified: trunk/qt/uim-kdehelper/src/pref/Makefile.am
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/Makefile.am 2005-01-09 11:13:22 UTC (rev 187)
+++ trunk/qt/uim-kdehelper/src/pref/Makefile.am 2005-01-09 14:39:10 UTC (rev 188)
@@ -1,5 +1,3 @@
-SUBDIRS = uimconfig uimqtconfig
-
INCLUDES = $(all_includes)
METASOURCES = AUTO
@@ -7,6 +5,6 @@
bin_PROGRAMS = uim-pref-qt
uim_pref_qt_SOURCES = uim-pref-qt.cpp
-uim_pref_qt_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+uim_pref_qt_LDFLAGS = $(all_libraries) $(KDE_RPATH) -luim
uim_pref_qt_LDADD = $(LIB_QT) $(LIB_KUTILS)
Modified: trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp 2005-01-09 11:13:22 UTC (rev 187)
+++ trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.cpp 2005-01-09 14:39:10 UTC (rev 188)
@@ -1,58 +1,128 @@
#include "uim-pref-qt.h"
-#include <kuniqueapplication.h>
-#include <klocale.h>
-#include <kcmdlineargs.h>
-#include <kaboutdata.h>
-#include <kcmoduleinfo.h>
+#include <qvbox.h>
+#include <qhbox.h>
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qcheckbox.h>
+#include <qtoolbutton.h>
+#include <qpushbutton.h>
+#include <qapplication.h>
+#include <qsplitter.h>
+#include <qlistview.h>
+#include <qvbox.h>
UimPrefDialog::UimPrefDialog( QWidget *parent, const char *name )
-// : KCMultiDialog(KDialogBase::TreeList, i18n("Uim Preference Dialog"), parent)
- : KCMultiDialog( parent, name )
+ : QDialog( parent, name )
{
- /*
- KCModuleInfo moduleinfo("uimconfig");
- addModule(moduleinfo, "uim-pref-qt");
+ char **g = uim_custom_primary_groups();
+// setupWidgets();
+}
- KCModuleInfo moduleinfo("uimqtconfig");
- addModule(moduleinfo, "uim-pref-qt");
- */
+UimPrefDialog::~UimPrefDialog()
+{
- addModule( "uimconfig" );
- addModule( "uimqtconfig" );
}
-UimPrefDialog::~UimPrefDialog()
+void UimPrefDialog::setupWidgets()
{
- removeAllModules();
+ createMainWidgets();
+ createGroupWidgets();
}
+void UimPrefDialog::createMainWidgets()
+{
+ QVBoxLayout *mainVLayout = new QVBoxLayout( this );
+
+ QSplitter *mainSplitter = new QSplitter( this );
+
+ m_groupListView = new QListView( mainSplitter );
+ m_groupListView->addColumn( "Group" );
+
+ QWidget *leftSideWidget = new QWidget( mainSplitter );
+ QVBoxLayout *leftVLayout = new QVBoxLayout( leftSideWidget );
+ QWidget *buttonHWidget = new QWidget( leftSideWidget );
+ m_groupWidgetStack = new QWidgetStack( leftSideWidget );
+ QHBoxLayout *buttonHLayout = new QHBoxLayout( buttonHWidget );
+ buttonHLayout->insertStretch( 0 );
+ buttonHLayout->setMargin( 10 );
+ buttonHLayout->setSpacing( 6 );
+ buttonHLayout->addWidget( new QPushButton("Apply", buttonHWidget) );
+ buttonHLayout->addWidget( new QPushButton("OK", buttonHWidget) );
+ buttonHLayout->addWidget( new QPushButton("Cancel", buttonHWidget ) );
+ leftVLayout->setMargin( 10 );
+ leftVLayout->setSpacing( 6 );
+ leftVLayout->addWidget( m_groupWidgetStack );
+ leftVLayout->insertStretch( 1 );
+ leftVLayout->addWidget( buttonHWidget );
+
+ mainVLayout->addWidget( mainSplitter );
+}
+
+void UimPrefDialog::createGroupWidgets()
+{
+ char **primary_groups = uim_custom_primary_groups();
+ char **grp = NULL;
+ for( grp = primary_groups; *grp; grp++ )
+ {
+ ;
+
+ /*
+ struct uim_custom_group *group = uim_custom_group_get( *grp );
+ m_groupWidgetStack->addWidget( createGroupWidget( *grp ) );
+ uim_custom_group_free( group );
+ */
+ }
+}
+
+QWidget* UimPrefDialog::createGroupWidget( const char *group_name )
+{
+ QVBox *vbox = new QVBox( m_groupWidgetStack );
+ new QPushButton( "FEFEFE", vbox );
+ return vbox;
+
+ struct uim_custom_group *group;
+ char **custom_syms, ** custom_sym;
+
+ group = uim_custom_group_get( group_name );
+ if( group == NULL )
+ return NULL;
+
+ custom_syms = uim_custom_collect_by_group( group_name );
+ if( custom_syms )
+ {
+ for( custom_sym = custom_syms; *custom_sym; custom_sym++ )
+ {
+// addCustom( *custom_sym );
+ ;
+ }
+
+ uim_custom_symbol_list_free( custom_syms );
+ }
+
+ uim_custom_group_free( group );
+}
+
+void UimPrefDialog::accept()
+{
+ done( QDialog::Accepted );
+}
+void UimPrefDialog::reject()
+{
+ done( QDialog::Rejected );
+}
+
int main( int argc, char **argv )
{
- KAboutData aboutData( "uim-pref-qt",
- I18N_NOOP( "uim-pref-qt" ),
- "0.1.0",
- "the dialog to customize Uim" );
- KCmdLineArgs::init( argc, argv, &aboutData );
- KUniqueApplication::addCmdLineOptions();
+ QApplication a( argc, argv );
- KUniqueApplication a;
-
UimPrefDialog *dlg = new UimPrefDialog();
a.setMainWidget( dlg );
- KGlobal::setActiveInstance( &a );
dlg->show();
return a.exec();
}
-
-void UimPrefDialog::slotApply()
+void UimPrefDialog::addCustom( QVBox *vbox, const char *custom_sym )
{
- KCMultiDialog::slotApply();
+ ;
}
-
-void UimPrefDialog::slotOk()
-{
- slotApply();
- KCMultiDialog::slotOk();
-}
Modified: trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h 2005-01-09 11:13:22 UTC (rev 187)
+++ trunk/qt/uim-kdehelper/src/pref/uim-pref-qt.h 2005-01-09 14:39:10 UTC (rev 188)
@@ -1,9 +1,16 @@
#ifndef _UIM_PREF_QT_H_
#define _UIM_PREF_QT_H_
-#include <kcmultidialog.h>
+#include <qdialog.h>
+#include <qmap.h>
+#include <qlistview.h>
+#include <qwidgetstack.h>
+#include <qvbox.h>
-class UimPrefDialog : public KCMultiDialog
+#include <uim/uim.h>
+#include <uim/uim-custom.h>
+
+class UimPrefDialog : public QDialog
{
Q_OBJECT
@@ -11,9 +18,23 @@
UimPrefDialog( QWidget *parent = 0, const char *name = 0 );
~UimPrefDialog();
-public slots:
- void slotApply();
- void slotOk();
+protected:
+ void setupWidgets();
+ void createMainWidgets();
+ void createGroupWidgets();
+ QWidget* createGroupWidget( const char *grpname );
+ void addCustom( QVBox *vbox, const char *custom_sym );
+
+protected slots:
+ void accept();
+ void reject();
+
+private:
+ QMap<QString, QWidget*> pageWidgets;
+ QString m_currentPageName;
+
+ QListView *m_groupListView;
+ QWidgetStack *m_groupWidgetStack;
};
#endif /* Not def: _UIM_PREF_QT_H_ */
More information about the Uim-commit
mailing list