mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
some polishing of zooming routines
This commit is contained in:
parent
cc1a083493
commit
c8e4e76254
|
@ -357,13 +357,7 @@ Class load() throw( exError )
|
||||||
c.preferences.autoStart = ( preferences.namedItem( "autoStart" ).toElement().text() == "1" );
|
c.preferences.autoStart = ( preferences.namedItem( "autoStart" ).toElement().text() == "1" );
|
||||||
|
|
||||||
if ( !preferences.namedItem( "zoomFactor" ).isNull() )
|
if ( !preferences.namedItem( "zoomFactor" ).isNull() )
|
||||||
{
|
|
||||||
c.preferences.zoomFactor = preferences.namedItem( "zoomFactor" ).toElement().text().toDouble();
|
c.preferences.zoomFactor = preferences.namedItem( "zoomFactor" ).toElement().text().toDouble();
|
||||||
if ( c.preferences.zoomFactor < 0.5 )
|
|
||||||
c.preferences.zoomFactor = 0.5;
|
|
||||||
else if ( c.preferences.zoomFactor > 5 )
|
|
||||||
c.preferences.zoomFactor = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
applyBoolOption( c.preferences.enableMainWindowHotkey, preferences.namedItem( "enableMainWindowHotkey" ) );
|
applyBoolOption( c.preferences.enableMainWindowHotkey, preferences.namedItem( "enableMainWindowHotkey" ) );
|
||||||
if ( !preferences.namedItem( "mainWindowHotkey" ).isNull() )
|
if ( !preferences.namedItem( "mainWindowHotkey" ).isNull() )
|
||||||
|
|
|
@ -241,6 +241,9 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
||||||
|
|
||||||
updateTrayIcon();
|
updateTrayIcon();
|
||||||
|
|
||||||
|
// Update zoomers
|
||||||
|
applyZoomFactor();
|
||||||
|
|
||||||
// Update autostart info
|
// Update autostart info
|
||||||
setAutostart(cfg.preferences.autoStart);
|
setAutostart(cfg.preferences.autoStart);
|
||||||
|
|
||||||
|
@ -1217,18 +1220,12 @@ void MainWindow::on_actionCloseToTray_activated()
|
||||||
|
|
||||||
void MainWindow::zoomin()
|
void MainWindow::zoomin()
|
||||||
{
|
{
|
||||||
if ( cfg.preferences.zoomFactor >= 5 )
|
|
||||||
return; // 5x is maximum
|
|
||||||
|
|
||||||
cfg.preferences.zoomFactor += 0.1;
|
cfg.preferences.zoomFactor += 0.1;
|
||||||
applyZoomFactor();
|
applyZoomFactor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::zoomout()
|
void MainWindow::zoomout()
|
||||||
{
|
{
|
||||||
if ( cfg.preferences.zoomFactor <= 0.5 )
|
|
||||||
return; // 0.5x is minimum
|
|
||||||
|
|
||||||
cfg.preferences.zoomFactor -= 0.1;
|
cfg.preferences.zoomFactor -= 0.1;
|
||||||
applyZoomFactor();
|
applyZoomFactor();
|
||||||
}
|
}
|
||||||
|
@ -1241,6 +1238,15 @@ void MainWindow::unzoom()
|
||||||
|
|
||||||
void MainWindow::applyZoomFactor()
|
void MainWindow::applyZoomFactor()
|
||||||
{
|
{
|
||||||
|
if ( cfg.preferences.zoomFactor >= 3 )
|
||||||
|
cfg.preferences.zoomFactor = 3;
|
||||||
|
else if ( cfg.preferences.zoomFactor <= 0.8 )
|
||||||
|
cfg.preferences.zoomFactor = 0.8;
|
||||||
|
|
||||||
|
zoomIn->setEnabled( cfg.preferences.zoomFactor < 3 );
|
||||||
|
zoomOut->setEnabled( cfg.preferences.zoomFactor > 0.8 );
|
||||||
|
zoomBase->setEnabled( cfg.preferences.zoomFactor != 1.0 );
|
||||||
|
|
||||||
for ( int i = 0; i < ui.tabWidget->count(); i++ )
|
for ( int i = 0; i < ui.tabWidget->count(); i++ )
|
||||||
{
|
{
|
||||||
ArticleView & view =
|
ArticleView & view =
|
||||||
|
|
Loading…
Reference in a new issue