Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Examples  

mutexwindow.h

Go to the documentation of this file.
00001 
00002 //
00003 // YASA mutex window declarations
00004 //
00005 // Project: Yasa 2
00006 // Author : Jan Blumenthal
00007 // Start  : 2002/02/28
00008 // $Header: /sources/yasa/yasagui/mutexwindow.h,v 1.4 2003/01/24 15:47:41 bj Exp $
00009 //
00011 //
00012 // This program is free software; you can redistribute it and/or modify
00013 // it under the terms of the GNU General Public License as published by
00014 // the Free Software Foundation; either version 2 of the License, or
00015 // (at your option) any later version.
00016 //
00017 // This program is distributed in the hope that it will be useful,
00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 // GNU General Public License for more details.
00021 //
00022 // You should have received a copy of the GNU General Public License
00023 // along with this program (See the included file COPYING);
00024 // if not, write to the Free Software Foundation, Inc.,
00025 // 675 Mass Ave, Cambridge, MA 02139, USA.
00026 //
00028 // This file contains all information about mutex windows
00030 #ifndef YASAGUI_MUTEXWINDOW_INCLUDE
00031 #define YASAGUI_MUTEXWINDOW_INCLUDE
00032 
00033 
00035 #include "mainwindow.h"
00036 #include "widgets.h"
00037 #include "task.h"
00038 #include "mutex.h"
00039 
00040 
00043 class YMutexFrame : public YObjectFrame
00044 {   Q_OBJECT
00045     QScrollView         scrollview;
00046 public:                 YMutexFrame(QWidget *parent, YFrameArgs &args) :
00047                         YObjectFrame(args),
00048                         scrollview(parent)
00049                         {}
00050     virtual int         InitInstance();
00051     virtual QWidget*    GetMainWidget()                     { return &scrollview;   }
00052     static YFrame*      CreateMutexFrame(QWidget *parent, YFrameArgs &args)
00053                         {
00054                             return new YMutexFrame( parent, args );
00055                         }
00056 };
00057 
00058 
00060 class YProtocolWidget : public YComboWidget
00061 {   Q_OBJECT
00062 public:                 YProtocolWidget(YMutex *mutex, QWidget *parent) : YComboWidget(mutex, parent)
00063                         {   insertItem(MSGP_MUTEX_PTYPE_NORMAL);
00064                             insertItem(MSGP_MUTEX_PTYPE_PIP);
00065                             insertItem(MSGP_MUTEX_PTYPE_CSP);
00066                             insertItem(MSGP_MUTEX_PTYPE_PCP);
00067                             insertItem(MSGP_MUTEX_PTYPE_DPCP);
00068                             insertItem(MSGP_MUTEX_PTYPE_KP);
00069                             insertItem(MSGP_MUTEX_PTYPE_SRP);
00070 #if YASASP_MAX!=6
00071 #error inconsistency occured !
00072 #error Insert/Remove new item to combobox here !!!
00073 #endif
00074                             UpdateWidget();
00075                         }
00076 public slots:
00077     virtual void        UpdateWidget()                          { if ( currentItem()!=((YMutex*)object)->GetProtocol() )
00078                                                                     setCurrentItem( ((YMutex*)object)->GetProtocol());  }
00079     virtual void        UpdateValue(int value)                  { ((YMutex*)object)->SetProtocol( value );      }
00080 };
00081 
00082 
00084 class YMutexTimeListViewItem : public YListViewItem
00085 {   Q_OBJECT
00086 public:                 YMutexTimeListViewItem(YObject *o, QListView *parent, QListViewItem *after=0) :
00087                         YListViewItem( o, parent, after)
00088                         { }
00089                         YMutexTimeListViewItem(YObject *o, QListViewItem *parent, QListViewItem *after=0) :
00090                         YListViewItem( o, parent, after)
00091                         { }
00092     virtual int         InitInstance();
00093     void                UpdateObject(YObject *);
00094 protected:
00095     QString             key(int column, bool ascending) const
00096                         {
00097                             YTask   *task;
00098                             if ( object && object->GetSet() && object->GetSet()->GetParent() )
00099                             {
00100                                 task= (YTask*) object;
00101                                 if ( task )
00102                                 {
00103                                     QString tmp;
00104                                     switch ( column)
00105                                     {
00106                                     case 1: return YString::Justify( task->GetPeriod().GetVisibleContentString() );
00107                                     case 2: return YString::Justify( task->GetPeriod().GetVisibleContentString() );
00108                                     case 3: return YString::Justify( task->GetDeadline().GetVisibleContentString() );
00109                                     case 4: return YString::Justify( task->GetLaxity().GetVisibleContentString() );
00110                                     }
00111                                 }
00112                             }
00113                             return text(column);
00114                             Q_UNUSED(ascending);
00115                         }
00116 };
00117 
00119 class YMutexTimesListView : public YListView
00120 {   Q_OBJECT
00121     YMutex              *mutex;
00122     YMutexTimeListViewItem* _FindItem(YTask *task);
00123 public:                 YMutexTimesListView(YTaskSet *s, QWidget *parent, YMutex *m) :
00124                         YListView(s, parent, MSGP_MUTEX_TASKS),
00125                         mutex(m)
00126                         {}
00127     virtual YMutexTimeListViewItem* CreateNewItem(QListViewItem *parent, YTask *object, QListViewItem *after=0)
00128                         {
00129                             if ( parent )
00130                                 return new YMutexTimeListViewItem(object,parent,after);
00131                             else
00132                                 return new YMutexTimeListViewItem(object,this,after);
00133                         }
00134     virtual int         CreateSetItems();                           
00135     virtual int         InitInstance();
00136 public slots:
00137     void                UpdateTaskProperties(YObject *task);
00138     virtual void        NewChildObject(YObject *object);            
00139     void                ResourceActionRemoved(YObject *);           
00140 };
00141 
00142 
00143 
00145 #endif                                                                          // ifndef YASAGUI_MUTEXWINDOW_INCLUDE

Generated on Thu Feb 13 23:43:54 2003 for Yasa by doxygen1.3-rc3