From d5ad3da516e2fdb5c34d1fa1496d2b678b7039e5 Mon Sep 17 00:00:00 2001 From: Ivan Novikov Date: Wed, 23 Jul 2014 18:08:15 +0400 Subject: [PATCH] Renamed some buttons and fixed zoom/move logic a bit Now when zooming in auto scale it does fixCurrent first (before this fix it used last fixed scale values which may be unexpected) Also removed connect to setFixedScale from zoom actions: instead call setFixedScale in onZoomChanged --- mainwindow.ui | 48 ++++++++++++++++++++++---------------------- seismoreg_ru.ts | 35 ++++++++++++++++++++++---------- src/gui/timeplot.cpp | 8 ++++++++ src/mainwindow.cpp | 3 ++- 4 files changed, 58 insertions(+), 36 deletions(-) diff --git a/mainwindow.ui b/mainwindow.ui index 29457f3..6c82b80 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -375,43 +375,23 @@ - Plot settings + Plot scale - Auto scale + Automatic true - - - - sec. - - - 5 - - - 3600 - - - - - - - Time interval: - - - - Fixed scale: + Manual @@ -486,7 +466,27 @@ - Fix now + Manual auto + + + + + + + Time interval: + + + + + + + sec. + + + 5 + + + 3600 diff --git a/seismoreg_ru.ts b/seismoreg_ru.ts index 2303060..1b3f4b7 100644 --- a/seismoreg_ru.ts +++ b/seismoreg_ru.ts @@ -164,6 +164,21 @@ ? ? + + + Manual + Ручной + + + + Automatic + Авто + + + + Manual auto + Ручной авто + Time elapsed @@ -233,18 +248,17 @@ - Plot settings - Настройки графиков + Plot scale + Plot settings + Масштаб графиков - Auto scale - Авто масштаб + Авто масштаб - Fixed scale: - Фикс. масштаб: + Фикс. масштаб: @@ -261,19 +275,18 @@ Суффикс (обычно расширение) - + Time interval: Интервал времени: - + sec. с. - Fix now - Фиксировать + Фиксировать @@ -809,7 +822,7 @@ TimePlot - + Unequal size of timestamps and items: %1 vs %2 Неравный размер отсчётов времени и данных: %1 и %2 diff --git a/src/gui/timeplot.cpp b/src/gui/timeplot.cpp index 807b354..5678b2d 100644 --- a/src/gui/timeplot.cpp +++ b/src/gui/timeplot.cpp @@ -140,6 +140,10 @@ void TimePlot::zoomOut() { void TimePlot::zoom(double factor) { + if ( ! fixedScale ) { + fixCurrent(); + } + double mid = (fixedScaleMin + fixedScaleMax) / 2; double amp = qAbs(fixedScaleMax - fixedScaleMin) / 2; @@ -159,6 +163,10 @@ void TimePlot::moveDown() { } void TimePlot::move(double factor) { + if ( ! fixedScale ) { + fixCurrent(); + } + double delta = (fixedScaleMax - fixedScaleMin)*factor; fixedScaleMin += delta; fixedScaleMax += delta; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3994830..815cee3 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -449,7 +449,6 @@ void MainWindow::initPortSettingsAction(QAction * action, QString title, PortSet void MainWindow::initZoomAction(QAction *action, QToolButton *btn) { btn->setDefaultAction(action); - connect(action, &QAction::triggered, this, &MainWindow::setFixedScale); } void MainWindow::setFixedScale() { @@ -465,6 +464,8 @@ void MainWindow::onZoomChanged(double newMin, double newMax) { ui->fixedScaleMax->blockSignals(false); ui->fixedScaleMin->blockSignals(false); + setFixedScale(); + if (!worker->isStarted()) { // replot to see the change (when started, it will be replotted when received next data) for (TimePlot * plot: plots) {