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

Heiko Tietze (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 10 09:26:59 UTC 2021


 cui/source/dialogs/tipofthedaydlg.cxx |   12 +++++++++++-
 cui/uiconfig/ui/tipofthedaydialog.ui  |    4 +++-
 2 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 7abfb02bda53ed71cdca335fa99490992fa7092b
Author:     Heiko Tietze <tietze.heiko at gmail.com>
AuthorDate: Mon Mar 8 08:47:21 2021 +0100
Commit:     Heiko Tietze <heiko.tietze at documentfoundation.org>
CommitDate: Wed Mar 10 10:26:14 2021 +0100

    tdf#140839 - Scale TotD image
    
    Fix preview size of 100x120px
    Margin added
    
    Change-Id: If1caad336f2c3ce492aa9551a170b9b20a9b8b50
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112152
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <heiko.tietze at documentfoundation.org>

diff --git a/cui/source/dialogs/tipofthedaydlg.cxx b/cui/source/dialogs/tipofthedaydlg.cxx
index 2404052271e6..478780578b56 100644
--- a/cui/source/dialogs/tipofthedaydlg.cxx
+++ b/cui/source/dialogs/tipofthedaydlg.cxx
@@ -42,6 +42,9 @@
 #include <unotools/configmgr.hxx>
 #include <com/sun/star/beans/PropertyValue.hpp>
 
+//size of preview
+const Size ThumbSize(100, 120);
+
 TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent)
     : GenericDialogController(pParent, "cui/ui/tipofthedaydialog.ui", "TipOfTheDayDialog")
     , m_pText(m_xBuilder->weld_label("lbText"))
@@ -52,8 +55,8 @@ TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent)
 {
     m_pShowTip->set_active(officecfg::Office::Common::Misc::ShowTipOfTheDay::get());
     m_pNext->connect_clicked(LINK(this, TipOfTheDayDialog, OnNextClick));
-
     m_nCurrentTip = officecfg::Office::Common::Misc::LastTipOfTheDayID::get();
+    m_pPreview->set_size_request(ThumbSize.Width(), ThumbSize.Height());
 
     const auto t0 = std::chrono::system_clock::now().time_since_epoch();
     m_nDay = std::chrono::duration_cast<std::chrono::hours>(t0).count() / 24;
@@ -176,6 +179,13 @@ void TipOfTheDayDialog::UpdateTip()
         aImageName = "tipoftheday.png";
     Graphic aGraphic;
     GraphicFilter::LoadGraphic(aURL + aImageName, OUString(), aGraphic);
+
+    if (!aGraphic.IsAnimated())
+    {
+        BitmapEx aBmpEx(aGraphic.GetBitmapEx());
+        if (aBmpEx.Scale(ThumbSize))
+            aGraphic = aBmpEx;
+    }
     m_aPreview.SetPreview(aGraphic);
 }
 
diff --git a/cui/uiconfig/ui/tipofthedaydialog.ui b/cui/uiconfig/ui/tipofthedaydialog.ui
index 4ee6522558b2..e05738d8466a 100644
--- a/cui/uiconfig/ui/tipofthedaydialog.ui
+++ b/cui/uiconfig/ui/tipofthedaydialog.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.1 -->
+<!-- Generated with glade 3.38.2 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkDialog" id="TipOfTheDayDialog">
@@ -86,6 +86,8 @@
               <object class="GtkDrawingArea" id="imPreview">
                 <property name="visible">True</property>
                 <property name="can-focus">False</property>
+                <property name="margin-start">6</property>
+                <property name="margin-end">12</property>
               </object>
               <packing>
                 <property name="expand">False</property>


More information about the Libreoffice-commits mailing list