[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [granatier] /: removed last bits of kdelibs4support
From: Mathias Kraus <k.hias () gmx ! de>
Date: 2015-02-24 19:49:58
Message-ID: E1YQLUU-0007vM-61 () scm ! kde ! org
[Download RAW message or body]
Git commit d14b9228222ae2b77353c63ac2638b2178ff49a8 by Mathias Kraus.
Committed on 24/02/2015 at 19:48.
Pushed by mkraus into branch 'master'.
removed last bits of kdelibs4support
M +1 -2 CMakeLists.txt
M +1 -1 src/CMakeLists.txt
M +20 -15 src/config/arenaselector.cpp
M +2 -8 src/config/arenaselector.ui
M +4 -61 src/config/playerselector.cpp
M +0 -8 src/config/playerselector.h
M +2 -2 src/config/playerselectoritem.cpp
M +2 -2 src/config/playerselectoritem.h
M +9 -4 src/config/playersettings.cpp
http://commits.kde.org/granatier/d14b9228222ae2b77353c63ac2638b2178ff49a8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e7e9357..d65bae4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,8 +20,7 @@ find_package(KF5 REQUIRED COMPONENTS
XmlGui
KIO
NewStuff
- NotifyConfig
- KDELibs4Support)
+ NotifyConfig)
find_package(KF5KDEGames 4.9.0 REQUIRED)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6b0a12c..08313b9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -45,7 +45,7 @@ kde4_add_app_icon(granatierSources \
"${CMAKE_CURRENT_SOURCE_DIR}/../pictures/hi*-
add_executable(granatier ${granatierSources})
-target_link_libraries(granatier Qt5::Xml Qt5::Widgets KF5::NewStuff KF5KDEGames \
KF5::KDELibs4Support Qt5::Svg KF5::DBusAddons) +target_link_libraries(granatier \
Qt5::Xml Qt5::Widgets KF5::NewStuff KF5KDEGames Qt5::Svg KF5::DBusAddons)
install(TARGETS granatier ${INSTALL_TARGETS_DEFAULT_ARGS})
diff --git a/src/config/arenaselector.cpp b/src/config/arenaselector.cpp
index c494bfe..73cc35b 100644
--- a/src/config/arenaselector.cpp
+++ b/src/config/arenaselector.cpp
@@ -26,16 +26,13 @@
#include <QtCore/QPointer>
-#include <KGlobal>
#include <KgTheme>
#include <QIcon>
#include <KGameRenderer>
-#include <KStandardDirs>
#include <KConfigSkeleton>
#include <KNS3/DownloadDialog>
-#include <KSaveFile>
+#include <QFile>
#include <QDir>
-#include <KComponentData>
#include <QStandardPaths>
#include "ui_arenaselector.h"
@@ -104,7 +101,7 @@ void ArenaSelector::showEvent(QShowEvent*)
ArenaSelector::Private::Private(ArenaSelector* parent, Options options) : q(parent), \
m_options(options), m_arena(NULL), m_graphicsScene(NULL), m_svgScaleFactor(1) {
KgTheme* theme = new KgTheme(QByteArray());
- theme->setGraphicsPath(QStandardPaths::locate(QStandardPaths::DataLocation, \
QString("themes/granatier.svgz"))); + \
theme->setGraphicsPath(QStandardPaths::locate(QStandardPaths::AppDataLocation, \
QString("themes/granatier.svgz"))); m_renderer = new KGameRenderer(theme);
}
@@ -155,7 +152,6 @@ void ArenaSelector::Private::setupData(KConfigSkeleton * aconfig)
m_tempRandomArenaModeArenaList.removeDuplicates();
//Now get our arenas into the list widget
- KGlobal::dirs()->addResourceType("arenaselector", "data", \
KGlobal::mainComponent().componentName() + '/' + lookupDirectory + '/'); \
findArenas(lastUsedArena);
connect(ui.importArenas, SIGNAL(clicked()), q, SLOT(_k_importArenasDialog()));
@@ -173,11 +169,11 @@ void ArenaSelector::Private::findArenas(const QString \
&initialSelection) ui.arenaList->setSortingEnabled(true);
QStringList arenasAvailable;
- const QStringList dirs = \
QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "granatier/arenas", \
QStandardPaths::LocateDirectory); + const QStringList dirs = \
QStandardPaths::locateAll(QStandardPaths::AppDataLocation, "arenas", \
QStandardPaths::LocateDirectory); Q_FOREACH (const QString& dir, dirs) {
const QStringList fileNames = QDir(dir).entryList(QStringList() << \
QStringLiteral("*.desktop")); Q_FOREACH (const QString& file, fileNames) {
- arenasAvailable.append(dir + '/' + file);
+ arenasAvailable.append(file);
}
}
@@ -200,6 +196,7 @@ void ArenaSelector::Private::findArenas(const QString \
&initialSelection) }
bool initialFound = false;
+
foreach (const QString &file, arenasAvailable)
{
QString arenaPath = lookupDirectory + '/' + file;
@@ -480,6 +477,12 @@ void ArenaSelector::Private::_k_openKNewStuffDialog()
void ArenaSelector::Private::_k_importArenasDialog()
{
+ // get local directory for arenas
+ const QString arenaDir = \
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + \
QStringLiteral("/arenas/"); + // create path if it does not exist
+ if(!QDir(arenaDir).exists()) QDir().mkpath(arenaDir);
+
+
//find the clanbomber files
QStringList listClanbomberPaths;
listClanbomberPaths.append(QDir::homePath() + "/.clanbomber/maps/");
@@ -502,10 +505,10 @@ void ArenaSelector::Private::_k_importArenasDialog()
QString strAuthor = readStream.readLine();
int nNumberOfPlayers = readStream.readLine().toInt();
- KSaveFile desktopFile;
+ QFile desktopFile;
QString strName = listMaps[j].left(listMaps[j].count()-4);
- desktopFile.setFileName(QString("%1clanbomber_%2.desktop").arg(KStandardDirs::locateLocal("appdata", \
"arenas/")).arg(strName));
- desktopFile.open();
+ desktopFile.setFileName(QString("%1clanbomber_%2.desktop").arg(arenaDir).arg(strName));
+ desktopFile.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream streamDesktopFile(&desktopFile);
streamDesktopFile << "[Arena]\n";
@@ -517,7 +520,6 @@ void ArenaSelector::Private::_k_importArenasDialog()
streamDesktopFile << "AuthorEmail=-\n";
streamDesktopFile.flush();
- desktopFile.finalize();
desktopFile.close();
QStringList arena;
@@ -546,9 +548,9 @@ void ArenaSelector::Private::_k_importArenasDialog()
arena.replaceInStrings("8", "p");
arena.replaceInStrings("9", "p");
- KSaveFile arenaFile;
- arenaFile.setFileName(QString("%1clanbomber_%2.xml").arg(KStandardDirs::locateLocal("appdata", \
"arenas/")).arg(strName));
- arenaFile.open();
+ QFile arenaFile;
+ arenaFile.setFileName(QString("%1clanbomber_%2.xml").arg(arenaDir).arg(strName));
+ arenaFile.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream streamArenaFile(&arenaFile);
@@ -559,6 +561,9 @@ void ArenaSelector::Private::_k_importArenasDialog()
streamArenaFile << " <Row>" << arena[j] << "</Row>\n";
}
streamArenaFile << "</Arena>\n";
+
+ streamArenaFile.flush();
+ arenaFile.close();
}
}
diff --git a/src/config/arenaselector.ui b/src/config/arenaselector.ui
index fa0504c..6810ef8 100644
--- a/src/config/arenaselector.ui
+++ b/src/config/arenaselector.ui
@@ -149,7 +149,7 @@
</layout>
</item>
<item>
- <widget class="KLineEdit" name="kcfg_Arena">
+ <widget class="QLineEdit" name="kcfg_Arena">
<property name="enabled">
<bool>false</bool>
</property>
@@ -163,13 +163,7 @@
</item>
</layout>
</widget>
- <customwidgets>
- <customwidget>
- <class>KLineEdit</class>
- <extends>QLineEdit</extends>
- <header>klineedit.h</header>
- </customwidget>
- </customwidgets>
+ <customwidgets/>
<resources/>
<connections/>
</ui>
diff --git a/src/config/playerselector.cpp b/src/config/playerselector.cpp
index 5cda9ed..cf1e061 100644
--- a/src/config/playerselector.cpp
+++ b/src/config/playerselector.cpp
@@ -35,13 +35,12 @@
#include <QVBoxLayout>
#include <QSpacerItem>
#include <QtSvg/QSvgRenderer>
-#include <KStandardDirs>
+#include <QStandardPaths>
#include <KConfig>
#include <KLocalizedString>
#include <KNS3/DownloadDialog>
#include <QIcon>
#include <KConfigGroup>
-#include <KDialog>
//PlayerSelectorDelegate declaration
#include <QStyledItemDelegate>
class PlayerSelectorDelegate : public QStyledItemDelegate
@@ -124,12 +123,12 @@ void PlayerSelector::Private::fillList()
item->setFlags(item->flags() & ~Qt::ItemIsSelectable);
playerSelectorItem = new PlayerSelectorItem(playerIDs[i], m_playerSettings, \
m_list);
-
- renderer.load(KStandardDirs::locate("appdata", \
QString("players/%1").arg(m_playerSettings->playerGraphicsFile(playerIDs[i])))); +
+ renderer.load(QStandardPaths::locate(QStandardPaths::AppDataLocation, \
QStringLiteral("players/%1").arg(m_playerSettings->playerGraphicsFile(playerIDs[i]))));
renderer.render(&pixPainter, "player_0");
playerSelectorItem->setPlayerPreviewPixmap(pixmap);
- KConfig desktopFile(KStandardDirs::locate("appdata", "players/" + \
playerIDs[i]), KConfig::SimpleConfig); + KConfig \
desktopFile(QStandardPaths::locate(QStandardPaths::DataLocation, \
QStringLiteral("players/%1").arg(playerIDs[i])), \
KConfig::SimpleConfig);
QString author = \
desktopFile.group("KGameTheme").readEntry<QString>("Author", "");
QString authorEmail = QString("<a \
href=\"mailto:%1\">%1</a>").arg(desktopFile.group("KGameTheme").readEntry<QString>("AuthorEmail", \
""));
//TODO: QString description = \
desktopFile.group("KGameTheme").readEntry<QString>("Description", ""); @@ -154,62 \
+153,6 @@ void PlayerSelector::Private::_k_showNewStuffDialog() delete dialog;
}
-class PlayerSelector::Dialog : public KDialog
-{
- public:
- Dialog(PlayerSelector* sel, const QString& caption)
- {
- setMainWidget(sel);
- //replace
- QPushButton* btn = sel->d->m_knsButton;
- if (btn)
- {
- btn->hide();
- setButtons(Close | User1);
- setButtonText(User1, btn->text());
- //cannot use btn->icon() because setButtonIcon() wants KIcon
- setButtonIcon(User1, QIcon::fromTheme("get-hot-new-stuff"));
- connect(this, SIGNAL(user1Clicked()), btn, SIGNAL(clicked()));
- }
- else
- {
- setButtons(Close);
- }
- //window caption
- if (caption.isEmpty())
- {
- setCaption(i18nc("@title:window config dialog", "Select player"));
- }
- else
- {
- setCaption(caption);
- }
- show();
- }
- protected:
- virtual void closeEvent(QCloseEvent* event)
- {
- event->accept();
- PlayerSelector* sel = qobject_cast<PlayerSelector*>(mainWidget());
- //delete myself, but *not* the PlayerSelector
- sel->setParent(0);
- deleteLater();
- //restore the KNS button
- if (sel->d->m_knsButton)
- {
- sel->d->m_knsButton->show();
- }
- }
-};
-
-void PlayerSelector::showAsDialog(const QString& caption)
-{
- if (!isVisible())
- {
- new PlayerSelector::Dialog(this, caption);
- }
-}
-
//END PlayerSelector
//BEGIN PlayerSelectorDelegate
diff --git a/src/config/playerselector.h b/src/config/playerselector.h
index 2547e4d..73f70a9 100644
--- a/src/config/playerselector.h
+++ b/src/config/playerselector.h
@@ -41,15 +41,7 @@ public:
explicit PlayerSelector(PlayerSettings* playerSettings, Options options = \
DefaultBehavior, QWidget* parent = 0); virtual ~PlayerSelector();
-public Q_SLOTS:
- ///Create and show a non-modal dialog which displays this selector.
- ///The dialog will be automatically cleaned up when it's closed, but it
- ///is ensured that the selector is not deleted.
- ///
- ///This method does nothing if the selector widget is already visible.
- void showAsDialog(const QString& caption = QString());
private:
- class Dialog;
class Private;
Private* const d;
diff --git a/src/config/playerselectoritem.cpp b/src/config/playerselectoritem.cpp
index c270b2c..6ee24ef 100644
--- a/src/config/playerselectoritem.cpp
+++ b/src/config/playerselectoritem.cpp
@@ -25,7 +25,7 @@
#include <QSpacerItem>
#include <QCheckBox>
-#include <KLineEdit>
+#include <QLineEdit>
#include <KKeySequenceWidget>
#include <KLocalizedString>
@@ -34,7 +34,7 @@ PlayerSelectorItem::PlayerSelectorItem(const QString& playerId, \
PlayerSettings* {
m_selectCheckBox = new QCheckBox;
m_selectCheckBox->setChecked(m_playerSettings->enabled(playerId));
- m_playerName = new KLineEdit(m_playerSettings->playerName(playerId));
+ m_playerName = new QLineEdit(m_playerSettings->playerName(playerId));
m_playerName->setFixedWidth(200);
m_playerPreviewPixmap = new QPixmap(QSize(64, 64));
m_playerPreviewPixmapAlphaChannel = new QPixmap(QSize(64, 64));
diff --git a/src/config/playerselectoritem.h b/src/config/playerselectoritem.h
index 4e008f7..117d3f8 100644
--- a/src/config/playerselectoritem.h
+++ b/src/config/playerselectoritem.h
@@ -23,7 +23,7 @@
class PlayerSettings;
class QCheckBox;
class QLabel;
-class KLineEdit;
+class QLineEdit;
class KKeySequenceWidget;
class PlayerSelectorItem : public QWidget
@@ -33,7 +33,7 @@ class PlayerSelectorItem : public QWidget
private:
QCheckBox* m_selectCheckBox;
- KLineEdit* m_playerName;
+ QLineEdit* m_playerName;
QPixmap* m_playerPreviewPixmap;
QPixmap* m_playerPreviewPixmapAlphaChannel;
diff --git a/src/config/playersettings.cpp b/src/config/playersettings.cpp
index db3dcd4..2578b38 100644
--- a/src/config/playersettings.cpp
+++ b/src/config/playersettings.cpp
@@ -18,10 +18,9 @@
#include "playersettings.h"
#include "settings.h"
-#include <KStandardDirs>
#include <KConfig>
#include <KConfigGroup>
-#include <KGlobal>
+#include <QDir>
#include <QStandardPaths>
PlayerSettings::PlayerSettings()
@@ -29,8 +28,14 @@ PlayerSettings::PlayerSettings()
QStringList playersAvailable;
QStringList playerFilesAvailable;
QStringList playerNamesAvailable;
- KGlobal::dirs()->addResourceType("players", "data", "granatier/players/");
- KGlobal::dirs()->findAllResources("players", "*.desktop", \
KStandardDirs::Recursive, playersAvailable); +
+ const QStringList dirs = \
QStandardPaths::locateAll(QStandardPaths::AppDataLocation, "players", \
QStandardPaths::LocateDirectory); + Q_FOREACH (const QString& dir, dirs) {
+ const QStringList fileNames = QDir(dir).entryList(QStringList() << \
QStringLiteral("*.desktop")); + Q_FOREACH (const QString& file, fileNames) {
+ playersAvailable.append(file);
+ }
+ }
playersAvailable.removeDuplicates();
playersAvailable.sort();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic