Commit 91b1f711 authored by Tomaz  Canabrava's avatar Tomaz Canabrava

Reduce string objects

Summary:
QStringLiteral cannot deal with duplicates, so each invokation in
the same file with the same string will create a different UTF-16
string representation for that thing. Considering that we called
the same string six times in the same function, just create a temporary
variable that's the UTF-16 representation of the QString, and use it

Reviewers: apol

Reviewed By: apol

Subscribers: apol, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D18578
parent 959cc1c8
......@@ -365,17 +365,18 @@ void TopLevel::timerEvent( QTimerEvent* )
if ( statusBar()->isVisibleTo( this ) ) {
/* Request some info about the memory status. The requested
* information will be received by answerReceived(). */
KSGRD::SensorMgr->sendRequest( QStringLiteral("localhost"), QStringLiteral("cpu/idle"),
const auto localhostString = QStringLiteral("localhost");
KSGRD::SensorMgr->sendRequest( localhostString, QStringLiteral("cpu/idle"),
(KSGRD::SensorClient*)this, 1 );
KSGRD::SensorMgr->sendRequest( QStringLiteral("localhost"), QStringLiteral("mem/physical/free"),
KSGRD::SensorMgr->sendRequest( localhostString, QStringLiteral("mem/physical/free"),
(KSGRD::SensorClient*)this, 2 );
KSGRD::SensorMgr->sendRequest( QStringLiteral("localhost"), QStringLiteral("mem/physical/used"),
KSGRD::SensorMgr->sendRequest( localhostString, QStringLiteral("mem/physical/used"),
(KSGRD::SensorClient*)this, 3 );
KSGRD::SensorMgr->sendRequest( QStringLiteral("localhost"), QStringLiteral("mem/physical/application"),
KSGRD::SensorMgr->sendRequest( localhostString, QStringLiteral("mem/physical/application"),
(KSGRD::SensorClient*)this, 4 );
KSGRD::SensorMgr->sendRequest( QStringLiteral("localhost"), QStringLiteral("mem/swap/free"),
KSGRD::SensorMgr->sendRequest( localhostString, QStringLiteral("mem/swap/free"),
(KSGRD::SensorClient*)this, 5 );
KSGRD::SensorMgr->sendRequest( QStringLiteral("localhost"), QStringLiteral("mem/swap/used"),
KSGRD::SensorMgr->sendRequest( localhostString, QStringLiteral("mem/swap/used"),
(KSGRD::SensorClient*)this, 6 );
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment