-rw-r--r-- | noncore/apps/odict/dingwidget.cpp | 16 | ||||
-rw-r--r-- | noncore/apps/odict/dingwidget.h | 5 | ||||
-rw-r--r-- | noncore/apps/odict/odict.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/odict/odict.h | 5 |
4 files changed, 30 insertions, 6 deletions
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp index 8f5a7ae..b69a803 100644 --- a/noncore/apps/odict/dingwidget.cpp +++ b/noncore/apps/odict/dingwidget.cpp | |||
@@ -1,95 +1,105 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : ODict | 2 | application: : ODict |
3 | 3 | ||
4 | begin : December 2002 | 4 | begin : December 2002 |
5 | copyright : ( C ) 2002, 2003 by Carsten Niehaus | 5 | copyright : ( C ) 2002, 2003 by Carsten Niehaus |
6 | email : cniehaus@handhelds.org | 6 | email : cniehaus@handhelds.org |
7 | **************************************************************************/ | 7 | **************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
15 | * * | 15 | * * |
16 | **************************************************************************/ | 16 | **************************************************************************/ |
17 | #include "dingwidget.h" | 17 | #include "dingwidget.h" |
18 | 18 | ||
19 | #include <qfile.h> | 19 | #include <qfile.h> |
20 | #include <qpe/config.h> | 20 | #include <qpe/config.h> |
21 | #include <qhbox.h> | 21 | #include <qhbox.h> |
22 | #include <qlabel.h> | 22 | #include <qlabel.h> |
23 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
24 | #include <qlineedit.h> | 24 | #include <qlineedit.h> |
25 | #include <qmainwindow.h> | 25 | #include <qmainwindow.h> |
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | #include <qtextstream.h> | 27 | #include <qtextstream.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | #include <qregexp.h> | 29 | #include <qregexp.h> |
30 | #include <qtextbrowser.h> | 30 | #include <qtextbrowser.h> |
31 | #include <stdlib.h> // for getenv | 31 | #include <stdlib.h> // for getenv |
32 | 32 | ||
33 | DingWidget::DingWidget(QWidget *parent, QString word, QTextBrowser *browser_top, QTextBrowser *browser_bottom) : QWidget(parent) | 33 | DingWidget::DingWidget(QWidget *parent, QString word, QTextBrowser *browser_top, QTextBrowser *browser_bottom, QString activated_name) : QWidget(parent) |
34 | { | 34 | { |
35 | methodname = activated_name; | ||
35 | queryword = word; | 36 | queryword = word; |
37 | trenner = QString::null; | ||
38 | loadValues(); | ||
36 | QString opie_dir = getenv("OPIEDIR"); | 39 | QString opie_dir = getenv("OPIEDIR"); |
37 | QFile file( opie_dir+"/noncore/apps/odict/eng_ita.dic" ); | 40 | QFile file( opie_dir+"/noncore/apps/odict/eng_ita.dic" ); |
38 | QStringList lines; | 41 | QStringList lines; |
39 | 42 | ||
40 | if( file.open( IO_ReadOnly ) ) | 43 | if( file.open( IO_ReadOnly ) ) |
41 | { | 44 | { |
42 | QTextStream stream( &file ); | 45 | QTextStream stream( &file ); |
43 | while ( !stream.eof() ) | 46 | while ( !stream.eof() ) |
44 | { | 47 | { |
45 | lines.append( stream.readLine() ); | 48 | lines.append( stream.readLine() ); |
46 | } | 49 | } |
47 | file.close(); | 50 | file.close(); |
48 | } | 51 | } |
49 | 52 | ||
50 | lines = lines.grep( queryword ); | 53 | lines = lines.grep( queryword ); |
51 | 54 | ||
52 | QString top, bottom; | 55 | QString top, bottom; |
53 | 56 | //parseInfo( lines, top , bottom ); | |
54 | parseInfo( lines, top , bottom ); | ||
55 | browser_top->setText( top ); | 57 | browser_top->setText( top ); |
56 | browser_bottom->setText( bottom ); | 58 | browser_bottom->setText( bottom ); |
57 | } | 59 | } |
58 | 60 | ||
61 | void DingWidget::loadValues() | ||
62 | { | ||
63 | Config cfg( "odict" ); | ||
64 | cfg.setGroup( "Method_"+methodname ); | ||
65 | trenner = cfg.readEntry( "Seperator" ); | ||
66 | } | ||
67 | |||
59 | void DingWidget::parseInfo( QStringList &lines, QString &top, QString &bottom ) | 68 | void DingWidget::parseInfo( QStringList &lines, QString &top, QString &bottom ) |
60 | { | 69 | { |
61 | 70 | ||
62 | QString current; | 71 | QString current; |
63 | QString left; | 72 | QString left; |
64 | QString right; | 73 | QString right; |
65 | QString html_header = "<html><table>"; | 74 | QString html_header = "<html><table>"; |
66 | QString html_footer = "</table></html>"; | 75 | QString html_footer = "</table></html>"; |
67 | QString html_table_left = "<tr><td width='50'>"; | 76 | QString html_table_left = "<tr><td width='50'>"; |
68 | QString html_table_sep = "</td><td>"; | 77 | QString html_table_sep = "</td><td>"; |
69 | QString html_table_right = "</td></tr>"; | 78 | QString html_table_right = "</td></tr>"; |
70 | QRegExp reg_div( "\\" ); | 79 | QRegExp reg_div( "\\" ); |
80 | //QRegExp reg_div( trenner ); | ||
71 | QRegExp reg_word( queryword ); | 81 | QRegExp reg_word( queryword ); |
72 | //QString substitute = "<font color=red>"+queryword+"</font>"; | 82 | //QString substitute = "<font color=red>"+queryword+"</font>"; |
73 | QString substitute = "<a href=''>"+queryword+"</a>"; | 83 | QString substitute = "<a href=''>"+queryword+"</a>"; |
74 | QStringList toplist, bottomlist; | 84 | QStringList toplist, bottomlist; |
75 | for( QStringList::Iterator it = lines.begin() ; it != lines.end() ; ++it ) | 85 | for( QStringList::Iterator it = lines.begin() ; it != lines.end() ; ++it ) |
76 | { | 86 | { |
77 | current = *it; | 87 | current = *it; |
78 | left = current.left( current.find(reg_div) ); | 88 | left = current.left( current.find(reg_div) ); |
79 | right = current.right( current.length() - current.find(reg_div) - 1 ); | 89 | right = current.right( current.length() - current.find(reg_div) - 1 ); |
80 | if ( left.contains( reg_word ) ) | 90 | if ( left.contains( reg_word ) ) |
81 | { | 91 | { |
82 | left.replace( queryword, substitute ); | 92 | left.replace( queryword, substitute ); |
83 | toplist.append( html_table_left + left + html_table_sep + right + html_table_right ); | 93 | toplist.append( html_table_left + left + html_table_sep + right + html_table_right ); |
84 | } | 94 | } |
85 | else | 95 | else |
86 | { | 96 | { |
87 | right.replace( reg_word, substitute ); | 97 | right.replace( reg_word, substitute ); |
88 | bottomlist.append( html_table_left + right + html_table_sep + left + html_table_right ); | 98 | bottomlist.append( html_table_left + right + html_table_sep + left + html_table_right ); |
89 | } | 99 | } |
90 | } | 100 | } |
91 | 101 | ||
92 | //thats it, the lists are rendered. Lets put them in one string | 102 | //thats it, the lists are rendered. Lets put them in one string |
93 | bottom = html_header + bottomlist.join( "<br>" ) + html_footer; | 103 | bottom = html_header + bottomlist.join( "<br>" ) + html_footer; |
94 | top = html_header + toplist.join( "<br>" ) + html_footer; | 104 | top = html_header + toplist.join( "<br>" ) + html_footer; |
95 | } | 105 | } |
diff --git a/noncore/apps/odict/dingwidget.h b/noncore/apps/odict/dingwidget.h index cba1edf..66379fe 100644 --- a/noncore/apps/odict/dingwidget.h +++ b/noncore/apps/odict/dingwidget.h | |||
@@ -1,28 +1,31 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 6 | * ( at your option ) any later version. * |
7 | * * | 7 | * * |
8 | **************************************************************************/ | 8 | **************************************************************************/ |
9 | 9 | ||
10 | #include <qwidget.h> | 10 | #include <qwidget.h> |
11 | 11 | ||
12 | class QString; | 12 | class QString; |
13 | class QTextBrowser; | 13 | class QTextBrowser; |
14 | class QString; | 14 | class QString; |
15 | class QStringList; | 15 | class QStringList; |
16 | 16 | ||
17 | class DingWidget : public QWidget | 17 | class DingWidget : public QWidget |
18 | { | 18 | { |
19 | Q_OBJECT | 19 | Q_OBJECT |
20 | 20 | ||
21 | public: | 21 | public: |
22 | DingWidget(QWidget *parent = 0, QString word = 0, QTextBrowser* = 0, QTextBrowser* =0); | 22 | DingWidget(QWidget *parent = 0, QString word = 0, QTextBrowser* = 0, QTextBrowser* =0, QString activated_name=0); |
23 | 23 | ||
24 | private: | 24 | private: |
25 | QString search_word; | 25 | QString search_word; |
26 | void parseInfo( QStringList& , QString&, QString& ); | 26 | void parseInfo( QStringList& , QString&, QString& ); |
27 | QString queryword; | 27 | QString queryword; |
28 | void loadValues(); | ||
29 | QString methodname; | ||
30 | QString trenner; | ||
28 | }; | 31 | }; |
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 7de9169..2857c65 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp | |||
@@ -1,173 +1,181 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : ODict | 2 | application: : ODict |
3 | 3 | ||
4 | begin : December 2002 | 4 | begin : December 2002 |
5 | copyright : ( C ) 2002, 2003 by Carsten Niehaus | 5 | copyright : ( C ) 2002, 2003 by Carsten Niehaus |
6 | email : cniehaus@handhelds.org | 6 | email : cniehaus@handhelds.org |
7 | **************************************************************************/ | 7 | **************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
15 | * * | 15 | * * |
16 | **************************************************************************/ | 16 | **************************************************************************/ |
17 | #include "odict.h" | 17 | #include "odict.h" |
18 | #include "configdlg.h" | 18 | #include "configdlg.h" |
19 | #include "dingwidget.h" | 19 | #include "dingwidget.h" |
20 | 20 | ||
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qpopupmenu.h> | 22 | #include <qpopupmenu.h> |
23 | #include <qmenubar.h> | 23 | #include <qmenubar.h> |
24 | #include <qmessagebox.h> | 24 | #include <qmessagebox.h> |
25 | #include <qpe/config.h> | 25 | #include <qpe/config.h> |
26 | #include <qhbox.h> | 26 | #include <qhbox.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qmainwindow.h> | 31 | #include <qmainwindow.h> |
32 | #include <qstring.h> | 32 | #include <qstring.h> |
33 | #include <qaction.h> | 33 | #include <qaction.h> |
34 | #include <qtextbrowser.h> | 34 | #include <qtextbrowser.h> |
35 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
36 | 36 | ||
37 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
38 | 38 | ||
39 | 39 | ||
40 | ODict::ODict() : QMainWindow() | 40 | ODict::ODict() : QMainWindow() |
41 | { | 41 | { |
42 | |||
43 | activated_name = QString::null; | ||
42 | vbox = new QVBox( this ); | 44 | vbox = new QVBox( this ); |
43 | setCaption( tr( "OPIE-Dictionary" ) ); | 45 | setCaption( tr( "OPIE-Dictionary" ) ); |
44 | setupMenus(); | 46 | setupMenus(); |
45 | 47 | ||
46 | QHBox *hbox = new QHBox( vbox ); | 48 | QHBox *hbox = new QHBox( vbox ); |
47 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); | 49 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); |
48 | query_le = new QLineEdit( hbox ); | 50 | query_le = new QLineEdit( hbox ); |
49 | query_co = new QComboBox( hbox ); | 51 | query_co = new QComboBox( hbox ); |
52 | connect( query_co , SIGNAL( activated(int) ), this, SLOT( slotMethodChanged(int) ) ); | ||
50 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); | 53 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); |
51 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); | 54 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); |
52 | browser_top = new QTextBrowser( vbox ); | 55 | browser_top = new QTextBrowser( vbox ); |
53 | browser_bottom = new QTextBrowser( vbox ); | 56 | browser_bottom = new QTextBrowser( vbox ); |
54 | 57 | ||
55 | loadConfig(); | 58 | loadConfig(); |
56 | setCentralWidget( vbox ); | 59 | setCentralWidget( vbox ); |
57 | } | 60 | } |
58 | 61 | ||
59 | void ODict::loadConfig() | 62 | void ODict::loadConfig() |
60 | { | 63 | { |
61 | Config cfg ( "odict" ); | 64 | Config cfg ( "odict" ); |
62 | cfg.setGroup( "generalsettings" ); | 65 | cfg.setGroup( "generalsettings" ); |
63 | errorTol = cfg.readEntry( "errtol" ).toInt(); | 66 | errorTol = cfg.readEntry( "errtol" ).toInt(); |
64 | casesens = cfg.readEntry( "casesens" ).toInt(); | 67 | casesens = cfg.readEntry( "casesens" ).toInt(); |
65 | regexp = cfg.readEntry( "regexp" ).toInt(); | 68 | regexp = cfg.readEntry( "regexp" ).toInt(); |
66 | completewords = cfg.readEntry( "completewords" ).toInt(); | 69 | completewords = cfg.readEntry( "completewords" ).toInt(); |
67 | 70 | ||
68 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); | 71 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); |
69 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) | 72 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) |
70 | { | 73 | { |
71 | cfg.setGroup( *it ); | 74 | cfg.setGroup( *it ); |
72 | query_co->insertItem( cfg.readEntry( "Name" ) ); | 75 | query_co->insertItem( cfg.readEntry( "Name" ) ); |
73 | } | 76 | } |
74 | } | 77 | } |
75 | 78 | ||
76 | 79 | ||
77 | void ODict::saveConfig() | 80 | void ODict::saveConfig() |
78 | { | 81 | { |
79 | Config cfg ( "odict" ); | 82 | Config cfg ( "odict" ); |
80 | cfg.setGroup( "generalsettings" ); | 83 | cfg.setGroup( "generalsettings" ); |
81 | cfg.writeEntry( "errtol" , errorTol ); | 84 | cfg.writeEntry( "errtol" , errorTol ); |
82 | cfg.writeEntry( "casesens" , casesens ); | 85 | cfg.writeEntry( "casesens" , casesens ); |
83 | cfg.writeEntry( "regexp" , regexp ); | 86 | cfg.writeEntry( "regexp" , regexp ); |
84 | cfg.writeEntry( "completewords" , completewords ); | 87 | cfg.writeEntry( "completewords" , completewords ); |
85 | } | 88 | } |
86 | 89 | ||
87 | void ODict::slotDisplayAbout() | 90 | void ODict::slotDisplayAbout() |
88 | { | 91 | { |
89 | QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030103" ) ); | 92 | QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030103" ) ); |
90 | } | 93 | } |
91 | 94 | ||
92 | void ODict::slotStartQuery() | 95 | void ODict::slotStartQuery() |
93 | { | 96 | { |
94 | QString querystring = query_le->text(); | 97 | QString querystring = query_le->text(); |
95 | DingWidget *ding = new DingWidget( vbox , querystring , browser_top, browser_bottom); | 98 | DingWidget *ding = new DingWidget( vbox , querystring , browser_top, browser_bottom, activated_name); |
96 | } | 99 | } |
97 | 100 | ||
98 | 101 | ||
99 | void ODict::slotSetErrorcount( int count ) | 102 | void ODict::slotSetErrorcount( int count ) |
100 | { | 103 | { |
101 | errorTol = count; | 104 | errorTol = count; |
102 | } | 105 | } |
103 | 106 | ||
104 | void ODict::slotSettings() | 107 | void ODict::slotSettings() |
105 | { | 108 | { |
106 | ConfigDlg dlg( this, "Config" , true); | 109 | ConfigDlg dlg( this, "Config" , true); |
107 | if ( dlg.exec() == QDialog::Accepted ) | 110 | if ( dlg.exec() == QDialog::Accepted ) |
108 | dlg.writeEntries(); | 111 | dlg.writeEntries(); |
109 | else qDebug( "abgebrochen" ); | 112 | else qDebug( "abgebrochen" ); |
110 | } | 113 | } |
111 | 114 | ||
112 | void ODict::slotSetParameter( int count ) | 115 | void ODict::slotSetParameter( int count ) |
113 | { | 116 | { |
114 | if ( count == 0 ) | 117 | if ( count == 0 ) |
115 | { | 118 | { |
116 | if ( casesens ) | 119 | if ( casesens ) |
117 | casesens = false; | 120 | casesens = false; |
118 | else | 121 | else |
119 | casesens = true; | 122 | casesens = true; |
120 | } | 123 | } |
121 | 124 | ||
122 | if ( count == 1 ) | 125 | if ( count == 1 ) |
123 | { | 126 | { |
124 | if ( completewords ) | 127 | if ( completewords ) |
125 | completewords = false; | 128 | completewords = false; |
126 | else | 129 | else |
127 | completewords = true; | 130 | completewords = true; |
128 | } | 131 | } |
129 | if ( count == 2 ) | 132 | if ( count == 2 ) |
130 | { | 133 | { |
131 | if ( regexp ) | 134 | if ( regexp ) |
132 | regexp = false; | 135 | regexp = false; |
133 | else | 136 | else |
134 | regexp = true; | 137 | regexp = true; |
135 | } | 138 | } |
136 | else qWarning( "ERROR" ); | 139 | else qWarning( "ERROR" ); |
137 | } | 140 | } |
138 | 141 | ||
142 | void ODict::slotMethodChanged( int methodnumber ) | ||
143 | { | ||
144 | activated_name = query_co->currentText(); | ||
145 | } | ||
146 | |||
139 | void ODict::setupMenus() | 147 | void ODict::setupMenus() |
140 | { | 148 | { |
141 | menu = new QMenuBar( this ); | 149 | menu = new QMenuBar( this ); |
142 | 150 | ||
143 | settings = new QPopupMenu( menu ); | 151 | settings = new QPopupMenu( menu ); |
144 | setting_a = new QAction(tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); | 152 | setting_a = new QAction(tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); |
145 | connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 153 | connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
146 | setting_a->addTo( settings ); | 154 | setting_a->addTo( settings ); |
147 | setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); | 155 | setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); |
148 | 156 | ||
149 | parameter = new QPopupMenu( menu ); | 157 | parameter = new QPopupMenu( menu ); |
150 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); | 158 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); |
151 | parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); | 159 | parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); |
152 | parameter->insertItem( tr( "Only &complete Words" ), 1 , 1) ; | 160 | parameter->insertItem( tr( "Only &complete Words" ), 1 , 1) ; |
153 | parameter->insertItem( tr( "Allow ®. expressions" ), 2 ); | 161 | parameter->insertItem( tr( "Allow ®. expressions" ), 2 ); |
154 | parameter->insertSeparator(); | 162 | parameter->insertSeparator(); |
155 | error_tol_menu = new QPopupMenu( menu ); | 163 | error_tol_menu = new QPopupMenu( menu ); |
156 | error_tol_menu->setCheckable( TRUE ); | 164 | error_tol_menu->setCheckable( TRUE ); |
157 | connect( error_tol_menu, SIGNAL( activated( int ) ), this, SLOT( slotSetErrorcount( int ) ) ); | 165 | connect( error_tol_menu, SIGNAL( activated( int ) ), this, SLOT( slotSetErrorcount( int ) ) ); |
158 | 166 | ||
159 | error_tol_menu->insertItem( tr( "0 Errors" ), 0 ); | 167 | error_tol_menu->insertItem( tr( "0 Errors" ), 0 ); |
160 | error_tol_menu->insertItem( tr( "1 Errors" ), 1 ); | 168 | error_tol_menu->insertItem( tr( "1 Errors" ), 1 ); |
161 | error_tol_menu->insertItem( tr( "2 Errors" ), 2 ); | 169 | error_tol_menu->insertItem( tr( "2 Errors" ), 2 ); |
162 | error_tol_menu->insertItem( tr( "3 Errors" ), 3 ); | 170 | error_tol_menu->insertItem( tr( "3 Errors" ), 3 ); |
163 | error_tol_menu->insertItem( tr( "4 Errors" ), 4 ); | 171 | error_tol_menu->insertItem( tr( "4 Errors" ), 4 ); |
164 | error_tol_menu->insertItem( tr( "Until Hit" ), 5 ); | 172 | error_tol_menu->insertItem( tr( "Until Hit" ), 5 ); |
165 | parameter->insertItem( tr( "&Error tolerance" ), error_tol_menu ); | 173 | parameter->insertItem( tr( "&Error tolerance" ), error_tol_menu ); |
166 | 174 | ||
167 | help = new QPopupMenu( menu ); | 175 | help = new QPopupMenu( menu ); |
168 | help->insertItem("&About",this,SLOT( slotDisplayAbout() )); | 176 | help->insertItem("&About",this,SLOT( slotDisplayAbout() )); |
169 | 177 | ||
170 | menu->insertItem( tr( "Settings" ) , settings ); | 178 | menu->insertItem( tr( "Settings" ) , settings ); |
171 | menu->insertItem( tr( "Parameter" ) , parameter ); | 179 | menu->insertItem( tr( "Parameter" ) , parameter ); |
172 | menu->insertItem( tr( "Help" ) , help ); | 180 | menu->insertItem( tr( "Help" ) , help ); |
173 | } | 181 | } |
diff --git a/noncore/apps/odict/odict.h b/noncore/apps/odict/odict.h index 7c1f32f..5096c5e 100644 --- a/noncore/apps/odict/odict.h +++ b/noncore/apps/odict/odict.h | |||
@@ -1,63 +1,66 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 6 | * ( at your option ) any later version. * |
7 | * * | 7 | * * |
8 | **************************************************************************/ | 8 | **************************************************************************/ |
9 | 9 | ||
10 | #include <qmainwindow.h> | 10 | #include <qmainwindow.h> |
11 | 11 | ||
12 | class QVBox; | 12 | class QVBox; |
13 | class QPopupMenu; | 13 | class QPopupMenu; |
14 | class QMenuBar; | 14 | class QMenuBar; |
15 | class QHBox; | 15 | class QHBox; |
16 | class QPushButton; | 16 | class QPushButton; |
17 | class QLineEdit; | 17 | class QLineEdit; |
18 | class QAction; | 18 | class QAction; |
19 | class QVBoxLayout; | 19 | class QVBoxLayout; |
20 | class QActionGroup; | 20 | class QActionGroup; |
21 | class DingWidget; | 21 | class DingWidget; |
22 | class QTextBrowser; | 22 | class QTextBrowser; |
23 | class QComboBox; | 23 | class QComboBox; |
24 | 24 | ||
25 | class ODict : public QMainWindow | 25 | class ODict : public QMainWindow |
26 | { | 26 | { |
27 | Q_OBJECT | 27 | Q_OBJECT |
28 | 28 | ||
29 | public: | 29 | public: |
30 | ODict(); | 30 | ODict(); |
31 | QVBox *vbox; | 31 | QVBox *vbox; |
32 | QTextBrowser *browser_top, | 32 | QTextBrowser *browser_top, |
33 | *browser_bottom; | 33 | *browser_bottom; |
34 | 34 | ||
35 | private: | 35 | private: |
36 | QPopupMenu *help, *settings, *parameter, *error_tol_menu; | 36 | QPopupMenu *help, *settings, *parameter, *error_tol_menu; |
37 | QMenuBar *menu; | 37 | QMenuBar *menu; |
38 | QHBox *hbox; | 38 | QHBox *hbox; |
39 | QLineEdit *query_le; | 39 | QLineEdit *query_le; |
40 | QComboBox *query_co; | 40 | QComboBox *query_co; |
41 | QPushButton *ok_button; | 41 | QPushButton *ok_button; |
42 | 42 | ||
43 | QVBoxLayout *vbox_layout; | 43 | QVBoxLayout *vbox_layout; |
44 | 44 | ||
45 | QAction *setting_a, *setting_b; | 45 | QAction *setting_a, *setting_b; |
46 | 46 | ||
47 | //DingWidget *ding; | 47 | DingWidget *ding; |
48 | 48 | ||
49 | void setupMenus(); | 49 | void setupMenus(); |
50 | 50 | ||
51 | int errorTol; | 51 | int errorTol; |
52 | bool casesens, completewords, regexp; | 52 | bool casesens, completewords, regexp; |
53 | 53 | ||
54 | void loadConfig(); | 54 | void loadConfig(); |
55 | void saveConfig(); | 55 | void saveConfig(); |
56 | |||
57 | QString activated_name; | ||
56 | 58 | ||
57 | private slots: | 59 | private slots: |
58 | void slotDisplayAbout(); | 60 | void slotDisplayAbout(); |
59 | void slotStartQuery(); | 61 | void slotStartQuery(); |
60 | void slotSetErrorcount( int ); | 62 | void slotSetErrorcount( int ); |
61 | void slotSettings(); | 63 | void slotSettings(); |
62 | void slotSetParameter( int ); | 64 | void slotSetParameter( int ); |
65 | void slotMethodChanged( int ); | ||
63 | }; | 66 | }; |