Kaydet (Commit) a30a5d1b authored tarafından Caolán McNamara's avatar Caolán McNamara

weld AboutDialog

use a native GtkAboutDialog on that platform and refactor the current cui about
dialog body to form the body of a vcl AboutDialog

use add_button to add the buttons to whichever is preferred of the headerbar
or action-area

Change-Id: I67e0b36dcb8d3fa08ec4f0397b0f6185b0778675
Reviewed-on: https://gerrit.libreoffice.org/73439
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 7665246a
......@@ -391,6 +391,19 @@
#define RID_SVXSTR_REGISTERED_DATABASES NC_("RID_SVXSTR_REGISTERED_DATABASES", "Registered Databases")
#define RID_SVXSTR_ABOUT_VERSION NC_("aboutdialog|textbuffer1", "Version: %ABOUTBOXPRODUCTVERSION%ABOUTBOXPRODUCTVERSIONSUFFIX")
#define RID_SVXSTR_ABOUT_COPYRIGHT NC_("aboutdialog|copyright", "Copyright © 2000–2019 LibreOffice contributors.")
#define RID_SVXSTR_ABOUT_CREDITS_URL NC_("aboutdialog|link", "https://www.libreoffice.org/about-us/credits/")
#define RID_SVXSTR_ABOUT_BUILDID NC_("aboutdialog|buildid", "Build ID: $BUILDID")
#define RID_SVXSTR_ABOUT_VENDOR NC_("aboutdialog|vendor", "This release was supplied by %OOOVENDOR.")
#define RID_SVXSTR_ABOUT_BASED_ON NC_("aboutdialog|libreoffice", "LibreOffice was based on OpenOffice.org.")
#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")
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
......@@ -925,11 +925,6 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateVclDialog( vcl::Wind
VclPtr<Dialog> pDlg;
switch ( nResId )
{
case SID_ABOUT:
{
pDlg = VclPtr<AboutDialog>::Create(pParent);
break;
}
case SID_OPTIONS_TREEDIALOG :
case SID_OPTIONS_DATABASES :
case SID_LANGUAGE_OPTIONS :
......@@ -960,6 +955,11 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateVclDialog( vcl::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(vcl::Window* pParent, const Reference< frame::XFrame >& rxFrame,
sal_uInt32 nResId, const OUString& rParameter )
{
......
......@@ -685,6 +685,8 @@ class AbstractDialogFactory_Impl : public SvxAbstractDialogFactory
public:
virtual VclPtr<VclAbstractDialog> CreateVclDialog( vcl::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,
......
......@@ -19,67 +19,44 @@
#ifndef INCLUDED_CUI_SOURCE_INC_ABOUT_HXX
#define INCLUDED_CUI_SOURCE_INC_ABOUT_HXX
#include <vcl/accel.hxx>
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
#include <vcl/fixedhyper.hxx>
#include <vcl/vclmedit.hxx>
#include <sfx2/basedlgs.hxx>
#include <vector>
#include <vcl/weld.hxx>
// class AboutDialog -----------------------------------------------------
class AboutDialog : public SfxModalDialog
class AboutDialog : public weld::DialogController
{
private:
BitmapEx aBackgroundBitmap;
BitmapEx aLogoBitmap;
std::unique_ptr<weld::Builder> m_xBuilder;
std::shared_ptr<weld::AboutDialog> m_xDialog;
std::shared_ptr<weld::Container> m_xContentArea;
VclPtr<VclMultiLineEdit> m_pVersion;
VclPtr<FixedHyperlink> m_pBuildIdLink;
VclPtr<FixedText> m_pDescriptionText;
VclPtr<FixedText> m_pCopyrightText;
VclPtr<FixedImage> m_pLogoImage;
VclPtr<FixedText> m_pLogoReplacement;
VclPtr<PushButton> m_pCreditsButton;
VclPtr<PushButton> m_pWebsiteButton;
VclPtr<PushButton> m_pReleaseNotesButton;
BitmapEx aLogoBitmap;
BitmapEx aBackgroundBitmap;
OUString m_aVersionTextStr;
OUString m_aVendorTextStr;
OUString m_aCopyrightTextStr;
OUString m_aBasedTextStr;
OUString m_aBasedDerivedTextStr;
OUString m_aCreditsLinkStr;
OUString m_sBuildStr;
OUString m_aLocaleStr;
OUString m_aUILocaleStr;
OUString m_buildIdLinkString;
weld::Button* m_pCreditsButton;
weld::Button* m_pWebsiteButton;
weld::Button* m_pReleaseNotesButton;
weld::Button* m_pCloseButton;
void SetBuildIdLink();
void StyleControls();
void SetLogo();
static OUString GetBuildId();
OUString GetVersionString();
OUString GetCopyrightString();
static OUString GetVersionString();
static OUString GetCopyrightString();
static OUString GetLocaleString();
static bool IsStringValidGitHash(const OUString& hash);
protected:
virtual bool Close() override;
virtual void Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect) override;
virtual void Resize() override;
public:
AboutDialog(vcl::Window* pParent);
AboutDialog(weld::Window* pParent);
virtual weld::Dialog* getDialog() override { return m_xDialog.get(); }
virtual ~AboutDialog() override;
virtual void dispose() override;
DECL_LINK( HandleClick, Button*, void );
DECL_LINK(HandleClick, weld::Button&, void);
DECL_LINK(SizeAllocHdl, const Size&, void);
};
#endif // INCLUDED_CUI_SOURCE_INC_ABOUT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
......@@ -132,6 +132,7 @@ public:
virtual VclPtr<SfxAbstractPasteDialog> CreatePasteDialog(weld::Window* pParent) = 0;
virtual VclPtr<SfxAbstractLinksDialog> CreateLinksDialog(weld::Window* pParent, sfx2::LinkManager* pMgr, bool bHTML=false, sfx2::SvBaseLink* p=nullptr) = 0;
virtual VclPtr<VclAbstractDialog> CreateSvxScriptOrgDialog(weld::Window* pParent, const OUString& rLanguage) = 0;
virtual VclPtr<VclAbstractDialog> CreateAboutDialog(weld::Window* pParent) = 0;
virtual VclPtr<AbstractScriptSelectorDialog> CreateScriptSelectorDialog(weld::Window* pParent,
const css::uno::Reference< css::frame::XFrame >& rxFrame) = 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/.
*/
#ifndef INCLUDED_VCL_ABOUT_DIALOG_HXX
#define INCLUDED_VCL_ABOUT_DIALOG_HXX
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
#include <vcl/fixedhyper.hxx>
#include <vcl/dialog.hxx>
#include <vcl/layout.hxx>
#include <vcl/vclmedit.hxx>
class AboutDialog : public Dialog
{
private:
BitmapEx m_aBackgroundBitmap;
std::unique_ptr<VclBuilder> m_xBuilder;
VclPtr<VclContainer> m_xContents;
VclPtr<VclMultiLineEdit> m_xVersion;
VclPtr<FixedHyperlink> m_xBuildIdLink;
VclPtr<FixedText> m_xDescriptionText;
VclPtr<FixedText> m_xCopyrightText;
VclPtr<FixedImage> m_xLogoImage;
VclPtr<FixedText> m_xLogoReplacement;
void StyleControls();
protected:
virtual void Paint(vcl::RenderContext& rRenderContext,
const ::tools::Rectangle& rRect) override;
virtual bool set_property(const OString& rKey, const OUString& rValue) override;
virtual void set_content_area(VclBox* pBox) override;
public:
explicit AboutDialog(vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG,
InitFlag eFlag = InitFlag::Default);
virtual ~AboutDialog() override;
virtual void dispose() override;
void SetLogo(const Image& rLogoBitmap);
void SetBackground(const Image& rBackgroundBitmap);
void SetVersion(const OUString& rVersion) { m_xVersion->SetText(rVersion); }
void SetCopyright(const OUString& rCopyright) { m_xCopyrightText->SetText(rCopyright); }
void SetWebsiteLink(const OUString& rURL) { m_xBuildIdLink->SetURL(rURL); }
void SetWebsiteLabel(const OUString& rLabel) { m_xBuildIdLink->SetText(rLabel); }
OUString GetWebsiteLabel() const { return m_xBuildIdLink->GetText(); }
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -96,7 +96,7 @@ protected:
protected:
friend class VclBuilder;
void set_action_area(VclButtonBox* pBox);
void set_content_area(VclBox* pBox);
virtual void set_content_area(VclBox* pBox);
public:
explicit Dialog( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG, InitFlag eFlag = InitFlag::Default );
......
......@@ -129,6 +129,8 @@ public:
virtual void set_vexpand(bool bExpand) = 0;
virtual bool get_vexpand() const = 0;
virtual void set_secondary(bool bSecondary) = 0;
virtual void set_margin_top(int nMargin) = 0;
virtual void set_margin_bottom(int nMargin) = 0;
......@@ -433,6 +435,18 @@ public:
virtual Container* weld_message_area() = 0;
};
class VCL_DLLPUBLIC AboutDialog : virtual public Dialog
{
public:
virtual void set_version(const OUString& rVersion) = 0;
virtual void set_copyright(const OUString& rCopyright) = 0;
virtual void set_website(const OUString& rURL) = 0;
virtual void set_website_label(const OUString& rLabel) = 0;
virtual OUString get_website_label() const = 0;
virtual void set_logo(VirtualDevice* pDevice) = 0;
virtual void set_background(VirtualDevice* pDevice) = 0;
};
struct VCL_DLLPUBLIC ComboBoxEntry
{
OUString sString;
......@@ -1730,6 +1744,9 @@ public:
bool bTakeOwnership = true)
= 0;
virtual std::unique_ptr<Dialog> weld_dialog(const OString& id, bool bTakeOwnership = true) = 0;
virtual std::unique_ptr<AboutDialog> weld_about_dialog(const OString& id,
bool bTakeOwnership = true)
= 0;
virtual std::unique_ptr<Window> weld_window(const OString& id, bool bTakeOwnership = true) = 0;
virtual std::unique_ptr<Widget> weld_widget(const OString& id, bool bTakeOwnership = false) = 0;
virtual std::unique_ptr<Container> weld_container(const OString& id,
......
......@@ -673,7 +673,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
case SID_ABOUT:
{
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( nullptr, SID_ABOUT ));
ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateAboutDialog(rReq.GetFrameWeld()));
pDlg->Execute();
bDone = true;
break;
......
cui/uiconfig/ui/aboutdialog.ui://GtkImage[@id='logo'] no-labelled-by
cui/uiconfig/ui/aboutdialog.ui://GtkLabel[@id='logoreplacement'] orphan-label
cui/uiconfig/ui/aboutdialog.ui://GtkLabel[@id='buildid'] orphan-label
cui/uiconfig/ui/aboutdialog.ui://GtkLabel[@id='locale'] orphan-label
cui/uiconfig/ui/aboutdialog.ui://GtkLabel[@id='uilocale'] orphan-label
cui/uiconfig/ui/aboutdialog.ui://GtkTextView[@id='version'] no-labelled-by
cui/uiconfig/ui/aboutdialog.ui://GtkLabel[@id='description'] orphan-label
cui/uiconfig/ui/aboutdialog.ui://GtkLabel[@id='copyright'] orphan-label
cui/uiconfig/ui/aboutdialog.ui://GtkLabel[@id='libreoffice'] orphan-label
cui/uiconfig/ui/aboutdialog.ui://GtkLabel[@id='derived'] orphan-label
cui/uiconfig/ui/aboutdialog.ui://GtkLabel[@id='vendor'] orphan-label
cui/uiconfig/ui/aboutdialog.ui://GtkLabel[@id='link'] orphan-label
cui/uiconfig/ui/aboutconfigdialog.ui://GtkEntry[@id='searchEntry'] no-labelled-by
cui/uiconfig/ui/aboutconfigdialog.ui://GtkLabel[@id='preference'] orphan-label
cui/uiconfig/ui/aboutconfigdialog.ui://GtkLabel[@id='property'] orphan-label
......
vcl/uiconfig/ui/aboutbox.ui://GtkImage[@id='logo'] no-labelled-by
vcl/uiconfig/ui/aboutbox.ui://GtkLabel[@id='logoreplacement'] orphan-label
vcl/uiconfig/ui/aboutbox.ui://GtkLabel[@id='buildid'] orphan-label
vcl/uiconfig/ui/aboutbox.ui://GtkLabel[@id='locale'] orphan-label
vcl/uiconfig/ui/aboutbox.ui://GtkLabel[@id='uilocale'] orphan-label
vcl/uiconfig/ui/aboutbox.ui://GtkTextView[@id='version'] no-labelled-by
vcl/uiconfig/ui/aboutbox.ui://GtkLabel[@id='description'] orphan-label
vcl/uiconfig/ui/aboutbox.ui://GtkLabel[@id='copyright'] orphan-label
vcl/uiconfig/ui/aboutbox.ui://GtkLabel[@id='libreoffice'] orphan-label
vcl/uiconfig/ui/aboutbox.ui://GtkLabel[@id='derived'] orphan-label
vcl/uiconfig/ui/aboutbox.ui://GtkLabel[@id='vendor'] orphan-label
vcl/uiconfig/ui/aboutbox.ui://GtkLabel[@id='link'] orphan-label
vcl/uiconfig/ui/cupspassworddialog.ui://GtkLabel[@id='text'] orphan-label
vcl/uiconfig/ui/printdialog.ui://GtkSpinButton[@id='pageedit-nospin'] no-labelled-by
vcl/uiconfig/ui/printdialog.ui://GtkLabel[@id='totalnumpages'] orphan-label
......
......@@ -117,6 +117,7 @@ endif
$(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/animate/Animation \
vcl/source/animate/AnimationBitmap \
vcl/source/window/aboutdialog \
vcl/source/window/errinf \
vcl/source/window/settings \
vcl/source/window/paint \
......
......@@ -10,6 +10,7 @@
$(eval $(call gb_UIConfig_UIConfig,vcl))
$(eval $(call gb_UIConfig_add_uifiles,vcl,\
vcl/uiconfig/ui/aboutbox \
vcl/uiconfig/ui/cupspassworddialog \
vcl/uiconfig/ui/editmenu \
vcl/uiconfig/ui/errornocontentdialog \
......
......@@ -36,6 +36,7 @@
#include <unotools/accessiblerelationsethelper.hxx>
#include <utility>
#include <tools/helpers.hxx>
#include <vcl/aboutdialog.hxx>
#include <vcl/builder.hxx>
#include <vcl/calendar.hxx>
#include <vcl/combobox.hxx>
......@@ -462,6 +463,11 @@ public:
return m_xWidget->get_vexpand();
}
virtual void set_secondary(bool bSecondary) override
{
m_xWidget->set_secondary(bSecondary);
}
virtual void set_margin_top(int nMargin) override
{
m_xWidget->set_margin_top(nMargin);
......@@ -1301,6 +1307,26 @@ public:
VclPtr<PushButton> xButton(VclPtr<PushButton>::Create(pBox, WB_CLIPCHILDREN|WB_CENTER|WB_VCENTER));
xButton->SetText(rText);
xButton->SetHelpId(rHelpId);
switch (nResponse)
{
case RET_OK:
xButton->set_id("ok");
break;
case RET_CLOSE:
xButton->set_id("close");
break;
case RET_CANCEL:
xButton->set_id("cancel");
break;
case RET_YES:
xButton->set_id("yes");
break;
case RET_NO:
xButton->set_id("no");
break;
}
xButton->Show();
m_xDialog->add_button(xButton, nResponse, true);
}
......@@ -1355,6 +1381,46 @@ public:
}
};
class SalInstanceAboutDialog : public SalInstanceDialog, public virtual weld::AboutDialog
{
private:
VclPtr<::AboutDialog> m_xAboutDialog;
public:
SalInstanceAboutDialog(::AboutDialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
: SalInstanceDialog(pDialog, pBuilder, bTakeOwnership)
, m_xAboutDialog(pDialog)
{
}
virtual void set_version(const OUString& rVersion) override
{
m_xAboutDialog->SetVersion(rVersion);
}
virtual void set_copyright(const OUString& rCopyright) override
{
m_xAboutDialog->SetCopyright(rCopyright);
}
virtual void set_website(const OUString& rURL) override
{
m_xAboutDialog->SetWebsiteLink(rURL);
}
virtual void set_website_label(const OUString& rLabel) override
{
m_xAboutDialog->SetWebsiteLabel(rLabel);
}
virtual OUString get_website_label() const override
{
return m_xAboutDialog->GetWebsiteLabel();
}
virtual void set_logo(VirtualDevice* pDevice) override
{
m_xAboutDialog->SetLogo(createImage(*pDevice));
}
virtual void set_background(VirtualDevice* pDevice) override
{
m_xAboutDialog->SetBackground(createImage(*pDevice));
}
};
class SalInstanceFrame : public SalInstanceContainer, public virtual weld::Frame
{
private:
......@@ -5014,6 +5080,19 @@ public:
return pRet;
}
virtual std::unique_ptr<weld::AboutDialog> weld_about_dialog(const OString &id, bool bTakeOwnership) override
{
AboutDialog* pAboutDialog = m_xBuilder->get<AboutDialog>(id);
std::unique_ptr<weld::AboutDialog> pRet(pAboutDialog ? new SalInstanceAboutDialog(pAboutDialog, this, false) : nullptr);
if (bTakeOwnership && pAboutDialog)
{
assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
m_aOwnedToplevel.set(pAboutDialog);
m_xBuilder->drop_ownership(pAboutDialog);
}
return pRet;
}
virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString &id, bool bTakeOwnership) override
{
Dialog* pDialog = m_xBuilder->get<Dialog>(id);
......
/* -*- 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 <config_features.h>
#include <osl/process.h>
#include <sal/log.hxx>
#include <osl/diagnose.h>
#include <rtl/character.hxx>
#include <vcl/aboutdialog.hxx>
#include <vcl/layout.hxx>
#include <vcl/weld.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <tools/stream.hxx>
#include <rtl/bootstrap.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/bootstrap.hxx>
#include <com/sun/star/uno/Any.h>
#include <vcl/graph.hxx>
#include <vcl/graphicfilter.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 <cppuhelper/bootstrap.hxx>
#include <basegfx/numeric/ftools.hxx>
#include <com/sun/star/geometry/RealRectangle2D.hpp>
#include <config_buildid.h>
#include <rtl/ustrbuf.hxx>
#include <vcl/bitmap.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star;
AboutDialog::AboutDialog(vcl::Window* pParent, WinBits nStyle, Dialog::InitFlag eFlag)
: Dialog(pParent, nStyle, eFlag)
, m_xBuilder(new VclBuilder(this, getUIRootDir(), "vcl/ui/aboutbox.ui"))
{
m_xBuilder->get(m_xContents, "about");
m_xBuilder->get(m_xLogoReplacement, "logoreplacement");
m_xBuilder->get(m_xLogoImage, "logo");
m_xBuilder->get(m_xVersion, "version");
m_xBuilder->get(m_xDescriptionText, "description");
m_xBuilder->get(m_xCopyrightText, "copyright");
m_xBuilder->get(m_xBuildIdLink, "buildIdLink");
}
void AboutDialog::set_content_area(VclBox* pBox)
{
Dialog::set_content_area(pBox);
// move it now that the content area exists
m_xContents->SetParent(pBox);
StyleControls();
}
AboutDialog::~AboutDialog() { disposeOnce(); }
void AboutDialog::dispose()
{
m_xVersion.clear();
m_xDescriptionText.clear();
m_xCopyrightText.clear();
m_xLogoImage.clear();
m_xLogoReplacement.clear();
m_xBuildIdLink.clear();
m_xContents.clear();
m_xBuilder.reset();
Dialog::dispose();
}
void AboutDialog::StyleControls()
{
// Make all the controls have a transparent background
m_xLogoImage->SetBackground();
m_xLogoReplacement->SetPaintTransparent(true);
m_xVersion->SetPaintTransparent(true);
m_xDescriptionText->SetPaintTransparent(true);
m_xCopyrightText->SetPaintTransparent(true);
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
const vcl::Font& aLabelFont = rStyleSettings.GetLabelFont();
vcl::Font aLargeFont = aLabelFont;
aLargeFont.SetFontSize(Size(0, aLabelFont.GetFontSize().Height() * 3));
// Logo Replacement Text
m_xLogoReplacement->SetControlFont(aLargeFont);
// Description Text
aLargeFont.SetFontSize(Size(0, aLabelFont.GetFontSize().Height() * 1.3));
m_xDescriptionText->SetControlFont(aLargeFont);
}
void AboutDialog::SetLogo(const Image& rLogoBitmap)
{
if (!rLogoBitmap)
{
m_xLogoImage->Hide();
m_xLogoReplacement->Show();
}
else
{
m_xLogoReplacement->Hide();
m_xLogoImage->SetImage(rLogoBitmap);
m_xLogoImage->Show();
}
}
void AboutDialog::SetBackground(const Image& rBackgroundBitmap)
{
m_aBackgroundBitmap = rBackgroundBitmap.GetBitmapEx();
Invalidate();
}
void AboutDialog::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect)
{
rRenderContext.SetClipRegion(vcl::Region(rRect));
Size aSize(GetOutputSizePixel());
Point aPos(aSize.Width() - m_aBackgroundBitmap.GetSizePixel().Width(),
aSize.Height() - m_aBackgroundBitmap.GetSizePixel().Height());
rRenderContext.DrawBitmapEx(aPos, m_aBackgroundBitmap);
}
bool AboutDialog::set_property(const OString& rKey, const OUString& rValue)
{
if (rKey == "version")
m_xVersion->SetText(rValue);
else if (rKey == "copyright")
m_xCopyrightText->SetText(rValue);
else if (rKey == "comments")
m_xDescriptionText->SetText(rValue);
else if (rKey == "website")
m_xBuildIdLink->SetURL(rValue);
else if (rKey == "website_label")
m_xBuildIdLink->SetText(rValue);
else if (rKey == "program_name")
m_xLogoReplacement->SetText(rValue);
else
return Dialog::set_property(rKey, rValue);
return true;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -20,6 +20,7 @@
#include <sal/log.hxx>
#include <unotools/localedatawrapper.hxx>
#include <unotools/resmgr.hxx>
#include <vcl/aboutdialog.hxx>
#include <vcl/builder.hxx>
#include <vcl/builderfactory.hxx>
#include <vcl/button.hxx>
......@@ -1647,12 +1648,15 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
extractButtonImage(id, rMap, name == "GtkRadioButton");
VclPtr<vcl::Window> xWindow;
if (name == "GtkDialog")
if (name == "GtkDialog" || name == "GtkAboutDialog")
{
WinBits nBits = WB_MOVEABLE|WB_3DLOOK|WB_CLOSEABLE;
if (extractResizable(rMap))
nBits |= WB_SIZEABLE;
xWindow = VclPtr<Dialog>::Create(pParent, nBits, !pParent ? Dialog::InitFlag::NoParent : Dialog::InitFlag::Default);
if (name == "GtkAboutDialog")
xWindow = VclPtr<AboutDialog>::Create(pParent, nBits, !pParent ? Dialog::InitFlag::NoParent : Dialog::InitFlag::Default);
else
xWindow = VclPtr<Dialog>::Create(pParent, nBits, !pParent ? Dialog::InitFlag::NoParent : Dialog::InitFlag::Default);
#if HAVE_FEATURE_DESKTOP
if (!m_bLegacy && !extractModal(rMap))
xWindow->SetType(WindowType::MODELESSDIALOG);
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<object class="GtkBox" id="about">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkImage" id="logo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-missing-image</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="logoreplacement">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="justify">center</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<child>
<object class="GtkTextView" id="version">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="editable">False</property>
<property name="wrap_mode">word</property>
<property name="justification">center</property>
<property name="cursor_visible">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLinkButton" id="buildIdLink">
<property name="label" translatable="yes" context="aboutdialog|buildIdLink">See Log: $GITHASH</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="description">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="justify">center</property>
<property name="wrap">True</property>
<property name="max_width_chars">62</property>
</object>