mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
+ Help menu implemented.
+ Translations are shown whenever user presses enter or clicks a word in list.
This commit is contained in:
parent
61943519c1
commit
d917ae8896
139
src/about.ui
Normal file
139
src/about.ui
Normal file
|
@ -0,0 +1,139 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>About</class>
|
||||||
|
<widget class="QDialog" name="About">
|
||||||
|
<property name="windowModality">
|
||||||
|
<enum>Qt::NonModal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>123</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>About</string>
|
||||||
|
</property>
|
||||||
|
<property name="modal">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="resources.qrc">:/icons/programicon.png</pixmap>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>GoldenDict dictionary lookup progam, version 0.5</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>(c) 2008-2009 Konstantin Isakov <ikm@users.berlios.de></string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Licensed under GPLv3 or later</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
<property name="centerButtons">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="resources.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>About</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>About</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
|
@ -70,7 +70,8 @@ HEADERS += folding.hh \
|
||||||
|
|
||||||
|
|
||||||
FORMS += groups.ui dictgroupwidget.ui mainwindow.ui sources.ui initializing.ui\
|
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 \
|
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 \
|
mainwindow.cc utf8.cc file.cc bgl_babylon.cc bgl.cc initializing.cc \
|
||||||
|
|
|
@ -10,11 +10,13 @@
|
||||||
#include "lsa.hh"
|
#include "lsa.hh"
|
||||||
#include "dsl.hh"
|
#include "dsl.hh"
|
||||||
#include "dictlock.hh"
|
#include "dictlock.hh"
|
||||||
|
#include "ui_about.h"
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
|
#include <QDesktopServices>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
@ -80,16 +82,29 @@ MainWindow::MainWindow():
|
||||||
|
|
||||||
connect( ui.preferences, SIGNAL( activated() ),
|
connect( ui.preferences, SIGNAL( activated() ),
|
||||||
this, SLOT( editPreferences() ) );
|
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 & ) ),
|
connect( ui.groupList, SIGNAL( currentIndexChanged( QString const & ) ),
|
||||||
this, SLOT( currentGroupChanged( QString const & ) ) );
|
this, SLOT( currentGroupChanged( QString const & ) ) );
|
||||||
|
|
||||||
connect( ui.translateLine, SIGNAL( textChanged( QString const & ) ),
|
connect( ui.translateLine, SIGNAL( textChanged( QString const & ) ),
|
||||||
this, SLOT( translateInputChanged( QString const & ) ) );
|
this, SLOT( translateInputChanged( QString const & ) ) );
|
||||||
|
|
||||||
|
connect( ui.translateLine, SIGNAL( returnPressed() ),
|
||||||
|
this, SLOT( translateInputFinished() ) );
|
||||||
|
|
||||||
connect( ui.wordList, SIGNAL( itemActivated( QListWidgetItem * ) ),
|
connect( ui.wordList, SIGNAL( itemActivated( QListWidgetItem * ) ),
|
||||||
this, SLOT( wordListItemActivated( QListWidgetItem * ) ) );
|
this, SLOT( wordListItemActivated( QListWidgetItem * ) ) );
|
||||||
|
|
||||||
|
connect( ui.wordList, SIGNAL( itemSelectionChanged() ),
|
||||||
|
this, SLOT( wordListSelectionChanged() ) );
|
||||||
|
|
||||||
connect( wordFinder.qobject(), SIGNAL( prefixMatchComplete( WordFinderResults ) ),
|
connect( wordFinder.qobject(), SIGNAL( prefixMatchComplete( WordFinderResults ) ),
|
||||||
this, SLOT( prefixMatchComplete( WordFinderResults ) ) );
|
this, SLOT( prefixMatchComplete( WordFinderResults ) ) );
|
||||||
|
|
||||||
|
@ -493,6 +508,12 @@ void MainWindow::translateInputChanged( QString const & newValue )
|
||||||
wordFinder.prefixMatch( req, &getActiveDicts() );
|
wordFinder.prefixMatch( req, &getActiveDicts() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::translateInputFinished()
|
||||||
|
{
|
||||||
|
if ( ui.wordList->count() )
|
||||||
|
wordListItemActivated( ui.wordList->item( 0 ) );
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::prefixMatchComplete( WordFinderResults r )
|
void MainWindow::prefixMatchComplete( WordFinderResults r )
|
||||||
{
|
{
|
||||||
if ( r.requestStr != ui.translateLine->text().trimmed() ||
|
if ( r.requestStr != ui.translateLine->text().trimmed() ||
|
||||||
|
@ -538,11 +559,17 @@ void MainWindow::prefixMatchComplete( WordFinderResults r )
|
||||||
|
|
||||||
void MainWindow::wordListItemActivated( QListWidgetItem * item )
|
void MainWindow::wordListItemActivated( QListWidgetItem * item )
|
||||||
{
|
{
|
||||||
printf( "act: %s\n", item->text().toLocal8Bit().data() );
|
|
||||||
|
|
||||||
showTranslationFor( item->text() );
|
showTranslationFor( item->text() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::wordListSelectionChanged()
|
||||||
|
{
|
||||||
|
QList< QListWidgetItem * > selected = ui.wordList->selectedItems();
|
||||||
|
|
||||||
|
if ( selected.size() )
|
||||||
|
wordListItemActivated( selected.front() );
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::showTranslationFor( QString const & inWord )
|
void MainWindow::showTranslationFor( QString const & inWord )
|
||||||
{
|
{
|
||||||
ArticleView & view =
|
ArticleView & view =
|
||||||
|
@ -654,3 +681,25 @@ void MainWindow::trayIconActivated( QSystemTrayIcon::ActivationReason )
|
||||||
hide();
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,12 +116,18 @@ private slots:
|
||||||
|
|
||||||
void currentGroupChanged( QString const & );
|
void currentGroupChanged( QString const & );
|
||||||
void translateInputChanged( QString const & );
|
void translateInputChanged( QString const & );
|
||||||
|
void translateInputFinished();
|
||||||
void prefixMatchComplete( WordFinderResults );
|
void prefixMatchComplete( WordFinderResults );
|
||||||
void wordListItemActivated( QListWidgetItem * );
|
void wordListItemActivated( QListWidgetItem * );
|
||||||
|
void wordListSelectionChanged();
|
||||||
|
|
||||||
void showTranslationFor( QString const & );
|
void showTranslationFor( QString const & );
|
||||||
|
|
||||||
void trayIconActivated( QSystemTrayIcon::ActivationReason );
|
void trayIconActivated( QSystemTrayIcon::ActivationReason );
|
||||||
|
|
||||||
|
void visitHomepage();
|
||||||
|
void visitForum();
|
||||||
|
void showAbout();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -260,7 +260,8 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&Help</string>
|
<string>&Help</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="openWebsite"/>
|
<addaction name="visitHomepage"/>
|
||||||
|
<addaction name="visitForum"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="about"/>
|
<addaction name="about"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -289,9 +290,9 @@
|
||||||
<string>&Preferences...</string>
|
<string>&Preferences...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="openWebsite">
|
<action name="visitHomepage">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Program's &website</string>
|
<string>&Homepage</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="about">
|
<action name="about">
|
||||||
|
@ -304,6 +305,11 @@
|
||||||
<string>&Quit</string>
|
<string>&Quit</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="visitForum">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Forum</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
Loading…
Reference in a new issue