[Libreoffice-commits] core.git: cui/source
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Tue Oct 20 17:21:16 UTC 2020
cui/source/options/optgdlg.cxx | 70 ++++++++++++++++++-----------------------
cui/source/options/optgdlg.hxx | 2 -
2 files changed, 32 insertions(+), 40 deletions(-)
New commits:
commit 7d2bab41350d7006366b7c450879fe99209713ea
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Oct 16 12:55:08 2020 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Tue Oct 20 19:20:11 2020 +0200
clean up handling of the UI Skia options
Disable the sub-option when the main option is disabled.
Enable it for the proper VCL backends ("win" and "gen").
Change-Id: I38c2f605c10eb0f3cfae3f05cd4bada4877cdc2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104426
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 7301bd817144..535285b70d90 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -681,27 +681,11 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
, m_xMoreIcons(m_xBuilder->weld_button("btnMoreIcons"))
{
if (Application::GetToolkitName() == "gtk3")
- {
- m_xUseSkia->hide();
- m_xForceSkiaRaster->hide();
- m_xSkiaStatusEnabled->hide();
- m_xSkiaStatusDisabled->hide();
m_xMenuIconBox->hide();
- }
-
-#if !HAVE_FEATURE_SKIA || !defined(_WIN32)
- // Duplicated also in UpdateSkiaStatus().
- // For now Skia is used mainly on Windows, hide the controls everywhere else.
- // It can also be used on Linux, but only with the rarely used 'gen' backend.
- m_xUseSkia->hide();
- m_xForceSkiaRaster->hide();
- m_xSkiaStatusEnabled->hide();
- m_xSkiaStatusDisabled->hide();
-#endif
m_xFontAntiAliasing->connect_toggled( LINK( this, OfaViewTabPage, OnAntialiasingToggled ) );
- m_xForceSkiaRaster->connect_toggled(LINK(this, OfaViewTabPage, OnForceSkiaRasterToggled));
+ m_xUseSkia->connect_toggled(LINK(this, OfaViewTabPage, OnUseSkiaToggled));
// Set known icon themes
OUString sAutoStr( m_xIconStyleLB->get_text( 0 ) );
@@ -727,12 +711,6 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
m_xIconStyleLB->set_active(0);
- // FIXME: should really add code to show a 'lock' icon here.
- if (officecfg::Office::Common::VCL::UseSkia::isReadOnly())
- m_xUseSkia->set_sensitive(false);
- if (officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly())
- m_xForceSkiaRaster->set_sensitive(false);
-
m_xMoreIcons->set_from_icon_name("cmd/sc_additionsdialog.png");
m_xMoreIcons->connect_clicked(LINK(this, OfaViewTabPage, OnMoreIconsClick));
@@ -759,13 +737,39 @@ IMPL_LINK_NOARG( OfaViewTabPage, OnAntialiasingToggled, weld::ToggleButton&, voi
m_xAAPointLimit->set_sensitive(bAAEnabled);
}
-IMPL_LINK_NOARG(OfaViewTabPage, OnForceSkiaRasterToggled, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(OfaViewTabPage, OnUseSkiaToggled, weld::ToggleButton&, void)
{
- if (m_xForceSkiaRaster->get_active())
+ UpdateSkiaStatus();
+}
+
+void OfaViewTabPage::UpdateSkiaStatus()
+{
+ bool skiaHidden = true;
+#if HAVE_FEATURE_SKIA
+ // For now Skia is used mainly on Windows, enable the controls there.
+ if (Application::GetToolkitName() == "win")
+ skiaHidden = false;
+ // It can also be used on Linux, but only with the rarely used 'gen' backend.
+ if (Application::GetToolkitName() == "x11")
+ skiaHidden = false;
+#endif
+ if (skiaHidden)
{
- // Forcing Skia raster implies that Skia is on.
- m_xUseSkia->set_active(true);
+ m_xUseSkia->hide();
+ m_xForceSkiaRaster->hide();
+ m_xSkiaStatusEnabled->hide();
+ m_xSkiaStatusDisabled->hide();
+ return;
}
+
+ // Easier than a custom translation string.
+ bool bEnabled = SkiaHelper::isVCLSkiaEnabled();
+ m_xSkiaStatusEnabled->set_visible(bEnabled);
+ m_xSkiaStatusDisabled->set_visible(!bEnabled);
+
+ // FIXME: should really add code to show a 'lock' icon here.
+ m_xUseSkia->set_sensitive(!officecfg::Office::Common::VCL::UseSkia::isReadOnly());
+ m_xForceSkiaRaster->set_sensitive(m_xUseSkia->get_active() && !officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly());
}
std::unique_ptr<SfxTabPage> OfaViewTabPage::Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet )
@@ -1083,18 +1087,6 @@ void OfaViewTabPage::Reset( const SfxItemSet* )
OnAntialiasingToggled(*m_xFontAntiAliasing);
}
-void OfaViewTabPage::UpdateSkiaStatus()
-{
- if (Application::GetToolkitName() == "gtk3")
- return;
-#if HAVE_FEATURE_SKIA && defined(_WIN32)
- // Easier than a custom translation string.
- bool bEnabled = SkiaHelper::isVCLSkiaEnabled();
- m_xSkiaStatusEnabled->set_visible(bEnabled);
- m_xSkiaStatusDisabled->set_visible(!bEnabled);
-#endif
-}
-
struct LanguageConfig_Impl
{
SvtLanguageOptions aLanguageOptions;
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
index 90daae0c92f0..973260283aaf 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -121,7 +121,7 @@ private:
std::unique_ptr<weld::Button> m_xMoreIcons;
DECL_LINK(OnAntialiasingToggled, weld::ToggleButton&, void);
- DECL_LINK(OnForceSkiaRasterToggled, weld::ToggleButton&, void);
+ DECL_LINK(OnUseSkiaToggled, weld::ToggleButton&, void);
DECL_STATIC_LINK(OfaViewTabPage, OnMoreIconsClick, weld::Button&, void);
void UpdateSkiaStatus();
More information about the Libreoffice-commits
mailing list