summaryrefslogtreecommitdiff
path: root/noncore/apps/odict
authorcniehaus <cniehaus>2003-01-03 18:27:56 (UTC)
committer cniehaus <cniehaus>2003-01-03 18:27:56 (UTC)
commitde71690306857498edcf1036123452c7321d1588 (patch) (unidiff)
tree86aa1bf0c375fbba7eca1173c904c726e31182e6 /noncore/apps/odict
parent7a97cd36cbc4c1a82043cdd44c82f931e2cdbb7f (diff)
downloadopie-de71690306857498edcf1036123452c7321d1588.zip
opie-de71690306857498edcf1036123452c7321d1588.tar.gz
opie-de71690306857498edcf1036123452c7321d1588.tar.bz2
I won't get a nobelprize for this code but at least it works
Diffstat (limited to 'noncore/apps/odict') (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
@@ -16,6 +16,7 @@
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>
@@ -23,8 +24,39 @@
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
@@ -9,16 +9,18 @@
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
@@ -16,37 +16,41 @@
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()
@@ -72,12 +76,13 @@ void ODict::saveConfig()
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
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
@@ -9,13 +9,17 @@
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{
@@ -23,6 +27,8 @@ class ODict : public QMainWindow
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;
@@ -31,7 +37,11 @@ class ODict : public QMainWindow
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