summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/odict/dingwidget.cpp34
-rw-r--r--noncore/apps/odict/dingwidget.h14
-rw-r--r--noncore/apps/odict/odict.cpp17
-rw-r--r--noncore/apps/odict/odict.h10
4 files changed, 62 insertions, 13 deletions
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp
index ff83114..c54cf56 100644
--- a/noncore/apps/odict/dingwidget.cpp
+++ b/noncore/apps/odict/dingwidget.cpp
@@ -7,24 +7,56 @@
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 "dingwidget.h" 17#include "dingwidget.h"
18 18
19#include <qfile.h>
19#include <qpe/config.h> 20#include <qpe/config.h>
20#include <qhbox.h> 21#include <qhbox.h>
21#include <qlabel.h> 22#include <qlabel.h>
22#include <qpushbutton.h> 23#include <qpushbutton.h>
23#include <qlineedit.h> 24#include <qlineedit.h>
24#include <qmainwindow.h> 25#include <qmainwindow.h>
25#include <qstring.h> 26#include <qstring.h>
27#include <qtextstream.h>
28#include <qstringlist.h>
29#include <qregexp.h>
30#include <qtextbrowser.h>
26 31
27DingWidget::DingWidget() : QWidget() 32DingWidget::DingWidget(QWidget *parent, QString word, QTextBrowser *browser) : QWidget(parent)
28{ 33{
34 QFile file( "/home/carsten/opie/opie/noncore/apps/odict/eng_ita.dic" );
35 QStringList lines;
36
37 if( file.open( IO_ReadOnly ) )
38 {
39 QTextStream stream( &file );
40 while ( !stream.eof() )
41 {
42 lines.append( stream.readLine() );
43 }
44 file.close();
45 }
46
47 lines = lines.grep( word );
48
49 //X for( QStringList::Iterator it = lines.begin() ; it != lines.end() ; ++it )
50 //X {
51 //X qDebug( *it );
52 //X }
53 browser->setText( parseInfo( lines ) );
29} 54}
30 55
56QString DingWidget::parseInfo( QStringList &lines )
57{
58 QString parsed = 0;
59 QStringList temp = lines;
60 parsed = temp.first();
61 return parsed;
62}
diff --git a/noncore/apps/odict/dingwidget.h b/noncore/apps/odict/dingwidget.h
index 68841d0..54e16ab 100644
--- a/noncore/apps/odict/dingwidget.h
+++ b/noncore/apps/odict/dingwidget.h
@@ -1,24 +1,26 @@
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
10#include <qwidget.h> 10#include <qwidget.h>
11 11
12class QPopupMenu; 12class QString;
13class QMenuBar; 13class QTextBrowser;
14class QHBox; 14class QString;
15class QPushButton; 15class QStringList;
16class QLineEdit;
17 16
18class DingWidget : public QWidget 17class DingWidget : public QWidget
19{ 18{
20 Q_OBJECT 19 Q_OBJECT
21 20
22 public: 21 public:
23 DingWidget(); 22 DingWidget(QWidget *parent = 0, QString word = 0, QTextBrowser* = 0);
23
24 private:
25 QString parseInfo( QStringList& );
24}; 26};
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp
index 0412807..6c03ce3 100644
--- a/noncore/apps/odict/odict.cpp
+++ b/noncore/apps/odict/odict.cpp
@@ -7,55 +7,59 @@
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 "odict.h" 17#include "odict.h"
18#include "configdlg.h" 18#include "configdlg.h"
19#include "dingwidget.h"
19 20
20#include <opie/otabwidget.h> 21#include <qlayout.h>
21
22#include <qpopupmenu.h> 22#include <qpopupmenu.h>
23#include <qmenubar.h> 23#include <qmenubar.h>
24#include <qmessagebox.h> 24#include <qmessagebox.h>
25#include <qpe/config.h> 25#include <qpe/config.h>
26#include <qhbox.h> 26#include <qhbox.h>
27#include <qvbox.h>
27#include <qlabel.h> 28#include <qlabel.h>
28#include <qpushbutton.h> 29#include <qpushbutton.h>
29#include <qlineedit.h> 30#include <qlineedit.h>
30#include <qmainwindow.h> 31#include <qmainwindow.h>
31#include <qstring.h> 32#include <qstring.h>
32#include <qaction.h> 33#include <qaction.h>
34#include <qtextbrowser.h>
33 35
34#include <qpe/resource.h> 36#include <qpe/resource.h>
35 37
36 38
37ODict::ODict() : QMainWindow() 39ODict::ODict() : QMainWindow()
38{ 40{
41 vbox = new QVBox( this );
39 setCaption( tr( "OPIE-Dictionary" ) ); 42 setCaption( tr( "OPIE-Dictionary" ) );
40 setupMenus(); 43 setupMenus();
41 44
42 QHBox *hbox = new QHBox( this ); 45 QHBox *hbox = new QHBox( vbox );
43 QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); 46 QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show();
44 query_le = new QLineEdit( hbox ); 47 query_le = new QLineEdit( hbox );
45 ok_button = new QPushButton( tr( "&Ok" ), hbox ); 48 ok_button = new QPushButton( tr( "&Ok" ), hbox );
46 connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); 49 connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) );
47 50 browser = new QTextBrowser( vbox );
48 setCentralWidget( hbox ); 51
49 loadConfig(); 52 loadConfig();
53 setCentralWidget( vbox );
50} 54}
51 55
52void ODict::loadConfig() 56void ODict::loadConfig()
53{ 57{
54 Config cfg ( "odict" ); 58 Config cfg ( "odict" );
55 cfg.setGroup( "generalsettings" ); 59 cfg.setGroup( "generalsettings" );
56 errorTol = cfg.readEntry( "errtol" ).toInt(); 60 errorTol = cfg.readEntry( "errtol" ).toInt();
57 casesens = cfg.readEntry( "casesens" ).toInt(); 61 casesens = cfg.readEntry( "casesens" ).toInt();
58 regexp = cfg.readEntry( "regexp" ).toInt(); 62 regexp = cfg.readEntry( "regexp" ).toInt();
59 completewords = cfg.readEntry( "completewords" ).toInt(); 63 completewords = cfg.readEntry( "completewords" ).toInt();
60} 64}
61 65
@@ -63,30 +67,31 @@ void ODict::loadConfig()
63void ODict::saveConfig() 67void ODict::saveConfig()
64{ 68{
65 Config cfg ( "odict" ); 69 Config cfg ( "odict" );
66 cfg.setGroup( "generalsettings" ); 70 cfg.setGroup( "generalsettings" );
67 cfg.writeEntry( "errtol" , errorTol ); 71 cfg.writeEntry( "errtol" , errorTol );
68 cfg.writeEntry( "casesens" , casesens ); 72 cfg.writeEntry( "casesens" , casesens );
69 cfg.writeEntry( "regexp" , regexp ); 73 cfg.writeEntry( "regexp" , regexp );
70 cfg.writeEntry( "completewords" , completewords ); 74 cfg.writeEntry( "completewords" , completewords );
71} 75}
72 76
73void ODict::slotDisplayAbout() 77void ODict::slotDisplayAbout()
74{ 78{
75 QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20021230" ) ); 79 QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030103" ) );
76} 80}
77 81
78void ODict::slotStartQuery() 82void ODict::slotStartQuery()
79{ 83{
80 QString querystring = query_le->text(); 84 QString querystring = query_le->text();
85 DingWidget *ding = new DingWidget( vbox , querystring , browser);
81} 86}
82 87
83 88
84void ODict::slotSetErrorcount( int count ) 89void ODict::slotSetErrorcount( int count )
85{ 90{
86 errorTol = count; 91 errorTol = count;
87} 92}
88 93
89void ODict::slotSettings() 94void ODict::slotSettings()
90{ 95{
91 ConfigDlg dlg( this, "Config" , true); 96 ConfigDlg dlg( this, "Config" , true);
92 if ( dlg.exec() == QDialog::Accepted ) 97 if ( dlg.exec() == QDialog::Accepted )
diff --git a/noncore/apps/odict/odict.h b/noncore/apps/odict/odict.h
index 014e488..d7e57e8 100644
--- a/noncore/apps/odict/odict.h
+++ b/noncore/apps/odict/odict.h
@@ -1,46 +1,56 @@
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
10#include <qmainwindow.h> 10#include <qmainwindow.h>
11 11
12class QVBox;
12class QPopupMenu; 13class QPopupMenu;
13class QMenuBar; 14class QMenuBar;
14class QHBox; 15class QHBox;
15class QPushButton; 16class QPushButton;
16class QLineEdit; 17class QLineEdit;
17class QAction; 18class QAction;
19class QVBoxLayout;
18class QActionGroup; 20class QActionGroup;
21class DingWidget;
22class QTextBrowser;
19 23
20class ODict : public QMainWindow 24class ODict : public QMainWindow
21{ 25{
22 Q_OBJECT 26 Q_OBJECT
23 27
24 public: 28 public:
25 ODict(); 29 ODict();
30 QVBox *vbox;
31 QTextBrowser *browser;
26 32
27 private: 33 private:
28 QPopupMenu *help, *settings, *parameter, *error_tol_menu; 34 QPopupMenu *help, *settings, *parameter, *error_tol_menu;
29 QMenuBar *menu; 35 QMenuBar *menu;
30 QHBox *hbox; 36 QHBox *hbox;
31 QLineEdit *query_le; 37 QLineEdit *query_le;
32 QPushButton *ok_button; 38 QPushButton *ok_button;
33 39
40 QVBoxLayout *vbox_layout;
41
34 QAction *setting_a, *setting_b; 42 QAction *setting_a, *setting_b;
43
44 //DingWidget *ding;
35 45
36 void setupMenus(); 46 void setupMenus();
37 47
38 int errorTol; 48 int errorTol;
39 bool casesens, completewords, regexp; 49 bool casesens, completewords, regexp;
40 50
41 void loadConfig(); 51 void loadConfig();
42 void saveConfig(); 52 void saveConfig();
43 53
44 private slots: 54 private slots:
45 void slotDisplayAbout(); 55 void slotDisplayAbout();
46 void slotStartQuery(); 56 void slotStartQuery();