mirror of
https://github.com/zealdocs/zeal.git
synced 2024-09-11 14:25:52 +03:00
parent
2024915307
commit
5cdad0ee98
@ -235,7 +235,7 @@ QString Docset::version() const
|
|||||||
return m_version;
|
return m_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Docset::revision() const
|
int Docset::revision() const
|
||||||
{
|
{
|
||||||
return m_revision;
|
return m_revision;
|
||||||
}
|
}
|
||||||
@ -401,7 +401,7 @@ void Docset::loadMetadata()
|
|||||||
m_name = jsonObject[QStringLiteral("name")].toString();
|
m_name = jsonObject[QStringLiteral("name")].toString();
|
||||||
m_title = jsonObject[QStringLiteral("title")].toString();
|
m_title = jsonObject[QStringLiteral("title")].toString();
|
||||||
m_version = jsonObject[QStringLiteral("version")].toString();
|
m_version = jsonObject[QStringLiteral("version")].toString();
|
||||||
m_revision = jsonObject[QStringLiteral("revision")].toString();
|
m_revision = jsonObject[QStringLiteral("revision")].toString().toInt();
|
||||||
|
|
||||||
if (jsonObject.contains(QStringLiteral("feed_url"))) {
|
if (jsonObject.contains(QStringLiteral("feed_url"))) {
|
||||||
m_feedUrl = jsonObject[QStringLiteral("feed_url")].toString();
|
m_feedUrl = jsonObject[QStringLiteral("feed_url")].toString();
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
QStringList keywords() const;
|
QStringList keywords() const;
|
||||||
|
|
||||||
QString version() const;
|
QString version() const;
|
||||||
QString revision() const;
|
int revision() const;
|
||||||
QString feedUrl() const;
|
QString feedUrl() const;
|
||||||
|
|
||||||
QString path() const;
|
QString path() const;
|
||||||
@ -107,7 +107,7 @@ private:
|
|||||||
QString m_title;
|
QString m_title;
|
||||||
QStringList m_keywords;
|
QStringList m_keywords;
|
||||||
QString m_version;
|
QString m_version;
|
||||||
QString m_revision;
|
int m_revision;
|
||||||
QString m_feedUrl;
|
QString m_feedUrl;
|
||||||
Docset::Type m_type = Type::Invalid;
|
Docset::Type m_type = Type::Invalid;
|
||||||
QString m_path;
|
QString m_path;
|
||||||
|
@ -59,7 +59,9 @@ DocsetMetadata::DocsetMetadata(const QJsonObject &jsonObject)
|
|||||||
m_versions << vv.toString();
|
m_versions << vv.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_revision = jsonObject[QStringLiteral("revision")].toString();
|
// Unfortunately, API returns revision as a string, so it needs to be converted to integer
|
||||||
|
// for comparison to work properly.
|
||||||
|
m_revision = jsonObject[QStringLiteral("revision")].toString().toInt();
|
||||||
|
|
||||||
m_feedUrl = QUrl(jsonObject[QStringLiteral("feed_url")].toString());
|
m_feedUrl = QUrl(jsonObject[QStringLiteral("feed_url")].toString());
|
||||||
|
|
||||||
@ -87,7 +89,7 @@ void DocsetMetadata::save(const QString &path, const QString &version)
|
|||||||
if (!version.isEmpty())
|
if (!version.isEmpty())
|
||||||
jsonObject[QStringLiteral("version")] = version;
|
jsonObject[QStringLiteral("version")] = version;
|
||||||
|
|
||||||
if (version == latestVersion() && !m_revision.isEmpty())
|
if (version == latestVersion() && m_revision == 0)
|
||||||
jsonObject[QStringLiteral("revision")] = m_revision;
|
jsonObject[QStringLiteral("revision")] = m_revision;
|
||||||
|
|
||||||
if (!m_feedUrl.isEmpty())
|
if (!m_feedUrl.isEmpty())
|
||||||
@ -155,7 +157,7 @@ QString DocsetMetadata::latestVersion() const
|
|||||||
return m_versions.isEmpty() ? QString() : m_versions.first();
|
return m_versions.isEmpty() ? QString() : m_versions.first();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DocsetMetadata::revision() const
|
int DocsetMetadata::revision() const
|
||||||
{
|
{
|
||||||
return m_revision;
|
return m_revision;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
QStringList aliases() const;
|
QStringList aliases() const;
|
||||||
QStringList versions() const;
|
QStringList versions() const;
|
||||||
QString latestVersion() const;
|
QString latestVersion() const;
|
||||||
QString revision() const;
|
int revision() const;
|
||||||
QIcon icon() const;
|
QIcon icon() const;
|
||||||
|
|
||||||
QUrl feedUrl() const;
|
QUrl feedUrl() const;
|
||||||
@ -59,7 +59,7 @@ private:
|
|||||||
QString m_title;
|
QString m_title;
|
||||||
QStringList m_aliases;
|
QStringList m_aliases;
|
||||||
QStringList m_versions;
|
QStringList m_versions;
|
||||||
QString m_revision;
|
int m_revision;
|
||||||
|
|
||||||
QByteArray m_rawIcon;
|
QByteArray m_rawIcon;
|
||||||
QByteArray m_rawIcon2x;
|
QByteArray m_rawIcon2x;
|
||||||
|
@ -92,7 +92,7 @@ QVariant ListModel::data(const QModelIndex &index, int role) const
|
|||||||
switch (indexLevel(index)) {
|
switch (indexLevel(index)) {
|
||||||
case Level::DocsetLevel: {
|
case Level::DocsetLevel: {
|
||||||
const auto docset = itemInRow(index.row())->docset;
|
const auto docset = itemInRow(index.row())->docset;
|
||||||
return tr("Version: %1r%2").arg(docset->version(), docset->revision());
|
return tr("Version: %1r%2").arg(docset->version()).arg(docset->revision());
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
Loading…
Reference in New Issue
Block a user