Commit cd3b350e authored by Sebastian Kügler's avatar Sebastian Kügler
Browse files

hide primary display combo when not supported

Summary:
Some backends, for example the kwayland backend, do not support
setting the primary display. The backends already make their
feature set known so we can just hide it from the UI.

It's enough to hide it from the UI since setting it doesn't make
any difference, the libkscreen backend will simply ignore it
internally, so it's just honest to not show it.

BUG:390638

Test Plan:
ran kscreen kcm on both, X11 and wayland platforms, combo
and label are shown and hidden as expected

Reviewers: #plasma, dvratil, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: kpiwowarski, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10723
parent 411c3c20
......@@ -89,7 +89,8 @@ Widget::Widget(QWidget *parent):
mPrimaryCombo = new PrimaryOutputCombo(this);
connect(mPrimaryCombo, &PrimaryOutputCombo::changed,
this, &Widget::changed);
hbox->addWidget(new QLabel(i18n("Primary display:")));
mPrimaryLabel = new QLabel(i18n("Primary display:"));
hbox->addWidget(mPrimaryLabel);
hbox->addWidget(mPrimaryCombo);
hbox->addStretch();
......@@ -176,7 +177,8 @@ void Widget::setConfig(const KScreen::ConfigPtr &config)
mPrimaryCombo->setConfig(mConfig);
mUnifyButton->setEnabled(mConfig->outputs().count() > 1);
mScaleAllOutputsButton->setVisible(!mConfig->supportedFeatures().testFlag(KScreen::Config::Feature::PerOutputScaling));
mPrimaryCombo->setVisible(mConfig->supportedFeatures().testFlag(KScreen::Config::Feature::PrimaryDisplay));
mPrimaryLabel->setVisible(mConfig->supportedFeatures().testFlag(KScreen::Config::Feature::PrimaryDisplay));
for (const KScreen::OutputPtr &output : mConfig->outputs()) {
connect(output.data(), &KScreen::Output::isEnabledChanged,
......
......@@ -26,6 +26,7 @@
#include <kscreen/config.h>
class ProfilesModel;
class QLabel;
class QMLOutput;
class QMLScreen;
class ControlPanel;
......@@ -89,6 +90,7 @@ class Widget : public QWidget
ProfilesModel *mProfilesModel = nullptr;
PrimaryOutputCombo *mPrimaryCombo = nullptr;
QLabel *mPrimaryLabel = nullptr;
QComboBox *mProfilesCombo = nullptr;
QPushButton *mScaleAllOutputsButton = nullptr;
......
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