Salome HOME
Use OpenCASCADE 5.2
[tools/install.git] / src / SALOME_ProgressView.hxx
1 //  File      : SALOME_ProgressView.hxx
2 //  Created   : Thu Dec 18 12:01:00 2002
3 //  Author    : Vadim SANDLER
4 //  Project   : PAL/SALOME
5 //  Module    : InstallWizard
6 //  Copyright : 2004 CEA
7 //  $Header$ 
8
9 #ifndef __SALOME_ProgressView
10 #define __SALOME_ProgressView
11
12 #include <qlistview.h> 
13
14 /*!
15   Class ProgressViewItem: Progress list view item
16 */
17 enum Status { Waiting, Processing, Completed, Aborted };
18 class ProgressView;
19 class ProgressViewItem : public QListViewItem
20 {
21 public:
22   // constructor
23   ProgressViewItem( ProgressView* parent, 
24                     QString       productName, 
25                     const QString installType, 
26                     const QString scriptName, 
27                     Status        status = Waiting );
28   
29   // sets product status
30   void    setStatus( Status status );
31   // gets product status
32   Status  getStatus()  const { return myStatus; }
33   // gets product name
34   QString getProduct() const { return text( 0 ); }
35   // gets product script
36   QString getScript()   const { return myScript; }
37   // gets type of the installation: 'binaries', 'source', 'native' or 'not install'
38   QString getInstallType() const { return text( 1 ); }
39
40 protected:
41   // paints cell of the item
42   void paintCell( QPainter* painter, const QColorGroup& cg, int column, int width, int align );
43
44 private:
45   Status  myStatus;       // status
46   QString myScript;       // alias
47 };
48
49 /*!
50   Class ProgressView: Progress list view
51 */
52 class ProgressView : public QListView
53 {
54 public:
55   // constructor
56   ProgressView( QWidget* parent );
57
58   // sets/gets status colors
59   void    setColors( QColor wColor, QColor pColor, QColor cColor );
60   QColor  getWaitingColor()     { return myWaitingColor;    }
61   QColor  getProcessingColor()  { return myProcessingColor; }
62   QColor  getCompletedColor()   { return myCompletedColor;  }
63
64   // adds product item
65   void    addProduct( const QString smbName, const QString type, const QString product );
66   // finds the first item with given status
67   QString findStatus( Status status );
68   // sets new status for the product item
69   void    setStatus( const QString product, Status status );
70   // scrolls the view to make item visible if necessary
71   void    ensureVisible( const QString product );
72   // gets the product script
73   QString getScript( const QString product );
74
75 protected:
76   // finds the item by the product name
77   ProgressViewItem* findItem( const QString product );
78
79 private:
80   QColor myWaitingColor;     // 'Waiting' color
81   QColor myProcessingColor;  // 'Processing' color
82   QColor myCompletedColor;   // 'Completed' color
83 };
84
85 #endif