mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +08:00
GUI improvements found during #707
* logs only screen in core as default * find top window, only use Qt::WA_TranslucentBackground on top level (Qt 5.6.1) * correct presize when insert * resize ATC when first station is added
This commit is contained in:
@@ -67,7 +67,6 @@ namespace BlackGui
|
|||||||
// set station mode
|
// set station mode
|
||||||
this->ui->tvp_AtcStationsOnline->setStationMode(CAtcStationListModel::StationsOnline);
|
this->ui->tvp_AtcStationsOnline->setStationMode(CAtcStationListModel::StationsOnline);
|
||||||
this->ui->tvp_AtcStationsBooked->setStationMode(CAtcStationListModel::StationsBooked);
|
this->ui->tvp_AtcStationsBooked->setStationMode(CAtcStationListModel::StationsBooked);
|
||||||
this->ui->tvp_AtcStationsBooked->setResizeMode(CAtcStationView::ResizingOnce);
|
|
||||||
|
|
||||||
// header
|
// header
|
||||||
this->ui->tvp_AtcStationsOnlineTree->setHeaderHidden(true);
|
this->ui->tvp_AtcStationsOnlineTree->setHeaderHidden(true);
|
||||||
@@ -146,11 +145,12 @@ namespace BlackGui
|
|||||||
// update
|
// update
|
||||||
if (this->m_timestampOnlineStationsChanged > this->m_timestampLastReadOnlineStations)
|
if (this->m_timestampOnlineStationsChanged > this->m_timestampLastReadOnlineStations)
|
||||||
{
|
{
|
||||||
this->ui->tvp_AtcStationsOnline->updateContainerMaybeAsync(
|
const CAtcStationList onlineStations =
|
||||||
// test: filter by frequency, see if this is better
|
// test: filter by frequency, see if this is better
|
||||||
// sGui->getIContextNetwork()->getAtcStationsOnline().stationsWithValidVoiceRoom()
|
// sGui->getIContextNetwork()->getAtcStationsOnline().stationsWithValidVoiceRoom()
|
||||||
sGui->getIContextNetwork()->getAtcStationsOnline().stationsWithValidFrequency()
|
sGui->getIContextNetwork()->getAtcStationsOnline().stationsWithValidFrequency();
|
||||||
);
|
|
||||||
|
this->ui->tvp_AtcStationsOnline->updateContainerMaybeAsync(onlineStations);
|
||||||
this->m_timestampLastReadOnlineStations = QDateTime::currentDateTimeUtc();
|
this->m_timestampLastReadOnlineStations = QDateTime::currentDateTimeUtc();
|
||||||
this->m_timestampOnlineStationsChanged = this->m_timestampLastReadOnlineStations;
|
this->m_timestampOnlineStationsChanged = this->m_timestampLastReadOnlineStations;
|
||||||
this->updateTreeView();
|
this->updateTreeView();
|
||||||
@@ -165,6 +165,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CAtcStationComponent::changedAtcStationOnlineConnectionStatus(const CAtcStation &station, bool added)
|
void CAtcStationComponent::changedAtcStationOnlineConnectionStatus(const CAtcStation &station, bool added)
|
||||||
{
|
{
|
||||||
|
// trick here is, we want to display a station ASAP
|
||||||
this->ui->tvp_AtcStationsOnline->changedAtcStationConnectionStatus(station, added);
|
this->ui->tvp_AtcStationsOnline->changedAtcStationConnectionStatus(station, added);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,8 +282,8 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CAtcStationComponent::updateTreeView()
|
void CAtcStationComponent::updateTreeView()
|
||||||
{
|
{
|
||||||
// EXPERIMENTAL CODE
|
//
|
||||||
//! \todo change model so we can directly use hierarchies
|
//! \todo EXPERIMENTAL CODE: change model so we can directly use hierarchies
|
||||||
QAbstractItemModel *old = (this->ui->tvp_AtcStationsOnlineTree->model());
|
QAbstractItemModel *old = (this->ui->tvp_AtcStationsOnlineTree->model());
|
||||||
this->ui->tvp_AtcStationsOnlineTree->setModel(
|
this->ui->tvp_AtcStationsOnlineTree->setModel(
|
||||||
this->ui->tvp_AtcStationsOnline->derivedModel()->toAtcGroupModel()
|
this->ui->tvp_AtcStationsOnline->derivedModel()->toAtcGroupModel()
|
||||||
|
|||||||
@@ -70,6 +70,11 @@ namespace BlackGui
|
|||||||
if (attention) { emit requestAttention(); }
|
if (attention) { emit requestAttention(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CLogComponent::showDetails(bool details)
|
||||||
|
{
|
||||||
|
ui->form_StatusMessage->setVisible(details);
|
||||||
|
}
|
||||||
|
|
||||||
void CLogComponent::appendStatusMessageToConsole(const CStatusMessage &statusMessage)
|
void CLogComponent::appendStatusMessageToConsole(const CStatusMessage &statusMessage)
|
||||||
{
|
{
|
||||||
if (statusMessage.isEmpty()) return;
|
if (statusMessage.isEmpty()) return;
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ namespace BlackGui
|
|||||||
//! Display console
|
//! Display console
|
||||||
void displayConsole(bool attention = false);
|
void displayConsole(bool attention = false);
|
||||||
|
|
||||||
|
//! Show log details
|
||||||
|
void showDetails(bool details);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Make me visible
|
//! Make me visible
|
||||||
void requestAttention();
|
void requestAttention();
|
||||||
|
|||||||
@@ -8,10 +8,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "blackgui/enableforframelesswindow.h"
|
#include "blackgui/enableforframelesswindow.h"
|
||||||
|
#include "blackgui/guiutility.h"
|
||||||
#include "blackmisc/icons.h"
|
#include "blackmisc/icons.h"
|
||||||
#include "blackmisc/stringutils.h"
|
#include "blackmisc/stringutils.h"
|
||||||
#include "blackmisc/worker.h"
|
#include "blackmisc/worker.h"
|
||||||
|
|
||||||
|
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QFlags>
|
#include <QFlags>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
@@ -110,7 +112,12 @@ namespace BlackGui
|
|||||||
bool frameless = (mode == WindowFrameless);
|
bool frameless = (mode == WindowFrameless);
|
||||||
// http://stackoverflow.com/questions/18316710/frameless-and-transparent-window-qt5
|
// http://stackoverflow.com/questions/18316710/frameless-and-transparent-window-qt5
|
||||||
this->m_widget->setAttribute(Qt::WA_NoSystemBackground, frameless);
|
this->m_widget->setAttribute(Qt::WA_NoSystemBackground, frameless);
|
||||||
this->m_widget->setAttribute(Qt::WA_TranslucentBackground, frameless);
|
|
||||||
|
// https://bugreports.qt.io/browse/QTBUG-52206
|
||||||
|
if (CGuiUtility::isTopLevelWidget(this->m_widget))
|
||||||
|
{
|
||||||
|
this->m_widget->setAttribute(Qt::WA_TranslucentBackground, frameless);
|
||||||
|
}
|
||||||
|
|
||||||
// Qt::WA_PaintOnScreen leads to a warning
|
// Qt::WA_PaintOnScreen leads to a warning
|
||||||
// setMask(QRegion(10, 10, 10, 10) would work, but requires "complex" calcs for rounded corners
|
// setMask(QRegion(10, 10, 10, 10) would work, but requires "complex" calcs for rounded corners
|
||||||
|
|||||||
@@ -339,4 +339,9 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CGuiUtility::isTopLevelWidget(QWidget *widget)
|
||||||
|
{
|
||||||
|
return QApplication::topLevelWidgets().contains(widget);
|
||||||
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -104,6 +104,9 @@ namespace BlackGui
|
|||||||
//! Only the row part and unique (so no rows is twice in the list)
|
//! Only the row part and unique (so no rows is twice in the list)
|
||||||
static QList<int> indexToUniqueRows(const QModelIndexList &indexes);
|
static QList<int> indexToUniqueRows(const QModelIndexList &indexes);
|
||||||
|
|
||||||
|
//! Is top level widget?
|
||||||
|
static bool isTopLevelWidget(QWidget *widget);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Constructor, use static methods only
|
//! Constructor, use static methods only
|
||||||
CGuiUtility() {}
|
CGuiUtility() {}
|
||||||
|
|||||||
@@ -44,7 +44,12 @@ namespace BlackGui
|
|||||||
void CAtcStationView::changedAtcStationConnectionStatus(const CAtcStation &station, bool added)
|
void CAtcStationView::changedAtcStationConnectionStatus(const CAtcStation &station, bool added)
|
||||||
{
|
{
|
||||||
this->m_model->changedAtcStationConnectionStatus(station, added);
|
this->m_model->changedAtcStationConnectionStatus(station, added);
|
||||||
this->resizeToContents();
|
|
||||||
|
// resize the first, rest will be resized with normal updates
|
||||||
|
if (this->rowCount() == 1)
|
||||||
|
{
|
||||||
|
this->fullResizeToContents();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAtcStationView::customMenu(CMenuActions &menuActions)
|
void CAtcStationView::customMenu(CMenuActions &menuActions)
|
||||||
@@ -87,6 +92,5 @@ namespace BlackGui
|
|||||||
if (s.getCallsign().isEmpty()) { return; }
|
if (s.getCallsign().isEmpty()) { return; }
|
||||||
emit this->requestTextMessageWidget(s.getCallsign());
|
emit this->requestTextMessageWidget(s.getCallsign());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -806,16 +806,32 @@ namespace BlackGui
|
|||||||
void CViewBase<ModelClass, ContainerType, ObjectType>::insert(const ObjectType &value, bool resize)
|
void CViewBase<ModelClass, ContainerType, ObjectType>::insert(const ObjectType &value, bool resize)
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_model);
|
Q_ASSERT(this->m_model);
|
||||||
this->m_model->insert(value);
|
if (this->rowCount() < 1)
|
||||||
if (resize) { this->performModeBasedResizeToContent(); }
|
{
|
||||||
|
// this allows presizing
|
||||||
|
this->updateContainerMaybeAsync(ContainerType({value}), true, resize);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->m_model->insert(value);
|
||||||
|
if (resize) { this->performModeBasedResizeToContent(); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ModelClass, class ContainerType, class ObjectType>
|
template <class ModelClass, class ContainerType, class ObjectType>
|
||||||
void CViewBase<ModelClass, ContainerType, ObjectType>::insert(const ContainerType &container, bool resize)
|
void CViewBase<ModelClass, ContainerType, ObjectType>::insert(const ContainerType &container, bool resize)
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_model);
|
Q_ASSERT(this->m_model);
|
||||||
this->m_model->insert(container);
|
if (this->rowCount() < 1)
|
||||||
if (resize) { this->performModeBasedResizeToContent(); }
|
{
|
||||||
|
// this allows presizing
|
||||||
|
this->updateContainerMaybeAsync(container, true, resize);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->m_model->insert(container);
|
||||||
|
if (resize) { this->performModeBasedResizeToContent(); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ModelClass, class ContainerType, class ObjectType>
|
template <class ModelClass, class ContainerType, class ObjectType>
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ void CSwiftCore::initSlots()
|
|||||||
|
|
||||||
void CSwiftCore::initLogDisplay()
|
void CSwiftCore::initLogDisplay()
|
||||||
{
|
{
|
||||||
|
this->m_mwaLogComponent->showDetails(false);
|
||||||
CLogHandler::instance()->install(true);
|
CLogHandler::instance()->install(true);
|
||||||
CLogHandler::instance()->enableConsoleOutput(false); // default disable
|
CLogHandler::instance()->enableConsoleOutput(false); // default disable
|
||||||
auto logHandler = CLogHandler::instance()->handlerForPattern(
|
auto logHandler = CLogHandler::instance()->handlerForPattern(
|
||||||
|
|||||||
Reference in New Issue
Block a user