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 c27e4858 authored by Nemanja Hiršl's avatar Nemanja Hiršl

Port KDE's deprecated classes

- Remaining KFileDialog to QFileDialog
- KIntSpinBox and KIntNumInput to QSpinBox
- KTabWidget to QTabWidget
- Use of KPixmapCache to QPixmapCache
- Usage of KComponentData (KGlobal::mainComponent().aboutData) replaced with KAboutData::applicationData()
- include kmenubar.h replaced with QMenuBar
parent fade6f36
......@@ -62,13 +62,11 @@
// include files for KDE
#include <kiconloader.h>
#include <kmessagebox.h>
#include <kfiledialog.h>
#include <KLocalizedString>
#include <kconfig.h>
#include <kstandardgameaction.h>
#include <kstandardaction.h>
#include <kactioncollection.h>
#include <kmenubar.h>
#include "ksirk_debug.h"
#include <ktextedit.h>
#include <phonon/mediaobject.h>
......
......@@ -34,7 +34,7 @@
</widget>
</item>
<item>
<widget class="KIntSpinBox" name="playersNumberEntry">
<widget class="QSpinBox" name="playersNumberEntry">
<property name="toolTip">
<string>Spin this to choose the number of players.</string>
</property>
......@@ -55,7 +55,7 @@
</widget>
</item>
<item>
<widget class="KIntSpinBox" name="localPlayersNumberEntry"/>
<widget class="QSpinBox" name="localPlayersNumberEntry"/>
</item>
</layout>
</item>
......@@ -69,7 +69,7 @@
</widget>
</item>
<item>
<widget class="KIntSpinBox" name="tcpPortEntry">
<widget class="QSpinBox" name="tcpPortEntry">
<property name="minimum">
<number>1</number>
</property>
......@@ -252,13 +252,6 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KIntSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>skinCombo</tabstop>
<tabstop>playersNumberEntry</tabstop>
......
......@@ -56,7 +56,7 @@
</spacer>
</item>
<item row="1" column="1">
<widget class="KIntSpinBox" name="portEdit">
<widget class="QSpinBox" name="portEdit">
<property name="minimum">
<number>1</number>
</property>
......@@ -130,13 +130,6 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KIntSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>
</customwidget>
</customwidgets>
<includes>
<include location="local">kpassworddialog.h</include>
</includes>
......
......@@ -162,8 +162,7 @@ GameAutomaton::GameAutomaton() :
m_attackAuto(false),
m_defenseAuto(false),
m_port(KSIRK_DEFAULT_PORT),
m_startingGame(false),
m_pixmapCache("GameAutomaton")
m_startingGame(false)
{
m_skin = "skins/default";
// qCDebug(KSIRK_LOG) << endl;
......
......@@ -30,8 +30,6 @@
#include <libkdegamesprivate/kgame/kmessageio.h>
#include <libkdegamesprivate/kgamesvgdocument.h>
#include <KPixmapCache>
#include <QPointF>
#include <QString>
#include <QSvgRenderer>
......@@ -394,7 +392,6 @@ public:
bool startingGame() const;
KPixmapCache& pixmapCache() {return m_pixmapCache;}
QSvgRenderer& rendererFor(const QString& skinName);
KGameSvgDocument& svgDomFor(const QString& skinName);
......@@ -494,7 +491,7 @@ protected:
void setGoalFor(Player* player);
private:
GameAutomaton(const GameAutomaton& /*ga*/) : KGame(), m_pixmapCache("GameAutomaton") {};
GameAutomaton(const GameAutomaton& /*ga*/) : KGame() {};
void countriesDistribution();
......@@ -593,7 +590,6 @@ private:
bool m_startingGame;
KPixmapCache m_pixmapCache;
QMap<QString, QSvgRenderer*> m_renderers;
QMap<QString, KGameSvgDocument> m_svgDoms;
......
......@@ -29,8 +29,9 @@
#include <qdom.h>
#include <QPainter>
#include <QPixmap>
#include <QPixmapCache>
#include <QFileInfo>
#include <QMenuBar>
#include <kapplication.h>
#include <kglobal.h>
#include <KLocalizedString>
......@@ -62,7 +63,7 @@ ONU::ONU(GameAutomaton* automaton,
qCDebug(KSIRK_LOG) << "ONU constructor: " << m_configFileName;
QFileInfo qfi(m_configFileName);
qCDebug(KSIRK_LOG) << "skin written at :" << qfi.lastModified().toTime_t();
qCDebug(KSIRK_LOG) << "cache created at:" << m_automaton->pixmapCache().timestamp();
//qCDebug(KSIRK_LOG) << "cache created at:" << m_automaton->pixmapCache().timestamp();
#pragma message("port to qt5")
#if 0
if (m_automaton->pixmapCache().timestamp() < qfi.lastModified().toTime_t())
......@@ -103,7 +104,7 @@ ONU::ONU(GameAutomaton* automaton,
m_skin = onugroup.readEntry("skinpath");
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))
if (!QPixmapCache::find(m_skin+"snapshot", m_snapshot))
{
// Pixmap isn't in the cache, create it and insert to cache
m_snapshot = QPixmap(QStandardPaths::locate(QStandardPaths::AppDataLocation, m_skin + "/Images/snapshot.jpg"));
......@@ -111,7 +112,7 @@ ONU::ONU(GameAutomaton* automaton,
{
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);
QPixmapCache::insert(m_skin+"snapshot", m_snapshot);
}
m_width = onugroup.readEntry("width",0);
m_height = onugroup.readEntry("height",0);
......@@ -152,7 +153,7 @@ ONU::ONU(GameAutomaton* automaton,
}
qCDebug(KSIRK_LOG) << "Loading map mask file: " << mapMaskFileName;
QPixmap countriesMaskPix;
if (!m_automaton->pixmapCache().find(m_skin+"mapmask", countriesMaskPix))
if (!QPixmapCache::find(m_skin+"mapmask", countriesMaskPix))
{
// Pixmap isn't in the cache, create it and insert to cache
countriesMaskPix = QPixmap(mapMaskFileName);
......@@ -160,7 +161,7 @@ ONU::ONU(GameAutomaton* automaton,
{
qCCritical(KSIRK_LOG) << "Was not able to load the map mask image: " << mapMaskFileName << endl;
}
m_automaton->pixmapCache().insert(m_skin+"mapmask", countriesMaskPix);
QPixmapCache::insert(m_skin+"mapmask", countriesMaskPix);
}
// countriesMask = QImage(mapMaskFileName);
countriesMask = countriesMaskPix.toImage();
......@@ -582,7 +583,7 @@ void ONU::buildMap()
{
qCDebug(KSIRK_LOG) << "with zoom="<< m_zoom;
//QSize size((int)(m_automaton->rendererFor(m_skin).defaultSize().width()*m_zoom),(int)(m_automaton->rendererFor(m_skin).defaultSize().height()*m_zoom));
if (!m_automaton->pixmapCache().find(m_skin+"map"+QString::number(m_width)+QString::number(m_height), m_map))
if (!QPixmapCache::find(m_skin+"map"+QString::number(m_width)+QString::number(m_height), m_map))
{
// Pixmap isn't in the cache, create it and insert to cache
QSize size((int)(m_width),(int)(m_height));
......@@ -627,7 +628,7 @@ void ONU::buildMap()
countryName);
}
m_automaton->pixmapCache().insert(m_skin+"map"+QString::number(m_width)+QString::number(m_height), m_map);
QPixmapCache::insert(m_skin+"map"+QString::number(m_width)+QString::number(m_height), m_map);
}
}
......
......@@ -30,6 +30,7 @@
#include <QPoint>
#include <QPixmap>
#include <QPixmapCache>
#include <QSvgRenderer>
#include <kmessagebox.h>
......@@ -115,11 +116,9 @@ void AnimSprite::sequenceConstruction()
{
QList<QPixmap> list;
KPixmapCache& cache = const_cast<ONU*>(backGnd->onu())->automaton()->pixmapCache();
QPixmap allpm;
QString allpmCacheId = m_skin+m_svgid+QString::number(m_width*frames)+"x"+QString::number(m_height*nbVersions);
if (!cache.find(allpmCacheId, allpm))
if (!QPixmapCache::find(allpmCacheId, allpm))
{
// Pixmap isn't in the cache, create it and insert to cache
QSize size((int)(m_width*frames), (int)(m_height*nbVersions));
......@@ -129,7 +128,7 @@ void AnimSprite::sequenceConstruction()
m_renderer->render(&p, m_svgid);
allpm = QPixmap::fromImage(image);
cache.insert(allpmCacheId, allpm);
QPixmapCache::insert(allpmCacheId, allpm);
}
for (unsigned int l = 0; l<nbVersions;l++)
......@@ -139,13 +138,13 @@ void AnimSprite::sequenceConstruction()
// qCDebug(KSIRK_LOG)<< "constr s : "<<m_width<<" "<<m_height<<" "<<look-1<<endl;
QPixmap pm;
QString pmCacheId = m_skin+m_svgid+QString::number(m_width*frames)+"x"+QString::number(m_height*nbVersions)+"-"+QString::number(i)+":"+QString::number(l);
if (!cache.find(pmCacheId, pm))
if (!QPixmapCache::find(pmCacheId, pm))
{
// Pixmap isn't in the cache, create it and insert to cache
pm = allpm.copy((int)(m_width*i), (int)(m_height*l),
(int)(m_width), (int)(m_height));
cache.insert(pmCacheId, pm);
QPixmapCache::insert(pmCacheId, pm);
}
list.push_back(pm);
......
......@@ -46,7 +46,6 @@
// include files for KDE
#include <kiconloader.h>
#include <kmessagebox.h>
#include <kfiledialog.h>
#include <KLocalizedString>
#include <kconfig.h>
#include <kstandardaction.h>
......
......@@ -60,19 +60,19 @@
#include <QMovie>
#include <QUuid>
#include <QHostInfo>
#include <QFileDialog>
#include <QMenuBar>
// include files for KDE
#include <KUrl>
#include <K4AboutData>
#include <kiconloader.h>
#include <kmessagebox.h>
#include <kfiledialog.h>
#include <KLocalizedString>
#include <kconfig.h>
#include <kstandardgameaction.h>
#include <kstandardaction.h>
#include <kactioncollection.h>
#include <kmenubar.h>
#include "ksirk_debug.h"
#include <phonon/mediaobject.h>
#include <QPushButton>
......@@ -305,12 +305,12 @@ KGameWindow::KGameWindow(QWidget* parent) :
struct utsname utsBuf;
uname (&utsBuf);
m_jabberClient->setClientName ("KsirK");
m_jabberClient->setClientVersion (KGlobal::mainComponent().aboutData()->version ());
m_jabberClient->setClientVersion (KAboutData::applicationData().version());
m_jabberClient->setOSName (QString ("%1 %2").arg (utsBuf.sysname, 1).arg (utsBuf.release, 2));
// Set caps node information
m_jabberClient->setCapsNode("http://ksirk.kde.org/jabber/caps");
m_jabberClient->setCapsVersion(KGlobal::mainComponent().aboutData()->version());
m_jabberClient->setCapsVersion(KAboutData::applicationData().version());
// Set Disco Identity information
DiscoItem::Identity identity;
......@@ -1096,7 +1096,7 @@ bool KGameWindow::actionOpenGame()
{
qCDebug(KSIRK_LOG) << "KGameWindow::actionOpenGame";
QString fileName = KFileDialog::getOpenFileName(KUrl(), "*.xml", this, i18n("KsirK - Load Game"));
QString fileName = QFileDialog::getOpenFileName(this, i18n("KsirK - Load Game"), QString(), "*.xml");
if (!fileName.isEmpty())
{
m_fileName = fileName;
......
......@@ -21,10 +21,8 @@
#include "ksirkskineditorsettings.h"
#include "ui_preferences.h"
#include <kfiledialog.h>
#include <kconfig.h>
#include <kurl.h>
#include <ktabwidget.h>
#include <kedittoolbar.h>
#include "ksirkskineditor_debug.h"
#include <QPushButton>
......
......@@ -24,7 +24,7 @@
</widget>
</item>
<item>
<widget class="KIntNumInput" name="bonus" >
<widget class="QSpinBox" name="bonus" >
<property name="toolTip" >
<string>Number of bonus points when owning the full continent</string>
</property>
......@@ -70,13 +70,6 @@ A list of all the world's countries will be shown and you will be able to select
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>KIntNumInput</class>
<extends>QWidget</extends>
<header>knuminput.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
......@@ -75,7 +75,7 @@
</widget>
</item>
<item row="3" column="1" >
<widget class="KIntNumInput" name="infantryx" >
<widget class="QSpinBox" name="infantryx" >
<property name="toolTip" >
<string>Infantry's sprite top left point x-coordinate</string>
</property>
......@@ -102,7 +102,7 @@ This value will be automatically updated if you move the infantry.</string>
</widget>
</item>
<item row="3" column="3" >
<widget class="KIntNumInput" name="infantryy" >
<widget class="QSpinBox" name="infantryy" >
<property name="toolTip" >
<string>Infantry's sprite top left point y-coordinate</string>
</property>
......@@ -126,7 +126,7 @@ This value will be automatically updated if you move the infantry by drag and dr
</widget>
</item>
<item row="4" column="1" >
<widget class="KIntNumInput" name="cavalryx" >
<widget class="QSpinBox" name="cavalryx" >
<property name="toolTip" >
<string>Cavalry's sprite top left point x-coordinate</string>
</property>
......@@ -153,7 +153,7 @@ This value will be automatically updated if you move the cavalry.</string>
</widget>
</item>
<item row="4" column="3" >
<widget class="KIntNumInput" name="cavalryy" >
<widget class="QSpinBox" name="cavalryy" >
<property name="toolTip" >
<string>Cavalry's sprite top left point y-coordinate</string>
</property>
......@@ -187,7 +187,7 @@ This value will be automatically updated if you move the cavalry by drag and dro
</widget>
</item>
<item row="5" column="3" >
<widget class="KIntNumInput" name="cannony" >
<widget class="QSpinBox" name="cannony" >
<property name="toolTip" >
<string>Cannon's sprite top left point y-coordinate</string>
</property>
......@@ -204,7 +204,7 @@ This value will be automatically updated if you move the cannon by drag and drop
</widget>
</item>
<item row="5" column="1" >
<widget class="KIntNumInput" name="cannonx" >
<widget class="QSpinBox" name="cannonx" >
<property name="toolTip" >
<string>Cannon's sprite top left point x-coordinate</string>
</property>
......@@ -221,7 +221,7 @@ This value will be automatically updated if you move the cannon.</string>
</widget>
</item>
<item row="2" column="3" >
<widget class="KIntNumInput" name="centery" >
<widget class="QSpinBox" name="centery" >
<property name="toolTip" >
<string>Point around which the country name is drawn y-coordinate</string>
</property>
......@@ -241,7 +241,7 @@ This value will be automatically updated if you move the country name by draggin
</widget>
</item>
<item row="2" column="1" >
<widget class="KIntNumInput" name="centerx" >
<widget class="QSpinBox" name="centerx" >
<property name="toolTip" >
<string>Point around which the country name is drawn x-coordinate</string>
</property>
......@@ -260,7 +260,7 @@ This value will be automatically updated if you move the country name by draggin
</widget>
</item>
<item row="1" column="3" >
<widget class="KIntNumInput" name="anchory" >
<widget class="QSpinBox" name="anchory" >
<property name="toolTip" >
<string>Center of the highlighting y-coordinate</string>
</property>
......@@ -277,7 +277,7 @@ This value will be automatically updated if you move the highlighting by draggin
</widget>
</item>
<item row="1" column="1" >
<widget class="KIntNumInput" name="anchorx" >
<widget class="QSpinBox" name="anchorx" >
<property name="toolTip" >
<string>Center of the highlighting x-coordinate</string>
</property>
......@@ -294,7 +294,7 @@ This value will be automatically updated if you move the highlighting by draggin
</widget>
</item>
<item row="0" column="3" >
<widget class="KIntNumInput" name="flagy" >
<widget class="QSpinBox" name="flagy" >
<property name="toolTip" >
<string>Flag's sprite top left point y-coordinate</string>
</property>
......@@ -311,7 +311,7 @@ This value will be automatically updated if you move the flag by drag and drop.<
</widget>
</item>
<item row="0" column="1" >
<widget class="KIntNumInput" name="flagx" >
<widget class="QSpinBox" name="flagx" >
<property name="toolTip" >
<string>Flag's sprite top left point x-coordinate</string>
</property>
......@@ -357,13 +357,6 @@ A list of all the world's countries will be shown and you will be able to select
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>KIntNumInput</class>
<extends>QWidget</extends>
<header>knuminput.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
......@@ -48,7 +48,7 @@
</widget>
</item>
<item>
<widget class="KIntNumInput" name="widthLineEdit" >
<widget class="QSpinBox" name="widthLineEdit" >
<property name="toolTip" >
<string>Map's width</string>
</property>
......@@ -66,7 +66,7 @@
</widget>
</item>
<item>
<widget class="KIntNumInput" name="heightLineEdit" >
<widget class="QSpinBox" name="heightLineEdit" >
<property name="toolTip" >
<string>Map's height</string>
</property>
......@@ -165,7 +165,7 @@
</widget>
</item>
<item>
<widget class="KTabWidget" name="ktabwidget" >
<widget class="QTabWidget" name="qtabwidget" >
<property name="whatsThis" >
<string/>
</property>
......@@ -453,17 +453,6 @@ Each goal name should be unique. Select a goal and edit its details in the right
<extends>QWidget</extends>
<header>kfontrequester.h</header>
</customwidget>
<customwidget>
<class>KIntNumInput</class>
<extends>QWidget</extends>
<header>knuminput.h</header>
</customwidget>
<customwidget>
<class>KTabWidget</class>
<extends>QTabWidget</extends>
<header>ktabwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
......
This diff is collapsed.
......@@ -47,6 +47,7 @@
#include <QGraphicsSvgItem>
#include <QBitmap>
#include <QInputDialog>
#include <QMenuBar>
// include files for KDE
#include <kiconloader.h>
......@@ -57,7 +58,6 @@
#include <kstandardgameaction.h>
#include <kstandardaction.h>
#include <kactioncollection.h>
#include <kmenubar.h>
#include "ksirkskineditor_debug.h"
#include <ktextedit.h>
#include <phonon/mediaobject.h>
......@@ -240,8 +240,8 @@ MainWindow::MainWindow(QWidget* parent) :
connect(m_spritesDefWidget->explodingv, SIGNAL(valueChanged(int)), this, SLOT(slotExplodingVersionsChanged(int)));
connect(m_skinDefWidget->ktabwidget, SIGNAL(currentChanged(int)), this, SLOT(slotSkinPartTabChanged(int)));
m_skinDefWidget->ktabwidget-> setCurrentIndex(0);
connect(m_skinDefWidget->qtabwidget, SIGNAL(currentChanged(int)), this, SLOT(slotSkinPartTabChanged(int)));
m_skinDefWidget->qtabwidget-> setCurrentIndex(0);
m_skinDefWidget->countrieslist->setSortingEnabled (true);
connect(m_skinDefWidget->countrieslist, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(slotCountrySelected(QListWidgetItem*)));
......
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