171 lines
4.6 KiB
C++
171 lines
4.6 KiB
C++
#include "formmainmenu.h"
|
|
#include "ui_formmainmenu.h"
|
|
#include "mainwindow.h"
|
|
|
|
FormMainMenu::FormMainMenu(QWidget *parent) :
|
|
QWidget(parent),
|
|
ui(new Ui::FormMainMenu)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
connect(ui->pushButton_Worklist, SIGNAL(released()), this, SLOT(SelectWorklist()));
|
|
connect(ui->pushButton_History, SIGNAL(released()), this, SLOT(SelectHistory()));
|
|
connect(ui->pushButton_Setting, SIGNAL(released()), this, SLOT(SelectSetting()));
|
|
|
|
m_ListButton.push_back(ui->pushButton_Worklist);
|
|
m_ListButton.push_back(ui->pushButton_History);
|
|
m_ListButton.push_back(ui->pushButton_Setting);
|
|
|
|
MainWindow* pMainWindow = MainWindow::GetMainWindow();
|
|
connect(this, SIGNAL(ChangeMenu(int)), pMainWindow, SLOT(ChangeMenu(int)));
|
|
|
|
m_nCurrentMenuID = SMENU_WORKLIST;
|
|
m_nCurrentWidgetID = SWIDGET_WORKLIST;
|
|
|
|
SetEnableDiskUSB(false);
|
|
}
|
|
|
|
FormMainMenu::~FormMainMenu()
|
|
{
|
|
disconnect(ui->pushButton_Worklist, SIGNAL(released()), this, SLOT(SelectWorklist()));
|
|
disconnect(ui->pushButton_History, SIGNAL(released()), this, SLOT(SelectHistory()));
|
|
disconnect(ui->pushButton_Setting, SIGNAL(released()), this, SLOT(SelectSetting()));
|
|
|
|
m_ListButton.clear();
|
|
|
|
delete ui;
|
|
}
|
|
|
|
void FormMainMenu::SelectWorklist()
|
|
{
|
|
if(m_nCurrentMenuID!=SMENU_WORKLIST)
|
|
{
|
|
int nPrevWidget = GetWidgetID(m_nCurrentMenuID);
|
|
m_ListButton[nPrevWidget]->setChecked(false);
|
|
m_nCurrentMenuID = SMENU_WORKLIST;
|
|
ChangeMenu(m_nCurrentMenuID);
|
|
}
|
|
|
|
m_nCurrentWidgetID = GetWidgetID(m_nCurrentMenuID);
|
|
m_ListButton[m_nCurrentWidgetID]->setChecked(true);
|
|
}
|
|
|
|
void FormMainMenu::SelectHistory()
|
|
{
|
|
if(m_nCurrentMenuID!=SMENU_HISTORY)
|
|
{
|
|
int nPrevWidget = GetWidgetID(m_nCurrentMenuID);
|
|
m_ListButton[nPrevWidget]->setChecked(false);
|
|
m_nCurrentMenuID = SMENU_HISTORY;
|
|
ChangeMenu(m_nCurrentMenuID);
|
|
}
|
|
|
|
m_nCurrentWidgetID = GetWidgetID(m_nCurrentMenuID);
|
|
m_ListButton[m_nCurrentWidgetID]->setChecked(true);
|
|
}
|
|
|
|
void FormMainMenu::SelectSetting()
|
|
{
|
|
if(m_nCurrentMenuID!=SMENU_SETTING)
|
|
{
|
|
int nPrevWidget = GetWidgetID(m_nCurrentMenuID);
|
|
m_ListButton[nPrevWidget]->setChecked(false);
|
|
m_nCurrentMenuID = SMENU_SETTING;
|
|
ChangeMenu(m_nCurrentMenuID);
|
|
}
|
|
|
|
m_nCurrentWidgetID = GetWidgetID(m_nCurrentMenuID);
|
|
m_ListButton[m_nCurrentWidgetID]->setChecked(true);
|
|
}
|
|
|
|
|
|
int FormMainMenu::GetWidgetID(int nID)
|
|
{
|
|
switch(nID)
|
|
{
|
|
case SMENU_WORKLIST:
|
|
return SWIDGET_WORKLIST;
|
|
break;
|
|
case SMENU_HISTORY:
|
|
return SWIDGET_HISTORY;
|
|
break;
|
|
case SMENU_SETTING:
|
|
return SWIDGET_SETTING;
|
|
break;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
void FormMainMenu::resizeEvent(QResizeEvent *event)
|
|
{
|
|
int nDisplayType = MainWindow::GetCommonData()->GetDisplayType();
|
|
|
|
int nFontSize = 24;
|
|
if(nDisplayType==SDISPLAY_1280X1024)
|
|
{
|
|
nFontSize = 18;
|
|
ui->frame_background->resize(462, 58);
|
|
//ui->frame_background->resize(1190, 58);
|
|
ui->pushButton_Worklist->setGeometry(0, 0, 154, 58);
|
|
ui->pushButton_History->setGeometry(154, 0, 154, 58);
|
|
ui->pushButton_Setting->setGeometry(308, 0, 154, 58);
|
|
|
|
ui->frame_usb->setGeometry(1104, 0, 58, 58);
|
|
ui->check_usb->setGeometry(0, 0, 58, 58);
|
|
}
|
|
else if(nDisplayType==SDISPLAY_1920X1080)
|
|
{
|
|
ui->frame_background->resize(573, 70);
|
|
ui->pushButton_Worklist->setGeometry(0, 0, 191, 70);
|
|
ui->pushButton_History->setGeometry(191, 0, 191, 70);
|
|
ui->pushButton_Setting->setGeometry(382, 0, 191, 70);
|
|
}
|
|
|
|
QString strBackground = QString(
|
|
"QFrame#frame_background \
|
|
{ \
|
|
background: #153b44;\
|
|
border-radius: 9px; \
|
|
border: none; \
|
|
} \
|
|
\
|
|
QPushButton \
|
|
{ \
|
|
background: none; \
|
|
border-radius: 8px; \
|
|
border: none; \
|
|
qproperty-autoDefault: false; \
|
|
qproperty-default: false; \
|
|
qproperty-flat: true; \
|
|
qproperty-checkable: true; \
|
|
qproperty-checked: false; \
|
|
color: white; \
|
|
font-family: 'Roboto'; \
|
|
font-size: %1px; \
|
|
font-weight: bold; \
|
|
} \
|
|
\
|
|
QPushButton:checked \
|
|
{ \
|
|
background: #A6B1C2; \
|
|
color: black; \
|
|
}").arg(nFontSize);
|
|
|
|
ui->frame_background->setStyleSheet(strBackground);
|
|
}
|
|
|
|
|
|
void FormMainMenu::SetEnableDiskUSB(bool bEnable)
|
|
{
|
|
if(bEnable==true)
|
|
{
|
|
ui->frame_usb->setVisible(true);
|
|
}
|
|
else
|
|
{
|
|
ui->frame_usb->setVisible(false);
|
|
}
|
|
}
|