Commit cd306648 authored by Laurent Montel's avatar Laurent Montel 😁

Const'ify

parent a87cec0b
......@@ -186,7 +186,7 @@ void KScreenDaemon::applyIdealConfig()
doApplyConfig(Generator::self()->idealConfig(m_monitoredConfig));
}
void logConfig(const KScreen::ConfigPtr config) {
void logConfig(const KScreen::ConfigPtr &config) {
if (config) {
foreach (auto o, config->outputs()) {
if (o->isConnected()) {
......
......@@ -625,7 +625,7 @@ KScreen::OutputPtr Generator::embeddedOutput(const KScreen::OutputList &outputs)
return KScreen::OutputPtr();
}
bool Generator::isLaptop()
bool Generator::isLaptop() const
{
if (m_forceLaptop) {
return true;
......@@ -637,7 +637,7 @@ bool Generator::isLaptop()
return Device::self()->isLaptop();
}
bool Generator::isLidClosed()
bool Generator::isLidClosed() const
{
if (m_forceLidClosed) {
return true;
......@@ -649,7 +649,7 @@ bool Generator::isLidClosed()
return Device::self()->isLidClosed();
}
bool Generator::isDocked()
bool Generator::isDocked() const
{
if (m_forceDocked) {
return true;
......
......@@ -79,9 +79,9 @@ class Generator : public QObject
KScreen::OutputPtr embeddedOutput(const KScreen::OutputList &connectedOutputs);
void disableAllDisconnectedOutputs(const KScreen::OutputList &connectedOutputs);
bool isLaptop();
bool isLidClosed();
bool isDocked();
bool isLaptop() const;
bool isLidClosed() const;
bool isDocked() const;
bool m_forceLaptop;
bool m_forceLidClosed;
......
......@@ -217,11 +217,12 @@ bool Serializer::moveConfig(const QString &srcId, const QString &destId)
KScreen::OutputPtr Serializer::findOutput(const KScreen::ConfigPtr &config, const QVariantMap& info)
{
KScreen::OutputList outputs = config->outputs(); // As individual outputs are indexed by a hash of their edid, which is not unique,
const KScreen::OutputList outputs = config->outputs(); // As individual outputs are indexed by a hash of their edid, which is not unique,
// to be able to tell apart multiple identical outputs, these need special treatment
QStringList duplicateIds;
QStringList allIds;
Q_FOREACH (KScreen::OutputPtr output, outputs) {
allIds.reserve(outputs.count());
Q_FOREACH (const KScreen::OutputPtr &output, outputs) {
const auto outputId = Serializer::outputId(output);
if (allIds.contains(outputId) && !duplicateIds.contains(outputId)) {
duplicateIds << outputId;
......
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