summaryrefslogtreecommitdiff
authorcniehaus <cniehaus>2002-12-29 16:49:48 (UTC)
committer cniehaus <cniehaus>2002-12-29 16:49:48 (UTC)
commit95e2d570a5f7dd3611858a55ac7956ab7ece6f3d (patch) (unidiff)
tree92c5abc77298eb69d506f2b7717d4f6a8d7e231f
parent5a0893171cf82ebad8347ab9dbc1193f9fcabda3 (diff)
downloadopie-95e2d570a5f7dd3611858a55ac7956ab7ece6f3d.zip
opie-95e2d570a5f7dd3611858a55ac7956ab7ece6f3d.tar.gz
opie-95e2d570a5f7dd3611858a55ac7956ab7ece6f3d.tar.bz2
more gui, started with the real code
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/odict/configdlg.cpp23
-rw-r--r--noncore/apps/odict/searchmethoddlg.cpp77
-rw-r--r--noncore/apps/odict/searchmethoddlg.h13
3 files changed, 104 insertions, 9 deletions
diff --git a/noncore/apps/odict/configdlg.cpp b/noncore/apps/odict/configdlg.cpp
index 75dc735..2056457 100644
--- a/noncore/apps/odict/configdlg.cpp
+++ b/noncore/apps/odict/configdlg.cpp
@@ -1,92 +1,105 @@
1/*************************************************************************** 1/***************************************************************************
2 application: : ODict 2 application: : ODict
3 3
4 begin : December 2002 4 begin : December 2002
5 copyright : ( C ) 2002, 2003 by Carsten Niehaus 5 copyright : ( C ) 2002, 2003 by Carsten Niehaus
6 email : cniehaus@handhelds.org 6 email : cniehaus@handhelds.org
7 **************************************************************************/ 7 **************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * ( at your option ) any later version. * 14 * ( at your option ) any later version. *
15 * * 15 * *
16 **************************************************************************/ 16 **************************************************************************/
17#include "configdlg.h" 17#include "configdlg.h"
18#include "searchmethoddlg.h" 18#include "searchmethoddlg.h"
19 19
20#include <qdialog.h> 20#include <qdialog.h>
21#include <qpe/config.h> 21#include <qpe/config.h>
22#include <qlayout.h> 22#include <qlayout.h>
23 23
24#include <qhbox.h> 24#include <qhbox.h>
25#include <qvbox.h> 25#include <qvbox.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qlistview.h> 27#include <qlistview.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qlineedit.h>
29 30
30#include <opie/otabwidget.h> 31#include <opie/otabwidget.h>
31 32
32ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) 33ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal)
33{ 34{
34 setCaption( tr( "Options" ) ); 35 setCaption( tr( "Options" ) );
35 QVBoxLayout *vbox_layout = new QVBoxLayout( this ); 36 QVBoxLayout *vbox_layout = new QVBoxLayout( this );
36 tab = new OTabWidget( this, "OTabWidget_tab", OTabWidget::Global, OTabWidget::Bottom ); 37 tab = new OTabWidget( this, "OTabWidget_tab", OTabWidget::Global, OTabWidget::Bottom );
37 vbox_layout->addWidget( tab ); 38 vbox_layout->addWidget( tab );
38 39
39 /*general settings*/ 40 /*general settings*/
40 settings_tab = new QWidget( tab , "settings_tab" ); 41 settings_tab = new QWidget( tab , "settings_tab" );
41 42
42 /*searchmethods*/ 43 /*searchmethods*/
43 search_tab = new QWidget( tab , "search_tab" ); 44 search_tab = new QWidget( tab , "search_tab" );
44 QVBoxLayout *vbox_layout_searchtab = new QVBoxLayout( search_tab, 4 , 4 ,"blah" ); 45 QVBoxLayout *vbox_layout_searchtab = new QVBoxLayout( search_tab, 4 , 4 ,"blah" );
45 46
46 QHBox *hbox = new QHBox( search_tab ); 47 QHBox *hbox = new QHBox( search_tab );
47 list = new QListView( hbox ); 48 list = new QListView( hbox );
48 list->addColumn( tr( "Searchmethod" ) ); 49 list->addColumn( tr( "Searchmethod" ) );
49 QListViewItem *item = new QListViewItem( list );
50 item->setText( 0, "foofooofoofoof" );
51 50
52 QVBox *vbox = new QVBox( hbox ); 51 QVBox *vbox = new QVBox( hbox );
53 new_button = new QPushButton( "New" , vbox ); 52 new_button = new QPushButton( "New" , vbox );
54 change_button = new QPushButton( "Change" , vbox ); 53 change_button = new QPushButton( "Change" , vbox );
55 delete_button = new QPushButton( "Delete" , vbox ); 54 delete_button = new QPushButton( "Delete" , vbox );
56 connect( new_button, SIGNAL( clicked() ), this, SLOT( slotNewMethod() ) ); 55 connect( new_button, SIGNAL( clicked() ), this, SLOT( slotNewMethod() ) );
57 connect( change_button, SIGNAL( clicked() ), this, SLOT( slotChangeMethod() )); 56 connect( change_button, SIGNAL( clicked() ), this, SLOT( slotChangeMethod() ));
58 connect( delete_button, SIGNAL( clicked() ), this, SLOT( slotDeleteMethod() )); 57 connect( delete_button, SIGNAL( clicked() ), this, SLOT( slotDeleteMethod() ));
59 58
60 vbox_layout_searchtab->addWidget( hbox ); 59 vbox_layout_searchtab->addWidget( hbox );
61 60
62 /*add the tabs and maximize*/ 61 /*add the tabs and maximize*/
63 tab->addTab( settings_tab, "pass", tr( "General Settings" ) ); 62 tab->addTab( settings_tab, "pass", tr( "General Settings" ) );
64 tab->addTab( search_tab, "zoom", tr( "Searchmethods" ) ); 63 tab->addTab( search_tab, "zoom", tr( "Searchmethods" ) );
65 showMaximized(); 64 showMaximized();
66} 65}
67 66
68void ConfigDlg::writeEntries() 67void ConfigDlg::writeEntries()
69{ 68{
70 qDebug( "richtig beendet" ); 69 qDebug( "richtig beendet" );
71} 70}
72 71
73void ConfigDlg::slotNewMethod() 72void ConfigDlg::slotNewMethod()
74{ 73{
75 SearchMethodDlg dlg( this, "SearchMethodDlg", true ); 74 SearchMethodDlg dlg( this, "SearchMethodDlg", true );
76 if ( dlg.exec() == QDialog::Accepted ) 75 if ( dlg.exec() == QDialog::Accepted )
77 { 76 {
78 //dlg.saveItem(); 77 dlg.saveItem();
79 QListViewItem *item = new QListViewItem( list ); 78 QListViewItem *item = new QListViewItem( list );
80 item->setText( 0 , dlg.itemName ); 79 item->setText( 0 , dlg.nameLE->text() );
81 } 80 }
82 else qDebug( "SearchMethodDlg abgebrochen" ); 81 else qDebug( "SearchMethodDlg abgebrochen" );
83} 82}
84 83
85void ConfigDlg::slotChangeMethod(){} 84void ConfigDlg::slotChangeMethod()
85{
86 if ( list->selectedItem() )
87 {
88 SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) );
89 if ( dlg.exec() == QDialog::Accepted )
90 {
91 dlg.saveItem();
92 QListViewItem *item = new QListViewItem( list );
93 item->setText( 0 , dlg.nameLE->text() );
94 }
95 else qDebug( "SearchMethodDlg abgebrochen" );
96 }
97 else qDebug( "kein item angewählt" );
98}
86 99
87void ConfigDlg::slotDeleteMethod() 100void ConfigDlg::slotDeleteMethod()
88{ 101{
89 if ( list->selectedItem() ) 102 if ( list->selectedItem() )
90 list->takeItem( list->selectedItem() ); 103 list->takeItem( list->selectedItem() );
91 else qDebug("no item selected"); 104 else qDebug("no item selected");
92} 105}
diff --git a/noncore/apps/odict/searchmethoddlg.cpp b/noncore/apps/odict/searchmethoddlg.cpp
index cd8a58a..0572f11 100644
--- a/noncore/apps/odict/searchmethoddlg.cpp
+++ b/noncore/apps/odict/searchmethoddlg.cpp
@@ -1,36 +1,107 @@
1/*************************************************************************** 1/***************************************************************************
2 application: : ODict 2 application: : ODict
3 3
4 begin : December 2002 4 begin : December 2002
5 copyright : ( C ) 2002, 2003 by Carsten Niehaus 5 copyright : ( C ) 2002, 2003 by Carsten Niehaus
6 email : cniehaus@handhelds.org 6 email : cniehaus@handhelds.org
7 **************************************************************************/ 7 **************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * ( at your option ) any later version. * 14 * ( at your option ) any later version. *
15 * * 15 * *
16 **************************************************************************/ 16 **************************************************************************/
17#include "searchmethoddlg.h" 17#include "searchmethoddlg.h"
18 18
19#include <qdialog.h> 19#include <qdialog.h>
20#include <qpe/config.h> 20#include <qpe/config.h>
21#include <qlayout.h> 21#include <qlayout.h>
22 22
23#include <qhbox.h> 23#include <qhbox.h>
24#include <qvbox.h> 24#include <qvbox.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qpushbutton.h> 26#include <qpushbutton.h>
27#include <qstring.h> 27#include <qstring.h>
28#include <qlineedit.h>
28 29
29SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) 30#include <opie/ofileselector.h>
31#include <opie/ofiledialog.h>
32
33SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal, QString itemname) : QDialog(parent, name, modal)
30{ 34{
31 setCaption( tr( "New Searchmethod" ) ); 35 if( !itemname )
36 setCaption( tr( "New Searchmethod" ) );
37 else
38 {
39 setCaption( tr( "Change Searchmethod" ) );
40 itemName = itemname;
41 setupEntries(itemname);
42 }
43
44 QVBoxLayout *vbox_layout = new QVBoxLayout( this, 4,4,"vbox_layout" );
45 QVBox *vbox = new QVBox( this );
46
47 QHBox *hbox1 = new QHBox( vbox );
48 QLabel *nameLabel = new QLabel( tr( "Name:" ) , hbox1 );
49 nameLE = new QLineEdit( hbox1 );
50
51 QLabel *dictLabel = new QLabel( tr( "Dictionary file" ), vbox );
52 QHBox *hbox2 = new QHBox( vbox );
53 dictFileLE = new QLineEdit( hbox2 );
54 QPushButton *browseButton = new QPushButton( tr( "Browse" ) , hbox2 );
55 connect( browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) );
56
57 QWidget *dummywidget = new QWidget( vbox );
58 QLabel *lag1 = new QLabel( tr( "Language 1" ),dummywidget);
59 QLabel *devider = new QLabel( tr( "Decollator" ),dummywidget);
60 QLabel *lag2 = new QLabel( tr( "Language 2" ),dummywidget);
61 lang1 = new QLineEdit( dummywidget );
62 lang2 = new QLineEdit( dummywidget );
63 trenner = new QLineEdit( dummywidget );
64 trenner->setText( "::" );
65
66 QGridLayout *grid = new QGridLayout( dummywidget, 2,3 );
67 grid->addWidget( lag1, 0,0 );
68 grid->addWidget( devider, 0,1 );
69 grid->addWidget( lag2, 0,2 );
70 grid->addWidget( lang1, 1,0 );
71 grid->addWidget( trenner, 1,1 );
72 grid->addWidget( lang2, 1,2 );
73
74 vbox_layout->addWidget( vbox );
32 75
33 itemName = "foo";
34 showMaximized(); 76 showMaximized();
35} 77}
36 78
79void SearchMethodDlg::setupEntries( QString item )
80{
81 Config cfg( "odict" );
82 cfg.setGroup( itemName );
83 trenner->setText( "foooof" );
84 //X trenner->setText( cfg.readEntry( "Seperator" ) );
85 //X lang1->setText( cfg.readEntry( "Lang1" ) );
86 //X lang2->setText( cfg.readEntry( "Lang2" ) );
87 //X nameLE->setText( itemName );
88 //X dictFileLE->setText( cfg.readEntry( "file" ) );
89}
90
91void SearchMethodDlg::slotBrowse()
92{
93 itemName=OFileDialog::getOpenFileName( OFileSelector::EXTENDED,"/home/carsten" );
94 dictFileLE->setText( itemName );
95}
96
97void SearchMethodDlg::saveItem()
98{
99 QString name = nameLE->text();
100 Config cfg( "odict" );
101 cfg.setGroup( name );
102 cfg.writeEntry( "Name", name );
103 cfg.writeEntry( "Seperator", trenner->text() );
104 cfg.writeEntry( "Lang1", lang1->text() );
105 cfg.writeEntry( "Lang2", lang2->text() );
106 cfg.writeEntry( "file", dictFileLE->text() );
107}
diff --git a/noncore/apps/odict/searchmethoddlg.h b/noncore/apps/odict/searchmethoddlg.h
index e277cfb..d98842f 100644
--- a/noncore/apps/odict/searchmethoddlg.h
+++ b/noncore/apps/odict/searchmethoddlg.h
@@ -1,29 +1,40 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * ( at your option ) any later version. * 6 * ( at your option ) any later version. *
7 * * 7 * *
8 **************************************************************************/ 8 **************************************************************************/
9 9
10class QWidget; 10class QWidget;
11class QLineEdit;
11class OTabWidget; 12class OTabWidget;
12class QListView; 13class QListView;
13class QPushButton; 14class QPushButton;
14class QLabel; 15class QLabel;
15class QString; 16class QString;
16 17
17#include <qdialog.h> 18#include <qdialog.h>
18 19
19 20
20class SearchMethodDlg : public QDialog 21class SearchMethodDlg : public QDialog
21{ 22{
22 Q_OBJECT 23 Q_OBJECT
23 24
24 public: 25 public:
25 SearchMethodDlg(QWidget *parent, const char *name, bool modal=FALSE ); 26 SearchMethodDlg(QWidget *parent, const char *name, bool modal=FALSE, QString itemname=0 );
26 27
27 QString itemName; 28 QString itemName;
29 QLineEdit *nameLE;
30 QLineEdit *lang1, *lang2, *trenner;
31 void saveItem();
32
33 private:
34 QLineEdit *dictFileLE;
35 void setupEntries( QString );
36
37 private slots:
38 void slotBrowse();
28 39
29}; 40};