00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00028
00030
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