diff --git a/src/blackgui/components/infobarstatuscomponent.ui b/src/blackgui/components/infobarstatuscomponent.ui
index f7b96adee..7ed74aca2 100644
--- a/src/blackgui/components/infobarstatuscomponent.ui
+++ b/src/blackgui/components/infobarstatuscomponent.ui
@@ -6,8 +6,8 @@
0
0
- 400
- 27
+ 415
+ 20
@@ -18,10 +18,13 @@
:/own/icons/own/swift/swift24.png:/own/icons/own/swift/swift24.png
- QFrame::StyledPanel
+ QFrame::NoFrame
- QFrame::Raised
+ QFrame::Plain
+
+
+ 0
diff --git a/src/blackgui/components/invisibleinfoareacomponent.cpp b/src/blackgui/components/invisibleinfoareacomponent.cpp
new file mode 100644
index 000000000..b8ddfff96
--- /dev/null
+++ b/src/blackgui/components/invisibleinfoareacomponent.cpp
@@ -0,0 +1,66 @@
+/* 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);
+ this->ui->comp_Navigator->allowStatusBar(false);
+ this->initInfoArea();
+ }
+
+ CInvisibleInfoAreaComponent::~CInvisibleInfoAreaComponent()
+ { }
+
+ QSize CInvisibleInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const
+ {
+ InfoArea area = static_cast(areaIndex);
+ switch (area)
+ {
+ case InfoAreaHorizontalNavigator:
+ return QSize(400, 50);
+ case InfoAreaVerticalNavigator:
+ return QSize(50, 400);
+ default:
+ return QSize(0, 0);
+ }
+ }
+
+ const QPixmap &CInvisibleInfoAreaComponent::indexToPixmap(int areaIndex) const
+ {
+ InfoArea area = static_cast(areaIndex);
+ switch (area)
+ {
+ case InfoAreaHorizontalNavigator:
+ case InfoAreaVerticalNavigator:
+ default:
+ return CIcons::empty();
+ }
+ }
+
+ void CInvisibleInfoAreaComponent::toggleNavigator()
+ {
+ this->ui->comp_Navigator->toggleFloating();
+ }
+
+ } // ns
+} // ns
diff --git a/src/blackgui/components/invisibleinfoareacomponent.h b/src/blackgui/components/invisibleinfoareacomponent.h
new file mode 100644
index 000000000..010f44028
--- /dev/null
+++ b/src/blackgui/components/invisibleinfoareacomponent.h
@@ -0,0 +1,62 @@
+/* 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/infoarea.h"
+#include
+
+namespace Ui { class CInvisibleInfoAreaComponent; }
+
+namespace BlackGui
+{
+ namespace Components
+ {
+
+ //! Info area to carry info areas on visibile when floating
+ class CInvisibleInfoAreaComponent : public BlackGui::CInfoArea
+ {
+ Q_OBJECT
+
+ public:
+
+ //! Info areas
+ enum InfoArea
+ {
+ // index must match tab index!
+ InfoAreaVerticalNavigator = 0,
+ InfoAreaHorizontalNavigator = 1
+ };
+
+ //! 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;
+
+ 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
new file mode 100644
index 000000000..1044e675b
--- /dev/null
+++ b/src/blackgui/components/invisibleinfoareacomponent.ui
@@ -0,0 +1,40 @@
+
+
+ CInvisibleInfoAreaComponent
+
+
+
+ 0
+ 0
+ 800
+ 600
+
+
+
+ Invisible info area
+
+
+
+
+ Qt::LeftDockWidgetArea
+
+
+ Navigator
+
+
+ 1
+
+
+
+
+
+
+ BlackGui::Components::CNavigatorDockWidget
+ QDockWidget
+ blackgui/components/navigatordockwidget.h
+ 1
+
+
+
+
+
diff --git a/src/blackgui/components/maininfoareacomponent.ui b/src/blackgui/components/maininfoareacomponent.ui
index ac98c6f12..e5f664b21 100644
--- a/src/blackgui/components/maininfoareacomponent.ui
+++ b/src/blackgui/components/maininfoareacomponent.ui
@@ -38,7 +38,17 @@
QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks
-
+
+
+ false
+
+
+
+ 0
+ 0
+
+
+
@@ -271,7 +281,7 @@
0
- 2
+ 0
0
@@ -282,10 +292,13 @@
-
- QFrame::StyledPanel
+ QFrame::NoFrame
- QFrame::Raised
+ QFrame::Plain
+
+
+ 0
@@ -309,7 +322,7 @@
4
-
+
0
@@ -363,7 +376,7 @@
0
- 2
+ 0
0
@@ -408,11 +421,14 @@
+
+ 0
+
0
- 2
+ 0
0
@@ -423,10 +439,13 @@
-
- QFrame::StyledPanel
+ QFrame::NoFrame
- QFrame::Raised
+ QFrame::Plain
+
+
+ 0
@@ -504,7 +523,7 @@
0
- 2
+ 0
0
@@ -515,10 +534,13 @@
-
- QFrame::StyledPanel
+ QFrame::NoFrame
- QFrame::Raised
+ QFrame::Plain
+
+
+ 0
@@ -550,7 +572,7 @@
0
- 2
+ 0
0
diff --git a/src/blackgui/components/navigatordockwidget.cpp b/src/blackgui/components/navigatordockwidget.cpp
index 679516c39..4ba6bf9a9 100644
--- a/src/blackgui/components/navigatordockwidget.cpp
+++ b/src/blackgui/components/navigatordockwidget.cpp
@@ -7,7 +7,6 @@
* contained in the LICENSE file.
*/
-
#include "navigatordockwidget.h"
#include "ui_navigatordockwidget.h"
@@ -18,7 +17,7 @@ namespace BlackGui
namespace Components
{
CNavigatorDockWidget::CNavigatorDockWidget(QWidget *parent) :
- CDockWidget(parent),
+ CDockWidgetInfoArea(parent),
ui(new Ui::CNavigatorDockWidget)
{
ui->setupUi(this);
diff --git a/src/blackgui/components/navigatordockwidget.h b/src/blackgui/components/navigatordockwidget.h
index e054468cf..e3731ce1c 100644
--- a/src/blackgui/components/navigatordockwidget.h
+++ b/src/blackgui/components/navigatordockwidget.h
@@ -12,7 +12,7 @@
#ifndef BLACKGUI_NAVIGATORDOCKWIDGET_H
#define BLACKGUI_NAVIGATORDOCKWIDGET_H
-#include "blackgui/dockwidget.h"
+#include "blackgui/dockwidgetinfoarea.h"
#include
#include
@@ -24,7 +24,7 @@ namespace BlackGui
{
//! Dock widget for navigators
- class CNavigatorDockWidget : public BlackGui::CDockWidget
+ class CNavigatorDockWidget : public BlackGui::CDockWidgetInfoArea
{
Q_OBJECT
diff --git a/src/blackgui/dockwidget.cpp b/src/blackgui/dockwidget.cpp
index 28ed80255..7c3862d99 100644
--- a/src/blackgui/dockwidget.cpp
+++ b/src/blackgui/dockwidget.cpp
@@ -18,9 +18,10 @@
namespace BlackGui
{
- CDockWidget::CDockWidget(QWidget *parent) :
+ CDockWidget::CDockWidget(bool allowStatusBar, QWidget *parent) :
QDockWidget(parent),
- CEnableForFramelessWindow(CEnableForFramelessWindow::WindowNormal, false, this)
+ CEnableForFramelessWindow(CEnableForFramelessWindow::WindowNormal, false, this),
+ m_allowStatusBar(allowStatusBar)
{
this->ps_onStyleSheetsChanged();
@@ -37,6 +38,9 @@ namespace BlackGui
}
+ CDockWidget::CDockWidget(QWidget *parent): CDockWidget(true, parent)
+ { }
+
void CDockWidget::setOriginalTitleBar()
{
if (!this->m_titleBarWidgetOriginal) { this->initTitleBarWidgets(); }
@@ -51,7 +55,7 @@ namespace BlackGui
this->setTitleBarWidget(this->m_titleBarWidgetEmpty);
}
- void CDockWidget::setNullTitleBar()
+ void CDockWidget::setNullTitleBarWidget()
{
this->setTitleBarWidget(nullptr);
}
@@ -61,11 +65,21 @@ namespace BlackGui
this->m_marginsWhenFloating = margins;
}
+ void CDockWidget::setMarginsWhenFramelessFloating(const QMargins &margins)
+ {
+ this->m_marginsWhenFramelessFloating = margins;
+ }
+
void CDockWidget::setMarginsWhenFloating(int left, int top, int right, int bottom)
{
this->m_marginsWhenFloating = QMargins(left, top, right, bottom);
}
+ void CDockWidget::setMarginsWhenFramelessFloating(int left, int top, int right, int bottom)
+ {
+ this->m_marginsWhenFramelessFloating = QMargins(left, top, right, bottom);
+ }
+
void CDockWidget::setMarginsWhenDocked(const QMargins &margins)
{
this->m_marginsWhenDocked = margins;
@@ -123,9 +137,53 @@ namespace BlackGui
this->m_preferredSizeWhenFloating = size;
}
+ void CDockWidget::setFrameless(bool frameless)
+ {
+ CEnableForFramelessWindow::setFrameless(frameless);
+
+ // grip
+ bool hasStatusBar = this->m_statusBar.getStatusBar();
+ if (frameless)
+ {
+ if (hasStatusBar)
+ {
+ this->addFramelessSizeGripToStatusBar(this->m_statusBar.getStatusBar());
+ }
+ }
+ else
+ {
+ if (hasStatusBar)
+ {
+ this->hideFramelessSizeGripInStatusBar();
+ }
+ }
+
+ // margins
+ if (this->isFloating())
+ {
+ this->setContentsMargins(frameless ? this->m_marginsWhenFramelessFloating : this->m_marginsWhenFloating);
+ }
+
+ // resize
+ if (frameless)
+ {
+ QWidget *innerWidget = this->widget(); // the inner widget containing the layout
+ Q_ASSERT(innerWidget);
+ this->resize(innerWidget->size());
+ }
+
+ //! \todo CDockWidget, check if style sheet reload is needed
+ this->ps_onStyleSheetsChanged(); // force style sheet reload
+ }
+
void CDockWidget::toggleFloating()
{
- this->setFloating(!this->isFloating());
+ bool floating = !this->isFloating();
+ if (!floating)
+ {
+ this->setFrameless(false);
+ }
+ this->setFloating(floating);
}
void CDockWidget::toggleVisibility()
@@ -140,6 +198,18 @@ namespace BlackGui
}
}
+ void CDockWidget::toggleFrameless()
+ {
+ if (this->isFrameless())
+ {
+ this->setFrameless(false);
+ }
+ else
+ {
+ this->setFrameless(true);
+ }
+ }
+
void CDockWidget::closeEvent(QCloseEvent *event)
{
if (this->isFloating())
@@ -174,11 +244,21 @@ namespace BlackGui
if (this->isFloating())
{
contextMenu->addAction(BlackMisc::CIcons::dockTop16(), "Dock", this, SLOT(toggleFloating()));
+ if (this->isFrameless())
+ {
+ contextMenu->addAction(BlackMisc::CIcons::tableSheet16(), "Normal window", this, SLOT(toggleFrameless()));
+ }
+ else
+ {
+ contextMenu->addAction(BlackMisc::CIcons::tableSheet16(), "Frameless", this, SLOT(toggleFrameless()));
+ }
+ contextMenu->addAction(BlackMisc::CIcons::refresh16(), "Redraw", this, SLOT(update()));
}
else
{
contextMenu->addAction(BlackMisc::CIcons::floatOne16(), "Float", this, SLOT(toggleFloating()));
}
+
}
void CDockWidget::initialFloating()
@@ -204,6 +284,43 @@ namespace BlackGui
}
}
+ bool CDockWidget::setMarginsFromSettings(const QString §ion)
+ {
+ QString sectionUsed(section.isEmpty() ? this->objectName() : section);
+ if (sectionUsed.isEmpty()) { return false; }
+ const QSettings *settings = CStyleSheetUtility::instance().iniFile();
+ if (!settings) { return false; }
+
+ // checked if value exists as there is no way to check if key/section exist
+ if (settings->value(sectionUsed + "/margindocked.left").toString().isEmpty())
+ {
+ // no values considered as no section, now we check if an alias exists
+ sectionUsed = settings->value("alias/" + sectionUsed).toString();
+ if (sectionUsed.isEmpty()) { return false; }
+ if (settings->value(sectionUsed + "/margindocked.left").toString().isEmpty()) { return false; }
+ }
+
+ if (settings)
+ {
+ this->setMarginsWhenDocked(
+ settings->value(sectionUsed + "/margindocked.left", 1).toInt(),
+ settings->value(sectionUsed + "/margindocked.top", 1).toInt(),
+ settings->value(sectionUsed + "/margindocked.right", 1).toInt(),
+ settings->value(sectionUsed + "/margindocked.bottom", 1).toInt());
+ this->setMarginsWhenFloating(
+ settings->value(sectionUsed + "/marginfloating.left", 10).toInt(),
+ settings->value(sectionUsed + "/marginfloating.top", 10).toInt(),
+ settings->value(sectionUsed + "/marginfloating.right", 10).toInt(),
+ settings->value(sectionUsed + "/marginfloating.bottom", 10).toInt());
+ this->setMarginsWhenFramelessFloating(
+ settings->value(sectionUsed + "/marginfloating.frameless.left", 5).toInt(),
+ settings->value(sectionUsed + "/marginfloating.frameless.top", 5).toInt(),
+ settings->value(sectionUsed + "/marginfloating.frameless.right", 5).toInt(),
+ settings->value(sectionUsed + "/marginfloating.frameless.bottom", 5).toInt());
+ }
+ return true;
+ }
+
void CDockWidget::ps_onTopLevelChanged(bool topLevel)
{
if (topLevel)
@@ -212,21 +329,22 @@ namespace BlackGui
{
QDockWidget::setWindowTitle(this->m_windowTitleBackup);
}
- this->setNullTitleBar();
- this->setContentsMargins(this->m_marginsWhenFloating);
+ this->setNullTitleBarWidget();
if (!this->m_wasAlreadyFloating) { this->initialFloating(); }
+
+ this->setContentsMargins(
+ this->isFrameless() ?
+ this->m_marginsWhenFramelessFloating :
+ this->m_marginsWhenFloating
+ );
this->m_statusBar.show();
-
- if (this->m_wasAlreadyFloating || this->m_resetedFloating)
- {
- //! \todo dock widget frameless
- // this->setFrameless(topLevel);
- }
-
this->m_wasAlreadyFloating = true;
}
else
{
+ // frameless
+ this->setFrameless(false);
+
if (!this->m_windowTitleWhenDocked) { QDockWidget::setWindowTitle(""); }
this->m_statusBar.hide();
this->setEmptyTitleBar();
@@ -237,9 +355,6 @@ namespace BlackGui
{
this->setMinimumSize(this->m_initialDockedMinimumSize);
}
-
- // frameless
- this->setFrameless(topLevel);
}
// relay
@@ -259,17 +374,17 @@ namespace BlackGui
if (!this->m_allowStatusBar) { return; }
this->m_statusBar.initStatusBar();
- QWidget *innerDockWidget = this->widget(); // the inner widget containing the layout
- Q_ASSERT(innerDockWidget);
- if (!innerDockWidget) { return; }
- QVBoxLayout *vLayout = qobject_cast(innerDockWidget->layout());
+ QWidget *innerWidget = this->widget(); // the inner widget containing the layout
+ Q_ASSERT(innerWidget);
+ if (!innerWidget) { return; }
+ QVBoxLayout *vLayout = qobject_cast(innerWidget->layout());
Q_ASSERT(vLayout);
if (!vLayout) { return; }
vLayout->addWidget(this->m_statusBar.getStatusBar(), 0, Qt::AlignBottom);
// adjust stretching of the original widget. It was the only widget so far
// and should occupy maximum space
- QWidget *compWidget = innerDockWidget->findChild(QString(), Qt::FindDirectChildrenOnly);
+ QWidget *compWidget = innerWidget->findChild(QString(), Qt::FindDirectChildrenOnly);
Q_ASSERT(compWidget);
if (!compWidget) { return; }
QSizePolicy sizePolicy = compWidget->sizePolicy();
@@ -293,6 +408,6 @@ namespace BlackGui
void CDockWidget::ps_onStyleSheetsChanged()
{
- // void, for further extensions
+ this->update();
}
} // namespace
diff --git a/src/blackgui/dockwidget.h b/src/blackgui/dockwidget.h
index 547a227d9..9cf233240 100644
--- a/src/blackgui/dockwidget.h
+++ b/src/blackgui/dockwidget.h
@@ -46,7 +46,7 @@ namespace BlackGui
void setEmptyTitleBar();
//! Set null (nullptr) title bar
- void setNullTitleBar();
+ void setNullTitleBarWidget();
//! Margins when window is floating
void setMarginsWhenFloating(const QMargins &margins);
@@ -54,12 +54,21 @@ namespace BlackGui
//! Margins when window is floating
void setMarginsWhenFloating(int left, int top, int right, int bottom);
+ //! Margins when window is floating (frameless)
+ void setMarginsWhenFramelessFloating(const QMargins &margins);
+
+ //! Margins when window is floating (frameless)
+ void setMarginsWhenFramelessFloating(int left, int top, int right, int bottom);
+
//! Margins when widget is floating
void setMarginsWhenDocked(const QMargins &margins);
//! Margins when widget is floating
void setMarginsWhenDocked(int left, int top, int right, int bottom);
+ //! Set margings from .ini file
+ bool setMarginsFromSettings(const QString §ion = "");
+
//! Window title backup
const QString &windowTitleBackup() const { return this->m_windowTitleBackup; }
@@ -91,6 +100,9 @@ namespace BlackGui
//! Position offset when floating first time
void setOffsetWhenFloating(const QPoint &point) { this->m_offsetWhenFloating = point; }
+ //! \copydoc CEnableForFramelessWindow::setFrameless
+ virtual void setFrameless(bool frameless) override;
+
public slots:
//! Toggle floating
void toggleFloating();
@@ -98,6 +110,9 @@ namespace BlackGui
//! Toggle visibility
void toggleVisibility();
+ //! Toggle frameless mode (EXPERIMENTAL)
+ void toggleFrameless();
+
//! Set title and internally keep a backup
void setWindowTitle(const QString &title);
@@ -115,6 +130,9 @@ namespace BlackGui
//! Constructor
explicit CDockWidget(QWidget *parent = nullptr);
+ //! Constructor
+ CDockWidget(bool allowStatusBar, QWidget *parent = nullptr);
+
//! Override close event
virtual void closeEvent(QCloseEvent *event) override;
@@ -141,18 +159,19 @@ namespace BlackGui
private slots:
//! Top level has been chaged
- virtual void ps_onTopLevelChanged(bool topLevel);
+ void ps_onTopLevelChanged(bool topLevel);
//! Context menu
- virtual void ps_showContextMenu(const QPoint &pos);
+ void ps_showContextMenu(const QPoint &pos);
//! Visibility has changed
- virtual void ps_onVisibilityChanged(bool visible);
+ void ps_onVisibilityChanged(bool visible);
private:
QWidget *m_titleBarWidgetEmpty = nullptr; //!< replacing default title bar
QWidget *m_titleBarWidgetOriginal = nullptr; //!< the original title bar
QMargins m_marginsWhenFloating; //!< Offsets when window is floating
+ QMargins m_marginsWhenFramelessFloating; //!< Offsets when window is frameless floating
QMargins m_marginsWhenDocked; //!< Offsets when window is docked
CManagedStatusBar m_statusBar; //!< Status bar when floating
QString m_windowTitleBackup; //!< original title, even if the widget title is deleted for layout purposes
@@ -171,6 +190,7 @@ namespace BlackGui
//! Init status bar
void initStatusBar();
+
};
} // namespace
diff --git a/src/blackgui/dockwidgetinfobar.cpp b/src/blackgui/dockwidgetinfobar.cpp
index 1febd9f11..447e72164 100644
--- a/src/blackgui/dockwidgetinfobar.cpp
+++ b/src/blackgui/dockwidgetinfobar.cpp
@@ -22,9 +22,7 @@ namespace BlackGui
{
CDockWidgetInfoBar::CDockWidgetInfoBar(QWidget *parent) : CDockWidget(parent)
{
- this->setProperty("frameless", CGuiUtility::isMainWindowFrameless());
- this->setMarginsWhenDocked(0, 0, 0, -1);
- this->setWindowTitle("Info bar");
+ this->setWindowTitle("Info status bar");
this->setWindowIcon(CIcons::swift24());
this->ps_onStyleSheetsChanged();
}
@@ -37,6 +35,7 @@ namespace BlackGui
void CDockWidgetInfoBar::ps_onStyleSheetsChanged()
{
+ if (!this->objectName().isEmpty()) { this->setMarginsFromSettings(); }
QString st = CStyleSheetUtility::instance().style(CStyleSheetUtility::fileNameInfoBar());
this->setStyleSheet(st);
}
diff --git a/src/blackgui/enableforframelesswindow.cpp b/src/blackgui/enableforframelesswindow.cpp
index 9398fa70c..a85612fee 100644
--- a/src/blackgui/enableforframelesswindow.cpp
+++ b/src/blackgui/enableforframelesswindow.cpp
@@ -9,7 +9,7 @@
#include "enableforframelesswindow.h"
#include "blackmisc/icons.h"
-#include
+#include "blackmisc/blackmiscfreefunctions.h"
#include
#include
@@ -28,6 +28,7 @@ namespace BlackGui
void CEnableForFramelessWindow::setMode(CEnableForFramelessWindow::WindowMode mode)
{
if (mode == this->m_windowMode) { return; }
+ // set the main window or dock widget
this->m_widget->setWindowFlags(modeToWindowFlags(mode));
this->setWindowAttributes(mode);
this->m_widget->show();
@@ -45,7 +46,9 @@ namespace BlackGui
// http://stackoverflow.com/questions/18316710/frameless-and-transparent-window-qt5
this->m_widget->setAttribute(Qt::WA_NoSystemBackground, frameless);
this->m_widget->setAttribute(Qt::WA_TranslucentBackground, frameless);
- this->m_widget->setProperty("frameless", frameless);
+
+ // property selector will check on string, so I directly provide a string
+ this->m_widget->setProperty("frameless", BlackMisc::boolToTrueFalse(frameless));
}
bool CEnableForFramelessWindow::handleMouseMoveEvent(QMouseEvent *event)
@@ -72,12 +75,25 @@ namespace BlackGui
return false;
}
- void CEnableForFramelessWindow::addFramelessSizeGrip(QStatusBar *statusBar)
+ void CEnableForFramelessWindow::addFramelessSizeGripToStatusBar(QStatusBar *statusBar)
{
if (!statusBar) { return; }
- QSizeGrip *grip = new QSizeGrip(this->m_widget);
- grip->setObjectName("sg_FramelessSizeGrip");
- statusBar->addPermanentWidget(grip);
+ if (!this->m_framelessSizeGrip)
+ {
+ this->m_framelessSizeGrip = new QSizeGrip(this->m_widget);
+ this->m_framelessSizeGrip->setObjectName("sg_FramelessSizeGrip");
+ statusBar->addPermanentWidget(this->m_framelessSizeGrip);
+ }
+ else
+ {
+ this->m_framelessSizeGrip->show();
+ }
+ }
+
+ void CEnableForFramelessWindow::hideFramelessSizeGripInStatusBar()
+ {
+ if (!this->m_framelessSizeGrip) { return; }
+ this->m_framelessSizeGrip->hide();
}
QHBoxLayout *CEnableForFramelessWindow::addFramelessCloseButton(QMenuBar *menuBar)
diff --git a/src/blackgui/enableforframelesswindow.h b/src/blackgui/enableforframelesswindow.h
index 8b00a795c..49a0aade9 100644
--- a/src/blackgui/enableforframelesswindow.h
+++ b/src/blackgui/enableforframelesswindow.h
@@ -18,6 +18,7 @@
#include
#include
#include
+#include
namespace BlackGui
{
@@ -42,7 +43,7 @@ namespace BlackGui
void setMode(WindowMode mode);
//! Framless
- void setFrameless(bool frameless);
+ virtual void setFrameless(bool frameless);
//! Frameless?
bool isFrameless() const { return this->m_windowMode == WindowFrameless; }
@@ -55,7 +56,10 @@ namespace BlackGui
protected:
//! Resize grip handle
- void addFramelessSizeGrip(QStatusBar *statusBar);
+ void addFramelessSizeGripToStatusBar(QStatusBar *statusBar);
+
+ //! Resize grip handle
+ void hideFramelessSizeGripInStatusBar();
//! Attributes
void setWindowAttributes(WindowMode mode);
@@ -71,6 +75,7 @@ namespace BlackGui
WindowMode m_windowMode = WindowNormal; //!< Window mode, \sa WindowMode
bool m_mainApplicationWindow = false; //!< is the main application window (only 1)
QWidget *m_widget = nullptr; //!< corresponding main window or dock widget
+ QSizeGrip *m_framelessSizeGrip = nullptr;
//! Mouse press, required for frameless window
bool handleMousePressEvent(QMouseEvent *event);
diff --git a/src/blackgui/infoarea.cpp b/src/blackgui/infoarea.cpp
index fb9429061..88a271af2 100644
--- a/src/blackgui/infoarea.cpp
+++ b/src/blackgui/infoarea.cpp
@@ -499,6 +499,15 @@ namespace BlackGui
}
}
+ void CInfoArea::setMarginsWhenFramelessFloating(int left, int top, int right, int bottom)
+ {
+ for (CDockWidgetInfoArea *dw : this->m_dockWidgetInfoAreas)
+ {
+ //! Margins when window is floating
+ dw->setMarginsWhenFramelessFloating(left, top, right, bottom);
+ }
+ }
+
void CInfoArea::setMarginsWhenDocked(int left, int top, int right, int bottom)
{
for (CDockWidgetInfoArea *dw : this->m_dockWidgetInfoAreas)
@@ -534,24 +543,21 @@ namespace BlackGui
void CInfoArea::iniFileBasedSettings()
{
+ const QString section(this->objectName());
const QSettings *settings = CStyleSheetUtility::instance().iniFile();
- if (settings)
+ if (settings && !section.isEmpty())
{
- this->setMarginsWhenDocked(
- settings->value("infoarea/margindocked.left").toInt(),
- settings->value("infoarea/margindocked.top").toInt(),
- settings->value("infoarea/margindocked.right").toInt(),
- settings->value("infoarea/margindocked.bottom").toInt());
- this->setMarginsWhenFloating(
- settings->value("infoarea/marginfloating.left").toInt(),
- settings->value("infoarea/marginfloating.top").toInt(),
- settings->value("infoarea/marginfloating.right").toInt(),
- settings->value("infoarea/marginfloating.bottom").toInt());
+ for (CDockWidgetInfoArea *dw : this->m_dockWidgetInfoAreas)
+ {
+ //! Margins when window is floating
+ dw->setMarginsFromSettings(section);
+ }
}
else
{
- // some defaut if not available
- this->setMarginsWhenFloating(10, 10, 20, 20); // left, top, right, bottom
+ // some defaults if not available
+ this->setMarginsWhenFloating(10, 10, 10, 10); // left, top, right, bottom
+ this->setMarginsWhenFramelessFloating(5, 5, 5, 5); // left, top, right, bottom
this->setMarginsWhenDocked(1, 1, 1, 1); // top has no effect
}
}
diff --git a/src/blackgui/infoarea.h b/src/blackgui/infoarea.h
index 9ba8e3931..3955d13a8 100644
--- a/src/blackgui/infoarea.h
+++ b/src/blackgui/infoarea.h
@@ -182,6 +182,9 @@ namespace BlackGui
//! Margins for the floating widgets
void setMarginsWhenFloating(int left, int top, int right, int bottom);
+ //! Margins for the floating widgets (when frameless)
+ void setMarginsWhenFramelessFloating(int left, int top, int right, int bottom);
+
//! Margins for the dockable widgets
void setMarginsWhenDocked(int left, int top, int right, int bottom);
diff --git a/src/blackgui/qss/gui.ini b/src/blackgui/qss/gui.ini
index 789928750..dc24b1c0d 100644
--- a/src/blackgui/qss/gui.ini
+++ b/src/blackgui/qss/gui.ini
@@ -1,5 +1,12 @@
-[infoarea]
-; margins as used in infoarea.cpp
+[alias]
+; those are the component names and valid until an object name is set
+; in most cases the object name is not yet known in the constructor
+; this alias makes sense as long there is one object per component
+CMainInfoAreaComponent = comp_MainInfoArea
+CCockpitInfoAreaComponent = comp_CockpitInfoArea
+CInfoBarStatusComponent = dw_dw_InfoBarStatus
+
+[comp_MainInfoArea]
margindocked.left = 1
margindocked.right = 1
margindocked.top = 1
@@ -8,4 +15,41 @@ margindocked.bottom = 1
marginfloating.left = 5
marginfloating.right = 20
marginfloating.top = 5
-marginfloating.bottom = 20
+marginfloating.bottom = 40
+
+marginfloating.frameless.left = 5
+marginfloating.frameless.right = 5
+marginfloating.frameless.top = 5
+marginfloating.frameless.bottom = 5
+
+[comp_CockpitInfoArea]
+margindocked.left = 1
+margindocked.right = 1
+margindocked.top = 1
+margindocked.bottom = 1
+
+marginfloating.left = 5
+marginfloating.right = 20
+marginfloating.top = 5
+marginfloating.bottom = 40
+
+marginfloating.frameless.left = 5
+marginfloating.frameless.right = 5
+marginfloating.frameless.top = 5
+marginfloating.frameless.bottom = 5
+
+[dw_InfoBarStatus]
+margindocked.left = 0
+margindocked.right = 0
+margindocked.top = 0
+margindocked.bottom = 0
+
+marginfloating.left = 0
+marginfloating.right = 0
+marginfloating.top = 0
+marginfloating.bottom = 0
+
+marginfloating.frameless.left = 0
+marginfloating.frameless.right = 0
+marginfloating.frameless.top = 0
+marginfloating.frameless.bottom = 0
diff --git a/src/blackgui/qss/infobar.qss b/src/blackgui/qss/infobar.qss
index 2041c039d..fffd7a984 100644
--- a/src/blackgui/qss/infobar.qss
+++ b/src/blackgui/qss/infobar.qss
@@ -1,14 +1,13 @@
+/** style is applied to a CDockWidgetInfoBar **/
+/** frameless is dynamic property**/
+/** for frameless only use QDockWidget[frameless="true"] QFrame **/
+
QFrame {
margin: 0px;
padding-left: 6px;
padding-right: 6px;
padding-bottom: 0px;
-}
-
-/** frameless is dynamic property**/
-/** for frameless only use QDockWidget[frameless="true"] QFrame **/
-QDockWidget QFrame
- {
+ padding-top: 0px;
background-color: darkslategray;
background-image: url(:/textures/icons/textures/texture-outer.jpg);
border: 0px;
diff --git a/src/blackgui/qss/mainwindow.qss b/src/blackgui/qss/mainwindow.qss
index e4a00b40f..f466cc8c6 100644
--- a/src/blackgui/qss/mainwindow.qss
+++ b/src/blackgui/qss/mainwindow.qss
@@ -19,25 +19,29 @@ QMainWindow {
/** required when dock widget is floating **/
/** background-image not working on QDockWidget, so I use direct children **/
-#sw_MainMiddle BlackGui--CDockWidgetInfoArea {
+BlackGui--CDockWidgetInfoArea[frameless="false"] {
background-color: black;
}
+BlackGui--CDockWidgetInfoArea[frameless="true"] {
+ background-color: white;
+}
+
/** this is the first widget in the dock area **/
/** all dock widgets shall have this QWidget as container **/
-#sw_MainMiddle BlackGui--CDockWidgetInfoArea > QWidget {
+BlackGui--CDockWidgetInfoArea > QWidget {
background-color: black;
background-image: url(:/textures/icons/textures/texture-inner.jpg);
}
/** the following QFrame, likely the component itself
-#sw_MainMiddle BlackGui--CDockWidgetInfoArea > QWidget > QFrame {
- border: 0px;
- padding: 0px;
+BlackGui--CDockWidgetInfoArea > QWidget > QFrame {
+ border: 0px;
+ padding: 0px;
}
/** fix the menu, which is overridden by the above QWidget **/
-#sw_MainMiddle BlackGui--CDockWidgetInfoArea > QMenu {
+BlackGui--CDockWidgetInfoArea > QMenu {
border: 1px solid darkslategray; /* reserve space for selection border */
background: lightgray;
color: black;
@@ -74,7 +78,10 @@ QAbstractScrollArea #pg_StatusPageConsole { background-color: black; }
/** dw_InfoBarStatus has its own style sheet **/
#fr_CentralFrameInside {
- margin: 5px;
+ margin-right: 5px;
+ margin-left: 5px;
+ margin-top: 2px;
+ margin-bottom: 5px;
}
#gb_AtcStationsOnlineInfo {
diff --git a/src/blackmisc/blackmiscfreefunctions.cpp b/src/blackmisc/blackmiscfreefunctions.cpp
index 61885b0a8..d5116cc4b 100644
--- a/src/blackmisc/blackmiscfreefunctions.cpp
+++ b/src/blackmisc/blackmiscfreefunctions.cpp
@@ -413,9 +413,14 @@ QString BlackMisc::boolToOnOff(bool v, bool i18n)
return v ? "on" : "off";
}
-
QString BlackMisc::boolToYesNo(bool v, bool i18n)
{
Q_UNUSED(i18n);
return v ? "yes" : "no";
}
+
+QString BlackMisc::boolToTrueFalse(bool v, bool i18n)
+{
+ Q_UNUSED(i18n);
+ return v ? "true" : "false";
+}
diff --git a/src/blackmisc/blackmiscfreefunctions.h b/src/blackmisc/blackmiscfreefunctions.h
index 3bee391d6..972421764 100644
--- a/src/blackmisc/blackmiscfreefunctions.h
+++ b/src/blackmisc/blackmiscfreefunctions.h
@@ -177,6 +177,9 @@ namespace BlackMisc
//! Bool to yes / no
QString boolToYesNo(bool v, bool i18n = false);
+ //! Bool to true / false
+ QString boolToTrueFalse(bool v, bool i18n = false);
+
//! Get local host name
const QString &localHostName();
diff --git a/src/swiftgui_standard/swiftguistd.cpp b/src/swiftgui_standard/swiftguistd.cpp
index 1ad65b1fc..1d8d13e91 100644
--- a/src/swiftgui_standard/swiftguistd.cpp
+++ b/src/swiftgui_standard/swiftguistd.cpp
@@ -308,17 +308,6 @@ void SwiftGuiStd::ps_onChangedMainInfoAreaFloating(bool floating)
Q_UNUSED(floating);
}
-void SwiftGuiStd::ps_toggleNavigatorHorizontal()
-{
-
-}
-
-void SwiftGuiStd::ps_toggleNavigatorVertical()
-{
- bool v = ui->ndw_NavigatorVertical->isVisible();
- ui->ndw_NavigatorVertical->setVisible(!v);
-}
-
void SwiftGuiStd::playNotifcationSound(CNotificationSounds::Notification notification) const
{
if (!this->m_contextAudioAvailable) return;
diff --git a/src/swiftgui_standard/swiftguistd.h b/src/swiftgui_standard/swiftguistd.h
index 290f54cbe..92d829e73 100644
--- a/src/swiftgui_standard/swiftguistd.h
+++ b/src/swiftgui_standard/swiftguistd.h
@@ -58,7 +58,8 @@ public:
{
MainPageInfoArea = 0,
MainPageLogin = 1,
- MainPageInternals = 2
+ MainPageInternals = 2,
+ MainPageInvisible = 3
};
//! Constructor
@@ -121,9 +122,6 @@ private:
//! Init GUI signals
void initGuiSignals();
- //! Init the navigstion bars
- void initNavigationBars();
-
//! Init dynamic menus
void initDynamicMenus();
@@ -240,13 +238,6 @@ private slots:
//! Whole main info area floating
void ps_onChangedMainInfoAreaFloating(bool floating);
-
- //! Toggle horizontal navigator
- void ps_toggleNavigatorHorizontal();
-
- //! Toggle vertical navigator
- void ps_toggleNavigatorVertical();
-
};
#pragma pop_macro("interface")
diff --git a/src/swiftgui_standard/swiftguistd.ui b/src/swiftgui_standard/swiftguistd.ui
index ca159092a..0105d0f51 100644
--- a/src/swiftgui_standard/swiftguistd.ui
+++ b/src/swiftgui_standard/swiftguistd.ui
@@ -90,6 +90,9 @@
+
+ 0
+
0
@@ -125,7 +128,7 @@
QFrame::NoFrame
- 2
+ 3
@@ -193,6 +196,13 @@
+
+
+ -
+
+
+
+
-
@@ -305,8 +315,7 @@
-
-
+
@@ -344,46 +353,34 @@
Qt::TopDockWidgetArea
+
+ Info status bar
+
4
-
-
-
-
- false
-
-
- QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable
-
-
- Qt::NoDockWidgetArea
-
-
- Horizontal navigator
-
-
- 1
-
-
-
-
-
- false
-
-
- QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable
-
-
- Qt::NoDockWidgetArea
-
-
- Vertical navigator
-
-
- 1
-
-
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+
@@ -466,9 +463,9 @@
Ctrl+W, Ctrl+T
-
+
- Vertical navigator
+ Navigator
@@ -516,9 +513,9 @@
1
- BlackGui::Components::CNavigatorDockWidget
- QDockWidget
- blackgui/components/navigatordockwidget.h
+ BlackGui::Components::CInvisibleInfoAreaComponent
+ QWidget
+ blackgui/components/invisibleinfoareacomponent.h
1
diff --git a/src/swiftgui_standard/swiftguistd_init.cpp b/src/swiftgui_standard/swiftguistd_init.cpp
index 6a56867bb..c12be8724 100644
--- a/src/swiftgui_standard/swiftguistd_init.cpp
+++ b/src/swiftgui_standard/swiftguistd_init.cpp
@@ -38,6 +38,8 @@ using namespace BlackGui::Components;
*/
void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig)
{
+ // POST(!) GUI init
+
if (this->m_init) { return; }
this->setVisible(false); // hide all, so no flashing windows during init
@@ -64,7 +66,7 @@ void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig)
this->ui->vl_CentralWidgetOutside->addWidget(this->ui->sb_MainStatusBar, 0);
// grip
- this->addFramelessSizeGrip(this->ui->sb_MainStatusBar);
+ this->addFramelessSizeGripToStatusBar(this->ui->sb_MainStatusBar);
}
// timers
@@ -74,13 +76,14 @@ void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig)
this->createRuntime(runtimeConfig, this);
CEnableForRuntime::setRuntimeForComponents(this->getRuntime(), this);
+ // info bar and status bar
+ this->m_statusBar.initStatusBar(this->ui->sb_MainStatusBar);
+ this->ui->dw_InfoBarStatus->allowStatusBar(false);
+ this->ui->dw_InfoBarStatus->setPreferredSizeWhenFloating(this->ui->dw_InfoBarStatus->size()); // set floating size
+
// wire GUI signals
this->initGuiSignals();
- // status bar
- this->ui->dw_InfoBarStatus->allowStatusBar(false);
- this->m_statusBar.initStatusBar(this->ui->sb_MainStatusBar);
-
// signal / slots contexts / timers
connect(this->getIContextNetwork(), &IContextNetwork::connectionTerminated, this, &SwiftGuiStd::ps_onConnectionTerminated);
connect(this->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &SwiftGuiStd::ps_onConnectionStatusChanged);
@@ -105,9 +108,6 @@ void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig)
this->ps_setMainPageToInfoArea();
this->initDynamicMenus();
- // navigation bars
- // this->initNavigationBars();
-
// starting
this->getIContextApplication()->notifyAboutComponentChange(IContextApplication::ApplicationGui, IContextApplication::ApplicationStarts);
@@ -128,15 +128,6 @@ void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig)
this->m_init = true;
}
-/*
- * Init navigation bars
- */
-void SwiftGuiStd::initNavigationBars()
-{
- ui->ndw_NavigatorHorizontal->setVisible(false);
- ui->ndw_NavigatorVertical->setVisible(false);
-}
-
/*
* GUI signals
*/
@@ -170,9 +161,8 @@ 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_NavigatorHorizontal, &QAction::triggered, this, &SwiftGuiStd::ps_toggleNavigatorHorizontal);
- connect(this->ui->menu_NavigatorVertical, &QAction::triggered, this, &SwiftGuiStd::ps_toggleNavigatorVertical);
- connect(this->ui->menu_DebugMetaTypes, &QAction::triggered, this, &SwiftGuiStd::ps_toggleNavigatorHorizontal);
+ connect(this->ui->menu_WindowToggleNavigator, &QAction::triggered, this->ui->comp_InvisibleInfoArea, &CInvisibleInfoAreaComponent::toggleNavigator);
+ connect(this->ui->menu_DebugMetaTypes, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
// command line / text messages
connect(this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::displayInInfoWindow, this->m_compInfoWindow, &CInfoWindowComponent::display);