82 lines
2.0 KiB
C++
82 lines
2.0 KiB
C++
#include "dvieSecondaryWindow.h"
|
|
#include "./ui_dvieSecondaryWindow.h"
|
|
#include "transparentMask.h"
|
|
#include "dvieMainWindow.h"
|
|
#include "dashboardFrame.h"
|
|
#include <QCloseEvent>
|
|
|
|
DvieSecondaryWindow::DvieSecondaryWindow(const QString& strName, QWidget *parent)
|
|
: QMainWindow(parent)
|
|
, ui(new Ui::dvieSecondaryWindow)
|
|
, m_pMainWindow(nullptr)
|
|
, m_pTransparentMask(nullptr)
|
|
, m_pDashboardFrame(nullptr)
|
|
|
|
{
|
|
ui->setupUi(this);
|
|
setProperty("windowType", "secondary");
|
|
|
|
m_strName = strName;
|
|
|
|
QString strDashboard = strName + "_dashboardFrame";
|
|
m_pDashboardFrame = new DashboardFrame(strDashboard, dashboardFrame::ft_secondary, this);
|
|
ui->centralLayout->addWidget(m_pDashboardFrame);
|
|
}
|
|
|
|
DvieSecondaryWindow::~DvieSecondaryWindow()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void DvieSecondaryWindow::showTransparentMask()
|
|
{
|
|
if(m_pTransparentMask == nullptr)
|
|
m_pTransparentMask = new TransparentMask(this);
|
|
|
|
m_pTransparentMask->setGeometry(ui->topWidget->geometry());
|
|
m_pTransparentMask->show();
|
|
}
|
|
void DvieSecondaryWindow::hideTransparentMask()
|
|
{
|
|
if(m_pTransparentMask != nullptr && m_pTransparentMask->isVisible())
|
|
m_pTransparentMask->hide();
|
|
}
|
|
|
|
void DvieSecondaryWindow::closeEvent(QCloseEvent* e)
|
|
{
|
|
if(m_pMainWindow)
|
|
m_pMainWindow->removeSecondartWindow(m_strName);
|
|
else
|
|
QMainWindow::closeEvent(e);
|
|
}
|
|
|
|
QString DvieSecondaryWindow::name()
|
|
{
|
|
return m_strName;
|
|
}
|
|
|
|
DashboardFrame* DvieSecondaryWindow::dashboardFrame()
|
|
{
|
|
return m_pDashboardFrame;
|
|
}
|
|
|
|
DashboardFrame* DvieSecondaryWindow::getDashboardFrame(const QString& strName)
|
|
{
|
|
if(m_pMainWindow)
|
|
return m_pMainWindow->getDashboardFrame(strName);
|
|
else
|
|
return nullptr;
|
|
}
|
|
|
|
void DvieSecondaryWindow::setMainWindow(DvieMainWindow* mainWindow)
|
|
{
|
|
m_pMainWindow = mainWindow;
|
|
}
|
|
|
|
void DvieSecondaryWindow::creatSecondaryWindowAndAddDashboard(QPoint pos, Dashboard* dashboard)
|
|
{
|
|
if(m_pMainWindow)
|
|
m_pMainWindow->creatSecondaryWindowAndAddDashboard(pos, dashboard);
|
|
}
|
|
|