generic: get rid of the QStringBuilder requirement

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-10-29 05:06:31 +00:00
parent fdc5c56557
commit 1e3b872a26
7 changed files with 137 additions and 145 deletions

View file

@ -36,7 +36,6 @@
#include <QtCore/QBuffer>
#include <QtCore/QDataStream>
#include <QtCore/QByteArray>
#include <QtCore/QStringBuilder> // % operator for QString
#include <QtGui/QIcon>
#include <QtGui/QImage>
#include <QtGui/QMovie>
@ -747,18 +746,17 @@ void KIconLoaderPrivate::normalizeIconMetadata(KIconLoader::Group &group, int &s
QString KIconLoaderPrivate::makeCacheKey(const QString &name, KIconLoader::Group group,
const QStringList &overlays, int size, int state) const
{
// The icon cache is shared so add some namespacing. The following code
// uses QStringBuilder (new in Qt 4.6)
// The icon cache is shared so add some namespacing.
return (group == KIconLoader::User
? QLatin1Literal("$kicou_")
: QLatin1Literal("$kico_"))
% name
% QLatin1Char('_')
% QString::number(size)
% QLatin1Char('_')
% overlays.join("_")
% ( group >= 0 ? mpEffect.fingerprint(group, state)
+ name
+ QLatin1Char('_')
+ QString::number(size)
+ QLatin1Char('_')
+ overlays.join("_")
+ ( group >= 0 ? mpEffect.fingerprint(group, state)
: *NULL_EFFECT_FINGERPRINT);
}

View file

@ -29,7 +29,6 @@
#include <kstandarddirs.h>
#include <QtCore/qhash.h>
#include <QtCore/QStringBuilder>
#include <QtNetwork/QHostInfo>
#include <QtNetwork/QHostAddress>
@ -376,7 +375,7 @@ QString KUriFilterData::queryForPreferredSearchProvider(const QString& provider)
{
const KUriFilterSearchProvider* searchProvider = d->searchProviderMap.value(provider);
if (searchProvider)
return (searchProvider->defaultKey() % searchTermSeparator() % searchTerm());
return (searchProvider->defaultKey() + searchTermSeparator() + searchTerm());
return QString();
}

View file

@ -27,7 +27,6 @@
#include <QPainter>
#include <QRegion>
#include <QSize>
#include <QStringBuilder>
#include <QTimer>
#include <kdebug.h>
@ -208,7 +207,7 @@ void FrameSvg::setElementPrefix(const QString &prefix)
{
const QString oldPrefix(d->prefix);
if (!hasElement(prefix % "-center")) {
if (!hasElement(prefix + "-center")) {
d->prefix.clear();
} else {
d->prefix = prefix;
@ -280,7 +279,7 @@ bool FrameSvg::hasElementPrefix(const QString & prefix) const
if (prefix.isEmpty()) {
return hasElement("center");
} else {
return hasElement(prefix % "-center");
return hasElement(prefix + "-center");
}
}
@ -599,7 +598,7 @@ QPixmap FrameSvgPrivate::alphaMask()
FrameData *frame = frames[prefix];
QString maskPrefix;
if (q->hasElement("mask-" % prefix % "center")) {
if (q->hasElement("mask-" + prefix + "center")) {
maskPrefix = "mask-";
}
@ -617,7 +616,7 @@ QPixmap FrameSvgPrivate::alphaMask()
// We are setting the prefix only temporary to generate
// the needed mask image
prefix = maskPrefix % oldPrefix;
prefix = maskPrefix + oldPrefix;
if (!frames.contains(prefix)) {
const QString key = cacheId(frame, prefix);
@ -671,13 +670,13 @@ void FrameSvgPrivate::generateBackground(FrameData *frame)
Theme *theme = Theme::defaultTheme();
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 + "overlay");
QPixmap overlay;
if (q->isUsingRenderingCache()) {
frameCached = theme->findInCache(id, frame->cachedBackground) && !frame->cachedBackground.isNull();
if (overlayAvailable) {
overlayCached = theme->findInCache("overlay_" % id, overlay) && !overlay.isNull();
overlayCached = theme->findInCache("overlay_" + id, overlay) && !overlay.isNull();
}
}
@ -689,23 +688,23 @@ void FrameSvgPrivate::generateBackground(FrameData *frame)
QSize overlaySize;
QPoint actualOverlayPos = QPoint(0, 0);
if (overlayAvailable && !overlayCached) {
overlaySize = q->elementSize(prefix % "overlay");
overlaySize = q->elementSize(prefix + "overlay");
//Random pos, stretched and tiled are mutually exclusive
if (q->hasElement(prefix % "hint-overlay-random-pos")) {
if (q->hasElement(prefix + "hint-overlay-random-pos")) {
actualOverlayPos = overlayPos;
} else if (q->hasElement(prefix % "hint-overlay-pos-right")) {
} else if (q->hasElement(prefix + "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 + "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 + "hint-overlay-stretch")) {
overlaySize = frameSize(frame).toSize();
} else {
if (q->hasElement(prefix % "hint-overlay-tile-horizontal")) {
if (q->hasElement(prefix + "hint-overlay-tile-horizontal")) {
overlaySize.setWidth(frameSize(frame).width());
}
if (q->hasElement(prefix % "hint-overlay-tile-vertical")) {
if (q->hasElement(prefix + "hint-overlay-tile-vertical")) {
overlaySize.setHeight(frameSize(frame).height());
}
}
@ -714,16 +713,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 + "hint-overlay-tile-horizontal") ||
q->hasElement(prefix + "hint-overlay-tile-vertical")) {
QSize s = q->size();
q->resize(q->elementSize(prefix % "overlay"));
q->resize(q->elementSize(prefix + "overlay"));
overlayPainter.drawTiledPixmap(QRect(QPoint(0,0), overlaySize), q->pixmap(prefix % "overlay"));
overlayPainter.drawTiledPixmap(QRect(QPoint(0,0), overlaySize), q->pixmap(prefix + "overlay"));
q->resize(s);
} else {
q->paint(&overlayPainter, QRect(actualOverlayPos, overlaySize), prefix % "overlay");
q->paint(&overlayPainter, QRect(actualOverlayPos, overlaySize), prefix + "overlay");
}
overlayPainter.end();
@ -744,8 +743,8 @@ void FrameSvgPrivate::generateFrameBackground(FrameData *frame)
{
//kDebug() << "generating background";
const QSizeF size = frameSize(frame);
const int topWidth = q->elementSize(prefix % "top").width();
const int leftHeight = q->elementSize(prefix % "left").height();
const int topWidth = q->elementSize(prefix + "top").width();
const int leftHeight = q->elementSize(prefix + "left").height();
const int topOffset = 0;
const int leftOffset = 0;
@ -776,15 +775,15 @@ void FrameSvgPrivate::generateFrameBackground(FrameData *frame)
//CENTER
if (frame->tileCenter) {
if (contentHeight > 0 && contentWidth > 0) {
const int centerTileHeight = q->elementSize(prefix % "center").height();
const int centerTileWidth = q->elementSize(prefix % "center").width();
const int centerTileHeight = q->elementSize(prefix + "center").height();
const int centerTileWidth = q->elementSize(prefix + "center").width();
QPixmap center(centerTileWidth, centerTileHeight);
center.fill(Qt::transparent);
{
QPainter centerPainter(&center);
centerPainter.setCompositionMode(QPainter::CompositionMode_Source);
q->paint(&centerPainter, QRect(QPoint(0, 0), q->elementSize(prefix % "center")), prefix % "center");
q->paint(&centerPainter, QRect(QPoint(0, 0), q->elementSize(prefix + "center")), prefix + "center");
}
if (frame->composeOverBorder) {
@ -798,11 +797,11 @@ void FrameSvgPrivate::generateFrameBackground(FrameData *frame)
if (contentHeight > 0 && contentWidth > 0) {
if (frame->composeOverBorder) {
q->paint(&p, QRect(QPoint(0, 0), size.toSize()),
prefix % "center");
prefix + "center");
} else {
q->paint(&p, QRect(frame->leftWidth, frame->topHeight,
contentWidth, contentHeight),
prefix % "center");
prefix + "center");
}
}
}
@ -813,110 +812,110 @@ void FrameSvgPrivate::generateFrameBackground(FrameData *frame)
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
}
if (frame->enabledBorders & FrameSvg::LeftBorder && q->hasElement(prefix % "left")) {
if (frame->enabledBorders & FrameSvg::LeftBorder && q->hasElement(prefix + "left")) {
rightOffset += frame->leftWidth;
}
// Corners
if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(prefix % "top")) {
if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(prefix + "top")) {
contentTop = frame->topHeight;
bottomOffset += frame->topHeight;
if (q->hasElement(prefix % "topleft") && frame->enabledBorders & FrameSvg::LeftBorder) {
q->paint(&p, QRect(leftOffset, topOffset, frame->leftWidth, frame->topHeight), prefix % "topleft");
if (q->hasElement(prefix + "topleft") && frame->enabledBorders & FrameSvg::LeftBorder) {
q->paint(&p, QRect(leftOffset, topOffset, frame->leftWidth, frame->topHeight), prefix + "topleft");
contentLeft = frame->leftWidth;
}
if (q->hasElement(prefix % "topright") && frame->enabledBorders & FrameSvg::RightBorder) {
q->paint(&p, QRect(rightOffset, topOffset, frame->rightWidth, frame->topHeight), prefix % "topright");
if (q->hasElement(prefix + "topright") && frame->enabledBorders & FrameSvg::RightBorder) {
q->paint(&p, QRect(rightOffset, topOffset, frame->rightWidth, frame->topHeight), prefix + "topright");
}
}
if (frame->enabledBorders & FrameSvg::BottomBorder && q->hasElement(prefix % "bottom")) {
if (q->hasElement(prefix % "bottomleft") && frame->enabledBorders & FrameSvg::LeftBorder) {
q->paint(&p, QRect(leftOffset, bottomOffset, frame->leftWidth, frame->bottomHeight), prefix % "bottomleft");
if (frame->enabledBorders & FrameSvg::BottomBorder && q->hasElement(prefix + "bottom")) {
if (q->hasElement(prefix + "bottomleft") && frame->enabledBorders & FrameSvg::LeftBorder) {
q->paint(&p, QRect(leftOffset, bottomOffset, frame->leftWidth, frame->bottomHeight), prefix + "bottomleft");
contentLeft = frame->leftWidth;
}
if (frame->enabledBorders & FrameSvg::RightBorder && q->hasElement(prefix % "bottomright")) {
q->paint(&p, QRect(rightOffset, bottomOffset, frame->rightWidth, frame->bottomHeight), prefix % "bottomright");
if (frame->enabledBorders & FrameSvg::RightBorder && q->hasElement(prefix + "bottomright")) {
q->paint(&p, QRect(rightOffset, bottomOffset, frame->rightWidth, frame->bottomHeight), prefix + "bottomright");
}
}
// Sides
if (frame->stretchBorders) {
if (frame->enabledBorders & FrameSvg::LeftBorder || frame->enabledBorders & FrameSvg::RightBorder) {
if (q->hasElement(prefix % "left") &&
if (q->hasElement(prefix + "left") &&
frame->enabledBorders & FrameSvg::LeftBorder &&
contentHeight > 0) {
q->paint(&p, QRect(leftOffset, contentTop, frame->leftWidth, contentHeight), prefix % "left");
q->paint(&p, QRect(leftOffset, contentTop, frame->leftWidth, contentHeight), prefix + "left");
}
if (q->hasElement(prefix % "right") &&
if (q->hasElement(prefix + "right") &&
frame->enabledBorders & FrameSvg::RightBorder &&
contentHeight > 0) {
q->paint(&p, QRect(rightOffset, contentTop, frame->rightWidth, contentHeight), prefix % "right");
q->paint(&p, QRect(rightOffset, contentTop, frame->rightWidth, contentHeight), prefix + "right");
}
}
if (frame->enabledBorders & FrameSvg::TopBorder || frame->enabledBorders & FrameSvg::BottomBorder) {
if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(prefix % "top") &&
if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(prefix + "top") &&
contentWidth > 0) {
q->paint(&p, QRect(contentLeft, topOffset, contentWidth, frame->topHeight), prefix % "top");
q->paint(&p, QRect(contentLeft, topOffset, contentWidth, frame->topHeight), prefix + "top");
}
if (frame->enabledBorders & FrameSvg::BottomBorder && q->hasElement(prefix % "bottom") &&
if (frame->enabledBorders & FrameSvg::BottomBorder && q->hasElement(prefix + "bottom") &&
contentWidth > 0) {
q->paint(&p, QRect(contentLeft, bottomOffset, contentWidth, frame->bottomHeight), prefix % "bottom");
q->paint(&p, QRect(contentLeft, bottomOffset, contentWidth, frame->bottomHeight), prefix + "bottom");
}
}
} else {
if (frame->enabledBorders & FrameSvg::LeftBorder && q->hasElement(prefix % "left")
if (frame->enabledBorders & FrameSvg::LeftBorder && q->hasElement(prefix + "left")
&& leftHeight > 0 && frame->leftWidth > 0) {
QPixmap left(frame->leftWidth, leftHeight);
left.fill(Qt::transparent);
QPainter sidePainter(&left);
sidePainter.setCompositionMode(QPainter::CompositionMode_Source);
q->paint(&sidePainter, QRect(QPoint(0, 0), left.size()), prefix % "left");
q->paint(&sidePainter, QRect(QPoint(0, 0), left.size()), prefix + "left");
p.drawTiledPixmap(QRect(leftOffset, contentTop, frame->leftWidth, contentHeight), left);
}
if (frame->enabledBorders & FrameSvg::RightBorder && q->hasElement(prefix % "right") &&
if (frame->enabledBorders & FrameSvg::RightBorder && q->hasElement(prefix + "right") &&
leftHeight > 0 && frame->rightWidth > 0) {
QPixmap right(frame->rightWidth, leftHeight);
right.fill(Qt::transparent);
QPainter sidePainter(&right);
sidePainter.setCompositionMode(QPainter::CompositionMode_Source);
q->paint(&sidePainter, QRect(QPoint(0, 0), right.size()), prefix % "right");
q->paint(&sidePainter, QRect(QPoint(0, 0), right.size()), prefix + "right");
p.drawTiledPixmap(QRect(rightOffset, contentTop, frame->rightWidth, contentHeight), right);
}
if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(prefix % "top")
if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(prefix + "top")
&& topWidth > 0 && frame->topHeight > 0) {
QPixmap top(topWidth, frame->topHeight);
top.fill(Qt::transparent);
QPainter sidePainter(&top);
sidePainter.setCompositionMode(QPainter::CompositionMode_Source);
q->paint(&sidePainter, QRect(QPoint(0, 0), top.size()), prefix % "top");
q->paint(&sidePainter, QRect(QPoint(0, 0), top.size()), prefix + "top");
p.drawTiledPixmap(QRect(contentLeft, topOffset, contentWidth, frame->topHeight), top);
}
if (frame->enabledBorders & FrameSvg::BottomBorder && q->hasElement(prefix % "bottom")
if (frame->enabledBorders & FrameSvg::BottomBorder && q->hasElement(prefix + "bottom")
&& topWidth > 0 && frame->bottomHeight > 0) {
QPixmap bottom(topWidth, frame->bottomHeight);
bottom.fill(Qt::transparent);
QPainter sidePainter(&bottom);
sidePainter.setCompositionMode(QPainter::CompositionMode_Source);
q->paint(&sidePainter, QRect(QPoint(0, 0), bottom.size()), prefix % "bottom");
q->paint(&sidePainter, QRect(QPoint(0, 0), bottom.size()), prefix + "bottom");
p.drawTiledPixmap(QRect(contentLeft, bottomOffset, contentWidth, frame->bottomHeight), bottom);
}
@ -928,7 +927,7 @@ QString FrameSvgPrivate::cacheId(FrameData *frame, const QString &prefixToSave)
{
const QSize size = frameSize(frame).toSize();
const QLatin1Char s('_');
return QString::number(frame->enabledBorders) % s % QString::number(size.width()) % s % QString::number(size.height()) % s % prefixToSave % s % q->imagePath();
return QString::number(frame->enabledBorders) + s + QString::number(size.width()) + s + QString::number(size.height()) + s + prefixToSave + s + q->imagePath();
}
void FrameSvgPrivate::cacheFrame(const QString &prefixToSave, const QPixmap &background, const QPixmap &overlay)
@ -948,11 +947,11 @@ void FrameSvgPrivate::cacheFrame(const QString &prefixToSave, const QPixmap &bac
//kDebug()<<"Saving to cache frame"<<id;
Theme::defaultTheme()->insertIntoCache(id, background, QString::number((qint64)q, 16) % prefixToSave);
Theme::defaultTheme()->insertIntoCache(id, background, QString::number((qint64)q, 16) + prefixToSave);
if (!overlay.isNull()) {
//insert overlay
Theme::defaultTheme()->insertIntoCache("overlay_" % id, overlay, QString::number((qint64)q, 16) % prefixToSave % "overlay");
Theme::defaultTheme()->insertIntoCache("overlay_" + id, overlay, QString::number((qint64)q, 16) + prefixToSave + "overlay");
}
}
@ -967,10 +966,10 @@ void FrameSvgPrivate::updateSizes() const
frame->cachedBackground = QPixmap();
if (frame->enabledBorders & FrameSvg::TopBorder) {
frame->topHeight = q->elementSize(prefix % "top").height();
frame->topHeight = q->elementSize(prefix + "top").height();
if (q->hasElement(prefix % "hint-top-margin")) {
frame->topMargin = q->elementSize(prefix % "hint-top-margin").height();
if (q->hasElement(prefix + "hint-top-margin")) {
frame->topMargin = q->elementSize(prefix + "hint-top-margin").height();
} else {
frame->topMargin = frame->topHeight;
}
@ -979,10 +978,10 @@ void FrameSvgPrivate::updateSizes() const
}
if (frame->enabledBorders & FrameSvg::LeftBorder) {
frame->leftWidth = q->elementSize(prefix % "left").width();
frame->leftWidth = q->elementSize(prefix + "left").width();
if (q->hasElement(prefix % "hint-left-margin")) {
frame->leftMargin = q->elementSize(prefix % "hint-left-margin").width();
if (q->hasElement(prefix + "hint-left-margin")) {
frame->leftMargin = q->elementSize(prefix + "hint-left-margin").width();
} else {
frame->leftMargin = frame->leftWidth;
}
@ -991,10 +990,10 @@ void FrameSvgPrivate::updateSizes() const
}
if (frame->enabledBorders & FrameSvg::RightBorder) {
frame->rightWidth = q->elementSize(prefix % "right").width();
frame->rightWidth = q->elementSize(prefix + "right").width();
if (q->hasElement(prefix % "hint-right-margin")) {
frame->rightMargin = q->elementSize(prefix % "hint-right-margin").width();
if (q->hasElement(prefix + "hint-right-margin")) {
frame->rightMargin = q->elementSize(prefix + "hint-right-margin").width();
} else {
frame->rightMargin = frame->rightWidth;
}
@ -1003,10 +1002,10 @@ void FrameSvgPrivate::updateSizes() const
}
if (frame->enabledBorders & FrameSvg::BottomBorder) {
frame->bottomHeight = q->elementSize(prefix % "bottom").height();
frame->bottomHeight = q->elementSize(prefix + "bottom").height();
if (q->hasElement(prefix % "hint-bottom-margin")) {
frame->bottomMargin = q->elementSize(prefix % "hint-bottom-margin").height();
if (q->hasElement(prefix + "hint-bottom-margin")) {
frame->bottomMargin = q->elementSize(prefix + "hint-bottom-margin").height();
} else {
frame->bottomMargin = frame->bottomHeight;
}
@ -1014,14 +1013,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 + "hint-compose-over-border") &&
q->hasElement("mask-" + prefix + "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("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"));
q->resize(s);
}

View file

@ -21,7 +21,6 @@
#include <QtGui/qgraphicssceneevent.h>
#include <QPainter>
#include <QStringBuilder>
#include <QtGui/qstyleoption.h>
#include <plasma/theme.h>
@ -107,9 +106,9 @@ void FocusIndicator::setCustomPrefix(const QString &prefix)
m_prefix.prepend(m_customPrefix);
}
m_testPrefix = m_customPrefix % "hover";
m_testPrefix = m_customPrefix + "hover";
if (m_prefix.isEmpty()) {
m_prefix = m_customPrefix % "shadow";
m_prefix = m_customPrefix + "shadow";
}
if (m_prefix == was) {
@ -136,17 +135,17 @@ bool FocusIndicator::eventFilter(QObject *watched, QEvent *event)
switch (event->type()) {
case QEvent::GraphicsSceneHoverEnter:
if (!m_parent->hasFocus()) {
m_prefix = m_customPrefix % "hover";
m_prefix = m_customPrefix + "hover";
syncGeometry();
m_hoverAnimation->stop();
if (m_background->hasElementPrefix(m_testPrefix)) {
m_background->setElementPrefix(m_customPrefix % "shadow");
m_background->setElementPrefix(m_customPrefix + "shadow");
m_hoverAnimation->setProperty("startPixmap", m_background->framePixmap());
m_background->setElementPrefix(m_customPrefix % "hover");
m_background->setElementPrefix(m_customPrefix + "hover");
m_hoverAnimation->setProperty("targetPixmap", m_background->framePixmap());
} else if (m_background->hasElement(m_testPrefix)) {
m_hoverAnimation->setProperty("startPixmap", m_background->pixmap(m_customPrefix % "shadow"));
m_hoverAnimation->setProperty("targetPixmap", m_background->pixmap(m_customPrefix % "hover"));
m_hoverAnimation->setProperty("startPixmap", m_background->pixmap(m_customPrefix + "shadow"));
m_hoverAnimation->setProperty("targetPixmap", m_background->pixmap(m_customPrefix + "hover"));
}
m_hoverAnimation->start();
@ -155,18 +154,18 @@ bool FocusIndicator::eventFilter(QObject *watched, QEvent *event)
case QEvent::GraphicsSceneHoverLeave:
if (!m_parent->hasFocus()) {
m_prefix = m_customPrefix % "shadow";
m_prefix = m_customPrefix + "shadow";
syncGeometry();
m_hoverAnimation->stop();
if (m_background->hasElementPrefix(m_testPrefix)) {
m_background->setElementPrefix(m_customPrefix % "hover");
m_background->setElementPrefix(m_customPrefix + "hover");
m_hoverAnimation->setProperty("startPixmap", m_background->framePixmap());
m_background->setElementPrefix(m_customPrefix % "shadow");
m_background->setElementPrefix(m_customPrefix + "shadow");
m_hoverAnimation->setProperty("targetPixmap", m_background->framePixmap());
} else if (m_background->hasElement(m_testPrefix)) {
m_hoverAnimation->setProperty("startPixmap", m_background->pixmap(m_customPrefix % "hover"));
m_hoverAnimation->setProperty("targetPixmap", m_background->pixmap(m_customPrefix % "shadow"));
m_hoverAnimation->setProperty("startPixmap", m_background->pixmap(m_customPrefix + "hover"));
m_hoverAnimation->setProperty("targetPixmap", m_background->pixmap(m_customPrefix + "shadow"));
}
m_hoverAnimation->start();
}
@ -177,18 +176,18 @@ bool FocusIndicator::eventFilter(QObject *watched, QEvent *event)
break;
case QEvent::FocusIn:
m_prefix = m_customPrefix % "focus";
m_prefix = m_customPrefix + "focus";
syncGeometry();
m_hoverAnimation->stop();
if (m_background->hasElementPrefix(m_customPrefix % "focus")) {
//m_background->setElementPrefix(m_customPrefix % "shadow");
if (m_background->hasElementPrefix(m_customPrefix + "focus")) {
//m_background->setElementPrefix(m_customPrefix + "shadow");
m_hoverAnimation->setProperty("startPixmap", m_background->framePixmap());
m_background->setElementPrefix(m_customPrefix % "focus");
m_background->setElementPrefix(m_customPrefix + "focus");
m_hoverAnimation->setProperty("targetPixmap", m_background->framePixmap());
} else if (m_background->hasElement(m_customPrefix % "focus")) {
//m_hoverAnimation->setProperty("startPixmap", m_background->pixmap(m_customPrefix % "shadow"));
m_hoverAnimation->setProperty("targetPixmap", m_background->pixmap(m_customPrefix % "focus"));
} else if (m_background->hasElement(m_customPrefix + "focus")) {
//m_hoverAnimation->setProperty("startPixmap", m_background->pixmap(m_customPrefix + "shadow"));
m_hoverAnimation->setProperty("targetPixmap", m_background->pixmap(m_customPrefix + "focus"));
}
m_hoverAnimation->start();
@ -196,18 +195,18 @@ bool FocusIndicator::eventFilter(QObject *watched, QEvent *event)
case QEvent::FocusOut:
if (!m_isUnderMouse) {
m_prefix = m_customPrefix % "shadow";
m_prefix = m_customPrefix + "shadow";
syncGeometry();
m_hoverAnimation->stop();
if (m_background->hasElementPrefix(m_customPrefix % "focus")) {
if (m_background->hasElementPrefix(m_customPrefix + "focus")) {
m_background->setElementPrefix("focus");
m_hoverAnimation->setProperty("startPixmap", m_background->framePixmap());
m_background->setElementPrefix("shadow");
m_hoverAnimation->setProperty("targetPixmap", m_background->framePixmap());
} else if (m_background->hasElement(m_customPrefix % "focus")) {
m_hoverAnimation->setProperty("startPixmap", m_background->pixmap(m_customPrefix % "focus"));
m_hoverAnimation->setProperty("targetPixmap", m_background->pixmap(m_customPrefix % "shadow"));
} else if (m_background->hasElement(m_customPrefix + "focus")) {
m_hoverAnimation->setProperty("startPixmap", m_background->pixmap(m_customPrefix + "focus"));
m_hoverAnimation->setProperty("targetPixmap", m_background->pixmap(m_customPrefix + "shadow"));
}
m_hoverAnimation->start();
@ -223,18 +222,18 @@ bool FocusIndicator::eventFilter(QObject *watched, QEvent *event)
void FocusIndicator::resizeEvent(QGraphicsSceneResizeEvent *)
{
if (m_background->hasElementPrefix(m_customPrefix % "shadow")) {
m_background->setElementPrefix(m_customPrefix % "shadow");
if (m_background->hasElementPrefix(m_customPrefix + "shadow")) {
m_background->setElementPrefix(m_customPrefix + "shadow");
m_background->resizeFrame(size());
}
if (m_background->hasElementPrefix(m_customPrefix % "hover")) {
m_background->setElementPrefix(m_customPrefix % "hover");
if (m_background->hasElementPrefix(m_customPrefix + "hover")) {
m_background->setElementPrefix(m_customPrefix + "hover");
m_background->resizeFrame(size());
}
if (m_background->hasElementPrefix(m_customPrefix % "focus")) {
m_background->setElementPrefix(m_customPrefix % "focus");
if (m_background->hasElementPrefix(m_customPrefix + "focus")) {
m_background->setElementPrefix(m_customPrefix + "focus");
m_background->resizeFrame(size());
}

View file

@ -22,7 +22,6 @@
#define PLASMA_FRAMESVG_P_H
#include <QHash>
#include <QStringBuilder>
#include <kdebug.h>

View file

@ -27,7 +27,6 @@
#include <QtXml/qdom.h>
#include <QMatrix>
#include <QPainter>
#include <QStringBuilder>
#include <kcolorscheme.h>
#include <kconfiggroup.h>
@ -131,8 +130,8 @@ bool SharedSvgRenderer::load(
}
#define QLSEP QLatin1Char('_')
#define CACHE_ID_WITH_SIZE(size, id) QString::number(int(size.width())) % QLSEP % QString::number(int(size.height())) % QLSEP % id
#define CACHE_ID_NATURAL_SIZE(id) QLatin1Literal("Natural") % QLSEP % id
#define CACHE_ID_WITH_SIZE(size, id) QString::number(int(size.width())) + QLSEP + QString::number(int(size.height())) + QLSEP + id
#define CACHE_ID_NATURAL_SIZE(id) QLatin1Literal("Natural") + QLSEP + id
SvgPrivate::SvgPrivate(Svg *svg)
: q(svg),
@ -300,8 +299,8 @@ QPixmap SvgPrivate::findInCache(const QString &elementId, const QSizeF &s)
}
if (bestFit.isValid()) {
actualElementId = QString::number(bestFit.width()) % "-" %
QString::number(bestFit.height()) % "-" % elementId;
actualElementId = QString::number(bestFit.width()) + "-" +
QString::number(bestFit.height()) + "-" + elementId;
}
}
}
@ -366,7 +365,7 @@ QPixmap SvgPrivate::findInCache(const QString &elementId, const QSizeF &s)
}
if (cacheRendering) {
cacheAndColorsTheme()->insertIntoCache(id, p, QString::number((qint64)q, 16) % QLSEP % actualElementId);
cacheAndColorsTheme()->insertIntoCache(id, p, QString::number((qint64)q, 16) + QLSEP + actualElementId);
}
return p;

View file

@ -22,9 +22,8 @@
#include <QApplication>
#include <QFile>
#include <QFileInfo>
#include <QtCore/qlist.h>
#include <QList>
#include <QPair>
#include <QStringBuilder>
#include <QTimer>
#include <QCache>
#include <QBuffer>
@ -268,19 +267,19 @@ QString ThemePrivate::findInTheme(const QString &image, const QString &theme, bo
QString search;
if (locolor) {
search = QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/locolor/") % image;
search = QLatin1Literal("desktoptheme/") + theme + QLatin1Literal("/locolor/") + image;
search = KStandardDirs::locate("data", search);
} else if (!compositingActive) {
search = QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/opaque/") % image;
search = QLatin1Literal("desktoptheme/") + theme + QLatin1Literal("/opaque/") + image;
search = KStandardDirs::locate("data", search);
} else if (WindowEffects::isEffectAvailable(WindowEffects::BlurBehind)) {
search = QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/translucent/") % image;
search = QLatin1Literal("desktoptheme/") + theme + QLatin1Literal("/translucent/") + image;
search = KStandardDirs::locate("data", search);
}
//not found or compositing enabled
if (search.isEmpty()) {
search = QLatin1Literal("desktoptheme/") % theme % QLatin1Char('/') % image;
search = QLatin1Literal("desktoptheme/") + theme + QLatin1Char('/') + image;
search = KStandardDirs::locate("data", search);
}
@ -575,7 +574,7 @@ void ThemePrivate::processWallpaperSettings(KConfigBase *metadata)
void ThemePrivate::processAnimationSettings(const QString &theme, KConfigBase *metadata)
{
KConfigGroup cg(metadata, "Animations");
const QString animDir = QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/animations/");
const QString animDir = QLatin1Literal("desktoptheme/") + theme + QLatin1Literal("/animations/");
foreach (const QString &path, cg.keyList()) {
const QStringList anims = cg.readEntry(path, QStringList());
foreach (const QString &anim, anims) {
@ -585,7 +584,7 @@ void ThemePrivate::processAnimationSettings(const QString &theme, KConfigBase *m
<< "\tpath: " << path << "\t*******\n\n\n";
//key: desktoptheme/default/animations/+ all.js
//value: ZoomAnimation
animationMapping.insert(anim, animDir % path);
animationMapping.insert(anim, animDir + path);
} else {
kDebug() << "************Animation already registered!\n\n\n";
}
@ -611,7 +610,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
// the system colors.
bool realTheme = theme != systemColorsTheme;
if (realTheme) {
QString themePath = KStandardDirs::locate("data", QLatin1Literal("desktoptheme/") % theme % QLatin1Char('/'));
QString themePath = KStandardDirs::locate("data", QLatin1Literal("desktoptheme/") + theme + QLatin1Char('/'));
if (themePath.isEmpty() && themeName.isEmpty()) {
themePath = KStandardDirs::locate("data", "desktoptheme/default/");
@ -631,14 +630,14 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
themeName = theme;
// load the color scheme config
const QString colorsFile = realTheme ? KStandardDirs::locate("data", QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/colors"))
const QString colorsFile = realTheme ? KStandardDirs::locate("data", QLatin1Literal("desktoptheme/") + theme + QLatin1Literal("/colors"))
: QString();
//kDebug() << "we're going for..." << colorsFile << "*******************";
// load the wallpaper settings, if any
if (realTheme) {
const QString metadataPath(KStandardDirs::locate("data", QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/metadata.desktop")));
const QString metadataPath(KStandardDirs::locate("data", QLatin1Literal("desktoptheme/") + theme + QLatin1Literal("/metadata.desktop")));
KConfig metadata(metadataPath);
processWallpaperSettings(&metadata);
@ -655,7 +654,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
while (!fallback.isEmpty() && !fallbackThemes.contains(fallback)) {
fallbackThemes.append(fallback);
QString metadataPath(KStandardDirs::locate("data", QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/metadata.desktop")));
QString metadataPath(KStandardDirs::locate("data", QLatin1Literal("desktoptheme/") + theme + QLatin1Literal("/metadata.desktop")));
KConfig metadata(metadataPath);
KConfigGroup cg(&metadata, "Settings");
fallback = cg.readEntry("FallbackTheme", QString());
@ -670,7 +669,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
}
foreach (const QString &theme, fallbackThemes) {
QString metadataPath(KStandardDirs::locate("data", QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/metadata.desktop")));
QString metadataPath(KStandardDirs::locate("data", QLatin1Literal("desktoptheme/") + theme + QLatin1Literal("/metadata.desktop")));
KConfig metadata(metadataPath);
processAnimationSettings(theme, &metadata);
processWallpaperSettings(&metadata);
@ -690,7 +689,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window, colors);
buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, colors);
viewColorScheme = KColorScheme(QPalette::Active, KColorScheme::View, colors);
hasWallpapers = KGlobal::dirs()->exists(KStandardDirs::locateLocal("data", QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/wallpapers/")));
hasWallpapers = KGlobal::dirs()->exists(KStandardDirs::locateLocal("data", QLatin1Literal("desktoptheme/") + theme + QLatin1Literal("/wallpapers/")));
if (realTheme && isDefault && writeSettings) {
// we're the default theme, let's save our state
@ -720,12 +719,12 @@ QString Theme::imagePath(const QString &name) const
return QString();
}
const QString svgzName = name % QLatin1Literal(".svgz");
const QString svgzName = name + QLatin1Literal(".svgz");
QString path = d->findInTheme(svgzName, d->themeName);
if (path.isEmpty()) {
// try for an uncompressed svg file
const QString svgName = name % QLatin1Literal(".svg");
const QString svgName = name + QLatin1Literal(".svg");
path = d->findInTheme(svgName, d->themeName);
// search in fallback themes if necessary
@ -792,10 +791,10 @@ QString Theme::wallpaperPath(const QSize &size) const
// to override the theme?
if (d->hasWallpapers) {
// check in the theme first
fullPath = d->findInTheme(QLatin1Literal("wallpapers/") % image, d->themeName);
fullPath = d->findInTheme(QLatin1Literal("wallpapers/") + image, d->themeName);
if (fullPath.isEmpty()) {
fullPath = d->findInTheme(QLatin1Literal("wallpapers/") % defaultImage, d->themeName);
fullPath = d->findInTheme(QLatin1Literal("wallpapers/") + defaultImage, d->themeName);
}
}
@ -826,8 +825,8 @@ bool Theme::currentThemeHasImage(const QString &name) const
return false;
}
return !(d->findInTheme(name % QLatin1Literal(".svgz"), d->themeName, false).isEmpty()) ||
!(d->findInTheme(name % QLatin1Literal(".svg"), d->themeName, false).isEmpty());
return !(d->findInTheme(name + QLatin1Literal(".svgz"), d->themeName, false).isEmpty()) ||
!(d->findInTheme(name + QLatin1Literal(".svg"), d->themeName, false).isEmpty());
}
KSharedConfigPtr Theme::colorScheme() const
@ -993,7 +992,7 @@ bool Theme::findInRectsCache(const QString &image, const QString &element, QRect
}
KConfigGroup imageGroup(d->svgElementsCache, image);
rect = imageGroup.readEntry(element % QLatin1Literal("Size"), QRectF());
rect = imageGroup.readEntry(element + QLatin1Literal("Size"), QRectF());
if (rect.isValid()) {
return true;
@ -1050,7 +1049,7 @@ void Theme::insertIntoRectsCache(const QString& image, const QString &element, c
if (rect.isValid()) {
KConfigGroup imageGroup(d->svgElementsCache, image);
imageGroup.writeEntry(element % QLatin1Literal("Size"), rect);
imageGroup.writeEntry(element + QLatin1Literal("Size"), rect);
} else {
QHash<QString, QSet<QString> >::iterator it = d->invalidElements.find(image);
if (it == d->invalidElements.end()) {
@ -1100,7 +1099,7 @@ void Theme::setCacheLimit(int kbytes)
KUrl Theme::homepage() const
{
const QString metadataPath(KStandardDirs::locate("data", QLatin1Literal("desktoptheme/") % d->themeName % QLatin1Literal("/metadata.desktop")));
const QString metadataPath(KStandardDirs::locate("data", QLatin1Literal("desktoptheme/") + d->themeName + QLatin1Literal("/metadata.desktop")));
KConfig metadata(metadataPath);
KConfigGroup brandConfig(&metadata, "Branding");
return brandConfig.readEntry("homepage", KUrl("http://www.kde.org"));