Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtGui]
authorThiago Macieira <thiago.macieira@intel.com>
Wed, 2 May 2012 14:32:26 +0000 (16:32 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 4 May 2012 10:45:52 +0000 (12:45 +0200)
This operation should be a no-op anyway, since at this point in time,
the fromAscii and toAscii functions simply call their fromLatin1 and
toLatin1 counterparts.

Task-number: QTBUG-21872
Change-Id: I2850033159508ebb1ff7564e15b99a146dbee94c
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
src/gui/image/qimage.h
src/gui/text/qtextdocument.cpp
tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp
tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
tests/auto/other/qaccessibility/tst_qaccessibility.cpp
tests/benchmarks/gui/image/blendbench/main.cpp
tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp

index db54969..aa81061 100644 (file)
@@ -326,9 +326,9 @@ inline QString QImage::text(const char* key, const char* lang) const
 {
     if (!d)
         return QString();
-    QString k = QString::fromAscii(key);
+    QString k = QString::fromLatin1(key);
     if (lang && *lang)
-        k += QLatin1Char('/') + QString::fromAscii(lang);
+        k += QLatin1Char('/') + QString::fromLatin1(lang);
     return text(k);
 }
 
@@ -342,8 +342,8 @@ inline QList<QImageTextKeyLang> QImage::textList() const
         int index = keys.at(i).indexOf(QLatin1Char('/'));
         if (index > 0) {
             QImageTextKeyLang tkl(true);
-            tkl.key = keys.at(i).left(index).toAscii();
-            tkl.lang = keys.at(i).mid(index+1).toAscii();
+            tkl.key = keys.at(i).left(index).toLatin1();
+            tkl.lang = keys.at(i).mid(index+1).toLatin1();
             imageTextKeys += tkl;
         }
     }
@@ -370,9 +370,9 @@ inline QString QImage::text(const QImageTextKeyLang&kl) const
 {
     if (!d)
         return QString();
-    QString k = QString::fromAscii(kl.key.constData());
+    QString k = QString::fromLatin1(kl.key.constData());
     if (!kl.lang.isEmpty())
-        k += QLatin1Char('/') + QString::fromAscii(kl.lang.constData());
+        k += QLatin1Char('/') + QString::fromLatin1(kl.lang.constData());
     return text(k);
 }
 
@@ -386,9 +386,9 @@ inline void QImage::setText(const char* key, const char* lang, const QString &s)
     if (!d)
         return;
 
-    QString k = QString::fromAscii(key);
+    QString k = QString::fromLatin1(key);
     if (lang && *lang)
-        k += QLatin1Char('/') + QString::fromAscii(lang);
+        k += QLatin1Char('/') + QString::fromLatin1(lang);
     setText(k, s);
 }
 
index f9fe166..89f6d1a 100644 (file)
@@ -2025,7 +2025,7 @@ QString QTextHtmlExporter::toHtml(const QByteArray &encoding, ExportMode mode)
     fragmentMarkers = (mode == ExportFragment);
 
     if (!encoding.isEmpty())
-        html += QString::fromLatin1("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%1\" />").arg(QString::fromAscii(encoding));
+        html += QString::fromLatin1("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%1\" />").arg(QString::fromLatin1(encoding));
 
     QString title  = doc->metaInformation(QTextDocument::DocumentTitle);
     if (!title.isEmpty())
index 12c9044..a1d050c 100644 (file)
@@ -1617,14 +1617,14 @@ void tst_QImageReader::pixelCompareWithBaseline()
                                     // least one file succeeded we know that the plugin was built.
                                     // The other failures are then real failures.
     QImage icoImg;
-    const QString inputFileName(QString::fromAscii("images/%1").arg(fileName));
+    const QString inputFileName(QString::fromLatin1("images/%1").arg(fileName));
     QFileInfo fi(inputFileName);
 
     ++enteredCount;
     // might fail if the plugin does not exist, which is ok.
     if (icoImg.load(inputFileName)) {
         icoImg = icoImg.convertToFormat(QImage::Format_ARGB32_Premultiplied);
-        const QString baselineFileName(QString::fromAscii("baseline/%1.png").arg(fi.baseName()));
+        const QString baselineFileName(QString::fromLatin1("baseline/%1.png").arg(fi.baseName()));
 #if 0
         icoImg.save(baselineFileName);
 #else
index 213b388..6fb3ab9 100644 (file)
@@ -279,23 +279,23 @@ void tst_QTextDocument::find_data()
 
     QTest::newRow("1") << "Hello World" << "World" << int(QTextDocument::FindCaseSensitively) << 0 << 6 << 11;
 
-    QTest::newRow("2") << QString::fromAscii("Hello") + QString(QChar::ParagraphSeparator) + QString::fromAscii("World")
+    QTest::newRow("2") << QString::fromLatin1("Hello") + QString(QChar::ParagraphSeparator) + QString::fromLatin1("World")
                     << "World" << int(QTextDocument::FindCaseSensitively) << 1 << 6 << 11;
 
-    QTest::newRow("3") << QString::fromAscii("Hello") + QString(QChar::ParagraphSeparator) + QString::fromAscii("World")
+    QTest::newRow("3") << QString::fromLatin1("Hello") + QString(QChar::ParagraphSeparator) + QString::fromLatin1("World")
                     << "Hello" << int(QTextDocument::FindCaseSensitively | QTextDocument::FindBackward) << 10 << 0 << 5;
-    QTest::newRow("4wholewords") << QString::fromAscii("Hello Blah World")
+    QTest::newRow("4wholewords") << QString::fromLatin1("Hello Blah World")
                               << "Blah" << int(QTextDocument::FindWholeWords) << 0 << 6 << 10;
-    QTest::newRow("5wholewords") << QString::fromAscii("HelloBlahWorld")
+    QTest::newRow("5wholewords") << QString::fromLatin1("HelloBlahWorld")
                               << "Blah" << int(QTextDocument::FindWholeWords) << 0 << -1 << -1;
-    QTest::newRow("6wholewords") << QString::fromAscii("HelloBlahWorld Blah Hah")
+    QTest::newRow("6wholewords") << QString::fromLatin1("HelloBlahWorld Blah Hah")
                               << "Blah" << int(QTextDocument::FindWholeWords) << 0 << 15 << 19;
-    QTest::newRow("7wholewords") << QString::fromAscii("HelloBlahWorld Blah Hah")
+    QTest::newRow("7wholewords") << QString::fromLatin1("HelloBlahWorld Blah Hah")
                               << "Blah" << int(QTextDocument::FindWholeWords | QTextDocument::FindBackward) << 23 << 15 << 19;
-    QTest::newRow("8wholewords") << QString::fromAscii("Hello: World\n")
+    QTest::newRow("8wholewords") << QString::fromLatin1("Hello: World\n")
                               << "orld" << int(QTextDocument::FindWholeWords) << 0 << -1 << -1;
 
-    QTest::newRow("across-paragraphs") << QString::fromAscii("First Parag\nSecond Parag with a lot more text")
+    QTest::newRow("across-paragraphs") << QString::fromLatin1("First Parag\nSecond Parag with a lot more text")
                                        << "Parag" << int(QTextDocument::FindBackward)
                                        << 15 << 6 << 11;
 
@@ -350,7 +350,7 @@ void tst_QTextDocument::findWithRegExp_data()
     // match ampersands but not &amp;
     QTest::newRow("2") << "His &amp; hers & theirs" << "&(?!amp;)"<< int(QTextDocument::FindCaseSensitively) << 0 << 15 << 16;
     //backward search
-    QTest::newRow("3") << QString::fromAscii("HelloBlahWorld Blah Hah")
+    QTest::newRow("3") << QString::fromLatin1("HelloBlahWorld Blah Hah")
                               << "h" << int(QTextDocument::FindBackward) << 18 << 8 << 9;
 
 }
index 7ca4fc9..d9fc5da 100644 (file)
@@ -884,7 +884,7 @@ void tst_QTextDocumentFragment::hrefAnchor()
         const char html[] = "<a href=\"test\">blah</a>";
         setHtml(QString::fromLatin1(html));
         QVERIFY(doc->begin().begin().fragment().charFormat().isAnchor());
-        QCOMPARE(doc->begin().begin().fragment().charFormat().anchorHref(), QString::fromAscii("test"));
+        QCOMPARE(doc->begin().begin().fragment().charFormat().anchorHref(), QString::fromLatin1("test"));
         QVERIFY(doc->begin().begin().fragment().charFormat().fontUnderline() == true);
     }
 
@@ -912,13 +912,13 @@ void tst_QTextDocumentFragment::namedAnchorFragments()
 
     // the 'a'
     QVERIFY(it.fragment().isValid());
-    QCOMPARE(it.fragment().text(), QString::fromAscii("a"));
+    QCOMPARE(it.fragment().text(), QString::fromLatin1("a"));
     QVERIFY(it.fragment().charFormat().isAnchor() == false);
 
     // the 'b' of 'blah' as separate fragment with the anchor attribute
     ++it;
     QVERIFY(it.fragment().isValid());
-    QCOMPARE(it.fragment().text(), QString::fromAscii("b"));
+    QCOMPARE(it.fragment().text(), QString::fromLatin1("b"));
     QVERIFY(it.fragment().charFormat().isAnchor());
 
     // the 'lah' of 'blah' as remainder
@@ -938,12 +938,12 @@ void tst_QTextDocumentFragment::namedAnchorFragments2()
     QTextBlock::Iterator it = doc->begin().begin();
     QVERIFY(!it.atEnd());
 
-    QCOMPARE(it.fragment().text(), QString::fromAscii("H"));
+    QCOMPARE(it.fragment().text(), QString::fromLatin1("H"));
     QVERIFY(it.fragment().charFormat().isAnchor());
 
     ++it;
 
-    QCOMPARE(it.fragment().text(), QString::fromAscii("ello"));
+    QCOMPARE(it.fragment().text(), QString::fromLatin1("ello"));
     QVERIFY(!it.fragment().charFormat().isAnchor());
 }
 
@@ -956,7 +956,7 @@ void tst_QTextDocumentFragment::namedAnchorFragments3()
     QTextBlock::Iterator it = doc->begin().begin();
     QVERIFY(!it.atEnd());
 
-    QCOMPARE(it.fragment().text(), QString::fromAscii("T"));
+    QCOMPARE(it.fragment().text(), QString::fromLatin1("T"));
     QVERIFY(it.fragment().charFormat().isAnchor());
     QCOMPARE(it.fragment().charFormat().anchorName(), QString("target"));
     QStringList targets; targets << "target" << "target2";
@@ -964,7 +964,7 @@ void tst_QTextDocumentFragment::namedAnchorFragments3()
 
     ++it;
 
-    QCOMPARE(it.fragment().text(), QString::fromAscii("ext"));
+    QCOMPARE(it.fragment().text(), QString::fromLatin1("ext"));
     QVERIFY(!it.fragment().charFormat().isAnchor());
 }
 
@@ -1068,7 +1068,7 @@ void tst_QTextDocumentFragment::mayNotHaveChildren()
     // make sure the Hey does not end up as tag text for the img tag
     const char html[] = "<img />Hey";
     setHtml(QString::fromLatin1(html));
-    QCOMPARE(doc->toPlainText().mid(1), QString::fromAscii("Hey"));
+    QCOMPARE(doc->toPlainText().mid(1), QString::fromLatin1("Hey"));
 }
 
 void tst_QTextDocumentFragment::inheritAlignment()
index 8920e63..d83f1e9 100644 (file)
@@ -530,7 +530,7 @@ void tst_QTextLayout::defaultWordSeparators_data()
     QString separators(".,:;-<>[](){}=/+%&^*");
     separators += QLatin1String("!?");
     for (int i = 0; i < separators.count(); ++i) {
-        QTest::newRow(QString::number(i).toAscii().data())
+        QTest::newRow(QString::number(i).toLatin1().data())
             << QString::fromLatin1("abcd") + separators.at(i) + QString::fromLatin1("efgh")
             <<  0 << 4;
     }
index ba1e73a..68ad38d 100644 (file)
@@ -368,7 +368,7 @@ void tst_QAccessibility::cleanup()
     const EventList list = QTestAccessibility::events();
     if (!list.isEmpty()) {
         qWarning("%d accessibility event(s) were not handled in testfunction '%s':", list.count(),
-                 QString(QTest::currentTestFunction()).toAscii().constData());
+                 QString(QTest::currentTestFunction()).toLatin1().constData());
         for (int i = 0; i < list.count(); ++i)
             qWarning(" %d: Object: %p Event: '%s' Child: %d", i + 1, list.at(i)->object(),
                      qAccessibleEventString(list.at(i)->type()), list.at(i)->child());
@@ -567,7 +567,7 @@ static QWidget *createWidgets()
 
     int i = 0;
     box->addWidget(new QComboBox(w));
-    box->addWidget(new QPushButton(QString::fromAscii("widget text %1").arg(i++), w));
+    box->addWidget(new QPushButton(QString::fromLatin1("widget text %1").arg(i++), w));
     box->addWidget(new QHeaderView(Qt::Vertical, w));
     box->addWidget(new QTreeView(w));
     box->addWidget(new QTreeWidget(w));
@@ -577,25 +577,25 @@ static QWidget *createWidgets()
     box->addWidget(new QTableWidget(w));
     box->addWidget(new QCalendarWidget(w));
     box->addWidget(new QDialogButtonBox(w));
-    box->addWidget(new QGroupBox(QString::fromAscii("widget text %1").arg(i++), w));
+    box->addWidget(new QGroupBox(QString::fromLatin1("widget text %1").arg(i++), w));
     box->addWidget(new QFrame(w));
-    box->addWidget(new QLineEdit(QString::fromAscii("widget text %1").arg(i++), w));
+    box->addWidget(new QLineEdit(QString::fromLatin1("widget text %1").arg(i++), w));
     box->addWidget(new QProgressBar(w));
     box->addWidget(new QTabWidget(w));
-    box->addWidget(new QCheckBox(QString::fromAscii("widget text %1").arg(i++), w));
-    box->addWidget(new QRadioButton(QString::fromAscii("widget text %1").arg(i++), w));
+    box->addWidget(new QCheckBox(QString::fromLatin1("widget text %1").arg(i++), w));
+    box->addWidget(new QRadioButton(QString::fromLatin1("widget text %1").arg(i++), w));
     box->addWidget(new QDial(w));
     box->addWidget(new QScrollBar(w));
     box->addWidget(new QSlider(w));
     box->addWidget(new QDateTimeEdit(w));
     box->addWidget(new QDoubleSpinBox(w));
     box->addWidget(new QSpinBox(w));
-    box->addWidget(new QLabel(QString::fromAscii("widget text %1").arg(i++), w));
+    box->addWidget(new QLabel(QString::fromLatin1("widget text %1").arg(i++), w));
     box->addWidget(new QLCDNumber(w));
     box->addWidget(new QStackedWidget(w));
     box->addWidget(new QToolBox(w));
-    box->addWidget(new QLabel(QString::fromAscii("widget text %1").arg(i++), w));
-    box->addWidget(new QTextEdit(QString::fromAscii("widget text %1").arg(i++), w));
+    box->addWidget(new QLabel(QString::fromLatin1("widget text %1").arg(i++), w));
+    box->addWidget(new QTextEdit(QString::fromLatin1("widget text %1").arg(i++), w));
 
     /* Not in the list
      * QAbstractItemView, QGraphicsView, QScrollArea,
index 82d7d4b..75e8e82 100644 (file)
@@ -126,7 +126,7 @@ void BlendBench::blendBench_data()
     for (int brush = ImageBrush; brush <= SolidBrush; ++brush)
         for (int mode = first; mode < limit; ++mode)
             QTest::newRow(QString("brush=%1; mode=%2")
-                          .arg(brushTypes[brush]).arg(compositionModes[mode]).toAscii().data())
+                          .arg(brushTypes[brush]).arg(compositionModes[mode]).toLatin1().data())
                 << brush << mode;
 }
 
index e5f09b9..9529ff6 100644 (file)
@@ -490,7 +490,7 @@ void tst_QPainter::setupBrushes()
 //          it != m_brushes.constEnd(); ++it) {
 //         for (int w=2; w<1025; w*=2) {
 //             for (int h=2; h<1025; h*=2) {
-//                 QTest::newRow(QString("brush=%1; size=[%2,%3]").arg(it.key()).arg(w).arg(h).toAscii().data())
+//                 QTest::newRow(QString("brush=%1; size=[%2,%3]").arg(it.key()).arg(w).arg(h).toLatin1().data())
 //                     << *it << QSize(w, h);
 //             }
 //         }