Hello community, here is the log from the commit of package libyui for openSUSE:Factory checked in at 2014-01-09 17:24:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libyui (Old) and /work/SRC/openSUSE:Factory/.libyui.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libyui" Changes: -------- --- /work/SRC/openSUSE:Factory/libyui/libyui.changes 2013-08-10 12:18:20.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libyui.new/libyui.changes 2014-01-09 17:24:42.000000000 +0100 @@ -1,0 +2,17 @@ +Wed Dec 11 10:09:19 CET 2013 - [email protected] + +- added external widget plugin management +- added support for multi plugin loader (one per name) +- Version 3.0.12 + +------------------------------------------------------------------- +Thu Dec 5 13:19:10 UTC 2013 - [email protected] + +- Added a new option for YPushButton: YUIOpt_relNotesButton; + it will pop up a dialog with externally provided release notes. + (by jsrain) +- Added a generic plugin loader libyui-NAME-[qt|gtk|ncurses] + to manage user defined external widget (by anaselli) +- 3.0.11 + +------------------------------------------------------------------- @@ -5 +22 @@ -- Version 3.0.9 +- Version 3.0.10 Old: ---- libyui-3.0.10.tar.bz2 New: ---- libyui-3.0.12.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libyui-doc.spec ++++++ --- /var/tmp/diff_new_pack.uPpIr9/_old 2014-01-09 17:24:43.000000000 +0100 +++ /var/tmp/diff_new_pack.uPpIr9/_new 2014-01-09 17:24:43.000000000 +0100 @@ -17,7 +17,7 @@ Name: libyui-doc -Version: 3.0.10 +Version: 3.0.12 Release: 0 Source: libyui-%{version}.tar.bz2 @@ -71,13 +71,13 @@ cd build make install DESTDIR="$RPM_BUILD_ROOT" -%fdupes -s $RPM_BUILD_ROOT/%_docdir/libyui5 +%fdupes -s $RPM_BUILD_ROOT/%_docdir/libyui6 %clean rm -rf "$RPM_BUILD_ROOT" %files %defattr(-,root,root) -%doc %{_docdir}/libyui5 +%doc %{_docdir}/libyui6 %changelog ++++++ libyui.spec ++++++ --- /var/tmp/diff_new_pack.uPpIr9/_old 2014-01-09 17:24:43.000000000 +0100 +++ /var/tmp/diff_new_pack.uPpIr9/_new 2014-01-09 17:24:43.000000000 +0100 @@ -20,7 +20,7 @@ # Name: libyui -Version: 3.0.10 +Version: 3.0.12 Release: 0 Source: libyui-%{version}.tar.bz2 @@ -43,17 +43,17 @@ YaST for generic (C++) applications. This package has very few dependencies. -%package -n libyui5 +%package -n libyui6 Provides: yast2-libyui = 2.42.0 Obsoletes: yast2-libyui < 2.42.0 -Requires: yui_backend = 5 +Requires: yui_backend = 6 Url: http://github.com/libyui/ Summary: Libyui - GUI-abstraction library Group: System/Libraries -%description -n libyui5 +%description -n libyui6 This is the user interface engine that provides the abstraction from graphical user interfaces (Qt, Gtk) and text based user interfaces (ncurses). @@ -68,7 +68,7 @@ Requires: boost-devel Requires: glibc-devel Requires: libstdc++-devel -Requires: libyui5 = %{version} +Requires: libyui6 = %{version} Url: http://github.com/libyui/ Summary: Libyui header files @@ -119,33 +119,33 @@ %install cd build make install DESTDIR="$RPM_BUILD_ROOT" -install -m0755 -d $RPM_BUILD_ROOT/%{_docdir}/libyui5/ +install -m0755 -d $RPM_BUILD_ROOT/%{_docdir}/libyui6/ install -m0755 -d $RPM_BUILD_ROOT/%{_libdir}/yui -install -m0644 ../COPYING* $RPM_BUILD_ROOT/%{_docdir}/libyui5/ +install -m0644 ../COPYING* $RPM_BUILD_ROOT/%{_docdir}/libyui6/ %clean rm -rf "$RPM_BUILD_ROOT" -%post -n libyui5 -p /sbin/ldconfig +%post -n libyui6 -p /sbin/ldconfig -%postun -n libyui5 -p /sbin/ldconfig +%postun -n libyui6 -p /sbin/ldconfig -%files -n libyui5 +%files -n libyui6 %defattr(-,root,root) %dir %{_libdir}/yui %dir %{_datadir}/libyui %{_libdir}/lib*.so.* -%doc %dir %{_docdir}/libyui5 -%doc %{_docdir}/libyui5/COPYING* +%doc %dir %{_docdir}/libyui6 +%doc %{_docdir}/libyui6/COPYING* %files devel %defattr(-,root,root) -%dir %{_docdir}/libyui5 +%dir %{_docdir}/libyui6 %{_libdir}/lib*.so %{_prefix}/include/yui %{_libdir}/pkgconfig/libyui.pc %{_libdir}/cmake/libyui %{_datadir}/libyui/buildtools -%doc %{_docdir}/libyui5/examples +%doc %{_docdir}/libyui6/examples %changelog ++++++ libyui-3.0.10.tar.bz2 -> libyui-3.0.12.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/.gitignore new/libyui-3.0.12/.gitignore --- old/libyui-3.0.10/.gitignore 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/.gitignore 2013-12-11 11:09:00.000000000 +0100 @@ -106,6 +106,7 @@ # KDE .directory +*.kdev4 # Subversion .svn/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/ChangeLog new/libyui-3.0.12/ChangeLog --- old/libyui-3.0.10/ChangeLog 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/ChangeLog 2013-12-11 11:09:00.000000000 +0100 @@ -1,8 +1,25 @@ ------------------------------------------------------------------- +Wed Dec 11 10:09:19 CET 2013 - [email protected] + +- added external widget plugin management +- added support for multi plugin loader (one per name) +- Version 3.0.12 + +------------------------------------------------------------------- +Thu Dec 5 13:19:10 UTC 2013 - [email protected] + +- Added a new option for YPushButton: YUIOpt_relNotesButton; + it will pop up a dialog with externally provided release notes. + (by jsrain) +- Added a generic plugin loader libyui-NAME-[qt|gtk|ncurses] + to manage user defined external widget (by anaselli) +- 3.0.11 + +------------------------------------------------------------------- Tue Aug 6 14:30:53 CEST 2013 - [email protected] - Fixed dependencies -- Version 3.0.9 +- Version 3.0.10 ------------------------------------------------------------------- Wed Jul 24 14:59:07 CEST 2013 - [email protected] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/SOURCECONF.cmake new/libyui-3.0.12/SOURCECONF.cmake --- old/libyui-3.0.10/SOURCECONF.cmake 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/SOURCECONF.cmake 2013-12-11 11:09:00.000000000 +0100 @@ -5,6 +5,7 @@ YOptionalWidgetFactory.cc YSettings.cc YPath.cc + YExternalWidgets.cc YCommandLine.cc YDialogSpy.cc @@ -175,6 +176,8 @@ YRpmGroupsTree.h YStringTree.h YTransText.h + YExternalWidgetFactory.h + YExternalWidgets.h ) SET( EXAMPLES_LIST diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/VERSION.cmake new/libyui-3.0.12/VERSION.cmake --- old/libyui-3.0.10/VERSION.cmake 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/VERSION.cmake 2013-12-11 11:09:00.000000000 +0100 @@ -1,11 +1,12 @@ SET( VERSION_MAJOR "3") SET( VERSION_MINOR "0" ) -SET( VERSION_PATCH "10" ) +SET( VERSION_PATCH "12" ) SET( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${GIT_SHA1_VERSION}" ) ##### This is need for the libyui core, ONLY. ##### These will be overridden from exports in LibyuiConfig.cmake -SET( SONAME_MAJOR "5" ) +# must also adjust "Requires: yui_backend = SONAME_MAJOR" in libyui.spec.in +SET( SONAME_MAJOR "6" ) SET( SONAME_MINOR "0" ) SET( SONAME_PATCH "0" ) SET( SONAME "${SONAME_MAJOR}.${SONAME_MINOR}.${SONAME_PATCH}" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/buildtools/CMakeLists.common new/libyui-3.0.12/buildtools/CMakeLists.common --- old/libyui-3.0.10/buildtools/CMakeLists.common 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/buildtools/CMakeLists.common 2013-12-11 11:09:00.000000000 +0100 @@ -8,11 +8,15 @@ SET( PREFIX "/usr" ) ENDIF( NOT PREFIX ) -IF( PLUGINNAME ) +IF( PLUGINNAME AND EXTENSIONNAME ) + MESSAGE( FATAL_ERROR "Please define PLUGINNAME or EXTENSIONNAME not both" ) +ENDIF( PLUGINNAME AND EXTENSIONNAME ) + +IF( PLUGINNAME OR EXTENSIONNAME ) SET( BUILDTOOLS_DIR "${PREFIX}/share/lib${BASELIB}/${BUILDTOOLS_DIR}" ) -ELSE( PLUGINNAME ) +ELSE( PLUGINNAME OR EXTENSIONNAME ) SET( BUILDTOOLS_DIR "${CMAKE_SOURCE_DIR}/${BUILDTOOLS_DIR}" ) -ENDIF( PLUGINNAME ) +ENDIF( PLUGINNAME OR EXTENSIONNAME ) SET( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules" "${BUILDTOOLS_DIR}" "${CMAKE_MODULE_PATH}" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/buildtools/LibyuiCommon.cmake new/libyui-3.0.12/buildtools/LibyuiCommon.cmake --- old/libyui-3.0.10/buildtools/LibyuiCommon.cmake 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/buildtools/LibyuiCommon.cmake 2013-12-11 11:09:00.000000000 +0100 @@ -33,7 +33,11 @@ SET( PROGSUBDIR_UC "${PROGSUBDIR}" ) STRING( TOLOWER "${PROGSUBDIR_UC}" PROGSUBDIR ) - SET( TARGETLIB "${BASELIB}-${PROGSUBDIR}-${PLUGINNAME}" ) + IF ( EXTENSIONNAME ) + SET( TARGETLIB "${BASELIB}-${PROGSUBDIR}-${EXTENSIONNAME}" ) + ELSE ( EXTENSIONNAME ) + SET( TARGETLIB "${BASELIB}-${PROGSUBDIR}-${PLUGINNAME}" ) + ENDIF ( EXTENSIONNAME ) STRING( REGEX REPLACE "-+" "-" TARGETLIB "${TARGETLIB}" ) STRING( REGEX REPLACE "-+$" "" TARGETLIB "${TARGETLIB}" ) @@ -159,8 +163,13 @@ SET( INSTALL_PKGCONFIG_DIR ${LIB_DIR}/pkgconfig CACHE PATH "Installation directory for pkgconfig files" ) SET( LIB_DIR_PLAIN "${LIB_DIR}" ) - SET( INCLUDE_DIR "${INCLUDE_DIR}/${BASELIB}/${PROGSUBDIR_UC}/${PLUGINNAME}" ) - + IF ( EXTENSIONNAME ) + SET( INCLUDE_DIR "${INCLUDE_DIR}/${BASELIB}/${PROGSUBDIR_UC}/${EXTENSIONNAME}" ) + ELSE ( EXTENSIONNAME ) + SET( INCLUDE_DIR "${INCLUDE_DIR}/${BASELIB}/${PROGSUBDIR_UC}/${PLUGINNAME}" ) + ENDIF ( EXTENSIONNAME ) + + # Only plugin go under libdir/yui, not extensions IF( PLUGINNAME ) SET( LIB_DIR "${LIB_DIR}/${BASELIB}" ) ENDIF( PLUGINNAME ) @@ -204,12 +213,12 @@ MACRO( SET_SONAME ) - IF( PLUGINNAME ) + IF( PLUGINNAME OR EXTENSIONNAME ) FOREACH( p "" _MAJOR _MINOR _PATCH ) STRING(TOUPPER ${BASELIB} baselibUPPER) SET( SONAME${p} "${LIB${baselibUPPER}_SONAME${p}}") ENDFOREACH() - ENDIF( PLUGINNAME ) + ENDIF( PLUGINNAME OR EXTENSIONNAME ) ENDMACRO( SET_SONAME ) @@ -380,7 +389,7 @@ @ONLY ) - IF( NOT PLUGINNAME ) + IF( NOT PLUGINNAME AND NOT EXTENSIONNAME ) CONFIGURE_FILE( "${BUILDTOOLS_DIR}/config.h.in" "${PROJECT_BINARY_DIR}/src/${PROJECTNAME_UC}_config.h" @@ -392,7 +401,7 @@ "${PROJECT_BINARY_DIR}/src/${PROJECTNAME_UC}_config.h" @ONLY ) - ENDIF( NOT PLUGINNAME ) + ENDIF( NOT PLUGINNAME AND NOT EXTENSIONNAME ) FOREACH( p "${PROJECTNAME_UC}Config.cmake" "${PROJECTNAME_UC}ConfigVersion.cmake" "${PROJECTNAME}.pc" ) CONFIGURE_FILE( @@ -502,6 +511,7 @@ MESSAGE( STATUS " ${PROJECTNAME} has been configured with following options:" ) MESSAGE( STATUS "" ) MESSAGE( STATUS " Plugin-Name: ${PLUGINNAME}" ) + MESSAGE( STATUS " Extension-Name: ${EXTENSIONNAME}" ) MESSAGE( STATUS " Library-Dependencies: ${LIB_DEPS}" ) MESSAGE( STATUS " Plugin is for use with: ${PROGSUBDIR}" ) MESSAGE( STATUS " targetlib to build: ${TARGETLIB}" ) @@ -570,12 +580,12 @@ DESTINATION "${INSTALL_PKGCONFIG_DIR_PREFIX}" ) -IF( NOT PLUGINNAME ) +IF( NOT PLUGINNAME AND NOT EXTENSIONNAME ) INSTALL( DIRECTORY "${BUILDTOOLS_DIR}" DESTINATION "${INSTALL_BUILDTOOLS_DIR_PREFIX}" ) -ENDIF( NOT PLUGINNAME ) +ENDIF( NOT PLUGINNAME AND NOT EXTENSIONNAME ) INSTALL( FILES ${BUILDTOOLS_LIST} @@ -609,12 +619,12 @@ ENDIF( QT_FOUND ) - IF( NOT PLUGINNAME ) + IF( NOT PLUGINNAME AND NOT EXTENSIONNAME ) SET( ${TARGETLIB}_HEADERS "${${TARGETLIB}_HEADERS}" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECTNAME_UC}_config.h" ) - ENDIF( NOT PLUGINNAME ) + ENDIF( NOT PLUGINNAME AND NOT EXTENSIONNAME ) IF( DISABLE_SHARED ) ADD_LIBRARY( ${TARGETLIB} STATIC ${${TARGETLIB}_SOURCES} ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/libyui.spec.in new/libyui-3.0.12/libyui.spec.in --- old/libyui-3.0.10/libyui.spec.in 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/libyui.spec.in 2013-12-11 11:09:00.000000000 +0100 @@ -43,7 +43,7 @@ Provides: yast2-libyui = 2.42.0 Obsoletes: yast2-libyui < 2.42.0 -Requires: yui_backend = 5 +Requires: yui_backend = 6 URL: @URL@ Summary: @PROJECTNAME_UC@ - @SUMMARY@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/src/YApplication.cc new/libyui-3.0.12/src/YApplication.cc --- old/libyui-3.0.10/src/YApplication.cc 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/src/YApplication.cc 2013-12-11 11:09:00.000000000 +0100 @@ -54,6 +54,7 @@ std::string applicationIcon; YFunctionKeyMap defaultFunctionKey; YIconLoader* iconLoader; + std::map<std::string,std::string> releaseNotes; }; @@ -118,6 +119,17 @@ return priv->productName; } +void +YApplication::setReleaseNotes( const std::map<std::string,std::string> & relNotes ) +{ + priv->releaseNotes = relNotes; +} + +std::map<std::string,std::string> +YApplication::releaseNotes() const +{ + return priv->releaseNotes; +} void YApplication::setReverseLayout( bool reverse ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/src/YApplication.h new/libyui-3.0.12/src/YApplication.h --- old/libyui-3.0.10/src/YApplication.h 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/src/YApplication.h 2013-12-11 11:09:00.000000000 +0100 @@ -25,6 +25,7 @@ #ifndef YApplication_h #include <string> +#include <map> #include "YUI.h" #include "ImplPtr.h" #include "YMenuItem.h" @@ -246,11 +247,22 @@ virtual void setProductName( const std::string & productName ); /** - * Set the current product name ("openSUSE", "SLES", ...). + * Get the current product name ("openSUSE", "SLES", ...). **/ std::string productName() const; /** + * Set release notes; map product => text + * + */ + void setReleaseNotes( const std::map<std::string,std::string> & relNotes ); + + /** + * Get the current release notes map + **/ + std::map<std::string,std::string> releaseNotes() const; + + /** * Convert logical layout spacing units into device dependent units. * A default size dialog is assumed to be 80x25 layout spacing units. * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/src/YButtonBox.cc new/libyui-3.0.12/src/YButtonBox.cc --- old/libyui-3.0.10/src/YButtonBox.cc 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/src/YButtonBox.cc 2013-12-11 11:09:00.000000000 +0100 @@ -427,6 +427,7 @@ case YCancelButton: case YApplyButton: case YHelpButton: + case YRelNotesButton: if ( specialButtons[ button->role() ] ) // Only one of each of those is allowed { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/src/YDialog.cc new/libyui-3.0.12/src/YDialog.cc --- old/libyui-3.0.10/src/YDialog.cc 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/src/YDialog.cc 2013-12-11 11:09:00.000000000 +0100 @@ -36,13 +36,21 @@ #include "YButtonBox.h" #include "YUI.h" +#include "YApplication.h" #include "YWidgetFactory.h" +#include "YOptionalWidgetFactory.h" #include "YLayoutBox.h" #include "YRichText.h" #include "YAlignment.h" #include "YUIException.h" #include "YEventFilter.h" +#include "YWidgetID.h" +#include "YDumbTab.h" +// needed in order to read release notes +#include <sys/types.h> +#include <dirent.h> +#include <fstream> #define VERBOSE_DIALOGS 0 #define VERBOSE_DISCARDED_EVENTS 0 @@ -105,6 +113,37 @@ } }; +/** + * Helper class: Event filter that handles "ReleaseNotes" buttons. + **/ +class YRelNotesButtonHandler: public YEventFilter +{ +public: + YRelNotesButtonHandler( YDialog * dialog ) + : YEventFilter( dialog ) + {} + + virtual ~YRelNotesButtonHandler() {} + + YEvent * filter( YEvent * event ) + { + if ( event && event->widget() ) + { + YPushButton * button = dynamic_cast<YPushButton *> ( event->widget() ); + + if ( button && button->isRelNotesButton() ) + { + if ( YDialog::showRelNotesText() ) + { + event = 0; // consume event + } + } + } + + return event; + } +}; + @@ -121,6 +160,7 @@ #endif new YHelpButtonHandler( this ); + new YRelNotesButtonHandler( this ); } @@ -686,3 +726,97 @@ return ! helpText.empty(); } + +bool +YDialog::showRelNotesText() +{ + yuiMilestone() <<"Showing Release Notes" << std::endl; + + // set help text dialog size to 80% of topmost dialog, respectively 45x15 (default) + + unsigned int dialogWidth = 45; + unsigned int dialogHeight = 15; + + if ( ! _dialogStack.empty() ) + { + YDialog * dialog = _dialogStack.top(); + dialogWidth = (unsigned int) ( (float) dialog->preferredWidth() * 0.8 ); + dialogHeight = (unsigned int) ( (float) dialog->preferredHeight() * 0.8 ); + } + + // limit dialog to a reasonable size + if ( dialogWidth > 80 || dialogHeight > 25 ) + { + dialogWidth = 80; + dialogHeight = 25; + } + + try + { + std::map<std::string,std::string> relnotes = YUI::application()->releaseNotes(); + if ( relnotes.size() == 0) + { + return false; + } + std::vector<std::string> keys; + for(std::map<std::string,std::string>::iterator it = relnotes.begin(); it != relnotes.end(); ++it) { + keys.push_back(it->first); + } + YDialog * dialog = YUI::widgetFactory()->createPopupDialog(); + YAlignment * minSize = YUI::widgetFactory()->createMinSize( dialog, dialogWidth, dialogHeight ); + YLayoutBox * vbox = YUI::widgetFactory()->createVBox( minSize ); + YDumbTab * rnTab = 0; + YRichText * richtext = 0; + // both QT and NCurses do support DumbTab + if (relnotes.size() > 1 && YUI::optionalWidgetFactory()->hasDumbTab()) + { + rnTab = YUI::optionalWidgetFactory()->createDumbTab( vbox ); + int index = 0; + for(std::map<std::string,std::string>::const_iterator it = relnotes.begin(); it != relnotes.end(); it++) + { + YItem * item = new YItem((*it).first ); + item->setIndex( index++ ); + rnTab->addItem( item ); + } + richtext = YUI::widgetFactory()->createRichText( rnTab, (*(relnotes.begin())).second, false ); + } + else + { + richtext = YUI::widgetFactory()->createRichText( vbox, (*(relnotes.begin())).second, false ); + } + YButtonBox * buttonBox = YUI::widgetFactory()->createButtonBox( vbox ); + YPushButton * okButton = YUI::widgetFactory()->createPushButton( buttonBox, "&OK" ); + okButton->setRole( YOKButton ); + okButton->setDefaultButton(); + + while(true) { + YEvent* event = dialog->waitForEvent(); + if ( event && event->eventType() == YEvent::MenuEvent && event->item()) + { + YItem * item = dynamic_cast<YItem *> ( event->item()); + richtext->setValue( relnotes[keys[item->index()]] ); + } + else if ( event && event->widget() ) + { + YPushButton * button = dynamic_cast<YPushButton *> ( event->widget() ); + if ( button ) + { + if ( button->role() == YOKButton) + { + break; + } + } + } + } + dialog->destroy(); + } + catch ( YUIException exception ) + { + // Don't let the application die just because RN couldn't be displayed. + + YUI_CAUGHT( exception ); + } + + return true; + +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/src/YDialog.h new/libyui-3.0.12/src/YDialog.h --- old/libyui-3.0.10/src/YDialog.h 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/src/YDialog.h 2013-12-11 11:09:00.000000000 +0100 @@ -28,6 +28,7 @@ #include "YSingleChildContainerWidget.h" #include <stack> +#include <map> class YShortcutManager; class YPushButton; @@ -344,6 +345,17 @@ **/ static bool showHelpText( YWidget * widget ); + /** + * Show the release notes + * + * If there are release notes, they are displayed in a pop-up dialog with a local + * event loop. + * + * This returns 'true' on success (there were relnotes) and 'false' on + * failure (no relnotes). + **/ + static bool showRelNotesText(); + protected: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/src/YExternalWidgetFactory.h new/libyui-3.0.12/src/YExternalWidgetFactory.h --- old/libyui-3.0.10/src/YExternalWidgetFactory.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libyui-3.0.12/src/YExternalWidgetFactory.h 2013-12-11 11:09:00.000000000 +0100 @@ -0,0 +1,51 @@ +/* + Copyright (C) 2013 Angelo Naselli <anaselli at linux dot it> + + This file is part of libyui project + + This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) version 3.0 of the License. This library + is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. You should have received a copy of the GNU + Lesser General Public License along with this library; if not, write + to the Free Software Foundation, Inc., 51 Franklin Street, Fifth + Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef YExternalWidgetFactory_h +#define YExternalWidgetFactory_h + +/** + * Abstract widget factory for mandatory widgets. + * Use YOptionalWidgetFactory for optional ("special") widgets. + * YExternalWidgetFactory is used for external widgets, e.g. user defined plugin. + * + * Refer to the respective widget's documentation (in the header file) for + * documentation about the function parameters. + **/ +class YExternalWidgetFactory +{ +protected: + + friend class YUI; + friend class YExternalWidgets; + + /** + * Constructor. + * + * Use YExternalWidgets::widgetExtensionFactory() to get the singleton for this class. + **/ + YExternalWidgetFactory() {} + + /** + * Destructor. + **/ + virtual ~YExternalWidgetFactory() {} + +}; // class YExternalWidgetFactory + +#endif // YExternalWidgetFactory_h \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/src/YExternalWidgets.cc new/libyui-3.0.12/src/YExternalWidgets.cc --- old/libyui-3.0.10/src/YExternalWidgets.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libyui-3.0.12/src/YExternalWidgets.cc 2013-12-11 11:09:00.000000000 +0100 @@ -0,0 +1,128 @@ +/* + Copyright (C) 2013 Angelo Naselli <anaselli at linux dot it> + + This file is part of libyui project + + This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) version 3.0 of the License. This library + is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. You should have received a copy of the GNU + Lesser General Public License along with this library; if not, write + to the Free Software Foundation, Inc., 51 Franklin Street, Fifth + Floor, Boston, MA 02110-1301 USA +*/ +#define YUILogComponent "ew" +#include "YUILog.h" + +#include "YUI.h" +#include "YUILoader.h" +#include "YUIException.h" +#include "YExternalWidgets.h" +#include "YExternalWidgetFactory.h" + +#include <map> +#include <string> + +std::map<std::string, YExternalWidgets *> YExternalWidgets::_externalWidgets; + +YExternalWidgets::YExternalWidgets(const std::string& name) : _name(name), _factory(0) +{ + if (!YUI::ui()) + YUI_THROW( YUIException( "UI must be initialized first" ) ); + + yuiMilestone() << "Creating Libyui External Widgets object" << std::endl; + + std::pair<std::map<std::string, YExternalWidgets *>::iterator, bool> ret; + ret = _externalWidgets.insert ( std::pair<std::string, YExternalWidgets *>(_name, this)); + if (ret.second==false) { + std::string errorString = _name; + errorString.append(" already created"); + YUI_THROW( YUIException( errorString ) ); + } +} + +YExternalWidgets::~YExternalWidgets() +{ + delete _factory; + + _externalWidgets.erase(_name); +} + +YExternalWidgets* YExternalWidgets::externalWidgets(const std::string& name) +{ + std::map<std::string, YExternalWidgets *>::iterator it; + + it = _externalWidgets.find(name); + if (it == _externalWidgets.end()) + { + YUILoader::loadExternalWidgets(name); + } + + return _externalWidgets[name]; +} + +YExternalWidgetFactory* YExternalWidgets::externalWidgetFactory(const std::string& name) +{ + return YExternalWidgets::externalWidgets(name)->externalWidgetFactory(); +} + +YExternalWidgetFactory* YExternalWidgets::externalWidgetFactory() +{ + if (!YUI::ui()) + YUI_THROW( YUIException( "UI must be initialized first" ) ); + + if ( !_factory ) + _factory = this->createExternalWidgetFactory(); + + YUI_CHECK_PTR( _factory ); + + return _factory; +} + + +/** + * Helper class to make sure the EW is properly shut down. + **/ +class YExternalWidgetsTerminator +{ +public: + YExternalWidgetsTerminator() {} + + /** + * Destructor. + * + * If there still is a EW, it will be deleted. + * If there is none, this will do nothing. + **/ + ~YExternalWidgetsTerminator(); +}; + + +YExternalWidgetsTerminator::~YExternalWidgetsTerminator() +{ + // Let's copy map to avoid content deletion when removing ExternalWidgets objects + std::map <std::string, YExternalWidgets* > ew = YExternalWidgets::_externalWidgets; + std::map<std::string, YExternalWidgets *>::iterator it; + + for (it= ew.begin(); it != ew.end(); it++) + { + yuiMilestone() << "Shutting down " << it->first << " External Widgets" << std::endl; + delete it->second; + } +} + + +/** + * Static YExternalWidgetsTerminator instance: It will make sure the EW is deleted in its + * global destructor. If the EW is already destroyed, it will do nothing. If + * there still is a EW object, it will be deleted. + * + * This is particularly important for the NCurses EW so the terminal settings + * are properly restored. + **/ +static YExternalWidgetsTerminator weTerminator; + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/src/YExternalWidgets.h new/libyui-3.0.12/src/YExternalWidgets.h --- old/libyui-3.0.10/src/YExternalWidgets.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libyui-3.0.12/src/YExternalWidgets.h 2013-12-11 11:09:00.000000000 +0100 @@ -0,0 +1,104 @@ +/* + Copyright (C) 2013 Angelo Naselli <anaselli at linux dot it> + + This file is part of libyui project + + This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) version 3.0 of the License. This library + is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. You should have received a copy of the GNU + Lesser General Public License along with this library; if not, write + to the Free Software Foundation, Inc., 51 Franklin Street, Fifth + Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef YExternalWidgets_h +#define YExternalWidgets_h +#include <map> +#include <string> + +class YExternalWidgetFactory; + +/** + * Abstract base class of a libYUI Widget Extension interface. + **/ +class YExternalWidgets +{ + friend class YExternalWidgetsTerminator; + +protected: + /** + * Constructor. + * 'name' is the plugin name + * + * throws a YUIException if the plugin 'name' has been alread created + **/ + YExternalWidgets( const std::string& name ); + +public: + + /** + * Destructor. + **/ + virtual ~YExternalWidgets(); + + + /** + * Access the global YUI external widgets. + * 'name' is the plugin name + * + * if plugin 'name' has not been explicitally loaded by YUILoader::loadExternalWidgets + * externalWidgets try loading it (exactly as YUI::ui does) with default function symbol + * to be executed (see YUILoader::loadExternalWidgets for explanation) + **/ + static YExternalWidgets * externalWidgets(const std::string& name); + + /** + * Return the external widget factory that provides all the createXY() methods for + * user defined widgets. + * + * This will create the factory upon the first call and return a pointer to + * the one and only (singleton) factory upon each subsequent call. + * This may throw exceptions if the factory cannot be created. + * + * It is up to user extend YExternalWidgetFactory to add createXY() methods in + * his/her implementation. So once YExternalWidgetFactory is extended with + * all the createXY() methods, three sub-plugins must be defined one for each + * supported graphical environment, e.g. Gtk, ncurses and QT, following the + * libyui implementation rules. + * + * For instance an external widgets plugin called yui-foo that needs Gtk, ncurses + * and QT specialization will require also yui-foo-gtk, yui-foo-ncurses and + * yui-foo-qt plugin implementation. + * + **/ + YExternalWidgetFactory * externalWidgetFactory(); + static YExternalWidgetFactory * externalWidgetFactory(const std::string& name); + +protected: + + /** + * Create the external widgets factory that provides all the createXY() methods for + * + * Derived classes are required to implement this. Usually createXY() is virtual, + * real implementation is demanded to derived classes that implement Gtk, ncurses and QT + * specialization. + **/ + virtual YExternalWidgetFactory * createExternalWidgetFactory() = 0; + +private: + /** Externale widgets plugin name */ + std::string _name; + + /** Externale widget factory */ + YExternalWidgetFactory* _factory; + + /** plugin instances */ + static std::map<std::string, YExternalWidgets *> _externalWidgets; +}; + +#endif // YExternalWidgets_h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/src/YPushButton.cc new/libyui-3.0.12/src/YPushButton.cc --- old/libyui-3.0.10/src/YPushButton.cc 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/src/YPushButton.cc 2013-12-11 11:09:00.000000000 +0100 @@ -42,6 +42,7 @@ , isDefaultButton( false ) , setDefaultButtonRecursive( false ) , isHelpButton( false ) + , isRelNotesButton( false ) , role( YCustomButton ) {} @@ -49,6 +50,7 @@ bool isDefaultButton; bool setDefaultButtonRecursive; bool isHelpButton; + bool isRelNotesButton; YButtonRole role; }; @@ -134,6 +136,18 @@ priv->role = YHelpButton; } +bool YPushButton::isRelNotesButton() const +{ + return priv->isRelNotesButton; +} + + +void YPushButton::setRelNotesButton( bool relNotesButton ) +{ + priv->isRelNotesButton = relNotesButton; + priv->role = YRelNotesButton; +} + /* setRole can try to guess function key, but only if there isn't a selected function key already */ @@ -249,6 +263,7 @@ case YApplyButton: stream << "YApplyButton"; break; case YCancelButton: stream << "YCancelButton"; break; case YHelpButton: stream << "YHelpButton"; break; + case YRelNotesButton: stream << "YRelNotesButton"; break; default: stream << "<Undefined button role #" << (int) role << ">"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/src/YPushButton.h new/libyui-3.0.12/src/YPushButton.h --- old/libyui-3.0.10/src/YPushButton.h 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/src/YPushButton.h 2013-12-11 11:09:00.000000000 +0100 @@ -150,6 +150,25 @@ virtual void setHelpButton( bool helpButton = true ); /** + * Returns 'true' if this is a "Release Notes" button. + * + * NOTE that this is only done during YDialog::waitForEvent() (i.e. in YCP + * UI::WaitForEvent(), UI::UserInput(), UI::TimeoutUserInput() ) and not + * during YDialog::pollEvent() (i.e. YCP UI::PollInput()) since displaying + * the release notes will block the application until the user closes the + * text. + **/ + bool isRelNotesButton() const; + + /** + * Make this button a release notes button. + * + * Derived classes are free to reimplement this, but they should call this + * base class method in the overloaded function. + **/ + virtual void setRelNotesButton( bool relNotesButton = true ); + + /** * Set a property. * Reimplemented from YWidget. * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/src/YTypes.h new/libyui-3.0.12/src/YTypes.h --- old/libyui-3.0.10/src/YTypes.h 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/src/YTypes.h 2013-12-11 11:09:00.000000000 +0100 @@ -84,6 +84,7 @@ YApplyButton, // [Apply] YCancelButton, // [Cancel] YHelpButton, // [Help] + YRelNotesButton, // [Release Notes] YMaxButtonRole // For use as array size }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/src/YUILoader.cc new/libyui-3.0.12/src/YUILoader.cc --- old/libyui-3.0.10/src/YUILoader.cc 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/src/YUILoader.cc 2013-12-11 11:09:00.000000000 +0100 @@ -116,6 +116,79 @@ YUI_THROW( YUIPluginException( name ) ); } +void YUILoader::loadExternalWidgetsPlugin ( const std::string& name, const std::string& plugin_name, const std::string& symbol ) +{ + YUIPlugin uiPlugin ( plugin_name.c_str() ); + + if ( uiPlugin.success() ) + { + createEWFunction_t createEW = ( createEWFunction_t ) uiPlugin.locateSymbol ( symbol.c_str() ); + + if ( createEW ) + { + YExternalWidgets * we = createEW ( name.c_str() ); + + if ( we ) + return; + } + } + + YUI_THROW ( YUIPluginException ( plugin_name ) ); +} + +void YUILoader::loadExternalWidgets ( const std::string& name, const std::string& symbol ) +{ + const char * envDisplay = getenv( "DISPLAY" ); + + YCommandLine cmdline; + + bool wantNcurses = cmdline.find("--ncurses") != -1; + bool wantQt = cmdline.find("--qt") != -1; + bool wantGtk = cmdline.find("--gtk") != -1; + + bool haveQt = pluginExists( YUIPlugin_Qt ); + bool haveGtk = pluginExists( YUIPlugin_Gtk ); + + if ( envDisplay && !wantNcurses ) + { + std::string wantedGUI = name; + wantedGUI.append("-"); + + if ( haveQt && !wantGtk) + wantedGUI.append(YUIPlugin_Qt); + else if ( haveGtk && !wantQt ) + wantedGUI.append(YUIPlugin_Gtk); + + try + { + loadExternalWidgetsPlugin(name, wantedGUI, symbol ); + return; + } + catch ( YUIException & ex) + { + YUI_CAUGHT( ex ); + } + } + + // + // NCurses UI (test on tty has already been done by loadUI) + // + + try + { + std::string wantedNcurses = name; + wantedNcurses.append("-"); + wantedNcurses.append(YUIPlugin_NCurses); + loadExternalWidgetsPlugin(name, wantedNcurses, symbol ); + return; + } + catch ( YUIException & ex) + { + YUI_CAUGHT( ex ); + YUI_RETHROW( ex ); // what else to do here? + } +} + bool YUILoader::pluginExists( const std::string & pluginBaseName ) { struct stat fileinfo; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/src/YUILoader.h new/libyui-3.0.12/src/YUILoader.h --- old/libyui-3.0.10/src/YUILoader.h 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/src/YUILoader.h 2013-12-11 11:09:00.000000000 +0100 @@ -30,6 +30,7 @@ #include <string> #include "YUI.h" +#include "YExternalWidgets.h" @@ -59,10 +60,39 @@ static void loadPlugin( const std::string & name, bool withThreads = false ); static bool pluginExists( const std::string & pluginBaseName ); - + + /** + * Load the given External Widgets plugin followed by its graphical extension implementation + * in the following order in the same way as loadUI: + * - Qt, Gtk or NCurses + * + * 'name' is the user defined plugin name, graphical extension implementations have to + * be called 'name'-qt, 'name'-gtk and 'name'-ncurses. Following this rule plugin + * file names are as libyui-XX-YY.so.VER where: + * XX is the user defined name + * YY is the UI used (ncurses, gtk, qt) + * VER is the libyui so version + * 'symbol' is the function symbol to be loaded, e.g. YExternalWidgets* 'symbol'(void) + * (e.g. default YExternalWidgets* createExternalWidgets(const char *) + * see createEWFunction_t definition) + **/ + static void loadExternalWidgets( const std::string & name, const std::string & symbol="_Z21createExternalWidgetsPKc" ); + private: YUILoader() {} ~YUILoader() {} + + /** + * Used by loadExternalWidgets to load the graphical plugin specialization. + * + * 'name' is the original plugin name (e.g. the one passed to loadExternalWidgets) + * 'plugin_name' is the graphical plugin specialization name (e.g. 'name'-[gtk|ncurses|qt]) + * 'symbol' is the function symbol to be loaded and executed (e.g. the one passed loadExternalWidgets) + * This might throw exceptions: + * YUIPluginException if the plugin has not been loaded + * specific exception can be thrown by funtion invoked (param symbol) + **/ + static void loadExternalWidgetsPlugin( const std::string& name, const std::string& plugin_name, const std::string& symbol ); }; @@ -76,5 +106,14 @@ **/ typedef YUI * (*createUIFunction_t)( bool ); +/** + * Every WE extension plug-in has to provide a function + * + * YExternalWidgets * createWE( ) + * + * that creates a WE of that specific type upon the first call and returns that + * singleton for all subsequent calls. + **/ +typedef YExternalWidgets * (*createEWFunction_t)( const char * ); #endif // YUILoader_h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-3.0.10/src/YUISymbols.h new/libyui-3.0.12/src/YUISymbols.h --- old/libyui-3.0.10/src/YUISymbols.h 2013-08-06 15:33:21.000000000 +0200 +++ new/libyui-3.0.12/src/YUISymbols.h 2013-12-11 11:09:00.000000000 +0100 @@ -217,6 +217,7 @@ #define YUIOpt_easterEgg "easterEgg" #define YUIOpt_editable "editable" #define YUIOpt_helpButton "helpButton" +#define YUIOpt_relNotesButton "relNotesButton" #define YUIOpt_hstretch "hstretch" #define YUIOpt_hvstretch "hvstretch" #define YUIOpt_immediate "immediate" -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
