author | cniehaus <cniehaus> | 2003-01-03 18:27:56 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2003-01-03 18:27:56 (UTC) |
commit | de71690306857498edcf1036123452c7321d1588 (patch) (unidiff) | |
tree | 86aa1bf0c375fbba7eca1173c904c726e31182e6 | |
parent | 7a97cd36cbc4c1a82043cdd44c82f931e2cdbb7f (diff) | |
download | opie-de71690306857498edcf1036123452c7321d1588.zip opie-de71690306857498edcf1036123452c7321d1588.tar.gz opie-de71690306857498edcf1036123452c7321d1588.tar.bz2 |
I won't get a nobelprize for this code but at least it works
-rw-r--r-- | noncore/apps/odict/dingwidget.cpp | 34 | ||||
-rw-r--r-- | noncore/apps/odict/dingwidget.h | 14 | ||||
-rw-r--r-- | noncore/apps/odict/odict.cpp | 17 | ||||
-rw-r--r-- | noncore/apps/odict/odict.h | 10 |
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 | |||
@@ -18,2 +18,3 @@ | |||
18 | 18 | ||
19 | #include <qfile.h> | ||
19 | #include <qpe/config.h> | 20 | #include <qpe/config.h> |
@@ -25,6 +26,37 @@ | |||
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 | ||
27 | DingWidget::DingWidget() : QWidget() | 32 | DingWidget::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 | ||
56 | QString 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 | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | class QPopupMenu; | 12 | class QString; |
13 | class QMenuBar; | 13 | class QTextBrowser; |
14 | class QHBox; | 14 | class QString; |
15 | class QPushButton; | 15 | class QStringList; |
16 | class QLineEdit; | ||
17 | 16 | ||
@@ -22,3 +21,6 @@ class DingWidget : public QWidget | |||
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 | |||
@@ -18,5 +18,5 @@ | |||
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> |
@@ -26,2 +26,3 @@ | |||
26 | #include <qhbox.h> | 26 | #include <qhbox.h> |
27 | #include <qvbox.h> | ||
27 | #include <qlabel.h> | 28 | #include <qlabel.h> |
@@ -32,2 +33,3 @@ | |||
32 | #include <qaction.h> | 33 | #include <qaction.h> |
34 | #include <qtextbrowser.h> | ||
33 | 35 | ||
@@ -38,2 +40,3 @@ ODict::ODict() : QMainWindow() | |||
38 | { | 40 | { |
41 | vbox = new QVBox( this ); | ||
39 | setCaption( tr( "OPIE-Dictionary" ) ); | 42 | setCaption( tr( "OPIE-Dictionary" ) ); |
@@ -41,3 +44,3 @@ ODict::ODict() : QMainWindow() | |||
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(); |
@@ -46,5 +49,6 @@ ODict::ODict() : QMainWindow() | |||
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 | } |
@@ -74,3 +78,3 @@ void 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 | } |
@@ -80,2 +84,3 @@ void ODict::slotStartQuery() | |||
80 | QString querystring = query_le->text(); | 84 | QString querystring = query_le->text(); |
85 | DingWidget *ding = new DingWidget( vbox , querystring , browser); | ||
81 | } | 86 | } |
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 | |||
@@ -11,2 +11,3 @@ | |||
11 | 11 | ||
12 | class QVBox; | ||
12 | class QPopupMenu; | 13 | class QPopupMenu; |
@@ -17,3 +18,6 @@ class QLineEdit; | |||
17 | class QAction; | 18 | class QAction; |
19 | class QVBoxLayout; | ||
18 | class QActionGroup; | 20 | class QActionGroup; |
21 | class DingWidget; | ||
22 | class QTextBrowser; | ||
19 | 23 | ||
@@ -25,2 +29,4 @@ class ODict : public QMainWindow | |||
25 | ODict(); | 29 | ODict(); |
30 | QVBox *vbox; | ||
31 | QTextBrowser *browser; | ||
26 | 32 | ||
@@ -33,3 +39,7 @@ class ODict : public QMainWindow | |||
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 | ||