diff options
author | Heiko Tietze <tietze.heiko@gmail.com> | 2020-04-08 12:58:34 +0200 |
---|---|---|
committer | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2020-04-15 17:35:44 +0200 |
commit | 9b1c9ac6edcdeae431d6104c586ca7feffbb6483 (patch) | |
tree | 395bddaa18a31abfbc8a86277028b0d6087eb130 /cui | |
parent | 0db34d1c5dd7d06435c5a5d58a42da2cbe007006 (diff) |
Related tdf#130778: New About dialog
More flexible dialog
logo & about images as SVGs
Change-Id: Icefa035893e241a7dee6aa28236e6b89b38477de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91908
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/inc/strings.hrc | 3 | ||||
-rw-r--r-- | cui/source/dialogs/about.cxx | 446 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 19 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 19 | ||||
-rw-r--r-- | cui/source/inc/about.hxx | 28 | ||||
-rw-r--r-- | cui/uiconfig/ui/aboutdialog.ui | 205 |
6 files changed, 403 insertions, 317 deletions
diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc index 70b06199e700..9c81a8e104f9 100644 --- a/cui/inc/strings.hrc +++ b/cui/inc/strings.hrc @@ -390,9 +390,6 @@ #define RID_SVXSTR_ABOUT_DERIVED NC_("aboutdialog|derived", "%PRODUCTNAME is derived from LibreOffice which was based on OpenOffice.org") #define RID_SVXSTR_ABOUT_LOCALE NC_("aboutdialog|locale", "Locale: $LOCALE") #define RID_SVXSTR_ABOUT_UILOCALE NC_("aboutdialog|uilocale", "UI-Language: $LOCALE") -#define RID_SVXSTR_ABOUT_RELEASE_NOTES NC_("aboutdialog|releasenotes", "~Release Notes") -#define RID_SVXSTR_ABOUT_WEBSITE NC_("aboutdialog|website", "~Website") -#define RID_SVXSTR_ABOUT_CREDITS NC_("aboutdialog|credits", "Cre~dits") #define RID_SVXSTR_EDIT_PATHS NC_("optpathspage|editpaths", "Edit Paths: %1") diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx index 625adf9f9a7c..ec5d6b98930b 100644 --- a/cui/source/dialogs/about.cxx +++ b/cui/source/dialogs/about.cxx @@ -17,324 +17,228 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <config_feature_opencl.h> -#include <osl/process.h> -#include <sal/log.hxx> -#include <osl/diagnose.h> -#include <rtl/character.hxx> -#include <vcl/graphicfilter.hxx> -#include <vcl/settings.hxx> -#include <vcl/stdtext.hxx> -#include <vcl/svapp.hxx> +#include <about.hxx> + +#include <osl/diagnose.h> //OSL_ENSURE +#include <osl/process.h> //osl_getProcessLocale +#include <rtl/character.hxx> //rtl::isAsciiHexDigit +#include <sal/log.hxx> //SAL_WARN +#include <vcl/settings.hxx> //GetSettings #include <vcl/weld.hxx> +#include <vcl/svapp.hxx> //Application:: +#include <vcl/virdev.hxx> //VirtualDevice -#include <unotools/configmgr.hxx> -#include <unotools/bootstrap.hxx> -#include <com/sun/star/uno/Any.h> -#include <svtools/langhelp.hxx> #include <i18nlangtag/languagetag.hxx> - -#include <com/sun/star/system/SystemShellExecuteFlags.hpp> -#include <com/sun/star/system/SystemShellExecute.hpp> -#include <comphelper/processfactory.hxx> -#include <comphelper/anytostring.hxx> -#include <cppuhelper/exc_hlp.hxx> -#include <svtools/optionsdrawinglayer.hxx> - -#include <about.hxx> -#include <dialmgr.hxx> +#include <svtools/langhelp.hxx> +#include <unotools/bootstrap.hxx> //utl::Bootstrap::getBuildVersion +#include <unotools/configmgr.hxx> //ConfigManager:: +#include <config_buildid.h> //EXTRA_BUILDID +#include <dialmgr.hxx> //CuiResId +#include <sfx2/app.hxx> //SfxApplication::loadBrandSvg #include <strings.hrc> -#include <config_buildid.h> -#include <sfx2/app.hxx> +#include <config_feature_opencl.h> #if HAVE_FEATURE_OPENCL #include <opencl/openclwrapper.hxx> #endif -#include <officecfg/Office/Common.hxx> #include <officecfg/Office/Calc.hxx> +#include <officecfg/Office/Common.hxx> using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star; - -AboutDialog::AboutDialog(weld::Window* pParent) - : m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/aboutdialog.ui")) - , m_xDialog(m_xBuilder->weld_about_dialog("AboutDialog")) - , m_xContentArea(m_xDialog->weld_content_area()) -{ - m_xDialog->add_button(GetStandardText(StandardButtonType::Close), RET_CLOSE); - m_xDialog->add_button(CuiResId(RID_SVXSTR_ABOUT_CREDITS), 101); - m_xDialog->add_button(CuiResId(RID_SVXSTR_ABOUT_WEBSITE), 102); - m_xDialog->add_button(CuiResId(RID_SVXSTR_ABOUT_RELEASE_NOTES), 103); - - m_xCreditsButton.reset(m_xDialog->weld_widget_for_response(101)); - m_xCreditsButton->set_secondary(true); - m_xWebsiteButton.reset(m_xDialog->weld_widget_for_response(102)); - m_xWebsiteButton->set_secondary(true); - m_xReleaseNotesButton.reset(m_xDialog->weld_widget_for_response(103)); - m_xReleaseNotesButton->set_secondary(true); - m_xCloseButton.reset(m_xDialog->weld_widget_for_response(RET_CLOSE)); - - m_buildIdLinkString = m_xDialog->get_website_label(); - - m_xDialog->set_version(GetVersionString()); - m_xDialog->set_copyright(GetCopyrightString()); - - SetBuildIdLink(); - - SetLogo(); - - m_xDialog->connect_size_allocate(LINK(this, AboutDialog, SizeAllocHdl)); - - // Connect all handlers - m_xCreditsButton->connect_clicked( LINK( this, AboutDialog, HandleClick ) ); - m_xWebsiteButton->connect_clicked( LINK( this, AboutDialog, HandleClick ) ); - m_xReleaseNotesButton->connect_clicked( LINK( this, AboutDialog, HandleClick ) ); - m_xCloseButton->grab_focus(); -} -AboutDialog::~AboutDialog() -{ +AboutDialog::AboutDialog(weld::Window *pParent) + : GenericDialogController(pParent, "cui/ui/aboutdialog.ui", "AboutDialog"), + m_pCreditsButton(m_xBuilder->weld_link_button("btnCredits")), + m_pWebsiteButton(m_xBuilder->weld_link_button("btnWebsite")), + m_pReleaseNotesButton(m_xBuilder->weld_link_button("btnReleaseNotes")), + m_pCloseButton(m_xBuilder->weld_button("btnClose")), + m_pBrandImage(m_xBuilder->weld_image("imBrand")), + m_pAboutImage(m_xBuilder->weld_image("imAbout")), + m_pVersionLabel(m_xBuilder->weld_label("lbVersion")), + m_pCopyrightLabel(m_xBuilder->weld_label("lbCopyright")) { + m_pVersionLabel->set_label(GetVersionString()); + m_pCopyrightLabel->set_label(GetCopyrightString()); + + //Images + const Size nWidth(m_pVersionLabel->get_preferred_size()); + BitmapEx aBackgroundBitmap; + + if (SfxApplication::loadBrandSvg(Application::GetSettings() + .GetStyleSettings() + .GetDialogColor() + .IsDark() + ? "shell/logo_inverted" + : "shell/logo", + aBackgroundBitmap, + nWidth.getWidth() * 0.8)) { + ScopedVclPtr<VirtualDevice> m_pVirDev = + m_pBrandImage->create_virtual_device(); + m_pVirDev->SetOutputSizePixel(aBackgroundBitmap.GetSizePixel()); + m_pVirDev->DrawBitmapEx(Point(0, 0), aBackgroundBitmap); + m_pBrandImage->set_image(m_pVirDev.get()); + m_pVirDev.disposeAndClear(); + } + if (SfxApplication::loadBrandSvg("shell/about", aBackgroundBitmap, + nWidth.getWidth())) { + ScopedVclPtr<VirtualDevice> m_pVirDev = + m_pAboutImage->create_virtual_device(); + m_pVirDev->SetOutputSizePixel(aBackgroundBitmap.GetSizePixel()); + m_pVirDev->DrawBitmapEx(Point(0, 0), aBackgroundBitmap); + m_pAboutImage->set_image(m_pVirDev.get()); + m_pVirDev.disposeAndClear(); + } + + //Links + m_pCreditsButton->set_uri(CuiResId(RID_SVXSTR_ABOUT_CREDITS_URL)); + + OUString sURL(officecfg::Office::Common::Help::StartCenter::InfoURL::get()); + localizeWebserviceURI(sURL); + m_pWebsiteButton->set_uri(sURL); + + sURL = officecfg::Office::Common::Menus::ReleaseNotesURL::get() + + "?LOvers=" + utl::ConfigManager::getProductVersion() + "&LOlocale=" + + LanguageTag(utl::ConfigManager::getUILocale()).getLanguage(); + m_pReleaseNotesButton->set_uri(sURL); + + //Handler + m_pCloseButton->grab_focus(); } -IMPL_LINK(AboutDialog, HandleClick, weld::Button&, rButton, void) -{ - OUString sURL = ""; - - // Find which button was pressed and from this, get the URL to be opened - if (&rButton == m_xCreditsButton.get()) - sURL = CuiResId(RID_SVXSTR_ABOUT_CREDITS_URL); - else if (&rButton == m_xWebsiteButton.get()) - { - sURL = officecfg::Office::Common::Help::StartCenter::InfoURL::get(); - localizeWebserviceURI(sURL); - } - else if (&rButton == m_xReleaseNotesButton.get()) - { - sURL = officecfg::Office::Common::Menus::ReleaseNotesURL::get() + - "?LOvers=" + utl::ConfigManager::getProductVersion() + - "&LOlocale=" + LanguageTag(utl::ConfigManager::getUILocale()).getLanguage(); - } +AboutDialog::~AboutDialog() {} - // If the URL is empty, don't do anything - if ( sURL.isEmpty() ) - return; - try - { - Reference< css::system::XSystemShellExecute > xSystemShellExecute( - css::system::SystemShellExecute::create(::comphelper::getProcessComponentContext() ) ); - xSystemShellExecute->execute( sURL, OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY ); - } - catch (const Exception&) - { - Any exc( ::cppu::getCaughtException() ); - OUString msg( ::comphelper::anyToString( exc ) ); - const SolarMutexGuard guard; - std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(getDialog(), - VclMessageType::Warning, VclButtonsType::Ok, msg)); - xErrorBox->set_title(m_xDialog->get_title()); - xErrorBox->run(); - } -} +OUString AboutDialog::GetBuildId() { + OUString sDefault; + OUString sBuildId(utl::Bootstrap::getBuildVersion(sDefault)); + if (!sBuildId.isEmpty()) + return sBuildId; -void AboutDialog::SetBuildIdLink() -{ - const OUString buildId = GetBuildId(); + sBuildId = utl::Bootstrap::getBuildIdData(sDefault); - if (IsStringValidGitHash(buildId)) - { - if (m_buildIdLinkString.indexOf("$GITHASH") == -1) - { - SAL_WARN( "cui.dialogs", "translated git hash string in translations doesn't contain $GITHASH placeholder" ); - m_buildIdLinkString += " $GITHASH"; - } + if (!sBuildId.isEmpty()) { + return sBuildId.getToken(0, '-'); + } - m_xDialog->set_website_label(m_buildIdLinkString.replaceAll("$GITHASH", buildId)); - m_xDialog->set_website("https://hub.libreoffice.org/git-core/" + buildId); - } - else - { - m_xDialog->set_website_label(OUString()); - m_xDialog->set_website(OUString()); - } + OSL_ENSURE(!sBuildId.isEmpty(), "No BUILDID in bootstrap file"); + return sBuildId; } -void AboutDialog::SetLogo() -{ - auto nWidth = m_xContentArea->get_preferred_size().Width(); +OUString AboutDialog::GetLocaleString() { + OUString aLocaleStr; + rtl_Locale *pLocale; - // fdo#67401 set AntiAliasing for SVG logo - SvtOptionsDrawinglayer aDrawOpt; - bool bOldAntiAliasSetting = aDrawOpt.IsAntiAliasing(); - aDrawOpt.SetAntiAliasing(true); + osl_getProcessLocale(&pLocale); - // load svg logo, specify desired width, scale height isotropically - SfxApplication::loadBrandSvg("flat_logo", aLogoBitmap, nWidth); - - aDrawOpt.SetAntiAliasing(bOldAntiAliasSetting); - - if (!aLogoBitmap) - m_xDialog->set_logo(nullptr); + if (pLocale && pLocale->Language) { + if (pLocale->Country && rtl_uString_getLength(pLocale->Country) > 0) + aLocaleStr = OUString::unacquired(&pLocale->Language) + "_" + + OUString::unacquired(&pLocale->Country); else - { - Graphic aGraphic(aLogoBitmap); - m_xDialog->set_logo(aGraphic.GetXGraphic()); - } -} - -IMPL_LINK(AboutDialog, SizeAllocHdl, const Size&, rSize, void) -{ - if (rSize.Width() == aBackgroundBitmap.GetSizePixel().Width()) - return; - // Load background image - if (!(Application::GetSettings().GetStyleSettings().GetHighContrastMode())) - { - SfxApplication::loadBrandSvg("shell/about", aBackgroundBitmap, rSize.Width()); - Graphic aGraphic(aBackgroundBitmap); - m_xDialog->set_background(aGraphic.GetXGraphic()); - } -} - -OUString AboutDialog::GetBuildId() -{ - OUString sDefault; - OUString sBuildId(utl::Bootstrap::getBuildVersion(sDefault)); - if (!sBuildId.isEmpty()) - return sBuildId; - - sBuildId = utl::Bootstrap::getBuildIdData(sDefault); - - if (!sBuildId.isEmpty()) - { - return sBuildId.getToken( 0, '-' ); - } - - OSL_ENSURE( !sBuildId.isEmpty(), "No BUILDID in bootstrap file" ); - return sBuildId; -} - -OUString AboutDialog::GetLocaleString() -{ - OUString aLocaleStr; - rtl_Locale * pLocale; - - osl_getProcessLocale( &pLocale ); - - if ( pLocale && pLocale->Language ) - { - if (pLocale->Country && rtl_uString_getLength( pLocale->Country) > 0) - aLocaleStr = OUString::unacquired(&pLocale->Language) + "_" + OUString::unacquired(&pLocale->Country); - else - aLocaleStr = OUString(pLocale->Language); - if (pLocale->Variant && rtl_uString_getLength( pLocale->Variant) > 0) - aLocaleStr += OUString(pLocale->Variant); - } + aLocaleStr = OUString(pLocale->Language); + if (pLocale->Variant && rtl_uString_getLength(pLocale->Variant) > 0) + aLocaleStr += OUString(pLocale->Variant); + } - return aLocaleStr; + return aLocaleStr; } -bool AboutDialog::IsStringValidGitHash(const OUString& hash) -{ - for (int i = 0; i < hash.getLength(); i++) - { - if (!rtl::isAsciiHexDigit(hash[i])) - { - return false; - } +bool AboutDialog::IsStringValidGitHash(const OUString &hash) { + for (int i = 0; i < hash.getLength(); i++) { + if (!rtl::isAsciiHexDigit(hash[i])) { + return false; } + } - return true; + return true; } -OUString AboutDialog::GetVersionString() -{ - OUString sVersion = CuiResId(RID_SVXSTR_ABOUT_VERSION); +OUString AboutDialog::GetVersionString() { + OUString sVersion = CuiResId(RID_SVXSTR_ABOUT_VERSION); #ifdef _WIN64 - sVersion += " (x64)"; + sVersion += " (x64)"; #elif defined(_WIN32) - sVersion += " (x86)"; + sVersion += " (x86)"; #endif - OUString sBuildId = GetBuildId(); - - OUString aLocaleStr = Application::GetSettings().GetLanguageTag().getBcp47() + " (" + GetLocaleString() + ")"; - OUString aUILocaleStr = Application::GetSettings().GetUILanguageTag().getBcp47(); - - if (!sBuildId.trim().isEmpty()) - { - sVersion += "\n"; - OUString sBuildStr = CuiResId(RID_SVXSTR_ABOUT_BUILDID); - if (sBuildStr.indexOf("$BUILDID") == -1) - { - SAL_WARN( "cui.dialogs", "translated Build Id string in translations doesn't contain $BUILDID placeholder" ); - sBuildStr += " $BUILDID"; - } - sVersion += sBuildStr.replaceAll("$BUILDID", sBuildId); - } - - sVersion += "\n" + Application::GetHWOSConfInfo(); - - bool const extra = EXTRA_BUILDID[0] != '\0'; - // extracted from the 'if' to avoid Clang -Wunreachable-code - if (extra) - { - sVersion += "\n" EXTRA_BUILDID; - } - - OUString sLocaleStr(CuiResId(RID_SVXSTR_ABOUT_LOCALE)); - if (sLocaleStr.indexOf("$LOCALE") == -1) - { - SAL_WARN( "cui.dialogs", "translated locale string in translations doesn't contain $LOCALE placeholder" ); - sLocaleStr += " $LOCALE"; - } - sVersion += "\n" + sLocaleStr.replaceAll("$LOCALE", aLocaleStr); - - OUString sUILocaleStr(CuiResId(RID_SVXSTR_ABOUT_UILOCALE)); - if (sUILocaleStr.indexOf("$LOCALE") == -1) - { - SAL_WARN( "cui.dialogs", "translated uilocale string in translations doesn't contain $LOCALE placeholder" ); - sUILocaleStr += " $LOCALE"; - } - sVersion += "; " + sUILocaleStr.replaceAll("$LOCALE", aUILocaleStr); - - OUString aCalcMode = "Calc: "; // Calc calculation mode + OUString sBuildId = GetBuildId(); + + OUString aLocaleStr = Application::GetSettings().GetLanguageTag().getBcp47() + + " (" + GetLocaleString() + ")"; + OUString aUILocaleStr = + Application::GetSettings().GetUILanguageTag().getBcp47(); + + if (!sBuildId.trim().isEmpty()) { + sVersion += "\n"; + OUString sBuildStr = CuiResId(RID_SVXSTR_ABOUT_BUILDID); + if (sBuildStr.indexOf("$BUILDID") == -1) { + SAL_WARN("cui.dialogs", "translated Build Id string in translations " + "doesn't contain $BUILDID placeholder"); + sBuildStr += " $BUILDID"; + } + sVersion += sBuildStr.replaceAll("$BUILDID", sBuildId); + } + + sVersion += "\n" + Application::GetHWOSConfInfo(); + + bool const extra = EXTRA_BUILDID[0] != '\0'; + // extracted from the 'if' to avoid Clang -Wunreachable-code + if (extra) { + sVersion += "\n" EXTRA_BUILDID; + } + + OUString sLocaleStr(CuiResId(RID_SVXSTR_ABOUT_LOCALE)); + if (sLocaleStr.indexOf("$LOCALE") == -1) { + SAL_WARN("cui.dialogs", "translated locale string in translations doesn't " + "contain $LOCALE placeholder"); + sLocaleStr += " $LOCALE"; + } + sVersion += "\n" + sLocaleStr.replaceAll("$LOCALE", aLocaleStr); + + OUString sUILocaleStr(CuiResId(RID_SVXSTR_ABOUT_UILOCALE)); + if (sUILocaleStr.indexOf("$LOCALE") == -1) { + SAL_WARN("cui.dialogs", "translated uilocale string in translations " + "doesn't contain $LOCALE placeholder"); + sUILocaleStr += " $LOCALE"; + } + sVersion += "; " + sUILocaleStr.replaceAll("$LOCALE", aUILocaleStr); + + OUString aCalcMode = "Calc: "; // Calc calculation mode #if HAVE_FEATURE_OPENCL - bool bOpenCL = openclwrapper::GPUEnv::isOpenCLEnabled(); - if (bOpenCL) - aCalcMode += "CL"; + bool bOpenCL = openclwrapper::GPUEnv::isOpenCLEnabled(); + if (bOpenCL) + aCalcMode += "CL"; #else - const bool bOpenCL = false; + const bool bOpenCL = false; #endif - static const bool bThreadingProhibited = std::getenv("SC_NO_THREADED_CALCULATION"); - bool bThreadedCalc = officecfg::Office::Calc::Formula::Calculation::UseThreadedCalculationForFormulaGroups::get(); + static const bool bThreadingProhibited = + std::getenv("SC_NO_THREADED_CALCULATION"); + bool bThreadedCalc = officecfg::Office::Calc::Formula::Calculation:: + UseThreadedCalculationForFormulaGroups::get(); - if (!bThreadingProhibited && !bOpenCL && bThreadedCalc) - { - if (!aCalcMode.endsWith(" ")) - aCalcMode += " "; - aCalcMode += "threaded"; - } + if (!bThreadingProhibited && !bOpenCL && bThreadedCalc) { + if (!aCalcMode.endsWith(" ")) + aCalcMode += " "; + aCalcMode += "threaded"; + } - sVersion += "\n" + aCalcMode; + sVersion += "\n" + aCalcMode; - return sVersion; + return sVersion; } -OUString AboutDialog::GetCopyrightString() -{ - OUString sVendorTextStr(CuiResId(RID_SVXSTR_ABOUT_VENDOR)); - OUString aCopyrightString = sVendorTextStr + "\n" - + CuiResId(RID_SVXSTR_ABOUT_COPYRIGHT) + "\n"; +OUString AboutDialog::GetCopyrightString() { + OUString sVendorTextStr(CuiResId(RID_SVXSTR_ABOUT_VENDOR)); + OUString aCopyrightString = + sVendorTextStr + "\n" + CuiResId(RID_SVXSTR_ABOUT_COPYRIGHT) + "\n"; - if (utl::ConfigManager::getProductName() == "LibreOffice") - aCopyrightString += CuiResId(RID_SVXSTR_ABOUT_BASED_ON); - else - aCopyrightString += CuiResId(RID_SVXSTR_ABOUT_DERIVED); + if (utl::ConfigManager::getProductName() == "LibreOffice") + aCopyrightString += CuiResId(RID_SVXSTR_ABOUT_BASED_ON); + else + aCopyrightString += CuiResId(RID_SVXSTR_ABOUT_DERIVED); - return aCopyrightString; + return aCopyrightString; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index d7868049d4c7..e7282b3c197a 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -20,6 +20,7 @@ #include <align.hxx> #include "dlgfact.hxx" +#include <about.hxx> #include <sfx2/app.hxx> #include <sfx2/basedlgs.hxx> #include <sfx2/pageids.hxx> @@ -85,7 +86,6 @@ #include <screenshotannotationdlg.hxx> #include <hyphen.hxx> #include <thesdlg.hxx> -#include <about.hxx> #include <tipofthedaydlg.hxx> #include <DiagramDialog.hxx> @@ -1022,11 +1022,6 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateVclDialog(weld::Wind return nullptr; } -VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateAboutDialog(weld::Window* pParent) -{ - return VclPtr<CuiAbstractController_Impl>::Create(std::make_unique<AboutDialog>(pParent)); -} - VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateFrameDialog(weld::Window* pParent, const Reference< frame::XFrame >& rxFrame, sal_uInt32 nResId, const OUString& rParameter ) { @@ -1421,6 +1416,11 @@ short SvxMacroAssignDialog::Execute() return m_xDialog->run(); } +short AbstractAboutDialog_Impl::Execute() +{ + return m_xDlg->run(); +} + short AbstractTipOfTheDayDialog_Impl::Execute() { return m_xDlg->run(); @@ -1676,6 +1676,13 @@ VclPtr<AbstractQrCodeGenDialog> AbstractDialogFactory_Impl::CreateQrCodeGenDialo std::make_unique<QrCodeGenDialog>(pParent, xModel, bEditExisting)); } +VclPtr<AbstractAboutDialog> +AbstractDialogFactory_Impl::CreateAboutDialog(weld::Window* pParent) +{ + return VclPtr<AbstractAboutDialog_Impl>::Create( + std::make_unique<AboutDialog>(pParent)); +} + VclPtr<AbstractTipOfTheDayDialog> AbstractDialogFactory_Impl::CreateTipOfTheDayDialog(weld::Window* pParent) { diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index cd4b4d36a9dd..5ddcce87f0db 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -26,6 +26,7 @@ #include <tools/link.hxx> #include <com/sun/star/frame/XFrame.hpp> +#include <about.hxx> #include <cfgutil.hxx> #include <cui/cuicharmap.hxx> #include <cuifmsearch.hxx> @@ -738,6 +739,20 @@ public: virtual short Execute() override; }; +class AboutDialog; +class AbstractAboutDialog_Impl : public AbstractAboutDialog +{ +protected: + std::unique_ptr<AboutDialog> m_xDlg; + +public: + explicit AbstractAboutDialog_Impl(std::unique_ptr<AboutDialog> p) + : m_xDlg(std::move(p)) + { + } + virtual short Execute() override; +}; + class TipOfTheDayDialog; class AbstractTipOfTheDayDialog_Impl : public AbstractTipOfTheDayDialog { @@ -774,8 +789,6 @@ class AbstractDialogFactory_Impl : public SvxAbstractDialogFactory public: virtual VclPtr<VclAbstractDialog> CreateVclDialog(weld::Window* pParent, sal_uInt32 nResId) override; - virtual VclPtr<VclAbstractDialog> CreateAboutDialog(weld::Window* pParent) override; - virtual VclPtr<SfxAbstractDialog> CreateSfxDialog( weld::Window* pParent, const SfxItemSet& rAttr, const SdrView* pView, @@ -954,6 +967,8 @@ public: CreateQrCodeGenDialog(weld::Window* pParent, const css::uno::Reference<css::frame::XModel> xModel, bool bEditExisting) override; + virtual VclPtr<AbstractAboutDialog> CreateAboutDialog(weld::Window* pParent) override; + virtual VclPtr<AbstractTipOfTheDayDialog> CreateTipOfTheDayDialog(weld::Window* pParent) override; virtual VclPtr<AbstractDiagramDialog> CreateDiagramDialog( diff --git a/cui/source/inc/about.hxx b/cui/source/inc/about.hxx index aeda433cb2bd..ab03768a27df 100644 --- a/cui/source/inc/about.hxx +++ b/cui/source/inc/about.hxx @@ -22,24 +22,18 @@ #include <vcl/bitmapex.hxx> #include <vcl/weld.hxx> -class AboutDialog : public weld::DialogController +class AboutDialog : public weld::GenericDialogController { private: - std::unique_ptr<weld::Builder> m_xBuilder; - std::shared_ptr<weld::AboutDialog> m_xDialog; - std::unique_ptr<weld::Container> m_xContentArea; - std::unique_ptr<weld::Button> m_xCreditsButton; - std::unique_ptr<weld::Button> m_xWebsiteButton; - std::unique_ptr<weld::Button> m_xReleaseNotesButton; - std::unique_ptr<weld::Button> m_xCloseButton; + std::unique_ptr<weld::LinkButton> m_pCreditsButton; + std::unique_ptr<weld::LinkButton> m_pWebsiteButton; + std::unique_ptr<weld::LinkButton> m_pReleaseNotesButton; + std::unique_ptr<weld::Button> m_pCloseButton; - BitmapEx aLogoBitmap; - BitmapEx aBackgroundBitmap; - - OUString m_buildIdLinkString; - - void SetBuildIdLink(); - void SetLogo(); + std::unique_ptr<weld::Image> m_pBrandImage; + std::unique_ptr<weld::Image> m_pAboutImage; + std::unique_ptr<weld::Label> m_pVersionLabel; + std::unique_ptr<weld::Label> m_pCopyrightLabel; static OUString GetBuildId(); static OUString GetVersionString(); @@ -49,11 +43,7 @@ private: public: AboutDialog(weld::Window* pParent); - virtual weld::Dialog* getDialog() override { return m_xDialog.get(); } virtual ~AboutDialog() override; - - DECL_LINK(HandleClick, weld::Button&, void); - DECL_LINK(SizeAllocHdl, const Size&, void); }; #endif // INCLUDED_CUI_SOURCE_INC_ABOUT_HXX diff --git a/cui/uiconfig/ui/aboutdialog.ui b/cui/uiconfig/ui/aboutdialog.ui index 21d9725b11bb..da99da4e5f51 100644 --- a/cui/uiconfig/ui/aboutdialog.ui +++ b/cui/uiconfig/ui/aboutdialog.ui @@ -1,36 +1,44 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.1 --> +<!-- Generated with glade 3.22.2 --> <interface domain="cui"> - <requires lib="gtk+" version="3.18"/> - <object class="GtkAboutDialog" id="AboutDialog"> + <requires lib="gtk+" version="3.20"/> + <object class="GtkDialog" id="AboutDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="aboutdialog|AboutDialog">About %PRODUCTNAME</property> <property name="resizable">False</property> <property name="modal">True</property> - <property name="default_width">0</property> - <property name="default_height">0</property> + <property name="window_position">center-on-parent</property> <property name="type_hint">dialog</property> - <property name="program_name">%PRODUCTNAME</property> - <property name="comments" translatable="yes" context="aboutdialog|description">%PRODUCTNAME is a modern, easy-to-use, open source productivity suite for word processing, spreadsheets, presentations and more.</property> - <property name="website">https://www.libreoffice.org/</property> - <property name="website_label" translatable="yes" context="aboutdialog|buildIdLink">See Log: $GITHASH</property> - <property name="logo_icon_name">image-missing</property> - <child> + <child type="titlebar"> <placeholder/> </child> <child internal-child="vbox"> - <object class="GtkBox" id="dialog-vbox1"> + <object class="GtkBox"> <property name="can_focus">False</property> <property name="orientation">vertical</property> - <property name="spacing">6</property> + <property name="spacing">12</property> <child internal-child="action_area"> - <object class="GtkButtonBox" id="dialog-action_area1"> - <property name="visible">True</property> + <object class="GtkButtonBox"> <property name="can_focus">False</property> + <property name="margin_top">12</property> + <property name="hexpand">True</property> <property name="layout_style">end</property> <child> - <placeholder/> + <object class="GtkButton" id="btnClose"> + <property name="label">gtk-close</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="use_stock">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">3</property> + </packing> </child> </object> <packing> @@ -40,7 +48,172 @@ <property name="position">0</property> </packing> </child> + <child> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child> + <object class="GtkImage" id="imAbout"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_right">12</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="height">5</property> + </packing> + </child> + <child> + <object class="GtkImage" id="imBrand"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_left">24</property> + <property name="margin_top">24</property> + <property name="margin_bottom">24</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="lbCopyright"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="margin_bottom">6</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="label" context="aboutdialog|copyright">This release was supplied by The Document Foundation. +Copyright (c) 1980-2020 LibreOffice contributors. +LibreOffice was based on OpenOffice.org</property> + <property name="wrap">True</property> + <property name="max_width_chars">50</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="lbAbout"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">end</property> + <property name="margin_top">12</property> + <property name="margin_bottom">12</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="label" translatable="yes" context="aboutdialog|description">%PRODUCTNAME is a modern, easy-to-use, open source productivity suite for word processing, spreadsheets, presentations and more.</property> + <property name="wrap">True</property> + <property name="max_width_chars">50</property> + <property name="xalign">0</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="lbVersion"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">end</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="label">Version: 7.0 +Build ID: 7.0 +CPU threads +Locale: +Calc:</property> + <property name="wrap">True</property> + <property name="selectable">True</property> + <property name="ellipsize">end</property> + <property name="max_width_chars">50</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="homogeneous">True</property> + <child> + <object class="GtkLinkButton" id="btnCredits"> + <property name="label" translatable="yes" context="aboutdialog|credits">Credits</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="relief">none</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLinkButton" id="btnWebsite"> + <property name="label" translatable="yes" context="aboutdialog|website">Website</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="relief">none</property> + <property name="xalign">0</property> + <property name="uri">https://www.libreoffice.org/</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkLinkButton" id="btnReleaseNotes"> + <property name="label" translatable="yes" context="aboutdialog|description">Release Notes</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="relief">none</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">4</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> </object> </child> + <action-widgets> + <action-widget response="-7">btnClose</action-widget> + </action-widgets> </object> </interface> |