Launcher UI feedback: mark history buttons as disabled
This commit is contained in:
parent
8a390dab2a
commit
7431fb12b3
7 changed files with 36 additions and 3 deletions
|
@ -28,6 +28,11 @@ QUrl RecentAircraftModel::uriAt(int index) const
|
|||
return m_data.at(index);
|
||||
}
|
||||
|
||||
bool RecentAircraftModel::isEmpty() const
|
||||
{
|
||||
return m_data.empty();
|
||||
}
|
||||
|
||||
QVariant RecentAircraftModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
const QUrl uri = m_data.at(index.row());
|
||||
|
@ -89,4 +94,6 @@ void RecentAircraftModel::insert(QUrl aircraftUrl)
|
|||
m_data = m_data.mid(0, MAX_RECENT_AIRCRAFT);
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
emit isEmptyChanged();
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ class AircraftItemModel;
|
|||
class RecentAircraftModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(bool isEmpty READ isEmpty NOTIFY isEmptyChanged)
|
||||
public:
|
||||
RecentAircraftModel(AircraftItemModel *acModel, QObject* pr = nullptr);
|
||||
|
||||
|
@ -26,6 +28,12 @@ public:
|
|||
void saveToSettings();
|
||||
|
||||
Q_INVOKABLE QUrl uriAt(int index) const;
|
||||
|
||||
bool isEmpty() const;
|
||||
|
||||
signals:
|
||||
void isEmptyChanged();
|
||||
|
||||
private:
|
||||
AircraftItemModel* m_aircraftModel;
|
||||
QList<QUrl> m_data;
|
||||
|
|
|
@ -24,6 +24,11 @@ QVariantMap RecentLocationsModel::locationAt(int index) const
|
|||
return m_data.at(index).toMap();
|
||||
}
|
||||
|
||||
bool RecentLocationsModel::isEmpty() const
|
||||
{
|
||||
return m_data.empty();
|
||||
}
|
||||
|
||||
QVariant RecentLocationsModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
const QVariantMap loc = m_data.at(index.row()).toMap();
|
||||
|
@ -88,4 +93,6 @@ void RecentLocationsModel::insert(QVariant location)
|
|||
m_data = m_data.mid(0, MAX_RECENT_LOCATIONS);
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
emit isEmptyChanged();
|
||||
}
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
class RecentLocationsModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(bool isEmpty READ isEmpty NOTIFY isEmptyChanged)
|
||||
|
||||
public:
|
||||
RecentLocationsModel(QObject* pr = nullptr);
|
||||
|
||||
|
@ -24,6 +27,12 @@ public:
|
|||
void saveToSettings();
|
||||
|
||||
Q_INVOKABLE QVariantMap locationAt(int index) const;
|
||||
|
||||
bool isEmpty() const;
|
||||
|
||||
signals:
|
||||
void isEmptyChanged();
|
||||
|
||||
private:
|
||||
QVariantList m_data;
|
||||
};
|
||||
|
|
|
@ -34,7 +34,7 @@ Item {
|
|||
MouseArea {
|
||||
anchors.fill: parent
|
||||
id: mouse
|
||||
hoverEnabled: true
|
||||
hoverEnabled: root.enabled
|
||||
enabled: root.enabled
|
||||
onClicked: {
|
||||
var screenPos = _launcher.mapToGlobal(button, Qt.point(-popupFrame.width, 0))
|
||||
|
|
|
@ -28,6 +28,6 @@ QtObject
|
|||
|
||||
readonly property string disabledTextColor: "#5f5f5f"
|
||||
|
||||
readonly property double panelOpacity: 0.8
|
||||
readonly property double panelOpacity: 0.5
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ Item {
|
|||
color: "white"
|
||||
opacity: Style.panelOpacity
|
||||
// radius: Style.roundRadius
|
||||
border.width: 1
|
||||
border.width: 2
|
||||
border.color: Style.frameColor
|
||||
|
||||
anchors {
|
||||
|
@ -154,6 +154,7 @@ Item {
|
|||
HistoryPopup {
|
||||
id: aircraftHistoryPopup
|
||||
model: _launcher.aircraftHistory
|
||||
enabled: !_launcher.aircraftHistory.isEmpty
|
||||
onSelected: {
|
||||
_launcher.selectedAircraft = _launcher.aircraftHistory.uriAt(index)
|
||||
}
|
||||
|
@ -267,6 +268,7 @@ Item {
|
|||
HistoryPopup {
|
||||
id: locationHistoryPopup
|
||||
model: _launcher.locationHistory
|
||||
enabled: !_launcher.aircraftHistory.isEmpty
|
||||
onSelected: {
|
||||
_launcher.restoreLocation(_launcher.locationHistory.locationAt(index))
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue