some polishing of zooming routines

This commit is contained in:
ars_goldendict 2009-04-30 22:09:04 +00:00
parent cc1a083493
commit c8e4e76254
2 changed files with 12 additions and 12 deletions

View file

@ -357,13 +357,7 @@ Class load() throw( exError )
c.preferences.autoStart = ( preferences.namedItem( "autoStart" ).toElement().text() == "1" );
if ( !preferences.namedItem( "zoomFactor" ).isNull() )
{
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" ) );
if ( !preferences.namedItem( "mainWindowHotkey" ).isNull() )

View file

@ -241,6 +241,9 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
updateTrayIcon();
// Update zoomers
applyZoomFactor();
// Update autostart info
setAutostart(cfg.preferences.autoStart);
@ -1217,18 +1220,12 @@ void MainWindow::on_actionCloseToTray_activated()
void MainWindow::zoomin()
{
if ( cfg.preferences.zoomFactor >= 5 )
return; // 5x is maximum
cfg.preferences.zoomFactor += 0.1;
applyZoomFactor();
}
void MainWindow::zoomout()
{
if ( cfg.preferences.zoomFactor <= 0.5 )
return; // 0.5x is minimum
cfg.preferences.zoomFactor -= 0.1;
applyZoomFactor();
}
@ -1241,6 +1238,15 @@ void MainWindow::unzoom()
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++ )
{
ArticleView & view =