Commit 51c93ef1 authored by Frederik Gladhorn's avatar Frederik Gladhorn

Remove Advanced section from screen config

Summary:
There was only one option hidden behind the andvanced section, just have
one line for refresh rate that is visible.

Reviewers: #plasma, #vdg, ngraham

Reviewed By: #vdg, ngraham

Subscribers: ngraham, andreaska, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D14325
parent bb6c51b0
......@@ -8,7 +8,6 @@ set(kcm_kscreen_SRCS
declarative/qmloutputcomponent.cpp
declarative/qmlscreen.cpp
collapsablebutton.cpp
controlpanel.cpp
outputconfig.cpp
unifiedoutputconfig.cpp
......
/*
* Copyright 2013 Daniel Vrátil <dvratil@redhat.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "collapsablebutton.h"
#include <QPainter>
#include <QStyleOption>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QHBoxLayout>
CollapsableButton::CollapsableButton(const QString &text, QWidget *parent)
: QWidget(parent)
, mCollapsed(false)
, mWidget(nullptr)
{
QHBoxLayout *layout = new QHBoxLayout(this);
mLabel = new QLabel(text, this);
layout->addWidget(mLabel);
QFont f = mLabel->font();
f.setBold(true);
mLabel->setFont(f);
mLabel->setIndent(20);
}
CollapsableButton::~CollapsableButton()
{
}
void CollapsableButton::mouseReleaseEvent(QMouseEvent *ev)
{
if (ev->button() == Qt::LeftButton) {
toggle();
Q_EMIT toggled();
}
QWidget::mouseReleaseEvent(ev);
}
void CollapsableButton::paintEvent(QPaintEvent *ev)
{
QPainter painter(this);
QStyleOption opt;
const int h = 20;
opt.rect = QRect(0, (height() - h) / 2, h, h);
opt.palette = palette();
QStyle::PrimitiveElement pe = mCollapsed ? QStyle::PE_IndicatorArrowRight : QStyle::PE_IndicatorArrowDown;
style()->drawPrimitive(pe, &opt, &painter);
painter.end();
QWidget::paintEvent(ev);
}
bool CollapsableButton::isCollapsed() const
{
return mCollapsed;
}
void CollapsableButton::setCollapsed(bool collapsed)
{
if (mCollapsed == collapsed) {
return;
}
mCollapsed = collapsed;
if (mWidget) {
mWidget->setHidden(collapsed);
}
update();
}
QLabel* CollapsableButton::label() const
{
return mLabel;
}
void CollapsableButton::setWidget(QWidget *widget)
{
mWidget = widget;
if (mWidget) {
mWidget->setHidden(isCollapsed());
}
}
QWidget *CollapsableButton::widget() const
{
return mWidget;
}
void CollapsableButton::toggle()
{
setCollapsed(!isCollapsed());
Q_EMIT toggled();
}
/*
* Copyright 2013 Daniel Vrátil <dvratil@redhat.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef COLLAPSABLE_BUTTON_H
#define COLLAPSABLE_BUTTON_H
#include <QLabel>
class CollapsableButton : public QWidget
{
Q_OBJECT
public:
explicit CollapsableButton(const QString &text, QWidget *parent = nullptr);
~CollapsableButton() override;
void setCollapsed(bool collapsed);
bool isCollapsed() const;
void setWidget(QWidget *widget);
QWidget* widget() const;
QLabel* label() const;
public Q_SLOTS:
void toggle();
Q_SIGNALS:
void toggled();
protected:
void paintEvent(QPaintEvent *ev) override;
void mouseReleaseEvent(QMouseEvent *ev) override;
private:
bool mCollapsed;
QLabel *mLabel;
QWidget *mWidget;
};
#endif // COLLAPSABLE_BUTTON_H
......@@ -21,7 +21,6 @@
#include "outputconfig.h"
#include "resolutionslider.h"
#include "collapsablebutton.h"
#include "utils.h"
#include "kcm_screen_debug.h"
......@@ -139,21 +138,7 @@ void OutputConfig::initUi()
formLayout->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum));
}
CollapsableButton *advancedButton = new CollapsableButton(i18n("Advanced Settings"), this);
advancedButton->setCollapsed(true);
vbox->addWidget(advancedButton);
QWidget *advancedWidget = new QWidget(this);
int leftMargin, topMargin, rightMargin, bottomMargin;
advancedWidget->getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin);
advancedWidget->setContentsMargins(25, topMargin, rightMargin, bottomMargin);
vbox->addWidget(advancedWidget);
advancedButton->setWidget(advancedWidget);
formLayout = new QFormLayout(advancedWidget);
advancedWidget->setLayout(formLayout);
mRefreshRate = new QComboBox(advancedWidget);
mRefreshRate = new QComboBox(this);
mRefreshRate->addItem(i18n("Auto"), -1);
formLayout->addRow(i18n("Refresh rate:"), mRefreshRate);
slotResolutionChanged(mResolution->currentResolution());
......
......@@ -28,7 +28,6 @@
#include <kscreen/output.h>
class CollapsableButton;
class QCheckBox;
class ResolutionSlider;
class QLabel;
......
......@@ -20,7 +20,6 @@
*/
#include "unifiedoutputconfig.h"
#include "collapsablebutton.h"
#include "resolutionslider.h"
#include "utils.h"
#include "kcm_screen_debug.h"
......@@ -29,6 +28,7 @@
#include <QIcon>
#include <KLocalizedString>
#include <QLabel>
#include <QGridLayout>
#include <QSpacerItem>
#include <QCheckBox>
......
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