mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14: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\
|
||||
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 \
|
||||
|
|
|
@ -10,11 +10,13 @@
|
|||
#include "lsa.hh"
|
||||
#include "dsl.hh"
|
||||
#include "dictlock.hh"
|
||||
#include "ui_about.h"
|
||||
#include <QDir>
|
||||
#include <QMessageBox>
|
||||
#include <QIcon>
|
||||
#include <QToolBar>
|
||||
#include <QCloseEvent>
|
||||
#include <QDesktopServices>
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -260,7 +260,8 @@
|
|||
<property name="title">
|
||||
<string>&Help</string>
|
||||
</property>
|
||||
<addaction name="openWebsite"/>
|
||||
<addaction name="visitHomepage"/>
|
||||
<addaction name="visitForum"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="about"/>
|
||||
</widget>
|
||||
|
@ -289,9 +290,9 @@
|
|||
<string>&Preferences...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="openWebsite">
|
||||
<action name="visitHomepage">
|
||||
<property name="text">
|
||||
<string>Program's &website</string>
|
||||
<string>&Homepage</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="about">
|
||||
|
@ -304,6 +305,11 @@
|
|||
<string>&Quit</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="visitForum">
|
||||
<property name="text">
|
||||
<string>&Forum</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
Loading…
Reference in a new issue