mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-01 22:55:41 +08:00
* allow to set/unset frameless mode in CDockWidget * adjusted context menus * adjusted style sheets * ini settings for margins * hidden info area to host floating widgets only visible when floating (allows to CDockInfoArea widgets) * made some private slots non-virtual
This commit is contained in:
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>415</width>
|
||||||
<height>27</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -18,10 +18,13 @@
|
|||||||
<normaloff>:/own/icons/own/swift/swift24.png</normaloff>:/own/icons/own/swift/swift24.png</iconset>
|
<normaloff>:/own/icons/own/swift/swift24.png</normaloff>:/own/icons/own/swift/swift24.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="hl_InfoBarStatus">
|
<layout class="QHBoxLayout" name="hl_InfoBarStatus">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
|||||||
66
src/blackgui/components/invisibleinfoareacomponent.cpp
Normal file
66
src/blackgui/components/invisibleinfoareacomponent.cpp
Normal file
@@ -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<InfoArea>(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<InfoArea>(areaIndex);
|
||||||
|
switch (area)
|
||||||
|
{
|
||||||
|
case InfoAreaHorizontalNavigator:
|
||||||
|
case InfoAreaVerticalNavigator:
|
||||||
|
default:
|
||||||
|
return CIcons::empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CInvisibleInfoAreaComponent::toggleNavigator()
|
||||||
|
{
|
||||||
|
this->ui->comp_Navigator->toggleFloating();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // ns
|
||||||
|
} // ns
|
||||||
62
src/blackgui/components/invisibleinfoareacomponent.h
Normal file
62
src/blackgui/components/invisibleinfoareacomponent.h
Normal file
@@ -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 <QMainWindow>
|
||||||
|
|
||||||
|
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::CInvisibleInfoAreaComponent> ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // ns
|
||||||
|
} // ns
|
||||||
|
|
||||||
|
|
||||||
|
#endif // guard
|
||||||
40
src/blackgui/components/invisibleinfoareacomponent.ui
Normal file
40
src/blackgui/components/invisibleinfoareacomponent.ui
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CInvisibleInfoAreaComponent</class>
|
||||||
|
<widget class="QMainWindow" name="CInvisibleInfoAreaComponent">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>800</width>
|
||||||
|
<height>600</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Invisible info area</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="qw_InvisibleInfoArea"/>
|
||||||
|
<widget class="BlackGui::Components::CNavigatorDockWidget" name="comp_Navigator">
|
||||||
|
<property name="allowedAreas">
|
||||||
|
<set>Qt::LeftDockWidgetArea</set>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Navigator</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="dockWidgetArea">
|
||||||
|
<number>1</number>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QWidget" name="qw_Navigaor"/>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Components::CNavigatorDockWidget</class>
|
||||||
|
<extends>QDockWidget</extends>
|
||||||
|
<header>blackgui/components/navigatordockwidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -38,7 +38,17 @@
|
|||||||
<property name="dockOptions">
|
<property name="dockOptions">
|
||||||
<set>QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks</set>
|
<set>QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks</set>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="qw_centralWidgetEmpty"/>
|
<widget class="QWidget" name="qw_centralWidgetEmpty">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
<widget class="BlackGui::CDockWidgetInfoArea" name="dwp_Cockpit">
|
<widget class="BlackGui::CDockWidgetInfoArea" name="dwp_Cockpit">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
@@ -271,7 +281,7 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>2</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@@ -282,10 +292,13 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="BlackGui::Components::CTextMessageComponent" name="comp_TextMessages">
|
<widget class="BlackGui::Components::CTextMessageComponent" name="comp_TextMessages">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -309,7 +322,7 @@
|
|||||||
<number>4</number>
|
<number>4</number>
|
||||||
</attribute>
|
</attribute>
|
||||||
<widget class="QWidget" name="qw_SimulatorInner">
|
<widget class="QWidget" name="qw_SimulatorInner">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="vl_Simulator">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -363,7 +376,7 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>2</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@@ -408,11 +421,14 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vl_Weather">
|
<layout class="QVBoxLayout" name="vl_Weather">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>2</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@@ -423,10 +439,13 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="fr_WeatherDummy">
|
<widget class="QFrame" name="fr_WeatherDummy">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -504,7 +523,7 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>2</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@@ -515,10 +534,13 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="BlackGui::Components::CLogComponent" name="comp_Log">
|
<widget class="BlackGui::Components::CLogComponent" name="comp_Log">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -550,7 +572,7 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>2</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "navigatordockwidget.h"
|
#include "navigatordockwidget.h"
|
||||||
#include "ui_navigatordockwidget.h"
|
#include "ui_navigatordockwidget.h"
|
||||||
|
|
||||||
@@ -18,7 +17,7 @@ namespace BlackGui
|
|||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
CNavigatorDockWidget::CNavigatorDockWidget(QWidget *parent) :
|
CNavigatorDockWidget::CNavigatorDockWidget(QWidget *parent) :
|
||||||
CDockWidget(parent),
|
CDockWidgetInfoArea(parent),
|
||||||
ui(new Ui::CNavigatorDockWidget)
|
ui(new Ui::CNavigatorDockWidget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#ifndef BLACKGUI_NAVIGATORDOCKWIDGET_H
|
#ifndef BLACKGUI_NAVIGATORDOCKWIDGET_H
|
||||||
#define BLACKGUI_NAVIGATORDOCKWIDGET_H
|
#define BLACKGUI_NAVIGATORDOCKWIDGET_H
|
||||||
|
|
||||||
#include "blackgui/dockwidget.h"
|
#include "blackgui/dockwidgetinfoarea.h"
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
|
|
||||||
//! Dock widget for navigators
|
//! Dock widget for navigators
|
||||||
class CNavigatorDockWidget : public BlackGui::CDockWidget
|
class CNavigatorDockWidget : public BlackGui::CDockWidgetInfoArea
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,10 @@
|
|||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
CDockWidget::CDockWidget(QWidget *parent) :
|
CDockWidget::CDockWidget(bool allowStatusBar, QWidget *parent) :
|
||||||
QDockWidget(parent),
|
QDockWidget(parent),
|
||||||
CEnableForFramelessWindow(CEnableForFramelessWindow::WindowNormal, false, this)
|
CEnableForFramelessWindow(CEnableForFramelessWindow::WindowNormal, false, this),
|
||||||
|
m_allowStatusBar(allowStatusBar)
|
||||||
{
|
{
|
||||||
|
|
||||||
this->ps_onStyleSheetsChanged();
|
this->ps_onStyleSheetsChanged();
|
||||||
@@ -37,6 +38,9 @@ namespace BlackGui
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CDockWidget::CDockWidget(QWidget *parent): CDockWidget(true, parent)
|
||||||
|
{ }
|
||||||
|
|
||||||
void CDockWidget::setOriginalTitleBar()
|
void CDockWidget::setOriginalTitleBar()
|
||||||
{
|
{
|
||||||
if (!this->m_titleBarWidgetOriginal) { this->initTitleBarWidgets(); }
|
if (!this->m_titleBarWidgetOriginal) { this->initTitleBarWidgets(); }
|
||||||
@@ -51,7 +55,7 @@ namespace BlackGui
|
|||||||
this->setTitleBarWidget(this->m_titleBarWidgetEmpty);
|
this->setTitleBarWidget(this->m_titleBarWidgetEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDockWidget::setNullTitleBar()
|
void CDockWidget::setNullTitleBarWidget()
|
||||||
{
|
{
|
||||||
this->setTitleBarWidget(nullptr);
|
this->setTitleBarWidget(nullptr);
|
||||||
}
|
}
|
||||||
@@ -61,11 +65,21 @@ namespace BlackGui
|
|||||||
this->m_marginsWhenFloating = margins;
|
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)
|
void CDockWidget::setMarginsWhenFloating(int left, int top, int right, int bottom)
|
||||||
{
|
{
|
||||||
this->m_marginsWhenFloating = QMargins(left, top, right, 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)
|
void CDockWidget::setMarginsWhenDocked(const QMargins &margins)
|
||||||
{
|
{
|
||||||
this->m_marginsWhenDocked = margins;
|
this->m_marginsWhenDocked = margins;
|
||||||
@@ -123,9 +137,53 @@ namespace BlackGui
|
|||||||
this->m_preferredSizeWhenFloating = size;
|
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()
|
void CDockWidget::toggleFloating()
|
||||||
{
|
{
|
||||||
this->setFloating(!this->isFloating());
|
bool floating = !this->isFloating();
|
||||||
|
if (!floating)
|
||||||
|
{
|
||||||
|
this->setFrameless(false);
|
||||||
|
}
|
||||||
|
this->setFloating(floating);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDockWidget::toggleVisibility()
|
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)
|
void CDockWidget::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
if (this->isFloating())
|
if (this->isFloating())
|
||||||
@@ -174,11 +244,21 @@ namespace BlackGui
|
|||||||
if (this->isFloating())
|
if (this->isFloating())
|
||||||
{
|
{
|
||||||
contextMenu->addAction(BlackMisc::CIcons::dockTop16(), "Dock", this, SLOT(toggleFloating()));
|
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
|
else
|
||||||
{
|
{
|
||||||
contextMenu->addAction(BlackMisc::CIcons::floatOne16(), "Float", this, SLOT(toggleFloating()));
|
contextMenu->addAction(BlackMisc::CIcons::floatOne16(), "Float", this, SLOT(toggleFloating()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDockWidget::initialFloating()
|
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)
|
void CDockWidget::ps_onTopLevelChanged(bool topLevel)
|
||||||
{
|
{
|
||||||
if (topLevel)
|
if (topLevel)
|
||||||
@@ -212,21 +329,22 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
QDockWidget::setWindowTitle(this->m_windowTitleBackup);
|
QDockWidget::setWindowTitle(this->m_windowTitleBackup);
|
||||||
}
|
}
|
||||||
this->setNullTitleBar();
|
this->setNullTitleBarWidget();
|
||||||
this->setContentsMargins(this->m_marginsWhenFloating);
|
|
||||||
if (!this->m_wasAlreadyFloating) { this->initialFloating(); }
|
if (!this->m_wasAlreadyFloating) { this->initialFloating(); }
|
||||||
|
|
||||||
|
this->setContentsMargins(
|
||||||
|
this->isFrameless() ?
|
||||||
|
this->m_marginsWhenFramelessFloating :
|
||||||
|
this->m_marginsWhenFloating
|
||||||
|
);
|
||||||
this->m_statusBar.show();
|
this->m_statusBar.show();
|
||||||
|
|
||||||
if (this->m_wasAlreadyFloating || this->m_resetedFloating)
|
|
||||||
{
|
|
||||||
//! \todo dock widget frameless
|
|
||||||
// this->setFrameless(topLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->m_wasAlreadyFloating = true;
|
this->m_wasAlreadyFloating = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// frameless
|
||||||
|
this->setFrameless(false);
|
||||||
|
|
||||||
if (!this->m_windowTitleWhenDocked) { QDockWidget::setWindowTitle(""); }
|
if (!this->m_windowTitleWhenDocked) { QDockWidget::setWindowTitle(""); }
|
||||||
this->m_statusBar.hide();
|
this->m_statusBar.hide();
|
||||||
this->setEmptyTitleBar();
|
this->setEmptyTitleBar();
|
||||||
@@ -237,9 +355,6 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
this->setMinimumSize(this->m_initialDockedMinimumSize);
|
this->setMinimumSize(this->m_initialDockedMinimumSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// frameless
|
|
||||||
this->setFrameless(topLevel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// relay
|
// relay
|
||||||
@@ -259,17 +374,17 @@ namespace BlackGui
|
|||||||
if (!this->m_allowStatusBar) { return; }
|
if (!this->m_allowStatusBar) { return; }
|
||||||
this->m_statusBar.initStatusBar();
|
this->m_statusBar.initStatusBar();
|
||||||
|
|
||||||
QWidget *innerDockWidget = this->widget(); // the inner widget containing the layout
|
QWidget *innerWidget = this->widget(); // the inner widget containing the layout
|
||||||
Q_ASSERT(innerDockWidget);
|
Q_ASSERT(innerWidget);
|
||||||
if (!innerDockWidget) { return; }
|
if (!innerWidget) { return; }
|
||||||
QVBoxLayout *vLayout = qobject_cast<QVBoxLayout *>(innerDockWidget->layout());
|
QVBoxLayout *vLayout = qobject_cast<QVBoxLayout *>(innerWidget->layout());
|
||||||
Q_ASSERT(vLayout);
|
Q_ASSERT(vLayout);
|
||||||
if (!vLayout) { return; }
|
if (!vLayout) { return; }
|
||||||
vLayout->addWidget(this->m_statusBar.getStatusBar(), 0, Qt::AlignBottom);
|
vLayout->addWidget(this->m_statusBar.getStatusBar(), 0, Qt::AlignBottom);
|
||||||
|
|
||||||
// adjust stretching of the original widget. It was the only widget so far
|
// adjust stretching of the original widget. It was the only widget so far
|
||||||
// and should occupy maximum space
|
// and should occupy maximum space
|
||||||
QWidget *compWidget = innerDockWidget->findChild<QWidget *>(QString(), Qt::FindDirectChildrenOnly);
|
QWidget *compWidget = innerWidget->findChild<QWidget *>(QString(), Qt::FindDirectChildrenOnly);
|
||||||
Q_ASSERT(compWidget);
|
Q_ASSERT(compWidget);
|
||||||
if (!compWidget) { return; }
|
if (!compWidget) { return; }
|
||||||
QSizePolicy sizePolicy = compWidget->sizePolicy();
|
QSizePolicy sizePolicy = compWidget->sizePolicy();
|
||||||
@@ -293,6 +408,6 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CDockWidget::ps_onStyleSheetsChanged()
|
void CDockWidget::ps_onStyleSheetsChanged()
|
||||||
{
|
{
|
||||||
// void, for further extensions
|
this->update();
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace BlackGui
|
|||||||
void setEmptyTitleBar();
|
void setEmptyTitleBar();
|
||||||
|
|
||||||
//! Set null (nullptr) title bar
|
//! Set null (nullptr) title bar
|
||||||
void setNullTitleBar();
|
void setNullTitleBarWidget();
|
||||||
|
|
||||||
//! Margins when window is floating
|
//! Margins when window is floating
|
||||||
void setMarginsWhenFloating(const QMargins &margins);
|
void setMarginsWhenFloating(const QMargins &margins);
|
||||||
@@ -54,12 +54,21 @@ namespace BlackGui
|
|||||||
//! Margins when window is floating
|
//! Margins when window is floating
|
||||||
void setMarginsWhenFloating(int left, int top, int right, int bottom);
|
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
|
//! Margins when widget is floating
|
||||||
void setMarginsWhenDocked(const QMargins &margins);
|
void setMarginsWhenDocked(const QMargins &margins);
|
||||||
|
|
||||||
//! Margins when widget is floating
|
//! Margins when widget is floating
|
||||||
void setMarginsWhenDocked(int left, int top, int right, int bottom);
|
void setMarginsWhenDocked(int left, int top, int right, int bottom);
|
||||||
|
|
||||||
|
//! Set margings from .ini file
|
||||||
|
bool setMarginsFromSettings(const QString §ion = "");
|
||||||
|
|
||||||
//! Window title backup
|
//! Window title backup
|
||||||
const QString &windowTitleBackup() const { return this->m_windowTitleBackup; }
|
const QString &windowTitleBackup() const { return this->m_windowTitleBackup; }
|
||||||
|
|
||||||
@@ -91,6 +100,9 @@ namespace BlackGui
|
|||||||
//! Position offset when floating first time
|
//! Position offset when floating first time
|
||||||
void setOffsetWhenFloating(const QPoint &point) { this->m_offsetWhenFloating = point; }
|
void setOffsetWhenFloating(const QPoint &point) { this->m_offsetWhenFloating = point; }
|
||||||
|
|
||||||
|
//! \copydoc CEnableForFramelessWindow::setFrameless
|
||||||
|
virtual void setFrameless(bool frameless) override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! Toggle floating
|
//! Toggle floating
|
||||||
void toggleFloating();
|
void toggleFloating();
|
||||||
@@ -98,6 +110,9 @@ namespace BlackGui
|
|||||||
//! Toggle visibility
|
//! Toggle visibility
|
||||||
void toggleVisibility();
|
void toggleVisibility();
|
||||||
|
|
||||||
|
//! Toggle frameless mode (EXPERIMENTAL)
|
||||||
|
void toggleFrameless();
|
||||||
|
|
||||||
//! Set title and internally keep a backup
|
//! Set title and internally keep a backup
|
||||||
void setWindowTitle(const QString &title);
|
void setWindowTitle(const QString &title);
|
||||||
|
|
||||||
@@ -115,6 +130,9 @@ namespace BlackGui
|
|||||||
//! Constructor
|
//! Constructor
|
||||||
explicit CDockWidget(QWidget *parent = nullptr);
|
explicit CDockWidget(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
CDockWidget(bool allowStatusBar, QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Override close event
|
//! Override close event
|
||||||
virtual void closeEvent(QCloseEvent *event) override;
|
virtual void closeEvent(QCloseEvent *event) override;
|
||||||
|
|
||||||
@@ -141,18 +159,19 @@ namespace BlackGui
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Top level has been chaged
|
//! Top level has been chaged
|
||||||
virtual void ps_onTopLevelChanged(bool topLevel);
|
void ps_onTopLevelChanged(bool topLevel);
|
||||||
|
|
||||||
//! Context menu
|
//! Context menu
|
||||||
virtual void ps_showContextMenu(const QPoint &pos);
|
void ps_showContextMenu(const QPoint &pos);
|
||||||
|
|
||||||
//! Visibility has changed
|
//! Visibility has changed
|
||||||
virtual void ps_onVisibilityChanged(bool visible);
|
void ps_onVisibilityChanged(bool visible);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *m_titleBarWidgetEmpty = nullptr; //!< replacing default title bar
|
QWidget *m_titleBarWidgetEmpty = nullptr; //!< replacing default title bar
|
||||||
QWidget *m_titleBarWidgetOriginal = nullptr; //!< the original title bar
|
QWidget *m_titleBarWidgetOriginal = nullptr; //!< the original title bar
|
||||||
QMargins m_marginsWhenFloating; //!< Offsets when window is floating
|
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
|
QMargins m_marginsWhenDocked; //!< Offsets when window is docked
|
||||||
CManagedStatusBar m_statusBar; //!< Status bar when floating
|
CManagedStatusBar m_statusBar; //!< Status bar when floating
|
||||||
QString m_windowTitleBackup; //!< original title, even if the widget title is deleted for layout purposes
|
QString m_windowTitleBackup; //!< original title, even if the widget title is deleted for layout purposes
|
||||||
@@ -171,6 +190,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
//! Init status bar
|
//! Init status bar
|
||||||
void initStatusBar();
|
void initStatusBar();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -22,9 +22,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
CDockWidgetInfoBar::CDockWidgetInfoBar(QWidget *parent) : CDockWidget(parent)
|
CDockWidgetInfoBar::CDockWidgetInfoBar(QWidget *parent) : CDockWidget(parent)
|
||||||
{
|
{
|
||||||
this->setProperty("frameless", CGuiUtility::isMainWindowFrameless());
|
this->setWindowTitle("Info status bar");
|
||||||
this->setMarginsWhenDocked(0, 0, 0, -1);
|
|
||||||
this->setWindowTitle("Info bar");
|
|
||||||
this->setWindowIcon(CIcons::swift24());
|
this->setWindowIcon(CIcons::swift24());
|
||||||
this->ps_onStyleSheetsChanged();
|
this->ps_onStyleSheetsChanged();
|
||||||
}
|
}
|
||||||
@@ -37,6 +35,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CDockWidgetInfoBar::ps_onStyleSheetsChanged()
|
void CDockWidgetInfoBar::ps_onStyleSheetsChanged()
|
||||||
{
|
{
|
||||||
|
if (!this->objectName().isEmpty()) { this->setMarginsFromSettings(); }
|
||||||
QString st = CStyleSheetUtility::instance().style(CStyleSheetUtility::fileNameInfoBar());
|
QString st = CStyleSheetUtility::instance().style(CStyleSheetUtility::fileNameInfoBar());
|
||||||
this->setStyleSheet(st);
|
this->setStyleSheet(st);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include "enableforframelesswindow.h"
|
#include "enableforframelesswindow.h"
|
||||||
#include "blackmisc/icons.h"
|
#include "blackmisc/icons.h"
|
||||||
#include <QSizeGrip>
|
#include "blackmisc/blackmiscfreefunctions.h"
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
@@ -28,6 +28,7 @@ namespace BlackGui
|
|||||||
void CEnableForFramelessWindow::setMode(CEnableForFramelessWindow::WindowMode mode)
|
void CEnableForFramelessWindow::setMode(CEnableForFramelessWindow::WindowMode mode)
|
||||||
{
|
{
|
||||||
if (mode == this->m_windowMode) { return; }
|
if (mode == this->m_windowMode) { return; }
|
||||||
|
// set the main window or dock widget
|
||||||
this->m_widget->setWindowFlags(modeToWindowFlags(mode));
|
this->m_widget->setWindowFlags(modeToWindowFlags(mode));
|
||||||
this->setWindowAttributes(mode);
|
this->setWindowAttributes(mode);
|
||||||
this->m_widget->show();
|
this->m_widget->show();
|
||||||
@@ -45,7 +46,9 @@ namespace BlackGui
|
|||||||
// 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);
|
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)
|
bool CEnableForFramelessWindow::handleMouseMoveEvent(QMouseEvent *event)
|
||||||
@@ -72,12 +75,25 @@ namespace BlackGui
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEnableForFramelessWindow::addFramelessSizeGrip(QStatusBar *statusBar)
|
void CEnableForFramelessWindow::addFramelessSizeGripToStatusBar(QStatusBar *statusBar)
|
||||||
{
|
{
|
||||||
if (!statusBar) { return; }
|
if (!statusBar) { return; }
|
||||||
QSizeGrip *grip = new QSizeGrip(this->m_widget);
|
if (!this->m_framelessSizeGrip)
|
||||||
grip->setObjectName("sg_FramelessSizeGrip");
|
{
|
||||||
statusBar->addPermanentWidget(grip);
|
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)
|
QHBoxLayout *CEnableForFramelessWindow::addFramelessCloseButton(QMenuBar *menuBar)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
|
#include <QSizeGrip>
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
@@ -42,7 +43,7 @@ namespace BlackGui
|
|||||||
void setMode(WindowMode mode);
|
void setMode(WindowMode mode);
|
||||||
|
|
||||||
//! Framless
|
//! Framless
|
||||||
void setFrameless(bool frameless);
|
virtual void setFrameless(bool frameless);
|
||||||
|
|
||||||
//! Frameless?
|
//! Frameless?
|
||||||
bool isFrameless() const { return this->m_windowMode == WindowFrameless; }
|
bool isFrameless() const { return this->m_windowMode == WindowFrameless; }
|
||||||
@@ -55,7 +56,10 @@ namespace BlackGui
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Resize grip handle
|
//! Resize grip handle
|
||||||
void addFramelessSizeGrip(QStatusBar *statusBar);
|
void addFramelessSizeGripToStatusBar(QStatusBar *statusBar);
|
||||||
|
|
||||||
|
//! Resize grip handle
|
||||||
|
void hideFramelessSizeGripInStatusBar();
|
||||||
|
|
||||||
//! Attributes
|
//! Attributes
|
||||||
void setWindowAttributes(WindowMode mode);
|
void setWindowAttributes(WindowMode mode);
|
||||||
@@ -71,6 +75,7 @@ namespace BlackGui
|
|||||||
WindowMode m_windowMode = WindowNormal; //!< Window mode, \sa WindowMode
|
WindowMode m_windowMode = WindowNormal; //!< Window mode, \sa WindowMode
|
||||||
bool m_mainApplicationWindow = false; //!< is the main application window (only 1)
|
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 main window or dock widget
|
||||||
|
QSizeGrip *m_framelessSizeGrip = nullptr;
|
||||||
|
|
||||||
//! Mouse press, required for frameless window
|
//! Mouse press, required for frameless window
|
||||||
bool handleMousePressEvent(QMouseEvent *event);
|
bool handleMousePressEvent(QMouseEvent *event);
|
||||||
|
|||||||
@@ -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)
|
void CInfoArea::setMarginsWhenDocked(int left, int top, int right, int bottom)
|
||||||
{
|
{
|
||||||
for (CDockWidgetInfoArea *dw : this->m_dockWidgetInfoAreas)
|
for (CDockWidgetInfoArea *dw : this->m_dockWidgetInfoAreas)
|
||||||
@@ -534,24 +543,21 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CInfoArea::iniFileBasedSettings()
|
void CInfoArea::iniFileBasedSettings()
|
||||||
{
|
{
|
||||||
|
const QString section(this->objectName());
|
||||||
const QSettings *settings = CStyleSheetUtility::instance().iniFile();
|
const QSettings *settings = CStyleSheetUtility::instance().iniFile();
|
||||||
if (settings)
|
if (settings && !section.isEmpty())
|
||||||
{
|
{
|
||||||
this->setMarginsWhenDocked(
|
for (CDockWidgetInfoArea *dw : this->m_dockWidgetInfoAreas)
|
||||||
settings->value("infoarea/margindocked.left").toInt(),
|
{
|
||||||
settings->value("infoarea/margindocked.top").toInt(),
|
//! Margins when window is floating
|
||||||
settings->value("infoarea/margindocked.right").toInt(),
|
dw->setMarginsFromSettings(section);
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// some defaut if not available
|
// some defaults if not available
|
||||||
this->setMarginsWhenFloating(10, 10, 20, 20); // left, top, right, bottom
|
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
|
this->setMarginsWhenDocked(1, 1, 1, 1); // top has no effect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,6 +182,9 @@ namespace BlackGui
|
|||||||
//! Margins for the floating widgets
|
//! Margins for the floating widgets
|
||||||
void setMarginsWhenFloating(int left, int top, int right, int bottom);
|
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
|
//! Margins for the dockable widgets
|
||||||
void setMarginsWhenDocked(int left, int top, int right, int bottom);
|
void setMarginsWhenDocked(int left, int top, int right, int bottom);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
[infoarea]
|
[alias]
|
||||||
; margins as used in infoarea.cpp
|
; 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.left = 1
|
||||||
margindocked.right = 1
|
margindocked.right = 1
|
||||||
margindocked.top = 1
|
margindocked.top = 1
|
||||||
@@ -8,4 +15,41 @@ margindocked.bottom = 1
|
|||||||
marginfloating.left = 5
|
marginfloating.left = 5
|
||||||
marginfloating.right = 20
|
marginfloating.right = 20
|
||||||
marginfloating.top = 5
|
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
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
|
/** style is applied to a CDockWidgetInfoBar **/
|
||||||
|
/** frameless is dynamic property**/
|
||||||
|
/** for frameless only use QDockWidget[frameless="true"] QFrame **/
|
||||||
|
|
||||||
QFrame {
|
QFrame {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding-left: 6px;
|
padding-left: 6px;
|
||||||
padding-right: 6px;
|
padding-right: 6px;
|
||||||
padding-bottom: 0px;
|
padding-bottom: 0px;
|
||||||
}
|
padding-top: 0px;
|
||||||
|
|
||||||
/** frameless is dynamic property**/
|
|
||||||
/** for frameless only use QDockWidget[frameless="true"] QFrame **/
|
|
||||||
QDockWidget QFrame
|
|
||||||
{
|
|
||||||
background-color: darkslategray;
|
background-color: darkslategray;
|
||||||
background-image: url(:/textures/icons/textures/texture-outer.jpg);
|
background-image: url(:/textures/icons/textures/texture-outer.jpg);
|
||||||
border: 0px;
|
border: 0px;
|
||||||
|
|||||||
@@ -19,25 +19,29 @@ QMainWindow {
|
|||||||
|
|
||||||
/** required when dock widget is floating **/
|
/** required when dock widget is floating **/
|
||||||
/** background-image not working on QDockWidget, so I use direct children **/
|
/** background-image not working on QDockWidget, so I use direct children **/
|
||||||
#sw_MainMiddle BlackGui--CDockWidgetInfoArea {
|
BlackGui--CDockWidgetInfoArea[frameless="false"] {
|
||||||
background-color: black;
|
background-color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BlackGui--CDockWidgetInfoArea[frameless="true"] {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
/** this is the first widget in the dock area **/
|
/** this is the first widget in the dock area **/
|
||||||
/** all dock widgets shall have this QWidget as container **/
|
/** all dock widgets shall have this QWidget as container **/
|
||||||
#sw_MainMiddle BlackGui--CDockWidgetInfoArea > QWidget {
|
BlackGui--CDockWidgetInfoArea > QWidget {
|
||||||
background-color: black;
|
background-color: black;
|
||||||
background-image: url(:/textures/icons/textures/texture-inner.jpg);
|
background-image: url(:/textures/icons/textures/texture-inner.jpg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the following QFrame, likely the component itself
|
/** the following QFrame, likely the component itself
|
||||||
#sw_MainMiddle BlackGui--CDockWidgetInfoArea > QWidget > QFrame {
|
BlackGui--CDockWidgetInfoArea > QWidget > QFrame {
|
||||||
border: 0px;
|
border: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** fix the menu, which is overridden by the above QWidget **/
|
/** 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 */
|
border: 1px solid darkslategray; /* reserve space for selection border */
|
||||||
background: lightgray;
|
background: lightgray;
|
||||||
color: black;
|
color: black;
|
||||||
@@ -74,7 +78,10 @@ QAbstractScrollArea #pg_StatusPageConsole { background-color: black; }
|
|||||||
/** dw_InfoBarStatus has its own style sheet **/
|
/** dw_InfoBarStatus has its own style sheet **/
|
||||||
|
|
||||||
#fr_CentralFrameInside {
|
#fr_CentralFrameInside {
|
||||||
margin: 5px;
|
margin-right: 5px;
|
||||||
|
margin-left: 5px;
|
||||||
|
margin-top: 2px;
|
||||||
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#gb_AtcStationsOnlineInfo {
|
#gb_AtcStationsOnlineInfo {
|
||||||
|
|||||||
@@ -413,9 +413,14 @@ QString BlackMisc::boolToOnOff(bool v, bool i18n)
|
|||||||
return v ? "on" : "off";
|
return v ? "on" : "off";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString BlackMisc::boolToYesNo(bool v, bool i18n)
|
QString BlackMisc::boolToYesNo(bool v, bool i18n)
|
||||||
{
|
{
|
||||||
Q_UNUSED(i18n);
|
Q_UNUSED(i18n);
|
||||||
return v ? "yes" : "no";
|
return v ? "yes" : "no";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString BlackMisc::boolToTrueFalse(bool v, bool i18n)
|
||||||
|
{
|
||||||
|
Q_UNUSED(i18n);
|
||||||
|
return v ? "true" : "false";
|
||||||
|
}
|
||||||
|
|||||||
@@ -177,6 +177,9 @@ namespace BlackMisc
|
|||||||
//! Bool to yes / no
|
//! Bool to yes / no
|
||||||
QString boolToYesNo(bool v, bool i18n = false);
|
QString boolToYesNo(bool v, bool i18n = false);
|
||||||
|
|
||||||
|
//! Bool to true / false
|
||||||
|
QString boolToTrueFalse(bool v, bool i18n = false);
|
||||||
|
|
||||||
//! Get local host name
|
//! Get local host name
|
||||||
const QString &localHostName();
|
const QString &localHostName();
|
||||||
|
|
||||||
|
|||||||
@@ -308,17 +308,6 @@ void SwiftGuiStd::ps_onChangedMainInfoAreaFloating(bool floating)
|
|||||||
Q_UNUSED(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
|
void SwiftGuiStd::playNotifcationSound(CNotificationSounds::Notification notification) const
|
||||||
{
|
{
|
||||||
if (!this->m_contextAudioAvailable) return;
|
if (!this->m_contextAudioAvailable) return;
|
||||||
|
|||||||
@@ -58,7 +58,8 @@ public:
|
|||||||
{
|
{
|
||||||
MainPageInfoArea = 0,
|
MainPageInfoArea = 0,
|
||||||
MainPageLogin = 1,
|
MainPageLogin = 1,
|
||||||
MainPageInternals = 2
|
MainPageInternals = 2,
|
||||||
|
MainPageInvisible = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
@@ -121,9 +122,6 @@ private:
|
|||||||
//! Init GUI signals
|
//! Init GUI signals
|
||||||
void initGuiSignals();
|
void initGuiSignals();
|
||||||
|
|
||||||
//! Init the navigstion bars
|
|
||||||
void initNavigationBars();
|
|
||||||
|
|
||||||
//! Init dynamic menus
|
//! Init dynamic menus
|
||||||
void initDynamicMenus();
|
void initDynamicMenus();
|
||||||
|
|
||||||
@@ -240,13 +238,6 @@ private slots:
|
|||||||
|
|
||||||
//! Whole main info area floating
|
//! Whole main info area floating
|
||||||
void ps_onChangedMainInfoAreaFloating(bool floating);
|
void ps_onChangedMainInfoAreaFloating(bool floating);
|
||||||
|
|
||||||
//! Toggle horizontal navigator
|
|
||||||
void ps_toggleNavigatorHorizontal();
|
|
||||||
|
|
||||||
//! Toggle vertical navigator
|
|
||||||
void ps_toggleNavigatorVertical();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pop_macro("interface")
|
#pragma pop_macro("interface")
|
||||||
|
|||||||
@@ -90,6 +90,9 @@
|
|||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vl_CentralFrameInside">
|
<layout class="QVBoxLayout" name="vl_CentralFrameInside">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@@ -125,7 +128,7 @@
|
|||||||
<enum>QFrame::NoFrame</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="pg_MainInfoArea">
|
<widget class="QWidget" name="pg_MainInfoArea">
|
||||||
<layout class="QVBoxLayout" name="vl_MainInfoArea">
|
<layout class="QVBoxLayout" name="vl_MainInfoArea">
|
||||||
@@ -193,6 +196,13 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="pg_InvisibleAreas">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="BlackGui::Components::CInvisibleInfoAreaComponent" name="comp_InvisibleInfoArea" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -305,8 +315,7 @@
|
|||||||
<addaction name="menu_WindowFont"/>
|
<addaction name="menu_WindowFont"/>
|
||||||
<addaction name="menu_WindowMinimize"/>
|
<addaction name="menu_WindowMinimize"/>
|
||||||
<addaction name="menu_WindowToggleOnTop"/>
|
<addaction name="menu_WindowToggleOnTop"/>
|
||||||
<addaction name="menu_NavigatorVertical"/>
|
<addaction name="menu_WindowToggleNavigator"/>
|
||||||
<addaction name="menu_NavigatorHorizontal"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menu_File"/>
|
<addaction name="menu_File"/>
|
||||||
<addaction name="menuWindow"/>
|
<addaction name="menuWindow"/>
|
||||||
@@ -344,46 +353,34 @@
|
|||||||
<property name="allowedAreas">
|
<property name="allowedAreas">
|
||||||
<set>Qt::TopDockWidgetArea</set>
|
<set>Qt::TopDockWidgetArea</set>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Info status bar</string>
|
||||||
|
</property>
|
||||||
<attribute name="dockWidgetArea">
|
<attribute name="dockWidgetArea">
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</attribute>
|
</attribute>
|
||||||
<widget class="BlackGui::Components::CInfoBarStatusComponent" name="comp_InfoBarStatus"/>
|
<widget class="QWidget" name="qw_InfoBarStatusInner">
|
||||||
</widget>
|
<layout class="QVBoxLayout" name="vl_InfoBarStatusOuter">
|
||||||
<widget class="BlackGui::Components::CNavigatorDockWidget" name="ndw_NavigatorHorizontal">
|
<property name="spacing">
|
||||||
<property name="floating">
|
<number>0</number>
|
||||||
<bool>false</bool>
|
</property>
|
||||||
</property>
|
<property name="leftMargin">
|
||||||
<property name="features">
|
<number>0</number>
|
||||||
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
|
</property>
|
||||||
</property>
|
<property name="topMargin">
|
||||||
<property name="allowedAreas">
|
<number>0</number>
|
||||||
<set>Qt::NoDockWidgetArea</set>
|
</property>
|
||||||
</property>
|
<property name="rightMargin">
|
||||||
<property name="windowTitle">
|
<number>0</number>
|
||||||
<string>Horizontal navigator</string>
|
</property>
|
||||||
</property>
|
<property name="bottomMargin">
|
||||||
<attribute name="dockWidgetArea">
|
<number>0</number>
|
||||||
<number>1</number>
|
</property>
|
||||||
</attribute>
|
<item alignment="Qt::AlignTop">
|
||||||
<widget class="QWidget" name="qw_NavigatorHorizontal"/>
|
<widget class="BlackGui::Components::CInfoBarStatusComponent" name="comp_InfoBarStatus" native="true"/>
|
||||||
</widget>
|
</item>
|
||||||
<widget class="BlackGui::Components::CNavigatorDockWidget" name="ndw_NavigatorVertical">
|
</layout>
|
||||||
<property name="floating">
|
</widget>
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="features">
|
|
||||||
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
|
|
||||||
</property>
|
|
||||||
<property name="allowedAreas">
|
|
||||||
<set>Qt::NoDockWidgetArea</set>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Vertical navigator</string>
|
|
||||||
</property>
|
|
||||||
<attribute name="dockWidgetArea">
|
|
||||||
<number>1</number>
|
|
||||||
</attribute>
|
|
||||||
<widget class="QWidget" name="qw_NavigatorVertical"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
<action name="menu_TestLocationsEDDF">
|
<action name="menu_TestLocationsEDDF">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -466,9 +463,9 @@
|
|||||||
<string>Ctrl+W, Ctrl+T</string>
|
<string>Ctrl+W, Ctrl+T</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="menu_NavigatorVertical">
|
<action name="menu_WindowToggleNavigator">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Vertical navigator</string>
|
<string>Navigator</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="menu_NavigatorHorizontal">
|
<action name="menu_NavigatorHorizontal">
|
||||||
@@ -516,9 +513,9 @@
|
|||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>BlackGui::Components::CNavigatorDockWidget</class>
|
<class>BlackGui::Components::CInvisibleInfoAreaComponent</class>
|
||||||
<extends>QDockWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header>blackgui/components/navigatordockwidget.h</header>
|
<header>blackgui/components/invisibleinfoareacomponent.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ using namespace BlackGui::Components;
|
|||||||
*/
|
*/
|
||||||
void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig)
|
void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig)
|
||||||
{
|
{
|
||||||
|
// POST(!) GUI init
|
||||||
|
|
||||||
if (this->m_init) { return; }
|
if (this->m_init) { return; }
|
||||||
this->setVisible(false); // hide all, so no flashing windows during init
|
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);
|
this->ui->vl_CentralWidgetOutside->addWidget(this->ui->sb_MainStatusBar, 0);
|
||||||
|
|
||||||
// grip
|
// grip
|
||||||
this->addFramelessSizeGrip(this->ui->sb_MainStatusBar);
|
this->addFramelessSizeGripToStatusBar(this->ui->sb_MainStatusBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
// timers
|
// timers
|
||||||
@@ -74,13 +76,14 @@ void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig)
|
|||||||
this->createRuntime(runtimeConfig, this);
|
this->createRuntime(runtimeConfig, this);
|
||||||
CEnableForRuntime::setRuntimeForComponents(this->getRuntime(), 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
|
// wire GUI signals
|
||||||
this->initGuiSignals();
|
this->initGuiSignals();
|
||||||
|
|
||||||
// status bar
|
|
||||||
this->ui->dw_InfoBarStatus->allowStatusBar(false);
|
|
||||||
this->m_statusBar.initStatusBar(this->ui->sb_MainStatusBar);
|
|
||||||
|
|
||||||
// signal / slots contexts / timers
|
// signal / slots contexts / timers
|
||||||
connect(this->getIContextNetwork(), &IContextNetwork::connectionTerminated, this, &SwiftGuiStd::ps_onConnectionTerminated);
|
connect(this->getIContextNetwork(), &IContextNetwork::connectionTerminated, this, &SwiftGuiStd::ps_onConnectionTerminated);
|
||||||
connect(this->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &SwiftGuiStd::ps_onConnectionStatusChanged);
|
connect(this->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &SwiftGuiStd::ps_onConnectionStatusChanged);
|
||||||
@@ -105,9 +108,6 @@ void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig)
|
|||||||
this->ps_setMainPageToInfoArea();
|
this->ps_setMainPageToInfoArea();
|
||||||
this->initDynamicMenus();
|
this->initDynamicMenus();
|
||||||
|
|
||||||
// navigation bars
|
|
||||||
// this->initNavigationBars();
|
|
||||||
|
|
||||||
// starting
|
// starting
|
||||||
this->getIContextApplication()->notifyAboutComponentChange(IContextApplication::ApplicationGui, IContextApplication::ApplicationStarts);
|
this->getIContextApplication()->notifyAboutComponentChange(IContextApplication::ApplicationGui, IContextApplication::ApplicationStarts);
|
||||||
|
|
||||||
@@ -128,15 +128,6 @@ void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig)
|
|||||||
this->m_init = true;
|
this->m_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Init navigation bars
|
|
||||||
*/
|
|
||||||
void SwiftGuiStd::initNavigationBars()
|
|
||||||
{
|
|
||||||
ui->ndw_NavigatorHorizontal->setVisible(false);
|
|
||||||
ui->ndw_NavigatorVertical->setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GUI signals
|
* GUI signals
|
||||||
*/
|
*/
|
||||||
@@ -170,9 +161,8 @@ void SwiftGuiStd::initGuiSignals()
|
|||||||
connect(this->ui->menu_WindowFont, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
|
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_WindowMinimize, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
|
||||||
connect(this->ui->menu_WindowToggleOnTop, &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_WindowToggleNavigator, &QAction::triggered, this->ui->comp_InvisibleInfoArea, &CInvisibleInfoAreaComponent::toggleNavigator);
|
||||||
connect(this->ui->menu_NavigatorVertical, &QAction::triggered, this, &SwiftGuiStd::ps_toggleNavigatorVertical);
|
connect(this->ui->menu_DebugMetaTypes, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
|
||||||
connect(this->ui->menu_DebugMetaTypes, &QAction::triggered, this, &SwiftGuiStd::ps_toggleNavigatorHorizontal);
|
|
||||||
|
|
||||||
// command line / text messages
|
// command line / text messages
|
||||||
connect(this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::displayInInfoWindow, this->m_compInfoWindow, &CInfoWindowComponent::display);
|
connect(this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::displayInInfoWindow, this->m_compInfoWindow, &CInfoWindowComponent::display);
|
||||||
|
|||||||
Reference in New Issue
Block a user