[Libreoffice-commits] core.git: Branch 'feature/gsoc14-personas' - cui/source cui/uiconfig vcl/source
cui/source/options/personalization.cxx | 20 +++- cui/source/options/personalization.hxx |4 cui/uiconfig/ui/personalization_tab.ui | 137 ++--- vcl/source/app/settings.cxx|4 4 files changed, 99 insertions(+), 66 deletions(-) New commits: commit e23bd6a56c5f9868d042ee79c4810ac47d41745b Author: Rachit Gupta rachitgupta1...@gmail.com Date: Tue Jul 1 15:30:44 2014 +0530 Moved the personas installed through extensions handling to 'own'. Change-Id: I12baaf22bfad73e228d3ed55dcf365f8eba9cf0a diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index dd96fd4..616fd14 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -245,15 +245,16 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage( Window *pParent, const Sfx m_vDefaultPersonaImages[2]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); get( m_vExtensionPersonas[0], extension1 ); -m_vExtensionPersonas[0]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); +m_vExtensionPersonas[0]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, InstalledPersona ) ); get( m_vExtensionPersonas[1], extension2 ); -m_vExtensionPersonas[1]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); +m_vExtensionPersonas[1]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, InstalledPersona ) ); get( m_vExtensionPersonas[2], extension3 ); -m_vExtensionPersonas[2]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); +m_vExtensionPersonas[2]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, InstalledPersona ) ); LoadDefaultImages(); +LoadExtensionImages(); } SvxPersonalizationTabPage::~SvxPersonalizationTabPage() @@ -360,13 +361,18 @@ void SvxPersonalizationTabPage::LoadDefaultImages() m_vDefaultPersonaImages[nIndex]-Show(); m_vDefaultPersonaImages[nIndex++]-SetModeImage( Image( aBmp ) ); } +} +void SvxPersonalizationTabPage::LoadExtensionImages() +{ // See if any extensions are used to install personas. If yes, load them. +GraphicFilter aFilter; +Graphic aGraphic; +sal_Int32 nIndex = 0; css::uno::SequenceOUString installedPersonas( officecfg::Office::Common::Misc::PersonasList::get()-getElementNames() ); sal_Int32 nLength = installedPersonas.getLength(); sal_Int32 nCount = 0; -nIndex = 0; if( nLength == 0 ) return; @@ -442,6 +448,12 @@ IMPL_LINK( SvxPersonalizationTabPage, DefaultPersona, PushButton*, pButton ) m_aPersonaSettings = m_vDefaultPersonaSettings[nIndex]; } +return 0; +} + +IMPL_LINK( SvxPersonalizationTabPage, InstalledPersona, PushButton*, pButton ) +{ +m_pOwnPersona-Check(); for( sal_Int32 nIndex = 0; nIndex 3; nIndex++ ) { if( pButton == m_vExtensionPersonas[nIndex] ) diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx index 0865037..d5e4bcf 100644 --- a/cui/source/options/personalization.hxx +++ b/cui/source/options/personalization.hxx @@ -52,6 +52,7 @@ public: void SetPersonaSettings( const OUString ); void LoadDefaultImages(); +void LoadExtensionImages(); private: /// Handle the Persona selection @@ -62,6 +63,9 @@ private: /// Handle the default Persona selection DECL_LINK( DefaultPersona, PushButton* ); + +/// Handle the Personas installed through extensions selection +DECL_LINK( InstalledPersona, PushButton* ); }; /** Dialog that will allow the user to choose a Persona to use. diff --git a/cui/uiconfig/ui/personalization_tab.ui b/cui/uiconfig/ui/personalization_tab.ui index e2f4332..2b53e02 100644 --- a/cui/uiconfig/ui/personalization_tab.ui +++ b/cui/uiconfig/ui/personalization_tab.ui @@ -58,11 +58,9 @@ /packing /child child - object class=GtkGrid id=grid1 + object class=GtkBox id=box1 property name=visibleTrue/property property name=can_focusFalse/property -property name=row_spacing6/property -property name=column_spacing6/property child object class=GtkButton id=default1 property name=can_focusTrue/property @@ -71,10 +69,9 @@ property name=vexpandTrue/property /object packing -property name=left_attach0/property -property name=top_attach0/property -property name=width1/property -property name=height1/property +property name=expandFalse/property +property name=fillTrue/property +
[Libreoffice-commits] core.git: Branch 'feature/gsoc14-personas' - cui/source cui/uiconfig
cui/source/options/personalization.cxx | 63 +++-- cui/source/options/personalization.hxx | 19 + cui/uiconfig/ui/personalization_tab.ui | 29 +++ 3 files changed, 46 insertions(+), 65 deletions(-) New commits: commit 7b6d0027af81b406014226bc0172d0646be545c5 Author: Rachit Gupta rachitgupta1...@gmail.com Date: Tue Jul 1 18:27:42 2014 +0530 Changed Personas installed through extensions procedure. The UI now consists of a TreeView that lists all the personas that were installed through extensions. When the user selects any name from the list, the preview is shown in a button besides the list. If there are no extensions installed, the list stays hidden. Change-Id: I030d99549fd5b15d1104224116257ad62cdd1891 diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 616fd14..0bc8fb5 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -21,6 +21,7 @@ #include tools/urlobj.hxx #include vcl/edit.hxx #include vcl/msgbox.hxx +#include vcl/lstbox.hxx #include vcl/svapp.hxx #include vcl/settings.hxx #include vcl/graphicfilter.hxx @@ -244,17 +245,13 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage( Window *pParent, const Sfx get( m_vDefaultPersonaImages[2], default3 ); m_vDefaultPersonaImages[2]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); -get( m_vExtensionPersonas[0], extension1 ); -m_vExtensionPersonas[0]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, InstalledPersona ) ); +get( m_pPersonaList, installed_personas ); +m_pPersonaList-SetSelectHdl( LINK( this, SvxPersonalizationTabPage, SelectInstalledPersona ) ); -get( m_vExtensionPersonas[1], extension2 ); -m_vExtensionPersonas[1]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, InstalledPersona ) ); - -get( m_vExtensionPersonas[2], extension3 ); -m_vExtensionPersonas[2]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, InstalledPersona ) ); +get( m_pExtensionPersonaPreview, persona_preview ); LoadDefaultImages(); -LoadExtensionImages(); +LoadExtensionThemes(); } SvxPersonalizationTabPage::~SvxPersonalizationTabPage() @@ -363,37 +360,28 @@ void SvxPersonalizationTabPage::LoadDefaultImages() } } -void SvxPersonalizationTabPage::LoadExtensionImages() +void SvxPersonalizationTabPage::LoadExtensionThemes() { // See if any extensions are used to install personas. If yes, load them. -GraphicFilter aFilter; -Graphic aGraphic; -sal_Int32 nIndex = 0; css::uno::SequenceOUString installedPersonas( officecfg::Office::Common::Misc::PersonasList::get()-getElementNames() ); sal_Int32 nLength = installedPersonas.getLength(); -sal_Int32 nCount = 0; if( nLength == 0 ) return; -if( nLength 3 ) -nIndex = nLength - 3; +m_pPersonaList-Show(); -for( ; nIndex nLength; nIndex++ ) +for( sal_Int32 nIndex = 0; nIndex nLength; nIndex++ ) { Reference XPropertySet xPropertySet( officecfg::Office::Common::Misc::PersonasList::get()-getByName( installedPersonas[nIndex] ), UNO_QUERY_THROW ); OUString aPersonaName, aPreviewFile, aHeaderFile, aFooterFile, aTextColor, aAccentColor, aPersonaSettings; -Any aValue = xPropertySet-getPropertyValue( Preview ); -aValue = aPreviewFile; -INetURLObject aURLObj( aPreviewFile ); -aFilter.ImportGraphic( aGraphic, aURLObj ); -Bitmap aBmp = aGraphic.GetBitmap(); -m_vExtensionPersonas[nCount]-Show(); -m_vExtensionPersonas[nCount++]-SetModeImage( Image( aBmp ) ); - -aValue = xPropertySet-getPropertyValue( Name ); +Any aValue = xPropertySet-getPropertyValue( Name ); aValue = aPersonaName; +m_pPersonaList-InsertEntry( aPersonaName ); + +aValue = xPropertySet-getPropertyValue( Preview ); +aValue = aPreviewFile; aValue = xPropertySet-getPropertyValue( Header ); aValue = aHeaderFile; @@ -407,7 +395,7 @@ void SvxPersonalizationTabPage::LoadExtensionImages() aValue = xPropertySet-getPropertyValue( AccentColor ); aValue = aAccentColor; -aPersonaSettings = aHeaderFile + ; + aFooterFile + ; + aTextColor + ; + aAccentColor; +aPersonaSettings = aPreviewFile + ; + aHeaderFile + ; + aFooterFile + ; + aTextColor + ; + aAccentColor; rtl::Bootstrap::expandMacros( aPersonaSettings ); m_vExtensionPersonaSettings.push_back( aPersonaSettings ); } @@ -451,14 +439,23 @@ IMPL_LINK( SvxPersonalizationTabPage, DefaultPersona, PushButton*, pButton ) return 0; } -IMPL_LINK( SvxPersonalizationTabPage, InstalledPersona, PushButton*, pButton ) +IMPL_LINK( SvxPersonalizationTabPage, SelectInstalledPersona, ListBox*, ) { -m_pOwnPersona-Check(); -for( sal_Int32 nIndex = 0; nIndex 3;
[Libreoffice-commits] core.git: Branch 'feature/gsoc14-personas' - cui/source cui/uiconfig officecfg/registry vcl/source
cui/source/options/personalization.cxx | 54 + cui/source/options/personalization.hxx |2 cui/uiconfig/ui/personalization_tab.ui | 76 + officecfg/registry/schema/org/openoffice/Office/Common.xcs | 23 +++ vcl/source/app/settings.cxx|2 5 files changed, 137 insertions(+), 20 deletions(-) New commits: commit e62172ebbe41e0fe184e8a65c84dbd06f87bb01b Author: Rachit Gupta rachitgupta1...@gmail.com Date: Fri Jun 27 23:52:42 2014 +0530 The Personas can be install through oxt extensions. The user can install an oxt extension and choose his/her theme from the Personalization page. * Created a template in Common.xcs registry to hold the values for the PersonasList set. * Added 3 buttons to personalization_tab.ui to incorporate the latest 3 personas installed through extensions. * Currently, only 3 installed personas are shown alongwith the default available personas. Change-Id: I30a40ae48d17f4ed8caef33854ef88afcbec5a54 diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index ec7..1cc8b75 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -14,6 +14,8 @@ #include comphelper/processfactory.hxx #include officecfg/Office/Common.hxx +#include com/sun/star/container/XNameAccess.hpp +#include com/sun/star/beans/XPropertySet.hpp #include osl/file.hxx #include rtl/bootstrap.hxx #include tools/urlobj.hxx @@ -31,6 +33,7 @@ using namespace com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ucb; +using namespace ::com::sun::star::beans; SelectPersonaDialog::SelectPersonaDialog( Window *pParent ) : ModalDialog( pParent, SelectPersonaDialog, cui/ui/select_persona_dialog.ui ) @@ -241,6 +244,15 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage( Window *pParent, const Sfx get( m_vDefaultPersonaImages[2], default3 ); m_vDefaultPersonaImages[2]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); +get( m_vExtensionPersonas[0], extension1 ); +m_vExtensionPersonas[0]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + +get( m_vExtensionPersonas[1], extension2 ); +m_vExtensionPersonas[1]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + +get( m_vExtensionPersonas[2], extension3 ); +m_vExtensionPersonas[2]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + LoadDefaultImages(); } @@ -273,7 +285,6 @@ bool SvxPersonalizationTabPage::FillItemSet( SfxItemSet ) // write boost::shared_ptr comphelper::ConfigurationChanges batch( comphelper::ConfigurationChanges::create() ); - officecfg::Office::Common::Misc::Persona::set( aPersona, batch ); officecfg::Office::Common::Misc::PersonaSettings::set( m_aPersonaSettings, batch ); batch-commit(); @@ -316,6 +327,8 @@ void SvxPersonalizationTabPage::SetPersonaSettings( const OUString aPersonaSetti void SvxPersonalizationTabPage::LoadDefaultImages() { +// Load the pre saved personas + OUString gallery( ); gallery = $BRAND_BASE_DIR/ LIBO_SHARE_FOLDER; gallery += /gallery/personas/; @@ -345,6 +358,38 @@ void SvxPersonalizationTabPage::LoadDefaultImages() m_vDefaultPersonaImages[nIndex]-Show(); m_vDefaultPersonaImages[nIndex++]-SetModeImage( Image( aBmp ) ); } + +// See if any extensions are used to install personas. If yes, load them. + +css::uno::SequenceOUString installedPersonas( officecfg::Office::Common::Misc::PersonasList::get()-getElementNames() ); +sal_Int32 nLength = installedPersonas.getLength(); +sal_Int32 nCount = 0; +nIndex = 0; + +if( nLength == 0 ) +return; + +if( nLength 3 ) +nIndex = nLength - 3; + +for( ; nIndex nLength; nIndex++ ) +{ +Reference XPropertySet xPropertySet( officecfg::Office::Common::Misc::PersonasList::get()-getByName( installedPersonas[nIndex] ), UNO_QUERY_THROW ); +Any aValue = xPropertySet-getPropertyValue( PersonaPreview ); +OUString aPreviewFile; +aValue = aPreviewFile; +INetURLObject aURLObj( aPreviewFile ); +aFilter.ImportGraphic( aGraphic, aURLObj ); +Bitmap aBmp = aGraphic.GetBitmap(); +m_vExtensionPersonas[nCount]-Show(); +m_vExtensionPersonas[nCount++]-SetModeImage( Image( aBmp ) ); + +aValue = xPropertySet-getPropertyValue( PersonaSettings ); +OUString sPersonaSettings; +aValue = sPersonaSettings; +rtl::Bootstrap::expandMacros( sPersonaSettings ); +m_vExtensionPersonaSettings.push_back( sPersonaSettings ); +} } IMPL_LINK( SvxPersonalizationTabPage, SelectPersona, PushButton*, /*pButton*/ ) @@ -381,6 +426,13 @@ IMPL_LINK(
[Libreoffice-commits] core.git: Branch 'feature/gsoc14-personas' - cui/source cui/uiconfig
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 rachitgupta1...@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::vectorImage rImageList ) +void SelectPersonaDialog::SetImages( Image aImage, sal_Int32 nIndex ) { -sal_Int32 nCount = 0; -for( std::vectorImage::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::vectorOUString vLearnmoreURLs = pHandler-getLearnmoreURLs(); std::vectorOUString::iterator it; -std::vectorImage 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::vectorImage); +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=vexpandTrue/property property name=row_spacing6/property property name=column_spacing6/property +property name=width_request624/property +property name=height_request219/property +property name=row_homogeneousTrue/property +property name=column_homogeneousTrue/property child object class=GtkButton id=result1 property name=can_focusTrue/property ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/gsoc14-personas' - cui/source cui/uiconfig
cui/source/options/personalization.cxx | 38 ++ cui/source/options/personalization.hxx |1 cui/uiconfig/ui/select_persona_dialog.ui | 110 +-- 3 files changed, 142 insertions(+), 7 deletions(-) New commits: commit cb5236f244cc7231816af3c191be3987daf3c673 Author: Rachit Gupta rachitgupta1...@gmail.com Date: Fri Jun 20 21:20:37 2014 +0530 Added some pre-defined search terms. The user can now enter his/her own search term or can use the commonly used search terms to browse for themes. Change-Id: Ife4ad6b820784a6321f5b916a0069a915c114c7e diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index f708d43..ec7 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -38,6 +38,26 @@ SelectPersonaDialog::SelectPersonaDialog( Window *pParent ) get( m_pSearchButton, search_personas ); m_pSearchButton-SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); +get( m_vSearchSuggestions[0], suggestion1 ); +m_vSearchSuggestions[0]-SetText( libreoffice ); +m_vSearchSuggestions[0]-SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); + +get( m_vSearchSuggestions[1], suggestion2 ); +m_vSearchSuggestions[1]-SetText( science ); +m_vSearchSuggestions[1]-SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); + +get( m_vSearchSuggestions[2], suggestion3 ); +m_vSearchSuggestions[2]-SetText( firefox ); +m_vSearchSuggestions[2]-SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); + +get( m_vSearchSuggestions[3], suggestion4 ); +m_vSearchSuggestions[3]-SetText( nasa ); +m_vSearchSuggestions[3]-SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); + +get( m_vSearchSuggestions[4], suggestion5 ); +m_vSearchSuggestions[4]-SetText( harry potter ); +m_vSearchSuggestions[4]-SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); + get( m_pEdit, search_term ); m_pEdit-SetPlaceholderText( Search term... ); @@ -85,9 +105,23 @@ OUString SelectPersonaDialog::GetSelectedPersona() const return OUString(); } -IMPL_LINK( SelectPersonaDialog, SearchPersonas, PushButton*, /*pButton*/ ) +IMPL_LINK( SelectPersonaDialog, SearchPersonas, PushButton*, pButton ) { -OUString searchTerm = m_pEdit-GetText(); +OUString searchTerm; +if( pButton == m_pSearchButton) +searchTerm = m_pEdit-GetText(); +else +{ +for( sal_Int32 nIndex = 0; nIndex 5; nIndex++ ) +{ +if( pButton == m_vSearchSuggestions[nIndex] ) +{ +searchTerm = m_vSearchSuggestions[nIndex]-GetDisplayText(); +break; +} +} +} + if( searchTerm.isEmpty( ) ) return 0; diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx index da17122..8e0520e 100644 --- a/cui/source/options/personalization.hxx +++ b/cui/source/options/personalization.hxx @@ -74,6 +74,7 @@ private: PushButton *m_pSearchButton;/// The search button FixedText *m_pProgressLabel;/// The label for showing progress of search PushButton *m_vResultList[9]; /// List of buttons to show search results +PushButton *m_vSearchSuggestions[9];/// List of buttons for the search suggestions PushButton *m_pOkButton;/// The OK button PushButton *m_pCancelButton;/// The Cancel button diff --git a/cui/uiconfig/ui/select_persona_dialog.ui b/cui/uiconfig/ui/select_persona_dialog.ui index 51d8bcb..7497c5f 100644 --- a/cui/uiconfig/ui/select_persona_dialog.ui +++ b/cui/uiconfig/ui/select_persona_dialog.ui @@ -104,7 +104,6 @@ property name=can_focusTrue/property property name=hexpandTrue/property property name=invisible_charâ/property -property name=invisible_char_setTrue/property property name=primary_icon_activatableFalse/property property name=secondary_icon_activatableFalse/property /object @@ -136,9 +135,12 @@ /packing /child child - object class=GtkLabel id=progress_label + object class=GtkLabel id=label2 property name=visibleTrue/property property name=can_focusFalse/property +property name=xalign0/property +property name=label translatable=yesOr, use these commonly used terms to _browse themes:/property +property name=use_underlineTrue/property /object packing property name=expandFalse/property @@ -147,15 +149,113 @@ /packing /child child + object class=GtkBox
[Libreoffice-commits] core.git: Branch 'feature/gsoc14-personas' - cui/source cui/uiconfig vcl/source
cui/source/options/personalization.cxx | 81 +++-- cui/source/options/personalization.hxx | 10 +++- cui/uiconfig/ui/personalization_tab.ui | 66 ++ vcl/source/app/settings.cxx|8 --- 4 files changed, 142 insertions(+), 23 deletions(-) New commits: commit dc7092fe6e48e5d50a438bf27332cf151d86b2ca Author: Rachit Gupta rachitgupta1...@gmail.com Date: Thu Jun 19 18:49:36 2014 +0530 Added functionality to apply default themes. * The themes are stored in the share folder under the personas directory in the gallery. The information is stored in a personas_list.txt which contains the info in the form headerFile;footerFile;textColor;AccentColor for the default themes. * Changed the personalization_tab.ui to include _three_ buttons to show the default images. * Changed the vcl/source/app/settings.cxx to read the persona information properly in the case of default personas. * Some variable name changes. Change-Id: Ib5f2167729a5fb7eb8061925679560accb934a44 diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index e6307f4..e592126 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -202,6 +202,17 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage( Window *pParent, const Sfx get( m_pSelectPersona, select_persona ); m_pSelectPersona-SetClickHdl( LINK( this, SvxPersonalizationTabPage, SelectPersona ) ); + +get( m_vDefaultPersonaImages[0], default1 ); +m_vDefaultPersonaImages[0]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + +get( m_vDefaultPersonaImages[1], default2 ); +m_vDefaultPersonaImages[1]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + +get( m_vDefaultPersonaImages[2], default3 ); +m_vDefaultPersonaImages[2]-SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + +LoadDefaultImages(); } SvxPersonalizationTabPage::~SvxPersonalizationTabPage() @@ -268,6 +279,45 @@ void SvxPersonalizationTabPage::Reset( const SfxItemSet ) m_pDefaultPersona-Check(); } +void SvxPersonalizationTabPage::SetPersonaSettings( const OUString aPersonaSettings ) +{ +m_aPersonaSettings = aPersonaSettings; +m_pOwnPersona-Check(); +} + +void SvxPersonalizationTabPage::LoadDefaultImages() +{ +OUString gallery( ); +gallery = $BRAND_BASE_DIR/ LIBO_SHARE_FOLDER; +gallery += /gallery/personas/; +rtl::Bootstrap::expandMacros( gallery ); +OUString aPersonasList = gallery + personas_list.txt; +SvFileStream aStream( aPersonasList, STREAM_READ ); +GraphicFilter aFilter; +Graphic aGraphic; +sal_Int32 nIndex = 0; + +while( aStream.IsOpen() !aStream.IsEof() ) +{ +OString aLine; +aStream.ReadLine( aLine ); +OUString aPersonaSetting( OStringToOUString( aLine, RTL_TEXTENCODING_UTF8 ) ); +OUString aPreviewFile; +sal_Int32 nNewIndex = aPersonaSetting.indexOf( ';', 0 ); +if( nNewIndex 0 ) +break; +aPreviewFile = aPersonaSetting.copy( 0, nNewIndex ); +aPersonaSetting = aPersonaSetting.copy( nNewIndex + 1 ); +m_vDefaultPersonaSettings.push_back( aPersonaSetting ); + +INetURLObject aURLObj( gallery + aPreviewFile ); +aFilter.ImportGraphic( aGraphic, aURLObj ); +Bitmap aBmp = aGraphic.GetBitmap(); +m_vDefaultPersonaImages[nIndex]-Show(); +m_vDefaultPersonaImages[nIndex++]-SetModeImage( Image( aBmp ) ); +} +} + IMPL_LINK( SvxPersonalizationTabPage, SelectPersona, PushButton*, /*pButton*/ ) { SelectPersonaDialog aDialog( NULL ); @@ -277,7 +327,7 @@ IMPL_LINK( SvxPersonalizationTabPage, SelectPersona, PushButton*, /*pButton*/ ) OUString aPersonaSetting( aDialog.GetAppliedPersonaSetting() ); if ( !aPersonaSetting.isEmpty() ) { -setPersonaSettings( aPersonaSetting ); +SetPersonaSettings( aPersonaSetting ); } break; @@ -294,6 +344,17 @@ IMPL_LINK( SvxPersonalizationTabPage, ForceSelect, RadioButton*, pButton ) return 0; } +IMPL_LINK( SvxPersonalizationTabPage, DefaultPersona, PushButton*, pButton ) +{ +m_pDefaultPersona-Check(); +for( sal_Int32 nIndex = 0; nIndex 3; nIndex++ ) +{ +if( pButton == m_vDefaultPersonaImages[nIndex] ) +m_aPersonaSettings = m_vDefaultPersonaSettings[nIndex]; +} +return 0; +} + /// Find the value on the Persona page, and convert it to a usable form. static OUString searchValue( const OString rBuffer, sal_Int32 from, const OString rIdentifier ) { @@ -351,12 +412,6 @@ static bool parsePersonaInfo( const OString rBuffer, OUString *pHeaderURL, OUSt return true; } -void SvxPersonalizationTabPage::setPersonaSettings( const OUString aPersonaSettings ) -{ -
[Libreoffice-commits] core.git: Branch 'feature/gsoc14-personas' - cui/source cui/uiconfig
cui/source/options/personalization.cxx | 28 +- cui/source/options/personalization.hxx |2 cui/uiconfig/ui/select_persona_dialog.ui | 83 --- 3 files changed, 72 insertions(+), 41 deletions(-) New commits: commit 8c5811cc945fea05d75f52bf917f315b1a09069d Author: Rachit Gupta rachitgupta1...@gmail.com Date: Mon Jun 2 23:26:11 2014 +0530 Changed images to buttons so they are clickable. Changed some variable names too. Change-Id: I166d996389c84d00782cba42169c991f8f0f923e diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index e4d82ef..9c8d345 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -43,15 +43,15 @@ SelectPersonaDialog::SelectPersonaDialog( Window *pParent ) get( m_pProgressLabel, progress_label ); -get(m_vImageList[0], image1); -get(m_vImageList[1], image2); -get(m_vImageList[2], image3); -get(m_vImageList[3], image4); -get(m_vImageList[4], image5); -get(m_vImageList[5], image6); -get(m_vImageList[6], image7); -get(m_vImageList[7], image8); -get(m_vImageList[8], image9); +get(m_vResultList[0], result1); +get(m_vResultList[1], result2); +get(m_vResultList[2], result3); +get(m_vResultList[3], result4); +get(m_vResultList[4], result5); +get(m_vResultList[5], result6); +get(m_vResultList[6], result7); +get(m_vResultList[7], result8); +get(m_vResultList[8], result9); } OUString SelectPersonaDialog::GetPersonaURL() const @@ -86,7 +86,9 @@ void SelectPersonaDialog::SetImages( std::vectorImage rImageList ) sal_Int32 nCount = 0; for( std::vectorImage::iterator it=rImageList.begin(); it!=rImageList.end(); ++it ) { -m_vImageList[nCount++]-SetImage( *it ); +m_vResultList[nCount]-Show(); +m_vResultList[nCount]-SetModeImage( *it ); +nCount++; } } @@ -357,7 +359,7 @@ void SearchAndParseThread::execute() std::vectorOUString vLearnmoreURLs = pHandler-getLearnmoreURLs(); std::vectorOUString::iterator it; -std::vectorImage vImageList; +std::vectorImage vResultList; GraphicFilter aFilter; Graphic aGraphic; @@ -367,9 +369,9 @@ void SearchAndParseThread::execute() INetURLObject aURLObj( sHeaderFile ); aFilter.ImportGraphic( aGraphic, aURLObj ); Bitmap aBmp = aGraphic.GetBitmap(); -vImageList.push_back( Image( aBmp ) ); +vResultList.push_back( Image( aBmp ) ); } -m_pPersonaDialog-SetImages( vImageList ); +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 e7f02c9..9bc99a7 100644 --- a/cui/source/options/personalization.hxx +++ b/cui/source/options/personalization.hxx @@ -65,7 +65,7 @@ private: Edit *m_pEdit; /// The input line for the Persona URL PushButton *m_pButton; FixedText *m_pProgressLabel; -FixedImage *m_vImageList[9]; +PushButton *m_vResultList[9]; public: SelectPersonaDialog( Window *pParent ); diff --git a/cui/uiconfig/ui/select_persona_dialog.ui b/cui/uiconfig/ui/select_persona_dialog.ui index ab4c89c..2c9f5a1 100644 --- a/cui/uiconfig/ui/select_persona_dialog.ui +++ b/cui/uiconfig/ui/select_persona_dialog.ui @@ -132,11 +132,16 @@ object class=GtkGrid id=grid1 property name=visibleTrue/property property name=can_focusFalse/property +property name=row_spacing6/property +property name=column_spacing6/property child - object class=GtkImage id=image1 + object class=GtkButton id=result1 property name=visibleTrue/property -property name=can_focusFalse/property -property name=stockgtk-missing-image/property +property name=can_focusTrue/property +property name=receives_defaultTrue/property +child + placeholder/ +/child /object packing property name=left_attach0/property @@ -146,10 +151,13 @@ /packing /child child - object class=GtkImage id=image2 + object class=GtkButton id=result2 property name=visibleTrue/property -property name=can_focusFalse/property -property name=stockgtk-missing-image/property +property name=can_focusTrue/property +property name=receives_defaultTrue/property +child +
[Libreoffice-commits] core.git: Branch 'feature/gsoc14-personas' - cui/source cui/uiconfig
cui/source/options/personalization.cxx| 129 - cui/source/options/personalization.hxx| 10 + cui/source/options/personasdochandler.hxx |1 cui/uiconfig/ui/select_persona_dialog.ui | 151 +++--- 4 files changed, 269 insertions(+), 22 deletions(-) New commits: commit 62df0a31f5298843586c3c4936434761fdf4268c Author: Rachit Gupta rachitgupta1...@gmail.com Date: Thu May 22 20:48:34 2014 +0530 The search result images are shown in the dialog. 1. Changed the UI to include a 3x3 grid of images 2. The preview images are downloaded in the thread 3. The images are downloaded in their respective folders 4. A progress label is shown Change-Id: Id87e72343d28e03b37e0c422e5ebfe1a9a37c1b5 diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index b454d17..357d5ab 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -35,11 +35,23 @@ using namespace ::com::sun::star::ucb; SelectPersonaDialog::SelectPersonaDialog( Window *pParent ) : ModalDialog( pParent, SelectPersonaDialog, cui/ui/select_persona_dialog.ui ) { -get( pButton, search_personas ); -pButton-SetClickHdl( LINK( this, SelectPersonaDialog, VisitPersonas ) ); +get( m_pButton, search_personas ); +m_pButton-SetClickHdl( LINK( this, SelectPersonaDialog, VisitPersonas ) ); get( m_pEdit, search_term ); m_pEdit-SetPlaceholderText( Search term... ); + +get( m_pProgressLabel, progress_label ); + +get(m_vImageList[0], image1); +get(m_vImageList[1], image2); +get(m_vImageList[2], image3); +get(m_vImageList[3], image4); +get(m_vImageList[4], image5); +get(m_vImageList[5], image6); +get(m_vImageList[6], image7); +get(m_vImageList[7], image8); +get(m_vImageList[8], image9); } OUString SelectPersonaDialog::GetPersonaURL() const @@ -55,12 +67,29 @@ OUString SelectPersonaDialog::GetPersonaURL() const IMPL_LINK( SelectPersonaDialog, VisitPersonas, PushButton*, /*pButton*/ ) { OUString searchTerm = m_pEdit-GetText(); -OUString rURL = https://addons.allizom.org/en-US/firefox/api/1.5/search/; + searchTerm + /9/; +OUString rURL = https://addons.allizom.org/en-US/firefox/api/1.5/search/; + searchTerm + /9/9; m_aSearchThread = new SearchAndParseThread( this, rURL ); m_aSearchThread-launch(); return 0; } +void SelectPersonaDialog::SetProgress( OUString rProgress ) +{ +if(rProgress.isEmpty()) +m_pProgressLabel-Hide(); +else +m_pProgressLabel-SetText( rProgress ); +} + +void SelectPersonaDialog::SetImages( std::vectorImage rImageList ) +{ +sal_Int32 nCount = 0; +for( std::vectorImage::iterator it=rImageList.begin(); it!=rImageList.end(); ++it ) +{ +m_vImageList[nCount++]-SetImage( *it ); +} +} + SvxPersonalizationTabPage::SvxPersonalizationTabPage( Window *pParent, const SfxItemSet rSet ) : SfxTabPage( pParent, PersonalizationTabPage, cui/ui/personalization_tab.ui, rSet ) { @@ -187,7 +216,9 @@ static OUString searchValue( const OString rBuffer, sal_Int32 from, const OStri } /// Parse the Persona web page, and find where to get the bitmaps + the color values. -static bool parsePersonaInfo( const OString rBuffer, OUString *pHeaderURL, OUString *pFooterURL, OUString *pTextColor, OUString *pAccentColor ) +static bool parsePersonaInfo( const OString rBuffer, OUString *pHeaderURL, OUString *pFooterURL, + OUString *pTextColor, OUString *pAccentColor, OUString *pPreviewURL, + OUString *pName ) { // it is the first attribute that contains persona= sal_Int32 persona = rBuffer.indexOf( data-browsertheme=\{ ); @@ -211,6 +242,14 @@ static bool parsePersonaInfo( const OString rBuffer, OUString *pHeaderURL, OUSt if ( pAccentColor-isEmpty() ) return false; +*pPreviewURL = searchValue( rBuffer, persona, #34;previewURL#34;:#34; ); +if ( pAccentColor-isEmpty() ) +return false; + +*pName = searchValue( rBuffer, persona, #34;name#34;:#34; ); +if ( pAccentColor-isEmpty() ) +return false; + return true; } @@ -249,9 +288,9 @@ bool SvxPersonalizationTabPage::CopyPersonaToGallery( const OUString rURL ) xStream-closeInput(); // get the important bits of info -OUString aHeaderURL, aFooterURL, aTextColor, aAccentColor; +OUString aHeaderURL, aFooterURL, aTextColor, aAccentColor, aPreviewURL, aName; -if ( !parsePersonaInfo( aBuffer.makeStringAndClear(), aHeaderURL, aFooterURL, aTextColor, aAccentColor ) ) +if ( !parsePersonaInfo( aBuffer.makeStringAndClear(), aHeaderURL, aFooterURL, aTextColor, aAccentColor, aPreviewURL, aName ) ) // Temp return false; // copy the images to the user's gallery @@ -292,6 +331,8 @@ SearchAndParseThread::~SearchAndParseThread() void