|
From: <dhu...@us...> - 2007-01-05 10:42:47
|
Revision: 95
http://svn.sourceforge.net/qcell/?rev=95&view=rev
Author: dhubleizh
Date: 2007-01-05 02:42:45 -0800 (Fri, 05 Jan 2007)
Log Message:
-----------
- Proper handling of start, stop, continuos and timed processing
- nasty hackcs for database of experiments
Modified Paths:
--------------
trunk/qcell/visgui/MainWindow.cpp
trunk/qcell/visgui/MainWindow.h
trunk/qcell/visgui/MainWindow.ui
trunk/qcell/visgui/visgui.pro
Modified: trunk/qcell/visgui/MainWindow.cpp
===================================================================
--- trunk/qcell/visgui/MainWindow.cpp 2007-01-05 10:41:52 UTC (rev 94)
+++ trunk/qcell/visgui/MainWindow.cpp 2007-01-05 10:42:45 UTC (rev 95)
@@ -64,6 +64,7 @@
}
}
+ setupEngine();
}
@@ -118,7 +119,11 @@
fd.exec();
- callParser(fd.selectedFiles().first(), "Neighbourhood");
+ if(!fd.selectedFiles().isEmpty())
+ {
+ callParser(fd.selectedFiles().first(), "Neighbourhood");
+
+ }
}
void MainWindow::on_action_Function_activated()
@@ -157,6 +162,11 @@
fd.exec();
+ if(!fd.selectedFiles().isEmpty())
+ {
+ callParser(fd.selectedFiles().first(), "LocalFunction");
+
+ }
}
void MainWindow::on_action_World_activated()
@@ -195,6 +205,11 @@
fd.exec();
+ if(!fd.selectedFiles().isEmpty())
+ {
+ callParser(fd.selectedFiles().first(), "World");
+
+ }
}
void MainWindow::callParser(QString filename, QString type)
@@ -259,3 +274,90 @@
}
+void MainWindow::setupEngine()
+{
+ working = false;
+}
+
+void MainWindow::oneStep()
+{
+ /// @todo Write oneStep
+}
+
+void MainWindow::stepForward(int step)
+{
+ for(int i = 0; i < step; i++)
+ {
+ if(!working)
+ {
+ return;
+ }
+
+ oneStep();
+
+ // No freezing the app
+ if(qApp->hasPendingEvents())
+ {
+ qApp->processEvents();
+ }
+ }
+
+}
+
+void MainWindow::continousSteps()
+{
+ while(working)
+ {
+ oneStep();
+
+ // No freezing the app
+ if(qApp->hasPendingEvents())
+ {
+ qApp->processEvents();
+ }
+ }
+
+}
+
+void MainWindow::on_action_Forward_activated()
+{
+ oneStep();
+}
+
+void MainWindow::on_action_Back_activated()
+{
+ /// @todo Handle back movement
+}
+
+void MainWindow::on_action_Start_activated()
+{
+ QDialog* dialog = new QDialog(this);
+ Ui::ExperimentSetupDialog es;
+ es.setupUi(dialog);
+
+ if(dialog->exec() == QDialog::Accepted)
+ {
+ working = true;
+ if(es.continiuosCheckBox->isChecked())
+ {
+ continousSteps();
+ }
+ else
+ {
+ stepForward(es.iterationsSpinBox->value());
+ }
+ }
+
+}
+
+void MainWindow::on_action_Stop_activated()
+{
+ working=false;
+}
+
+void MainWindow::on_action_Restart_activated()
+{
+ /// @todo Handle restarting the experiment
+ CalculationData backup = data.first();
+}
+
Modified: trunk/qcell/visgui/MainWindow.h
===================================================================
--- trunk/qcell/visgui/MainWindow.h 2007-01-05 10:41:52 UTC (rev 94)
+++ trunk/qcell/visgui/MainWindow.h 2007-01-05 10:42:45 UTC (rev 95)
@@ -11,11 +11,17 @@
#include "ui_MainWindow.h"
#include "ui_AboutDialog.h"
+#include "ui_ExperimentSetup.h"
#include <QPluginLoader>
#include "GenericParserPlugin.h"
#include <QFileDialog>
#include <QMessageBox>
+#include <CalculationData.h>
+#include <LocalFunction.h>
+#include <Neighbourhood.h>
+#include <Renderer.h>
+
#include <iostream>
using namespace std;
@@ -35,13 +41,35 @@
void on_action_Function_activated();
void on_action_World_activated();
+ /// @todo not here!
+ void on_action_Forward_activated();
+ void on_action_Back_activated();
+
+ void on_action_Start_activated();
+ void on_action_Stop_activated();
+ void on_action_Restart_activated();
private:
QMap<QString, ParserInterface*> neighbourhood_parsers;
QMap<QString, ParserInterface*> function_parsers;
QMap<QString, ParserInterface*> world_parsers;
+
void callParser(QString filename, QString type);
+ /// @todo Not in here!
+ bool working;
+
+ QList<CalculationData> data;
+ LocalFunction* local_function;
+ Neighbourhood* neighbourhood;
+ Renderer* renderer;
+
+ void setupEngine();
+
+ void oneStep();
+ void stepForward(int step);
+ void continousSteps();
+
};
#endif
Modified: trunk/qcell/visgui/MainWindow.ui
===================================================================
--- trunk/qcell/visgui/MainWindow.ui 2007-01-05 10:41:52 UTC (rev 94)
+++ trunk/qcell/visgui/MainWindow.ui 2007-01-05 10:42:45 UTC (rev 95)
@@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>557</width>
- <height>541</height>
+ <width>553</width>
+ <height>538</height>
</rect>
</property>
<property name="windowTitle" >
@@ -23,9 +23,6 @@
<property name="spacing" >
<number>6</number>
</property>
- <item>
- <widget class="QWidget" native="1" name="MainGLWidget" />
- </item>
</layout>
</widget>
<widget class="QMenuBar" name="mainMenubar" >
@@ -33,7 +30,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>557</width>
+ <width>553</width>
<height>30</height>
</rect>
</property>
@@ -44,6 +41,11 @@
<addaction name="separator" />
<addaction name="action_About" />
</widget>
+ <widget class="QMenu" name="menu_Edit" >
+ <property name="title" >
+ <string>&Edit</string>
+ </property>
+ </widget>
<widget class="QMenu" name="menu_File" >
<property name="title" >
<string>&File</string>
@@ -65,20 +67,36 @@
<addaction name="separator" />
<addaction name="action_Quit" />
</widget>
+ <widget class="QMenu" name="menu_Experiment" >
+ <property name="title" >
+ <string>&Experiment</string>
+ </property>
+ <addaction name="action_Start" />
+ <addaction name="action_Stop" />
+ <addaction name="action_Restart" />
+ <addaction name="separator" />
+ <addaction name="action_Forward" />
+ <addaction name="action_Back" />
+ </widget>
<addaction name="menu_File" />
+ <addaction name="menu_Edit" />
+ <addaction name="menu_Experiment" />
<addaction name="menu_Help" />
</widget>
<widget class="QStatusBar" name="statusbar" />
- <widget class="QToolBar" name="mainToolBar" >
- <property name="toolTip" >
- <string>This menu allows searching through help topics and reading about the application.</string>
- </property>
+ <widget class="QToolBar" name="toolBar" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<attribute name="toolBarArea" >
<number>4</number>
</attribute>
+ <addaction name="action_Start" />
+ <addaction name="action_Stop" />
+ <addaction name="action_Restart" />
+ <addaction name="separator" />
+ <addaction name="action_Forward" />
+ <addaction name="action_Back" />
</widget>
<action name="action_Quit" >
<property name="text" >
@@ -139,6 +157,61 @@
<string>Shows info about the program.</string>
</property>
</action>
+ <action name="action_Start" >
+ <property name="text" >
+ <string>&Start</string>
+ </property>
+ <property name="toolTip" >
+ <string>Starts the experiment.</string>
+ </property>
+ <property name="statusTip" >
+ <string>Starts the experiment.</string>
+ </property>
+ </action>
+ <action name="action_Stop" >
+ <property name="text" >
+ <string>S&top</string>
+ </property>
+ <property name="toolTip" >
+ <string>Stops the experiment.</string>
+ </property>
+ <property name="statusTip" >
+ <string>Stops the experiment.</string>
+ </property>
+ </action>
+ <action name="action_Restart" >
+ <property name="text" >
+ <string>&Restart</string>
+ </property>
+ <property name="toolTip" >
+ <string>Restarts the experiment.</string>
+ </property>
+ <property name="statusTip" >
+ <string>Restarts the experiment.</string>
+ </property>
+ </action>
+ <action name="action_Forward" >
+ <property name="text" >
+ <string>&Forward</string>
+ </property>
+ <property name="toolTip" >
+ <string>Iterates one setp forward.</string>
+ </property>
+ <property name="statusTip" >
+ <string>Iterates one setp forward.</string>
+ </property>
+ </action>
+ <action name="action_Back" >
+ <property name="text" >
+ <string>&Back</string>
+ </property>
+ <property name="toolTip" >
+ <string>Iterates one setp back.</string>
+ </property>
+ <property name="statusTip" >
+ <string>Iterates one setp back.</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections/>
Modified: trunk/qcell/visgui/visgui.pro
===================================================================
--- trunk/qcell/visgui/visgui.pro 2007-01-05 10:41:52 UTC (rev 94)
+++ trunk/qcell/visgui/visgui.pro 2007-01-05 10:42:45 UTC (rev 95)
@@ -1,12 +1,13 @@
TEMPLATE = app
DESTDIR = ../bin
CONFIG += thread warn_on debug
-QT += network xml
+QT += network xml opengl
INCLUDEPATH = ../baseheaders
FORMS = MainWindow.ui \
- AboutDialog.ui
+ AboutDialog.ui \
+ ExperimentSetup.ui
HEADERS = MainWindow.h \
../baseheaders/Client.h \
../baseheaders/ClientInfo.h \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|