|
From: <dhu...@us...> - 2007-01-10 20:59:52
|
Revision: 143
http://svn.sourceforge.net/qcell/?rev=143&view=rev
Author: dhubleizh
Date: 2007-01-10 12:59:44 -0800 (Wed, 10 Jan 2007)
Log Message:
-----------
- stepping now honors delays
Modified Paths:
--------------
trunk/qcell/visgui/MainWindow.cpp
trunk/qcell/visgui/MainWindow.h
Modified: trunk/qcell/visgui/MainWindow.cpp
===================================================================
--- trunk/qcell/visgui/MainWindow.cpp 2007-01-10 20:14:34 UTC (rev 142)
+++ trunk/qcell/visgui/MainWindow.cpp 2007-01-10 20:59:44 UTC (rev 143)
@@ -352,7 +352,8 @@
data.append((CalculationData*)world_parsers[subtype]->parse(file_content, type, subtype).toInt());
*sw->getStorage() = *data.last();
- calc.setForeignDataPointer((char*)data.first()->getDataPointer());
+// calc.setForeignDataPointer((char*)data.first()->getDataPointer());
+ *(CalculationData*)&calc = *data.last();
QVector<int> end_coord;
end_coord << data.last()->getSizeX()
<< data.last()->getSizeY()
@@ -475,10 +476,12 @@
void MainWindow::oneStep(int direction)
{
+ QTime t;
switch (direction)
{
case Forward:
{
+ t.start();
if((iteration + 1) >= data.count())
{
/// @todo Use the updated API of Calculator
@@ -506,7 +509,24 @@
}
}
- /// @todo This will probabelly need change after the Calculator API change
+
+ // Timeout handling
+ // If the calculations took longer then the delay
+ if (t.elapsed()*1.0 >= msec_delay)
+ {
+ update();
+ /// @todo Make user know
+ }
+ // If not, we need to wait the rest of the time
+ else
+ {
+ QTimer::singleShot(msec_delay - (double)t.elapsed(),
+ this, SLOT(update()));
+ }
+}
+
+void MainWindow::update()
+{
*sw->getStorage() = *data[iteration];
iterationLCD->display(iteration);
}
Modified: trunk/qcell/visgui/MainWindow.h
===================================================================
--- trunk/qcell/visgui/MainWindow.h 2007-01-10 20:14:34 UTC (rev 142)
+++ trunk/qcell/visgui/MainWindow.h 2007-01-10 20:59:44 UTC (rev 143)
@@ -54,6 +54,7 @@
void sliderChanged(int value);
void spinBoxChanged(double value);
+ void update();
/// @todo not here!
void on_action_Forward_activated();
void on_action_Back_activated();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|