"Back" and "Forward" buttons in scan popup window

This commit is contained in:
Abs62 2012-12-24 16:59:46 +04:00
parent da13998518
commit 4c8b12b9af
3 changed files with 53 additions and 0 deletions

View file

@ -207,6 +207,9 @@ ScanPopup::ScanPopup( QWidget * parent,
this, SLOT(mouseGrabPoll()) ); this, SLOT(mouseGrabPoll()) );
MouseOver::instance().setPreferencesPtr( &( cfg.preferences ) ); MouseOver::instance().setPreferencesPtr( &( cfg.preferences ) );
ui.goBackButton->setEnabled( false );
ui.goForwardButton->setEnabled( false );
} }
ScanPopup::~ScanPopup() ScanPopup::~ScanPopup()
@ -785,6 +788,8 @@ void ScanPopup::pageLoaded( ArticleView * )
{ {
ui.pronounceButton->setVisible( definition->hasSound() ); ui.pronounceButton->setVisible( definition->hasSound() );
updateBackForwardButtons();
if ( cfg.preferences.pronounceOnLoadPopup ) if ( cfg.preferences.pronounceOnLoadPopup )
definition->playSound(); definition->playSound();
} }
@ -888,3 +893,19 @@ void ScanPopup::switchExpandOptionalPartsMode()
if( isVisible() ) if( isVisible() )
emit switchExpandMode(); emit switchExpandMode();
} }
void ScanPopup::updateBackForwardButtons()
{
ui.goBackButton->setEnabled(definition->canGoBack());
ui.goForwardButton->setEnabled(definition->canGoForward());
}
void ScanPopup::on_goBackButton_clicked()
{
definition->back();
}
void ScanPopup::on_goForwardButton_clicked()
{
definition->forward();
}

View file

@ -143,6 +143,8 @@ private:
/// Returns inputWord, chopped with appended ... if it's too long/ /// Returns inputWord, chopped with appended ... if it's too long/
QString elideInputWord(); QString elideInputWord();
void updateBackForwardButtons();
private slots: private slots:
void clipboardChanged( QClipboard::Mode ); void clipboardChanged( QClipboard::Mode );
@ -155,6 +157,8 @@ private slots:
void on_showDictionaryBar_clicked( bool checked ); void on_showDictionaryBar_clicked( bool checked );
void showStatusBarMessage ( QString const &, int, QPixmap const & ); void showStatusBarMessage ( QString const &, int, QPixmap const & );
void on_sendWordButton_clicked(); void on_sendWordButton_clicked();
void on_goBackButton_clicked();
void on_goForwardButton_clicked();
void hideTimerExpired(); void hideTimerExpired();
void altModeExpired(); void altModeExpired();

View file

@ -61,6 +61,34 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QToolButton" name="goBackButton">
<property name="toolTip">
<string>Back</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/previous.png</normaloff>:/icons/previous.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="goForwardButton">
<property name="toolTip">
<string>Forward</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/next.png</normaloff>:/icons/next.png</iconset>
</property>
</widget>
</item>
<item> <item>
<widget class="QToolButton" name="wordListButton"> <widget class="QToolButton" name="wordListButton">
<property name="toolTip"> <property name="toolTip">