Skip to content
Permalink
Browse files
change qsettings in qgsoptions, not qgsapplication
  • Loading branch information
etiennesky committed May 17, 2014
1 parent e879a8b commit a4e974a3384714c785d548658dbf445501607548
Showing with 9 additions and 11 deletions.
  1. +3 −4 src/app/qgsoptions.cpp
  2. +6 −7 src/core/qgsapplication.cpp
@@ -1076,10 +1076,9 @@ void QgsOptions::saveOptions()
settings.setValue( "/qgis/enable_anti_aliasing", chkAntiAliasing->isChecked() );
settings.setValue( "/qgis/enable_render_caching", chkUseRenderCaching->isChecked() );
settings.setValue( "/qgis/parallel_rendering", chkParallelRendering->isChecked() );
if ( chkMaxThreads->isChecked() )
QgsApplication::setMaxThreads( spinMaxThreads->value() );
else
QgsApplication::setMaxThreads( -1 );
int maxThreads = chkMaxThreads->isChecked() ? spinMaxThreads->value() : -1;
QgsApplication::setMaxThreads( maxThreads );
settings.setValue( "/qgis/max_threads", maxThreads );

settings.setValue( "/qgis/map_update_interval", spinMapUpdateInterval->value() );
settings.setValue( "/qgis/legendDoubleClickAction", cmbLegendDoubleClickAction->currentIndex() );
@@ -1023,25 +1023,24 @@ bool QgsApplication::createDB( QString *errorMessage )
return true;
}

void QgsApplication::setMaxThreads( int maxThreads )
{
qDebug("max threads: %d",maxThreads);
void QgsApplication::setMaxThreads( int maxThreads )
{
QgsDebugMsg( QString( "maxThreads: %1" ).arg( maxThreads ) );

// make sure value is between 1 and #cores, if not set to -1 (use #cores)
// 0 could be used to disable any parallel processing
if ( maxThreads < 1 || maxThreads > QThread::idealThreadCount() )
maxThreads = -1;
maxThreads = -1;

// save value
ABISYM( mMaxThreads ) = maxThreads;
QSettings().setValue( "/qgis/max_threads", maxThreads );

// if -1 use #cores
if ( maxThreads == -1 )
maxThreads = QThread::idealThreadCount();
maxThreads = QThread::idealThreadCount();

// set max thread count in QThreadPool
QThreadPool::globalInstance()->setMaxThreadCount( maxThreads );
qDebug( "set QThreadPool max thread count to %d", QThreadPool::globalInstance()->maxThreadCount() );
QgsDebugMsg( QString( "set QThreadPool max thread count to %d" ).arg( QThreadPool::globalInstance()->maxThreadCount() ) );
}

0 comments on commit a4e974a

Please sign in to comment.