00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _SETTINGS_TAB_H_
00022 #define _SETTINGS_TAB_H_
00023
00024 #include "ITab.h"
00025 #include "TestScene.h"
00026
00027 #include <QtGui\QPushButton>
00028 #include <QtCore\QObject>
00029 #include <QtGui\QSpinBox>
00030 #include <QtGui\QSplitter>
00031 #include <QtGui\QGridLayout>
00032 #include <boost\shared_ptr.hpp>
00033 #include "UserEventQueue.h"
00034 #include "ICustomEvent.h"
00035
00036 namespace TaskBasedFlockSim
00037 {
00038
00039
00040 class SettingsTab :
00041 public QObject, public TestFrameWork::ITab
00042 {
00043 Q_OBJECT
00044
00045 public:
00046 SettingsTab(TestFrameWork::UserEventQueue& eventQueue);
00047
00048 ~SettingsTab(void);
00049
00050 QWidget* GetWidget(void) const;
00051
00052 void LoadDefaultSceneParameters(const TestFrameWork::ScenePtr scene);
00053
00054 private:
00055 QWidget* m_widget;
00056 QGridLayout* m_gridLayout;
00057 QSpinBox* m_spinBox_flockSize;
00058 QDoubleSpinBox* m_doubleSpinBox_separationDistance;
00059 QDoubleSpinBox* m_doubleSpinBox_groupDistance;
00060 QDoubleSpinBox* m_doubleSpinBox_separationWeight;
00061 QDoubleSpinBox* m_doubleSpinBox_cohesionWeight;
00062 QDoubleSpinBox* m_doubleSpinBox_alignmentWeight;
00063 QDoubleSpinBox* m_doubleSpinBox_maxSpeed;
00064 QDoubleSpinBox* m_doubleSpinBox_trefoilKnotPathWeight;
00065 QDoubleSpinBox* m_doubleSpinBox_angleIncrement;
00066 QSpinBox* m_spinBox_tasksCount;
00067
00068 TestFrameWork::UserEventQueue& m_eventQueue;
00069
00070 void SetupWidget(void);
00071
00072 private slots:
00073 void TasksCountChanged(int i);
00074
00075 void SizeChange(int val);
00076
00077 void AngleIncrementChanged(double val);
00078
00079 void SeparationWeightChanged(double val);
00080
00081 void CohesionWeightChanged(double val);
00082
00083 void AlignmentWeightChanged(double val);
00084
00085 void TrefoildKnotPathWeightChanged(double val);
00086
00087 void MaxSpeedChanged(double val);
00088
00089 void SeparationDistanceChanged(double val);
00090
00091 void GroupDistanceChanged(double val);
00092 };
00093
00094 enum SettingsTabValueId
00095 {
00096 TasksCount,
00097 FlockSize,
00098 AngleIncrement,
00099 SeparationWeight,
00100 CohesionWeight,
00101 AlignmentWeight,
00102 TrefoilKnotPathWeight,
00103 MaxSpeed,
00104 SeparationDistance,
00105 GroupDistance
00106 };
00107
00108 class ValueChangedEvent :
00109 public TestFrameWork::ICustomEvent
00110 {
00111 public:
00112 ValueChangedEvent(float value,
00113 SettingsTabValueId settingsTabValueId) : m_value(value),
00114 m_settingsTabValueId(settingsTabValueId)
00115 {
00116 }
00117
00118 TestFrameWork::UserEventType GetUserEventType(void) const
00119 {
00120 return TestFrameWork::Custom;
00121 }
00122
00123 TestFrameWork::CustomEventType GetCustomEventType(void) const
00124 {
00125 return TestFrameWork::CustomEventType(m_settingsTabValueId);
00126 }
00127
00128 float m_value;
00129 SettingsTabValueId m_settingsTabValueId;
00130 };
00131
00132 typedef boost::shared_ptr<ValueChangedEvent> ValueChangedEventPtr;
00133 }
00134
00135 #endif