Rename AboutWidget to AboutForm.
This commit is contained in:
167
src/forms/settings/AboutForm.cpp
Normal file
167
src/forms/settings/AboutForm.cpp
Normal file
@@ -0,0 +1,167 @@
|
||||
#include "AboutForm.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"
|
||||
|
||||
AboutForm::AboutForm(QWidget* aParent)
|
||||
: QWidget(aParent)
|
||||
{
|
||||
initUiWidget();
|
||||
}
|
||||
|
||||
AboutForm::~AboutForm()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AboutForm::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"));
|
||||
pMainLayout->addWidget(pCompanyCopyRight);
|
||||
|
||||
pMainLayout->addSpacing(subContentSpacing);
|
||||
|
||||
pGuiVer = new QLabel(this);
|
||||
pGuiVer->setText(QString(tr("GUI Software V%1")).arg(getGUIVersion()));
|
||||
pMainLayout->addWidget(pGuiVer);
|
||||
|
||||
pEmbededSoftVer = new QLabel(this);
|
||||
pEmbededSoftVer->setText(tr("Embedded Software %1, Data store Path:%2").arg(getEmbVersion(), getDataStorePath()));
|
||||
pMainLayout->addWidget(pEmbededSoftVer);
|
||||
|
||||
pReconSotfVer = new QLabel(this);
|
||||
pReconSotfVer->setText(tr("Reconstruction Software V1.2"));
|
||||
pMainLayout->addWidget(pReconSotfVer);
|
||||
pMainLayout->addSpacing(subContentSpacing);
|
||||
|
||||
pFEBVer = new QLabel(this);
|
||||
pFEBVer->setText(tr("FEB Information"));
|
||||
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."));
|
||||
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"));
|
||||
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 AboutForm::openHelpFile()
|
||||
{
|
||||
QString userManulFile = QCoreApplication::applicationDirPath() + "/userManual.pdf";
|
||||
|
||||
QFileInfo file(userManulFile);
|
||||
if (file.exists())
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(userManulFile));
|
||||
}
|
||||
}
|
||||
|
||||
QString AboutForm::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 AboutForm::getEmbVersion()
|
||||
{
|
||||
return DeviceManager::Default()->getSoftwareVersion();
|
||||
}
|
||||
|
||||
QString AboutForm::getDataStorePath()
|
||||
{
|
||||
return DeviceManager::Default()->getScanOutputPath();;
|
||||
}
|
||||
Reference in New Issue
Block a user