Commit 35fb3c9b authored by Laurent Montel's avatar Laurent Montel 😁

Fix some clazy warning

parent 75477b74
......@@ -197,8 +197,8 @@ QPixmap AtomFieldItem::renderAtom( KGameRenderer* renderer, const atom& at, int
// ----------------- MoleculePreviewItem ----------------------------
MoleculePreviewItem::MoleculePreviewItem( PlayField* scene )
: QGraphicsItem( 0 ), m_renderer(scene->renderer()), m_width(0),
m_atomSize(20), m_maxAtomSize(30), m_mol( 0 )
: QGraphicsItem( nullptr ), m_renderer(scene->renderer()), m_width(0),
m_atomSize(20), m_maxAtomSize(30), m_mol( nullptr )
{
scene->addItem(this);
}
......@@ -234,7 +234,7 @@ void MoleculePreviewItem::setWidth(int width)
void MoleculePreviewItem::paint( QPainter * painter, const QStyleOptionGraphicsItem*, QWidget *)
{
if ( m_width == 0 || m_mol == 0 )
if ( m_width == 0 || m_mol == nullptr )
return;
painter->save();
......
......@@ -156,7 +156,7 @@ public:
inline QRectF boundingRect() const override { return QRectF(0,0, m_width, m_width); } // reimp
private:
void paint( QPainter * painter, const QStyleOptionGraphicsItem*, QWidget * widget = 0 ) override;
void paint( QPainter * painter, const QStyleOptionGraphicsItem*, QWidget * widget = nullptr ) override;
KGameRenderer* m_renderer;
int m_width;
......
......@@ -222,7 +222,7 @@ void GameWidget::loadGame()
if (levelSet.isEmpty())
{
//qDebug() << "note: savegame file doesn't contain info about levelset, assuming default one";
levelSet = QLatin1String(DEFAULT_LEVELSET_NAME);
levelSet = QStringLiteral(DEFAULT_LEVELSET_NAME);
}
bool res = setLevelSet(levelSet);
......
......@@ -51,7 +51,7 @@ void LevelSetDelegate::paint(QPainter* p, const QStyleOptionViewItem& opt, const
option.decorationSize = QSize(48, 48);
QStyle* style = QApplication::style();
style->drawControl(QStyle::CE_ItemViewItem, &option, p, 0);
style->drawControl(QStyle::CE_ItemViewItem, &option, p, nullptr);
if (option.state & QStyle::State_Selected)
p->setPen(option.palette.color(QPalette::Normal, QPalette::HighlightedText));
......
......@@ -82,7 +82,7 @@ int main(int argc, char **argv)
KDBusService service;
if (!LevelSet::isDefaultLevelsAvailable())
{
KMessageBox::error(0, i18n("KAtomic failed to find its default level set and will quit. Please check your installation."));
KMessageBox::error(nullptr, i18n("KAtomic failed to find its default level set and will quit. Please check your installation."));
QTimer::singleShot(0, &app, SLOT(quit()));
}
else
......
......@@ -50,7 +50,7 @@ struct Theme : public KgTheme
};
PlayField::PlayField( QObject* parent )
: QGraphicsScene(parent), m_renderer(new Theme), m_numMoves(0), m_levelData(0),
: QGraphicsScene(parent), m_renderer(new Theme), m_numMoves(0), m_levelData(nullptr),
m_elemSize(MIN_ELEM_SIZE), m_selIdx(-1), m_animSpeed(120),
m_levelFinished(false)
{
......
......@@ -44,7 +44,7 @@ AtomTopLevel::AtomTopLevel()
{
QString lastPlayedLevelSet = Preferences::lastPlayedLevelSet();
if (lastPlayedLevelSet.isEmpty())
lastPlayedLevelSet = QLatin1String(DEFAULT_LEVELSET_NAME);
lastPlayedLevelSet = QStringLiteral(DEFAULT_LEVELSET_NAME);
m_gameWid = new GameWidget( lastPlayedLevelSet, this);
m_gameWid->setObjectName( QStringLiteral("gamewidget" ));
......@@ -104,14 +104,14 @@ void AtomTopLevel::createMenu()
m_prevLevelAct->setText( i18n( "Previous Level" ) );
actionCollection()->setDefaultShortcut(m_prevLevelAct, Qt::CTRL + Qt::Key_P );
addAction( m_prevLevelAct );
connect( m_prevLevelAct, SIGNAL(triggered(bool)), m_gameWid, SLOT(prevLevel()) );
connect( m_prevLevelAct, &QAction::triggered, m_gameWid, &GameWidget::prevLevel );
m_nextLevelAct = actionCollection()->addAction( QStringLiteral( "next_level" ) );
m_nextLevelAct->setIcon( QIcon::fromTheme( QStringLiteral( "arrow-right" ) ) );
m_nextLevelAct->setText( i18n( "Next Level" ) );
actionCollection()->setDefaultShortcut(m_nextLevelAct, Qt::CTRL + Qt::Key_N );
addAction( m_nextLevelAct );
connect( m_nextLevelAct, SIGNAL(triggered(bool)), m_gameWid, SLOT(nextLevel()) );
connect( m_nextLevelAct, &QAction::triggered, m_gameWid, &GameWidget::nextLevel );
QAction* chooseLevelSet = actionCollection()->addAction( QStringLiteral( "choose_level_set" ) );
chooseLevelSet->setText( i18n( "Choose level set..." ) );
......@@ -128,22 +128,22 @@ void AtomTopLevel::createMenu()
QAction *undoAll = actionCollection()->addAction( QStringLiteral( "move_undo_all" ) );
undoAll->setIcon( QIcon::fromTheme( QStringLiteral( "media-skip-backward" )) );
undoAll->setText( i18n("Undo All") );
connect( undoAll, SIGNAL(triggered(bool)), m_gameWid->playfield(), SLOT(undoAll()) );
connect( undoAll, &QAction::triggered, m_gameWid->playfield(), &PlayField::undoAll );
QAction *redoAll = actionCollection()->addAction( QStringLiteral( "move_redo_all" ) );
redoAll->setIcon( QIcon::fromTheme( QStringLiteral( "media-skip-forward" )) );
redoAll->setText( i18n("Redo All") );
connect( redoAll, SIGNAL(triggered(bool)), m_gameWid->playfield(), SLOT(redoAll()) );
connect( redoAll, &QAction::triggered, m_gameWid->playfield(), &PlayField::redoAll );
m_undoAct->setEnabled(false);
m_redoAct->setEnabled(false);
undoAll->setEnabled(false);
redoAll->setEnabled(false);
connect (m_gameWid->playfield(), SIGNAL (enableRedo(bool)), m_redoAct, SLOT(setEnabled(bool)));
connect (m_gameWid->playfield(), SIGNAL (enableUndo(bool)), m_undoAct, SLOT(setEnabled(bool)));
connect (m_gameWid->playfield(), SIGNAL (enableUndo(bool)), undoAll, SLOT(setEnabled(bool)));
connect (m_gameWid->playfield(), SIGNAL (enableRedo(bool)), redoAll, SLOT(setEnabled(bool)));
connect (m_gameWid->playfield(), &PlayField::enableRedo, m_redoAct, &QAction::setEnabled);
connect (m_gameWid->playfield(), &PlayField::enableUndo, m_undoAct, &QAction::setEnabled);
connect (m_gameWid->playfield(), &PlayField::enableUndo, undoAll, &QAction::setEnabled);
connect (m_gameWid->playfield(), &PlayField::enableRedo, redoAll, &QAction::setEnabled);
QAction * atomUpAct = actionCollection()->addAction( QStringLiteral( "atom_up" ));
atomUpAct->setText(i18n("Atom Up"));
......@@ -173,13 +173,13 @@ void AtomTopLevel::createMenu()
nextAtomAct->setText(i18n("Next Atom"));
actionCollection()->setDefaultShortcut(nextAtomAct,Qt::Key_Tab);
addAction(nextAtomAct);
connect(nextAtomAct, SIGNAL(triggered(bool)), m_gameWid->playfield(), SLOT(nextAtom()));
connect(nextAtomAct, &QAction::triggered, m_gameWid->playfield(), &PlayField::nextAtom);
QAction * prevAtomAct = actionCollection()->addAction( QStringLiteral( "prev_atom" ));
prevAtomAct->setText(i18n("Previous Atom"));
actionCollection()->setDefaultShortcut(prevAtomAct,Qt::SHIFT+Qt::Key_Tab);
addAction(prevAtomAct);
connect(prevAtomAct, SIGNAL(triggered(bool)), m_gameWid->playfield(), SLOT(previousAtom()));
connect(prevAtomAct, &QAction::triggered, m_gameWid->playfield(), &PlayField::previousAtom);
}
void AtomTopLevel::loadSettings()
......
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