mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 09:45:44 +08:00
refs #432, components for core GUI
* register: show applications connected with core * info area, allow to add new areas in core GUI
This commit is contained in:
75
src/blackgui/components/coreinfoareacomponent.cpp
Normal file
75
src/blackgui/components/coreinfoareacomponent.cpp
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
/* 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 "coreinfoareacomponent.h"
|
||||||
|
#include "ui_coreinfoareacomponent.h"
|
||||||
|
#include "blackgui/components/logcomponent.h"
|
||||||
|
#include "blackgui/components/corestatuscomponent.h"
|
||||||
|
#include "blackgui/stylesheetutility.h"
|
||||||
|
#include "blackgui/guiutility.h"
|
||||||
|
#include "blackmisc/icons.h"
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QListIterator>
|
||||||
|
#include <QSignalMapper>
|
||||||
|
#include <QCloseEvent>
|
||||||
|
|
||||||
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackGui;
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Components
|
||||||
|
{
|
||||||
|
CCoreInfoAreaComponent::CCoreInfoAreaComponent(QWidget *parent) :
|
||||||
|
CInfoArea(parent),
|
||||||
|
ui(new Ui::CCoreInfoAreaComponent)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
initInfoArea();
|
||||||
|
ps_toggleTabBarLocked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
CCoreInfoAreaComponent::~CCoreInfoAreaComponent()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
CLogComponent *CCoreInfoAreaComponent::getLogComponent()
|
||||||
|
{
|
||||||
|
return this->ui->comp_Log;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCoreStatusComponent *CCoreInfoAreaComponent::getStatusComponent()
|
||||||
|
{
|
||||||
|
return this->ui->comp_Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize CCoreInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const
|
||||||
|
{
|
||||||
|
InfoArea area = static_cast<InfoArea>(areaIndex);
|
||||||
|
switch (area)
|
||||||
|
{
|
||||||
|
case InfoAreaLog:
|
||||||
|
return QSize(400, 300);
|
||||||
|
default:
|
||||||
|
return QSize(400, 300);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const QPixmap &CCoreInfoAreaComponent::indexToPixmap(int areaIndex) const
|
||||||
|
{
|
||||||
|
InfoArea area = static_cast<InfoArea>(areaIndex);
|
||||||
|
switch (area)
|
||||||
|
{
|
||||||
|
case InfoAreaLog:
|
||||||
|
return CIcons::appLog16();
|
||||||
|
default:
|
||||||
|
return CIcons::statusBar16();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
77
src/blackgui/components/coreinfoareacomponent.h
Normal file
77
src/blackgui/components/coreinfoareacomponent.h
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! \file
|
||||||
|
|
||||||
|
#ifndef BLACKGUI_COREINFOAREACOMPONENT_H
|
||||||
|
#define BLACKGUI_COREINFOAREACOMPONENT_H
|
||||||
|
|
||||||
|
#include "blackgui/blackguiexport.h"
|
||||||
|
#include "../infoarea.h"
|
||||||
|
#include <QTabBar>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QScopedPointer>
|
||||||
|
|
||||||
|
namespace Ui { class CCoreInfoAreaComponent; }
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Components
|
||||||
|
{
|
||||||
|
// break compile dependency
|
||||||
|
class CLogComponent;
|
||||||
|
class CCoreStatusComponent;
|
||||||
|
|
||||||
|
//! Main info area
|
||||||
|
class BLACKGUI_EXPORT CCoreInfoAreaComponent : public BlackGui::CInfoArea
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
explicit CCoreInfoAreaComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CCoreInfoAreaComponent();
|
||||||
|
|
||||||
|
//! Info areas
|
||||||
|
enum InfoArea
|
||||||
|
{
|
||||||
|
// index must match tab index!
|
||||||
|
InfoAreaLog = 0,
|
||||||
|
InfoAreaStatus = 1,
|
||||||
|
InfoAreaNone = -1
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Log messages
|
||||||
|
CLogComponent *getLogComponent();
|
||||||
|
|
||||||
|
//! Simulator
|
||||||
|
CCoreStatusComponent *getStatusComponent();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
//! Toggle floating of given area
|
||||||
|
void toggleFloating(InfoArea infoArea) { CInfoArea::toggleFloatingByIndex(static_cast<int>(infoArea)); }
|
||||||
|
|
||||||
|
//! Select area
|
||||||
|
void selectArea(InfoArea infoArea) { CInfoArea::selectArea(static_cast<int>(infoArea)); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! \copydoc CInfoArea::getPreferredSizeWhenFloating
|
||||||
|
virtual QSize getPreferredSizeWhenFloating(int areaIndex) const override;
|
||||||
|
|
||||||
|
//! \copydoc CInfoArea::indexToPixmap
|
||||||
|
virtual const QPixmap &indexToPixmap(int areaIndex) const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QScopedPointer<Ui::CCoreInfoAreaComponent> ui;
|
||||||
|
};
|
||||||
|
} // ns
|
||||||
|
} // ns
|
||||||
|
|
||||||
|
#endif // guard
|
||||||
220
src/blackgui/components/coreinfoareacomponent.ui
Normal file
220
src/blackgui/components/coreinfoareacomponent.ui
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CCoreInfoAreaComponent</class>
|
||||||
|
<widget class="QMainWindow" name="CCoreInfoAreaComponent">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1533</width>
|
||||||
|
<height>242</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Main info area</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset resource="../../blackmisc/blackmisc.qrc">
|
||||||
|
<normaloff>:/own/icons/own/swift/swift24.png</normaloff>:/own/icons/own/swift/swift24.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="animated">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="documentMode">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="dockNestingEnabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="dockOptions">
|
||||||
|
<set>QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks</set>
|
||||||
|
</property>
|
||||||
|
<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_Log">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>70</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="allowedAreas">
|
||||||
|
<set>Qt::TopDockWidgetArea</set>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Log</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="dockWidgetArea">
|
||||||
|
<number>4</number>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QWidget" name="qw_LogOuter">
|
||||||
|
<layout class="QVBoxLayout" name="vl_LogOuter">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="fr_LogInner">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="vl_LogInner">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="BlackGui::Components::CLogComponent" name="comp_Log" native="true">
|
||||||
|
<property name="lineWidth" stdset="0">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="BlackGui::CDockWidgetInfoArea" name="dwp_Status">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>165</width>
|
||||||
|
<height>66</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="allowedAreas">
|
||||||
|
<set>Qt::TopDockWidgetArea</set>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Status</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="dockWidgetArea">
|
||||||
|
<number>4</number>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QWidget" name="qw_StatusOuter">
|
||||||
|
<layout class="QVBoxLayout" name="vl_SettingsOuter">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="fr_StatusInner">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="vl_SettingsInner">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="BlackGui::Components::CCoreStatusComponent" name="comp_Status">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Components::CLogComponent</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>blackgui/components/logcomponent.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::CDockWidgetInfoArea</class>
|
||||||
|
<extends>QDockWidget</extends>
|
||||||
|
<header>blackgui/dockwidgetinfoarea.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Components::CCoreStatusComponent</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header>blackgui/components/corestatuscomponent.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources>
|
||||||
|
<include location="../../blackmisc/blackmisc.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
27
src/blackgui/components/corestatuscomponent.cpp
Normal file
27
src/blackgui/components/corestatuscomponent.cpp
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/* 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 "corestatuscomponent.h"
|
||||||
|
#include "ui_corestatuscomponent.h"
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Components
|
||||||
|
{
|
||||||
|
CCoreStatusComponent::CCoreStatusComponent(QWidget *parent) :
|
||||||
|
QFrame(parent),
|
||||||
|
ui(new Ui::CCoreStatusComponent)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
CCoreStatusComponent::~CCoreStatusComponent() { }
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
} // namespacee
|
||||||
43
src/blackgui/components/corestatuscomponent.h
Normal file
43
src/blackgui/components/corestatuscomponent.h
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
/* 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_CORESTATUSCOMPONENT_H
|
||||||
|
#define BLACKGUI_COMPONENTS_CORESTATUSCOMPONENT_H
|
||||||
|
|
||||||
|
#include "blackgui/blackguiexport.h"
|
||||||
|
#include <QFrame>
|
||||||
|
#include <QScopedPointer>
|
||||||
|
|
||||||
|
namespace Ui { class CCoreStatusComponent; }
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Components
|
||||||
|
{
|
||||||
|
|
||||||
|
//! Display status information about the core
|
||||||
|
class BLACKGUI_EXPORT CCoreStatusComponent : public QFrame
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
explicit CCoreStatusComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
~CCoreStatusComponent();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QScopedPointer<Ui::CCoreStatusComponent> ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif // guard
|
||||||
66
src/blackgui/components/corestatuscomponent.ui
Normal file
66
src/blackgui/components/corestatuscomponent.ui
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CCoreStatusComponent</class>
|
||||||
|
<widget class="QFrame" name="CCoreStatusComponent">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Frame</string>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="vl_CoreStatusComponent">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="BlackGui::Components::CRegisterComponent" name="comp_Registered">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Components::CRegisterComponent</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header>blackgui/components/registercomponent.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
44
src/blackgui/components/registercomponent.cpp
Normal file
44
src/blackgui/components/registercomponent.cpp
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/* 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 "registercomponent.h"
|
||||||
|
#include "ui_registercomponent.h"
|
||||||
|
#include "blackcore/context_application.h"
|
||||||
|
|
||||||
|
using namespace BlackCore;
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Components
|
||||||
|
{
|
||||||
|
CRegisterComponent::CRegisterComponent(QWidget *parent) :
|
||||||
|
QFrame(parent),
|
||||||
|
ui(new Ui::CRegisterComponent),
|
||||||
|
m_updateTimer(new CUpdateTimer("CRegisterComponent", &CRegisterComponent::ps_update, this))
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
CRegisterComponent::~CRegisterComponent()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
void CRegisterComponent::ps_update()
|
||||||
|
{
|
||||||
|
this->ui->tvp_RegisteredComponents->updateContainer(getIContextApplication()->getRegisteredApplications());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRegisterComponent::runtimeHasBeenSet()
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(getIContextApplication(), Q_FUNC_INFO, "Missing context");
|
||||||
|
m_updateTimer->setUpdateIntervalSeconds(20);
|
||||||
|
QObject::connect(getIContextApplication(), &IContextApplication::registrationChanged, this, &CRegisterComponent::ps_update);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // ns
|
||||||
|
} // ns
|
||||||
53
src/blackgui/components/registercomponent.h
Normal file
53
src/blackgui/components/registercomponent.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/* 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_REGISTERCOMPONENT_H
|
||||||
|
#define BLACKGUI_COMPONENTS_REGISTERCOMPONENT_H
|
||||||
|
|
||||||
|
#include "blackgui/components/enableforruntime.h"
|
||||||
|
#include "blackgui/components/updatetimer.h"
|
||||||
|
#include <QFrame>
|
||||||
|
|
||||||
|
namespace Ui { class CRegisterComponent; }
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Components
|
||||||
|
{
|
||||||
|
//! Register components in the GUI
|
||||||
|
class BLACKGUI_EXPORT CRegisterComponent :
|
||||||
|
public QFrame,
|
||||||
|
public CEnableForRuntime
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
explicit CRegisterComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
~CRegisterComponent();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! \copydoc CRuntimeBasedComponent::runtimeHasBeenSet
|
||||||
|
virtual void runtimeHasBeenSet() override;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
//! Update data
|
||||||
|
void ps_update();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QScopedPointer<Ui::CRegisterComponent> ui;
|
||||||
|
QScopedPointer<CUpdateTimer> m_updateTimer;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // ns
|
||||||
|
} // ns
|
||||||
|
|
||||||
|
#endif // guard
|
||||||
53
src/blackgui/components/registercomponent.ui
Normal file
53
src/blackgui/components/registercomponent.ui
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CRegisterComponent</class>
|
||||||
|
<widget class="QFrame" name="CRegisterComponent">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Frame</string>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="vl_RegisterComponent">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="BlackGui::Views::COriginatorView" name="tvp_RegisteredComponents">
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Views::COriginatorView</class>
|
||||||
|
<extends>QTableView</extends>
|
||||||
|
<header>blackgui/views/originatorview.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
Reference in New Issue
Block a user