[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - cui/source

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 1 12:08:58 UTC 2020


 cui/source/options/optgdlg.cxx |  101 +++--------------------------------------
 cui/source/options/optgdlg.hxx |    5 --
 2 files changed, 8 insertions(+), 98 deletions(-)

New commits:
commit 33e1a54ea845f263fa417d5fda4baee26c1cc519
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Nov 30 16:40:57 2020 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Tue Dec 1 13:08:27 2020 +0100

    drop the needless and broken SkiaConfig abstraction (tdf#137935)
    
    I originally copy&pasted this from the OpenGL setting, but this appears
    to be just an unnecessary complication. Both the option and writing
    is in fact simple, and trying to make it abstract and complicated
    doesn't provide much, and it causes the options not saved if only
    'Apply' is used in the config dialog.
    
    Change-Id: Ibd55052467988b54429358567d70cbfbb0a34653
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106900
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    (cherry picked from commit 414930465e86e898a2493f61e4832f9a841ebe00)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106940

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 0dc33f2c64ba..07435990a234 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -101,90 +101,6 @@ using namespace ::com::sun::star::container;
 using namespace ::com::sun::star::util;
 using namespace ::utl;
 
-namespace svt {
-
-class SkiaCfg
-{
-private:
-    bool mbUseSkia;
-    bool mbForceSkiaRaster;
-    bool mbModified;
-
-public:
-    SkiaCfg();
-    ~SkiaCfg();
-
-    bool useSkia() const;
-    bool forceSkiaRaster() const;
-
-    void setUseSkia(bool bSkia);
-    void setForceSkiaRaster(bool bSkia);
-
-    void reset();
-};
-
-SkiaCfg::SkiaCfg():
-    mbModified(false)
-{
-    reset();
-}
-
-void SkiaCfg::reset()
-{
-    mbUseSkia = officecfg::Office::Common::VCL::UseSkia::get();
-    mbForceSkiaRaster = officecfg::Office::Common::VCL::ForceSkiaRaster::get();
-    mbModified = false;
-}
-
-SkiaCfg::~SkiaCfg()
-{
-    if (!mbModified)
-        return;
-
-    try
-    {
-        std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
-        if (!officecfg::Office::Common::VCL::UseSkia::isReadOnly())
-            officecfg::Office::Common::VCL::UseSkia::set(mbUseSkia, batch);
-        if (!officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly())
-            officecfg::Office::Common::VCL::ForceSkiaRaster::set(mbForceSkiaRaster, batch);
-        batch->commit();
-    }
-    catch (...)
-    {
-    }
-}
-
-bool SkiaCfg::useSkia() const
-{
-    return mbUseSkia;
-}
-
-bool SkiaCfg::forceSkiaRaster() const
-{
-    return mbForceSkiaRaster;
-}
-
-void SkiaCfg::setUseSkia(bool bSkia)
-{
-    if (bSkia != mbUseSkia)
-    {
-        mbUseSkia = bSkia;
-        mbModified = true;
-    }
-}
-
-void SkiaCfg::setForceSkiaRaster(bool bSkia)
-{
-    if (mbForceSkiaRaster != bSkia)
-    {
-        mbForceSkiaRaster = bSkia;
-        mbModified = true;
-    }
-}
-
-}
-
 // class OfaMiscTabPage --------------------------------------------------
 
 DeactivateRC OfaMiscTabPage::DeactivatePage( SfxItemSet* pSet_ )
@@ -656,7 +572,6 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
     , pAppearanceCfg(new SvtTabAppearanceCfg)
     , pCanvasSettings(new CanvasSettings)
     , mpDrawinglayerOpt(new SvtOptionsDrawinglayer)
-    , mpSkiaConfig(new svt::SkiaCfg)
     , m_xIconSizeLB(m_xBuilder->weld_combo_box("iconsize"))
     , m_xSidebarIconSizeLB(m_xBuilder->weld_combo_box("sidebariconsize"))
     , m_xNotebookbarIconSizeLB(m_xBuilder->weld_combo_box("notebookbariconsize"))
@@ -941,8 +856,10 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
     if (m_xUseSkia->get_state_changed_from_saved() ||
         m_xForceSkiaRaster->get_state_changed_from_saved())
     {
-        mpSkiaConfig->setUseSkia(m_xUseSkia->get_active());
-        mpSkiaConfig->setForceSkiaRaster(m_xForceSkiaRaster->get_active());
+        std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
+        officecfg::Office::Common::VCL::UseSkia::set(m_xUseSkia->get_active(), batch);
+        officecfg::Office::Common::VCL::ForceSkiaRaster::set(m_xForceSkiaRaster->get_active(), batch);
+        batch->commit();
         bModified = true;
     }
 
@@ -989,7 +906,6 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
 void OfaViewTabPage::Reset( const SfxItemSet* )
 {
     SvtMiscOptions aMiscOptions;
-    mpSkiaConfig->reset();
 
     if (aMiscOptions.GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO)
     {
@@ -1072,16 +988,15 @@ void OfaViewTabPage::Reset( const SfxItemSet* )
         m_xUseAntiAliase->save_state();
     }
 
-    m_xUseSkia->set_active(mpSkiaConfig->useSkia());
-    m_xForceSkiaRaster->set_active(mpSkiaConfig->forceSkiaRaster());
+    m_xUseSkia->set_active(officecfg::Office::Common::VCL::UseSkia::get());
+    m_xForceSkiaRaster->set_active(officecfg::Office::Common::VCL::ForceSkiaRaster::get());
+    m_xUseSkia->save_state();
+    m_xForceSkiaRaster->save_state();
 
     m_xFontAntiAliasing->save_state();
     m_xAAPointLimit->save_value();
     m_xFontShowCB->save_state();
 
-    m_xUseSkia->save_state();
-    m_xForceSkiaRaster->save_state();
-
     OnAntialiasingToggled(*m_xFontAntiAliasing);
     UpdateSkiaStatus();
 }
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
index 0944bb674932..07d3cca86fb7 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -28,10 +28,6 @@ namespace vcl {
     class IconThemeInfo;
 }
 
-namespace svt {
-    class SkiaCfg;
-}
-
 class OfaMiscTabPage : public SfxTabPage
 {
 private:
@@ -88,7 +84,6 @@ private:
     std::unique_ptr<SvtTabAppearanceCfg>    pAppearanceCfg;
     std::unique_ptr<CanvasSettings>         pCanvasSettings;
     std::unique_ptr<SvtOptionsDrawinglayer> mpDrawinglayerOpt;
-    std::unique_ptr<svt::SkiaCfg> mpSkiaConfig;
 
     std::vector<vcl::IconThemeInfo> mInstalledIconThemes;
 


More information about the Libreoffice-commits mailing list