diff main/PreferencesDialog.cpp @ 950:c9d87032f3da osx-retina

Make Retina layer rendering selectable in settings
author Chris Cannam
date Wed, 29 Apr 2015 13:28:44 +0100
parents 6de549288477
children 1f4e40be5aa2
line wrap: on
line diff
--- 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");