[Kst] branches/work/kst/portto4/kst/src
Barth Netterfield
netterfield at astro.utoronto.ca
Fri Jul 18 19:28:13 CEST 2008
SVN commit 834343 by netterfield:
-Pause works now
-Immediate update for some vector dialogs
-Timer is minimum period, not maximum frequency - fix variable names and labels.
M +9 -7 libkst/datasource.cpp
M +1 -0 libkst/updatemanager.cpp
M +5 -1 libkst/updatemanager.h
M +6 -6 libkstapp/applicationsettings.cpp
M +2 -2 libkstapp/applicationsettings.h
M +2 -2 libkstapp/applicationsettingsdialog.cpp
M +1 -0 libkstapp/changedatasampledialog.cpp
M +3 -3 libkstapp/generaltab.cpp
M +2 -2 libkstapp/generaltab.h
M +1 -1 libkstapp/generaltab.ui
M +8 -1 libkstapp/mainwindow.cpp
M +4 -12 libkstapp/matrixdialog.cpp
M +1 -0 libkstapp/scalardialog.cpp
M +4 -3 libkstapp/vectordialog.cpp
M +2 -1 libkstmath/curve.cpp
--- branches/work/kst/portto4/kst/src/libkst/datasource.cpp #834342:834343
@@ -490,7 +490,7 @@
// Don't set provider - this is always up-to-date
if (_updateCheckType == Timer) {
- QTimer::singleShot(DATASOURCE_UPDATE_TIMER_LENGTH, this, SLOT(checkUpdate()));
+ QTimer::singleShot(UpdateManager::self()->minimumUpdatePeriod()-1, this, SLOT(checkUpdate()));
} else if (_updateCheckType == File) {
QFileSystemWatcher *watcher = new QFileSystemWatcher();
watcher->addPath(_filename);
@@ -506,15 +506,17 @@
void DataSource::checkUpdate() {
- if (update()) {
+ if (!UpdateManager::self()->paused()) {
+ if (update()) {
#if DEBUG_UPDATE_CYCLE > 1
- qDebug() << "UP - DataSource update ready for" << shortName();
+ qDebug() << "UP - DataSource update ready for" << shortName();
#endif
- UpdateManager::self()->requestUpdate(this);
- }
+ UpdateManager::self()->requestUpdate(this);
+ }
- if (_updateCheckType == Timer) {
- QTimer::singleShot(DATASOURCE_UPDATE_TIMER_LENGTH, this, SLOT(checkUpdate()));
+ if (_updateCheckType == Timer) {
+ QTimer::singleShot(UpdateManager::self()->minimumUpdatePeriod()-1, this, SLOT(checkUpdate()));
+ }
}
}
--- branches/work/kst/portto4/kst/src/libkst/updatemanager.cpp #834342:834343
@@ -37,6 +37,7 @@
UpdateManager::UpdateManager() {
_maxUpdate = MAX_UPDATES;
+ _paused = false;
QTimer::singleShot(_maxUpdate, this, SLOT(allowUpdates()));
}
--- branches/work/kst/portto4/kst/src/libkst/updatemanager.h #834342:834343
@@ -38,8 +38,11 @@
void updateStarted(ObjectPtr updateObject, ObjectPtr reportingObject);
void updateFinished(ObjectPtr updateObject, ObjectPtr reportingObject);
- void setMaximumUpdateFrequency(const int frequency) { _maxUpdate = frequency; }
+ void setMinimumUpdatePeriod(const int period) { _maxUpdate = period; }
+ int minimumUpdatePeriod() { return _maxUpdate; }
+ void setPaused(bool paused) { _paused = paused;}
+ bool paused() { return _paused; }
private Q_SLOTS:
void allowUpdates();
@@ -56,6 +59,7 @@
bool _delayedUpdate;
int _maxUpdate;
+ bool _paused;
};
}
--- branches/work/kst/portto4/kst/src/libkstapp/applicationsettings.cpp #834342:834343
@@ -54,7 +54,7 @@
_refFontSize = _settings->value("general/referencefontsize", QVariant(12)).toInt();
_minFontSize = _settings->value("general/minimumfontsize", QVariant(5)).toInt();
_defaultFontFamily = _settings->value("general/defaultfontfamily", "Albany AMT").toString();
- _maxUpdate = _settings->value("general/maximumupdatefrequency", QVariant(2000)).toInt();
+ _maxUpdate = _settings->value("general/minimumupdateperiod", QVariant(2000)).toInt();
_showGrid = _settings->value("grid/showgrid", QVariant(true)).toBool();
_snapToGrid = _settings->value("grid/snaptogrid", QVariant(false)).toBool();
@@ -158,16 +158,16 @@
}
-int ApplicationSettings::maximumUpdateFrequency() const {
+int ApplicationSettings::minimumUpdatePeriod() const {
return _maxUpdate;
}
-void ApplicationSettings::setMaximumUpdateFrequency(const int frequency) {
- _maxUpdate = frequency;
- _settings->setValue("general/maximumupdatefrequency", frequency);
+void ApplicationSettings::setMinimumUpdatePeriod(const int period) {
+ _maxUpdate = period;
+ _settings->setValue("general/minimumupdateperiod", period);
- UpdateManager::self()->setMaximumUpdateFrequency(frequency);
+ UpdateManager::self()->setMinimumUpdatePeriod(period);
}
--- branches/work/kst/portto4/kst/src/libkstapp/applicationsettings.h #834342:834343
@@ -47,8 +47,8 @@
QString defaultFontFamily() const;
void setDefaultFontFamily(const QString &fontFamily);
- int maximumUpdateFrequency() const;
- void setMaximumUpdateFrequency(const int frequency);
+ int minimumUpdatePeriod() const;
+ void setMinimumUpdatePeriod(const int period);
bool showGrid() const;
void setShowGrid(bool showGrid);
--- branches/work/kst/portto4/kst/src/libkstapp/applicationsettingsdialog.cpp #834342:834343
@@ -56,7 +56,7 @@
_generalTab->setReferenceFontSize(ApplicationSettings::self()->referenceFontSize());
_generalTab->setMinimumFontSize(ApplicationSettings::self()->minimumFontSize());
_generalTab->setDefaultFontFamily(ApplicationSettings::self()->defaultFontFamily());
- _generalTab->setMaximumUpdateFrequency(ApplicationSettings::self()->maximumUpdateFrequency());
+ _generalTab->setMinimumUpdatePeriod(ApplicationSettings::self()->minimumUpdatePeriod());
}
@@ -77,7 +77,7 @@
ApplicationSettings::self()->setReferenceFontSize(_generalTab->referenceFontSize());
ApplicationSettings::self()->setMinimumFontSize(_generalTab->minimumFontSize());
ApplicationSettings::self()->setDefaultFontFamily(_generalTab->defaultFontFamily());
- ApplicationSettings::self()->setMaximumUpdateFrequency(_generalTab->maximumUpdateFrequency());
+ ApplicationSettings::self()->setMinimumUpdatePeriod(_generalTab->minimumUpdatePeriod());
ApplicationSettings::self()->blockSignals(false);
emit ApplicationSettings::self()->modified();
--- branches/work/kst/portto4/kst/src/libkstapp/changedatasampledialog.cpp #834342:834343
@@ -131,6 +131,7 @@
_dataRange->skip(),
_dataRange->doSkip(),
_dataRange->doFilter());
+ vector->immediateUpdate(); // FIXME: cache all dependent updates until all vectors have been updated
vector->unlock();
}
}
--- branches/work/kst/portto4/kst/src/libkstapp/generaltab.cpp #834342:834343
@@ -93,13 +93,13 @@
}
-int GeneralTab::maximumUpdateFrequency() const {
+int GeneralTab::minimumUpdatePeriod() const {
return _maxUpdate->value();
}
-void GeneralTab::setMaximumUpdateFrequency(const int frequency) {
- _maxUpdate->setValue(frequency);
+void GeneralTab::setMinimumUpdatePeriod(const int period) {
+ _maxUpdate->setValue(period);
}
}
--- branches/work/kst/portto4/kst/src/libkstapp/generaltab.h #834342:834343
@@ -43,8 +43,8 @@
QString defaultFontFamily() const;
void setDefaultFontFamily(const QString &fontFamily);
- int maximumUpdateFrequency() const;
- void setMaximumUpdateFrequency(const int frequency);
+ int minimumUpdatePeriod() const;
+ void setMinimumUpdatePeriod(const int Period);
};
}
--- branches/work/kst/portto4/kst/src/libkstapp/generaltab.ui #834342:834343
@@ -81,7 +81,7 @@
<item row="6" column="0" colspan="2" >
<widget class="QLabel" name="label_5" >
<property name="text" >
- <string>Maximum Update Frequency (ms)</string>
+ <string>Period Between Updates (ms)</string>
</property>
</widget>
</item>
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #834342:834343
@@ -101,7 +101,7 @@
void MainWindow::performHeavyStartupActions() {
// Set the timer for the UpdateManager.
- UpdateManager::self()->setMaximumUpdateFrequency(ApplicationSettings::self()->maximumUpdateFrequency());
+ UpdateManager::self()->setMinimumUpdatePeriod(ApplicationSettings::self()->minimumUpdatePeriod());
}
@@ -815,6 +815,13 @@
}
void MainWindow::pause(bool pause) {
+ UpdateManager::self()->setPaused(pause);
+
+ if (!pause) {
+ foreach (DataSourcePtr s, document()->objectStore()->dataSourceList()) {
+ s->checkUpdate();
+ }
+ }
}
void MainWindow::forward() {
--- branches/work/kst/portto4/kst/src/libkstapp/matrixdialog.cpp #834342:834343
@@ -730,14 +730,6 @@
xNumSteps, yNumSteps, doAverage,
doSkip, skip, minX, minY, stepX, stepY);
-#if 0
- DataMatrixPtr matrix = new DataMatrix(
- dataSource, field, tag,
- xStart, yStart,
- xNumSteps, yNumSteps,
- doAve,
- doSkip, skip);
-#endif
matrix->setDescriptiveName(DataDialog::tagString().replace(defaultTagString(), QString()));
matrix->writeLock();
@@ -823,7 +815,7 @@
matrix->writeLock();
matrix->changeFrames(xStart, yStart, xNumSteps, yNumSteps, doAve, doSkip, skip, minX, minY, stepX, stepY);
- matrix->update();
+ matrix->immediateUpdate();
matrix->unlock();
}
}
@@ -849,7 +841,7 @@
dataMatrix->writeLock();
dataMatrix->change(dataSource, field, xStart, yStart, xNumSteps, yNumSteps, doAverage, doSkip, skip, minX, minY, stepX, stepY);
- dataMatrix->update();
+ dataMatrix->immediateUpdate();
dataMatrix->unlock();
setDataMatrixDefaults(dataMatrix);
}
@@ -871,7 +863,7 @@
matrix->writeLock();
matrix->change(nX, nY, minX, minY, stepX, stepY, gradientZAtMin, gradientZAtMax, xDirection);
- matrix->update();
+ matrix->immediateUpdate();
matrix->unlock();
}
}
@@ -888,7 +880,7 @@
generatedMatrix->writeLock();
generatedMatrix->change(nX, nY, minX, minY, stepX, stepY, gradZMin, gradZMax, xDirection);
- generatedMatrix->update();
+ generatedMatrix->immediateUpdate();
generatedMatrix->unlock();
}
}
--- branches/work/kst/portto4/kst/src/libkstapp/scalardialog.cpp #834342:834343
@@ -132,6 +132,7 @@
scalar->setDescriptiveName(DataDialog::tagString().replace(defaultTagString(), QString()));
scalar->writeLock();
scalar->setValue(value);
+ scalar->immediateUpdate();
scalar->unlock();
}
return dataObject();
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.cpp #834342:834343
@@ -438,7 +438,7 @@
bool doAve = dataRange->doFilterDirty() ? dataRange->doFilter() : vector->doAve();
vector->writeLock();
vector->changeFrames(start, range, skip, doSkip, doAve);
- vector->update();
+ vector->immediateUpdate();
vector->unlock();
}
}
@@ -462,7 +462,7 @@
dataVector->setDescriptiveName(DataDialog::tagString().replace(defaultTagString(), QString()));
- dataVector->update();
+ dataVector->immediateUpdate();
dataVector->unlock();
setDataVectorDefaults(dataVector);
@@ -479,7 +479,7 @@
double length = _vectorTab->numberOfSamplesDirty() ? _vectorTab->numberOfSamples() : vector->length();
vector->writeLock();
vector->changeRange(min, max, length);
- vector->update();
+ vector->immediateUpdate();
vector->unlock();
}
}
@@ -490,6 +490,7 @@
generatedVector->writeLock();
generatedVector->changeRange(from, to, numberOfSamples);
generatedVector->setDescriptiveName(DataDialog::tagString().replace(defaultTagString(), QString()));
+ generatedVector->immediateUpdate();
generatedVector->unlock();
setGenVectorDefaults(generatedVector);
}
--- branches/work/kst/portto4/kst/src/libkstmath/curve.cpp #834342:834343
@@ -38,7 +38,7 @@
#include <time.h>
// #define DEBUG_VECTOR_CURVE
-// #define BENCHMARK
+#define BENCHMARK
#ifndef KDE_IS_LIKELY
#if __GNUC__ - 0 >= 3
@@ -712,6 +712,7 @@
void Curve::paint(const CurveRenderContext& context) {
+
VectorPtr xv = *_inputVectors.find(COLOR_XVECTOR);
VectorPtr yv = *_inputVectors.find(COLOR_YVECTOR);
if (!xv || !yv) {
More information about the Kst
mailing list