Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit a39bce32 authored by Nemanja Hiršl's avatar Nemanja Hiršl

Port KStandardDirs to QStandardPaths

parent ab10dbb5
......@@ -68,7 +68,6 @@
#include <kstandardgameaction.h>
#include <kstandardaction.h>
#include <kactioncollection.h>
#include <kstandarddirs.h>
#include <kmenubar.h>
#include "ksirk_debug.h"
#include <ktextedit.h>
......
......@@ -24,7 +24,7 @@
#include <KLocalizedString>
#include "ksirk_debug.h"
#include <KStandardDirs>
#include <QStandardPaths>
#include <KMessageBox>
#include <KConfigDialog>
#include <knewstuff3/downloaddialog.h>
......@@ -118,14 +118,12 @@ void NewGameWidget::fillSkinsCombo()
skinCombo->clear();
qDeleteAll(m_newGameSetup->worlds());
KStandardDirs *m_dirs = KGlobal::dirs();
QStringList skinsDirs = m_dirs->findDirs("appdata","skins");
QStringList skinsDirs = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, "skins", QStandardPaths::LocateDirectory);
qCDebug(KSIRK_LOG) << skinsDirs;
uint skinNum = 0;
uint currentSkinNum = 0;
foreach (const QString &skinsDirName, skinsDirs)
{
// QString skinsDirName = m_dirs->findResourceDir("appdata", "skins/skinsdir");
if (skinsDirName.isEmpty())
{
KMessageBox::error(0,
......@@ -140,11 +138,11 @@ void NewGameWidget::fillSkinsCombo()
foreach (const QString& name, skinsDirsNames)
{
qCDebug(KSIRK_LOG) << "Got skin dir name: " << name;
QDir skinDir(skinsDirName + name);
QDir skinDir(skinsDirName + '/' + name);
if (skinDir.exists())
{
qCDebug(KSIRK_LOG) << "Got skin dir: " << skinDir.dirName();
GameLogic::ONU* world = new GameLogic::ONU(m_newGameSetup->automaton(),skinsDirName + skinDir.dirName() + "/Data/world.desktop");
GameLogic::ONU* world = new GameLogic::ONU(m_newGameSetup->automaton(),skinsDirName + '/' + skinDir.dirName() + "/Data/world.desktop");
if (!world->skin().isEmpty())
{
skinCombo->addItem(i18n(world->name().toUtf8().data()));
......
......@@ -20,7 +20,7 @@
#include <KLocalizedString>
#include "ksirk_debug.h"
#include <kstandarddirs.h>
#include <QStandardPaths>
#include <kmessagebox.h>
#include <qspinbox.h>
......
......@@ -32,7 +32,6 @@
#include <QFileInfo>
#include <kapplication.h>
#include <kstandarddirs.h>
#include <kglobal.h>
#include <KLocalizedString>
#include "ksirk_debug.h"
......@@ -102,16 +101,15 @@ ONU::ONU(GameAutomaton* automaton,
m_name = onugroup.readEntry("name");
m_skin = onugroup.readEntry("skinpath");
qCDebug(KSIRK_LOG) << "skin snapshot file: " << KGlobal::dirs()-> findResource("appdata", m_skin + "/Images/snapshot.jpg");
qCDebug(KSIRK_LOG) << "skin snapshot file: " << QStandardPaths::locate(QStandardPaths::AppDataLocation, m_skin + "/Images/snapshot.jpg");
if (!m_automaton->pixmapCache().find(m_skin+"snapshot", m_snapshot))
{
// Pixmap isn't in the cache, create it and insert to cache
m_snapshot = QPixmap(KGlobal::dirs()-> findResource("appdata", m_skin + "/Images/snapshot.jpg"));
m_snapshot = QPixmap(QStandardPaths::locate(QStandardPaths::AppDataLocation, m_skin + "/Images/snapshot.jpg"));
if (m_snapshot.isNull())
{
qCCritical(KSIRK_LOG) << "Was not able to load the snapshot image: "
<< KGlobal::dirs()-> findResource("appdata", m_skin + "/Images/snapshot.jpg")
<< endl;
qCCritical(KSIRK_LOG) << "Was not able to load the snapshot image: " << QStandardPaths::locate(QStandardPaths::AppDataLocation, m_skin + "/Images/snapshot.jpg") << endl;
}
m_automaton->pixmapCache().insert(m_skin+"snapshot", m_snapshot);
}
......@@ -125,7 +123,8 @@ ONU::ONU(GameAutomaton* automaton,
QString poolString = onugroup.readEntry("pool");
qCDebug(KSIRK_LOG) << "Pool path: " << poolString;
qCDebug(KSIRK_LOG) << "Searching resource: " << (m_skin + '/' + poolString);
QString poolFileName = KGlobal::dirs()-> findResource("appdata", m_skin + '/' + poolString);
QString poolFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_skin + '/' + poolString);
qCDebug(KSIRK_LOG) << "Pool file name: " << poolFileName;
if (poolFileName.isEmpty())
{
......@@ -142,7 +141,7 @@ ONU::ONU(GameAutomaton* automaton,
m_automaton->svgDomFor(m_skin).load(poolFileName);
qCDebug(KSIRK_LOG) << m_skin << "after pool loading";
QString mapMaskFileName = KGlobal::dirs()-> findResource("appdata", m_skin + '/' + onugroup.readEntry("map-mask"));
QString mapMaskFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_skin + '/' + onugroup.readEntry("map-mask"));
qCDebug(KSIRK_LOG) << "Map mask file name: " << mapMaskFileName;
if (mapMaskFileName.isNull())
{
......
......@@ -34,7 +34,6 @@
#include <kmessagebox.h>
#include <KLocalizedString>
#include <kstandarddirs.h>
#include "ksirk_debug.h"
namespace Ksirk
......
......@@ -250,36 +250,36 @@ void DecoratedGameFrame::setIcon()
QString imageFileName;
imageFileName = KGlobal::dirs()->findResource("appdata", skin + "/Images/attackOne.png");
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + "/Images/attackOne.png");
Attack1Action-> setIcon(QIcon(imageFileName));
imageFileName = KGlobal::dirs()->findResource("appdata", skin + "/Images/attackTwo.png");
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + "/Images/attackTwo.png");
Attack2Action-> setIcon(QIcon(imageFileName));
imageFileName = KGlobal::dirs()->findResource("appdata", skin + "/Images/attackThree.png");
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + "/Images/attackThree.png");
Attack3Action-> setIcon(QIcon(imageFileName));
imageFileName = KGlobal::dirs()->findResource("appdata", skin + "/Images/attackAuto.png");
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + "/Images/attackAuto.png");
AutoAction-> setIcon(QIcon(imageFileName));
imageFileName = KGlobal::dirs()->findResource("appdata", skin + "/Images/moveOne.png");
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + "/Images/moveOne.png");
Move1Action-> setIcon(QIcon(imageFileName));
imageFileName = KGlobal::dirs()->findResource("appdata", skin + "/Images/moveFive.png");
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + "/Images/moveFive.png");
Move5Action-> setIcon(QIcon(imageFileName));
imageFileName = KGlobal::dirs()->findResource("appdata", skin + "/Images/moveTen.png");
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + "/Images/moveTen.png");
Move10Action-> setIcon(QIcon(imageFileName));
//temporary
imageFileName = KGlobal::dirs()->findResource("appdata", skin + "/Images/moveArmies.png");
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + "/Images/moveArmies.png");
m_arenaAction-> setIcon(QIcon(imageFileName));
imageFileName = KGlobal::dirs()->findResource("appdata", skin + '/' + CM_NEXTPLAYER);
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + '/' + CM_NEXTPLAYER);
nextPlayer-> setIcon(QIcon(imageFileName));
// temporary
imageFileName = KGlobal::dirs()->findResource("appdata", skin + "/Images/newNetGame.png");
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + "/Images/newNetGame.png");
detailsAction-> setIcon(QIcon(imageFileName));
}
......
......@@ -73,7 +73,7 @@ namespace Ksirk
KConfig config(onuObject->getConfigFileName());
KConfigGroup onugroup = config.group("onu");
QString skin = onugroup.readEntry("skinpath");
QString imageFileName = KGlobal::dirs()->findResource("appdata", skin + "/Images/arena.svg");
QString imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + "/Images/arena.svg");
// create the background image
m_bgImage = new QPixmap(imageFileName);
}
......
......@@ -33,7 +33,6 @@
#include <QMouseEvent>
#include <QGraphicsView>
#include <QPixmap>
#include <kstandarddirs.h>
#include <kglobal.h>
#include <kconfig.h>
#include <kconfiggroup.h>
......
......@@ -51,7 +51,6 @@
#include <kconfig.h>
#include <kstandardaction.h>
#include <phonon/mediaobject.h>
#include <kstandarddirs.h>
#include "ksirk_debug.h"
#include <KToolBar>
......@@ -689,7 +688,7 @@ void KGameWindow::initCombatMovement()
qCDebug(KSIRK_LOG) << "add a sprite 2";
m_animFighters->addSprite(attackingSprite);
//(pointDepartAttaquantX <= pointArriveeAttaquantX) ? attackingSprite-> setLookRight() : attackingSprite-> setLookLeft();
sndRoulePath = m_dirs-> findResource("appdata", m_automaton->skin() + "/Sounds/roll.wav");
sndRoulePath = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Sounds/roll.wav");
if (sndRoulePath.isNull())
{
KMessageBox::error(0, i18n("Sound roule not found - Verify your installation<br>Program cannot continue"), i18n("Error!"));
......@@ -804,7 +803,7 @@ void KGameWindow::initCombatMovement()
//(pointDepartDefenseurX <= pointArriveeDefenseurX) ? defenderSprite-> setLookRight() : defenderSprite-> setLookLeft();
qCDebug(KSIRK_LOG) << "add a sprite 3";
m_animFighters->addSprite(defenderSprite);
sndRoulePath = m_dirs-> findResource("appdata", m_automaton->skin() + "/Sounds/roll.wav");
sndRoulePath = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Sounds/roll.wav");
if (sndRoulePath.isNull())
{
KMessageBox::error(0, i18n("Sound roule not found - Verify your installation<br>Program cannot continue"), i18n("Error!"));
......@@ -848,7 +847,7 @@ void KGameWindow::animCombat()
}
sprite->setAnimated(1);
QString sndCanonPath = m_dirs-> findResource("appdata", m_automaton->skin() + "/Sounds/cannon.wav");
QString sndCanonPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Sounds/cannon.wav");
if (sndCanonPath.isNull())
{
KMessageBox::error(0,
......@@ -924,7 +923,7 @@ void KGameWindow::animExplosion(int who)
sprite->setAnimated(NKA);
QString sndCrashPath = m_dirs-> findResource("appdata", m_automaton->skin() + "/Sounds/crash.wav");
QString sndCrashPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Sounds/crash.wav");
if (sndCrashPath.isNull())
{
KMessageBox::information(this, i18n("Sound crash not found - Verify your installation\nProgram cannot continue"), i18n("KsirK - Error!"));
......@@ -944,7 +943,7 @@ void KGameWindow::animExplosion(int who)
sprite->setAnimated(NKD);
QString sndCrashPath = m_dirs-> findResource("appdata", m_automaton->skin() + "/Sounds/crash.wav");
QString sndCrashPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Sounds/crash.wav");
if (sndCrashPath.isNull())
{
KMessageBox::information(this, i18n("Sound crash not found - Verify your installation\nProgram cannot continue"), i18n("KsirK - Error!"));
......@@ -1045,7 +1044,7 @@ void KGameWindow::animExplosionForArena()
sprite->setAnimated(NKA);
QString sndCrashPath = m_dirs-> findResource("appdata", m_automaton->skin() + "/Sounds/crash.wav");
QString sndCrashPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Sounds/crash.wav");
if (sndCrashPath.isNull())
{
KMessageBox::information(this, i18n("Sound crash not found - Verify your installation\nProgram cannot continue"), i18n("KsirK - Error!"));
......@@ -1082,7 +1081,7 @@ void KGameWindow::animExplosionForArena()
sprite->setAnimated(NKA);
QString sndCrashPath = m_dirs-> findResource("appdata", m_automaton->skin() + "/Sounds/crash.wav");
QString sndCrashPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Sounds/crash.wav");
if (sndCrashPath.isNull())
{
KMessageBox::information(this, i18n("Sound crash not found - Verify your installation\nProgram cannot continue"), i18n("KsirK - Error!"));
......@@ -1117,7 +1116,7 @@ void KGameWindow::animExplosionForArena()
sprite->setAnimated(1);
QString sndCrashPath = m_dirs-> findResource("appdata", m_automaton->skin() + "/Sounds/crash.wav");
QString sndCrashPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Sounds/crash.wav");
if (sndCrashPath.isNull())
{
KMessageBox::information(this, i18n("Sound crash not found - Verify your installation\nProgram cannot continue"), i18n("KsirK - Error!"));
......@@ -1171,7 +1170,7 @@ void KGameWindow::animExplosionForArena()
sprite->setAnimated(NKD);
QString sndCrashPath = m_dirs-> findResource("appdata", m_automaton->skin() + "/Sounds/crash.wav");
QString sndCrashPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Sounds/crash.wav");
if (sndCrashPath.isNull())
{
KMessageBox::information(this, i18n("Sound crash not found - Verify your installation\nProgram cannot continue"), i18n("KsirK - Error!"));
......@@ -1208,7 +1207,7 @@ void KGameWindow::animExplosionForArena()
sprite->setAnimated(NKD);
QString sndCrashPath = m_dirs-> findResource("appdata", m_automaton->skin() + "/Sounds/crash.wav");
QString sndCrashPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Sounds/crash.wav");
if (sndCrashPath.isNull())
{
KMessageBox::information(this, i18n("Sound crash not found - Verify your installation\nProgram cannot continue"), i18n("KsirK - Error!"));
......@@ -1242,7 +1241,7 @@ void KGameWindow::animExplosionForArena()
sprite->setAnimated(1);
QString sndCrashPath = m_dirs-> findResource("appdata", m_automaton->skin() + "/Sounds/crash.wav");
QString sndCrashPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Sounds/crash.wav");
if (sndCrashPath.isNull())
{
KMessageBox::information(this, i18n("Sound crash not found - Verify your installation\nProgram cannot continue"), i18n("KsirK - Error!"));
......@@ -1405,7 +1404,7 @@ void KGameWindow::initCombatBringBackForArena(Country *attackingCountry, Country
qCDebug(KSIRK_LOG) << "add a sprite 4";
m_animFighters->addSprite(newSprite);
QString sndRoulePath = m_dirs-> findResource("appdata", m_automaton->skin() + "/Sounds/roll.wav");
QString sndRoulePath = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Sounds/roll.wav");
if (sndRoulePath.isNull())
{
KMessageBox::error(0, i18n("Sound roule not found - Verify your installation<br>Program cannot continue"), i18n("Error!"));
......@@ -1482,7 +1481,7 @@ void KGameWindow::initCombatBringBackForArena(Country *attackingCountry, Country
qCDebug(KSIRK_LOG) << "add a sprite 5";
m_animFighters->addSprite(newSprite);
QString sndRoulePath = m_dirs-> findResource("appdata", m_automaton->skin() + "/Sounds/roll.wav");
QString sndRoulePath = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Sounds/roll.wav");
if (sndRoulePath.isNull())
{
KMessageBox::error(0, i18n("Sound roule not found - Verify your installation<br>Program cannot continue"), i18n("Error!"));
......
......@@ -72,7 +72,6 @@
#include <kstandardgameaction.h>
#include <kstandardaction.h>
#include <kactioncollection.h>
#include <kstandarddirs.h>
#include <kmenubar.h>
#include "ksirk_debug.h"
#include <phonon/mediaobject.h>
......@@ -89,10 +88,8 @@
#include <QIcon>
#define USE_UNSTABLE_LIBKDEGAMESPRIVATE_API
#include <libkdegamesprivate/kgame/kgamechat.h>
#include <sys/utsname.h>
#include <QStandardPaths>
namespace Ksirk
{
......@@ -151,10 +148,9 @@ KGameWindow::KGameWindow(QWidget* parent) :
statusBar()->addWidget(m_barFlag);
m_dirs = KGlobal::dirs();
// m_accels.setEnabled(true);
QString iconFileName = m_dirs-> findResource("appdata", m_automaton->skin() + "/Images/soldierKneeling.png");
QString iconFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Images/soldierKneeling.png");
if (iconFileName.isNull())
{
KMessageBox::error(0, i18n("Cannot load icon<br>Program cannot continue"), i18n("Error!"));
......@@ -186,12 +182,12 @@ KGameWindow::KGameWindow(QWidget* parent) :
SLOT(slotChatMessage()));
m_upChatFloatPix.load(m_dirs->findResource("appdata", m_automaton->skin() + "/Images/2UpArrow.png"));
m_downChatFloatPix.load(m_dirs->findResource("appdata", m_automaton->skin() + "/Images/2DownArrow.png"));
m_upChatFloatPix.load(QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Images/2UpArrow.png"));
m_downChatFloatPix.load(QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Images/2DownArrow.png"));
m_chatIsReduced = false;
m_titleChatMsg = new QLabel(i18n("No message..."));
QPixmap downChatReducePix(m_dirs->findResource("appdata", m_automaton->skin() + "/Images/downArrow.png"));
QPixmap downChatReducePix(QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Images/downArrow.png"));
m_reduceChatButton = new QPushButton(downChatReducePix,"");
m_floatChatButton = new QPushButton(m_upChatFloatPix,"");
m_reduceChatButton->setFixedSize(30,30);
......@@ -331,7 +327,7 @@ KGameWindow::KGameWindow(QWidget* parent) :
KGameWindow::~KGameWindow()
{
qCDebug(KSIRK_LOG);
m_dirs = 0;
if (m_jabberClient != 0)
{
delete m_jabberClient;
......@@ -382,7 +378,7 @@ void KGameWindow::initActions()
KStandardAction::preferences( this, SLOT(optionsConfigure()), actionCollection() );
// specific ksirk action
QString imageFileName = m_dirs-> findResource("appdata", "jabber.png");
QString imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, "jabber.png");
// qCDebug(KSIRK_LOG) << "Trying to load button image file: " << imageFileName;
if (imageFileName.isNull())
{
......@@ -399,7 +395,7 @@ void KGameWindow::initActions()
actionCollection()->addAction("game_jabber", m_jabberAction);
// specific ksirk action
imageFileName = m_dirs-> findResource("appdata", m_automaton->skin() + '/' + CM_NEWNETGAME);
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + '/' + CM_NEWNETGAME);
// qCDebug(KSIRK_LOG) << "Trying to load button image file: " << imageFileName;
if (imageFileName.isNull())
{
......@@ -416,7 +412,7 @@ void KGameWindow::initActions()
// specific ksirk action
imageFileName = m_dirs-> findResource("appdata", m_automaton->skin() + '/' + CM_NEWNETGAME);
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + '/' + CM_NEWNETGAME);
// qCDebug(KSIRK_LOG) << "Trying to load button image file: " << imageFileName;
if (imageFileName.isNull())
{
......@@ -450,7 +446,7 @@ void KGameWindow::initActions()
actionCollection()->addAction("help_contextual", m_contextualHelpAction);
QString nextPlayerActionImageFileName = KGlobal::dirs()->findResource("appdata", m_automaton->skin() + '/' + CM_NEXTPLAYER);
QString nextPlayerActionImageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + '/' + CM_NEXTPLAYER);
m_nextPlayerAction = new QAction(QIcon(nextPlayerActionImageFileName),
i18n("Next Player"), this);
connect(m_nextPlayerAction, SIGNAL(triggered(bool)), this, SLOT(slotNextPlayer()));
......@@ -578,7 +574,7 @@ void KGameWindow::newSkin(const QString& onuFileName)
QString onuDefinitionFileName = onuFileName;
if (onuDefinitionFileName.isEmpty())
{
onuDefinitionFileName = m_dirs-> findResource("appdata", m_automaton->skin() + "/Data/world.desktop");
onuDefinitionFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Data/world.desktop");
}
else if (!QFile::exists(onuDefinitionFileName))
{
......@@ -740,7 +736,7 @@ KRightDialog * KGameWindow::getRightDialog()
void KGameWindow::initView()
{
qCDebug(KSIRK_LOG);
QString iconFileName = m_dirs-> findResource("appdata", m_automaton->skin() + "/Images/soldierKneeling.png");
QString iconFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Images/soldierKneeling.png");
if (iconFileName.isNull())
{
KMessageBox::error(0, i18n("Cannot load icon<br>Program cannot continue"), i18n("Error!"));
......@@ -1257,11 +1253,11 @@ void KGameWindow::createDefenseDialog()
QString skin = m_automaton->game()->theWorld()->skin();
QString imageFileName;
imageFileName = KGlobal::dirs()->findResource("appdata", skin + "/Images/defendOne.png");
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + "/Images/defendOne.png");
def1->setIcon(QIcon(imageFileName));
imageFileName = KGlobal::dirs()->findResource("appdata", skin + "/Images/defendTwo.png");
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + "/Images/defendTwo.png");
def2->setIcon(QIcon(imageFileName));
imageFileName = KGlobal::dirs()->findResource("appdata", skin + "/Images/attackAuto.png");
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + "/Images/attackAuto.png");
defAuto->setIcon(QIcon(imageFileName));
......@@ -3087,7 +3083,7 @@ void KGameWindow::reduceChat()
m_lastWidthChat = m_bottomDock->width();
// reduce the chat
QPixmap upChatReducePix(m_dirs->findResource("appdata", m_automaton->skin() + "/Images/upArrow.png"));
QPixmap upChatReducePix(QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Images/upArrow.png"));
m_reduceChatButton->setIcon(upChatReducePix);
m_chatDlg->hide();
m_titleChatMsg->show();
......@@ -3099,7 +3095,7 @@ void KGameWindow::unreduceChat()
m_chatIsReduced = false;
// restore the chat
QPixmap downChatReducePix(m_dirs->findResource("appdata", m_automaton->skin() + "/Images/downArrow.png"));
QPixmap downChatReducePix(QStandardPaths::locate(QStandardPaths::AppDataLocation, m_automaton->skin() + "/Images/downArrow.png"));
m_reduceChatButton->setIcon(downChatReducePix);
m_chatDlg->show();
m_titleChatMsg->hide();
......
......@@ -48,7 +48,7 @@
// include files for KDE
#include <ksharedconfig.h>
#include <KXmlGuiWindow>
#include <KStandardDirs>
#include <QStandardPaths>
#include <KShortcut>
// #include <kdialogbase.h>
......@@ -1013,11 +1013,6 @@ private: // Private members
*/
mainMenu* m_mainMenu;
/**
* a shortcut to the standard dirs object.
*/
KStandardDirs* m_dirs;
/**
* This button is used to display the flag of the currently active player
* in the status bar.
......
......@@ -71,19 +71,19 @@ KRightDialog::KRightDialog(QDockWidget * parent, ONU * world,KGameWindow* m_game
delete sprite;
// load the stopAttackAuto image
QString imageFileName = KGlobal::dirs()->findResource("appdata", skin + "/Images/stopAttackAuto.png");
QString imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + "/Images/stopAttackAuto.png");
stopAttackAuto.load(imageFileName);
// load the recycle image
imageFileName = KGlobal::dirs()->findResource("appdata", skin + '/' +CM_RECYCLING);
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + '/' +CM_RECYCLING);
recycleContinue.load(imageFileName);
// load the finish recycle image
imageFileName = KGlobal::dirs()->findResource("appdata", skin + '/' + CM_RECYCLINGFINISHED);
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + '/' + CM_RECYCLINGFINISHED);
recycleDone.load(imageFileName);
// load the next player image
imageFileName = KGlobal::dirs()->findResource("appdata", skin + '/' + CM_NEXTPLAYER);
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + '/' + CM_NEXTPLAYER);
recycleNextPlayer.load(imageFileName);
show();
......@@ -180,7 +180,7 @@ void KRightDialog::displayFightDetails(Country * attaker, Country * defender,int
KConfig config(world->getConfigFileName());
KConfigGroup onugroup = config.group("onu");
QString skin = onugroup.readEntry("skinpath");
QString imageFileName = KGlobal::dirs()->findResource("appdata", skin + "/Images/loader.gif");
QString imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, skin + "/Images/loader.gif");
QMovie * loading = new QMovie(imageFileName);
loadingLabel->setMovie(loading);
......
......@@ -35,9 +35,9 @@ mainMenu::mainMenu(Ksirk::KGameWindow* game, QWidget* parent) : QWidget(parent)
QString imageFileName;
QPixmap imag1, imag2;
imageFileName = KGlobal::dirs()->findResource("appdata", "skins/default/Images/logoRight.png");
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, "skins/default/Images/logoRight.png");
imag1.load(imageFileName);
imageFileName = KGlobal::dirs()->findResource("appdata", "skins/default/Images/logoLeft.png");
imageFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, "skins/default/Images/logoLeft.png");
imag2.load(imageFileName);
lImage1->setPixmap(imag1.scaled(100,100,Qt::KeepAspectRatioByExpanding));
......
......@@ -20,7 +20,7 @@
#include <KLocalizedString>
#include "ksirk_debug.h"
#include <KStandardDirs>
#include <QStandardPaths>
#include <KMessageBox>
#include <qdir.h>
......@@ -33,12 +33,10 @@ m_automaton(automaton), m_skin(""), m_worlds(), m_players(),
m_useGoals(true), m_networkGameType(Ksirk::GameLogic::GameAutomaton::None),
m_tcpPort(20000)
{
KStandardDirs *m_dirs = KGlobal::dirs();
QStringList skinsDirs = m_dirs->findDirs("appdata","skins");
QStringList skinsDirs = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, "skins", QStandardPaths::LocateDirectory);
qCDebug(KSIRK_LOG) << skinsDirs;
foreach (const QString &skinsDirName, skinsDirs)
{
// QString skinsDirName = m_dirs->findResourceDir("appdata", "skins/skinsdir");
if (skinsDirName.isEmpty())
{
KMessageBox::error(0,
......@@ -53,11 +51,11 @@ m_automaton(automaton), m_skin(""), m_worlds(), m_players(),
foreach (const QString& name, skinsDirsNames)
{
qCDebug(KSIRK_LOG) << "Got skin dir name: " << name;
QDir skinDir(skinsDirName + name);
QDir skinDir(skinsDirName + '/' + name);
if (skinDir.exists())
{
qCDebug(KSIRK_LOG) << "Got skin dir: " << skinDir.dirName();
GameLogic::ONU* world = new GameLogic::ONU(automaton,skinsDirName + skinDir.dirName() + "/Data/world.desktop");
GameLogic::ONU* world = new GameLogic::ONU(automaton,skinsDirName + '/' + skinDir.dirName() + "/Data/world.desktop");
if (!world->skin().isEmpty())
{
m_worlds[i18n(world->name().toUtf8().data())] = world;
......
......@@ -57,7 +57,6 @@
#include <kstandardgameaction.h>
#include <kstandardaction.h>
#include <kactioncollection.h>
#include <kstandarddirs.h>
#include <kmenubar.h>
#include "ksirkskineditor_debug.h"
#include <ktextedit.h>
......@@ -127,9 +126,7 @@ MainWindow::MainWindow(QWidget* parent) :
m_cannonButton->setEnabled(false);
connect(m_cannonButton,SIGNAL(clicked()),this,SLOT(slotCannonButtonClicked()));
m_dirs = KGlobal::dirs();
QString anchorFileName = m_dirs-> findResource("appdata", "cross.png");
QString anchorFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, "cross.png");
if (anchorFileName.isNull())
{
KMessageBox::error(0, i18n("Cannot load anchor icon<br>Program cannot continue"), i18n("Error"));
......@@ -143,7 +140,7 @@ MainWindow::MainWindow(QWidget* parent) :
m_anchorButton->setEnabled(false);
connect(m_anchorButton,SIGNAL(clicked()),this,SLOT(slotAnchorButtonClicked()));
QString centerFileName = m_dirs-> findResource("appdata", "target.png");
QString centerFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, "target.png");
if (centerFileName.isNull())
{
KMessageBox::error(0, i18n("Cannot load center icon<br>Program cannot continue"), i18n("Error"));
......@@ -160,7 +157,7 @@ MainWindow::MainWindow(QWidget* parent) :
// m_accels.setEnabled(true);
QString iconFileName = m_dirs-> findResource("appdata", "ksirkskineditor.png");
QString iconFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, "ksirkskineditor.png");
/* if (iconFileName.isNull())
{
KMessageBox::error(0, i18n("Cannot load icon<br>Program cannot continue"), i18n("Error"));
......@@ -315,7 +312,6 @@ MainWindow::MainWindow(QWidget* parent) :
MainWindow::~MainWindow()
{
qCDebug(KSIRKSKINEDITOR_LOG);
m_dirs = 0;
KSharedConfig::Ptr config = KSharedConfig::openConfig();
if (m_rfa != 0)
{
......@@ -683,7 +679,7 @@ void MainWindow::slotAnchorButtonClicked()
}
else if (m_skinDefWidget->countrieslist->currentItem()!=0)
{
QString anchorFileName = m_dirs-> findResource("appdata", "cross.png");
QString anchorFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, "cross.png");
if (anchorFileName.isNull())
{
KMessageBox::error(0, i18n("Cannot load anchor icon<br>Program cannot continue"), i18n("Error"));
......@@ -712,7 +708,7 @@ void MainWindow::slotCenterButtonClicked()
}
else if (m_skinDefWidget->countrieslist->currentItem()!=0)
{
QString centerFileName = m_dirs-> findResource("appdata", "target.png");
QString centerFileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, "target.png");
if (centerFileName.isNull())
{
KMessageBox::error(0, i18n("Cannot load center icon<br>Program cannot continue"), i18n("Error"));
......@@ -811,7 +807,7 @@ void MainWindow::slotPressPosition(const QPointF& clickedPoint)
break;
case Anchor:
qCDebug(KSIRKSKINEDITOR_LOG) << "Adding anchor";
fileName = m_dirs-> findResource("appdata", "cross.png");
fileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, "cross.png");
if (fileName.isNull())
{
KMessageBox::error(0, i18n("Cannot load anchor icon<br>Program cannot continue"), i18n("Error"));
......@@ -828,7 +824,7 @@ void MainWindow::slotPressPosition(const QPointF& clickedPoint)
break;
case Center:
qCDebug(KSIRKSKINEDITOR_LOG) << "Adding center";
fileName = m_dirs-> findResource("appdata", "target.png");
fileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, "target.png");
if (fileName.isNull())
{
KMessageBox::error(0, i18n("Cannot load center icon<br>Program cannot continue"), i18n("Error"));
......@@ -1198,7 +1194,7 @@ void MainWindow::createPixmapFor(Country* country, SpriteType type)
item = new PixmapItem();
item->setZValue(3);
qCDebug(KSIRKSKINEDITOR_LOG) << "Adding anchor";
fileName = m_dirs-> findResource("appdata", "cross.png");
fileName = QStandardPaths::locate(QStandardPaths::AppDataLocation, "cross.png");
if (fileName.isNull())
{
KMessageBox::error(0, i18n("Cannot load anchor icon<br>Program cannot continue"), i18n("Error"));
......
......@@ -38,7 +38,6 @@
// include files for KDE
#include <ksharedconfig.h>
#include <KXmlGuiWindow>
#include <KStandardDirs>
#include <KShortcut>
#include <KUrl>
// include files for kde games
......@@ -245,11 +244,6 @@ private:
Country* currentCountry();
void createPixmapFor(Country* country, SpriteType type);
/**
* a shortcut to the standard dirs object.
*/
KStandardDirs* m_dirs;
/**
* Audio player object: play all the sounds of the 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