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 abf01b68 authored by Laurent Montel's avatar Laurent Montel 😁

Fix clazy warning

parent a4d17beb
......@@ -25,7 +25,7 @@
#include <QApplication>
Ball::Ball(QGraphicsItem* parent, b2World* world)
: EllipticalCanvasItem(true, QLatin1String("ball"), parent, world)
: EllipticalCanvasItem(true, QStringLiteral("ball"), parent, world)
{
const int diameter = 8;
setSize(QSizeF(diameter, diameter));
......
This diff is collapsed.
......@@ -184,11 +184,11 @@ public:
int lowestMaxStrokes() const { return m_lowestMaxStrokes; }
int maxStrokes() const { return m_maxStrokes; }
bool hasMaxStrokes() const { return m_maxStrokes != m_lowestMaxStrokes; }
void setAuthor(QString newauthor) { m_author = newauthor; }
void setAuthor(const QString &newauthor) { m_author = newauthor; }
QString author() const { return m_author; }
void setName(QString newname) { m_name = newname; }
void setUntranslatedName(QString newname) { m_untranslatedName = newname; }
void setName(const QString &newname) { m_name = newname; }
void setUntranslatedName(const QString &newname) { m_untranslatedName = newname; }
QString name() const { return m_name; }
QString untranslatedName() const { return m_untranslatedName; }
......
......@@ -143,8 +143,8 @@ QString KComboBoxDialog::getText(const QString &_caption, const QString &_text,
KHistoryComboBox * const box = dlg->comboBox();
box->setEditable(true);
const QString historyItem = QString("%1History").arg(configName);
const QString completionItem = QString("%1Completion").arg(configName);
const QString historyItem = QStringLiteral("%1History").arg(configName);
const QString completionItem = QStringLiteral("%1Completion").arg(configName);
if(!configName.isNull())
{
......
This diff is collapsed.
......@@ -42,7 +42,7 @@ public:
KolfWindow();
~KolfWindow();
void openUrl(QUrl url);
void openUrl(const QUrl &url);
public slots:
void closeGame();
......
......@@ -78,9 +78,9 @@ kolfNumInput::kolfNumInput(QWidget *parent)
{
setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
setFocusPolicy(Qt::StrongFocus);
KConfigDialogManager::changedMap()->insert("kpIntNumInput", SIGNAL(valueChanged(int)));
KConfigDialogManager::changedMap()->insert("QSpinBox", SIGNAL(valueChanged(int)));
KConfigDialogManager::changedMap()->insert("kolfDoubleSpinBox", SIGNAL(valueChanged(double)));
KConfigDialogManager::changedMap()->insert(QStringLiteral("kpIntNumInput"), SIGNAL(valueChanged(int)));
KConfigDialogManager::changedMap()->insert(QStringLiteral("QSpinBox"), SIGNAL(valueChanged(int)));
KConfigDialogManager::changedMap()->insert(QStringLiteral("kolfDoubleSpinBox"), SIGNAL(valueChanged(double)));
}
kolfNumInput::~kolfNumInput()
......@@ -109,7 +109,7 @@ void kolfNumInput::setLabel(const QString &label, Qt::Alignment a)
d->label = new QLabel(this);
}
d->label->setText(label);
d->label->setObjectName("kolfNumInput::QLabel");
d->label->setObjectName(QStringLiteral("kolfNumInput::QLabel"));
d->label->setAlignment(a);
// if no vertical alignment set, use Top alignment
if (!(a & (Qt::AlignTop | Qt::AlignBottom | Qt::AlignVCenter))) {
......@@ -204,7 +204,7 @@ void kolfDoubleNumInput::initWidget(double value, double lower, double upper,
d->spin->setValue(value);
d->spin->setDecimals(precision);
d->spin->setObjectName("kolfDoubleNumInput::QDoubleSpinBox");
d->spin->setObjectName(QStringLiteral("kolfDoubleNumInput::QDoubleSpinBox"));
setFocusProxy(d->spin);
connect(d->spin, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
this, &kolfDoubleNumInput::valueChanged);
......
......@@ -179,7 +179,7 @@ void Kolf::LandscapeConfig::setBlinkInterval(int sliderValue)
//BEGIN Kolf::Puddle
Kolf::Puddle::Puddle(QGraphicsItem* parent, b2World* world)
: Kolf::LandscapeItem(QLatin1String("puddle"), parent, world)
: Kolf::LandscapeItem(QStringLiteral("puddle"), parent, world)
{
setData(0, Rtti_DontPlaceOn);
setSize(QSizeF(45, 30));
......@@ -208,7 +208,7 @@ bool Kolf::Puddle::collision(Ball* ball)
//BEGIN Kolf::Sand
Kolf::Sand::Sand(QGraphicsItem* parent, b2World* world)
: Kolf::LandscapeItem(QLatin1String("sand"), parent, world)
: Kolf::LandscapeItem(QStringLiteral("sand"), parent, world)
{
setSize(QSizeF(45, 40));
setZBehavior(CanvasItem::FixedZValue, 2);
......@@ -230,26 +230,26 @@ struct SlopeData
QStringList spriteKeys, reversedSpriteKeys;
SlopeData()
{
gradientKeys << QLatin1String("Vertical")
<< QLatin1String("Horizontal")
<< QLatin1String("Diagonal")
<< QLatin1String("Opposite Diagonal")
<< QLatin1String("Elliptic");
gradientKeys << QStringLiteral("Vertical")
<< QStringLiteral("Horizontal")
<< QStringLiteral("Diagonal")
<< QStringLiteral("Opposite Diagonal")
<< QStringLiteral("Elliptic");
translatedGradientKeys << i18n("Vertical")
<< i18n("Horizontal")
<< i18n("Diagonal")
<< i18n("Opposite Diagonal")
<< i18n("Elliptic");
spriteKeys << QLatin1String("slope_n")
<< QLatin1String("slope_w")
<< QLatin1String("slope_nw")
<< QLatin1String("slope_ne")
<< QLatin1String("slope_bump");
reversedSpriteKeys << QLatin1String("slope_s")
<< QLatin1String("slope_e")
<< QLatin1String("slope_se")
<< QLatin1String("slope_sw")
<< QLatin1String("slope_dip");
spriteKeys << QStringLiteral("slope_n")
<< QStringLiteral("slope_w")
<< QStringLiteral("slope_nw")
<< QStringLiteral("slope_ne")
<< QStringLiteral("slope_bump");
reversedSpriteKeys << QStringLiteral("slope_s")
<< QStringLiteral("slope_e")
<< QStringLiteral("slope_se")
<< QStringLiteral("slope_sw")
<< QStringLiteral("slope_dip");
}
};
Q_GLOBAL_STATIC(SlopeData, g_slopeData)
......
......@@ -46,13 +46,13 @@ int main(int argc, char **argv)
KLocalizedString::setApplicationDomain("kolf");
KAboutData aboutData( "kolf", i18n("Kolf"), version, i18n(description), KAboutLicense::GPL, i18n("(c) 2002-2010, Kolf developers"), "http://games.kde.org/kolf");
KAboutData aboutData( QStringLiteral("kolf"), i18n("Kolf"), version, i18n(description), KAboutLicense::GPL, i18n("(c) 2002-2010, Kolf developers"), QStringLiteral("http://games.kde.org/kolf"));
aboutData.addAuthor(i18n("Stefan Majewsky"), i18n("Current maintainer"), "majewsky@gmx.net");
aboutData.addAuthor(i18n("Jason Katz-Brown"), i18n("Former main author"), "jasonkb@mit.edu");
aboutData.addAuthor(i18n("Stefan Majewsky"), i18n("Current maintainer"), QStringLiteral("majewsky@gmx.net"));
aboutData.addAuthor(i18n("Jason Katz-Brown"), i18n("Former main author"), QStringLiteral("jasonkb@mit.edu"));
aboutData.addAuthor(i18n("Niklas Knutsson"), i18n("Advanced putting mode"));
aboutData.addAuthor(i18n("Rik Hemsley"), i18n("Border around course"));
aboutData.addAuthor(i18n("Timo A. Hummel"), i18n("Some good sound effects"), "timo.hummel@gmx.net");
aboutData.addAuthor(i18n("Timo A. Hummel"), i18n("Some good sound effects"), QStringLiteral("timo.hummel@gmx.net"));
aboutData.addCredit(i18n("Rob Renaud"), i18n("Wall-bouncing help"));
aboutData.addCredit(i18n("Aaron Seigo"), i18n("Suggestions, bug reports"));
......@@ -63,8 +63,8 @@ int main(int argc, char **argv)
QCommandLineParser parser;
KAboutData::setApplicationData(aboutData);
KCrash::initialize();
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("+file"), i18n("File")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("course-info"), i18n("Print course information and exit")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("+file"), i18n("File")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("course-info"), i18n("Print course information and exit")));
aboutData.setupCommandLine(&parser);
parser.process(app);
......@@ -72,9 +72,9 @@ int main(int argc, char **argv)
KDBusService service;
// I've actually added this for my web site uploaded courses display
if (parser.isSet("course-info"))
if (parser.isSet(QStringLiteral("course-info")))
{
QString filename(parser.value("course-info"));
QString filename(parser.value(QStringLiteral("course-info")));
if (QFile::exists(filename))
{
CourseInfo info;
......
......@@ -46,7 +46,7 @@ NewGameDialog::NewGameDialog(bool enableCourses)
KSharedConfig::Ptr config = KSharedConfig::openConfig();
// following use this group
KConfigGroup configGroup(config->group(QString("New Game Dialog Mode")));
KConfigGroup configGroup(config->group(QStringLiteral("New Game Dialog Mode")));
// lots o' colors :)
startColors << Qt::blue << Qt::red << Qt::yellow << Qt::lightGray << Qt::cyan << Qt::darkBlue << Qt::magenta << Qt::darkGray << Qt::darkMagenta << Qt::darkYellow;
......@@ -67,7 +67,7 @@ NewGameDialog::NewGameDialog(bool enableCourses)
scroller->setWidget(playersWidget);
new QVBoxLayout(playersWidget);
QMap<QString, QString> entries = config->entryMap("New Game Dialog");
QMap<QString, QString> entries = config->entryMap(QStringLiteral("New Game Dialog"));
int i = 0;
for (QMap<QString, QString>::Iterator it = entries.begin(); it != entries.end(); ++it)
{
......@@ -105,7 +105,7 @@ NewGameDialog::NewGameDialog(bool enableCourses)
/// course loading
QStringList files;
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, "courses", QStandardPaths::LocateDirectory);
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, QStringLiteral("courses"), QStandardPaths::LocateDirectory);
Q_FOREACH (const QString& dir, dirs) {
const QStringList fileNames = QDir(dir).entryList(QStringList() << QStringLiteral("*"), QDir::Files);
Q_FOREACH (const QString& file, fileNames) {
......@@ -206,7 +206,7 @@ NewGameDialog::~NewGameDialog()
void NewGameDialog::slotOk()
{
KSharedConfig::Ptr config = KSharedConfig::openConfig();
KConfigGroup configGroup(config->group(QString("New Game Dialog Mode")));
KConfigGroup configGroup(config->group(QStringLiteral("New Game Dialog Mode")));
configGroup.writeEntry("competition", mode->isChecked());
if (enableCourses)
......@@ -236,7 +236,7 @@ void NewGameDialog::courseSelected(int index)
CourseInfo &curinfo = info[currentCourse];
name->setText(QString("<strong>%1</strong>").arg(curinfo.name));
name->setText(QStringLiteral("<strong>%1</strong>").arg(curinfo.name));
author->setText(i18n("By %1", curinfo.author));
par->setText(i18n("Par %1", curinfo.par));
......@@ -246,7 +246,7 @@ void NewGameDialog::courseSelected(int index)
void NewGameDialog::showHighscores()
{
KScoreDialog *scoreDialog = new KScoreDialog(KScoreDialog::Name | KScoreDialog::Custom1 | KScoreDialog::Score, this);
scoreDialog->addField(KScoreDialog::Custom1, i18n("Par"), "Par");
scoreDialog->addField(KScoreDialog::Custom1, i18n("Par"), QStringLiteral("Par"));
scoreDialog->setConfigGroup(qMakePair(QByteArray(info[currentCourse].untranslatedName.toUtf8() + " Highscores"), i18n("High Scores for %1", info[currentCourse].name)));
scoreDialog->setComment(i18n("High Scores for %1", info[currentCourse].name));
scoreDialog->show();
......@@ -343,7 +343,7 @@ void NewGameDialog::enableButtons()
/////////////////////////
PlayerEditor::PlayerEditor(QString startName, QColor startColor, QWidget *parent)
PlayerEditor::PlayerEditor(const QString &startName, QColor startColor, QWidget *parent)
: QWidget(parent)
{
QHBoxLayout *layout = new QHBoxLayout(this);
......
......@@ -37,7 +37,7 @@ class PlayerEditor : public QWidget
Q_OBJECT
public:
explicit PlayerEditor(QString name = QString(), QColor = Qt::red, QWidget *parent = 0);
explicit PlayerEditor(const QString &name = QString(), QColor = Qt::red, QWidget *parent = 0);
QColor color() { return colorButton->color(); }
QString name() { return editor->text(); }
void setColor(QColor col) { colorButton->setColor(col); }
......
......@@ -32,7 +32,7 @@
//BEGIN Kolf::BlackHole
Kolf::BlackHole::BlackHole(QGraphicsItem* parent, b2World* world)
: EllipticalCanvasItem(true, QLatin1String("black_hole"), parent, world)
: EllipticalCanvasItem(true, QStringLiteral("black_hole"), parent, world)
, m_minSpeed(3.0)
, m_maxSpeed(5.0)
, m_runs(0)
......@@ -324,7 +324,7 @@ void Kolf::BlackHoleOverlay::moveHandle(const QPointF& handleScenePos)
//BEGIN Kolf::Cup
Kolf::Cup::Cup(QGraphicsItem* parent, b2World* world)
: EllipticalCanvasItem(false, QLatin1String("cup"), parent, world)
: EllipticalCanvasItem(false, QStringLiteral("cup"), parent, world)
{
const int diameter = 16;
setSize(QSizeF(diameter, diameter));
......
......@@ -34,7 +34,7 @@
//BEGIN Kolf::Bumper
Kolf::Bumper::Bumper(QGraphicsItem* parent, b2World* world)
: EllipticalCanvasItem(false, QLatin1String("bumper_off"), parent, world)
: EllipticalCanvasItem(false, QStringLiteral("bumper_off"), parent, world)
{
const int diameter = 20;
setSize(QSizeF(diameter, diameter));
......@@ -59,14 +59,14 @@ bool Kolf::Bumper::collision(Ball* ball)
game->playSound(Sound::Bumper);
setSpriteKey(QLatin1String("bumper_on"));
setSpriteKey(QStringLiteral("bumper_on"));
QTimer::singleShot(100, this, &Kolf::Bumper::turnBumperOff);
return true;
}
void Kolf::Bumper::turnBumperOff()
{
setSpriteKey(QLatin1String("bumper_off"));
setSpriteKey(QStringLiteral("bumper_off"));
}
Kolf::Overlay* Kolf::Bumper::createOverlay()
......@@ -197,7 +197,7 @@ Kolf::RectangleItem::RectangleItem(const QString& type, QGraphicsItem* parent, b
addShape(m_shape);
setSimulationType(CanvasItem::NoSimulation);
//default size
setSize(type == "sign" ? QSize(110, 40) : QSize(80, 40));
setSize(type == QLatin1String("sign") ? QSize(110, 40) : QSize(80, 40));
}
Kolf::RectangleItem::~RectangleItem()
......@@ -490,7 +490,7 @@ void Kolf::RectangleConfig::wallChanged(Kolf::WallIndex index, bool hasWall, boo
//BEGIN Kolf::Bridge
Kolf::Bridge::Bridge(QGraphicsItem* parent, b2World* world)
: Kolf::RectangleItem(QLatin1String("bridge"), parent, world)
: Kolf::RectangleItem(QStringLiteral("bridge"), parent, world)
{
setZBehavior(CanvasItem::IsStrut, 0);
}
......@@ -505,7 +505,7 @@ bool Kolf::Bridge::collision(Ball* ball)
//BEGIN Kolf::Floater
Kolf::Floater::Floater(QGraphicsItem* parent, b2World* world)
: Kolf::RectangleItem(QLatin1String("floater"), parent, world)
: Kolf::RectangleItem(QStringLiteral("floater"), parent, world)
, m_motionLine(QLineF(200, 200, 100, 100))
, m_speed(0)
, m_velocity(0)
......@@ -673,7 +673,7 @@ void Kolf::FloaterOverlay::moveMotionLineHandle(const QPointF& handleScenePos)
//BEGIN Kolf::Sign
Kolf::Sign::Sign(QGraphicsItem* parent, b2World* world)
: Kolf::RectangleItem(QLatin1String("sign"), parent, world)
: Kolf::RectangleItem(QStringLiteral("sign"), parent, world)
, m_text(i18n("New Text"))
, m_textItem(new QGraphicsTextItem(m_text, this))
{
......@@ -721,7 +721,7 @@ void Kolf::Sign::save(KConfigGroup* group)
//BEGIN Kolf::Windmill
Kolf::Windmill::Windmill(QGraphicsItem* parent, b2World* world)
: Kolf::RectangleItem(QLatin1String("windmill"), parent, world)
: Kolf::RectangleItem(QStringLiteral("windmill"), parent, world)
, m_leftWall(new Kolf::Wall(parent, world))
, m_rightWall(new Kolf::Wall(parent, world))
, m_guardWall(new Kolf::Wall(parent, world))
......
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