Commit 462b9a10 authored by Laurent Montel's avatar Laurent Montel 😁

kdelibs4support--

parent 4151641f
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#include <ktogglefullscreenaction.h> #include <ktogglefullscreenaction.h>
#include <kstandardaction.h> #include <kstandardaction.h>
#include <kstandardgameaction.h> #include <kstandardgameaction.h>
#include <kicon.h> #include <QIcon>
#include <KMenu> #include <KMenu>
#include <KCmdLineArgs> #include <KCmdLineArgs>
#include <KAboutData> #include <KAboutData>
...@@ -115,9 +115,6 @@ KGoldrunner::KGoldrunner() ...@@ -115,9 +115,6 @@ KGoldrunner::KGoldrunner()
/************************* SET UP THE USER INTERFACE ************************/ /************************* SET UP THE USER INTERFACE ************************/
/******************************************************************************/ /******************************************************************************/
// Get catalog for translation.
KGlobal::locale()->insertCatalog ( QLatin1String( "libkdegames" ));
// Tell the KMainWindow that the KGrCanvas object is the main widget. // Tell the KMainWindow that the KGrCanvas object is the main widget.
setCentralWidget (view); setCentralWidget (view);
...@@ -315,14 +312,14 @@ void KGoldrunner::setupActions() ...@@ -315,14 +312,14 @@ void KGoldrunner::setupActions()
i18n ("&Create Level"), i18n ("&Create Level"),
i18n ("Create level."), i18n ("Create level."),
i18n ("Create a completely new level.")); i18n ("Create a completely new level."));
ed->setIcon (KIcon ( QLatin1String( "document-new" ))); ed->setIcon (QIcon::fromTheme( QLatin1String( "document-new" )));
ed->setIconText (i18n ("Create")); ed->setIconText (i18n ("Create"));
ed = editAction ("edit_any", EDIT_ANY, ed = editAction ("edit_any", EDIT_ANY,
i18n ("&Edit Level..."), i18n ("&Edit Level..."),
i18n ("Edit level..."), i18n ("Edit level..."),
i18n ("Edit any level...")); i18n ("Edit any level..."));
ed->setIcon (KIcon ( QLatin1String( "document-open" ))); ed->setIcon (QIcon::fromTheme( QLatin1String( "document-open" )));
ed->setIconText (i18n ("Edit")); ed->setIconText (i18n ("Edit"));
// Save Edits... // Save Edits...
...@@ -334,7 +331,7 @@ void KGoldrunner::setupActions() ...@@ -334,7 +331,7 @@ void KGoldrunner::setupActions()
i18n ("&Save Edits..."), i18n ("&Save Edits..."),
i18n ("Save edits..."), i18n ("Save edits..."),
i18n ("Save your level after editing...")); i18n ("Save your level after editing..."));
saveEdits->setIcon (KIcon ( QLatin1String( "document-save" ))); saveEdits->setIcon (QIcon::fromTheme( QLatin1String( "document-save" )));
saveEdits->setIconText (i18n ("Save")); saveEdits->setIconText (i18n ("Save"));
saveEdits->setEnabled (false); // Nothing to save, yet. saveEdits->setEnabled (false); // Nothing to save, yet.
...@@ -554,7 +551,7 @@ void KGoldrunner::setupActions() ...@@ -554,7 +551,7 @@ void KGoldrunner::setupActions()
// stepping through the animation, toggling a debug patch or log messages // stepping through the animation, toggling a debug patch or log messages
// on or off during gameplay and printing the states of runners or tiles. // on or off during gameplay and printing the states of runners or tiles.
KConfigGroup debugGroup (KGlobal::config(), "Debugging"); KConfigGroup debugGroup (KSharedConfig::openConfig(), "Debugging");
bool addDebuggingShortcuts = debugGroup.readEntry bool addDebuggingShortcuts = debugGroup.readEntry
("DebuggingShortcuts", false); // Get debug option. ("DebuggingShortcuts", false); // Get debug option.
if (! addDebuggingShortcuts) if (! addDebuggingShortcuts)
...@@ -807,7 +804,7 @@ void KGoldrunner::setEditMenu (bool on_off) ...@@ -807,7 +804,7 @@ void KGoldrunner::setEditMenu (bool on_off)
void KGoldrunner::setEditIcon (const QString & actionName, const char iconType) void KGoldrunner::setEditIcon (const QString & actionName, const char iconType)
{ {
((KToggleAction *) (actionCollection()->action (actionName)))-> ((KToggleAction *) (actionCollection()->action (actionName)))->
setIcon (KIcon (renderer->getPixmap (iconType))); setIcon (QIcon(renderer->getPixmap (iconType)));
} }
/******************************************************************************/ /******************************************************************************/
...@@ -954,7 +951,7 @@ void KGoldrunner::setupEditToolbarActions() ...@@ -954,7 +951,7 @@ void KGoldrunner::setupEditToolbarActions()
i18n ("Edit level name or hint"), i18n ("Edit level name or hint"),
i18n ("Edit text for the name or hint " i18n ("Edit text for the name or hint "
"of a level")); "of a level"));
ed->setIcon (KIcon ( QLatin1String( "games-hint" ))); ed->setIcon (QIcon::fromTheme( QLatin1String( "games-hint" )));
ed->setIconText (i18n ("Name/Hint")); ed->setIconText (i18n ("Name/Hint"));
KToggleAction * free = editToolbarAction ("freebg", FREE, KToggleAction * free = editToolbarAction ("freebg", FREE,
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <QButtonGroup> #include <QButtonGroup>
#include <KGlobalSettings> #include <KGlobalSettings>
#include <QFontDatabase>
/******************************************************************************* /*******************************************************************************
*************** DIALOG BOX TO CREATE/EDIT A LEVEL NAME AND HINT **************** *************** DIALOG BOX TO CREATE/EDIT A LEVEL NAME AND HINT ****************
...@@ -245,7 +246,7 @@ KGrLGDialog::KGrLGDialog (QFile * savedGames, ...@@ -245,7 +246,7 @@ KGrLGDialog::KGrLGDialog (QFile * savedGames,
"Day Date Time "), dad); "Day Date Time "), dad);
lgList = new QListWidget (dad); lgList = new QListWidget (dad);
QFont f = KGlobalSettings::fixedFont(); // KDE version. QFont f = QFontDatabase::systemFont(QFontDatabase::FixedFont); // KDE version.
f.setFixedPitch (true); f.setFixedPitch (true);
lgList-> setFont (f); lgList-> setFont (f);
f.setBold (true); f.setBold (true);
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#include <QDateTime> #include <QDateTime>
#include <KRandomSequence> #include <KRandomSequence>
#include <KPushButton> #include <QPushButton>
#include <KStandardGuiItem> #include <KStandardGuiItem>
#include <KStandardDirs> #include <KStandardDirs>
#include <KApplication> #include <KApplication>
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
#include <QHeaderView> #include <QHeaderView>
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include <QDir> #include <QDir>
#include <KGuiItem>
#endif #endif
...@@ -329,7 +330,7 @@ void KGrGame::editActions (const int action) ...@@ -329,7 +330,7 @@ void KGrGame::editActions (const int action)
level = lev; level = lev;
kDebug() << "Saving to KConfigGroup"; kDebug() << "Saving to KConfigGroup";
KConfigGroup gameGroup (KGlobal::config(), "KDEGame"); KConfigGroup gameGroup (KSharedConfig::openConfig(), "KDEGame");
gameGroup.writeEntry ("GamePrefix", prefix); gameGroup.writeEntry ("GamePrefix", prefix);
gameGroup.writeEntry ("Level_" + prefix, level); gameGroup.writeEntry ("Level_" + prefix, level);
gameGroup.sync(); // Ensure that the entry goes to disk. gameGroup.sync(); // Ensure that the entry goes to disk.
...@@ -367,7 +368,7 @@ void KGrGame::editToolbarActions (const int action) ...@@ -367,7 +368,7 @@ void KGrGame::editToolbarActions (const int action)
void KGrGame::settings (const int action) void KGrGame::settings (const int action)
{ {
// TODO - Bad - Configure Keys does not pause a demo. IDW // TODO - Bad - Configure Keys does not pause a demo. IDW
KConfigGroup gameGroup (KGlobal::config(), "KDEGame"); KConfigGroup gameGroup (KSharedConfig::openConfig(), "KDEGame");
bool onOff = false; bool onOff = false;
switch (action) { switch (action) {
case PLAY_SOUNDS: case PLAY_SOUNDS:
...@@ -429,7 +430,7 @@ void KGrGame::initGame() ...@@ -429,7 +430,7 @@ void KGrGame::initGame()
// Get the most recent collection and level that was played by this user. // Get the most recent collection and level that was played by this user.
// If he/she has never played before, set it to Tutorial, level 1. // If he/she has never played before, set it to Tutorial, level 1.
KConfigGroup gameGroup (KGlobal::config(), "KDEGame"); KConfigGroup gameGroup (KSharedConfig::openConfig(), "KDEGame");
QString prevGamePrefix = gameGroup.readEntry ("GamePrefix", "tute"); QString prevGamePrefix = gameGroup.readEntry ("GamePrefix", "tute");
int prevLevel = gameGroup.readEntry ("Level_" + prevGamePrefix, 1); int prevLevel = gameGroup.readEntry ("Level_" + prevGamePrefix, 1);
...@@ -623,7 +624,7 @@ void KGrGame::startInstantReplay() ...@@ -623,7 +624,7 @@ void KGrGame::startInstantReplay()
void KGrGame::replayLastLevel() void KGrGame::replayLastLevel()
{ {
// Replay the last game and level completed by the player. // Replay the last game and level completed by the player.
KConfigGroup gameGroup (KGlobal::config(), "KDEGame"); KConfigGroup gameGroup (KSharedConfig::openConfig(), "KDEGame");
QString lastPrefix = gameGroup.readEntry ("LastGamePrefix", ""); QString lastPrefix = gameGroup.readEntry ("LastGamePrefix", "");
int lastLevel = gameGroup.readEntry ("LastLevel", -1); int lastLevel = gameGroup.readEntry ("LastLevel", -1);
...@@ -867,7 +868,7 @@ bool KGrGame::playLevel (const Owner fileOwner, const QString & prefix, ...@@ -867,7 +868,7 @@ bool KGrGame::playLevel (const Owner fileOwner, const QString & prefix,
// If we are starting a new level, save it in the player's config file. // If we are starting a new level, save it in the player's config file.
if (newLevel && (level != 0)) { // But do not save the "ENDE" level. if (newLevel && (level != 0)) { // But do not save the "ENDE" level.
KConfigGroup gameGroup (KGlobal::config(), "KDEGame"); KConfigGroup gameGroup (KSharedConfig::openConfig(), "KDEGame");
gameGroup.writeEntry ("GamePrefix", prefix); gameGroup.writeEntry ("GamePrefix", prefix);
gameGroup.writeEntry ("Level_" + prefix, level); gameGroup.writeEntry ("Level_" + prefix, level);
gameGroup.sync(); // Ensure that the entry goes to disk. gameGroup.sync(); // Ensure that the entry goes to disk.
...@@ -1151,7 +1152,7 @@ bool KGrGame::inEditMode() ...@@ -1151,7 +1152,7 @@ bool KGrGame::inEditMode()
void KGrGame::toggleSoundsOnOff (const int action) void KGrGame::toggleSoundsOnOff (const int action)
{ {
const char * setting = (action == PLAY_SOUNDS) ? "Sound" : "StepSounds"; const char * setting = (action == PLAY_SOUNDS) ? "Sound" : "StepSounds";
KConfigGroup gameGroup (KGlobal::config(), "KDEGame"); KConfigGroup gameGroup (KSharedConfig::openConfig(), "KDEGame");
bool soundOnOff = gameGroup.readEntry (setting, false); bool soundOnOff = gameGroup.readEntry (setting, false);
soundOnOff = (! soundOnOff); soundOnOff = (! soundOnOff);
gameGroup.writeEntry (setting, soundOnOff); gameGroup.writeEntry (setting, soundOnOff);
...@@ -1645,7 +1646,8 @@ void KGrGame::checkHighScore() ...@@ -1645,7 +1646,8 @@ void KGrGame::checkHighScore()
"in the KGoldrunner Hall of Fame.</html>"), "in the KGoldrunner Hall of Fame.</html>"),
hsn); hsn);
QLineEdit * hsnUser = new QLineEdit (hsn); QLineEdit * hsnUser = new QLineEdit (hsn);
QPushButton * OK = new KPushButton (KStandardGuiItem::ok(), hsn); QPushButton * OK = new QPushButton(hsn);
KGuiItem::assign(OK,KStandardGuiItem::ok());
mainLayout-> addWidget (hsnMessage); mainLayout-> addWidget (hsnMessage);
mainLayout-> addWidget (hsnUser); mainLayout-> addWidget (hsnUser);
...@@ -1873,7 +1875,8 @@ void KGrGame::showHighScores() ...@@ -1873,7 +1875,8 @@ void KGrGame::showHighScores()
QSpacerItem * spacerItem = new QSpacerItem (40, 20, QSizePolicy::Expanding, QSpacerItem * spacerItem = new QSpacerItem (40, 20, QSizePolicy::Expanding,
QSizePolicy::Minimum); QSizePolicy::Minimum);
hboxLayout1->addItem (spacerItem); hboxLayout1->addItem (spacerItem);
QPushButton * OK = new KPushButton (KStandardGuiItem::close(), hs); QPushButton * OK = new QPushButton(hs);
KGuiItem::assign(OK,KStandardGuiItem::close());
OK-> setShortcut (Qt::Key_Return); OK-> setShortcut (Qt::Key_Return);
OK-> setMaximumWidth (100); OK-> setMaximumWidth (100);
hboxLayout1->addWidget (OK); hboxLayout1->addWidget (OK);
...@@ -2073,7 +2076,7 @@ void KGrGame::saveRecording() ...@@ -2073,7 +2076,7 @@ void KGrGame::saveRecording()
configGroup.sync(); // Ensure that the entry goes to disk. configGroup.sync(); // Ensure that the entry goes to disk.
// Save the game and level, for use in the REPLAY_LAST action. // Save the game and level, for use in the REPLAY_LAST action.
KConfigGroup gameGroup (KGlobal::config(), "KDEGame"); KConfigGroup gameGroup (KSharedConfig::openConfig(), "KDEGame");
gameGroup.writeEntry ("LastGamePrefix", prefix); gameGroup.writeEntry ("LastGamePrefix", prefix);
gameGroup.writeEntry ("LastLevel", level); gameGroup.writeEntry ("LastLevel", level);
gameGroup.sync(); // Ensure that the entry goes to disk. gameGroup.sync(); // Ensure that the entry goes to disk.
......
...@@ -424,7 +424,7 @@ void KGrSLDialog::slGame() ...@@ -424,7 +424,7 @@ void KGrSLDialog::slGame()
display->setMaximum (1); display->setMaximum (1);
} }
KConfigGroup gameGroup (KGlobal::config(), "KDEGame"); KConfigGroup gameGroup (KSharedConfig::openConfig(), "KDEGame");
int lev = 1; int lev = 1;
// Set a default level number for the selected game. // Set a default level number for the selected game.
......
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