2024-10-10 16:59:51 +08:00
|
|
|
|
#include "dvieMainWindow.h"
|
|
|
|
|
|
#include "./ui_dvieMainWindow.h"
|
2024-11-20 16:57:26 +08:00
|
|
|
|
#include "transparentMask.h"
|
2024-11-05 15:17:03 +08:00
|
|
|
|
#include "dashboardFrame.h"
|
2024-11-14 09:19:14 +08:00
|
|
|
|
#include "dvieSecondaryWindow.h"
|
|
|
|
|
|
#include <QDateTime>
|
2024-10-10 16:59:51 +08:00
|
|
|
|
|
|
|
|
|
|
DvieMainWindow::DvieMainWindow(QWidget *parent)
|
|
|
|
|
|
: QMainWindow(parent)
|
|
|
|
|
|
, ui(new Ui::dvieMainWindow)
|
2024-11-20 16:57:26 +08:00
|
|
|
|
, m_pTransparentMask(nullptr)
|
2024-11-05 15:17:03 +08:00
|
|
|
|
, m_pDashboardFrame(nullptr)
|
|
|
|
|
|
|
2024-10-10 16:59:51 +08:00
|
|
|
|
{
|
|
|
|
|
|
ui->setupUi(this);
|
2024-11-07 12:08:56 +08:00
|
|
|
|
setProperty("windowType", "main");
|
2024-10-10 16:59:51 +08:00
|
|
|
|
|
2024-11-14 09:19:14 +08:00
|
|
|
|
m_pDashboardFrame = new DashboardFrame("mainDVIE_dashboardFrame", dashboardFrame::ft_main, this);
|
2024-11-05 15:17:03 +08:00
|
|
|
|
ui->centralLayout->addWidget(m_pDashboardFrame);
|
2024-10-10 16:59:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DvieMainWindow::~DvieMainWindow()
|
|
|
|
|
|
{
|
|
|
|
|
|
delete ui;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-20 17:29:29 +08:00
|
|
|
|
void DvieMainWindow::resizeEvent(QResizeEvent* event)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(m_pTransparentMask && m_pTransparentMask->isVisible())
|
|
|
|
|
|
m_pTransparentMask->setGeometry(ui->topWidget->geometry());
|
|
|
|
|
|
|
|
|
|
|
|
QMainWindow::resizeEvent(event);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-20 16:57:26 +08:00
|
|
|
|
void DvieMainWindow::showTransparentMask()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(m_pTransparentMask == nullptr)
|
|
|
|
|
|
m_pTransparentMask = new TransparentMask(this);
|
|
|
|
|
|
|
|
|
|
|
|
m_pTransparentMask->setGeometry(ui->topWidget->geometry());
|
|
|
|
|
|
m_pTransparentMask->show();
|
|
|
|
|
|
}
|
|
|
|
|
|
void DvieMainWindow::hideTransparentMask()
|
|
|
|
|
|
{
|
2024-11-20 17:29:29 +08:00
|
|
|
|
if(m_pTransparentMask && m_pTransparentMask->isVisible())
|
2024-11-20 16:57:26 +08:00
|
|
|
|
m_pTransparentMask->hide();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-14 09:19:14 +08:00
|
|
|
|
DashboardFrame* DvieMainWindow::dashboardFrame()
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_pDashboardFrame;
|
|
|
|
|
|
}
|
|
|
|
|
|
DashboardFrame* DvieMainWindow::getDashboardFrame(const QString& strName)
|
|
|
|
|
|
{
|
|
|
|
|
|
DashboardFrame* frame = nullptr;
|
|
|
|
|
|
if(m_pDashboardFrame->objectName() == strName)
|
|
|
|
|
|
frame = m_pDashboardFrame;
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
int nIndex = strName.indexOf("_dashboardFrame");
|
|
|
|
|
|
if(nIndex != -1)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString strDVIEWindowName = strName.left(nIndex);
|
2024-11-21 17:29:37 +08:00
|
|
|
|
//qDebug() << strDVIEWindowName;
|
2024-11-14 09:19:14 +08:00
|
|
|
|
auto itr = m_hashSecondaryWindow.find(strDVIEWindowName);
|
|
|
|
|
|
if(itr != m_hashSecondaryWindow.end())
|
|
|
|
|
|
frame = itr.value()->dashboardFrame();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return frame;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DvieMainWindow::creatSecondaryWindowAndAddDashboard(QPoint pos, Dashboard* dashboard)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString strName = "secondaryDVIE_" + QDateTime::currentDateTime().toString("yyMMdd-HHmmss");
|
|
|
|
|
|
DvieSecondaryWindow* secondartWindow = new DvieSecondaryWindow(strName, this);
|
|
|
|
|
|
secondartWindow->setMainWindow(this);
|
|
|
|
|
|
secondartWindow->move(pos);
|
|
|
|
|
|
secondartWindow->show();
|
2024-11-21 17:29:37 +08:00
|
|
|
|
if(secondartWindow->dashboardFrame())
|
|
|
|
|
|
secondartWindow->dashboardFrame()->addDashboard(dashboard);
|
2024-11-14 09:19:14 +08:00
|
|
|
|
m_hashSecondaryWindow.insert(strName, secondartWindow);
|
|
|
|
|
|
//qDebug() << m_hashSecondaryWindow.count();
|
|
|
|
|
|
}
|
|
|
|
|
|
void DvieMainWindow::removeSecondartWindow(QString& strName)
|
|
|
|
|
|
{
|
|
|
|
|
|
DvieSecondaryWindow* secondartWindow = m_hashSecondaryWindow.take(strName);
|
|
|
|
|
|
if(secondartWindow)
|
|
|
|
|
|
secondartWindow->deleteLater(); //不要直接delete,因为后续还需要该对象做一些其它工作
|
|
|
|
|
|
//qDebug() << m_hashSecondaryWindow.count();
|
|
|
|
|
|
}
|