00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: YQPkgVersionsView.h 00014 00015 Author: Stefan Hundhammer <sh@suse.de> 00016 00017 /-*/ 00018 00019 // -*- c++ -*- 00020 00021 00022 #ifndef YQPkgVersionsView_h 00023 #define YQPkgVersionsView_h 00024 00025 #include "QY2ListView.h" 00026 #include <y2pm/PMObject.h> 00027 00028 00029 class QTabWidget; 00030 00031 00037 class YQPkgVersionsView : public QY2ListView 00038 { 00039 Q_OBJECT 00040 00041 public: 00042 00049 YQPkgVersionsView( QWidget * parent, bool userCanSwitchVersions ); 00050 00054 virtual ~YQPkgVersionsView(); 00055 00060 virtual QSize minimumSizeHint() const; 00061 00062 00063 // Column numbers 00064 00065 int versionCol() const { return _versionCol; } 00066 int instSrcCol() const { return _instSrcCol; } 00067 int nameCol() const { return _nameCol; } 00068 int summaryCol() const { return _summaryCol; } 00069 int statusCol() const { return _statusCol; } 00070 int archCol() const { return _archCol; } 00071 00072 00073 public slots: 00074 00080 void showDetailsIfVisible( PMObjectPtr pmObj ); 00081 00082 // slot clear() inherited from QListView 00083 00084 00088 void reload( QWidget * newCurrent ); 00089 00090 00091 signals: 00092 00096 void candidateChanged( PMObjectPtr newCandidate ); 00097 00098 00099 protected slots: 00100 00104 void checkForChangedCandidate(); 00105 00106 00107 protected: 00108 00112 void showDetails( PMObjectPtr pmObj ); 00113 00114 00115 // Data members 00116 00117 QTabWidget * _parentTab; 00118 PMObjectPtr _pmObj; 00119 bool _userCanSwitch; 00120 00121 int _versionCol; 00122 int _instSrcCol; 00123 int _nameCol; 00124 int _summaryCol; 00125 int _statusCol; 00126 int _archCol; 00127 }; 00128 00129 00130 class YQPkgVersion: public QY2CheckListItem 00131 { 00132 public: 00133 00138 YQPkgVersion( YQPkgVersionsView * pkgVersionList, 00139 QY2CheckListItem * parent, 00140 PMObjectPtr pmObj, 00141 bool enabled = true ); 00142 00146 virtual ~YQPkgVersion(); 00147 00151 PMObjectPtr pmObj() { return _pmObj; } 00152 00156 const PMObjectPtr constPMObj() const { return _pmObj; } 00157 00167 virtual int compare( QListViewItem * other, 00168 int col, 00169 bool ascending ) const; 00170 00177 virtual QString toolTip( int column ); 00178 00179 00180 // Columns 00181 00182 int versionCol() const { return _pkgVersionList->versionCol(); } 00183 int instSrcCol() const { return _pkgVersionList->instSrcCol(); } 00184 int statusCol() const { return _pkgVersionList->statusCol(); } 00185 int archCol() const { return _pkgVersionList->archCol(); } 00186 00187 00188 protected: 00189 00190 // Data members 00191 00192 YQPkgVersionsView * _pkgVersionList; 00193 PMObjectPtr _pmObj; 00194 }; 00195 00196 00197 #endif // ifndef YQPkgVersionsView_h