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

projectwindow.h

Go to the documentation of this file.
00001 
00002 //
00003 // YASA project window declarations
00004 //
00005 // Project: Yasa 2
00006 // Author : Jan Blumenthal
00007 // Start  : 2002/02/28
00008 // $Header: /sources/yasa/yasagui/projectwindow.h,v 1.4 2003/01/24 15:47:42 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 project windows
00030 #ifndef YASAGUI_PROJECTWINDOW_INCLUDE
00031 #define YASAGUI_PROJECTWINDOW_INCLUDE
00032 
00033 
00035 #include "mainwindow.h"
00036 #include "widgets.h"
00037 #include "project.h"
00038 
00039 
00042 class YProjectFrame : public YObjectFrame
00043 {   Q_OBJECT
00044     QScrollView         scrollview;
00045 public:                 YProjectFrame(QWidget *parent, YFrameArgs &args) :
00046                         YObjectFrame(args),
00047                         scrollview(parent)
00048                         {}
00049     virtual int         InitInstance();
00050     virtual QWidget*    GetMainWidget()                             { return &scrollview;   }
00051     static YFrame*      CreateProjectFrame(QWidget *parent, YFrameArgs &args)
00052                         {
00053                             return new YProjectFrame(parent, args);
00054                         }
00055 };
00056 
00057 
00059 class YCPUProjectWidget : public YIntegerWidget
00060 {   Q_OBJECT
00061 public:                 YCPUProjectWidget(YProject *project, QWidget *parent) : YIntegerWidget(project, parent)
00062                         {   setMinValue( project->GetMaxCPU().GetMinValue() );
00063                             setMaxValue(YG_MAX_CPU);
00064                             UpdateWidget();
00065                         }
00066 public slots:
00067     virtual void        UpdateWidget()              { //int a=((YProject*)object)->GetMaxCPU();
00068                                                         if ( value()!=((YProject*)object)->GetMaxCPU() )
00069                                                         setValue( ((YProject*)object)->GetMaxCPU());    }
00070     virtual void        UpdateValue(int value)      { if ( value != 0)
00071                                                         ((YProject*)object)->SetMaxCPU( value );        }
00072 };
00073 
00075 class YEndTimeProjectWidget : public YYasaTimeWidget
00076 {   Q_OBJECT
00077 public:                 YEndTimeProjectWidget(YProject *project, QWidget *parent) : YYasaTimeWidget(project, parent)
00078                         {   UpdateWidget();
00079                         }
00080 public slots:
00081     virtual void        UpdateWidget()              { if ( GetYasaTime() != ((YProject*)object)->GetEndTime() )
00082                                                         SetYasaTime( ((YProject*)object)->GetEndTime());    }
00083     virtual void        UpdateValue(YASA_TIME value) { ((YProject*)object)->SetEndTime( value );            }
00084 };
00085 
00087 class YTickProjectWidget : public YYasaTimeWidget
00088 {   Q_OBJECT
00089 public:                 YTickProjectWidget(YProject *project, QWidget *parent) : YYasaTimeWidget(project, parent)
00090                         {   UpdateWidget();
00091                             updateDisplay();    }
00092 public slots:
00093     virtual void        UpdateWidget()              { if ( GetYasaTime() != ((YProject*)object)->GetTimerTick() )
00094                                                         SetYasaTime( ((YProject*)object)->GetTimerTick());  }
00095     virtual void        UpdateValue(YASA_TIME value) { ((YProject*)object)->SetTimerTick( value );          }
00096 protected:
00097     virtual QString     mapValueToText(int v)                   {   if ( v==YTIME::YASA_TIME_MIN)   return QString( MSGP_ENVIRONMENT_TIMERTICK_NO );
00098                                                                     return QString::number(v);                      }
00099     virtual int         mapTextToValue(bool *ok)                {   if ( text()==MSGP_ENVIRONMENT_TIMERTICK_NO )    return YTIME::YASA_TIME_MIN;
00100                                                                     return text().toInt(ok);                        }
00101 };
00102 
00103 
00105 class YCalcPreemptionTimeProjectWidget : public YCheckBoxWidget
00106 {   Q_OBJECT
00107 public:                 YCalcPreemptionTimeProjectWidget(YProject *project, QWidget *parent) :
00108                         YCheckBoxWidget(project, parent)
00109                         {   setChecked( project->GetCalcPreemptionTime() );
00110                             UpdateWidget();
00111                         }
00112 public slots:
00113     virtual void        UpdateWidget()              { if ( isChecked()!=((YProject*)object)->GetCalcPreemptionTime() )
00114                                                         setChecked( ((YProject*)object)->GetCalcPreemptionTime());  }
00115     virtual void        UpdateValue(bool value)     { ((YProject*)object)->SetCalcPreemptionTime( value );      }
00116 };
00117 
00118 
00119 
00121 class YProjectPathWidget : public YStringWidget
00122 {   Q_OBJECT
00123 public:                 YProjectPathWidget(YObject *object, QWidget *parent) :
00124                         YStringWidget(object,parent) {  UpdateWidget(); }
00125 public slots:
00126     virtual void        UpdateWidget()                          { if ( text()!=((YProject*)object)->GetProjectDir().GetContentString() )
00127                                                                     setText(((YProject*)object)->GetProjectDir().GetContentString() );  }
00128     virtual void        UpdateValue(const QString &t)           { ((YProject*)object)->SetProjectDir( t );      }
00129 };
00130 
00131 
00133 #endif                                                                          // ifndef YASAGUI_PROJECTWINDOW_INCLUDE

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