[Libreoffice-commits] core.git: cui/source cui/uiconfig

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 30 15:20:44 UTC 2019


 cui/source/options/personalization.cxx |   51 ++++++++++++---------------------
 cui/source/options/personalization.hxx |   11 +++----
 cui/uiconfig/ui/personalization_tab.ui |    9 +++--
 3 files changed, 31 insertions(+), 40 deletions(-)

New commits:
commit af20b49acb34694febf2a3ba79207b25a70a68cd
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jul 30 15:02:05 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jul 30 17:19:14 2019 +0200

    weld SvxPersonalizationTabPage
    
    Change-Id: I5240fc4237d8b471b2c23a8bc776cffa46a53285
    Reviewed-on: https://gerrit.libreoffice.org/76607
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index e7c68fccb495..cdb6d805f525 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -44,45 +44,35 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::ucb;
 using namespace ::com::sun::star::beans;
 
-SvxPersonalizationTabPage::SvxPersonalizationTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
-    : SfxTabPage(pParent, "PersonalizationTabPage", "cui/ui/personalization_tab.ui", &rSet)
+// persona
+SvxPersonalizationTabPage::SvxPersonalizationTabPage(TabPageParent pParent, const SfxItemSet& rSet)
+    : SfxTabPage(pParent, "cui/ui/personalization_tab.ui", "PersonalizationTabPage", &rSet)
+    , m_xNoPersona(m_xBuilder->weld_radio_button("no_persona"))
+    , m_xDefaultPersona(m_xBuilder->weld_radio_button("default_persona"))
 {
-    // persona
-    get(m_pNoPersona, "no_persona");
-    get(m_pDefaultPersona, "default_persona");
-
     for (sal_uInt32 i = 0; i < MAX_DEFAULT_PERSONAS; ++i)
     {
-        OUString sDefaultId("default" + OUString::number(i));
-        get(m_vDefaultPersonaImages[i], OUStringToOString(sDefaultId, RTL_TEXTENCODING_UTF8));
-        m_vDefaultPersonaImages[i]->SetClickHdl(
+        OString sDefaultId("default" + OString::number(i));
+        m_vDefaultPersonaImages[i] = m_xBuilder->weld_button(sDefaultId);
+        m_vDefaultPersonaImages[i]->connect_clicked(
             LINK(this, SvxPersonalizationTabPage, DefaultPersona));
     }
 
     LoadDefaultImages();
 }
 
-SvxPersonalizationTabPage::~SvxPersonalizationTabPage() { disposeOnce(); }
-
-void SvxPersonalizationTabPage::dispose()
-{
-    m_pNoPersona.clear();
-    m_pDefaultPersona.clear();
-    for (VclPtr<PushButton>& i : m_vDefaultPersonaImages)
-        i.clear();
-    SfxTabPage::dispose();
-}
+SvxPersonalizationTabPage::~SvxPersonalizationTabPage() {}
 
 VclPtr<SfxTabPage> SvxPersonalizationTabPage::Create(TabPageParent pParent, const SfxItemSet* rSet)
 {
-    return VclPtr<SvxPersonalizationTabPage>::Create(pParent.pParent, *rSet);
+    return VclPtr<SvxPersonalizationTabPage>::Create(pParent, *rSet);
 }
 
 bool SvxPersonalizationTabPage::FillItemSet(SfxItemSet*)
 {
     // persona
     OUString aPersona("default");
-    if (m_pNoPersona->IsChecked())
+    if (m_xNoPersona->get_active())
         aPersona = "no";
 
     bool bModified = false;
@@ -128,9 +118,9 @@ void SvxPersonalizationTabPage::Reset(const SfxItemSet*)
     }
 
     if (aPersona == "no")
-        m_pNoPersona->Check();
+        m_xNoPersona->set_active(true);
     else
-        m_pDefaultPersona->Check();
+        m_xDefaultPersona->set_active(true);
 }
 
 void SvxPersonalizationTabPage::LoadDefaultImages()
@@ -164,22 +154,21 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
 
         INetURLObject aURLObj(gallery + aPreviewFile);
         aFilter.ImportGraphic(aGraphic, aURLObj);
-        BitmapEx aBmp = aGraphic.GetBitmapEx();
-        m_vDefaultPersonaImages[nIndex]->SetModeImage(Image(aBmp));
-        m_vDefaultPersonaImages[nIndex]->SetQuickHelpText(aName);
-        m_vDefaultPersonaImages[nIndex++]->Show();
+        m_vDefaultPersonaImages[nIndex]->set_image(aGraphic.GetXGraphic());
+        m_vDefaultPersonaImages[nIndex]->set_tooltip_text(aName);
+        m_vDefaultPersonaImages[nIndex++]->show();
         foundOne = true;
     }
 
-    m_pDefaultPersona->Enable(foundOne);
+    m_xDefaultPersona->set_sensitive(foundOne);
 }
 
-IMPL_LINK(SvxPersonalizationTabPage, DefaultPersona, Button*, pButton, void)
+IMPL_LINK(SvxPersonalizationTabPage, DefaultPersona, weld::Button&, rButton, void)
 {
-    m_pDefaultPersona->Check();
+    m_xDefaultPersona->set_active(true);
     for (sal_Int32 nIndex = 0; nIndex < MAX_DEFAULT_PERSONAS; ++nIndex)
     {
-        if (pButton == m_vDefaultPersonaImages[nIndex])
+        if (&rButton == m_vDefaultPersonaImages[nIndex].get())
             m_aPersonaSettings = m_vDefaultPersonaSettings[nIndex];
     }
 }
diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx
index 7930016f5d62..09fb7956003e 100644
--- a/cui/source/options/personalization.hxx
+++ b/cui/source/options/personalization.hxx
@@ -20,18 +20,17 @@ class SvxPersonalizationTabPage : public SfxTabPage
     using SfxTabPage::DeactivatePage;
 
 private:
-    VclPtr<RadioButton> m_pNoPersona; ///< Just the default look, without any bitmap
-    VclPtr<RadioButton> m_pDefaultPersona; ///< Use the built-in bitmap
-    VclPtr<PushButton> m_vDefaultPersonaImages
+    std::unique_ptr<weld::RadioButton> m_xNoPersona; ///< Just the default look, without any bitmap
+    std::unique_ptr<weld::RadioButton> m_xDefaultPersona; ///< Use the built-in bitmap
+    std::unique_ptr<weld::Button> m_vDefaultPersonaImages
         [MAX_DEFAULT_PERSONAS]; ///< Buttons to show the default persona images
     OUString m_aPersonaSettings; ///< Header and footer images + color to be set in the settings.
 
     std::vector<OUString> m_vDefaultPersonaSettings;
 
 public:
-    SvxPersonalizationTabPage(vcl::Window* pParent, const SfxItemSet& rSet);
+    SvxPersonalizationTabPage(TabPageParent pParent, const SfxItemSet& rSet);
     virtual ~SvxPersonalizationTabPage() override;
-    virtual void dispose() override;
 
     static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* rSet);
 
@@ -58,7 +57,7 @@ public:
 
 private:
     /// Handle the default Persona selection
-    DECL_LINK(DefaultPersona, Button*, void);
+    DECL_LINK(DefaultPersona, weld::Button&, void);
 };
 
 #endif // INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
diff --git a/cui/uiconfig/ui/personalization_tab.ui b/cui/uiconfig/ui/personalization_tab.ui
index de2e74ee99f1..448cbf894634 100644
--- a/cui/uiconfig/ui/personalization_tab.ui
+++ b/cui/uiconfig/ui/personalization_tab.ui
@@ -2,10 +2,11 @@
 <!-- Generated with glade 3.22.1 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.18"/>
-  <object class="GtkVBox" id="PersonalizationTabPage">
+  <object class="GtkBox" id="PersonalizationTabPage">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
+    <property name="orientation">vertical</property>
     <property name="spacing">12</property>
     <child>
       <object class="GtkFrame" id="frame2">
@@ -22,9 +23,10 @@
             <property name="left_padding">12</property>
             <property name="right_padding">6</property>
             <child>
-              <object class="GtkVBox" id="vbox2">
+              <object class="GtkBox" id="vbox2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
                 <property name="spacing">12</property>
                 <child>
                   <object class="GtkRadioButton" id="no_persona">
@@ -34,8 +36,8 @@
                     <property name="receives_default">False</property>
                     <property name="use_underline">True</property>
                     <property name="xalign">0</property>
+                    <property name="active">True</property>
                     <property name="draw_indicator">True</property>
-                    <property name="group">default_persona</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -52,6 +54,7 @@
                     <property name="use_underline">True</property>
                     <property name="xalign">0</property>
                     <property name="draw_indicator">True</property>
+                    <property name="group">no_persona</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>


More information about the Libreoffice-commits mailing list