-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 | |||
@@ -17,4 +17,5 @@ | |||
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> |
@@ -24,7 +25,38 @@ | |||
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 | ||
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 | |||
@@ -10,9 +10,8 @@ | |||
10 | #include <qwidget.h> | 10 | #include <qwidget.h> |
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 | ||
18 | class DingWidget : public QWidget | 17 | class DingWidget : public QWidget |
@@ -21,4 +20,7 @@ class DingWidget : public QWidget | |||
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 | |||
@@ -17,7 +17,7 @@ | |||
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> |
@@ -25,4 +25,5 @@ | |||
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> |
@@ -31,4 +32,5 @@ | |||
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> |
@@ -37,15 +39,17 @@ | |||
37 | ODict::ODict() : QMainWindow() | 39 | ODict::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 | ||
@@ -73,5 +77,5 @@ void ODict::saveConfig() | |||
73 | void ODict::slotDisplayAbout() | 77 | 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 | } |
77 | 81 | ||
@@ -79,4 +83,5 @@ void 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 | ||
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 | |||
@@ -10,4 +10,5 @@ | |||
10 | #include <qmainwindow.h> | 10 | #include <qmainwindow.h> |
11 | 11 | ||
12 | class QVBox; | ||
12 | class QPopupMenu; | 13 | class QPopupMenu; |
13 | class QMenuBar; | 14 | class QMenuBar; |
@@ -16,5 +17,8 @@ class QPushButton; | |||
16 | class QLineEdit; | 17 | 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 | ||
20 | class ODict : public QMainWindow | 24 | class ODict : public QMainWindow |
@@ -24,4 +28,6 @@ class ODict : public QMainWindow | |||
24 | public: | 28 | public: |
25 | ODict(); | 29 | ODict(); |
30 | QVBox *vbox; | ||
31 | QTextBrowser *browser; | ||
26 | 32 | ||
27 | private: | 33 | private: |
@@ -32,5 +38,9 @@ class ODict : public QMainWindow | |||
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(); |