-rw-r--r-- | noncore/apps/odict/.cvsignore | 5 | ||||
-rw-r--r-- | noncore/apps/odict/configdlg.cpp | 70 | ||||
-rw-r--r-- | noncore/apps/odict/configdlg.h | 20 | ||||
-rw-r--r-- | noncore/apps/odict/odict.cpp | 44 | ||||
-rw-r--r-- | noncore/apps/odict/odict.h | 1 | ||||
-rw-r--r-- | noncore/apps/odict/odict.pro | 4 | ||||
-rw-r--r-- | noncore/apps/odict/searchmethoddlg.cpp | 36 | ||||
-rw-r--r-- | noncore/apps/odict/searchmethoddlg.h | 29 |
8 files changed, 182 insertions, 27 deletions
diff --git a/noncore/apps/odict/.cvsignore b/noncore/apps/odict/.cvsignore new file mode 100644 index 0000000..12d2df2 --- a/dev/null +++ b/noncore/apps/odict/.cvsignore @@ -0,0 +1,5 @@ +*~ +Makefile* +*.moc +config.in +moc_* diff --git a/noncore/apps/odict/configdlg.cpp b/noncore/apps/odict/configdlg.cpp index 2680d7a..75dc735 100644 --- a/noncore/apps/odict/configdlg.cpp +++ b/noncore/apps/odict/configdlg.cpp @@ -1,26 +1,92 @@ /*************************************************************************** application: : ODict begin : December 2002 copyright : ( C ) 2002, 2003 by Carsten Niehaus email : cniehaus@handhelds.org **************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * ( at your option ) any later version. * * * **************************************************************************/ #include "configdlg.h" +#include "searchmethoddlg.h" #include <qdialog.h> #include <qpe/config.h> +#include <qlayout.h> -ConfigDlg::ConfigDlg(QWidget *parent, const char *name) : QDialog(parent, name) +#include <qhbox.h> +#include <qvbox.h> +#include <qlabel.h> +#include <qlistview.h> +#include <qpushbutton.h> + +#include <opie/otabwidget.h> + +ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) { - this->show(); setCaption( tr( "Options" ) ); + QVBoxLayout *vbox_layout = new QVBoxLayout( this ); + tab = new OTabWidget( this, "OTabWidget_tab", OTabWidget::Global, OTabWidget::Bottom ); + vbox_layout->addWidget( tab ); + + /*general settings*/ + settings_tab = new QWidget( tab , "settings_tab" ); + + /*searchmethods*/ + search_tab = new QWidget( tab , "search_tab" ); + QVBoxLayout *vbox_layout_searchtab = new QVBoxLayout( search_tab, 4 , 4 ,"blah" ); + + QHBox *hbox = new QHBox( search_tab ); + list = new QListView( hbox ); + list->addColumn( tr( "Searchmethod" ) ); + QListViewItem *item = new QListViewItem( list ); + item->setText( 0, "foofooofoofoof" ); + + QVBox *vbox = new QVBox( hbox ); + new_button = new QPushButton( "New" , vbox ); + change_button = new QPushButton( "Change" , vbox ); + delete_button = new QPushButton( "Delete" , vbox ); + connect( new_button, SIGNAL( clicked() ), this, SLOT( slotNewMethod() ) ); + connect( change_button, SIGNAL( clicked() ), this, SLOT( slotChangeMethod() )); + connect( delete_button, SIGNAL( clicked() ), this, SLOT( slotDeleteMethod() )); + + vbox_layout_searchtab->addWidget( hbox ); + + /*add the tabs and maximize*/ + tab->addTab( settings_tab, "pass", tr( "General Settings" ) ); + tab->addTab( search_tab, "zoom", tr( "Searchmethods" ) ); + showMaximized(); +} + +void ConfigDlg::writeEntries() +{ + qDebug( "richtig beendet" ); +} + +void ConfigDlg::slotNewMethod() +{ + SearchMethodDlg dlg( this, "SearchMethodDlg", true ); + if ( dlg.exec() == QDialog::Accepted ) + { + //dlg.saveItem(); + QListViewItem *item = new QListViewItem( list ); + item->setText( 0 , dlg.itemName ); + } + else qDebug( "SearchMethodDlg abgebrochen" ); +} + +void ConfigDlg::slotChangeMethod(){} + +void ConfigDlg::slotDeleteMethod() +{ + if ( list->selectedItem() ) + list->takeItem( list->selectedItem() ); + else qDebug("no item selected"); } diff --git a/noncore/apps/odict/configdlg.h b/noncore/apps/odict/configdlg.h index 47f66bd..e59b875 100644 --- a/noncore/apps/odict/configdlg.h +++ b/noncore/apps/odict/configdlg.h @@ -1,19 +1,37 @@ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * ( at your option ) any later version. * * * **************************************************************************/ +class QWidget; +class OTabWidget; +class QListView; +class QPushButton; + #include <qdialog.h> class ConfigDlg : public QDialog { Q_OBJECT public: - ConfigDlg(QWidget *parent, const char *name); + ConfigDlg(QWidget *parent, const char *name, bool modal=FALSE ); + + void writeEntries(); + + private: + OTabWidget *tab; + QWidget *settings_tab, *search_tab; + QListView *list; + QPushButton *new_button, *change_button, *delete_button; + + private slots: + void slotNewMethod(); + void slotChangeMethod(); + void slotDeleteMethod(); }; diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 857daaa..7f369d4 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp @@ -37,81 +37,81 @@ ODict::ODict() : QMainWindow() { setCaption( tr( "OPIE-Dictionary" ) ); setupMenus(); QHBox *hbox = new QHBox( this ); QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); query_le = new QLineEdit( hbox ); ok_button = new QPushButton( tr( "&Ok" ), hbox ); connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); setCentralWidget( hbox ); } void ODict::slotDisplayAbout() { QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 0.1" ) ); } void ODict::slotStartQuery() { QString querystring = query_le->text(); } + +void ODict::slotSetErrorcount( int count ) +{ + count = 1; +} + +void ODict::slotSettings() +{ + ConfigDlg dlg( this, "Config" , true); + if ( dlg.exec() == QDialog::Accepted ) + dlg.writeEntries(); + else qDebug( "abgebrochen" ); +} + +void ODict::slotSetParameter( int /*count*/ ) +{ +//X if ( int == 0 ) +//X if ( int == 1 ) +//X if ( int == 2 ) +//X else qWarning( "ERROR" ); +} + void ODict::setupMenus() { menu = new QMenuBar( this ); settings = new QPopupMenu( menu ); setting_a = new QAction(tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); setting_a->addTo( settings ); setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); - connect( setting_b, SIGNAL( activated() ), this, SLOT( slotSearchMethods() ) ); - setting_b->addTo( settings ); parameter = new QPopupMenu( menu ); connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); parameter->insertItem( tr( "C&ase sensitive" ), 0 ); parameter->insertItem( tr( "Only &complete Words" ), 1 ) ; parameter->insertItem( tr( "Allow ®. expressions" ), 2 ); parameter->insertSeparator(); error_tol_menu = new QPopupMenu( menu ); error_tol_menu->setCheckable( TRUE ); connect( error_tol_menu, SIGNAL( activated( int ) ), this, SLOT( slotSetErrorcount( int ) ) ); error_tol_menu->insertItem( tr( "0 Errors" ), 0 ); error_tol_menu->insertItem( tr( "1 Errors" ), 1 ); error_tol_menu->insertItem( tr( "2 Errors" ), 2 ); error_tol_menu->insertItem( tr( "3 Errors" ), 3 ); error_tol_menu->insertItem( tr( "4 Errors" ), 4 ); error_tol_menu->insertItem( tr( "Until Hit" ), 5 ); parameter->insertItem( tr( "&Error tolerance" ), error_tol_menu ); help = new QPopupMenu( menu ); help->insertItem("&About",this,SLOT( slotDisplayAbout() )); menu->insertItem( tr( "Settings" ) , settings ); menu->insertItem( tr( "Parameter" ) , parameter ); menu->insertItem( tr( "Help" ) , help ); } - -void ODict::slotSetErrorcount( int count ) -{ -} - -void ODict::slotSettings() -{ - ConfigDlg *dlg = new ConfigDlg( this, "Config" ); -} - -void ODict::slotSetParameter( int count ) -{ -//X if ( int == 0 ) -//X if ( int == 1 ) -//X if ( int == 2 ) -//X else qWarning( "ERROR" ); -} - -void ODict::slotSearchMethods(){} - diff --git a/noncore/apps/odict/odict.h b/noncore/apps/odict/odict.h index 98db25e..30307c1 100644 --- a/noncore/apps/odict/odict.h +++ b/noncore/apps/odict/odict.h @@ -20,26 +20,25 @@ class QActionGroup; class ODict : public QMainWindow { Q_OBJECT public: ODict(); private: QPopupMenu *help, *settings, *parameter, *error_tol_menu; QMenuBar *menu; QHBox *hbox; QLineEdit *query_le; QPushButton *ok_button; QAction *setting_a, *setting_b; void setupMenus(); private slots: void slotDisplayAbout(); void slotStartQuery(); void slotSetErrorcount( int ); void slotSettings(); void slotSetParameter( int ); - void slotSearchMethods(); }; diff --git a/noncore/apps/odict/odict.pro b/noncore/apps/odict/odict.pro index 7f5f30c..6257e5f 100644 --- a/noncore/apps/odict/odict.pro +++ b/noncore/apps/odict/odict.pro @@ -1,31 +1,33 @@ TEMPLATE = app CONFIG = qt warn_on release HEADERS = odict.h \ + searchmethoddlg.h \ configdlg.h SOURCES = main.cpp \ odict.cpp \ + searchmethoddlg.cpp \ configdlg.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lstdc++ +LIBS += -lqpe -lstdc++ -lopie TARGET = odict DESTDIR = $(OPIEDIR)/bin TRANSLATIONS = ../../../i18n/de/odict.ts \ ../../../i18n/xx/odict.ts \ ../../../i18n/en/odict.ts \ ../../../i18n/es/odict.ts \ ../../../i18n/fr/odict.ts \ ../../../i18n/hu/odict.ts \ ../../../i18n/ja/odict.ts \ ../../../i18n/ko/odict.ts \ ../../../i18n/no/odict.ts \ ../../../i18n/pl/odict.ts \ ../../../i18n/pt/odict.ts \ ../../../i18n/pt_BR/odict.ts \ ../../../i18n/sl/odict.ts \ ../../../i18n/zh_CN/odict.ts \ ../../../i18n/zh_TW/odict.ts \ ../../../i18n/it/odict.ts \ ../../../i18n/da/odict.ts diff --git a/noncore/apps/odict/searchmethoddlg.cpp b/noncore/apps/odict/searchmethoddlg.cpp new file mode 100644 index 0000000..cd8a58a --- a/dev/null +++ b/noncore/apps/odict/searchmethoddlg.cpp @@ -0,0 +1,36 @@ +/*************************************************************************** + application: : ODict + + begin : December 2002 + copyright : ( C ) 2002, 2003 by Carsten Niehaus + email : cniehaus@handhelds.org + **************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * ( at your option ) any later version. * + * * + **************************************************************************/ +#include "searchmethoddlg.h" + +#include <qdialog.h> +#include <qpe/config.h> +#include <qlayout.h> + +#include <qhbox.h> +#include <qvbox.h> +#include <qlabel.h> +#include <qpushbutton.h> +#include <qstring.h> + +SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) +{ + setCaption( tr( "New Searchmethod" ) ); + + itemName = "foo"; + showMaximized(); +} + diff --git a/noncore/apps/odict/searchmethoddlg.h b/noncore/apps/odict/searchmethoddlg.h new file mode 100644 index 0000000..e277cfb --- a/dev/null +++ b/noncore/apps/odict/searchmethoddlg.h @@ -0,0 +1,29 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * ( at your option ) any later version. * + * * + **************************************************************************/ + +class QWidget; +class OTabWidget; +class QListView; +class QPushButton; +class QLabel; +class QString; + +#include <qdialog.h> + + +class SearchMethodDlg : public QDialog +{ + Q_OBJECT + + public: + SearchMethodDlg(QWidget *parent, const char *name, bool modal=FALSE ); + + QString itemName; + +}; |