Run clang-format

This commit is contained in:
Bart De Vries 2021-05-28 23:16:35 +02:00
parent 3983e09634
commit 9d78b5b488
3 changed files with 17 additions and 16 deletions

View File

@ -188,7 +188,7 @@ void AudioManager::setEntry(Entry *entry)
// TODO: make grace time a setting in SettingsManager
if (d->m_entry) {
qCDebug(kastsAudio) << "Checking previous track";
qCDebug(kastsAudio) << "Left time" << (duration()-position());
qCDebug(kastsAudio) << "Left time" << (duration() - position());
qCDebug(kastsAudio) << "MediaStatus" << d->m_player.mediaStatus();
if (((duration() - position()) < 15000) || (d->m_player.mediaStatus() == QMediaPlayer::EndOfMedia)) {
qCDebug(kastsAudio) << "Mark as read:" << d->m_entry->title();
@ -230,13 +230,14 @@ void AudioManager::setEntry(Entry *entry)
Q_EMIT canGoNextChanged();
d->m_isSeekable = true;
Q_EMIT seekableChanged(true);
qCDebug(kastsAudio) << "Duration" << d->m_player.duration()/1000 << d->m_entry->enclosure()->duration();
qCDebug(kastsAudio) << "Duration" << d->m_player.duration() / 1000 << d->m_entry->enclosure()->duration();
// Finally, check if duration mentioned in enclosure corresponds to real duration
if ((d->m_player.duration() / 1000) != d->m_entry->enclosure()->duration()) {
d->m_entry->enclosure()->setDuration(d->m_player.duration() / 1000);
qCDebug(kastsAudio) << "Correcting duration of" << d->m_entry->id() << "to" << d->m_player.duration()/1000;
qCDebug(kastsAudio) << "Correcting duration of" << d->m_entry->id() << "to" << d->m_player.duration() / 1000;
}
if (continuePlayback) play();
if (continuePlayback)
play();
} else {
DataManager::instance().setLastPlayingEntry(QStringLiteral("none"));
d->m_entry = nullptr;
@ -377,7 +378,7 @@ void AudioManager::next()
if (canGoNext()) {
QMediaPlayer::State previousTrackState = playbackState();
int index = DataManager::instance().queue().indexOf(d->m_entry->id());
qCDebug(kastsAudio) << "Skipping to" << DataManager::instance().queue()[index+1];
qCDebug(kastsAudio) << "Skipping to" << DataManager::instance().queue()[index + 1];
setEntry(DataManager::instance().getEntry(DataManager::instance().queue()[index + 1]));
if (previousTrackState == QMediaPlayer::PlayingState)
play();
@ -497,7 +498,8 @@ void AudioManagerPrivate::prepareAudioStream()
loop.connect(&m_player, &QMediaPlayer::mediaStatusChanged, &loop, &QEventLoop::quit);
qCDebug(kastsAudio) << "Starting waiting loop on media status" << m_player.mediaStatus();
loop.exec();
} qCDebug(kastsAudio) << "Changing position";
}
qCDebug(kastsAudio) << "Changing position";
if (startingPosition > 1000)
m_player.setPosition(startingPosition);
m_player.pause();

View File

@ -5,10 +5,10 @@
*/
#include "datamanager.h"
#include "audiomanager.h"
#include "database.h"
#include "fetcher.h"
#include "settingsmanager.h"
#include "audiomanager.h"
#include <QDateTime>
#include <QDir>
#include <QSqlDatabase>
@ -253,7 +253,7 @@ void DataManager::removeFeed(const int index)
qDebug() << "delete queueentries of" << feedurl;
for (auto &id : m_queuemap) {
if (getEntry(id)->feed()->url() == feedurl) {
if(AudioManager::instance().entry() == getEntry(id)) {
if (AudioManager::instance().entry() == getEntry(id)) {
AudioManager::instance().next();
}
removeQueueItem(id);

View File

@ -25,7 +25,6 @@
#include <KLocalizedContext>
#include <KLocalizedString>
#include "kasts-version.h"
#include "audiomanager.h"
#include "database.h"
#include "datamanager.h"
@ -35,6 +34,7 @@
#include "errorlogmodel.h"
#include "feedsmodel.h"
#include "fetcher.h"
#include "kasts-version.h"
#include "mpris2/mpris2.h"
#include "queuemodel.h"
#include "settingsmanager.h"
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
QQuickStyle::setStyle(QStringLiteral("Material"));
#else
QApplication app(argc, argv);
if(qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
}
#endif
@ -77,10 +77,10 @@ int main(int argc, char *argv[])
QCommandLineParser parser;
parser.setApplicationDescription(i18n("Podcast Application"));
QCommandLineOption addFeedOption(QStringList() << QStringLiteral("a") << QStringLiteral("add")
, i18n("Adds a new podcast to subscriptions.")
, i18n("Podcast URL")
, QStringLiteral("none"));
QCommandLineOption addFeedOption(QStringList() << QStringLiteral("a") << QStringLiteral("add"),
i18n("Adds a new podcast to subscriptions."),
i18n("Podcast URL"),
QStringLiteral("none"));
parser.addOption(addFeedOption);
KAboutData about(QStringLiteral("kasts"),
@ -96,7 +96,7 @@ int main(int argc, char *argv[])
about.setupCommandLine(&parser);
parser.process(app);
QString feedURL = parser.value(addFeedOption);
if(feedURL != QStringLiteral("none")) {
if (feedURL != QStringLiteral("none")) {
Database::instance();
DataManager::instance().addFeed(feedURL);
}
@ -120,7 +120,6 @@ int main(int argc, char *argv[])
qmlRegisterSingletonInstance("org.kde.kasts", 1, 0, "ErrorLogModel", &ErrorLogModel::instance());
qmlRegisterSingletonInstance("org.kde.kasts", 1, 0, "AudioManager", &AudioManager::instance());
qRegisterMetaType<Entry *>("const Entry*"); // "hack" to make qml understand Entry*
// Make sure that settings are saved before the application exits