mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-18 06:30:55 +00:00
Fix crash on the placeholder icon and fix display of multiple PCs
This commit is contained in:
+10
-3
@@ -4,9 +4,15 @@ import QtQuick.Controls 2.2
|
|||||||
import ComputerModel 1.0
|
import ComputerModel 1.0
|
||||||
|
|
||||||
Frame {
|
Frame {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
GridView {
|
GridView {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cellWidth: 200; cellHeight: 300;
|
anchors.leftMargin: 5
|
||||||
|
anchors.topMargin: 5
|
||||||
|
anchors.rightMargin: 5
|
||||||
|
anchors.bottomMargin: 5
|
||||||
|
cellWidth: 350; cellHeight: 350;
|
||||||
focus: true
|
focus: true
|
||||||
|
|
||||||
model: ComputerModel {}
|
model: ComputerModel {}
|
||||||
@@ -16,7 +22,7 @@ Frame {
|
|||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: pcIcon
|
id: pcIcon
|
||||||
y: 10; anchors.horizontalCenter: parent.horizontalCenter;
|
anchors.horizontalCenter: parent.horizontalCenter;
|
||||||
source: {
|
source: {
|
||||||
model.addPc ? "ic_add_to_queue_white_48px.svg" : "ic_tv_white_48px.svg"
|
model.addPc ? "ic_add_to_queue_white_48px.svg" : "ic_tv_white_48px.svg"
|
||||||
}
|
}
|
||||||
@@ -34,7 +40,7 @@ Frame {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
anchors.top: pcIcon.bottom
|
anchors.top: pcIcon.bottom
|
||||||
minimumPointSize: 12
|
minimumPointSize: 12
|
||||||
font.pointSize: 36
|
font.pointSize: 48
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
fontSizeMode: Text.HorizontalFit
|
fontSizeMode: Text.HorizontalFit
|
||||||
}
|
}
|
||||||
@@ -63,6 +69,7 @@ Frame {
|
|||||||
|
|
||||||
id: pcPairedText
|
id: pcPairedText
|
||||||
text: getStatusText(model)
|
text: getStatusText(model)
|
||||||
|
visible: !model.addPc
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
anchors.top: pcNameText.bottom
|
anchors.top: pcNameText.bottom
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ QVariant ComputerModel::data(const QModelIndex& index, int role) const
|
|||||||
return "Add PC";
|
return "Add PC";
|
||||||
case AddPcRole:
|
case AddPcRole:
|
||||||
return true;
|
return true;
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (index.row() > m_Computers.count()) {
|
else if (index.row() > m_Computers.count()) {
|
||||||
@@ -69,6 +71,7 @@ QHash<int, QByteArray> ComputerModel::roleNames() const
|
|||||||
names[OnlineRole] = "online";
|
names[OnlineRole] = "online";
|
||||||
names[PairedRole] = "paired";
|
names[PairedRole] = "paired";
|
||||||
names[BusyRole] = "busy";
|
names[BusyRole] = "busy";
|
||||||
|
names[AddPcRole] = "addPc";
|
||||||
|
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user