Files
GUI/src/forms/settings/AboutWidget.cpp
Krad fc3fab4909 Rename tabformwidget to TabFormWidget.
Fix layout add bug.
2022-07-13 10:13:07 +08:00

175 lines
5.7 KiB
C++

#include "AboutWidget.h"
#include <QVBoxLayout>
#include <QLabel>
#include <QHBoxLayout>
#include <QPushButton>
#include <QStringList>
#include <QThread>
#include "event/EventCenter.h"
#include "json/cmdhelper.h"
#include "AppVersion.h"
#include "device/DeviceManager.h"
AboutWidget::AboutWidget(QWidget* aParent)
: QWidget(aParent)
{
initUiWidget();
}
AboutWidget::~AboutWidget()
{
}
void AboutWidget::initUiWidget()
{
const int subContentMargin = 10;
const int subContentSpacing = 20;
QVBoxLayout* pMainLayout;
QHBoxLayout* pProductVerLayout;
QLabel* pProductVer;
QPushButton* pBtnHelp;
QLabel* pCompanyCopyRight;
QLabel* pGuiVer;
QLabel* pEmbededSoftVer;
QLabel* pReconSotfVer;
QLabel* pFEBVer;
QLabel* pQtVer;
QLabel* pQtCopyright;
QLabel* pJsoncppVer;
QLabel* pJsoncppCopyright;
QLabel* pDcmtkVer;
QLabel* pDcmtkCopyright;
QLabel* pSUSEVer;
this->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
pMainLayout = new QVBoxLayout(this);
pMainLayout->setAlignment(Qt::AlignLeft);
pMainLayout->setSpacing(10);
pProductVerLayout = new QHBoxLayout;
pMainLayout->addLayout(pProductVerLayout);
pProductVer = new QLabel(this);
pProductVer->setText(tr("HJ-USCT-01 V1.0"));
pProductVerLayout->addWidget(pProductVer);
pBtnHelp = new QPushButton(this);
pBtnHelp->setText(tr("?"));
pBtnHelp->setFixedWidth(50);
pProductVerLayout->addWidget(pBtnHelp);
pCompanyCopyRight = new QLabel(this);
pCompanyCopyRight->setObjectName("normal");
pCompanyCopyRight->setText(tr("Copyright © 2017-2022 Zhejiang Equilibrium Nine Medical Equipment Co., Ltd. All Rights Reversed"));
pCompanyCopyRight->setContentsMargins(subContentMargin, 0, 0, 0);
pMainLayout->addWidget(pCompanyCopyRight);
pMainLayout->addSpacing(subContentSpacing);
pGuiVer = new QLabel(this);
pGuiVer->setText(QString(tr("GUI Software V%1")).arg(getGUIVersion()));
pGuiVer->setContentsMargins(subContentMargin, 0, 0, 0);
pMainLayout->addWidget(pGuiVer);
pEmbededSoftVer = new QLabel(this);
pEmbededSoftVer->setText(tr("Embedded Software %1, Data store Path:%2").arg(getEmbVersion(), getDataStorePath()));
pEmbededSoftVer->setContentsMargins(subContentMargin, 0, 0, 0);
pMainLayout->addWidget(pEmbededSoftVer);
pReconSotfVer = new QLabel(this);
pReconSotfVer->setText(tr("Reconstruction Software V1.2"));
pReconSotfVer->setContentsMargins(subContentMargin, 0, 0, 0);
pMainLayout->addWidget(pReconSotfVer);
pMainLayout->addSpacing(subContentSpacing);
pFEBVer = new QLabel(this);
pFEBVer->setText(tr("FEB Information"));
pFEBVer->setContentsMargins(subContentMargin, 0, 0, 0);
pMainLayout->addWidget(pFEBVer);
pMainLayout->addSpacing(subContentSpacing);
pQtVer = new QLabel(tr("Qt 5.12.0"), this);
pMainLayout->addWidget(pQtVer);
pMainLayout->addSpacing(subContentSpacing);
pSUSEVer = new QLabel(this);
pSUSEVer->setText(tr("Loading..."));
pMainLayout->addWidget(pSUSEVer);
pMainLayout->addSpacing(subContentSpacing);
pDcmtkVer = new QLabel(this);
pDcmtkVer->setText(tr("Loading..."));
pMainLayout->addWidget(pDcmtkVer);
pDcmtkCopyright = new QLabel(this);
pDcmtkCopyright->setObjectName("normal");
pDcmtkCopyright->setText(tr("Copyright (c) 1994-2021, OFFIS e.V."));
pDcmtkCopyright->setContentsMargins(subContentMargin, 0, 0, 0);
pMainLayout->addWidget(pDcmtkCopyright);
pMainLayout->addSpacing(subContentSpacing);
pJsoncppVer = new QLabel(this);
pJsoncppVer->setText(tr("cJSON"));
pMainLayout->addWidget(pJsoncppVer);
pJsoncppCopyright = new QLabel(this);
pJsoncppCopyright->setObjectName("normal");
pJsoncppCopyright->setText(tr("Copyright (c) 2009-2017 Dave Gamble"));
pJsoncppCopyright->setContentsMargins(subContentMargin, 0, 0, 0);
pMainLayout->addWidget(pJsoncppCopyright);
pMainLayout->addSpacing(subContentSpacing);
pMainLayout->addStretch();
QThread* t = QThread::create([=]() {
pSUSEVer->setText(cmdHelper::Instance()->getLinuxVersion());
pDcmtkVer->setText(cmdHelper::Instance()->getDCMTKVersion());
});
t->start();
connect(t, SIGNAL(finished()), t, SLOT(deleteLater()));
connect(pBtnHelp, SIGNAL(clicked()), this, SLOT(openHelpFile()));
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
pProductVer->setText(tr("HJ-USCT-01 V1.0"));
pBtnHelp->setText(tr("?"));
pCompanyCopyRight->setText(tr("Copyright © 2017-2020 Zhejiang Equilibrium Nine Medical Equipment Co., Ltd. All Rights Reversed"));
pGuiVer->setText(QString(tr("GUI Software V%1")).arg(getGUIVersion()));
pEmbededSoftVer->setText(tr("Embedded Software %1, Data store Path:%2").arg(getEmbVersion(), getDataStorePath()));
pReconSotfVer->setText(tr("Reconstruction Software V1.2"));
pFEBVer->setText(tr("FEB Information"));
});
}
void AboutWidget::openHelpFile()
{
QString userManulFile = QCoreApplication::applicationDirPath() + "/userManual.pdf";
QFileInfo file(userManulFile);
if (file.exists())
{
QDesktopServices::openUrl(QUrl::fromLocalFile(userManulFile));
}
}
QString AboutWidget::getGUIVersion()
{
if (GUI_VERSION_BETA)
{
return QString("%1.%2.%3 beta").arg(GUI_VERSION_MAJOR).arg(GUI_VERSION_MINOR).arg(GUI_VERSION_BUILD);
}
return QString("%1.%2.%3").arg(GUI_VERSION_MAJOR).arg(GUI_VERSION_MINOR).arg(GUI_VERSION_BUILD);
}
QString AboutWidget::getEmbVersion()
{
return DeviceManager::Default()->getSoftwareVersion();
}
QString AboutWidget::getDataStorePath()
{
return DeviceManager::Default()->getScanOutputPath();;
}