mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-11 23:32:38 +02:00
Fixed a bug in rdairplay(1) with HourSelector::updateTimeData()
where timer was not set properly when crossing midnight.
This commit is contained in:
parent
d0c232eef1
commit
98b8297fa1
@ -19749,3 +19749,6 @@
|
|||||||
* Fixed a regression in rdairplay(1) that caused two events to be
|
* Fixed a regression in rdairplay(1) that caused two events to be
|
||||||
started by a single spacebar tap if a SoundPanel event had been
|
started by a single spacebar tap if a SoundPanel event had been
|
||||||
played previously.
|
played previously.
|
||||||
|
2020-04-01 Patrick Linstruth <patrick@deltecent.com>
|
||||||
|
* Fixed a bug in rdairplay(1) with HourSelector::updateTimeData()
|
||||||
|
where timer was not set properly when crossing midnight.
|
||||||
|
@ -46,6 +46,7 @@ HourSelector::HourSelector(QWidget *parent)
|
|||||||
// Update Timer
|
// Update Timer
|
||||||
//
|
//
|
||||||
hour_update_timer=new QTimer(this);
|
hour_update_timer=new QTimer(this);
|
||||||
|
hour_update_timer->setSingleShot(true);
|
||||||
connect(hour_update_timer,SIGNAL(timeout()),this,SLOT(updateTimeData()));
|
connect(hour_update_timer,SIGNAL(timeout()),this,SLOT(updateTimeData()));
|
||||||
updateTimeData();
|
updateTimeData();
|
||||||
}
|
}
|
||||||
@ -124,10 +125,13 @@ void HourSelector::hourClicked(int hour)
|
|||||||
|
|
||||||
void HourSelector::updateTimeData()
|
void HourSelector::updateTimeData()
|
||||||
{
|
{
|
||||||
QTime now=QTime::currentTime();
|
QDateTime now=QDateTime::currentDateTime();
|
||||||
|
QDateTime next;
|
||||||
for(unsigned i=0;i<24;i++) {
|
for(unsigned i=0;i<24;i++) {
|
||||||
hour_button[i]->setPalette(palette());
|
hour_button[i]->setPalette(palette());
|
||||||
}
|
}
|
||||||
hour_button[now.hour()]->setPalette(hour_active_palette);
|
hour_button[now.time().hour()]->setPalette(hour_active_palette);
|
||||||
hour_update_timer->start(now.msecsTo(QTime(now.hour()+1,0,1)),true);
|
next=now.addSecs(60*60); // Next hour
|
||||||
|
next.setTime(QTime(next.time().hour(),0,1)); // Set top of hour HH:00:01
|
||||||
|
hour_update_timer->start(now.msecsTo(next)); // Start timer
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user