diff --git a/src/blackgui/components/invisibleinfoareacomponent.cpp b/src/blackgui/components/invisibleinfoareacomponent.cpp deleted file mode 100644 index 26b891453..000000000 --- a/src/blackgui/components/invisibleinfoareacomponent.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (C) 2015 - * swift project Community / Contributors - * - * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level - * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, - * including this file, may be copied, modified, propagated, or distributed except according to the terms - * contained in the LICENSE file. - */ - -#include "invisibleinfoareacomponent.h" -#include "ui_invisibleinfoareacomponent.h" -#include "blackmisc/icons.h" - -using namespace BlackGui; -using namespace BlackMisc; - -namespace BlackGui -{ - namespace Components - { - - CInvisibleInfoAreaComponent::CInvisibleInfoAreaComponent(QWidget *parent) : - CInfoArea(parent), - ui(new Ui::CInvisibleInfoAreaComponent) - { - ui->setupUi(this); - - // remove widgets just required for GUI builder, but not needed for promoted component - this->ui->comp_Navigator->layout()->removeWidget(this->ui->qw_NavigatorDummy); - delete this->ui->qw_NavigatorDummy; - this->ui->qw_NavigatorDummy = nullptr; - - // init area - this->initInfoArea(); - } - - CInvisibleInfoAreaComponent::~CInvisibleInfoAreaComponent() - { } - - QSize CInvisibleInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const - { - InfoArea area = static_cast(areaIndex); - switch (area) - { - case InfoAreaNavigator: - { - return this->ui->comp_Navigator->minimumSize(); - } - default: - Q_ASSERT_X(false, Q_FUNC_INFO, "Unknown index for invisible info area"); - return QSize(0, 0); - } - } - - const QPixmap &CInvisibleInfoAreaComponent::indexToPixmap(int areaIndex) const - { - Q_UNUSED(areaIndex); - return CIcons::empty(); - } - - CNavigatorDockWidget *CInvisibleInfoAreaComponent::getNavigatorComponent() - { - return this->ui->comp_Navigator; - } - - void CInvisibleInfoAreaComponent::toggleNavigator() - { - this->ui->comp_Navigator->toggleFloating(); - } - - } // ns -} // ns diff --git a/src/blackgui/components/invisibleinfoareacomponent.h b/src/blackgui/components/invisibleinfoareacomponent.h deleted file mode 100644 index 2e0bde586..000000000 --- a/src/blackgui/components/invisibleinfoareacomponent.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2015 - * swift project Community / Contributors - * - * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level - * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, - * including this file, may be copied, modified, propagated, or distributed except according to the terms - * contained in the LICENSE file. - */ - -#ifndef BLACKGUI_COMPONENTS_INVISIBLEINFOAREACOMPONENT_H -#define BLACKGUI_COMPONENTS_INVISIBLEINFOAREACOMPONENT_H - -#include "blackgui/blackguiexport.h" -#include "blackgui/infoarea.h" -#include "blackgui/components/navigatordockwidget.h" -#include - -namespace Ui { class CInvisibleInfoAreaComponent; } - -namespace BlackGui -{ - namespace Components - { - - //! Info area to carry info areas on visibile when floating - class BLACKGUI_EXPORT CInvisibleInfoAreaComponent : public BlackGui::CInfoArea - { - Q_OBJECT - - public: - - //! Info areas - enum InfoArea - { - // index must match tab index! - InfoAreaNavigator = 0 - }; - - //! Consturctor - explicit CInvisibleInfoAreaComponent(QWidget *parent = nullptr); - - //! Destructor - ~CInvisibleInfoAreaComponent(); - - //! \copydoc CInfoArea::getPreferredSizeWhenFloating - virtual QSize getPreferredSizeWhenFloating(int areaIndex) const override; - - //! \copydoc CInfoArea::indexToPixmap - const QPixmap &indexToPixmap(int areaIndex) const override; - - //! Get navigator component - BlackGui::Components::CNavigatorDockWidget *getNavigatorComponent(); - - public slots: - //! Navigator floating - void toggleNavigator(); - - private: - QScopedPointer ui; - }; - - } // ns -} // ns - - -#endif // guard diff --git a/src/blackgui/components/invisibleinfoareacomponent.ui b/src/blackgui/components/invisibleinfoareacomponent.ui deleted file mode 100644 index 61a981fc2..000000000 --- a/src/blackgui/components/invisibleinfoareacomponent.ui +++ /dev/null @@ -1,50 +0,0 @@ - - - CInvisibleInfoAreaComponent - - - Invisible info area - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - QDockWidget::AllDockWidgetFeatures - - - Qt::LeftDockWidgetArea - - - Navigator - - - 1 - - - - - - - BlackGui::Components::CNavigatorDockWidget - QDockWidget -
blackgui/components/navigatordockwidget.h
- 1 -
-
- - -
diff --git a/src/blackgui/components/navigatordialog.cpp b/src/blackgui/components/navigatordialog.cpp index 31c9b9669..b3c36c6ca 100644 --- a/src/blackgui/components/navigatordialog.cpp +++ b/src/blackgui/components/navigatordialog.cpp @@ -9,10 +9,8 @@ #include "navigatordialog.h" #include "ui_navigatordialog.h" -#include "blackgui/infoarea.h" #include "blackgui/guiutility.h" #include "blackgui/stylesheetutility.h" - #include #include #include @@ -24,10 +22,12 @@ namespace BlackGui { namespace Components { - + // If the dialog is a normal window, it stays open when the parent is minimized + // (and the parent is null for the dialog). If the dialog is a tool winow it is always + // minimized, regardless of dialog`s parent CNavigatorDialog::CNavigatorDialog(QWidget *parent) : - QDialog(parent, Qt::Tool), - CEnableForFramelessWindow(CEnableForFramelessWindow::WindowTool, false, "NavigatorDialog", this), + QDialog(parent, modeToWindowFlags(CEnableForFramelessWindow::WindowTool)), + CEnableForFramelessWindow(CEnableForFramelessWindow::WindowTool, false, "navigatorFrameless", this), ui(new Ui::CNavigatorDialog) { ui->setupUi(this); @@ -64,7 +64,8 @@ namespace BlackGui this->ui->fr_NavigatorDialogInner->setLayout(gridLayout); int r = 0; int c = 0; - for (const auto &action : actions()) + + for (const auto &action : this->actions()) { QToolButton *tb = new QToolButton(this->ui->fr_NavigatorDialogInner); tb->setDefaultAction(action); @@ -79,7 +80,8 @@ namespace BlackGui int w = 16 * gridLayout->columnCount(); int h = 16 * gridLayout->rowCount(); - QSize min(w, h); + this->m_currentColumns = gridLayout->columnCount(); + QSize min(w + 2, h + 2); this->ui->fr_NavigatorDialogInner->setMinimumSize(min); this->setMinimumSize(min); this->adjustSize(); @@ -90,11 +92,17 @@ namespace BlackGui this->setFrameless(!this->isFrameless()); } + void CNavigatorDialog::toggleNavigator() + { + this->setVisible(!this->isVisible()); + } + void CNavigatorDialog::ps_onStyleSheetsChanged() { const QString fn(CStyleSheetUtility::fileNameNavigator()); const QString qss(CStyleSheetUtility::instance().style(fn)); this->setStyleSheet(qss); + this->repaint(); } void CNavigatorDialog::mouseMoveEvent(QMouseEvent *event) @@ -107,6 +115,27 @@ namespace BlackGui if (!handleMousePressEvent(event)) { QDialog::mousePressEvent(event); } } + void CNavigatorDialog::changeEvent(QEvent *evt) + { + QEvent::Type t = evt->type(); + if (t == QEvent::WindowStateChange) + { + evt->ignore(); + hide(); + } + else + { + QDialog::changeEvent(evt); + } + } + + void CNavigatorDialog::windowFlagsChanged() + { + if (this->m_firstBuild) { return; } + this->ps_onStyleSheetsChanged(); + this->buildNavigator(this->m_currentColumns); + } + void CNavigatorDialog::ps_showContextMenu(const QPoint &pos) { QPoint globalPos = this->mapToGlobal(pos); @@ -129,8 +158,20 @@ namespace BlackGui void CNavigatorDialog::insertOwnActions() { + // add some space for frameless navigators where I can move the navigator + QAction *a = new QAction(BlackMisc::CIcons::empty16(), "move navigator here", this); + if (this->actions().isEmpty()) + { + this->addAction(a); + } + else + { + this->insertAction(this->actions().first(), a); + } + + // close QIcon i(CIcons::changeIconBackgroundColor(this->style()->standardIcon(QStyle::SP_TitleBarCloseButton), Qt::white, QSize(16, 16))); - QAction *a = new QAction(i, "Close", this); + a = new QAction(i, "Close", this); connect(a, &QAction::triggered, this, &CNavigatorDialog::close); this->addAction(a); } @@ -145,20 +186,19 @@ namespace BlackGui void CNavigatorDialog::addToContextMenu(QMenu *contextMenu) const { - QAction *a; - a = contextMenu->addAction(CIcons::resize16(), "1 row", this, &CNavigatorDialog::ps_changeLayout); + QAction *a = contextMenu->addAction(CIcons::resize16(), "1 row", this, SLOT(ps_changeLayout())); a->setData("1r"); - a = contextMenu->addAction(CIcons::resize16(), "2 rows", this, &CNavigatorDialog::ps_changeLayout); + a = contextMenu->addAction(CIcons::resize16(), "2 rows", this, SLOT(ps_changeLayout())); a->setData("2r"); - a = contextMenu->addAction(CIcons::resize16(), "1 column", this, &CNavigatorDialog::ps_changeLayout); + a = contextMenu->addAction(CIcons::resize16(), "1 column", this, SLOT(ps_changeLayout())); a->setData("1c"); - a = contextMenu->addAction(CIcons::resize16(), "2 columns", this, &CNavigatorDialog::ps_changeLayout); + a = contextMenu->addAction(CIcons::resize16(), "2 columns", this, SLOT(ps_changeLayout())); a->setData("2c"); contextMenu->addSeparator(); QString frameLessActionText = this->isFrameless() ? "Normal window" : "Frameless"; - contextMenu->addAction(BlackMisc::CIcons::tableSheet16(), frameLessActionText, this, &CNavigatorDialog::toggleFrameless); + contextMenu->addAction(BlackMisc::CIcons::tableSheet16(), frameLessActionText, this, SLOT(toggleFrameless())); } } // ns diff --git a/src/blackgui/components/navigatordialog.h b/src/blackgui/components/navigatordialog.h index 6c9fea3a6..bd4188416 100644 --- a/src/blackgui/components/navigatordialog.h +++ b/src/blackgui/components/navigatordialog.h @@ -14,6 +14,7 @@ #include "blackgui/blackguiexport.h" #include "blackgui/enableforframelesswindow.h" +#include "blackmisc/icons.h" #include #include #include @@ -24,13 +25,12 @@ namespace BlackGui { namespace Components { - /*! - * Navigators dialog + * Navigator dialog */ class BLACKGUI_EXPORT CNavigatorDialog : - public QDialog, - public CEnableForFramelessWindow + public QDialog, + public CEnableForFramelessWindow { Q_OBJECT @@ -44,9 +44,13 @@ namespace BlackGui //! Navigator void buildNavigator(int columns); + public slots: //! Toggle frameless mode void toggleFrameless(); + //! Toggle visibility + void toggleNavigator(); + protected: //! Style sheet has changed void ps_onStyleSheetsChanged(); @@ -57,6 +61,12 @@ namespace BlackGui //! \copydoc QMainWindow::mousePressEvent virtual void mousePressEvent(QMouseEvent *event) override; + //! \copydoc QMainWindow::mousePressEvent + virtual void changeEvent(QEvent *evt) override; + + //! \copydoc CEnableForFramelessWindow::windowFlagsChanged + virtual void windowFlagsChanged() override; + private slots: //! Context menu void ps_showContextMenu(const QPoint &pos); @@ -76,8 +86,8 @@ namespace BlackGui QScopedPointer ui; bool m_firstBuild = true; + int m_currentColumns = 1; }; - } // ns } // ns diff --git a/src/blackgui/components/navigatordialog.ui b/src/blackgui/components/navigatordialog.ui index 966bc7d91..3d2672d87 100644 --- a/src/blackgui/components/navigatordialog.ui +++ b/src/blackgui/components/navigatordialog.ui @@ -6,8 +6,8 @@ 0 0 - 16 - 16 + 48 + 381 diff --git a/src/blackgui/components/navigatordockwidget.cpp b/src/blackgui/components/navigatordockwidget.cpp deleted file mode 100644 index 9a9af626a..000000000 --- a/src/blackgui/components/navigatordockwidget.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* Copyright (C) 2013 - * swift project Community / Contributors - * - * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level - * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, - * including this file, may be copied, modified, propagated, or distributed except according to the terms - * contained in the LICENSE file. - */ - -#include "navigatordockwidget.h" -#include "blackgui/infoarea.h" -#include "blackgui/guiutility.h" -#include "blackgui/stylesheetutility.h" -#include "ui_navigatordockwidget.h" - -#include -#include -#include - -using namespace BlackGui; -using namespace BlackMisc; - -namespace BlackGui -{ - namespace Components - { - CNavigatorDockWidget::CNavigatorDockWidget(QWidget *parent) : - CDockWidgetInfoArea(parent), - ui(new Ui::CNavigatorDockWidget) - { - this->allowStatusBar(false); - ui->setupUi(this); - this->ps_onStyleSheetsChanged(); - } - - CNavigatorDockWidget::~CNavigatorDockWidget() - { } - - void CNavigatorDockWidget::addAction(QAction *action) - { - if (action) - { - this->m_actions.append(action); - QToolButton *tb = new QToolButton(this->ui->fr_NavigatorDockWidgetInner); - tb->setDefaultAction(action); - tb->setObjectName(this->objectName().append(":").append(action->objectName())); - this->m_widgets.append(tb); - } - } - - void CNavigatorDockWidget::addActions(QList actions) - { - if (actions.isEmpty()) { return; } - for (QAction *a : actions) - { - this->addAction(a); - } - } - - void CNavigatorDockWidget::buildNavigator(int columns) - { - if (m_firstBuild) - { - m_firstBuild = false; - this->insertOwnActions(); - } - - // remove old layout - CGuiUtility::deleteLayout(this->ui->fr_NavigatorDockWidgetInner->layout(), false); - - // new layout - QGridLayout *gridLayout = new QGridLayout(this->ui->fr_NavigatorDockWidgetInner); - gridLayout->setObjectName("gl_CNavigatorDockWidget"); - gridLayout->setSpacing(0); - gridLayout->setMargin(0); - gridLayout->setContentsMargins(0, 0, 0, 0); - - this->ui->fr_NavigatorDockWidgetInner->setLayout(gridLayout); - int r = 0; - int c = 0; - for (int i = 0; i < this->m_widgets.size(); i++) - { - gridLayout->addWidget(this->m_widgets[i], r, c++); - this->m_widgets[i]->show(); - if (c < columns) { continue; } - c = 0; - r++; - } - - // set the real values - c = gridLayout->columnCount(); - r = gridLayout->rowCount(); - QSize ws = this->setMinimumSizeForWidgets(r, c); - this->resize(ws); - - // see documentation, required as layout was changed - // this requires setting widget again - this->ui->fr_NavigatorDockWidgetInner->show(); - this->setWidget(this->ui->fr_NavigatorDockWidgetInner); - } - - void CNavigatorDockWidget::addToContextMenu(QMenu *contextMenu) const - { - QAction *a; - a = contextMenu->addAction(CIcons::resize16(), "1 row", this, SLOT(ps_changeLayout())); - a->setData("1r"); - a = contextMenu->addAction(CIcons::resize16(), "2 rows", this, SLOT(ps_changeLayout())); - a->setData("2r"); - a = contextMenu->addAction(CIcons::resize16(), "1 column", this, SLOT(ps_changeLayout())); - a->setData("1c"); - a = contextMenu->addAction(CIcons::resize16(), "2 columns", this, SLOT(ps_changeLayout())); - a->setData("2c"); - contextMenu->addSeparator(); - CDockWidgetInfoArea::addToContextMenu(contextMenu); - } - - void CNavigatorDockWidget::ps_onStyleSheetsChanged() - { - const QString fn(CStyleSheetUtility::fileNameNavigator()); - const QString qss(CStyleSheetUtility::instance().style(fn)); - this->setStyleSheet(qss); - } - - void CNavigatorDockWidget::ps_changeLayout() - { - QAction *a = qobject_cast(QObject::sender()); - if (!a) { return; } - QString v(a->data().toString()); - if (v == "1c") { buildNavigator(1);} - else if (v == "2c") { buildNavigator(2);} - else if (v == "1r") { buildNavigator(columnsForRows(1));} - else if (v == "2r") { buildNavigator(columnsForRows(2));} - } - - void CNavigatorDockWidget::insertOwnActions() - { - QIcon i(CIcons::changeIconBackgroundColor(this->style()->standardIcon(QStyle::SP_TitleBarCloseButton), Qt::white, QSize(16, 16))); - QAction *a = new QAction(i, "Close", this); - connect(a, &QAction::triggered, this, &CNavigatorDockWidget::close); - this->addAction(a); - } - - int CNavigatorDockWidget::columnsForRows(int rows) - { - Q_ASSERT_X(rows >= 0, Q_FUNC_INFO, "no rows"); - int items = this->m_widgets.size(); - int c = items / rows; - return (c * rows) < items ? c + 1 : c; - } - - QSize CNavigatorDockWidget::setMinimumSizeForWidgets(int rows, int columns) - { - int w = 20 * columns; - int h = 20 * rows; - QSize min(w, h); - this->ui->qw_NavigatorDockWidgetOuter->setMinimumSize(min); - this->ui->fr_NavigatorDockWidgetInner->setMinimumSize(min); - this->setMinimumSize(min); - return min; - } - - } // ns -} // ns diff --git a/src/blackgui/components/navigatordockwidget.h b/src/blackgui/components/navigatordockwidget.h deleted file mode 100644 index 8fdcd92c0..000000000 --- a/src/blackgui/components/navigatordockwidget.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright (C) 2013 - * swift project Community / Contributors - * - * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level - * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, - * including this file, may be copied, modified, propagated, or distributed except according to the terms - * contained in the LICENSE file. - */ - -//! \file - -#ifndef BLACKGUI_COMPONENTS_NAVIGATORDOCKWIDGET_H -#define BLACKGUI_COMPONENTS_NAVIGATORDOCKWIDGET_H - -#include "blackgui/blackguiexport.h" -#include "blackgui/dockwidgetinfoarea.h" -#include -#include - -namespace Ui { class CNavigatorDockWidget; } - -namespace BlackGui -{ - namespace Components - { - - //! Dock widget for navigators - class BLACKGUI_EXPORT CNavigatorDockWidget : public BlackGui::CDockWidgetInfoArea - { - Q_OBJECT - - public: - //! Constructor - explicit CNavigatorDockWidget(QWidget *parent = nullptr); - - //! Destructor - virtual ~CNavigatorDockWidget(); - - //! Add action as navigator item - void addAction(QAction * action); - - //! Add actions as navigator items - void addActions(QList actions); - - //! Navigator - void buildNavigator(int columns); - - protected: - //! \copydoc CDockWidgetInfoArea::addToContextMenu - virtual void addToContextMenu(QMenu *contextMenu) const override; - - protected: - //! \copydoc CDockWidget::ps_onStyleSheetsChanged - virtual void ps_onStyleSheetsChanged() override; - - private slots: - //! Change the layout - void ps_changeLayout(); - - private: - QScopedPointer ui; - QList m_widgets; - QList m_actions; - bool m_firstBuild = true; - - //! Insert own actions - void insertOwnActions(); - - //! How many columns for given rows - int columnsForRows(int rows); - - //! Set widgets to their minimum size - QSize setMinimumSizeForWidgets(int rows, int columns); - - }; - - } // ns -} // ns - -#endif // guard diff --git a/src/blackgui/components/navigatordockwidget.ui b/src/blackgui/components/navigatordockwidget.ui deleted file mode 100644 index aa326b653..000000000 --- a/src/blackgui/components/navigatordockwidget.ui +++ /dev/null @@ -1,72 +0,0 @@ - - - CNavigatorDockWidget - - - - 0 - 0 - 60 - 38 - - - - - 0 - 0 - - - - - 30 - 38 - - - - true - - - QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable - - - Qt::NoDockWidgetArea - - - Navigator - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::NoFrame - - - QFrame::Plain - - - 0 - - - - - - - - - diff --git a/src/blackgui/enableforframelesswindow.h b/src/blackgui/enableforframelesswindow.h index 09a5126e4..90a34f510 100644 --- a/src/blackgui/enableforframelesswindow.h +++ b/src/blackgui/enableforframelesswindow.h @@ -55,7 +55,7 @@ namespace BlackGui //! Frameless? bool isFrameless() const { return this->m_windowMode == WindowFrameless; } - //! The main application + //! Is main application, explicitly set bool isMainApplicationWindow() const { return m_mainApplicationWindow; } //! Always on top? @@ -76,7 +76,7 @@ namespace BlackGui WindowMode m_windowMode = WindowNormal; //!< Window mode, \sa WindowMode WindowMode m_originalWindowMode = WindowNormal; //!< mode when initialized bool m_mainApplicationWindow = false; //!< is the main application window (only 1) - QWidget *m_widget = nullptr; //!< corresponding main window or dock widget + QWidget *m_widget = nullptr; //!< corresponding widget or dock widget QSizeGrip *m_framelessSizeGrip = nullptr; //!< size grip object QByteArray m_framelessPropertyName; //!< property name for frameless widgets diff --git a/src/blackgui/qss/navigator.qss b/src/blackgui/qss/navigator.qss index 4b6974ca2..a529f5c49 100644 --- a/src/blackgui/qss/navigator.qss +++ b/src/blackgui/qss/navigator.qss @@ -1,10 +1,17 @@ -#fr_NavigatorDockWidgetInner[framelessDockWidget="true"] { +#fr_NavigatorDialogInner[navigatorFrameless="true"] { margin: 0px; padding: 3px; border: 2px solid green; border-radius: 10px; } -#fr_NavigatorDockWidgetInner QToolButton { +#fr_NavigatorDialogInner[navigatorFrameless="false"] { + margin: 0px; + padding: 3px; + border: 0px; + border-radius: 0px; +} + +#fr_NavigatorDialogInner QToolButton { margin: 0px; } diff --git a/src/swiftguistandard/swiftguistd.cpp b/src/swiftguistandard/swiftguistd.cpp index 035aa8d67..2dd2344f1 100644 --- a/src/swiftguistandard/swiftguistd.cpp +++ b/src/swiftguistandard/swiftguistd.cpp @@ -22,7 +22,6 @@ #include "blackmisc/logmessage.h" #include "blackmisc/audio/notificationsounds.h" #include -#include using namespace BlackCore; using namespace BlackSound; @@ -88,7 +87,6 @@ void SwiftGuiStd::performGracefulShutdown() // clean up GUI this->ui->comp_MainInfoArea->dockAllWidgets(); - this->ui->comp_InvisibleInfoArea->dockAllWidgets(); // allow some other parts to react QApplication::processEvents(QEventLoop::AllEvents, 100); @@ -203,7 +201,6 @@ void SwiftGuiStd::ps_displayStatusMessageInGui(const CStatusMessage &statusMessa // main info areas this->ui->comp_MainInfoArea->displayStatusMessage(statusMessage); - this->ui->comp_InvisibleInfoArea->displayStatusMessage(statusMessage); // list this->ui->comp_MainInfoArea->getLogComponent()->appendStatusMessageToList(statusMessage); diff --git a/src/swiftguistandard/swiftguistd.h b/src/swiftguistandard/swiftguistd.h index 5aad4cb98..c4132c059 100644 --- a/src/swiftguistandard/swiftguistd.h +++ b/src/swiftguistandard/swiftguistd.h @@ -22,6 +22,7 @@ #include "blackcore/data/globalsetup.h" #include "blackgui/components/enableforruntime.h" #include "blackgui/components/maininfoareacomponent.h" +#include "blackgui/components/navigatordialog.h" #include "blackgui/transpondermodeselector.h" #include "blackgui/models/atcstationlistmodel.h" #include "blackgui/models/serverlistmodel.h" @@ -110,6 +111,8 @@ protected: private: QScopedPointer ui; + // if I pass the parent, the dialog is always center over the parent + QScopedPointer m_navigator{new BlackGui::Components::CNavigatorDialog()}; bool m_init = false; BlackGui::CManagedStatusBar m_statusBar; BlackMisc::CLogSubscriber m_logSubscriber { this, &SwiftGuiStd::ps_displayStatusMessageInGui }; diff --git a/src/swiftguistandard/swiftguistd.ui b/src/swiftguistandard/swiftguistd.ui index 36ddfcc38..2eae5142c 100644 --- a/src/swiftguistandard/swiftguistd.ui +++ b/src/swiftguistandard/swiftguistd.ui @@ -124,7 +124,7 @@ QFrame::NoFrame - 2 + 0 @@ -192,28 +192,6 @@ - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - @@ -243,7 +221,7 @@ 0 0 350 - 21 + 20 @@ -605,12 +583,6 @@
blackgui/components/internalscomponent.h
1 - - BlackGui::Components::CInvisibleInfoAreaComponent - QWidget -
blackgui/components/invisibleinfoareacomponent.h
- 1 -
BlackGui::COverlayMessagesFrame QFrame diff --git a/src/swiftguistandard/swiftguistdinit.cpp b/src/swiftguistandard/swiftguistdinit.cpp index 4db4a15d9..cb0def6f9 100644 --- a/src/swiftguistandard/swiftguistdinit.cpp +++ b/src/swiftguistandard/swiftguistdinit.cpp @@ -81,15 +81,12 @@ void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig) this->ui->dw_InfoBarStatus->setPreferredSizeWhenFloating(this->ui->dw_InfoBarStatus->size()); // set floating size // navigator - CNavigatorDockWidget *nav = this->ui->comp_InvisibleInfoArea->getNavigatorComponent(); - Q_ASSERT(nav); - nav->addAction(this->getToggleWindowVisibilityAction(nav)); - nav->addActions(this->ui->comp_MainInfoArea->getInfoAreaToggleFloatingActions(nav)); - nav->addAction(this->getWindowNormalAction(nav)); - nav->addAction(this->getWindowMinimizeAction(nav)); - nav->addAction(this->getToggleStayOnTopAction(nav)); - - this->ui->comp_InvisibleInfoArea->getNavigatorComponent()->buildNavigator(1); + this->m_navigator->addAction(this->getToggleWindowVisibilityAction(this->m_navigator.data())); + this->m_navigator->addActions(this->ui->comp_MainInfoArea->getInfoAreaToggleFloatingActions(this->m_navigator.data())); + this->m_navigator->addAction(this->getWindowNormalAction(this->m_navigator.data())); + this->m_navigator->addAction(this->getWindowMinimizeAction(this->m_navigator.data())); + this->m_navigator->addAction(this->getToggleStayOnTopAction(this->m_navigator.data())); + this->m_navigator->buildNavigator(1); // wire GUI signals this->initGuiSignals(); @@ -181,7 +178,7 @@ void SwiftGuiStd::initGuiSignals() connect(this->ui->menu_WindowFont, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked); connect(this->ui->menu_WindowMinimize, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked); connect(this->ui->menu_WindowToggleOnTop, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked); - connect(this->ui->menu_WindowToggleNavigator, &QAction::triggered, this->ui->comp_InvisibleInfoArea, &CInvisibleInfoAreaComponent::toggleNavigator); + connect(this->ui->menu_WindowToggleNavigator, &QAction::triggered, this->m_navigator.data(), &CNavigatorDialog::toggleNavigator); connect(this->ui->menu_InternalsCompileInfo, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked); connect(this->ui->menu_InternalsEnvVars, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);