Launcher: tweak sidebar icons
This commit is contained in:
parent
1cbcae9795
commit
180cf66077
10 changed files with 75 additions and 10 deletions
|
@ -826,3 +826,16 @@ void LauncherController::setMinWindowSize(QSize sz)
|
|||
m_window->setMinimumSize(sz);
|
||||
emit minWindowSizeChanged();
|
||||
}
|
||||
|
||||
QUrl LauncherController::flyIconUrl() const
|
||||
{
|
||||
if (m_aircraftType == Helicopter) {
|
||||
return QUrl{"qrc:///svg/toolbox-fly-heli"};
|
||||
} else if (m_selectedAircraftInfo) {
|
||||
if (m_selectedAircraftInfo->hasTag("spaceship")) {
|
||||
return QUrl{"qrc:///svg/toolbox-fly-alt"};
|
||||
}
|
||||
}
|
||||
|
||||
return QUrl{"qrc:///svg/toolbox-fly"};
|
||||
}
|
||||
|
|
|
@ -84,6 +84,8 @@ class LauncherController : public QObject
|
|||
|
||||
Q_PROPERTY(QSize minimumWindowSize READ minWindowSize WRITE setMinWindowSize NOTIFY minWindowSizeChanged)
|
||||
|
||||
Q_PROPERTY(QUrl flyIconUrl READ flyIconUrl NOTIFY selectedAircraftChanged)
|
||||
|
||||
public:
|
||||
explicit LauncherController(QObject *parent, QWindow* win);
|
||||
|
||||
|
@ -182,6 +184,9 @@ public:
|
|||
}
|
||||
|
||||
void setMinWindowSize(QSize sz);
|
||||
|
||||
QUrl flyIconUrl() const;
|
||||
|
||||
signals:
|
||||
|
||||
void selectedAircraftChanged(QUrl selectedAircraft);
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <simgear/props/props_io.hxx>
|
||||
#include <simgear/structure/exception.hxx>
|
||||
|
||||
static quint32 CACHE_VERSION = 11;
|
||||
static quint32 CACHE_VERSION = 12;
|
||||
|
||||
const int STANDARD_THUMBNAIL_HEIGHT = 128;
|
||||
//const int STANDARD_THUMBNAIL_WIDTH = 172;
|
||||
|
@ -103,8 +103,10 @@ AircraftItem::AircraftItem(QDir dir, QString filePath)
|
|||
// could also consider vtol tag?
|
||||
usesSeaports |= (strcmp(tagName, "seaplane") == 0);
|
||||
usesSeaports |= (strcmp(tagName, "floats") == 0);
|
||||
|
||||
needsMaintenance |= (strcmp(tagName, "needs-maintenance") == 0);
|
||||
|
||||
// and actually store the tags
|
||||
tags.push_back(QString::fromUtf8(tagName));
|
||||
}
|
||||
} // of tags iteration
|
||||
} // of set-xml has tags
|
||||
|
@ -155,6 +157,7 @@ void AircraftItem::fromDataStream(QDataStream& ds)
|
|||
ds >> minFGVersion;
|
||||
ds >> needsMaintenance >> usesHeliports >> usesSeaports;
|
||||
ds >> homepageUrl >> supportUrl >> wikipediaUrl;
|
||||
ds >> tags;
|
||||
}
|
||||
|
||||
void AircraftItem::toDataStream(QDataStream& ds) const
|
||||
|
@ -171,6 +174,7 @@ void AircraftItem::toDataStream(QDataStream& ds) const
|
|||
ds << minFGVersion;
|
||||
ds << needsMaintenance << usesHeliports << usesSeaports;
|
||||
ds << homepageUrl << supportUrl << wikipediaUrl;
|
||||
ds << tags;
|
||||
}
|
||||
|
||||
QPixmap AircraftItem::thumbnail(bool loadIfRequired) const
|
||||
|
|
|
@ -68,6 +68,7 @@ struct AircraftItem
|
|||
bool isPrimary = false;
|
||||
QString thumbnailPath;
|
||||
QString minFGVersion;
|
||||
QStringList tags;
|
||||
bool needsMaintenance = false;
|
||||
QUrl homepageUrl;
|
||||
QUrl wikipediaUrl;
|
||||
|
|
|
@ -214,7 +214,10 @@ public:
|
|||
|
||||
QVariant data(const QModelIndex &index, int role) const override
|
||||
{
|
||||
const StateInfo& s = _data.at(index.row());
|
||||
size_t i;
|
||||
if (!makeSafeIndex(index.row(), i))
|
||||
return {};
|
||||
const StateInfo& s = _data.at(i);
|
||||
if (role == Qt::DisplayRole) {
|
||||
if (s.name.isEmpty()) {
|
||||
return humanNameFromStateTag(s.primaryTag());
|
||||
|
@ -244,19 +247,21 @@ public:
|
|||
|
||||
Q_INVOKABLE QString descriptionForState(int row) const
|
||||
{
|
||||
if ((row < 0) || (row >= _data.size()))
|
||||
size_t index;
|
||||
if (!makeSafeIndex(row, index))
|
||||
return {};
|
||||
|
||||
const StateInfo& s = _data.at(row);
|
||||
const StateInfo& s = _data.at(index);
|
||||
return s.description;
|
||||
}
|
||||
|
||||
Q_INVOKABLE QString tagForState(int row) const
|
||||
{
|
||||
if ((row < 0) || (row >= _data.size()))
|
||||
size_t index;
|
||||
if (!makeSafeIndex(row, index))
|
||||
return {};
|
||||
|
||||
return QString::fromStdString(_data.at(row).primaryTag());
|
||||
return QString::fromStdString(_data.at(index).primaryTag());
|
||||
}
|
||||
|
||||
bool hasExplicitAuto() const
|
||||
|
@ -274,6 +279,15 @@ public:
|
|||
return indexForTag(st.toStdString()) != -1;
|
||||
}
|
||||
private:
|
||||
bool makeSafeIndex(int row, size_t& t) const
|
||||
{
|
||||
if (row < 0) {
|
||||
return false;
|
||||
}
|
||||
t = static_cast<size_t>(row);
|
||||
return (t < _data.size());
|
||||
}
|
||||
|
||||
AircraftStateVec _data;
|
||||
bool _explicitAutoState = false;
|
||||
};
|
||||
|
@ -849,5 +863,18 @@ bool QmlAircraftInfo::isAltitudeBelowLimits(QuantityValue speed) const
|
|||
return true;
|
||||
}
|
||||
|
||||
bool QmlAircraftInfo::hasTag(QString tag) const
|
||||
{
|
||||
if (_item) {
|
||||
return resolveItem()->tags.contains(tag);
|
||||
} else if (_package) {
|
||||
const auto& tags = _package->tags();
|
||||
auto it = tags.find(tag.toStdString());
|
||||
return (it != tags.end());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#include "QmlAircraftInfo.moc"
|
||||
|
||||
|
|
|
@ -126,6 +126,7 @@ public:
|
|||
Q_INVOKABLE bool isSpeedBelowLimits(QuantityValue speed) const;
|
||||
Q_INVOKABLE bool isAltitudeBelowLimits(QuantityValue speed) const;
|
||||
|
||||
Q_INVOKABLE bool hasTag(QString tag) const;
|
||||
signals:
|
||||
void uriChanged();
|
||||
void infoChanged();
|
||||
|
|
6
src/GUI/assets/icons8-helicopter.svg
Normal file
6
src/GUI/assets/icons8-helicopter.svg
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" version="1.1" fill="#ffffff" width="50px" height="50px">
|
||||
<g id="surface1" fill="#ffffff">
|
||||
<path style=" " d="M 28.90625 8.96875 C 28.863281 8.976563 28.820313 8.988281 28.78125 9 C 28.316406 9.105469 27.988281 9.523438 28 10 L 28 10.84375 L 9.8125 10 C 8.804688 10 8 10.671875 8 11.5 C 8 12.328125 8.804688 13 9.8125 13 L 28 12.15625 L 28 14.4375 C 25.886719 15.097656 24.363281 16.441406 23.15625 18 L 9.59375 18 C 8.820313 16.230469 7.039063 15 5 15 C 2.25 15 0 17.25 0 20 C 0 22.75 2.25 25 5 25 C 6.648438 25 8.121094 24.203125 9.03125 22.96875 C 9.472656 23.085938 9.765625 23.15625 10.25 23.28125 C 13.253906 24.066406 16.875 25.011719 20 25.78125 L 20 28 C 20 29.835938 20.378906 31.28125 21.1875 32.375 C 21.996094 33.46875 23.191406 34.132813 24.5 34.5 C 27.117188 35.230469 30.386719 35 34 35 C 37.648438 35 41.457031 35.042969 44.53125 34.09375 C 46.070313 33.621094 47.441406 32.863281 48.4375 31.6875 C 49.433594 30.511719 50 28.933594 50 27 C 50 26.726563 49.898438 26.484375 49.875 26.21875 C 49.871094 26.1875 49.878906 26.15625 49.875 26.125 C 49.898438 25.933594 49.867188 25.738281 49.78125 25.5625 C 49.773438 25.53125 49.761719 25.5 49.75 25.46875 C 49.167969 22.3125 46.96875 19.578125 43.90625 17.625 C 42.550781 16.757813 40.929688 16.167969 39.3125 15.59375 C 39.125 15.375 38.851563 15.25 38.5625 15.25 C 38.554688 15.246094 38.539063 15.253906 38.53125 15.25 C 36.132813 14.496094 33.601563 14 31 14 C 30.648438 14 30.328125 14.03125 30 14.0625 L 30 12.15625 L 48.1875 13 C 49.195313 13 50 12.328125 50 11.5 C 50 10.671875 49.195313 10 48.1875 10 L 30 10.84375 L 30 10 C 30.011719 9.710938 29.894531 9.433594 29.6875 9.238281 C 29.476563 9.039063 29.191406 8.941406 28.90625 8.96875 Z M 31 16 C 32.101563 16 33.164063 16.28125 34.25 16.4375 C 34.011719 16.617188 33.699219 16.664063 33.5 16.90625 C 32.324219 18.347656 32 20.550781 32 24.25 C 32 25.503906 32.433594 26.710938 33.3125 27.59375 C 34.191406 28.476563 35.488281 29 37 29 C 41.09375 29 43.75 28.867188 45.65625 28.53125 C 46.535156 28.378906 47.257813 28.152344 47.875 27.875 C 47.742188 28.929688 47.433594 29.785156 46.90625 30.40625 C 46.230469 31.199219 45.238281 31.753906 43.9375 32.15625 C 41.335938 32.957031 37.648438 33 34 33 C 30.3125 33 27.085938 33.167969 25.03125 32.59375 C 24.003906 32.308594 23.300781 31.882813 22.8125 31.21875 C 22.324219 30.554688 22 29.554688 22 28 L 22 25 C 22 24.542969 21.691406 24.144531 21.25 24.03125 C 18.007813 23.238281 13.980469 22.1875 10.75 21.34375 C 9.136719 20.921875 7.722656 20.550781 6.6875 20.28125 C 6.222656 20.160156 5.855469 20.074219 5.5625 20 L 23.625 20 C 23.945313 20.003906 24.246094 19.851563 24.4375 19.59375 C 25.992188 17.429688 27.59375 16 31 16 Z M 5 17 C 5.882813 17 6.671875 17.398438 7.21875 18 L 4.78125 18 C 4.257813 18 3.769531 18.253906 3.46875 18.59375 C 3.167969 18.933594 3.007813 19.339844 2.96875 19.75 C 2.929688 20.160156 3.023438 20.601563 3.28125 21 C 3.53125 21.382813 3.976563 21.683594 4.46875 21.78125 C 4.492188 21.789063 4.554688 21.800781 4.59375 21.8125 C 4.675781 21.832031 4.789063 21.867188 4.9375 21.90625 C 5.234375 21.984375 5.671875 22.082031 6.1875 22.21875 C 6.347656 22.261719 6.636719 22.328125 6.8125 22.375 C 6.304688 22.757813 5.6875 23 5 23 C 3.332031 23 2 21.667969 2 20 C 2 18.332031 3.332031 17 5 17 Z M 38.25 17.28125 C 39.898438 17.828125 41.511719 18.464844 42.84375 19.3125 C 45.515625 21.015625 47.261719 23.203125 47.78125 25.59375 C 47.300781 26.007813 46.683594 26.320313 45.3125 26.5625 C 43.644531 26.855469 41.054688 27 37 27 C 35.925781 27 35.226563 26.667969 34.75 26.1875 C 34.273438 25.707031 34 25.042969 34 24.25 C 34 20.699219 34.457031 18.898438 35.0625 18.15625 C 35.363281 17.785156 35.691406 17.613281 36.25 17.46875 C 36.734375 17.34375 37.464844 17.292969 38.25 17.28125 Z M 48.09375 34.96875 C 48.019531 34.972656 47.945313 34.980469 47.875 35 C 47.503906 35.085938 47.210938 35.378906 47.125 35.75 C 47.128906 35.742188 47.105469 35.738281 47.09375 35.78125 C 47.070313 35.808594 46.992188 35.894531 46.65625 36.0625 C 45.925781 36.425781 44.121094 36.9375 40.375 36.9375 L 19.21875 36.9375 C 18.859375 36.933594 18.523438 37.121094 18.339844 37.433594 C 18.160156 37.746094 18.160156 38.128906 18.339844 38.441406 C 18.523438 38.753906 18.859375 38.941406 19.21875 38.9375 L 40.375 38.9375 C 44.289063 38.9375 46.359375 38.441406 47.5625 37.84375 C 48.164063 37.542969 48.546875 37.222656 48.78125 36.875 C 48.898438 36.703125 48.988281 36.523438 49.03125 36.375 C 49.074219 36.226563 49.0625 36.03125 49.0625 36.03125 C 49.078125 35.761719 48.984375 35.496094 48.804688 35.292969 C 48.621094 35.09375 48.363281 34.976563 48.09375 34.96875 Z " fill="#ffffff"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.7 KiB |
6
src/GUI/assets/icons8-rocket.svg
Normal file
6
src/GUI/assets/icons8-rocket.svg
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" version="1.1" fill="#ffffff" width="50px" height="50px">
|
||||
<g id="surface1" fill="#ffffff">
|
||||
<path style=" " d="M 49.03125 0.96875 L 47.96875 1 C 47.96875 1 40.617188 1.097656 33.53125 4.625 C 31.253906 5.761719 28.964844 7.320313 26.90625 9.375 C 24.371094 11.910156 20.792969 16.070313 17.53125 20 L 9 20 C 8.96875 20 8.9375 20 8.90625 20 C 8.636719 20.027344 8.386719 20.160156 8.21875 20.375 L 3.21875 26.375 C 3.007813 26.640625 2.941406 26.996094 3.050781 27.316406 C 3.15625 27.636719 3.421875 27.882813 3.75 27.96875 L 9.84375 29.5 C 9.796875 29.558594 9.5 29.9375 9.5 29.9375 L 9.375 30.0625 L 9.3125 30.25 C 9.3125 30.25 9.226563 30.601563 9.25 30.9375 C 9.257813 31.0625 9.28125 31.226563 9.3125 31.375 L 7.15625 35 C 7.15625 35 7.058594 35.195313 7.03125 35.3125 C 7.003906 35.429688 6.996094 35.574219 7 35.71875 C 7.007813 36.007813 7.078125 36.332031 7.25 36.71875 C 7.59375 37.492188 8.328125 38.515625 9.90625 40.09375 C 11.484375 41.667969 12.503906 42.40625 13.28125 42.75 C 13.667969 42.921875 13.992188 42.992188 14.28125 43 C 14.425781 43.003906 14.570313 42.996094 14.6875 42.96875 C 14.804688 42.941406 15 42.84375 15 42.84375 L 18.65625 40.6875 C 18.792969 40.714844 18.949219 40.742188 19.0625 40.75 C 19.398438 40.773438 19.75 40.6875 19.75 40.6875 L 19.9375 40.625 L 20.09375 40.5 C 20.09375 40.5 20.449219 40.226563 20.5 40.1875 L 22.03125 46.25 C 22.117188 46.578125 22.363281 46.84375 22.683594 46.949219 C 23.003906 47.058594 23.359375 46.992188 23.625 46.78125 L 29.625 41.78125 C 29.863281 41.589844 30 41.304688 30 41 L 30 32.4375 C 33.957031 29.148438 38.144531 25.574219 40.625 23.09375 C 42.671875 21.042969 44.207031 18.75 45.34375 16.46875 C 48.855469 9.394531 49 2.03125 49 2.03125 Z M 46.875 3.125 C 46.792969 4.628906 46.398438 9.875 43.5625 15.59375 C 42.507813 17.714844 41.09375 19.8125 39.21875 21.6875 C 36.78125 24.125 32.492188 27.78125 28.5 31.09375 C 28.417969 31.144531 28.34375 31.207031 28.28125 31.28125 C 23.605469 35.15625 19.386719 38.511719 19.125 38.71875 C 19.007813 38.707031 18.824219 38.695313 18.5 38.5625 C 17.753906 38.257813 16.445313 37.476563 14.5 35.53125 C 12.554688 33.585938 11.742188 32.246094 11.4375 31.5 C 11.304688 31.175781 11.292969 30.992188 11.28125 30.875 C 11.488281 30.613281 14.796875 26.441406 18.65625 21.78125 C 18.761719 21.695313 18.84375 21.589844 18.90625 21.46875 C 22.183594 17.515625 25.816406 13.277344 28.3125 10.78125 C 30.195313 8.898438 32.289063 7.496094 34.40625 6.4375 C 40.132813 3.589844 45.375 3.203125 46.875 3.125 Z M 34 11 C 31.25 11 29 13.25 29 16 C 29 18.75 31.25 21 34 21 C 36.75 21 39 18.75 39 16 C 39 13.25 36.75 11 34 11 Z M 34 13 C 35.667969 13 37 14.332031 37 16 C 37 17.667969 35.667969 19 34 19 C 32.332031 19 31 17.667969 31 16 C 31 14.332031 32.332031 13 34 13 Z M 9.46875 22 L 15.875 22 C 13.957031 24.339844 12.378906 26.328125 11.21875 27.78125 L 5.78125 26.40625 Z M 10.3125 33.59375 C 10.882813 34.507813 11.71875 35.59375 13.0625 36.9375 C 14.402344 38.277344 15.492188 39.117188 16.40625 39.6875 L 14.25 40.96875 C 14.21875 40.960938 14.222656 40.964844 14.09375 40.90625 C 13.683594 40.726563 12.789063 40.160156 11.3125 38.6875 C 9.839844 37.210938 9.273438 36.316406 9.09375 35.90625 C 9.035156 35.777344 9.039063 35.78125 9.03125 35.75 Z M 28 34.125 L 28 40.53125 L 23.59375 44.21875 L 22.21875 38.8125 C 23.667969 37.652344 25.636719 36.070313 28 34.125 Z M 6.40625 38.21875 C 4.773438 39.472656 3.296875 39.632813 1.96875 40.9375 C 1.304688 41.589844 0.777344 42.515625 0.46875 43.78125 C 0.160156 45.046875 0.03125 46.679688 0.03125 48.96875 L 0.03125 49.96875 L 1.03125 49.96875 C 5.625 49.96875 7.871094 49.242188 9.21875 47.875 C 10.566406 46.507813 10.789063 44.984375 11.8125 43.59375 L 10.1875 42.40625 C 8.890625 44.171875 8.601563 45.636719 7.78125 46.46875 C 7.058594 47.203125 5.449219 47.742188 2.125 47.875 C 2.175781 46.421875 2.246094 45.027344 2.4375 44.25 C 2.6875 43.238281 2.992188 42.75 3.375 42.375 C 4.136719 41.625 5.628906 41.289063 7.59375 39.78125 Z M 14.09375 41.0625 L 14 41.125 L 14 41.09375 C 14 41.09375 14.054688 41.078125 14.09375 41.0625 Z " fill="#ffffff"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.2 KiB |
|
@ -74,7 +74,7 @@ Rectangle {
|
|||
anchors.bottom: parent.bottom
|
||||
enabled: _launcher.canFly
|
||||
disabledText: qsTr("The selected aircraft is not installed or has updates pending")
|
||||
icon: "qrc:///svg/toolbox-fly"
|
||||
icon: _launcher.flyIconUrl
|
||||
onClicked: _launcher.fly();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,5 +137,7 @@
|
|||
<file alias="toolbox-addons">assets/icons8-puzzle.svg</file>
|
||||
<file alias="toolbox-summary">assets/icons8-home.svg</file>
|
||||
<file alias="toolbox-aircraft">assets/icons8-aircraft.svg</file>
|
||||
<file alias="toolbox-fly-alt">assets/icons8-rocket.svg</file>
|
||||
<file alias="toolbox-fly-heli">assets/icons8-helicopter.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Loading…
Add table
Reference in a new issue