comparison 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
comparison
equal deleted inserted replaced
949:4d805177023e 950:c9d87032f3da
220 connect(bgMode, SIGNAL(currentIndexChanged(int)), 220 connect(bgMode, SIGNAL(currentIndexChanged(int)),
221 this, SLOT(backgroundModeChanged(int))); 221 this, SLOT(backgroundModeChanged(int)));
222 #endif 222 #endif
223 223
224 settings.beginGroup("Preferences"); 224 settings.beginGroup("Preferences");
225
226 #ifdef Q_OS_MAC
227 m_retina = settings.value("scaledHiDpi", true).toBool();
228 QCheckBox *retina = new QCheckBox;
229 retina->setCheckState(m_retina ? Qt::Checked : Qt::Unchecked);
230 connect(retina, SIGNAL(stateChanged(int)), this, SLOT(retinaChanged(int)));
231 #else
232 m_retina = false;
233 #endif
225 234
226 QString userLocale = settings.value("locale", "").toString(); 235 QString userLocale = settings.value("locale", "").toString();
227 m_currentLocale = userLocale; 236 m_currentLocale = userLocale;
228 237
229 QString permishTag = QString("network-permission-%1").arg(SV_VERSION); 238 QString permishTag = QString("network-permission-%1").arg(SV_VERSION);
351 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel 360 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
352 ("Show Splash Screen"))), 361 ("Show Splash Screen"))),
353 row, 0); 362 row, 0);
354 subgrid->addWidget(showSplash, row++, 1, 1, 1); 363 subgrid->addWidget(showSplash, row++, 1, 1, 1);
355 364
365 #ifdef Q_OS_MAC
366 if (devicePixelRatio() > 1) {
367 subgrid->addWidget(new QLabel(tr("Draw layers at Retina resolution:")), row, 0);
368 subgrid->addWidget(retina, row++, 1, 1, 1);
369 }
370 #endif
371
356 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel 372 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
357 ("Property Box Layout"))), 373 ("Property Box Layout"))),
358 row, 0); 374 row, 0);
359 subgrid->addWidget(propertyLayout, row++, 1, 1, 2); 375 subgrid->addWidget(propertyLayout, row++, 1, 1, 2);
360 376
559 PreferencesDialog::networkPermissionChanged(int state) 575 PreferencesDialog::networkPermissionChanged(int state)
560 { 576 {
561 m_networkPermission = (state == Qt::Checked); 577 m_networkPermission = (state == Qt::Checked);
562 m_applyButton->setEnabled(true); 578 m_applyButton->setEnabled(true);
563 m_changesOnRestart = true; 579 m_changesOnRestart = true;
580 }
581
582 void
583 PreferencesDialog::retinaChanged(int state)
584 {
585 m_retina = (state == Qt::Checked);
586 m_applyButton->setEnabled(true);
587 // Does not require a restart
564 } 588 }
565 589
566 void 590 void
567 PreferencesDialog::showSplashChanged(int state) 591 PreferencesDialog::showSplashChanged(int state)
568 { 592 {
678 settings.beginGroup("Preferences"); 702 settings.beginGroup("Preferences");
679 QString permishTag = QString("network-permission-%1").arg(SV_VERSION); 703 QString permishTag = QString("network-permission-%1").arg(SV_VERSION);
680 settings.setValue(permishTag, m_networkPermission); 704 settings.setValue(permishTag, m_networkPermission);
681 settings.setValue("audio-target", devices[m_audioDevice]); 705 settings.setValue("audio-target", devices[m_audioDevice]);
682 settings.setValue("locale", m_currentLocale); 706 settings.setValue("locale", m_currentLocale);
707 #ifdef Q_OS_MAC
708 settings.setValue("scaledHiDpi", m_retina);
709 #endif
683 settings.endGroup(); 710 settings.endGroup();
684 711
685 settings.beginGroup("MainWindow"); 712 settings.beginGroup("MainWindow");
686 settings.setValue("sessiontemplate", m_currentTemplate); 713 settings.setValue("sessiontemplate", m_currentTemplate);
687 settings.endGroup(); 714 settings.endGroup();