Migrate some OpenGL options to new config module

svn path=/trunk/KDE/kdebase/workspace/; revision=690341
This commit is contained in:
Rivo Laks 2007-07-20 18:50:51 +00:00
parent 5db0b94027
commit 5d21a58b44
3 changed files with 69 additions and 5 deletions

View file

@ -29,6 +29,9 @@ KWinAdvancedCompositingOptions::KWinAdvancedCompositingOptions(QWidget* parent,
setMainWidget(mainWidget); setMainWidget(mainWidget);
connect(ui.compositingType, SIGNAL(currentIndexChanged(int)), this, SLOT(changed())); connect(ui.compositingType, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(ui.glMode, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(ui.glDirect, SIGNAL(toggled(bool)), this, SLOT(changed()));
connect(ui.glVSync, SIGNAL(toggled(bool)), this, SLOT(changed()));
connect(this, SIGNAL(okClicked()), this, SLOT(save())); connect(this, SIGNAL(okClicked()), this, SLOT(save()));
connect(this, SIGNAL(applyClicked()), this, SLOT(save())); connect(this, SIGNAL(applyClicked()), this, SLOT(save()));
@ -52,6 +55,10 @@ void KWinAdvancedCompositingOptions::load()
KConfigGroup config(mKWinConfig, "Compositing"); KConfigGroup config(mKWinConfig, "Compositing");
QString backend = config.readEntry("Backend", "OpenGL"); QString backend = config.readEntry("Backend", "OpenGL");
ui.compositingType->setCurrentIndex((backend == "XRender") ? 1 : 0); ui.compositingType->setCurrentIndex((backend == "XRender") ? 1 : 0);
QString glMode = config.readEntry("GLMode", "TFP");
ui.glMode->setCurrentIndex((glMode == "TFP") ? 0 : ((glMode == "SHM") ? 1 : 2));
ui.glDirect->setChecked(config.readEntry("GLDirect", true));
ui.glVSync->setChecked(config.readEntry("GLVSync", true));
} }
void KWinAdvancedCompositingOptions::save() void KWinAdvancedCompositingOptions::save()
@ -63,6 +70,10 @@ void KWinAdvancedCompositingOptions::save()
KConfigGroup config(mKWinConfig, "Compositing"); KConfigGroup config(mKWinConfig, "Compositing");
config.writeEntry("Backend", (ui.compositingType->currentIndex() == 0) ? "OpenGL" : "XRender"); config.writeEntry("Backend", (ui.compositingType->currentIndex() == 0) ? "OpenGL" : "XRender");
QString glModes[] = { "TFP", "SHM", "Fallback" };
config.writeEntry("GLMode", glModes[ui.glMode->currentIndex()]);
config.writeEntry("GLDirect", ui.glDirect->isChecked());
config.writeEntry("GLVSync", ui.glVSync->isChecked());
enableButtonApply(false); enableButtonApply(false);
emit configSaved(); emit configSaved();

View file

@ -38,6 +38,59 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>OpenGL options</string>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>OpenGL mode:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="glMode" >
<item>
<property name="text" >
<string>Texture From Pixmap</string>
</property>
</item>
<item>
<property name="text" >
<string>Shared Memory</string>
</property>
</item>
<item>
<property name="text" >
<string>Fallback</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="glDirect" >
<property name="text" >
<string>Direct rendering</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="glVSync" >
<property name="text" >
<string>Use VSync</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
@ -46,7 +99,7 @@
<property name="sizeHint" > <property name="sizeHint" >
<size> <size>
<width>20</width> <width>20</width>
<height>40</height> <height>31</height>
</size> </size>
</property> </property>
</spacer> </spacer>

View file

@ -185,10 +185,6 @@ unsigned long Options::updateSettings()
compositingMode = XRenderCompositing; compositingMode = XRenderCompositing;
else else
compositingMode = OpenGLCompositing; compositingMode = OpenGLCompositing;
config.changeGroup("Translucency");
refreshRate = config.readEntry( "RefreshRate", 0 );
smoothScale = qBound( -1, config.readEntry( "SmoothScale", -1 ), 2 );
QString glmode = config.readEntry("GLMode", "TFP" ).toUpper(); QString glmode = config.readEntry("GLMode", "TFP" ).toUpper();
if( glmode == "TFP" ) if( glmode == "TFP" )
glMode = GLTFP; glMode = GLTFP;
@ -198,6 +194,10 @@ unsigned long Options::updateSettings()
glMode = GLFallback; glMode = GLFallback;
glDirect = config.readEntry("GLDirect", true ); glDirect = config.readEntry("GLDirect", true );
glVSync = config.readEntry("GLVSync", true ); glVSync = config.readEntry("GLVSync", true );
config.changeGroup("Translucency");
refreshRate = config.readEntry( "RefreshRate", 0 );
smoothScale = qBound( -1, config.readEntry( "SmoothScale", -1 ), 2 );
glStrictBinding = config.readEntry( "GLStrictBinding", false ); glStrictBinding = config.readEntry( "GLStrictBinding", false );
const HiddenPreviews hps[] = { HiddenPreviewsNever, HiddenPreviewsKeep, HiddenPreviewUpdate, HiddenPreviewsActive }; const HiddenPreviews hps[] = { HiddenPreviewsNever, HiddenPreviewsKeep, HiddenPreviewUpdate, HiddenPreviewsActive };
hiddenPreviews = hps[ qBound( 0, config.readEntry( "HiddenPreviews", 3 ), 3 ) ]; hiddenPreviews = hps[ qBound( 0, config.readEntry( "HiddenPreviews", 3 ), 3 ) ];