qstring optimizations
REVIEW: 126148
This commit is contained in:
parent
8ce47c5f1e
commit
c7c2980f14
@ -119,7 +119,7 @@ endif()
|
||||
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0)
|
||||
|
||||
#add_definitions(-Wno-deprecated)
|
||||
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
|
||||
add_definitions(-DQT_USE_QSTRINGBUILDER)
|
||||
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
|
||||
|
||||
remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_STRICT_ITERATORS -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_KEYWORDS)
|
||||
|
@ -32,7 +32,7 @@ namespace Plasma
|
||||
SortFilterModel::SortFilterModel(QObject *parent)
|
||||
: QSortFilterProxyModel(parent)
|
||||
{
|
||||
setObjectName("SortFilterModel");
|
||||
setObjectName(QStringLiteral("SortFilterModel"));
|
||||
setDynamicSortFilter(true);
|
||||
connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)),
|
||||
this, SIGNAL(countChanged()));
|
||||
@ -54,8 +54,8 @@ void SortFilterModel::syncRoleNames()
|
||||
}
|
||||
|
||||
m_roleIds.clear();
|
||||
QHash<int, QByteArray>::const_iterator i;
|
||||
for (i = roleNames().constBegin(); i != roleNames().constEnd(); ++i) {
|
||||
const QHash<int, QByteArray> rNames = roleNames();
|
||||
for (auto i = rNames.constBegin(); i != rNames.constEnd(); ++i) {
|
||||
m_roleIds[i.value()] = i.key();
|
||||
}
|
||||
|
||||
@ -194,8 +194,8 @@ QVariantMap SortFilterModel::get(int row) const
|
||||
QModelIndex idx = index(row, 0);
|
||||
QVariantMap hash;
|
||||
|
||||
QHash<int, QByteArray>::const_iterator i;
|
||||
for (i = roleNames().constBegin(); i != roleNames().constEnd(); ++i) {
|
||||
const QHash<int, QByteArray> rNames = roleNames();
|
||||
for (auto i = rNames.begin(); i != rNames.end(); ++i) {
|
||||
hash[i.value()] = data(idx, i.key());
|
||||
}
|
||||
|
||||
@ -224,11 +224,11 @@ DataModel::DataModel(QObject *parent)
|
||||
m_maxRoleId(Qt::UserRole + 1)
|
||||
{
|
||||
//There is one reserved role name: DataEngineSource
|
||||
m_roleNames[m_maxRoleId] = "DataEngineSource";
|
||||
m_roleNames[m_maxRoleId] = QByteArrayLiteral("DataEngineSource");
|
||||
m_roleIds["DataEngineSource"] = m_maxRoleId;
|
||||
++m_maxRoleId;
|
||||
|
||||
setObjectName("DataModel");
|
||||
setObjectName(QStringLiteral("DataModel"));
|
||||
connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)),
|
||||
this, SIGNAL(countChanged()));
|
||||
connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)),
|
||||
@ -541,8 +541,8 @@ QVariantMap DataModel::get(int row) const
|
||||
QModelIndex idx = index(row, 0);
|
||||
QVariantMap map;
|
||||
|
||||
QHash<int, QByteArray>::const_iterator i;
|
||||
for (i = roleNames().constBegin(); i != roleNames().constEnd(); ++i) {
|
||||
const QHash<int, QByteArray> rNames = roleNames();
|
||||
for (auto i = rNames.constBegin(); i != rNames.constEnd(); ++i) {
|
||||
map[i.value()] = data(idx, i.key());
|
||||
}
|
||||
|
||||
|
@ -51,13 +51,13 @@ public:
|
||||
, bottomHeight(0)
|
||||
{
|
||||
if (svg->enabledBorders() & FrameSvg::LeftBorder)
|
||||
leftWidth = svg->elementSize(prefix % "left").width();
|
||||
leftWidth = svg->elementSize(prefix % QLatin1String("left")).width();
|
||||
if (svg->enabledBorders() & FrameSvg::RightBorder)
|
||||
rightWidth = svg->elementSize(prefix % "right").width();
|
||||
rightWidth = svg->elementSize(prefix % QLatin1String("right")).width();
|
||||
if (svg->enabledBorders() & FrameSvg::TopBorder)
|
||||
topHeight = svg->elementSize(prefix % "top").height();
|
||||
topHeight = svg->elementSize(prefix % QLatin1String("top")).height();
|
||||
if (svg->enabledBorders() & FrameSvg::BottomBorder)
|
||||
bottomHeight = svg->elementSize(prefix % "bottom").height();
|
||||
bottomHeight = svg->elementSize(prefix % QLatin1String("bottom")).height();
|
||||
}
|
||||
|
||||
QRect contentsRect(const QSize& size) const
|
||||
@ -415,9 +415,9 @@ void FrameSvgItem::doUpdate()
|
||||
}
|
||||
|
||||
QString prefix = m_frameSvg->actualPrefix();
|
||||
bool hasOverlay = !prefix.startsWith(QStringLiteral("mask-")) && m_frameSvg->hasElement(prefix % "overlay");
|
||||
bool hasComposeOverBorder = m_frameSvg->hasElement(prefix % "hint-compose-over-border") &&
|
||||
m_frameSvg->hasElement("mask-" % prefix % "center");
|
||||
bool hasOverlay = !prefix.startsWith(QLatin1String("mask-")) && m_frameSvg->hasElement(prefix % QLatin1String("overlay"));
|
||||
bool hasComposeOverBorder = m_frameSvg->hasElement(prefix % QLatin1String("hint-compose-over-border")) &&
|
||||
m_frameSvg->hasElement(QLatin1String("mask-") % prefix % QLatin1String("center"));
|
||||
m_fastPath = !hasOverlay && !hasComposeOverBorder;
|
||||
m_textureChanged = true;
|
||||
|
||||
@ -450,8 +450,10 @@ QSGNode *FrameSvgItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaint
|
||||
QString prefix = m_frameSvg->actualPrefix();
|
||||
oldNode = new FrameNode(prefix, m_frameSvg);
|
||||
|
||||
bool tileCenter = (m_frameSvg->hasElement("hint-tile-center") || m_frameSvg->hasElement(prefix % "hint-tile-center"));
|
||||
bool stretchBorders = (m_frameSvg->hasElement("hint-stretch-borders") || m_frameSvg->hasElement(prefix % "hint-stretch-borders"));
|
||||
bool tileCenter = (m_frameSvg->hasElement(QStringLiteral("hint-tile-center"))
|
||||
|| m_frameSvg->hasElement(prefix % QLatin1String("hint-tile-center")));
|
||||
bool stretchBorders = (m_frameSvg->hasElement(QStringLiteral("hint-stretch-borders"))
|
||||
|| m_frameSvg->hasElement(prefix % QLatin1String("hint-stretch-borders")));
|
||||
FrameItemNode::FitMode borderFitMode = stretchBorders ? FrameItemNode::Stretch : FrameItemNode::Tile;
|
||||
FrameItemNode::FitMode centerFitMode = tileCenter ? FrameItemNode::Tile: FrameItemNode::Stretch;
|
||||
|
||||
|
@ -122,7 +122,7 @@ void IconItem::setSource(const QVariant &source)
|
||||
m_svgIcon->setDevicePixelRatio((window() ? window()->devicePixelRatio() : qApp->devicePixelRatio()));
|
||||
}
|
||||
//try as a svg icon
|
||||
m_svgIcon->setImagePath("icons/" + source.toString().split("-").first());
|
||||
m_svgIcon->setImagePath(QLatin1String("icons/") + source.toString().split('-').first());
|
||||
|
||||
m_svgIcon->setContainsMultipleImages(true);
|
||||
|
||||
@ -137,9 +137,9 @@ void IconItem::setSource(const QVariant &source)
|
||||
const auto *iconTheme = KIconLoader::global()->theme();
|
||||
QString iconPath;
|
||||
if (iconTheme) {
|
||||
iconTheme->iconPath(source.toString() + ".svg", qMin(width(), height()), KIconLoader::MatchBest);
|
||||
iconTheme->iconPath(source.toString() + QLatin1String(".svg"), qMin(width(), height()), KIconLoader::MatchBest);
|
||||
if (iconPath.isEmpty()) {
|
||||
iconPath = iconTheme->iconPath(source.toString() + ".svgz", qMin(width(), height()), KIconLoader::MatchBest);
|
||||
iconPath = iconTheme->iconPath(source.toString() + QLatin1String(".svgz"), qMin(width(), height()), KIconLoader::MatchBest);
|
||||
}
|
||||
} else {
|
||||
qWarning() << "KIconLoader has no theme set";
|
||||
@ -348,9 +348,9 @@ void IconItem::loadPixmap()
|
||||
const auto *iconTheme = KIconLoader::global()->theme();
|
||||
QString iconPath;
|
||||
if (iconTheme) {
|
||||
QString iconPath = iconTheme->iconPath(source().toString() + ".svg", qMin(width(), height()), KIconLoader::MatchBest);
|
||||
QString iconPath = iconTheme->iconPath(source().toString() + QLatin1String(".svg"), qMin(width(), height()), KIconLoader::MatchBest);
|
||||
if (iconPath.isEmpty()) {
|
||||
iconPath = iconTheme->iconPath(source().toString() + ".svgz", qMin(width(), height()), KIconLoader::MatchBest);
|
||||
iconPath = iconTheme->iconPath(source().toString() + QLatin1String(".svgz"), qMin(width(), height()), KIconLoader::MatchBest);
|
||||
}
|
||||
} else {
|
||||
qWarning() << "KIconLoader has no theme set";
|
||||
|
@ -614,7 +614,7 @@ void Applet::setGlobalShortcut(const QKeySequence &shortcut)
|
||||
if (!d->activationAction) {
|
||||
d->activationAction = new QAction(this);
|
||||
d->activationAction->setText(i18n("Activate %1 Widget", title()));
|
||||
d->activationAction->setObjectName(QString("activate widget %1").arg(id())); // NO I18N
|
||||
d->activationAction->setObjectName(QStringLiteral("activate widget %1").arg(id())); // NO I18N
|
||||
connect(d->activationAction, SIGNAL(triggered()), this, SIGNAL(activated()));
|
||||
connect(d->activationAction, SIGNAL(changed()),
|
||||
this, SLOT(globalShortcutChanged()));
|
||||
@ -659,12 +659,12 @@ void Applet::setHasConfigurationInterface(bool hasInterface)
|
||||
return;
|
||||
}
|
||||
|
||||
QAction *configAction = d->actions->action("configure");
|
||||
QAction *configAction = d->actions->action(QStringLiteral("configure"));
|
||||
if (configAction) {
|
||||
bool enable = hasInterface;
|
||||
if (enable) {
|
||||
const bool unlocked = immutability() == Types::Mutable;
|
||||
enable = unlocked || KAuthorized::authorize("plasma/allow_configure_when_locked");
|
||||
enable = unlocked || KAuthorized::authorize(QStringLiteral("plasma/allow_configure_when_locked"));
|
||||
}
|
||||
configAction->setEnabled(enable);
|
||||
}
|
||||
@ -728,11 +728,12 @@ bool Applet::hasValidAssociatedApplication() const
|
||||
|
||||
Applet *Applet::loadPlasmoid(const QString &path, uint appletId)
|
||||
{
|
||||
if (QFile::exists(path + "/metadata.desktop")) {
|
||||
KService service(path + "/metadata.desktop");
|
||||
const QString metadataPath = path + QLatin1String("/metadata.desktop");
|
||||
if (QFile::exists(metadataPath)) {
|
||||
KService service(metadataPath);
|
||||
const QStringList &types = service.serviceTypes();
|
||||
|
||||
if (types.contains("Plasma/Containment")) {
|
||||
if (types.contains(QStringLiteral("Plasma/Containment"))) {
|
||||
return new Containment(path, appletId);
|
||||
} else {
|
||||
return new Applet(path, appletId);
|
||||
|
@ -102,11 +102,11 @@ void Containment::init()
|
||||
//Try to determine the containment type. It must be done as soon as possible
|
||||
QString type = pluginInfo().property("X-Plasma-ContainmentType").toString();
|
||||
|
||||
if (type == "Panel") {
|
||||
if (type == QLatin1String("Panel")) {
|
||||
setContainmentType(Plasma::Types::PanelContainment);
|
||||
} else if (type == "Custom") {
|
||||
} else if (type == QLatin1String("Custom")) {
|
||||
setContainmentType(Plasma::Types::CustomContainment);
|
||||
} else if (type == "CustomPanel") {
|
||||
} else if (type == QLatin1String("CustomPanel")) {
|
||||
setContainmentType(Plasma::Types::CustomPanelContainment);
|
||||
//default to desktop
|
||||
} else {
|
||||
@ -120,17 +120,17 @@ void Containment::init()
|
||||
|
||||
//fix the text of the actions that need title()
|
||||
//btw, do we really want to use title() when it's a desktopcontainment?
|
||||
QAction *closeApplet = actions()->action("remove");
|
||||
QAction *closeApplet = actions()->action(QStringLiteral("remove"));
|
||||
if (closeApplet) {
|
||||
closeApplet->setText(i18nc("%1 is the name of the applet", "Remove this %1", title()));
|
||||
}
|
||||
|
||||
QAction *configAction = actions()->action("configure");
|
||||
QAction *configAction = actions()->action(QStringLiteral("configure"));
|
||||
if (configAction) {
|
||||
configAction->setText(i18nc("%1 is the name of the applet", "%1 Settings", title()));
|
||||
}
|
||||
|
||||
QAction *appletBrowserAction = actions()->action("add widgets");
|
||||
QAction *appletBrowserAction = actions()->action(QStringLiteral("add widgets"));
|
||||
if (appletBrowserAction) {
|
||||
appletBrowserAction->setVisible(unlocked);
|
||||
appletBrowserAction->setEnabled(unlocked);
|
||||
@ -138,10 +138,10 @@ void Containment::init()
|
||||
}
|
||||
|
||||
if (immutability() != Types::SystemImmutable && corona()) {
|
||||
QAction *lockDesktopAction = corona()->actions()->action("lock widgets");
|
||||
QAction *lockDesktopAction = corona()->actions()->action(QStringLiteral("lock widgets"));
|
||||
//keep a pointer so nobody notices it moved to corona
|
||||
if (lockDesktopAction) {
|
||||
actions()->addAction("lock widgets", lockDesktopAction);
|
||||
actions()->addAction(QLatin1String("lock widgets"), lockDesktopAction);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ void FrameSvg::setElementPrefix(const QString &prefix)
|
||||
{
|
||||
const QString oldPrefix(d->prefix);
|
||||
|
||||
if (!hasElement(prefix % "-center")) {
|
||||
if (!hasElement(prefix % QLatin1String("-center"))) {
|
||||
d->prefix.clear();
|
||||
} else {
|
||||
d->prefix = prefix;
|
||||
@ -289,9 +289,9 @@ bool FrameSvg::hasElementPrefix(const QString &prefix) const
|
||||
//for now it simply checks if a center element exists,
|
||||
//because it could make sense for certain themes to not have all the elements
|
||||
if (prefix.isEmpty()) {
|
||||
return hasElement("center");
|
||||
return hasElement(QStringLiteral("center"));
|
||||
} else {
|
||||
return hasElement(prefix % "-center");
|
||||
return hasElement(prefix % QLatin1String("-center"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,16 +299,16 @@ bool FrameSvg::hasElementPrefix(Plasma::Types::Location location) const
|
||||
{
|
||||
switch (location) {
|
||||
case Types::TopEdge:
|
||||
return hasElementPrefix("north");
|
||||
return hasElementPrefix(QStringLiteral("north"));
|
||||
break;
|
||||
case Types::BottomEdge:
|
||||
return hasElementPrefix("south");
|
||||
return hasElementPrefix(QStringLiteral("south"));
|
||||
break;
|
||||
case Types::LeftEdge:
|
||||
return hasElementPrefix("west");
|
||||
return hasElementPrefix(QStringLiteral("west"));
|
||||
break;
|
||||
case Types::RightEdge:
|
||||
return hasElementPrefix("east");
|
||||
return hasElementPrefix(QStringLiteral("east"));
|
||||
break;
|
||||
default:
|
||||
return hasElementPrefix(QString());
|
||||
@ -652,8 +652,8 @@ QPixmap FrameSvgPrivate::alphaMask()
|
||||
FrameData *frame = frames[prefix];
|
||||
QString maskPrefix;
|
||||
|
||||
if (q->hasElement("mask-" % prefix % "center")) {
|
||||
maskPrefix = "mask-";
|
||||
if (q->hasElement(QLatin1String("mask-") % prefix % QLatin1String("center"))) {
|
||||
maskPrefix = QStringLiteral("mask-");
|
||||
}
|
||||
|
||||
if (maskPrefix.isNull()) {
|
||||
@ -725,13 +725,13 @@ void FrameSvgPrivate::generateBackground(FrameData *frame)
|
||||
|
||||
bool frameCached = !frame->cachedBackground.isNull();
|
||||
bool overlayCached = false;
|
||||
const bool overlayAvailable = !prefix.startsWith(QLatin1String("mask-")) && q->hasElement(prefix % "overlay");
|
||||
const bool overlayAvailable = !prefix.startsWith(QLatin1String("mask-")) && q->hasElement(prefix % QLatin1String("overlay"));
|
||||
QPixmap overlay;
|
||||
if (q->isUsingRenderingCache()) {
|
||||
frameCached = q->theme()->findInCache(id, frame->cachedBackground) && !frame->cachedBackground.isNull();
|
||||
|
||||
if (overlayAvailable) {
|
||||
overlayCached = q->theme()->findInCache("overlay_" % id, overlay) && !overlay.isNull();
|
||||
overlayCached = q->theme()->findInCache(QLatin1String("overlay_") % id, overlay) && !overlay.isNull();
|
||||
}
|
||||
}
|
||||
|
||||
@ -743,20 +743,20 @@ void FrameSvgPrivate::generateBackground(FrameData *frame)
|
||||
QSize overlaySize;
|
||||
QPoint actualOverlayPos = QPoint(0, 0);
|
||||
if (overlayAvailable && !overlayCached) {
|
||||
overlaySize = q->elementSize(prefix % "overlay");
|
||||
overlaySize = q->elementSize(prefix % QLatin1String("overlay"));
|
||||
|
||||
if (q->hasElement(prefix % "hint-overlay-pos-right")) {
|
||||
if (q->hasElement(prefix % QLatin1String("hint-overlay-pos-right"))) {
|
||||
actualOverlayPos.setX(frame->frameSize.width() - overlaySize.width());
|
||||
} else if (q->hasElement(prefix % "hint-overlay-pos-bottom")) {
|
||||
} else if (q->hasElement(prefix % QLatin1String("hint-overlay-pos-bottom"))) {
|
||||
actualOverlayPos.setY(frame->frameSize.height() - overlaySize.height());
|
||||
//Stretched or Tiled?
|
||||
} else if (q->hasElement(prefix % "hint-overlay-stretch")) {
|
||||
} else if (q->hasElement(prefix % QLatin1String("hint-overlay-stretch"))) {
|
||||
overlaySize = frameSize(frame).toSize();
|
||||
} else {
|
||||
if (q->hasElement(prefix % "hint-overlay-tile-horizontal")) {
|
||||
if (q->hasElement(prefix % QLatin1String("hint-overlay-tile-horizontal"))) {
|
||||
overlaySize.setWidth(frameSize(frame).width());
|
||||
}
|
||||
if (q->hasElement(prefix % "hint-overlay-tile-vertical")) {
|
||||
if (q->hasElement(prefix % QLatin1String("hint-overlay-tile-vertical"))) {
|
||||
overlaySize.setHeight(frameSize(frame).height());
|
||||
}
|
||||
}
|
||||
@ -765,16 +765,16 @@ void FrameSvgPrivate::generateBackground(FrameData *frame)
|
||||
QPainter overlayPainter(&overlay);
|
||||
overlayPainter.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
||||
//Tiling?
|
||||
if (q->hasElement(prefix % "hint-overlay-tile-horizontal") ||
|
||||
q->hasElement(prefix % "hint-overlay-tile-vertical")) {
|
||||
if (q->hasElement(prefix % QLatin1String("hint-overlay-tile-horizontal")) ||
|
||||
q->hasElement(prefix % QLatin1String("hint-overlay-tile-vertical"))) {
|
||||
|
||||
QSize s = q->size();
|
||||
q->resize(q->elementSize(prefix % "overlay"));
|
||||
q->resize(q->elementSize(prefix % QLatin1String("overlay")));
|
||||
|
||||
overlayPainter.drawTiledPixmap(QRect(QPoint(0, 0), overlaySize), q->pixmap(prefix % "overlay"));
|
||||
overlayPainter.drawTiledPixmap(QRect(QPoint(0, 0), overlaySize), q->pixmap(prefix % QLatin1String("overlay")));
|
||||
q->resize(s);
|
||||
} else {
|
||||
q->paint(&overlayPainter, QRect(actualOverlayPos, overlaySize), prefix % "overlay");
|
||||
q->paint(&overlayPainter, QRect(actualOverlayPos, overlaySize), prefix % QLatin1String("overlay"));
|
||||
}
|
||||
|
||||
overlayPainter.end();
|
||||
@ -822,11 +822,11 @@ void FrameSvgPrivate::generateFrameBackground(FrameData *frame)
|
||||
paintCorner(p, frame, FrameSvg::RightBorder|FrameSvg::BottomBorder, contentRect);
|
||||
|
||||
// Sides
|
||||
const int leftHeight = q->elementSize(prefix % "left").height();
|
||||
const int leftHeight = q->elementSize(prefix % QLatin1String("left")).height();
|
||||
paintBorder(p, frame, FrameSvg::LeftBorder, QSize(frame->leftWidth, leftHeight) * q->devicePixelRatio(), contentRect);
|
||||
paintBorder(p, frame, FrameSvg::RightBorder, QSize(frame->rightWidth, leftHeight) * q->devicePixelRatio(), contentRect);
|
||||
|
||||
const int topWidth = q->elementSize(prefix % "top").width();
|
||||
const int topWidth = q->elementSize(prefix % QLatin1String("top")).width();
|
||||
paintBorder(p, frame, FrameSvg::TopBorder, QSize(topWidth, frame->topHeight) * q->devicePixelRatio(), contentRect);
|
||||
paintBorder(p, frame, FrameSvg::BottomBorder, QSize(topWidth, frame->bottomHeight) * q->devicePixelRatio(), contentRect);
|
||||
p.end();
|
||||
@ -839,12 +839,12 @@ QRect FrameSvgPrivate::contentGeometry(FrameData* frame, const QSize& size) cons
|
||||
const QSize contentSize(size.width() - frame->leftWidth * q->devicePixelRatio() - frame->rightWidth * q->devicePixelRatio(),
|
||||
size.height() - frame->topHeight * q->devicePixelRatio() - frame->bottomHeight * q->devicePixelRatio());
|
||||
QRect contentRect(QPoint(0,0), contentSize);
|
||||
if (frame->enabledBorders & FrameSvg::LeftBorder && q->hasElement(prefix % "left")) {
|
||||
if (frame->enabledBorders & FrameSvg::LeftBorder && q->hasElement(prefix % QLatin1String("left"))) {
|
||||
contentRect.translate(frame->leftWidth * q->devicePixelRatio(), 0);
|
||||
}
|
||||
|
||||
// Corners
|
||||
if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(prefix % "top")) {
|
||||
if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(prefix % QLatin1String("top"))) {
|
||||
contentRect.translate(0, frame->topHeight * q->devicePixelRatio());
|
||||
}
|
||||
return contentRect;
|
||||
@ -853,7 +853,7 @@ QRect FrameSvgPrivate::contentGeometry(FrameData* frame, const QSize& size) cons
|
||||
void FrameSvgPrivate::paintCenter(QPainter& p, FrameData* frame, const QRect& contentRect, const QSize& fullSize)
|
||||
{
|
||||
if (!contentRect.isEmpty()) {
|
||||
const QString centerElementId = prefix % "center";
|
||||
const QString centerElementId = prefix % QLatin1String("center");
|
||||
if (frame->tileCenter) {
|
||||
QSize centerTileSize = q->elementSize(centerElementId);
|
||||
QPixmap center(centerTileSize);
|
||||
@ -940,7 +940,7 @@ void FrameSvgPrivate::cacheFrame(const QString &prefixToSave, const QPixmap &bac
|
||||
|
||||
if (!overlay.isNull()) {
|
||||
//insert overlay
|
||||
q->theme()->insertIntoCache("overlay_" % id, overlay, QString::number((qint64)q, 16) % prefixToSave % "overlay");
|
||||
q->theme()->insertIntoCache(QLatin1String("overlay_") % id, overlay, QString::number((qint64)q, 16) % prefixToSave % QLatin1String("overlay"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -955,20 +955,20 @@ void FrameSvgPrivate::updateSizes() const
|
||||
frame->cachedBackground = QPixmap();
|
||||
|
||||
//This has the same size regardless the border is enabled or not
|
||||
frame->fixedTopHeight = q->elementSize(prefix % "top").height();
|
||||
frame->fixedTopHeight = q->elementSize(prefix % QLatin1String("top")).height();
|
||||
|
||||
if (q->hasElement(prefix % "hint-top-margin")) {
|
||||
frame->fixedTopMargin = q->elementSize(prefix % "hint-top-margin").height();
|
||||
if (q->hasElement(prefix % QLatin1String("hint-top-margin"))) {
|
||||
frame->fixedTopMargin = q->elementSize(prefix % QLatin1String("hint-top-margin")).height();
|
||||
} else {
|
||||
frame->fixedTopMargin = frame->fixedTopHeight;
|
||||
}
|
||||
|
||||
//The same, but its size depends from the margin being enabled
|
||||
if (frame->enabledBorders & FrameSvg::TopBorder) {
|
||||
frame->topHeight = q->elementSize(prefix % "top").height();
|
||||
frame->topHeight = q->elementSize(prefix % QLatin1String("top")).height();
|
||||
|
||||
if (q->hasElement(prefix % "hint-top-margin")) {
|
||||
frame->topMargin = q->elementSize(prefix % "hint-top-margin").height();
|
||||
if (q->hasElement(prefix % QLatin1String("hint-top-margin"))) {
|
||||
frame->topMargin = q->elementSize(prefix % QLatin1String("hint-top-margin")).height();
|
||||
} else {
|
||||
frame->topMargin = frame->topHeight;
|
||||
}
|
||||
@ -976,19 +976,19 @@ void FrameSvgPrivate::updateSizes() const
|
||||
frame->topMargin = frame->topHeight = 0;
|
||||
}
|
||||
|
||||
frame->fixedLeftWidth = q->elementSize(prefix % "left").width();
|
||||
frame->fixedLeftWidth = q->elementSize(prefix % QLatin1String("left")).width();
|
||||
|
||||
if (q->hasElement(prefix % "hint-left-margin")) {
|
||||
frame->fixedLeftMargin = q->elementSize(prefix % "hint-left-margin").width();
|
||||
if (q->hasElement(prefix % QLatin1String("hint-left-margin"))) {
|
||||
frame->fixedLeftMargin = q->elementSize(prefix % QLatin1String("hint-left-margin")).width();
|
||||
} else {
|
||||
frame->fixedLeftMargin = frame->fixedLeftWidth;
|
||||
}
|
||||
|
||||
if (frame->enabledBorders & FrameSvg::LeftBorder) {
|
||||
frame->leftWidth = q->elementSize(prefix % "left").width();
|
||||
frame->leftWidth = q->elementSize(prefix % QLatin1String("left")).width();
|
||||
|
||||
if (q->hasElement(prefix % "hint-left-margin")) {
|
||||
frame->leftMargin = q->elementSize(prefix % "hint-left-margin").width();
|
||||
if (q->hasElement(prefix % QLatin1String("hint-left-margin"))) {
|
||||
frame->leftMargin = q->elementSize(prefix % QLatin1String("hint-left-margin")).width();
|
||||
} else {
|
||||
frame->leftMargin = frame->leftWidth;
|
||||
}
|
||||
@ -996,19 +996,19 @@ void FrameSvgPrivate::updateSizes() const
|
||||
frame->leftMargin = frame->leftWidth = 0;
|
||||
}
|
||||
|
||||
frame->fixedRightWidth = q->elementSize(prefix % "right").width();
|
||||
frame->fixedRightWidth = q->elementSize(prefix % QLatin1String("right")).width();
|
||||
|
||||
if (q->hasElement(prefix % "hint-right-margin")) {
|
||||
frame->fixedRightMargin = q->elementSize(prefix % "hint-right-margin").width();
|
||||
if (q->hasElement(prefix % QLatin1String("hint-right-margin"))) {
|
||||
frame->fixedRightMargin = q->elementSize(prefix % QLatin1String("hint-right-margin")).width();
|
||||
} else {
|
||||
frame->fixedRightMargin = frame->fixedRightWidth;
|
||||
}
|
||||
|
||||
if (frame->enabledBorders & FrameSvg::RightBorder) {
|
||||
frame->rightWidth = q->elementSize(prefix % "right").width();
|
||||
frame->rightWidth = q->elementSize(prefix % QLatin1String("right")).width();
|
||||
|
||||
if (q->hasElement(prefix % "hint-right-margin")) {
|
||||
frame->rightMargin = q->elementSize(prefix % "hint-right-margin").width();
|
||||
if (q->hasElement(prefix % QLatin1String("hint-right-margin"))) {
|
||||
frame->rightMargin = q->elementSize(prefix % QLatin1String("hint-right-margin")).width();
|
||||
} else {
|
||||
frame->rightMargin = frame->rightWidth;
|
||||
}
|
||||
@ -1016,19 +1016,19 @@ void FrameSvgPrivate::updateSizes() const
|
||||
frame->rightMargin = frame->rightWidth = 0;
|
||||
}
|
||||
|
||||
frame->fixedBottomHeight = q->elementSize(prefix % "bottom").height();
|
||||
frame->fixedBottomHeight = q->elementSize(prefix % QLatin1String("bottom")).height();
|
||||
|
||||
if (q->hasElement(prefix % "hint-bottom-margin")) {
|
||||
frame->fixedBottomMargin = q->elementSize(prefix % "hint-bottom-margin").height();
|
||||
if (q->hasElement(prefix % QLatin1String("hint-bottom-margin"))) {
|
||||
frame->fixedBottomMargin = q->elementSize(prefix % QLatin1String("hint-bottom-margin")).height();
|
||||
} else {
|
||||
frame->fixedBottomMargin = frame->fixedBottomHeight;
|
||||
}
|
||||
|
||||
if (frame->enabledBorders & FrameSvg::BottomBorder) {
|
||||
frame->bottomHeight = q->elementSize(prefix % "bottom").height();
|
||||
frame->bottomHeight = q->elementSize(prefix % QLatin1String("bottom")).height();
|
||||
|
||||
if (q->hasElement(prefix % "hint-bottom-margin")) {
|
||||
frame->bottomMargin = q->elementSize(prefix % "hint-bottom-margin").height();
|
||||
if (q->hasElement(prefix % QLatin1String("hint-bottom-margin"))) {
|
||||
frame->bottomMargin = q->elementSize(prefix % QLatin1String("hint-bottom-margin")).height();
|
||||
} else {
|
||||
frame->bottomMargin = frame->bottomHeight;
|
||||
}
|
||||
@ -1036,14 +1036,14 @@ void FrameSvgPrivate::updateSizes() const
|
||||
frame->bottomMargin = frame->bottomHeight = 0;
|
||||
}
|
||||
|
||||
frame->composeOverBorder = (q->hasElement(prefix % "hint-compose-over-border") &&
|
||||
q->hasElement("mask-" % prefix % "center"));
|
||||
frame->composeOverBorder = (q->hasElement(prefix % QLatin1String("hint-compose-over-border")) &&
|
||||
q->hasElement(QLatin1String("mask-") % prefix % QLatin1String("center")));
|
||||
|
||||
//since it's rectangular, topWidth and bottomWidth must be the same
|
||||
//the ones that don't have a prefix is for retrocompatibility
|
||||
frame->tileCenter = (q->hasElement("hint-tile-center") || q->hasElement(prefix % "hint-tile-center"));
|
||||
frame->noBorderPadding = (q->hasElement("hint-no-border-padding") || q->hasElement(prefix % "hint-no-border-padding"));
|
||||
frame->stretchBorders = (q->hasElement("hint-stretch-borders") || q->hasElement(prefix % "hint-stretch-borders"));
|
||||
frame->tileCenter = (q->hasElement(QStringLiteral("hint-tile-center")) || q->hasElement(prefix % QLatin1String("hint-tile-center")));
|
||||
frame->noBorderPadding = (q->hasElement(QStringLiteral("hint-no-border-padding")) || q->hasElement(prefix % QLatin1String("hint-no-border-padding")));
|
||||
frame->stretchBorders = (q->hasElement(QStringLiteral("hint-stretch-borders")) || q->hasElement(prefix % QLatin1String("hint-stretch-borders")));
|
||||
q->resize(s);
|
||||
}
|
||||
|
||||
|
@ -56,13 +56,13 @@ class PluginLoaderPrivate
|
||||
public:
|
||||
PluginLoaderPrivate()
|
||||
: isDefaultLoader(false),
|
||||
packageRE("[^a-zA-Z0-9\\-_]")
|
||||
packageRE(QLatin1String("[^a-zA-Z0-9\\-_]"))
|
||||
{
|
||||
KPackage::PackageLoader::self()->addKnownPackageStructure("Plasma/Applet", new PlasmoidPackage());
|
||||
KPackage::PackageLoader::self()->addKnownPackageStructure("Plasma/DataEngine", new DataEnginePackage());
|
||||
KPackage::PackageLoader::self()->addKnownPackageStructure("Plasma/Theme", new ThemePackage());
|
||||
KPackage::PackageLoader::self()->addKnownPackageStructure("Plasma/ContainmentActions", new ContainmentActionsPackage());
|
||||
KPackage::PackageLoader::self()->addKnownPackageStructure("Plasma/Generic", new GenericPackage());
|
||||
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Applet"), new PlasmoidPackage());
|
||||
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/DataEngine"), new DataEnginePackage());
|
||||
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Theme"), new ThemePackage());
|
||||
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/ContainmentActions"), new ContainmentActionsPackage());
|
||||
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Generic"), new GenericPackage());
|
||||
}
|
||||
|
||||
static QSet<QString> knownCategories();
|
||||
@ -82,11 +82,11 @@ public:
|
||||
|
||||
QSet<QString> PluginLoaderPrivate::s_customCategories;
|
||||
|
||||
QString PluginLoaderPrivate::s_dataEnginePluginDir("plasma/dataengine");
|
||||
QString PluginLoaderPrivate::s_packageStructurePluginDir("plasma/packagestructure");
|
||||
QString PluginLoaderPrivate::s_plasmoidsPluginDir("plasma/applets");
|
||||
QString PluginLoaderPrivate::s_servicesPluginDir("plasma/services");
|
||||
QString PluginLoaderPrivate::s_containmentActionsPluginDir("plasma/containmentactions");
|
||||
QString PluginLoaderPrivate::s_dataEnginePluginDir = QStringLiteral("plasma/dataengine");
|
||||
QString PluginLoaderPrivate::s_packageStructurePluginDir = QStringLiteral("plasma/packagestructure");
|
||||
QString PluginLoaderPrivate::s_plasmoidsPluginDir = QStringLiteral("plasma/applets");
|
||||
QString PluginLoaderPrivate::s_servicesPluginDir = QStringLiteral("plasma/services");
|
||||
QString PluginLoaderPrivate::s_containmentActionsPluginDir = QStringLiteral("plasma/containmentactions");
|
||||
|
||||
QSet<QString> PluginLoaderPrivate::knownCategories()
|
||||
{
|
||||
@ -124,11 +124,11 @@ QString PluginLoaderPrivate::parentAppConstraint(const QString &parentApp)
|
||||
return QString();
|
||||
}
|
||||
|
||||
return QString("((not exist [X-KDE-ParentApp] or [X-KDE-ParentApp] == '') or [X-KDE-ParentApp] == '%1')")
|
||||
return QStringLiteral("((not exist [X-KDE-ParentApp] or [X-KDE-ParentApp] == '') or [X-KDE-ParentApp] == '%1')")
|
||||
.arg(app->applicationName());
|
||||
}
|
||||
|
||||
return QString("[X-KDE-ParentApp] == '%1'").arg(parentApp);
|
||||
return QStringLiteral("[X-KDE-ParentApp] == '%1'").arg(parentApp);
|
||||
}
|
||||
|
||||
PluginLoader::PluginLoader()
|
||||
@ -211,7 +211,7 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari
|
||||
}
|
||||
|
||||
|
||||
KPackage::Package p = KPackage::PackageLoader::self()->loadPackage("Plasma/Applet", name);
|
||||
KPackage::Package p = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/Applet"), name);
|
||||
if (!p.isValid()) {
|
||||
//some applets have actually the root path from another package, such as icontasks
|
||||
//try to do a fallback package with X-Plasma-RootPath root
|
||||
@ -219,7 +219,7 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari
|
||||
p.setPath(name);
|
||||
|
||||
KPluginMetaData md(p.filePath("metadata"));
|
||||
const KPackage::Package fp = KPackage::PackageLoader::self()->loadPackage("Plasma/Applet", md.value("X-Plasma-RootPath"));
|
||||
const KPackage::Package fp = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/Applet"), md.value(QStringLiteral("X-Plasma-RootPath")));
|
||||
p.setFallbackPackage(fp);
|
||||
|
||||
if (!fp.isValid()) {
|
||||
@ -259,7 +259,7 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari
|
||||
QVariantList allArgs;
|
||||
allArgs << p.metadata().fileName() << appletId << args;
|
||||
|
||||
if (p.metadata().serviceTypes().contains("Plasma/Containment")) {
|
||||
if (p.metadata().serviceTypes().contains(QStringLiteral("Plasma/Containment"))) {
|
||||
return new Containment(0, allArgs);
|
||||
} else {
|
||||
return new Applet(0, allArgs);
|
||||
@ -297,7 +297,7 @@ DataEngine *PluginLoader::loadDataEngine(const QString &name)
|
||||
return engine;
|
||||
}
|
||||
|
||||
const KPackage::Package p = KPackage::PackageLoader::self()->loadPackage("Plasma/DataEngine", name);
|
||||
const KPackage::Package p = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/DataEngine"), name);
|
||||
if (!p.isValid()) {
|
||||
return 0;
|
||||
}
|
||||
@ -315,7 +315,7 @@ QStringList PluginLoader::listAllEngines(const QString &parentApp)
|
||||
// Look for C++ plugins first
|
||||
auto filter = [&parentApp](const KPluginMetaData &md) -> bool
|
||||
{
|
||||
return md.value("X-KDE-ParentApp") == parentApp;
|
||||
return md.value(QStringLiteral("X-KDE-ParentApp")) == parentApp;
|
||||
};
|
||||
QVector<KPluginMetaData> plugins;
|
||||
if (parentApp.isEmpty()) {
|
||||
@ -355,11 +355,12 @@ KPluginInfo::List PluginLoader::listEngineInfoByCategory(const QString &category
|
||||
// Look for C++ plugins first
|
||||
auto filterNormal = [&category](const KPluginMetaData &md) -> bool
|
||||
{
|
||||
return md.value("X-KDE-PluginInfo-Category") == category;
|
||||
return md.value(QStringLiteral("X-KDE-PluginInfo-Category")) == category;
|
||||
};
|
||||
auto filterParentApp = [&category, &parentApp](const KPluginMetaData &md) -> bool
|
||||
{
|
||||
return md.value("X-KDE-ParentApp") == parentApp && md.value("X-KDE-PluginInfo-Category") == category;
|
||||
return md.value(QStringLiteral("X-KDE-ParentApp")) == parentApp
|
||||
&& md.value(QStringLiteral("X-KDE-PluginInfo-Category")) == category;
|
||||
};
|
||||
QVector<KPluginMetaData> plugins;
|
||||
if (parentApp.isEmpty()) {
|
||||
@ -388,7 +389,7 @@ Service *PluginLoader::loadService(const QString &name, const QVariantList &args
|
||||
//TODO: scripting API support
|
||||
if (name.isEmpty()) {
|
||||
return new NullService(QString(), parent);
|
||||
} else if (name == "org.kde.servicestorage") {
|
||||
} else if (name == QLatin1String("org.kde.servicestorage")) {
|
||||
return new Storage(parent);
|
||||
}
|
||||
|
||||
@ -456,8 +457,8 @@ ContainmentActions *PluginLoader::loadContainmentActions(Containment *parent, co
|
||||
|
||||
//FIXME: this is only for backwards compatibility, but probably will have to stay
|
||||
//for the time being
|
||||
QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(name);
|
||||
KService::List offers = KServiceTypeTrader::self()->query("Plasma/ContainmentActions", constraint);
|
||||
QString constraint = QStringLiteral("[X-KDE-PluginInfo-Name] == '%1'").arg(name);
|
||||
KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("Plasma/ContainmentActions"), constraint);
|
||||
|
||||
if (offers.isEmpty()) {
|
||||
#ifndef NDEBUG
|
||||
@ -508,16 +509,16 @@ Package PluginLoader::loadPackage(const QString &packageFormat, const QString &s
|
||||
return Package(structure);
|
||||
}
|
||||
|
||||
if (packageFormat.startsWith("Plasma")) {
|
||||
if (packageFormat.endsWith("/Applet")) {
|
||||
if (packageFormat.startsWith(QLatin1String("Plasma"))) {
|
||||
if (packageFormat.endsWith(QLatin1String("/Applet"))) {
|
||||
internalStructure = new PlasmoidPackage();
|
||||
} else if (packageFormat.endsWith("/DataEngine")) {
|
||||
} else if (packageFormat.endsWith(QLatin1String("/DataEngine"))) {
|
||||
internalStructure = new DataEnginePackage();
|
||||
} else if (packageFormat.endsWith("/Theme")) {
|
||||
} else if (packageFormat.endsWith(QLatin1String("/Theme"))) {
|
||||
internalStructure = new ThemePackage();
|
||||
} else if (packageFormat.endsWith("/ContainmentActions")) {
|
||||
} else if (packageFormat.endsWith(QLatin1String("/ContainmentActions"))) {
|
||||
internalStructure = new ContainmentActionsPackage();
|
||||
} else if (packageFormat.endsWith("/Generic")) {
|
||||
} else if (packageFormat.endsWith(QLatin1String("/Generic"))) {
|
||||
internalStructure = new GenericPackage();
|
||||
}
|
||||
|
||||
@ -571,7 +572,7 @@ KPluginInfo::List PluginLoader::listAppletInfo(const QString &category, const QS
|
||||
|
||||
auto filter = [&excluded, &parentApp](const KPluginMetaData &md) -> bool
|
||||
{
|
||||
const QString pa = md.value("X-KDE-ParentApp");
|
||||
const QString pa = md.value(QStringLiteral("X-KDE-ParentApp"));
|
||||
return (pa.isEmpty() || pa == parentApp) && !excluded.contains(md.category());
|
||||
};
|
||||
|
||||
@ -592,8 +593,8 @@ KPluginInfo::List PluginLoader::listAppletInfo(const QString &category, const QS
|
||||
|
||||
auto filter = [&category, &parentApp](const KPluginMetaData &md) -> bool
|
||||
{
|
||||
const QString pa = md.value("X-KDE-ParentApp");
|
||||
if (category == "Miscellaneous") {
|
||||
const QString pa = md.value(QStringLiteral("X-KDE-ParentApp"));
|
||||
if (category == QLatin1String("Miscellaneous")) {
|
||||
return (pa.isEmpty() || pa == parentApp) && (md.category() == category || md.category().isEmpty());
|
||||
} else {
|
||||
return (pa.isEmpty() || pa == parentApp) && md.category() == category;
|
||||
@ -619,7 +620,7 @@ KPluginInfo::List PluginLoader::listAppletInfoForMimeType(const QString &mimeTyp
|
||||
{
|
||||
auto filter = [&mimeType](const KPluginMetaData &md) -> bool
|
||||
{
|
||||
return md.value("X-Plasma-DropMimeTypes").contains(mimeType);
|
||||
return md.value(QStringLiteral("X-Plasma-DropMimeTypes")).contains(mimeType);
|
||||
};
|
||||
return KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages("Plasma/Applet", QString(), filter).toVector());
|
||||
}
|
||||
@ -634,8 +635,8 @@ KPluginInfo::List PluginLoader::listAppletInfoForUrl(const QUrl &url)
|
||||
|
||||
auto filter = [&parentApp](const KPluginMetaData &md) -> bool
|
||||
{
|
||||
const QString pa = md.value("X-KDE-ParentApp");
|
||||
return (pa.isEmpty() || pa == parentApp) && !md.value("X-Plasma-DropUrlPatterns").isEmpty();
|
||||
const QString pa = md.value(QStringLiteral("X-KDE-ParentApp"));
|
||||
return (pa.isEmpty() || pa == parentApp) && !md.value(QStringLiteral("X-Plasma-DropUrlPatterns")).isEmpty();
|
||||
};
|
||||
KPluginInfo::List allApplets = KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages("Plasma/Applet", QString(), filter).toVector());
|
||||
|
||||
@ -663,10 +664,12 @@ QStringList PluginLoader::listAppletCategories(const QString &parentApp, bool vi
|
||||
const QStringList excluded = group.readEntry("ExcludeCategories", QStringList());
|
||||
auto filter = [&parentApp, &excluded, visibleOnly](const KPluginMetaData &md) -> bool
|
||||
{
|
||||
const QString pa = md.value("X-KDE-ParentApp");
|
||||
return (pa.isEmpty() || pa == parentApp) && (excluded.isEmpty() || excluded.contains(md.value("X-KDE-PluginInfo-Category"))) && (!visibleOnly || !md.isHidden());
|
||||
const QString pa = md.value(QStringLiteral("X-KDE-ParentApp"));
|
||||
return (pa.isEmpty() || pa == parentApp)
|
||||
&& (excluded.isEmpty() || excluded.contains(md.value(QStringLiteral("X-KDE-PluginInfo-Category"))))
|
||||
&& (!visibleOnly || !md.isHidden());
|
||||
};
|
||||
QList<KPluginMetaData> allApplets = KPackage::PackageLoader::self()->findPackages("Plasma/Applet", QString(), filter);
|
||||
const QList<KPluginMetaData> allApplets = KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter);
|
||||
|
||||
|
||||
QStringList categories;
|
||||
@ -699,7 +702,7 @@ QString PluginLoader::appletCategory(const QString &appletName)
|
||||
return QString();
|
||||
}
|
||||
|
||||
const KPackage::Package p = KPackage::PackageLoader::self()->loadPackage("Plasma/Applet", appletName);
|
||||
const KPackage::Package p = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/Applet"), appletName);
|
||||
if (!p.isValid()) {
|
||||
return QString();
|
||||
}
|
||||
@ -717,53 +720,54 @@ KPluginInfo::List PluginLoader::listContainmentsOfType(const QString &type,
|
||||
const QString &category,
|
||||
const QString &parentApp)
|
||||
{
|
||||
if (!KPackage::PackageLoader::self()->loadPackageStructure("Plasma/Applet")) {
|
||||
KPackage::PackageLoader::self()->addKnownPackageStructure("Plasma/Applet", new PlasmoidPackage());
|
||||
if (!KPackage::PackageLoader::self()->loadPackageStructure(QLatin1String("Plasma/Applet"))) {
|
||||
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Applet"), new PlasmoidPackage());
|
||||
}
|
||||
|
||||
KConfigGroup group(KSharedConfig::openConfig(), "General");
|
||||
const QStringList excluded = group.readEntry("ExcludeCategories", QStringList());
|
||||
auto filter = [&type, &category, &parentApp](const KPluginMetaData &md) -> bool
|
||||
{
|
||||
if (!md.serviceTypes().contains("Plasma/Containment")) {
|
||||
if (!md.serviceTypes().contains(QStringLiteral("Plasma/Containment"))) {
|
||||
return false;
|
||||
}
|
||||
const QString pa = md.value("X-KDE-ParentApp");
|
||||
const QString pa = md.value(QStringLiteral("X-KDE-ParentApp"));
|
||||
if (!pa.isEmpty() && pa != parentApp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!type.isEmpty() && md.value("X-Plasma-ContainmentType") != type) {
|
||||
if (!type.isEmpty() && md.value(QStringLiteral("X-Plasma-ContainmentType")) != type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!category.isEmpty() && md.value("X-KDE-PluginInfo-Category") != category) {
|
||||
if (!category.isEmpty() && md.value(QStringLiteral("X-KDE-PluginInfo-Category")) != category) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
return KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages("Plasma/Applet", QString(), filter).toVector());
|
||||
return KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter).toVector());
|
||||
}
|
||||
|
||||
KPluginInfo::List PluginLoader::listContainmentsForMimeType(const QString &mimeType)
|
||||
{
|
||||
if (!KPackage::PackageLoader::self()->loadPackageStructure("Plasma/Applet")) {
|
||||
KPackage::PackageLoader::self()->addKnownPackageStructure("Plasma/Applet", new DataEnginePackage());
|
||||
if (!KPackage::PackageLoader::self()->loadPackageStructure(QLatin1String("Plasma/Applet"))) {
|
||||
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Applet"), new DataEnginePackage());
|
||||
}
|
||||
auto filter = [&mimeType](const KPluginMetaData &md) -> bool
|
||||
{
|
||||
return md.value("X-KDE-ServiceTypes").contains("Plasma/Containment") && md.value("X-Plasma-DropMimeTypes").contains(mimeType);
|
||||
return md.value(QStringLiteral("X-KDE-ServiceTypes")).contains(QLatin1String("Plasma/Containment"))
|
||||
&& md.value(QStringLiteral("X-Plasma-DropMimeTypes")).contains(mimeType);
|
||||
};
|
||||
|
||||
return KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages("Plasma/Applet", QString(), filter).toVector());
|
||||
return KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter).toVector());
|
||||
}
|
||||
|
||||
QStringList PluginLoader::listContainmentTypes()
|
||||
{
|
||||
if (!KPackage::PackageLoader::self()->loadPackageStructure("Plasma/Applet")) {
|
||||
KPackage::PackageLoader::self()->addKnownPackageStructure("Plasma/Applet", new DataEnginePackage());
|
||||
if (!KPackage::PackageLoader::self()->loadPackageStructure(QLatin1String("Plasma/Applet"))) {
|
||||
KPackage::PackageLoader::self()->addKnownPackageStructure(QLatin1String("Plasma/Applet"), new DataEnginePackage());
|
||||
}
|
||||
KPluginInfo::List containmentInfos = listContainments();
|
||||
QSet<QString> types;
|
||||
@ -788,12 +792,12 @@ KPluginInfo::List PluginLoader::listDataEngineInfo(const QString &parentApp)
|
||||
|
||||
QString constraint;
|
||||
if (parentApp.isEmpty()) {
|
||||
constraint.append("not exist [X-KDE-ParentApp]");
|
||||
constraint = QStringLiteral("not exist [X-KDE-ParentApp]");
|
||||
} else {
|
||||
constraint.append("[X-KDE-ParentApp] == '").append(parentApp).append("'");
|
||||
constraint = QLatin1String("[X-KDE-ParentApp] == '") + parentApp + '\'';
|
||||
}
|
||||
|
||||
list.append(KPluginTrader::self()->query(PluginLoaderPrivate::s_dataEnginePluginDir, "Plasma/DataEngine", constraint));
|
||||
list.append(KPluginTrader::self()->query(PluginLoaderPrivate::s_dataEnginePluginDir, QStringLiteral("Plasma/DataEngine"), constraint));
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -807,12 +811,12 @@ KPluginInfo::List PluginLoader::listContainmentActionsInfo(const QString &parent
|
||||
|
||||
QString constraint;
|
||||
if (parentApp.isEmpty()) {
|
||||
constraint.append("not exist [X-KDE-ParentApp]");
|
||||
constraint = QStringLiteral("not exist [X-KDE-ParentApp]");
|
||||
} else {
|
||||
constraint.append("[X-KDE-ParentApp] == '").append(parentApp).append("'");
|
||||
constraint = QLatin1String("[X-KDE-ParentApp] == '") + parentApp + '\'';
|
||||
}
|
||||
|
||||
list.append(KPluginTrader::self()->query(PluginLoaderPrivate::s_containmentActionsPluginDir, "Plasma/ContainmentActions", constraint));
|
||||
list.append(KPluginTrader::self()->query(PluginLoaderPrivate::s_containmentActionsPluginDir, QStringLiteral("Plasma/ContainmentActions"), constraint));
|
||||
|
||||
QSet<QString> knownPlugins;
|
||||
foreach (const KPluginInfo &p, list) {
|
||||
@ -821,7 +825,7 @@ KPluginInfo::List PluginLoader::listContainmentActionsInfo(const QString &parent
|
||||
|
||||
//FIXME: this is only for backwards compatibility, but probably will have to stay
|
||||
//for the time being
|
||||
KService::List offers = KServiceTypeTrader::self()->query("Plasma/ContainmentActions", constraint);
|
||||
KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("Plasma/ContainmentActions"), constraint);
|
||||
foreach (KService::Ptr s, offers) {
|
||||
if (!knownPlugins.contains(s->pluginKeyword())) {
|
||||
list.append(KPluginInfo(s));
|
||||
@ -891,7 +895,7 @@ KPluginInfo::List PluginLoader::internalContainmentActionsInfo() const
|
||||
static KPluginInfo::List standardInternalInfo(const QString &type, const QString &category = QString())
|
||||
{
|
||||
QStringList files = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
PLASMA_RELATIVE_DATA_INSTALL_DIR "/internal/" + type + "/*.desktop",
|
||||
QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/internal/") + type + QLatin1String("/*.desktop"),
|
||||
QStandardPaths::LocateFile);
|
||||
|
||||
KPluginInfo::List allInfo = KPluginInfo::fromFiles(files);
|
||||
@ -912,17 +916,17 @@ static KPluginInfo::List standardInternalInfo(const QString &type, const QString
|
||||
|
||||
KPluginInfo::List PluginLoader::standardInternalAppletInfo(const QString &category) const
|
||||
{
|
||||
return standardInternalInfo("applets", category);
|
||||
return standardInternalInfo(QStringLiteral("applets"), category);
|
||||
}
|
||||
|
||||
KPluginInfo::List PluginLoader::standardInternalDataEngineInfo() const
|
||||
{
|
||||
return standardInternalInfo("dataengines");
|
||||
return standardInternalInfo(QStringLiteral("dataengines"));
|
||||
}
|
||||
|
||||
KPluginInfo::List PluginLoader::standardInternalServiceInfo() const
|
||||
{
|
||||
return standardInternalInfo("services");
|
||||
return standardInternalInfo(QStringLiteral("services"));
|
||||
}
|
||||
|
||||
} // Plasma Namespace
|
||||
|
@ -80,7 +80,7 @@ AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int
|
||||
} else if (appletId > s_maxAppletId) {
|
||||
s_maxAppletId = appletId;
|
||||
}
|
||||
QObject::connect(actions->action("configure"), SIGNAL(triggered()),
|
||||
QObject::connect(actions->action(QStringLiteral("configure")), SIGNAL(triggered()),
|
||||
q, SLOT(requestConfiguration()));
|
||||
#ifndef NDEBUG
|
||||
new TimeTracker(q);
|
||||
@ -115,7 +115,7 @@ void AppletPrivate::init(const QString &packagePath, const QVariantList &args)
|
||||
// that requires a Corona, which is not available at this point
|
||||
q->setHasConfigurationInterface(true);
|
||||
|
||||
QAction *closeApplet = actions->action("remove");
|
||||
QAction *closeApplet = actions->action(QStringLiteral("remove"));
|
||||
if (closeApplet) {
|
||||
closeApplet->setText(i18nc("%1 is the name of the applet", "Remove this %1", q->title()));
|
||||
}
|
||||
@ -167,7 +167,7 @@ void AppletPrivate::init(const QString &packagePath, const QVariantList &args)
|
||||
//It's valid, let's try to load the icon from within the package
|
||||
if (script) {
|
||||
//use the absolute path of the in-package icon as icon name
|
||||
if (appletDescription.icon().startsWith("/")) {
|
||||
if (appletDescription.icon().startsWith('/')) {
|
||||
icon = package->filePath("", appletDescription.icon().toUtf8());
|
||||
}
|
||||
//package not valid, get rid of it
|
||||
@ -182,12 +182,12 @@ void AppletPrivate::init(const QString &packagePath, const QVariantList &args)
|
||||
|
||||
if (!q->isContainment() && q->pluginInfo().isValid()) {
|
||||
QString constraint;
|
||||
QStringList provides = q->pluginInfo().property("X-Plasma-Provides").value<QStringList>();
|
||||
QStringList provides = q->pluginInfo().property("X-Plasma-Provides").toStringList();
|
||||
if (!provides.isEmpty()) {
|
||||
auto filter = [&provides](const KPluginMetaData &md) -> bool
|
||||
{
|
||||
foreach (const QString &p, provides) {
|
||||
if (md.value("X-Plasma-Provides").contains(p)) {
|
||||
if (md.value(QStringLiteral("X-Plasma-Provides")).contains(p)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -75,29 +75,29 @@ Plasma::ContainmentPrivate::~ContainmentPrivate()
|
||||
|
||||
void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containment *c)
|
||||
{
|
||||
actions->setConfigGroup("Shortcuts-Containment");
|
||||
actions->setConfigGroup(QLatin1String("Shortcuts-Containment"));
|
||||
|
||||
//adjust applet actions
|
||||
QAction *appAction = qobject_cast<QAction *>(actions->action("remove"));
|
||||
appAction->setShortcut(QKeySequence("alt+d, alt+r"));
|
||||
QAction *appAction = qobject_cast<QAction *>(actions->action(QStringLiteral("remove")));
|
||||
appAction->setShortcut(QKeySequence(Qt::ALT+Qt::Key_D, Qt::ALT+Qt::Key_R));
|
||||
if (c && c->d->isPanelContainment()) {
|
||||
appAction->setText(i18n("Remove this Panel"));
|
||||
} else {
|
||||
appAction->setText(i18n("Remove this Activity"));
|
||||
}
|
||||
|
||||
appAction = qobject_cast<QAction *>(actions->action("configure"));
|
||||
appAction = qobject_cast<QAction *>(actions->action(QStringLiteral("configure")));
|
||||
if (appAction) {
|
||||
appAction->setShortcut(QKeySequence("alt+d, alt+s"));
|
||||
appAction->setShortcut(QKeySequence(Qt::ALT+Qt::Key_D, Qt::ALT+Qt::Key_S));
|
||||
appAction->setText(i18n("Activity Settings"));
|
||||
}
|
||||
|
||||
//add our own actions
|
||||
QAction *appletBrowserAction = actions->add<QAction>("add widgets");
|
||||
QAction *appletBrowserAction = actions->add<QAction>(QLatin1String("add widgets"));
|
||||
appletBrowserAction->setAutoRepeat(false);
|
||||
appletBrowserAction->setText(i18n("Add Widgets..."));
|
||||
appletBrowserAction->setIcon(QIcon::fromTheme("list-add"));
|
||||
appletBrowserAction->setShortcut(QKeySequence("alt+d, a"));
|
||||
appletBrowserAction->setIcon(QIcon::fromTheme(QLatin1String("list-add")));
|
||||
appletBrowserAction->setShortcut(QKeySequence(Qt::ALT+Qt::Key_D, Qt::Key_A));
|
||||
appletBrowserAction->setData(Plasma::Types::AddAction);
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ ThemePrivate::ThemePrivate(QObject *parent)
|
||||
}
|
||||
QCoreApplication::instance()->installEventFilter(this);
|
||||
|
||||
const QString configFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + themeRcFile;
|
||||
const QString configFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + QLatin1String(themeRcFile);
|
||||
KDirWatch::self()->addFile(configFile);
|
||||
|
||||
// Catch both, direct changes to the config file ...
|
||||
@ -145,7 +145,7 @@ KConfigGroup &ThemePrivate::config()
|
||||
#ifndef NDEBUG
|
||||
// qDebug() << "using theme for app" << app;
|
||||
#endif
|
||||
groupName.append("-").append(app);
|
||||
groupName.append('-').append(app);
|
||||
}
|
||||
}
|
||||
cfg = KConfigGroup(KSharedConfig::openConfig(themeRcFile), groupName);
|
||||
@ -163,8 +163,8 @@ bool ThemePrivate::useCache()
|
||||
ThemeConfig config;
|
||||
cacheSize = config.themeCacheKb();
|
||||
}
|
||||
const bool isRegularTheme = themeName != systemColorsTheme;
|
||||
QString cacheFile = QStringLiteral("plasma_theme_") + themeName;
|
||||
const bool isRegularTheme = themeName != QLatin1String(systemColorsTheme);
|
||||
QString cacheFile = QLatin1String("plasma_theme_") + themeName;
|
||||
|
||||
// clear any cached values from the previous theme cache
|
||||
themeVersion.clear();
|
||||
@ -176,7 +176,7 @@ bool ThemePrivate::useCache()
|
||||
themeMetadataPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % themeName % QLatin1Literal("/metadata.desktop"));
|
||||
|
||||
Q_ASSERT(!themeMetadataPath.isEmpty() || themeName.isEmpty());
|
||||
const QString cacheFileBase = cacheFile + QStringLiteral("*.kcache");
|
||||
const QString cacheFileBase = cacheFile + QLatin1String("*.kcache");
|
||||
|
||||
QString currentCacheFileName;
|
||||
if (!themeMetadataPath.isEmpty()) {
|
||||
@ -184,8 +184,8 @@ bool ThemePrivate::useCache()
|
||||
const KPluginInfo pluginInfo(themeMetadataPath);
|
||||
themeVersion = pluginInfo.version();
|
||||
if (!themeVersion.isEmpty()) {
|
||||
cacheFile += "_v" + themeVersion;
|
||||
currentCacheFileName = cacheFile + QStringLiteral(".kcache");
|
||||
cacheFile += QLatin1String("_v") + themeVersion;
|
||||
currentCacheFileName = cacheFile + QLatin1String(".kcache");
|
||||
}
|
||||
|
||||
// watch the metadata file for changes at runtime
|
||||
@ -218,7 +218,7 @@ bool ThemePrivate::useCache()
|
||||
// the cache should be dropped; we need a way to detect system color change when the
|
||||
// application is not running.
|
||||
// check for expired cache
|
||||
const QString cacheFilePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + '/' + cacheFile + ".kcache";
|
||||
const QString cacheFilePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + '/' + cacheFile + QLatin1String(".kcache");
|
||||
if (!cacheFilePath.isEmpty()) {
|
||||
const QFileInfo cacheFileInfo(cacheFilePath);
|
||||
const QFileInfo metadataFileInfo(themeMetadataPath);
|
||||
@ -235,10 +235,10 @@ bool ThemePrivate::useCache()
|
||||
}
|
||||
|
||||
if (cacheTheme && !svgElementsCache) {
|
||||
const QString svgElementsFileNameBase = QStringLiteral("plasma-svgelements-") + themeName;
|
||||
const QString svgElementsFileNameBase = QLatin1String("plasma-svgelements-") + themeName;
|
||||
QString svgElementsFileName = svgElementsFileNameBase;
|
||||
if (!themeVersion.isEmpty()) {
|
||||
svgElementsFileName += "_v" + themeVersion;
|
||||
svgElementsFileName += QLatin1String("_v") + themeVersion;
|
||||
}
|
||||
|
||||
// now we check for (and remove) old caches
|
||||
@ -434,7 +434,7 @@ const QString ThemePrivate::processStyleSheet(const QString &css)
|
||||
QFont font = QGuiApplication::font();
|
||||
elements[QStringLiteral("%fontsize")] = QStringLiteral("%1pt").arg(font.pointSize());
|
||||
elements[QStringLiteral("%fontfamily")] = font.family().split('[').first();
|
||||
elements[QStringLiteral("%smallfontsize")] = QString("%1pt").arg(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont).pointSize());
|
||||
elements[QStringLiteral("%smallfontsize")] = QStringLiteral("%1pt").arg(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont).pointSize());
|
||||
|
||||
QHash<QString, QString>::const_iterator it = elements.constBegin();
|
||||
QHash<QString, QString>::const_iterator itEnd = elements.constEnd();
|
||||
@ -507,7 +507,7 @@ void ThemePrivate::settingsFileChanged(const QString &file)
|
||||
if (themeVersion != pluginInfo.version()) {
|
||||
scheduleThemeChangeNotification(SvgElementsCache);
|
||||
}
|
||||
} else if (file.endsWith(themeRcFile)) {
|
||||
} else if (file.endsWith(QLatin1String(themeRcFile))) {
|
||||
config().config()->reparseConfiguration();
|
||||
settingsChanged(true);
|
||||
}
|
||||
@ -696,7 +696,7 @@ void ThemePrivate::processContrastSettings(KConfigBase *metadata)
|
||||
KConfigGroup cg;
|
||||
if (metadata->hasGroup("ContrastEffect")) {
|
||||
cg = KConfigGroup(metadata, "ContrastEffect");
|
||||
backgroundContrastEnabled = cg.readEntry(QStringLiteral("enabled"), false);
|
||||
backgroundContrastEnabled = cg.readEntry("enabled", false);
|
||||
|
||||
//if (backgroundContrastEnabled) {
|
||||
// Make up sensible default values, based on the background color
|
||||
@ -711,9 +711,9 @@ void ThemePrivate::processContrastSettings(KConfigBase *metadata)
|
||||
_intensity = 0.45;
|
||||
_saturation = 1.7;
|
||||
}
|
||||
backgroundContrast = cg.readEntry(QStringLiteral("contrast"), _contrast);
|
||||
backgroundIntensity = cg.readEntry(QStringLiteral("intensity"), _intensity);
|
||||
backgroundSaturation = cg.readEntry(QStringLiteral("saturation"), _saturation);
|
||||
backgroundContrast = cg.readEntry("contrast", _contrast);
|
||||
backgroundIntensity = cg.readEntry("intensity", _intensity);
|
||||
backgroundSaturation = cg.readEntry("saturation", _saturation);
|
||||
//}
|
||||
} else {
|
||||
backgroundContrastEnabled = false;
|
||||
@ -726,7 +726,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
|
||||
if (theme.isEmpty() || theme == themeName) {
|
||||
// let's try and get the default theme at least
|
||||
if (themeName.isEmpty()) {
|
||||
theme = ThemePrivate::defaultTheme;
|
||||
theme = QLatin1String(ThemePrivate::defaultTheme);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@ -734,19 +734,19 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
|
||||
|
||||
// we have one special theme: essentially a dummy theme used to cache things with
|
||||
// the system colors.
|
||||
bool realTheme = theme != systemColorsTheme;
|
||||
bool realTheme = theme != QLatin1String(systemColorsTheme);
|
||||
if (realTheme) {
|
||||
QString themePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % "/metadata.desktop");
|
||||
QString themePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1String("/metadata.desktop"));
|
||||
|
||||
if (themePath.isEmpty() && themeName.isEmpty()) {
|
||||
// note: can't use QStringLiteral("foo" "bar") on Windows
|
||||
themePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/default"), QStandardPaths::LocateDirectory);
|
||||
themePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/default"), QStandardPaths::LocateDirectory);
|
||||
|
||||
if (themePath.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
theme = ThemePrivate::defaultTheme;
|
||||
theme = QLatin1String(ThemePrivate::defaultTheme);
|
||||
}
|
||||
}
|
||||
|
||||
@ -798,8 +798,8 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
|
||||
fallback = cg.readEntry("FallbackTheme", QString());
|
||||
}
|
||||
|
||||
if (!fallbackThemes.contains(ThemePrivate::defaultTheme)) {
|
||||
fallbackThemes.append(ThemePrivate::defaultTheme);
|
||||
if (!fallbackThemes.contains(QLatin1String(ThemePrivate::defaultTheme))) {
|
||||
fallbackThemes.append(QLatin1String(ThemePrivate::defaultTheme));
|
||||
}
|
||||
|
||||
foreach (const QString &theme, fallbackThemes) {
|
||||
|
@ -61,15 +61,13 @@ QString ScriptEngine::mainScript() const
|
||||
QStringList knownLanguages(Types::ComponentTypes types)
|
||||
{
|
||||
QStringList languages;
|
||||
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins("plasma/scriptengines");
|
||||
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("plasma/scriptengines"));
|
||||
|
||||
for (auto plugin : plugins) {
|
||||
if ((types & Types::AppletComponent) &&
|
||||
plugin.value("X-Plasma-ComponentTypes") == "Applet") {
|
||||
languages << plugin.value("X-Plasma-API");
|
||||
} else if ((types & Types::DataEngineComponent) &&
|
||||
plugin.value("X-Plasma-ComponentTypes") == "DataEngine") {
|
||||
languages << plugin.value("X-Plasma-API");
|
||||
const QString componentTypes = plugin.value(QStringLiteral("X-Plasma-ComponentTypes"));
|
||||
if (((types & Types::AppletComponent) && componentTypes == QLatin1String("Applet"))
|
||||
||((types & Types::DataEngineComponent) && componentTypes == QLatin1String("DataEngine"))) {
|
||||
languages << plugin.value(QStringLiteral("X-Plasma-API"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,16 +81,14 @@ ScriptEngine *loadEngine(const QString &language, Types::ComponentType type, QOb
|
||||
|
||||
auto filter = [&language](const KPluginMetaData &md) -> bool
|
||||
{
|
||||
return md.value("X-Plasma-API") == language;
|
||||
return md.value(QStringLiteral("X-Plasma-API")) == language;
|
||||
};
|
||||
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins("plasma/scriptengines", filter);
|
||||
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("plasma/scriptengines"), filter);
|
||||
|
||||
if (plugins.count()) {
|
||||
if ((type & Types::AppletComponent) &&
|
||||
plugins.first().value("X-Plasma-ComponentTypes") != "Applet") {
|
||||
return 0;
|
||||
} else if ((type & Types::DataEngineComponent) &&
|
||||
plugins.first().value("X-Plasma-ComponentTypes") != "DataEngine") {
|
||||
const QString componentTypes = plugins.first().value(QStringLiteral("X-Plasma-ComponentTypes"));
|
||||
if (((type & Types::AppletComponent) && componentTypes != QLatin1String("Applet"))
|
||||
|| ((type & Types::DataEngineComponent) && componentTypes != QLatin1String("DataEngine"))) {
|
||||
return 0;
|
||||
}
|
||||
KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins);
|
||||
|
@ -86,18 +86,19 @@ bool SharedSvgRenderer::load(
|
||||
return false;
|
||||
}
|
||||
|
||||
QDomNode defs = svg.elementsByTagName("defs").item(0);
|
||||
QDomNode defs = svg.elementsByTagName(QStringLiteral("defs")).item(0);
|
||||
|
||||
for (QDomElement style = defs.firstChildElement("style"); !style.isNull();
|
||||
style = style.nextSiblingElement("style")) {
|
||||
if (style.attribute("id") == "current-color-scheme") {
|
||||
QDomElement colorScheme = svg.createElement("style");
|
||||
colorScheme.setAttribute("type", "text/css");
|
||||
colorScheme.setAttribute("id", "current-color-scheme");
|
||||
const QString STYLE = QStringLiteral("style");
|
||||
for (QDomElement style = defs.firstChildElement(STYLE); !style.isNull();
|
||||
style = style.nextSiblingElement(STYLE)) {
|
||||
if (style.attribute(QStringLiteral("id")) == QLatin1String("current-color-scheme")) {
|
||||
QDomElement colorScheme = svg.createElement(STYLE);
|
||||
colorScheme.setAttribute(QLatin1String("type"), QLatin1String("text/css"));
|
||||
colorScheme.setAttribute(QLatin1String("id"), QLatin1String("current-color-scheme"));
|
||||
defs.replaceChild(colorScheme, style);
|
||||
colorScheme.appendChild(svg.createCDATASection(styleSheet));
|
||||
|
||||
interestingElements.insert("current-color-scheme", QRect(0, 0, 1, 1));
|
||||
interestingElements.insert(QLatin1String("current-color-scheme"), QRect(0, 0, 1, 1));
|
||||
|
||||
break;
|
||||
}
|
||||
@ -111,7 +112,7 @@ bool SharedSvgRenderer::load(
|
||||
|
||||
// Search the SVG to find and store all ids that contain size hints.
|
||||
const QString contentsAsString(QString::fromLatin1(contents));
|
||||
QRegExp idExpr("id\\s*=\\s*(['\"])(\\d+-\\d+-.*)\\1");
|
||||
QRegExp idExpr(QLatin1String("id\\s*=\\s*(['\"])(\\d+-\\d+-.*)\\1"));
|
||||
idExpr.setMinimal(true);
|
||||
|
||||
int pos = 0;
|
||||
@ -131,7 +132,7 @@ bool SharedSvgRenderer::load(
|
||||
|
||||
#define QLSEP QLatin1Char('_')
|
||||
#define CACHE_ID_WITH_SIZE(size, id, devicePixelRatio) QString::number(int(size.width())) % QLSEP % QString::number(int(size.height())) % QLSEP % id % QLSEP % QLSEP % QString::number(int(devicePixelRatio))
|
||||
#define CACHE_ID_NATURAL_SIZE(id, devicePixelRatio) QLatin1Literal("Natural") % QLSEP % id % QLSEP % QLSEP % QString::number(int(devicePixelRatio))
|
||||
#define CACHE_ID_NATURAL_SIZE(id, devicePixelRatio) QLatin1String("Natural") % QLSEP % id % QLSEP % QLSEP % QString::number(int(devicePixelRatio))
|
||||
|
||||
SvgPrivate::SvgPrivate(Svg *svg)
|
||||
: q(svg),
|
||||
@ -176,7 +177,7 @@ QString SvgPrivate::cachePath(const QString &path, const QSize &size)
|
||||
bool SvgPrivate::setImagePath(const QString &imagePath)
|
||||
{
|
||||
QString actualPath = imagePath;
|
||||
if (imagePath.startsWith("file://")) {
|
||||
if (imagePath.startsWith(QLatin1String("file://"))) {
|
||||
//length of file://
|
||||
actualPath = actualPath.mid(7);
|
||||
}
|
||||
@ -236,13 +237,13 @@ bool SvgPrivate::setImagePath(const QString &imagePath)
|
||||
if ((themed && QFile::exists(path)) || QFile::exists(actualPath)) {
|
||||
QRectF rect;
|
||||
|
||||
if (cacheAndColorsTheme()->findInRectsCache(path, QString("_Natural_%1").arg(scaleFactor), rect)) {
|
||||
if (cacheAndColorsTheme()->findInRectsCache(path, QStringLiteral("_Natural_%1").arg(scaleFactor), rect)) {
|
||||
naturalSize = rect.size();
|
||||
} else {
|
||||
createRenderer();
|
||||
naturalSize = renderer->defaultSize() * scaleFactor;
|
||||
//qDebug() << "natural size for" << path << "from renderer is" << naturalSize;
|
||||
cacheAndColorsTheme()->insertIntoRectsCache(path, QString("_Natural_%1").arg(scaleFactor), QRectF(QPointF(0, 0), naturalSize));
|
||||
cacheAndColorsTheme()->insertIntoRectsCache(path, QStringLiteral("_Natural_%1").arg(scaleFactor), QRectF(QPointF(0, 0), naturalSize));
|
||||
//qDebug() << "natural size for" << path << "from cache is" << naturalSize;
|
||||
}
|
||||
}
|
||||
@ -276,7 +277,7 @@ Theme *SvgPrivate::cacheAndColorsTheme()
|
||||
// use a separate cache source for unthemed svg's
|
||||
if (!s_systemColorsCache) {
|
||||
//FIXME: reference count this, so that it is deleted when no longer in use
|
||||
s_systemColorsCache = new Plasma::Theme("internal-system-colors");
|
||||
s_systemColorsCache = new Plasma::Theme(QLatin1String("internal-system-colors"));
|
||||
}
|
||||
|
||||
return s_systemColorsCache.data();
|
||||
@ -319,7 +320,7 @@ QPixmap SvgPrivate::findInCache(const QString &elementId, qreal ratio, const QSi
|
||||
if (!elementSizeHints.isEmpty()) {
|
||||
QSize bestFit(-1, -1);
|
||||
|
||||
Q_FOREACH (const QSize &hint, elementSizeHints) {
|
||||
Q_FOREACH (QSize hint, elementSizeHints) {
|
||||
|
||||
if (hint.width() >= s.width() * ratio && hint.height() >= s.height() * ratio &&
|
||||
(!bestFit.isValid() ||
|
||||
@ -329,8 +330,8 @@ QPixmap SvgPrivate::findInCache(const QString &elementId, qreal ratio, const QSi
|
||||
}
|
||||
|
||||
if (bestFit.isValid()) {
|
||||
actualElementId = QString::number(bestFit.width()) % "-" %
|
||||
QString::number(bestFit.height()) % "-" % elementId;
|
||||
actualElementId = QString::number(bestFit.width()) % '-' %
|
||||
QString::number(bestFit.height()) % '-' % elementId;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -417,10 +418,10 @@ void SvgPrivate::createRenderer()
|
||||
//for.
|
||||
if (applet && applet->kPackage().isValid()) {
|
||||
const KPackage::Package package = applet->kPackage();
|
||||
path = package.filePath("images", themePath + ".svg");
|
||||
path = package.filePath("images", themePath + QLatin1String(".svg"));
|
||||
|
||||
if (path.isEmpty()) {
|
||||
path = package.filePath("images", themePath + ".svgz");
|
||||
path = package.filePath("images", themePath + QLatin1String(".svgz"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -565,10 +566,10 @@ QMatrix SvgPrivate::matrixForElement(const QString &elementId)
|
||||
|
||||
void SvgPrivate::checkColorHints()
|
||||
{
|
||||
if (elementRect("hint-apply-color-scheme").isValid()) {
|
||||
if (elementRect(QStringLiteral("hint-apply-color-scheme")).isValid()) {
|
||||
applyColors = true;
|
||||
usesColors = true;
|
||||
} else if (elementRect("current-color-scheme").isValid()) {
|
||||
} else if (elementRect(QStringLiteral("current-color-scheme")).isValid()) {
|
||||
applyColors = false;
|
||||
usesColors = true;
|
||||
} else {
|
||||
@ -887,7 +888,7 @@ bool Svg::isValid() const
|
||||
|
||||
//try very hard to avoid creation of a parser
|
||||
QRectF rect;
|
||||
if (d->cacheAndColorsTheme()->findInRectsCache(d->path, QString("_Natural_%1").arg(d->scaleFactor), rect)) {
|
||||
if (d->cacheAndColorsTheme()->findInRectsCache(d->path, QStringLiteral("_Natural_%1").arg(d->scaleFactor), rect)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ QString Theme::themeName() const
|
||||
QString Theme::imagePath(const QString &name) const
|
||||
{
|
||||
// look for a compressed svg file in the theme
|
||||
if (name.contains("../") || name.isEmpty()) {
|
||||
if (name.contains(QLatin1String("../")) || name.isEmpty()) {
|
||||
// we don't support relative paths
|
||||
//qDebug() << "Theme says: bad image path " << name;
|
||||
return QString();
|
||||
@ -190,7 +190,7 @@ QString Theme::imagePath(const QString &name) const
|
||||
|
||||
QString Theme::backgroundPath(const QString& image) const
|
||||
{
|
||||
return d->imagePath(themeName(), QLatin1Literal("/appbackgrounds/"), image);
|
||||
return d->imagePath(themeName(), QStringLiteral("/appbackgrounds/"), image);
|
||||
}
|
||||
|
||||
QString Theme::styleSheet(const QString &css) const
|
||||
@ -257,7 +257,7 @@ QString Theme::wallpaperPathForSize(int width, int height) const
|
||||
|
||||
bool Theme::currentThemeHasImage(const QString &name) const
|
||||
{
|
||||
if (name.contains("../")) {
|
||||
if (name.contains(QLatin1String("../"))) {
|
||||
// we don't support relative paths
|
||||
return false;
|
||||
}
|
||||
@ -385,7 +385,7 @@ QStringList Theme::listCachedRectKeys(const QString &image) const
|
||||
QMutableListIterator<QString> i(keys);
|
||||
while (i.hasNext()) {
|
||||
QString key = i.next();
|
||||
if (key.endsWith("Size")) {
|
||||
if (key.endsWith(QLatin1String("Size"))) {
|
||||
// The actual cache id used from outside doesn't end on "Size".
|
||||
key.resize(key.size() - 4);
|
||||
i.setValue(key);
|
||||
|
@ -194,7 +194,7 @@ QQuickItem *AppletQuickItemPrivate::createCompactRepresentationItem()
|
||||
}
|
||||
|
||||
QVariantHash initialProperties;
|
||||
initialProperties["parent"] = QVariant::fromValue(q);
|
||||
initialProperties[QStringLiteral("parent")] = QVariant::fromValue(q);
|
||||
|
||||
compactRepresentationItem = qobject_cast<QQuickItem*>(qmlObject->createObjectFromComponent(compactRepresentation, QtQml::qmlContext(qmlObject->rootObject()), initialProperties));
|
||||
|
||||
@ -211,7 +211,7 @@ QQuickItem *AppletQuickItemPrivate::createFullRepresentationItem()
|
||||
|
||||
if (fullRepresentation && fullRepresentation != qmlObject->mainComponent()) {
|
||||
QVariantHash initialProperties;
|
||||
initialProperties["parent"] = QVariant::fromValue(q);
|
||||
initialProperties[QStringLiteral("parent")] = QVariant::fromValue(q);
|
||||
fullRepresentationItem = qobject_cast<QQuickItem*>(qmlObject->createObjectFromComponent(fullRepresentation, QtQml::qmlContext(qmlObject->rootObject()), initialProperties));
|
||||
} else {
|
||||
fullRepresentation = qmlObject->mainComponent();
|
||||
@ -301,8 +301,8 @@ void AppletQuickItemPrivate::compactRepresentationCheck()
|
||||
item->setParentItem(q);
|
||||
{
|
||||
//set anchors
|
||||
QQmlExpression expr(QtQml::qmlContext(qmlObject->rootObject()), item, "parent");
|
||||
QQmlProperty prop(item, "anchors.fill");
|
||||
QQmlExpression expr(QtQml::qmlContext(qmlObject->rootObject()), item, QStringLiteral("parent"));
|
||||
QQmlProperty prop(item, QStringLiteral("anchors.fill"));
|
||||
prop.write(expr.evaluate());
|
||||
}
|
||||
|
||||
@ -328,8 +328,8 @@ void AppletQuickItemPrivate::compactRepresentationCheck()
|
||||
compactExpanderItem->setVisible(true);
|
||||
{
|
||||
//set anchors
|
||||
QQmlExpression expr(QtQml::qmlContext(qmlObject->rootObject()), compactExpanderItem, "parent");
|
||||
QQmlProperty prop(compactExpanderItem, "anchors.fill");
|
||||
QQmlExpression expr(QtQml::qmlContext(qmlObject->rootObject()), compactExpanderItem, QStringLiteral("parent"));
|
||||
QQmlProperty prop(compactExpanderItem, QStringLiteral("anchors.fill"));
|
||||
prop.write(expr.evaluate());
|
||||
}
|
||||
|
||||
@ -410,11 +410,11 @@ AppletQuickItem::AppletQuickItem(Plasma::Applet *applet, QQuickItem *parent)
|
||||
this, SLOT(compactRepresentationCheck()));
|
||||
|
||||
if (applet->pluginInfo().isValid()) {
|
||||
const QString rootPath = applet->pluginInfo().property("X-Plasma-RootPath").toString();
|
||||
const QString rootPath = applet->pluginInfo().property(QStringLiteral("X-Plasma-RootPath")).toString();
|
||||
if (!rootPath.isEmpty()) {
|
||||
d->qmlObject->setTranslationDomain("plasma_applet_" + rootPath);
|
||||
d->qmlObject->setTranslationDomain(QLatin1String("plasma_applet_") + rootPath);
|
||||
} else {
|
||||
d->qmlObject->setTranslationDomain("plasma_applet_" + applet->pluginInfo().pluginName());
|
||||
d->qmlObject->setTranslationDomain(QLatin1String("plasma_applet_") + applet->pluginInfo().pluginName());
|
||||
}
|
||||
}
|
||||
d->qmlObject->setInitializationDelayed(true);
|
||||
@ -494,14 +494,14 @@ void AppletQuickItem::init()
|
||||
//this way is possible to mix QtQuickControls and plasma components in applets
|
||||
//while still having the desktop style in configuration dialogs
|
||||
QQmlComponent c(engine);
|
||||
c.setData("import QtQuick 2.1\n\
|
||||
c.setData(QByteArrayLiteral("import QtQuick 2.1\n\
|
||||
import QtQuick.Controls 1.0\n\
|
||||
import QtQuick.Controls.Private 1.0\n \
|
||||
Item {\
|
||||
Component.onCompleted: {\
|
||||
Settings.styleName = \"Plasma\";\
|
||||
}\
|
||||
}", QUrl());
|
||||
}"), QUrl());
|
||||
QObject *o = c.create();
|
||||
o->deleteLater();
|
||||
|
||||
@ -531,14 +531,14 @@ void AppletQuickItem::init()
|
||||
d->applet->setLaunchErrorMessage(reason);
|
||||
}
|
||||
|
||||
d->qmlObject->rootContext()->setContextProperty("plasmoid", this);
|
||||
d->qmlObject->rootContext()->setContextProperty(QStringLiteral("plasmoid"), this);
|
||||
|
||||
//initialize size, so an useless resize less
|
||||
QVariantHash initialProperties;
|
||||
//initialize with our size only if valid
|
||||
if (width() > 0 && height() > 0) {
|
||||
initialProperties["width"] = width();
|
||||
initialProperties["height"] = height();
|
||||
initialProperties[QStringLiteral("width")] = width();
|
||||
initialProperties[QStringLiteral("height")] = height();
|
||||
}
|
||||
d->qmlObject->setInitializationDelayed(false);
|
||||
d->qmlObject->completeInitialization(initialProperties);
|
||||
|
@ -50,19 +50,19 @@ Plasma::Package ShellPluginLoader::internalLoadPackage(const QString &packageFor
|
||||
{
|
||||
Q_UNUSED(specialization)
|
||||
|
||||
if (packageFormat == "Plasma/LookAndFeel") {
|
||||
if (packageFormat == QLatin1String("Plasma/LookAndFeel")) {
|
||||
if (!m_lnfPackage) {
|
||||
m_lnfPackage = new LookAndFeelPackage();
|
||||
}
|
||||
|
||||
return Plasma::Package(m_lnfPackage);
|
||||
} else if (packageFormat == "Plasma/Wallpaper") {
|
||||
} else if (packageFormat == QLatin1String("Plasma/Wallpaper")) {
|
||||
if (!m_qmlPackage) {
|
||||
m_qmlPackage = new QmlWallpaperPackage();
|
||||
}
|
||||
|
||||
return Plasma::Package(m_qmlPackage);
|
||||
} else if (packageFormat == "Plasma/LayoutTemplate") {
|
||||
} else if (packageFormat == QLatin1String("Plasma/LayoutTemplate")) {
|
||||
if (!m_layoutPackage) {
|
||||
m_layoutPackage = new LayoutTemplatePackage();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user