summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorHeiko Tietze <tietze.heiko@gmail.com>2020-04-08 12:58:34 +0200
committerHeiko Tietze <heiko.tietze@documentfoundation.org>2020-04-15 17:35:44 +0200
commit9b1c9ac6edcdeae431d6104c586ca7feffbb6483 (patch)
tree395bddaa18a31abfbc8a86277028b0d6087eb130 /vcl/unx
parent0db34d1c5dd7d06435c5a5d58a42da2cbe007006 (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 'vcl/unx')
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx124
1 files changed, 0 insertions, 124 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 584741d17e11..070958751aed 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -4730,103 +4730,6 @@ public:
}
};
-class GtkInstanceAboutDialog final : public GtkInstanceDialog, public virtual weld::AboutDialog
-{
-private:
- GtkAboutDialog* m_pAboutDialog;
- GtkCssProvider* m_pCssProvider;
- std::unique_ptr<utl::TempFile> mxBackgroundImage;
-public:
- GtkInstanceAboutDialog(GtkAboutDialog* pAboutDialog, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
- : GtkInstanceDialog(GTK_WINDOW(pAboutDialog), pBuilder, bTakeOwnership)
- , m_pAboutDialog(pAboutDialog)
- , m_pCssProvider(nullptr)
- {
- // in GtkAboutDialog apply_use_header_bar if headerbar is false it
- // automatically adds a default close button which it doesn't if
- // headerbar is true and which doesn't appear in the .ui
- if (GtkWidget* pDefaultButton = gtk_dialog_get_widget_for_response(GTK_DIALOG(pAboutDialog), GTK_RESPONSE_DELETE_EVENT))
- gtk_widget_destroy(pDefaultButton);
- }
-
- virtual void set_version(const OUString& rVersion) override
- {
- gtk_about_dialog_set_version(m_pAboutDialog, OUStringToOString(rVersion, RTL_TEXTENCODING_UTF8).getStr());
- }
-
- virtual void set_copyright(const OUString& rCopyright) override
- {
- gtk_about_dialog_set_copyright(m_pAboutDialog, OUStringToOString(rCopyright, RTL_TEXTENCODING_UTF8).getStr());
- }
-
- virtual void set_website(const OUString& rURL) override
- {
- OString sURL(OUStringToOString(rURL, RTL_TEXTENCODING_UTF8));
- gtk_about_dialog_set_website(m_pAboutDialog, sURL.isEmpty() ? nullptr : sURL.getStr());
- }
-
- virtual void set_website_label(const OUString& rLabel) override
- {
- OString sLabel(OUStringToOString(rLabel, RTL_TEXTENCODING_UTF8));
- gtk_about_dialog_set_website_label(m_pAboutDialog, sLabel.isEmpty() ? nullptr : sLabel.getStr());
- }
-
- virtual OUString get_website_label() const override
- {
- const gchar* pText = gtk_about_dialog_get_website_label(m_pAboutDialog);
- return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8);
- }
-
- virtual void set_logo(const css::uno::Reference<css::graphic::XGraphic>& rImage) override
- {
- GdkPixbuf* pixbuf = rImage.is() ? getPixbuf(rImage) : nullptr;
- if (!pixbuf)
- gtk_about_dialog_set_logo(m_pAboutDialog, nullptr);
- else
- {
- gtk_about_dialog_set_logo(m_pAboutDialog, pixbuf);
- g_object_unref(pixbuf);
- }
- }
-
- virtual void set_background(const css::uno::Reference<css::graphic::XGraphic>& rImage) override
- {
- GtkStyleContext *pStyleContext = gtk_widget_get_style_context(GTK_WIDGET(m_pAboutDialog));
- if (m_pCssProvider)
- {
- gtk_style_context_remove_provider(pStyleContext, GTK_STYLE_PROVIDER(m_pCssProvider));
- m_pCssProvider= nullptr;
- }
-
- mxBackgroundImage.reset();
-
- if (rImage.is())
- {
- mxBackgroundImage.reset(new utl::TempFile());
- mxBackgroundImage->EnableKillingFile(true);
-
- Image aImage(rImage);
-
- vcl::PNGWriter aPNGWriter(aImage.GetBitmapEx());
- SvStream* pStream = mxBackgroundImage->GetStream(StreamMode::WRITE);
- aPNGWriter.Write(*pStream);
- mxBackgroundImage->CloseStream();
-
- m_pCssProvider = gtk_css_provider_new();
- OUString aBuffer = "* { background-image: url(\"" + mxBackgroundImage->GetURL() + "\"); }";
- OString aResult = OUStringToOString(aBuffer, RTL_TEXTENCODING_UTF8);
- gtk_css_provider_load_from_data(m_pCssProvider, aResult.getStr(), aResult.getLength(), nullptr);
- gtk_style_context_add_provider(pStyleContext, GTK_STYLE_PROVIDER(m_pCssProvider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- }
- }
-
- virtual ~GtkInstanceAboutDialog() override
- {
- set_background(nullptr);
- }
-};
-
class GtkInstanceAssistant : public GtkInstanceDialog, public virtual weld::Assistant
{
private:
@@ -14117,24 +14020,6 @@ private:
set_primary_text(pMessageDialog, (*m_pStringReplace)(get_primary_text(pMessageDialog)));
set_secondary_text(pMessageDialog, (*m_pStringReplace)(get_secondary_text(pMessageDialog)));
}
- else if (GTK_IS_ABOUT_DIALOG(pWindow))
- {
- GtkAboutDialog* pAboutDialog = GTK_ABOUT_DIALOG(pWindow);
- const gchar *pComments = gtk_about_dialog_get_comments(pAboutDialog);
- if (pComments)
- {
- OUString sComments(pComments, strlen(pComments), RTL_TEXTENCODING_UTF8);
- sComments = (*m_pStringReplace)(sComments);
- gtk_about_dialog_set_comments(pAboutDialog, OUStringToOString(sComments, RTL_TEXTENCODING_UTF8).getStr());
- }
- const gchar *pProgramName = gtk_about_dialog_get_program_name(pAboutDialog);
- if (pProgramName)
- {
- OUString sProgramName(pProgramName, strlen(pProgramName), RTL_TEXTENCODING_UTF8);
- sProgramName = (*m_pStringReplace)(sProgramName);
- gtk_about_dialog_set_program_name(pAboutDialog, OUStringToOString(sProgramName, RTL_TEXTENCODING_UTF8).getStr());
- }
- }
}
}
}
@@ -14283,15 +14168,6 @@ public:
return std::make_unique<GtkInstanceMessageDialog>(pMessageDialog, this, bTakeOwnership);
}
- virtual std::unique_ptr<weld::AboutDialog> weld_about_dialog(const OString &id, bool bTakeOwnership) override
- {
- GtkAboutDialog* pAboutDialog = GTK_ABOUT_DIALOG(gtk_builder_get_object(m_pBuilder, id.getStr()));
- if (!pAboutDialog)
- return nullptr;
- gtk_window_set_transient_for(GTK_WINDOW(pAboutDialog), GTK_WINDOW(gtk_widget_get_toplevel(m_pParentWidget)));
- return std::make_unique<GtkInstanceAboutDialog>(pAboutDialog, this, bTakeOwnership);
- }
-
virtual std::unique_ptr<weld::Assistant> weld_assistant(const OString &id, bool bTakeOwnership) override
{
GtkAssistant* pAssistant = GTK_ASSISTANT(gtk_builder_get_object(m_pBuilder, id.getStr()));