[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kscreen] kcm/src: Show the preferred resolution on the combo box
From:       Aleix Pol <null () kde ! org>
Date:       2018-09-28 16:34:30
Message-ID: E1g5vio-0005mp-Ct () code ! kde ! org
[Download RAW message or body]

Git commit dfd178e6d093885b430847b5ec0d880c12785633 by Aleix Pol, on behalf of Your \
Name. Committed on 28/09/2018 at 16:32.
Pushed by apol into branch 'master'.

Show the preferred resolution on the combo box

Summary: Usually there's a preferred resoluton for a display, let the user know it

Test Plan: Used the kcm with it, it's shown.

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: ngraham, davidedmundson, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D15776

M  +7    -4    kcm/src/resolutionslider.cpp

https://commits.kde.org/kscreen/dfd178e6d093885b430847b5ec0d880c12785633

diff --git a/kcm/src/resolutionslider.cpp b/kcm/src/resolutionslider.cpp
index ad22660..7485125 100644
--- a/kcm/src/resolutionslider.cpp
+++ b/kcm/src/resolutionslider.cpp
@@ -63,10 +63,13 @@ ResolutionSlider::ResolutionSlider(const KScreen::OutputPtr \
&output, QWidget *pa  mComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
         mComboBox->setEditable(false);
         Q_FOREACH (const QSize &size, mModes) {
-            mComboBox->addItem(Utils::sizeToString(size));
-            if ((output->currentMode() && (output->currentMode()->size() == size))
-                || (output->preferredMode() && (output->preferredMode()->size() == \
                size))) {
-                    mComboBox->setCurrentIndex(mComboBox->count() - 1);
+            const bool isCurrentMode = output->currentMode() && \
(output->currentMode()->size() == size); +            const bool isPreferredMode = \
output->preferredMode() && (output->preferredMode()->size() == size); +            \
const QIcon icon = isPreferredMode ? QIcon::fromTheme(QStringLiteral("favorite")) : \
QIcon(); +
+            mComboBox->addItem(icon, Utils::sizeToString(size));
+            if (isCurrentMode || isPreferredMode) {
+                mComboBox->setCurrentIndex(mComboBox->count() - 1);
             }
         }
         layout->addWidget(mComboBox, 0, 0, 1, 1);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic