Mailinglist Archive: yast-commit (819 mails)

< Previous Next >
[yast-commit] r54911 - in /branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src: YQPackageSelector.cc YQPackageSelector.h YQPkgFilterTab.cc YQPkgFilterTab.h
  • From: sh-sh-sh@xxxxxxxxxxxxxxxx
  • Date: Thu, 22 Jan 2009 14:22:44 -0000
  • Message-id: <E1LQ0SC-0002TZ-Oh@xxxxxxxxxxxxxxxx>
Author: sh-sh-sh
Date: Thu Jan 22 15:22:44 2009
New Revision: 54911

URL: http://svn.opensuse.org/viewcvs/yast?rev=54911&view=rev
Log:
first version that works

Modified:
branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPackageSelector.cc
branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPackageSelector.h
branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPkgFilterTab.cc
branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPkgFilterTab.h

Modified: branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPackageSelector.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPackageSelector.cc?rev=54911&r1=54910&r2=54911&view=diff
==============================================================================
--- branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPackageSelector.cc
(original)
+++ branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPackageSelector.cc Thu Jan
22 15:22:44 2009
@@ -110,7 +110,6 @@
_showChangesDialog = true;
_autoDependenciesAction = 0;
_detailsViews = 0;
- _diskUsageList = 0;
_filters = 0;
_repoFilterView = 0;
_langList = 0;
@@ -189,8 +188,8 @@
}


- if ( _diskUsageList )
- _diskUsageList->updateDiskUsage();
+ if ( _filters->diskUsageList() )
+ _filters->diskUsageList()->updateDiskUsage();

yuiMilestone() << "PackageSelector init done" << endl;

@@ -211,7 +210,8 @@
std::string
YQPackageSelector::iconPath( const std::string &name, int size )
{
- return zypp::str::form("%s/share/icons/hicolor/%dx%d/apps/%s.png", PREFIX,
size, size, name.c_str());
+ return zypp::str::form("%s/share/icons/hicolor/%dx%d/apps/%s.png",
+ PREFIX, size, size, name.c_str() );
}


@@ -223,63 +223,18 @@
setLayout( layout );
layoutMenuBar( this );

-#if 0
- QSplitter * outer_splitter = new QSplitter( Qt::Horizontal, this );
- Q_CHECK_PTR( outer_splitter );
-
- outer_splitter->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,
QSizePolicy::Expanding ) );
- outer_splitter->setObjectName( "outer_splitter" );
- layout->addWidget( outer_splitter );
-
- QWidget * left_pane = layoutLeftPane ( outer_splitter );
- QWidget * right_pane = layoutRightPane( outer_splitter );
+ _filters = new YQPkgFilterTab( this );
+ YUI_CHECK_NEW( _filters );

- outer_splitter->setStretchFactor( outer_splitter->indexOf( left_pane ),
0);
- outer_splitter->setStretchFactor( outer_splitter->indexOf( right_pane ),
1);
-#else
- _filterTab = new YQPkgFilterTab( this );
- YUI_CHECK_NEW( _filterTab );
- layout->addWidget( _filterTab );
-#endif
- layoutRightPane( _filterTab->rightPane() );
-}
-
-
-QWidget *
-YQPackageSelector::layoutLeftPane( QWidget *parent )
-{
- QSplitter * splitter = new QSplitter( Qt::Vertical, parent );
- Q_CHECK_PTR( splitter );
- splitter->setObjectName( "left_pane_splitter" );
-
- QWidget * upper_vbox = new QWidget( splitter );
- QVBoxLayout * layout = new QVBoxLayout( upper_vbox );
- layout->setContentsMargins( 0, MARGIN, 0, 0 );
- upper_vbox->setLayout(layout);
-
- Q_CHECK_PTR( upper_vbox );
- layoutFilters( upper_vbox );
-
- _diskUsageList = new YQPkgDiskUsageList( splitter );
-
- splitter->setStretchFactor(splitter->indexOf(upper_vbox), 1);
- splitter->setStretchFactor(splitter->indexOf( _diskUsageList ), 2);
- QList<int> sizes;
- sizes << height();
- sizes << 0;
- splitter->setSizes( sizes );
-
- return splitter;
+ layout->addWidget( _filters );
+ layoutFilters( this );
+ layoutRightPane( _filters->rightPane() );
}


void
YQPackageSelector::layoutFilters( QWidget *parent )
{
- _filters = new QY2ComboTabWidget( _( "Fi&lter:" ), parent );
- Q_CHECK_PTR( _filters );
- parent->layout()->addWidget(_filters);
-
//
// Update problem view
//
@@ -289,8 +244,8 @@
if ( YQPkgUpdateProblemFilterView::haveProblematicPackages()
|| testMode() )
{
- _updateProblemFilterView = new YQPkgUpdateProblemFilterView(
parent);
- Q_CHECK_PTR( _updateProblemFilterView );
+ _updateProblemFilterView = new YQPkgUpdateProblemFilterView( parent
);
+ YUI_CHECK_NEW( _updateProblemFilterView );
_filters->addPage( _( "Update Problems" ), _updateProblemFilterView
);
}
}
@@ -305,7 +260,9 @@
|| ! zyppPool().empty<zypp::Patch>()
#endif
)
+ {
addPatchFilterView();
+ }


//
@@ -315,7 +272,7 @@
if ( ! zyppPool().empty<zypp::Pattern>() || testMode() )
{
_patternList = new YQPkgPatternList( parent, true );
- Q_CHECK_PTR( _patternList );
+ YUI_CHECK_NEW( _patternList );
_filters->addPage( _( "Patterns" ), _patternList );

connect( _patternList, SIGNAL( statusChanged()
),
@@ -337,7 +294,7 @@
//

_rpmGroupTagsFilterView = new YQPkgRpmGroupTagsFilterView( parent );
- Q_CHECK_PTR( _rpmGroupTagsFilterView );
+ YUI_CHECK_NEW( _rpmGroupTagsFilterView );
_filters->addPage( _( "Package Groups" ), _rpmGroupTagsFilterView );

connect( this, SIGNAL( loadData() ),
@@ -348,7 +305,7 @@
// Languages view
//
_langList = new YQPkgLangList( parent );
- Q_CHECK_PTR( _langList );
+ YUI_CHECK_NEW( _langList );

_filters->addPage( _( "Languages" ), _langList );
_langList->setSizePolicy( QSizePolicy( QSizePolicy::Ignored,
QSizePolicy::Ignored ) ); // hor/vert
@@ -365,7 +322,7 @@
//

_repoFilterView = new YQPkgRepoFilterView( parent );
- Q_CHECK_PTR( _repoFilterView );
+ YUI_CHECK_NEW( _repoFilterView );
_filters->addPage( _( "Repositories" ), _repoFilterView );


@@ -374,7 +331,7 @@
//

_searchFilterView = new YQPkgSearchFilterView( parent );
- Q_CHECK_PTR( _searchFilterView );
+ YUI_CHECK_NEW( _searchFilterView );
_filters->addPage( _( "Search" ), _searchFilterView );


@@ -383,7 +340,7 @@
//

_statusFilterView = new YQPkgStatusFilterView( parent );
- Q_CHECK_PTR( _statusFilterView );
+ YUI_CHECK_NEW( _statusFilterView );
_filters->addPage( _( "Installation Summary" ), _statusFilterView );


@@ -400,20 +357,16 @@
QWidget *
YQPackageSelector::layoutRightPane( QWidget *parent )
{
- QWidget * right_pane_vbox = new QWidget( parent );
-
- QVBoxLayout *layout = new QVBoxLayout( right_pane_vbox );
- Q_CHECK_PTR( right_pane_vbox );
-
- QSplitter * splitter = new QSplitter( Qt::Vertical, right_pane_vbox );
- Q_CHECK_PTR( splitter );
+ QVBoxLayout *layout = new QVBoxLayout( parent );
+ QSplitter * splitter = new QSplitter( Qt::Vertical, parent );
+ YUI_CHECK_NEW( splitter );
layout->addWidget(splitter);

layoutPkgList( splitter );
layoutDetailsViews( splitter );
- layoutButtons( right_pane_vbox );
+ layoutButtons( parent );

- return right_pane_vbox;
+ return parent;
}


@@ -421,7 +374,7 @@
YQPackageSelector::layoutPkgList( QWidget *parent )
{
_pkgList= new YQPkgList( parent );
- Q_CHECK_PTR( _pkgList );
+ YUI_CHECK_NEW( _pkgList );

connect( _pkgList, SIGNAL( statusChanged() ),
this, SLOT ( autoResolveDependencies() ) );
@@ -435,19 +388,19 @@


_detailsViews = new QTabWidget( parent );
- Q_CHECK_PTR( _detailsViews );
+ YUI_CHECK_NEW( _detailsViews );

//
// Description
//

_pkgDescriptionView = new YQPkgDescriptionView( _detailsViews );
- Q_CHECK_PTR( _pkgDescriptionView );
+ YUI_CHECK_NEW( _pkgDescriptionView );

_detailsViews->addTab( _pkgDescriptionView, _( "D&escription" ) );
_detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,
QSizePolicy::Expanding ) ); // hor/vert

- connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel
) ),
+ connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel )
),
_pkgDescriptionView, SLOT ( showDetailsIfVisible( ZyppSel )
) );

//
@@ -455,11 +408,11 @@
//

_pkgTechnicalDetailsView = new YQPkgTechnicalDetailsView( _detailsViews );
- Q_CHECK_PTR( _pkgTechnicalDetailsView );
+ YUI_CHECK_NEW( _pkgTechnicalDetailsView );

_detailsViews->addTab( _pkgTechnicalDetailsView, _( "&Technical Data" ) );

- connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel
) ),
+ connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel )
),
_pkgTechnicalDetailsView, SLOT ( showDetailsIfVisible( ZyppSel )
) );


@@ -468,12 +421,12 @@
//

_pkgDependenciesView = new YQPkgDependenciesView( _detailsViews );
- Q_CHECK_PTR( _pkgDependenciesView );
+ YUI_CHECK_NEW( _pkgDependenciesView );

_detailsViews->addTab( _pkgDependenciesView, _( "Dependencies" ) );
_detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,
QSizePolicy::Expanding ) ); // hor/vert

- connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel
) ),
+ connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel )
),
_pkgDependenciesView, SLOT ( showDetailsIfVisible( ZyppSel )
) );


@@ -484,11 +437,11 @@

_pkgVersionsView = new YQPkgVersionsView( _detailsViews,
true ); // userCanSwitchVersions
- Q_CHECK_PTR( _pkgVersionsView );
+ YUI_CHECK_NEW( _pkgVersionsView );

_detailsViews->addTab( _pkgVersionsView, _( "&Versions" ) );

- connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
+ connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel ) ),
_pkgVersionsView, SLOT ( showDetailsIfVisible( ZyppSel ) ) );


@@ -499,12 +452,12 @@
if ( haveInstalledPkgs ) // file list information is only available for
installed pkgs
{
_pkgFileListView = new YQPkgFileListView( _detailsViews );
- Q_CHECK_PTR( _pkgFileListView );
+ YUI_CHECK_NEW( _pkgFileListView );

_detailsViews->addTab( _pkgFileListView, _( "File List" ) );
_detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,
QSizePolicy::Expanding ) ); // hor/vert

- connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel
) ),
+ connect( _pkgList, SIGNAL( currentItemChanged ( ZyppSel )
),
_pkgFileListView, SLOT ( showDetailsIfVisible( ZyppSel )
) );
}

@@ -516,7 +469,7 @@
if ( haveInstalledPkgs ) // change log information is only available for
installed pkgs
{
_pkgChangeLogView = new YQPkgChangeLogView( _detailsViews );
- Q_CHECK_PTR( _pkgChangeLogView );
+ YUI_CHECK_NEW( _pkgChangeLogView );

_detailsViews->addTab( _pkgChangeLogView, _( "Change Log" ) );
_detailsViews->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,
QSizePolicy::Expanding ) ); // hor/vert
@@ -531,7 +484,7 @@
YQPackageSelector::layoutButtons( QWidget *parent )
{
QWidget * button_box = new QWidget( parent );
- Q_CHECK_PTR( button_box );
+ YUI_CHECK_NEW( button_box );
parent->layout()->addWidget( button_box );

QHBoxLayout *layout = new QHBoxLayout(button_box);
@@ -540,7 +493,7 @@
layout->addStretch();

QPushButton * cancel_button = new QPushButton( _( "&Cancel" ), button_box
);
- Q_CHECK_PTR( cancel_button );
+ YUI_CHECK_NEW( cancel_button );
layout->addWidget(cancel_button);

cancel_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
QSizePolicy::Fixed ) ); // hor/vert
@@ -550,7 +503,7 @@


QPushButton * accept_button = new QPushButton( _( "&Accept" ), button_box
);
- Q_CHECK_PTR( accept_button );
+ YUI_CHECK_NEW( accept_button );
layout->addWidget(accept_button);
accept_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
QSizePolicy::Fixed ) ); // hor/vert

@@ -565,7 +518,7 @@
YQPackageSelector::layoutMenuBar( QWidget *parent )
{
_menuBar = new QMenuBar( parent );
- Q_CHECK_PTR( _menuBar );
+ YUI_CHECK_NEW( _menuBar );

parent->layout()->addWidget(_menuBar);

@@ -589,7 +542,7 @@
//

_fileMenu = new QMenu( _menuBar );
- Q_CHECK_PTR( _fileMenu );
+ YUI_CHECK_NEW( _fileMenu );
QAction *action = _menuBar->addMenu( _fileMenu );
action->setText( _( "&File" ));

@@ -609,7 +562,7 @@
//

_viewMenu = new QMenu( _menuBar );
- Q_CHECK_PTR( _viewMenu );
+ YUI_CHECK_NEW( _viewMenu );
QAction *action = _menuBar->addMenu( _viewMenu );
action->setText(_( "&View" ));

@@ -620,7 +573,7 @@
_showDevelAction->setChecked(true);

_excludeDevelPkgs = new YQPkgObjList::ExcludeRule( _pkgList, QRegExp(
".*-devel(-\\d+bit)?$" ), _pkgList->nameCol() );
- Q_CHECK_PTR( _excludeDevelPkgs );
+ YUI_CHECK_NEW( _excludeDevelPkgs );
_excludeDevelPkgs->enable( false );

// Translators: This is about packages ending in "-debuginfo", so don't
translate that "-debuginfo"!
@@ -629,7 +582,7 @@
_showDebugAction->setCheckable(true);
_showDebugAction->setChecked(true);
_excludeDebugInfoPkgs = new YQPkgObjList::ExcludeRule( _pkgList,
QRegExp( ".*-(debuginfo|debugsource)$" ), _pkgList->nameCol() );
- Q_CHECK_PTR( _excludeDebugInfoPkgs );
+ YUI_CHECK_NEW( _excludeDebugInfoPkgs );
_excludeDebugInfoPkgs->enable( false );


@@ -638,7 +591,7 @@
//

_pkgMenu = new QMenu( _menuBar );
- Q_CHECK_PTR( _pkgMenu );
+ YUI_CHECK_NEW( _pkgMenu );
action = _menuBar->addMenu( _pkgMenu );
action->setText(_( "&Package" ));

@@ -659,7 +612,7 @@

_pkgMenu->addSeparator();
QMenu * submenu = _pkgList->addAllInListSubMenu( _pkgMenu );
- Q_CHECK_PTR( submenu );
+ YUI_CHECK_NEW( submenu );

#if ENABLE_SOURCE_RPMS
submenu->addSeparator();
@@ -673,7 +626,7 @@
//

submenu = new QMenu( _pkgMenu );
- Q_CHECK_PTR( submenu );
+ YUI_CHECK_NEW( submenu );

// Translators: Unlike the "all in this list" submenu, this submenu
// refers to all packages globally, not only to those that are
@@ -696,7 +649,7 @@
//

_patchMenu = new QMenu( _menuBar );
- Q_CHECK_PTR( _patchMenu );
+ YUI_CHECK_NEW( _patchMenu );
action = _menuBar->addMenu( _patchMenu );
action->setText(_( "&Patch" ));

@@ -722,7 +675,7 @@
if ( repoMgrEnabled() )
{
_configMenu = new QMenu( _menuBar );
- Q_CHECK_PTR( _configMenu );
+ YUI_CHECK_NEW( _configMenu );
action = _menuBar->addMenu( _configMenu );
action->setText(_( "&Configuration" ));
_configMenu->addAction( _( "&Repositories..." ), this, SLOT(
repoManager() ), Qt::CTRL + Qt::Key_R );
@@ -734,7 +687,7 @@
//

_dependencyMenu = new QMenu( _menuBar );
- Q_CHECK_PTR( _dependencyMenu );
+ YUI_CHECK_NEW( _dependencyMenu );
action = _menuBar->addMenu( _dependencyMenu );
action->setText(_( "&Dependencies" ));

@@ -749,7 +702,7 @@
// Extras menu
//
_extrasMenu = new QMenu( _menuBar );
- Q_CHECK_PTR( _extrasMenu );
+ YUI_CHECK_NEW( _extrasMenu );
action = _menuBar->addMenu( _extrasMenu );
action->setText(_( "&Extras" ));

@@ -792,7 +745,7 @@
//

_helpMenu = new QMenu( _menuBar );
- Q_CHECK_PTR( _helpMenu );
+ YUI_CHECK_NEW( _helpMenu );
_menuBar->addSeparator();
action = _menuBar->addMenu( _helpMenu );
action->setText(_( "&Help" ));
@@ -844,15 +797,15 @@
pkgList, SLOT ( setFocus() ) );


- if ( hasUpdateSignal )
+ if ( hasUpdateSignal && _filters->diskUsageList() )
{
connect( filter, SIGNAL( updatePackages() ),
pkgList, SLOT ( updateItemStates() ) );

- if ( _diskUsageList )
+ if ( _filters->diskUsageList() )
{
- connect( filter, SIGNAL( updatePackages() ),
- _diskUsageList, SLOT ( updateDiskUsage() ) );
+ connect( filter, SIGNAL( updatePackages() ),
+ _filters->diskUsageList(), SLOT ( updateDiskUsage() ) );
}
}
}
@@ -882,11 +835,11 @@
_pkgList, SLOT ( addPkgItemDimmed ( ZyppSel,
ZyppPkg ) ) );
}

- if ( _pkgList && _diskUsageList )
+ if ( _pkgList && _filters->diskUsageList() )
{

- connect( _pkgList, SIGNAL( statusChanged() ),
- _diskUsageList, SLOT ( updateDiskUsage() ) );
+ connect( _pkgList, SIGNAL( statusChanged() ),
+ _filters->diskUsageList(), SLOT ( updateDiskUsage() ) );
}

connectPatchList();
@@ -912,10 +865,10 @@
}


- if ( _diskUsageList )
+ if ( _filters->diskUsageList() )
{
connect( _pkgConflictDialog, SIGNAL( updatePackages() ),
- _diskUsageList, SLOT ( updateDiskUsage() ) );
+ _filters->diskUsageList(), SLOT ( updateDiskUsage() ) );
}
}

@@ -936,7 +889,7 @@
//

QShortcut * accel = new QShortcut( Qt::Key_F2, this, SLOT(
hotkeyInsertPatchFilterView() ) );
- Q_CHECK_PTR( accel );
+ YUI_CHECK_NEW( accel );

//
// Update actions just before opening menus
@@ -999,11 +952,11 @@
if ( ! _patchFilterView )
{
_patchFilterView = new YQPkgPatchFilterView( this );
- Q_CHECK_PTR( _patchFilterView );
+ YUI_CHECK_NEW( _patchFilterView );
_filters->addPage( _( "Patches" ), _patchFilterView );

_patchList = _patchFilterView->patchList();
- Q_CHECK_PTR( _patchList );
+ YUI_CHECK_PTR( _patchList );

connectPatchList();
}

Modified: branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPackageSelector.h
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPackageSelector.h?rev=54911&r1=54910&r2=54911&view=diff
==============================================================================
--- branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPackageSelector.h
(original)
+++ branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPackageSelector.h Thu Jan
22 15:22:44 2009
@@ -43,7 +43,6 @@
class YQPkgChangeLogView;
class YQPkgDependenciesView;
class YQPkgDescriptionView;
-class YQPkgDiskUsageList;
class YQPkgFileListView;
class YQPkgFilterTab;
class YQPkgLangList;
@@ -202,7 +201,6 @@

void basicLayout();

- QWidget * layoutLeftPane ( QWidget *parent );
QWidget * layoutRightPane ( QWidget *parent );
void layoutFilters ( QWidget *parent );
void layoutPkgList ( QWidget *parent );
@@ -295,8 +293,7 @@
QAction * _autoDependenciesAction;
QPushButton * _checkDependenciesButton;
QTabWidget * _detailsViews;
- YQPkgFilterTab * _filterTab;
- QY2ComboTabWidget * _filters;
+ YQPkgFilterTab * _filters;
YQPkgChangeLogView * _pkgChangeLogView;
YQPkgDependenciesView * _pkgDependenciesView;
YQPkgDescriptionView * _pkgDescriptionView;

Modified: branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPkgFilterTab.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPkgFilterTab.cc?rev=54911&r1=54910&r2=54911&view=diff
==============================================================================
--- branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPkgFilterTab.cc (original)
+++ branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPkgFilterTab.cc Thu Jan 22
15:22:44 2009
@@ -27,6 +27,9 @@

#include "YUIException.h"
#include "YQPkgFilterTab.h"
+#include "YQPkgDiskUsageList.h"
+#include "YQSignalBlocker.h"
+#include "utf8.h"


using std::vector;
@@ -38,13 +41,17 @@
YQPkgFilterTabPrivate()
: baseClassWidgetStack(0)
, outerSplitter(0)
- ,widgetStack(0)
+ , leftPaneSplitter(0)
+ , filtersWidgetStack(0)
+ , diskUsageList(0)
, rightPane(0)
{}

QStackedWidget * baseClassWidgetStack;
QSplitter * outerSplitter;
- QStackedWidget * widgetStack;
+ QSplitter * leftPaneSplitter;
+ QStackedWidget * filtersWidgetStack;
+ YQPkgDiskUsageList * diskUsageList;
QWidget * rightPane;
YQPkgFilterPageVector pages;
};
@@ -65,16 +72,79 @@

priv->baseClassWidgetStack = findChild<QStackedWidget*>();
YUI_CHECK_PTR( priv->baseClassWidgetStack );
- yuiWarning() << "Found base class widget stack at "
- << hex << priv->baseClassWidgetStack << dec
- << endl;

- // Nasty hack: Disconnect the base class from signals from its tab bar. We
- // will handle that signal on our own.
+ // Nasty hack: Disconnect the base class from signals from its tab bar.
+ // We will handle that signal on our own.

disconnect( tabBar(), SIGNAL( currentChanged( int ) ), 0, 0 );


+ //
+ // Splitter that divides this widget into a left and a right pane
+ //
+
+ priv->outerSplitter = new QSplitter( Qt::Horizontal, this );
+ YUI_CHECK_NEW( priv->outerSplitter );
+
+ priv->outerSplitter->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,
+ QSizePolicy::Expanding ) );
+ priv->baseClassWidgetStack->addWidget( priv->outerSplitter );
+
+
+ //
+ // Splitter that divides the left pane into upper filters area and disk
usage area
+ //
+
+ priv->leftPaneSplitter = new QSplitter( Qt::Vertical, priv->outerSplitter
);
+ YUI_CHECK_NEW( priv->leftPaneSplitter );
+
+
+ //
+ // Left pane content
+ //
+
+ priv->filtersWidgetStack = new QStackedWidget( priv->leftPaneSplitter );
+ YUI_CHECK_NEW( priv->filtersWidgetStack );
+
+ priv->diskUsageList = new YQPkgDiskUsageList( priv->leftPaneSplitter );
+ YUI_CHECK_NEW( priv->diskUsageList );
+
+ {
+ QSplitter * sp = priv->leftPaneSplitter;
+ sp->setStretchFactor( sp->indexOf( priv->filtersWidgetStack ), 1 );
+ sp->setStretchFactor( sp->indexOf( priv->diskUsageList ), 2 );
+
+
+ // FIXME: Don't always hide the disk usage list
+ QList<int> sizes;
+ sizes << priv->leftPaneSplitter->height();
+ sizes << 0;
+ sp->setSizes( sizes );
+ }
+
+
+ //
+ // Right pane
+ //
+
+ priv->rightPane = new QWidget( priv->outerSplitter );
+ YUI_CHECK_NEW( priv->rightPane );
+
+
+ //
+ // Stretch factors for left and right pane
+ //
+ {
+ QSplitter * sp = priv->outerSplitter;
+ sp->setStretchFactor( sp->indexOf( priv->leftPaneSplitter ), 0 );
+ sp->setStretchFactor( sp->indexOf( priv->rightPane ), 1 );
+ }
+
+
+ // Set up connections
+
+ connect( tabBar(), SIGNAL( currentChanged( int ) ),
+ this, SLOT ( showPage ( int ) ) );
}


@@ -91,6 +161,20 @@
}


+QWidget *
+YQPkgFilterTab::rightPane() const
+{
+ return priv->rightPane;
+}
+
+
+YQPkgDiskUsageList *
+YQPkgFilterTab::diskUsageList() const
+{
+ return priv->diskUsageList;
+}
+
+
void
YQPkgFilterTab::addPage( const QString & pageLabel,
QWidget * pageContent,
@@ -101,28 +185,63 @@
pageContent,
internalName,
showAlways );
+ YUI_CHECK_NEW( page );
+
priv->pages.push_back( page );
+ priv->filtersWidgetStack->addWidget( pageContent );
+
+ // FIXME: Only add showAlways pages immediately
+ yuiWarning() << "Adding " << toUTF8( pageLabel) << endl;
+ page->tabIndex = tabBar()->addTab( pageLabel );
}


void
-YQPkgFilterTab::showPage( QWidget * page )
+YQPkgFilterTab::showPage( QWidget * pageContent )
{
-
+ YQPkgFilterPage * page = findPage( pageContent );
+ YUI_CHECK_PTR( page );
+
+ showPage( page );
}


void
YQPkgFilterTab::showPage( const QString & internalName )
{
+ YQPkgFilterPage * page = findPage( internalName );
+ YUI_CHECK_PTR( page );

+ showPage( page );
}


-QWidget *
-YQPkgFilterTab::rightPane() const
+void
+YQPkgFilterTab::showPage( int tabIndex )
{
- return priv->rightPane;
+ YQPkgFilterPage * page = findPage( tabIndex );
+
+ if ( page )
+ showPage( page );
+}
+
+
+void
+YQPkgFilterTab::showPage( YQPkgFilterPage * page )
+{
+ YUI_CHECK_PTR( page );
+ YQSignalBlocker sigBlocker( tabBar() );
+
+ if ( page->tabIndex < 0 ) // No corresponding tab yet?
+ {
+ // Add a tab for that page
+ page->tabIndex = tabBar()->addTab( page->label );
+ }
+
+ priv->filtersWidgetStack->setCurrentWidget( page->content );
+ tabBar()->setCurrentIndex( page->tabIndex );
+
+ emit currentChanged( page->content );
}


@@ -142,7 +261,7 @@


YQPkgFilterPage *
-YQPkgFilterTab::findPage( const QString * internalName )
+YQPkgFilterTab::findPage( const QString & internalName )
{
for ( YQPkgFilterPageVector::iterator it = priv->pages.begin();
it != priv->pages.end();
@@ -156,6 +275,24 @@
}


+YQPkgFilterPage *
+YQPkgFilterTab::findPage( int tabIndex )
+{
+ if ( tabIndex < 0 )
+ return 0;
+
+ for ( YQPkgFilterPageVector::iterator it = priv->pages.begin();
+ it != priv->pages.end();
+ ++it )
+ {
+ if ( (*it)->tabIndex == tabIndex )
+ return *it;
+ }
+
+ return 0;
+}
+
+

#include "YQPkgFilterTab.moc"


Modified: branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPkgFilterTab.h
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPkgFilterTab.h?rev=54911&r1=54910&r2=54911&view=diff
==============================================================================
--- branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPkgFilterTab.h (original)
+++ branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPkgFilterTab.h Thu Jan 22
15:22:44 2009
@@ -26,12 +26,13 @@

class YQPkgFilterTabPrivate;
class YQPkgFilterPage;
+class YQPkgDiskUsageList;


/**
* Widget for "tabbed browsing" in packages:
*
- * /------\/------\/------\
+ * /------\/------\/------\
* | Tab1 || Tab2 || Tab3 | [New] [Close]
* +-----------------+------------------------------------+
* | | |
@@ -58,7 +59,7 @@
* but the last filter pages can be closed with the [Close] button.
*
* The left (filter page) and right panes are separated with a user-moveable
- * splitter.
+ * splitter.
**/
class YQPkgFilterTab: protected QTabWidget
{
@@ -93,7 +94,22 @@
* Return the right pane.
**/
QWidget * rightPane() const;
-
+
+ /**
+ * Return the disk usage list widget or 0 if there is none.
+ **/
+ YQPkgDiskUsageList * diskUsageList() const;
+
+
+signals:
+
+ /**
+ * Emitted when the current page changes.
+ * NOT emitted initially for the very first page that is shown.
+ **/
+ void currentChanged( QWidget * newPageContent );
+
+
public slots:

/**
@@ -102,13 +118,26 @@
void showPage( QWidget * page );
void showPage( const QString & internalName );

-
+
+protected slots:
+
+ /**
+ * Show the page with the specified tab index.
+ **/
+ void showPage( int tabIndex );
+
+
protected:

/**
+ * Show a page.
+ **/
+ void showPage( YQPkgFilterPage * page );
+
+ /**
* Find a filter page by its content widget (the widget that was passed
* to addPage() ).
- * Return 0 if there is no such page.
+ * Return 0 if there is no such page.
**/
YQPkgFilterPage * findPage( QWidget * pageContent );

@@ -116,9 +145,15 @@
* Find a filter page by its internal name.
* Return 0 if there is no such page.
**/
- YQPkgFilterPage * findPage( const QString * internalName );
+ YQPkgFilterPage * findPage( const QString & internalName );
+
+ /**
+ * Find a filter page by its tab index.
+ * Return 0 if there is no such page.
+ **/
+ YQPkgFilterPage * findPage( int tabIndex );
+

-
private:

ImplPtr<YQPkgFilterTabPrivate> priv;
@@ -139,15 +174,15 @@
, label( pageLabel )
, id( internalName )
, showAlways( showAlways )
+ , tabIndex( -1 )
{}
-
+
QWidget * content;
- QString label; // user visible
- QString id; // internal
+ QString label; // user visible text
+ QString id; // internal name
bool showAlways;
+ int tabIndex; // index of the corresponding tab or -1
if none
};


-
-
#endif // YQPkgFilterTab_h

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

< Previous Next >
This Thread
  • No further messages