diff --git a/src/about.ui b/src/about.ui new file mode 100644 index 00000000..5ccd2f89 --- /dev/null +++ b/src/about.ui @@ -0,0 +1,139 @@ + + + About + + + Qt::NonModal + + + + 0 + 0 + 400 + 123 + + + + About + + + true + + + + + + + + + + + :/icons/programicon.png + + + Qt::AlignCenter + + + + + + + + + GoldenDict dictionary lookup progam, version 0.5 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + (c) 2008-2009 Konstantin Isakov <ikm@users.berlios.de> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Licensed under GPLv3 or later + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + true + + + + + + + + + + + buttonBox + accepted() + About + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + About + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/goldendict.pro b/src/goldendict.pro index e6abb69c..f3d4c5d6 100644 --- a/src/goldendict.pro +++ b/src/goldendict.pro @@ -70,7 +70,8 @@ HEADERS += folding.hh \ FORMS += groups.ui dictgroupwidget.ui mainwindow.ui sources.ui initializing.ui\ - groupselectorwidget.ui scanpopup.ui articleview.ui preferences.ui + groupselectorwidget.ui scanpopup.ui articleview.ui preferences.ui\ + about.ui SOURCES += folding.cc main.cc dictionary.cc md5.c config.cc sources.cc \ mainwindow.cc utf8.cc file.cc bgl_babylon.cc bgl.cc initializing.cc \ diff --git a/src/mainwindow.cc b/src/mainwindow.cc index e3907350..a9ff611d 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -10,11 +10,13 @@ #include "lsa.hh" #include "dsl.hh" #include "dictlock.hh" +#include "ui_about.h" #include #include #include #include #include +#include #include #include @@ -80,16 +82,29 @@ MainWindow::MainWindow(): connect( ui.preferences, SIGNAL( activated() ), this, SLOT( editPreferences() ) ); + + connect( ui.visitHomepage, SIGNAL( activated() ), + this, SLOT( visitHomepage() ) ); + connect( ui.visitForum, SIGNAL( activated() ), + this, SLOT( visitForum() ) ); + connect( ui.about, SIGNAL( activated() ), + this, SLOT( showAbout() ) ); connect( ui.groupList, SIGNAL( currentIndexChanged( QString const & ) ), this, SLOT( currentGroupChanged( QString const & ) ) ); connect( ui.translateLine, SIGNAL( textChanged( QString const & ) ), this, SLOT( translateInputChanged( QString const & ) ) ); + + connect( ui.translateLine, SIGNAL( returnPressed() ), + this, SLOT( translateInputFinished() ) ); connect( ui.wordList, SIGNAL( itemActivated( QListWidgetItem * ) ), this, SLOT( wordListItemActivated( QListWidgetItem * ) ) ); - + + connect( ui.wordList, SIGNAL( itemSelectionChanged() ), + this, SLOT( wordListSelectionChanged() ) ); + connect( wordFinder.qobject(), SIGNAL( prefixMatchComplete( WordFinderResults ) ), this, SLOT( prefixMatchComplete( WordFinderResults ) ) ); @@ -493,6 +508,12 @@ void MainWindow::translateInputChanged( QString const & newValue ) wordFinder.prefixMatch( req, &getActiveDicts() ); } +void MainWindow::translateInputFinished() +{ + if ( ui.wordList->count() ) + wordListItemActivated( ui.wordList->item( 0 ) ); +} + void MainWindow::prefixMatchComplete( WordFinderResults r ) { if ( r.requestStr != ui.translateLine->text().trimmed() || @@ -538,11 +559,17 @@ void MainWindow::prefixMatchComplete( WordFinderResults r ) void MainWindow::wordListItemActivated( QListWidgetItem * item ) { - printf( "act: %s\n", item->text().toLocal8Bit().data() ); - showTranslationFor( item->text() ); } +void MainWindow::wordListSelectionChanged() +{ + QList< QListWidgetItem * > selected = ui.wordList->selectedItems(); + + if ( selected.size() ) + wordListItemActivated( selected.front() ); +} + void MainWindow::showTranslationFor( QString const & inWord ) { ArticleView & view = @@ -654,3 +681,25 @@ void MainWindow::trayIconActivated( QSystemTrayIcon::ActivationReason ) hide(); } +void MainWindow::visitHomepage() +{ + QDesktopServices::openUrl( QUrl( "http://goldendict.berlios.de/" ) ); +} + +void MainWindow::visitForum() +{ + QDesktopServices::openUrl( QUrl( "http://goldendict.berlios.de/forum/" ) ); +} + +void MainWindow::showAbout() +{ + QDialog about( this ); + + Ui::About ui; + + ui.setupUi( &about ); + + about.show(); + about.exec(); +} + diff --git a/src/mainwindow.hh b/src/mainwindow.hh index 3d28b10b..e1b45e8b 100644 --- a/src/mainwindow.hh +++ b/src/mainwindow.hh @@ -116,12 +116,18 @@ private slots: void currentGroupChanged( QString const & ); void translateInputChanged( QString const & ); + void translateInputFinished(); void prefixMatchComplete( WordFinderResults ); void wordListItemActivated( QListWidgetItem * ); + void wordListSelectionChanged(); void showTranslationFor( QString const & ); void trayIconActivated( QSystemTrayIcon::ActivationReason ); + + void visitHomepage(); + void visitForum(); + void showAbout(); }; #endif diff --git a/src/mainwindow.ui b/src/mainwindow.ui index b8399156..d4b2ac2c 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -260,7 +260,8 @@ &Help - + + @@ -289,9 +290,9 @@ &Preferences... - + - Program's &website + &Homepage @@ -304,6 +305,11 @@ &Quit + + + &Forum + +