From 1bd9747a126a3e82b6093c2b4af3b3a74774a3e9 Mon Sep 17 00:00:00 2001 From: Heiko Tietze Date: Wed, 22 May 2024 13:18:27 +0200 Subject: tdf#161209 - Reverts WhatsNew/Welcome dialog dd889b290304b73f96a9a8e6e0f144d3aa2ba7e1 Change-Id: Idf0594c546e4d9ca263272ed1534b27948e8e930 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167956 Reviewed-by: Heiko Tietze Tested-by: Jenkins --- cui/Library_cui.mk | 1 - cui/UIConfig_cui.mk | 1 - cui/inc/whatsnew.hrc | 42 ---------- cui/source/dialogs/whatsnew.cxx | 172 -------------------------------------- cui/source/factory/dlgfact.cxx | 14 ---- cui/source/factory/dlgfact.hxx | 2 - cui/source/inc/whatsnew.hxx | 79 ----------------- cui/uiconfig/ui/whatsnewdialog.ui | 131 ----------------------------- 8 files changed, 442 deletions(-) delete mode 100644 cui/inc/whatsnew.hrc delete mode 100644 cui/source/dialogs/whatsnew.cxx delete mode 100644 cui/source/inc/whatsnew.hxx delete mode 100644 cui/uiconfig/ui/whatsnewdialog.ui (limited to 'cui') diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index 3ee744e32d0f..e01e33ecb4ec 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -114,7 +114,6 @@ $(eval $(call gb_Library_add_exception_objects,cui,\ cui/source/customize/SvxNotebookbarConfigPage \ cui/source/customize/CustomNotebookbarGenerator \ cui/source/dialogs/about \ - cui/source/dialogs/whatsnew \ $(call gb_Helper_optional,EXTENSIONS, \ cui/source/dialogs/AdditionsDialog) \ cui/source/dialogs/colorpicker \ diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk index 79ff7696a93a..10acd83c8c39 100644 --- a/cui/UIConfig_cui.mk +++ b/cui/UIConfig_cui.mk @@ -18,7 +18,6 @@ endif ifneq ($(ENABLE_WASM_STRIP_PINGUSER),TRUE) $(eval $(call gb_UIConfig_add_uifiles,cui,\ cui/uiconfig/ui/tipofthedaydialog \ - cui/uiconfig/ui/whatsnewdialog \ )) endif diff --git a/cui/inc/whatsnew.hrc b/cui/inc/whatsnew.hrc deleted file mode 100644 index e155a597bcf2..000000000000 --- a/cui/inc/whatsnew.hrc +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#pragma once - -#define NC_(Context, String) TranslateId(Context, u8##String) - -#include -#include -#include -#include - -/* - * std:tuple consists of - * image: - * place new images at extra/source/whatsnew - * do not forget to add the files to vcl/Package_whatsnew.mk - * images are cut-off at 600x400px -*/ - -const std::tuple WELCOME_STRINGARRAY[] = -{ - { NC_("RID_CUI_WHATSNEW", "%PRODUCTNAME is a powerful and free office suite, used by millions of people around the world."), "LibreOffice.gif"}, - { NC_("RID_CUI_WHATSNEW", "%PRODUCTNAME uses the reliable and trustworthy standard open document format."), "ODF.png"}, - { NC_("RID_CUI_WHATSNEW", "%PRODUCTNAME blends into every operation system and provides full customization."), "Configurability.png"}, - { NC_("RID_CUI_WHATSNEW", "%PRODUCTNAME is open source: Your project, your data, your freedom."), "Community.png"}, -}; - -const std::tuple WHATSNEW_STRINGARRAY[] = -{ - { NC_("RID_CUI_WHATSNEW", "Version 24.8 brings a shiny WhatsNew dialog :-)"), "whatsnew1.png"}, -}; - -#define STR_WELCOME NC_("STR_WELCOME", "Welcome to %PRODUCTNAME!") - -/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ \ No newline at end of file diff --git a/cui/source/dialogs/whatsnew.cxx b/cui/source/dialogs/whatsnew.cxx deleted file mode 100644 index 5136c62f33ca..000000000000 --- a/cui/source/dialogs/whatsnew.cxx +++ /dev/null @@ -1,172 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include -#include - -#include -#include -#include -#include -#include -#include - -constexpr tools::Long TEXT_HEIGHT(120); -constexpr tools::Long PROGRESS_DOTSIZE(24); -constexpr tools::Long PROGRESS_DOTSPACING(4); - -WhatsNewDialog::WhatsNewDialog(weld::Window* pParent, const bool bWelcome) - : GenericDialogController(pParent, u"cui/ui/whatsnewdialog.ui"_ustr, u"WhatsNewDialog"_ustr) - , m_bWelcome(bWelcome) - , m_aPreview() - , m_aProgress() - , m_pPrevBtn(m_xBuilder->weld_button(u"btnPrev"_ustr)) - , m_pNextBtn(m_xBuilder->weld_button(u"btnNext"_ustr)) - , m_pProgress(new weld::CustomWeld(*m_xBuilder, u"imProgress"_ustr, m_aProgress)) - , m_pImage(new weld::CustomWeld(*m_xBuilder, u"imNews"_ustr, m_aPreview)) -{ - if (m_bWelcome) - m_xDialog->set_title(CuiResId(STR_WELCOME)); - m_pPrevBtn->set_sensitive(false); - - m_pPrevBtn->connect_clicked(LINK(this, WhatsNewDialog, OnPrevClick)); - m_pNextBtn->connect_clicked(LINK(this, WhatsNewDialog, OnNextClick)); - - m_nNumberOfNews = m_bWelcome ? std::size(WELCOME_STRINGARRAY) : std::size(WHATSNEW_STRINGARRAY); - m_nCurrentNews = 0; - m_pNextBtn->set_sensitive(m_nNumberOfNews > 1); - m_pProgress->set_size_request(m_nNumberOfNews * (PROGRESS_DOTSIZE + PROGRESS_DOTSPACING), - PROGRESS_DOTSIZE + 1); - - LoadImage(); -} - -WhatsNewDialog::~WhatsNewDialog() {} - -void WhatsNewDialog::LoadImage() -{ - if (m_nCurrentNews < m_nNumberOfNews) - { - auto[sText, sImage] = m_bWelcome ? WELCOME_STRINGARRAY[m_nCurrentNews] - : WHATSNEW_STRINGARRAY[m_nCurrentNews]; - OUString aURL(u"$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/whatsnew/"_ustr); - rtl::Bootstrap::expandMacros(aURL); - - const bool bFileExists = comphelper::DirectoryHelper::fileExists(aURL + sImage); - if (!sImage.isEmpty() && bFileExists) - m_aPreview.Update(aURL + sImage, CuiResId(sText)); - - m_aProgress.Update(m_nCurrentNews, m_nNumberOfNews); - } -} - -IMPL_LINK_NOARG(WhatsNewDialog, OnPrevClick, weld::Button&, void) -{ - m_nCurrentNews--; - if (m_nCurrentNews == 0) - m_pPrevBtn->set_sensitive(false); - m_pNextBtn->set_sensitive(true); - LoadImage(); -} - -IMPL_LINK_NOARG(WhatsNewDialog, OnNextClick, weld::Button&, void) -{ - m_nCurrentNews++; - if (m_nCurrentNews == m_nNumberOfNews - 1) - m_pNextBtn->set_sensitive(false); - m_pPrevBtn->set_sensitive(true); - LoadImage(); -} - -void WhatsNewImg::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) -{ - const StyleSettings rSettings(Application::GetSettings().GetStyleSettings()); - - //clear - rRenderContext.SetBackground(Wallpaper(rSettings.GetDialogColor())); - rRenderContext.Erase(); - - //background image - Graphic aGraphic; - GraphicFilter::LoadGraphic(m_sImage, OUString(), aGraphic); - const Size aGraphicSize(aGraphic.GetSizePixel()); - - if (aGraphic.IsAnimated()) - aGraphic.StartAnimation(rRenderContext, Point(), aGraphicSize); - else - aGraphic.Draw(rRenderContext, Point(), aGraphicSize); - - tools::Rectangle aRect(Point(0, aGraphicSize.Height() - TEXT_HEIGHT), - Size(aGraphicSize.Width(), TEXT_HEIGHT)); - - //transparent text background - ScopedVclPtrInstance aVDev; - GDIMetaFile aMetafile; - - aMetafile.Record(aVDev.get()); - aMetafile.SetPrefSize(aRect.GetSize()); - aVDev->SetOutputSize(aRect.GetSize()); - aVDev->SetBackground(Color(0x10, 0x68, 0x02)); - aVDev->Erase(); - aMetafile.Stop(); - - Gradient aVCLGradient; - aVCLGradient.SetStyle(css::awt::GradientStyle_LINEAR); - aVCLGradient.SetStartColor(COL_GRAY); - aVCLGradient.SetEndColor(COL_GRAY); - aVCLGradient.SetStartIntensity(33); - aVCLGradient.SetEndIntensity(66); - - rRenderContext.DrawTransparent(aMetafile, aRect.TopLeft(), aRect.GetSize(), aVCLGradient); - - //text - vcl::Font aFont = rRenderContext.GetFont(); - const Size aFontSize = aFont.GetFontSize(); - aFont.SetFontSize(Size(0, 24)); - aFont.SetColor(COL_WHITE); - aFont.SetWeight(WEIGHT_BOLD); - rRenderContext.SetFont(aFont); - - DrawTextFlags nDrawTextStyle(DrawTextFlags::MultiLine | DrawTextFlags::WordBreak - | DrawTextFlags::EndEllipsis); - const bool bIsRTL = rRenderContext.GetTextIsRTL(m_sText, 0, m_sText.getLength()); - if (bIsRTL) - nDrawTextStyle |= DrawTextFlags::Right; - - aRect.shrink(6); - aRect.setWidth(rRenderContext.GetOutputSizePixel().Width() - 12); - rRenderContext.DrawText(aRect, m_sText, nDrawTextStyle); - - aFont.SetFontSize(aFontSize); - aFont.SetWeight(WEIGHT_NORMAL); - rRenderContext.SetFont(aFont); -} - -void WhatsNewProgress::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) -{ - const StyleSettings rSettings(Application::GetSettings().GetStyleSettings()); - rRenderContext.SetBackground(rSettings.GetDialogColor()); - rRenderContext.Erase(); - rRenderContext.SetAntialiasing(AntialiasingFlags::Enable); - - tools::Rectangle aRect(Point(1, 1), Size(PROGRESS_DOTSIZE, PROGRESS_DOTSIZE)); - for (sal_Int32 i = 0; i < m_nTotal; i++) - { - if (i == m_nCurrent) - rRenderContext.SetFillColor(rSettings.GetAccentColor()); - else - rRenderContext.SetFillColor(COL_WHITE); - rRenderContext.DrawEllipse(aRect); - - aRect.AdjustLeft(PROGRESS_DOTSIZE + PROGRESS_DOTSPACING); - aRect.AdjustRight(PROGRESS_DOTSIZE + PROGRESS_DOTSPACING); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ \ No newline at end of file diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index afd9f41b1616..e3556334e6a3 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -24,7 +24,6 @@ #include "dlgfact.hxx" #include -#include #include #include #include @@ -1532,19 +1531,6 @@ AbstractDialogFactory_Impl::CreateAboutDialog(weld::Window* pParent) std::make_shared(pParent)); } -VclPtr -AbstractDialogFactory_Impl::CreateWhatsNewDialog(weld::Window* pParent, const bool bWelcome) -{ -#if !ENABLE_WASM_STRIP_PINGUSER - return VclPtr::Create( - std::make_shared(pParent, bWelcome)); -#else - (void) pParent; - (void) bWelcome; - return nullptr; -#endif -} - VclPtr AbstractDialogFactory_Impl::CreateTipOfTheDayDialog(weld::Window* pParent) { diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index a10837f6cd48..ca11ec7427dc 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -619,8 +619,6 @@ public: virtual VclPtr CreateAboutDialog(weld::Window* pParent) override; - virtual VclPtr CreateWhatsNewDialog(weld::Window* pParent, const bool bWelcome) override; - virtual VclPtr CreateTipOfTheDayDialog(weld::Window* pParent) override; virtual VclPtr CreateWidgetTestDialog(weld::Window* pParent) override; diff --git a/cui/source/inc/whatsnew.hxx b/cui/source/inc/whatsnew.hxx deleted file mode 100644 index 979fff919df2..000000000000 --- a/cui/source/inc/whatsnew.hxx +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#pragma once - -#include -#include -#include "cuigrfflt.hxx" - -class WhatsNewImg : public weld::CustomWidgetController -{ - OUString m_sImage; - OUString m_sText; - virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; - -public: - WhatsNewImg() {} - void Update(const OUString& sImage, const OUString& sText) - { - m_sImage = sImage; - m_sText = sText; - SetAccessibleName(m_sText); - Invalidate(); - } -}; - -class WhatsNewProgress : public weld::CustomWidgetController -{ - sal_Int32 m_nTotal; - sal_Int32 m_nCurrent; - virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; - -public: - WhatsNewProgress() - : m_nTotal(0) - , m_nCurrent(0) - { - } - void Update(const sal_Int32 nCurrent, const sal_Int32 nTotal) - { - m_nTotal = nTotal; - m_nCurrent = nCurrent; - Invalidate(); - } -}; - -class WhatsNewDialog : public weld::GenericDialogController -{ -private: - const bool m_bWelcome; - - WhatsNewImg m_aPreview; - WhatsNewProgress m_aProgress; - - std::unique_ptr m_pPrevBtn; - std::unique_ptr m_pNextBtn; - std::unique_ptr m_pProgress; - std::unique_ptr m_pImage; - - DECL_LINK(OnPrevClick, weld::Button&, void); - DECL_LINK(OnNextClick, weld::Button&, void); - - void LoadImage(); // loads WHATSNEW_STRINGARRAY[m_nCurrentNews] - - sal_Int32 m_nNumberOfNews; - sal_Int32 m_nCurrentNews; - -public: - WhatsNewDialog(weld::Window* pParent, const bool bWelcome); - virtual ~WhatsNewDialog() override; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/cui/uiconfig/ui/whatsnewdialog.ui b/cui/uiconfig/ui/whatsnewdialog.ui deleted file mode 100644 index 0a4949c398bf..000000000000 --- a/cui/uiconfig/ui/whatsnewdialog.ui +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - False - 6 - What's new in %PRODUCTVERSION - False - True - center-on-parent - dialog - - - False - vertical - 12 - - - False - 12 - True - end - - - _Close - True - True - True - True - - - True - True - end - 3 - - - - - False - True - end - 0 - - - - - - True - False - - - 600 - 400 - True - False - - - Picture illustrating what is new - - - - - 0 - 0 - 3 - - - - - Previous - True - True - True - end - center - True - - - 0 - 1 - - - - - Next - True - True - True - start - center - True - right - - - 2 - 1 - - - - - True - False - center - center - - - Progress of news - - - - - 1 - 1 - - - - - False - True - 1 - - - - - - btnClose - - - -- cgit