Commit 40cbcf1a authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use QStringLiteral with all example apps

parent 77a4ce27
......@@ -27,7 +27,7 @@ void MyMarbleWidget::customPaint(GeoPainter* painter)
painter->setPen(Qt::green);
painter->drawEllipse(home, 7, 7);
painter->setPen(Qt::black);
painter->drawText(home, "Hello Marble!");
painter->drawText(home, QStringLiteral("Hello Marble!"));
}
int main(int argc, char** argv)
......
......@@ -47,10 +47,15 @@ public:
m_countryNames( 0 ),
m_countryBoundaries( 0 )
{
m_continentsAndOceans << "Asia" << "Africa" << "North America" << "South America"
<< "Antarctica" << "Europe" << "Australia" << "Arctic Ocean" << "Indian Ocean"
<< "North Atlantic Ocean" << "North Pacific Ocean" << "South Pacific Ocean"
<< "South Atlantic Ocean" << "Southern Ocean" ;
m_continentsAndOceans
<< QStringLiteral("Asia") << QStringLiteral("Africa")
<< QStringLiteral("North America") << QStringLiteral("South America")
<< QStringLiteral("Antarctica") << QStringLiteral("Europe")
<< QStringLiteral("Australia")
<< QStringLiteral("Arctic Ocean") << QStringLiteral("Indian Ocean")
<< QStringLiteral("North Atlantic Ocean") << QStringLiteral("North Pacific Ocean")
<< QStringLiteral("South Pacific Ocean") << QStringLiteral("South Atlantic Ocean")
<< QStringLiteral("Southern Ocean");
}
~ClickOnThatPrivate()
......@@ -254,7 +259,7 @@ void ClickOnThat::updateSelectPin(bool result, const GeoDataCoordinates &clicked
iconPath += QLatin1String("/MapTackRoundHeadRed.png");
}
GeoDataStyle::Ptr style = d->m_selectPinDocument->style("answer");
GeoDataStyle::Ptr style = d->m_selectPinDocument->style(QStringLiteral("answer"));
style->iconStyle().setIconPath( iconPath );
d->m_selectPinDocument->addStyle( style );
......
......@@ -41,10 +41,15 @@ public:
m_parent( 0 ),
m_countryNames( 0 )
{
m_continentsAndOceans << "Asia" << "Africa" << "North America" << "South America"
<< "Antarctica" << "Europe" << "Australia" << "Arctic Ocean" << "Indian Ocean"
<< "North Atlantic Ocean" << "North Pacific Ocean" << "South Pacific Ocean"
<< "South Atlantic Ocean" << "Southern Ocean" ;
m_continentsAndOceans
<< QStringLiteral("Asia") << QStringLiteral("Africa")
<< QStringLiteral("North America") << QStringLiteral("South America")
<< QStringLiteral("Antarctica") << QStringLiteral("Europe")
<< QStringLiteral("Australia")
<< QStringLiteral("Arctic Ocean") << QStringLiteral("Indian Ocean")
<< QStringLiteral("North Atlantic Ocean") << QStringLiteral("North Pacific Ocean")
<< QStringLiteral("South Pacific Ocean") << QStringLiteral("South Atlantic Ocean")
<< QStringLiteral("Southern Ocean");
}
MarbleWidget *m_marbleWidget;
......@@ -136,10 +141,11 @@ void CountryByFlag::postQuestion( QObject *gameObject )
placemark = countryPlacemarks[randomIndex];
if ( !d->m_continentsAndOceans.contains(placemark->name(), Qt::CaseSensitive) ) {
flagPath = MarbleDirs::path(QLatin1String("flags/flag_") + placemark->countryCode().toLower() + QLatin1String(".svg"));
const QString countryCode = placemark->countryCode().toLower();
flagPath = MarbleDirs::path(QLatin1String("flags/flag_") + countryCode + QLatin1String(".svg"));
QImage flag = QFile::exists( flagPath ) ? QImage( flagPath ) : QImage();
if ( !flag.isNull() ) {
flagPath = QString("%1flag_%2.svg").arg("../../../data/flags/").arg(placemark->countryCode().toLower());
flagPath = QLatin1String("../../../data/flags/flag_") + countryCode + QLatin1String(".svg");
found = true;
}
}
......
......@@ -46,10 +46,15 @@ public:
m_countryNames( 0 ),
m_countryBoundaries( 0 )
{
m_continentsAndOceans << "Asia" << "Africa" << "North America" << "South America"
<< "Antarctica" << "Europe" << "Australia" << "Arctic Ocean" << "Indian Ocean"
<< "North Atlantic Ocean" << "North Pacific Ocean" << "South Pacific Ocean"
<< "South Atlantic Ocean" << "Southern Ocean" ;
m_continentsAndOceans
<< QStringLiteral("Asia") << QStringLiteral("Africa")
<< QStringLiteral("North America") << QStringLiteral("South America")
<< QStringLiteral("Antarctica") << QStringLiteral("Europe")
<< QStringLiteral("Australia")
<< QStringLiteral("Arctic Ocean") << QStringLiteral("Indian Ocean")
<< QStringLiteral("North Atlantic Ocean") << QStringLiteral("North Pacific Ocean")
<< QStringLiteral("South Pacific Ocean") << QStringLiteral("South Atlantic Ocean")
<< QStringLiteral("Southern Ocean");
}
CountryByShape *m_parent;
......
......@@ -114,7 +114,7 @@ void Private::setupGameSignals()
if ( root ) {
m_parent->connect( root, SIGNAL(browseMapButtonClicked()),
m_parent, SLOT(browseMapButtonClicked()) );
QObject *gameOptions = root->findChild<QObject*>("gameOptions");
QObject *gameOptions = root->findChild<QObject*>(QStringLiteral("gameOptions"));
m_parent->connect( gameOptions, SIGNAL(nextButtonClicked()),
m_parent, SLOT(createQuestion()) );
......@@ -156,7 +156,7 @@ MainWindow::MainWindow( const QString &marbleDataPath, QWidget *parent, Qt::Wind
d->setupMarbleWidget();
setCentralWidget( d->m_marbleWidget );
d->m_view.setSource( QUrl( "qrc:/Window.qml" ) );
d->m_view.setSource(QUrl(QStringLiteral("qrc:/Window.qml")));
QWidget *leftPanel = QWidget::createWindowContainer( &d->m_view, d->dockWidgetContents );
QVBoxLayout *layout = new QVBoxLayout( d->dockWidgetContents );
......@@ -178,7 +178,7 @@ MarbleWidget *MainWindow::marbleWidget()
void MainWindow::createQuestion()
{
QObject *gameObject = d->m_view.rootObject()->findChild<QObject*>("gameOptions");
QObject *gameObject = d->m_view.rootObject()->findChild<QObject*>(QStringLiteral("gameOptions"));
if ( gameObject ) {
emit postQuestion( gameObject );
}
......@@ -260,7 +260,7 @@ void MainWindow::enableClickOnThatGame()
void MainWindow::displayResult(bool result )
{
QObject *gameObject = d->m_view.rootObject()->findChild<QObject*>("gameOptions");
QObject *gameObject = d->m_view.rootObject()->findChild<QObject*>(QStringLiteral("gameOptions"));
if ( gameObject ) {
QMetaObject::invokeMethod( gameObject, "displayResult",
Q_ARG(QVariant, QVariant(result)) );
......
......@@ -28,9 +28,9 @@ using namespace Marble;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
app.setApplicationName( "Marble Game" );
app.setOrganizationName( "KDE" );
app.setOrganizationDomain( "kde.org" );
app.setApplicationName(QStringLiteral("Marble Game"));
app.setOrganizationName(QStringLiteral("KDE"));
app.setOrganizationDomain(QStringLiteral("kde.org"));
// Widget translation
QString lang = QLocale::system().name().section(QLatin1Char('_'), 0, 0);
......@@ -54,7 +54,7 @@ int main(int argc, char *argv[])
QStringList args = QApplication::arguments();
if ( args.contains( "-h" ) || args.contains( "--help" ) ) {
if (args.contains(QStringLiteral("-h")) || args.contains(QStringLiteral("--help"))) {
qWarning() << "Usage: marble [options]";
qWarning();
qWarning() << "general options:";
......
......@@ -29,7 +29,7 @@ public:
void componentComplete()
{
QQuickItem *pinch = findChild<QQuickItem*>("pinchArea");
QQuickItem *pinch = findChild<QQuickItem*>(QStringLiteral("pinchArea"));
if (pinch)
{
pinch->installEventFilter(getEventFilter());
......@@ -69,7 +69,7 @@ public:
{
MarbleDeclarativePlugin plugin;
plugin.registerTypes("org.kde.marble");
setSource(QUrl("qrc:/main.qml"));
setSource(QUrl(QStringLiteral("qrc:/main.qml")));
if(status()!=QQuickView::Ready)
qDebug("can't initialise view");
......@@ -79,7 +79,7 @@ public:
setFormat(format);
setClearBeforeRendering(true);
setColor(QColor(Qt::transparent));
setTitle("Marble in QML 2.0 demo");
setTitle(QStringLiteral("Marble in QML 2.0 demo"));
show();
}
......
......@@ -25,7 +25,7 @@ int main(int argc, char** argv)
MarbleModel model;
SearchRunnerManager manager( &model );
QVector<GeoDataPlacemark*> searchResult = manager.searchPlacemarks( "Karlsruhe" );
QVector<GeoDataPlacemark*> searchResult = manager.searchPlacemarks(QStringLiteral("Karlsruhe"));
foreach( const GeoDataPlacemark* placemark, searchResult ) {
qDebug() << "Found" << placemark->name() << "at" << placemark->coordinate().toString();
}
......
......@@ -73,12 +73,12 @@ bool MyPaintLayer::render ( GeoPainter *painter, ViewportParams *viewport, const
painter->drawEllipse ( a2, 8, 8 );
qreal x, y;
if ( viewport->screenCoordinates ( a2, x, y ) ) {
painter->drawText( x+5, y, "A" );
painter->drawText(x+5, y, QStringLiteral("A"));
}
GeoDataCoordinates b1 = basePoint( m_cities[1], m_cities[2], m_cities[3] );
painter->drawEllipse ( b1, 8, 8 );
if ( viewport->screenCoordinates ( b1, x, y ) ) {
painter->drawText( x+5, y, "B" );
painter->drawText(x+5, y, QStringLiteral("B"));
}
QPen grapePen = Marble::Oxygen::grapeViolet4;
......@@ -102,7 +102,7 @@ bool MyPaintLayer::render ( GeoPainter *painter, ViewportParams *viewport, const
QPen greenPen = Marble::Oxygen::forestGreen4;
greenPen.setWidth ( 3 );
painter->setPen ( greenPen );
painter->drawPolyline ( m_interpolated, "Squad\nInterpolation", LineEnd );
painter->drawPolyline ( m_interpolated, QStringLiteral("Squad\nInterpolation"), LineEnd );
// Increasing city indices with some transparency effect for readability
QFont font = painter->font();
......@@ -219,7 +219,7 @@ int main ( int argc, char** argv )
using namespace Marble;
QApplication app ( argc, argv );
MarbleWidget *mapWidget = new MarbleWidget;
mapWidget->setWindowTitle( "Marble - Squad Interpolation" );
mapWidget->setWindowTitle(QStringLiteral("Marble - Squad Interpolation"));
// Create and register our paint layer
MyPaintLayer* layer = new MyPaintLayer ( mapWidget );
......
......@@ -76,8 +76,8 @@ Window::Window(QWidget *parent) :
m_marbleWidget->centerOn(Kiev);
m_marbleWidget->setZoom(2300);
m_carFirst = new GeoDataPlacemark("Bus");
m_carSecond = new GeoDataPlacemark("Car");
m_carFirst = new GeoDataPlacemark(QStringLiteral("Bus"));
m_carSecond = new GeoDataPlacemark(QStringLiteral("Car"));
GeoDataDocument *document = new GeoDataDocument;
......
Supports Markdown
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