From 27c05c94e114371193fa5894475cb37f174accc9 Mon Sep 17 00:00:00 2001
From: Benedikt Reinartz <filmor@gmail.com>
Date: Fri, 22 Dec 2017 08:26:25 +0100
Subject: [PATCH] Add native styling back.

---
 mscore/helpBrowser.cpp | 7 ++++---
 mscore/miconengine.cpp | 3 +++
 mscore/musescore.cpp   | 4 ++++
 mscore/preferences.cpp | 5 +++++
 mscore/preferences.h   | 4 +++-
 mscore/prefsdialog.ui  | 5 +++++
 6 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/mscore/helpBrowser.cpp b/mscore/helpBrowser.cpp
index 8335fe5c9..f806d361a 100644
--- a/mscore/helpBrowser.cpp
+++ b/mscore/helpBrowser.cpp
@@ -150,9 +150,10 @@ HelpBrowser::HelpBrowser(QWidget* parent)
 
       bl->addStretch(10);
 
-      view->document()->setDefaultStyleSheet(
-            preferences.isThemeDark() ? cssDark : css);
-      view->setOpenExternalLinks(true);
+      if (!preferences.isThemeNative())
+          view->document()->setDefaultStyleSheet(
+                preferences.isThemeDark() ? cssDark : css);
+
       toolbar->setLayout(bl);
       }
 
diff --git a/mscore/miconengine.cpp b/mscore/miconengine.cpp
index 1d82cb9db..37ca5d606 100644
--- a/mscore/miconengine.cpp
+++ b/mscore/miconengine.cpp
@@ -117,6 +117,9 @@ void MIconEnginePrivate::loadDataForModeAndState(QSvgRenderer* renderer, QIcon::
             if (svgFile.isEmpty())
                   svgFile = svgFiles.value(hashKey(QIcon::Normal, QIcon::Off));
             if (!svgFile.isEmpty()) {
+                  if (Ms::preferences.isThemeNative())
+                        return;
+
                   QFile f(svgFile);
                   f.open(QIODevice::ReadOnly);
                   QByteArray ba = f.readAll();
diff --git a/mscore/musescore.cpp b/mscore/musescore.cpp
index 11d7f3bbb..5d427a65d 100644
--- a/mscore/musescore.cpp
+++ b/mscore/musescore.cpp
@@ -6815,12 +6815,16 @@ bool MuseScore::saveMp3(Score* score, QIODevice* device, bool& wasCanceled)
 
 void MuseScore::updateUiStyleAndTheme()
       {
+      if (preferences.isThemeNative())
+            return;
+
       // set UI Theme
       QApplication::setStyle(QStyleFactory::create("Fusion"));
 
       QString wd      = QString("%1/%2").arg(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)).arg(QCoreApplication::applicationName());
       // set UI Color Palette
       QPalette p(QApplication::palette());
+
       QString jsonPaletteFilename = preferences.isThemeDark() ? "palette_dark_fusion.json" : "palette_light_fusion.json";;
       QFile jsonPalette(QString(":/themes/%1").arg(jsonPaletteFilename));
       // read from Documents TODO: remove this
diff --git a/mscore/preferences.cpp b/mscore/preferences.cpp
index 816df5c81..ff61f2c22 100644
--- a/mscore/preferences.cpp
+++ b/mscore/preferences.cpp
@@ -377,6 +377,11 @@ MuseScoreStyleType Preferences::globalStyle() const
       return preference(PREF_UI_APP_GLOBALSTYLE).value<MuseScoreStyleType>();
       }
 
+bool Preferences::isThemeNative() const
+      {
+      return globalStyle() == MuseScoreStyleType::NATIVE;
+      }
+
 bool Preferences::isThemeDark() const
       {
       return globalStyle() == MuseScoreStyleType::DARK_FUSION;
diff --git a/mscore/preferences.h b/mscore/preferences.h
index de5485ae2..9292aa5f5 100644
--- a/mscore/preferences.h
+++ b/mscore/preferences.h
@@ -64,7 +64,8 @@ enum {
 
 enum class MuseScoreStyleType : char {
       DARK_FUSION = 0,
-      LIGHT_FUSION
+      LIGHT_FUSION,
+      NATIVE
       };
 
 // MusicXML export break values
@@ -337,6 +338,7 @@ class Preferences {
       SessionStart sessionStart() const;
       MusicxmlExportBreaks musicxmlExportBreaks() const;
       MuseScoreStyleType globalStyle() const;
+      bool isThemeNative() const;
       bool isThemeDark() const;
 
       template<typename T>
diff --git a/mscore/prefsdialog.ui b/mscore/prefsdialog.ui
index 7d9a9e622..bac283bdd 100644
--- a/mscore/prefsdialog.ui
+++ b/mscore/prefsdialog.ui
@@ -735,6 +735,11 @@
               <string>Light</string>
              </property>
             </item>
+            <item>
+             <property name="text">
+              <string>Native</string>
+             </property>
+            </item>
            </widget>
           </item>
           <item row="2" column="3">
-- 
2.19.2

