Mailinglist Archive: yast-commit (819 mails)

< Previous Next >
[yast-commit] r54873 - in /branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src: CMakeLists.txt YQPackageSelector.cc YQPackageSelector.h YQPkgFilterTab.cc YQPkgFilterTab.h
  • From: sh-sh-sh@xxxxxxxxxxxxxxxx
  • Date: Wed, 21 Jan 2009 17:56:00 -0000
  • Message-id: <E1LPhJ2-0007Cw-6Y@xxxxxxxxxxxxxxxx>
Author: sh-sh-sh
Date: Wed Jan 21 18:55:59 2009
New Revision: 54873

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

Added:
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/CMakeLists.txt
branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPackageSelector.cc
branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPackageSelector.h

Modified: branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/CMakeLists.txt
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/CMakeLists.txt?rev=54873&r1=54872&r2=54873&view=diff
==============================================================================
--- branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/CMakeLists.txt (original)
+++ branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/CMakeLists.txt Wed Jan 21
18:55:59 2009
@@ -32,6 +32,7 @@
YQPkgDiskUsageList.cc
YQPkgDiskUsageWarningDialog.cc
YQPkgFileListView.cc
+ YQPkgFilterTab.cc
YQPkgGenericDetailsView.cc
YQPkgLangList.cc
YQPkgList.cc

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=54873&r1=54872&r2=54873&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 Wed Jan
21 18:55:59 2009
@@ -65,6 +65,7 @@
#include "YQPkgDiskUsageList.h"
#include "YQPkgDiskUsageWarningDialog.h"
#include "YQPkgFileListView.h"
+#include "YQPkgFilterTab.h"
#include "YQPkgRepoFilterView.h"
#include "YQPkgRepoList.h"
#include "YQPkgLangList.h"
@@ -130,7 +131,6 @@
_excludeDevelPkgs = 0;
_excludeDebugInfoPkgs = 0;

-
if ( onlineUpdateMode() ) yuiMilestone() << "Online update mode" << endl;
if ( updateMode() ) yuiMilestone() << "Update mode" << endl;

@@ -220,21 +220,28 @@
{
QVBoxLayout *layout = new QVBoxLayout();
layout->setContentsMargins( MARGIN, 0, 0, MARGIN );
- setLayout(layout);
- layoutMenuBar(this);
+ 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);
+ layout->addWidget( outer_splitter );

QWidget * left_pane = layoutLeftPane ( outer_splitter );
QWidget * right_pane = layoutRightPane( outer_splitter );
-
- outer_splitter->setStretchFactor(outer_splitter->indexOf(left_pane), 0);
- outer_splitter->setStretchFactor(outer_splitter->indexOf(right_pane), 1);
+
+ 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() );
}


@@ -246,7 +253,7 @@
splitter->setObjectName( "left_pane_splitter" );

QWidget * upper_vbox = new QWidget( splitter );
- QVBoxLayout *layout = new QVBoxLayout(upper_vbox);
+ QVBoxLayout * layout = new QVBoxLayout( upper_vbox );
layout->setContentsMargins( 0, MARGIN, 0, 0 );
upper_vbox->setLayout(layout);

@@ -746,11 +753,9 @@
action = _menuBar->addMenu( _extrasMenu );
action->setText(_( "&Extras" ));

- _extrasMenu->addAction( _( "Show &Products" ), this,
SLOT( showProducts() ) );
- _extrasMenu->addAction( _( "Show P&ackage Changes" ), this, SLOT(
showAutoPkgList() ), Qt::CTRL + Qt::Key_A );
- _extrasMenu->addAction( _( "&Verify System" ), this,
SLOT( verifySystem() ) );
-
-
+ _extrasMenu->addAction( _( "Show &Products" ), this, SLOT(
showProducts() ) );
+ _extrasMenu->addAction( _( "Show P&ackage Changes" ), this, SLOT(
showAutoPkgList() ), Qt::CTRL + Qt::Key_A );
+ _extrasMenu->addAction( _( "&Verify System" ), this, SLOT(
verifySystem() ) );

_extrasMenu->addSeparator();

@@ -767,7 +772,6 @@
// Translators: This is about packages ending in "-debugsource", so don't
translate that "-debugsource"!
_extrasMenu->addAction( _( "Install All Matching -debug&source Packages"
), this, SLOT( installDebugSourcePkgs() ) );

-
_extrasMenu->addSeparator();

if ( _pkgConflictDialog )
@@ -777,7 +781,6 @@
if ( _actionResetIgnoredDependencyProblems )
_extrasMenu->addAction(_actionResetIgnoredDependencyProblems);

-
#ifdef FIXME
if ( _patchList )
_extrasMenu->addAction(_patchList->actionShowRawPatchInfo);
@@ -804,7 +807,7 @@
_helpMenu->addAction( _( "&Symbols" ), this, SLOT( symbolHelp() ),
Qt::SHIFT + Qt::Key_F1 );

// Menu entry for keyboard help
- _helpMenu->addAction( _( "&Keys" ), this, SLOT( keyboardHelp() )
);
+ _helpMenu->addAction( _( "&Keys" ), this, SLOT( keyboardHelp() ) );
}



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=54873&r1=54872&r2=54873&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 Wed Jan
21 18:55:59 2009
@@ -45,10 +45,13 @@
class YQPkgDescriptionView;
class YQPkgDiskUsageList;
class YQPkgFileListView;
-class YQPkgRepoFilterView;
+class YQPkgFilterTab;
class YQPkgLangList;
class YQPkgList;
+class YQPkgPatchFilterView;
+class YQPkgPatchList;
class YQPkgPatternList;
+class YQPkgRepoFilterView;
class YQPkgRpmGroupTagsFilterView;
class YQPkgSearchFilterView;
class YQPkgSelList;
@@ -56,8 +59,6 @@
class YQPkgTechnicalDetailsView;
class YQPkgUpdateProblemFilterView;
class YQPkgVersionsView;
-class YQPkgPatchFilterView;
-class YQPkgPatchList;

class YQPackageSelector : public YQPackageSelectorBase
{
@@ -294,6 +295,7 @@
QAction * _autoDependenciesAction;
QPushButton * _checkDependenciesButton;
QTabWidget * _detailsViews;
+ YQPkgFilterTab * _filterTab;
QY2ComboTabWidget * _filters;
YQPkgChangeLogView * _pkgChangeLogView;
YQPkgDependenciesView * _pkgDependenciesView;

Added: 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=54873&view=auto
==============================================================================
--- branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPkgFilterTab.cc (added)
+++ branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPkgFilterTab.cc Wed Jan 21
18:55:59 2009
@@ -0,0 +1,161 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YQPkgFilterTab.cc
+
+ Author: Stefan Hundhammer <sh@xxxxxxx>
+
+/-*/
+
+
+#include <vector>
+#include <QStackedWidget>
+#include <QSplitter>
+#include <QTabBar>
+
+#define YUILogComponent "qt-pkg"
+#include "YUILog.h"
+
+#include "YUIException.h"
+#include "YQPkgFilterTab.h"
+
+
+using std::vector;
+typedef vector<YQPkgFilterPage *> YQPkgFilterPageVector;
+
+
+struct YQPkgFilterTabPrivate
+{
+ YQPkgFilterTabPrivate()
+ : baseClassWidgetStack(0)
+ , outerSplitter(0)
+ ,widgetStack(0)
+ , rightPane(0)
+ {}
+
+ QStackedWidget * baseClassWidgetStack;
+ QSplitter * outerSplitter;
+ QStackedWidget * widgetStack;
+ QWidget * rightPane;
+ YQPkgFilterPageVector pages;
+};
+
+
+
+
+YQPkgFilterTab::YQPkgFilterTab( QWidget * parent )
+ : QTabWidget( parent )
+ , priv( new YQPkgFilterTabPrivate() )
+{
+ YUI_CHECK_NEW( priv );
+
+ // Nasty hack: Find the base class's QStackedWidget in its widget tree so
+ // we have a place to put our own widgets. Unfortunately, this is private
+ // in the base class, but Qt lets us search the widget hierarchy by widget
+ // type.
+
+ 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.
+
+ disconnect( tabBar(), SIGNAL( currentChanged( int ) ), 0, 0 );
+
+
+}
+
+
+YQPkgFilterTab::~YQPkgFilterTab()
+{
+ for ( YQPkgFilterPageVector::iterator it = priv->pages.begin();
+ it != priv->pages.end();
+ ++it )
+ {
+ delete (*it);
+ }
+
+ priv->pages.clear();
+}
+
+
+void
+YQPkgFilterTab::addPage( const QString & pageLabel,
+ QWidget * pageContent,
+ const QString & internalName,
+ bool showAlways )
+{
+ YQPkgFilterPage * page = new YQPkgFilterPage( pageLabel,
+ pageContent,
+ internalName,
+ showAlways );
+ priv->pages.push_back( page );
+}
+
+
+void
+YQPkgFilterTab::showPage( QWidget * page )
+{
+
+}
+
+
+void
+YQPkgFilterTab::showPage( const QString & internalName )
+{
+
+}
+
+
+QWidget *
+YQPkgFilterTab::rightPane() const
+{
+ return priv->rightPane;
+}
+
+
+YQPkgFilterPage *
+YQPkgFilterTab::findPage( QWidget * pageContent )
+{
+ for ( YQPkgFilterPageVector::iterator it = priv->pages.begin();
+ it != priv->pages.end();
+ ++it )
+ {
+ if ( (*it)->content == pageContent )
+ return *it;
+ }
+
+ return 0;
+}
+
+
+YQPkgFilterPage *
+YQPkgFilterTab::findPage( const QString * internalName )
+{
+ for ( YQPkgFilterPageVector::iterator it = priv->pages.begin();
+ it != priv->pages.end();
+ ++it )
+ {
+ if ( (*it)->id == internalName )
+ return *it;
+ }
+
+ return 0;
+}
+
+
+
+#include "YQPkgFilterTab.moc"
+

Added: 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=54873&view=auto
==============================================================================
--- branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPkgFilterTab.h (added)
+++ branches/tmp/sh/tabbed-pkg-browsing/qt-pkg/src/YQPkgFilterTab.h Wed Jan 21
18:55:59 2009
@@ -0,0 +1,153 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YQPkgFilterTab.h
+
+ Author: Stefan Hundhammer <sh@xxxxxxx>
+
+/-*/
+
+#ifndef YQPkgFilterTab_h
+#define YQPkgFilterTab_h
+
+#include <QWidget>
+#include <QHash>
+#include <QTabWidget>
+#include "ImplPtr.h"
+
+class YQPkgFilterTabPrivate;
+class YQPkgFilterPage;
+
+
+/**
+ * Widget for "tabbed browsing" in packages:
+ *
+ * /------\/------\/------\
+ * | Tab1 || Tab2 || Tab3 | [New] [Close]
+ * +-----------------+------------------------------------+
+ * | | |
+ * | QStackedWidget: | Right pane |
+ * | | |
+ * | Filter pages | (application defined) |
+ * | | |
+ * | | |
+ * | | |
+ * . . .
+ * . . .
+ * . . .
+ * | | |
+ * +-----------------+------------------------------------+
+ *
+ * Each filter page corresponds to one tab and a number of widgets in a
+ * QStackedWidget in the left filter pane. When tabs are switched, the
+ * corresponding filter page is raised to the top of the widget stack.
+ * The right pane, however, remains unchanged.
+ *
+ * Only a small numbers of filter pages is displayed as open tabs right
+ * away. Each of the other filter pages is shown in a new tabs when the user
+ * requests it via the pop-up menu on [New] button. Similarly, the tabs for all
+ * 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.
+ **/
+class YQPkgFilterTab: protected QTabWidget
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Constructor.
+ **/
+ YQPkgFilterTab( QWidget * parent );
+
+ /**
+ * Destructor.
+ **/
+ virtual ~YQPkgFilterTab();
+
+ /**
+ * Add a page with a user-visible "pageLabel", a widget with the page
+ * content and an internal name (or ID). If 'showAlways' is true, the
+ * corresponding tab will be opened immediately, otherwise the page will
+ * just be added to the pop-up menu on the [New] button.
+ *
+ * 'pageContent' will be reparented to a subwidget of this class.
+ **/
+ void addPage( const QString & pageLabel,
+ QWidget * pageContent,
+ const QString & internalName = QString(),
+ bool showAlways = false );
+
+ /**
+ * Return the right pane.
+ **/
+ QWidget * rightPane() const;
+
+public slots:
+
+ /**
+ * Show a page. Create a tab for that page if it doesn't already exist.
+ **/
+ void showPage( QWidget * page );
+ void showPage( const QString & internalName );
+
+
+protected:
+
+ /**
+ * Find a filter page by its content widget (the widget that was passed
+ * to addPage() ).
+ * Return 0 if there is no such page.
+ **/
+ YQPkgFilterPage * findPage( QWidget * pageContent );
+
+ /**
+ * Find a filter page by its internal name.
+ * Return 0 if there is no such page.
+ **/
+ YQPkgFilterPage * findPage( const QString * internalName );
+
+
+private:
+
+ ImplPtr<YQPkgFilterTabPrivate> priv;
+};
+
+
+
+/**
+ * Helper class for filter pages
+ **/
+struct YQPkgFilterPage
+{
+ YQPkgFilterPage( const QString & pageLabel,
+ QWidget * content,
+ const QString & internalName = QString(),
+ bool showAlways = false )
+ : content( content )
+ , label( pageLabel )
+ , id( internalName )
+ , showAlways( showAlways )
+ {}
+
+ QWidget * content;
+ QString label; // user visible
+ QString id; // internal
+ bool showAlways;
+};
+
+
+
+
+#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