add hw accel toggle to prefs

This commit is contained in:
Damien Elmes 2018-08-30 13:39:04 +10:00
parent a8ce102916
commit f699ebb370
3 changed files with 25 additions and 4 deletions

View file

@ -247,8 +247,6 @@ def setupGL(pm):
print("qt:", msg)
qInstallMessageHandler(msgHandler)
print("Hardware acceleration set to", mode)
if mode == "auto":
return
elif isLin:

View file

@ -76,6 +76,10 @@ class Preferences(QDialog):
f = self.form
qc = self.mw.col.conf
self._setupDayCutoff()
if isMac:
f.hwAccel.setVisible(False)
else:
f.hwAccel.setChecked(self.mw.pm.glMode() != "software")
f.lrnCutoff.setValue(qc['collapseTime']/60.0)
f.timeLimit.setValue(qc['timeLim']/60.0)
f.showEstimates.setChecked(qc['estTimes'])
@ -93,6 +97,17 @@ class Preferences(QDialog):
def updateCollection(self):
f = self.form
d = self.mw.col
if not isMac:
wasAccel = self.mw.pm.glMode() != "software"
wantAccel = f.hwAccel.isChecked()
if wasAccel != wantAccel:
if wantAccel:
self.mw.pm.setGlMode("auto")
else:
self.mw.pm.setGlMode("software")
showInfo(_("Changes will take effect when you restart Anki."))
qc = d.conf
qc['dueCounts'] = f.showProgress.isChecked()
qc['estTimes'] = f.showEstimates.isChecked()

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>405</width>
<height>469</height>
<width>423</width>
<height>508</height>
</rect>
</property>
<property name="windowTitle">
@ -66,6 +66,13 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="hwAccel">
<property name="text">
<string>Hardware acceleration (faster, may cause display issues)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showEstimates">
<property name="text">
@ -474,6 +481,7 @@
</widget>
<tabstops>
<tabstop>lang</tabstop>
<tabstop>hwAccel</tabstop>
<tabstop>showEstimates</tabstop>
<tabstop>showProgress</tabstop>
<tabstop>pastePNG</tabstop>