diff options
author | Yusuf Keten <ketenyusuf@gmail.com> | 2020-08-19 19:36:58 +0300 |
---|---|---|
committer | Muhammet Kara <muhammet.kara@collabora.com> | 2020-08-24 21:45:07 +0200 |
commit | 48a796c5bbdf897228eb4125512e4f80527f4b55 (patch) | |
tree | 66eb0b29262580cbd2ffd71978f394533a81a23b /cui/source | |
parent | 403d5a8889913ff2c15eff35643cbb3dcc514132 (diff) |
tdf#133026: Additions: Rating image implementation
Change-Id: Id250f0e70490941743e0f3ca2b94897f69a9208f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101013
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/dialogs/AdditionsDialog.cxx | 30 | ||||
-rw-r--r-- | cui/source/inc/AdditionsDialog.hxx | 7 |
2 files changed, 35 insertions, 2 deletions
diff --git a/cui/source/dialogs/AdditionsDialog.cxx b/cui/source/dialogs/AdditionsDialog.cxx index f57031511404..680e519a60d0 100644 --- a/cui/source/dialogs/AdditionsDialog.cxx +++ b/cui/source/dialogs/AdditionsDialog.cxx @@ -592,7 +592,12 @@ AdditionsItem::AdditionsItem(weld::Widget* pParent, AdditionsDialog* pParentDial , m_xLabelVersion(m_xBuilder->weld_label("labelVersion")) , m_xLabelComments(m_xBuilder->weld_label("labelComments")) // no change , m_xLinkButtonComments(m_xBuilder->weld_link_button("linkButtonComments")) - , m_xImageVoting(m_xBuilder->weld_image("imageVoting")) + , m_xImageVoting1(m_xBuilder->weld_image("imageVoting1")) + , m_xImageVoting2(m_xBuilder->weld_image("imageVoting2")) + , m_xImageVoting3(m_xBuilder->weld_image("imageVoting3")) + , m_xImageVoting4(m_xBuilder->weld_image("imageVoting4")) + , m_xImageVoting5(m_xBuilder->weld_image("imageVoting5")) + , m_xLabelNoVoting(m_xBuilder->weld_label("votingLabel")) , m_xImageDownloadNumber(m_xBuilder->weld_image("imageDownloadNumber")) , m_xLabelDownloadNumber(m_xBuilder->weld_label("labelDownloadNumber")) , m_xButtonShowMore(m_xBuilder->weld_button("buttonShowMore")) @@ -622,6 +627,29 @@ AdditionsItem::AdditionsItem(weld::Widget* pParent, AdditionsDialog* pParentDial m_xLinkButtonName->set_label(sExtensionName); + double aExtensionRating = additionInfo.sRating.toDouble(); + switch (int(aExtensionRating)) + { + case 5: + m_xImageVoting5->show(); + [[fallthrough]]; + case 4: + m_xImageVoting4->show(); + [[fallthrough]]; + case 3: + m_xImageVoting3->show(); + [[fallthrough]]; + case 2: + m_xImageVoting2->show(); + [[fallthrough]]; + case 1: + m_xImageVoting1->show(); + break; + case 0: + m_xLabelNoVoting->show(); + break; + } + m_xLinkButtonName->set_uri(additionInfo.sExtensionURL); m_xLabelDescription->set_label(additionInfo.sIntroduction); m_xLabelAuthor->set_label(additionInfo.sAuthorName); diff --git a/cui/source/inc/AdditionsDialog.hxx b/cui/source/inc/AdditionsDialog.hxx index 5b7089b9b6c5..9061b755a5be 100644 --- a/cui/source/inc/AdditionsDialog.hxx +++ b/cui/source/inc/AdditionsDialog.hxx @@ -126,7 +126,12 @@ public: std::unique_ptr<weld::Label> m_xLabelVersion; std::unique_ptr<weld::Label> m_xLabelComments; std::unique_ptr<weld::LinkButton> m_xLinkButtonComments; - std::unique_ptr<weld::Image> m_xImageVoting; + std::unique_ptr<weld::Image> m_xImageVoting1; + std::unique_ptr<weld::Image> m_xImageVoting2; + std::unique_ptr<weld::Image> m_xImageVoting3; + std::unique_ptr<weld::Image> m_xImageVoting4; + std::unique_ptr<weld::Image> m_xImageVoting5; + std::unique_ptr<weld::Label> m_xLabelNoVoting; std::unique_ptr<weld::Image> m_xImageDownloadNumber; std::unique_ptr<weld::Label> m_xLabelDownloadNumber; std::unique_ptr<weld::Button> m_xButtonShowMore; |