add a browser options dialog so the user can toggle full search

This commit is contained in:
Damien Elmes 2011-04-17 08:11:24 +09:00
parent 28c1741b43
commit 4fa0a68dd3
5 changed files with 159 additions and 142 deletions

View file

@ -346,7 +346,7 @@ class Browser(QMainWindow):
c(f.actionToggleSuspend, SIGNAL("triggered(bool)"), self.onSuspend)
c(f.actionToggleMark, SIGNAL("triggered(bool)"), self.onMark)
# edit
c(f.actionFont, s, self.onFont)
c(f.actionOptions, s, self.onOptions)
c(f.actionUndo, s, self.mw.onUndo)
c(f.actionInvertSelection, s, self.invertSelection)
c(f.actionSelectFacts, s, self.selectFacts)
@ -907,17 +907,18 @@ where id in %s""" % ids2str(sf))
else:
self.form.actionUndo.setEnabled(False)
# Edit: font
# Options
######################################################################
def onFont(self):
def onOptions(self):
d = QDialog(self)
frm = aqt.forms.editfont.Ui_Dialog()
frm = aqt.forms.browseropts.Ui_Dialog()
frm.setupUi(d)
frm.fontCombo.setCurrentFont(QFont(
self.mw.config['editFontFamily']))
frm.fontSize.setValue(self.mw.config['editFontSize'])
frm.lineSize.setValue(self.mw.config['editLineSize'])
frm.fullSearch.setChecked(self.mw.config['fullSearch'])
if d.exec_():
self.mw.config['editFontFamily'] = (
unicode(frm.fontCombo.currentFont().family()))
@ -925,6 +926,7 @@ where id in %s""" % ids2str(sf))
int(frm.fontSize.value()))
self.mw.config['editLineSize'] = (
int(frm.lineSize.value()))
self.mw.config['fullSearch'] = frm.fullSearch.isChecked()
self.updateFont()
# Edit: replacing

View file

@ -20,8 +20,8 @@ defaultConf = {
'factEditorAdvanced': False,
'showStudyScreen': True,
'recentDeckPaths': [],
'interfaceLang': "en",
'fullSearch': False,
'autoplaySounds': True,
'checkForUpdates': True,

View file

@ -202,7 +202,7 @@
<addaction name="actionFindReplace"/>
<addaction name="actionFindDuplicates"/>
<addaction name="separator"/>
<addaction name="actionFont"/>
<addaction name="actionOptions"/>
</widget>
<widget class="QMenu" name="menuActions">
<property name="title">
@ -448,9 +448,9 @@
<string>&amp;Cram...</string>
</property>
</action>
<action name="actionFont">
<action name="actionOptions">
<property name="text">
<string>Font...</string>
<string>Browser Options...</string>
</property>
</action>
<action name="actionSuspend">

149
designer/browseropts.ui Normal file
View file

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>288</width>
<height>195</height>
</rect>
</property>
<property name="windowTitle">
<string>Browser Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;b&gt;Font&lt;/b&gt;:</string>
</property>
</widget>
</item>
<item>
<widget class="QFontComboBox" name="fontCombo"/>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;b&gt;Font Size&lt;/b&gt;:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="fontSize">
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>&lt;b&gt;Line Size&lt;/b&gt;:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="lineSize"/>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="fullSearch">
<property name="text">
<string>Search within formatting (slow)</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>fontCombo</tabstop>
<tabstop>fontSize</tabstop>
<tabstop>lineSize</tabstop>
<tabstop>fullSearch</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -1,134 +0,0 @@
<ui version="4.0" >
<class>Dialog</class>
<widget class="QDialog" name="Dialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>205</width>
<height>139</height>
</rect>
</property>
<property name="windowTitle" >
<string>Browser Font</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>&lt;b>Font&lt;/b>:</string>
</property>
</widget>
</item>
<item>
<widget class="QFontComboBox" name="fontCombo" />
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>&lt;b>Font Size&lt;/b>:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QSpinBox" name="fontSize" >
<property name="minimumSize" >
<size>
<width>75</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>&lt;b>Line Size&lt;/b>:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QSpinBox" name="lineSize" />
</item>
<item row="0" column="2" >
<spacer name="horizontalSpacer_2" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>