...
 
Commits (3)
......@@ -70,7 +70,7 @@ bool KgAudioScene::hasError()
KgOpenALRuntime::KgOpenALRuntime()
: m_volume(1)
, m_error(false)
, m_context(0)
, m_context(nullptr)
, m_device(alcOpenDevice(""))
{
if (!m_device)
......@@ -79,7 +79,7 @@ KgOpenALRuntime::KgOpenALRuntime()
m_error = true;
return;
}
m_context = alcCreateContext(m_device, 0);
m_context = alcCreateContext(m_device, nullptr);
int error = alcGetError(m_device);
if (error != AL_NO_ERROR)
{
......@@ -95,7 +95,7 @@ KgOpenALRuntime::~KgOpenALRuntime()
{
if (m_context == alcGetCurrentContext())
{
alcMakeContextCurrent(0);
alcMakeContextCurrent(nullptr);
}
alcDestroyContext(m_context);
alcCloseDevice(m_device);
......
......@@ -51,7 +51,7 @@ int QPaintDeviceColorProxy::metric(QPaintDevice::PaintDeviceMetric metric) const
typedef int (QPaintDevice::*MetricFunction)(void) const;
static const MetricFunction metricFunctions[] = {
0,
nullptr,
&QPaintDevice::width, // QPaintDevice::PdmWidth == 1
&QPaintDevice::height,
&QPaintDevice::widthMM,
......@@ -108,7 +108,7 @@ QPen QPaintDeviceColorProxy::map(const QPen& pen) const
//BEGIN QPaintEngineColorProxy
QPaintEngineColorProxy::QPaintEngineColorProxy()
: m_proxy(0)
: m_proxy(nullptr)
, m_painter(new QPainter)
{
}
......@@ -158,7 +158,7 @@ bool QPaintEngineColorProxy::end()
{
return false;
}
m_proxy = 0;
m_proxy = nullptr;
return m_painter->end();
}
......
......@@ -107,7 +107,7 @@ KScoreDialog::KScoreDialog(int fields, QWidget *parent)
setWindowTitle( i18n(DEFAULT_GROUP_NAME) );
setModal( true );
d->highscoreObject = new KHighscore();
d->edit = 0;
d->edit = nullptr;
fields |= Score; //Make 'Score' field automatic (it can be hidden if necessary)
d->fields = fields;
d->hiddenFields = 0;
......@@ -644,7 +644,7 @@ void KScoreDialog::slotGotName()
d->stack[d->newName.first].at((d->newName.second-1))->setCurrentWidget(label);
d->stack[d->newName.first].at((d->newName.second-1))->removeWidget(d->edit);
delete d->edit;
d->edit = 0;
d->edit = nullptr;
d->newName = QPair<QByteArray,int>(QByteArray(),-1);
d->scores[d->configGroup].removeAt(10);
d->comment.clear(); // hide the congratulations
......@@ -661,7 +661,7 @@ void KScoreDialog::slotForgetScore()
d->stack[d->newName.first].at((d->newName.second-1))->removeWidget(d->edit);
// delete the editor
delete d->edit;
d->edit = 0;
d->edit = nullptr;
// avoid to recreate the KTextEdit widget
d->newName = QPair<QByteArray,int>(QByteArray(),-1);
// delete the highscore to forget
......
......@@ -95,7 +95,7 @@ public:
KGamePopupItemPrivate()
: m_position( KGamePopupItem::BottomLeft ), m_timeout(2000),
m_opacity(1.0), m_animOpacity(-1), m_hoveredByMouse(false),
m_hideOnClick(true), m_textChildItem(0),
m_hideOnClick(true), m_textChildItem(nullptr),
m_sharpness(KGamePopupItem::Square), m_linkHovered(false) {}
/**
* Timeline for animations
......@@ -243,7 +243,7 @@ void KGamePopupItem::showMessage( const QString& text, Position pos, ReplaceMode
// NOTE: we blindly take first visible view we found. I.e. we don't support
// multiple views. If no visible scene is found, we simply pick the first one.
QGraphicsView *sceneView = 0;
QGraphicsView *sceneView = nullptr;
foreach (QGraphicsView *view, scene()->views()) {
if (view->isVisible()) {
sceneView = view;
......
......@@ -26,7 +26,7 @@ class KGameRenderedItemPrivate
KGameRenderedItem::KGameRenderedItem(KGameRenderer* renderer, const QString& spriteKey, QGraphicsItem* parent)
: QGraphicsPixmapItem(parent)
, KGameRendererClient(renderer, spriteKey)
, d(0)
, d(nullptr)
{
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
}
......
......@@ -33,7 +33,7 @@ class KGameRenderedObjectItemPrivate : public QGraphicsPixmapItem
bool contains(const QPointF& point) const override;
bool isObscuredBy(const QGraphicsItem* item) const override;
QPainterPath opaqueArea() const override;
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) override;
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
QPainterPath shape() const override;
public:
KGameRenderedObjectItem* m_parent;
......@@ -45,7 +45,7 @@ class KGameRenderedObjectItemPrivate : public QGraphicsPixmapItem
KGameRenderedObjectItemPrivate::KGameRenderedObjectItemPrivate(KGameRenderedObjectItem* parent)
: QGraphicsPixmapItem(parent)
, m_parent(parent)
, m_primaryView(0)
, m_primaryView(nullptr)
, m_correctRenderSize(0, 0)
, m_fixedSize(-1, -1)
{
......
......@@ -100,7 +100,7 @@ class KDEGAMES_EXPORT KGameRenderedObjectItem : public QGraphicsObject, public K
bool contains(const QPointF& point) const override;
bool isObscuredBy(const QGraphicsItem* item) const override;
QPainterPath opaqueArea() const override;
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) override;
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
QPainterPath shape() const override;
protected:
void receivePixmap(const QPixmap& pixmap) override;
......
......@@ -46,7 +46,7 @@ static const QString cacheName(QByteArray theme)
KGameRendererPrivate::KGameRendererPrivate(KgThemeProvider* provider, unsigned cacheSize, KGameRenderer* parent)
: m_parent(parent)
, m_provider(provider)
, m_currentTheme(0) //will be loaded on first use
, m_currentTheme(nullptr) //will be loaded on first use
, m_frameSuffix(QStringLiteral("_%1"))
, m_sizePrefix(QStringLiteral("%1-%2-"))
, m_frameCountPrefix(QStringLiteral("fc-"))
......@@ -55,9 +55,9 @@ KGameRendererPrivate::KGameRendererPrivate(KgThemeProvider* provider, unsigned c
, m_cacheSize((cacheSize == 0 ? 3 : cacheSize) << 20)
, m_strategies(KGameRenderer::UseDiskCache | KGameRenderer::UseRenderingThreads)
, m_frameBaseIndex(0)
, m_defaultPrimaryView(0)
, m_defaultPrimaryView(nullptr)
, m_rendererPool(&m_workerPool)
, m_imageCache(0)
, m_imageCache(nullptr)
{
qRegisterMetaType<KGRInternal::Job*>();
......@@ -150,7 +150,7 @@ void KGameRenderer::setStrategyEnabled(KGameRenderer::Strategy strategy, bool en
const KgTheme* theme = d->m_currentTheme;
if (theme)
{
d->m_currentTheme = 0; //or setTheme() will return immediately
d->m_currentTheme = nullptr; //or setTheme() will return immediately
d->_k_setTheme(theme);
}
}
......@@ -248,7 +248,7 @@ bool KGameRendererPrivate::setTheme(const KgTheme* theme)
}
//disconnect from disk cache (only needed if changing strategy)
delete m_imageCache;
m_imageCache = 0;
m_imageCache = nullptr;
}
//clear in-process caches
m_pixmapCache.clear();
......@@ -411,7 +411,7 @@ bool KGameRenderer::spriteExists(const QString& key) const
QPixmap KGameRenderer::spritePixmap(const QString& key, const QSize& size, int frame, const QHash<QColor, QColor>& customColors) const
{
QPixmap result;
d->requestPixmap(KGRInternal::ClientSpec(key, frame, size, customColors), 0, &result);
d->requestPixmap(KGRInternal::ClientSpec(key, frame, size, customColors), nullptr, &result);
return result;
}
......@@ -547,8 +547,8 @@ void KGRInternal::Worker::run()
{
QImage image(m_job->spec.size, QImage::Format_ARGB32_Premultiplied);
image.fill(transparentRgba);
QPainter* painter = 0;
QPaintDeviceColorProxy* proxy = 0;
QPainter* painter = nullptr;
QPaintDeviceColorProxy* proxy = nullptr;
//if no custom colors requested, paint directly onto image
if (m_job->spec.customColors.isEmpty())
{
......@@ -600,7 +600,7 @@ void KGRInternal::RendererPool::setPath(const QString& graphicsPath, QSvgRendere
QHash<QSvgRenderer*, QThread*>::const_iterator it1 = m_hash.constBegin(), it2 = m_hash.constEnd();
for (; it1 != it2; ++it1)
{
Q_ASSERT(it1.value() == 0); //nobody may be using our renderers anymore now
Q_ASSERT(it1.value() == nullptr); //nobody may be using our renderers anymore now
delete it1.key();
}
m_hash.clear();
......@@ -610,7 +610,7 @@ void KGRInternal::RendererPool::setPath(const QString& graphicsPath, QSvgRendere
if (renderer)
{
m_valid = Checked_Valid;
m_hash.insert(renderer, 0);
m_hash.insert(renderer, nullptr);
}
else
{
......@@ -622,7 +622,7 @@ bool KGRInternal::RendererPool::hasAvailableRenderers() const
{
//look for a renderer which is not associated with a thread
QMutexLocker locker(&m_mutex);
return m_hash.key(0) != 0;
return m_hash.key(nullptr) != nullptr;
}
QSvgRenderer* KGRInternal::RendererPool::allocRenderer()
......@@ -630,13 +630,13 @@ QSvgRenderer* KGRInternal::RendererPool::allocRenderer()
QThread* thread = QThread::currentThread();
//look for an available renderer
QMutexLocker locker(&m_mutex);
QSvgRenderer* renderer = m_hash.key(0);
QSvgRenderer* renderer = m_hash.key(nullptr);
if (!renderer)
{
//instantiate a new renderer (only if the SVG file has not been found to be invalid yet)
if (m_valid == Checked_Invalid)
{
return 0;
return nullptr;
}
renderer = new QSvgRenderer(m_path);
m_valid = renderer->isValid() ? Checked_Valid : Checked_Invalid;
......@@ -650,7 +650,7 @@ void KGRInternal::RendererPool::freeRenderer(QSvgRenderer* renderer)
{
//mark renderer as available
QMutexLocker locker(&m_mutex);
m_hash.insert(renderer, 0);
m_hash.insert(renderer, nullptr);
}
//END KGRInternal::RendererPool
......
......@@ -60,7 +60,7 @@ namespace KGRInternal
//The second argument can be used to pass an instance which has been
//used earlier to check the validity of the SVG file.
inline void setPath(const QString& graphicsPath, QSvgRenderer* renderer = 0);
inline void setPath(const QString& graphicsPath, QSvgRenderer* renderer = nullptr);
//This can be used to determine whether a call to allocRenderer()
//would need to create a new renderer instance.
inline bool hasAvailableRenderers() const;
......@@ -112,7 +112,7 @@ class KGameRendererPrivate : public QObject
void _k_setTheme(const KgTheme* theme);
bool setTheme(const KgTheme* theme);
inline QString spriteFrameKey(const QString& key, int frame, bool normalizeFrameNo = false) const;
void requestPixmap(const KGRInternal::ClientSpec& spec, KGameRendererClient* client, QPixmap* synchronousResult = 0);
void requestPixmap(const KGRInternal::ClientSpec& spec, KGameRendererClient* client, QPixmap* synchronousResult = nullptr);
private:
inline void requestPixmap__propagateResult(const QPixmap& pixmap, KGameRendererClient* client, QPixmap* synchronousResult);
public Q_SLOTS:
......
......@@ -22,7 +22,7 @@
KgDeclarativeView::KgDeclarativeView(QWidget *parent) :
QQuickWidget(parent),
d(0) //unused for now, for future expandability
d(nullptr) //unused for now, for future expandability
{
KDeclarative::KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(engine());
......
......@@ -107,7 +107,7 @@ KgDifficultyLevel::Private* KgDifficultyLevel::Private::fromStandardLevel(KgDiff
data = qMakePair(QByteArray("Impossible"), i18nc("Game difficulty level 8 out of 8", "Impossible"));
break;
case Custom:
return 0;
return nullptr;
}
return new KgDifficultyLevel::Private(level, data.first, data.second, level, isDefault);
}
......@@ -152,7 +152,7 @@ class KgDifficulty::Private
const KgDifficultyLevel* m_currentLevel;
bool m_editable, m_gameRunning;
Private() : m_currentLevel(0), m_editable(true), m_gameRunning(false) {}
Private() : m_currentLevel(nullptr), m_editable(true), m_gameRunning(false) {}
};
static void saveLevel()
......@@ -183,7 +183,7 @@ void KgDifficulty::addLevel(KgDifficultyLevel* level)
//start to work with the currentLevel(). The first call to currentLevel()
//will load the previous selection from the config, and the level list will
//be considered immutable from this point.
Q_ASSERT_X(d->m_currentLevel == 0,
Q_ASSERT_X(d->m_currentLevel == nullptr,
"KgDifficulty::addLevel",
"Only allowed before currentLevel() is called."
);
......@@ -309,7 +309,7 @@ void KgDifficulty::select(const KgDifficultyLevel* level)
//ask for confirmation if necessary
if (d->m_gameRunning)
{
const int result = KMessageBox::warningContinueCancel(0,
const int result = KMessageBox::warningContinueCancel(nullptr,
i18n("Changing the difficulty level will end the current game!"),
QString(), KGuiItem(i18n("Change the difficulty level"))
);
......
......@@ -192,7 +192,7 @@ namespace KgDifficultyGUI
///KgDifficulty instance in the given @a window.
///
///Without a second parameter, the Kg::difficulty() singleton is used.
KDEGAMES_EXPORT void init(KXmlGuiWindow* window, KgDifficulty* difficulty = 0);
KDEGAMES_EXPORT void init(KXmlGuiWindow* window, KgDifficulty* difficulty = nullptr);
}
#endif // KGDIFFICULTY_H
......@@ -46,7 +46,7 @@ class KgThemeProvider::Private
//this disables the addTheme() lock during rediscoverThemes()
bool m_inRediscover;
Private(KgThemeProvider *parent, const QByteArray& key) : q(parent), m_configKey(key), m_currentTheme(0), m_defaultTheme(0), m_inRediscover(false) {}
Private(KgThemeProvider *parent, const QByteArray& key) : q(parent), m_configKey(key), m_currentTheme(nullptr), m_defaultTheme(nullptr), m_inRediscover(false) {}
void updateThemeName()
{
......@@ -102,7 +102,7 @@ void KgThemeProvider::addTheme(KgTheme* theme)
//*then* start to work with the currentLevel(). The first call to
//currentTheme() will load the previous selection from the config, and the
//level list will be considered immutable from this point.
Q_ASSERT_X(d->m_currentTheme == 0 || d->m_inRediscover,
Q_ASSERT_X(d->m_currentTheme == nullptr || d->m_inRediscover,
"KgThemeProvider::addTheme",
"Only allowed before currentTheme() is called."
);
......@@ -196,7 +196,7 @@ void KgThemeProvider::rediscoverThemes()
return; //discoverThemes() was never called
}
KgTheme* defaultTheme = NULL;
KgTheme* defaultTheme = nullptr;
d->m_inRediscover = true;
const QString defaultFileName = d->m_dtDefaultThemeName + QLatin1String(".desktop");
......@@ -267,11 +267,11 @@ void KgThemeProvider::rediscoverThemes()
addTheme(theme);
}
if(defaultTheme != NULL)
if(defaultTheme != nullptr)
{
setDefaultTheme(defaultTheme);
}
else if(d->m_defaultTheme == NULL && themes.count() != 0)
else if(d->m_defaultTheme == nullptr && themes.count() != 0)
{
setDefaultTheme(themes.value(0));
}
......
......@@ -104,7 +104,7 @@ class KDEGAMES_EXPORT KgThemeProvider : public QObject
///instances of this KgTheme subclass. The @a themeClass must export
///(with the Q_INVOKABLE marker) a constructor with the same signature
///as the KgTheme constructor.
void discoverThemes(const QByteArray& resource, const QString& directory, const QString& defaultThemeName = QStringLiteral("default"), const QMetaObject* themeClass = 0);
void discoverThemes(const QByteArray& resource, const QString& directory, const QString& defaultThemeName = QStringLiteral("default"), const QMetaObject* themeClass = nullptr);
///After this provider has been set up with discoverThemes(), this
///method may be used to read additional themes which were added since
///the discoverThemes() call. This is esp. useful for KNewStuff
......
......@@ -55,7 +55,7 @@ class KgThemeSelector::Private
void fillList();
Private(KgThemeProvider* provider, Options options, KgThemeSelector* q) : q(q), m_provider(provider), m_options(options), m_knsButton(0) {}
Private(KgThemeProvider* provider, Options options, KgThemeSelector* q) : q(q), m_provider(provider), m_options(options), m_knsButton(nullptr) {}
void _k_updateListSelection(const KgTheme* theme);
void _k_updateProviderSelection();
......@@ -217,7 +217,7 @@ class KgThemeSelector::Dialog : public QDialog
{
event->accept();
//delete myself, but *not* the KgThemeSelector
mSelector->setParent(0);
mSelector->setParent(nullptr);
deleteLater();
//restore the KNS button
if (mSelector->d->m_knsButton)
......@@ -262,7 +262,7 @@ void KgThemeDelegate::paint(QPainter* painter, const QStyleOptionViewItem& optio
const bool rtl = option.direction == Qt::RightToLeft;
QRect baseRect = option.rect;
//draw background
QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, 0);
QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, nullptr);
//draw thumbnail
QRect thumbnailBaseRect = this->thumbnailRect(baseRect);
const QPixmap thumbnail = index.data(Qt::DecorationRole).value<QPixmap>();
......
......@@ -50,34 +50,34 @@ struct KStandardGameActionInfo
const KStandardGameActionInfo g_rgActionInfo[] = {
// "game" menu
{ KStandardGameAction::New, KStandardShortcut::New, 0, "game_new", I18N_NOOP2("new game", "&New"), I18N_NOOP("Start a new game."), "document-new", I18N_NOOP("Start a new game") },
{ KStandardGameAction::Load, KStandardShortcut::Open, 0, "game_load", 0, I18N_NOOP("&Load..."), 0, "document-open", I18N_NOOP("Open a saved game...") },
{ KStandardGameAction::LoadRecent, KStandardShortcut::AccelNone, 0, "game_load_recent", 0, I18N_NOOP("Load &Recent"), 0, 0, I18N_NOOP("Open a recently saved game...") },
{ KStandardGameAction::Restart, KStandardShortcut::Reload, 0, "game_restart", 0, I18N_NOOP("Restart &Game"), 0, "view-refresh", I18N_NOOP("Restart the game") },
{ KStandardGameAction::Save, KStandardShortcut::Save, 0, "game_save", 0, I18N_NOOP("&Save"), 0, "document-save", I18N_NOOP("Save the current game") },
{ KStandardGameAction::SaveAs, KStandardShortcut::AccelNone, 0, "game_save_as", 0, I18N_NOOP("Save &As..."), 0, "document-save-as", I18N_NOOP("Save the current game to another file") },
{ KStandardGameAction::End, KStandardShortcut::End, 0, "game_end", 0, I18N_NOOP("&End Game"), 0, "window-close", I18N_NOOP("End the current game") },
{ KStandardGameAction::Pause, KStandardShortcut::AccelNone, Qt::Key_P, "game_pause", 0, I18N_NOOP("Pa&use"), 0, "media-playback-pause", I18N_NOOP("Pause the game") },
{ KStandardGameAction::Highscores, KStandardShortcut::AccelNone, Qt::CTRL+Qt::Key_H, "game_highscores", 0, I18N_NOOP("Show &High Scores"), 0, "games-highscores", I18N_NOOP("Show high scores") },
{ KStandardGameAction::ClearHighscores, KStandardShortcut::AccelNone, 0, "game_clear_highscores", 0, I18N_NOOP("&Clear High Scores"), 0, "clear_highscore", I18N_NOOP("Clear high scores") },
{ KStandardGameAction::Statistics, KStandardShortcut::AccelNone, 0, "game_statistics", 0, I18N_NOOP("Show Statistics"), 0, "highscore", I18N_NOOP("Show statistics") },
{ KStandardGameAction::ClearStatistics, KStandardShortcut::AccelNone, 0, "game_clear_statistics", 0, I18N_NOOP("&Clear Statistics"), 0, "flag", I18N_NOOP("Delete all-time statistics.") },
{ KStandardGameAction::Print, KStandardShortcut::Print, 0, "game_print", 0, I18N_NOOP("&Print..."), 0, "document-print", 0 },
{ KStandardGameAction::Quit, KStandardShortcut::Quit, 0, "game_quit", 0, I18N_NOOP("&Quit"), 0, "application-exit", I18N_NOOP("Quit the program") },
{ KStandardGameAction::Load, KStandardShortcut::Open, 0, "game_load", nullptr, I18N_NOOP("&Load..."), nullptr, "document-open", I18N_NOOP("Open a saved game...") },
{ KStandardGameAction::LoadRecent, KStandardShortcut::AccelNone, 0, "game_load_recent", nullptr, I18N_NOOP("Load &Recent"), nullptr, nullptr, I18N_NOOP("Open a recently saved game...") },
{ KStandardGameAction::Restart, KStandardShortcut::Reload, 0, "game_restart", nullptr, I18N_NOOP("Restart &Game"), nullptr, "view-refresh", I18N_NOOP("Restart the game") },
{ KStandardGameAction::Save, KStandardShortcut::Save, 0, "game_save", nullptr, I18N_NOOP("&Save"), nullptr, "document-save", I18N_NOOP("Save the current game") },
{ KStandardGameAction::SaveAs, KStandardShortcut::AccelNone, 0, "game_save_as", nullptr, I18N_NOOP("Save &As..."), nullptr, "document-save-as", I18N_NOOP("Save the current game to another file") },
{ KStandardGameAction::End, KStandardShortcut::End, 0, "game_end", nullptr, I18N_NOOP("&End Game"), nullptr, "window-close", I18N_NOOP("End the current game") },
{ KStandardGameAction::Pause, KStandardShortcut::AccelNone, Qt::Key_P, "game_pause", nullptr, I18N_NOOP("Pa&use"), nullptr, "media-playback-pause", I18N_NOOP("Pause the game") },
{ KStandardGameAction::Highscores, KStandardShortcut::AccelNone, Qt::CTRL+Qt::Key_H, "game_highscores", nullptr, I18N_NOOP("Show &High Scores"), nullptr, "games-highscores", I18N_NOOP("Show high scores") },
{ KStandardGameAction::ClearHighscores, KStandardShortcut::AccelNone, 0, "game_clear_highscores", nullptr, I18N_NOOP("&Clear High Scores"), nullptr, "clear_highscore", I18N_NOOP("Clear high scores") },
{ KStandardGameAction::Statistics, KStandardShortcut::AccelNone, 0, "game_statistics", nullptr, I18N_NOOP("Show Statistics"), nullptr, "highscore", I18N_NOOP("Show statistics") },
{ KStandardGameAction::ClearStatistics, KStandardShortcut::AccelNone, 0, "game_clear_statistics", nullptr, I18N_NOOP("&Clear Statistics"), nullptr, "flag", I18N_NOOP("Delete all-time statistics.") },
{ KStandardGameAction::Print, KStandardShortcut::Print, 0, "game_print", nullptr, I18N_NOOP("&Print..."), nullptr, "document-print", nullptr },
{ KStandardGameAction::Quit, KStandardShortcut::Quit, 0, "game_quit", nullptr, I18N_NOOP("&Quit"), nullptr, "application-exit", I18N_NOOP("Quit the program") },
// "move" menu
{ KStandardGameAction::Repeat, KStandardShortcut::AccelNone, 0, "move_repeat", 0, I18N_NOOP("Repeat"), 0, 0, I18N_NOOP("Repeat the last move") },
{ KStandardGameAction::Undo, KStandardShortcut::Undo, 0, "move_undo", 0, I18N_NOOP("Und&o"), 0, "edit-undo", I18N_NOOP("Undo the last move") },
{ KStandardGameAction::Redo, KStandardShortcut::Redo, 0, "move_redo", 0, I18N_NOOP("Re&do"), 0, "edit-redo", I18N_NOOP("Redo the latest move") },
{ KStandardGameAction::Roll, KStandardShortcut::AccelNone, Qt::CTRL+Qt::Key_R, "move_roll", 0, I18N_NOOP("&Roll Dice"), 0, "roll", I18N_NOOP("Roll the dice") },
{ KStandardGameAction::EndTurn, KStandardShortcut::AccelNone, 0, "move_end_turn", 0, I18N_NOOP("End Turn"), 0, "games-endturn", 0 },
{ KStandardGameAction::Hint, KStandardShortcut::AccelNone, Qt::Key_H, "move_hint", 0, I18N_NOOP("&Hint"), 0, "games-hint", I18N_NOOP("Give a hint") },
{ KStandardGameAction::Demo, KStandardShortcut::AccelNone, Qt::Key_D, "move_demo", 0, I18N_NOOP("&Demo"), 0, "media-playback-start", I18N_NOOP("Play a demo") },
{ KStandardGameAction::Solve, KStandardShortcut::AccelNone, 0, "move_solve", 0, I18N_NOOP("&Solve"), 0, "games-solve", I18N_NOOP("Solve the game") },
{ KStandardGameAction::Repeat, KStandardShortcut::AccelNone, 0, "move_repeat", nullptr, I18N_NOOP("Repeat"), nullptr, nullptr, I18N_NOOP("Repeat the last move") },
{ KStandardGameAction::Undo, KStandardShortcut::Undo, 0, "move_undo", nullptr, I18N_NOOP("Und&o"), nullptr, "edit-undo", I18N_NOOP("Undo the last move") },
{ KStandardGameAction::Redo, KStandardShortcut::Redo, 0, "move_redo", nullptr, I18N_NOOP("Re&do"), nullptr, "edit-redo", I18N_NOOP("Redo the latest move") },
{ KStandardGameAction::Roll, KStandardShortcut::AccelNone, Qt::CTRL+Qt::Key_R, "move_roll", nullptr, I18N_NOOP("&Roll Dice"), nullptr, "roll", I18N_NOOP("Roll the dice") },
{ KStandardGameAction::EndTurn, KStandardShortcut::AccelNone, 0, "move_end_turn", nullptr, I18N_NOOP("End Turn"), nullptr, "games-endturn", nullptr },
{ KStandardGameAction::Hint, KStandardShortcut::AccelNone, Qt::Key_H, "move_hint", nullptr, I18N_NOOP("&Hint"), nullptr, "games-hint", I18N_NOOP("Give a hint") },
{ KStandardGameAction::Demo, KStandardShortcut::AccelNone, Qt::Key_D, "move_demo", nullptr, I18N_NOOP("&Demo"), nullptr, "media-playback-start", I18N_NOOP("Play a demo") },
{ KStandardGameAction::Solve, KStandardShortcut::AccelNone, 0, "move_solve", nullptr, I18N_NOOP("&Solve"), nullptr, "games-solve", I18N_NOOP("Solve the game") },
// "settings" menu
{ KStandardGameAction::ChooseGameType, KStandardShortcut::AccelNone, 0, "options_choose_game_type", 0, I18N_NOOP("Choose Game &Type"), 0, 0, 0 },
{ KStandardGameAction::Carddecks, KStandardShortcut::AccelNone, 0, "options_configure_carddecks", 0, I18N_NOOP("Configure &Carddecks..."), 0, 0, 0 },
{ KStandardGameAction::ConfigureHighscores, KStandardShortcut::AccelNone, 0, "options_configure_highscores", 0, I18N_NOOP("Configure &High Scores..."), 0, 0, 0 },
{ KStandardGameAction::ChooseGameType, KStandardShortcut::AccelNone, 0, "options_choose_game_type", nullptr, I18N_NOOP("Choose Game &Type"), nullptr, nullptr, nullptr },
{ KStandardGameAction::Carddecks, KStandardShortcut::AccelNone, 0, "options_configure_carddecks", nullptr, I18N_NOOP("Configure &Carddecks..."), nullptr, nullptr, nullptr },
{ KStandardGameAction::ConfigureHighscores, KStandardShortcut::AccelNone, 0, "options_configure_highscores", nullptr, I18N_NOOP("Configure &High Scores..."), nullptr, nullptr, nullptr },
{ KStandardGameAction::ActionNone, KStandardShortcut::AccelNone, 0, 0, 0, 0, 0, 0, 0 }
{ KStandardGameAction::ActionNone, KStandardShortcut::AccelNone, 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }
};
static const KStandardGameActionInfo* infoPtr( KStandardGameAction::StandardGameAction id )
......@@ -86,16 +86,16 @@ static const KStandardGameActionInfo* infoPtr( KStandardGameAction::StandardGame
if( g_rgActionInfo[i].id == id )
return &g_rgActionInfo[i];
}
return 0;
return nullptr;
}
QAction* KStandardGameAction::create(StandardGameAction id, const QObject *recvr, const char *slot,
QObject* parent )
{
QAction* pAction = 0;
QAction* pAction = nullptr;
const KStandardGameActionInfo* pInfo = infoPtr( id );
qCDebug(GAMES_UI) << "KStandardGameAction::create( " << id << "=" << (pInfo ? pInfo->psName : (const char*)0) << "," << parent << " )";
qCDebug(GAMES_UI) << "KStandardGameAction::create( " << id << "=" << (pInfo ? pInfo->psName : (const char*)nullptr) << "," << parent << " )";
if( pInfo ) {
QString sLabel = i18nc(pInfo->psLabelContext, pInfo->psLabel);
bool do_connect = (recvr && slot); //both not 0
......@@ -150,7 +150,7 @@ QAction* KStandardGameAction::create(StandardGameAction id, const QObject *recvr
const char* KStandardGameAction::name( StandardGameAction id )
{
const KStandardGameActionInfo* pInfo = infoPtr( id );
return (pInfo) ? pInfo->psName : 0;
return (pInfo) ? pInfo->psName : nullptr;
}
QAction *KStandardGameAction::gameNew(const QObject *recvr, const char *slot,
......
enable_testing()
project(libkdegamesprivate)
if(BUILD_TESTING)
......
......@@ -39,9 +39,9 @@ class KChatBasePrivate
public:
KChatBasePrivate(KChatBaseModel* model, KChatBaseItemDelegate* delegate)
{
mBox = 0;
mEdit = 0;
mCombo = 0;
mBox = nullptr;
mEdit = nullptr;
mCombo = nullptr;
mAcceptMessage = true;
......@@ -73,10 +73,10 @@ KChatBaseModel* KChatBase::model()
KChatBase::KChatBase(QWidget* parent, KChatBaseModel* model, KChatBaseItemDelegate* delegate, bool noComboBox) : QFrame(parent)
{
KChatBaseModel* mod = model;
if (mod==0)
if (mod==nullptr)
mod = new KChatBaseModel(parent);
KChatBaseItemDelegate* del = delegate;
if (del == 0)
if (del == nullptr)
del = new KChatBaseItemDelegate(parent);
d = new KChatBasePrivate(mod, del);
......@@ -267,7 +267,7 @@ void KChatBase::setCompletionMode(KCompletion::CompletionMode mode)
void KChatBase::saveConfig(KConfig* conf)
{
if (conf == 0) {
if (conf == nullptr) {
return;
}
d->mModel->saveConfig(conf);
......@@ -275,7 +275,7 @@ void KChatBase::saveConfig(KConfig* conf)
void KChatBase::readConfig(KConfig* conf)
{
if (conf == 0) {
if (conf == nullptr) {
return;
}
d->mModel->readConfig(conf);
......
......@@ -263,14 +263,14 @@ public:
* to. If you use 0 then KGlobal::config() is used and the group is changed
* to "KChatBase" (the current group is restored at the end).
**/
virtual void saveConfig(KConfig* conf = 0);
virtual void saveConfig(KConfig* conf = nullptr);
/**
* Read the configuration from a KConfig object. If the pointer is
* NULL KGlobal::config() is used and the group is changed to "KChatBase".
* The current KConfig::group is restored after this call.
**/
virtual void readConfig(KConfig* conf = 0);
virtual void readConfig(KConfig* conf = nullptr);
/**
* Set the maximum number of items in the list. If the number of item
......
......@@ -172,14 +172,14 @@ public:
* to. If you use 0 then KGlobal::config() is used and the group is changed
* to "KChatBase" (the current group is restored at the end).
**/
virtual void saveConfig(KConfig* conf = 0);
virtual void saveConfig(KConfig* conf = nullptr);
/**
* Read the configuration from a KConfig object. If the pointer is
* NULL KGlobal::config() is used and the group is changed to "KChatBase".
* The current KConfig::group is restored after this call.
**/
virtual void readConfig(KConfig* conf = 0);
virtual void readConfig(KConfig* conf = nullptr);
/**
* Set the maximum number of items in the list. If the number of item
......
......@@ -54,7 +54,7 @@ public:
{
mUniquePlayerNumber = 0;
mPolicy=KGame::PolicyLocal;
mGameSequence = 0;
mGameSequence = nullptr;
}
int mUniquePlayerNumber;
......@@ -200,7 +200,7 @@ bool KGame::loadgame(QDataStream &stream, bool network,bool resetgame)
if (gameSequence())
{
gameSequence()->setCurrentPlayer(0); // TODO !!!
gameSequence()->setCurrentPlayer(nullptr); // TODO !!!
}
int newseed;
stream >> newseed;
......@@ -401,7 +401,7 @@ KPlayer * KGame::findPlayer(quint32 id) const
return *it;
}
}
return 0;
return nullptr;
}
// it is necessary that addPlayer and systemAddPlayer are called in the same
......@@ -574,7 +574,7 @@ bool KGame::systemRemove(KPlayer* p,bool deleteit)
emit signalPlayerLeftGame(p);
p->setGame(0);
p->setGame(nullptr);
if (deleteit)
{
delete p;
......@@ -767,7 +767,7 @@ bool KGame::systemPlayerInput(QDataStream &msg, KPlayer *player, quint32 sender)
KPlayer * KGame::playerInputFinished(KPlayer *player)
{
if ( !player )
return 0;
return nullptr;
qCDebug(GAMES_PRIVATE_KGAME) <<"player input finished for "<<player->id();
// Check for game over and if not allow the next player to move
......@@ -835,7 +835,7 @@ KPlayer *KGame::nextPlayer(KPlayer *last,bool exclusive)
{
return gameSequence()->nextPlayer(last, exclusive);
}
return 0;
return nullptr;
}
void KGame::setGameStatus(int status)
......@@ -950,7 +950,7 @@ void KGame::networkTransmission(QDataStream &stream, int msgid, quint32 receiver
qCDebug(GAMES_PRIVATE_KGAME) << ": Got IdAddPlayer";
if (sender!=gameId() || policy()!=PolicyDirty)
{
KPlayer *newplayer=0;
KPlayer *newplayer=nullptr;
// We sent the message so the player is already available
if (sender==gameId())
{
......@@ -1093,7 +1093,7 @@ void KGame::setupGameContinue(QDataStream& stream, quint32 sender)
qCDebug(GAMES_PRIVATE_KGAME) << " Still to deactivate "
<< (int)(cnt+playerCount()-inactivateIds.count())-(int)maxPlayers()
;
KPlayer *currentPlayer=0;
KPlayer *currentPlayer=nullptr;
int currentPriority=0x7fff; // MAX_UINT (16bit?) to get the maximum of the list
// find lowest network priority which is not yet in the newPlayerList
// do this for the new players
......@@ -1169,7 +1169,7 @@ void KGame::setupGameContinue(QDataStream& stream, quint32 sender)
{
sendSystemMessage(player->id(), KGameMessage::IdInactivatePlayer);
} else
player = 0;
player = nullptr;
}
else
{
......
......@@ -767,7 +767,7 @@ protected:
* @param list the optional list is the player list to be saved, default is playerList()
*
**/
void savePlayers(QDataStream &stream,KGamePlayerList *list=0);
void savePlayers(QDataStream &stream,KGamePlayerList *list=nullptr);
/**
* Prepare a player for being added. Put all data about a player into the
......
......@@ -38,8 +38,8 @@ class KGameChatPrivate
public:
KGameChatPrivate()
{
mFromPlayer = 0;
mGame = 0;
mFromPlayer = nullptr;
mGame = nullptr;
mToMyGroup = -1;
}
......@@ -72,7 +72,7 @@ KGameChat::KGameChat(QWidget* parent)
: KChatBase(parent),
d( new KGameChatPrivate )
{
init(0, -1);
init(nullptr, -1);
}
KGameChat::~KGameChat()
......@@ -201,7 +201,7 @@ void KGameChat::setFromPlayer(KPlayer* p)
if (!p) {
qCCritical(GAMES_PRIVATE_KGAME) << ": NULL player";
removeSendingEntry(d->mToMyGroup);
d->mFromPlayer = 0;
d->mFromPlayer = nullptr;
return;
}
if (d->mFromPlayer) {
......@@ -257,7 +257,7 @@ void KGameChat::slotUnsetKGame()
if (!d->mGame) {
return;
}
disconnect(d->mGame, 0, this, 0);
disconnect(d->mGame, nullptr, this, nullptr);
removeSendingEntry(d->mToMyGroup);
QMap<int, int>::Iterator it;
for (it = d->mSendId2PlayerId.begin(); it != d->mSendId2PlayerId.end(); ++it) {
......
......@@ -51,14 +51,14 @@ public:
* the chat message. The @p fromPlayer is the local player (see @ref
* setFromPlayer).
**/
KGameChat(KGame* game, int msgid, KPlayer* fromPlayer, QWidget * parent, KChatBaseModel* model=0, KChatBaseItemDelegate* delegate=0);
KGameChat(KGame* game, int msgid, KPlayer* fromPlayer, QWidget * parent, KChatBaseModel* model=nullptr, KChatBaseItemDelegate* delegate=nullptr);
/**
* @overload
* To make use of this widget you need to call @ref setFromPlayer
* manually.
**/
KGameChat(KGame* game, int msgId, QWidget* parent, KChatBaseModel* model=0, KChatBaseItemDelegate* delegate=0);
KGameChat(KGame* game, int msgId, QWidget* parent, KChatBaseModel* model=nullptr, KChatBaseItemDelegate* delegate=nullptr);
/**
* @overload
......
......@@ -40,7 +40,7 @@ class KGameIOPrivate
{
public:
KGameIOPrivate()
: mPlayer(0)
: mPlayer(nullptr)
{
}
......@@ -115,7 +115,7 @@ KGame* KGameIO::game() const
{
if (!player())
{
return 0;
return nullptr;
}
return player()->game();
}
......@@ -144,7 +144,7 @@ class KGameKeyIOPrivate
};
KGameKeyIO::KGameKeyIO(QWidget *parent)
: KGameIO(), d(0)
: KGameIO(), d(nullptr)
{
if (parent)
{
......@@ -199,7 +199,7 @@ class KGameMouseIOPrivate
};
KGameMouseIO::KGameMouseIO(QWidget *parent,bool trackmouse)
: KGameIO(), d(0)
: KGameIO(), d(nullptr)
{
if (parent)
{
......@@ -210,7 +210,7 @@ KGameMouseIO::KGameMouseIO(QWidget *parent,bool trackmouse)
}
KGameMouseIO::KGameMouseIO(QGraphicsScene *parent,bool /*trackmouse*/)
: KGameIO(), d(0)
: KGameIO(), d(nullptr)
{
if (parent)
{
......@@ -289,7 +289,7 @@ public:
{
//mMessageServer = 0;
//mMessageClient = 0;
mProcessIO=0;
mProcessIO=nullptr;
}
//KMessageServer *mMessageServer;
//KMessageClient *mMessageClient;
......@@ -334,7 +334,7 @@ KGameProcessIO::~KGameProcessIO()
if (d->mProcessIO)
{
delete d->mProcessIO;
d->mProcessIO=0;
d->mProcessIO=nullptr;
}
delete d;
}
......@@ -482,7 +482,7 @@ public:
mPauseCounter = 0;
mAdvanceTimer = 0;
mAdvanceTimer = nullptr;
}
int mAdvanceCounter;
int mReactionPeriod;
......
......@@ -37,10 +37,10 @@ class KGameNetworkPrivate
public:
KGameNetworkPrivate()
{
mMessageClient = 0;
mMessageServer = 0;
mMessageClient = nullptr;
mMessageServer = nullptr;
mDisconnectId = 0;
mService = 0;
mService = nullptr;
}
public:
......@@ -96,7 +96,7 @@ int KGameNetwork::cookie() const
{ return d->mCookie; }
bool KGameNetwork::isMaster() const
{ return (d->mMessageServer != 0); }
{ return (d->mMessageServer != nullptr); }
bool KGameNetwork::isAdmin() const
{ return (d->mMessageClient->isAdmin()); }
......@@ -224,9 +224,9 @@ bool KGameNetwork::connectToServer (KMessageIO *connection)
<< "make sure that all clients connect to that server! "
<< "quitting the local server now...";
stopServerConnection();
d->mMessageClient->setServer((KMessageIO*)0);
d->mMessageClient->setServer((KMessageIO*)nullptr);
delete d->mMessageServer;
d->mMessageServer = 0;
d->mMessageServer = nullptr;
}
qCDebug(GAMES_PRIVATE_KGAME) << " about to set server";
......
......@@ -56,7 +56,7 @@ KGamePropertyBase::~KGamePropertyBase()
void KGamePropertyBase::init()
{
mOwner = 0;
mOwner = nullptr;
setDirty(false);
// this is very useful and used by e.g. KGameDialog so
......@@ -90,7 +90,7 @@ int KGamePropertyBase::registerData(int id, KGamePropertyHandler* owner,Property
// we don't support changing the id
if (!owner) {
qCWarning(GAMES_PRIVATE_KGAME) << "Resetting owner=0. Sure you want to do this?";
mOwner=0;
mOwner=nullptr;
return -1;
}
if (!mOwner) {
......@@ -115,7 +115,7 @@ void KGamePropertyBase::unregisterData()
return;
}
mOwner->removeProperty(this);
mOwner = 0;
mOwner = nullptr;
}
bool KGamePropertyBase::sendProperty()
......
......@@ -322,7 +322,7 @@ bool KGamePropertyHandler::sendProperty(QDataStream &s)
KGamePropertyBase* KGamePropertyHandler::find(int id)
{
if (d->mIdDict.find(id) == d->mIdDict.end())
return 0;
return nullptr;
return *(d->mIdDict.find(id));
}
......
......@@ -28,7 +28,7 @@ class KGameSequence::KGameSequencePrivate
{
public:
KGameSequencePrivate()
: mGame(0), mCurrentPlayer(0)
: mGame(nullptr), mCurrentPlayer(nullptr)
{
}
......@@ -72,7 +72,7 @@ KPlayer *KGameSequence::nextPlayer(KPlayer *last,bool exclusive)
if (!game())
{
qCCritical(GAMES_PRIVATE_KGAME) << "NULL game object";
return 0;
return nullptr;
}
unsigned int minId,nextId,lastId;
KPlayer *nextplayer, *minplayer;
......@@ -90,8 +90,8 @@ KPlayer *KGameSequence::nextPlayer(KPlayer *last,bool exclusive)
// remove when this has been checked
minId = 0x7fff; // we just need a very large number...properly MAX_UINT or so would be ok...
nextId = minId;
nextplayer = 0;
minplayer = 0;
nextplayer = nullptr;
minplayer = nullptr;
QList<KPlayer*>::iterator it = game()->playerList()->begin();
for (;it != game()->playerList()->end(); it++ )
......@@ -130,7 +130,7 @@ KPlayer *KGameSequence::nextPlayer(KPlayer *last,bool exclusive)
}
else
{
return 0;
return nullptr;
}
return nextplayer;
}
......
......@@ -33,7 +33,7 @@ class KMessageClientPrivate
{
public:
KMessageClientPrivate ()
: adminID (0), connection (0)
: adminID (0), connection (nullptr)
{}
~KMessageClientPrivate ()
......@@ -333,7 +333,7 @@ void KMessageClient::removeBrokenConnection2 ()
emit aboutToDisconnect(id());
delete d->connection;
d->connection = 0;
d->connection = nullptr;
d->adminID = 0;
emit connectionBroken();
qCDebug(GAMES_PRIVATE_KGAME) << ": Broken:Deleting the connection object DONE";
......@@ -345,7 +345,7 @@ void KMessageClient::disconnect ()
emit aboutToDisconnect(id());
delete d->connection;
d->connection = 0;
d->connection = nullptr;
d->adminID = 0;
emit connectionBroken();
qCDebug(GAMES_PRIVATE_KGAME) << ": Disconnect:Deleting the connection object DONE";
......
......@@ -153,7 +153,12 @@ void KMessageSocket::processNewData ()
void KMessageSocket::initSocket ()
{
connect(mSocket, static_cast<void (QTcpSocket::*)(QAbstractSocket::SocketError)>(&QTcpSocket::error), this, &KMessageSocket::connectionBroken);
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
connect(mSocket, &QTcpSocket::errorOccurred,
#else
connect(mSocket, QOverload<QAbstractSocket::SocketError>::of(&QTcpSocket::error),
#endif
this, &KMessageSocket::connectionBroken);
connect(mSocket, &QTcpSocket::disconnected, this, &KMessageSocket::connectionBroken);
connect(mSocket, &QTcpSocket::readyRead, this, &KMessageSocket::processNewData);
mAwaitingHeader = true;
......@@ -174,7 +179,7 @@ QString KMessageSocket::peerName () const
// ----------------------KMessageDirect -----------------------
KMessageDirect::KMessageDirect (KMessageDirect *partner, QObject *parent)
: KMessageIO (parent), mPartner (0)
: KMessageIO (parent), mPartner (nullptr)
{
// 0 as first parameter leaves the object unconnected
if (!partner)
......@@ -198,14 +203,14 @@ KMessageDirect::~KMessageDirect ()
{
if (mPartner)
{
mPartner->mPartner = 0;
mPartner->mPartner = nullptr;
emit mPartner->connectionBroken();
}
}
bool KMessageDirect::isConnected () const
{
return mPartner != 0;
return mPartner != nullptr;
}
void KMessageDirect::send (const QByteArray &msg)
......@@ -226,7 +231,7 @@ KMessageProcess::~KMessageProcess()
{
mProcess->kill();
mProcess->deleteLater();
mProcess=0;
mProcess=nullptr;
// Maybe todo: delete mSendBuffer
}
}
......@@ -246,7 +251,7 @@ KMessageProcess::KMessageProcess(QObject *parent, const QString& file) : KMessag
connect(mProcess, &KProcess::readyReadStandardError, this, &KMessageProcess::slotReceivedStderr);
connect(mProcess, static_cast<void (KProcess::*)(int, QProcess::ExitStatus)>(&KProcess::finished), this, &KMessageProcess::slotProcessExited);
mProcess->start();
mSendBuffer=0;
mSendBuffer=nullptr;
mReceiveCount=0;
mReceiveBuffer.resize(1024);
}
......@@ -264,7 +269,7 @@ void KMessageProcess::send(const QByteArray &msg)
qCDebug(GAMES_PRIVATE_KGAME) << "@@@KMessageProcess:: SEND("<<msg.size()<<") to process";
unsigned int size=msg.size()+2*sizeof(long);
if (mProcess == 0) {
if (mProcess == nullptr) {
qCDebug(GAMES_PRIVATE_KGAME) << "@@@KMessageProcess:: cannot write to stdin, no process available";
return;
}
......@@ -358,7 +363,7 @@ void KMessageProcess::slotProcessExited(int exitCode, QProcess::ExitStatus)
qCDebug(GAMES_PRIVATE_KGAME) << "Process exited (slot) with code" << exitCode;
emit connectionBroken();
delete mProcess;
mProcess=0;
mProcess=nullptr;
}
......
......@@ -308,7 +308,7 @@ public:
If that object is already connected, the object remains unconnected.
*/
explicit KMessageDirect (KMessageDirect *partner = 0, QObject *parent = nullptr);
explicit KMessageDirect (KMessageDirect *partner = nullptr, QObject *parent = nullptr);
/**
Destructor, closes the connection.
......
......@@ -69,7 +69,7 @@ class KMessageServerPrivate
{
public:
KMessageServerPrivate()
: mMaxClients (-1), mGameId (1), mUniqueClientNumber (1), mAdminID (0), mServerSocket (0) {}
: mMaxClients (-1), mGameId (1), mUniqueClientNumber (1), mAdminID (0), mServerSocket (nullptr) {}
~KMessageServerPrivate()
{
......@@ -140,7 +140,7 @@ bool KMessageServer::initNetwork (quint16 port)
{
qCCritical(GAMES_PRIVATE_KGAME) << ": Serversocket::ok() == false";
delete d->mServerSocket;
d->mServerSocket=0;
d->mServerSocket=nullptr;
return false;
}
......@@ -163,13 +163,13 @@ void KMessageServer::stopNetwork()
if (d->mServerSocket)
{
delete d->mServerSocket;
d->mServerSocket = 0;
d->mServerSocket = nullptr;
}
}
bool KMessageServer::isOfferingConnections() const
{
return d->mServerSocket != 0;
return d->mServerSocket != nullptr;
}
//----------------------------------------------- adding / removing clients
......@@ -260,7 +260,7 @@ void KMessageServer::deleteClients()
void KMessageServer::removeBrokenClient ()
{
KMessageIO *client = sender() ? qobject_cast<KMessageIO*>(sender()) : 0;
KMessageIO *client = sender() ? qobject_cast<KMessageIO*>(sender()) : nullptr;
if (!client)
{
qCCritical(GAMES_PRIVATE_KGAME) << ": sender of the signal was not a KMessageIO object!";
......@@ -307,7 +307,7 @@ KMessageIO* KMessageServer::findClient (quint32 no) const
return (*iter);
++iter;
}
return 0;
return nullptr;
}
quint32 KMessageServer::adminID () const
......@@ -321,7 +321,7 @@ void KMessageServer::setAdmin (quint32 adminID)
if (adminID == d->mAdminID)
return;
if (adminID > 0 && findClient (adminID) == 0)
if (adminID > 0 && findClient (adminID) == nullptr)
{
qCWarning(GAMES_PRIVATE_KGAME) << "Trying to set a new admin that doesn't exist!";
return;
......@@ -367,7 +367,7 @@ void KMessageServer::sendMessage (const QList <quint32> &ids, const QByteArray &
void KMessageServer::getReceivedMessage (const QByteArray &msg)
{
KMessageIO *client = sender() ? qobject_cast<KMessageIO*>(sender()) : 0;
KMessageIO *client = sender() ? qobject_cast<KMessageIO*>(sender()) : nullptr;
if (!client)
{
qCCritical(GAMES_PRIVATE_KGAME) << ": slot was not called from KMessageIO!";
......
......@@ -39,7 +39,7 @@ class KPlayerPrivate
public:
KPlayerPrivate()
{
mNetworkPlayer = 0;
mNetworkPlayer = nullptr;
}
KGame *mGame;
......@@ -81,7 +81,7 @@ void KPlayer::init()
SLOT(emitSignal(KGamePropertyBase*)));
d->mVirtual=false;
d->mActive=true;
d->mGame=0;
d->mGame=nullptr;
d->mId=0; // "0" is always an invalid ID!
d->mPriority=0;
// I guess we cannot translate the group otherwise no
......@@ -301,7 +301,7 @@ bool KPlayer::removeGameIO(KGameIO *targetinput,bool deleteit)
}
else
{
targetinput->setPlayer(0);
targetinput->setPlayer(nullptr);
result = d->mInputList.removeAll(targetinput);
}
}
......@@ -310,7 +310,7 @@ bool KPlayer::removeGameIO(KGameIO *targetinput,bool deleteit)
bool KPlayer::hasRtti(int rtti) const
{
return findRttiIO(rtti) != 0;
return findRttiIO(rtti) != nullptr;
}
KGameIO * KPlayer::findRttiIO(int rtti) const
......@@ -324,7 +324,7 @@ KGameIO * KPlayer::findRttiIO(int rtti) const
return curGameIO;
}
}
return 0;
return nullptr;
}
int KPlayer::calcIOValue()
......
......@@ -293,7 +293,7 @@ public:
* @param deleteit true (default) to delete the device otherwise just remove it
* @return true on ok
*/
bool removeGameIO(KGameIO *input=0,bool deleteit=true);
bool removeGameIO(KGameIO *input=nullptr,bool deleteit=true);
/**
* Finds the KGameIO devies with the given rtti code.
......
......@@ -55,7 +55,7 @@ KGameCanvasAbstract::KGameCanvasAbstract() {
KGameCanvasAbstract::~KGameCanvasAbstract() {
//Note: this does not delete the items, be sure not to leak memory!
for(int i=0;i<m_items.size();i++)
m_items[i]->m_canvas = NULL;
m_items[i]->m_canvas = nullptr;
}
KGameCanvasItem* KGameCanvasAbstract::itemAt(const QPoint &pt) const {
......@@ -64,7 +64,7 @@ KGameCanvasItem* KGameCanvasAbstract::itemAt(const QPoint &pt) const {
if(el->m_visible && el->rect().contains(pt))
return el;
}
return NULL;
return nullptr;
}
QList<KGameCanvasItem*> KGameCanvasAbstract::itemsAt(const QPoint &pt) const {
......@@ -270,7 +270,7 @@ void KGameCanvasItem::updateChanges() {
m_changed = false;
}
QPixmap *KGameCanvasItem::transparence_pixmap_cache = NULL;
QPixmap *KGameCanvasItem::transparence_pixmap_cache = nullptr;
QPixmap* KGameCanvasItem::getTransparenceCache(const QSize &s) {
if(!transparence_pixmap_cache)
......@@ -633,7 +633,7 @@ QRect KGameCanvasGroup::rect() const
KGameCanvasWidget* KGameCanvasGroup::topLevelCanvas()
{
return m_canvas ? m_canvas->topLevelCanvas() : NULL;
return m_canvas ? m_canvas->topLevelCanvas() : nullptr;
}
QPoint KGameCanvasGroup::canvasPosition() const {
......
......@@ -145,7 +145,7 @@ public:
Note that the restacking functions are quite intelligent and will only
repaint if there is an actual need of doing it. So if you call raise on
an item that is already (locally) on the top, no redraw will take place */
explicit KGameCanvasItem(KGameCanvasAbstract* canvas = NULL);
explicit KGameCanvasItem(KGameCanvasAbstract* canvas = nullptr);
virtual ~KGameCanvasItem();
......@@ -192,7 +192,7 @@ public:
KGameCanvasAbstract *canvas() const { return m_canvas; }
/** Returns the toplevel canvas widget, or NULL */
KGameCanvasWidget *topLevelCanvas() const { return m_canvas ? m_canvas->topLevelCanvas() : NULL; }
KGameCanvasWidget *topLevelCanvas() const { return m_canvas ? m_canvas->topLevelCanvas() : nullptr; }
/** Lets you specify the owning canvas. Call this function with canvas
set to NULL to remove the item from the current canvas. */
......@@ -245,7 +245,7 @@ class KDEGAMESPRIVATE_EXPORT KGameCanvasDummy : public KGameCanvasItem
{
public:
/** Constructor */
explicit KGameCanvasDummy(KGameCanvasAbstract* canvas = NULL);
explicit KGameCanvasDummy(KGameCanvasAbstract* canvas = nullptr);
virtual ~KGameCanvasDummy();
......@@ -284,7 +284,7 @@ private:
public:
/** Constructor */
explicit KGameCanvasGroup(KGameCanvasAbstract* canvas = NULL);
explicit KGameCanvasGroup(KGameCanvasAbstract* canvas = nullptr);
virtual ~KGameCanvasGroup();
......@@ -318,10 +318,10 @@ private:
public:
/** Constructor, specifying the picture to use */
explicit KGameCanvasPicture(const QPicture& picture, KGameCanvasAbstract* canvas = NULL);
explicit KGameCanvasPicture(const QPicture& picture, KGameCanvasAbstract* canvas = nullptr);
/** Constructor, creating with an empty picture */
explicit KGameCanvasPicture(KGameCanvasAbstract* canvas = NULL);
explicit KGameCanvasPicture(KGameCanvasAbstract* canvas = nullptr);
virtual ~KGameCanvasPicture();
......@@ -350,10 +350,10 @@ private:
public:
/** Constructor, specifying the pixmap to use */
explicit KGameCanvasPixmap(const QPixmap& pixmap, KGameCanvasAbstract* canvas = NULL);
explicit KGameCanvasPixmap(const QPixmap& pixmap, KGameCanvasAbstract* canvas = nullptr);
/** Constructor, creating with an empty pixmap */
explicit KGameCanvasPixmap(KGameCanvasAbstract* canvas = NULL);
explicit KGameCanvasPixmap(KGameCanvasAbstract* canvas = nullptr);
virtual ~KGameCanvasPixmap();
......@@ -381,7 +381,7 @@ public:
class KDEGAMESPRIVATE_EXPORT KGameCanvasRenderedPixmap : public KGameCanvasPixmap, public KGameRendererClient
{
public:
KGameCanvasRenderedPixmap(KGameRenderer* renderer, const QString& spriteKey, KGameCanvasAbstract* canvas = 0);
KGameCanvasRenderedPixmap(KGameRenderer* renderer, const QString& spriteKey, KGameCanvasAbstract* canvas = nullptr);
protected:
void receivePixmap(const QPixmap& pixmap) override;
};
......@@ -405,10 +405,10 @@ private:
public:
/** Constructor, specifying the pixmap and the parameters to use */
KGameCanvasTiledPixmap(const QPixmap& pixmap, const QSize &size, const QPoint &origin,
bool move_orig, KGameCanvasAbstract* canvas = NULL);
bool move_orig, KGameCanvasAbstract* canvas = nullptr);
/** Constructor, creating with an empty pixmap */
explicit KGameCanvasTiledPixmap(KGameCanvasAbstract* canvas = NULL);
explicit KGameCanvasTiledPixmap(KGameCanvasAbstract* canvas = nullptr);
virtual ~KGameCanvasTiledPixmap();
......@@ -455,10 +455,10 @@ private:
public:
/** Constructor, specifying the pixmap and the parameters to use */
KGameCanvasRectangle(const QColor& color, const QSize &size, KGameCanvasAbstract* canvas = NULL);
KGameCanvasRectangle(const QColor& color, const QSize &size, KGameCanvasAbstract* canvas = nullptr);
/** Constructor, creating with an empty pixmap */
explicit KGameCanvasRectangle(KGameCanvasAbstract* canvas = NULL);
explicit KGameCanvasRectangle(KGameCanvasAbstract* canvas = nullptr);
virtual ~KGameCanvasRectangle();
......@@ -522,10 +522,10 @@ public:
/** Constructor, specifying the text and the parameters to use */
KGameCanvasText(const QString& text, const QColor& color,
const QFont& font, HPos hp, VPos vp,
KGameCanvasAbstract* canvas = NULL);
KGameCanvasAbstract* canvas = nullptr);
/** Constructor, creating with an empty text */
explicit KGameCanvasText(KGameCanvasAbstract* canvas = NULL);
explicit KGameCanvasText(KGameCanvasAbstract* canvas = nullptr);
virtual ~KGameCanvasText();
......@@ -592,7 +592,7 @@ private Q_SLOTS:
public:
/** The constructor */
explicit KGameCanvasWidget(QWidget* parent = NULL);
explicit KGameCanvasWidget(QWidget* parent = nullptr);
virtual ~KGameCanvasWidget();
......@@ -653,7 +653,7 @@ public:
* An adapter is not associated to any canvas, so this function
* simply returns 0.
*/
class KGameCanvasWidget* topLevelCanvas() override { return 0; }
class KGameCanvasWidget* topLevelCanvas() override { return nullptr; }
/**
* The absolute position of the rendered content is not well
......
......@@ -101,16 +101,16 @@ KGameDifficultyPrivate::~KGameDifficultyPrivate()
}
void KGameDifficultyPrivate::init(KXmlGuiWindow* window, const QObject* recvr, const char* slotStandard, const char* slotCustom = 0)
void KGameDifficultyPrivate::init(KXmlGuiWindow* window, const QObject* recvr, const char* slotStandard, const char* slotCustom = nullptr)
{
Q_ASSERT(recvr!=0);
Q_ASSERT(recvr!=nullptr);
m_oldSelection = -1; // No valid selection
m_level = KGameDifficulty::NoLevel;
m_running = false;
QObject::connect(this, SIGNAL(standardLevelChanged(KGameDifficulty::standardLevel)), recvr, slotStandard);
if (slotCustom!=0)
if (slotCustom!=nullptr)
QObject::connect(this, SIGNAL(customLevelChanged(int)), recvr, slotCustom);
m_menu = new KSelectAction(QIcon::fromTheme( QStringLiteral( "games-difficult") ), i18nc("Game difficulty level", "Difficulty" ), window);
......@@ -137,7 +137,7 @@ void KGameDifficultyPrivate::changeSelection(int newSelection)
bool mayChange = true;
if (mayChange && (m_restartOnChange==KGameDifficulty::RestartOnChange) && m_running)
mayChange = ( KMessageBox::warningContinueCancel(0, i18n("Changing the difficulty level will end the current game!"), QString(), KGuiItem(i18n("Change the difficulty level"))) == KMessageBox::Continue );
mayChange = ( KMessageBox::warningContinueCancel(nullptr, i18n("Changing the difficulty level will end the current game!"), QString(), KGuiItem(i18n("Change the difficulty level"))) == KMessageBox::Continue );
if (mayChange) {
setSelection(newSelection);
......@@ -280,7 +280,7 @@ void KGameDifficultyPrivate::setLevelCustom(int key)
KGameDifficulty* KGameDifficulty::instance = 0;
KGameDifficulty* KGameDifficulty::instance = nullptr;
KGameDifficulty::~KGameDifficulty()
......@@ -454,7 +454,7 @@ KGameDifficulty::KGameDifficulty() : d(new KGameDifficultyPrivate())
KGameDifficulty* KGameDifficulty::self()
{
if (instance==0)
if (instance==nullptr)
instance = new KGameDifficulty();
return instance;
}
......