gui: fix ghost process, null block.reaction crash, window counter
This commit is contained in:
parent
c5a5c0c9b9
commit
9cf63f67b4
|
|
@ -692,20 +692,20 @@ Item {
|
|||
anchors.right: parent.right
|
||||
anchors.margins: 4
|
||||
z: 10
|
||||
text: block.reaction || ""
|
||||
text: block ? (block.reaction || "") : ""
|
||||
font.pixelSize: 18
|
||||
visible: block.reaction !== ""
|
||||
visible: block ? block.reaction !== "" : false
|
||||
}
|
||||
|
||||
// Reaction buttons (hover only, hidden when already reacted)
|
||||
Row {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: block.reaction !== "" ? 36 : 4
|
||||
anchors.rightMargin: block && block.reaction !== "" ? 36 : 4
|
||||
anchors.margins: 4
|
||||
z: 10
|
||||
spacing: 2
|
||||
opacity: (assistantHover.hovered && block.reaction === "") ? 0.9 : 0
|
||||
opacity: (assistantHover.hovered && (block ? block.reaction : "") === "") ? 0.9 : 0
|
||||
Behavior on opacity { NumberAnimation { duration: 150 } }
|
||||
|
||||
Repeater {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,16 @@ ApplicationWindow {
|
|||
height: 600
|
||||
visible: true
|
||||
|
||||
Component.onCompleted: activator.windowOpened()
|
||||
|
||||
Component.onDestruction: {
|
||||
activator.windowClosed()
|
||||
if (activator.windowCount === 0
|
||||
&& !(theme.closeToTray && systemTrayAvailable)) {
|
||||
Qt.quit()
|
||||
}
|
||||
}
|
||||
|
||||
onClosing: {
|
||||
if (theme.closeToTray && systemTrayAvailable) {
|
||||
close.accepted = false
|
||||
|
|
|
|||
|
|
@ -27,12 +27,16 @@ public:
|
|||
explicit GuiActivator(QQmlApplicationEngine *engine, QObject *parent = nullptr)
|
||||
: QObject(parent)
|
||||
, m_engine(engine)
|
||||
, m_windowCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
void setWindowUrl(const QUrl &url) { m_url = url; }
|
||||
int windowCount() const { return m_windowCount; }
|
||||
|
||||
public slots:
|
||||
void windowOpened() { ++m_windowCount; }
|
||||
void windowClosed() { if (m_windowCount > 0) --m_windowCount; }
|
||||
void Activate()
|
||||
{
|
||||
const auto roots = m_engine->rootObjects();
|
||||
|
|
@ -65,6 +69,7 @@ public slots:
|
|||
private:
|
||||
QQmlApplicationEngine *m_engine;
|
||||
QUrl m_url;
|
||||
int m_windowCount;
|
||||
};
|
||||
|
||||
static QIcon makeBrainIcon()
|
||||
|
|
|
|||
15
gui/main.qml
15
gui/main.qml
|
|
@ -10,6 +10,8 @@ ApplicationWindow {
|
|||
height: 600
|
||||
visible: true
|
||||
|
||||
Component.onCompleted: activator.windowOpened()
|
||||
|
||||
onClosing: function(close) {
|
||||
if (theme.closeToTray && systemTrayAvailable) {
|
||||
close.accepted = false
|
||||
|
|
@ -17,6 +19,12 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
if (typeof activator !== 'undefined' && activator) {
|
||||
activator.windowClosed()
|
||||
}
|
||||
}
|
||||
|
||||
color: palette.window
|
||||
font.family: theme.fontFamily || Qt.application.font.family
|
||||
font.pointSize: theme.fontSize > 0 ? theme.fontSize : Qt.application.font.pointSize
|
||||
|
|
@ -290,6 +298,13 @@ ApplicationWindow {
|
|||
visible: false
|
||||
color: palette.window
|
||||
|
||||
Component.onCompleted: activator.windowOpened()
|
||||
Component.onDestruction: {
|
||||
if (typeof activator !== 'undefined' && activator) {
|
||||
activator.windowClosed()
|
||||
}
|
||||
}
|
||||
|
||||
SessionGraph {
|
||||
id: graphView
|
||||
anchors.fill: parent
|
||||
|
|
|
|||
Reference in New Issue