changeset 950:c9d87032f3da osx-retina

Make Retina layer rendering selectable in settings
author Chris Cannam
date Wed, 29 Apr 2015 13:28:44 +0100
parents 4d805177023e
children 728343b94622
files .hgsubstate main/PreferencesDialog.cpp main/PreferencesDialog.h
diffstat 3 files changed, 30 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Wed Apr 29 13:08:17 2015 +0100
+++ b/.hgsubstate	Wed Apr 29 13:28:44 2015 +0100
@@ -2,4 +2,4 @@
 55ece8862b6d3a54aad271a53f9c1615e5d3bcf8 sv-dependency-builds
 dc1a360f2b694d73d4bc858b708db44249e2cddc svapp
 32ab6c48efaa23d24a67315bccdc27f3ba1a18d5 svcore
-76b5eabd816b97c9777e785fb46a784507c4c8ba svgui
+092de22db207791d93628688a35031261735bbd5 svgui
--- a/main/PreferencesDialog.cpp	Wed Apr 29 13:08:17 2015 +0100
+++ b/main/PreferencesDialog.cpp	Wed Apr 29 13:28:44 2015 +0100
@@ -223,6 +223,15 @@
 
     settings.beginGroup("Preferences");
 
+#ifdef Q_OS_MAC
+    m_retina = settings.value("scaledHiDpi", true).toBool();
+    QCheckBox *retina = new QCheckBox;
+    retina->setCheckState(m_retina ? Qt::Checked : Qt::Unchecked);
+    connect(retina, SIGNAL(stateChanged(int)), this, SLOT(retinaChanged(int)));
+#else
+    m_retina = false;
+#endif
+
     QString userLocale = settings.value("locale", "").toString();
     m_currentLocale = userLocale;
     
@@ -353,6 +362,13 @@
                        row, 0);
     subgrid->addWidget(showSplash, row++, 1, 1, 1);
 
+#ifdef Q_OS_MAC
+    if (devicePixelRatio() > 1) {
+        subgrid->addWidget(new QLabel(tr("Draw layers at Retina resolution:")), row, 0);
+        subgrid->addWidget(retina, row++, 1, 1, 1);
+    }
+#endif
+
     subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
                                                 ("Property Box Layout"))),
                        row, 0);
@@ -564,6 +580,14 @@
 }
 
 void
+PreferencesDialog::retinaChanged(int state)
+{
+    m_retina = (state == Qt::Checked);
+    m_applyButton->setEnabled(true);
+    // Does not require a restart
+}
+
+void
 PreferencesDialog::showSplashChanged(int state)
 {
     m_showSplash = (state == Qt::Checked);
@@ -680,6 +704,9 @@
     settings.setValue(permishTag, m_networkPermission);
     settings.setValue("audio-target", devices[m_audioDevice]);
     settings.setValue("locale", m_currentLocale);
+#ifdef Q_OS_MAC
+    settings.setValue("scaledHiDpi", m_retina);
+#endif
     settings.endGroup();
 
     settings.beginGroup("MainWindow");
--- a/main/PreferencesDialog.h	Wed Apr 29 13:08:17 2015 +0100
+++ b/main/PreferencesDialog.h	Wed Apr 29 13:28:44 2015 +0100
@@ -64,6 +64,7 @@
     void defaultTemplateChanged(int);
     void localeChanged(int);
     void networkPermissionChanged(int state);
+    void retinaChanged(int state);
 
     void tempDirButtonClicked();
 
@@ -95,6 +96,7 @@
     int m_resampleQuality;
     bool m_resampleOnLoad;
     bool m_networkPermission;
+    bool m_retina;
     QString m_tempDirRoot;
     int m_backgroundMode;
     int m_timeToTextMode;