Commit 2ae645bd authored by Méven Car's avatar Méven Car Committed by Marco Martin
Browse files

Don't save scale in control file

cc @apol 

But then we can ask ourselves do you need this control layer at all ?

It has always seemed to me an over-engineering.
If the backend can't save some settings that is a bug, this control layer is just a workaround.

[CCBUG: 442743](https://bugs.kde.org/show_bug.cgi?id=442743)
parent e72a8d98
Pipeline #247799 passed with stage
in 1 minute and 1 second
......@@ -345,16 +345,6 @@ void ControlConfig::set(const KScreen::OutputPtr &output, const QString &name, F
}
}
qreal ControlConfig::getScale(const KScreen::OutputPtr &output) const
{
return get(output, scaleString, &ControlOutput::getScale, -1.0);
}
void ControlConfig::setScale(const KScreen::OutputPtr &output, qreal value)
{
set<qreal>(output, scaleString, &ControlOutput::setScale, value);
}
bool ControlConfig::getAutoRotate(const KScreen::OutputPtr &output) const
{
return get(output, autorotateString, &ControlOutput::getAutoRotate, true);
......@@ -514,21 +504,6 @@ QString ControlOutput::filePath() const
return filePathFromHash(m_output->hashMd5());
}
qreal ControlOutput::getScale() const
{
const auto val = constInfo()[scaleString];
return val.canConvert<qreal>() ? val.toReal() : -1;
}
void ControlOutput::setScale(qreal value)
{
auto &infoMap = info();
if (infoMap.isEmpty()) {
infoMap = createOutputInfo(m_output->hashMd5(), m_output->name());
}
infoMap[scaleString] = value;
}
bool ControlOutput::getAutoRotate() const
{
const auto val = constInfo()[autorotateString];
......
......@@ -60,28 +60,11 @@ void ConfigHandler::setConfig(KScreen::ConfigPtr config)
Q_EMIT outputModelChanged();
}
void ConfigHandler::resetScale(const KScreen::OutputPtr &output)
{
// Load scale control (either not set, same or windowing system does not transmit scale).
const qreal scale = m_control->getScale(output);
if (scale > 0) {
output->setScale(scale);
const auto outputs = m_initialConfig->outputs();
for (auto initialOutput : outputs) {
if (initialOutput->id() == output->id()) {
initialOutput->setScale(scale);
break;
}
}
}
}
void ConfigHandler::initOutput(const KScreen::OutputPtr &output)
{
output->setExplicitLogicalSize(config()->logicalSizeForOutput(*output));
if (output->isConnected()) {
resetScale(output);
m_outputModel->add(output);
}
connect(output.data(), &KScreen::Output::isConnectedChanged, this, [this, output]() {
......@@ -98,10 +81,6 @@ void ConfigHandler::updateInitialData()
return;
}
m_initialConfig = qobject_cast<GetConfigOperation *>(op)->config();
const auto outputs = m_config->outputs();
for (const auto &output : outputs) {
resetScale(output);
}
m_initialControl.reset(new ControlConfig(m_initialConfig));
checkNeedsSave();
});
......@@ -292,16 +271,6 @@ void ConfigHandler::setRetention(int retention)
Q_EMIT changed();
}
qreal ConfigHandler::scale(const KScreen::OutputPtr &output) const
{
return m_control->getScale(output);
}
void ConfigHandler::setScale(KScreen::OutputPtr &output, qreal scale)
{
m_control->setScale(output, scale);
}
KScreen::OutputPtr ConfigHandler::replicationSource(const KScreen::OutputPtr &output) const
{
return m_control->getReplicationSource(output);
......
......@@ -48,9 +48,6 @@ public:
int retention() const;
void setRetention(int retention);
qreal scale(const KScreen::OutputPtr &output) const;
void setScale(KScreen::OutputPtr &output, qreal scale);
KScreen::OutputPtr replicationSource(const KScreen::OutputPtr &output) const;
void setReplicationSource(KScreen::OutputPtr &output, const KScreen::OutputPtr &source);
......@@ -88,7 +85,6 @@ private:
void primaryOutputSelected(int index);
void primaryOutputChanged(const KScreen::OutputPtr &output);
void initOutput(const KScreen::OutputPtr &output);
void resetScale(const KScreen::OutputPtr &output);
/**
* @brief checkSaveandTestCommon - compairs common config changes that would make the config dirty and needed to have the config checked when applied.
* @param isSaveCheck - True if your checking to see if the changes should request a save.
......
......@@ -183,7 +183,6 @@ bool OutputModel::setData(const QModelIndex &index, const QVariant &value, int r
const auto oldSize = output.ptr->explicitLogicalSize().toSize();
output.ptr->setScale(scale);
m_config->setScale(output.ptr, scale);
const auto newSize = m_config->config()->logicalSizeForOutput(*output.ptr).toSize();
output.ptr->setExplicitLogicalSize(newSize);
......
Supports Markdown
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