From 1a00c868f25c95466b8780a9da4d75fd6294fe6d Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Thu, 25 Mar 2021 12:25:04 -0400 Subject: [PATCH] 2021-03-25 Fred Gleason * Modified the 'Time' buttons in 'RDMarkerDialog' to show currently available 'In' and 'Out' possibilities. Signed-off-by: Fred Gleason --- ChangeLog | 3 ++ lib/rdmarkerdialog.cpp | 44 ++++++++++--------------- lib/rdmarkerdialog.h | 3 -- lib/rdmarkerview.cpp | 74 ++++++++++++++++++++++++++++++++---------- lib/rdmarkerview.h | 11 +++++-- 5 files changed, 87 insertions(+), 48 deletions(-) diff --git a/ChangeLog b/ChangeLog index 709d4d0a..7efc48b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21344,3 +21344,6 @@ attributes. 2021-03-25 Fred Gleason * Refactored layout of 'RDMarkerDialog' +2021-03-25 Fred Gleason + * Modified the 'Time' buttons in 'RDMarkerDialog' to show currently + available 'In' and 'Out' possibilities. diff --git a/lib/rdmarkerdialog.cpp b/lib/rdmarkerdialog.cpp index d773ed08..7652cd55 100644 --- a/lib/rdmarkerdialog.cpp +++ b/lib/rdmarkerdialog.cpp @@ -53,24 +53,33 @@ RDMarkerDialog::RDMarkerDialog(const QString &caption,int card,int port, this,SLOT(amplitudeDownData())); // - // Time + // Time Scaling Buttons // d_time_box=new QGroupBox(tr("Time"),this); d_time_box->setFont(labelFont()); d_time_fullin_button=new QPushButton(tr("Full\nIn"),d_time_box); d_time_fullin_button->setFont(buttonFont()); - connect(d_time_fullin_button,SIGNAL(clicked()),this,SLOT(timeFullInData())); + connect(d_time_fullin_button,SIGNAL(clicked()), + d_marker_view,SLOT(maxShrinkTime())); + connect(d_marker_view,SIGNAL(canShrinkTimeChanged(bool)), + d_time_fullin_button,SLOT(setEnabled(bool))); d_time_in_button=new RDTransportButton(RDTransportButton::Up,d_time_box); - connect(d_time_in_button,SIGNAL(clicked()),this,SLOT(timeInData())); + connect(d_time_in_button,SIGNAL(clicked()),d_marker_view,SLOT(shrinkTime())); + connect(d_marker_view,SIGNAL(canShrinkTimeChanged(bool)), + d_time_in_button,SLOT(setEnabled(bool))); d_time_out_button=new RDTransportButton(RDTransportButton::Down,d_time_box); - connect(d_time_out_button,SIGNAL(clicked()),this,SLOT(timeOutData())); + connect(d_time_out_button,SIGNAL(clicked()),d_marker_view,SLOT(growTime())); + connect(d_marker_view,SIGNAL(canGrowTimeChanged(bool)), + d_time_out_button,SLOT(setEnabled(bool))); d_time_fullout_button=new QPushButton(tr("Full\nOut"),d_time_box); d_time_fullout_button->setFont(buttonFont()); connect(d_time_fullout_button,SIGNAL(clicked()), - d_marker_view,SLOT(setMaximumShrinkFactor())); + d_marker_view,SLOT(maxGrowTime())); + connect(d_marker_view,SIGNAL(canGrowTimeChanged(bool)), + d_time_fullout_button,SLOT(setEnabled(bool))); /************************************************************************** * Transport Section @@ -157,6 +166,10 @@ int RDMarkerDialog::exec(unsigned cartnum,int cutnum) } d_marker_view-> setSelectedMarkers(RDMarkerHandle::CutStart,RDMarkerHandle::CutEnd); + d_time_fullin_button->setEnabled(d_marker_view->canShrinkTime()); + d_time_in_button->setEnabled(d_marker_view->canShrinkTime()); + d_time_out_button->setEnabled(d_marker_view->canGrowTime()); + d_time_fullout_button->setEnabled(d_marker_view->canGrowTime()); return QDialog::exec(); } @@ -174,27 +187,6 @@ void RDMarkerDialog::amplitudeDownData() } -void RDMarkerDialog::timeFullInData() -{ - d_marker_view->setShrinkFactor(1); -} - - -void RDMarkerDialog::timeInData() -{ - int sf=d_marker_view->shrinkFactor(); - if(sf>1) { - d_marker_view->setShrinkFactor(sf/2); - } -} - - -void RDMarkerDialog::timeOutData() -{ - d_marker_view->setShrinkFactor(2*d_marker_view->shrinkFactor()); -} - - void RDMarkerDialog::okData() { d_marker_view->save(); diff --git a/lib/rdmarkerdialog.h b/lib/rdmarkerdialog.h index de4fc1d8..9ab3da2f 100644 --- a/lib/rdmarkerdialog.h +++ b/lib/rdmarkerdialog.h @@ -74,9 +74,6 @@ class RDMarkerDialog : public RDDialog private slots: void amplitudeUpData(); void amplitudeDownData(); - void timeFullInData(); - void timeInData(); - void timeOutData(); void okData(); void cancelData(); diff --git a/lib/rdmarkerview.cpp b/lib/rdmarkerview.cpp index e09270bf..bb73bfd0 100644 --- a/lib/rdmarkerview.cpp +++ b/lib/rdmarkerview.cpp @@ -456,6 +456,18 @@ int RDMarkerView::shrinkFactor() const } +bool RDMarkerView::canShrinkTime() const +{ + return d_shrink_factor>1; +} + + +bool RDMarkerView::canGrowTime() const +{ + return d_shrink_factor=360) { if(shrinkFactor()>1) { - setShrinkFactor(shrinkFactor()/2); + SetShrinkFactor(shrinkFactor()/2); } d_wheel_angle=0; } if(d_wheel_angle<=-360) { if(shrinkFactor()