cui/source/dialogs/AdditionsDialog.cxx |   30 +++++++++
 cui/source/inc/AdditionsDialog.hxx     |    7 +-
 cui/uiconfig/ui/additionsfragment.ui   |  101 ++++++++++++++++++++++++++++++---
 3 files changed, 129 insertions(+), 9 deletions(-)

New commits:
commit 48a796c5bbdf897228eb4125512e4f80527f4b55
Author:     Yusuf Keten <ketenyu...@gmail.com>
AuthorDate: Wed Aug 19 19:36:58 2020 +0300
Commit:     Muhammet Kara <muhammet.k...@collabora.com>
CommitDate: Mon Aug 24 21:45:07 2020 +0200

    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.k...@collabora.com>

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;
diff --git a/cui/uiconfig/ui/additionsfragment.ui 
b/cui/uiconfig/ui/additionsfragment.ui
index 2b4c23dff55b..93c8e50ad126 100644
--- a/cui/uiconfig/ui/additionsfragment.ui
+++ b/cui/uiconfig/ui/additionsfragment.ui
@@ -132,7 +132,6 @@
                 <property name="max_width_chars">50</property>
                 <accessibility>
                   <relation type="label-for" target="imageScreenshot"/>
-                  <relation type="label-for" target="imageVoting"/>
                 </accessibility>
               </object>
               <packing>
@@ -209,14 +208,102 @@
               </packing>
             </child>
             <child>
-              <object class="GtkImage" id="imageVoting">
+              <object class="GtkBox">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="halign">start</property>
-                <property name="stock">gtk-about</property>
-                <accessibility>
-                  <relation type="labelled-by" target="labelDescription"/>
-                </accessibility>
+                <child>
+                  <object class="GtkImage" id="imageVoting1">
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="stock">gtk-about</property>
+                    <accessibility>
+                      <relation type="labelled-by" target="votingLabel"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkImage" id="imageVoting2">
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="stock">gtk-about</property>
+                    <accessibility>
+                      <relation type="labelled-by" target="votingLabel"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkImage" id="imageVoting4">
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="stock">gtk-about</property>
+                    <accessibility>
+                      <relation type="labelled-by" target="votingLabel"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkImage" id="imageVoting3">
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="stock">gtk-about</property>
+                    <accessibility>
+                      <relation type="labelled-by" target="votingLabel"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkImage" id="imageVoting5">
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="stock">gtk-about</property>
+                    <accessibility>
+                      <relation type="labelled-by" target="votingLabel"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="votingLabel">
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes" 
context="additionsEntry|votingLabel">No Voting</property>
+                    <accessibility>
+                      <relation type="label-for" target="imageVoting1"/>
+                      <relation type="label-for" target="imageVoting2"/>
+                      <relation type="label-for" target="imageVoting4"/>
+                      <relation type="label-for" target="imageVoting3"/>
+                      <relation type="label-for" target="imageVoting5"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">5</property>
+                  </packing>
+                </child>
               </object>
               <packing>
                 <property name="expand">False</property>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to