libyui-qt-pkg
YQPkgFilterTab.h
1 /**************************************************************************
2 Copyright (C) 2000 - 2010 Novell, Inc.
3 All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 
19 **************************************************************************/
20 
21 
22 /*---------------------------------------------------------------------\
23 | |
24 | __ __ ____ _____ ____ |
25 | \ \ / /_ _/ ___|_ _|___ \ |
26 | \ V / _` \___ \ | | __) | |
27 | | | (_| |___) || | / __/ |
28 | |_|\__,_|____/ |_| |_____| |
29 | |
30 | core system |
31 | (C) SuSE GmbH |
32 \----------------------------------------------------------------------/
33 
34  File: YQPkgFilterTab.h
35 
36  Author: Stefan Hundhammer <shundhammer.de>
37 
38 /-*/
39 
40 #ifndef YQPkgFilterTab_h
41 #define YQPkgFilterTab_h
42 
43 #include <yui/ImplPtr.h>
44 
45 #include <QWidget>
46 #include <QHash>
47 #include <QTabWidget>
48 
50 class YQPkgFilterPage;
51 class YQPkgDiskUsageList;
52 class QAction;
53 
54 
87 class YQPkgFilterTab: public QTabWidget
88 {
89  Q_OBJECT
90 
91 public:
92 
96  YQPkgFilterTab( QWidget * parent, const QString & settingsName );
97 
101  virtual ~YQPkgFilterTab();
102 
108  void addPage( const QString & pageLabel,
109  QWidget * pageContent,
110  const QString & internalName );
111 
115  QWidget * rightPane() const;
116 
121 
127  YQPkgFilterPage * findPage( QWidget * pageContent );
128 
133  YQPkgFilterPage * findPage( const QString & internalName );
134 
139  YQPkgFilterPage * findPage( int tabIndex );
140 
144  int tabCount() const;
145 
153  virtual bool eventFilter ( QObject * watchedObj, QEvent * event );
154 
155 
156 signals:
157 
162  void currentChanged( QWidget * newPageContent );
163 
164 
165 public slots:
166 
170  void showPage( QWidget * page );
171  void showPage( const QString & internalName );
172 
176  void closeCurrentPage();
177 
187  void loadSettings();
188 
193  void saveSettings();
194 
198  void closeAllPages();
199 
200 
201 protected slots:
202 
206  void showPage( int tabIndex );
207 
211  void showPage( QAction * action );
212 
217  void contextMovePageLeft();
218 
223  void contextMovePageRight();
224 
228  void contextClosePage();
229 
230 
231 protected:
232 
236  void showPage( YQPkgFilterPage * page );
237 
243  bool postTabContextMenu( const QPoint & pos );
244 
248  void swapTabs( YQPkgFilterPage * page1, YQPkgFilterPage * page2 );
249 
250 
251 private:
252 
253  ImplPtr<YQPkgFilterTabPrivate> priv;
254 };
255 
256 
257 
262 {
263  YQPkgFilterPage( const QString & pageLabel,
264  QWidget * content,
265  const QString & internalName )
266  : content( content )
267  , label( pageLabel )
268  , id( internalName )
269  , closeEnabled( true )
270  , tabIndex( -1 )
271  {}
272 
273  QWidget * content;
274  QString label; // user visible text
275  QString id; // internal name
276  bool closeEnabled;
277  int tabIndex; // index of the corresponding tab or -1 if none
278 };
279 
280 
281 #endif // YQPkgFilterTab_h
void contextMovePageRight()
Definition: YQPkgFilterTab.cc:593
bool postTabContextMenu(const QPoint &pos)
Definition: YQPkgFilterTab.cc:511
void showPage(QWidget *page)
Definition: YQPkgFilterTab.cc:328
void saveSettings()
Definition: YQPkgFilterTab.cc:698
void addPage(const QString &pageLabel, QWidget *pageContent, const QString &internalName)
Definition: YQPkgFilterTab.cc:299
virtual ~YQPkgFilterTab()
Definition: YQPkgFilterTab.cc:269
YQPkgFilterTab(QWidget *parent, const QString &settingsName)
Definition: YQPkgFilterTab.cc:119
Definition: YQPkgFilterTab.h:87
void swapTabs(YQPkgFilterPage *page1, YQPkgFilterPage *page2)
Definition: YQPkgFilterTab.cc:609
YQPkgDiskUsageList * diskUsageList() const
Definition: YQPkgFilterTab.cc:292
QWidget * rightPane() const
Definition: YQPkgFilterTab.cc:285
void closeAllPages()
Definition: YQPkgFilterTab.cc:389
void currentChanged(QWidget *newPageContent)
void loadSettings()
Definition: YQPkgFilterTab.cc:666
virtual bool eventFilter(QObject *watchedObj, QEvent *event)
Definition: YQPkgFilterTab.cc:493
int tabCount() const
Definition: YQPkgFilterTab.cc:486
Definition: YQPkgFilterTab.h:261
YQPkgFilterPage * findPage(QWidget *pageContent)
Definition: YQPkgFilterTab.cc:438
void contextMovePageLeft()
Definition: YQPkgFilterTab.cc:577
void contextClosePage()
Definition: YQPkgFilterTab.cc:637
Definition: YQPkgFilterTab.cc:85
void closeCurrentPage()
Definition: YQPkgFilterTab.cc:406
List of disk usage of all attached partitions.
Definition: YQPkgDiskUsageList.h:149