author | mickeyl <mickeyl> | 2003-10-27 19:51:32 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-27 19:51:32 (UTC) |
commit | 951d1d4125a80dc814f95d2956853bf53ca52e9a (patch) (side-by-side diff) | |
tree | 46c7a70b80a7eebb54cd59c46204c28335f3821c /noncore/apps/odict | |
parent | f0a15a9866f9eddfe10596e63a1e6300b92b9e3f (diff) | |
download | opie-951d1d4125a80dc814f95d2956853bf53ca52e9a.zip opie-951d1d4125a80dc814f95d2956853bf53ca52e9a.tar.gz opie-951d1d4125a80dc814f95d2956853bf53ca52e9a.tar.bz2 |
merge noncore/apps/* except
- advancedfm (ljp, please...)
- odict (tille, please...)
-rw-r--r-- | noncore/apps/odict/main.cpp | 11 | ||||
-rw-r--r-- | noncore/apps/odict/odict.cpp | 34 | ||||
-rw-r--r-- | noncore/apps/odict/odict.h | 4 | ||||
-rw-r--r-- | noncore/apps/odict/odict.pro | 5 |
4 files changed, 23 insertions, 31 deletions
diff --git a/noncore/apps/odict/main.cpp b/noncore/apps/odict/main.cpp index c68253f..0642022 100644 --- a/noncore/apps/odict/main.cpp +++ b/noncore/apps/odict/main.cpp @@ -8,22 +8,17 @@ /*************************************************************************** * * * 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 <qpe/qpeapplication.h> +#include <opie/oapplicationfactory.h> #include "odict.h" -int main(int argc, char **argv) -{ - QPEApplication app(argc, argv); - ODict *odict= new ODict(); - app.setMainWidget(odict); - odict->showMaximized(); - return app.exec(); -} + +OPIE_EXPORT_APP( OApplicationFactory<ODict> ) diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 010545e..9718c5c 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp @@ -27,68 +27,68 @@ #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> #include <qpe/config.h> -ODict::ODict() : QMainWindow() +ODict::ODict(QWidget* parent, const char* name, WFlags fl ) : QMainWindow(parent, name, fl ) { activated_name = QString::null; - + vbox = new QVBox( this ); setCaption( tr( "Opie-Dictionary" ) ); setupMenus(); QHBox *hbox = new QHBox( vbox ); - QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); + QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); query_le = new QLineEdit( hbox ); query_co = new QComboBox( hbox ); connect( query_co , SIGNAL( activated(const QString&) ), this, SLOT( slotMethodChanged(const QString&) ) ); ok_button = new QPushButton( tr( "&Ok" ), hbox ); connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); - + top_name = new QLabel( vbox ); top_name->setAlignment( AlignHCenter ); browser_top = new QTextBrowser( vbox ); bottom_name = new QLabel( vbox ); bottom_name->setAlignment( AlignHCenter ); browser_bottom = new QTextBrowser( vbox ); ding = new DingWidget(); loadConfig(); setCentralWidget( vbox ); } void ODict::loadConfig() { /* * the name of the last used dictionary */ QString lastname; - + Config cfg ( "odict" ); cfg.setGroup( "generalsettings" ); casesens = cfg.readEntry( "casesens" ).toInt(); QString lastDict = cfg.readEntry( "lastdict" ); int i = 0, e = 0; - + QStringList groupListCfg = cfg.groupList().grep( "Method_" ); query_co->clear(); for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) { QString name; cfg.setGroup( *it ); name = cfg.readEntry( "Name" ); query_co->insertItem( name ); /* * this check is to look up what dictionary has been used the * last time @@ -108,65 +108,65 @@ void ODict::loadConfig() ding->loadDict( lastname ); ding->loadValues(); query_co->setCurrentItem( e ); top_name->setText( top_name_content ); bottom_name->setText( bottom_name_content ); } void ODict::lookupLanguageNames( QString dictname ) { Config cfg ( "odict" ); cfg.setGroup( "Method_"+dictname ); - top_name_content = cfg.readEntry( "Lang1" ); - bottom_name_content = cfg.readEntry( "Lang2" ); + top_name_content = cfg.readEntry( "Lang1" ); + bottom_name_content = cfg.readEntry( "Lang2" ); } void ODict::saveConfig() { Config cfg ( "odict" ); cfg.setGroup( "generalsettings" ); cfg.writeEntry( "casesens" , casesens ); cfg.writeEntry( "lastdict" , query_co->currentText() ); } void ODict::slotStartQuery() { QString querystring = query_le->text(); if ( !querystring.isEmpty() ) { /* * if the user has not yet defined a dictionary */ if ( !query_co->currentText() ) { switch ( QMessageBox::information( this, tr( "OPIE-Dictionary" ), tr( "No dictionary defined" ), - tr( "&Define one" ), + tr( "&Define one" ), tr( "&Cancel" ), 0, // Define a dict 1 ) ) // Cancel choosen - { + { case 0: slotSettings(); break; case 1: // stop here return; } - } + } /* * ok, the user has defined a dict */ - ding->setCaseSensitive( casesens ); + ding->setCaseSensitive( casesens ); BroswerContent test = ding->setText( querystring ); browser_top->setText( test.top ); browser_bottom->setText( test.bottom ); } } void ODict::slotSettings() { ConfigDlg dlg( this, "Config" , true); if ( dlg.exec() == QDialog::Accepted ) @@ -180,41 +180,41 @@ void ODict::slotSetParameter( int count ) if ( casesens ) casesens = false; else casesens = true; } saveConfig(); } void ODict::slotMethodChanged( const QString& methodnumber ) { activated_name = methodnumber; - + if ( activated_name != ding->loadedDict() ) { ding->loadDict(activated_name); - + lookupLanguageNames( activated_name ); top_name->setText( top_name_content ); bottom_name->setText( bottom_name_content ); } } void ODict::setupMenus() { menu = new QMenuBar( this ); - + settings = new QPopupMenu( menu ); setting_a = new QAction(tr( "Configuration" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); setting_a->addTo( settings ); setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); - + parameter = new QPopupMenu( menu ); connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); parameter->insertSeparator(); - + menu->insertItem( tr( "Settings" ) , settings ); menu->insertItem( tr( "Parameter" ) , parameter ); } diff --git a/noncore/apps/odict/odict.h b/noncore/apps/odict/odict.h index be2a532..68a8f95 100644 --- a/noncore/apps/odict/odict.h +++ b/noncore/apps/odict/odict.h @@ -20,30 +20,30 @@ class QAction; class QVBoxLayout; class QActionGroup; class DingWidget; class QTextBrowser; class QComboBox; class DingWidget; class ODict : public QMainWindow { Q_OBJECT public: - ODict(); + ODict(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); QVBox *vbox; QTextBrowser *browser_top, *browser_bottom; DingWidget *ding; - + static QString appName() { return QString::fromLatin1("odict"); } private: QPopupMenu *help, *settings, *parameter; QMenuBar *menu; QHBox *hbox; QLineEdit *query_le; QComboBox *query_co; QPushButton *ok_button; QVBoxLayout *vbox_layout; QAction *setting_a, *setting_b; diff --git a/noncore/apps/odict/odict.pro b/noncore/apps/odict/odict.pro index 82f6a41..4ad287b 100644 --- a/noncore/apps/odict/odict.pro +++ b/noncore/apps/odict/odict.pro @@ -1,30 +1,27 @@ -TEMPLATE = app -CONFIG = qt warn_on debug -#CONFIG = qt warn_on release +CONFIG = qt warn_on release quick-app HEADERS = odict.h \ searchmethoddlg.h \ configdlg.h \ dingwidget.h SOURCES = main.cpp \ odict.cpp \ searchmethoddlg.cpp \ configdlg.cpp \ dingwidget.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lstdc++ -lopie TARGET = odict -DESTDIR = $(OPIEDIR)/bin TRANSLATIONS = ../../../i18n/de/odict.ts \ ../../../i18n/nl/odict.ts \ ../../../i18n/xx/odict.ts \ ../../../i18n/en/odict.ts \ ../../../i18n/es/odict.ts \ ../../../i18n/fr/odict.ts \ ../../../i18n/hu/odict.ts \ ../../../i18n/ja/odict.ts \ ../../../i18n/ko/odict.ts \ ../../../i18n/no/odict.ts \ ../../../i18n/pl/odict.ts \ |