Some QString init cleanup

parent 1ee9cac6
......@@ -82,8 +82,17 @@ set_package_properties(OpenGL PROPERTIES
# TRUE
# )
#endif(APPLE)
#add_definitions( -DQT_NO_CAST_FROM_ASCII )
#add_definitions( -DQT_NO_CAST_TO_ASCII )
# use sane compile flags
add_definitions(
# -DQT_USE_QSTRINGBUILDER
-DQT_NO_CAST_TO_ASCII
# -DQT_NO_CAST_FROM_ASCII
-DQT_STRICT_ITERATORS
-DQT_NO_URL_CAST_FROM_STRING
-DQT_NO_CAST_FROM_BYTEARRAY
# -DQT_USE_FAST_OPERATOR_PLUS
)
install(FILES kdenlivesettings.kcfg DESTINATION ${KCFG_INSTALL_DIR})
kconfig_add_kcfg_files(kdenlive_SRCS kdenlivesettings.kcfgc)
......
......@@ -77,7 +77,7 @@ QImage AssetIconProvider::makeIcon(const QString &effectId, const QString &effec
QFont ft = QFont();
ft.setBold(true);
uint hex = qHash(effectName);
QString t = "#" + QString::number(hex, 16).toUpper().left(6);
QString t = QStringLiteral("#") + QString::number(hex, 16).toUpper().left(6);
QColor col(t);
bool isAudio = false;
if (m_effect) {
......
......@@ -649,7 +649,7 @@ void KeyframeModel::parseAnimProperty(const QString &prop)
switch (m_paramType) {
case ParamType::AnimatedRect: {
mlt_rect rect = mlt_prop.anim_get_rect("key", frame);
value = QVariant(QString("%1 %2 %3 %4 %5").arg(rect.x).arg(rect.y).arg(rect.w).arg(rect.h).arg(rect.o));
value = QVariant(QStringLiteral("%1 %2 %3 %4 %5").arg(rect.x).arg(rect.y).arg(rect.w).arg(rect.h).arg(rect.o));
break;
}
default:
......@@ -749,7 +749,7 @@ QVariant KeyframeModel::getInterpolatedValue(const GenTime &pos) const
prop.anim_set("keyframe", rect, next->first.frames(pCore->getCurrentFps()), next->first.frames(pCore->getCurrentFps()),
convertToMltType(next->second.first));
rect = prop.anim_get_rect("keyframe", p);
const QString res = QString("%1 %2 %3 %4 %5").arg((int)rect.x).arg((int)rect.y).arg((int)rect.w).arg((int)rect.h).arg(rect.o);
const QString res = QStringLiteral("%1 %2 %3 %4 %5").arg((int)rect.x).arg((int)rect.y).arg((int)rect.w).arg((int)rect.h).arg(rect.o);
return QVariant(res);
}
return QVariant();
......
......@@ -139,7 +139,8 @@ void AssetParameterModel::setParameter(const QString &name, const QString &value
}
emit modelChanged();
// Update timeline view if necessary
pCore->updateItemModel(m_ownerId, m_asset->get("kdenlive_id"));
const QString assetId(m_asset->get("kdenlive_id"));
pCore->updateItemModel(m_ownerId, assetId);
pCore->refreshProjectItem(m_ownerId);
pCore->invalidateItem(m_ownerId);
}
......@@ -209,7 +210,7 @@ QVariant AssetParameterModel::data(const QModelIndex &index, int role) const
case OpacityRole:
return element.attribute(QStringLiteral("opacity")) != QLatin1String("false");
case ValueRole: {
QString value = m_asset->get(paramName.toUtf8().constData());
QString value(m_asset->get(paramName.toUtf8().constData()));
return value.isEmpty() ? (element.attribute(QStringLiteral("value")).isNull() ? parseAttribute(QStringLiteral("default"), element)
: element.attribute(QStringLiteral("value")))
: value;
......
......@@ -27,7 +27,7 @@
#include "projectclip.h"
#include <mlt++/Mlt.h>
QString BinPlaylist::binPlaylistId = "main bin";
QString BinPlaylist::binPlaylistId = QStringLiteral("main bin");
BinPlaylist::BinPlaylist()
: m_binPlaylist(new Mlt::Playlist(pCore->getCurrentProfile()->profile()))
{
......@@ -100,7 +100,7 @@ void BinPlaylist::removeBinClip(const QString &id)
int size = m_binPlaylist->count();
for (int i = 0; !ok && i < size; i++) {
QScopedPointer<Mlt::Producer> prod(m_binPlaylist->get_clip(i));
QString prodId = prod->parent().get("kdenlive:id");
QString prodId(prod->parent().get("kdenlive:id"));
if (prodId == id) {
m_binPlaylist->remove(i);
ok = true;
......@@ -131,7 +131,7 @@ void BinPlaylist::saveDocumentProperties(const QMap<QString, QString> &props, co
Mlt::Properties docProperties;
docProperties.pass_values(playlistProps, "kdenlive:docproperties.");
for (int i = 0; i < docProperties.count(); i++) {
QString propName = QStringLiteral("kdenlive:docproperties.") + docProperties.get_name(i);
QString propName = QStringLiteral("kdenlive:docproperties.%1").arg(docProperties.get_name(i));
playlistProps.set(propName.toUtf8().constData(), (char *)nullptr);
}
......@@ -139,7 +139,7 @@ void BinPlaylist::saveDocumentProperties(const QMap<QString, QString> &props, co
Mlt::Properties docMetadata;
docMetadata.pass_values(playlistProps, "kdenlive:docmetadata.");
for (int i = 0; i < docMetadata.count(); i++) {
QString propName = QStringLiteral("kdenlive:docmetadata.") + docMetadata.get_name(i);
QString propName = QStringLiteral("kdenlive:docmetadata.%1").arg(docMetadata.get_name(i));
playlistProps.set(propName.toUtf8().constData(), (char *)nullptr);
}
......
......@@ -213,7 +213,7 @@ bool ClipCreator::createClipsFromList(const QList<QUrl> &list, bool checkRemovab
QMimeDatabase db;
for (const QUrl &file : list) {
QMimeType type = db.mimeTypeForUrl(file);
if (type.inherits("inode/directory")) {
if (type.inherits(QLatin1String("inode/directory"))) {
// user dropped a folder, import its files
QDir dir(file.path());
QStringList result = dir.entryList(QDir::Files);
......
......@@ -148,7 +148,7 @@ void Core::initGUI(const QUrl &Url)
KMessageBox::error(
m_mainWindow,
i18n("The given profile is invalid. We default to the profile \"dv_pal\", but you can change this from Kdenlive's settings panel"));
m_profile = "dv_pal";
m_profile = QStringLiteral("dv_pal");
}
KdenliveSettings::setDefault_profile(m_profile);
profileChanged();
......
......@@ -522,14 +522,12 @@ void KdenliveSettingsDialog::initDevices()
if (line.contains(QStringLiteral("playback"))) {
deviceId = line.section(QLatin1Char(':'), 0, 0);
m_configSdl.kcfg_audio_device->addItem(line.section(QLatin1Char(':'), 1, 1),
"plughw:" + QString::number(deviceId.section(QLatin1Char('-'), 0, 0).toInt()) + QLatin1Char(',') +
QString::number(deviceId.section(QLatin1Char('-'), 1, 1).toInt()));
QStringLiteral("plughw:%1,%2").arg(deviceId.section(QLatin1Char('-'), 0, 0).toInt()).arg(deviceId.section(QLatin1Char('-'), 1, 1).toInt()));
}
if (line.contains(QStringLiteral("capture"))) {
deviceId = line.section(QLatin1Char(':'), 0, 0);
m_configCapture.kcfg_v4l_alsadevice->addItem(line.section(QLatin1Char(':'), 1, 1).simplified(),
"hw:" + QString::number(deviceId.section(QLatin1Char('-'), 0, 0).toInt()) + QLatin1Char(',') +
QString::number(deviceId.section(QLatin1Char('-'), 1, 1).toInt()));
QStringLiteral("hw:%1,%2").arg(deviceId.section(QLatin1Char('-'), 0, 0).toInt()).arg(deviceId.section(QLatin1Char('-'), 1, 1).toInt()));
}
line = stream.readLine();
}
......@@ -580,8 +578,8 @@ void KdenliveSettingsDialog::slotReadAudioDevices()
if (!devicestr.startsWith(QLatin1Char(' ')) && devicestr.count(QLatin1Char(':')) > 1) {
QString card = devicestr.section(QLatin1Char(':'), 0, 0).section(QLatin1Char(' '), -1);
QString device = devicestr.section(QLatin1Char(':'), 1, 1).section(QLatin1Char(' '), -1);
m_configSdl.kcfg_audio_device->addItem(devicestr.section(QLatin1Char(':'), -1).simplified(), "plughw:" + card + QLatin1Char(',') + device);
m_configCapture.kcfg_v4l_alsadevice->addItem(devicestr.section(QLatin1Char(':'), -1).simplified(), "hw:" + card + QLatin1Char(',') + device);
m_configSdl.kcfg_audio_device->addItem(devicestr.section(QLatin1Char(':'), -1).simplified(), QStringLiteral("plughw:%1,%2").arg(card).arg(device));
m_configCapture.kcfg_v4l_alsadevice->addItem(devicestr.section(QLatin1Char(':'), -1).simplified(), QStringLiteral("hw:%1,%2").arg(card).arg(device));
}
}
}
......
......@@ -761,13 +761,15 @@ void Wizard::slotCheckStandard()
QListWidgetItem *item = m_standard.profiles_list->item(i);
std::unique_ptr<ProfileModel> &curProfile = ProfileRepository::get()->getProfile(item->data(Qt::UserRole).toString());
const QString infoString = ("<strong>" + i18n("Frame size:") + QStringLiteral(" </strong>%1x%2<br /><strong>") + i18n("Frame rate:") +
const QString infoString = QStringLiteral("<strong>") + i18n("Frame size:") + QStringLiteral(" </strong>%1x%2<br /><strong>").arg(curProfile->width()).arg(curProfile->height()) + i18n("Frame rate:") + QStringLiteral(" </strong>%1/%2<br /><strong>").arg(curProfile->frame_rate_num()).arg(curProfile->frame_rate_den()) + i18n("Pixel aspect ratio:") + QStringLiteral("</strong>%1/%2<br /><strong>").arg(curProfile->sample_aspect_num()).arg(curProfile->sample_aspect_den()) + i18n("Display aspect ratio:") + QStringLiteral(" </strong>%1/%2").arg(curProfile->display_aspect_num()).arg(curProfile->display_aspect_den());
/*const QString infoString = QStringLiteral("<strong>" + i18n("Frame size:") + QStringLiteral(" </strong>%1x%2<br /><strong>") + i18n("Frame rate:") +
QStringLiteral(" </strong>%3/%4<br /><strong>") + i18n("Pixel aspect ratio:") +
QStringLiteral("</strong>%5/%6<br /><strong>") + i18n("Display aspect ratio:") + QStringLiteral(" </strong>%7/%8"))
.arg(QString::number(curProfile->width()), QString::number(curProfile->height()),
QString::number(curProfile->frame_rate_num()), QString::number(curProfile->frame_rate_den()),
QString::number(curProfile->sample_aspect_num()), QString::number(curProfile->sample_aspect_den()),
QString::number(curProfile->display_aspect_num()), QString::number(curProfile->display_aspect_den()));
QString::number(curProfile->display_aspect_num()), QString::number(curProfile->display_aspect_den()));*/
item->setToolTip(infoString);
}
......
......@@ -57,7 +57,7 @@ void MonitorManager::setDocument(KdenliveDoc *doc)
QAction *MonitorManager::getAction(const QString &name)
{
return pCore->window()->action(name.toLatin1());
return pCore->window()->action(name.toUtf8().constData());
}
void MonitorManager::initMonitors(Monitor *clipMonitor, Monitor *projectMonitor)
......
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