Commit e028473d authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Address constness of objects

Will save us some unnecessary copies
parent 0c9a8941
......@@ -44,7 +44,7 @@ Config::Config(KScreen::ConfigPtr config, QObject *parent)
{
}
QString Config::filePath()
QString Config::filePath() const
{
if (!QDir().mkpath(configsDirPath())) {
return QString();
......
......@@ -63,7 +63,7 @@ Q_SIGNALS:
private:
friend class TestConfig;
QString filePath();
QString filePath() const;
std::unique_ptr<Config> readFile(const QString &fileName);
bool writeFile(const QString &filePath);
......
......@@ -455,14 +455,14 @@ void KScreenDaemon::outputConnectedChanged()
void KScreenDaemon::monitorConnectedChange()
{
KScreen::OutputList outputs = m_monitoredConfig->data()->outputs();
Q_FOREACH(const KScreen::OutputPtr &output, outputs) {
const KScreen::OutputList outputs = m_monitoredConfig->data()->outputs();
for (const KScreen::OutputPtr &output : outputs) {
connect(output.data(), &KScreen::Output::isConnectedChanged,
this, &KScreenDaemon::outputConnectedChanged,
Qt::UniqueConnection);
}
connect(m_monitoredConfig->data().data(), &KScreen::Config::outputAdded, this,
[this] (const KScreen::OutputPtr output) {
[this] (const KScreen::OutputPtr &output) {
if (output->isConnected()) {
m_changeCompressor->start();
}
......
......@@ -62,7 +62,7 @@ void Output::readInGlobalPartFromInfo(KScreen::OutputPtr output, const QVariantM
qCDebug(KSCREEN_KDED) << "Finding a mode for" << size << "@" << modeInfo[QStringLiteral("refresh")].toFloat();
KScreen::ModeList modes = output->modes();
const KScreen::ModeList modes = output->modes();
KScreen::ModePtr matchingMode;
for(const KScreen::ModePtr &mode : modes) {
if (mode->size() != size) {
......@@ -323,7 +323,7 @@ void Output::readIn(KScreen::OutputPtr output, const QVariantMap &info, Control:
void Output::readInOutputs(KScreen::ConfigPtr config, const QVariantList &outputsInfo)
{
KScreen::OutputList outputs = config->outputs();
const KScreen::OutputList outputs = config->outputs();
ControlConfig control(config);
// As global 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
......@@ -338,10 +338,9 @@ void Output::readInOutputs(KScreen::ConfigPtr config, const QVariantList &output
}
allIds << outputId;
}
allIds.clear();
}
for (KScreen::OutputPtr output : outputs) {
for (const KScreen::OutputPtr &output : outputs) {
if (!output->isConnected()) {
output->setEnabled(false);
continue;
......
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