From 479363562b2148481b3808250575379ca2c9c37e Mon Sep 17 00:00:00 2001 From: Heiko Tietze Date: Thu, 8 Oct 2020 11:29:10 +0200 Subject: Resolves tdf#135270 - Make the tight extensions dialog shiny Information rearranged, empty icons instead of hidden, background and scaling of thumbnail Change-Id: Iae095134a717cb50670bf5d1786774c6424d283e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104079 Tested-by: Jenkins Reviewed-by: Heiko Tietze --- cui/inc/strings.hrc | 2 - cui/source/dialogs/AdditionsDialog.cxx | 58 +++-- cui/source/inc/AdditionsDialog.hxx | 3 +- cui/uiconfig/ui/additionsdialog.ui | 31 +-- cui/uiconfig/ui/additionsfragment.ui | 402 +++++++++++++++++++-------------- icon-themes/breeze/links.txt | 3 + icon-themes/breeze_dark/links.txt | 3 + icon-themes/colibre/links.txt | 3 + icon-themes/elementary/links.txt | 3 + icon-themes/karasa_jaga/links.txt | 2 + icon-themes/sifr/links.txt | 3 + icon-themes/sifr_dark/links.txt | 3 + icon-themes/sukapura/links.txt | 3 + 13 files changed, 317 insertions(+), 202 deletions(-) diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc index e96e76e85fd2..19b7730b60a4 100644 --- a/cui/inc/strings.hrc +++ b/cui/inc/strings.hrc @@ -394,8 +394,6 @@ #define RID_SVXSTR_ADDITIONS_INSTALLBUTTON NC_("RID_SVXSTR_ADDITIONS_INSTALLBUTTON", "Install") #define RID_SVXSTR_ADDITIONS_INSTALLEDBUTTON NC_("RID_SVXSTR_ADDITIONS_INSTALLEDBUTTON", "Installed") #define RID_SVXSTR_ADDITIONS_INSTALLING NC_("RID_SVXSTR_ADDITIONS_INSTALLING", "Installing") -#define RID_SVXSTR_ADDITIONS_LICENCE NC_("RID_SVXSTR_ADDITIONS_LICENCE", "License:") -#define RID_SVXSTR_ADDITIONS_REQUIREDVERSION NC_("RID_SVXSTR_ADDITIONS_REQUIREDVERSION","Required version: >=") #define RID_SVXSTR_ADDITIONS_SEARCHING NC_("RID_SVXSTR_ADDITIONS_SEARCHING", "Searching...") #define RID_SVXSTR_ADDITIONS_LOADING NC_("RID_SVXSTR_ADDITIONS_LOADING", "Loading...") #define RID_SVXSTR_ADDITIONS_DIALOG_TITLE_PREFIX NC_("RID_SVXSTR_ADDITIONS_DIALOG_TITLE_PREFIX", "Extensions") diff --git a/cui/source/dialogs/AdditionsDialog.cxx b/cui/source/dialogs/AdditionsDialog.cxx index 7d5d953ad976..ad8f5de0928b 100644 --- a/cui/source/dialogs/AdditionsDialog.cxx +++ b/cui/source/dialogs/AdditionsDialog.cxx @@ -282,6 +282,8 @@ bool getPreviewFile(const AdditionInfo& aAdditionInfo, OUString& sPreviewFile) void LoadImage(const OUString& rPreviewFile, std::shared_ptr pCurrentItem) { + const sal_Int8 Margin = 6; + SolarMutexGuard aGuard; GraphicFilter aFilter; @@ -292,11 +294,30 @@ void LoadImage(const OUString& rPreviewFile, std::shared_ptr pCur // for VCL to be able to create bitmaps / do visual changes in the thread aFilter.ImportGraphic(aGraphic, aURLObj); BitmapEx aBmp = aGraphic.GetBitmapEx(); + Size aBmpSize = aBmp.GetSizePixel(); + Size aThumbSize(pCurrentItem->m_xImageScreenshot->get_size_request()); + if (!aBmp.IsEmpty()) + { + double aScale; + if (aBmpSize.Width() > aThumbSize.Width() - 2 * Margin) + { + aScale = static_cast(aBmpSize.Width()) / (aThumbSize.Width() - 2 * Margin); + aBmp.Scale(Size(aBmpSize.Width() / aScale, aBmpSize.Height() / aScale)); + } + else if (aBmpSize.Height() > aThumbSize.Height() - 2 * Margin) + { + aScale = static_cast(aBmpSize.Height()) / (aThumbSize.Height() - 2 * Margin); + aBmp.Scale(Size(aBmpSize.Width() / aScale, aBmpSize.Height() / aScale)); + }; + aBmpSize = aBmp.GetSizePixel(); + } ScopedVclPtr xVirDev = pCurrentItem->m_xImageScreenshot->create_virtual_device(); - xVirDev->SetOutputSizePixel(aBmp.GetSizePixel()); - xVirDev->DrawBitmapEx(Point(0, 0), aBmp); - + xVirDev->SetOutputSizePixel(aThumbSize); + //white background since images come with a white border + xVirDev->SetBackground(Wallpaper(COL_WHITE)); + xVirDev->Erase(); + xVirDev->DrawBitmapEx(Point(aThumbSize.Width() / 2 - aBmpSize.Width() / 2, Margin), aBmp); pCurrentItem->m_xImageScreenshot->set_image(xVirDev.get()); xVirDev.disposeAndClear(); } @@ -606,12 +627,13 @@ AdditionsItem::AdditionsItem(weld::Widget* pParent, AdditionsDialog* pParentDial , m_xContainer(m_xBuilder->weld_widget("additionsEntry")) , m_xImageScreenshot(m_xBuilder->weld_image("imageScreenshot")) , m_xButtonInstall(m_xBuilder->weld_button("buttonInstall")) - , m_xLinkButtonName(m_xBuilder->weld_link_button("linkButtonName")) + , m_xLinkButtonWebsite(m_xBuilder->weld_link_button("btnWebsite")) + , m_xLabelName(m_xBuilder->weld_label("lbName")) , m_xLabelAuthor(m_xBuilder->weld_label("labelAuthor")) , m_xLabelDesc(m_xBuilder->weld_label("labelDesc")) // no change (print description) , m_xLabelDescription(m_xBuilder->weld_label("labelDescription")) - , m_xLabelLicense(m_xBuilder->weld_label("labelLicense")) - , m_xLabelVersion(m_xBuilder->weld_label("labelVersion")) + , m_xLabelLicense(m_xBuilder->weld_label("lbLicenseText")) + , m_xLabelVersion(m_xBuilder->weld_label("lbVersionText")) , m_xLabelComments(m_xBuilder->weld_label("labelComments")) // no change , m_xLinkButtonComments(m_xBuilder->weld_link_button("linkButtonComments")) , m_xImageVoting1(m_xBuilder->weld_image("imageVoting1")) @@ -647,43 +669,37 @@ AdditionsItem::AdditionsItem(weld::Widget* pParent, AdditionsDialog* pParentDial sExtensionName = additionInfo.sName; } - m_xLinkButtonName->set_label(sExtensionName); + m_xLabelName->set_label(sExtensionName); double aExtensionRating = additionInfo.sRating.toDouble(); switch (int(aExtensionRating)) { case 5: - m_xImageVoting5->show(); + m_xImageVoting5->set_from_icon_name("cmd/sc_stars-full.png"); [[fallthrough]]; case 4: - m_xImageVoting4->show(); + m_xImageVoting4->set_from_icon_name("cmd/sc_stars-full.png"); [[fallthrough]]; case 3: - m_xImageVoting3->show(); + m_xImageVoting3->set_from_icon_name("cmd/sc_stars-full.png"); [[fallthrough]]; case 2: - m_xImageVoting2->show(); + m_xImageVoting2->set_from_icon_name("cmd/sc_stars-full.png"); [[fallthrough]]; case 1: - m_xImageVoting1->show(); - break; - case 0: - m_xLabelNoVoting->show(); + m_xImageVoting1->set_from_icon_name("cmd/sc_stars-full.png"); break; } - m_xLinkButtonName->set_uri(additionInfo.sExtensionURL); + m_xLinkButtonWebsite->set_uri(additionInfo.sExtensionURL); m_xLabelDescription->set_label(additionInfo.sIntroduction); if (!additionInfo.sAuthorName.equalsIgnoreAsciiCase("null")) m_xLabelAuthor->set_label(additionInfo.sAuthorName); m_xButtonInstall->set_label(CuiResId(RID_SVXSTR_ADDITIONS_INSTALLBUTTON)); - OUString sLicenseString = CuiResId(RID_SVXSTR_ADDITIONS_LICENCE) + additionInfo.sLicense; - m_xLabelLicense->set_label(sLicenseString); - OUString sVersionString - = CuiResId(RID_SVXSTR_ADDITIONS_REQUIREDVERSION) + additionInfo.sCompatibleVersion; - m_xLabelVersion->set_label(sVersionString); + m_xLabelLicense->set_label(additionInfo.sLicense); + m_xLabelVersion->set_label(">=" + additionInfo.sCompatibleVersion); m_xLinkButtonComments->set_label(additionInfo.sCommentNumber); m_xLinkButtonComments->set_uri(additionInfo.sCommentURL); m_xLabelDownloadNumber->set_label(additionInfo.sDownloadNumber); diff --git a/cui/source/inc/AdditionsDialog.hxx b/cui/source/inc/AdditionsDialog.hxx index 9596ed16955a..9b7ced9c75f4 100644 --- a/cui/source/inc/AdditionsDialog.hxx +++ b/cui/source/inc/AdditionsDialog.hxx @@ -124,7 +124,8 @@ public: std::unique_ptr m_xContainer; std::unique_ptr m_xImageScreenshot; std::unique_ptr m_xButtonInstall; - std::unique_ptr m_xLinkButtonName; + std::unique_ptr m_xLinkButtonWebsite; + std::unique_ptr m_xLabelName; std::unique_ptr m_xLabelAuthor; std::unique_ptr m_xLabelDesc; std::unique_ptr m_xLabelDescription; diff --git a/cui/uiconfig/ui/additionsdialog.ui b/cui/uiconfig/ui/additionsdialog.ui index 507410467960..d9a4a46632bc 100644 --- a/cui/uiconfig/ui/additionsdialog.ui +++ b/cui/uiconfig/ui/additionsdialog.ui @@ -1,12 +1,7 @@ - + - - True - False - cmd/sc_menubar.png - True False @@ -90,6 +85,11 @@ + + True + False + cmd/sc_menubar.png + 550 600 @@ -100,9 +100,6 @@ 300 400 dialog - - - False @@ -111,8 +108,7 @@ False - end - start + end 200 @@ -163,8 +159,8 @@ False - True - 0 + False + 1 @@ -243,11 +239,15 @@ True False start + True 6 12 + + + @@ -263,7 +263,7 @@ True True - 1 + 0 @@ -271,5 +271,8 @@ buttonClose + + + diff --git a/cui/uiconfig/ui/additionsfragment.ui b/cui/uiconfig/ui/additionsfragment.ui index b0a5d480fb44..6282c2bfe344 100644 --- a/cui/uiconfig/ui/additionsfragment.ui +++ b/cui/uiconfig/ui/additionsfragment.ui @@ -1,18 +1,21 @@ - + + True - False - 6 - 24 - 12 + False + start + True + 6 + 24 + 12 Show More Extensions - True - True + True + True ButtonShowMore @@ -21,43 +24,183 @@ - 0 - 1 + 0 + 1 + 2 + True - False - 3 - 12 - True + False + start + True + 12 - + + True + False + start + start + 3 + description + True + word-char + 40 + 40 + 0 + + + + + + 1 + 1 + 2 + + + + + True + False + start + Voting: + 0 + + + + + + + + + + 1 + 2 + + + + + True + False + start + License: + 0 + + + 1 + 3 + + + + + True + False + start + Required version: + 0 + + + 1 + 4 + + + + + True + False + start + Comments: + 0 + + + 1 + 5 + + + + + True + False + start + Downloads: + 0 + + + 1 + 6 + + + + + True + False + start + label + 0 + + + 2 + 6 + + + + button True - True - True + True + True start none + 0 http://glade.gnome.org - 0 - 0 + 2 + 5 + + + + + True + False + start + label + 0 + + + 2 + 4 + + + + + True + False + start + label + 0 + + + 2 + 3 True - False - end + False + start + center True - False + True + False start - cmd/sc_starshapes.png + center + cmd/sc_stars-empty.png @@ -70,9 +213,11 @@ - False + True + False start - cmd/sc_starshapes.png + center + cmd/sc_stars-empty.png @@ -84,10 +229,12 @@ - - False + + True + False start - cmd/sc_starshapes.png + center + cmd/sc_stars-empty.png @@ -99,10 +246,12 @@ - - False + + True + False start - cmd/sc_starshapes.png + center + cmd/sc_stars-empty.png @@ -115,9 +264,11 @@ - False + True + False start - cmd/sc_starshapes.png + center + cmd/sc_stars-empty.png @@ -128,116 +279,50 @@ 4 - - - False - Vote - - - - - - - - - - True - True - 5 - - - 1 - 0 + 2 + 2 + 180 + 120 True - False + False center - True - - - - - - 0 - 1 - 2 - - - - - True - False - start start - description - True - word-char - 1 - 50 - - - - - - 0 - 2 - 2 - - - - - True - False - start - label - - - 0 - 3 - - - - - True - False - start - label - - - 0 - 4 - - - - - button - True - True - True - end + 6 + 6 + 12 + 12 + True + True + 0 + + + - 0 - 5 - 2 + 0 + 1 + 6 True - False - start - 3 + False + 6 + True - + + Install True - False - Downloads: + True + True + end False @@ -246,11 +331,13 @@ - + + Website True - False - start - label + True + True + none + http://glade.gnome.org False @@ -260,52 +347,39 @@ - 1 - 4 + 1 + 7 + 2 - + True - False - 6 - - - True - False - Comments: - - - False - True - 0 - - - - - button - True - True - True - none - http://glade.gnome.org - - - False - True - 1 - - + False + 6 + Name + 0 + + + - 1 - 3 + 1 + 0 + 2 + + + + + + - 0 - 0 + 0 + 0 + 2 diff --git a/icon-themes/breeze/links.txt b/icon-themes/breeze/links.txt index da539638744f..956cb8695b49 100644 --- a/icon-themes/breeze/links.txt +++ b/icon-themes/breeze/links.txt @@ -2891,3 +2891,6 @@ cmd/sc_librelogo-translate.png cmd/sc_editglossary.png cmd/32/openxmlfiltersettings.png cmd/32/managexmlsource.png cmd/lc_openxmlfiltersettings.png cmd/lc_managexmlsource.png cmd/sc_openxmlfiltersettings.png cmd/sc_managexmlsource.png + +cmd/sc_stars-full.png sc/res/icon-set-stars-full.png +cmd/sc_stars-empty.png sc/res/icon-set-stars-empty.png \ No newline at end of file diff --git a/icon-themes/breeze_dark/links.txt b/icon-themes/breeze_dark/links.txt index da539638744f..956cb8695b49 100644 --- a/icon-themes/breeze_dark/links.txt +++ b/icon-themes/breeze_dark/links.txt @@ -2891,3 +2891,6 @@ cmd/sc_librelogo-translate.png cmd/sc_editglossary.png cmd/32/openxmlfiltersettings.png cmd/32/managexmlsource.png cmd/lc_openxmlfiltersettings.png cmd/lc_managexmlsource.png cmd/sc_openxmlfiltersettings.png cmd/sc_managexmlsource.png + +cmd/sc_stars-full.png sc/res/icon-set-stars-full.png +cmd/sc_stars-empty.png sc/res/icon-set-stars-empty.png \ No newline at end of file diff --git a/icon-themes/colibre/links.txt b/icon-themes/colibre/links.txt index ddfd302ad49b..c7940461e7c6 100644 --- a/icon-themes/colibre/links.txt +++ b/icon-themes/colibre/links.txt @@ -2739,3 +2739,6 @@ cmd/sc_librelogo-goforward.png cmd/sc_arrowshapes.up-arrow.png cmd/sc_librelogo-run.png cmd/sc_runbasic.png cmd/sc_librelogo-stop.png cmd/sc_basicstop.png cmd/sc_librelogo-translate.png cmd/sc_editglossary.png + +cmd/sc_stars-full.png sc/res/icon-set-stars-full.png +cmd/sc_stars-empty.png sc/res/icon-set-stars-empty.png \ No newline at end of file diff --git a/icon-themes/elementary/links.txt b/icon-themes/elementary/links.txt index cbf9285da324..2d719c46f9aa 100644 --- a/icon-themes/elementary/links.txt +++ b/icon-themes/elementary/links.txt @@ -2718,3 +2718,6 @@ cmd/sc_renametable.png cmd/sc_name.png cmd/32/textattributes.png cmd/32/fontdialog.png cmd/lc_textattributes.png cmd/lc_fontdialog.png cmd/sc_textattributes.png cmd/sc_fontdialog.png + +cmd/sc_stars-full.png sc/res/icon-set-stars-full.png +cmd/sc_stars-empty.png sc/res/icon-set-stars-empty.png \ No newline at end of file diff --git a/icon-themes/karasa_jaga/links.txt b/icon-themes/karasa_jaga/links.txt index fd42bb93b488..508747392151 100644 --- a/icon-themes/karasa_jaga/links.txt +++ b/icon-themes/karasa_jaga/links.txt @@ -2072,3 +2072,5 @@ vcl/res/radio5.png vcl/res/radio3.png vcl/source/src/msgbox.png vcl/res/msgbox.png xmlsecurity/res/notcertificate_16.png svx/res/notcertificate_16.png xmlsecurity/res/signet_11x16.png svx/res/signet_11x16.png +cmd/sc_stars-full.png sc/res/icon-set-stars-full.png +cmd/sc_stars-empty.png sc/res/icon-set-stars-empty.png \ No newline at end of file diff --git a/icon-themes/sifr/links.txt b/icon-themes/sifr/links.txt index 1c706c9fbdbe..72c775dacc05 100644 --- a/icon-themes/sifr/links.txt +++ b/icon-themes/sifr/links.txt @@ -2716,3 +2716,6 @@ cmd/sc_librelogo-home.png cmd/sc_firstpage.png cmd/sc_librelogo-run.png cmd/sc_mediaplay.png cmd/sc_librelogo-stop.png cmd/sc_basicstop.png cmd/sc_librelogo-translate.png cmd/sc_editglossary.png + +cmd/sc_stars-full.png sc/res/icon-set-stars-full.png +cmd/sc_stars-empty.png sc/res/icon-set-stars-empty.png \ No newline at end of file diff --git a/icon-themes/sifr_dark/links.txt b/icon-themes/sifr_dark/links.txt index 1c706c9fbdbe..72c775dacc05 100644 --- a/icon-themes/sifr_dark/links.txt +++ b/icon-themes/sifr_dark/links.txt @@ -2716,3 +2716,6 @@ cmd/sc_librelogo-home.png cmd/sc_firstpage.png cmd/sc_librelogo-run.png cmd/sc_mediaplay.png cmd/sc_librelogo-stop.png cmd/sc_basicstop.png cmd/sc_librelogo-translate.png cmd/sc_editglossary.png + +cmd/sc_stars-full.png sc/res/icon-set-stars-full.png +cmd/sc_stars-empty.png sc/res/icon-set-stars-empty.png \ No newline at end of file diff --git a/icon-themes/sukapura/links.txt b/icon-themes/sukapura/links.txt index c525d3667831..91299506e883 100644 --- a/icon-themes/sukapura/links.txt +++ b/icon-themes/sukapura/links.txt @@ -2720,3 +2720,6 @@ cmd/lc_librelogo-translate.png cmd/lc_editglossary.png cmd/sc_librelogo-run.png cmd/sc_runbasic.png cmd/sc_librelogo-stop.png cmd/sc_basicstop.png cmd/sc_librelogo-translate.png cmd/sc_editglossary.png + +cmd/sc_stars-full.png sc/res/icon-set-stars-full.png +cmd/sc_stars-empty.png sc/res/icon-set-stars-empty.png \ No newline at end of file -- cgit v1.2.3