author | cniehaus <cniehaus> | 2003-01-03 18:27:56 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2003-01-03 18:27:56 (UTC) |
commit | de71690306857498edcf1036123452c7321d1588 (patch) (side-by-side diff) | |
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 @@ +#include <qfile.h> #include <qpe/config.h> @@ -25,6 +26,37 @@ #include <qstring.h> +#include <qtextstream.h> +#include <qstringlist.h> +#include <qregexp.h> +#include <qtextbrowser.h> -DingWidget::DingWidget() : QWidget() +DingWidget::DingWidget(QWidget *parent, QString word, QTextBrowser *browser) : QWidget(parent) { + QFile file( "/home/carsten/opie/opie/noncore/apps/odict/eng_ita.dic" ); + QStringList lines; + + if( file.open( IO_ReadOnly ) ) + { + QTextStream stream( &file ); + while ( !stream.eof() ) + { + lines.append( stream.readLine() ); + } + file.close(); + } + + lines = lines.grep( word ); + +//X for( QStringList::Iterator it = lines.begin() ; it != lines.end() ; ++it ) +//X { +//X qDebug( *it ); +//X } + browser->setText( parseInfo( lines ) ); } +QString DingWidget::parseInfo( QStringList &lines ) +{ + QString parsed = 0; + QStringList temp = lines; + parsed = temp.first(); + return parsed; +} 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 @@ -class QPopupMenu; -class QMenuBar; -class QHBox; -class QPushButton; -class QLineEdit; +class QString; +class QTextBrowser; +class QString; +class QStringList; @@ -22,3 +21,6 @@ class DingWidget : public QWidget public: - DingWidget(); + DingWidget(QWidget *parent = 0, QString word = 0, QTextBrowser* = 0); + + private: + QString parseInfo( QStringList& ); }; 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 @@ #include "configdlg.h" +#include "dingwidget.h" -#include <opie/otabwidget.h> - +#include <qlayout.h> #include <qpopupmenu.h> @@ -26,2 +26,3 @@ #include <qhbox.h> +#include <qvbox.h> #include <qlabel.h> @@ -32,2 +33,3 @@ #include <qaction.h> +#include <qtextbrowser.h> @@ -38,2 +40,3 @@ ODict::ODict() : QMainWindow() { + vbox = new QVBox( this ); setCaption( tr( "OPIE-Dictionary" ) ); @@ -41,3 +44,3 @@ ODict::ODict() : QMainWindow() - QHBox *hbox = new QHBox( this ); + QHBox *hbox = new QHBox( vbox ); QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); @@ -46,5 +49,6 @@ ODict::ODict() : QMainWindow() connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); - - setCentralWidget( hbox ); + browser = new QTextBrowser( vbox ); + loadConfig(); + setCentralWidget( vbox ); } @@ -74,3 +78,3 @@ void ODict::slotDisplayAbout() { - QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20021230" ) ); + QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030103" ) ); } @@ -80,2 +84,3 @@ void ODict::slotStartQuery() QString querystring = query_le->text(); + DingWidget *ding = new DingWidget( vbox , querystring , browser); } 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 @@ +class QVBox; class QPopupMenu; @@ -17,3 +18,6 @@ class QLineEdit; class QAction; +class QVBoxLayout; class QActionGroup; +class DingWidget; +class QTextBrowser; @@ -25,2 +29,4 @@ class ODict : public QMainWindow ODict(); + QVBox *vbox; + QTextBrowser *browser; @@ -33,3 +39,7 @@ class ODict : public QMainWindow + QVBoxLayout *vbox_layout; + QAction *setting_a, *setting_b; + + //DingWidget *ding; |