109 changes: 56 additions & 53 deletions mythplugins/mythgame/i18n/mythgame_it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -970,54 +970,57 @@ di volerlo fare?</translation>
<location filename="themestrings.h" line="5"/>
<source>%00x00| - %%&quot;|SUBTITLE|&quot;
%%|YEARSTARS| - %%DESCRIPTION%</source>
<translation type="unfinished"></translation>
<translation type="unfinished">%00x00| - %%&quot;|SUBTITLE|&quot;
%%|YEARSTARS| - %%DESCRIPTION%</translation>
</message>
<message>
<location filename="themestrings.h" line="7"/>
<source>%Published by |publisher|%%, |YEAR%</source>
<translation type="unfinished"></translation>
<translation type="unfinished">%Pubblicato da|publisher|%%, |YEAR%</translation>
</message>
<message>
<location filename="themestrings.h" line="8"/>
<source>%&quot;|SUBTITLE|&quot;

%%DESCRIPTION%</source>
<translation type="unfinished"></translation>
<translation type="unfinished">%&quot;|SUBTITLE|&quot;

%%DESCRIPTION%</translation>
</message>
<message>
<location filename="themestrings.h" line="9"/>
<source>%cast%</source>
<translation type="unfinished"></translation>
<translation type="unfinished">%cast%</translation>
</message>
<message>
<location filename="themestrings.h" line="10"/>
<source>%playcount% times</source>
<translation type="unfinished"></translation>
<translation type="unfinished">%playcount% volte</translation>
</message>
<message>
<location filename="themestrings.h" line="11"/>
<source>%romname%%, |(rompath)%</source>
<translation type="unfinished"></translation>
<translation type="unfinished">%romname%%, |(rompath)%</translation>
</message>
<message>
<location filename="themestrings.h" line="13"/>
<source>Add game to Favorites:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Aggiungi gioco ai preferiti:</translation>
</message>
<message>
<location filename="themestrings.h" line="14"/>
<source>Add games to your</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Aggiungi giochi al tuo</translation>
</message>
<message>
<location filename="themestrings.h" line="16"/>
<source>Add to favorites:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Aggiungi ai preferiti:</translation>
</message>
<message>
<location filename="themestrings.h" line="19"/>
<source>CRC</source>
<translation type="unfinished"></translation>
<translation type="unfinished">CRC</translation>
</message>
<message>
<location filename="themestrings.h" line="21"/>
Expand All @@ -1027,57 +1030,57 @@ di volerlo fare?</translation>
<message>
<location filename="themestrings.h" line="23"/>
<source>Clear data of all your games</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Cancella dati di tutti i giochi</translation>
</message>
<message>
<location filename="themestrings.h" line="24"/>
<source>Clear your game</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Cancella il tuo gioco</translation>
</message>
<message>
<location filename="themestrings.h" line="29"/>
<source>Configure game emulators</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Configura emulatori giochi</translation>
</message>
<message>
<location filename="themestrings.h" line="30"/>
<source>Configure your game</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Configura gioco</translation>
</message>
<message>
<location filename="themestrings.h" line="31"/>
<source>Country</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Paese</translation>
</message>
<message>
<location filename="themestrings.h" line="34"/>
<source>Coverart</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Copertina</translation>
</message>
<message>
<location filename="themestrings.h" line="35"/>
<source>Coverart:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Copertina:</translation>
</message>
<message>
<location filename="themestrings.h" line="36"/>
<source>Customize meta data of your games</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Personalizza metadati dei giochi</translation>
</message>
<message>
<location filename="themestrings.h" line="37"/>
<source>Data</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Dati</translation>
</message>
<message>
<location filename="themestrings.h" line="39"/>
<source>Description: %1</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Descrizione: %1</translation>
</message>
<message>
<location filename="themestrings.h" line="40"/>
<source>Detailed information about your game</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Informazioni dettagliate sul gioco</translation>
</message>
<message>
<location filename="themestrings.h" line="43"/>
Expand All @@ -1087,57 +1090,57 @@ di volerlo fare?</translation>
<message>
<location filename="themestrings.h" line="46"/>
<source>Fanart</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Fanart</translation>
</message>
<message>
<location filename="themestrings.h" line="50"/>
<source>File:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">File:</translation>
</message>
<message>
<location filename="themestrings.h" line="51"/>
<source>Filename</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Nome file</translation>
</message>
<message>
<location filename="themestrings.h" line="54"/>
<source>GAMES</source>
<translation type="unfinished"></translation>
<translation type="unfinished">GIOCHI</translation>
</message>
<message>
<location filename="themestrings.h" line="58"/>
<source>Game Type:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Tipo gioco:</translation>
</message>
<message>
<location filename="themestrings.h" line="59"/>
<source>Game details</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Dettagli gioco</translation>
</message>
<message>
<location filename="themestrings.h" line="60"/>
<source>Game folders and general</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Cartelle gioco e generale</translation>
</message>
<message>
<location filename="themestrings.h" line="62"/>
<source>Game folders and general settings</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Cartelle gioco e impostazioni generali</translation>
</message>
<message>
<location filename="themestrings.h" line="64"/>
<source>Game plot:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Trama gioco:</translation>
</message>
<message>
<location filename="themestrings.h" line="70"/>
<source>Library</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Biblioteca</translation>
</message>
<message>
<location filename="themestrings.h" line="71"/>
<source>Metadata</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Metadati</translation>
</message>
<message>
<location filename="themestrings.h" line="72"/>
Expand All @@ -1147,92 +1150,92 @@ di volerlo fare?</translation>
<message>
<location filename="themestrings.h" line="73"/>
<source>Name:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Nome:</translation>
</message>
<message>
<location filename="themestrings.h" line="74"/>
<source>Navigation</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Navigazione</translation>
</message>
<message>
<location filename="themestrings.h" line="77"/>
<source>Path:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Percorso:</translation>
</message>
<message>
<location filename="themestrings.h" line="80"/>
<source>Players</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Giocatori</translation>
</message>
<message>
<location filename="themestrings.h" line="82"/>
<source>Publisher</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Editore</translation>
</message>
<message>
<location filename="themestrings.h" line="86"/>
<source>ROM path</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Percorso ROM</translation>
</message>
<message>
<location filename="themestrings.h" line="88"/>
<source>ROM:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">ROM:</translation>
</message>
<message>
<location filename="themestrings.h" line="91"/>
<source>Save</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Salva</translation>
</message>
<message>
<location filename="themestrings.h" line="93"/>
<source>Screenshot</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Schermata</translation>
</message>
<message>
<location filename="themestrings.h" line="95"/>
<source>Search</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Cerca</translation>
</message>
<message>
<location filename="themestrings.h" line="96"/>
<source>Search Boxart</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Cerca boxart</translation>
</message>
<message>
<location filename="themestrings.h" line="97"/>
<source>Search Fanart</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Cerca fanart</translation>
</message>
<message>
<location filename="themestrings.h" line="98"/>
<source>Search Screenshot</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Cerca schermata</translation>
</message>
<message>
<location filename="themestrings.h" line="99"/>
<source>Select Game</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Seleziona gioco</translation>
</message>
<message>
<location filename="themestrings.h" line="100"/>
<source>Settings</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Impostazioni</translation>
</message>
<message>
<location filename="themestrings.h" line="101"/>
<source>Starring:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Protagonista:</translation>
</message>
<message>
<location filename="themestrings.h" line="102"/>
<source>System</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Sistema</translation>
</message>
<message>
<location filename="themestrings.h" line="106"/>
<source>Systems:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Sistemi:</translation>
</message>
<message>
<location filename="themestrings.h" line="107"/>
Expand All @@ -1242,17 +1245,17 @@ di volerlo fare?</translation>
<message>
<location filename="themestrings.h" line="113"/>
<source>_</source>
<translation type="unfinished"></translation>
<translation type="unfinished">_</translation>
</message>
<message>
<location filename="themestrings.h" line="114"/>
<source>genre:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">genere:</translation>
</message>
<message>
<location filename="themestrings.h" line="115"/>
<source>system:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">sistema:</translation>
</message>
<message>
<location filename="themestrings.h" line="33"/>
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythgame/mythgame/gamehandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ void GameHandler::Launchgame(RomInfo *romdata, const QString& systemname)
// the command.
if (exec.contains("%s") || handler->SpanDisks())
{
exec = exec.replace(QRegExp("%s"),arg);
exec = exec.replace("%s",arg);

if (handler->SpanDisks())
{
Expand Down
389 changes: 195 additions & 194 deletions mythplugins/mythmusic/i18n/mythmusic_it.ts

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions mythplugins/mythmusic/mythmusic/avfdecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ extern "C" {
#include "libavutil/opt.h"
}

using namespace std::chrono_literals;

/****************************************************************************/

using ShoutCastMetaMap = QMap<QString,QString>;
Expand Down Expand Up @@ -314,7 +312,7 @@ bool avfDecoder::initialize()
mdata.setArtist(tag->value);

mdata.setAlbum("");
mdata.setLength(-1);
mdata.setLength(-1ms);

DecoderHandlerEvent ev(DecoderHandlerEvent::Meta, mdata);
dispatch(ev);
Expand Down Expand Up @@ -499,20 +497,20 @@ void avfDecoder::run()
if (data_size <= 0)
continue;

output()->AddData(m_outputBuffer, data_size, -1, 0);
output()->AddData(m_outputBuffer, data_size, -1ms, 0);
}

av_packet_unref(&pkt);

// Wait until we need to decode or supply more samples
while (!m_finish && !m_userStop && m_seekTime <= 0.0)
{
int64_t buffered = output()->GetAudioBufferedTime();
std::chrono::milliseconds buffered = output()->GetAudioBufferedTime();
// never go below 1s buffered
if (buffered < 1000)
if (buffered < 1s)
break;
// wait
const struct timespec ns {0, (buffered - 1000) * 1000000};
const struct timespec ns {0, (buffered.count() - 1000) * 1000000};
nanosleep(&ns, nullptr);
}
}
Expand Down Expand Up @@ -565,7 +563,7 @@ void avfDecoder::checkMetatdata(void)
mdata.setTitle(meta_map["title"]);
mdata.setArtist(meta_map["artist"]);
mdata.setAlbum(meta_map["album"]);
mdata.setLength(-1);
mdata.setLength(-1ms);

DecoderHandlerEvent ev(DecoderHandlerEvent::Meta, mdata);
dispatch(ev);
Expand Down
12 changes: 6 additions & 6 deletions mythplugins/mythmusic/mythmusic/cddecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void CdDecoder::writeBlock()
{
while (m_seekTime <= +0.)
{
if(output()->AddFrames(m_outputBuf, m_bksFrames, -1))
if(output()->AddFrames(m_outputBuf, m_bksFrames, -1ms))
{
if (m_outputAt >= m_bks)
{
Expand All @@ -133,7 +133,7 @@ void CdDecoder::writeBlock()
}
break;
}
::usleep(output()->GetAudioBufferedTime()<<9);
::usleep(output()->GetAudioBufferedTime().count()<<9);
}
}

Expand Down Expand Up @@ -384,7 +384,7 @@ void CdDecoder::run()
if (fill < (thresh << 6))
break;
// Wait for half of the buffer to drain
::usleep(output()->GetAudioBufferedTime()<<9);
::usleep(output()->GetAudioBufferedTime().count()<<9);
}

// write a block if there's sufficient space for it
Expand Down Expand Up @@ -506,7 +506,7 @@ MusicMetadata *CdDecoder::getMetadata()
QString title;
QString genre;
int year = 0;
unsigned long length = 0;
std::chrono::milliseconds length = 0s;
track_t tracknum = 0;

if (-1 == m_setTrackNum)
Expand Down Expand Up @@ -572,8 +572,8 @@ MusicMetadata *CdDecoder::getMetadata()
const lsn_t start = cdio_get_track_lsn(cdio, tracknum);
if (CDIO_INVALID_LSN != start && CDIO_INVALID_LSN != end)
{
length = ((end - start + 1) * 1000 + CDIO_CD_FRAMES_PER_SEC/2) /
CDIO_CD_FRAMES_PER_SEC;
length = std::chrono::milliseconds(((end - start + 1) * 1000 + CDIO_CD_FRAMES_PER_SEC/2) /
CDIO_CD_FRAMES_PER_SEC);
}

bool isCompilation = false;
Expand Down
12 changes: 5 additions & 7 deletions mythplugins/mythmusic/mythmusic/cdrip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
#include "mythlogging.h"
#include "vorbisencoder.h"

using namespace std::chrono_literals;

#ifdef HAVE_CDIO
// libparanoia compatibility
#ifndef cdrom_paranoia
Expand Down Expand Up @@ -1225,9 +1223,9 @@ void Ripper::updateTrackList(void)
item->SetText(metadata->Title(), "title");
item->SetText(metadata->Artist(), "artist");

if (track->length >= ONESECINMS)
if (track->length >= 1s)
{
item->SetText(MythFormatTimeMs(track->length, "mm:ss"), "length");
item->SetText(MythFormatTime(track->length, "mm:ss"), "length");
}
else
item->SetText("", "length");
Expand Down Expand Up @@ -1413,19 +1411,19 @@ void Ripper::ShowConflictMenu(RipTrack* track)

void Ripper::updateTrackLengths()
{
int length = 0;
std::chrono::milliseconds length = 0ms;

for (auto *it = m_tracks->end() - 1; it == m_tracks->begin(); --it)
{
RipTrack *track = *it;
if (track->active)
{
track->length = length + track->metadata->Length();
length = 0;
length = 0ms;
}
else
{
track->length = 0;
track->length = 0ms;
length += track->metadata->Length();
}
}
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/mythmusic/cdrip.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct RipTrack
{
MusicMetadata *metadata;
bool active;
int length;
std::chrono::milliseconds length;
bool isNew;
};

Expand Down
24 changes: 8 additions & 16 deletions mythplugins/mythmusic/mythmusic/lyricsview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

// qt
#include <QKeyEvent>
#include <QRegExp>
#include <QThread>
#include <QDomDocument>

Expand Down Expand Up @@ -111,14 +110,14 @@ void LyricsView::customEvent(QEvent *event)
if (!oe || !curMeta)
return;

int rs = 0;
std::chrono::milliseconds rs = 0ms;

if (gPlayer->getPlayMode() == MusicPlayer::PLAYMODE_RADIO)
{
rs = gPlayer->getCurrentTrackTime() * 1000;
rs = gPlayer->getCurrentTrackTime();
}
else
rs = oe->elapsedSeconds() * 1000;
rs = oe->elapsedSeconds();

int pos = 0;
for (int x = 0; x < m_lyricsList->GetCount(); x++)
Expand All @@ -127,7 +126,7 @@ void LyricsView::customEvent(QEvent *event)
auto *lyric = item->GetData().value<LyricsLine*>();
if (lyric)
{
if (lyric->m_time > 1000 && rs >= lyric->m_time)
if (lyric->m_time > 1s && rs >= lyric->m_time)
pos = x;
}
}
Expand Down Expand Up @@ -339,7 +338,7 @@ void LyricsView::setLyricTime(void)
auto *lyric = item->GetData().value<LyricsLine*>();
if (lyric)
{
lyric->m_time = gPlayer->getOutput()->GetAudiotime() - 750;
lyric->m_time = gPlayer->getOutput()->GetAudiotime() - 750ms;
m_lyricData->setChanged(true);
m_lyricData->setSyncronized(true);
m_autoScroll = false;
Expand Down Expand Up @@ -448,13 +447,10 @@ void LyricsView::showLyrics(void)
QString syncronized = m_lyricData->syncronized() ? tr("Syncronized") : tr("Unsyncronized");
new MythUIButtonListItem(m_lyricsList, tr("** Lyrics from %1 (%2) **").arg(m_lyricData->grabber()).arg(syncronized));

QMap<int, LyricsLine*>::iterator i = m_lyricData->lyrics()->begin();
while (i != m_lyricData->lyrics()->end())
for (auto * line : qAsConst(*m_lyricData->lyrics()))
{
LyricsLine *line = (*i);
if (line)
new MythUIButtonListItem(m_lyricsList, line->m_lyric, QVariant::fromValue(line));
++i;
}

m_autoScroll = true;
Expand Down Expand Up @@ -564,7 +560,7 @@ bool EditLyricsDialog::keyPressEvent(QKeyEvent *event)
void EditLyricsDialog::loadLyrics(void)
{
QString lyrics;
QMap<int, LyricsLine*>::iterator i = m_sourceData->lyrics()->begin();
LyricsLineMap::iterator i = m_sourceData->lyrics()->begin();
while (i != m_sourceData->lyrics()->end())
{
LyricsLine *line = (*i);
Expand Down Expand Up @@ -602,14 +598,10 @@ bool EditLyricsDialog::somethingChanged(void)
return true;

int x = 0;
QMap<int, LyricsLine*>::iterator i = m_sourceData->lyrics()->begin();
while (i != m_sourceData->lyrics()->end())
for (auto * line : qAsConst(*m_sourceData->lyrics()))
{
LyricsLine *line = (*i);
if (line->toString(m_sourceData->syncronized()) != lines.at(x))
changed = true;

++i;
++x;
}

Expand Down
1 change: 0 additions & 1 deletion mythplugins/mythmusic/mythmusic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
// Qt headers
#include <QDir>
#include <QApplication>
#include <QRegExp>
#include <QScopedPointer>

// MythTV headers
Expand Down
8 changes: 5 additions & 3 deletions mythplugins/mythmusic/mythmusic/mainvisual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ void MainVisual::prepare()
// This is called via : mythtv/libs/libmyth/output.cpp :: OutputListeners::dispatchVisual
// from : mythtv/libs/libmyth/audio/audiooutputbase.cpp :: AudioOutputBase::AddData
// Caller holds mutex() lock
void MainVisual::add(const void *buffer, unsigned long b_len, unsigned long timecode, int source_channels, int bits_per_sample)
void MainVisual::add(const void *buffer, unsigned long b_len,
std::chrono::milliseconds timecode,
int source_channels, int bits_per_sample)
{
unsigned long len = b_len;
short *l = nullptr;
Expand Down Expand Up @@ -211,10 +213,10 @@ void MainVisual::timeout()
if (m_playing && gPlayer->getOutput())
{
QMutexLocker locker(mutex());
int64_t timestamp = gPlayer->getOutput()->GetAudiotime();
std::chrono::milliseconds timestamp = gPlayer->getOutput()->GetAudiotime();
while (m_nodes.size() > 1)
{
if ((int64_t)m_nodes.first()->m_offset > timestamp)
if (m_nodes.first()->m_offset > timestamp)
break;

if (m_vis)
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/mythmusic/mainvisual.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class MainVisual : public QObject, public MythTV::Visual

void resize(QSize size);

void add(const void *buffer, unsigned long b_len, unsigned long timecode,
void add(const void *buffer, unsigned long b_len, std::chrono::milliseconds timecode,
int source_channel, int bits_per_sample) override; // Visual
void prepare(void) override; // Visual

Expand Down
2 changes: 0 additions & 2 deletions mythplugins/mythmusic/mythmusic/miniplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

#include <QTimer>

using namespace std::chrono_literals;


MiniPlayer::MiniPlayer(MythScreenStack *parent)
: MusicCommon(parent, nullptr, "music_miniplayer")
Expand Down
62 changes: 30 additions & 32 deletions mythplugins/mythmusic/mythmusic/musiccommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void MusicCommon::init(bool startPlayback)

if (m_playlistProgress)
{
m_playlistProgress->SetTotal(m_playlistMaxTime);
m_playlistProgress->SetTotal(m_playlistMaxTime.count());
m_playlistProgress->SetUsed(0);
}

Expand Down Expand Up @@ -747,7 +747,7 @@ bool MusicCommon::keyPressEvent(QKeyEvent *e)
m_stopButton->Push();
else
stop();
m_currentTime = 0;
m_currentTime = 0s;
}
else if (action == "CYCLEVIS")
cycleVisualizer();
Expand Down Expand Up @@ -939,8 +939,8 @@ void MusicCommon::updateProgressBar()
{
// show the track played time
int percentplayed = 1;
if (m_maxTime)
percentplayed = (int)(((double)m_currentTime / (double)m_maxTime) * 100);
if (m_maxTime > 0s)
percentplayed = m_currentTime * 100 / m_maxTime;
m_trackProgress->SetTotal(100);
m_trackProgress->SetUsed(percentplayed);
}
Expand Down Expand Up @@ -1071,7 +1071,7 @@ void MusicCommon::stop(void)
{
gPlayer->stop();

QString time_string = getTimeString(m_maxTime, 0);
QString time_string = getTimeString(m_maxTime, 0s);

if (m_timeText)
m_timeText->SetText(time_string);
Expand All @@ -1098,29 +1098,27 @@ void MusicCommon::previous()

void MusicCommon::seekforward()
{
int nextTime = m_currentTime + 5;
if (nextTime > m_maxTime)
nextTime = m_maxTime;
std::chrono::seconds nextTime = m_currentTime + 5s;
nextTime = std::clamp(nextTime, 0s, m_maxTime);
seek(nextTime);
}

void MusicCommon::seekback()
{
int nextTime = m_currentTime - 5;
if (nextTime < 0)
nextTime = 0;
std::chrono::seconds nextTime = m_currentTime - 5s;
nextTime = std::clamp(nextTime, 0s, m_maxTime);
seek(nextTime);
}

void MusicCommon::seek(int pos)
void MusicCommon::seek(std::chrono::seconds pos)
{
if (gPlayer->getOutput())
{
Decoder *decoder = gPlayer->getDecoder();
if (decoder && decoder->isRunning())
{
decoder->lock();
decoder->seek(pos);
decoder->seek(pos.count());

if (m_mainvisual)
{
Expand All @@ -1132,7 +1130,7 @@ void MusicCommon::seek(int pos)
decoder->unlock();
}

gPlayer->getOutput()->SetTimecode(pos*1000);
gPlayer->getOutput()->SetTimecode(pos);

if (!gPlayer->isPlaying())
{
Expand All @@ -1144,8 +1142,8 @@ void MusicCommon::seek(int pos)

if (LCD *lcd = LCD::Get())
{
float percent_heard = m_maxTime <= 0 ? 0.0F : ((float)pos /
(float)m_maxTime);
float percent_heard = m_maxTime <= 0s ? 0.0F : ((float)pos.count() /
(float)m_maxTime.count());

QString lcd_time_string = getTimeString(pos, m_maxTime);

Expand Down Expand Up @@ -1255,15 +1253,15 @@ void MusicCommon::customEvent(QEvent *event)
if (!oe)
return;

int rs = 0;
std::chrono::seconds rs = 0s;
MusicMetadata *curMeta = gPlayer->getCurrentMetadata();

if (gPlayer->getPlayMode() == MusicPlayer::PLAYMODE_RADIO)
{
if (curMeta)
m_currentTime = rs = curMeta->Length() / 1000;
m_currentTime = rs = duration_cast<std::chrono::seconds>(curMeta->Length());
else
m_currentTime = 0;
m_currentTime = 0s;
}
else
m_currentTime = rs = oe->elapsedSeconds();
Expand All @@ -1276,8 +1274,8 @@ void MusicCommon::customEvent(QEvent *event)
{
if (LCD *lcd = LCD::Get())
{
float percent_heard = m_maxTime <= 0 ?
0.0F:((float)rs / (float)curMeta->Length()) * 1000.0F;
float percent_heard = m_maxTime <= 0s ?
0.0F:((float)rs.count() / (float)curMeta->Length().count()) * 1000.0F;

QString lcd_time_string = time_string;

Expand Down Expand Up @@ -1604,7 +1602,7 @@ void MusicCommon::customEvent(QEvent *event)
m_currentTrack, &m_playlistPlayedTime);
if (m_playlistProgress)
{
m_playlistProgress->SetTotal(m_playlistMaxTime);
m_playlistProgress->SetTotal(m_playlistMaxTime.count());
m_playlistProgress->SetUsed(0);
}

Expand Down Expand Up @@ -1911,9 +1909,9 @@ void MusicCommon::updateTrackInfo(MusicMetadata *mdata)
}

if (gPlayer->getPlayMode() == MusicPlayer::PLAYMODE_RADIO)
m_maxTime = 0;
m_maxTime = 0s;
else
m_maxTime = mdata->Length() / 1000;
m_maxTime = duration_cast<std::chrono::seconds>(mdata->Length());

// get map for current track
InfoMap metadataMap;
Expand Down Expand Up @@ -2114,8 +2112,8 @@ void MusicCommon::updatePlaylistStats(void)
map["playlistcurrent"] = playlistcurrent;
map["playlistcount"] = playlisttotal;
map["playlisttime"] = getTimeString(m_playlistPlayedTime + m_currentTime, m_playlistMaxTime);
map["playlistplayedtime"] = getTimeString(m_playlistPlayedTime + m_currentTime, 0);
map["playlisttotaltime"] = getTimeString(m_playlistMaxTime, 0);
map["playlistplayedtime"] = getTimeString(m_playlistPlayedTime + m_currentTime, 0s);
map["playlisttotaltime"] = getTimeString(m_playlistMaxTime, 0s);
QString playlistName = gPlayer->getCurrentPlaylist() ? gPlayer->getCurrentPlaylist()->getName() : "";
if (playlistName == "default_playlist_storage")
playlistName = tr("Default Playlist");
Expand All @@ -2137,16 +2135,16 @@ void MusicCommon::updatePlaylistStats(void)
SetTextFromMap(map);

if (m_playlistProgress)
m_playlistProgress->SetUsed(m_playlistPlayedTime + m_currentTime);
m_playlistProgress->SetUsed((m_playlistPlayedTime + m_currentTime).count());
}

QString MusicCommon::getTimeString(int exTime, int maxTime)
QString MusicCommon::getTimeString(std::chrono::seconds exTime, std::chrono::seconds maxTime)
{
if (maxTime <= 0)
if (maxTime <= 0ms)
return MythFormatTime(exTime,
(exTime >= ONEHOURINSEC) ? "H:mm:ss" : "mm:ss");
(exTime >= 1h) ? "H:mm:ss" : "mm:ss");

QString fmt = (maxTime >= ONEHOURINSEC) ? "H:mm:ss" : "mm:ss";
QString fmt = (maxTime >= 1h) ? "H:mm:ss" : "mm:ss";
return MythFormatTime(exTime, fmt) + " / " + MythFormatTime(maxTime, fmt);
}

Expand Down Expand Up @@ -2648,7 +2646,7 @@ void MusicCommon::playFirstTrack()
//---------------------------------------------------------
// MythMusicVolumeDialog
//---------------------------------------------------------
#define MUSICVOLUMEPOPUPTIME (4 * 1000)
static constexpr std::chrono::milliseconds MUSICVOLUMEPOPUPTIME { 4s };

MythMusicVolumeDialog::~MythMusicVolumeDialog(void)
{
Expand Down
12 changes: 6 additions & 6 deletions mythplugins/mythmusic/mythmusic/musiccommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class MPUBLIC MusicCommon : public MythScreenType
void next(void);
void seekforward(void);
void seekback(void);
void seek(int pos);
void seek(std::chrono::seconds pos);
void stopAll(void);
static void changeRating(bool increase);

Expand Down Expand Up @@ -106,7 +106,7 @@ class MPUBLIC MusicCommon : public MythScreenType

protected:
void init(bool startPlayback = true);
static QString getTimeString(int exTime, int maxTime);
static QString getTimeString(std::chrono::seconds exTime, std::chrono::seconds maxTime);
void updateProgressBar(void);
static void setTrackOnLCD(MusicMetadata *mdata);
static void editTrackInfo(MusicMetadata *mdata);
Expand Down Expand Up @@ -153,12 +153,12 @@ class MPUBLIC MusicCommon : public MythScreenType
bool m_controlVolume {true};

int m_currentTrack {0};
int m_currentTime {0};
int m_maxTime {0};
std::chrono::seconds m_currentTime {0s};
std::chrono::seconds m_maxTime {0s};

uint m_playlistTrackCount {0};
uint m_playlistPlayedTime {0};
uint m_playlistMaxTime {0};
std::chrono::seconds m_playlistPlayedTime {0s};
std::chrono::seconds m_playlistMaxTime {0s};

// for quick playlists
PlaylistOptions m_playlistOptions {PL_REPLACE, PL_CURRENT};
Expand Down
3 changes: 1 addition & 2 deletions mythplugins/mythmusic/mythmusic/musicdbcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -947,8 +947,7 @@ static bool doUpgradeMusicDatabaseSchema(QString &dbver)
"ALTER TABLE music_directories DEFAULT CHARACTER SET utf8;",
"ALTER TABLE music_genres DEFAULT CHARACTER SET utf8;",
"ALTER TABLE music_playlists DEFAULT CHARACTER SET utf8;",
"ALTER TABLE music_smartplaylist_categories"
" DEFAULT CHARACTER SET utf8;",
"ALTER TABLE music_smartplaylist_categories DEFAULT CHARACTER SET utf8;",
"ALTER TABLE music_smartplaylist_items DEFAULT CHARACTER SET utf8;",
"ALTER TABLE music_smartplaylists DEFAULT CHARACTER SET utf8;",
"ALTER TABLE music_songs DEFAULT CHARACTER SET utf8;",
Expand Down
37 changes: 19 additions & 18 deletions mythplugins/mythmusic/mythmusic/musicplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ void MusicPlayer::loadSettings(void)
m_resumeModeEditor = (ResumeMode) gCoreContext->GetNumSetting("ResumeModeEditor", MusicPlayer::RESUME_OFF);
m_resumeModeRadio = (ResumeMode) gCoreContext->GetNumSetting("ResumeModeRadio", MusicPlayer::RESUME_TRACK);

m_lastplayDelay = gCoreContext->GetNumSetting("MusicLastPlayDelay", LASTPLAY_DELAY);
m_lastplayDelay = gCoreContext->GetDurSetting<std::chrono::seconds>("MusicLastPlayDelay", LASTPLAY_DELAY);
m_autoShowPlayer = (gCoreContext->GetNumSetting("MusicAutoShowPlayer", 1) > 0);
}

Expand Down Expand Up @@ -878,8 +878,8 @@ void MusicPlayer::customEvent(QEvent *event)
{
// we update the lastplay and playcount after playing
// for m_lastplayDelay seconds or half the total track time
if ((getCurrentMetadata() && m_currentTime >
(getCurrentMetadata()->Length() / 1000) / 2) ||
if ((getCurrentMetadata() &&
m_currentTime > duration_cast<std::chrono::seconds>(getCurrentMetadata()->Length()) / 2) ||
m_currentTime >= m_lastplayDelay)
{
updateLastplay();
Expand All @@ -891,7 +891,7 @@ void MusicPlayer::customEvent(QEvent *event)
{
if (!m_playedList.isEmpty())
{
m_playedList.last()->setLength(m_currentTime * 1000);
m_playedList.last()->setLength(m_currentTime);
// this will update any track lengths displayed on screen
gPlayer->sendMetadataChangedEvent(m_playedList.last()->ID());
}
Expand All @@ -907,13 +907,14 @@ void MusicPlayer::customEvent(QEvent *event)
}
else
{
auto metadataSecs = duration_cast<std::chrono::seconds>(getCurrentMetadata()->Length());
if (m_playMode != PLAYMODE_RADIO && getCurrentMetadata() &&
m_currentTime != getCurrentMetadata()->Length() / 1000)
m_currentTime != metadataSecs)
{
LOG(VB_GENERAL, LOG_NOTICE, QString("MusicPlayer: Updating track length was %1s, should be %2s")
.arg(getCurrentMetadata()->Length() / 1000).arg(m_currentTime));
.arg(metadataSecs.count()).arg(m_currentTime.count()));

getCurrentMetadata()->setLength(m_currentTime * 1000);
getCurrentMetadata()->setLength(m_currentTime);
getCurrentMetadata()->dumpToDatabase();

// this will update any track lengths displayed on screen
Expand Down Expand Up @@ -1059,7 +1060,7 @@ void MusicPlayer::savePosition(void)
else
{
gCoreContext->SaveSetting("MusicBookmark", getCurrentMetadata()->ID());
gCoreContext->SaveSetting("MusicBookmarkPosition", m_currentTime);
gCoreContext->SaveDurSetting("MusicBookmarkPosition", m_currentTime);
}
}

Expand Down Expand Up @@ -1099,19 +1100,19 @@ void MusicPlayer::restorePosition(void)
play();

if (gPlayer->getResumeMode() == MusicPlayer::RESUME_EXACT && m_playMode != PLAYMODE_RADIO)
seek(gCoreContext->GetNumSetting("MusicBookmarkPosition", 0));
seek(gCoreContext->GetDurSetting<std::chrono::seconds>("MusicBookmarkPosition", 0s));
}
}

void MusicPlayer::seek(int pos)
void MusicPlayer::seek(std::chrono::seconds pos)
{
if (m_output)
{
Decoder *decoder = getDecoder();
if (decoder && decoder->isRunning())
decoder->seek(pos);
decoder->seek(pos.count());

m_output->SetTimecode(pos*1000);
m_output->SetTimecode(pos);
}
}

Expand Down Expand Up @@ -1537,8 +1538,8 @@ void MusicPlayer::decoderHandlerReady(void)
decoder->addListener(*it);
}

m_currentTime = 0;
m_lastTrackStart = 0;
m_currentTime = 0s;
m_lastTrackStart = 0s;

// NOLINTNEXTLINE(modernize-loop-convert)
for (auto it = m_visualisers.begin(); it != m_visualisers.end() ; ++it)
Expand All @@ -1556,10 +1557,10 @@ void MusicPlayer::decoderHandlerReady(void)
decoder->start();

if (!m_oneshotMetadata && getResumeMode() == RESUME_EXACT &&
gCoreContext->GetNumSetting("MusicBookmarkPosition", 0) > 0)
gCoreContext->GetDurSetting<std::chrono::seconds>("MusicBookmarkPosition", 0s) > 0s)
{
seek(gCoreContext->GetNumSetting("MusicBookmarkPosition", 0));
gCoreContext->SaveSetting("MusicBookmarkPosition", 0);
seek(gCoreContext->GetDurSetting<std::chrono::seconds>("MusicBookmarkPosition", 0s));
gCoreContext->SaveDurSetting("MusicBookmarkPosition", 0s);
}

m_isPlaying = true;
Expand Down Expand Up @@ -1635,7 +1636,7 @@ void MusicPlayer::sendNotification(int notificationID, const QString &title, con

n->SetId(notificationID);
n->SetParent(this);
n->SetDuration(5);
n->SetDuration(5s);
n->SetFullScreen(false);
GetNotificationCenter()->Queue(*n);
delete n;
Expand Down
12 changes: 6 additions & 6 deletions mythplugins/mythmusic/mythmusic/musicplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "decoderhandler.h"

// how long to wait before updating the lastplay and playcount fields
#define LASTPLAY_DELAY 15
static constexpr std::chrono::seconds LASTPLAY_DELAY { 15s };

class AudioOutput;
class MainVisual;
Expand Down Expand Up @@ -133,15 +133,15 @@ class MusicPlayer : public QObject, public MythObservable
bool setCurrentTrackPos(int pos);
void changeCurrentTrack(int trackNo);

int getCurrentTrackTime(void) const { return m_currentTime; }
std::chrono::seconds getCurrentTrackTime(void) const { return m_currentTime; }

void activePlaylistChanged(int trackID, bool deleted);
void playlistChanged(int playlistID);

void savePosition(void);
void restorePosition(void);
void setAllowRestorePos(bool allow) { m_allowRestorePos = allow; }
void seek(int pos);
void seek(std::chrono::seconds pos);

MusicMetadata *getCurrentMetadata(void);
MusicMetadata *getNextMetadata(void);
Expand Down Expand Up @@ -210,7 +210,7 @@ class MusicPlayer : public QObject, public MythObservable
void decoderHandlerReady(void);

int m_currentTrack {-1};
int m_currentTime {0};
std::chrono::seconds m_currentTime {0s};

MusicMetadata *m_oneshotMetadata {nullptr};

Expand All @@ -228,7 +228,7 @@ class MusicPlayer : public QObject, public MythObservable
bool m_updatedLastplay {false};
bool m_allowRestorePos {true};

int m_lastplayDelay {LASTPLAY_DELAY};
std::chrono::seconds m_lastplayDelay {LASTPLAY_DELAY};

ShuffleMode m_shuffleMode {SHUFFLE_OFF};
RepeatMode m_repeatMode {REPEAT_OFF};
Expand All @@ -244,7 +244,7 @@ class MusicPlayer : public QObject, public MythObservable

// radio stuff
QList<MusicMetadata*> m_playedList;
int m_lastTrackStart {0};
std::chrono::seconds m_lastTrackStart {0s};
int m_bufferAvailable {0};
int m_bufferSize {0};

Expand Down
19 changes: 10 additions & 9 deletions mythplugins/mythmusic/mythmusic/playlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,11 @@ void Playlist::describeYourself(void) const
LOG(VB_GENERAL, LOG_INFO, LOC + msg);
}

void Playlist::getStats(uint *trackCount, uint *totalLength, uint currenttrack, uint *playedLength) const
void Playlist::getStats(uint *trackCount, std::chrono::seconds *totalLength,
uint currenttrack, std::chrono::seconds *playedLength) const
{
uint64_t total = 0;
uint64_t played = 0;
std::chrono::milliseconds total = 0ms;
std::chrono::milliseconds played = 0ms;

*trackCount = m_shuffledSongs.size();

Expand All @@ -511,9 +512,9 @@ void Playlist::getStats(uint *trackCount, uint *totalLength, uint currenttrack,
}

if (playedLength)
*playedLength = played / 1000;
*playedLength = duration_cast<std::chrono::seconds>(played);

*totalLength = total / 1000;
*totalLength = duration_cast<std::chrono::seconds>(total);
}

void Playlist::loadPlaylist(const QString& a_name, const QString& a_host)
Expand Down Expand Up @@ -1012,7 +1013,7 @@ void Playlist::savePlaylist(const QString& a_name, const QString& a_host)

MSqlQuery query(MSqlQuery::InitCon());
uint songcount = 0;
uint playtime = 0;
std::chrono::seconds playtime = 0s;

getStats(&songcount, &playtime);

Expand Down Expand Up @@ -1048,7 +1049,7 @@ void Playlist::savePlaylist(const QString& a_name, const QString& a_host)
query.bindValue(":LIST", rawSonglist);
query.bindValue(":NAME", a_name);
query.bindValue(":SONGCOUNT", songcount);
query.bindValue(":PLAYTIME", qlonglong(playtime));
query.bindValue(":PLAYTIME", qlonglong(playtime.count()));
if (save_host)
query.bindValue(":HOSTNAME", a_host);

Expand Down Expand Up @@ -1382,7 +1383,7 @@ int Playlist::CreateCDMP3(void)
m_proc->Run();

while( m_procExitVal == GENERIC_EXIT_RUNNING )
usleep( 100000 );
usleep( 100ms );

uint retval = m_procExitVal;

Expand Down Expand Up @@ -1431,7 +1432,7 @@ int Playlist::CreateCDMP3(void)
m_proc->Run();

while( m_procExitVal == GENERIC_EXIT_RUNNING )
usleep( 100000 );
usleep( 100ms );

retval = m_procExitVal;

Expand Down
3 changes: 2 additions & 1 deletion mythplugins/mythmusic/mythmusic/playlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ class Playlist : public QObject
int getID(void) const { return m_playlistid; }
void setID(int x) { m_playlistid = x; }

void getStats(uint *trackCount, uint *totalLength, uint currentTrack = 0, uint *playedLength = nullptr) const;
void getStats(uint *trackCount, std::chrono::seconds *totalLength,
uint currentTrack = 0, std::chrono::seconds *playedLength = nullptr) const;

void resync(void);

Expand Down
3 changes: 1 addition & 2 deletions mythplugins/mythmusic/mythmusic/playlistcontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
#include "playlist.h"
#include "playlistcontainer.h"


void PlaylistLoadingThread::run()
{
RunProlog();
while (!m_allMusic->doneLoading())
{
msleep(250);
usleep(250ms);
}
m_parent->load();
RunEpilog();
Expand Down
31 changes: 27 additions & 4 deletions mythplugins/mythmusic/mythmusic/pls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,37 @@ int PlayListFile::parse(PlayListFile *pls, const QString &filename)

int PlayListFile::parsePLS(PlayListFile *pls, const QString &filename)
{
LOG(VB_FILE, LOG_DEBUG, QString("DecoderHandler: parsePLS - '%1'").arg(filename));

QSettings settings(filename, QSettings::IniFormat);
settings.beginGroup("playlist");

int num_entries = settings.value("numberofentries", -1).toInt();
// we allow both 'playlist' and 'Playlist' for the group name
QStringList groups = settings.childGroups();

if (groups.contains("playlist"))
settings.beginGroup("playlist");
else if (groups.contains("Playlist"))
settings.beginGroup("Playlist");
else
{
LOG(VB_GENERAL, LOG_ERR, QString("DecoderHandler: parsePLS - playlist group not found"));
return 0;
}

int num_entries = -1;

// Some pls files have "numberofentries", some have "NumberOfEntries".
QStringList keys = settings.childKeys();

// Some pls files have "numberofentries", some has "NumberOfEntries".
if (num_entries == -1)
if (keys.contains("numberofentries"))
num_entries = settings.value("numberofentries", -1).toInt();
else if (keys.contains("NumberOfEntries"))
num_entries = settings.value("NumberOfEntries", -1).toInt();
else
{
LOG(VB_GENERAL, LOG_ERR, QString("DecoderHandler: parsePLS - NumberOfEntries key not found"));
return 0;
}

for (int n = 1; n <= num_entries; n++)
{
Expand Down
3 changes: 0 additions & 3 deletions mythplugins/mythmusic/mythmusic/streamview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

// qt
#include <QKeyEvent>
#include <QRegExp>
#include <QThread>
#include <QDomDocument>

Expand All @@ -31,8 +30,6 @@
#include "musicplayer.h"
#include "streamview.h"

using namespace std::chrono_literals;

StreamView::StreamView(MythScreenStack *parent, MythScreenType *parentScreen)
: MusicCommon(parent, parentScreen, "streamview")
{
Expand Down
10 changes: 5 additions & 5 deletions mythplugins/mythmusic/mythmusic/visualize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ void Piano::zero_analysis(void)

m_pianoData[key].samples_processed = 0;
}
m_offsetProcessed = 0;
m_offsetProcessed = 0ms;
}

void Piano::resize(const QSize &newsize)
Expand Down Expand Up @@ -1096,16 +1096,16 @@ bool Piano::process_all_types(VisualNode *node, bool /*this_will_be_displayed*/)
piano_audio short_to_bounded = 32768.0F;

// Detect start of new song (current node more than 10s earlier than already seen)
if (node->m_offset + 10000 < m_offsetProcessed)
if (node->m_offset + 10s < m_offsetProcessed)
{
LOG(VB_GENERAL, LOG_DEBUG, QString("Piano : Node offset=%1 too far backwards : NEW SONG").arg(node->m_offset));
LOG(VB_GENERAL, LOG_DEBUG, QString("Piano : Node offset=%1 too far backwards : NEW SONG").arg(node->m_offset.count()));
zero_analysis();
}

// Check whether we've seen this node (more recently than 10secs ago)
if (node->m_offset <= m_offsetProcessed)
{
LOG(VB_GENERAL, LOG_DEBUG, QString("Piano : Already seen node offset=%1, returning without processing").arg(node->m_offset));
LOG(VB_GENERAL, LOG_DEBUG, QString("Piano : Already seen node offset=%1, returning without processing").arg(node->m_offset.count()));
return allZero; // Nothing to see here - the server can stop if it wants to
}

Expand Down Expand Up @@ -1481,7 +1481,7 @@ bool AlbumArt::draw(QPainter *p, const QColor &back)

if (imageFilename.startsWith("myth://"))
{
auto *rf = new RemoteFile(imageFilename, false, false, 0);
auto *rf = new RemoteFile(imageFilename, false, false, 0ms);

QByteArray data;
bool ret = rf->SaveAs(data);
Expand Down
8 changes: 4 additions & 4 deletions mythplugins/mythmusic/mythmusic/visualize.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class MainVisual;
class VisualNode
{
public:
VisualNode(short *l, short *r, unsigned long n, unsigned long o)
: m_left(l), m_right(r), m_length(n), m_offset(o)
VisualNode(short *l, short *r, unsigned long n, std::chrono::milliseconds timecode)
: m_left(l), m_right(r), m_length(n), m_offset(timecode)
{
// left and right are allocated and then passed to this class
// the code that allocated left and right should give up all ownership
Expand All @@ -66,7 +66,7 @@ class VisualNode
short *m_left {nullptr};
short *m_right {nullptr};
unsigned long m_length;
unsigned long m_offset;
std::chrono::milliseconds m_offset;
};

class VisualBase
Expand Down Expand Up @@ -287,7 +287,7 @@ struct piano_key_data {
std::vector<QRect> m_rects {};
QSize m_size;

unsigned long m_offsetProcessed {0};
std::chrono::milliseconds m_offsetProcessed {0ms};

piano_key_data *m_pianoData {nullptr};
piano_audio *m_audioData {nullptr};
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/mythmusic/visualizerview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void VisualizerView::showTrackInfoPopup(void)
//---------------------------------------------------------
// TrackInfoPopup
//---------------------------------------------------------
#define MUSICINFOPOPUPTIME (8 * 1000)
static constexpr std::chrono::seconds MUSICINFOPOPUPTIME { 8s };

TrackInfoPopup::~TrackInfoPopup(void)
{
Expand Down
154 changes: 80 additions & 74 deletions mythplugins/mythnetvision/i18n/mythnetvision_it.ts

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion mythplugins/mythnetvision/mythnetvision/netbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ void NetBase::StreamWebVideo()
return;
}

auto seconds = std::chrono::seconds(item->GetTime().toInt());
GetMythMainWindow()->HandleMedia("Internal", item->GetMediaURL(),
item->GetDescription(), item->GetTitle(), item->GetSubtitle(),
QString(), item->GetSeason(), item->GetEpisode(), QString(),
item->GetTime().toInt() / 60, item->GetDate().toString("yyyy"));
duration_cast<std::chrono::minutes>(seconds), item->GetDate().toString("yyyy"));
}

void NetBase::ShowWebVideo()
Expand Down
72 changes: 37 additions & 35 deletions mythplugins/mythnews/i18n/mythnews_it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ Al termine della modifica, per continuare seleziona &quot;Ok&quot; o &quot;Annul
<message>
<location filename="themestrings.h" line="35"/>
<source>News Settings</source>
<translation>Impostazioni news</translation>
<translation type="unfinished">Impostaz. notizie</translation>
</message>
<message>
<location filename="themestrings.h" line="5"/>
Expand All @@ -264,7 +264,7 @@ Al termine della modifica, per continuare seleziona &quot;Ok&quot; o &quot;Annul
<message>
<location filename="themestrings.h" line="16"/>
<source>Choose the news sites you would like to read.</source>
<translation>Sceglie il sito di news che desideri leggere.</translation>
<translation type="unfinished">Scegli il sito di notizie che desideri leggere.</translation>
</message>
<message>
<location filename="themestrings.h" line="31"/>
Expand All @@ -284,7 +284,7 @@ Al termine della modifica, per continuare seleziona &quot;Ok&quot; o &quot;Annul
<message>
<location filename="themestrings.h" line="32"/>
<source>News Config</source>
<translation>Configurazione News</translation>
<translation type="unfinished">Config. notizie</translation>
</message>
<message>
<location filename="themestrings.h" line="8"/>
Expand All @@ -296,7 +296,9 @@ Al termine della modifica, per continuare seleziona &quot;Ok&quot; o &quot;Annul
<source>%&quot;|SUBTITLE|&quot;

%%DESCRIPTION%</source>
<translation type="unfinished"></translation>
<translation type="unfinished">%&quot;|SUBTITLE|&quot;

%%DESCRIPTION%</translation>
</message>
<message>
<location filename="themestrings.h" line="9"/>
Expand All @@ -306,7 +308,7 @@ Al termine della modifica, per continuare seleziona &quot;Ok&quot; o &quot;Annul
<message>
<location filename="themestrings.h" line="12"/>
<source>Categories</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Categorie</translation>
</message>
<message>
<location filename="themestrings.h" line="13"/>
Expand All @@ -316,137 +318,137 @@ Al termine della modifica, per continuare seleziona &quot;Ok&quot; o &quot;Annul
<message>
<location filename="themestrings.h" line="15"/>
<source>Choose sites you want to receive news from</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Scegli il sito dal quale vuoi ricevere le notizie</translation>
</message>
<message>
<location filename="themestrings.h" line="17"/>
<source>Choose which news channels interest you</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Scegli quali canali di notizie ti interessano</translation>
</message>
<message>
<location filename="themestrings.h" line="19"/>
<source>Date:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Data:</translation>
</message>
<message>
<location filename="themestrings.h" line="23"/>
<source>Enclosures:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Ambiti:</translation>
</message>
<message>
<location filename="themestrings.h" line="26"/>
<source>Is Podcast:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Is Podcast:</translation>
</message>
<message>
<location filename="themestrings.h" line="27"/>
<source>NEWS</source>
<translation type="unfinished"></translation>
<translation type="unfinished">NOTIZIE</translation>
</message>
<message>
<location filename="themestrings.h" line="28"/>
<source>Name site:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Nome sito:</translation>
</message>
<message>
<location filename="themestrings.h" line="30"/>
<source>Needs Download:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Richiede download:</translation>
</message>
<message>
<location filename="themestrings.h" line="34"/>
<source>News Feeds Settings</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Impostazioni feed notizie</translation>
</message>
<message>
<location filename="themestrings.h" line="37"/>
<source>News catagories</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Categorie notizie</translation>
</message>
<message>
<location filename="themestrings.h" line="38"/>
<source>News settings</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Impostaz. notizie</translation>
</message>
<message>
<location filename="themestrings.h" line="39"/>
<source>No</source>
<translation type="unfinished"></translation>
<translation type="unfinished">No</translation>
</message>
<message>
<location filename="themestrings.h" line="40"/>
<source>No news sites available, please configure your subscriptions using the configuration menu</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Nessun sito di notizie disponibile, configura i tuoi abbonamenti utilizzando il menu di configurazione</translation>
</message>
<message>
<location filename="themestrings.h" line="41"/>
<source>Not Applicable</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Non applicabile</translation>
</message>
<message>
<location filename="themestrings.h" line="45"/>
<source>RSS Editor</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Editor RSS</translation>
</message>
<message>
<location filename="themestrings.h" line="46"/>
<source>RSS Icon:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Icona RSS:</translation>
</message>
<message>
<location filename="themestrings.h" line="47"/>
<source>RSS Newsfeeds</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Newsfeed RSS</translation>
</message>
<message>
<location filename="themestrings.h" line="48"/>
<source>RSS URL:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">URL RSS:</translation>
</message>
<message>
<location filename="themestrings.h" line="49"/>
<source>RSS feed is podcast:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Podcast è il feed RSS:</translation>
</message>
<message>
<location filename="themestrings.h" line="50"/>
<source>RSS feed name:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Nome feed RSS:</translation>
</message>
<message>
<location filename="themestrings.h" line="51"/>
<source>Rating</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Valutazione</translation>
</message>
<message>
<location filename="themestrings.h" line="52"/>
<source>Save</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Salva</translation>
</message>
<message>
<location filename="themestrings.h" line="53"/>
<source>Select a feed to views</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Seleziona il feed da vedere</translation>
</message>
<message>
<location filename="themestrings.h" line="54"/>
<source>Site icon:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Icona sito:</translation>
</message>
<message>
<location filename="themestrings.h" line="55"/>
<source>Subscribe to News Feeds</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Iscriviti ai feed notizie</translation>
</message>
<message>
<location filename="themestrings.h" line="56"/>
<source>Title:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Titolo:</translation>
</message>
<message>
<location filename="themestrings.h" line="57"/>
<source>URL site:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">URL sito:</translation>
</message>
<message>
<location filename="themestrings.h" line="59"/>
Expand All @@ -456,7 +458,7 @@ Al termine della modifica, per continuare seleziona &quot;Ok&quot; o &quot;Annul
<message>
<location filename="themestrings.h" line="60"/>
<source>Update</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Aggiorna</translation>
</message>
<message>
<location filename="themestrings.h" line="64"/>
Expand All @@ -471,7 +473,7 @@ Al termine della modifica, per continuare seleziona &quot;Ok&quot; o &quot;Annul
<message>
<location filename="themestrings.h" line="21"/>
<source>Edit RSS News Feed</source>
<translation>Modifica feed RSS</translation>
<translation type="unfinished">Modifica feed RSS notizie</translation>
</message>
<message>
<location filename="themestrings.h" line="43"/>
Expand Down Expand Up @@ -503,7 +505,7 @@ Al termine della modifica, per continuare seleziona &quot;Ok&quot; o &quot;Annul
<message>
<location filename="themestrings.h" line="33"/>
<source>News Feeds</source>
<translation>News Feeds</translation>
<translation type="unfinished">Feed notizie</translation>
</message>
</context>
</TS>
2 changes: 1 addition & 1 deletion mythplugins/mythnews/mythnews/mythnews.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
MythNews::MythNews(MythScreenStack *parent, const QString &name) :
MythScreenType(parent, name),
m_retrieveTimer(new QTimer(this)),
m_updateFreq(gCoreContext->GetNumSetting("NewsUpdateFrequency", 30)),
m_updateFreq(gCoreContext->GetDurSetting<std::chrono::minutes>("NewsUpdateFrequency", 30min)),
m_zoom(gCoreContext->GetSetting("WebBrowserZoomLevel", "1.0")),
m_browser(gCoreContext->GetSetting("WebBrowserCommand", ""))
{
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythnews/mythnews/mythnews.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class MythNews : public MythScreenType
NewsSite::List m_newsSites;

QTimer *m_retrieveTimer {nullptr};
int m_timerTimeout {10*60*1000};
unsigned int m_updateFreq {30};
std::chrono::minutes m_timerTimeout {10min};
std::chrono::minutes m_updateFreq {30min};

QString m_zoom {"1.0"};
QString m_browser;
Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythnews/mythnews/newssite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ QDateTime NewsSite::lastUpdated(void) const
return m_updated;
}

unsigned int NewsSite::timeSinceLastUpdate(void) const
std::chrono::minutes NewsSite::timeSinceLastUpdate(void) const
{
QMutexLocker locker(&m_lock);

QDateTime curTime(MythDate::current());
unsigned int min = m_updated.secsTo(curTime)/60;
return min;
auto secs = std::chrono::seconds(m_updated.secsTo(curTime));
return duration_cast<std::chrono::minutes>(secs);
}

void NewsSite::customEvent(QEvent *event)
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythnews/mythnews/newssite.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class NewsSite : public QObject
QDateTime lastUpdated(void) const;
QString imageURL(void) const;
bool podcast(void) const;
unsigned int timeSinceLastUpdate(void) const; // in minutes
std::chrono::minutes timeSinceLastUpdate(void) const;

void insertNewsArticle(const NewsArticle &item);
void clearNewsArticles(void);
Expand Down
90 changes: 45 additions & 45 deletions mythplugins/mythweather/i18n/mythweather_it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -965,17 +965,17 @@
<message>
<location filename="themestrings.h" line="41"/>
<source>Low: %1</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Min: %1</translation>
</message>
<message>
<location filename="themestrings.h" line="42"/>
<source>N/A</source>
<translation type="unfinished"></translation>
<translation type="unfinished">N/D</translation>
</message>
<message>
<location filename="themestrings.h" line="45"/>
<source>Precip: %1</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Precip: %1</translation>
</message>
<message>
<location filename="themestrings.h" line="46"/>
Expand All @@ -985,42 +985,42 @@
<message>
<location filename="themestrings.h" line="48"/>
<source>Pressure: %1</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Pressione: %1</translation>
</message>
<message>
<location filename="themestrings.h" line="49"/>
<source>Results</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Risultati</translation>
</message>
<message>
<location filename="themestrings.h" line="53"/>
<source>Save</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Salva</translation>
</message>
<message>
<location filename="themestrings.h" line="56"/>
<source>Screen setup</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Imposta schermo</translation>
</message>
<message>
<location filename="themestrings.h" line="58"/>
<source>Search locations for your weather forecast</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Cerca località per le previsioni meteo</translation>
</message>
<message>
<location filename="themestrings.h" line="61"/>
<source>Settings</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Impostazioni</translation>
</message>
<message>
<location filename="themestrings.h" line="62"/>
<source>Setup sources for your weather forecast</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Imposta sorgenti previsioni meteo</translation>
</message>
<message>
<location filename="themestrings.h" line="67"/>
<source>Source setup</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Imposta sorgente</translation>
</message>
<message>
<location filename="themestrings.h" line="68"/>
Expand All @@ -1030,7 +1030,7 @@
<message>
<location filename="themestrings.h" line="70"/>
<source>Temp: %1</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Temp: %1</translation>
</message>
<message>
<location filename="themestrings.h" line="75"/>
Expand All @@ -1040,57 +1040,57 @@
<message>
<location filename="themestrings.h" line="77"/>
<source>Visibility: %1</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Visibilità: %1</translation>
</message>
<message>
<location filename="themestrings.h" line="78"/>
<source>Visibilty</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Visibilità</translation>
</message>
<message>
<location filename="themestrings.h" line="79"/>
<source>WEATHER</source>
<translation type="unfinished"></translation>
<translation type="unfinished">METEO</translation>
</message>
<message>
<location filename="themestrings.h" line="80"/>
<source>Weather</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Meteo</translation>
</message>
<message>
<location filename="themestrings.h" line="82"/>
<source>Weather Global Settings</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Impostazioni globali meteo</translation>
</message>
<message>
<location filename="themestrings.h" line="84"/>
<source>Weather Report</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Bollettino meteo</translation>
</message>
<message>
<location filename="themestrings.h" line="89"/>
<source>Weather Source Settings</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Impostazioni sorgente meteo</translation>
</message>
<message>
<location filename="themestrings.h" line="91"/>
<source>Weather forecasts to</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Previsioni meteo a</translation>
</message>
<message>
<location filename="themestrings.h" line="92"/>
<source>Weather forecasts to display on screen</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Previsioni meteo da visualizzare sullo schermo</translation>
</message>
<message>
<location filename="themestrings.h" line="97"/>
<source>Wind Direction: %1</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Direzione del vento: %1</translation>
</message>
<message>
<location filename="themestrings.h" line="98"/>
<source>Wind(Dir)</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Vento (dir)</translation>
</message>
<message>
<location filename="themestrings.h" line="99"/>
Expand All @@ -1100,22 +1100,22 @@
<message>
<location filename="themestrings.h" line="100"/>
<source>Wind(Gust):</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Vento (raffiche):</translation>
</message>
<message>
<location filename="themestrings.h" line="101"/>
<source>Wind(Gust): %1</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Vento (raffiche): %1</translation>
</message>
<message>
<location filename="themestrings.h" line="102"/>
<source>dddd, MMMM dd, yyyy | hh:mm AP</source>
<translation type="unfinished"></translation>
<translation type="unfinished">gggg, MMMM gg, aaaa | hh:mm AP</translation>
</message>
<message>
<location filename="themestrings.h" line="103"/>
<source>updating</source>
<translation type="unfinished"></translation>
<translation type="unfinished">aggiorno</translation>
</message>
<message>
<location filename="themestrings.h" line="95"/>
Expand All @@ -1125,27 +1125,27 @@
<message>
<location filename="themestrings.h" line="13"/>
<source>Configure your global weather settings</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Configura le impostazioni meteo globali</translation>
</message>
<message>
<location filename="themestrings.h" line="14"/>
<source>Configure your weather</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Configura meteo</translation>
</message>
<message>
<location filename="themestrings.h" line="16"/>
<source>Display</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Display</translation>
</message>
<message>
<location filename="themestrings.h" line="19"/>
<source>Enter location:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Inserisci Località:</translation>
</message>
<message>
<location filename="themestrings.h" line="21"/>
<source>Enter your current location, nearest large town or city. In some countries postal codes are also supported. Hit the right or down arrow to continue.</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Immetti la località attuale, o una grande città vicina. In alcune nazioni sono supportati i codici postali.</translation>
</message>
<message>
<location filename="themestrings.h" line="22"/>
Expand All @@ -1155,17 +1155,17 @@
<message>
<location filename="themestrings.h" line="24"/>
<source>Feels Like: %1</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Percepito: %1</translation>
</message>
<message>
<location filename="themestrings.h" line="26"/>
<source>General Mythweather options</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Opzioni generali Mythweather</translation>
</message>
<message>
<location filename="themestrings.h" line="27"/>
<source>General weather</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Meteo globale</translation>
</message>
<message>
<location filename="themestrings.h" line="31"/>
Expand All @@ -1176,12 +1176,12 @@
<message>
<location filename="themestrings.h" line="33"/>
<source>High: %1</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Max: %1</translation>
</message>
<message>
<location filename="themestrings.h" line="36"/>
<source>Humidity: %1</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Umidità: %1</translation>
</message>
<message>
<location filename="themestrings.h" line="39"/>
Expand Down Expand Up @@ -1278,7 +1278,7 @@ Al termine della configurazione del plugin meteo, fai clic &quot;Finito&quot; pe
<message>
<location filename="themestrings.h" line="88"/>
<source>Weather Setup</source>
<translation>Impostazioni meteo</translation>
<translation type="unfinished">Imposta meteo</translation>
</message>
<message>
<location filename="themestrings.h" line="9"/>
Expand All @@ -1293,7 +1293,7 @@ Al termine della configurazione del plugin meteo, fai clic &quot;Finito&quot; pe
<message>
<location filename="themestrings.h" line="87"/>
<source>Weather Script Settings</source>
<translation>Impostazioni script meteo</translation>
<translation type="unfinished">Imposta script meteo</translation>
</message>
<message>
<location filename="themestrings.h" line="74"/>
Expand Down Expand Up @@ -1332,12 +1332,12 @@ Al termine delle modifiche, fai clic su &quot;Finito&quot; per continuare.</tran
<message>
<location filename="themestrings.h" line="86"/>
<source>Weather Screen Setup</source>
<translation>Impostazioni schermo meteo</translation>
<translation type="unfinished">Imposta schermo meteo</translation>
</message>
<message>
<location filename="themestrings.h" line="90"/>
<source>Weather Source Setup</source>
<translation>Impostazioni sorgente meteo</translation>
<translation type="unfinished">Imposta sorgente meteo</translation>
</message>
<message>
<location filename="themestrings.h" line="63"/>
Expand Down Expand Up @@ -1392,7 +1392,7 @@ Al termine delle modifiche, fai clic su &quot;Finito&quot; per continuare.</tran
<message>
<location filename="themestrings.h" line="30"/>
<source>Global Weather Settings</source>
<translation>Impostazioni meteo globali</translation>
<translation type="unfinished">Impostazioni globali meteo</translation>
</message>
<message>
<location filename="themestrings.h" line="59"/>
Expand All @@ -1407,7 +1407,7 @@ Al termine delle modifiche, fai clic su &quot;Finito&quot; per continuare.</tran
<message>
<location filename="themestrings.h" line="28"/>
<source>General weather options</source>
<translation>Opzioni meteo generali</translation>
<translation type="unfinished">Opzioni generali meteo</translation>
</message>
<message>
<location filename="themestrings.h" line="54"/>
Expand Down Expand Up @@ -1447,7 +1447,7 @@ Al termine delle modifiche, fai clic su &quot;Finito&quot; per continuare.</tran
<message>
<location filename="themestrings.h" line="55"/>
<source>Screen Setup</source>
<translation>Impostazioni schermo</translation>
<translation type="unfinished">Imposta schermo</translation>
</message>
<message>
<location filename="themestrings.h" line="38"/>
Expand All @@ -1457,7 +1457,7 @@ Al termine delle modifiche, fai clic su &quot;Finito&quot; per continuare.</tran
<message>
<location filename="themestrings.h" line="20"/>
<source>Enter your current location, nearest large town or city. In some countries postal codes are also supported.</source>
<translation>Immetti la località corrente, o una grande città vicina. In alcune nazioni i codici postali sono supportati.</translation>
<translation type="unfinished">Immetti la località attuale, o una grande città vicina. In alcune nazioni sono supportati i codici postali.</translation>
</message>
<message>
<location filename="themestrings.h" line="18"/>
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythweather/mythweather/sourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ bool SourceManager::findScriptsDB()
auto *si = new ScriptInfo;
si->id = db.value(0).toInt();
si->name = db.value(1).toString();
si->updateTimeout = db.value(2).toUInt() * 1000;
si->scriptTimeout = db.value(3).toUInt();
si->updateTimeout = std::chrono::seconds(db.value(2).toUInt());
si->scriptTimeout = std::chrono::seconds(db.value(3).toUInt());
si->path = fi.absolutePath();
si->program = fi.absoluteFilePath();
si->author = db.value(5).toString();
Expand Down
12 changes: 6 additions & 6 deletions mythplugins/mythweather/mythweather/weather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Weather::Weather(MythScreenStack *parent, const QString &name, SourceManager *srcMan)
: MythScreenType(parent, name),
m_weatherStack(new MythScreenStack(GetMythMainWindow(), "weather stack")),
m_nextpageInterval(gCoreContext->GetNumSetting("weatherTimeout", 10)),
m_nextpageInterval(gCoreContext->GetDurSetting<std::chrono::seconds>("weatherTimeout", 10s)),
m_nextPageTimer(new QTimer(this))
{
if (!srcMan)
Expand Down Expand Up @@ -214,7 +214,7 @@ void Weather::screenReady(WeatherScreen *ws)
{
m_firstRun = false;
showScreen(ws);
m_nextPageTimer->start(1000 * m_nextpageInterval);
m_nextPageTimer->start(m_nextpageInterval);
}
disconnect(ws, &WeatherScreen::screenReady, this, &Weather::screenReady);
}
Expand Down Expand Up @@ -301,7 +301,7 @@ void Weather::hideScreen()
void Weather::holdPage()
{
if (!m_nextPageTimer->isActive())
m_nextPageTimer->start(1000 * m_nextpageInterval);
m_nextPageTimer->start(m_nextpageInterval);
else
m_nextPageTimer->stop();

Expand Down Expand Up @@ -350,7 +350,7 @@ void Weather::cursorRight()
hideScreen();
showScreen(ws);
if (!m_paused)
m_nextPageTimer->start(1000 * m_nextpageInterval);
m_nextPageTimer->start(m_nextpageInterval);
}
}

Expand All @@ -362,7 +362,7 @@ void Weather::cursorLeft()
hideScreen();
showScreen(ws);
if (!m_paused)
m_nextPageTimer->start(1000 * m_nextpageInterval);
m_nextPageTimer->start(m_nextpageInterval);
}
}

Expand All @@ -378,7 +378,7 @@ void Weather::nextpage_timeout()
else
LOG(VB_GENERAL, LOG_ERR, "Next screen not ready");

m_nextPageTimer->start(1000 * m_nextpageInterval);
m_nextPageTimer->start(m_nextpageInterval);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythweather/mythweather/weather.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Weather : public MythScreenType
MythScreenStack *m_weatherStack {nullptr};

bool m_firstRun {true};
int m_nextpageInterval {10};
std::chrono::seconds m_nextpageInterval {10s};

QTimer *m_nextPageTimer {nullptr};

Expand Down
20 changes: 10 additions & 10 deletions mythplugins/mythweather/mythweather/weatherSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,8 @@ bool SourceSetup::loadData()
auto *si = new SourceListInfo;
si->id = db.value(0).toUInt();
si->name = db.value(1).toString();
si->update_timeout = db.value(2).toUInt() / 60;
si->retrieve_timeout = db.value(3).toUInt();
si->update_timeout = std::chrono::minutes(db.value(2).toUInt() / 60);
si->retrieve_timeout = std::chrono::seconds(db.value(3).toUInt());
si->author = db.value(4).toString();
si->email = db.value(5).toString();
si->version = db.value(6).toString();
Expand All @@ -783,8 +783,8 @@ void SourceSetup::saveData()
if (curritem)
{
auto *si = curritem->GetData().value<SourceListInfo *>();
si->update_timeout = m_updateSpinbox->GetIntValue();
si->retrieve_timeout = m_retrieveSpinbox->GetIntValue();
si->update_timeout = m_updateSpinbox->GetDuration<std::chrono::minutes>();
si->retrieve_timeout = m_retrieveSpinbox->GetDuration<std::chrono::seconds>();
}

MSqlQuery db(MSqlQuery::InitCon());
Expand All @@ -798,8 +798,8 @@ void SourceSetup::saveData()
MythUIButtonListItem *item = m_sourceList->GetItemAt(i);
auto *si = item->GetData().value<SourceListInfo *>();
db.bindValue(":ID", si->id);
db.bindValue(":UPDATE", si->update_timeout * 60);
db.bindValue(":RETRIEVE", si->retrieve_timeout);
db.bindValue(":UPDATE", (int)duration_cast<std::chrono::seconds>(si->update_timeout).count());
db.bindValue(":RETRIEVE", (int)si->retrieve_timeout.count());
if (!db.exec())
{
LOG(VB_GENERAL, LOG_ERR, db.lastError().text());
Expand All @@ -815,7 +815,7 @@ void SourceSetup::updateSpinboxUpdate()
if (m_sourceList->GetItemCurrent())
{
auto *si = m_sourceList->GetItemCurrent()->GetData().value<SourceListInfo *>();
si->update_timeout = m_updateSpinbox->GetIntValue();
si->update_timeout = m_updateSpinbox->GetDuration<std::chrono::minutes>();
}
}

Expand All @@ -824,7 +824,7 @@ void SourceSetup::retrieveSpinboxUpdate()
if (m_sourceList->GetItemCurrent())
{
auto *si = m_sourceList->GetItemCurrent()->GetData().value<SourceListInfo *>();
si->retrieve_timeout = m_retrieveSpinbox->GetIntValue();
si->retrieve_timeout = m_retrieveSpinbox->GetDuration<std::chrono::seconds>();
}
}

Expand All @@ -840,8 +840,8 @@ void SourceSetup::sourceListItemSelected(MythUIButtonListItem *item)
if (!si)
return;

m_updateSpinbox->SetValue(si->update_timeout);
m_retrieveSpinbox->SetValue(si->retrieve_timeout);
m_updateSpinbox->SetDuration<std::chrono::minutes>(si->update_timeout);
m_retrieveSpinbox->SetDuration<std::chrono::seconds>(si->retrieve_timeout);
QString txt = tr("Author: ");
txt += si->author;
txt += "\n" + tr("Email: ") + si->email;
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythweather/mythweather/weatherSetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ struct SourceListInfo
QString author;
QString email;
QString version;
uint update_timeout {DEFAULT_UPDATE_TIMEOUT};
uint retrieve_timeout {};
std::chrono::minutes update_timeout {DEFAULT_UPDATE_TIMEOUT};
std::chrono::seconds retrieve_timeout {0s};
uint id {};
};

Expand Down
18 changes: 9 additions & 9 deletions mythplugins/mythweather/mythweather/weatherSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ QStringList WeatherSource::ProbeTypes(const QString& workingDirectory,

bool WeatherSource::ProbeTimeouts(const QString& workingDirectory,
const QString& program,
uint &updateTimeout,
uint &scriptTimeout)
std::chrono::seconds &updateTimeout,
std::chrono::seconds &scriptTimeout)
{
QStringList arguments("-T");
const QString loc = QString("WeatherSource::ProbeTimeouts(%1 %2): ")
Expand Down Expand Up @@ -120,8 +120,8 @@ bool WeatherSource::ProbeTimeouts(const QString& workingDirectory,
return false;
}

updateTimeout = ut * 1000;
scriptTimeout = st;
updateTimeout = std::chrono::seconds(ut);
scriptTimeout = std::chrono::seconds(st);

return true;
}
Expand Down Expand Up @@ -224,8 +224,8 @@ ScriptInfo *WeatherSource::ProbeScript(const QFileInfo &fi)
if (db.next())
{
info.id = db.value(0).toInt();
info.updateTimeout = db.value(2).toUInt() * 1000;
info.scriptTimeout = db.value(3).toUInt();
info.updateTimeout = std::chrono::seconds(db.value(2).toUInt());
info.scriptTimeout = std::chrono::seconds(db.value(3).toUInt());

// compare versions, if equal... be happy
QString dbver = db.value(6).toString();
Expand Down Expand Up @@ -280,8 +280,8 @@ ScriptInfo *WeatherSource::ProbeScript(const QFileInfo &fi)
db.prepare(query);
db.bindValue(":NAME", info.name);
db.bindValue(":HOST", gCoreContext->GetHostName());
db.bindValue(":UPDATETO", QString::number(info.updateTimeout/1000));
db.bindValue(":RETTO", QString::number(info.scriptTimeout));
db.bindValue(":UPDATETO", QString::number(info.updateTimeout.count()));
db.bindValue(":RETTO", QString::number(info.scriptTimeout.count()));
db.bindValue(":PATH", info.program);
db.bindValue(":AUTHOR", info.author);
db.bindValue(":VERSION", info.version);
Expand Down Expand Up @@ -347,7 +347,7 @@ WeatherSource::~WeatherSource()
if (m_ms)
{
m_ms->Signal(kSignalKill);
m_ms->Wait(5);
m_ms->Wait(5s);
delete m_ms;
}
delete m_updateTimer;
Expand Down
16 changes: 8 additions & 8 deletions mythplugins/mythweather/mythweather/weatherSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class ScriptInfo
QStringList types;
QString program;
QString path;
unsigned int scriptTimeout {DEFAULT_SCRIPT_TIMEOUT};
unsigned int updateTimeout {DEFAULT_UPDATE_TIMEOUT};
std::chrono::seconds scriptTimeout {DEFAULT_SCRIPT_TIMEOUT};
std::chrono::seconds updateTimeout {DEFAULT_UPDATE_TIMEOUT};
int id {0};
};

Expand All @@ -40,8 +40,8 @@ class WeatherSource : public QObject
const QString& program);
static bool ProbeTimeouts(const QString& workingDirectory,
const QString& program,
uint &updateTimeout,
uint &scriptTimeout);
std::chrono::seconds &updateTimeout,
std::chrono::seconds &scriptTimeout);
static bool ProbeInfo(ScriptInfo &scriptInfo);

explicit WeatherSource(ScriptInfo *info);
Expand All @@ -60,11 +60,11 @@ class WeatherSource : public QObject

void startUpdate(bool forceUpdate = false);

int getScriptTimeout() { return m_info->scriptTimeout; }
void setScriptTimeout(int timeout) { m_info->scriptTimeout = timeout; }
std::chrono::seconds getScriptTimeout() { return m_info->scriptTimeout; }
void setScriptTimeout(std::chrono::seconds timeout) { m_info->scriptTimeout = timeout; }

int getUpdateTimeout() { return m_info->updateTimeout; }
void setUpdateTimeout(int timeout) { m_info->updateTimeout = timeout; }
std::chrono::seconds getUpdateTimeout() { return m_info->updateTimeout; }
void setUpdateTimeout(std::chrono::seconds timeout) { m_info->updateTimeout = timeout; }

void startUpdateTimer() { m_updateTimer->start(m_info->updateTimeout); }
void stopUpdateTimer() { m_updateTimer->stop(); }
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythweather/mythweather/weatherUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

#define SI_UNITS 0
#define ENG_UNITS 1
#define DEFAULT_UPDATE_TIMEOUT (5*60*1000)
#define DEFAULT_SCRIPT_TIMEOUT (60)
static constexpr std::chrono::minutes DEFAULT_UPDATE_TIMEOUT { 5min };
static constexpr std::chrono::seconds DEFAULT_SCRIPT_TIMEOUT { 60s };

class ScriptInfo;

Expand Down
89 changes: 45 additions & 44 deletions mythplugins/mythzoneminder/i18n/mythzoneminder_it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,52 +74,52 @@
<message>
<location filename="themestrings.h" line="66"/>
<source>Monitor Function</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Funzione monitor</translation>
</message>
<message>
<location filename="themestrings.h" line="67"/>
<source>Monitors</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Monitor</translation>
</message>
<message>
<location filename="themestrings.h" line="71"/>
<source>Play</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Riproduci</translation>
</message>
<message>
<location filename="themestrings.h" line="74"/>
<source>Save</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Salva</translation>
</message>
<message>
<location filename="themestrings.h" line="75"/>
<source>See what your system is doing</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Vedi cosa sta facendo il sistema</translation>
</message>
<message>
<location filename="themestrings.h" line="84"/>
<source>Show zoneminder</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Mostra zoneminder</translation>
</message>
<message>
<location filename="themestrings.h" line="85"/>
<source>Show zoneminder console</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Mostra console zoneminder</translation>
</message>
<message>
<location filename="themestrings.h" line="86"/>
<source>Show zoneminder events</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Mostr eventi zoneminder</translation>
</message>
<message>
<location filename="themestrings.h" line="87"/>
<source>Show zoneminder live cctv views</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Mostra viste cctv live di zoneminder</translation>
</message>
<message>
<location filename="themestrings.h" line="89"/>
<source>Source:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Sorgente:</translation>
</message>
<message>
<location filename="themestrings.h" line="92"/>
Expand All @@ -129,27 +129,27 @@
<message>
<location filename="themestrings.h" line="93"/>
<source>Storage:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Archivio:</translation>
</message>
<message>
<location filename="themestrings.h" line="95"/>
<source>System Load:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Corico sistema:</translation>
</message>
<message>
<location filename="themestrings.h" line="96"/>
<source>System:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Sistema:</translation>
</message>
<message>
<location filename="themestrings.h" line="99"/>
<source>Time:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Ora:</translation>
</message>
<message>
<location filename="themestrings.h" line="101"/>
<source>Zone Minder Console</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Console Zone Minder</translation>
</message>
<message>
<location filename="themestrings.h" line="103"/>
Expand All @@ -164,12 +164,12 @@
<message>
<location filename="themestrings.h" line="108"/>
<source>Zoneminder console</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Console Zoneminder</translation>
</message>
<message>
<location filename="themestrings.h" line="110"/>
<source>[R] = Running, [S] = Stopped</source>
<translation type="unfinished"></translation>
<translation type="unfinished">[R] = In esecuz., [S] = Fermato</translation>
</message>
<message>
<location filename="themestrings.h" line="112"/>
Expand Down Expand Up @@ -229,7 +229,7 @@
<message>
<location filename="themestrings.h" line="51"/>
<source>Length</source>
<translation>Lunghezza</translation>
<translation type="unfinished">Durata</translation>
</message>
<message>
<location filename="themestrings.h" line="68"/>
Expand Down Expand Up @@ -300,17 +300,18 @@
<location filename="themestrings.h" line="6"/>
<source>%buttontext%
%time%</source>
<translation type="unfinished"></translation>
<translation type="unfinished">%buttontext%
%time%</translation>
</message>
<message>
<location filename="themestrings.h" line="7"/>
<source>%camera%: %time% (%length%)</source>
<translation type="unfinished"></translation>
<translation type="unfinished">%camera%: %time% (%length%)</translation>
</message>
<message>
<location filename="themestrings.h" line="8"/>
<source>%length%</source>
<translation type="unfinished"></translation>
<translation type="unfinished">%length%</translation>
</message>
<message>
<location filename="themestrings.h" line="9"/>
Expand All @@ -325,92 +326,92 @@
<message>
<location filename="themestrings.h" line="13"/>
<source>CCTV Console</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Console CCTV</translation>
</message>
<message>
<location filename="themestrings.h" line="14"/>
<source>CCTV Date:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Data CCTV:</translation>
</message>
<message>
<location filename="themestrings.h" line="15"/>
<source>CCTV Event Player</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Lettore eventi CCTV</translation>
</message>
<message>
<location filename="themestrings.h" line="16"/>
<source>CCTV Live Player</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Live player CCTV</translation>
</message>
<message>
<location filename="themestrings.h" line="17"/>
<source>CCTV Status:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Stato CCTV:</translation>
</message>
<message>
<location filename="themestrings.h" line="18"/>
<source>CCTV Time:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Ora CCTV:</translation>
</message>
<message>
<location filename="themestrings.h" line="26"/>
<source>Configure Zoneminder console</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Configura console di Zoneminder</translation>
</message>
<message>
<location filename="themestrings.h" line="27"/>
<source>Console</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Console</translation>
</message>
<message>
<location filename="themestrings.h" line="31"/>
<source>Delete</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Elimina</translation>
</message>
<message>
<location filename="themestrings.h" line="32"/>
<source>Disk Usage:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Utilizzo disco:</translation>
</message>
<message>
<location filename="themestrings.h" line="36"/>
<source>Edit CCTV Monitor Function</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Modifica funzione monitor CCTV</translation>
</message>
<message>
<location filename="themestrings.h" line="41"/>
<source>Event No:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">N. evento:</translation>
</message>
<message>
<location filename="themestrings.h" line="43"/>
<source>Event number:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Numero evento:</translation>
</message>
<message>
<location filename="themestrings.h" line="46"/>
<source>Events:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Eventi:</translation>
</message>
<message>
<location filename="themestrings.h" line="49"/>
<source>Function:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Funzione:</translation>
</message>
<message>
<location filename="themestrings.h" line="52"/>
<source>Length:</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Durata:</translation>
</message>
<message>
<location filename="themestrings.h" line="54"/>
<source>Live View</source>
<translation type="unfinished"></translation>
<translation type="unfinished">vista diretta</translation>
</message>
<message>
<location filename="themestrings.h" line="56"/>
<source>Look at the Zoneminder events list</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Vedi elenco eventi di Zoneminder</translation>
</message>
<message>
<location filename="themestrings.h" line="59"/>
Expand Down Expand Up @@ -552,7 +553,7 @@
<message>
<location filename="themestrings.h" line="94"/>
<source>Store</source>
<translation>Archiviare</translation>
<translation type="unfinished">Archivia</translation>
</message>
<message>
<location filename="themestrings.h" line="81"/>
Expand Down Expand Up @@ -611,7 +612,7 @@
<message>
<location filename="../mythzoneminder/zmevents.cpp" line="84"/>
<source>Delete</source>
<translation>Cancella</translation>
<translation type="unfinished">Elimina</translation>
</message>
<message>
<location filename="../mythzoneminder/zmevents.cpp" line="165"/>
Expand Down Expand Up @@ -649,12 +650,12 @@
<message>
<location filename="../mythzoneminder/zmevents.cpp" line="445"/>
<source>Delete All</source>
<translation>Cancellare tutto</translation>
<translation type="unfinished">Elimina tutto</translation>
</message>
<message>
<location filename="../mythzoneminder/zmevents.cpp" line="463"/>
<source>Delete All Events?</source>
<translation>Cancellare tutti gli eventi?</translation>
<translation type="unfinished">Elimino tutti gli eventi?</translation>
</message>
<message>
<location filename="../mythzoneminder/zmevents.cpp" line="464"/>
Expand Down Expand Up @@ -731,7 +732,7 @@
<message>
<location filename="../mythzoneminder/zmplayer.cpp" line="98"/>
<source>Delete</source>
<translation>Cancellare</translation>
<translation type="unfinished">Elimina</translation>
</message>
<message>
<location filename="../mythzoneminder/zmplayer.cpp" line="104"/>
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythzoneminder/mythzmserver/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ int main(int argc, char **argv)
while (!quit)
{
// the maximum time select() should wait
struct timeval timeout {DB_CHECK_TIME, 0};
struct timeval timeout {DB_CHECK_TIME.count(), 0};

read_fds = master; // copy it
int res = select(fdmax+1, &read_fds, nullptr, nullptr, &timeout);
Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythzoneminder/mythzmserver/zmserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int g_majorVersion = 0;
int g_minorVersion = 0;
int g_revisionVersion = 0;

time_t g_lastDBKick = 0;
TimePoint g_lastDBKick {};

// returns true if the ZM version >= the requested version
bool checkVersion(int major, int minor, int revision)
Expand Down Expand Up @@ -200,13 +200,13 @@ void connectToDatabase(void)

void kickDatabase(bool debug)
{
if (time(nullptr) < g_lastDBKick + DB_CHECK_TIME)
if (Clock::now() < g_lastDBKick + DB_CHECK_TIME)
return;

if (debug)
std::cout << "Kicking database connection" << std::endl;

g_lastDBKick = time(nullptr);
g_lastDBKick = Clock::now();

if (mysql_query(&g_dbConn, "SELECT NULL;") == 0)
{
Expand Down
8 changes: 6 additions & 2 deletions mythplugins/mythzoneminder/mythzmserver/zmserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@
#ifndef ZMSERVER_H
#define ZMSERVER_H

#include <chrono>
#include <cstdint>
#include <map>
#include <mysql/mysql.h>
#include <sstream>
#include <string>
#include <unistd.h>
#include <vector>
using namespace std::chrono_literals;
using Clock = std::chrono::system_clock;
using TimePoint = std::chrono::time_point<Clock>;

// the maximum image size we are ever likely to get from ZM
#define MAX_IMAGE_SIZE (2048*1536*3)
Expand All @@ -47,8 +51,8 @@ extern int g_majorVersion;
extern int g_minorVersion;
extern int g_revisionVersion;

#define DB_CHECK_TIME 60
extern time_t g_lastDBKick;
static constexpr std::chrono::seconds DB_CHECK_TIME { 60s };
extern TimePoint g_lastDBKick;

const std::string FUNCTION_MONITOR = "Monitor";
const std::string FUNCTION_MODECT = "Modect";
Expand Down
13 changes: 6 additions & 7 deletions mythplugins/mythzoneminder/mythzoneminder/zmclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,14 +583,13 @@ void ZMClient::deleteEventList(std::vector<Event*> *eventList)
bool ZMClient::readData(unsigned char *data, int dataSize)
{
qint64 read = 0;
int errmsgtime = 0;
std::chrono::milliseconds errmsgtime { 0ms };
MythTimer timer;
timer.start();

while (dataSize > 0)
{
qint64 sret = m_socket->Read(
(char*) data + read, dataSize, 100 /*ms*/);
qint64 sret = m_socket->Read((char*) data + read, dataSize, 100ms);
if (sret > 0)
{
read += sret;
Expand All @@ -615,10 +614,10 @@ bool ZMClient::readData(unsigned char *data, int dataSize)
}
else
{
int elapsed = timer.elapsed();
if (elapsed > 10000)
std::chrono::milliseconds elapsed = timer.elapsed();
if (elapsed > 10s)
{
if ((elapsed - errmsgtime) > 10000)
if ((elapsed - errmsgtime) > 10s)
{
errmsgtime = elapsed;
LOG(VB_GENERAL, LOG_ERR,
Expand All @@ -627,7 +626,7 @@ bool ZMClient::readData(unsigned char *data, int dataSize)
}
}

if (elapsed > 100000)
if (elapsed > 100s)
{
LOG(VB_GENERAL, LOG_ERR, "Error, readData timeout (readBlock)");
return false;
Expand Down
2 changes: 0 additions & 2 deletions mythplugins/mythzoneminder/mythzoneminder/zmconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
#include "zmclient.h"
#include "zmconsole.h"

using namespace std::chrono_literals;

constexpr std::chrono::milliseconds STATUS_UPDATE_TIME { 10s }; // update the status every 10 seconds
constexpr std::chrono::milliseconds TIME_UPDATE_TIME { 1s }; // update the time every 1 second

Expand Down
Loading