From dbf182fc39ad4014f696850a26ba98b383e4ad44 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Thu, 9 Nov 2023 10:21:25 +0100
Subject: [PATCH] rm "native" stylesheet (#819); update CHANGELOG

---
 CHANGELOG                               |  5 +-
 GUI/View/Main/ActionManager.cpp         |  1 -
 GUI/View/Widget/ApplicationSettings.cpp | 31 ++++------
 GUI/View/Widget/ApplicationSettings.h   |  2 +-
 GUI/gui.qrc                             |  1 -
 GUI/styles/Native.stylesheet            | 78 -------------------------
 6 files changed, 14 insertions(+), 104 deletions(-)
 delete mode 100644 GUI/styles/Native.stylesheet

diff --git a/CHANGELOG b/CHANGELOG
index 1c747915b56..c244354e99a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,8 +4,8 @@ BornAgain-22.0, in preparation
     * LambdaScan for time-of-flight offspec
     * Datafield::flat flattens out axis of size 1
    > API:
-    * Detector2D replaces RectangularDetector and SphericalDetector. Its nominal axes are equidistant
-      phi, alpha grids, but scattering is computed for the actual phi, alpha of each pixel.
+    * Detector2D replaces RectangularDetector and SphericalDetector. Nominal axes are equidistant,
+      but scattering is computed for the actual phi, alpha of each pixel.
     * Offspec analyzer is set for detector, not scan(#651)
     * FitObjective::addSimulationAndData has been replaced by function addFitPair,
       which takes experimental data in form of a Datafield object instead of a NumPy array
@@ -17,6 +17,7 @@ BornAgain-22.0, in preparation
     * Simplified and unified some views
     * In sample model, removed possibility to set lengths in angstrom instead of nm (#756)
     * Removed unfinished undo/redo support (#757)
+    * Removed style option "native" (#819)
   > Examples and documentation:
     * New Transmission.py, prints transmission of a multilayer
   > Bug fixes:
diff --git a/GUI/View/Main/ActionManager.cpp b/GUI/View/Main/ActionManager.cpp
index 938e0f830cd..09152502884 100644
--- a/GUI/View/Main/ActionManager.cpp
+++ b/GUI/View/Main/ActionManager.cpp
@@ -257,7 +257,6 @@ void ActionManager::onAboutToShowSettingsMenu()
     };
 
     addStyleAction("Dark style", ApplicationSettings::Style::dark);
-    addStyleAction("Native style", ApplicationSettings::Style::native);
     addStyleAction("Light style", ApplicationSettings::Style::light);
 }
 
diff --git a/GUI/View/Widget/ApplicationSettings.cpp b/GUI/View/Widget/ApplicationSettings.cpp
index e6074320927..33f24e9fc54 100644
--- a/GUI/View/Widget/ApplicationSettings.cpp
+++ b/GUI/View/Widget/ApplicationSettings.cpp
@@ -36,7 +36,7 @@ const QString S_DEFAULT_UNIT_IS_ANGSTROM = "DefaultUnitIsAngstrom";
 ApplicationSettings* appSettings; //!< global pointer to _the_ instance
 
 ApplicationSettings::ApplicationSettings()
-    : m_currentStyle(ApplicationSettings::Style::native)
+    : m_currentStyle(ApplicationSettings::Style::light)
 {
     appSettings = this;
 }
@@ -62,7 +62,7 @@ void ApplicationSettings::setCreateNewProjectOnStartup(bool b)
 
 ApplicationSettings::Style ApplicationSettings::styleToUse() const
 {
-    return static_cast<Style>(QSettings().value(S_STYLE, static_cast<int>(Style::native)).toInt());
+    return static_cast<Style>(QSettings().value(S_STYLE, static_cast<int>(Style::light)).toInt());
 }
 
 void ApplicationSettings::setStyleToUse(Style style)
@@ -132,29 +132,22 @@ void ApplicationSettings::loadWindowSizeAndPos(QWidget* w)
 
 void ApplicationSettings::loadStyle(ApplicationSettings::Style style)
 {
-    QString stylesheet;
+    QFile base(":/styles/Base.stylesheet");
+    base.open(QFile::ReadOnly);
+    QString stylesheet = base.readAll();
 
     switch (style) {
-    case ApplicationSettings::Style::light: {
-        QFile base(":/styles/Base.stylesheet");
-        base.open(QFile::ReadOnly);
-        QFile light(":/styles/Light.stylesheet");
-        light.open(QFile::ReadOnly);
-        stylesheet = base.readAll() + light.readAll();
-        break;
-    }
     case ApplicationSettings::Style::dark: {
-        QFile base(":/styles/Base.stylesheet");
-        base.open(QFile::ReadOnly);
         QFile dark(":/styles/Dark.stylesheet");
         dark.open(QFile::ReadOnly);
-        stylesheet = base.readAll() + dark.readAll();
+        stylesheet += dark.readAll();
         break;
     }
+    case ApplicationSettings::Style::light:
     default: {
-        QFile native(":/styles/Native.stylesheet");
-        native.open(QFile::ReadOnly);
-        stylesheet = native.readAll();
+        QFile light(":/styles/Light.stylesheet");
+        light.open(QFile::ReadOnly);
+        stylesheet += light.readAll();
         break;
     }
     }
@@ -180,10 +173,6 @@ void ApplicationSettings::loadStyle(ApplicationSettings::Style style)
         styleSheetPalette.setColor(QPalette::Dark, QColor(43, 50, 54).darker(120));
         break;
     }
-    default: {
-        styleSheetPalette = qApp->style()->standardPalette();
-        break;
-    }
     }
     QApplication::setPalette(styleSheetPalette);
     qApp->setStyleSheet("");
diff --git a/GUI/View/Widget/ApplicationSettings.h b/GUI/View/Widget/ApplicationSettings.h
index 6141be08159..49ca9370c02 100644
--- a/GUI/View/Widget/ApplicationSettings.h
+++ b/GUI/View/Widget/ApplicationSettings.h
@@ -27,7 +27,7 @@ class QVariant;
 //! contains settings which may be user editable in the future.
 class ApplicationSettings {
 public:
-    enum class Style { native, light, dark };
+    enum class Style { light, dark };
 
     ApplicationSettings();
 
diff --git a/GUI/gui.qrc b/GUI/gui.qrc
index e61c21b021c..7bac3609e8c 100644
--- a/GUI/gui.qrc
+++ b/GUI/gui.qrc
@@ -74,6 +74,5 @@
         <file>styles/Base.stylesheet</file>
         <file>styles/Dark.stylesheet</file>
         <file>styles/Light.stylesheet</file>
-        <file>styles/Native.stylesheet</file>
     </qresource>
 </RCC>
diff --git a/GUI/styles/Native.stylesheet b/GUI/styles/Native.stylesheet
deleted file mode 100644
index 6d01b3bc773..00000000000
--- a/GUI/styles/Native.stylesheet
+++ /dev/null
@@ -1,78 +0,0 @@
-CompoundForm, LayerForm,MesocrystalForm,ParticleForm,CoreAndShellForm, ParticleLayoutForm{
-    border: 1px solid;
-    border-color: rgba(100, 100, 100, 10%);
-}
-
-
-/* Reset Margin From QGroupBox To 0px To Save Space In SampleView */
-LayerForm {
-    margin-top:0px;
-
-}
-LayerForm QGroupBox{
-    border: 1px solid;
-    border-color: rgba(100, 100, 100, 25%);
-}
-
-
-ProjectsView{
-    background-color: #e6e6e6;
-}
-
-
-SampleView QGroupBox
-{
-    border: 1px solid rgba(0, 0, 0,0%);
-    border-radius: 3px;
-}
-
-SampleView LayerOrientedSampleEditor QScrollArea LayerForm QLabel{
-    color: black;
-}
-
-SampleView LayerOrientedSampleEditor QScrollArea LayerForm QCheckBox{
-    color: black;
-}
-
-SampleView LayerOrientedSampleEditor QScrollArea LayerForm QToolButton{
-    color: black;
-}
-
-SampleView LayerOrientedSampleEditor QScrollArea LayerForm QPushButton{
-    color: black;
-}
-
-
-/* Set The Style For The Global SideBar */
-QToolButton#ViewSelectionButton
-{
-    border: none;
-    color: white; background-color:  qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop : 0 #153b4c, stop : 1 #347a9c);
-}
-
-QToolButton#GroupBoxToggler
-{
-    border: none;
-    text-align: left; font: bold;
-    padding: 5px
-}
-
-QToolButton#ViewSelectionButton:pressed
-{
-    color: white; background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #97a8b0, stop: 1 #dae7ed);
-}
-
-QToolButton#ViewSelectionButton:hover
-{
-    color: white; background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #254b5c, stop: 1 #448aac);
-}
-
-QToolButton#ViewSelectionButton:checked
-{
-    color: white; background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop : 0 #2b899c, stop : 1 #2abdda);
-}
-QToolButton#ViewSelectionButton:disabled
-{
-    color: dimgray; background-color: transparent;
-    border-right: 1px solid rgba(100,100,100,25%);
-}
-- 
GitLab