diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2018-04-15 08:15:30 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2018-04-15 08:15:30 +0000 |
| commit | fb04803cc2865030f8913f2e85221ff25b93ecf8 (patch) | |
| tree | 591b3ef84b89eafd22b854f9b2b64788e77766a6 | |
| parent | 9cde07e978a6945c31ec577aaec780e83a3384df (diff) | |
| download | qmmp-fb04803cc2865030f8913f2e85221ff25b93ecf8.tar.gz qmmp-fb04803cc2865030f8913f2e85221ff25b93ecf8.tar.bz2 qmmp-fb04803cc2865030f8913f2e85221ff25b93ecf8.zip | |
some api changes
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@7905 90c681e8-e032-0410-971d-27865f9a5e38
21 files changed, 48 insertions, 48 deletions
diff --git a/src/app/qmmpstarter.cpp b/src/app/qmmpstarter.cpp index cbabb8a28..b3d6422d0 100644 --- a/src/app/qmmpstarter.cpp +++ b/src/app/qmmpstarter.cpp @@ -267,7 +267,7 @@ void QMMPStarter::savePosition() settings.beginGroup("General"); settings.setValue("resume_playback",m_core->state() == Qmmp::Playing && QmmpUiSettings::instance()->resumeOnStartup()); - settings.setValue("resume_playback_time", m_core->totalTime() > 0 ? m_core->elapsed() : 0); + settings.setValue("resume_playback_time", m_core->duration() > 0 ? m_core->elapsed() : 0); settings.endGroup(); m_core->stop(); } diff --git a/src/plugins/CommandLineOptions/SeekOption/seekoption.cpp b/src/plugins/CommandLineOptions/SeekOption/seekoption.cpp index 02e971940..0b0a0b0b2 100644 --- a/src/plugins/CommandLineOptions/SeekOption/seekoption.cpp +++ b/src/plugins/CommandLineOptions/SeekOption/seekoption.cpp @@ -43,7 +43,7 @@ const QStringList SeekOption::helpString() const QString SeekOption::executeCommand(const QString &opt_str, const QStringList &args) { SoundCore *core = SoundCore::instance(); - if(core->state() != Qmmp::Playing && core->totalTime()) + if(core->state() != Qmmp::Playing && core->duration()) return QString(); if(args.isEmpty()) return QString(); @@ -68,7 +68,7 @@ QString SeekOption::executeCommand(const QString &opt_str, const QStringList &ar seek_pos = elapsed - seek_pos; qDebug("SeekOption: position = %d", seek_pos); - if(seek_pos >= 0 && seek_pos < core->totalTime()) + if(seek_pos >= 0 && seek_pos < core->duration()) core->seek(seek_pos * 1000); else return QString(); diff --git a/src/plugins/CommandLineOptions/StatusOption/statusoption.cpp b/src/plugins/CommandLineOptions/StatusOption/statusoption.cpp index b2884fc76..ecb0f8b37 100644 --- a/src/plugins/CommandLineOptions/StatusOption/statusoption.cpp +++ b/src/plugins/CommandLineOptions/StatusOption/statusoption.cpp @@ -71,7 +71,7 @@ QString StatusOption::executeCommand(const QString &opt_str, const QStringList & out += "TRACK = %n\n"; out += "FILE = %f"; MetaDataFormatter formatter(out); - out = formatter.format(core->metaData(), core->totalTime()); + out = formatter.format(core->metaData(), core->duration()); } out += "\n"; } @@ -79,7 +79,7 @@ QString StatusOption::executeCommand(const QString &opt_str, const QStringList & { QString t = args.join(" "); MetaDataFormatter formatter(t); - out = formatter.format(core->metaData(), core->totalTime()); + out = formatter.format(core->metaData(), core->duration()); out += "\n"; } else if(opt_str == "--nowplaying-syntax") @@ -121,15 +121,15 @@ QTranslator *StatusOption::createTranslator(QObject *parent) QString StatusOption::genProgressBar() { SoundCore *core = SoundCore::instance(); - QString totalTime = QString("%1:%2").arg(core->totalTime()/60000) - .arg(core->totalTime()%60000/1000, 2, 10, QChar('0')); + QString totalTime = QString("%1:%2").arg(core->duration()/60000) + .arg(core->duration()%60000/1000, 2, 10, QChar('0')); QString currentTime = QString("%1:%2").arg(core->elapsed()/60000) .arg(core->elapsed()%60000/1000, 2, 10, QChar('0')); QString out = currentTime; - if(core->totalTime()) + if(core->duration()) { out.clear(); - int played_count = 22 * (double)core->elapsed()/core->totalTime(); + int played_count = 22 * (double)core->elapsed()/core->duration(); for(int i = 0; i < played_count; ++i) out += "="; out += "#"; diff --git a/src/plugins/Effect/crossfade/crossfadeplugin.cpp b/src/plugins/Effect/crossfade/crossfadeplugin.cpp index fe0081781..3d9850361 100644 --- a/src/plugins/Effect/crossfade/crossfadeplugin.cpp +++ b/src/plugins/Effect/crossfade/crossfadeplugin.cpp @@ -47,8 +47,8 @@ void CrossfadePlugin::applyEffect(Buffer *b) switch (m_state) { case WAITING: - if((m_core->totalTime() > m_overlap + 2000) - && (m_core->totalTime() - m_handler->elapsed() < m_overlap + 2000)) + if((m_core->duration() > m_overlap + 2000) + && (m_core->duration() - m_handler->elapsed() < m_overlap + 2000)) { StateHandler::instance()->sendNextTrackRequest(); m_state = CHECKING; @@ -60,7 +60,7 @@ void CrossfadePlugin::applyEffect(Buffer *b) m_state = PREPARING; break; case PREPARING: - if(m_core->totalTime() && (m_core->totalTime() - m_handler->elapsed() < m_overlap)) + if(m_core->duration() && (m_core->duration() - m_handler->elapsed() < m_overlap)) { if(m_buffer_at + b->samples > m_buffer_size) { diff --git a/src/plugins/Effect/filewriter/filewriterplugin.cpp b/src/plugins/Effect/filewriter/filewriterplugin.cpp index c605370e0..f2ed0d793 100644 --- a/src/plugins/Effect/filewriter/filewriterplugin.cpp +++ b/src/plugins/Effect/filewriter/filewriterplugin.cpp @@ -123,7 +123,7 @@ void FileWriterPlugin::init(const QMap<Qmmp::MetaData, QString> &metaData) fileName = metaData[Qmmp::URL].section("/", 1); MetaDataFormatter formatter(fileName); - fileName = formatter.format(metaData, SoundCore::instance()->totalTime() / 1000); + fileName = formatter.format(metaData, SoundCore::instance()->duration() / 1000); if(!fileName.endsWith(".ogg", Qt::CaseInsensitive)) fileName.append(".ogg"); diff --git a/src/plugins/General/kdenotify/kdenotify.cpp b/src/plugins/General/kdenotify/kdenotify.cpp index d4bb4a482..6b0826769 100644 --- a/src/plugins/General/kdenotify/kdenotify.cpp +++ b/src/plugins/General/kdenotify/kdenotify.cpp @@ -95,7 +95,7 @@ KdeNotify::~KdeNotify() QString KdeNotify::totalTimeString() { - int time = SoundCore::instance()->totalTime()/1000; + int time = SoundCore::instance()->duration()/1000; if(time >= 3600) { @@ -121,7 +121,7 @@ QList<QVariant> KdeNotify::prepareNotification() args.append(tr("Qmmp now playing:")); //summary (notification title) MetaDataFormatter f(m_template); - QString body = f.format(core->metaData(), core->totalTime()/1000); + QString body = f.format(core->metaData(), core->duration()/1000); QString coverPath; if(m_showCovers) diff --git a/src/plugins/General/mpris/mpris1/playerobject.cpp b/src/plugins/General/mpris/mpris1/playerobject.cpp index 866a9858b..a1b3c490b 100644 --- a/src/plugins/General/mpris/mpris1/playerobject.cpp +++ b/src/plugins/General/mpris/mpris1/playerobject.cpp @@ -138,8 +138,8 @@ QVariantMap PlayerObject::GetMetadata() map.insert("albumartist", m_core->metaData(Qmmp::ALBUMARTIST)); map.insert("album", m_core->metaData(Qmmp::ALBUM)); map.insert("tracknumber", m_core->metaData(Qmmp::TRACK)); - map.insert("time", (quint32)m_core->totalTime()/1000); - map.insert("mtime", (quint32)m_core->totalTime()); + map.insert("time", (quint32)m_core->duration()/1000); + map.insert("mtime", (quint32)m_core->duration()); map.insert("genre", m_core->metaData(Qmmp::GENRE)); map.insert("comment", m_core->metaData(Qmmp::COMMENT)); map.insert("audio-bitrate", (quint32)m_core->bitrate()); @@ -155,7 +155,7 @@ int PlayerObject::GetCaps() caps |= CAN_PAUSE; else caps |= CAN_PLAY; - if ((GetStatus().state < 2) && (m_core->totalTime() > 0)) + if ((GetStatus().state < 2) && (m_core->duration() > 0)) caps |= CAN_SEEK; caps |= CAN_GO_NEXT; caps |= CAN_GO_PREV; diff --git a/src/plugins/General/mpris/mpris2/player2object.cpp b/src/plugins/General/mpris/mpris2/player2object.cpp index ccdb8c70a..cee1aebfe 100644 --- a/src/plugins/General/mpris/mpris2/player2object.cpp +++ b/src/plugins/General/mpris/mpris2/player2object.cpp @@ -83,7 +83,7 @@ bool Player2Object::canPlay() const bool Player2Object::canSeek() const { - return m_core->totalTime() > 0; + return m_core->duration() > 0; } QString Player2Object::loopStatus() const @@ -126,7 +126,7 @@ QVariantMap Player2Object::metadata() const if(!track || m_core->metaData(Qmmp::URL).isEmpty()) return QVariantMap(); QVariantMap map; - map["mpris:length"] = qMax(m_core->totalTime() * 1000 , qint64(0)); + map["mpris:length"] = qMax(m_core->duration() * 1000 , qint64(0)); if(!MetaDataManager::instance()->getCoverPath(m_core->metaData(Qmmp::URL)).isEmpty()) { map["mpris:artUrl"] = QUrl::fromLocalFile( diff --git a/src/plugins/General/notifier/notifier.cpp b/src/plugins/General/notifier/notifier.cpp index c55008406..c7d25db94 100644 --- a/src/plugins/General/notifier/notifier.cpp +++ b/src/plugins/General/notifier/notifier.cpp @@ -136,7 +136,7 @@ void Notifier::showMetaData() data.append(m_core->metaData(Qmmp::ARTIST).toUtf8()+"\n"); data.append(m_core->metaData(Qmmp::ALBUM).toUtf8()+"\n"); data.append(m_core->metaData(Qmmp::TRACK).toUtf8()+"\n"); - data.append(QString("%1").arg(m_core->totalTime()/1000).toUtf8()+"\n"); + data.append(QString("%1").arg(m_core->duration()/1000).toUtf8()+"\n"); foreach(QString path, m_psiTuneFiles) { diff --git a/src/plugins/General/notifier/popupwidget.cpp b/src/plugins/General/notifier/popupwidget.cpp index b3a4c136a..d5b72e04b 100644 --- a/src/plugins/General/notifier/popupwidget.cpp +++ b/src/plugins/General/notifier/popupwidget.cpp @@ -84,7 +84,7 @@ void PopupWidget::showMetaData() m_timer->stop(); SoundCore *core = SoundCore::instance(); - QString title = m_formatter.format(core->metaData(), core->totalTime() / 1000); + QString title = m_formatter.format(core->metaData(), core->duration() / 1000); m_label1->setText(title); diff --git a/src/plugins/General/scrobbler/scrobbler.cpp b/src/plugins/General/scrobbler/scrobbler.cpp index b4f10e634..3c90abbbe 100644 --- a/src/plugins/General/scrobbler/scrobbler.cpp +++ b/src/plugins/General/scrobbler/scrobbler.cpp @@ -178,7 +178,7 @@ void Scrobbler::updateMetaData() if(!metadata.value(Qmmp::TITLE).isEmpty() && !metadata.value(Qmmp::ARTIST).isEmpty()) { - m_song = SongInfo(metadata, m_core->totalTime()/1000); + m_song = SongInfo(metadata, m_core->duration()/1000); m_song.setTimeStamp(QDateTime::currentDateTime().toTime_t()); sendNotification(m_song); } diff --git a/src/plugins/General/statusicon/statusicon.cpp b/src/plugins/General/statusicon/statusicon.cpp index f33e395e8..21f1a6519 100644 --- a/src/plugins/General/statusicon/statusicon.cpp +++ b/src/plugins/General/statusicon/statusicon.cpp @@ -136,7 +136,7 @@ void StatusIcon::showMetaData() } } - QString message = m_messageFormatter.format(meta, m_core->totalTime() / 1000); + QString message = m_messageFormatter.format(meta, m_core->duration() / 1000); if (message.isEmpty()) message = meta[Qmmp::URL].section('/',-1); @@ -146,7 +146,7 @@ void StatusIcon::showMetaData() if(m_showToolTip) { - message = m_toolTipFormatter.format(meta, m_core->totalTime() / 1000); + message = m_toolTipFormatter.format(meta, m_core->duration() / 1000); if(message.isEmpty()) message = meta[Qmmp::URL].section('/',-1); m_tray->setToolTip(message); diff --git a/src/plugins/General/statusicon/statusiconpopupwidget.cpp b/src/plugins/General/statusicon/statusiconpopupwidget.cpp index 11439ecd6..e219d4122 100644 --- a/src/plugins/General/statusicon/statusiconpopupwidget.cpp +++ b/src/plugins/General/statusicon/statusiconpopupwidget.cpp @@ -126,7 +126,7 @@ void StatusIconPopupWidget::updateMetaData(const QString &message) void StatusIconPopupWidget::updateTime(qint64 elapsed) { - m_bar->setMaximum(SoundCore::instance()->totalTime()/1000); + m_bar->setMaximum(SoundCore::instance()->duration()/1000); m_bar->setValue(elapsed/1000); m_bar->update(); } diff --git a/src/plugins/Ui/qsui/mainwindow.cpp b/src/plugins/Ui/qsui/mainwindow.cpp index 3cf109e5e..a482aff4e 100644 --- a/src/plugins/Ui/qsui/mainwindow.cpp +++ b/src/plugins/Ui/qsui/mainwindow.cpp @@ -199,15 +199,15 @@ void MainWindow::addUrl() void MainWindow::updatePosition(qint64 pos) { - m_positionSlider->setMaximum(m_core->totalTime()/1000); + m_positionSlider->setMaximum(m_core->duration()/1000); if(!m_positionSlider->isSliderDown()) m_positionSlider->setValue(pos/1000); QString text = MetaDataFormatter::formatLength(pos/1000, false); - if(m_core->totalTime() > 1000) + if(m_core->duration() > 1000) { text.append("/"); - text.append(MetaDataFormatter::formatLength(m_core->totalTime()/1000)); + text.append(MetaDataFormatter::formatLength(m_core->duration()/1000)); } m_timeLabel->setText(text); } diff --git a/src/plugins/Ui/skinned/display.cpp b/src/plugins/Ui/skinned/display.cpp index d4fd519a4..45b3ec70f 100644 --- a/src/plugins/Ui/skinned/display.cpp +++ b/src/plugins/Ui/skinned/display.cpp @@ -190,7 +190,7 @@ void MainDisplay::setState(Qmmp::State state) case Qmmp::Playing: m_playstatus->setStatus(PlayStatus::PLAY); m_timeIndicatorModel->setVisible(true); - setDuration(m_core->totalTime()); + setDuration(m_core->duration()); break; case Qmmp::Paused: m_playstatus->setStatus(PlayStatus::PAUSE); diff --git a/src/plugins/Ui/skinned/playlist.cpp b/src/plugins/Ui/skinned/playlist.cpp index ab79cc254..13f9819f0 100644 --- a/src/plugins/Ui/skinned/playlist.cpp +++ b/src/plugins/Ui/skinned/playlist.cpp @@ -577,7 +577,7 @@ void PlayList::setTime(qint64 time) if (SoundCore::instance()) { QString str_length = formatTime (m_pl_manager->currentPlayList()->totalLength()) + - "/" + formatTime (SoundCore::instance()->totalTime()/1000); + "/" + formatTime (SoundCore::instance()->duration()/1000); m_length_totalLength->display (str_length); m_length_totalLength->update(); } diff --git a/src/plugins/Ui/skinned/textscroller.cpp b/src/plugins/Ui/skinned/textscroller.cpp index 8d9c5f545..3f9d3d1bd 100644 --- a/src/plugins/Ui/skinned/textscroller.cpp +++ b/src/plugins/Ui/skinned/textscroller.cpp @@ -253,7 +253,7 @@ void TextScroller::processMetaData() { if(m_core->state() == Qmmp::Playing) { - m_titleText = m_formater.format(m_core->metaData(), m_core->totalTime()/1000); + m_titleText = m_formater.format(m_core->metaData(), m_core->duration()/1000); updateText(); } } diff --git a/src/qmmp/soundcore.cpp b/src/qmmp/soundcore.cpp index 26400e3ea..90a28966a 100644 --- a/src/qmmp/soundcore.cpp +++ b/src/qmmp/soundcore.cpp @@ -135,9 +135,9 @@ bool SoundCore::nextTrackAccepted() const return m_nextState == SAME_ENGINE; } -qint64 SoundCore::totalTime() const +qint64 SoundCore::duration() const { - return m_handler->totalTime(); + return m_handler->duration(); } EqSettings SoundCore::eqSettings() const diff --git a/src/qmmp/soundcore.h b/src/qmmp/soundcore.h index b1b12bb75..5084fafe6 100644 --- a/src/qmmp/soundcore.h +++ b/src/qmmp/soundcore.h @@ -56,7 +56,7 @@ public: /*! * Returns length in milliseconds */ - qint64 totalTime() const; + qint64 duration() const; /*! * Returns equalizer settings */ diff --git a/src/qmmp/statehandler.cpp b/src/qmmp/statehandler.cpp index 4ff6dddae..4abc4669a 100644 --- a/src/qmmp/statehandler.cpp +++ b/src/qmmp/statehandler.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008-2017 by Ilya Kotov * + * Copyright (C) 2008-2018 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -39,7 +39,7 @@ StateHandler::StateHandler(QObject *parent) qRegisterMetaType<AudioParameters>("AudioParameters"); m_instance = this; m_elapsed = -1; - m_length = 0; + m_duration = 0; m_bitrate = 0; m_sendAboutToFinish = true; m_state = Qmmp::Stopped; @@ -62,12 +62,12 @@ void StateHandler::dispatch(qint64 elapsed, int bitrate) m_bitrate = bitrate; emit (bitrateChanged(bitrate)); } - if((SoundCore::instance()->totalTime() > PREFINISH_TIME) - && (m_length - m_elapsed < PREFINISH_TIME) + if((SoundCore::instance()->duration() > PREFINISH_TIME) + && (m_duration - m_elapsed < PREFINISH_TIME) && m_sendAboutToFinish) { m_sendAboutToFinish = false; - if(m_length - m_elapsed > PREFINISH_TIME/2) + if(m_duration - m_elapsed > PREFINISH_TIME/2) qApp->postEvent(parent(), new QEvent(EVENT_NEXT_TRACK_REQUEST)); } } @@ -88,7 +88,7 @@ void StateHandler::dispatch(const AudioParameters &p) void StateHandler::dispatch(qint64 length) { m_mutex.lock(); - m_length = length; + m_duration = length; m_mutex.unlock(); } @@ -182,10 +182,10 @@ qint64 StateHandler::elapsed() const return m_elapsed; } -qint64 StateHandler::totalTime() const +qint64 StateHandler::duration() const { QMutexLocker locker(&m_mutex); - return m_length; + return m_duration; } int StateHandler::bitrate() const diff --git a/src/qmmp/statehandler.h b/src/qmmp/statehandler.h index 7316653e4..56692a517 100644 --- a/src/qmmp/statehandler.h +++ b/src/qmmp/statehandler.h @@ -57,9 +57,9 @@ public: void dispatch(const AudioParameters &p); /*! * Sends information about song length - * @param length song length in milliseconds + * @param duration track length in milliseconds */ - void dispatch(qint64 length); + void dispatch(qint64 duration); /*! * Sends metadata \b metaData */ @@ -82,9 +82,9 @@ public: */ qint64 elapsed() const; /*! - * Returns length in milliseconds + * Returns duration in milliseconds */ - qint64 totalTime() const; + qint64 duration() const; /*! * Returns current bitrate (in kbps) */ @@ -135,7 +135,7 @@ signals: private: qint64 m_elapsed; - qint64 m_length; + qint64 m_duration; bool m_sendAboutToFinish; int m_bitrate; static StateHandler* m_instance; |
