Commit af3668c3 authored by Ian Wadham's avatar Ian Wadham

Add a new Change Theme item to the Settings menu and connect it to KGrRenderer...

Add a new Change Theme item to the Settings menu and connect it to KGrRenderer and the KgThemeSelector library class.

svn path=/branches/work/kgoldrunner-qgv/; revision=1296994
parent 6ce57ecf
......@@ -18,6 +18,7 @@
****************************************************************************/
#include "kgoldrunner.h"
#include "kgrrenderer.h" // IDW test
#include <QApplication>
#include <QDesktopWidget>
......@@ -122,6 +123,7 @@ KGoldrunner::KGoldrunner()
// Tell the KMainWindow that the KGrCanvas object is the main widget.
setCentralWidget (view);
m_renderer = new KGrRenderer (view); // IDW test.
// Set up our actions (menu, toolbar and keystrokes) ...
setupActions();
......@@ -362,9 +364,12 @@ void KGoldrunner::setupActions()
/***************************** THEMES MENU *****************************/
/**************************************************************************/
// The Themes menu is obtained AFTER calling setupGUI(), by locating an
// open-ended list of theme-files and plugging the translated text-names of
// the themes in place of ActionList <name="theme_list" /> in the ui.rc file.
QAction * themes = actionCollection()->addAction ("select_theme");
themes->setText (i18n ("Change &Theme..."));
themes->setToolTip (i18n ("Change the graphics theme..."));
themes->setWhatsThis (i18n ("Alter the visual appearance of the runners "
"and background scene..."));
connect (themes, SIGNAL(triggered(bool)), m_renderer, SLOT(selectTheme()));
/**************************************************************************/
/**************************** SETTINGS MENU ****************************/
......@@ -736,7 +741,7 @@ void KGoldrunner::setupThemes()
foreach (const QString &filepath, themeFilepaths) { // Read each theme-file.
KConfig theme (filepath, KConfig::SimpleConfig);// Extract theme-name.
KConfigGroup group = theme.group ("KDEGameTheme"); // Translated.
KConfigGroup group = theme.group ("KGameTheme"); // Translated.
actionName = group.readEntry ("Name", i18n ("Missing Name"));
newTheme = new KToggleAction (actionName, this);
......
......@@ -41,6 +41,7 @@ class KToggleAction;
class KGrGame;
class KGrCanvas;
class KGrRenderer;
/**
* This class serves as the main window for KGoldrunner. It handles the
......@@ -149,9 +150,10 @@ private:
bool startupOK;
KGrCanvas * view;
KGrGame * game;
bool frozen;
KGrCanvas * view;
KGrGame * game;
KGrRenderer * m_renderer;
bool frozen;
bool getDirectories(); // Get directory paths, as below.
QString systemHTMLDir; // Where the manual is stored.
......
<?xml version="1.0" encoding="UTF-8"?>
<gui name="kgoldrunner"
version="14"
version="15"
xmlns="http://www.kde.org/standards/kxmlgui/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kxmlgui/1.0
......@@ -31,6 +31,7 @@
<ActionList name="theme_list" />
</Menu>
<Menu name="settings" >
<Action append="save_merge" name="select_theme" />
<Action append="save_merge" name="options_sounds" />
<Action append="save_merge" name="options_steps" />
<Action append="save_merge" name="options_demo" />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment