mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 11:52:25 +00:00
GuiCharacter: Add "Reset" and "Restore Defaults" buttons
Addresses #11415
This commit is contained in:
parent
1b6ce0e827
commit
5f03889609
@ -34,6 +34,7 @@
|
|||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
|
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
|
#include <QPushButton>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
@ -251,6 +252,7 @@ GuiCharacter::GuiCharacter(GuiView & lv)
|
|||||||
bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
|
bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
|
||||||
bc().setApply(buttonBox->button(QDialogButtonBox::Apply));
|
bc().setApply(buttonBox->button(QDialogButtonBox::Apply));
|
||||||
bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
|
bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
|
||||||
|
bc().setRestore(buttonBox->button(QDialogButtonBox::Reset));
|
||||||
bc().setAutoApply(autoapplyCB);
|
bc().setAutoApply(autoapplyCB);
|
||||||
bc().addReadOnly(familyCO);
|
bc().addReadOnly(familyCO);
|
||||||
bc().addReadOnly(seriesCO);
|
bc().addReadOnly(seriesCO);
|
||||||
@ -307,19 +309,12 @@ void GuiCharacter::on_nospellcheckCB_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiCharacter::slotRestoreDefaults()
|
||||||
void GuiCharacter::change_adaptor()
|
|
||||||
{
|
{
|
||||||
changed();
|
Font font(inherit_font);
|
||||||
|
font.setLanguage(reset_language);
|
||||||
if (!autoapplyCB->isChecked())
|
paramsToDialog(font);
|
||||||
return;
|
change_adaptor();
|
||||||
|
|
||||||
// to be really good here, we should set the combos to the values of
|
|
||||||
// the current text, and make it appear as "no change" if the values
|
|
||||||
// stay the same between applys. Might be difficult though wrt to a
|
|
||||||
// moved cursor - jbl
|
|
||||||
slotApply();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -404,6 +399,41 @@ lyx::FontState setMarkupState(Qt::CheckState cs)
|
|||||||
} // end namespace anon
|
} // end namespace anon
|
||||||
|
|
||||||
|
|
||||||
|
void GuiCharacter::change_adaptor()
|
||||||
|
{
|
||||||
|
changed();
|
||||||
|
|
||||||
|
checkRestoreDefaults();
|
||||||
|
|
||||||
|
if (!autoapplyCB->isChecked())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// to be really good here, we should set the combos to the values of
|
||||||
|
// the current text, and make it appear as "no change" if the values
|
||||||
|
// stay the same between applys. Might be difficult though wrt to a
|
||||||
|
// moved cursor - jbl
|
||||||
|
slotApply();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiCharacter::checkRestoreDefaults()
|
||||||
|
{
|
||||||
|
// (De)Activate Restore Defaults button
|
||||||
|
buttonBox->button(QDialogButtonBox::RestoreDefaults)->setEnabled(
|
||||||
|
family[familyCO->currentIndex()].second != INHERIT_FAMILY
|
||||||
|
|| series[seriesCO->currentIndex()].second != INHERIT_SERIES
|
||||||
|
|| shape[shapeCO->currentIndex()].second != INHERIT_SHAPE
|
||||||
|
|| size[sizeCO->currentIndex()].second != FONT_SIZE_INHERIT
|
||||||
|
|| setMarkupState(emphCB->checkState()) != FONT_OFF
|
||||||
|
|| setMarkupState(nounCB->checkState()) != FONT_OFF
|
||||||
|
|| setMarkupState(nospellcheckCB->checkState()) != FONT_OFF
|
||||||
|
|| bar[ulineCO->currentIndex()].second != INHERIT
|
||||||
|
|| strike[strikeCO->currentIndex()].second != INHERIT
|
||||||
|
|| lcolor.getFromLyXName(fromqstr(colorCO->itemData(colorCO->currentIndex()).toString())) != Color_inherit
|
||||||
|
|| languages.getLanguage(fromqstr(language[langCO->currentIndex()].second)) != reset_language);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiCharacter::updateContents()
|
void GuiCharacter::updateContents()
|
||||||
{
|
{
|
||||||
if (bufferview()->cursor().selection()) {
|
if (bufferview()->cursor().selection()) {
|
||||||
@ -458,6 +488,8 @@ void GuiCharacter::updateContents()
|
|||||||
font_.setLanguage(reset_language);
|
font_.setLanguage(reset_language);
|
||||||
|
|
||||||
paramsToDialog(font_);
|
paramsToDialog(font_);
|
||||||
|
|
||||||
|
checkRestoreDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,6 +66,8 @@ protected Q_SLOTS:
|
|||||||
void on_emphCB_clicked();
|
void on_emphCB_clicked();
|
||||||
void on_nounCB_clicked();
|
void on_nounCB_clicked();
|
||||||
void on_nospellcheckCB_clicked();
|
void on_nospellcheckCB_clicked();
|
||||||
|
void slotRestoreDefaults();
|
||||||
|
void checkRestoreDefaults();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// \name Dialog inherited methods
|
/// \name Dialog inherited methods
|
||||||
|
@ -106,9 +106,11 @@ void GuiDialog::slotButtonBox(QAbstractButton * button)
|
|||||||
slotClose();
|
slotClose();
|
||||||
break;
|
break;
|
||||||
case QDialogButtonBox::Reset:
|
case QDialogButtonBox::Reset:
|
||||||
case QDialogButtonBox::RestoreDefaults:
|
|
||||||
slotRestore();
|
slotRestore();
|
||||||
break;
|
break;
|
||||||
|
case QDialogButtonBox::RestoreDefaults:
|
||||||
|
slotRestoreDefaults();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,8 @@ public Q_SLOTS:
|
|||||||
*/
|
*/
|
||||||
// Restore button clicked
|
// Restore button clicked
|
||||||
void slotRestore();
|
void slotRestore();
|
||||||
|
// Restore Defaults button clicked
|
||||||
|
virtual void slotRestoreDefaults() {}
|
||||||
// OK button clicked
|
// OK button clicked
|
||||||
void slotOK();
|
void slotOK();
|
||||||
// Apply button clicked
|
// Apply button clicked
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>523</width>
|
<width>545</width>
|
||||||
<height>372</height>
|
<height>428</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -17,58 +17,6 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_7">
|
<layout class="QGridLayout" name="gridLayout_7">
|
||||||
<item row="2" column="0" colspan="2">
|
|
||||||
<layout class="QHBoxLayout">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="autoapplyCB">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Apply each change automatically</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Apply changes &immediately</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
@ -369,6 +317,62 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
|
<layout class="QHBoxLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset|QDialogButtonBox::RestoreDefaults</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="autoapplyCB">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Apply each change automatically</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Apply changes &immediately</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
Loading…
Reference in New Issue
Block a user