summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Tietze <tietze.heiko@gmail.com>2020-10-23 13:30:17 +0200
committerHeiko Tietze <heiko.tietze@documentfoundation.org>2020-10-24 10:12:08 +0200
commit92ab0afa1c36bfbc99de25a53a108b6f28e0e627 (patch)
treeed4433c6202cadb40f0fe4fb4099794cd7cab76a
parent3c09c306a15e8c40deedb08d6bcf38b9ee190db4 (diff)
Show animated GIFs in TotD
marchingants.gif added as an example Change-Id: I555aebc4a4e191b8afb4be06dfc1e5f3e6d1a911 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104718 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
-rw-r--r--cui/inc/tipoftheday.hrc2
-rw-r--r--cui/source/dialogs/tipofthedaydlg.cxx28
-rw-r--r--cui/source/inc/tipofthedaydlg.hxx7
-rw-r--r--cui/uiconfig/ui/tipofthedaydialog.ui79
-rw-r--r--extras/source/tipoftheday/marchingants.gifbin0 -> 10298 bytes
-rw-r--r--vcl/Package_tipoftheday.mk1
6 files changed, 56 insertions, 61 deletions
diff --git a/cui/inc/tipoftheday.hrc b/cui/inc/tipoftheday.hrc
index e78d4aaa019d..0448f6dd87cc 100644
--- a/cui/inc/tipoftheday.hrc
+++ b/cui/inc/tipoftheday.hrc
@@ -133,7 +133,7 @@ const std::tuple<const char*, OUString, OUString> TIPOFTHEDAY_STRINGARRAY[] =
{ NC_("RID_CUI_TIPOFTHEDAY", "Date/time value is just a number of days since a chosen day zero; in the number, integer part represents date, and fractional part is time (elapsed part of a day), with 0.5 representing noon."), "", "tipoftheday_c.png"},
{ NC_("RID_CUI_TIPOFTHEDAY", "Shift+%MOD1+Del deletes from cursor to the end of the current sentence."), "", "tipoftheday_w.png"},
{ NC_("RID_CUI_TIPOFTHEDAY", "Use column or row labels in formulas. For example, if you have two columns, “Time” and “KM”, use =Time/KM to get minutes per kilometer."), "", "tipoftheday_c.png"},
- { NC_("RID_CUI_TIPOFTHEDAY", "Annoyed by the “marching ants” around cells in Calc? Press escape to stop them; the copied content will remain available for pasting."), "", "tipoftheday_c.png"},
+ { NC_("RID_CUI_TIPOFTHEDAY", "Annoyed by the “marching ants” around cells in Calc? Press escape to stop them; the copied content will remain available for pasting."), "", "marchingants.gif"},
{ NC_("RID_CUI_TIPOFTHEDAY", "Want to become a %PRODUCTNAME Ambassador? There are certifications for developers, admins, and trainers."), "http://www.documentfoundation.org/certification", ""},
{ NC_("RID_CUI_TIPOFTHEDAY", "Mix portrait and landscape orientations in a Calc spreadsheet by applying different page styles on sheets."), "", "tipoftheday_c.png"},
{ NC_("RID_CUI_TIPOFTHEDAY", "Click on the special character icon in the toolbar to get quick access to favorite and recent characters to insert."), "", ""},
diff --git a/cui/source/dialogs/tipofthedaydlg.cxx b/cui/source/dialogs/tipofthedaydlg.cxx
index beed468ba5b6..b88369890529 100644
--- a/cui/source/dialogs/tipofthedaydlg.cxx
+++ b/cui/source/dialogs/tipofthedaydlg.cxx
@@ -25,8 +25,6 @@
#include <vcl/commandinfoprovider.hxx>
#include <vcl/graphicfilter.hxx>
#include <vcl/help.hxx>
-#include <vcl/virdev.hxx>
-#include <vcl/svapp.hxx>
#include <com/sun/star/frame/XDesktop2.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
@@ -46,11 +44,11 @@
TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent)
: GenericDialogController(pParent, "cui/ui/tipofthedaydialog.ui", "TipOfTheDayDialog")
- , m_pImage(m_xBuilder->weld_image("imImage"))
, m_pText(m_xBuilder->weld_label("lbText"))
, m_pShowTip(m_xBuilder->weld_check_button("cbShowTip"))
, m_pNext(m_xBuilder->weld_button("btnNext"))
, m_pLink(m_xBuilder->weld_link_button("btnLink"))
+ , m_pPreview(new weld::CustomWeld(*m_xBuilder, "imPreview", m_aPreview))
{
m_pShowTip->set_active(officecfg::Office::Common::Misc::ShowTipOfTheDay::get());
m_pNext->connect_clicked(LINK(this, TipOfTheDayDialog, OnNextClick));
@@ -62,6 +60,8 @@ TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent)
if (m_nDay > officecfg::Office::Common::Misc::LastTipOfTheDayShown::get())
m_nCurrentTip++;
+ m_aPreview.init(&m_aGraphic, LINK(this, TipOfTheDayDialog, ImplModifyHdl));
+
UpdateTip();
}
@@ -172,20 +172,16 @@ void TipOfTheDayDialog::UpdateTip()
// image
OUString aURL("$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/tipoftheday/");
rtl::Bootstrap::expandMacros(aURL);
- OUString aImage = sImage;
+ OUString aImageName = sImage;
// use default image if none is available with the number
- if (aImage.isEmpty() || !file_exists(aURL + aImage))
- aImage = "tipoftheday.png";
- // draw image
- Graphic aGraphic;
- if (GraphicFilter::LoadGraphic(aURL + aImage, OUString(), aGraphic) == ERRCODE_NONE)
- {
- ScopedVclPtr<VirtualDevice> m_pVirDev = m_pImage->create_virtual_device();
- m_pVirDev->SetOutputSizePixel(aGraphic.GetSizePixel());
- m_pVirDev->DrawBitmapEx(Point(0, 0), aGraphic.GetBitmapEx());
- m_pImage->set_image(m_pVirDev.get());
- m_pVirDev.disposeAndClear();
- }
+ if (aImageName.isEmpty() || !file_exists(aURL + aImageName))
+ aImageName = "tipoftheday.png";
+ GraphicFilter::LoadGraphic(aURL + aImageName, OUString(), m_aGraphic);
+}
+
+IMPL_LINK_NOARG(TipOfTheDayDialog, ImplModifyHdl, LinkParamNone*, void)
+{
+ m_aPreview.SetPreview(m_aGraphic);
}
IMPL_LINK(TipOfTheDayDialog, OnLinkClick, weld::LinkButton&, rButton, bool)
diff --git a/cui/source/inc/tipofthedaydlg.hxx b/cui/source/inc/tipofthedaydlg.hxx
index bb417bb2705a..a63ac3cc44e5 100644
--- a/cui/source/inc/tipofthedaydlg.hxx
+++ b/cui/source/inc/tipofthedaydlg.hxx
@@ -19,21 +19,26 @@
#pragma once
#include <vcl/weld.hxx>
+#include "cuigrfflt.hxx"
class TipOfTheDayDialog : public weld::GenericDialogController
{
private:
- std::unique_ptr<weld::Image> m_pImage;
+ CuiGraphicPreviewWindow m_aPreview;
+
std::unique_ptr<weld::Label> m_pText;
std::unique_ptr<weld::CheckButton> m_pShowTip;
std::unique_ptr<weld::Button> m_pNext;
std::unique_ptr<weld::LinkButton> m_pLink;
+ std::unique_ptr<weld::CustomWeld> m_pPreview;
+ Graphic m_aGraphic;
sal_Int32 m_nCurrentTip;
sal_Int32 m_nDay;
void UpdateTip();
DECL_LINK(OnNextClick, weld::Button&, void);
DECL_LINK(OnLinkClick, weld::LinkButton&, bool);
+ DECL_LINK(ImplModifyHdl, LinkParamNone*, void);
public:
TipOfTheDayDialog(weld::Window* pWindow);
diff --git a/cui/uiconfig/ui/tipofthedaydialog.ui b/cui/uiconfig/ui/tipofthedaydialog.ui
index b223d86742cc..13e0452187c3 100644
--- a/cui/uiconfig/ui/tipofthedaydialog.ui
+++ b/cui/uiconfig/ui/tipofthedaydialog.ui
@@ -1,38 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
+<!-- Generated with glade 3.38.1 -->
<interface domain="cui">
<requires lib="gtk+" version="3.20"/>
<object class="GtkDialog" id="TipOfTheDayDialog">
- <property name="can_focus">False</property>
- <property name="border_width">6</property>
+ <property name="can-focus">False</property>
+ <property name="border-width">6</property>
<property name="title" translatable="yes" context="TipOfTheDayDialog|Name">Tip of the day</property>
<property name="resizable">False</property>
<property name="modal">True</property>
- <property name="window_position">center-on-parent</property>
- <property name="type_hint">dialog</property>
- <child>
- <placeholder/>
- </child>
+ <property name="window-position">center-on-parent</property>
+ <property name="type-hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="hexpand">True</property>
- <property name="layout_style">end</property>
+ <property name="layout-style">end</property>
<child>
<object class="GtkCheckButton" id="cbShowTip">
<property name="label" translatable="yes" context="TipOfTheDay|Checkbox">_Show tips on startup</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes" context="TipOfTheDay|Checkbox_Tooltip">Enable the dialog again at Tools &gt; Options &gt; General</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="tooltip-text" translatable="yes" context="TipOfTheDay|Checkbox_Tooltip">Enable the dialog again at Tools &gt; Options &gt; General</property>
+ <property name="use-underline">True</property>
<property name="active">True</property>
- <property name="draw_indicator">True</property>
+ <property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">True</property>
@@ -45,9 +42,9 @@
<object class="GtkButton" id="btnNext">
<property name="label" translatable="yes" context="TipOfTheDayDialog|Next_Button">_Next Tip</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
</object>
<packing>
<property name="expand">True</property>
@@ -59,13 +56,13 @@
<object class="GtkButton" id="btnOk">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_focus">True</property>
- <property name="is_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
+ <property name="can-focus">True</property>
+ <property name="has-focus">True</property>
+ <property name="is-focus">True</property>
+ <property name="can-default">True</property>
+ <property name="has-default">True</property>
+ <property name="receives-default">True</property>
+ <property name="use-stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -77,22 +74,18 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="pack_type">end</property>
+ <property name="pack-type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<child>
- <object class="GtkImage" id="imImage">
+ <object class="GtkDrawingArea" id="imPreview">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_left">12</property>
- <property name="margin_right">12</property>
- <property name="margin_top">12</property>
- <property name="margin_bottom">12</property>
+ <property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
@@ -103,14 +96,14 @@
<child>
<object class="GtkBox">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="lbTitle">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_top">12</property>
+ <property name="can-focus">False</property>
+ <property name="margin-top">12</property>
<property name="label" translatable="yes" context="TipOfTheDayDialog|Title">Did you know?</property>
<attributes>
<attribute name="weight" value="bold"/>
@@ -126,7 +119,7 @@
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
@@ -137,11 +130,11 @@
<child>
<object class="GtkLabel" id="lbText">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="vexpand">True</property>
<property name="wrap">True</property>
- <property name="width_chars">50</property>
- <property name="max_width_chars">50</property>
+ <property name="width-chars">50</property>
+ <property name="max-width-chars">50</property>
</object>
<packing>
<property name="expand">False</property>
@@ -152,8 +145,8 @@
<child>
<object class="GtkLinkButton" id="btnLink">
<property name="label" translatable="yes" context="TipOfTheDayDialog|Link_Button">Link</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
<property name="relief">none</property>
</object>
<packing>
diff --git a/extras/source/tipoftheday/marchingants.gif b/extras/source/tipoftheday/marchingants.gif
new file mode 100644
index 000000000000..0fcca2ebf4f0
--- /dev/null
+++ b/extras/source/tipoftheday/marchingants.gif
Binary files differ
diff --git a/vcl/Package_tipoftheday.mk b/vcl/Package_tipoftheday.mk
index ea81ee9668b3..3421c800a944 100644
--- a/vcl/Package_tipoftheday.mk
+++ b/vcl/Package_tipoftheday.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_Package_add_files_with_dir,tipoftheday_images,$(LIBO_SHARE_FOLD
tipoftheday_i.png \
tipoftheday_d.png \
toolbarmode.png \
+ marchingants.gif \
))
# vim: set noet sw=4 ts=4: