@@ -53,7 +53,7 @@ namespace
5353 const float TimerMinFPS = 0 .25f ;
5454 const float TimerMaxFPS = 20 .0f ;
5555 const int MilliSecondsPerSecond = 1000 ;
56- const int BlendSteps = 100 ;
56+ // const int BlendSteps = 100;
5757 const int NumberOfColumns = 5 ;
5858 const auto NoStep = -1 ;
5959 const auto NoVolIdx = std::numeric_limits<size_t >::max();
@@ -68,7 +68,7 @@ iAVolumePlayerWidget::iAVolumePlayerWidget(iAMdiChild *child, std::vector<iAVolu
6868 m_child (child)
6969{
7070 m_ui->setupUi (this );
71- m_isBlendingOn = m_ui->blending ->isChecked ();
71+ // m_isBlendingOn = m_ui->blending->isChecked();
7272 setSpeed ();
7373
7474 m_ui->volumeSlider ->setMaximum (static_cast <int >(m_volumeViewers.size () - 1 ));
@@ -87,11 +87,13 @@ iAVolumePlayerWidget::iAVolumePlayerWidget(iAMdiChild *child, std::vector<iAVolu
8787 connect (m_ui->tbApplyForAll , &QToolButton::clicked, this , &iAVolumePlayerWidget::applyForAll);
8888 connect (m_ui->dataTable ->horizontalHeader (), &QHeaderView::sectionClicked, this , &iAVolumePlayerWidget::selectAll);
8989 connect (&m_timer, &QTimer::timeout, this , &iAVolumePlayerWidget::nextVolume);
90+ /*
9091#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0)
9192 connect(m_ui->blending, &QCheckBox::stateChanged, this, &iAVolumePlayerWidget::blendingStateChanged);
9293#else
9394 connect(m_ui->blending, &QCheckBox::checkStateChanged, this, &iAVolumePlayerWidget::blendingStateChanged);
9495#endif
96+ */
9597
9698 m_ui->sbSpeed ->setMinimum (TimerMinFPS);
9799 m_ui->sbSpeed ->setMaximum (TimerMaxFPS);
@@ -163,7 +165,7 @@ iAVolumePlayerWidget::~iAVolumePlayerWidget() = default;
163165
164166void iAVolumePlayerWidget::applyForAll ()
165167{
166- assert (!m_isBlendingOn);
168+ // assert(!m_isBlendingOn);
167169 auto currentIdx = listToVolumeIndex (m_ui->volumeSlider ->value ());
168170 auto tf = m_volumeViewers[currentIdx]->transfer ();
169171 for (size_t i = 0 ; i < m_volumeViewers.size (); ++i)
@@ -197,18 +199,18 @@ void iAVolumePlayerWidget::sliderChanged()
197199{
198200 int step = m_ui->volumeSlider ->value ();
199201 // if (m_isBlendingOn)
200- {
202+ // {
201203 // float listIdx = static_cast<float>(step / BlendSteps);
202204 // QSet<size_t> tohide;
203205 // if (m_prevVolIdx.first != NoVolIdx && m_prevVolIdx.second != NoVolIdx &&
204- // m_prevVolIdx.first != std::floor(listToVolumeIndex(listIdx)) || m_prevVolIdx.second != std::ceil(listToVolumeIndex(listIdx)))
206+ // m_prevVolIdx.first != std::floor(listToVolumeIndex(listIdx)) || m_prevVolIdx.second != std::ceil(listToVolumeIndex(listIdx)))
205207 // {
206- // tohide.insert(m_prevVolIdx.first);
207- // tohide.insert(m_prevVolIdx.second);
208+ // tohide.insert(m_prevVolIdx.first);
209+ // tohide.insert(m_prevVolIdx.second);
208210 // }
209211 // if (step % BlendSteps == 0)
210212 // {
211- // tohide.insert(m_prevVolIdx.first); // possibly not accurate, does this consider each case (automatic/manual switching?)
213+ // tohide.insert(m_prevVolIdx.first); // possibly not accurate, does this consider each case (automatic/manual switching?)
212214 // }
213215 // auto fadeOutVolIdx = listToVolumeIndex(std::floor(listIdx));
214216 // auto fadeInVolIdx = listToVolumeIndex(static_cast<int>(std::trunc(listIdx + 1)) % getNumberOfCheckedVolumes());
@@ -219,34 +221,36 @@ void iAVolumePlayerWidget::sliderChanged()
219221 //
220222 // for (auto h : tohide)
221223 // {
222- // if (!toshow.contains(h))
223- // {
224- // m_volumeViewers[h]->renderer()->setVisible(false);
225- // }
224+ // if (!toshow.contains(h))
225+ // {
226+ // m_volumeViewers[h]->renderer()->setVisible(false);
227+ // }
226228 // }
227229 // for (auto s : toshow)
228230 // {
229- // m_volumeViewers[s]->renderer()->setVisible(true);
231+ // m_volumeViewers[s]->renderer()->setVisible(true);
230232 // }
231233 // // actual blending: modify TF - store original somewhere...
232234 // for ()
233235 // m_volumeViewers[fadeOutVolIdx]->transfer()->opacityTF
234-
235- }
236+ // }
236237 // else
237- {
238+ // {
238239 if (m_prevVolIdx.first != NoVolIdx)
239240 {
240241 m_volumeViewers[m_prevVolIdx.first ]->renderer ()->setVisible (false );
241242 m_volumeViewers[m_prevVolIdx.first ]->showInSlicers (false );
242243 }
243244 auto volIdx = listToVolumeIndex (step);
244- m_volumeViewers[volIdx]->renderer ()->setVisible (true );
245- m_child->updateRenderer (); // maybe do update in viewer?
246- m_volumeViewers[volIdx]->showInSlicers (true );
247- m_child->updateSlicers (); // maybe do update in viewer?
248- m_prevVolIdx.first = volIdx;
249- }
245+ if (volIdx != NoVolIdx)
246+ {
247+ m_volumeViewers[volIdx]->renderer ()->setVisible (true );
248+ m_child->updateRenderer (); // maybe do update in viewer?
249+ m_volumeViewers[volIdx]->showInSlicers (true );
250+ m_child->updateSlicers (); // maybe do update in viewer?
251+ m_prevVolIdx.first = volIdx;
252+ }
253+ // }
250254}
251255
252256void iAVolumePlayerWidget::stopVolume ()
@@ -271,8 +275,16 @@ void iAVolumePlayerWidget::setChecked(int r, int /*c*/)
271275{
272276 for (int i=1 ; i<NumberOfColumns;i++)
273277 {
274- m_ui->dataTable ->item (m_old_r,i)->setBackground (Qt::white);
275- m_ui->dataTable ->item (r,i)->setBackground (Qt::lightGray);
278+ auto oldItem = m_ui->dataTable ->item (m_old_r, i);
279+ if (oldItem)
280+ {
281+ oldItem->setBackground (Qt::white);
282+ }
283+ auto newItem = m_ui->dataTable ->item (r, i);
284+ if (newItem)
285+ {
286+ newItem->setBackground (Qt::lightGray);
287+ }
276288 }
277289 m_old_r=r;
278290}
@@ -338,9 +350,10 @@ float iAVolumePlayerWidget::currentSpeed() const
338350
339351void iAVolumePlayerWidget::adjustSliderMax ()
340352{
341- m_ui->volumeSlider ->setMaximum ((getNumberOfCheckedVolumes () - 1 ) * (m_isBlendingOn ? BlendSteps : 1 ));
353+ m_ui->volumeSlider ->setMaximum ((getNumberOfCheckedVolumes () - 1 ) /* * (m_isBlendingOn ? BlendSteps : 1)*/ );
342354}
343355
356+ /*
344357void iAVolumePlayerWidget::blendingStateChanged(int state)
345358{
346359 m_isBlendingOn = state;
@@ -351,6 +364,7 @@ void iAVolumePlayerWidget::blendingStateChanged(int state)
351364 : std::floor(static_cast<double>(oldVal + 1) / BlendSteps + 0.5));
352365 m_ui->tbApplyForAll->setEnabled(!m_isBlendingOn);
353366}
367+ */
354368
355369void iAVolumePlayerWidget::enableVolume (int state)
356370{
0 commit comments