Cherry pick make format changes
This commit is contained in:
parent
6cc72e2f5d
commit
bf55bc08fb
@ -235,18 +235,15 @@ bool RemoveRecursive(const QString& path) {
|
||||
QDir dir(path);
|
||||
for (const QString& child :
|
||||
dir.entryList(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Hidden)) {
|
||||
if (!RemoveRecursive(path + "/" + child))
|
||||
return false;
|
||||
if (!RemoveRecursive(path + "/" + child)) return false;
|
||||
}
|
||||
|
||||
for (const QString& child :
|
||||
dir.entryList(QDir::NoDotAndDotDot | QDir::Files | QDir::Hidden)) {
|
||||
if (!QFile::remove(path + "/" + child))
|
||||
return false;
|
||||
if (!QFile::remove(path + "/" + child)) return false;
|
||||
}
|
||||
|
||||
if (!dir.rmdir(path))
|
||||
return false;
|
||||
if (!dir.rmdir(path)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -465,19 +462,18 @@ QByteArray HmacSha1(const QByteArray& key, const QByteArray& data) {
|
||||
}
|
||||
|
||||
QByteArray Sha256(const QByteArray& data) {
|
||||
#ifndef USE_SYSTEM_SHA2
|
||||
using clementine_sha2::SHA256_CTX;
|
||||
using clementine_sha2::SHA256_Init;
|
||||
using clementine_sha2::SHA256_Update;
|
||||
using clementine_sha2::SHA256_Final;
|
||||
using clementine_sha2::SHA256_DIGEST_LENGTH;
|
||||
#endif
|
||||
#ifndef USE_SYSTEM_SHA2
|
||||
using clementine_sha2::SHA256_CTX;
|
||||
using clementine_sha2::SHA256_Init;
|
||||
using clementine_sha2::SHA256_Update;
|
||||
using clementine_sha2::SHA256_Final;
|
||||
using clementine_sha2::SHA256_DIGEST_LENGTH;
|
||||
#endif
|
||||
|
||||
SHA256_CTX context;
|
||||
SHA256_Init(&context);
|
||||
SHA256_Update(
|
||||
&context, reinterpret_cast<const quint8*>(data.constData()),
|
||||
data.length());
|
||||
SHA256_Update(&context, reinterpret_cast<const quint8*>(data.constData()),
|
||||
data.length());
|
||||
|
||||
QByteArray ret(SHA256_DIGEST_LENGTH, '\0');
|
||||
SHA256_Final(reinterpret_cast<quint8*>(ret.data()), &context);
|
||||
@ -577,10 +573,10 @@ QDateTime ParseRFC822DateTime(const QString& text) {
|
||||
"(\\d{1,2}):(\\d{1,2}):(\\d{1,2})");
|
||||
if (re.indexIn(text) != -1) {
|
||||
ret = QDateTime(
|
||||
QDate::fromString(QString("%1 %2 %3 %4")
|
||||
.arg(re.cap(1), re.cap(3), re.cap(2), re.cap(4)),
|
||||
Qt::TextDate),
|
||||
QTime(re.cap(5).toInt(), re.cap(6).toInt(), re.cap(7).toInt()));
|
||||
QDate::fromString(QString("%1 %2 %3 %4")
|
||||
.arg(re.cap(1), re.cap(3), re.cap(2), re.cap(4)),
|
||||
Qt::TextDate),
|
||||
QTime(re.cap(5).toInt(), re.cap(6).toInt(), re.cap(7).toInt()));
|
||||
}
|
||||
if (ret.isValid()) return ret;
|
||||
// Because http://feeds.feedburner.com/reasonabledoubts/Msxh?format=xml
|
||||
@ -604,8 +600,8 @@ QDateTime ParseRFC822DateTime(const QString& text) {
|
||||
|
||||
if (re2.indexIn(text) != -1) {
|
||||
QDate date(re2.cap(3).toInt(), monthmap[re2.cap(2)], re2.cap(1).toInt());
|
||||
ret = QDateTime(date,
|
||||
QTime(re2.cap(4).toInt(), re2.cap(5).toInt(), re2.cap(6).toInt()));
|
||||
ret = QDateTime(date, QTime(re2.cap(4).toInt(), re2.cap(5).toInt(),
|
||||
re2.cap(6).toInt()));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ PodcastEpisodeList PodcastBackend::GetEpisodes(int podcast_id) {
|
||||
QSqlQuery q("SELECT ROWID, " + PodcastEpisode::kColumnSpec +
|
||||
" FROM podcast_episodes"
|
||||
" WHERE podcast_id = :id"
|
||||
" ORDER BY publication_date DESC" ,
|
||||
" ORDER BY publication_date DESC",
|
||||
db);
|
||||
q.bindValue(":db", podcast_id);
|
||||
q.exec();
|
||||
|
@ -123,8 +123,7 @@ void PodcastParser::ParseChannel(QXmlStreamReader* reader, Podcast* ret) const {
|
||||
ParseImage(reader, ret);
|
||||
} else if (name == "copyright") {
|
||||
ret->set_copyright(reader->readElementText());
|
||||
} else if (name == "link" &&
|
||||
lower_namespace == kAtomNamespace &&
|
||||
} else if (name == "link" && lower_namespace == kAtomNamespace &&
|
||||
ret->url().isEmpty() &&
|
||||
reader->attributes().value("rel") == "self") {
|
||||
ret->set_url(QUrl::fromEncoded(reader->readElementText().toAscii()));
|
||||
@ -215,7 +214,9 @@ void PodcastParser::ParseItem(QXmlStreamReader* reader, Podcast* ret) const {
|
||||
episode.set_publication_date(Utilities::ParseRFC822DateTime(date));
|
||||
if (!episode.publication_date().isValid()) {
|
||||
qLog(Error) << "Unable to parse date:" << date
|
||||
<< "Pleas submit it to https://github.com/clementine-player/Clementine/issues/new";
|
||||
<< "Pleas submit it to "
|
||||
"https://github.com/clementine-player/Clementine/"
|
||||
"issues/new";
|
||||
}
|
||||
} else if (name == "duration" && lower_namespace == kItunesNamespace) {
|
||||
// http://www.apple.com/itunes/podcasts/specs.html
|
||||
|
@ -434,9 +434,9 @@ void PodcastService::ShowContextMenu(const QPoint& global_pos) {
|
||||
copy_to_device_ = context_menu_->addAction(
|
||||
IconLoader::Load("multimedia-player-ipod-mini-blue"),
|
||||
tr("Copy to device..."), this, SLOT(CopyToDevice()));
|
||||
cancel_download_ = context_menu_->addAction(
|
||||
IconLoader::Load("cancel"),
|
||||
tr("Cancel download"), this, SLOT(CancelDownload()));
|
||||
cancel_download_ = context_menu_->addAction(IconLoader::Load("cancel"),
|
||||
tr("Cancel download"), this,
|
||||
SLOT(CancelDownload()));
|
||||
remove_selected_action_ = context_menu_->addAction(
|
||||
IconLoader::Load("list-remove"), tr("Unsubscribe"), this,
|
||||
SLOT(RemoveSelectedPodcast()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user