[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdegames/kmines
From:       Dmitry Suzdalev <dimsuz () gmail ! com>
Date:       2008-11-27 19:33:54
Message-ID: 1227814434.820153.23923.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 889825 by dimsuz:

Fixed saving of current difficulty level.

Thanks to Sérgio Luís for the patch!
(I only changed Settings::self()->level() to simply Settings::level())

BUG: 176080


 M  +3 -8      kmines.kcfg  
 M  +5 -2      mainwindow.cpp  
 M  +1 -0      settings.kcfgc  


--- trunk/KDE/kdegames/kmines/kmines.kcfg #889824:889825
@@ -4,6 +4,7 @@
       xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
       http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
   <kcfgfile name="kminesrc"/>
+  <include>KGameDifficulty</include>
   <group name="General">
     <entry name="UseQuestionMarks" type="Bool" key="question mark">
       <label>Whether the "unsure" marker may be used.</label>
@@ -30,15 +31,9 @@
       <label>The number of mines in the playing field.</label>
       <default>20</default>
     </entry>
-    <entry name="level" type="Enum">
+    <entry name="level" type="Int">
       <label>The difficulty level.</label>
-      <default>Easy</default>
-      <choices>
-        <choice name="Easy"/>
-        <choice name="Normal"/>
-        <choice name="Expert"/>
-        <choice name="Custom"/>
-      </choices>
+      <default code="true">KGameDifficulty::Easy</default>
     </entry>
   </group>
 </kcfg>
--- trunk/KDE/kdegames/kmines/mainwindow.cpp #889824:889825
@@ -92,8 +92,8 @@
     setCentralWidget(m_view);
     setupActions();
 
-    // TODO: load this from config
-    KGameDifficulty::setLevel( KGameDifficulty::Easy );
+    KGameDifficulty::setLevel( KGameDifficulty::standardLevel(Settings::level()) );
+
     newGame();
 }
 
@@ -124,6 +124,9 @@
 
 void KMinesMainWindow::levelChanged(KGameDifficulty::standardLevel)
 {
+    Settings::setLevel(KGameDifficulty::level());
+    Settings::self()->writeConfig();
+
     newGame();
 }
 
--- trunk/KDE/kdegames/kmines/settings.kcfgc #889824:889825
@@ -2,3 +2,4 @@
 File=kmines.kcfg
 ClassName=Settings
 Singleton=true
+Mutators=true
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic