From 86e3ceb0e97333d782719279e3d4bedea1e9ff67 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 18 Sep 2022 15:51:43 +0200 Subject: [PATCH] cleanup: remove isGnome3Session function This is only used for archaic distros. Signed-off-by: Berthold Stoeger --- desktop-widgets/modeldelegates.cpp | 9 ------ desktop-widgets/simplewidgets.cpp | 15 ---------- desktop-widgets/simplewidgets.h | 2 -- .../tab-widgets/TabDiveEquipment.cpp | 9 ------ desktop-widgets/tab-widgets/maintab.cpp | 28 ------------------- 5 files changed, 63 deletions(-) diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp index 570bed872..a7e3a6be2 100644 --- a/desktop-widgets/modeldelegates.cpp +++ b/desktop-widgets/modeldelegates.cpp @@ -127,15 +127,6 @@ QWidget *ComboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewI currCombo.model = const_cast(index.model()); currCombo.activeText = currCombo.model->data(index).toString(); - // Current display of things on Gnome3 looks like shit, so - // let's fix that. - if (isGnome3Session()) { - QPalette p; - p.setColor(QPalette::Window, QColor(Qt::white)); - p.setColor(QPalette::Base, QColor(Qt::white)); - comboDelegate->lineEdit()->setPalette(p); - comboDelegate->setPalette(p); - } return comboDelegate; } diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index 4fc89ac21..cc1a1ed2c 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -282,21 +282,6 @@ QString URLDialog::url() const return ui.urlField->toPlainText(); } -bool isGnome3Session() -{ -#if defined(QT_OS_WIW) || defined(QT_OS_MAC) - return false; -#else - if (qApp->style()->objectName() != "gtk+") - return false; - QProcess p; - p.start("pidof", QStringList() << "gnome-shell"); - p.waitForFinished(-1); - QString p_stdout = p.readAllStandardOutput(); - return !p_stdout.isEmpty(); -#endif -} - #define COMPONENT_FROM_UI(_component) what->_component = ui._component->isChecked() #define UI_FROM_COMPONENT(_component) ui._component->setChecked(what->_component) diff --git a/desktop-widgets/simplewidgets.h b/desktop-widgets/simplewidgets.h index d5d3764ff..0f143d724 100644 --- a/desktop-widgets/simplewidgets.h +++ b/desktop-widgets/simplewidgets.h @@ -146,6 +146,4 @@ private: Q_DISABLE_COPY(TextHyperlinkEventFilter) }; -bool isGnome3Session(); - #endif // SIMPLEWIDGETS_H diff --git a/desktop-widgets/tab-widgets/TabDiveEquipment.cpp b/desktop-widgets/tab-widgets/TabDiveEquipment.cpp index 2524fb371..2598ce808 100644 --- a/desktop-widgets/tab-widgets/TabDiveEquipment.cpp +++ b/desktop-widgets/tab-widgets/TabDiveEquipment.cpp @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #include "TabDiveEquipment.h" #include "maintab.h" -#include "desktop-widgets/simplewidgets.h" // For isGnome3Session() #include "desktop-widgets/modeldelegates.h" #include "core/dive.h" #include "core/selection.h" @@ -51,14 +50,6 @@ TabDiveEquipment::TabDiveEquipment(QWidget *parent) : TabBase(parent), connect(cylindersModel, &CylindersModel::divesEdited, this, &TabDiveEquipment::divesEdited); connect(weightModel, &WeightModel::divesEdited, this, &TabDiveEquipment::divesEdited); - // Current display of things on Gnome3 looks like shit, so - // let's fix that. - if (isGnome3Session()) { - QPalette p; - p.setColor(QPalette::Window, QColor(Qt::white)); - ui.scrollArea->viewport()->setPalette(p); - } - ui.cylinders->view()->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate(this)); ui.cylinders->view()->setItemDelegateForColumn(CylindersModel::USE, new TankUseDelegate(this)); ui.cylinders->view()->setItemDelegateForColumn(CylindersModel::SENSORS, new SensorDelegate(this)); diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 0eb7adc89..41f994e77 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -16,7 +16,6 @@ #include "TabDiveSite.h" #include "core/selection.h" -#include "desktop-widgets/simplewidgets.h" // for isGnome3Session() #include "qt-models/diveplannermodel.h" #include @@ -63,33 +62,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), else setDocumentMode(false); - // Current display of things on Gnome3 looks like shit, so - // let's fix that. - if (isGnome3Session()) { - // TODO: Either do this for all scroll areas or none - //QPalette p; - //p.setColor(QPalette::Window, QColor(Qt::white)); - //ui.scrollArea->viewport()->setPalette(p); - - // GroupBoxes in Gnome3 looks like I'v drawn them... - static const QString gnomeCss = QStringLiteral( - "QGroupBox {" - "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," - "stop: 0 #E0E0E0, stop: 1 #FFFFFF);" - "border: 2px solid gray;" - "border-radius: 5px;" - "margin-top: 1ex;" - "}" - "QGroupBox::title {" - "subcontrol-origin: margin;" - "subcontrol-position: top center;" - "padding: 0 3px;" - "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," - "stop: 0 #E0E0E0, stop: 1 #FFFFFF);" - "}"); - for (QGroupBox *box: findChildren()) - box->setStyleSheet(gnomeCss); - } // QLineEdit and QLabels should have minimal margin on the left and right but not waste vertical space QMargins margins(3, 2, 1, 0); for (QLabel *label: findChildren())