author | cniehaus <cniehaus> | 2003-01-03 22:31:19 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2003-01-03 22:31:19 (UTC) |
commit | da1889933ccd03ef948fef7debda0b7e13f12add (patch) (side-by-side diff) | |
tree | 98df5c800d091800f1264dcbd601b951b0522a96 | |
parent | 5c6c68a2297762fe69ac6d1bd62fd0e09afeccb3 (diff) | |
download | opie-da1889933ccd03ef948fef7debda0b7e13f12add.zip opie-da1889933ccd03ef948fef7debda0b7e13f12add.tar.gz opie-da1889933ccd03ef948fef7debda0b7e13f12add.tar.bz2 |
minifixes to avoid clashes with tille
-rw-r--r-- | noncore/apps/odict/dingwidget.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/odict/odict.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/odict/odict.h | 2 |
3 files changed, 16 insertions, 3 deletions
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp index 6e3179f..61ddbbf 100644 --- a/noncore/apps/odict/dingwidget.cpp +++ b/noncore/apps/odict/dingwidget.cpp @@ -51,38 +51,40 @@ DingWidget::DingWidget(QWidget *parent, QString word, QTextBrowser *browser_top, QString top, bottom; parseInfo( lines, top , bottom ); browser_top->setText( top ); browser_bottom->setText( bottom ); } void DingWidget::parseInfo( QStringList &lines, QString &top, QString &bottom ) { QString current; QString left; QString right; QRegExp reg_div( "\\" ); QRegExp reg_word( queryword ); //rot: QString substitute = "<font color='#FF0000'>"+queryword+"</font>"; QString substitute = "<a href=''>"+queryword+"</a>"; QStringList toplist, bottomlist; for( QStringList::Iterator it = lines.begin() ; it != lines.end() ; ++it ) { current = *it; left = current.left( current.find(reg_div) ); right = current.right( current.length() - current.find(reg_div) - 1 ); - if ( left.contains( reg_word ) ){ + if ( left.contains( reg_word ) ) + { left.replace( queryword, substitute ); toplist.append( left + " -> " + right); - }else{ + } + else + { right.replace( reg_word, substitute ); bottomlist.append( right + " -> " + left ); } - // .replace( reg_word, substitute ); } //thats it, the lists are rendered. Lets put them in one string bottom = bottomlist.join( "<br>\n" ); top = toplist.join( "<br>\n" ); } diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 166f6b9..7de9169 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp @@ -11,78 +11,87 @@ * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * 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 <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 <qcombobox.h> #include <qpe/resource.h> ODict::ODict() : QMainWindow() { vbox = new QVBox( this ); setCaption( tr( "OPIE-Dictionary" ) ); setupMenus(); QHBox *hbox = new QHBox( vbox ); QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); query_le = new QLineEdit( hbox ); + query_co = new QComboBox( hbox ); ok_button = new QPushButton( tr( "&Ok" ), hbox ); connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); browser_top = new QTextBrowser( vbox ); browser_bottom = new QTextBrowser( vbox ); loadConfig(); setCentralWidget( vbox ); } void ODict::loadConfig() { Config cfg ( "odict" ); cfg.setGroup( "generalsettings" ); errorTol = cfg.readEntry( "errtol" ).toInt(); casesens = cfg.readEntry( "casesens" ).toInt(); regexp = cfg.readEntry( "regexp" ).toInt(); completewords = cfg.readEntry( "completewords" ).toInt(); + + QStringList groupListCfg = cfg.groupList().grep( "Method_" ); + for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) + { + cfg.setGroup( *it ); + query_co->insertItem( cfg.readEntry( "Name" ) ); + } } void ODict::saveConfig() { Config cfg ( "odict" ); cfg.setGroup( "generalsettings" ); cfg.writeEntry( "errtol" , errorTol ); cfg.writeEntry( "casesens" , casesens ); 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 20030103" ) ); } void ODict::slotStartQuery() { QString querystring = query_le->text(); DingWidget *ding = new DingWidget( vbox , querystring , browser_top, browser_bottom); } diff --git a/noncore/apps/odict/odict.h b/noncore/apps/odict/odict.h index ef0822d..7c1f32f 100644 --- a/noncore/apps/odict/odict.h +++ b/noncore/apps/odict/odict.h @@ -1,61 +1,63 @@ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * ( 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 QComboBox; class ODict : public QMainWindow { Q_OBJECT public: ODict(); QVBox *vbox; QTextBrowser *browser_top, *browser_bottom; private: QPopupMenu *help, *settings, *parameter, *error_tol_menu; QMenuBar *menu; QHBox *hbox; QLineEdit *query_le; + QComboBox *query_co; QPushButton *ok_button; QVBoxLayout *vbox_layout; QAction *setting_a, *setting_b; //DingWidget *ding; void setupMenus(); int errorTol; bool casesens, completewords, regexp; void loadConfig(); void saveConfig(); private slots: void slotDisplayAbout(); void slotStartQuery(); void slotSetErrorcount( int ); void slotSettings(); void slotSetParameter( int ); }; |