diff --git a/CHANGELOG b/CHANGELOG index c244354e99af7646b8c394fda32de467d72a35a2..1c747915b5647cd8ab6d5916581059fb0e328a20 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. Nominal axes are equidistant, - but scattering is computed for the actual phi, alpha of each pixel. + * 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. * 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,7 +17,6 @@ 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 d57398112dcb6d2889b73ca8715e1ad7975a2e8a..7a7d4a2562d1bb0492f3398a52f25e155a4321fa 100644 --- a/GUI/View/Main/ActionManager.cpp +++ b/GUI/View/Main/ActionManager.cpp @@ -256,6 +256,7 @@ void ActionManager::onAboutToShowSettingsMenu() styleMenu->addAction(action); }; + addStyleAction("Native style", ApplicationSettings::Style::native); addStyleAction("Light style", ApplicationSettings::Style::light); addStyleAction("Dark style", ApplicationSettings::Style::dark); } diff --git a/GUI/View/Widget/ApplicationSettings.cpp b/GUI/View/Widget/ApplicationSettings.cpp index 292c6923b0db97c4b36956aa33cd27f55728d206..b14660f93409921b8cec7e2eac6f0d7600da8c1a 100644 --- a/GUI/View/Widget/ApplicationSettings.cpp +++ b/GUI/View/Widget/ApplicationSettings.cpp @@ -35,7 +35,7 @@ const QString S_DEFAULT_UNIT_IS_ANGSTROM = "DefaultUnitIsAngstrom"; ApplicationSettings* appSettings; //!< global pointer to _the_ instance ApplicationSettings::ApplicationSettings() - : m_currentStyle(ApplicationSettings::Style::light) + : m_currentStyle(ApplicationSettings::Style::native) { appSettings = this; } @@ -61,7 +61,7 @@ void ApplicationSettings::setCreateNewProjectOnStartup(bool b) ApplicationSettings::Style ApplicationSettings::styleToUse() const { - return static_cast<Style>(QSettings().value(S_STYLE, static_cast<int>(Style::light)).toInt()); + return static_cast<Style>(QSettings().value(S_STYLE, static_cast<int>(Style::native)).toInt()); } void ApplicationSettings::setStyleToUse(Style style) @@ -101,41 +101,63 @@ void ApplicationSettings::loadWindowSizeAndPos(QWidget* w) void ApplicationSettings::loadStyle(ApplicationSettings::Style style) { - QFile base(":/styles/Base.stylesheet"); - base.open(QFile::ReadOnly); - QString stylesheet = base.readAll(); - - if (style == ApplicationSettings::Style::light) { - QFile f(":/styles/Light.stylesheet"); - f.open(QFile::ReadOnly); - stylesheet += f.readAll(); - } else if (style == ApplicationSettings::Style::dark) { - QFile f(":/styles/Dark.stylesheet"); - f.open(QFile::ReadOnly); - stylesheet += f.readAll(); - } else - ASSERT_NEVER; + QString stylesheet; + + 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(); + break; + } + default: { + QFile native(":/styles/Native.stylesheet"); + native.open(QFile::ReadOnly); + stylesheet = native.readAll(); + break; + } + } m_currentStyle = style; QPalette styleSheetPalette = qApp->style()->standardPalette(); // -- init palette for later usage; could be improved by parsing the stylesheet - if (m_currentStyle == ApplicationSettings::Style::light) { + switch (m_currentStyle) { + case ApplicationSettings::Style::light: { styleSheetPalette.setColor(QPalette::Text, Qt::black); styleSheetPalette.setColor(QPalette::WindowText, Qt::black); styleSheetPalette.setColor(QPalette::Base, Qt::white); styleSheetPalette.setColor(QPalette::AlternateBase, QColor(255, 255, 255).darker(105)); styleSheetPalette.setColor(QPalette::Dark, QColor(255, 255, 255).darker(110)); - } else if (m_currentStyle == ApplicationSettings::Style::dark) { + break; + } + case ApplicationSettings::Style::dark: { styleSheetPalette.setColor(QPalette::Text, QColor(213, 220, 223)); styleSheetPalette.setColor(QPalette::WindowText, QColor(213, 220, 223)); styleSheetPalette.setColor(QPalette::Base, QColor(43, 50, 54)); styleSheetPalette.setColor(QPalette::AlternateBase, QColor(43, 50, 54).darker(130)); styleSheetPalette.setColor(QPalette::Dark, QColor(43, 50, 54).darker(120)); + break; + } + default: { + styleSheetPalette = qApp->style()->standardPalette(); + break; + } } QApplication::setPalette(styleSheetPalette); qApp->setStyleSheet(""); qApp->setStyleSheet(stylesheet); + } ApplicationSettings::Style ApplicationSettings::currentStyle() diff --git a/GUI/View/Widget/ApplicationSettings.h b/GUI/View/Widget/ApplicationSettings.h index 86b8a8a57b0e52ae2134293f3b097efec64f4526..2b540c5dd08aa83aeadbf470bfe4f4f62a461a1b 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 { light, dark }; + enum class Style { native, light, dark }; ApplicationSettings(); diff --git a/GUI/gui.qrc b/GUI/gui.qrc index aed12d2167b152aee804f8641054544142ffa6f2..e4f10c8b2a294fddd15a51fbee10c3e7ee5422ba 100644 --- a/GUI/gui.qrc +++ b/GUI/gui.qrc @@ -71,5 +71,6 @@ <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 new file mode 100644 index 0000000000000000000000000000000000000000..6d01b3bc7734f27110969dbadf4c2d8acf52c77f --- /dev/null +++ b/GUI/styles/Native.stylesheet @@ -0,0 +1,78 @@ +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%); +}