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