Don't use automatic string conversions
* Disables automatic conversions from 8-bit strings (char *) to unicode QStrings. * Disables automatic conversion from QString to 8-bit strings (char *). * Disables automatic conversions from QByteArray to const char * or const void *. * Disables automatic conversions from QString (or char *) to QUrl. * Use QStringBuilder for more efficient string creation. It make us aware of string and encoding conversions.
This commit is contained in:
committed by
Chih-Hsuan Yen
parent
e3adf1abe2
commit
c6880070e9
+9
-9
@@ -16,23 +16,23 @@ QString get_kb_layout_dir()
|
||||
#else
|
||||
// qDebug() << __FILE__ << __FUNCTION__;
|
||||
|
||||
QString rval = "";
|
||||
QString k(KB_LAYOUT_DIR);
|
||||
QString rval = QString();
|
||||
QString k(QLatin1String(KB_LAYOUT_DIR));
|
||||
QDir d(k);
|
||||
|
||||
qDebug() << "default KB_LAYOUT_DIR: " << k;
|
||||
|
||||
if (d.exists())
|
||||
{
|
||||
rval = k.append("/");
|
||||
rval = k.append(QLatin1Char('/'));
|
||||
return rval;
|
||||
}
|
||||
|
||||
// subdir in the app location
|
||||
d.setPath(QCoreApplication::applicationDirPath() + "/kb-layouts/");
|
||||
d.setPath(QCoreApplication::applicationDirPath() + QLatin1String("/kb-layouts/"));
|
||||
//qDebug() << d.path();
|
||||
if (d.exists())
|
||||
return QCoreApplication::applicationDirPath() + "/kb-layouts/";
|
||||
return QCoreApplication::applicationDirPath() + QLatin1String("/kb-layouts/");
|
||||
#ifdef Q_WS_MAC
|
||||
d.setPath(QCoreApplication::applicationDirPath() + "/../Resources/kb-layouts/");
|
||||
if (d.exists())
|
||||
@@ -66,22 +66,22 @@ const QStringList get_color_schemes_dirs()
|
||||
// qDebug() << __FILE__ << __FUNCTION__;
|
||||
|
||||
QStringList rval;
|
||||
QString k(COLORSCHEMES_DIR);
|
||||
QString k(QLatin1String(COLORSCHEMES_DIR));
|
||||
QDir d(k);
|
||||
|
||||
// qDebug() << "default COLORSCHEMES_DIR: " << k;
|
||||
|
||||
if (d.exists())
|
||||
rval << k.append("/");
|
||||
rval << k.append(QLatin1Char('/'));
|
||||
|
||||
// subdir in the app location
|
||||
d.setPath(QCoreApplication::applicationDirPath() + "/color-schemes/");
|
||||
d.setPath(QCoreApplication::applicationDirPath() + QLatin1String("/color-schemes/"));
|
||||
//qDebug() << d.path();
|
||||
if (d.exists())
|
||||
{
|
||||
if (!rval.isEmpty())
|
||||
rval.clear();
|
||||
rval << (QCoreApplication::applicationDirPath() + "/color-schemes/");
|
||||
rval << (QCoreApplication::applicationDirPath() + QLatin1String("/color-schemes/"));
|
||||
}
|
||||
#ifdef Q_WS_MAC
|
||||
d.setPath(QCoreApplication::applicationDirPath() + "/../Resources/color-schemes/");
|
||||
|
||||
Reference in New Issue
Block a user