[Libreoffice-commits] core.git: Branch 'feature/gsoc14-personas' - cui/source cui/uiconfig

Rachit Gupta rachitgupta1792 at gmail.com
Fri Jun 20 05:49:41 PDT 2014


 cui/source/options/personalization.cxx   |   21 +++++++++------------
 cui/source/options/personalization.hxx   |    2 +-
 cui/uiconfig/ui/select_persona_dialog.ui |    4 ++++
 3 files changed, 14 insertions(+), 13 deletions(-)

New commits:
commit 84deacb87c1437d8409e4b7df4e182275f9723b8
Author: Rachit Gupta <rachitgupta1792 at gmail.com>
Date:   Fri Jun 20 15:38:26 2014 +0530

    Improved search: the images are displayed as they are downloaded.
    
    Previously, all the search result images were displayed in one go,
    but now the images are shown as they are downloaded.
    
    Change-Id: I95990f36c242a0c90bd2b2fd65fd76953f46bcc2

diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index e592126..f708d43 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -166,15 +166,10 @@ void SelectPersonaDialog::SetProgress( OUString& rProgress )
     }
 }
 
-void SelectPersonaDialog::SetImages( std::vector<Image> &rImageList )
+void SelectPersonaDialog::SetImages( Image aImage, sal_Int32 nIndex )
 {
-    sal_Int32 nCount = 0;
-    for( std::vector<Image>::iterator it=rImageList.begin(); it!=rImageList.end(); ++it )
-    {
-        m_vResultList[nCount]->Show();
-        m_vResultList[nCount]->SetModeImage( *it );
-        nCount++;
-    }
+    m_vResultList[nIndex]->Show();
+    m_vResultList[nIndex]->SetModeImage( aImage );
 }
 
 void SelectPersonaDialog::AddPersonaSetting( OUString& rPersonaSetting )
@@ -465,7 +460,7 @@ void SearchAndParseThread::execute()
 
         std::vector<OUString> vLearnmoreURLs = pHandler->getLearnmoreURLs();
         std::vector<OUString>::iterator it;
-        std::vector<Image> vResultList;
+        sal_Int32 nIndex = 0;
         GraphicFilter aFilter;
         Graphic aGraphic;
 
@@ -476,14 +471,16 @@ void SearchAndParseThread::execute()
             INetURLObject aURLObj( sPreviewFile );
             aFilter.ImportGraphic( aGraphic, aURLObj );
             Bitmap aBmp = aGraphic.GetBitmap();
-            vResultList.push_back( Image( aBmp ) );
+
+            // for VCL to be able to do visual changes in the thread
+            SolarMutexGuard aGuard;
+            m_pPersonaDialog->SetImages( Image( aBmp ), nIndex++ );
+            m_pPersonaDialog->setOptimalLayoutSize();
             m_pPersonaDialog->AddPersonaSetting( aPersonaSetting );
         }
 
-        // for VCL to be able to do visual changes in the thread
         SolarMutexGuard aGuard;
 
-        m_pPersonaDialog->SetImages( vResultList );
         sProgress = "";
         m_pPersonaDialog->SetProgress( sProgress );
         m_pPersonaDialog->setOptimalLayoutSize();
diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx
index fb26c70..da17122 100644
--- a/cui/source/options/personalization.hxx
+++ b/cui/source/options/personalization.hxx
@@ -87,7 +87,7 @@ public:
 
     OUString GetSelectedPersona() const;
     void SetProgress( OUString& );
-    void SetImages( std::vector<Image>&);
+    void SetImages( Image, sal_Int32 );
     void AddPersonaSetting( OUString& );
     void ClearSearchResults();
     void SetAppliedPersonaSetting( OUString& );
diff --git a/cui/uiconfig/ui/select_persona_dialog.ui b/cui/uiconfig/ui/select_persona_dialog.ui
index cf551dc..51d8bcb 100644
--- a/cui/uiconfig/ui/select_persona_dialog.ui
+++ b/cui/uiconfig/ui/select_persona_dialog.ui
@@ -154,6 +154,10 @@
                 <property name="vexpand">True</property>
                 <property name="row_spacing">6</property>
                 <property name="column_spacing">6</property>
+                <property name="width_request">624</property>
+                <property name="height_request">219</property>
+                <property name="row_homogeneous">True</property>
+                <property name="column_homogeneous">True</property>
                 <child>
                   <object class="GtkButton" id="result1">
                     <property name="can_focus">True</property>


More information about the Libreoffice-commits mailing list