Fix no cast to/from ASCII intrduced issues

* "" needs to be wrapped in QStringLiteral
* QString::fromUtf8 needed for const char* and QByteArray
* QByteArray::constData() needed to get to the const char*
This commit is contained in:
Martin Gräßlin 2013-07-23 07:02:52 +02:00
parent d45d900dc5
commit 330d40f425
102 changed files with 1106 additions and 1079 deletions

View file

@ -122,7 +122,7 @@ inline
QString Activities::nullUuid()
{
// cloned from kactivities/src/lib/core/consumer.cpp
return QString("00000000-0000-0000-0000-000000000000");
return QStringLiteral("00000000-0000-0000-0000-000000000000");
}
}

View file

@ -1361,18 +1361,18 @@ void Client::killProcess(bool ask, xcb_timestamp_t timestamp)
if (!ask) {
if (!clientMachine()->isLocal()) {
QStringList lst;
lst << clientMachine()->hostName() << "kill" << QString::number(pid);
QProcess::startDetached("xon", lst);
lst << QString::fromUtf8(clientMachine()->hostName()) << QStringLiteral("kill") << QString::number(pid);
QProcess::startDetached(QStringLiteral("xon"), lst);
} else
::kill(pid, SIGTERM);
} else {
QString hostname = clientMachine()->isLocal() ? "localhost" : clientMachine()->hostName();
QProcess::startDetached(KStandardDirs::findExe("kwin_killer_helper"),
QStringList() << "--pid" << QByteArray().setNum(unsigned(pid)) << "--hostname" << hostname
<< "--windowname" << caption()
<< "--applicationname" << resourceClass()
<< "--wid" << QString::number(window())
<< "--timestamp" << QString::number(timestamp),
QString hostname = clientMachine()->isLocal() ? QStringLiteral("localhost") : QString::fromUtf8(clientMachine()->hostName());
QProcess::startDetached(KStandardDirs::findExe(QStringLiteral("kwin_killer_helper")),
QStringList() << QStringLiteral("--pid") << QString::number(unsigned(pid)) << QStringLiteral("--hostname") << hostname
<< QStringLiteral("--windowname") << caption()
<< QStringLiteral("--applicationname") << QString::fromUtf8(resourceClass())
<< QStringLiteral("--wid") << QString::number(window())
<< QStringLiteral("--timestamp") << QString::number(timestamp),
QString(), &m_killHelperPID);
}
}
@ -1501,9 +1501,9 @@ void Client::setOnActivity(const QString &activity, bool enable)
void Client::setOnActivities(QStringList newActivitiesList)
{
#ifdef KWIN_BUILD_ACTIVITIES
QString joinedActivitiesList = newActivitiesList.join(",");
QString joinedActivitiesList = newActivitiesList.join(QStringLiteral(","));
joinedActivitiesList = rules()->checkActivity(joinedActivitiesList, false);
newActivitiesList = joinedActivitiesList.split(',', QString::SkipEmptyParts);
newActivitiesList = joinedActivitiesList.split(QStringLiteral(","), QString::SkipEmptyParts);
QStringList allActivities = Activities::self()->all();
if ( newActivitiesList.isEmpty() ||
@ -1739,7 +1739,7 @@ void Client::setCaption(const QString& _s, bool force)
QString s(_s);
for (int i = 0; i < s.length(); ++i)
if (!s[i].isPrint())
s[i] = QChar(' ');
s[i] = QChar(u' ');
cap_normal = s;
#ifdef KWIN_BUILD_SCRIPTING
if (options->condensedTitle()) {
@ -1747,21 +1747,21 @@ void Client::setCaption(const QString& _s, bool force)
static QScriptProgram stripTitle;
static QScriptValue script;
if (stripTitle.isNull()) {
const QString scriptFile = KStandardDirs::locate("data", QLatin1String(KWIN_NAME) + "/stripTitle.js");
const QString scriptFile = KStandardDirs::locate("data", QStringLiteral(KWIN_NAME) + QStringLiteral("/stripTitle.js"));
if (!scriptFile.isEmpty()) {
QFile f(scriptFile);
if (f.open(QIODevice::ReadOnly|QIODevice::Text)) {
f.reset();
stripTitle = QScriptProgram(QString::fromLocal8Bit(f.readAll()), "stripTitle.js");
stripTitle = QScriptProgram(QString::fromLocal8Bit(f.readAll()), QStringLiteral("stripTitle.js"));
f.close();
}
}
if (stripTitle.isNull())
stripTitle = QScriptProgram("(function(title, wm_name, wm_class){ return title ; })", "stripTitle.js");
stripTitle = QScriptProgram(QStringLiteral("(function(title, wm_name, wm_class){ return title ; })"), QStringLiteral("stripTitle.js"));
script = engine.evaluate(stripTitle);
}
QScriptValueList args;
args << _s << QString(resourceName()) << QString(resourceClass());
args << _s << QString::fromUtf8(resourceName()) << QString::fromUtf8(resourceClass());
s = script.call(QScriptValue(), args).toString();
}
#endif
@ -1775,17 +1775,17 @@ void Client::setCaption(const QString& _s, bool force)
QString machine_suffix;
if (!options->condensedTitle()) { // machine doesn't qualify for "clean"
if (clientMachine()->hostName() != ClientMachine::localhost() && !clientMachine()->isLocal())
machine_suffix = QString(" <@") + clientMachine()->hostName() + '>' + LRM;
machine_suffix = QStringLiteral(" <@") + QString::fromUtf8(clientMachine()->hostName()) + QStringLiteral(">") + LRM;
}
QString shortcut_suffix = !shortcut().isEmpty() ? (" {" + shortcut().toString() + '}') : QString();
QString shortcut_suffix = !shortcut().isEmpty() ? (QStringLiteral(" {") + shortcut().toString() + QStringLiteral("}")) : QString();
cap_suffix = machine_suffix + shortcut_suffix;
if ((!isSpecialWindow() || isToolbar()) && workspace()->findClient(FetchNameInternalPredicate(this))) {
int i = 2;
do {
cap_suffix = machine_suffix + " <" + QString::number(i) + '>' + LRM;
cap_suffix = machine_suffix + QStringLiteral(" <") + QString::number(i) + QStringLiteral(">") + LRM;
i++;
} while (workspace()->findClient(FetchNameInternalPredicate(this)));
info->setVisibleName(caption().toUtf8());
info->setVisibleName(caption().toUtf8().constData());
reset_name = false;
}
if ((was_suffix && cap_suffix.isEmpty()) || reset_name) {
@ -1794,7 +1794,7 @@ void Client::setCaption(const QString& _s, bool force)
info->setVisibleIconName("");
} else if (!cap_suffix.isEmpty() && !cap_iconic.isEmpty())
// Keep the same suffix in iconic name if it's set
info->setVisibleIconName(QString(cap_iconic + cap_suffix).toUtf8());
info->setVisibleIconName(QString(cap_iconic + cap_suffix).toUtf8().constData());
emit captionChanged();
}
@ -1816,7 +1816,7 @@ void Client::fetchIconicName()
cap_iconic = s;
if (!cap_suffix.isEmpty()) {
if (!cap_iconic.isEmpty()) // Keep the same suffix in iconic name if it's set
info->setVisibleIconName(QString(s + cap_suffix).toUtf8());
info->setVisibleIconName(QString(s + cap_suffix).toUtf8().constData());
else if (was_set)
info->setVisibleIconName("");
}
@ -2347,7 +2347,7 @@ QPixmap* kwin_get_menu_pix_hack()
{
static QPixmap p;
if (p.isNull())
p = SmallIcon("bx2");
p = SmallIcon(QStringLiteral("bx2"));
return &p;
}
@ -2357,7 +2357,7 @@ void Client::checkActivities()
QStringList newActivitiesList;
QByteArray prop = getStringProperty(window(), atoms->activities);
activitiesDefined = !prop.isEmpty();
if (prop == Activities::nullUuid()) {
if (QString::fromUtf8(prop) == Activities::nullUuid()) {
//copied from setOnAllActivities to avoid a redundant XChangeProperty.
if (!activityList.isEmpty()) {
activityList.clear();
@ -2374,7 +2374,7 @@ void Client::checkActivities()
return;
}
newActivitiesList = QString(prop).split(',');
newActivitiesList = QString::fromUtf8(prop).split(QStringLiteral(","));
if (newActivitiesList == activityList)
return; //expected change, it's ok.

View file

@ -98,8 +98,8 @@ void GetAddrInfo::resolve()
// TODO: C++11 nullptr
const char* nullPtr = NULL;
m_watcher->setFuture(QtConcurrent::run(getaddrinfo, m_hostName, nullPtr, m_addressHints, &m_address));
m_ownAddressWatcher->setFuture(QtConcurrent::run(getaddrinfo, getHostName(), nullPtr, m_addressHints, &m_ownAddress));
m_watcher->setFuture(QtConcurrent::run(getaddrinfo, m_hostName.constData(), nullPtr, m_addressHints, &m_address));
m_ownAddressWatcher->setFuture(QtConcurrent::run(getaddrinfo, getHostName().constData(), nullPtr, m_addressHints, &m_ownAddress));
}
void GetAddrInfo::slotResolved()

View file

@ -93,8 +93,8 @@ Compositor::Compositor(QObject* workspace)
qRegisterMetaType<Compositor::SuspendReason>("Compositor::SuspendReason");
new CompositingAdaptor(this);
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.registerObject("/Compositor", this);
dbus.registerService("org.kde.kwin.Compositing");
dbus.registerObject(QStringLiteral("/Compositor"), this);
dbus.registerService(QStringLiteral("org.kde.kwin.Compositing"));
connect(&unredirectTimer, SIGNAL(timeout()), SLOT(delayedCheckUnredirect()));
connect(&compositeResetTimer, SIGNAL(timeout()), SLOT(restart()));
connect(workspace, SIGNAL(configChanged()), SLOT(slotConfigChanged()));
@ -183,7 +183,7 @@ void Compositor::slotCompositingOptionsInitialized()
// Some broken drivers crash on glXQuery() so to prevent constant KWin crashes:
KSharedConfigPtr unsafeConfigPtr = KGlobal::config();
KConfigGroup unsafeConfig(unsafeConfigPtr, "Compositing");
const QString openGLIsUnsafe = "OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : "");
const QString openGLIsUnsafe = QStringLiteral("OpenGLIsUnsafe") + (is_multihead ? QString::number(screen_number) : QString());
if (unsafeConfig.readEntry(openGLIsUnsafe, false))
kWarning(1212) << "KWin has detected that your OpenGL library is unsafe to use";
else {
@ -431,13 +431,13 @@ void Compositor::toggleCompositing()
if (m_suspended) {
// when disabled show a shortcut how the user can get back compositing
QString shortcut, message;
if (KAction* action = qobject_cast<KAction*>(Workspace::self()->actionCollection()->action("Suspend Compositing")))
if (KAction* action = qobject_cast<KAction*>(Workspace::self()->actionCollection()->action(QStringLiteral("Suspend Compositing"))))
shortcut = action->globalShortcut().primary().toString(QKeySequence::NativeText);
if (!shortcut.isEmpty()) {
// display notification only if there is the shortcut
message = i18n("Desktop effects have been suspended by another application.<br/>"
"You can resume using the '%1' shortcut.", shortcut);
KNotification::event("compositingsuspendeddbus", message);
KNotification::event(QStringLiteral("compositingsuspendeddbus"), message);
}
}
}
@ -780,22 +780,22 @@ bool Compositor::isOpenGLBroken() const
QString Compositor::compositingType() const
{
if (!hasScene()) {
return "none";
return QStringLiteral("none");
}
switch (m_scene->compositingType()) {
case XRenderCompositing:
return "xrender";
return QStringLiteral("xrender");
case OpenGL1Compositing:
return "gl1";
return QStringLiteral("gl1");
case OpenGL2Compositing:
#ifdef KWIN_HAVE_OPENGLES
return "gles";
return QStringLiteral("gles");
#else
return "gl2";
return QStringLiteral("gl2");
#endif
case NoCompositing:
default:
return "none";
return QStringLiteral("none");
}
}

View file

@ -52,7 +52,7 @@ CompositingPrefs::~CompositingPrefs()
bool CompositingPrefs::openGlIsBroken()
{
const QString unsafeKey("OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : ""));
const QString unsafeKey(QStringLiteral("OpenGLIsUnsafe") + (is_multihead ? QString::number(screen_number) : QString()));
return KConfigGroup(KGlobal::config(), "Compositing").readEntry(unsafeKey, false);
}
@ -60,8 +60,8 @@ bool CompositingPrefs::compositingPossible()
{
// first off, check whether we figured that we'll crash on detection because of a buggy driver
KConfigGroup gl_workaround_group(KGlobal::config(), "Compositing");
const QString unsafeKey("OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : ""));
if (gl_workaround_group.readEntry("Backend", "OpenGL") == "OpenGL" &&
const QString unsafeKey(QStringLiteral("OpenGLIsUnsafe") + (is_multihead ? QString::number(screen_number) : QString()));
if (gl_workaround_group.readEntry("Backend", "OpenGL") == QStringLiteral("OpenGL") &&
gl_workaround_group.readEntry(unsafeKey, false))
return false;
@ -90,8 +90,8 @@ QString CompositingPrefs::compositingNotPossibleReason()
{
// first off, check whether we figured that we'll crash on detection because of a buggy driver
KConfigGroup gl_workaround_group(KGlobal::config(), "Compositing");
const QString unsafeKey("OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : ""));
if (gl_workaround_group.readEntry("Backend", "OpenGL") == "OpenGL" &&
const QString unsafeKey(QStringLiteral("OpenGLIsUnsafe") + (is_multihead ? QString::number(screen_number) : QString()));
if (gl_workaround_group.readEntry("Backend", "OpenGL") == QStringLiteral("OpenGL") &&
gl_workaround_group.readEntry(unsafeKey, false))
return i18n("<b>OpenGL compositing (the default) has crashed KWin in the past.</b><br>"
"This was most likely due to a driver bug."
@ -149,7 +149,7 @@ void CompositingPrefs::detect()
// environment variable.
// Direct rendering is preferred, since not all OpenGL extensions are
// available with indirect rendering.
const QString opengl_test = KStandardDirs::findExe("kwin_opengl_test");
const QString opengl_test = KStandardDirs::findExe(QStringLiteral("kwin_opengl_test"));
if (QProcess::execute(opengl_test) != 0) {
mEnableDirectRendering = false;
setenv("LIBGL_ALWAYS_INDIRECT", "1", true);

View file

@ -46,15 +46,15 @@ DBusInterface::DBusInterface(QObject *parent)
(void) new KWinAdaptor(this);
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.registerObject("/KWin", this);
if (!dbus.registerService("org.kde.KWin")) {
QDBusServiceWatcher *dog = new QDBusServiceWatcher("org.kde.KWin", dbus, QDBusServiceWatcher::WatchForUnregistration, this);
dbus.registerObject(QStringLiteral("/KWin"), this);
if (!dbus.registerService(QStringLiteral("org.kde.KWin"))) {
QDBusServiceWatcher *dog = new QDBusServiceWatcher(QStringLiteral("org.kde.KWin"), dbus, QDBusServiceWatcher::WatchForUnregistration, this);
connect (dog, SIGNAL(serviceUnregistered(QString)), SLOT(becomeKWinService(QString)));
}
connect(Compositor::self(), SIGNAL(compositingToggled(bool)), SIGNAL(compositingToggled(bool)));
dbus.connect(QString(), "/KWin", "org.kde.KWin", "reloadConfig",
dbus.connect(QString(), QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reloadConfig"),
Workspace::self(), SLOT(slotReloadConfig()));
dbus.connect(QString(), "/KWin", "org.kde.KWin", "reinitCompositing",
dbus.connect(QString(), QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reinitCompositing"),
Compositor::self(), SLOT(slotReinitialize()));
}
@ -62,16 +62,16 @@ void DBusInterface::becomeKWinService(const QString &service)
{
// TODO: this watchdog exists to make really safe that we at some point get the service
// but it's probably no longer needed since we explicitly unregister the service with the deconstructor
if (service == "org.kde.KWin" && QDBusConnection::sessionBus().registerService("org.kde.KWin") && sender()) {
if (service == QStringLiteral("org.kde.KWin") && QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.KWin")) && sender()) {
sender()->deleteLater(); // bye doggy :'(
}
}
DBusInterface::~DBusInterface()
{
QDBusConnection::sessionBus().unregisterService("org.kde.KWin"); // this is the long standing legal service
QDBusConnection::sessionBus().unregisterService(QStringLiteral("org.kde.KWin")); // this is the long standing legal service
// KApplication automatically also grabs org.kde.kwin, so it's often been used externally - ensure to free it as well
QDBusConnection::sessionBus().unregisterService("org.kde.kwin");
QDBusConnection::sessionBus().unregisterService(QStringLiteral("org.kde.kwin"));
}
void DBusInterface::circulateDesktopApplications()

View file

@ -38,12 +38,12 @@ DecorationPlugin::DecorationPlugin(QObject *parent)
, KDecorationPlugins(KGlobal::config())
, m_disabled(false)
{
defaultPlugin = "kwin3_oxygen";
defaultPlugin = QStringLiteral("kwin3_oxygen");
#ifndef KWIN_BUILD_OXYGEN
defaultPlugin = "kwin3_aurorae";
defaultPlugin = QStringLiteral("kwin3_aurorae");
#endif
#ifdef KWIN_BUILD_DECORATIONS
loadPlugin(""); // load the plugin specified in cfg file
loadPlugin(QString()); // load the plugin specified in cfg file
#else
setDisabled(true);
#endif
@ -157,30 +157,30 @@ void DecorationPlugin::resetCompositing()
QString DecorationPlugin::supportInformation()
{
if (m_disabled) {
return "Decoration Plugin disabled\n";
return QStringLiteral("Decoration Plugin disabled\n");
}
QString support;
support.append("Current Plugin: ");
support.append(QStringLiteral("Current Plugin: "));
support.append(currentPlugin());
support.append('\n');
support.append(QStringLiteral("\n"));
support.append("Shadows: ");
support.append(hasShadows() ? "yes\n" : "no\n");
support.append(QStringLiteral("Shadows: "));
support.append(hasShadows() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
support.append("Alpha: ");
support.append(hasAlpha() ? "yes\n" : "no\n");
support.append(QStringLiteral("Alpha: "));
support.append(hasAlpha() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
support.append("Announces Alpha: ");
support.append(supportsAnnounceAlpha() ? "yes\n" : "no\n");
support.append(QStringLiteral("Announces Alpha: "));
support.append(supportsAnnounceAlpha() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
support.append("Tabbing: ");
support.append(supportsTabbing() ? "yes\n" : "no\n");
support.append(QStringLiteral("Tabbing: "));
support.append(supportsTabbing() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
support.append("Frame Overlap: ");
support.append(supportsFrameOverlap() ? "yes\n" : "no\n");
support.append(QStringLiteral("Frame Overlap: "));
support.append(supportsFrameOverlap() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
support.append("Blur Behind: ");
support.append(supportsBlurBehind() ? "yes\n" : "no\n");
support.append(QStringLiteral("Blur Behind: "));
support.append(supportsBlurBehind() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
// TODO: Qt5 - read support information from Factory
return support;
}

View file

@ -76,7 +76,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin
{
static const QString SCREEN_LOCKER_SERVICE_NAME = QString("org.freedesktop.ScreenSaver");
static const QString SCREEN_LOCKER_SERVICE_NAME = QStringLiteral("org.freedesktop.ScreenSaver");
ScreenLockerWatcher::ScreenLockerWatcher(QObject *parent)
: QObject(parent)
@ -220,8 +220,8 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
{
new EffectsAdaptor(this);
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.registerObject("/Effects", this);
dbus.registerService("org.kde.kwin.Effects");
dbus.registerObject(QStringLiteral("/Effects"), this);
dbus.registerService(QStringLiteral("org.kde.kwin.Effects"));
// init is important, otherwise causes crashes when quads are build before the first painting pass start
m_currentBuildQuadsIterator = m_activeEffects.end();
@ -303,7 +303,7 @@ void EffectsHandlerImpl::reconfigure()
// perform querying for the services in a thread
QFutureWatcher<KService::List> *watcher = new QFutureWatcher<KService::List>(this);
connect(watcher, SIGNAL(finished()), this, SLOT(slotEffectsQueried()));
watcher->setFuture(QtConcurrent::run(KServiceTypeTrader::self(), &KServiceTypeTrader::query, QString("KWin/Effect"), QString()));
watcher->setFuture(QtConcurrent::run(KServiceTypeTrader::self(), &KServiceTypeTrader::query, QStringLiteral("KWin/Effect"), QString()));
}
void EffectsHandlerImpl::slotEffectsQueried()
@ -735,7 +735,7 @@ void EffectsHandlerImpl::stopMouseInterception(Effect *effect)
void* EffectsHandlerImpl::getProxy(QString name)
{
// All effects start with "kwin4_effect_", prepend it to the name
name.prepend("kwin4_effect_");
name.prepend(QStringLiteral("kwin4_effect_"));
for (QVector< EffectPair >::iterator it = loaded_effects.begin(); it != loaded_effects.end(); ++it)
if ((*it).first == name)
@ -1276,11 +1276,11 @@ KLibrary* EffectsHandlerImpl::findEffectLibrary(KService* service)
{
QString libname = service->library();
#ifdef KWIN_HAVE_OPENGLES
if (libname.startsWith(QLatin1String("kwin4_effect_"))) {
libname.replace("kwin4_effect_", "kwin4_effect_gles_");
if (libname.startsWith(QStringLiteral("kwin4_effect_"))) {
libname.replace(QStringLiteral("kwin4_effect_"), QStringLiteral("kwin4_effect_gles_"));
}
#endif
libname.replace("kwin", KWIN_NAME);
libname.replace(QStringLiteral("kwin"), QStringLiteral(KWIN_NAME));
KLibrary* library = new KLibrary(libname);
if (!library) {
kError(1212) << "couldn't open library for effect '" <<
@ -1310,7 +1310,7 @@ QStringList EffectsHandlerImpl::loadedEffects() const
QStringList EffectsHandlerImpl::listOfEffects() const
{
KService::List offers = KServiceTypeTrader::self()->query("KWin/Effect");
KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("KWin/Effect"));
QStringList listOfModules;
// First unload necessary effects
foreach (const KService::Ptr & service, offers) {
@ -1339,15 +1339,15 @@ bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault)
kDebug(1212) << "Trying to load " << name;
QString internalname = name.toLower();
QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(internalname);
KService::List offers = KServiceTypeTrader::self()->query("KWin/Effect", constraint);
QString constraint = QStringLiteral("[X-KDE-PluginInfo-Name] == '%1'").arg(internalname);
KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("KWin/Effect"), constraint);
if (offers.isEmpty()) {
kError(1212) << "Couldn't find effect " << name << endl;
return false;
}
KService::Ptr service = offers.first();
if (service->property("X-Plasma-API").toString() == "javascript") {
if (service->property(QStringLiteral("X-Plasma-API")).toString() == QStringLiteral("javascript")) {
// this is a scripted effect - use different loader
return loadScriptedEffect(name, service.data());
}
@ -1357,8 +1357,8 @@ bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault)
return false;
}
QString version_symbol = "effect_version_" + name;
KLibrary::void_function_ptr version_func = library->resolveFunction(version_symbol.toAscii());
QString version_symbol = QStringLiteral("effect_version_") + name;
KLibrary::void_function_ptr version_func = library->resolveFunction(version_symbol.toAscii().constData());
if (version_func == NULL) {
kWarning(1212) << "Effect " << name << " does not provide required API version, ignoring.";
delete library;
@ -1376,13 +1376,13 @@ bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault)
return false;
}
const QString enabledByDefault_symbol = "effect_enabledbydefault_" + name;
const QString enabledByDefault_symbol = QStringLiteral("effect_enabledbydefault_") + name;
KLibrary::void_function_ptr enabledByDefault_func = library->resolveFunction(enabledByDefault_symbol.toAscii().data());
const QString supported_symbol = "effect_supported_" + name;
const QString supported_symbol = QStringLiteral("effect_supported_") + name;
KLibrary::void_function_ptr supported_func = library->resolveFunction(supported_symbol.toAscii().data());
const QString create_symbol = "effect_create_" + name;
const QString create_symbol = QStringLiteral("effect_create_") + name;
KLibrary::void_function_ptr create_func = library->resolveFunction(create_symbol.toAscii().data());
if (supported_func) {
@ -1428,7 +1428,7 @@ bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault)
Effect* e = create();
effect_order.insert(service->property("X-KDE-Ordering").toInt(), EffectPair(name, e));
effect_order.insert(service->property(QStringLiteral("X-KDE-Ordering")).toInt(), EffectPair(name, e));
effectsChanged();
effect_libraries[ name ] = library;
@ -1439,12 +1439,12 @@ bool EffectsHandlerImpl::loadScriptedEffect(const QString& name, KService *servi
{
#ifdef KWIN_BUILD_SCRIPTING
const KDesktopFile df("services", service->entryPath());
const QString scriptName = df.desktopGroup().readEntry<QString>("X-Plasma-MainScript", "");
const QString scriptName = df.desktopGroup().readEntry<QString>(QStringLiteral("X-Plasma-MainScript"), QString());
if (scriptName.isEmpty()) {
kDebug(1212) << "X-Plasma-MainScript not set";
return false;
}
const QString scriptFile = KStandardDirs::locate("data", QLatin1String(KWIN_NAME) + "/effects/" + name + "/contents/" + scriptName);
const QString scriptFile = KStandardDirs::locate("data", QStringLiteral(KWIN_NAME) + QStringLiteral("/effects/") + name + QStringLiteral("/contents/") + scriptName);
if (scriptFile.isNull()) {
kDebug(1212) << "Could not locate the effect script";
return false;
@ -1454,7 +1454,7 @@ bool EffectsHandlerImpl::loadScriptedEffect(const QString& name, KService *servi
kDebug(1212) << "Could not initialize scripted effect: " << name;
return false;
}
effect_order.insert(service->property("X-KDE-Ordering").toInt(), EffectPair(name, effect));
effect_order.insert(service->property(QStringLiteral("X-KDE-Ordering")).toInt(), EffectPair(name, effect));
effectsChanged();
return true;
#else
@ -1578,14 +1578,14 @@ QString EffectsHandlerImpl::supportInformation(const QString &name) const
}
for (QVector< EffectPair >::const_iterator it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); ++it) {
if ((*it).first == name) {
QString support((*it).first + ":\n");
QString support((*it).first + QStringLiteral(":\n"));
const QMetaObject *metaOptions = (*it).second->metaObject();
for (int i=0; i<metaOptions->propertyCount(); ++i) {
const QMetaProperty property = metaOptions->property(i);
if (QLatin1String(property.name()) == "objectName") {
if (QLatin1String(property.name()) == QLatin1String("objectName")) {
continue;
}
support.append(QLatin1String(property.name()) % ": " % (*it).second->property(property.name()).toString() % '\n');
support.append(QString::fromUtf8(property.name()) + QStringLiteral(": ") + (*it).second->property(property.name()).toString() + QStringLiteral("\n"));
}
return support;
}
@ -1601,7 +1601,7 @@ bool EffectsHandlerImpl::isScreenLocked() const
QString EffectsHandlerImpl::debug(const QString& name, const QString& parameter) const
{
QString internalName = name.startsWith("kwin4_effect_") ? name : "kwin4_effect_" + name;
QString internalName = name.startsWith(QStringLiteral("kwin4_effect_")) ? name : QStringLiteral("kwin4_effect_") + name;
for (QVector< EffectPair >::const_iterator it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); ++it) {
if ((*it).first == internalName) {
return it->second->debug(parameter);
@ -1849,12 +1849,12 @@ EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint
, m_theme(new Plasma::Theme(this))
{
if (m_style == EffectFrameStyled) {
m_frame.setImagePath("widgets/background");
m_frame.setImagePath(QStringLiteral("widgets/background"));
m_frame.setCacheAllRenderedFrames(true);
connect(m_theme, SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged()));
}
m_selection.setImagePath("widgets/viewitem");
m_selection.setElementPrefix("hover");
m_selection.setImagePath(QStringLiteral("widgets/viewitem"));
m_selection.setElementPrefix(QStringLiteral("hover"));
m_selection.setCacheAllRenderedFrames(true);
m_selection.setEnabledBorders(Plasma::FrameSvg::AllBorders);

View file

@ -45,7 +45,7 @@ void BlurEffectConfig::save()
{
KCModule::save();
EffectsHandler::sendReloadMessage("blur");
EffectsHandler::sendReloadMessage(QStringLiteral("blur"));
}
} // namespace KWin

View file

@ -362,7 +362,7 @@ void ARBBlurShader::reset()
bool ARBBlurShader::supported()
{
if (!hasGLExtension("GL_ARB_fragment_program"))
if (!hasGLExtension(QStringLiteral("GL_ARB_fragment_program")))
return false;
(void) glGetError(); // Clear the error state

View file

@ -68,15 +68,15 @@ CoverSwitchEffect::CoverSwitchEffect()
captionFont.setPointSize(captionFont.pointSize() * 2);
if (effects->compositingType() == OpenGL2Compositing) {
QString shadersDir = "kwin/shaders/1.10/";
QString shadersDir = QStringLiteral("kwin/shaders/1.10/");
#ifdef KWIN_HAVE_OPENGLES
const qint64 coreVersionNumber = kVersionNumber(3, 0);
#else
const qint64 coreVersionNumber = kVersionNumber(1, 40);
#endif
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
shadersDir = "kwin/shaders/1.40/";
const QString fragmentshader = KGlobal::dirs()->findResource("data", shadersDir + "coverswitch-reflection.glsl");
shadersDir = QStringLiteral("kwin/shaders/1.40/");
const QString fragmentshader = KGlobal::dirs()->findResource("data", shadersDir + QStringLiteral("coverswitch-reflection.glsl"));
m_reflectionShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, fragmentshader);
} else {
m_reflectionShader = NULL;
@ -1010,7 +1010,7 @@ void CoverSwitchEffect::updateCaption()
if (selected_window->isDesktop()) {
captionFrame->setText(i18nc("Special entry in alt+tab list for minimizing all windows",
"Show Desktop"));
static QPixmap pix = KIcon("user-desktop").pixmap(captionFrame->iconSize());
static QPixmap pix = KIcon(QStringLiteral("user-desktop")).pixmap(captionFrame->iconSize());
captionFrame->setIcon(pix);
} else {
captionFrame->setText(selected_window->caption());

View file

@ -50,7 +50,7 @@ CoverSwitchEffectConfig::CoverSwitchEffectConfig(QWidget* parent, const QVariant
void CoverSwitchEffectConfig::save()
{
KCModule::save();
EffectsHandler::sendReloadMessage("coverswitch");
EffectsHandler::sendReloadMessage(QStringLiteral("coverswitch"));
}
} // namespace

View file

@ -93,7 +93,7 @@ CubeEffect::CubeEffect()
, zOrderingFactor(0.0f)
, mAddedHeightCoeff1(0.0f)
, mAddedHeightCoeff2(0.0f)
, m_shadersDir("kwin/shaders/1.10/")
, m_shadersDir(QStringLiteral("kwin/shaders/1.10/"))
, m_cubeCapBuffer(NULL)
, m_proxy(this)
{
@ -106,12 +106,12 @@ CubeEffect::CubeEffect()
const qint64 coreVersionNumber = kVersionNumber(1, 40);
#endif
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
m_shadersDir = "kwin/shaders/1.40/";
m_shadersDir = QStringLiteral("kwin/shaders/1.40/");
if (effects->compositingType() == OpenGL2Compositing) {
const QString fragmentshader = KGlobal::dirs()->findResource("data", m_shadersDir + "cube-reflection.glsl");
const QString fragmentshader = KGlobal::dirs()->findResource("data", m_shadersDir + QStringLiteral("cube-reflection.glsl"));
m_reflectionShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, fragmentshader);
const QString capshader = KGlobal::dirs()->findResource("data", m_shadersDir + "cube-cap.glsl");
const QString capshader = KGlobal::dirs()->findResource("data", m_shadersDir + QStringLiteral("cube-cap.glsl"));
m_capShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, capshader);
} else {
m_reflectionShader = NULL;
@ -202,15 +202,15 @@ void CubeEffect::reconfigure(ReconfigureFlags)
// do not connect the shortcut if we use cylinder or sphere
if (!shortcutsRegistered) {
KActionCollection* actionCollection = new KActionCollection(this);
KAction* cubeAction = static_cast< KAction* >(actionCollection->addAction("Cube"));
KAction* cubeAction = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("Cube")));
cubeAction->setText(i18n("Desktop Cube"));
cubeAction->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F11));
cubeShortcut = cubeAction->globalShortcut();
KAction* cylinderAction = static_cast< KAction* >(actionCollection->addAction("Cylinder"));
KAction* cylinderAction = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("Cylinder")));
cylinderAction->setText(i18n("Desktop Cylinder"));
cylinderAction->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
cylinderShortcut = cylinderAction->globalShortcut();
KAction* sphereAction = static_cast< KAction* >(actionCollection->addAction("Sphere"));
KAction* sphereAction = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("Sphere")));
sphereAction->setText(i18n("Desktop Sphere"));
sphereAction->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
sphereShortcut = sphereAction->globalShortcut();
@ -297,8 +297,8 @@ bool CubeEffect::loadShader()
if (!(GLPlatform::instance()->supports(GLSL) &&
(effects->compositingType() == OpenGL2Compositing)))
return false;
QString cylinderVertexshader = KGlobal::dirs()->findResource("data", m_shadersDir + "cylinder.vert");
QString sphereVertexshader = KGlobal::dirs()->findResource("data", m_shadersDir + "sphere.vert");
QString cylinderVertexshader = KGlobal::dirs()->findResource("data", m_shadersDir + QStringLiteral("cylinder.vert"));
QString sphereVertexshader = KGlobal::dirs()->findResource("data", m_shadersDir + QStringLiteral("sphere.vert"));
if (cylinderVertexshader.isEmpty() || sphereVertexshader.isEmpty()) {
kError(1212) << "Couldn't locate shader files" << endl;
return false;

View file

@ -31,7 +31,7 @@
<default code="true">QColor(KColorScheme(QPalette::Active, KColorScheme::Window).background().color())</default>
</entry>
<entry name="CapPath" type="String">
<default code="true">KGlobal::dirs()->findResource(&quot;appdata&quot;, &quot;cubecap.png&quot;)</default>
<default code="true">KGlobal::dirs()->findResource(&quot;appdata&quot;, QStringLiteral(&quot;cubecap.png&quot;))</default>
</entry>
<entry name="TexturedCaps" type="Bool">
<default>true</default>

View file

@ -56,25 +56,25 @@ CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) :
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection->setConfigGroup("Cube");
m_actionCollection->setConfigGroup(QStringLiteral("Cube"));
m_actionCollection->setConfigGlobal(true);
KAction* cubeAction = (KAction*) m_actionCollection->addAction("Cube");
KAction* cubeAction = (KAction*) m_actionCollection->addAction(QStringLiteral("Cube"));
cubeAction->setText(i18n("Desktop Cube"));
cubeAction->setProperty("isConfigurationAction", true);
cubeAction->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F11));
KAction* cylinderAction = (KAction*) m_actionCollection->addAction("Cylinder");
KAction* cylinderAction = (KAction*) m_actionCollection->addAction(QStringLiteral("Cylinder"));
cylinderAction->setText(i18n("Desktop Cylinder"));
cylinderAction->setProperty("isConfigurationAction", true);
cylinderAction->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
KAction* sphereAction = (KAction*) m_actionCollection->addAction("Sphere");
KAction* sphereAction = (KAction*) m_actionCollection->addAction(QStringLiteral("Sphere"));
sphereAction->setText(i18n("Desktop Sphere"));
sphereAction->setProperty("isConfigurationAction", true);
sphereAction->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
m_ui->editor->addCollection(m_actionCollection);
connect(m_ui->kcfg_Caps, SIGNAL(stateChanged(int)), this, SLOT(capsSelectionChanged()));
m_ui->kcfg_Wallpaper->setFilter("*.png *.jpeg *.jpg ");
m_ui->kcfg_Wallpaper->setFilter(QStringLiteral("*.png *.jpeg *.jpg "));
addConfig(CubeConfig::self(), m_ui);
load();
}
@ -83,7 +83,7 @@ void CubeEffectConfig::save()
{
KCModule::save();
m_ui->editor->save();
EffectsHandler::sendReloadMessage("cube");
EffectsHandler::sendReloadMessage(QStringLiteral("cube"));
}
void CubeEffectConfig::capsSelectionChanged()

View file

@ -53,7 +53,7 @@ CubeSlideEffectConfig::CubeSlideEffectConfig(QWidget* parent, const QVariantList
void CubeSlideEffectConfig::save()
{
KCModule::save();
EffectsHandler::sendReloadMessage("cubeslide");
EffectsHandler::sendReloadMessage(QStringLiteral("cubeslide"));
}
} // namespace

View file

@ -122,7 +122,7 @@ void DashboardEffect::postPaintScreen()
bool DashboardEffect::isDashboard(EffectWindow *w)
{
return w->windowRole() == "plasma-dashboard";
return w->windowRole() == QStringLiteral("plasma-dashboard");
}
void DashboardEffect::slotWindowActivated(EffectWindow *w)

View file

@ -46,7 +46,7 @@ void DashboardEffectConfig::save()
{
KCModule::save();
EffectsHandler::sendReloadMessage("dashboard");
EffectsHandler::sendReloadMessage(QStringLiteral("dashboard"));
}
} // namespace KWin

View file

@ -71,7 +71,7 @@ DesktopGridEffect::DesktopGridEffect()
{
// Load shortcuts
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = (KAction*) actionCollection->addAction("ShowDesktopGrid");
KAction* a = (KAction*) actionCollection->addAction(QStringLiteral("ShowDesktopGrid"));
a->setText(i18n("Show Desktop Grid"));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F8));
shortcut = a->globalShortcut();
@ -1093,7 +1093,7 @@ void DesktopGridEffect::setup()
// setup the motion managers
if (m_usePresentWindows)
m_proxy = static_cast<PresentWindowsEffectProxy*>(effects->getProxy("presentwindows"));
m_proxy = static_cast<PresentWindowsEffectProxy*>(effects->getProxy(QStringLiteral("presentwindows")));
if (isUsingPresentWindows()) {
for (int i = 1; i <= effects->numberOfDesktops(); i++) {
for (int j = 0; j < effects->numScreens(); j++) {
@ -1390,7 +1390,7 @@ DesktopButtonsView::DesktopButtonsView(QWidget *parent)
QPalette pal = palette();
pal.setColor(backgroundRole(), Qt::transparent);
setPalette(pal);
foreach (const QString &importPath, KGlobal::dirs()->findDirs("module", "imports")) {
for (const QString &importPath : KGlobal::dirs()->findDirs("module", QStringLiteral("imports"))) {
engine()->addImportPath(importPath);
}
KDeclarative kdeclarative;
@ -1398,13 +1398,13 @@ DesktopButtonsView::DesktopButtonsView(QWidget *parent)
kdeclarative.initialize();
kdeclarative.setupBindings();
rootContext()->setContextProperty("add", QVariant(true));
rootContext()->setContextProperty("remove", QVariant(true));
setSource(QUrl(KStandardDirs::locate("data", QLatin1String("kwin/effects/desktopgrid/main.qml"))));
if (QObject *item = rootObject()->findChild<QObject*>("addButton")) {
rootContext()->setContextProperty(QStringLiteral("add"), QVariant(true));
rootContext()->setContextProperty(QStringLiteral("remove"), QVariant(true));
setSource(QUrl(KStandardDirs::locate("data", QStringLiteral("kwin/effects/desktopgrid/main.qml"))));
if (QObject *item = rootObject()->findChild<QObject*>(QStringLiteral("addButton"))) {
connect(item, SIGNAL(clicked()), SIGNAL(addDesktop()));
}
if (QObject *item = rootObject()->findChild<QObject*>("removeButton")) {
if (QObject *item = rootObject()->findChild<QObject*>(QStringLiteral("removeButton"))) {
connect(item, SIGNAL(clicked()), SIGNAL(removeDesktop()));
}
}
@ -1424,12 +1424,12 @@ void DesktopButtonsView::windowInputMouseEvent(QMouseEvent *e)
void DesktopButtonsView::setAddDesktopEnabled(bool enable)
{
rootContext()->setContextProperty("add", QVariant(enable));
rootContext()->setContextProperty(QStringLiteral("add"), QVariant(enable));
}
void DesktopButtonsView::setRemoveDesktopEnabled(bool enable)
{
rootContext()->setContextProperty("remove", QVariant(enable));
rootContext()->setContextProperty(QStringLiteral("remove"), QVariant(enable));
}
} // namespace

View file

@ -53,10 +53,10 @@ DesktopGridEffectConfig::DesktopGridEffectConfig(QWidget* parent, const QVariant
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection->setConfigGroup("DesktopGrid");
m_actionCollection->setConfigGroup(QStringLiteral("DesktopGrid"));
m_actionCollection->setConfigGlobal(true);
KAction* a = (KAction*) m_actionCollection->addAction("ShowDesktopGrid");
KAction* a = (KAction*) m_actionCollection->addAction(QStringLiteral("ShowDesktopGrid"));
a->setText(i18n("Show Desktop Grid"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F8));
@ -94,11 +94,11 @@ void DesktopGridEffectConfig::save()
DesktopGridConfig::setDesktopNameAlignment(m_ui->desktopNameAlignmentCombo->itemData(m_ui->desktopNameAlignmentCombo->currentIndex()).toInt());
KCModule::save();
KConfigGroup conf = EffectsHandler::effectConfig("DesktopGrid");
KConfigGroup conf = EffectsHandler::effectConfig(QStringLiteral("DesktopGrid"));
conf.writeEntry("DesktopNameAlignment", DesktopGridConfig::desktopNameAlignment());
conf.sync();
EffectsHandler::sendReloadMessage("desktopgrid");
EffectsHandler::sendReloadMessage(QStringLiteral("desktopgrid"));
}
void DesktopGridEffectConfig::load()

View file

@ -60,7 +60,7 @@ DimInactiveEffectConfig::DimInactiveEffectConfig(QWidget* parent, const QVariant
void DimInactiveEffectConfig::save()
{
KCModule::save();
EffectsHandler::sendReloadMessage("diminactive");
EffectsHandler::sendReloadMessage(QStringLiteral("diminactive"));
}
} // namespace

View file

@ -89,11 +89,11 @@ void DimScreenEffect::slotWindowActivated(EffectWindow *w)
{
if (!w) return;
QStringList check;
check << "kdesu kdesu";
check << "kdesudo kdesudo";
check << "polkit-kde-manager polkit-kde-manager";
check << "polkit-kde-authentication-agent-1 polkit-kde-authentication-agent-1";
check << "pinentry pinentry";
check << QStringLiteral("kdesu kdesu");
check << QStringLiteral("kdesudo kdesudo");
check << QStringLiteral("polkit-kde-manager polkit-kde-manager");
check << QStringLiteral("polkit-kde-authentication-agent-1 polkit-kde-authentication-agent-1");
check << QStringLiteral("pinentry pinentry");
if (check.contains(w->windowClass())) {
mActivated = true;
activateAnimation = true;

View file

@ -44,7 +44,7 @@ FallApartEffect::FallApartEffect()
void FallApartEffect::reconfigure(ReconfigureFlags)
{
KConfigGroup conf = effects->effectConfig("FallApart");
KConfigGroup conf = effects->effectConfig(QStringLiteral("FallApart"));
blockSize = qBound(1, conf.readEntry("BlockSize", 40), 100000);
}

View file

@ -58,13 +58,13 @@ FlipSwitchEffect::FlipSwitchEffect()
m_captionFont.setPointSize(m_captionFont.pointSize() * 2);
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = (KAction*)actionCollection->addAction("FlipSwitchCurrent");
KAction* a = (KAction*)actionCollection->addAction(QStringLiteral("FlipSwitchCurrent"));
a->setText(i18n("Toggle Flip Switch (Current desktop)"));
a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
m_shortcutCurrent = a->globalShortcut();
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleActiveCurrent()));
connect(a, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChangedCurrent(QKeySequence)));
KAction* b = (KAction*)actionCollection->addAction("FlipSwitchAll");
KAction* b = (KAction*)actionCollection->addAction(QStringLiteral("FlipSwitchAll"));
b->setText(i18n("Toggle Flip Switch (All desktops)"));
b->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
m_shortcutAll = b->globalShortcut();
@ -950,7 +950,7 @@ void FlipSwitchEffect::updateCaption()
if (m_selectedWindow->isDesktop()) {
m_captionFrame->setText(i18nc("Special entry in alt+tab list for minimizing all windows",
"Show Desktop"));
static QPixmap pix = KIcon("user-desktop").pixmap(m_captionFrame->iconSize());
static QPixmap pix = KIcon(QStringLiteral("user-desktop")).pixmap(m_captionFrame->iconSize());
m_captionFrame->setIcon(pix);
} else {
m_captionFrame->setText(m_selectedWindow->caption());

View file

@ -50,14 +50,14 @@ FlipSwitchEffectConfig::FlipSwitchEffectConfig(QWidget* parent, const QVariantLi
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
KAction* a = (KAction*)m_actionCollection->addAction("FlipSwitchCurrent");
KAction* a = (KAction*)m_actionCollection->addAction(QStringLiteral("FlipSwitchCurrent"));
a->setText(i18n("Toggle Flip Switch (Current desktop)"));
a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
KAction* b = (KAction*)m_actionCollection->addAction("FlipSwitchAll");
KAction* b = (KAction*)m_actionCollection->addAction(QStringLiteral("FlipSwitchAll"));
b->setText(i18n("Toggle Flip Switch (All desktops)"));
b->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
m_actionCollection->setConfigGroup("FlipSwitch");
m_actionCollection->setConfigGroup(QStringLiteral("FlipSwitch"));
m_actionCollection->setConfigGlobal(true);
m_ui->shortcutEditor->addCollection(m_actionCollection);
@ -76,7 +76,7 @@ void FlipSwitchEffectConfig::save()
KCModule::save();
m_ui->shortcutEditor->save();
EffectsHandler::sendReloadMessage("flipswitch");
EffectsHandler::sendReloadMessage(QStringLiteral("flipswitch"));
}

View file

@ -225,7 +225,7 @@ bool GlideEffect::isGlideWindow(EffectWindow* w)
return true;
if (!w->isManaged() || w->isMenu() || w->isNotification() || w->isDesktop() ||
w->isDock() || w->isSplash() || w->isToolbar() ||
w->windowClass() == "dashboard dashboard")
w->windowClass() == QStringLiteral("dashboard dashboard"))
return false;
return true;
}

View file

@ -44,7 +44,7 @@ GlideEffectConfig::~GlideEffectConfig()
void GlideEffectConfig::save()
{
KCModule::save();
EffectsHandler::sendReloadMessage("glide");
EffectsHandler::sendReloadMessage(QStringLiteral("glide"));
}
} // namespace KWin
#include "glide_config.moc"

View file

@ -46,12 +46,12 @@ InvertEffect::InvertEffect()
{
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = (KAction*)actionCollection->addAction("Invert");
KAction* a = (KAction*)actionCollection->addAction(QStringLiteral("Invert"));
a->setText(i18n("Toggle Invert Effect"));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_I));
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleScreenInversion()));
KAction* b = (KAction*)actionCollection->addAction("InvertWindow");
KAction* b = (KAction*)actionCollection->addAction(QStringLiteral("InvertWindow"));
b->setText(i18n("Toggle Invert Effect on Window"));
b->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_U));
connect(b, SIGNAL(triggered(bool)), this, SLOT(toggleWindow()));
@ -72,15 +72,15 @@ bool InvertEffect::loadData()
{
m_inited = true;
QString shadersDir = "kwin/shaders/1.10/";
QString shadersDir = QStringLiteral("kwin/shaders/1.10/");
#ifdef KWIN_HAVE_OPENGLES
const qint64 coreVersionNumber = kVersionNumber(3, 0);
#else
const qint64 coreVersionNumber = kVersionNumber(1, 40);
#endif
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
shadersDir = "kwin/shaders/1.40/";
const QString fragmentshader = KGlobal::dirs()->findResource("data", shadersDir + "invert.frag");
shadersDir = QStringLiteral("kwin/shaders/1.40/");
const QString fragmentshader = KGlobal::dirs()->findResource("data", shadersDir + QStringLiteral("invert.frag"));
m_shader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, fragmentshader);
if (!m_shader->isValid()) {

View file

@ -43,12 +43,12 @@ InvertEffectConfig::InvertEffectConfig(QWidget* parent, const QVariantList& args
// Shortcut config. The shortcut belongs to the component "kwin"!
KActionCollection *actionCollection = new KActionCollection(this, KComponentData("kwin"));
KAction* a = static_cast<KAction*>(actionCollection->addAction("Invert"));
KAction* a = static_cast<KAction*>(actionCollection->addAction(QStringLiteral("Invert")));
a->setText(i18n("Toggle Invert Effect"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_I));
KAction* b = static_cast<KAction*>(actionCollection->addAction("InvertWindow"));
KAction* b = static_cast<KAction*>(actionCollection->addAction(QStringLiteral("InvertWindow")));
b->setText(i18n("Toggle Invert Effect on Window"));
b->setProperty("isConfigurationAction", true);
b->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_U));
@ -81,7 +81,7 @@ void InvertEffectConfig::save()
mShortcutEditor->save(); // undo() will restore to this state from now on
emit changed(false);
EffectsHandler::sendReloadMessage("invert");
EffectsHandler::sendReloadMessage(QStringLiteral("invert"));
}
void InvertEffectConfig::defaults()

View file

@ -282,8 +282,8 @@ void LogoutEffect::slotWindowDeleted(EffectWindow* w)
bool LogoutEffect::isLogoutDialog(EffectWindow* w)
{
// TODO there should be probably a better way (window type?)
if (w->windowClass() == "ksmserver ksmserver"
&& (w->windowRole() == "logoutdialog" || w->windowRole() == "logouteffect")) {
if (w->windowClass() == QStringLiteral("ksmserver ksmserver")
&& (w->windowRole() == QStringLiteral("logoutdialog") || w->windowRole() == QStringLiteral("logouteffect"))) {
return true;
}
return false;
@ -296,8 +296,8 @@ void LogoutEffect::renderVignetting()
return;
}
if (!m_vignettingShader) {
const char *shader = GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40) ?
"kwin/vignetting-140.frag" : "kwin/vignetting.frag";
QString shader = GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40) ?
QStringLiteral("kwin/vignetting-140.frag") : QStringLiteral("kwin/vignetting.frag");
m_vignettingShader = ShaderManager::instance()->loadFragmentShader(KWin::ShaderManager::ColorShader,
KGlobal::dirs()->findResource("data", shader));
if (!m_vignettingShader->isValid()) {
@ -378,8 +378,8 @@ void LogoutEffect::renderBlurTexture()
return;
}
if (!m_blurShader) {
const char *shader = GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40) ?
"kwin/logout-blur-140.frag" : "kwin/logout-blur.frag";
QString shader = GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40) ?
QStringLiteral("kwin/logout-blur-140.frag") : QStringLiteral("kwin/logout-blur.frag");
m_blurShader = ShaderManager::instance()->loadFragmentShader(KWin::ShaderManager::SimpleShader,
KGlobal::dirs()->findResource("data", shader));
if (!m_blurShader->isValid()) {

View file

@ -57,7 +57,7 @@ LookingGlassEffect::LookingGlassEffect()
{
actionCollection = new KActionCollection(this);
actionCollection->setConfigGlobal(true);
actionCollection->setConfigGroup("LookingGlass");
actionCollection->setConfigGroup(QStringLiteral("LookingGlass"));
KAction* a;
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomIn, this, SLOT(zoomIn())));
@ -89,7 +89,7 @@ void LookingGlassEffect::reconfigure(ReconfigureFlags)
LookingGlassConfig::self()->readConfig();
initialradius = LookingGlassConfig::radius();
radius = initialradius;
kDebug(1212) << QString("Radius from config: %1").arg(radius) << endl;
kDebug(1212) << QStringLiteral("Radius from config: %1").arg(radius) << endl;
actionCollection->readSettings();
m_valid = loadData();
}
@ -116,15 +116,15 @@ bool LookingGlassEffect::loadData()
return false;
}
QString shadersDir = "kwin/shaders/1.10/";
QString shadersDir = QStringLiteral("kwin/shaders/1.10/");
#ifdef KWIN_HAVE_OPENGLES
const qint64 coreVersionNumber = kVersionNumber(3, 0);
#else
const qint64 coreVersionNumber = kVersionNumber(1, 40);
#endif
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
shadersDir = "kwin/shaders/1.40/";
const QString fragmentshader = KGlobal::dirs()->findResource("data", shadersDir + "lookingglass.frag");
shadersDir = QStringLiteral("kwin/shaders/1.40/");
const QString fragmentshader = KGlobal::dirs()->findResource("data", shadersDir + QStringLiteral("lookingglass.frag"));
m_shader = ShaderManager::instance()->loadFragmentShader(ShaderManager::SimpleShader, fragmentshader);
if (m_shader->isValid()) {
ShaderBinder binder(m_shader);

View file

@ -60,7 +60,7 @@ LookingGlassEffectConfig::LookingGlassEffectConfig(QWidget* parent, const QVaria
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection->setConfigGroup("LookingGlass");
m_actionCollection->setConfigGroup(QStringLiteral("LookingGlass"));
m_actionCollection->setConfigGlobal(true);
KAction* a;
@ -92,7 +92,7 @@ void LookingGlassEffectConfig::save()
m_ui->editor->save(); // undo() will restore to this state from now on
EffectsHandler::sendReloadMessage("lookingglass");
EffectsHandler::sendReloadMessage(QStringLiteral("lookingglass"));
}
void LookingGlassEffectConfig::defaults()

View file

@ -55,8 +55,8 @@ void MagicLampEffect::reconfigure(ReconfigureFlags)
// TODO: rename animationDuration to duration
mAnimationDuration = animationTime(MagicLampConfig::animationDuration() != 0 ? MagicLampConfig::animationDuration() : 250);
KConfigGroup conf = effects->effectConfig("MagicLamp");
conf = effects->effectConfig("Shadow");
KConfigGroup conf = effects->effectConfig(QStringLiteral("MagicLamp"));
conf = effects->effectConfig(QStringLiteral("Shadow"));
int v = conf.readEntry("Size", 5);
v += conf.readEntry("Fuzzyness", 10);
mShadowOffset[0] = mShadowOffset[1] = -v;

View file

@ -54,7 +54,7 @@ MagicLampEffectConfig::MagicLampEffectConfig(QWidget* parent, const QVariantList
void MagicLampEffectConfig::save()
{
KCModule::save();
EffectsHandler::sendReloadMessage("magiclamp");
EffectsHandler::sendReloadMessage(QStringLiteral("magiclamp"));
}
} // namespace

View file

@ -73,7 +73,7 @@ MagnifierEffect::~MagnifierEffect()
delete m_texture;
destroyPixmap();
// Save the zoom value.
KConfigGroup conf = EffectsHandler::effectConfig("Magnifier");
KConfigGroup conf = EffectsHandler::effectConfig(QStringLiteral("Magnifier"));
conf.writeEntry("InitialZoom", target_zoom);
conf.sync();
}

View file

@ -60,7 +60,7 @@ MagnifierEffectConfig::MagnifierEffectConfig(QWidget* parent, const QVariantList
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection->setConfigGroup("Magnifier");
m_actionCollection->setConfigGroup(QStringLiteral("Magnifier"));
m_actionCollection->setConfigGlobal(true);
KAction* a;
@ -92,7 +92,7 @@ void MagnifierEffectConfig::save()
m_ui->editor->save(); // undo() will restore to this state from now on
KCModule::save();
EffectsHandler::sendReloadMessage("magnifier");
EffectsHandler::sendReloadMessage(QStringLiteral("magnifier"));
}
void MagnifierEffectConfig::defaults()

View file

@ -45,7 +45,7 @@ MouseClickEffect::MouseClickEffect()
{
m_enabled = false;
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = static_cast<KAction*>(actionCollection->addAction("ToggleMouseClick"));
KAction* a = static_cast<KAction*>(actionCollection->addAction(QStringLiteral("ToggleMouseClick")));
a->setText(i18n("Toggle Effect"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Asterisk));
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleEnabled()));

View file

@ -53,7 +53,7 @@ MouseClickEffectConfig::MouseClickEffectConfig(QWidget* parent, const QVariantLi
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
KAction* a = static_cast<KAction*>(m_actionCollection->addAction("ToggleMouseClick"));
KAction* a = static_cast<KAction*>(m_actionCollection->addAction(QStringLiteral("ToggleMouseClick")));
a->setText(i18n("Toggle Effect"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Asterisk));
@ -74,7 +74,7 @@ void MouseClickEffectConfig::save()
{
KCModule::save();
m_ui->editor->save(); // undo() will restore to this state from now on
EffectsHandler::sendReloadMessage("mouseclick");
EffectsHandler::sendReloadMessage(QStringLiteral("mouseclick"));
}
} // namespace

View file

@ -49,11 +49,11 @@ KWIN_EFFECT(mousemark, MouseMarkEffect)
MouseMarkEffect::MouseMarkEffect()
{
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = static_cast< KAction* >(actionCollection->addAction("ClearMouseMarks"));
KAction* a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("ClearMouseMarks")));
a->setText(i18n("Clear All Mouse Marks"));
a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F11));
connect(a, SIGNAL(triggered(bool)), this, SLOT(clear()));
a = static_cast< KAction* >(actionCollection->addAction("ClearLastMouseMark"));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("ClearLastMouseMark")));
a->setText(i18n("Clear Last Mouse Mark"));
a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F12));
connect(a, SIGNAL(triggered(bool)), this, SLOT(clearLast()));

View file

@ -59,12 +59,12 @@ MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
KAction* a = static_cast< KAction* >(m_actionCollection->addAction("ClearMouseMarks"));
KAction* a = static_cast< KAction* >(m_actionCollection->addAction(QStringLiteral("ClearMouseMarks")));
a->setText(i18n("Clear Mouse Marks"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F11));
a = static_cast< KAction* >(m_actionCollection->addAction("ClearLastMouseMark"));
a = static_cast< KAction* >(m_actionCollection->addAction(QStringLiteral("ClearLastMouseMark")));
a->setText(i18n("Clear Last Mouse Mark"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F12));
@ -88,7 +88,7 @@ void MouseMarkEffectConfig::save()
m_actionCollection->writeSettings();
m_ui->editor->save(); // undo() will restore to this state from now on
EffectsHandler::sendReloadMessage("mousemark");
EffectsHandler::sendReloadMessage(QStringLiteral("mousemark"));
}
} // namespace

View file

@ -75,19 +75,19 @@ PresentWindowsEffect::PresentWindowsEffect()
m_atomWindows = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_GROUP", this);
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = (KAction*)actionCollection->addAction("Expose");
KAction* a = (KAction*)actionCollection->addAction(QStringLiteral("Expose"));
a->setText(i18n("Toggle Present Windows (Current desktop)"));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F9));
shortcut = a->globalShortcut();
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleActive()));
connect(a, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChanged(QKeySequence)));
KAction* b = (KAction*)actionCollection->addAction("ExposeAll");
KAction* b = (KAction*)actionCollection->addAction(QStringLiteral("ExposeAll"));
b->setText(i18n("Toggle Present Windows (All desktops)"));
b->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F10));
shortcutAll = b->globalShortcut();
connect(b, SIGNAL(triggered(bool)), this, SLOT(toggleActiveAllDesktops()));
connect(b, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChangedAll(QKeySequence)));
KAction* c = (KAction*)actionCollection->addAction("ExposeClass");
KAction* c = (KAction*)actionCollection->addAction(QStringLiteral("ExposeClass"));
c->setText(i18n("Toggle Present Windows (Window class)"));
c->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F7));
connect(c, SIGNAL(triggered(bool)), this, SLOT(toggleActiveClass()));
@ -566,7 +566,7 @@ void PresentWindowsEffect::windowInputMouseEvent(QEvent *e)
m_dragInProgress = false;
m_dragWindow = NULL;
if (m_highlightedDropTarget) {
KIcon icon("user-trash");
KIcon icon(QStringLiteral("user-trash"));
m_highlightedDropTarget->setIcon(icon.pixmap(QSize(128, 128), QIcon::Normal));
m_highlightedDropTarget = NULL;
}
@ -606,7 +606,7 @@ void PresentWindowsEffect::windowInputMouseEvent(QEvent *e)
m_dragWindow = NULL;
if (m_highlightedDropTarget) {
effects->addRepaint(m_highlightedDropTarget->geometry());
KIcon icon("user-trash");
KIcon icon(QStringLiteral("user-trash"));
m_highlightedDropTarget->setIcon(icon.pixmap(QSize(128, 128), QIcon::Normal));
m_highlightedDropTarget = NULL;
}
@ -637,12 +637,12 @@ void PresentWindowsEffect::windowInputMouseEvent(QEvent *e)
}
if (target && !m_highlightedDropTarget) {
m_highlightedDropTarget = target;
KIcon icon("user-trash");
KIcon icon(QStringLiteral("user-trash"));
effects->addRepaint(m_highlightedDropTarget->geometry());
m_highlightedDropTarget->setIcon(icon.pixmap(QSize(128, 128), QIcon::Active));
effects->defineCursor(Qt::DragMoveCursor);
} else if (!target && m_highlightedDropTarget) {
KIcon icon("user-trash");
KIcon icon(QStringLiteral("user-trash"));
effects->addRepaint(m_highlightedDropTarget->geometry());
m_highlightedDropTarget->setIcon(icon.pixmap(QSize(128, 128), QIcon::Normal));
m_highlightedDropTarget = NULL;
@ -1925,7 +1925,7 @@ void PresentWindowsEffect::screenCountChanged()
if (m_dragToClose) {
const QRect screenRect = effects->clientArea(FullScreenArea, i, 1);
EffectFrame *frame = effects->effectFrame(EffectFrameNone, false);
KIcon icon("user-trash");
KIcon icon(QStringLiteral("user-trash"));
frame->setIcon(icon.pixmap(QSize(128, 128)));
frame->setPosition(QPoint(screenRect.x() + screenRect.width(), screenRect.y()));
frame->setAlignment(Qt::AlignRight | Qt::AlignTop);
@ -1947,7 +1947,7 @@ CloseWindowView::CloseWindowView(QWidget *parent)
QPalette pal = palette();
pal.setColor(backgroundRole(), Qt::transparent);
setPalette(pal);
foreach (const QString &importPath, KGlobal::dirs()->findDirs("module", "imports")) {
for (const QString &importPath : KGlobal::dirs()->findDirs("module", QStringLiteral("imports"))) {
engine()->addImportPath(importPath);
}
KDeclarative kdeclarative;
@ -1955,10 +1955,10 @@ CloseWindowView::CloseWindowView(QWidget *parent)
kdeclarative.initialize();
kdeclarative.setupBindings();
rootContext()->setContextProperty("armed", QVariant(false));
rootContext()->setContextProperty(QStringLiteral("armed"), QVariant(false));
setSource(QUrl(KStandardDirs::locate("data", QLatin1String("kwin/effects/presentwindows/main.qml"))));
if (QObject *item = rootObject()->findChild<QObject*>("closeButton")) {
setSource(QUrl(KStandardDirs::locate("data", QStringLiteral("kwin/effects/presentwindows/main.qml"))));
if (QObject *item = rootObject()->findChild<QObject*>(QStringLiteral("closeButton"))) {
connect(item, SIGNAL(clicked()), SIGNAL(close()));
}
@ -1985,12 +1985,12 @@ void CloseWindowView::windowInputMouseEvent(QMouseEvent *e)
void CloseWindowView::arm()
{
rootContext()->setContextProperty("armed", QVariant(true));
rootContext()->setContextProperty(QStringLiteral("armed"), QVariant(true));
}
void CloseWindowView::disarm()
{
rootContext()->setContextProperty("armed", QVariant(false));
rootContext()->setContextProperty(QStringLiteral("armed"), QVariant(false));
m_armTimer->start();
}

View file

@ -52,20 +52,20 @@ PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QV
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection->setConfigGroup("PresentWindows");
m_actionCollection->setConfigGroup(QStringLiteral("PresentWindows"));
m_actionCollection->setConfigGlobal(true);
KAction* a = (KAction*) m_actionCollection->addAction("ExposeAll");
KAction* a = (KAction*) m_actionCollection->addAction(QStringLiteral("ExposeAll"));
a->setText(i18n("Toggle Present Windows (All desktops)"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F10));
KAction* b = (KAction*) m_actionCollection->addAction("Expose");
KAction* b = (KAction*) m_actionCollection->addAction(QStringLiteral("Expose"));
b->setText(i18n("Toggle Present Windows (Current desktop)"));
b->setProperty("isConfigurationAction", true);
b->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F9));
KAction* c = (KAction*)m_actionCollection->addAction("ExposeClass");
KAction* c = (KAction*)m_actionCollection->addAction(QStringLiteral("ExposeClass"));
c->setText(i18n("Toggle Present Windows (Window class)"));
c->setProperty("isConfigurationAction", true);
c->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F7));
@ -89,7 +89,7 @@ void PresentWindowsEffectConfig::save()
{
KCModule::save();
m_ui->shortcutEditor->save();
EffectsHandler::sendReloadMessage("presentwindows");
EffectsHandler::sendReloadMessage(QStringLiteral("presentwindows"));
}
void PresentWindowsEffectConfig::defaults()

View file

@ -54,7 +54,7 @@ ResizeEffectConfig::ResizeEffectConfig(QWidget* parent, const QVariantList& args
void ResizeEffectConfig::save()
{
KCModule::save();
EffectsHandler::sendReloadMessage("resize");
EffectsHandler::sendReloadMessage(QStringLiteral("resize"));
}
} // namespace

View file

@ -42,7 +42,7 @@ ScreenEdgeEffect::ScreenEdgeEffect()
, m_glow(new Plasma::Svg(this))
, m_cleanupTimer(new QTimer(this))
{
m_glow->setImagePath("widgets/glowbar");
m_glow->setImagePath(QStringLiteral("widgets/glowbar"));
connect(effects, SIGNAL(screenEdgeApproaching(ElectricBorder,qreal,QRect)), SLOT(edgeApproaching(ElectricBorder,qreal,QRect)));
m_cleanupTimer->setInterval(5000);
m_cleanupTimer->setSingleShot(true);
@ -218,13 +218,13 @@ T *ScreenEdgeEffect::createCornerGlow(ElectricBorder border)
{
switch (border) {
case ElectricTopLeft:
return new T(m_glow->pixmap("bottomright"));
return new T(m_glow->pixmap(QStringLiteral("bottomright")));
case ElectricTopRight:
return new T(m_glow->pixmap("bottomleft"));
return new T(m_glow->pixmap(QStringLiteral("bottomleft")));
case ElectricBottomRight:
return new T(m_glow->pixmap("topleft"));
return new T(m_glow->pixmap(QStringLiteral("topleft")));
case ElectricBottomLeft:
return new T(m_glow->pixmap("topright"));
return new T(m_glow->pixmap(QStringLiteral("topright")));
default:
return NULL;
}
@ -234,13 +234,13 @@ QSize ScreenEdgeEffect::cornerGlowSize(ElectricBorder border) const
{
switch (border) {
case ElectricTopLeft:
return m_glow->elementSize("bottomright");
return m_glow->elementSize(QStringLiteral("bottomright"));
case ElectricTopRight:
return m_glow->elementSize("bottomleft");
return m_glow->elementSize(QStringLiteral("bottomleft"));
case ElectricBottomRight:
return m_glow->elementSize("topleft");
return m_glow->elementSize(QStringLiteral("topleft"));
case ElectricBottomLeft:
return m_glow->elementSize("topright");
return m_glow->elementSize(QStringLiteral("topright"));
default:
return QSize();
}
@ -253,25 +253,25 @@ T *ScreenEdgeEffect::createEdgeGlow(ElectricBorder border, const QSize &size)
QPixmap l, r, c;
switch (border) {
case ElectricTop:
l = m_glow->pixmap("bottomleft");
r = m_glow->pixmap("bottomright");
c = m_glow->pixmap("bottom");
l = m_glow->pixmap(QStringLiteral("bottomleft"));
r = m_glow->pixmap(QStringLiteral("bottomright"));
c = m_glow->pixmap(QStringLiteral("bottom"));
break;
case ElectricBottom:
l = m_glow->pixmap("topleft");
r = m_glow->pixmap("topright");
c = m_glow->pixmap("top");
l = m_glow->pixmap(QStringLiteral("topleft"));
r = m_glow->pixmap(QStringLiteral("topright"));
c = m_glow->pixmap(QStringLiteral("top"));
pixmapPosition = QPoint(0, size.height() - c.height());
break;
case ElectricLeft:
l = m_glow->pixmap("topright");
r = m_glow->pixmap("bottomright");
c = m_glow->pixmap("right");
l = m_glow->pixmap(QStringLiteral("topright"));
r = m_glow->pixmap(QStringLiteral("bottomright"));
c = m_glow->pixmap(QStringLiteral("right"));
break;
case ElectricRight:
l = m_glow->pixmap("topleft");
r = m_glow->pixmap("bottomleft");
c = m_glow->pixmap("left");
l = m_glow->pixmap(QStringLiteral("topleft"));
r = m_glow->pixmap(QStringLiteral("bottomleft"));
c = m_glow->pixmap(QStringLiteral("left"));
pixmapPosition = QPoint(size.width() - c.width(), 0);
break;
default:

View file

@ -45,14 +45,14 @@ ScreenShotEffect::ScreenShotEffect()
: m_scheduledScreenshot(0)
{
connect ( effects, SIGNAL(windowClosed(KWin::EffectWindow*)), SLOT(windowClosed(KWin::EffectWindow*)) );
QDBusConnection::sessionBus().registerObject("/Screenshot", this, QDBusConnection::ExportScriptableContents);
QDBusConnection::sessionBus().registerService("org.kde.kwin.Screenshot");
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Screenshot"), this, QDBusConnection::ExportScriptableContents);
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.kwin.Screenshot"));
}
ScreenShotEffect::~ScreenShotEffect()
{
QDBusConnection::sessionBus().unregisterObject("/Screenshot");
QDBusConnection::sessionBus().unregisterService("org.kde.kwin.Screenshot");
QDBusConnection::sessionBus().unregisterObject(QStringLiteral("/Screenshot"));
QDBusConnection::sessionBus().unregisterService(QStringLiteral("org.kde.kwin.Screenshot"));
}
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
@ -305,7 +305,7 @@ QString ScreenShotEffect::blitScreenshot(const QRect &geometry)
}
KTemporaryFile temp;
temp.setSuffix(".png");
temp.setSuffix(QStringLiteral(".png"));
temp.setAutoRemove(false);
if (!temp.open()) {
return QString();

View file

@ -54,7 +54,7 @@ ShowFpsEffectConfig::~ShowFpsEffectConfig()
void ShowFpsEffectConfig::save()
{
KCModule::save();
EffectsHandler::sendReloadMessage("showfps");
EffectsHandler::sendReloadMessage(QStringLiteral("showfps"));
}
} // namespace

View file

@ -46,9 +46,9 @@ SlidingPopupsEffect::~SlidingPopupsEffect()
void SlidingPopupsEffect::reconfigure(ReconfigureFlags flags)
{
Q_UNUSED(flags)
KConfigGroup conf = effects->effectConfig("SlidingPopups");
mFadeInTime = animationTime(conf, "SlideInTime", 250);
mFadeOutTime = animationTime(conf, "SlideOutTime", 250);
KConfigGroup conf = effects->effectConfig(QStringLiteral("SlidingPopups"));
mFadeInTime = animationTime(conf, QStringLiteral("SlideInTime"), 250);
mFadeOutTime = animationTime(conf, QStringLiteral("SlideOutTime"), 250);
QHash< const EffectWindow*, QTimeLine* >::iterator it = mAppearingWindows.begin();
while (it != mAppearingWindows.end()) {
it.value()->setDuration(animationTime(mFadeInTime));

View file

@ -115,7 +115,7 @@ bool StartupFeedbackEffect::supported()
void StartupFeedbackEffect::reconfigure(Effect::ReconfigureFlags flags)
{
Q_UNUSED(flags)
KConfig conf("klaunchrc", KConfig::NoGlobals);
KConfig conf(QStringLiteral("klaunchrc"), KConfig::NoGlobals);
KConfigGroup c = conf.group("FeedbackStyle");
const bool busyCursor = c.readEntry("BusyCursor", true);
@ -132,7 +132,7 @@ void StartupFeedbackEffect::reconfigure(Effect::ReconfigureFlags flags)
if (effects->compositingType() == OpenGL2Compositing) {
delete m_blinkingShader;
m_blinkingShader = 0;
const QString shader = KGlobal::dirs()->findResource("data", "kwin/blinking-startup-fragment.glsl");
const QString shader = KGlobal::dirs()->findResource("data", QStringLiteral("kwin/blinking-startup-fragment.glsl"));
m_blinkingShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::SimpleShader, shader);
if (m_blinkingShader->isValid()) {
kDebug(1212) << "Blinking Shader is valid";
@ -321,7 +321,7 @@ void StartupFeedbackEffect::start(const QString& icon)
QPixmap iconPixmap = KIconLoader::global()->loadIcon(icon, KIconLoader::Small, 0,
KIconLoader::DefaultState, QStringList(), 0, true); // return null pixmap if not found
if (iconPixmap.isNull())
iconPixmap = SmallIcon("system-run");
iconPixmap = SmallIcon(QStringLiteral("system-run"));
prepareTextures(iconPixmap);
m_dirtyRect = m_currentGeometry = feedbackRect();
effects->addRepaintFull();

View file

@ -35,7 +35,7 @@ KWIN_EFFECT(thumbnailaside, ThumbnailAsideEffect)
ThumbnailAsideEffect::ThumbnailAsideEffect()
{
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = (KAction*)actionCollection->addAction("ToggleCurrentThumbnail");
KAction* a = (KAction*)actionCollection->addAction(QStringLiteral("ToggleCurrentThumbnail"));
a->setText(i18n("Toggle Thumbnail for Current Window"));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_T));
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleCurrentThumbnail()));

View file

@ -60,10 +60,10 @@ ThumbnailAsideEffectConfig::ThumbnailAsideEffectConfig(QWidget* parent, const QV
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection->setConfigGroup("ThumbnailAside");
m_actionCollection->setConfigGroup(QStringLiteral("ThumbnailAside"));
m_actionCollection->setConfigGlobal(true);
KAction* a = (KAction*)m_actionCollection->addAction("ToggleCurrentThumbnail");
KAction* a = (KAction*)m_actionCollection->addAction(QStringLiteral("ToggleCurrentThumbnail"));
a->setText(i18n("Toggle Thumbnail for Current Window"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::CTRL + Qt::Key_T));
@ -82,7 +82,7 @@ ThumbnailAsideEffectConfig::~ThumbnailAsideEffectConfig()
void ThumbnailAsideEffectConfig::save()
{
KCModule::save();
EffectsHandler::sendReloadMessage("thumbnailaside");
EffectsHandler::sendReloadMessage(QStringLiteral("thumbnailaside"));
}
} // namespace

View file

@ -61,7 +61,7 @@ TrackMouseEffect::TrackMouseEffect()
m_angleBase = 90.0;
m_mousePolling = false;
KActionCollection *actionCollection = new KActionCollection(this);
m_action = static_cast< KAction* >(actionCollection->addAction("TrackMouse"));
m_action = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("TrackMouse")));
m_action->setText(i18n("Track mouse"));
m_action->setGlobalShortcut(KShortcut());
@ -245,8 +245,8 @@ void TrackMouseEffect::slotMouseChanged(const QPoint&, const QPoint&,
void TrackMouseEffect::loadTexture()
{
QString f[2] = {KGlobal::dirs()->findResource("appdata", "tm_outer.png"),
KGlobal::dirs()->findResource("appdata", "tm_inner.png")};
QString f[2] = {KGlobal::dirs()->findResource("appdata", QStringLiteral("tm_outer.png")),
KGlobal::dirs()->findResource("appdata", QStringLiteral("tm_inner.png"))};
if (f[0].isEmpty() || f[1].isEmpty())
return;

View file

@ -56,10 +56,10 @@ TrackMouseEffectConfig::TrackMouseEffectConfig(QWidget* parent, const QVariantLi
addConfig(TrackMouseConfig::self(), m_ui);
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection->setConfigGroup("TrackMouse");
m_actionCollection->setConfigGroup(QStringLiteral("TrackMouse"));
m_actionCollection->setConfigGlobal(true);
KAction *a = static_cast< KAction* >(m_actionCollection->addAction("TrackMouse"));
KAction *a = static_cast< KAction* >(m_actionCollection->addAction(QStringLiteral("TrackMouse")));
a->setText(i18n("Track mouse"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut());
@ -84,7 +84,7 @@ void TrackMouseEffectConfig::checkModifiers()
void TrackMouseEffectConfig::load()
{
KCModule::load();
if (KAction *a = qobject_cast<KAction*>(m_actionCollection->action("TrackMouse")))
if (KAction *a = qobject_cast<KAction*>(m_actionCollection->action(QStringLiteral("TrackMouse"))))
m_ui->shortcut->setKeySequence(a->globalShortcut().primary());
checkModifiers();
@ -95,7 +95,7 @@ void TrackMouseEffectConfig::save()
{
KCModule::save();
m_actionCollection->writeSettings();
EffectsHandler::sendReloadMessage("trackmouse");
EffectsHandler::sendReloadMessage(QStringLiteral("trackmouse"));
}
void TrackMouseEffectConfig::defaults()
@ -107,7 +107,7 @@ void TrackMouseEffectConfig::defaults()
void TrackMouseEffectConfig::shortcutChanged(const QKeySequence &seq)
{
if (KAction *a = qobject_cast<KAction*>(m_actionCollection->action("TrackMouse")))
if (KAction *a = qobject_cast<KAction*>(m_actionCollection->action(QStringLiteral("TrackMouse"))))
a->setGlobalShortcut(KShortcut(seq), KAction::ActiveShortcut, KAction::NoAutoloading);
// m_actionCollection->writeSettings();
emit changed(true);

View file

@ -61,7 +61,7 @@ WindowGeometry::WindowGeometry()
myMeasure[2]->setAlignment(Qt::AlignRight | Qt::AlignBottom);
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = static_cast< KAction* >(actionCollection->addAction("WindowGeometry"));
KAction* a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("WindowGeometry")));
a->setText(i18n("Toggle window geometry display (effect only)"));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_F11));
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggle()));
@ -130,12 +130,12 @@ static inline QString number(int n)
QString sign;
if (n >= 0) {
sign = KGlobal::locale()->positiveSign();
if (sign.isEmpty()) sign = '+';
if (sign.isEmpty()) sign = QStringLiteral("+");
}
else {
n = -n;
sign = KGlobal::locale()->negativeSign();
if (sign.isEmpty()) sign = '-';
if (sign.isEmpty()) sign = QStringLiteral("-");
}
return sign + QString::number(n);
}

View file

@ -45,7 +45,7 @@ WindowGeometryConfig::WindowGeometryConfig(QWidget* parent, const QVariantList&
// Shortcut config. The shortcut belongs to the component "kwin"!
myActionCollection = new KActionCollection(this, KComponentData("kwin"));
KAction* a = (KAction*)myActionCollection->addAction("WindowGeometry");
KAction* a = (KAction*)myActionCollection->addAction(QStringLiteral("WindowGeometry"));
a->setText(i18n("Toggle KWin composited geometry display"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_F11));
@ -68,7 +68,7 @@ void WindowGeometryConfig::save()
{
KCModule::save();
myUi->shortcuts->save(); // undo() will restore to this state from now on
EffectsHandler::sendReloadMessage("windowgeometry");
EffectsHandler::sendReloadMessage(QStringLiteral("windowgeometry"));
}
void WindowGeometryConfig::defaults()

View file

@ -177,7 +177,7 @@ void WobblyWindowsEffect::reconfigure(ReconfigureFlags)
WobblyWindowsConfig::self()->readConfig();
QString settingsMode = WobblyWindowsConfig::settings();
if (settingsMode != "Custom") {
if (settingsMode != QStringLiteral("Custom")) {
unsigned int wobblynessLevel = WobblyWindowsConfig::wobblynessLevel();
if (wobblynessLevel > 4) {
kDebug(1212) << "Wrong value for \"WobblynessLevel\" : " << wobblynessLevel;

View file

@ -97,7 +97,7 @@ void WobblyWindowsEffectConfig::save()
{
KCModule::save();
EffectsHandler::sendReloadMessage("wobblywindows");
EffectsHandler::sendReloadMessage(QStringLiteral("wobblywindows"));
}
void WobblyWindowsEffectConfig::wobblinessChanged()

View file

@ -75,33 +75,33 @@ ZoomEffect::ZoomEffect()
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ActualSize, this, SLOT(actualSize())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
a = static_cast< KAction* >(actionCollection->addAction("MoveZoomLeft"));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveZoomLeft")));
a->setText(i18n("Move Zoomed Area to Left"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Left));
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomLeft()));
a = static_cast< KAction* >(actionCollection->addAction("MoveZoomRight"));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveZoomRight")));
a->setText(i18n("Move Zoomed Area to Right"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Right));
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomRight()));
a = static_cast< KAction* >(actionCollection->addAction("MoveZoomUp"));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveZoomUp")));
a->setText(i18n("Move Zoomed Area Upwards"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Up));
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomUp()));
a = static_cast< KAction* >(actionCollection->addAction("MoveZoomDown"));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveZoomDown")));
a->setText(i18n("Move Zoomed Area Downwards"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Down));
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomDown()));
// TODO: these two actions don't belong into the effect. They need to be moved into KWin core
a = static_cast< KAction* >(actionCollection->addAction("MoveMouseToFocus"));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveMouseToFocus")));
a->setText(i18n("Move Mouse to Focus"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F5));
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveMouseToFocus()));
a = static_cast< KAction* >(actionCollection->addAction("MoveMouseToCenter"));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveMouseToCenter")));
a->setText(i18n("Move Mouse to Center"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F6));
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveMouseToCenter()));
@ -121,7 +121,7 @@ ZoomEffect::~ZoomEffect()
// switch off and free resources
showCursor();
// Save the zoom value.
KConfigGroup conf = EffectsHandler::effectConfig("Zoom");
KConfigGroup conf = EffectsHandler::effectConfig(QStringLiteral("Zoom"));
conf.writeEntry("InitialZoom", target_zoom);
conf.sync();
}
@ -164,7 +164,7 @@ void ZoomEffect::hideCursor()
void ZoomEffect::recreateTexture()
{
// read details about the mouse-cursor theme define per default
KConfigGroup mousecfg(KSharedConfig::openConfig("kcminputrc"), "Mouse");
KConfigGroup mousecfg(KSharedConfig::openConfig(QStringLiteral("kcminputrc")), "Mouse");
QString theme = mousecfg.readEntry("cursorTheme", QString());
QString size = mousecfg.readEntry("cursorSize", QString());
@ -175,7 +175,7 @@ void ZoomEffect::recreateTexture()
iconSize = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize);
// load the cursor-theme image from the Xcursor-library
XcursorImage *ximg = XcursorLibraryLoadImage("left_ptr", theme.toLocal8Bit(), iconSize);
XcursorImage *ximg = XcursorLibraryLoadImage("left_ptr", theme.toLocal8Bit().constData(), iconSize);
if (!ximg) // default is better then nothing, so keep it as backup
ximg = XcursorLibraryLoadImage("left_ptr", "default", iconSize);
if (ximg) {
@ -212,9 +212,17 @@ void ZoomEffect::reconfigure(ReconfigureFlags)
enableFocusTracking = _enableFocusTracking;
if (QDBusConnection::sessionBus().isConnected()) {
if (enableFocusTracking)
QDBusConnection::sessionBus().connect("org.kde.kaccessibleapp", "/Adaptor", "org.kde.kaccessibleapp.Adaptor", "focusChanged", this, SLOT(focusChanged(int,int,int,int,int,int)));
QDBusConnection::sessionBus().connect(QStringLiteral("org.kde.kaccessibleapp"),
QStringLiteral("/Adaptor"),
QStringLiteral("org.kde.kaccessibleapp.Adaptor"),
QStringLiteral("focusChanged"),
this, SLOT(focusChanged(int,int,int,int,int,int)));
else
QDBusConnection::sessionBus().disconnect("org.kde.kaccessibleapp", "/Adaptor", "org.kde.kaccessibleapp.Adaptor", "focusChanged", this, SLOT(focusChanged(int,int,int,int,int,int)));
QDBusConnection::sessionBus().disconnect(QStringLiteral("org.kde.kaccessibleapp"),
QStringLiteral("/Adaptor"),
QStringLiteral("org.kde.kaccessibleapp.Adaptor"),
QStringLiteral("focusChanged"),
this, SLOT(focusChanged(int,int,int,int,int,int)));
}
}
// When the focus changes, move the zoom area to the focused location.

View file

@ -55,7 +55,7 @@ ZoomEffectConfig::ZoomEffectConfig(QWidget* parent, const QVariantList& args) :
// Shortcut config. The shortcut belongs to the component "kwin"!
KActionCollection *actionCollection = new KActionCollection(this, KComponentData("kwin"));
actionCollection->setConfigGroup("Zoom");
actionCollection->setConfigGroup(QStringLiteral("Zoom"));
actionCollection->setConfigGlobal(true);
KAction* a;
@ -71,38 +71,38 @@ ZoomEffectConfig::ZoomEffectConfig(QWidget* parent, const QVariantList& args) :
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
a = static_cast< KAction* >(actionCollection->addAction("MoveZoomLeft"));
a->setIcon(KIcon("go-previous"));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveZoomLeft")));
a->setIcon(KIcon(QStringLiteral("go-previous")));
a->setText(i18n("Move Left"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Left));
a = static_cast< KAction* >(actionCollection->addAction("MoveZoomRight"));
a->setIcon(KIcon("go-next"));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveZoomRight")));
a->setIcon(KIcon(QStringLiteral("go-next")));
a->setText(i18n("Move Right"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Right));
a = static_cast< KAction* >(actionCollection->addAction("MoveZoomUp"));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveZoomUp")));
a->setIcon(KIcon("go-up"));
a->setText(i18n("Move Up"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Up));
a = static_cast< KAction* >(actionCollection->addAction("MoveZoomDown"));
a->setIcon(KIcon("go-down"));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveZoomDown")));
a->setIcon(KIcon(QStringLiteral("go-down")));
a->setText(i18n("Move Down"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Down));
a = static_cast< KAction* >(actionCollection->addAction("MoveMouseToFocus"));
a->setIcon(KIcon("view-restore"));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveMouseToFocus")));
a->setIcon(KIcon(QStringLiteral("view-restore")));
a->setText(i18n("Move Mouse to Focus"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F5));
a = static_cast< KAction* >(actionCollection->addAction("MoveMouseToCenter"));
a->setIcon(KIcon("view-restore"));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveMouseToCenter")));
a->setIcon(KIcon(QStringLiteral("view-restore")));
a->setText(i18n("Move Mouse to Center"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F6));
@ -121,7 +121,7 @@ void ZoomEffectConfig::save()
{
m_ui->editor->save(); // undo() will restore to this state from now on
KCModule::save();
EffectsHandler::sendReloadMessage("zoom");
EffectsHandler::sendReloadMessage(QStringLiteral("zoom"));
}
} // namespace

View file

@ -59,23 +59,23 @@ static bool gs_tripleBufferNeedsDetection = false;
void EglOnXBackend::init()
{
if (!initRenderingContext()) {
setFailed("Could not initialize rendering context");
setFailed(QStringLiteral("Could not initialize rendering context"));
return;
}
initEGL();
if (!hasGLExtension("EGL_KHR_image") &&
(!hasGLExtension("EGL_KHR_image_base") ||
!hasGLExtension("EGL_KHR_image_pixmap"))) {
setFailed("Required support for binding pixmaps to EGLImages not found, disabling compositing");
if (!hasGLExtension(QStringLiteral("EGL_KHR_image")) &&
(!hasGLExtension(QStringLiteral("EGL_KHR_image_base")) ||
!hasGLExtension(QStringLiteral("EGL_KHR_image_pixmap")))) {
setFailed(QStringLiteral("Required support for binding pixmaps to EGLImages not found, disabling compositing"));
return;
}
GLPlatform *glPlatform = GLPlatform::instance();
glPlatform->detect(EglPlatformInterface);
glPlatform->printResults();
initGL(EglPlatformInterface);
if (!hasGLExtension("GL_OES_EGL_image")) {
setFailed("Required extension GL_OES_EGL_image not found, disabling compositing");
if (!hasGLExtension(QStringLiteral("GL_OES_EGL_image"))) {
setFailed(QStringLiteral("Required extension GL_OES_EGL_image not found, disabling compositing"));
return;
}
@ -84,7 +84,7 @@ void EglOnXBackend::init()
if (eglQuerySurface(dpy, surface, EGL_POST_SUB_BUFFER_SUPPORTED_NV, &surfaceHasSubPost) == EGL_FALSE) {
EGLint error = eglGetError();
if (error != EGL_SUCCESS && error != EGL_BAD_ATTRIBUTE) {
setFailed("query surface failed");
setFailed(QStringLiteral("query surface failed"));
return;
} else {
surfaceHasSubPost = EGL_FALSE;

View file

@ -77,19 +77,19 @@ void GlxBackend::init()
initGLX();
// require at least GLX 1.3
if (!hasGLXVersion(1, 3)) {
setFailed("Requires at least GLX 1.3");
setFailed(QStringLiteral("Requires at least GLX 1.3"));
return;
}
if (!initDrawableConfigs()) {
setFailed("Could not initialize the drawable configs");
setFailed(QStringLiteral("Could not initialize the drawable configs"));
return;
}
if (!initBuffer()) {
setFailed("Could not initialize the buffer");
setFailed(QStringLiteral("Could not initialize the buffer"));
return;
}
if (!initRenderingContext()) {
setFailed("Could not initialize rendering context");
setFailed(QStringLiteral("Could not initialize rendering context"));
return;
}
// Initialize OpenGL
@ -172,7 +172,7 @@ bool GlxBackend::initRenderingContext()
0
};
const bool have_robustness = hasGLExtension("GLX_ARB_create_context_robustness");
const bool have_robustness = hasGLExtension(QStringLiteral("GLX_ARB_create_context_robustness"));
// Try to create a 3.1 context first
if (options->glCoreProfile()) {

View file

@ -437,8 +437,8 @@ void Workspace::checkTransients(xcb_window_t w)
bool Toplevel::resourceMatch(const Toplevel* c1, const Toplevel* c2)
{
// xv has "xv" as resource name, and different strings starting with "XV" as resource class
if (qstrncmp(c1->resourceClass(), "xv", 2) == 0 && c1->resourceName() == "xv")
return qstrncmp(c2->resourceClass(), "xv", 2) == 0 && c2->resourceName() == "xv";
if (qstrncmp(c1->resourceClass().constData(), "xv", 2) == 0 && c1->resourceName() == "xv")
return qstrncmp(c2->resourceClass().constData(), "xv", 2) == 0 && c2->resourceName() == "xv";
// Mozilla has "Mozilla" as resource name, and different strings as resource class
if (c1->resourceName() == "mozilla")
return c2->resourceName() == "mozilla";

View file

@ -52,7 +52,7 @@ int main(int argc, char* argv[])
options.add("timestamp <time>", ki18n("Time of user action causing termination"));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
KApplication::setWindowIcon(KIcon("kwin"));
KApplication::setWindowIcon(KIcon(QStringLiteral("kwin")));
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
QString hostname = args->getOption("hostname");
bool pid_ok = false;
@ -69,7 +69,7 @@ int main(int argc, char* argv[])
KCmdLineArgs::usageError(i18n("This helper utility is not supposed to be called directly."));
return 1;
}
bool isLocal = hostname == "localhost";
bool isLocal = hostname == QStringLiteral("localhost");
caption = Qt::escape(caption);
appname = Qt::escape(appname);
@ -87,21 +87,21 @@ int main(int argc, char* argv[])
"<para><warning>Terminating the application will close all of its child windows. Any unsaved data will be lost.</warning></para>"
);
KGuiItem continueButton = KGuiItem(i18n("&Terminate Application %1", appname), "edit-bomb");
KGuiItem cancelButton = KGuiItem(i18n("Wait Longer"), "chronometer");
KGuiItem continueButton = KGuiItem(i18n("&Terminate Application %1", appname), QStringLiteral("edit-bomb"));
KGuiItem cancelButton = KGuiItem(i18n("Wait Longer"), QStringLiteral("chronometer"));
app.updateUserTimestamp(timestamp);
if (KMessageBox::warningContinueCancelWId(id, question, QString(), continueButton, cancelButton) == KMessageBox::Continue) {
if (!isLocal) {
QStringList lst;
lst << hostname << "kill" << QString::number(pid);
QProcess::startDetached("xon", lst);
lst << hostname << QStringLiteral("kill") << QString::number(pid);
QProcess::startDetached(QStringLiteral("xon"), lst);
} else {
if (::kill(pid, SIGKILL) && errno == EPERM) {
KAuth::Action killer("org.kde.ksysguard.processlisthelper.sendsignal");
killer.setHelperID("org.kde.ksysguard.processlisthelper");
killer.addArgument("pid0", pid);
killer.addArgument("pidcount", 1);
killer.addArgument("signal", SIGKILL);
KAuth::Action killer(QStringLiteral("org.kde.ksysguard.processlisthelper.sendsignal"));
killer.setHelperID(QStringLiteral("org.kde.ksysguard.processlisthelper"));
killer.addArgument(QStringLiteral("pid0"), pid);
killer.addArgument(QStringLiteral("pidcount"), 1);
killer.addArgument(QStringLiteral("signal"), SIGKILL);
if (killer.isValid()) {
kDebug(1212) << "Using KAuth to kill pid: " << pid;
killer.execute();

View file

@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// new DEF3 allows to pass data to the action, replacing the %1 argument in the name
#define DEF2( name, descr, key, fnSlot ) \
a = actionCollection->addAction( name ); \
a = actionCollection->addAction( QStringLiteral(name) ); \
a->setText( i18n(descr) ); \
qobject_cast<KAction*>( a )->setGlobalShortcut(KShortcut(key)); \
connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot));
@ -37,23 +37,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
DEF2(name, name, key, fnSlot)
#define DEF3( name, key, fnSlot, value ) \
a = actionCollection->addAction( QString(name).arg(value) ); \
a = actionCollection->addAction( QStringLiteral(name).arg(value) ); \
a->setText( i18n(name, value) ); \
qobject_cast<KAction*>( a )->setGlobalShortcut(KShortcut(key)); \
a->setData(value); \
connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot));
a = actionCollection->addAction("Program:kwin");
a = actionCollection->addAction(QStringLiteral("Program:kwin"));
a->setText(i18n("System"));
a = actionCollection->addAction("Group:Navigation");
a = actionCollection->addAction(QStringLiteral("Group:Navigation"));
a->setText(i18n("Navigation"));
DEF(I18N_NOOP("Walk Through Window Tabs"), 0, slotActivateNextTab());
DEF(I18N_NOOP("Walk Through Window Tabs (Reverse)"), 0, slotActivatePrevTab());
DEF(I18N_NOOP("Remove Window From Group"), 0, slotUntab());
a = actionCollection->addAction("Group:Windows");
a = actionCollection->addAction(QStringLiteral("Group:Windows"));
a->setText(i18n("Windows"));
DEF(I18N_NOOP("Window Operations Menu"),
Qt::ALT + Qt::Key_F3, slotWindowOperations());
@ -132,7 +132,7 @@ DEF2("Increase Opacity", I18N_NOOP("Increase Opacity of Active Window by 5 %"),
DEF2("Decrease Opacity", I18N_NOOP("Decrease Opacity of Active Window by 5 %"),
0, slotLowerWindowOpacity());
a = actionCollection->addAction("Group:Window Desktop");
a = actionCollection->addAction(QStringLiteral("Group:Window Desktop"));
a->setText(i18n("Window & Desktop"));
DEF2("Window On All Desktops", I18N_NOOP("Keep Window on All Desktops"),
0, slotWindowOnAllDesktops());
@ -161,7 +161,7 @@ for (int i = 0; i < 8; ++i) {
DEF(I18N_NOOP("Switch to Next Screen"), 0, slotSwitchToNextScreen());
DEF(I18N_NOOP("Switch to Previous Screen"), 0, slotSwitchToPrevScreen());
a = actionCollection->addAction("Group:Miscellaneous");
a = actionCollection->addAction(QStringLiteral("Group:Miscellaneous"));
a->setText(i18n("Miscellaneous"));
DEF(I18N_NOOP("Kill Window"), Qt::CTRL + Qt::ALT + Qt::Key_Escape, slotKillWindow());
DEF(I18N_NOOP("Suspend Compositing"), Qt::SHIFT + Qt::ALT + Qt::Key_F12, slotToggleCompositing());

View file

@ -86,8 +86,8 @@ void LanczosFilter::init()
}
m_shader.reset(ShaderManager::instance()->loadFragmentShader(ShaderManager::SimpleShader,
gl->glslVersion() >= kVersionNumber(1, 40) ?
":/resources/shaders/1.40/lanczos-fragment.glsl" :
":/resources/shaders/1.10/lanczos-fragment.glsl"));
QStringLiteral(":/resources/shaders/1.40/lanczos-fragment.glsl") :
QStringLiteral(":/resources/shaders/1.10/lanczos-fragment.glsl")));
if (m_shader->isValid()) {
ShaderBinder binder(m_shader.data());
m_uTexUnit = m_shader->uniformLocation("texUnit");

View file

@ -532,7 +532,7 @@ KDecorationDefines::Position KDecoration::titlebarPosition()
QString KDecorationDefines::tabDragMimeType()
{
return "text/ClientGroupItem";
return QStringLiteral("text/ClientGroupItem");
}
KDecorationOptions::KDecorationOptions()
@ -593,7 +593,7 @@ QString KDecorationOptions::titleButtonsLeft() const
QString KDecorationOptions::defaultTitleButtonsLeft()
{
return "MS";
return QStringLiteral("MS");
}
QString KDecorationOptions::titleButtonsRight() const
@ -603,7 +603,7 @@ QString KDecorationOptions::titleButtonsRight() const
QString KDecorationOptions::defaultTitleButtonsRight()
{
return "HIAX";
return QStringLiteral("HIAX");
}
bool KDecorationOptions::showTooltips() const

View file

@ -46,7 +46,7 @@ KDecorationPlugins::KDecorationPlugins(const KSharedConfigPtr &cfg)
fact(NULL),
old_library(NULL),
old_fact(NULL),
pluginStr("kwin3_undefined "),
pluginStr(QStringLiteral("kwin3_undefined ")),
config(cfg)
{
}
@ -75,7 +75,7 @@ bool KDecorationPlugins::reset(unsigned long changed)
QString oldPlugin = pluginStr;
config->reparseConfiguration();
bool ret = false;
if ((!loadPlugin("") && library) // "" = read the one in cfg file
if ((!loadPlugin(QString()) && library) // "" = read the one in cfg file
|| oldPlugin == pluginStr) {
// no new plugin loaded, reset the old one
// assert( fact != NULL );
@ -119,7 +119,7 @@ bool KDecorationPlugins::canLoad(QString nameStr, KLibrary **loadedLib)
return true;
}
KConfigGroup group(config, QString("Style"));
KConfigGroup group(config, QStringLiteral("Style"));
if (group.readEntry<bool>("NoPlugin", false)) {
error(i18n("Loading of window decoration plugin library disabled in configuration."));
return false;
@ -205,7 +205,7 @@ bool KDecorationPlugins::canLoad(QString nameStr, KLibrary **loadedLib)
// returns true if plugin was loaded successfully
bool KDecorationPlugins::loadPlugin(QString nameStr)
{
KConfigGroup group(config, QString("Style"));
KConfigGroup group(config, QStringLiteral("Style"));
if (nameStr.isEmpty()) {
nameStr = group.readEntry("PluginLib", defaultPlugin);
}

View file

@ -69,7 +69,7 @@ Qt::Corner KDecorationFactory::closeButtonCorner()
{
if (d->closeButtonCorner)
return d->closeButtonCorner;
return options()->titleButtonsLeft().contains('X') ? Qt::TopLeftCorner : Qt::TopRightCorner;
return options()->titleButtonsLeft().contains(QStringLiteral("X")) ? Qt::TopLeftCorner : Qt::TopRightCorner;
}
void KDecorationFactory::setCloseButtonCorner(Qt::Corner cnr)

View file

@ -73,7 +73,7 @@ AniData::AniData(const AniData &other)
static FPx2 fpx2(const QString &s, AnimationEffect::Attribute a)
{
bool ok; float f1, f2;
QStringList floats = s.split(',');
QStringList floats = s.split(QStringLiteral(","));
f1 = floats.at(0).toFloat(&ok);
if (!ok || (f1 < 0.0 && !( a == AnimationEffect::Position ||
a == AnimationEffect::Translation ||
@ -106,21 +106,21 @@ AniData::AniData(const QString &str) // format: WindowMask:Attribute:Meta:Durati
duration = 1; // invalidate
customCurve = 0; // Linear
QStringList animation = str.split(':');
QStringList animation = str.split(u':');
if (animation.count() < 5)
return; // at least window type, attribute, metadata, time and target is required
windowType = (NET::WindowTypeMask)animation.at(0).toUInt();
if (animation.at(1) == "Opacity") attribute = AnimationEffect::Opacity;
else if (animation.at(1) == "Brightness") attribute = AnimationEffect::Brightness;
else if (animation.at(1) == "Saturation") attribute = AnimationEffect::Saturation;
else if (animation.at(1) == "Scale") attribute = AnimationEffect::Scale;
else if (animation.at(1) == "Translation") attribute = AnimationEffect::Translation;
else if (animation.at(1) == "Rotation") attribute = AnimationEffect::Rotation;
else if (animation.at(1) == "Position") attribute = AnimationEffect::Position;
else if (animation.at(1) == "Size") attribute = AnimationEffect::Size;
else if (animation.at(1) == "Clip") attribute = AnimationEffect::Clip;
if (animation.at(1) == QStringLiteral("Opacity")) attribute = AnimationEffect::Opacity;
else if (animation.at(1) == QStringLiteral("Brightness")) attribute = AnimationEffect::Brightness;
else if (animation.at(1) == QStringLiteral("Saturation")) attribute = AnimationEffect::Saturation;
else if (animation.at(1) == QStringLiteral("Scale")) attribute = AnimationEffect::Scale;
else if (animation.at(1) == QStringLiteral("Translation")) attribute = AnimationEffect::Translation;
else if (animation.at(1) == QStringLiteral("Rotation")) attribute = AnimationEffect::Rotation;
else if (animation.at(1) == QStringLiteral("Position")) attribute = AnimationEffect::Position;
else if (animation.at(1) == QStringLiteral("Size")) attribute = AnimationEffect::Size;
else if (animation.at(1) == QStringLiteral("Clip")) attribute = AnimationEffect::Clip;
else {
kDebug(1212) << "Invalid attribute" << animation.at(1);
return;
@ -167,23 +167,23 @@ AniData::AniData(const QString &str) // format: WindowMask:Attribute:Meta:Durati
static QString attributeString(KWin::AnimationEffect::Attribute attribute)
{
switch (attribute) {
case KWin::AnimationEffect::Opacity: return "Opacity";
case KWin::AnimationEffect::Brightness: return "Brightness";
case KWin::AnimationEffect::Saturation: return "Saturation";
case KWin::AnimationEffect::Scale: return "Scale";
case KWin::AnimationEffect::Translation: return "Translation";
case KWin::AnimationEffect::Rotation: return "Rotation";
case KWin::AnimationEffect::Position: return "Position";
case KWin::AnimationEffect::Size: return "Size";
case KWin::AnimationEffect::Clip: return "Clip";
default: return " ";
case KWin::AnimationEffect::Opacity: return QStringLiteral("Opacity");
case KWin::AnimationEffect::Brightness: return QStringLiteral("Brightness");
case KWin::AnimationEffect::Saturation: return QStringLiteral("Saturation");
case KWin::AnimationEffect::Scale: return QStringLiteral("Scale");
case KWin::AnimationEffect::Translation: return QStringLiteral("Translation");
case KWin::AnimationEffect::Rotation: return QStringLiteral("Rotation");
case KWin::AnimationEffect::Position: return QStringLiteral("Position");
case KWin::AnimationEffect::Size: return QStringLiteral("Size");
case KWin::AnimationEffect::Clip: return QStringLiteral("Clip");
default: return QStringLiteral(" ");
}
}
QList<AniData> AniData::list(const QString &str)
{
QList<AniData> newList;
QStringList list = str.split(';', QString::SkipEmptyParts);
QStringList list = str.split(u';', QString::SkipEmptyParts);
foreach (const QString &astr, list) {
newList << AniData(astr);
if (newList.last().duration < 0)
@ -194,20 +194,20 @@ QList<AniData> AniData::list(const QString &str)
QString AniData::toString() const
{
QString ret = QString::number((uint)windowType) + ':' + attributeString(attribute) + ':' +
QString::number(meta) + ':' + QString::number(duration) + ':' +
to.toString() + ':' + QString::number(customCurve) + ':' +
QString::number(time) + ':' + from.toString();
QString ret = QString::number((uint)windowType) + QStringLiteral(":") + attributeString(attribute) + QStringLiteral(":") +
QString::number(meta) + QStringLiteral(":") + QString::number(duration) + QStringLiteral(":") +
to.toString() + QStringLiteral(":") + QString::number(customCurve) + QStringLiteral(":") +
QString::number(time) + QStringLiteral(":") + from.toString();
return ret;
}
QString AniData::debugInfo() const
{
return "Animation: " + attributeString(attribute) + '\n' +
" From: " + from.toString() + '\n' +
" To: " + to.toString() + '\n' +
" Started: " + QString::number(AnimationEffect::clock() - startTime) + "ms ago\n" +
" Duration: " + QString::number(duration) + "ms\n" +
" Passed: " + QString::number(time) + "ms\n" +
" Applying: " + QString::number(windowType) + '\n';
return QStringLiteral("Animation: ") + attributeString(attribute) +
QStringLiteral("\n From: ") + from.toString() +
QStringLiteral("\n To: ") + to.toString() +
QStringLiteral("\n Started: ") + QString::number(AnimationEffect::clock() - startTime) + QStringLiteral("ms ago\n") +
QStringLiteral( " Duration: ") + QString::number(duration) + QStringLiteral("ms\n") +
QStringLiteral( " Passed: ") + QString::number(time) + QStringLiteral("ms\n") +
QStringLiteral( " Applying: ") + QString::number(windowType) + QStringLiteral("\n");
}

View file

@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
QDebug operator<<(QDebug dbg, const KWin::FPx2 &fpx2)
{
dbg.nospace() << fpx2[0] << "," << fpx2[1] << QString(fpx2.isValid() ? " (valid)" : " (invalid)");
dbg.nospace() << fpx2[0] << "," << fpx2[1] << QString(fpx2.isValid() ? QStringLiteral(" (valid)") : QStringLiteral(" (invalid)"));
return dbg.space();
}
@ -873,14 +873,14 @@ QString AnimationEffect::debug(const QString &/*parameter*/) const
Q_D(const AnimationEffect);
QString dbg;
if (d->m_animations.isEmpty())
dbg = "No window is animated";
dbg = QStringLiteral("No window is animated");
else {
AniMap::const_iterator entry = d->m_animations.constBegin(), mapEnd = d->m_animations.constEnd();
for (; entry != mapEnd; ++entry) {
QString caption = entry.key()->isDeleted() ? "[Deleted]" : entry.key()->caption();
QString caption = entry.key()->isDeleted() ? QStringLiteral("[Deleted]") : entry.key()->caption();
if (caption.isEmpty())
caption = "[Untitled]";
dbg += "Animating window: " + caption + '\n';
caption = QStringLiteral("[Untitled]");
dbg += QStringLiteral("Animating window: ") + caption + QStringLiteral("\n");
QList<AniData>::const_iterator anim = entry->first.constBegin(), animEnd = entry->first.constEnd();
for (; anim != animEnd; ++anim)
dbg += anim->debugInfo();

View file

@ -46,9 +46,9 @@ public:
inline QString toString() const {
QString ret;
if (valid)
ret = QString::number(f[0]) + ',' + QString::number(f[1]);
ret = QString::number(f[0]) + QStringLiteral(",") + QString::number(f[1]);
else
ret = QString("");
ret = QString();
return ret;
}

View file

@ -645,15 +645,18 @@ bool EffectsHandler::isOpenGLCompositing() const
void EffectsHandler::sendReloadMessage(const QString& effectname)
{
QDBusMessage message = QDBusMessage::createMethodCall("org.kde.kwin", "/KWin", "org.kde.KWin", "reconfigureEffect");
message << QString("kwin4_effect_" + effectname);
QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kwin"),
QStringLiteral("/KWin"),
QStringLiteral("org.kde.KWin"),
QStringLiteral("reconfigureEffect"));
message << QString(QStringLiteral("kwin4_effect_") + effectname);
QDBusConnection::sessionBus().send(message);
}
KConfigGroup EffectsHandler::effectConfig(const QString& effectname)
{
KSharedConfig::Ptr kwinconfig = KSharedConfig::openConfig(KWIN_CONFIG, KConfig::NoGlobals);
return kwinconfig->group("Effect-" + effectname);
KSharedConfig::Ptr kwinconfig = KSharedConfig::openConfig(QStringLiteral(KWIN_CONFIG), KConfig::NoGlobals);
return kwinconfig->group(QStringLiteral("Effect-") + effectname);
}
EffectsHandler* effects = 0;
@ -713,7 +716,7 @@ WINDOW_HELPER(QStringList, activities, "activities")
QString EffectWindow::windowClass() const
{
return parent()->property("resourceName").toString() + ' ' + parent()->property("resourceClass").toString();
return parent()->property("resourceName").toString() + QStringLiteral(" ") + parent()->property("resourceClass").toString();
}
QRect EffectWindow::contentsRect() const
@ -752,7 +755,7 @@ bool EffectWindow::isOnAllActivities() const
WINDOW_HELPER_DEFAULT(bool, isMinimized, "minimized", false)
WINDOW_HELPER_DEFAULT(bool, isMovable, "moveable", false)
WINDOW_HELPER_DEFAULT(bool, isMovableAcrossScreens, "moveableAcrossScreens", false)
WINDOW_HELPER_DEFAULT(QString, caption, "caption", "")
WINDOW_HELPER_DEFAULT(QString, caption, "caption", QString())
WINDOW_HELPER_DEFAULT(bool, keepAbove, "keepAbove", true)
WINDOW_HELPER_DEFAULT(bool, isModal, "modal", false)
WINDOW_HELPER_DEFAULT(QSize, basicUnit, "basicUnit", QSize(1, 1))

View file

@ -578,7 +578,7 @@ public Q_SLOTS:
* @see KWIN_EFFECT_CONFIG_MULTIPLE
*/
#define KWIN_EFFECT_CONFIG_SINGLE( name, classname ) \
registerPlugin<classname>(#name);
registerPlugin<classname>(QStringLiteral(#name));
/**
* The declaration of the factory to export the effect
*/

View file

@ -160,17 +160,17 @@ void ColorServerInterface::update()
QDBusPendingReply< uint > ColorServerInterface::getVersionInfo()
{
return QDBusPendingReply< uint >(asyncCall("getVersionInfo"));
return QDBusPendingReply< uint >(asyncCall(QStringLiteral("getVersionInfo")));
}
QDBusPendingReply< ClutList > ColorServerInterface::getOutputCluts()
{
return QDBusPendingReply< ClutList >(asyncCall("getOutputCluts"));
return QDBusPendingReply< ClutList >(asyncCall(QStringLiteral("getOutputCluts")));
}
QDBusPendingReply< RegionalClutMap > ColorServerInterface::getRegionCluts()
{
return QDBusPendingReply< RegionalClutMap >(asyncCall("getRegionCluts"));
return QDBusPendingReply< RegionalClutMap >(asyncCall(QStringLiteral("getRegionCluts")));
}
void ColorServerInterface::callFinishedSlot(QDBusPendingCallWatcher *watcher)
@ -271,8 +271,8 @@ ColorCorrectionPrivate::ColorCorrectionPrivate(ColorCorrection *parent)
// Establish a D-Bus communication interface with KolorServer
m_csi = new ColorServerInterface(
"org.kde.kded",
"/modules/kolorserver",
QStringLiteral("org.kde.kded"),
QStringLiteral("/modules/kolorserver"),
QDBusConnection::sessionBus(),
this);

View file

@ -42,12 +42,12 @@ static qint64 parseVersionString(const QByteArray &version)
{
// Skip any leading non digit
int start = 0;
while (start < version.length() && !QChar(version[start]).isDigit())
while (start < version.length() && !QChar::fromLatin1(version[start]).isDigit())
start++;
// Strip any non digit, non '.' characters from the end
int end = start;
while (end < version.length() && (version[end] == '.' || QChar(version[end]).isDigit()))
while (end < version.length() && (version[end] == '.' || QChar::fromLatin1(version[end]).isDigit()))
end++;
const QByteArray result = version.mid(start, end-start);
@ -105,85 +105,85 @@ static ChipClass detectRadeonClass(const QString &chipset)
if (chipset.isEmpty())
return UnknownRadeon;
if (chipset.contains("R100") ||
chipset.contains("RV100") ||
chipset.contains("RS100"))
if (chipset.contains(QStringLiteral("R100")) ||
chipset.contains(QStringLiteral("RV100")) ||
chipset.contains(QStringLiteral("RS100")))
return R100;
if (chipset.contains("RV200") ||
chipset.contains("RS200") ||
chipset.contains("R200") ||
chipset.contains("RV250") ||
chipset.contains("RS300") ||
chipset.contains("RV280"))
if (chipset.contains(QStringLiteral("RV200")) ||
chipset.contains(QStringLiteral("RS200")) ||
chipset.contains(QStringLiteral("R200")) ||
chipset.contains(QStringLiteral("RV250")) ||
chipset.contains(QStringLiteral("RS300")) ||
chipset.contains(QStringLiteral("RV280")))
return R200;
if (chipset.contains("R300") ||
chipset.contains("R350") ||
chipset.contains("R360") ||
chipset.contains("RV350") ||
chipset.contains("RV370") ||
chipset.contains("RV380"))
if (chipset.contains(QStringLiteral("R300")) ||
chipset.contains(QStringLiteral("R350")) ||
chipset.contains(QStringLiteral("R360")) ||
chipset.contains(QStringLiteral("RV350")) ||
chipset.contains(QStringLiteral("RV370")) ||
chipset.contains(QStringLiteral("RV380")))
return R300;
if (chipset.contains("R420") ||
chipset.contains("R423") ||
chipset.contains("R430") ||
chipset.contains("R480") ||
chipset.contains("R481") ||
chipset.contains("RV410") ||
chipset.contains("RS400") ||
chipset.contains("RC410") ||
chipset.contains("RS480") ||
chipset.contains("RS482") ||
chipset.contains("RS600") ||
chipset.contains("RS690") ||
chipset.contains("RS740"))
if (chipset.contains(QStringLiteral("R420")) ||
chipset.contains(QStringLiteral("R423")) ||
chipset.contains(QStringLiteral("R430")) ||
chipset.contains(QStringLiteral("R480")) ||
chipset.contains(QStringLiteral("R481")) ||
chipset.contains(QStringLiteral("RV410")) ||
chipset.contains(QStringLiteral("RS400")) ||
chipset.contains(QStringLiteral("RC410")) ||
chipset.contains(QStringLiteral("RS480")) ||
chipset.contains(QStringLiteral("RS482")) ||
chipset.contains(QStringLiteral("RS600")) ||
chipset.contains(QStringLiteral("RS690")) ||
chipset.contains(QStringLiteral("RS740")))
return R400;
if (chipset.contains("RV515") ||
chipset.contains("R520") ||
chipset.contains("RV530") ||
chipset.contains("R580") ||
chipset.contains("RV560") ||
chipset.contains("RV570"))
if (chipset.contains(QStringLiteral("RV515")) ||
chipset.contains(QStringLiteral("R520")) ||
chipset.contains(QStringLiteral("RV530")) ||
chipset.contains(QStringLiteral("R580")) ||
chipset.contains(QStringLiteral("RV560")) ||
chipset.contains(QStringLiteral("RV570")))
return R500;
if (chipset.contains("R600") ||
chipset.contains("RV610") ||
chipset.contains("RV630") ||
chipset.contains("RV670") ||
chipset.contains("RV620") ||
chipset.contains("RV635") ||
chipset.contains("RS780") ||
chipset.contains("RS880"))
if (chipset.contains(QStringLiteral("R600")) ||
chipset.contains(QStringLiteral("RV610")) ||
chipset.contains(QStringLiteral("RV630")) ||
chipset.contains(QStringLiteral("RV670")) ||
chipset.contains(QStringLiteral("RV620")) ||
chipset.contains(QStringLiteral("RV635")) ||
chipset.contains(QStringLiteral("RS780")) ||
chipset.contains(QStringLiteral("RS880")))
return R600;
if (chipset.contains("R700") ||
chipset.contains("RV770") ||
chipset.contains("RV730") ||
chipset.contains("RV710") ||
chipset.contains("RV740"))
if (chipset.contains(QStringLiteral("R700")) ||
chipset.contains(QStringLiteral("RV770")) ||
chipset.contains(QStringLiteral("RV730")) ||
chipset.contains(QStringLiteral("RV710")) ||
chipset.contains(QStringLiteral("RV740")))
return R700;
if (chipset.contains("EVERGREEN") || // Not an actual chipset, but returned by R600G in 7.9
chipset.contains("CEDAR") ||
chipset.contains("REDWOOD") ||
chipset.contains("JUNIPER") ||
chipset.contains("CYPRESS") ||
chipset.contains("HEMLOCK") ||
chipset.contains("PALM"))
if (chipset.contains(QStringLiteral("EVERGREEN")) || // Not an actual chipset, but returned by R600G in 7.9
chipset.contains(QStringLiteral("CEDAR")) ||
chipset.contains(QStringLiteral("REDWOOD")) ||
chipset.contains(QStringLiteral("JUNIPER")) ||
chipset.contains(QStringLiteral("CYPRESS")) ||
chipset.contains(QStringLiteral("HEMLOCK")) ||
chipset.contains(QStringLiteral("PALM")))
return Evergreen;
if (chipset.contains("SUMO") ||
chipset.contains("SUMO2") ||
chipset.contains("BARTS") ||
chipset.contains("TURKS") ||
chipset.contains("CAICOS") ||
chipset.contains("CAYMAN"))
if (chipset.contains(QStringLiteral("SUMO")) ||
chipset.contains(QStringLiteral("SUMO2")) ||
chipset.contains(QStringLiteral("BARTS")) ||
chipset.contains(QStringLiteral("TURKS")) ||
chipset.contains(QStringLiteral("CAICOS")) ||
chipset.contains(QStringLiteral("CAYMAN")))
return NorthernIslands;
QString name = extract(chipset, "HD [0-9]{4}"); // HD followed by a space and 4 digits
QString name = extract(chipset, QStringLiteral("HD [0-9]{4}")); // HD followed by a space and 4 digits
if (!name.isEmpty()) {
const int id = name.right(4).toInt();
if (id == 6250 || id == 6310) // Palm
@ -204,7 +204,7 @@ static ChipClass detectRadeonClass(const QString &chipset)
return UnknownRadeon;
}
name = extract(chipset, "X[0-9]{3,4}"); // X followed by 3-4 digits
name = extract(chipset, QStringLiteral("X[0-9]{3,4}")); // X followed by 3-4 digits
if (!name.isEmpty()) {
const int id = name.mid(1, -1).toInt();
@ -223,7 +223,7 @@ static ChipClass detectRadeonClass(const QString &chipset)
return UnknownRadeon;
}
name = extract(chipset, "\\b[0-9]{4}\\b"); // A group of 4 digits
name = extract(chipset, QStringLiteral("\\b[0-9]{4}\\b")); // A group of 4 digits
if (!name.isEmpty()) {
const int id = name.toInt();
@ -248,7 +248,7 @@ static ChipClass detectRadeonClass(const QString &chipset)
static ChipClass detectNVidiaClass(const QString &chipset)
{
QString name = extract(chipset, "\\bNV[0-9,A-F]{2}\\b"); // NV followed by two hexadecimal digits
QString name = extract(chipset, QStringLiteral("\\bNV[0-9,A-F]{2}\\b")); // NV followed by two hexadecimal digits
if (!name.isEmpty()) {
const int id = chipset.mid(2, -1).toInt(0, 16); // Strip the 'NV' from the id
@ -278,25 +278,25 @@ static ChipClass detectNVidiaClass(const QString &chipset)
}
}
if (chipset.contains("GeForce2") || chipset.contains("GeForce 256"))
if (chipset.contains(QStringLiteral("GeForce2")) || chipset.contains(QStringLiteral("GeForce 256")))
return NV10;
if (chipset.contains("GeForce3"))
if (chipset.contains(QStringLiteral("GeForce3")))
return NV20;
if (chipset.contains("GeForce4")) {
if (chipset.contains("MX 420") ||
chipset.contains("MX 440") || // including MX 440SE
chipset.contains("MX 460") ||
chipset.contains("MX 4000") ||
chipset.contains("PCX 4300"))
if (chipset.contains(QStringLiteral("GeForce4"))) {
if (chipset.contains(QStringLiteral("MX 420")) ||
chipset.contains(QStringLiteral("MX 440")) || // including MX 440SE
chipset.contains(QStringLiteral("MX 460")) ||
chipset.contains(QStringLiteral("MX 4000")) ||
chipset.contains(QStringLiteral("PCX 4300")))
return NV10;
return NV20;
}
// GeForce 5,6,7,8,9
name = extract(chipset, "GeForce (FX |PCX |Go )?\\d{4}(M|\\b)").trimmed();
name = extract(chipset, QStringLiteral("GeForce (FX |PCX |Go )?\\d{4}(M|\\b)")).trimmed();
if (!name.isEmpty()) {
if (!name[name.length() - 1].isDigit())
name.chop(1);
@ -315,7 +315,7 @@ static ChipClass detectNVidiaClass(const QString &chipset)
}
// GeForce 100/200/300/400/500
name = extract(chipset, "GeForce (G |GT |GTX |GTS )?\\d{3}(M|\\b)").trimmed();
name = extract(chipset, QStringLiteral("GeForce (G |GT |GTX |GTS )?\\d{3}(M|\\b)")).trimmed();
if (!name.isEmpty()) {
if (!name[name.length() - 1].isDigit())
name.chop(1);
@ -394,9 +394,9 @@ QString GLPlatform::versionToString(qint64 version)
int minor = (version >> 16) & 0xffff;
int patch = version & 0xffff;
QString string = QString::number(major) + QChar('.') + QString::number(minor);
QString string = QString::number(major) + QStringLiteral(".") + QString::number(minor);
if (patch != 0)
string += QChar('.') + QString::number(patch);
string += QStringLiteral(".") + QString::number(patch);
return string;
}
@ -405,38 +405,38 @@ QString GLPlatform::driverToString(Driver driver)
{
switch(driver) {
case Driver_R100:
return "Radeon";
return QStringLiteral("Radeon");
case Driver_R200:
return "R200";
return QStringLiteral("R200");
case Driver_R300C:
return "R300C";
return QStringLiteral("R300C");
case Driver_R300G:
return "R300G";
return QStringLiteral("R300G");
case Driver_R600C:
return "R600C";
return QStringLiteral("R600C");
case Driver_R600G:
return "R600G";
return QStringLiteral("R600G");
case Driver_Nouveau:
return "Nouveau";
return QStringLiteral("Nouveau");
case Driver_Intel:
return "Intel";
return QStringLiteral("Intel");
case Driver_NVidia:
return "NVIDIA";
return QStringLiteral("NVIDIA");
case Driver_Catalyst:
return "Catalyst";
return QStringLiteral("Catalyst");
case Driver_Swrast:
return "Software rasterizer";
return QStringLiteral("Software rasterizer");
case Driver_Softpipe:
return "softpipe";
return QStringLiteral("softpipe");
case Driver_Llvmpipe:
return "LLVMpipe";
return QStringLiteral("LLVMpipe");
case Driver_VirtualBox:
return "VirtualBox (Chromium)";
return QStringLiteral("VirtualBox (Chromium)");
case Driver_VMware:
return "VMware (SVGA3D)";
return QStringLiteral("VMware (SVGA3D)");
default:
return "Unknown";
return QStringLiteral("Unknown");
}
}
@ -444,52 +444,52 @@ QString GLPlatform::chipClassToString(ChipClass chipClass)
{
switch(chipClass) {
case R100:
return "R100";
return QStringLiteral("R100");
case R200:
return "R200";
return QStringLiteral("R200");
case R300:
return "R300";
return QStringLiteral("R300");
case R400:
return "R400";
return QStringLiteral("R400");
case R500:
return "R500";
return QStringLiteral("R500");
case R600:
return "R600";
return QStringLiteral("R600");
case R700:
return "R700";
return QStringLiteral("R700");
case Evergreen:
return "EVERGREEN";
return QStringLiteral("EVERGREEN");
case NorthernIslands:
return "NI";
return QStringLiteral("NI");
case NV10:
return "NV10";
return QStringLiteral("NV10");
case NV20:
return "NV20";
return QStringLiteral("NV20");
case NV30:
return "NV30";
return QStringLiteral("NV30");
case NV40:
return "NV40/G70";
return QStringLiteral("NV40/G70");
case G80:
return "G80/G90";
return QStringLiteral("G80/G90");
case GF100:
return "GF100";
return QStringLiteral("GF100");
case I8XX:
return "i830/i835";
return QStringLiteral("i830/i835");
case I915:
return "i915/i945";
return QStringLiteral("i915/i945");
case I965:
return "i965";
return QStringLiteral("i965");
case SandyBridge:
return "SandyBridge";
return QStringLiteral("SandyBridge");
case IvyBridge:
return "IvyBridge";
return QStringLiteral("IvyBridge");
case Haswell:
return "Haswell";
return QStringLiteral("Haswell");
default:
return "Unknown";
return QStringLiteral("Unknown");
}
}
@ -630,7 +630,7 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
// Vendor: Advanced Micro Devices, Inc.
m_driver = Driver_R600C;
m_chipClass = detectRadeonClass(m_chipset);
m_chipClass = detectRadeonClass(QString::fromUtf8(m_chipset));
}
// Intel
@ -659,7 +659,7 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
// R300G
if (m_vendor == "X.Org R300 Project") {
m_chipClass = detectRadeonClass(m_chipset);
m_chipClass = detectRadeonClass(QString::fromUtf8(m_chipset));
m_driver = Driver_R300G;
}
@ -684,13 +684,13 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
m_renderer.contains("TURKS") ||
m_renderer.contains("CAICOS") ||
m_renderer.contains("CAYMAN"))) {
m_chipClass = detectRadeonClass(m_chipset);
m_chipClass = detectRadeonClass(QString::fromUtf8(m_chipset));
m_driver = Driver_R600G;
}
// Nouveau
else if (m_vendor == "nouveau") {
m_chipClass = detectNVidiaClass(m_chipset);
m_chipClass = detectNVidiaClass(QString::fromUtf8(m_chipset));
m_driver = Driver_Nouveau;
}
@ -714,7 +714,7 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
// Properietary drivers
// ====================================================
else if (m_vendor == "ATI Technologies Inc.") {
m_chipClass = detectRadeonClass(m_renderer);
m_chipClass = detectRadeonClass(QString::fromUtf8(m_renderer));
m_driver = Driver_Catalyst;
if (versionTokens.count() > 1 && versionTokens.at(2)[0] == '(')
@ -726,7 +726,7 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
}
else if (m_vendor == "NVIDIA Corporation") {
m_chipClass = detectNVidiaClass(m_renderer);
m_chipClass = detectNVidiaClass(QString::fromUtf8(m_renderer));
m_driver = Driver_NVidia;
int index = versionTokens.indexOf("NVIDIA");
@ -866,38 +866,38 @@ static void print(const QString &label, const QString &setting)
void GLPlatform::printResults() const
{
print("OpenGL vendor string:", m_vendor);
print("OpenGL renderer string:", m_renderer);
print("OpenGL version string:", m_version);
print(QStringLiteral("OpenGL vendor string:"), QString::fromUtf8(m_vendor));
print(QStringLiteral("OpenGL renderer string:"), QString::fromUtf8(m_renderer));
print(QStringLiteral("OpenGL version string:"), QString::fromUtf8(m_version));
if (m_supportsGLSL)
print("OpenGL shading language version string:", m_glsl_version);
print(QStringLiteral("OpenGL shading language version string:"), QString::fromUtf8(m_glsl_version));
print("Driver:", driverToString(m_driver));
print(QStringLiteral("Driver:"), driverToString(m_driver));
if (!isMesaDriver())
print("Driver version:", versionToString(m_driverVersion));
print(QStringLiteral("Driver version:"), versionToString(m_driverVersion));
print("GPU class:", chipClassToString(m_chipClass));
print(QStringLiteral("GPU class:"), chipClassToString(m_chipClass));
print("OpenGL version:", versionToString(m_glVersion));
print(QStringLiteral("OpenGL version:"), versionToString(m_glVersion));
if (m_supportsGLSL)
print("GLSL version:", versionToString(m_glslVersion));
print(QStringLiteral("GLSL version:"), versionToString(m_glslVersion));
if (isMesaDriver())
print("Mesa version:", versionToString(mesaVersion()));
print(QStringLiteral("Mesa version:"), versionToString(mesaVersion()));
//if (galliumVersion() > 0)
// print("Gallium version:", versionToString(m_galliumVersion));
if (serverVersion() > 0)
print("X server version:", versionToString(m_serverVersion));
print(QStringLiteral("X server version:"), versionToString(m_serverVersion));
if (kernelVersion() > 0)
print("Linux kernel version:", versionToString(m_kernelVersion));
print(QStringLiteral("Linux kernel version:"), versionToString(m_kernelVersion));
print("Direct rendering:", m_directRendering ? "yes" : "no");
print("Requires strict binding:", !m_looseBinding ? "yes" : "no");
print("GLSL shaders:", m_supportsGLSL ? (m_limitedGLSL ? "limited" : "yes") : "no");
print("Texture NPOT support:", m_textureNPOT ? (m_limitedNPOT ? "limited" : "yes") : "no");
print("Virtual Machine:", m_virtualMachine ? "yes" : "no");
print(QStringLiteral("Direct rendering:"), m_directRendering ? QStringLiteral("yes") : QStringLiteral("no"));
print(QStringLiteral("Requires strict binding:"), !m_looseBinding ? QStringLiteral("yes") : QStringLiteral("no"));
print(QStringLiteral("GLSL shaders:"), m_supportsGLSL ? (m_limitedGLSL ? QStringLiteral("limited") : QStringLiteral("yes")) : QStringLiteral("no"));
print(QStringLiteral("Texture NPOT support:"), m_textureNPOT ? (m_limitedNPOT ? QStringLiteral("limited") : QStringLiteral("yes")) : QStringLiteral("no"));
print(QStringLiteral("Virtual Machine:"), m_virtualMachine ? QStringLiteral("yes") : QStringLiteral("no"));
}
bool GLPlatform::supports(GLFeature feature) const

View file

@ -151,12 +151,12 @@ void GLTexturePrivate::initStatic()
sNPOTTextureSupported = true;
sFramebufferObjectSupported = true;
sSaturationSupported = true;
sTextureFormatBGRA = hasGLExtension("GL_EXT_texture_format_BGRA8888");
sTextureFormatBGRA = hasGLExtension(QStringLiteral("GL_EXT_texture_format_BGRA8888"));
#else
sNPOTTextureSupported = hasGLExtension("GL_ARB_texture_non_power_of_two");
sFramebufferObjectSupported = hasGLExtension("GL_EXT_framebuffer_object");
sSaturationSupported = ((hasGLExtension("GL_ARB_texture_env_crossbar")
&& hasGLExtension("GL_ARB_texture_env_dot3")) || hasGLVersion(1, 4))
sNPOTTextureSupported = hasGLExtension(QStringLiteral("GL_ARB_texture_non_power_of_two"));
sFramebufferObjectSupported = hasGLExtension(QStringLiteral("GL_EXT_framebuffer_object"));
sSaturationSupported = ((hasGLExtension(QStringLiteral("GL_ARB_texture_env_crossbar"))
&& hasGLExtension(QStringLiteral("GL_ARB_texture_env_dot3"))) || hasGLVersion(1, 4))
&& (glTextureUnitsCount >= 4) && glActiveTexture != NULL;
sTextureFormatBGRA = true;
#endif
@ -236,7 +236,7 @@ void GLTexture::update(const QImage &image, const QPoint &offset, const QRect &s
Q_D(GLTexture);
#ifdef KWIN_HAVE_OPENGLES
static bool s_supportsUnpack = hasGLExtension("GL_EXT_unpack_subimage");
static bool s_supportsUnpack = hasGLExtension(QStringLiteral("GL_EXT_unpack_subimage"));
#else
static bool s_supportsUnpack = true;
#endif

View file

@ -76,8 +76,8 @@ void initGLX()
glXQueryVersion(display(), &major, &minor);
glXVersion = MAKE_GL_VERSION(major, minor, 0);
// Get list of supported GLX extensions
glxExtensions = QString((const char*)glXQueryExtensionsString(
display(), DefaultScreen(display()))).split(' ');
glxExtensions = QString::fromUtf8(glXQueryExtensionsString(
display(), DefaultScreen(display()))).split(QStringLiteral(" "));
glxResolveFunctions();
#endif
@ -90,7 +90,7 @@ void initEGL()
int major, minor;
eglInitialize(dpy, &major, &minor);
eglVersion = MAKE_GL_VERSION(major, minor, 0);
eglExtension = QString((const char*)eglQueryString(dpy, EGL_EXTENSIONS)).split(' ');
eglExtension = QString::fromUtf8(eglQueryString(dpy, EGL_EXTENSIONS)).split(QStringLiteral(" "));
eglResolveFunctions();
#endif
@ -99,10 +99,10 @@ void initEGL()
void initGL(OpenGLPlatformInterface platformInterface)
{
// Get OpenGL version
QString glversionstring = QString((const char*)glGetString(GL_VERSION));
QStringList glversioninfo = glversionstring.left(glversionstring.indexOf(' ')).split('.');
QString glversionstring = QString::fromUtf8((const char*)glGetString(GL_VERSION));
QStringList glversioninfo = glversionstring.left(glversionstring.indexOf(QStringLiteral(" "))).split(QStringLiteral("."));
while (glversioninfo.count() < 3)
glversioninfo << "0";
glversioninfo << QStringLiteral("0");
#ifndef KWIN_HAVE_OPENGLES
glVersion = MAKE_GL_VERSION(glversioninfo[0].toInt(), glversioninfo[1].toInt(), glversioninfo[2].toInt());
@ -123,11 +123,11 @@ void initGL(OpenGLPlatformInterface platformInterface)
for (int i = 0; i < count; i++) {
const char *name = (const char *) glGetStringi(GL_EXTENSIONS, i);
glExtensions << QString(name);
glExtensions << QString::fromUtf8(name);
}
} else
#endif
glExtensions = QString((const char*)glGetString(GL_EXTENSIONS)).split(' ');
glExtensions = QString::fromUtf8((const char*)glGetString(GL_EXTENSIONS)).split(QStringLiteral(" "));
// handle OpenGL extensions functions
glResolveFunctions(platformInterface);
@ -166,16 +166,16 @@ bool hasGLExtension(const QString& extension)
static QString formatGLError(GLenum err)
{
switch(err) {
case GL_NO_ERROR: return "GL_NO_ERROR";
case GL_INVALID_ENUM: return "GL_INVALID_ENUM";
case GL_INVALID_VALUE: return "GL_INVALID_VALUE";
case GL_INVALID_OPERATION: return "GL_INVALID_OPERATION";
case GL_NO_ERROR: return QStringLiteral("GL_NO_ERROR");
case GL_INVALID_ENUM: return QStringLiteral("GL_INVALID_ENUM");
case GL_INVALID_VALUE: return QStringLiteral("GL_INVALID_VALUE");
case GL_INVALID_OPERATION: return QStringLiteral("GL_INVALID_OPERATION");
#ifndef KWIN_HAVE_OPENGLES
case GL_STACK_OVERFLOW: return "GL_STACK_OVERFLOW";
case GL_STACK_UNDERFLOW: return "GL_STACK_UNDERFLOW";
case GL_STACK_OVERFLOW: return QStringLiteral("GL_STACK_OVERFLOW");
case GL_STACK_UNDERFLOW: return QStringLiteral("GL_STACK_UNDERFLOW");
#endif
case GL_OUT_OF_MEMORY: return "GL_OUT_OF_MEMORY";
default: return QString("0x") + QString::number(err, 16);
case GL_OUT_OF_MEMORY: return QStringLiteral("GL_OUT_OF_MEMORY");
default: return QStringLiteral("0x") + QString::number(err, 16);
}
}
@ -831,7 +831,7 @@ GLShader *ShaderManager::loadFragmentShader(ShaderType vertex, const QString &fr
"scene-color-vertex.glsl"
};
GLShader *shader = new GLShader(m_shaderDir + vertexFile[vertex], fragmentFile, GLShader::ExplicitLinking);
GLShader *shader = new GLShader(QString::fromUtf8(m_shaderDir + vertexFile[vertex]), fragmentFile, GLShader::ExplicitLinking);
bindAttributeLocations(shader);
bindFragDataLocations(shader);
shader->link();
@ -854,7 +854,7 @@ GLShader *ShaderManager::loadVertexShader(ShaderType fragment, const QString &ve
"scene-color-fragment.glsl"
};
GLShader *shader = new GLShader(vertexFile, m_shaderDir + fragmentFile[fragment], GLShader::ExplicitLinking);
GLShader *shader = new GLShader(vertexFile, QString::fromUtf8(m_shaderDir + fragmentFile[fragment]), GLShader::ExplicitLinking);
bindAttributeLocations(shader);
bindFragDataLocations(shader);
shader->link();
@ -906,7 +906,8 @@ void ShaderManager::initShaders()
m_valid = true;
for (int i = 0; i < 3; i++) {
m_shader[i] = new GLShader(m_shaderDir + vertexFile[i], m_shaderDir + fragmentFile[i],
m_shader[i] = new GLShader(QString::fromUtf8(m_shaderDir + vertexFile[i]),
QString::fromUtf8(m_shaderDir + fragmentFile[i]),
GLShader::ExplicitLinking);
bindAttributeLocations(m_shader[i]);
bindFragDataLocations(m_shader[i]);
@ -995,8 +996,8 @@ void GLRenderTarget::initStatic()
sSupported = true;
s_blitSupported = false;
#else
sSupported = hasGLVersion(3, 0) || hasGLExtension("GL_ARB_framebuffer_object") || hasGLExtension("GL_EXT_framebuffer_object");
s_blitSupported = hasGLVersion(3, 0) || hasGLExtension("GL_ARB_framebuffer_object") || hasGLExtension("GL_EXT_framebuffer_blit");
sSupported = hasGLVersion(3, 0) || hasGLExtension(QStringLiteral("GL_ARB_framebuffer_object")) || hasGLExtension(QStringLiteral("GL_EXT_framebuffer_object"));
s_blitSupported = hasGLVersion(3, 0) || hasGLExtension(QStringLiteral("GL_ARB_framebuffer_object")) || hasGLExtension(QStringLiteral("GL_EXT_framebuffer_blit"));
#endif
}
@ -1087,32 +1088,32 @@ static QString formatFramebufferStatus(GLenum status)
switch(status) {
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
// An attachment is the wrong type / is invalid / has 0 width or height
return "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT";
return QStringLiteral("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
// There are no images attached to the framebuffer
return "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";
return QStringLiteral("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");
case GL_FRAMEBUFFER_UNSUPPORTED:
// A format or the combination of formats of the attachments is unsupported
return "GL_FRAMEBUFFER_UNSUPPORTED";
return QStringLiteral("GL_FRAMEBUFFER_UNSUPPORTED");
#ifndef KWIN_HAVE_OPENGLES
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
// Not all attached images have the same width and height
return "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT";
return QStringLiteral("GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT");
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
// The color attachments don't have the same format
return "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT";
return QStringLiteral("GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT");
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT:
// The attachments don't have the same number of samples
return "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE";
return QStringLiteral("GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE");
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
// The draw buffer is missing
return "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER";
return QStringLiteral("GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER");
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
// The read buffer is missing
return "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER";
return QStringLiteral("GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER");
#endif
default:
return "Unknown (0x" + QString::number(status, 16) + ')';
return QStringLiteral("Unknown (0x") + QString::number(status, 16) + QStringLiteral(")");
}
}
@ -1970,11 +1971,11 @@ void GLVertexBuffer::initStatic()
{
#ifdef KWIN_HAVE_OPENGLES
GLVertexBufferPrivate::supported = true;
GLVertexBufferPrivate::hasMapBufferRange = hasGLExtension("GL_EXT_map_buffer_range");
GLVertexBufferPrivate::hasMapBufferRange = hasGLExtension(QStringLiteral("GL_EXT_map_buffer_range"));
GLVertexBufferPrivate::supportsIndexedQuads = false;
#else
GLVertexBufferPrivate::supported = hasGLVersion(1, 5) || hasGLExtension("GL_ARB_vertex_buffer_object");
GLVertexBufferPrivate::hasMapBufferRange = hasGLVersion(3, 0) || hasGLExtension("GL_ARB_map_buffer_range");
GLVertexBufferPrivate::supported = hasGLVersion(1, 5) || hasGLExtension(QStringLiteral("GL_ARB_vertex_buffer_object"));
GLVertexBufferPrivate::hasMapBufferRange = hasGLVersion(3, 0) || hasGLExtension(QStringLiteral("GL_ARB_map_buffer_range"));
GLVertexBufferPrivate::supportsIndexedQuads = glMapBufferRange && glCopyBufferSubData && glDrawElementsBaseVertex;
GLVertexBufferPrivate::s_indexBuffer = 0;
#endif

View file

@ -223,18 +223,18 @@ void glxResolveFunctions()
if (glXGetProcAddress == NULL)
glXGetProcAddress = (glXGetProcAddress_func) getProcAddress("glXGetProcAddressARB");
glXQueryDrawable = (glXQueryDrawable_func) getProcAddress("glXQueryDrawable");
if (hasGLExtension("GLX_EXT_texture_from_pixmap")) {
if (hasGLExtension(QStringLiteral("GLX_EXT_texture_from_pixmap"))) {
glXBindTexImageEXT = (glXBindTexImageEXT_func) getProcAddress("glXBindTexImageEXT");
glXReleaseTexImageEXT = (glXReleaseTexImageEXT_func) getProcAddress("glXReleaseTexImageEXT");
} else {
glXBindTexImageEXT = NULL;
glXReleaseTexImageEXT = NULL;
}
if (hasGLExtension("GLX_MESA_copy_sub_buffer"))
if (hasGLExtension(QStringLiteral("GLX_MESA_copy_sub_buffer")))
glXCopySubBuffer = (glXCopySubBuffer_func) getProcAddress("glXCopySubBufferMESA");
else
glXCopySubBuffer = NULL;
if (hasGLExtension("GLX_SGI_video_sync")) {
if (hasGLExtension(QStringLiteral("GLX_SGI_video_sync"))) {
glXGetVideoSync = (glXGetVideoSync_func) getProcAddress("glXGetVideoSyncSGI");
glXWaitVideoSync = (glXWaitVideoSync_func) getProcAddress("glXWaitVideoSyncSGI");
} else {
@ -242,20 +242,20 @@ void glxResolveFunctions()
glXWaitVideoSync = NULL;
}
if (hasGLExtension("GLX_SGI_swap_control"))
if (hasGLExtension(QStringLiteral("GLX_SGI_swap_control")))
glXSwapIntervalSGI = (glXSwapIntervalSGI_func) getProcAddress("glXSwapIntervalSGI");
else
glXSwapIntervalSGI = NULL;
if (hasGLExtension("GLX_EXT_swap_control"))
if (hasGLExtension(QStringLiteral("GLX_EXT_swap_control")))
glXSwapIntervalEXT = (glXSwapIntervalEXT_func) getProcAddress("glXSwapIntervalEXT");
else
glXSwapIntervalEXT = NULL;
if (hasGLExtension("GLX_MESA_swap_control"))
if (hasGLExtension(QStringLiteral("GLX_MESA_swap_control")))
glXSwapIntervalMESA = (glXSwapIntervalMESA_func) getProcAddress("glXSwapIntervalMESA");
else
glXSwapIntervalMESA = NULL;
if (hasGLExtension("GLX_ARB_create_context"))
if (hasGLExtension(QStringLiteral("GLX_ARB_create_context")))
glXCreateContextAttribsARB = (glXCreateContextAttribsARB_func) getProcAddress("glXCreateContextAttribsARB");
else
glXCreateContextAttribsARB = NULL;
@ -292,9 +292,9 @@ glGetnUniformfv_func glGetnUniformfv;
void eglResolveFunctions()
{
if (hasGLExtension("EGL_KHR_image") ||
(hasGLExtension("EGL_KHR_image_base") &&
hasGLExtension("EGL_KHR_image_pixmap"))) {
if (hasGLExtension(QStringLiteral("EGL_KHR_image")) ||
(hasGLExtension(QStringLiteral("EGL_KHR_image_base")) &&
hasGLExtension(QStringLiteral("EGL_KHR_image_pixmap")))) {
eglCreateImageKHR = (eglCreateImageKHR_func)eglGetProcAddress("eglCreateImageKHR");
eglDestroyImageKHR = (eglDestroyImageKHR_func)eglGetProcAddress("eglDestroyImageKHR");
} else {
@ -302,7 +302,7 @@ void eglResolveFunctions()
eglDestroyImageKHR = NULL;
}
if (hasGLExtension("EGL_NV_post_sub_buffer")) {
if (hasGLExtension(QStringLiteral("EGL_NV_post_sub_buffer"))) {
eglPostSubBufferNV = (eglPostSubBufferNV_func)eglGetProcAddress("eglPostSubBufferNV");
} else {
eglPostSubBufferNV = NULL;
@ -317,7 +317,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
GL_RESOLVE(glActiveTexture);
// Get number of texture units
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &glTextureUnitsCount);
} else if (hasGLExtension("GL_ARB_multitexture")) {
} else if (hasGLExtension(QStringLiteral("GL_ARB_multitexture"))) {
GL_RESOLVE_WITH_EXT(glActiveTexture, glActiveTextureARB);
// Get number of texture units
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &glTextureUnitsCount);
@ -326,7 +326,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
glTextureUnitsCount = 0;
}
if (hasGLVersion(3, 0) || hasGLExtension("GL_ARB_framebuffer_object")) {
if (hasGLVersion(3, 0) || hasGLExtension(QStringLiteral("GL_ARB_framebuffer_object"))) {
// see http://www.opengl.org/registry/specs/ARB/framebuffer_object.txt
GL_RESOLVE(glIsRenderbuffer);
GL_RESOLVE(glBindRenderbuffer);
@ -353,7 +353,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
GL_RESOLVE(glGetFramebufferAttachmentParameteriv);
GL_RESOLVE(glGenerateMipmap);
} else if (hasGLExtension("GL_EXT_framebuffer_object")) {
} else if (hasGLExtension(QStringLiteral("GL_EXT_framebuffer_object"))) {
// see http://www.opengl.org/registry/specs/EXT/framebuffer_object.txt
GL_RESOLVE_WITH_EXT(glIsRenderbuffer, glIsRenderbufferEXT);
GL_RESOLVE_WITH_EXT(glBindRenderbuffer, glBindRenderbufferEXT);
@ -400,10 +400,10 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
glGenerateMipmap = NULL;
}
if (hasGLVersion(3, 0) || hasGLExtension("GL_ARB_framebuffer_object")) {
if (hasGLVersion(3, 0) || hasGLExtension(QStringLiteral("GL_ARB_framebuffer_object"))) {
// see http://www.opengl.org/registry/specs/ARB/framebuffer_object.txt
GL_RESOLVE(glBlitFramebuffer);
} else if (hasGLExtension("GL_EXT_framebuffer_blit")) {
} else if (hasGLExtension(QStringLiteral("GL_EXT_framebuffer_blit"))) {
// see http://www.opengl.org/registry/specs/EXT/framebuffer_blit.txt
GL_RESOLVE_WITH_EXT(glBlitFramebuffer, glBlitFramebufferEXT);
} else {
@ -438,7 +438,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
GL_RESOLVE(glValidateProgram);
GL_RESOLVE(glGetUniformLocation);
GL_RESOLVE(glGetUniformfv);
} else if (hasGLExtension("GL_ARB_shader_objects")) {
} else if (hasGLExtension(QStringLiteral("GL_ARB_shader_objects"))) {
GL_RESOLVE_WITH_EXT(glCreateShader, glCreateShaderObjectARB);
GL_RESOLVE_WITH_EXT(glShaderSource, glShaderSourceARB);
GL_RESOLVE_WITH_EXT(glCompileShader, glCompileShaderARB);
@ -502,7 +502,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
GL_RESOLVE(glEnableVertexAttribArray);
GL_RESOLVE(glDisableVertexAttribArray);
GL_RESOLVE(glVertexAttribPointer);
} else if (hasGLExtension("GL_ARB_vertex_shader")) {
} else if (hasGLExtension(QStringLiteral("GL_ARB_vertex_shader"))) {
GL_RESOLVE_WITH_EXT(glVertexAttrib1f, glVertexAttrib1fARB);
GL_RESOLVE_WITH_EXT(glBindAttribLocation, glBindAttribLocationARB);
GL_RESOLVE_WITH_EXT(glGetAttribLocation, glGetAttribLocationARB);
@ -518,7 +518,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
glVertexAttribPointer = NULL;
}
if (hasGLExtension("GL_ARB_fragment_program") && hasGLExtension("GL_ARB_vertex_program")) {
if (hasGLExtension(QStringLiteral("GL_ARB_fragment_program")) && hasGLExtension(QStringLiteral("GL_ARB_vertex_program"))) {
// see http://www.opengl.org/registry/specs/ARB/fragment_program.txt
GL_RESOLVE(glProgramStringARB);
GL_RESOLVE(glBindProgramARB);
@ -544,7 +544,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
GL_RESOLVE(glBufferSubData);
GL_RESOLVE(glMapBuffer);
GL_RESOLVE(glUnmapBuffer);
} else if (hasGLExtension("GL_ARB_vertex_buffer_object")) {
} else if (hasGLExtension(QStringLiteral("GL_ARB_vertex_buffer_object"))) {
GL_RESOLVE_WITH_EXT(glGenBuffers, glGenBuffersARB);
GL_RESOLVE_WITH_EXT(glDeleteBuffers, glDeleteBuffersARB);
GL_RESOLVE_WITH_EXT(glBindBuffer, glBindBufferARB);
@ -564,7 +564,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
glUnmapBuffer = NULL;
}
if (hasGLVersion(3, 0) || hasGLExtension("GL_ARB_vertex_array_object")) {
if (hasGLVersion(3, 0) || hasGLExtension(QStringLiteral("GL_ARB_vertex_array_object"))) {
// see http://www.opengl.org/registry/specs/ARB/vertex_array_object.txt
GL_RESOLVE(glBindVertexArray);
GL_RESOLVE(glDeleteVertexArrays);
@ -611,7 +611,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
GL_RESOLVE(glUniform1uiv);
GL_RESOLVE(glUniform2uiv);
GL_RESOLVE(glUniform3uiv);
} else if (hasGLExtension("GL_EXT_gpu_shader4")) {
} else if (hasGLExtension(QStringLiteral("GL_EXT_gpu_shader4"))) {
// See http://www.opengl.org/registry/specs/EXT/gpu_shader4.txt
GL_RESOLVE_WITH_EXT(glVertexAttribI1i, glVertexAttribI1iEXT);
GL_RESOLVE_WITH_EXT(glVertexAttribI2i, glVertexAttribI2iEXT);
@ -682,7 +682,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
glUniform3uiv = NULL;
}
if (hasGLVersion(3, 0) || hasGLExtension("GL_ARB_map_buffer_range")) {
if (hasGLVersion(3, 0) || hasGLExtension(QStringLiteral("GL_ARB_map_buffer_range"))) {
// See http://www.opengl.org/registry/specs/ARB/map_buffer_range.txt
GL_RESOLVE(glMapBufferRange);
GL_RESOLVE(glFlushMappedBufferRange);
@ -691,7 +691,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
glFlushMappedBufferRange = NULL;
}
if (hasGLExtension("GL_ARB_robustness")) {
if (hasGLExtension(QStringLiteral("GL_ARB_robustness"))) {
// See http://www.opengl.org/registry/specs/ARB/robustness.txt
GL_RESOLVE_WITH_EXT(glGetGraphicsResetStatus, glGetGraphicsResetStatusARB);
GL_RESOLVE_WITH_EXT(glReadnPixels, glReadnPixelsARB);
@ -702,7 +702,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
glGetnUniformfv = KWin::GetnUniformfv;
}
if (hasGLVersion(3, 2) || hasGLExtension("GL_ARB_draw_elements_base_vertex")) {
if (hasGLVersion(3, 2) || hasGLExtension(QStringLiteral("GL_ARB_draw_elements_base_vertex"))) {
// See http://www.opengl.org/registry/specs/ARB/draw_elements_base_vertex.txt
GL_RESOLVE(glDrawElementsBaseVertex);
GL_RESOLVE(glDrawElementsInstancedBaseVertex);
@ -711,7 +711,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
glDrawElementsInstancedBaseVertex = NULL;
}
if (hasGLVersion(3, 1) || hasGLExtension("GL_ARB_copy_buffer")) {
if (hasGLVersion(3, 1) || hasGLExtension(QStringLiteral("GL_ARB_copy_buffer"))) {
// See http://www.opengl.org/registry/specs/ARB/copy_buffer.txt
GL_RESOLVE(glCopyBufferSubData);
} else {
@ -720,7 +720,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
#else
if (hasGLExtension("GL_OES_mapbuffer")) {
if (hasGLExtension(QStringLiteral("GL_OES_mapbuffer"))) {
// See http://www.khronos.org/registry/gles/extensions/OES/OES_mapbuffer.txt
glMapBuffer = (glMapBuffer_func) eglGetProcAddress("glMapBufferOES");
glUnmapBuffer = (glUnmapBuffer_func) eglGetProcAddress("glUnmapBufferOES");
@ -731,7 +731,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
glGetBufferPointerv = NULL;
}
if (hasGLExtension("GL_EXT_map_buffer_range")) {
if (hasGLExtension(QStringLiteral("GL_EXT_map_buffer_range"))) {
// See http://www.khronos.org/registry/gles/extensions/EXT/EXT_map_buffer_range.txt
glMapBufferRange = (glMapBufferRange_func) eglGetProcAddress("glMapBufferRangeEXT");
glFlushMappedBufferRange = (glFlushMappedBufferRange_func) eglGetProcAddress("glFlushMappedBufferRangeEXT");
@ -740,7 +740,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
glFlushMappedBufferRange = NULL;
}
if (hasGLExtension("GL_EXT_robustness")) {
if (hasGLExtension(QStringLiteral("GL_EXT_robustness"))) {
// See http://www.khronos.org/registry/gles/extensions/EXT/EXT_robustness.txt
glGetGraphicsResetStatus = (glGetGraphicsResetStatus_func) eglGetProcAddress("glGetGraphicsResetStatusEXT");
glReadnPixels = (glReadnPixels_func) eglGetProcAddress("glReadnPixelsEXT");
@ -755,7 +755,7 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
#ifdef KWIN_HAVE_EGL
if (platformInterface == EglPlatformInterface) {
if (hasGLExtension("GL_OES_EGL_image")) {
if (hasGLExtension(QStringLiteral("GL_OES_EGL_image"))) {
glEGLImageTargetTexture2DOES = (glEGLImageTargetTexture2DOES_func)eglGetProcAddress("glEGLImageTargetTexture2DOES");
} else {
glEGLImageTargetTexture2DOES = NULL;

View file

@ -276,10 +276,10 @@ public:
wmList->setEditable(true);
layout->addWidget(wmList);
addWM("metacity");
addWM("openbox");
addWM("fvwm2");
addWM(KWIN_NAME);
addWM(QStringLiteral("metacity"));
addWM(QStringLiteral("openbox"));
addWM(QStringLiteral("fvwm2"));
addWM(QStringLiteral(KWIN_NAME));
setMainWidget(mainWidget);
@ -324,7 +324,7 @@ Application::Application()
screen_number = DefaultScreen(display());
if (!owner.claim(args->isSet("replace"), true)) {
fputs(i18n("kwin: unable to claim manager selection, another wm running? (try using --replace)\n").toLocal8Bit(), stderr);
fputs(i18n("kwin: unable to claim manager selection, another wm running? (try using --replace)\n").toLocal8Bit().constData(), stderr);
::exit(1);
}
connect(&owner, SIGNAL(lostOwnership()), SLOT(lostSelection()));
@ -334,7 +334,7 @@ Application::Application()
if (crashes >= 4) {
// Something has gone seriously wrong
AlternativeWMDialog dialog;
QString cmd = KWIN_NAME;
QString cmd = QStringLiteral(KWIN_NAME);
if (dialog.exec() == QDialog::Accepted)
cmd = dialog.selectedWM();
else
@ -541,11 +541,11 @@ KDE_EXPORT int kdemain(int argc, char * argv[])
// for several bug reports about high CPU usage (bug #239963)
setenv("QT_NO_GLIB", "1", true);
org::kde::KSMServerInterface ksmserver("org.kde.ksmserver", "/KSMServer", QDBusConnection::sessionBus());
ksmserver.suspendStartup(KWIN_NAME);
org::kde::KSMServerInterface ksmserver(QStringLiteral("org.kde.ksmserver"), QStringLiteral("/KSMServer"), QDBusConnection::sessionBus());
ksmserver.suspendStartup(QStringLiteral(KWIN_NAME));
KWin::Application a;
ksmserver.resumeStartup(KWIN_NAME);
ksmserver.resumeStartup(QStringLiteral(KWIN_NAME));
KWin::SessionManager weAreIndeed;
KWin::SessionSaveDoneHelper helper;
#warning insertCatalog needs porting
@ -563,7 +563,7 @@ KDE_EXPORT int kdemain(int argc, char * argv[])
QString appname;
if (KWin::screen_number == 0)
appname = "org.kde.kwin";
appname = QStringLiteral("org.kde.kwin");
else
appname.sprintf("org.kde.kwin-screen-%d", KWin::screen_number);

View file

@ -227,7 +227,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
QString activitiesList;
activitiesList = rules()->checkActivity(activitiesList, !isMapped);
if (!activitiesList.isEmpty())
setOnActivities(activitiesList.split(','));
setOnActivities(activitiesList.split(QStringLiteral(",")));
QRect geom(attr.x, attr.y, attr.width, attr.height);
bool placementDone = false;

View file

@ -82,12 +82,12 @@ int currentRefreshRate()
{ // modeline approach failed
QProcess nvidia_settings;
QStringList env = QProcess::systemEnvironment();
env << "LC_ALL=C";
env << QStringLiteral("LC_ALL=C");
nvidia_settings.setEnvironment(env);
nvidia_settings.start("nvidia-settings", QStringList() << "-t" << "-q" << "RefreshRate", QIODevice::ReadOnly);
nvidia_settings.start(QStringLiteral("nvidia-settings"), QStringList() << QStringLiteral("-t") << QStringLiteral("-q") << QStringLiteral("RefreshRate"), QIODevice::ReadOnly);
nvidia_settings.waitForFinished();
if (nvidia_settings.exitStatus() == QProcess::NormalExit) {
QString reply = QString::fromLocal8Bit(nvidia_settings.readAllStandardOutput()).split(' ').first();
QString reply = QString::fromLocal8Bit(nvidia_settings.readAllStandardOutput()).split(QStringLiteral(" ")).first();
bool ok;
float frate = QLocale::c().toFloat(reply, &ok);
if (!ok)
@ -821,7 +821,7 @@ unsigned long Options::loadConfig()
config = KConfigGroup(_config, "MouseBindings");
// TODO: add properties for missing options
CmdTitlebarWheel = mouseWheelCommand(config.readEntry("CommandTitlebarWheel", "Switch to Window Tab to the Left/Right"));
CmdAllModKey = (config.readEntry("CommandAllKey", "Alt") == "Meta") ? Qt::Key_Meta : Qt::Key_Alt;
CmdAllModKey = (config.readEntry("CommandAllKey", "Alt") == QStringLiteral("Meta")) ? Qt::Key_Meta : Qt::Key_Alt;
CmdAllWheel = mouseWheelCommand(config.readEntry("CommandAllWheel", "Nothing"));
setCommandActiveTitlebar1(mouseCommand(config.readEntry("CommandActiveTitlebar1", "Raise"), true));
setCommandActiveTitlebar2(mouseCommand(config.readEntry("CommandActiveTitlebar2", "Start Window Tab Drag"), true));
@ -894,7 +894,7 @@ bool Options::loadCompositingConfig (bool force)
bool useCompositing = false;
CompositingType compositingMode = NoCompositing;
QString compositingBackend = config.readEntry("Backend", "OpenGL");
if (compositingBackend == "XRender")
if (compositingBackend == QStringLiteral("XRender"))
compositingMode = XRenderCompositing;
else
compositingMode = OpenGLCompositing;
@ -999,27 +999,27 @@ void Options::reloadCompositingSettings(bool force)
// may not be able to move it back, unless they know about Alt+LMB)
Options::WindowOperation Options::windowOperation(const QString &name, bool restricted)
{
if (name == "Move")
if (name == QStringLiteral("Move"))
return restricted ? MoveOp : UnrestrictedMoveOp;
else if (name == "Resize")
else if (name == QStringLiteral("Resize"))
return restricted ? ResizeOp : UnrestrictedResizeOp;
else if (name == "Maximize")
else if (name == QStringLiteral("Maximize"))
return MaximizeOp;
else if (name == "Minimize")
else if (name == QStringLiteral("Minimize"))
return MinimizeOp;
else if (name == "Close")
else if (name == QStringLiteral("Close"))
return CloseOp;
else if (name == "OnAllDesktops")
else if (name == QStringLiteral("OnAllDesktops"))
return OnAllDesktopsOp;
else if (name == "Shade")
else if (name == QStringLiteral("Shade"))
return ShadeOp;
else if (name == "Operations")
else if (name == QStringLiteral("Operations"))
return OperationsOp;
else if (name == "Maximize (vertical only)")
else if (name == QStringLiteral("Maximize (vertical only)"))
return VMaximizeOp;
else if (name == "Maximize (horizontal only)")
else if (name == QStringLiteral("Maximize (horizontal only)"))
return HMaximizeOp;
else if (name == "Lower")
else if (name == QStringLiteral("Lower"))
return LowerOp;
return NoOp;
}
@ -1027,43 +1027,43 @@ Options::WindowOperation Options::windowOperation(const QString &name, bool rest
Options::MouseCommand Options::mouseCommand(const QString &name, bool restricted)
{
QString lowerName = name.toLower();
if (lowerName == "raise") return MouseRaise;
if (lowerName == "lower") return MouseLower;
if (lowerName == "operations menu") return MouseOperationsMenu;
if (lowerName == "toggle raise and lower") return MouseToggleRaiseAndLower;
if (lowerName == "activate and raise") return MouseActivateAndRaise;
if (lowerName == "activate and lower") return MouseActivateAndLower;
if (lowerName == "activate") return MouseActivate;
if (lowerName == "activate, raise and pass click") return MouseActivateRaiseAndPassClick;
if (lowerName == "activate and pass click") return MouseActivateAndPassClick;
if (lowerName == "scroll") return MouseNothing;
if (lowerName == "activate and scroll") return MouseActivateAndPassClick;
if (lowerName == "activate, raise and scroll") return MouseActivateRaiseAndPassClick;
if (lowerName == "activate, raise and move")
if (lowerName == QStringLiteral("raise")) return MouseRaise;
if (lowerName == QStringLiteral("lower")) return MouseLower;
if (lowerName == QStringLiteral("operations menu")) return MouseOperationsMenu;
if (lowerName == QStringLiteral("toggle raise and lower")) return MouseToggleRaiseAndLower;
if (lowerName == QStringLiteral("activate and raise")) return MouseActivateAndRaise;
if (lowerName == QStringLiteral("activate and lower")) return MouseActivateAndLower;
if (lowerName == QStringLiteral("activate")) return MouseActivate;
if (lowerName == QStringLiteral("activate, raise and pass click")) return MouseActivateRaiseAndPassClick;
if (lowerName == QStringLiteral("activate and pass click")) return MouseActivateAndPassClick;
if (lowerName == QStringLiteral("scroll")) return MouseNothing;
if (lowerName == QStringLiteral("activate and scroll")) return MouseActivateAndPassClick;
if (lowerName == QStringLiteral("activate, raise and scroll")) return MouseActivateRaiseAndPassClick;
if (lowerName == QStringLiteral("activate, raise and move"))
return restricted ? MouseActivateRaiseAndMove : MouseActivateRaiseAndUnrestrictedMove;
if (lowerName == "move") return restricted ? MouseMove : MouseUnrestrictedMove;
if (lowerName == "resize") return restricted ? MouseResize : MouseUnrestrictedResize;
if (lowerName == "shade") return MouseShade;
if (lowerName == "minimize") return MouseMinimize;
if (lowerName == "start window tab drag") return MouseDragTab;
if (lowerName == "close") return MouseClose;
if (lowerName == "increase opacity") return MouseOpacityMore;
if (lowerName == "decrease opacity") return MouseOpacityLess;
if (lowerName == "nothing") return MouseNothing;
if (lowerName == QStringLiteral("move")) return restricted ? MouseMove : MouseUnrestrictedMove;
if (lowerName == QStringLiteral("resize")) return restricted ? MouseResize : MouseUnrestrictedResize;
if (lowerName == QStringLiteral("shade")) return MouseShade;
if (lowerName == QStringLiteral("minimize")) return MouseMinimize;
if (lowerName == QStringLiteral("start window tab drag")) return MouseDragTab;
if (lowerName == QStringLiteral("close")) return MouseClose;
if (lowerName == QStringLiteral("increase opacity")) return MouseOpacityMore;
if (lowerName == QStringLiteral("decrease opacity")) return MouseOpacityLess;
if (lowerName == QStringLiteral("nothing")) return MouseNothing;
return MouseNothing;
}
Options::MouseWheelCommand Options::mouseWheelCommand(const QString &name)
{
QString lowerName = name.toLower();
if (lowerName == "raise/lower") return MouseWheelRaiseLower;
if (lowerName == "shade/unshade") return MouseWheelShadeUnshade;
if (lowerName == "maximize/restore") return MouseWheelMaximizeRestore;
if (lowerName == "above/below") return MouseWheelAboveBelow;
if (lowerName == "previous/next desktop") return MouseWheelPreviousNextDesktop;
if (lowerName == "change opacity") return MouseWheelChangeOpacity;
if (lowerName == "switch to window tab to the left/right") return MouseWheelChangeCurrentTab;
if (lowerName == "nothing") return MouseWheelNothing;
if (lowerName == QStringLiteral("raise/lower")) return MouseWheelRaiseLower;
if (lowerName == QStringLiteral("shade/unshade")) return MouseWheelShadeUnshade;
if (lowerName == QStringLiteral("maximize/restore")) return MouseWheelMaximizeRestore;
if (lowerName == QStringLiteral("above/below")) return MouseWheelAboveBelow;
if (lowerName == QStringLiteral("previous/next desktop")) return MouseWheelPreviousNextDesktop;
if (lowerName == QStringLiteral("change opacity")) return MouseWheelChangeOpacity;
if (lowerName == QStringLiteral("switch to window tab to the left/right")) return MouseWheelChangeCurrentTab;
if (lowerName == QStringLiteral("nothing")) return MouseWheelNothing;
return MouseWheelChangeCurrentTab;
}

View file

@ -121,7 +121,7 @@ CompositedOutlineVisual::CompositedOutlineVisual(Outline *outline)
QPalette pal = palette();
pal.setColor(backgroundRole(), Qt::transparent);
setPalette(pal);
m_background->setImagePath("widgets/translucentbackground");
m_background->setImagePath(QStringLiteral("widgets/translucentbackground"));
m_background->setCacheAllRenderedFrames(true);
m_background->setEnabledBorders(Plasma::FrameSvg::AllBorders);
}

View file

@ -587,23 +587,23 @@ QRect Placement::checkArea(const Client* c, const QRect& area)
Placement::Policy Placement::policyFromString(const QString& policy, bool no_special)
{
if (policy == "NoPlacement")
if (policy == QStringLiteral("NoPlacement"))
return NoPlacement;
else if (policy == "Default" && !no_special)
else if (policy == QStringLiteral("Default") && !no_special)
return Default;
else if (policy == "Random")
else if (policy == QStringLiteral("Random"))
return Random;
else if (policy == "Cascade")
else if (policy == QStringLiteral("Cascade"))
return Cascade;
else if (policy == "Centered")
else if (policy == QStringLiteral("Centered"))
return Centered;
else if (policy == "ZeroCornered")
else if (policy == QStringLiteral("ZeroCornered"))
return ZeroCornered;
else if (policy == "UnderMouse")
else if (policy == QStringLiteral("UnderMouse"))
return UnderMouse;
else if (policy == "OnMainWindow" && !no_special)
else if (policy == QStringLiteral("OnMainWindow") && !no_special)
return OnMainWindow;
else if (policy == "Maximizing")
else if (policy == QStringLiteral("Maximizing"))
return Maximizing;
else
return Smart;

View file

@ -94,7 +94,7 @@ Rules::Rules(const QString& str, bool temporary)
KConfig cfg(file.fileName(), KConfig::SimpleConfig);
readFromCfg(cfg.group(QString()));
if (description.isEmpty())
description = "temporary";
description = QStringLiteral("temporary");
}
#define READ_MATCH_STRING( var, func ) \
@ -104,19 +104,19 @@ Rules::Rules(const QString& str, bool temporary)
#define READ_SET_RULE( var, func, def ) \
var = func ( cfg.readEntry( #var, def)); \
var##rule = readSetRule( cfg, #var "rule" );
var##rule = readSetRule( cfg, QStringLiteral( #var "rule" ) );
#define READ_SET_RULE_DEF( var , func, def ) \
var = func ( cfg.readEntry( #var, def )); \
var##rule = readSetRule( cfg, #var "rule" );
var##rule = readSetRule( cfg, QStringLiteral( #var "rule" ) );
#define READ_FORCE_RULE( var, func, def) \
var = func ( cfg.readEntry( #var, def)); \
var##rule = readForceRule( cfg, #var "rule" );
var##rule = readForceRule( cfg, QStringLiteral( #var "rule" ) );
#define READ_FORCE_RULE2( var, def, func, funcarg ) \
var = func ( cfg.readEntry( #var, def),funcarg ); \
var##rule = readForceRule( cfg, #var "rule" );
var##rule = readForceRule( cfg, QStringLiteral( #var "rule" ) );
@ -163,8 +163,8 @@ void Rules::readFromCfg(const KConfigGroup& cfg)
READ_SET_RULE(desktop, , 0);
READ_SET_RULE(screen, , 0);
READ_SET_RULE(activity, , QString());
type = readType(cfg, "type");
typerule = type != NET::Unknown ? readForceRule(cfg, "typerule") : UnusedForceRule;
type = readType(cfg, QStringLiteral("type"));
typerule = type != NET::Unknown ? readForceRule(cfg, QStringLiteral("typerule")) : UnusedForceRule;
READ_SET_RULE(maximizevert, , false);
READ_SET_RULE(maximizehoriz, , false);
READ_SET_RULE(minimize, , false);
@ -193,10 +193,10 @@ void Rules::readFromCfg(const KConfigGroup& cfg)
#undef READ_FORCE_RULE
#undef READ_FORCE_RULE2
#define WRITE_MATCH_STRING( var, cast, force ) \
#define WRITE_MATCH_STRING( var, force ) \
if ( !var.isEmpty() || force ) \
{ \
cfg.writeEntry( #var, cast var ); \
cfg.writeEntry( #var, var ); \
cfg.writeEntry( #var "match", (int)var##match ); \
} \
else \
@ -233,11 +233,11 @@ void Rules::write(KConfigGroup& cfg) const
{
cfg.writeEntry("Description", description);
// always write wmclass
WRITE_MATCH_STRING(wmclass, (const char*), true);
WRITE_MATCH_STRING(wmclass, true);
cfg.writeEntry("wmclasscomplete", wmclasscomplete);
WRITE_MATCH_STRING(windowrole, (const char*), false);
WRITE_MATCH_STRING(title, , false);
WRITE_MATCH_STRING(clientmachine, (const char*), false);
WRITE_MATCH_STRING(windowrole, false);
WRITE_MATCH_STRING(title, false);
WRITE_MATCH_STRING(clientmachine, false);
if (types != NET::AllTypesMask)
cfg.writeEntry("types", uint(types));
else
@ -360,7 +360,7 @@ bool Rules::matchWMClass(const QByteArray& match_class, const QByteArray& match_
// TODO optimize?
QByteArray cwmclass = wmclasscomplete
? match_name + ' ' + match_class : match_class;
if (wmclassmatch == RegExpMatch && QRegExp(wmclass).indexIn(cwmclass) == -1)
if (wmclassmatch == RegExpMatch && QRegExp(QString::fromUtf8(wmclass)).indexIn(QString::fromUtf8(cwmclass)) == -1)
return false;
if (wmclassmatch == ExactMatch && wmclass != cwmclass)
return false;
@ -373,7 +373,7 @@ bool Rules::matchWMClass(const QByteArray& match_class, const QByteArray& match_
bool Rules::matchRole(const QByteArray& match_role) const
{
if (windowrolematch != UnimportantMatch) {
if (windowrolematch == RegExpMatch && QRegExp(windowrole).indexIn(match_role) == -1)
if (windowrolematch == RegExpMatch && QRegExp(QString::fromUtf8(windowrole)).indexIn(QString::fromUtf8(match_role)) == -1)
return false;
if (windowrolematch == ExactMatch && windowrole != match_role)
return false;
@ -404,7 +404,7 @@ bool Rules::matchClientMachine(const QByteArray& match_machine, bool local) cons
&& matchClientMachine("localhost", true))
return true;
if (clientmachinematch == RegExpMatch
&& QRegExp(clientmachine).indexIn(match_machine) == -1)
&& QRegExp(QString::fromUtf8(clientmachine)).indexIn(QString::fromUtf8(match_machine)) == -1)
return false;
if (clientmachinematch == ExactMatch
&& clientmachine != match_machine)
@ -472,7 +472,7 @@ bool Rules::update(Client* c, int selection)
}
if NOW_REMEMBER(Activity, activity) {
// TODO: ivan - multiple activities support
const QString & joinedActivities = c->activities().join(",");
const QString & joinedActivities = c->activities().join(QStringLiteral(","));
updated = updated || activity != joinedActivities;
activity = joinedActivities;
}
@ -969,16 +969,16 @@ void RuleBook::edit(Client* c, bool whole_app)
{
save();
QStringList args;
args << "--wid" << QString::number(c->window());
args << QStringLiteral("--wid") << QString::number(c->window());
if (whole_app)
args << "--whole-app";
KToolInvocation::kdeinitExec("kwin_rules_dialog", args);
args << QStringLiteral("--whole-app");
KToolInvocation::kdeinitExec(QStringLiteral("kwin_rules_dialog"), args);
}
void RuleBook::load()
{
deleteAll();
KConfig cfg(QLatin1String(KWIN_NAME) + "rulesrc", KConfig::NoGlobals);
KConfig cfg(QStringLiteral(KWIN_NAME) + QStringLiteral("rulesrc"), KConfig::NoGlobals);
int count = cfg.group("General").readEntry("count", 0);
for (int i = 1;
i <= count;
@ -992,7 +992,7 @@ void RuleBook::load()
void RuleBook::save()
{
m_updateTimer->stop();
KConfig cfg(QLatin1String(KWIN_NAME) + "rulesrc", KConfig::NoGlobals);
KConfig cfg(QStringLiteral(KWIN_NAME) + QStringLiteral("rulesrc"), KConfig::NoGlobals);
QStringList groups = cfg.groupList();
for (QStringList::ConstIterator it = groups.constBegin();
it != groups.constEnd();

View file

@ -130,8 +130,8 @@ SceneOpenGL::SceneOpenGL(Workspace* ws, OpenGLBackend *backend)
// perform Scene specific checks
GLPlatform *glPlatform = GLPlatform::instance();
#ifndef KWIN_HAVE_OPENGLES
if (!hasGLExtension("GL_ARB_texture_non_power_of_two")
&& !hasGLExtension("GL_ARB_texture_rectangle")) {
if (!hasGLExtension(QStringLiteral("GL_ARB_texture_non_power_of_two"))
&& !hasGLExtension(QStringLiteral("GL_ARB_texture_rectangle"))) {
kError(1212) << "GL_ARB_texture_non_power_of_two and GL_ARB_texture_rectangle missing";
init_ok = false;
return; // error
@ -332,7 +332,7 @@ void SceneOpenGL::handleGraphicsReset(GLenum status)
kDebug(1212) << "Attempting to reset compositing.";
QMetaObject::invokeMethod(this, "resetCompositing", Qt::QueuedConnection);
KNotification::event("graphicsreset", i18n("Desktop effects were restarted due to a graphics reset"));
KNotification::event(QStringLiteral("graphicsreset"), i18n("Desktop effects were restarted due to a graphics reset"));
}
qint64 SceneOpenGL::paint(QRegion damage, ToplevelList toplevels)
@ -540,19 +540,19 @@ bool SceneOpenGL::viewportLimitsMatched(const QSize &size) const {
"restrict the OpenGL viewport size.");
const int oldTimeout = QDBusConnection::sessionBus().interface()->timeout();
QDBusConnection::sessionBus().interface()->setTimeout(500);
if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kwinCompositingDialog").value()) {
QDBusInterface dialog( "org.kde.kwinCompositingDialog", "/CompositorSettings", "org.kde.kwinCompositingDialog" );
dialog.asyncCall("warn", message, details, "");
if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.kwinCompositingDialog")).value()) {
QDBusInterface dialog( QStringLiteral("org.kde.kwinCompositingDialog"), QStringLiteral("/CompositorSettings"), QStringLiteral("org.kde.kwinCompositingDialog") );
dialog.asyncCall(QStringLiteral("warn"), message, details, QString());
} else {
const QString args = "warn " + message.toLocal8Bit().toBase64() + " details " + details.toLocal8Bit().toBase64();
KProcess::startDetached("kcmshell4", QStringList() << "kwincompositing" << "--args" << args);
const QString args = QStringLiteral("warn ") + QString::fromUtf8(message.toLocal8Bit().toBase64()) + QStringLiteral(" details ") + QString::fromUtf8(details.toLocal8Bit().toBase64());
KProcess::startDetached(QStringLiteral("kcmshell4"), QStringList() << QStringLiteral("kwincompositing") << QStringLiteral("--args") << args);
}
QDBusConnection::sessionBus().interface()->setTimeout(oldTimeout);
return false;
}
glGetIntegerv(GL_MAX_TEXTURE_SIZE, limit);
if (limit[0] < size.width() || limit[0] < size.height()) {
KConfig cfg("kwin_dialogsrc");
KConfig cfg(QStringLiteral("kwin_dialogsrc"));
if (!KConfigGroup(&cfg, "Notification Messages").readEntry("max_tex_warning", true))
return true;
@ -571,13 +571,13 @@ bool SceneOpenGL::viewportLimitsMatched(const QSize &size) const {
"software rendering in this case.");
const int oldTimeout = QDBusConnection::sessionBus().interface()->timeout();
QDBusConnection::sessionBus().interface()->setTimeout(500);
if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kwinCompositingDialog").value()) {
QDBusInterface dialog( "org.kde.kwinCompositingDialog", "/CompositorSettings", "org.kde.kwinCompositingDialog" );
dialog.asyncCall("warn", message, details, "kwin_dialogsrc:max_tex_warning");
if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.kwinCompositingDialog")).value()) {
QDBusInterface dialog( QStringLiteral("org.kde.kwinCompositingDialog"), QStringLiteral("/CompositorSettings"), QStringLiteral("org.kde.kwinCompositingDialog") );
dialog.asyncCall(QStringLiteral("warn"), message, details, QStringLiteral("kwin_dialogsrc:max_tex_warning"));
} else {
const QString args = "warn " + message.toLocal8Bit().toBase64() + " details " +
details.toLocal8Bit().toBase64() + " dontagain kwin_dialogsrc:max_tex_warning";
KProcess::startDetached("kcmshell4", QStringList() << "kwincompositing" << "--args" << args);
const QString args = QStringLiteral("warn ") + QString::fromUtf8(message.toLocal8Bit().toBase64()) + QStringLiteral(" details ") +
QString::fromUtf8(details.toLocal8Bit().toBase64()) + QStringLiteral(" dontagain kwin_dialogsrc:max_tex_warning");
KProcess::startDetached(QStringLiteral("kcmshell4"), QStringList() << QStringLiteral("kwincompositing") << QStringLiteral("--args") << args);
}
QDBusConnection::sessionBus().interface()->setTimeout(oldTimeout);
}
@ -668,7 +668,7 @@ SceneOpenGL2::SceneOpenGL2(OpenGLBackend *backend)
#ifndef KWIN_HAVE_OPENGLES
// It is not legal to not have a vertex array object bound in a core context
if (hasGLExtension("GL_ARB_vertex_array_object")) {
if (hasGLExtension(QStringLiteral("GL_ARB_vertex_array_object"))) {
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
}
@ -2493,7 +2493,7 @@ char SwapProfiler::end()
m_time = (10*m_time + m_timer.nsecsElapsed())/11;
if (++m_counter > 500) {
const bool blocks = m_time > 1000 * 1000; // 1ms, i get ~250µs and ~7ms w/o triple buffering...
kDebug(1212) << "Triple buffering detection:" << QString(blocks ? "NOT available" : "Available") <<
kDebug(1212) << "Triple buffering detection:" << QString(blocks ? QStringLiteral("NOT available") : QStringLiteral("Available")) <<
" - Mean block time:" << m_time/(1000.0*1000.0) << "ms";
return blocks ? 'd' : 't';
}

View file

@ -190,8 +190,8 @@ bool Edge::handleAction()
{
switch (m_action) {
case ElectricActionDashboard: { // Display Plasma dashboard
QDBusInterface plasmaApp("org.kde.plasma-desktop", "/App");
plasmaApp.asyncCall("toggleDashboard");
QDBusInterface plasmaApp(QStringLiteral("org.kde.plasma-desktop"), QStringLiteral("/App"));
plasmaApp.asyncCall(QStringLiteral("toggleDashboard"));
return true;
}
case ElectricActionShowDesktop: {
@ -199,8 +199,8 @@ bool Edge::handleAction()
return true;
}
case ElectricActionLockScreen: { // Lock the screen
QDBusInterface screenSaver("org.kde.screensaver", "/ScreenSaver");
screenSaver.asyncCall("Lock");
QDBusInterface screenSaver(QStringLiteral("org.kde.screensaver"), QStringLiteral("/ScreenSaver"));
screenSaver.asyncCall(QStringLiteral("Lock"));
return true;
}
default:
@ -569,13 +569,13 @@ void ScreenEdges::init()
static ElectricBorderAction electricBorderAction(const QString& name)
{
QString lowerName = name.toLower();
if (lowerName == "dashboard") {
if (lowerName == QStringLiteral("dashboard")) {
return ElectricActionDashboard;
} else if (lowerName == "showdesktop") {
} else if (lowerName == QStringLiteral("showdesktop")) {
return ElectricActionShowDesktop;
} else if (lowerName == "lockscreen") {
} else if (lowerName == QStringLiteral("lockscreen")) {
return ElectricActionLockScreen;
} else if (lowerName == "preventscreenlocking") {
} else if (lowerName == QStringLiteral("preventscreenlocking")) {
return ElectricActionPreventScreenLocking;
}
return ElectricActionNone;

View file

@ -42,7 +42,7 @@ QObject *GenericScriptedConfigFactory::create(const char *iface, QWidget *parent
{
Q_UNUSED(iface)
Q_UNUSED(parent)
if (keyword.startsWith("kwin4_effect_")) {
if (keyword.startsWith(QStringLiteral("kwin4_effect_"))) {
return new ScriptedEffectConfig(componentData(), keyword, parentWidget, args);
} else {
return new ScriptingConfig(componentData(), keyword, parentWidget, args);
@ -63,8 +63,20 @@ void GenericScriptedConfig::createUi()
{
QVBoxLayout* layout = new QVBoxLayout(this);
const QString kconfigXTFile = KStandardDirs::locate("data", QLatin1String(KWIN_NAME) + '/' + typeName() + '/' + m_packageName + "/contents/config/main.xml");
const QString uiPath = KStandardDirs::locate("data", QLatin1String(KWIN_NAME) + '/' + typeName() + '/' + m_packageName + "/contents/ui/config.ui");
const QString kconfigXTFile = KStandardDirs::locate("data",
QStringLiteral(KWIN_NAME) +
QStringLiteral("/") +
typeName() +
QStringLiteral("/") +
m_packageName +
QStringLiteral("/contents/config/main.xml"));
const QString uiPath = KStandardDirs::locate("data",
QStringLiteral(KWIN_NAME) +
QStringLiteral("/") +
typeName() +
QStringLiteral("/") +
m_packageName +
QStringLiteral("/contents/ui/config.ui"));
if (kconfigXTFile.isEmpty() || uiPath.isEmpty()) {
layout->addWidget(new QLabel(i18nc("Error message", "Plugin does not provide configuration file in expected location")));
return;
@ -104,17 +116,20 @@ ScriptedEffectConfig::~ScriptedEffectConfig()
QString ScriptedEffectConfig::typeName() const
{
return QString("effects");
return QStringLiteral("effects");
}
KConfigGroup ScriptedEffectConfig::configGroup()
{
return KSharedConfig::openConfig(KWIN_CONFIG)->group("Effect-" + packageName());
return KSharedConfig::openConfig(QStringLiteral(KWIN_CONFIG))->group(QStringLiteral("Effect-") + packageName());
}
void ScriptedEffectConfig::reload()
{
QDBusMessage message = QDBusMessage::createMethodCall("org.kde.kwin", "/KWin", "org.kde.KWin", "reconfigureEffect");
QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kwin"),
QStringLiteral("/KWin"),
QStringLiteral("org.kde.KWin"),
QStringLiteral("reconfigureEffect"));
message << QString(packageName());
QDBusConnection::sessionBus().send(message);
}
@ -131,12 +146,12 @@ ScriptingConfig::~ScriptingConfig()
KConfigGroup ScriptingConfig::configGroup()
{
return KSharedConfig::openConfig(KWIN_CONFIG)->group("Script-" + packageName());
return KSharedConfig::openConfig(QStringLiteral(KWIN_CONFIG))->group(QStringLiteral("Script-") + packageName());
}
QString ScriptingConfig::typeName() const
{
return QString("scripts");
return QStringLiteral("scripts");
}
void ScriptingConfig::reload()

View file

@ -29,15 +29,15 @@ using namespace KWin::MetaScripting;
QScriptValue Point::toScriptValue(QScriptEngine* eng, const QPoint& point)
{
QScriptValue temp = eng->newObject();
temp.setProperty("x", point.x());
temp.setProperty("y", point.y());
temp.setProperty(QStringLiteral("x"), point.x());
temp.setProperty(QStringLiteral("y"), point.y());
return temp;
}
void Point::fromScriptValue(const QScriptValue& obj, QPoint& point)
{
QScriptValue x = obj.property("x", QScriptValue::ResolveLocal);
QScriptValue y = obj.property("y", QScriptValue::ResolveLocal);
QScriptValue x = obj.property(QStringLiteral("x"), QScriptValue::ResolveLocal);
QScriptValue y = obj.property(QStringLiteral("y"), QScriptValue::ResolveLocal);
if (!x.isUndefined() && !y.isUndefined()) {
point.setX(x.toInt32());
@ -50,15 +50,15 @@ void Point::fromScriptValue(const QScriptValue& obj, QPoint& point)
QScriptValue Size::toScriptValue(QScriptEngine* eng, const QSize& size)
{
QScriptValue temp = eng->newObject();
temp.setProperty("w", size.width());
temp.setProperty("h", size.height());
temp.setProperty(QStringLiteral("w"), size.width());
temp.setProperty(QStringLiteral("h"), size.height());
return temp;
}
void Size::fromScriptValue(const QScriptValue& obj, QSize& size)
{
QScriptValue w = obj.property("w", QScriptValue::ResolveLocal);
QScriptValue h = obj.property("h", QScriptValue::ResolveLocal);
QScriptValue w = obj.property(QStringLiteral("w"), QScriptValue::ResolveLocal);
QScriptValue h = obj.property(QStringLiteral("h"), QScriptValue::ResolveLocal);
if (!w.isUndefined() && !h.isUndefined()) {
size.setWidth(w.toInt32());
@ -72,20 +72,20 @@ void Size::fromScriptValue(const QScriptValue& obj, QSize& size)
QScriptValue Rect::toScriptValue(QScriptEngine* eng, const QRect& rect)
{
QScriptValue temp = eng->newObject();
temp.setProperty("x", rect.x());
temp.setProperty("y", rect.y());
temp.setProperty("width", rect.width());
temp.setProperty("height", rect.height());
temp.setProperty(QStringLiteral("x"), rect.x());
temp.setProperty(QStringLiteral("y"), rect.y());
temp.setProperty(QStringLiteral("width"), rect.width());
temp.setProperty(QStringLiteral("height"), rect.height());
return temp;
}
void Rect::fromScriptValue(const QScriptValue& obj, QRect &rect)
{
QScriptValue w = obj.property("width", QScriptValue::ResolveLocal);
QScriptValue h = obj.property("height", QScriptValue::ResolveLocal);
QScriptValue x = obj.property("x", QScriptValue::ResolveLocal);
QScriptValue y = obj.property("y", QScriptValue::ResolveLocal);
QScriptValue w = obj.property(QStringLiteral("width"), QScriptValue::ResolveLocal);
QScriptValue h = obj.property(QStringLiteral("height"), QScriptValue::ResolveLocal);
QScriptValue x = obj.property(QStringLiteral("x"), QScriptValue::ResolveLocal);
QScriptValue y = obj.property(QStringLiteral("y"), QScriptValue::ResolveLocal);
if (!w.isUndefined() && !h.isUndefined() && !x.isUndefined() && !y.isUndefined()) {
rect.setX(x.toInt32());
@ -179,7 +179,7 @@ QScriptValue KWin::MetaScripting::getConfigValue(QScriptContext* ctx, QScriptEng
if ((ctx->argument(0)).isArray()) {
bool simple = (num == 1) ? 0 : (ctx->argument(1)).toBool();
QScriptValue array = (ctx->argument(0));
int len = (array.property("length").isValid()) ? array.property("length").toNumber() : 0;
int len = (array.property(QStringLiteral("length")).isValid()) ? array.property(QStringLiteral("length")).toNumber() : 0;
for (int i = 0; i < len; i++) {
QVariant val = scriptConfig.value(array.property(i).toString(), QVariant());
@ -218,10 +218,10 @@ void KWin::MetaScripting::supplyConfig(QScriptEngine* eng, const QVariant& scrip
{
QScriptValue configObject = eng->newObject();
configObject.setData(eng->newVariant(scriptConfig));
configObject.setProperty("get", eng->newFunction(getConfigValue, 0), QScriptValue::Undeletable);
configObject.setProperty("exists", eng->newFunction(configExists, 0), QScriptValue::Undeletable);
configObject.setProperty("loaded", ((scriptConfig.toHash().empty()) ? eng->newVariant((bool)0) : eng->newVariant((bool)1)), QScriptValue::Undeletable);
(eng->globalObject()).setProperty("config", configObject);
configObject.setProperty(QStringLiteral("get"), eng->newFunction(getConfigValue, 0), QScriptValue::Undeletable);
configObject.setProperty(QStringLiteral("exists"), eng->newFunction(configExists, 0), QScriptValue::Undeletable);
configObject.setProperty(QStringLiteral("loaded"), ((scriptConfig.toHash().empty()) ? eng->newVariant((bool)0) : eng->newVariant((bool)1)), QScriptValue::Undeletable);
(eng->globalObject()).setProperty(QStringLiteral("config"), configObject);
}
void KWin::MetaScripting::supplyConfig(QScriptEngine* eng)

View file

@ -49,7 +49,7 @@ QScriptValue kwinEffectScriptPrint(QScriptContext *context, QScriptEngine *engin
QString result;
for (int i = 0; i < context->argumentCount(); ++i) {
if (i > 0) {
result.append(" ");
result.append(QStringLiteral(" "));
}
result.append(context->argument(i).toString());
}
@ -109,10 +109,10 @@ AnimationSettings animationSettingsFromObject(QScriptValue &object)
AnimationSettings settings;
settings.set = 0;
settings.to = qscriptvalue_cast<FPx2>(object.property("to"));
settings.from = qscriptvalue_cast<FPx2>(object.property("from"));
settings.to = qscriptvalue_cast<FPx2>(object.property(QStringLiteral("to")));
settings.from = qscriptvalue_cast<FPx2>(object.property(QStringLiteral("from")));
QScriptValue duration = object.property("duration");
QScriptValue duration = object.property(QStringLiteral("duration"));
if (duration.isValid() && duration.isNumber()) {
settings.duration = duration.toUInt32();
settings.set |= AnimationSettings::Duration;
@ -120,7 +120,7 @@ AnimationSettings animationSettingsFromObject(QScriptValue &object)
settings.duration = 0;
}
QScriptValue delay = object.property("delay");
QScriptValue delay = object.property(QStringLiteral("delay"));
if (delay.isValid() && delay.isNumber()) {
settings.delay = delay.toInt32();
settings.set |= AnimationSettings::Delay;
@ -128,7 +128,7 @@ AnimationSettings animationSettingsFromObject(QScriptValue &object)
settings.delay = 0;
}
QScriptValue curve = object.property("curve");
QScriptValue curve = object.property(QStringLiteral("curve"));
if (curve.isValid() && curve.isNumber()) {
settings.curve = static_cast<QEasingCurve::Type>(curve.toInt32());
settings.set |= AnimationSettings::Curve;
@ -136,7 +136,7 @@ AnimationSettings animationSettingsFromObject(QScriptValue &object)
settings.curve = QEasingCurve::Linear;
}
QScriptValue type = object.property("type");
QScriptValue type = object.property(QStringLiteral("type"));
if (type.isValid() && type.isNumber()) {
settings.type = static_cast<AnimationEffect::Attribute>(type.toInt32());
settings.set |= AnimationSettings::Type;
@ -151,35 +151,35 @@ QList<AnimationSettings> animationSettings(QScriptContext *context, ScriptedEffe
{
QList<AnimationSettings> settings;
if (!effect) {
context->throwError(QScriptContext::ReferenceError, "Internal Scripted KWin Effect error");
context->throwError(QScriptContext::ReferenceError, QStringLiteral("Internal Scripted KWin Effect error"));
return settings;
}
if (context->argumentCount() != 1) {
context->throwError(QScriptContext::SyntaxError, "Exactly one argument expected");
context->throwError(QScriptContext::SyntaxError, QStringLiteral("Exactly one argument expected"));
return settings;
}
if (!context->argument(0).isObject()) {
context->throwError(QScriptContext::TypeError, "Argument needs to be an object");
context->throwError(QScriptContext::TypeError, QStringLiteral("Argument needs to be an object"));
return settings;
}
QScriptValue object = context->argument(0);
QScriptValue windowProperty = object.property("window");
QScriptValue windowProperty = object.property(QStringLiteral("window"));
if (!windowProperty.isValid() || !windowProperty.isObject()) {
context->throwError(QScriptContext::TypeError, "Window property missing in animation options");
context->throwError(QScriptContext::TypeError, QStringLiteral("Window property missing in animation options"));
return settings;
}
*window = qobject_cast<EffectWindow*>(windowProperty.toQObject());
settings << animationSettingsFromObject(object); // global
QScriptValue animations = object.property("animations"); // array
QScriptValue animations = object.property(QStringLiteral("animations")); // array
if (animations.isValid()) {
if (!animations.isArray()) {
context->throwError(QScriptContext::TypeError, "Animations provided but not an array");
context->throwError(QScriptContext::TypeError, QStringLiteral("Animations provided but not an array"));
settings.clear();
return settings;
}
const int length = static_cast<int>(animations.property("length").toInteger());
const int length = static_cast<int>(animations.property(QStringLiteral("length")).toInteger());
for (int i=0; i<length; ++i) {
QScriptValue value = animations.property(QString::number(i));
if (!value.isValid()) {
@ -190,11 +190,11 @@ QList<AnimationSettings> animationSettings(QScriptContext *context, ScriptedEffe
const uint set = s.set | settings.at(0).set;
// Catch show stoppers (incompletable animation)
if (!(set & AnimationSettings::Type)) {
context->throwError(QScriptContext::TypeError, "Type property missing in animation options");
context->throwError(QScriptContext::TypeError, QStringLiteral("Type property missing in animation options"));
continue;
}
if (!(set & AnimationSettings::Duration)) {
context->throwError(QScriptContext::TypeError, "Duration property missing in animation options");
context->throwError(QScriptContext::TypeError, QStringLiteral("Duration property missing in animation options"));
continue;
}
// Complete local animations from global settings
@ -215,11 +215,11 @@ QList<AnimationSettings> animationSettings(QScriptContext *context, ScriptedEffe
if (settings.count() == 1) {
const uint set = settings.at(0).set;
if (!(set & AnimationSettings::Type)) {
context->throwError(QScriptContext::TypeError, "Type property missing in animation options");
context->throwError(QScriptContext::TypeError, QStringLiteral("Type property missing in animation options"));
settings.clear();
}
if (!(set & AnimationSettings::Duration)) {
context->throwError(QScriptContext::TypeError, "Duration property missing in animation options");
context->throwError(QScriptContext::TypeError, QStringLiteral("Duration property missing in animation options"));
settings.clear();
}
} else if (!(settings.at(0).set & AnimationSettings::Type)) { // invalid global
@ -235,11 +235,11 @@ QScriptValue kwinEffectAnimate(QScriptContext *context, QScriptEngine *engine)
EffectWindow *window;
QList<AnimationSettings> settings = animationSettings(context, effect, &window);
if (settings.empty()) {
context->throwError(QScriptContext::TypeError, "No animations provided");
context->throwError(QScriptContext::TypeError, QStringLiteral("No animations provided"));
return engine->undefinedValue();
}
if (!window) {
context->throwError(QScriptContext::TypeError, "Window property does not contain an EffectWindow");
context->throwError(QScriptContext::TypeError, QStringLiteral("Window property does not contain an EffectWindow"));
return engine->undefinedValue();
}
@ -264,11 +264,11 @@ QScriptValue kwinEffectSet(QScriptContext *context, QScriptEngine *engine)
EffectWindow *window;
QList<AnimationSettings> settings = animationSettings(context, effect, &window);
if (settings.empty()) {
context->throwError(QScriptContext::TypeError, "No animations provided");
context->throwError(QScriptContext::TypeError, QStringLiteral("No animations provided"));
return engine->undefinedValue();
}
if (!window) {
context->throwError(QScriptContext::TypeError, "Window property does not contain an EffectWindow");
context->throwError(QScriptContext::TypeError, QStringLiteral("Window property does not contain an EffectWindow"));
return engine->undefinedValue();
}
@ -291,7 +291,7 @@ QScriptValue kwinEffectCancel(QScriptContext *context, QScriptEngine *engine)
{
ScriptedEffect *effect = qobject_cast<ScriptedEffect*>(context->callee().data().toQObject());
if (context->argumentCount() != 1) {
context->throwError(QScriptContext::SyntaxError, "Exactly one argument expected");
context->throwError(QScriptContext::SyntaxError, QStringLiteral("Exactly one argument expected"));
return engine->undefinedValue();
}
QVariant v = context->argument(0).toVariant();
@ -314,7 +314,7 @@ QScriptValue kwinEffectCancel(QScriptContext *context, QScriptEngine *engine)
}
}
if (!ok) {
context->throwError(QScriptContext::TypeError, "Argument needs to be one or several quint64");
context->throwError(QScriptContext::TypeError, QStringLiteral("Argument needs to be one or several quint64"));
return engine->undefinedValue();
}
@ -339,8 +339,8 @@ void effectWindowFromScriptValue(const QScriptValue &value, EffectWindow* &windo
QScriptValue fpx2ToScriptValue(QScriptEngine *eng, const KWin::FPx2 &fpx2)
{
QScriptValue val = eng->newObject();
val.setProperty("value1", fpx2[0]);
val.setProperty("value2", fpx2[1]);
val.setProperty(QStringLiteral("value1"), fpx2[0]);
val.setProperty(QStringLiteral("value2"), fpx2[1]);
return val;
}
@ -355,8 +355,8 @@ void fpx2FromScriptValue(const QScriptValue &value, KWin::FPx2 &fpx2)
return;
}
if (value.isObject()) {
QScriptValue value1 = value.property("value1");
QScriptValue value2 = value.property("value2");
QScriptValue value1 = value.property(QStringLiteral("value1"));
QScriptValue value2 = value.property(QStringLiteral("value2"));
if (!value1.isValid() || !value2.isValid() || !value1.isNumber() || !value2.isNumber()) {
kDebug(1212) << "Cannot cast scripted FPx2 to C++";
fpx2 = FPx2();
@ -400,7 +400,7 @@ bool ScriptedEffect::init(const QString &effectName, const QString &pathToScript
m_scriptFile = pathToScript;
// does the effect contain an KConfigXT file?
const QString kconfigXTFile = KStandardDirs::locate("data", QLatin1String(KWIN_NAME) + "/effects/" + m_effectName + "/contents/config/main.xml");
const QString kconfigXTFile = KStandardDirs::locate("data", QStringLiteral(KWIN_NAME) + QStringLiteral("/effects/") + m_effectName + QStringLiteral("/contents/config/main.xml"));
if (!kconfigXTFile.isNull()) {
KConfigGroup cg = effects->effectConfig(m_effectName);
QFile xmlFile(kconfigXTFile);
@ -409,12 +409,12 @@ bool ScriptedEffect::init(const QString &effectName, const QString &pathToScript
}
QScriptValue effectsObject = m_engine->newQObject(effects, QScriptEngine::QtOwnership, QScriptEngine::ExcludeDeleteLater);
m_engine->globalObject().setProperty("effects", effectsObject, QScriptValue::Undeletable);
m_engine->globalObject().setProperty("Effect", m_engine->newQMetaObject(&ScriptedEffect::staticMetaObject));
m_engine->globalObject().setProperty("KWin", m_engine->newQMetaObject(&WorkspaceWrapper::staticMetaObject));
m_engine->globalObject().setProperty("QEasingCurve", m_engine->newQMetaObject(&QEasingCurve::staticMetaObject));
m_engine->globalObject().setProperty("effect", m_engine->newQObject(this, QScriptEngine::QtOwnership, QScriptEngine::ExcludeDeleteLater), QScriptValue::Undeletable);
m_engine->globalObject().setProperty("AnimationData", m_engine->scriptValueFromQMetaObject<AnimationData>());
m_engine->globalObject().setProperty(QStringLiteral("effects"), effectsObject, QScriptValue::Undeletable);
m_engine->globalObject().setProperty(QStringLiteral("Effect"), m_engine->newQMetaObject(&ScriptedEffect::staticMetaObject));
m_engine->globalObject().setProperty(QStringLiteral("KWin"), m_engine->newQMetaObject(&WorkspaceWrapper::staticMetaObject));
m_engine->globalObject().setProperty(QStringLiteral("QEasingCurve"), m_engine->newQMetaObject(&QEasingCurve::staticMetaObject));
m_engine->globalObject().setProperty(QStringLiteral("effect"), m_engine->newQObject(this, QScriptEngine::QtOwnership, QScriptEngine::ExcludeDeleteLater), QScriptValue::Undeletable);
m_engine->globalObject().setProperty(QStringLiteral("AnimationData"), m_engine->scriptValueFromQMetaObject<AnimationData>());
MetaScripting::registration(m_engine);
qScriptRegisterMetaType<KEffectWindowRef>(m_engine, effectWindowToScriptValue, effectWindowFromScriptValue);
qScriptRegisterMetaType<KWin::FPx2>(m_engine, fpx2ToScriptValue, fpx2FromScriptValue);
@ -422,35 +422,35 @@ bool ScriptedEffect::init(const QString &effectName, const QString &pathToScript
// add our print
QScriptValue printFunc = m_engine->newFunction(kwinEffectScriptPrint);
printFunc.setData(m_engine->newQObject(this));
m_engine->globalObject().setProperty("print", printFunc);
m_engine->globalObject().setProperty(QStringLiteral("print"), printFunc);
// add our animationTime
QScriptValue animationTimeFunc = m_engine->newFunction(kwinEffectScriptAnimationTime);
animationTimeFunc.setData(m_engine->newQObject(this));
m_engine->globalObject().setProperty("animationTime", animationTimeFunc);
m_engine->globalObject().setProperty(QStringLiteral("animationTime"), animationTimeFunc);
// add displayWidth and displayHeight
QScriptValue displayWidthFunc = m_engine->newFunction(kwinEffectDisplayWidth);
m_engine->globalObject().setProperty("displayWidth", displayWidthFunc);
m_engine->globalObject().setProperty(QStringLiteral("displayWidth"), displayWidthFunc);
QScriptValue displayHeightFunc = m_engine->newFunction(kwinEffectDisplayHeight);
m_engine->globalObject().setProperty("displayHeight", displayHeightFunc);
m_engine->globalObject().setProperty(QStringLiteral("displayHeight"), displayHeightFunc);
// add global Shortcut
registerGlobalShortcutFunction(this, m_engine, kwinScriptGlobalShortcut);
registerScreenEdgeFunction(this, m_engine, kwinScriptScreenEdge);
// add the animate method
QScriptValue animateFunc = m_engine->newFunction(kwinEffectAnimate);
animateFunc.setData(m_engine->newQObject(this));
m_engine->globalObject().setProperty("animate", animateFunc);
m_engine->globalObject().setProperty(QStringLiteral("animate"), animateFunc);
// and the set variant
QScriptValue setFunc = m_engine->newFunction(kwinEffectSet);
setFunc.setData(m_engine->newQObject(this));
m_engine->globalObject().setProperty("set", setFunc);
m_engine->globalObject().setProperty(QStringLiteral("set"), setFunc);
// cancel...
QScriptValue cancelFunc = m_engine->newFunction(kwinEffectCancel);
cancelFunc.setData(m_engine->newQObject(this));
m_engine->globalObject().setProperty("cancel", cancelFunc);
m_engine->globalObject().setProperty(QStringLiteral("cancel"), cancelFunc);
QScriptValue ret = m_engine->evaluate(scriptFile.readAll());
QScriptValue ret = m_engine->evaluate(QString::fromUtf8(scriptFile.readAll()));
if (ret.isError()) {
signalHandlerException(ret);

View file

@ -164,7 +164,7 @@ QScriptValue kwinCallDBus(QScriptContext *context, QScriptEngine *engine)
{
KWin::AbstractScript *script = qobject_cast<KWin::AbstractScript*>(context->callee().data().toQObject());
if (!script) {
context->throwError(QScriptContext::UnknownError, "Internal Error: script not registered");
context->throwError(QScriptContext::UnknownError, QStringLiteral("Internal Error: script not registered"));
return engine->undefinedValue();
}
if (context->argumentCount() < 4) {
@ -231,7 +231,7 @@ KWin::AbstractScript::~AbstractScript()
KConfigGroup KWin::AbstractScript::config() const
{
return KGlobal::config()->group("Script-" + m_pluginName);
return KGlobal::config()->group(QStringLiteral("Script-") + m_pluginName);
}
void KWin::AbstractScript::stop()
@ -267,14 +267,14 @@ void KWin::AbstractScript::installScriptFunctions(QScriptEngine* engine)
// add our print
QScriptValue printFunc = engine->newFunction(kwinScriptPrint);
printFunc.setData(engine->newQObject(this));
engine->globalObject().setProperty("print", printFunc);
engine->globalObject().setProperty(QStringLiteral("print"), printFunc);
// add read config
QScriptValue configFunc = engine->newFunction(kwinScriptReadConfig);
configFunc.setData(engine->newQObject(this));
engine->globalObject().setProperty("readConfig", configFunc);
engine->globalObject().setProperty(QStringLiteral("readConfig"), configFunc);
QScriptValue dbusCallFunc = engine->newFunction(kwinCallDBus);
dbusCallFunc.setData(engine->newQObject(this));
engine->globalObject().setProperty("callDBus", dbusCallFunc);
engine->globalObject().setProperty(QStringLiteral("callDBus"), dbusCallFunc);
// add global Shortcut
registerGlobalShortcutFunction(this, engine, kwinScriptGlobalShortcut);
// add screen edge
@ -283,22 +283,22 @@ void KWin::AbstractScript::installScriptFunctions(QScriptEngine* engine)
regesterUserActionsMenuFunction(this, engine, kwinRegisterUserActionsMenu);
// add assertions
QScriptValue assertTrueFunc = engine->newFunction(kwinAssertTrue);
engine->globalObject().setProperty("assertTrue", assertTrueFunc);
engine->globalObject().setProperty("assert", assertTrueFunc);
engine->globalObject().setProperty(QStringLiteral("assertTrue"), assertTrueFunc);
engine->globalObject().setProperty(QStringLiteral("assert"), assertTrueFunc);
QScriptValue assertFalseFunc = engine->newFunction(kwinAssertFalse);
engine->globalObject().setProperty("assertFalse", assertFalseFunc);
engine->globalObject().setProperty(QStringLiteral("assertFalse"), assertFalseFunc);
QScriptValue assertEqualsFunc = engine->newFunction(kwinAssertEquals);
engine->globalObject().setProperty("assertEquals", assertEqualsFunc);
engine->globalObject().setProperty(QStringLiteral("assertEquals"), assertEqualsFunc);
QScriptValue assertNullFunc = engine->newFunction(kwinAssertNull);
engine->globalObject().setProperty("assertNull", assertNullFunc);
engine->globalObject().setProperty("assertEquals", assertEqualsFunc);
engine->globalObject().setProperty(QStringLiteral("assertNull"), assertNullFunc);
engine->globalObject().setProperty(QStringLiteral("assertEquals"), assertEqualsFunc);
QScriptValue assertNotNullFunc = engine->newFunction(kwinAssertNotNull);
engine->globalObject().setProperty("assertNotNull", assertNotNullFunc);
engine->globalObject().setProperty(QStringLiteral("assertNotNull"), assertNotNullFunc);
// global properties
engine->globalObject().setProperty("KWin", engine->newQMetaObject(&WorkspaceWrapper::staticMetaObject));
engine->globalObject().setProperty(QStringLiteral("KWin"), engine->newQMetaObject(&WorkspaceWrapper::staticMetaObject));
QScriptValue workspace = engine->newQObject(AbstractScript::workspace(), QScriptEngine::QtOwnership,
QScriptEngine::ExcludeSuperClassContents | QScriptEngine::ExcludeDeleteLater);
engine->globalObject().setProperty("workspace", workspace, QScriptValue::Undeletable);
engine->globalObject().setProperty(QStringLiteral("workspace"), workspace, QScriptValue::Undeletable);
// install meta functions
KWin::MetaScripting::registration(engine);
}
@ -359,11 +359,11 @@ QList< QAction * > KWin::AbstractScript::actionsForUserActionMenu(KWin::Client *
QAction *KWin::AbstractScript::scriptValueToAction(QScriptValue &value, QMenu *parent)
{
QScriptValue titleValue = value.property("text");
QScriptValue checkableValue = value.property("checkable");
QScriptValue checkedValue = value.property("checked");
QScriptValue itemsValue = value.property("items");
QScriptValue triggeredValue = value.property("triggered");
QScriptValue titleValue = value.property(QStringLiteral("text"));
QScriptValue checkableValue = value.property(QStringLiteral("checkable"));
QScriptValue checkedValue = value.property(QStringLiteral("checked"));
QScriptValue itemsValue = value.property(QStringLiteral("items"));
QScriptValue triggeredValue = value.property(QStringLiteral("triggered"));
if (!titleValue.isValid()) {
// title not specified - does not make any sense to include
@ -378,7 +378,7 @@ QAction *KWin::AbstractScript::scriptValueToAction(QScriptValue &value, QMenu *p
// not an array, so cannot be a menu
return NULL;
}
QScriptValue lengthValue = itemsValue.property("length");
QScriptValue lengthValue = itemsValue.property(QStringLiteral("length"));
if (!lengthValue.isValid() || !lengthValue.isNumber() || lengthValue.toInteger() == 0) {
// length property missing
return NULL;
@ -406,7 +406,7 @@ QAction *KWin::AbstractScript::createAction(const QString &title, bool checkable
QAction *KWin::AbstractScript::createMenu(const QString &title, QScriptValue &items, QMenu *parent)
{
QMenu *menu = new QMenu(title, parent);
const int length = static_cast<int>(items.property("length").toInteger());
const int length = static_cast<int>(items.property(QStringLiteral("length")).toInteger());
for (int i=0; i<length; ++i) {
QScriptValue value = items.property(QString::number(i));
if (!value.isValid()) {
@ -434,12 +434,12 @@ KWin::Script::Script(int id, QString scriptName, QString pluginName, QObject* pa
, m_starting(false)
, m_agent(new ScriptUnloaderAgent(this))
{
QDBusConnection::sessionBus().registerObject('/' + QString::number(scriptId()), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportScriptableInvokables);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/") + QString::number(scriptId()), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportScriptableInvokables);
}
KWin::Script::~Script()
{
QDBusConnection::sessionBus().unregisterObject('/' + QString::number(scriptId()));
QDBusConnection::sessionBus().unregisterObject(QStringLiteral("/") + QString::number(scriptId()));
}
void KWin::Script::run()
@ -478,13 +478,13 @@ void KWin::Script::slotScriptLoadedFromFile()
}
QScriptValue optionsValue = m_engine->newQObject(options, QScriptEngine::QtOwnership,
QScriptEngine::ExcludeSuperClassContents | QScriptEngine::ExcludeDeleteLater);
m_engine->globalObject().setProperty("options", optionsValue, QScriptValue::Undeletable);
m_engine->globalObject().setProperty("QTimer", constructTimerClass(m_engine));
m_engine->globalObject().setProperty(QStringLiteral("options"), optionsValue, QScriptValue::Undeletable);
m_engine->globalObject().setProperty(QStringLiteral("QTimer"), constructTimerClass(m_engine));
QObject::connect(m_engine, SIGNAL(signalHandlerException(QScriptValue)), this, SLOT(sigException(QScriptValue)));
KWin::MetaScripting::supplyConfig(m_engine);
installScriptFunctions(m_engine);
QScriptValue ret = m_engine->evaluate(watcher->result());
QScriptValue ret = m_engine->evaluate(QString::fromUtf8(watcher->result()));
if (ret.isError()) {
sigException(ret);
@ -559,7 +559,7 @@ void KWin::DeclarativeScript::run()
qmlRegisterType<KWin::ScriptingClientModel::ClientFilterModel>("org.kde.kwin", 0, 1, "ClientFilterModel");
qmlRegisterType<KWin::Client>();
m_engine->rootContext()->setContextProperty("options", options);
m_engine->rootContext()->setContextProperty(QStringLiteral("options"), options);
m_component->loadUrl(QUrl::fromLocalFile(scriptFile().fileName()));
if (m_component->isLoading()) {
@ -592,8 +592,8 @@ KWin::Scripting::Scripting(QObject *parent)
: QObject(parent)
, m_scriptsLock(new QMutex(QMutex::Recursive))
{
QDBusConnection::sessionBus().registerObject("/Scripting", this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportScriptableInvokables);
QDBusConnection::sessionBus().registerService("org.kde.kwin.Scripting");
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Scripting"), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportScriptableInvokables);
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.kwin.Scripting"));
connect(Workspace::self(), SIGNAL(configChanged()), SLOT(start()));
connect(Workspace::self(), SIGNAL(workspaceInitialized()), SLOT(start()));
}
@ -632,7 +632,7 @@ LoadScriptList KWin::Scripting::queryScriptsToLoad()
s_started = true;
}
QMap<QString,QString> pluginStates = KConfigGroup(_config, "Plugins").entryMap();
KService::List offers = KServiceTypeTrader::self()->query("KWin/Script");
KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("KWin/Script"));
LoadScriptList scriptsToLoad;
@ -640,8 +640,8 @@ LoadScriptList KWin::Scripting::queryScriptsToLoad()
KPluginInfo plugininfo(service);
const QString value = pluginStates.value(plugininfo.pluginName() + QString::fromLatin1("Enabled"), QString());
plugininfo.setPluginEnabled(value.isNull() ? plugininfo.isPluginEnabledByDefault() : QVariant(value).toBool());
const bool javaScript = service->property("X-Plasma-API").toString() == "javascript";
const bool declarativeScript = service->property("X-Plasma-API").toString() == "declarativescript";
const bool javaScript = service->property(QStringLiteral("X-Plasma-API")).toString() == QStringLiteral("javascript");
const bool declarativeScript = service->property(QStringLiteral("X-Plasma-API")).toString() == QStringLiteral("declarativescript");
if (!javaScript && !declarativeScript) {
continue;
}
@ -653,9 +653,9 @@ LoadScriptList KWin::Scripting::queryScriptsToLoad()
}
continue;
}
const QString pluginName = service->property("X-KDE-PluginInfo-Name").toString();
const QString scriptName = service->property("X-Plasma-MainScript").toString();
const QString file = KStandardDirs::locate("data", QLatin1String(KWIN_NAME) + "/scripts/" + pluginName + "/contents/" + scriptName);
const QString pluginName = service->property(QStringLiteral("X-KDE-PluginInfo-Name")).toString();
const QString scriptName = service->property(QStringLiteral("X-Plasma-MainScript")).toString();
const QString file = KStandardDirs::locate("data", QStringLiteral(KWIN_NAME) + QStringLiteral("/scripts/") + pluginName + QStringLiteral("/contents/") + scriptName);
if (file.isNull()) {
kDebug(1212) << "Could not find script file for " << pluginName;
continue;
@ -753,8 +753,8 @@ int KWin::Scripting::loadDeclarativeScript(const QString& filePath, const QStrin
KWin::Scripting::~Scripting()
{
QDBusConnection::sessionBus().unregisterObject("/Scripting");
QDBusConnection::sessionBus().unregisterService("org.kde.kwin.Scripting");
QDBusConnection::sessionBus().unregisterObject(QStringLiteral("/Scripting"));
QDBusConnection::sessionBus().unregisterService(QStringLiteral("org.kde.kwin.Scripting"));
s_self = NULL;
}

View file

@ -885,15 +885,15 @@ bool ClientFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourc
if (client->caption().contains(m_filter, Qt::CaseInsensitive)) {
return true;
}
const QString windowRole(client->windowRole());
const QString windowRole(QString::fromUtf8(client->windowRole()));
if (windowRole.contains(m_filter, Qt::CaseInsensitive)) {
return true;
}
const QString resourceName(client->resourceName());
const QString resourceName(QString::fromUtf8(client->resourceName()));
if (resourceName.contains(m_filter, Qt::CaseInsensitive)) {
return true;
}
const QString resourceClass(client->resourceClass());
const QString resourceClass(QString::fromUtf8(client->resourceClass()));
if (resourceClass.contains(m_filter, Qt::CaseInsensitive)) {
return true;
}

View file

@ -262,21 +262,21 @@ inline void registerGlobalShortcutFunction(QObject *parent, QScriptEngine *engin
{
QScriptValue shortcutFunc = engine->newFunction(function);
shortcutFunc.setData(engine->newQObject(parent));
engine->globalObject().setProperty("registerShortcut", shortcutFunc);
engine->globalObject().setProperty(QStringLiteral("registerShortcut"), shortcutFunc);
}
inline void registerScreenEdgeFunction(QObject *parent, QScriptEngine *engine, QScriptEngine::FunctionSignature function)
{
QScriptValue shortcutFunc = engine->newFunction(function);
shortcutFunc.setData(engine->newQObject(parent));
engine->globalObject().setProperty("registerScreenEdge", shortcutFunc);
engine->globalObject().setProperty(QStringLiteral("registerScreenEdge"), shortcutFunc);
}
inline void regesterUserActionsMenuFunction(QObject *parent, QScriptEngine *engine, QScriptEngine::FunctionSignature function)
{
QScriptValue shortcutFunc = engine->newFunction(function);
shortcutFunc.setData(engine->newQObject(parent));
engine->globalObject().setProperty("registerUserActionsMenu", shortcutFunc);
engine->globalObject().setProperty(QStringLiteral("registerUserActionsMenu"), shortcutFunc);
}
} // namespace KWin

112
sm.cpp
View file

@ -123,45 +123,45 @@ void Workspace::storeClient(KConfigGroup &cg, int num, Client *c)
{
c->setSessionInteract(false); //make sure we get the real values
QString n = QString::number(num);
cg.writeEntry(QString("sessionId") + n, c->sessionId().constData());
cg.writeEntry(QString("windowRole") + n, c->windowRole().constData());
cg.writeEntry(QString("wmCommand") + n, c->wmCommand().constData());
cg.writeEntry(QString("wmClientMachine") + n, c->wmClientMachine(true).constData());
cg.writeEntry(QString("resourceName") + n, c->resourceName().constData());
cg.writeEntry(QString("resourceClass") + n, c->resourceClass().constData());
cg.writeEntry(QString("geometry") + n, QRect(c->calculateGravitation(true), c->clientSize())); // FRAME
cg.writeEntry(QString("restore") + n, c->geometryRestore());
cg.writeEntry(QString("fsrestore") + n, c->geometryFSRestore());
cg.writeEntry(QString("maximize") + n, (int) c->maximizeMode());
cg.writeEntry(QString("fullscreen") + n, (int) c->fullScreenMode());
cg.writeEntry(QString("desktop") + n, c->desktop());
cg.writeEntry(QStringLiteral("sessionId") + n, c->sessionId().constData());
cg.writeEntry(QStringLiteral("windowRole") + n, c->windowRole().constData());
cg.writeEntry(QStringLiteral("wmCommand") + n, c->wmCommand().constData());
cg.writeEntry(QStringLiteral("wmClientMachine") + n, c->wmClientMachine(true).constData());
cg.writeEntry(QStringLiteral("resourceName") + n, c->resourceName().constData());
cg.writeEntry(QStringLiteral("resourceClass") + n, c->resourceClass().constData());
cg.writeEntry(QStringLiteral("geometry") + n, QRect(c->calculateGravitation(true), c->clientSize())); // FRAME
cg.writeEntry(QStringLiteral("restore") + n, c->geometryRestore());
cg.writeEntry(QStringLiteral("fsrestore") + n, c->geometryFSRestore());
cg.writeEntry(QStringLiteral("maximize") + n, (int) c->maximizeMode());
cg.writeEntry(QStringLiteral("fullscreen") + n, (int) c->fullScreenMode());
cg.writeEntry(QStringLiteral("desktop") + n, c->desktop());
// the config entry is called "iconified" for back. comp. reasons
// (kconf_update script for updating session files would be too complicated)
cg.writeEntry(QString("iconified") + n, c->isMinimized());
cg.writeEntry(QString("opacity") + n, c->opacity());
cg.writeEntry(QStringLiteral("iconified") + n, c->isMinimized());
cg.writeEntry(QStringLiteral("opacity") + n, c->opacity());
// the config entry is called "sticky" for back. comp. reasons
cg.writeEntry(QString("sticky") + n, c->isOnAllDesktops());
cg.writeEntry(QString("shaded") + n, c->isShade());
cg.writeEntry(QStringLiteral("sticky") + n, c->isOnAllDesktops());
cg.writeEntry(QStringLiteral("shaded") + n, c->isShade());
// the config entry is called "staysOnTop" for back. comp. reasons
cg.writeEntry(QString("staysOnTop") + n, c->keepAbove());
cg.writeEntry(QString("keepBelow") + n, c->keepBelow());
cg.writeEntry(QString("skipTaskbar") + n, c->skipTaskbar(true));
cg.writeEntry(QString("skipPager") + n, c->skipPager());
cg.writeEntry(QString("skipSwitcher") + n, c->skipSwitcher());
cg.writeEntry(QStringLiteral("staysOnTop") + n, c->keepAbove());
cg.writeEntry(QStringLiteral("keepBelow") + n, c->keepBelow());
cg.writeEntry(QStringLiteral("skipTaskbar") + n, c->skipTaskbar(true));
cg.writeEntry(QStringLiteral("skipPager") + n, c->skipPager());
cg.writeEntry(QStringLiteral("skipSwitcher") + n, c->skipSwitcher());
// not really just set by user, but name kept for back. comp. reasons
cg.writeEntry(QString("userNoBorder") + n, c->noBorder());
cg.writeEntry(QString("windowType") + n, windowTypeToTxt(c->windowType()));
cg.writeEntry(QString("shortcut") + n, c->shortcut().toString());
cg.writeEntry(QString("stackingOrder") + n, unconstrained_stacking_order.indexOf(c));
cg.writeEntry(QStringLiteral("userNoBorder") + n, c->noBorder());
cg.writeEntry(QStringLiteral("windowType") + n, windowTypeToTxt(c->windowType()));
cg.writeEntry(QStringLiteral("shortcut") + n, c->shortcut().toString());
cg.writeEntry(QStringLiteral("stackingOrder") + n, unconstrained_stacking_order.indexOf(c));
// KConfig doesn't support long so we need to live with less precision on 64-bit systems
cg.writeEntry(QString("tabGroup") + n, static_cast<int>(reinterpret_cast<long>(c->tabGroup())));
cg.writeEntry(QString("activities") + n, c->activities());
cg.writeEntry(QStringLiteral("tabGroup") + n, static_cast<int>(reinterpret_cast<long>(c->tabGroup())));
cg.writeEntry(QStringLiteral("activities") + n, c->activities());
}
void Workspace::storeSubSession(const QString &name, QSet<QByteArray> sessionIds)
{
//TODO clear it first
KConfigGroup cg(KGlobal::config(), QString("SubSession: ") + name);
KConfigGroup cg(KGlobal::config(), QStringLiteral("SubSession: ") + name);
int count = 0;
int active_client = -1;
for (ClientList::Iterator it = clients.begin(); it != clients.end(); ++it) {
@ -208,41 +208,41 @@ void Workspace::addSessionInfo(KConfigGroup &cg)
QString n = QString::number(i);
SessionInfo* info = new SessionInfo;
session.append(info);
info->sessionId = cg.readEntry(QString("sessionId") + n, QString()).toLatin1();
info->windowRole = cg.readEntry(QString("windowRole") + n, QString()).toLatin1();
info->wmCommand = cg.readEntry(QString("wmCommand") + n, QString()).toLatin1();
info->wmClientMachine = cg.readEntry(QString("wmClientMachine") + n, QString()).toLatin1();
info->resourceName = cg.readEntry(QString("resourceName") + n, QString()).toLatin1();
info->resourceClass = cg.readEntry(QString("resourceClass") + n, QString()).toLower().toLatin1();
info->geometry = cg.readEntry(QString("geometry") + n, QRect());
info->restore = cg.readEntry(QString("restore") + n, QRect());
info->fsrestore = cg.readEntry(QString("fsrestore") + n, QRect());
info->maximized = cg.readEntry(QString("maximize") + n, 0);
info->fullscreen = cg.readEntry(QString("fullscreen") + n, 0);
info->desktop = cg.readEntry(QString("desktop") + n, 0);
info->minimized = cg.readEntry(QString("iconified") + n, false);
info->opacity = cg.readEntry(QString("opacity") + n, 1.0);
info->onAllDesktops = cg.readEntry(QString("sticky") + n, false);
info->shaded = cg.readEntry(QString("shaded") + n, false);
info->keepAbove = cg.readEntry(QString("staysOnTop") + n, false);
info->keepBelow = cg.readEntry(QString("keepBelow") + n, false);
info->skipTaskbar = cg.readEntry(QString("skipTaskbar") + n, false);
info->skipPager = cg.readEntry(QString("skipPager") + n, false);
info->skipSwitcher = cg.readEntry(QString("skipSwitcher") + n, false);
info->noBorder = cg.readEntry(QString("userNoBorder") + n, false);
info->windowType = txtToWindowType(cg.readEntry(QString("windowType") + n, QString()).toLatin1());
info->shortcut = cg.readEntry(QString("shortcut") + n, QString());
info->sessionId = cg.readEntry(QStringLiteral("sessionId") + n, QString()).toLatin1();
info->windowRole = cg.readEntry(QStringLiteral("windowRole") + n, QString()).toLatin1();
info->wmCommand = cg.readEntry(QStringLiteral("wmCommand") + n, QString()).toLatin1();
info->wmClientMachine = cg.readEntry(QStringLiteral("wmClientMachine") + n, QString()).toLatin1();
info->resourceName = cg.readEntry(QStringLiteral("resourceName") + n, QString()).toLatin1();
info->resourceClass = cg.readEntry(QStringLiteral("resourceClass") + n, QString()).toLower().toLatin1();
info->geometry = cg.readEntry(QStringLiteral("geometry") + n, QRect());
info->restore = cg.readEntry(QStringLiteral("restore") + n, QRect());
info->fsrestore = cg.readEntry(QStringLiteral("fsrestore") + n, QRect());
info->maximized = cg.readEntry(QStringLiteral("maximize") + n, 0);
info->fullscreen = cg.readEntry(QStringLiteral("fullscreen") + n, 0);
info->desktop = cg.readEntry(QStringLiteral("desktop") + n, 0);
info->minimized = cg.readEntry(QStringLiteral("iconified") + n, false);
info->opacity = cg.readEntry(QStringLiteral("opacity") + n, 1.0);
info->onAllDesktops = cg.readEntry(QStringLiteral("sticky") + n, false);
info->shaded = cg.readEntry(QStringLiteral("shaded") + n, false);
info->keepAbove = cg.readEntry(QStringLiteral("staysOnTop") + n, false);
info->keepBelow = cg.readEntry(QStringLiteral("keepBelow") + n, false);
info->skipTaskbar = cg.readEntry(QStringLiteral("skipTaskbar") + n, false);
info->skipPager = cg.readEntry(QStringLiteral("skipPager") + n, false);
info->skipSwitcher = cg.readEntry(QStringLiteral("skipSwitcher") + n, false);
info->noBorder = cg.readEntry(QStringLiteral("userNoBorder") + n, false);
info->windowType = txtToWindowType(cg.readEntry(QStringLiteral("windowType") + n, QString()).toLatin1().constData());
info->shortcut = cg.readEntry(QStringLiteral("shortcut") + n, QString());
info->active = (active_client == i);
info->stackingOrder = cg.readEntry(QString("stackingOrder") + n, -1);
info->tabGroup = cg.readEntry(QString("tabGroup") + n, 0);
info->stackingOrder = cg.readEntry(QStringLiteral("stackingOrder") + n, -1);
info->tabGroup = cg.readEntry(QStringLiteral("tabGroup") + n, 0);
info->tabGroupClient = NULL;
info->activities = cg.readEntry(QString("activities") + n, QStringList());
info->activities = cg.readEntry(QStringLiteral("activities") + n, QStringList());
}
}
void Workspace::loadSubSessionInfo(const QString &name)
{
KConfigGroup cg(KGlobal::config(), QString("SubSession: ") + name);
KConfigGroup cg(KGlobal::config(), QStringLiteral("SubSession: ") + name);
addSessionInfo(cg);
}

View file

@ -62,7 +62,7 @@ ImageProvider::ImageProvider(QAbstractItemModel *model)
QPixmap ImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
{
bool ok = false;
QStringList parts = id.split('/');
QStringList parts = id.split(QStringLiteral("/"));
const int row = parts.first().toInt(&ok);
if (!ok) {
return QPixmap();
@ -142,16 +142,16 @@ DeclarativeView::DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBox
qmlRegisterType<DesktopThumbnailItem>("org.kde.kwin", 0, 1, "DesktopThumbnailItem");
#endif
qmlRegisterType<WindowThumbnailItem>("org.kde.kwin", 0, 1, "ThumbnailItem");
rootContext()->setContextProperty("viewId", static_cast<qulonglong>(winId()));
rootContext()->setContextProperty(QStringLiteral("viewId"), static_cast<qulonglong>(winId()));
if (m_mode == TabBoxConfig::ClientTabBox) {
rootContext()->setContextProperty("clientModel", model);
rootContext()->setContextProperty(QStringLiteral("clientModel"), model);
} else if (m_mode == TabBoxConfig::DesktopTabBox) {
rootContext()->setContextProperty("clientModel", model);
rootContext()->setContextProperty(QStringLiteral("clientModel"), model);
}
setSource(QUrl(KStandardDirs::locate("data", QLatin1String(KWIN_NAME) + QLatin1String("/tabbox/tabbox.qml"))));
// FrameSvg
m_frame->setImagePath("dialogs/background");
m_frame->setImagePath(QStringLiteral("dialogs/background"));
m_frame->setCacheAllRenderedFrames(true);
m_frame->setEnabledBorders(Plasma::FrameSvg::AllBorders);
@ -181,7 +181,7 @@ void DeclarativeView::showEvent(QShowEvent *event)
rootObject()->setProperty("longestCaption", clientModel->longestCaption());
}
if (QObject *item = rootObject()->findChild<QObject*>("listView")) {
if (QObject *item = rootObject()->findChild<QObject*>(QStringLiteral("listView"))) {
item->setProperty("currentIndex", tabBox->first().row());
connect(item, SIGNAL(currentIndexChanged(int)), SLOT(currentIndexChanged(int)));
}
@ -307,7 +307,7 @@ void DeclarativeView::setCurrentIndex(const QModelIndex &index, bool disableAnim
if (tabBox->config().tabBoxMode() != m_mode) {
return;
}
if (QObject *item = rootObject()->findChild<QObject*>("listView")) {
if (QObject *item = rootObject()->findChild<QObject*>(QStringLiteral("listView"))) {
QVariant durationRestore;
if (disableAnimation) {
durationRestore = item->property("highlightMoveDuration");
@ -340,7 +340,7 @@ void DeclarativeView::updateQmlSource(bool force)
if (service.isNull()) {
return;
}
if (service->property("X-Plasma-API").toString() != "declarativeappletscript") {
if (service->property(QStringLiteral("X-Plasma-API")).toString() != QStringLiteral("declarativeappletscript")) {
kDebug(1212) << "Window Switcher Layout is no declarativeappletscript";
return;
}
@ -354,12 +354,12 @@ void DeclarativeView::updateQmlSource(bool force)
KService::Ptr DeclarativeView::findWindowSwitcher()
{
QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(tabBox->config().layoutName());
KService::List offers = KServiceTypeTrader::self()->query("KWin/WindowSwitcher", constraint);
QString constraint = QStringLiteral("[X-KDE-PluginInfo-Name] == '%1'").arg(tabBox->config().layoutName());
KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("KWin/WindowSwitcher"), constraint);
if (offers.isEmpty()) {
// load default
constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg("informative");
offers = KServiceTypeTrader::self()->query("KWin/WindowSwitcher", constraint);
constraint = QStringLiteral("[X-KDE-PluginInfo-Name] == '%1'").arg(QStringLiteral("informative"));
offers = KServiceTypeTrader::self()->query(QStringLiteral("KWin/WindowSwitcher"), constraint);
if (offers.isEmpty()) {
kDebug(1212) << "could not find default window switcher layout";
return KService::Ptr();
@ -370,12 +370,12 @@ KService::Ptr DeclarativeView::findWindowSwitcher()
KService::Ptr DeclarativeView::findDesktopSwitcher()
{
QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(tabBox->config().layoutName());
KService::List offers = KServiceTypeTrader::self()->query("KWin/DesktopSwitcher", constraint);
QString constraint = QStringLiteral("[X-KDE-PluginInfo-Name] == '%1'").arg(tabBox->config().layoutName());
KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("KWin/DesktopSwitcher"), constraint);
if (offers.isEmpty()) {
// load default
constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg("informative");
offers = KServiceTypeTrader::self()->query("KWin/DesktopSwitcher", constraint);
constraint = QStringLiteral("[X-KDE-PluginInfo-Name] == '%1'").arg(QStringLiteral("informative"));
offers = KServiceTypeTrader::self()->query(QStringLiteral("KWin/DesktopSwitcher"), constraint);
if (offers.isEmpty()) {
kDebug(1212) << "could not find default desktop switcher layout";
return KService::Ptr();
@ -386,16 +386,16 @@ KService::Ptr DeclarativeView::findDesktopSwitcher()
QString DeclarativeView::findWindowSwitcherScriptFile(KService::Ptr service)
{
const QString pluginName = service->property("X-KDE-PluginInfo-Name").toString();
const QString scriptName = service->property("X-Plasma-MainScript").toString();
return KStandardDirs::locate("data", QLatin1String(KWIN_NAME) + "/tabbox/" + pluginName + "/contents/" + scriptName);
const QString pluginName = service->property(QStringLiteral("X-KDE-PluginInfo-Name")).toString();
const QString scriptName = service->property(QStringLiteral("X-Plasma-MainScript")).toString();
return KStandardDirs::locate("data", QStringLiteral(KWIN_NAME) + QStringLiteral("/tabbox/") + pluginName + QStringLiteral("/contents/") + scriptName);
}
QString DeclarativeView::findDesktopSwitcherScriptFile(KService::Ptr service)
{
const QString pluginName = service->property("X-KDE-PluginInfo-Name").toString();
const QString scriptName = service->property("X-Plasma-MainScript").toString();
return KStandardDirs::locate("data", QLatin1String(KWIN_NAME) + "/desktoptabbox/" + pluginName + "/contents/" + scriptName);
const QString pluginName = service->property(QStringLiteral("X-KDE-PluginInfo-Name")).toString();
const QString scriptName = service->property(QStringLiteral("X-Plasma-MainScript")).toString();
return KStandardDirs::locate("data", QStringLiteral(KWIN_NAME) + QStringLiteral("/desktoptabbox/") + pluginName + QStringLiteral("/contents/") + scriptName);
}
void DeclarativeView::slotEmbeddedChanged(bool enabled)

View file

@ -358,7 +358,7 @@ QString TabBoxClientImpl::caption() const
QPixmap TabBoxClientImpl::icon(const QSize& size) const
{
if (m_client->isDesktop()) {
return KIcon("user-desktop").pixmap(size);
return KIcon(QStringLiteral("user-desktop")).pixmap(size);
}
return m_client->icon(size);
}
@ -474,12 +474,12 @@ TabBox::TabBox(QObject *parent)
m_tabBoxMode = TabBoxDesktopMode; // init variables
connect(&m_delayedShowTimer, SIGNAL(timeout()), this, SLOT(show()));
connect(Workspace::self(), SIGNAL(configChanged()), this, SLOT(reconfigure()));
QDBusConnection::sessionBus().registerObject("/TabBox", this, QDBusConnection::ExportScriptableContents);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/TabBox"), this, QDBusConnection::ExportScriptableContents);
}
TabBox::~TabBox()
{
QDBusConnection::sessionBus().unregisterObject("/TabBox");
QDBusConnection::sessionBus().unregisterObject(QStringLiteral("/TabBox"));
s_self = NULL;
}
@ -498,7 +498,7 @@ void TabBox::initShortcuts(KActionCollection* keys)
// sequence is necessary in the case where the user has defined a
// custom key binding which KAction::setGlobalShortcut autoloads.
#define KEY( name, key, fnSlot, shortcut, shortcutSlot ) \
a = keys->addAction( name ); \
a = keys->addAction( QStringLiteral( name ) ); \
a->setText( i18n(name) ); \
shortcut = KShortcut(key); \
qobject_cast<KAction*>( a )->setGlobalShortcut(shortcut); \
@ -734,7 +734,7 @@ void TabBox::reconfigure()
#ifdef KWIN_BUILD_SCREENEDGES
QList<ElectricBorder> *borders = &m_borderActivate;
QString borderConfig = "BorderActivate";
QString borderConfig = QStringLiteral("BorderActivate");
for (int i = 0; i < 2; ++i) {
foreach (ElectricBorder border, *borders) {
ScreenEdges::self()->unreserve(border, this);
@ -750,7 +750,7 @@ void TabBox::reconfigure()
ScreenEdges::self()->reserve(ElectricBorder(i), this, "toggle");
}
borders = &m_borderAlternativeActivate;
borderConfig = "BorderAlternativeActivate";
borderConfig = QStringLiteral("BorderAlternativeActivate");
}
#endif
}

View file

@ -314,7 +314,7 @@ public:
return true;
}
static QString defaultLayoutName() {
return QString("thumbnails");
return QStringLiteral("thumbnails");
}
private:
TabBoxConfigPrivate* d;

View file

@ -216,13 +216,13 @@ void TestDesktopChain::useChain()
manager.resize(0, 4);
manager.addDesktop(0, 3);
// creating the first chain, should keep it unchanged
manager.useChain("test");
manager.useChain(QStringLiteral("test"));
QCOMPARE(manager.next(3), (uint)1);
QCOMPARE(manager.next(1), (uint)2);
QCOMPARE(manager.next(2), (uint)4);
QCOMPARE(manager.next(4), (uint)3);
// but creating a second chain, should create an empty one
manager.useChain("second chain");
manager.useChain(QStringLiteral("second chain"));
QCOMPARE(manager.next(1), (uint)2);
QCOMPARE(manager.next(2), (uint)3);
QCOMPARE(manager.next(3), (uint)4);
@ -234,26 +234,26 @@ void TestDesktopChain::useChain()
QCOMPARE(manager.next(3), (uint)4);
QCOMPARE(manager.next(4), (uint)2);
// verify by switching back
manager.useChain("test");
manager.useChain(QStringLiteral("test"));
QCOMPARE(manager.next(3), (uint)1);
QCOMPARE(manager.next(1), (uint)2);
QCOMPARE(manager.next(2), (uint)4);
QCOMPARE(manager.next(4), (uint)3);
manager.addDesktop(3, 1);
// use second chain again and put 4th desktop to front
manager.useChain("second chain");
manager.useChain(QStringLiteral("second chain"));
manager.addDesktop(3, 4);
// just for the fun a third chain, and let's shrink it
manager.useChain("third chain");
manager.useChain(QStringLiteral("third chain"));
manager.resize(4, 3);
QCOMPARE(manager.next(1), (uint)2);
QCOMPARE(manager.next(2), (uint)3);
// it must have affected all chains
manager.useChain("test");
manager.useChain(QStringLiteral("test"));
QCOMPARE(manager.next(1), (uint)3);
QCOMPARE(manager.next(3), (uint)2);
QCOMPARE(manager.next(2), (uint)1);
manager.useChain("second chain");
manager.useChain(QStringLiteral("second chain"));
QCOMPARE(manager.next(3), (uint)2);
QCOMPARE(manager.next(1), (uint)3);
QCOMPARE(manager.next(2), (uint)1);

View file

@ -62,7 +62,7 @@ void TestTabBoxConfig::testAssignmentOperator()
config.setClientMultiScreenMode(TabBoxConfig::ExcludeCurrentScreenClients);
config.setClientSwitchingMode(TabBoxConfig::StackingOrderSwitching);
config.setDesktopSwitchingMode(TabBoxConfig::StaticDesktopSwitching);
config.setLayoutName(QString("grid"));
config.setLayoutName(QStringLiteral("grid"));
TabBoxConfig config2;
config2 = config;
// verify the config2 values
@ -77,7 +77,7 @@ void TestTabBoxConfig::testAssignmentOperator()
QCOMPARE(config2.clientMultiScreenMode(), TabBoxConfig::ExcludeCurrentScreenClients);
QCOMPARE(config2.clientSwitchingMode(), TabBoxConfig::StackingOrderSwitching);
QCOMPARE(config2.desktopSwitchingMode(), TabBoxConfig::StaticDesktopSwitching);
QCOMPARE(config2.layoutName(), QString("grid"));
QCOMPARE(config2.layoutName(), QStringLiteral("grid"));
}
QTEST_MAIN(TestTabBoxConfig)

View file

@ -298,7 +298,7 @@ void TestVirtualDesktops::next_data()
void TestVirtualDesktops::next()
{
testDirection<DesktopNext>("Switch to Next Desktop");
testDirection<DesktopNext>(QStringLiteral("Switch to Next Desktop"));
}
void TestVirtualDesktops::previous_data()
@ -315,7 +315,7 @@ void TestVirtualDesktops::previous_data()
void TestVirtualDesktops::previous()
{
testDirection<DesktopPrevious>("Switch to Previous Desktop");
testDirection<DesktopPrevious>(QStringLiteral("Switch to Previous Desktop"));
}
void TestVirtualDesktops::left_data()
@ -340,7 +340,7 @@ void TestVirtualDesktops::left_data()
void TestVirtualDesktops::left()
{
testDirection<DesktopLeft>("Switch One Desktop to the Left");
testDirection<DesktopLeft>(QStringLiteral("Switch One Desktop to the Left"));
}
void TestVirtualDesktops::right_data()
@ -365,7 +365,7 @@ void TestVirtualDesktops::right_data()
void TestVirtualDesktops::right()
{
testDirection<DesktopRight>("Switch One Desktop to the Right");
testDirection<DesktopRight>(QStringLiteral("Switch One Desktop to the Right"));
}
void TestVirtualDesktops::above_data()
@ -386,7 +386,7 @@ void TestVirtualDesktops::above_data()
void TestVirtualDesktops::above()
{
testDirection<DesktopAbove>("Switch One Desktop Up");
testDirection<DesktopAbove>(QStringLiteral("Switch One Desktop Up"));
}
void TestVirtualDesktops::below_data()
@ -407,7 +407,7 @@ void TestVirtualDesktops::below_data()
void TestVirtualDesktops::below()
{
testDirection<DesktopBelow>("Switch One Desktop Down");
testDirection<DesktopBelow>(QStringLiteral("Switch One Desktop Down"));
}
void TestVirtualDesktops::updateGrid_data()
@ -558,7 +558,7 @@ void TestVirtualDesktops::switchToShortcuts()
vds->setCurrent(vds->maximum());
QCOMPARE(vds->current(), vds->maximum());
vds->initShortcuts(keys.data());
const QString toDesktop = "Switch to Desktop %1";
const QString toDesktop = QStringLiteral("Switch to Desktop %1");
for (uint i=1; i<=vds->maximum(); ++i) {
const QString desktop(toDesktop.arg(i));
QAction *action = keys->action(desktop);
@ -568,7 +568,7 @@ void TestVirtualDesktops::switchToShortcuts()
QCOMPARE(vds->current(), i);
}
// test switchTo with incorrect data in QAction
KAction *action = keys->addAction("wrong", vds, SLOT(slotSwitchTo()));
KAction *action = keys->addAction(QStringLiteral("wrong"), vds, SLOT(slotSwitchTo()));
action->trigger();
// should still be on max
QCOMPARE(vds->current(), vds->maximum());

View file

@ -95,7 +95,7 @@ void AbstractThumbnailItem::findParentEffectWindow()
kDebug(1212) << "No Context";
return;
}
const QVariant variant = ctx->engine()->rootContext()->contextProperty("viewId");
const QVariant variant = ctx->engine()->rootContext()->contextProperty(QStringLiteral("viewId"));
if (!variant.isValid()) {
kDebug(1212) << "Required context property 'viewId' not found";
return;

View file

@ -147,7 +147,7 @@ bool UserActionsMenu::isMenuClient(const Client *c) const
void UserActionsMenu::show(const QRect &pos, const QWeakPointer<Client> &cl)
{
if (!KAuthorized::authorizeKAction("kwin_rmb"))
if (!KAuthorized::authorizeKAction(QStringLiteral("kwin_rmb")))
return;
if (cl.isNull())
return;
@ -187,63 +187,63 @@ void UserActionsMenu::helperDialog(const QString& message, const QWeakPointer<Cl
QStringList args;
QString type;
KActionCollection *keys = Workspace::self()->actionCollection();
if (message == "noborderaltf3") {
KAction* action = qobject_cast<KAction*>(keys->action("Window Operations Menu"));
if (message == QStringLiteral("noborderaltf3")) {
KAction* action = qobject_cast<KAction*>(keys->action(QStringLiteral("Window Operations Menu")));
assert(action != NULL);
QString shortcut = QString("%1 (%2)").arg(action->text())
QString shortcut = QStringLiteral("%1 (%2)").arg(action->text())
.arg(action->globalShortcut().primary().toString(QKeySequence::NativeText));
args << "--msgbox" << i18n(
args << QStringLiteral("--msgbox") << i18n(
"You have selected to show a window without its border.\n"
"Without the border, you will not be able to enable the border "
"again using the mouse: use the window operations menu instead, "
"activated using the %1 keyboard shortcut.",
shortcut);
type = "altf3warning";
} else if (message == "fullscreenaltf3") {
KAction* action = qobject_cast<KAction*>(keys->action("Window Operations Menu"));
type = QStringLiteral("altf3warning");
} else if (message == QStringLiteral("fullscreenaltf3")) {
KAction* action = qobject_cast<KAction*>(keys->action(QStringLiteral("Window Operations Menu")));
assert(action != NULL);
QString shortcut = QString("%1 (%2)").arg(action->text())
QString shortcut = QStringLiteral("%1 (%2)").arg(action->text())
.arg(action->globalShortcut().primary().toString(QKeySequence::NativeText));
args << "--msgbox" << i18n(
args << QStringLiteral("--msgbox") << i18n(
"You have selected to show a window in fullscreen mode.\n"
"If the application itself does not have an option to turn the fullscreen "
"mode off you will not be able to disable it "
"again using the mouse: use the window operations menu instead, "
"activated using the %1 keyboard shortcut.",
shortcut);
type = "altf3warning";
type = QStringLiteral("altf3warning");
} else
abort();
if (!type.isEmpty()) {
KConfig cfg("kwin_dialogsrc");
KConfig cfg(QStringLiteral("kwin_dialogsrc"));
KConfigGroup cg(&cfg, "Notification Messages"); // Depends on KMessageBox
if (!cg.readEntry(type, true))
return;
args << "--dontagain" << "kwin_dialogsrc:" + type;
args << QStringLiteral("--dontagain") << QStringLiteral("kwin_dialogsrc:") + type;
}
if (!c.isNull())
args << "--embed" << QString::number(c.data()->window());
KProcess::startDetached("kdialog", args);
args << QStringLiteral("--embed") << QString::number(c.data()->window());
KProcess::startDetached(QStringLiteral("kdialog"), args);
}
QStringList configModules(bool controlCenter)
{
QStringList args;
args << "kwindecoration";
args << QStringLiteral("kwindecoration");
if (controlCenter)
args << "kwinoptions";
else if (KAuthorized::authorizeControlModule("kde-kwinoptions.desktop"))
args << "kwinactions" << "kwinfocus" << "kwinmoving" << "kwinadvanced"
<< "kwinrules" << "kwincompositing"
args << QStringLiteral("kwinoptions");
else if (KAuthorized::authorizeControlModule(QStringLiteral("kde-kwinoptions.desktop")))
args << QStringLiteral("kwinactions") << QStringLiteral("kwinfocus") << QStringLiteral("kwinmoving") << QStringLiteral("kwinadvanced")
<< QStringLiteral("kwinrules") << QStringLiteral("kwincompositing")
#ifdef KWIN_BUILD_TABBOX
<< "kwintabbox"
<< QStringLiteral("kwintabbox")
#endif
#ifdef KWIN_BUILD_SCREENEDGES
<< "kwinscreenedges"
<< QStringLiteral("kwinscreenedges")
#endif
#ifdef KWIN_BUILD_SCRIPTING
<< "kwinscripts"
<< QStringLiteral("kwinscripts")
#endif
;
return args;
@ -252,8 +252,8 @@ QStringList configModules(bool controlCenter)
void UserActionsMenu::configureWM()
{
QStringList args;
args << "--icon" << "preferences-system-windows" << configModules(false);
KToolInvocation::kdeinitExec("kcmshell4", args);
args << QStringLiteral("--icon") << QStringLiteral("preferences-system-windows") << configModules(false);
KToolInvocation::kdeinitExec(QStringLiteral("kcmshell4"), args);
}
void UserActionsMenu::init()
@ -270,52 +270,52 @@ void UserActionsMenu::init()
advancedMenu->setFont(KGlobalSettings::menuFont());
m_moveOperation = advancedMenu->addAction(i18n("&Move"));
m_moveOperation->setIcon(KIcon("transform-move"));
m_moveOperation->setIcon(KIcon(QStringLiteral("transform-move")));
KActionCollection *keys = Workspace::self()->actionCollection();
KAction *kaction = qobject_cast<KAction*>(keys->action("Window Move"));
KAction *kaction = qobject_cast<KAction*>(keys->action(QStringLiteral("Window Move")));
if (kaction != 0)
m_moveOperation->setShortcut(kaction->globalShortcut().primary());
m_moveOperation->setData(Options::UnrestrictedMoveOp);
m_resizeOperation = advancedMenu->addAction(i18n("Re&size"));
kaction = qobject_cast<KAction*>(keys->action("Window Resize"));
kaction = qobject_cast<KAction*>(keys->action(QStringLiteral("Window Resize")));
if (kaction != 0)
m_resizeOperation->setShortcut(kaction->globalShortcut().primary());
m_resizeOperation->setData(Options::ResizeOp);
m_keepAboveOperation = advancedMenu->addAction(i18n("Keep &Above Others"));
m_keepAboveOperation->setIcon(KIcon("go-up"));
kaction = qobject_cast<KAction*>(keys->action("Window Above Other Windows"));
m_keepAboveOperation->setIcon(KIcon(QStringLiteral("go-up")));
kaction = qobject_cast<KAction*>(keys->action(QStringLiteral("Window Above Other Windows")));
if (kaction != 0)
m_keepAboveOperation->setShortcut(kaction->globalShortcut().primary());
m_keepAboveOperation->setCheckable(true);
m_keepAboveOperation->setData(Options::KeepAboveOp);
m_keepBelowOperation = advancedMenu->addAction(i18n("Keep &Below Others"));
m_keepBelowOperation->setIcon(KIcon("go-down"));
kaction = qobject_cast<KAction*>(keys->action("Window Below Other Windows"));
m_keepBelowOperation->setIcon(KIcon(QStringLiteral("go-down")));
kaction = qobject_cast<KAction*>(keys->action(QStringLiteral("Window Below Other Windows")));
if (kaction != 0)
m_keepBelowOperation->setShortcut(kaction->globalShortcut().primary());
m_keepBelowOperation->setCheckable(true);
m_keepBelowOperation->setData(Options::KeepBelowOp);
m_fullScreenOperation = advancedMenu->addAction(i18n("&Fullscreen"));
m_fullScreenOperation->setIcon(KIcon("view-fullscreen"));
kaction = qobject_cast<KAction*>(keys->action("Window Fullscreen"));
m_fullScreenOperation->setIcon(KIcon(QStringLiteral("view-fullscreen")));
kaction = qobject_cast<KAction*>(keys->action(QStringLiteral("Window Fullscreen")));
if (kaction != 0)
m_fullScreenOperation->setShortcut(kaction->globalShortcut().primary());
m_fullScreenOperation->setCheckable(true);
m_fullScreenOperation->setData(Options::FullScreenOp);
m_shadeOperation = advancedMenu->addAction(i18n("Sh&ade"));
kaction = qobject_cast<KAction*>(keys->action("Window Shade"));
kaction = qobject_cast<KAction*>(keys->action(QStringLiteral("Window Shade")));
if (kaction != 0)
m_shadeOperation->setShortcut(kaction->globalShortcut().primary());
m_shadeOperation->setCheckable(true);
m_shadeOperation->setData(Options::ShadeOp);
m_noBorderOperation = advancedMenu->addAction(i18n("&No Border"));
kaction = qobject_cast<KAction*>(keys->action("Window No Border"));
kaction = qobject_cast<KAction*>(keys->action(QStringLiteral("Window No Border")));
if (kaction != 0)
m_noBorderOperation->setShortcut(kaction->globalShortcut().primary());
m_noBorderOperation->setCheckable(true);
@ -324,36 +324,36 @@ void UserActionsMenu::init()
advancedMenu->addSeparator();
QAction *action = advancedMenu->addAction(i18n("Window &Shortcut..."));
action->setIcon(KIcon("configure-shortcuts"));
kaction = qobject_cast<KAction*>(keys->action("Setup Window Shortcut"));
action->setIcon(KIcon(QStringLiteral("configure-shortcuts")));
kaction = qobject_cast<KAction*>(keys->action(QStringLiteral("Setup Window Shortcut")));
if (kaction != 0)
action->setShortcut(kaction->globalShortcut().primary());
action->setData(Options::SetupWindowShortcutOp);
action = advancedMenu->addAction(i18n("&Special Window Settings..."));
action->setIcon(KIcon("preferences-system-windows-actions"));
action->setIcon(KIcon(QStringLiteral("preferences-system-windows-actions")));
action->setData(Options::WindowRulesOp);
action = advancedMenu->addAction(i18n("S&pecial Application Settings..."));
action->setIcon(KIcon("preferences-system-windows-actions"));
action->setIcon(KIcon(QStringLiteral("preferences-system-windows-actions")));
action->setData(Options::ApplicationRulesOp);
if (!KGlobal::config()->isImmutable() &&
!KAuthorized::authorizeControlModules(configModules(true)).isEmpty()) {
advancedMenu->addSeparator();
action = advancedMenu->addAction(i18nc("Entry in context menu of window decoration to open the configuration module of KWin",
"Window &Manager Settings..."));
action->setIcon(KIcon("configure"));
action->setIcon(KIcon(QStringLiteral("configure")));
connect(action, SIGNAL(triggered()), this, SLOT(configureWM()));
}
m_minimizeOperation = m_menu->addAction(i18n("Mi&nimize"));
kaction = qobject_cast<KAction*>(keys->action("Window Minimize"));
kaction = qobject_cast<KAction*>(keys->action(QStringLiteral("Window Minimize")));
if (kaction != 0)
m_minimizeOperation->setShortcut(kaction->globalShortcut().primary());
m_minimizeOperation->setData(Options::MinimizeOp);
m_maximizeOperation = m_menu->addAction(i18n("Ma&ximize"));
kaction = qobject_cast<KAction*>(keys->action("Window Maximize"));
kaction = qobject_cast<KAction*>(keys->action(QStringLiteral("Window Maximize")));
if (kaction != 0)
m_maximizeOperation->setShortcut(kaction->globalShortcut().primary());
m_maximizeOperation->setCheckable(true);
@ -364,14 +364,14 @@ void UserActionsMenu::init()
// Actions for window tabbing
if (decorationPlugin()->supportsTabbing()) {
m_removeFromTabGroup = m_menu->addAction(i18n("&Untab"));
kaction = qobject_cast<KAction*>(keys->action("Untab"));
kaction = qobject_cast<KAction*>(keys->action(QStringLiteral("Untab")));
if (kaction != 0)
m_removeFromTabGroup->setShortcut(kaction->globalShortcut().primary());
m_removeFromTabGroup->setData(Options::RemoveTabFromGroupOp);
m_closeTabGroup = m_menu->addAction(i18n("Close Entire &Group"));
m_closeTabGroup->setIcon(KIcon("window-close"));
kaction = qobject_cast<KAction*>(keys->action("Close TabGroup"));
m_closeTabGroup->setIcon(KIcon(QStringLiteral("window-close")));
kaction = qobject_cast<KAction*>(keys->action(QStringLiteral("Close TabGroup")));
if (kaction != 0)
m_closeTabGroup->setShortcut(kaction->globalShortcut().primary());
m_closeTabGroup->setData(Options::CloseTabGroupOp);
@ -387,8 +387,8 @@ void UserActionsMenu::init()
m_menu->addSeparator();
m_closeOperation = m_menu->addAction(i18n("&Close"));
m_closeOperation->setIcon(KIcon("window-close"));
kaction = qobject_cast<KAction*>(keys->action("Window Close"));
m_closeOperation->setIcon(KIcon(QStringLiteral("window-close")));
kaction = qobject_cast<KAction*>(keys->action(QStringLiteral("Window Close")));
if (kaction != 0)
m_closeOperation->setShortcut(kaction->globalShortcut().primary());
m_closeOperation->setData(Options::CloseOp);
@ -510,7 +510,7 @@ static QString shortCaption(const QString &s)
if (s.length() < 64)
return s;
QString ss = s;
return ss.replace(32,s.length()-64,"...");
return ss.replace(32,s.length()-64, QStringLiteral("..."));
}
void UserActionsMenu::rebuildTabListPopup()
@ -660,11 +660,11 @@ void UserActionsMenu::desktopPopupAboutToShow()
const uint BASE = 10;
for (uint i = 1; i <= vds->count(); ++i) {
QString basic_name("%1 %2");
QString basic_name(QStringLiteral("%1 %2"));
if (i < BASE) {
basic_name.prepend('&');
basic_name.prepend(QStringLiteral("&"));
}
action = m_desktopMenu->addAction(basic_name.arg(i).arg(vds->name(i).replace('&', "&&")));
action = m_desktopMenu->addAction(basic_name.arg(i).arg(vds->name(i).replace(QStringLiteral("&"), QStringLiteral("&&"))));
action->setData(i);
action->setCheckable(true);
group->addAction(action);
@ -757,11 +757,11 @@ void UserActionsMenu::slotWindowOperation(QAction *action)
switch(op) {
case Options::FullScreenOp:
if (!c.data()->isFullScreen() && c.data()->userCanSetFullScreen())
type = "fullscreenaltf3";
type = QStringLiteral("fullscreenaltf3");
break;
case Options::NoBorderOp:
if (!c.data()->noBorder() && c.data()->userCanSetNoBorder())
type = "noborderaltf3";
type = QStringLiteral("noborderaltf3");
break;
default:
break;
@ -1015,8 +1015,8 @@ void Workspace::setupWindowShortcutDone(bool ok)
void Workspace::clientShortcutUpdated(Client* c)
{
QString key = QString("_k_session:%1").arg(c->window());
QAction* action = client_keys->action(key.toLatin1().constData());
QString key = QStringLiteral("_k_session:%1").arg(c->window());
QAction* action = client_keys->action(key);
if (!c->shortcut().isEmpty()) {
if (action == NULL) { // new shortcut
action = client_keys->addAction(QString(key));
@ -1393,9 +1393,9 @@ static bool screenSwitchImpossible()
if (!screens()->isCurrentFollowsMouse())
return false;
QStringList args;
args << "--passivepopup" << i18n("The window manager is configured to consider the screen with the mouse on it as active one.\n"
"Therefore it is not possible to switch to a screen explicitly.") << "20";
KProcess::startDetached("kdialog", args);
args << QStringLiteral("--passivepopup") << i18n("The window manager is configured to consider the screen with the mouse on it as active one.\n"
"Therefore it is not possible to switch to a screen explicitly.") << QStringLiteral("20");
KProcess::startDetached(QStringLiteral("kdialog"), args);
return true;
}
@ -1922,7 +1922,7 @@ void Client::setShortcut(const QString& _cut)
// Format:
// base+(abcdef)<space>base+(abcdef)
// E.g. Alt+Ctrl+(ABCDEF);Meta+X,Meta+(ABCDEF)
if (!cut.contains('(') && !cut.contains(')') && !cut.contains(" - ")) {
if (!cut.contains(QStringLiteral("(")) && !cut.contains(QStringLiteral(")")) && !cut.contains(QStringLiteral(" - "))) {
if (workspace()->shortcutAvailable(KShortcut(cut), this))
setShortcutInternal(KShortcut(cut));
else
@ -1930,11 +1930,11 @@ void Client::setShortcut(const QString& _cut)
return;
}
QList< KShortcut > keys;
QStringList groups = cut.split(" - ");
QStringList groups = cut.split(QStringLiteral(" - "));
for (QStringList::ConstIterator it = groups.constBegin();
it != groups.constEnd();
++it) {
QRegExp reg("(.*\\+)\\((.*)\\)");
QRegExp reg(QStringLiteral("(.*\\+)\\((.*)\\)"));
if (reg.indexIn(*it) > -1) {
QString base = reg.cap(1);
QString list = reg.cap(2);

Some files were not shown because too many files have changed in this diff Show more