-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 @@ -13,18 +13,50 @@ * the Free Software Foundation; either version 2 of the License, or * * ( at your option ) any later version. * * * **************************************************************************/ #include "dingwidget.h" +#include <qfile.h> #include <qpe/config.h> #include <qhbox.h> #include <qlabel.h> #include <qpushbutton.h> #include <qlineedit.h> #include <qmainwindow.h> #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 @@ -6,19 +6,21 @@ * ( at your option ) any later version. * * * **************************************************************************/ #include <qwidget.h> -class QPopupMenu; -class QMenuBar; -class QHBox; -class QPushButton; -class QLineEdit; +class QString; +class QTextBrowser; +class QString; +class QStringList; class DingWidget : public QWidget { Q_OBJECT 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 @@ -13,43 +13,47 @@ * the Free Software Foundation; either version 2 of the License, or * * ( at your option ) any later version. * * * **************************************************************************/ #include "odict.h" #include "configdlg.h" +#include "dingwidget.h" -#include <opie/otabwidget.h> - +#include <qlayout.h> #include <qpopupmenu.h> #include <qmenubar.h> #include <qmessagebox.h> #include <qpe/config.h> #include <qhbox.h> +#include <qvbox.h> #include <qlabel.h> #include <qpushbutton.h> #include <qlineedit.h> #include <qmainwindow.h> #include <qstring.h> #include <qaction.h> +#include <qtextbrowser.h> #include <qpe/resource.h> ODict::ODict() : QMainWindow() { + vbox = new QVBox( this ); setCaption( tr( "OPIE-Dictionary" ) ); setupMenus(); - QHBox *hbox = new QHBox( this ); + QHBox *hbox = new QHBox( vbox ); QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); query_le = new QLineEdit( hbox ); ok_button = new QPushButton( tr( "&Ok" ), hbox ); connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); - - setCentralWidget( hbox ); + browser = new QTextBrowser( vbox ); + loadConfig(); + setCentralWidget( vbox ); } void ODict::loadConfig() { Config cfg ( "odict" ); cfg.setGroup( "generalsettings" ); @@ -69,18 +73,19 @@ void ODict::saveConfig() cfg.writeEntry( "regexp" , regexp ); cfg.writeEntry( "completewords" , completewords ); } 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" ) ); } void ODict::slotStartQuery() { QString querystring = query_le->text(); + DingWidget *ding = new DingWidget( vbox , querystring , browser); } void ODict::slotSetErrorcount( int count ) { errorTol = count; 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 @@ -6,35 +6,45 @@ * ( at your option ) any later version. * * * **************************************************************************/ #include <qmainwindow.h> +class QVBox; class QPopupMenu; class QMenuBar; class QHBox; class QPushButton; class QLineEdit; class QAction; +class QVBoxLayout; class QActionGroup; +class DingWidget; +class QTextBrowser; class ODict : public QMainWindow { Q_OBJECT public: ODict(); + QVBox *vbox; + QTextBrowser *browser; private: QPopupMenu *help, *settings, *parameter, *error_tol_menu; QMenuBar *menu; QHBox *hbox; QLineEdit *query_le; QPushButton *ok_button; + QVBoxLayout *vbox_layout; + QAction *setting_a, *setting_b; + + //DingWidget *ding; void setupMenus(); int errorTol; bool casesens, completewords, regexp; |