Mailinglist Archive: yast-commit (953 mails)

< Previous Next >
[yast-commit] r49718 - in /trunk/ncurses-pkg/src: NCPackageSelector.cc NCPackageSelector.h NCPackageSelectorStart.cc NCPackageSelectorStart.h
  • From: kmachalkova@xxxxxxxxxxxxxxxx
  • Date: Tue, 05 Aug 2008 14:17:43 -0000
  • Message-id: <20080805141743.D0BA439CCF@xxxxxxxxxxxxxxxx>
Author: kmachalkova
Date: Tue Aug 5 16:17:43 2008
New Revision: 49718

URL: http://svn.opensuse.org/viewcvs/yast?rev=49718&view=rev
Log:
Avoiding code duplication (pkg selector modes)

This is all *cobe*-d up, NCPackageSelector should
inherit from YPackageSelector, but it's so entirely
entangled with the rest of the code that it is
impossible

Modified:
trunk/ncurses-pkg/src/NCPackageSelector.cc
trunk/ncurses-pkg/src/NCPackageSelector.h
trunk/ncurses-pkg/src/NCPackageSelectorStart.cc
trunk/ncurses-pkg/src/NCPackageSelectorStart.h

Modified: trunk/ncurses-pkg/src/NCPackageSelector.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPackageSelector.cc?rev=49718&r1=49717&r2=49718&view=diff
==============================================================================
--- trunk/ncurses-pkg/src/NCPackageSelector.cc (original)
+++ trunk/ncurses-pkg/src/NCPackageSelector.cc Tue Aug 5 16:17:43 2008
@@ -77,18 +77,14 @@
//
// Constructor
//
-NCPackageSelector::NCPackageSelector( YNCursesUI * ui, YWidget * wRoot, long
modeFlags )
- : y2ui( ui )
- , filterPopup( 0 )
+NCPackageSelector::NCPackageSelector( long modeFlags )
+ : filterPopup( 0 )
, depsPopup( 0 )
, patternPopup( 0 )
, languagePopup( 0 )
, repoPopup( 0 )
, diskspacePopup( 0 )
, searchPopup( 0 )
- , youMode( false )
- , updateMode( false )
- , testMode ( false )
, autoCheck( true )
, pkgList ( 0 )
, depsMenu( 0 )
@@ -111,16 +107,7 @@
, visibleInfo( 0 )

{
- if ( modeFlags & YPkg_OnlineUpdateMode )
- youMode = true;
-
- if ( modeFlags & YPkg_UpdateMode )
- updateMode = true;
-
- // read test source information
- if (modeFlags & YPkg_TestMode )
- testMode = true;
-
+ setFlags( modeFlags );
saveState ();
diskspacePopup = new NCPkgDiskspace( testMode );

@@ -138,6 +125,18 @@
// NCPackageSelectorPlugin::runPkgSelection
}

+void NCPackageSelector::setFlags( long modeFlags )
+{
+ youMode = ( modeFlags & YPkg_OnlineUpdateMode ) ? true : false ;
+
+ updateMode = ( modeFlags & YPkg_UpdateMode ) ? true : false ;
+
+ repoMgrEnabled = (modeFlags & YPkg_RepoMgr) ? true : false;
+
+ testMode = (modeFlags & YPkg_TestMode ) ? true : false ;
+
+}
+
bool NCPackageSelector::checkNow( bool *ok )
{
bool ret = false;

Modified: trunk/ncurses-pkg/src/NCPackageSelector.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPackageSelector.h?rev=49718&r1=49717&r2=49718&view=diff
==============================================================================
--- trunk/ncurses-pkg/src/NCPackageSelector.h (original)
+++ trunk/ncurses-pkg/src/NCPackageSelector.h Tue Aug 5 16:17:43 2008
@@ -100,8 +100,6 @@

tHandlerMap eventHandlerMap; // event handler map

- YNCursesUI * y2ui; // the UI
-
NCPkgFilterRPMGroups * filterPopup; // the rpm group tags popup

NCPkgPopupDeps * depsPopup; // the package dependeny popup
@@ -117,6 +115,7 @@
bool youMode; // YOU
bool updateMode; // Update
bool testMode; // testing
+ bool repoMgrEnabled;
bool autoCheck;

YRpmGroupsTree * _rpmGroupsTree; // rpm groups of the found packages
@@ -181,13 +180,15 @@
* @param ui The NCurses UI
* @param opt The widget options
*/
- NCPackageSelector( YNCursesUI * ui, YWidget * wRoot, long modeFlags );
+ NCPackageSelector( long modeFlags );

/**
* Destructor
*/
virtual ~NCPackageSelector();

+ void setFlags( long modeFlags);
+
/**
* Create layout for the PackageSelector
* @param parent Parent is PackageSelectorStart
@@ -266,6 +267,10 @@

bool isYouMode() { return youMode; }

+ bool isUpdateMode() { return updateMode; }
+
+ bool isRepoMgrEnabled() { return repoMgrEnabled; }
+
bool isAutoCheck() { return autoCheck; }

void AutoCheck( bool check) { autoCheck = check; }

Modified: trunk/ncurses-pkg/src/NCPackageSelectorStart.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPackageSelectorStart.cc?rev=49718&r1=49717&r2=49718&view=diff
==============================================================================
--- trunk/ncurses-pkg/src/NCPackageSelectorStart.cc (original)
+++ trunk/ncurses-pkg/src/NCPackageSelectorStart.cc Tue Aug 5 16:17:43 2008
@@ -43,42 +43,31 @@
long modeFlags,
YUIDimension dimension )
: NCLayoutBox( parent, dimension )
- , widgetRoot( 0 )
, packager( 0 )
- , youMode ( false )
- , updateMode ( false )
{
- YNCursesUI * ui = YNCursesUI::ui();
-
// set the textdomain
setTextdomain( "ncurses-pkg" );

- // get the mode (the mode is also available in PackageSelector via
modeFlags)
- if ( modeFlags & YPkg_OnlineUpdateMode )
- youMode = true;
-
- if ( modeFlags & YPkg_UpdateMode )
- updateMode = true;
-
// NEW NEW
- packager = new NCPackageSelector( ui, widgetRoot, modeFlags );
+ packager = new NCPackageSelector( modeFlags );

NCPkgTable::NCPkgTableType type;

- if ( youMode )
- type = NCPkgTable::T_Patches;
- else if ( updateMode )
- type = NCPkgTable::T_Update;
- else
- type = NCPkgTable::T_Packages;
-
if ( packager )
{
- yuiMilestone() << "YouMode: " << (youMode?"true":"false") << endl;
- if ( !youMode )
- packager->createPkgLayout( this, type );
- else
+ if ( packager->isYouMode() )
+ {
packager->createYouLayout( this );
+ type = NCPkgTable::T_Patches;
+ }
+ else
+ {
+ if ( packager->isUpdateMode() )
+ type = NCPkgTable::T_Update;
+ else
+ type = NCPkgTable::T_Packages;
+ packager->createPkgLayout( this, type );
+ }
}

yuiDebug() << endl;
@@ -136,7 +125,7 @@
// fill package list with packages belonging to default RPM group
packager->fillDefaultList();

- if ( youMode )
+ if ( packager->isYouMode() )
{
// show download size
packager->showDownloadSize();

Modified: trunk/ncurses-pkg/src/NCPackageSelectorStart.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPackageSelectorStart.h?rev=49718&r1=49717&r2=49718&view=diff
==============================================================================
--- trunk/ncurses-pkg/src/NCPackageSelectorStart.h (original)
+++ trunk/ncurses-pkg/src/NCPackageSelectorStart.h Tue Aug 5 16:17:43 2008
@@ -44,13 +44,8 @@
NCPackageSelectorStart ( const NCPackageSelectorStart & );

private:
-
- YWidget * widgetRoot; // root of the widget tree of the package
selection dialog

NCPackageSelector *packager; // packager object contains the data
and handles events
-
- bool youMode;
- bool updateMode;

protected:

@@ -97,12 +92,6 @@
* @return bool
*/
bool handleEvent( const NCursesEvent& event );
-
- /**
- * Returns the root of the widget tree.
- */
- YWidget * root( ) const { return widgetRoot; };
-

};


--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages