21 #include <QFontDialog>
23 #include <QHBoxLayout>
26 #include <QNonConstOverload>
29 #include <QVBoxLayout>
31 #include "../../backend/config/btconfig.h"
32 #include "../../backend/language.h"
33 #include "../../backend/managers/cswordbackend.h"
34 #include "../../util/btassert.h"
35 #include "../../util/btconnect.h"
36 #include "../../util/cresmgr.h"
51 QHBoxLayout *hLayout =
new QHBoxLayout;
52 hLayout->setContentsMargins(0, 0, 0, 0);
58 bool operator()(std::shared_ptr<Language const>
const & lhs,
59 std::shared_ptr<Language const>
const & rhs)
const
61 int cmp = lhs->translatedName().compare(rhs->translatedName());
63 cmp = lhs->abbrev().compare(rhs->abbrev());
69 std::set<std::shared_ptr<Language const>, Comp> languages;
71 auto const availableLanguages =
74 for (
auto const & language : *availableLanguages)
75 languages.emplace(language);
78 for (
auto const & l : languages) {
81 auto const & k = l->translatedName().isEmpty()
83 : l->translatedName();
95 | QFontDialog::DontUseNativeDialog);
104 [
this](QFont
const & newFont) {
107 work.settings.second = newFont;
110 qOverload<int>(&QComboBox::currentIndexChanged),
111 [
this](
int const newIndex) {
112 auto const i =
static_cast<std::size_t
>(newIndex);
128 QVBoxLayout *fLayout =
new QVBoxLayout;
129 fLayout->setContentsMargins(0, 0, 0, 0);
130 fLayout->addLayout(hLayout);
137 QVBoxLayout *mainLayout =
new QVBoxLayout(
this);
153 ? CResMgr::settings::fonts::icon()
160 m_languageComboBox->setToolTip(tr(
"The font selection below will apply to all texts in this language"));
BtConfig & btConfig()
This is a shortchand for BtConfig::getInstance().
void setHeaderText(QString const &headerText)
void setFontForLanguage(Language const &language, FontSettingsPair const &fontSettings)
Set font for a language.
FontSettingsPair getFontForLanguage(Language const &language)
Get font for a language.
BtFontSettingsPage(CConfigurationDialog *parent=nullptr)
QGroupBox * m_fontsGroupBox
std::vector< WorkSetting > m_workSettings
void useOwnFontClicked(bool)
QComboBox * m_languageComboBox
QCheckBox * m_languageCheckBox
QFontDialog * m_fontChooser
void save() const final override
std::shared_ptr< AvailableLanguagesCacheContainer const > availableLanguages() noexcept
static CSwordBackend & instance() noexcept