Launcher shows aircraft URLs
(in the details view)
This commit is contained in:
parent
72d5f1efa0
commit
68141f3675
7 changed files with 113 additions and 3 deletions
|
@ -35,7 +35,7 @@
|
|||
#include <simgear/props/props_io.hxx>
|
||||
#include <simgear/structure/exception.hxx>
|
||||
|
||||
static quint32 CACHE_VERSION = 10;
|
||||
static quint32 CACHE_VERSION = 11;
|
||||
|
||||
const int STANDARD_THUMBNAIL_HEIGHT = 128;
|
||||
//const int STANDARD_THUMBNAIL_WIDTH = 172;
|
||||
|
@ -128,6 +128,10 @@ AircraftItem::AircraftItem(QDir dir, QString filePath)
|
|||
if (sim->hasChild("minimum-fg-version")) {
|
||||
minFGVersion = sim->getStringValue("minimum-fg-version");
|
||||
}
|
||||
|
||||
homepageUrl = QUrl(QString::fromStdString(sim->getStringValue("urls/home-page")));
|
||||
supportUrl = QUrl(QString::fromStdString(sim->getStringValue("urls/support")));
|
||||
wikipediaUrl = QUrl(QString::fromStdString(sim->getStringValue("urls/wikipedia")));
|
||||
}
|
||||
|
||||
QString AircraftItem::baseName() const
|
||||
|
@ -150,6 +154,7 @@ void AircraftItem::fromDataStream(QDataStream& ds)
|
|||
ds >> thumbnailPath;
|
||||
ds >> minFGVersion;
|
||||
ds >> needsMaintenance >> usesHeliports >> usesSeaports;
|
||||
ds >> homepageUrl >> supportUrl >> wikipediaUrl;
|
||||
}
|
||||
|
||||
void AircraftItem::toDataStream(QDataStream& ds) const
|
||||
|
@ -165,6 +170,7 @@ void AircraftItem::toDataStream(QDataStream& ds) const
|
|||
ds << thumbnailPath;
|
||||
ds << minFGVersion;
|
||||
ds << needsMaintenance << usesHeliports << usesSeaports;
|
||||
ds << homepageUrl << supportUrl << wikipediaUrl;
|
||||
}
|
||||
|
||||
QPixmap AircraftItem::thumbnail(bool loadIfRequired) const
|
||||
|
|
|
@ -56,7 +56,7 @@ struct AircraftItem
|
|||
QString path;
|
||||
QString description;
|
||||
QString longDescription;
|
||||
QString authors;
|
||||
QString authors; // legacy authors data only
|
||||
int ratings[4] = {0, 0, 0, 0};
|
||||
QString variantOf;
|
||||
QDateTime pathModTime;
|
||||
|
@ -68,7 +68,9 @@ struct AircraftItem
|
|||
QString thumbnailPath;
|
||||
QString minFGVersion;
|
||||
bool needsMaintenance = false;
|
||||
|
||||
QUrl homepageUrl;
|
||||
QUrl wikipediaUrl;
|
||||
QUrl supportUrl;
|
||||
QVariant status(int variant);
|
||||
private:
|
||||
mutable QPixmap m_thumbnail;
|
||||
|
|
|
@ -483,6 +483,42 @@ QString QmlAircraftInfo::pathOnDisk() const
|
|||
return {};
|
||||
}
|
||||
|
||||
QUrl QmlAircraftInfo::homePage() const
|
||||
{
|
||||
if (_item) {
|
||||
return resolveItem()->homepageUrl;
|
||||
} else if (_package) {
|
||||
const auto u = _package->properties()->getStringValue("urls/home-page");
|
||||
return QUrl(QString::fromStdString(u));
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
QUrl QmlAircraftInfo::supportUrl() const
|
||||
{
|
||||
if (_item) {
|
||||
return resolveItem()->supportUrl;
|
||||
} else if (_package) {
|
||||
const auto u = _package->properties()->getStringValue("urls/support");
|
||||
return QUrl(QString::fromStdString(u));
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
QUrl QmlAircraftInfo::wikipediaUrl() const
|
||||
{
|
||||
if (_item) {
|
||||
return resolveItem()->wikipediaUrl;
|
||||
} else if (_package) {
|
||||
const auto u = _package->properties()->getStringValue("urls/wikipedia");
|
||||
return QUrl(QString::fromStdString(u));
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
QString QmlAircraftInfo::packageId() const
|
||||
{
|
||||
if (_package) {
|
||||
|
|
|
@ -45,6 +45,11 @@ class QmlAircraftInfo : public QObject
|
|||
|
||||
Q_PROPERTY(QString minimumFGVersion READ minimumFGVersion NOTIFY infoChanged)
|
||||
|
||||
Q_PROPERTY(QUrl homePage READ homePage NOTIFY infoChanged)
|
||||
Q_PROPERTY(QUrl supportUrl READ supportUrl NOTIFY infoChanged)
|
||||
Q_PROPERTY(QUrl wikipediaUrl READ wikipediaUrl NOTIFY infoChanged)
|
||||
|
||||
|
||||
Q_INVOKABLE void requestInstallUpdate();
|
||||
|
||||
Q_INVOKABLE void requestUninstall();
|
||||
|
@ -79,6 +84,10 @@ public:
|
|||
QUrl thumbnail() const;
|
||||
QString pathOnDisk() const;
|
||||
|
||||
QUrl homePage() const;
|
||||
QUrl supportUrl() const;
|
||||
QUrl wikipediaUrl() const;
|
||||
|
||||
QString packageId() const;
|
||||
int packageSize() const;
|
||||
int downloadedBytes() const;
|
||||
|
|
|
@ -114,6 +114,31 @@ Rectangle {
|
|||
|
||||
}
|
||||
|
||||
// web-links row
|
||||
Row {
|
||||
width: parent.width
|
||||
height: childrenRect.height
|
||||
spacing: Style.margin
|
||||
|
||||
Weblink {
|
||||
visible: aircraft.homePage != ""
|
||||
label: qsTr("Website")
|
||||
link: aircraft.homePage
|
||||
}
|
||||
|
||||
Weblink {
|
||||
visible: aircraft.supportUrl != ""
|
||||
label: qsTr("Support and issue reporting")
|
||||
link: aircraft.supportUrl
|
||||
}
|
||||
|
||||
Weblink {
|
||||
visible: aircraft.wikipediaUrl != ""
|
||||
label: qsTr("Wikipedia")
|
||||
link: aircraft.wikipediaUrl
|
||||
}
|
||||
}
|
||||
|
||||
AircraftDownloadPanel {
|
||||
visible: aircraft.isPackaged
|
||||
width: parent.width
|
||||
|
|
31
src/GUI/qml/Weblink.qml
Normal file
31
src/GUI/qml/Weblink.qml
Normal file
|
@ -0,0 +1,31 @@
|
|||
import QtQuick 2.4
|
||||
import "."
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
radius: Style.roundRadius
|
||||
color: Style.themeColor
|
||||
property url link
|
||||
|
||||
property alias label: label.text
|
||||
|
||||
implicitHeight: label.height + Style.margin
|
||||
implicitWidth: label.width + Style.margin * 2
|
||||
|
||||
StyledText {
|
||||
id: label
|
||||
x: Style.margin
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: "white"
|
||||
font.underline: mouse.containsMouse
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: root.clickable ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
|
||||
onClicked: Qt.openUrlExternally(root.link)
|
||||
}
|
||||
}
|
|
@ -117,6 +117,7 @@
|
|||
<file>qml/NumericalEdit.qml</file>
|
||||
<file>qml/Overlay.qml</file>
|
||||
<file>qml/OverlayShared.qml</file>
|
||||
<file>qml/Weblink.qml</file>
|
||||
</qresource>
|
||||
<qresource prefix="/preview">
|
||||
<file alias="close-icon">preview-close.png</file>
|
||||
|
|
Loading…
Add table
Reference in a new issue