From 64ea29dd39b337a83b4a5e322e4b55388564d185 Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Fri, 23 Feb 2018 21:40:37 +0100 Subject: [PATCH] Don't show message window again once it was hidden The message window was shown again after a new message. --- src/xswiftbus/messages.cpp | 7 +++---- src/xswiftbus/service.cpp | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xswiftbus/messages.cpp b/src/xswiftbus/messages.cpp index af1898411..935712444 100644 --- a/src/xswiftbus/messages.cpp +++ b/src/xswiftbus/messages.cpp @@ -83,7 +83,9 @@ namespace XSwiftBus m_scrollToTopCommand("org/swift-project/xswiftbus/scroll_top", "Scroll to top of XSwiftBus text messages", [this] { scrollToTop(); }), m_scrollToBottomCommand("org/swift-project/xswiftbus/scroll_bottom", "Scroll to bottom of XSwiftBus text messages", [this] { scrollToBottom(); }), m_debugCommand("org/swift-project/xswiftbus/debug", "", [this] { static int c = 0; this->addMessage({ "hello " + std::to_string(c++), 0, .75, 0 }); }) - {} + { + show(); + } void CMessageBoxControl::addMessage(const CMessage &message) { @@ -91,7 +93,6 @@ namespace XSwiftBus m_messages.push_back(message); if (m_position + 1 >= m_messages.size() || ! m_visible) { - show(); scrollToBottom(); } } @@ -128,8 +129,6 @@ namespace XSwiftBus void CMessageBoxControl::scrollToBottom() { - if (! m_visible) { return; } - m_position = m_messages.size(); updateVisibleLines(); } diff --git a/src/xswiftbus/service.cpp b/src/xswiftbus/service.cpp index b89079ba6..4f33af5ff 100644 --- a/src/xswiftbus/service.cpp +++ b/src/xswiftbus/service.cpp @@ -21,6 +21,7 @@ namespace XSwiftBus CService::CService(QObject *parent) : QObject(parent) { + m_messages.addMessage( { "xswiftbus started.", 0, 255, 255 } ); m_airportUpdater = new QTimer(this); m_airportUpdater->start(60000); connect(m_airportUpdater, &QTimer::timeout, this, &CService::updateAirportsInRange);