feat: add language change base logic
This commit is contained in:
@@ -22,3 +22,4 @@ bool SyncHelper::_syc_item[SYNC_STATE_NUM][SYNC_ITEM_NUM] = {true,true,true,true
|
||||
bool SyncHelper::_sync_flag =false; //for just zoom and pan
|
||||
const QString SyncHelper::SyncStateName[SYNC_STATE_NUM] = { "AUTO_SYNC","MANUAL_SYNC","DIS_SYNC" };
|
||||
const QString SyncHelper::SyncItemName[SYNC_ITEM_NUM] = { "SLICE_LOC","ZOOM_PAN","WIDTH_LEVEL" };
|
||||
LanguageOption LanguageHelper::lang = English;
|
||||
@@ -340,5 +340,25 @@ private:
|
||||
|
||||
};
|
||||
|
||||
enum LanguageOption
|
||||
{
|
||||
English,
|
||||
ChineseSimple
|
||||
};
|
||||
class LanguageHelper
|
||||
{
|
||||
|
||||
public:
|
||||
static LanguageOption getLanguage()
|
||||
{
|
||||
return lang;
|
||||
}
|
||||
static void setLanguage(LanguageOption aOption)
|
||||
{
|
||||
lang = aOption;
|
||||
}
|
||||
private:
|
||||
static LanguageOption lang;
|
||||
};
|
||||
|
||||
#endif OMEGAV_QGLOBALS_H
|
||||
|
||||
@@ -97,7 +97,7 @@ ImportWidget::~ImportWidget()
|
||||
void ImportWidget::initUi()
|
||||
{
|
||||
//this->setWindowFlags(Qt::FramelessWindowHint);
|
||||
this->setWindowTitle("PACS Configuration");
|
||||
this->setWindowTitle(tr("PACS Configuration"));
|
||||
this->resize(780, 470);
|
||||
this->setMinimumSize(QSize(780, 470));
|
||||
|
||||
@@ -204,7 +204,7 @@ void ImportWidget::initFilterPacs()
|
||||
|
||||
void ImportWidget::initFilterModality()
|
||||
{
|
||||
m_pModalityComboBox->addItem("All modalities");
|
||||
m_pModalityComboBox->addItem(tr("All modalities"));
|
||||
m_pModalityComboBox->addItem("CT");
|
||||
m_pModalityComboBox->addItem("US");
|
||||
m_pModalityComboBox->addItem("MR");
|
||||
@@ -214,23 +214,23 @@ void ImportWidget::initFilterModality()
|
||||
|
||||
void ImportWidget::initFilterDate()
|
||||
{
|
||||
m_pDateComboBox->addItem("All dates");
|
||||
m_pDateComboBox->addItem(tr("All dates"));
|
||||
m_pDateComboBox->addItem("-----------");
|
||||
m_pDateComboBox->addItem("Today");
|
||||
m_pDateComboBox->addItem("Yesterday");
|
||||
m_pDateComboBox->addItem("This week");
|
||||
m_pDateComboBox->addItem("This month");
|
||||
m_pDateComboBox->addItem("Custom date");
|
||||
m_pDateComboBox->addItem("Custom date range");
|
||||
m_pDateComboBox->addItem(tr("Today"));
|
||||
m_pDateComboBox->addItem(tr("Yesterday"));
|
||||
m_pDateComboBox->addItem(tr("This week"));
|
||||
m_pDateComboBox->addItem(tr("This month"));
|
||||
m_pDateComboBox->addItem(tr("Custom date"));
|
||||
m_pDateComboBox->addItem(tr("Custom date range"));
|
||||
m_pStartDate->setEnabled(false);
|
||||
m_pEndDate->setEnabled(false);
|
||||
}
|
||||
|
||||
void ImportWidget::initFilterDicom()
|
||||
{
|
||||
m_pDicomComboBox->addItem("Patient name");
|
||||
m_pDicomComboBox->addItem("Patient ID");
|
||||
m_pDicomComboBox->addItem("Accession number");
|
||||
m_pDicomComboBox->addItem(tr("Patient name"));
|
||||
m_pDicomComboBox->addItem(tr("Patient ID"));
|
||||
m_pDicomComboBox->addItem(tr("Accession number"));
|
||||
//m_pDicomComboBox->addItem("Study description");
|
||||
//m_pDicomComboBox->addItem("Referring physician");
|
||||
//m_pDicomComboBox->addItem("Performing physician");
|
||||
@@ -374,27 +374,27 @@ void ImportWidget::getDateIntervalForQuery(QString& startDate, QString& endDate)
|
||||
startDate.clear(); endDate.clear();
|
||||
|
||||
QDate startDate_, endDate_, date = QDate::currentDate();
|
||||
if (m_pDateComboBox->currentText() == "Today")
|
||||
if (m_pDateComboBox->currentText() == tr("Today"))
|
||||
{
|
||||
startDate_ = date;
|
||||
}
|
||||
else if(m_pDateComboBox->currentText() == "Yesterday")
|
||||
else if(m_pDateComboBox->currentText() == tr("Yesterday"))
|
||||
{
|
||||
startDate_ = date.addDays(-1);
|
||||
}
|
||||
else if (m_pDateComboBox->currentText() == "This week")
|
||||
else if (m_pDateComboBox->currentText() == tr("This week"))
|
||||
{
|
||||
startDate_ = date.addDays(-date.dayOfWeek() + 1);
|
||||
}
|
||||
else if (m_pDateComboBox->currentText() == "This month")
|
||||
else if (m_pDateComboBox->currentText() == tr("This month"))
|
||||
{
|
||||
startDate_ = QDate(date.year(), date.month(), 1);
|
||||
}
|
||||
else if (m_pDateComboBox->currentText() == "Custom date")
|
||||
else if (m_pDateComboBox->currentText() == tr("Custom date"))
|
||||
{
|
||||
startDate_ = m_pStartDate->date();
|
||||
}
|
||||
else if (m_pDateComboBox->currentText() == "Custom date range")
|
||||
else if (m_pDateComboBox->currentText() == tr("Custom date range"))
|
||||
{
|
||||
startDate_ = m_pStartDate->date();
|
||||
endDate_ = m_pEndDate->date();
|
||||
@@ -470,23 +470,23 @@ void ImportWidget::query()
|
||||
|
||||
QString studyStartDate, studyEndDate;
|
||||
getDateIntervalForQuery(studyStartDate, studyEndDate);
|
||||
if (m_pDicomComboBox->currentText() == "Patient ID")
|
||||
if (m_pDicomComboBox->currentText() == tr("Patient ID"))
|
||||
{
|
||||
if(m_pDateComboBox->currentText() == "All dates" || m_pDateComboBox->currentText() == "-----------")
|
||||
if(m_pDateComboBox->currentText() == tr("All dates") || m_pDateComboBox->currentText() == "-----------")
|
||||
QMetaObject::invokeMethod(mQueryWorker, "queryByPatientID", Qt::QueuedConnection, Q_ARG(QString, m_pDicomEdit->text()));
|
||||
else
|
||||
QMetaObject::invokeMethod(mQueryWorker, "queryByPatientIDAndDate", Qt::QueuedConnection, Q_ARG(QString, m_pDicomEdit->text()), Q_ARG(QString, studyStartDate), Q_ARG(QString, studyEndDate));
|
||||
}
|
||||
else if (m_pDicomComboBox->currentText() == "Patient name")
|
||||
else if (m_pDicomComboBox->currentText() == tr("Patient name"))
|
||||
{
|
||||
if (m_pDateComboBox->currentText() == "All dates" || m_pDateComboBox->currentText() == "-----------")
|
||||
if (m_pDateComboBox->currentText() == tr("All dates") || m_pDateComboBox->currentText() == "-----------")
|
||||
QMetaObject::invokeMethod(mQueryWorker, "queryByPatientName", Qt::QueuedConnection, Q_ARG(QString, m_pDicomEdit->text()));
|
||||
else
|
||||
QMetaObject::invokeMethod(mQueryWorker, "queryByPatientNameAndDate", Qt::QueuedConnection, Q_ARG(QString, m_pDicomEdit->text()), Q_ARG(QString, studyStartDate), Q_ARG(QString, studyEndDate));
|
||||
}
|
||||
else if (m_pDicomComboBox->currentText() == "Accession number")
|
||||
else if (m_pDicomComboBox->currentText() == tr("Accession number"))
|
||||
{
|
||||
if (m_pDateComboBox->currentText() == "All dates" || m_pDateComboBox->currentText() == "-----------")
|
||||
if (m_pDateComboBox->currentText() == tr("All dates") || m_pDateComboBox->currentText() == "-----------")
|
||||
QMetaObject::invokeMethod(mQueryWorker, "queryByAccessNo", Qt::QueuedConnection, Q_ARG(QString, m_pDicomEdit->text()));
|
||||
else
|
||||
QMetaObject::invokeMethod(mQueryWorker, "queryByAccessNoAndDate", Qt::QueuedConnection, Q_ARG(QString, m_pDicomEdit->text()), Q_ARG(QString, studyStartDate), Q_ARG(QString, studyEndDate));
|
||||
@@ -847,12 +847,12 @@ void ImportWidget::onPacsInfoUpdated()
|
||||
|
||||
void ImportWidget::onDateFilterChanged(const QString &text)
|
||||
{
|
||||
if (text == "Custom date")
|
||||
if (text == tr("Custom date"))
|
||||
{
|
||||
m_pStartDate->setEnabled(true);
|
||||
m_pEndDate->setEnabled(false);
|
||||
}
|
||||
else if (text == "Custom date range")
|
||||
else if (text == tr("Custom date range"))
|
||||
{
|
||||
m_pStartDate->setEnabled(true);
|
||||
m_pEndDate->setEnabled(true);
|
||||
|
||||
@@ -91,7 +91,7 @@ void AngleAnnotationActor::BuildShape() {
|
||||
double v2[3] = {p3[0] - p2[0], p3[1] - p2[1], 0.0};
|
||||
double angle = vtkMath::DegreesFromRadians(vtkMath::AngleBetweenVectors(v1, v2));
|
||||
char str[100];
|
||||
sprintf_s(str, "%.0f", angle);
|
||||
sprintf_s(str, "%.0f°", angle);
|
||||
vtkTextMapper::SafeDownCast(text->GetMapper())->SetInput(str);
|
||||
text->SetDisplayPosition(p2[0] + 10, p2[1] - 20);
|
||||
vtkNew<vtkPolyLineSource> source;
|
||||
|
||||
@@ -13,8 +13,9 @@
|
||||
#include <vtkRenderWindowInteractor.h>
|
||||
#include <vtkTextProperty.h>
|
||||
#include <vtkTextMapper.h>
|
||||
|
||||
#include <QFile>
|
||||
#include "Rendering/Core/ControlPointActor.h"
|
||||
#include "Common/QGlobals.h"
|
||||
|
||||
|
||||
vtkStandardNewMacro(EllipseAnnotationActor)
|
||||
@@ -29,11 +30,19 @@ void EllipseAnnotationActor::BuildShape() {
|
||||
|
||||
double *p_lt = controlP_lt->GetWorldPosition();
|
||||
double *p_rb = controlP_rb->GetWorldPosition();
|
||||
if (!transforming)
|
||||
{
|
||||
double area = abs((p_lt[0] - p_rb[0]) * (p_lt[1] - p_rb[1])) * vtkMath::Pi() * 0.25;
|
||||
bool unitFlag2 = area>1000;
|
||||
QString num = QString::number(area, 'f', 2);
|
||||
QString str = QString("Area = %1 cm2").arg(num);
|
||||
QString textValue = QString("%1: %2 %3")
|
||||
.arg(mAreaName)
|
||||
.arg(unitFlag2?area/100:area,0,'f',2).arg(unitFlag2?mUnitcm2:mUnitmm2);
|
||||
vtkTextMapper::SafeDownCast(text->GetMapper())->SetInput(textValue.toUtf8().constData());
|
||||
|
||||
}
|
||||
double *rp = renderPoints->GetPoint(0);
|
||||
vtkTextMapper::SafeDownCast(text->GetMapper())->SetInput(str.toStdString().c_str());
|
||||
|
||||
text->SetDisplayPosition(rp[0] + 10, rp[1] - 20);
|
||||
|
||||
|
||||
@@ -42,6 +51,7 @@ void EllipseAnnotationActor::BuildShape() {
|
||||
source->Update();
|
||||
|
||||
renderData->DeepCopy(source->GetOutput());
|
||||
|
||||
if (Measure::Hidden) {
|
||||
this->Hide();
|
||||
controlP_rt->Hide();
|
||||
@@ -94,8 +104,15 @@ EllipseAnnotationActor::EllipseAnnotationActor() {
|
||||
textMapper->SetInput("0");
|
||||
text->SetMapper(textMapper);
|
||||
textProperty = textMapper->GetTextProperty();
|
||||
textProperty->SetBold(true);
|
||||
if (LanguageHelper::getLanguage() == ChineseSimple && QFile::exists(FONT_FILE_PATH))
|
||||
{
|
||||
textProperty->SetFontFamily(VTK_FONT_FILE);
|
||||
textProperty->SetFontFile(FONT_FILE_PATH);
|
||||
}
|
||||
else{
|
||||
textProperty->SetFontFamilyToArial();
|
||||
textProperty->SetBold(1);
|
||||
}
|
||||
textProperty->SetFontSize(16);
|
||||
textProperty->SetColor(0.8, 0.8, 0.0);
|
||||
textProperty->SetOpacity(0.75);
|
||||
@@ -103,6 +120,10 @@ EllipseAnnotationActor::EllipseAnnotationActor() {
|
||||
//textProperty->SetFrameColor(1.0,0.0,0.0);
|
||||
textProperty->SetBackgroundColor(1.0, 0.0, 0.0);
|
||||
textProperty->SetBackgroundOpacity(0.3);
|
||||
|
||||
mUnitmm2 = QCoreApplication::translate("EllipseAnnotationActor","mm²");
|
||||
mUnitcm2 = QCoreApplication::translate("EllipseAnnotationActor","cm²");
|
||||
mAreaName = QCoreApplication::translate("EllipseAnnotationActor", "Area");
|
||||
}
|
||||
|
||||
EllipseAnnotationActor::~EllipseAnnotationActor() {
|
||||
@@ -115,8 +136,6 @@ EllipseAnnotationActor::~EllipseAnnotationActor() {
|
||||
controlP_rt = nullptr;
|
||||
controlP_lb = nullptr;
|
||||
controlP_rb = nullptr;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void EllipseAnnotationActor::SetRenderer(vtkRenderer *ren) {
|
||||
|
||||
@@ -57,6 +57,9 @@ private:
|
||||
void drawCircle(double *p1, double *p2);
|
||||
|
||||
vtkTextProperty *textProperty;
|
||||
QString mUnitmm2 ;
|
||||
QString mUnitcm2 ;
|
||||
QString mAreaName;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,10 @@ Measure* GetNextMeasure() override\
|
||||
class vtkRenderWindowInteractor;
|
||||
class vtkProp;
|
||||
|
||||
namespace{
|
||||
const char* FONT_FILE_PATH = "C:/Windows/Fonts/simhei.ttf";
|
||||
}
|
||||
|
||||
class Measure {
|
||||
public:
|
||||
virtual bool onMeasureDoubleClick(vtkRenderWindowInteractor *) { return this->Placing; };
|
||||
|
||||
@@ -5,8 +5,17 @@
|
||||
#include <vtkPolyLineSource.h>
|
||||
#include <vtkRenderer.h>
|
||||
#include <vtkRenderWindowInteractor.h>
|
||||
#include <vtkActor2D.h>
|
||||
#include <vtkTextMapper.h>
|
||||
#include <vtkTextProperty.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QCoreApplication>
|
||||
#include <qDebug>
|
||||
|
||||
#include "Rendering/Core/ControlPointRActor.h"
|
||||
#include "Common/QGlobals.h"
|
||||
|
||||
|
||||
vtkStandardNewMacro(OpenPolyAnnotationActor)
|
||||
|
||||
@@ -31,12 +40,19 @@ void OpenPolyAnnotationActor::BuildShape() {
|
||||
std::for_each(controlPointList.begin(), controlPointList.end(),[=](ControlPointRActor* p){
|
||||
p->Hide();
|
||||
});
|
||||
if (text)text->SetVisibility(0);
|
||||
}
|
||||
else{
|
||||
this->Show();
|
||||
std::for_each(controlPointList.begin(), controlPointList.end(),[=](ControlPointRActor* p){
|
||||
p->Show();
|
||||
});
|
||||
if (text && measured)text->SetVisibility(1);
|
||||
}
|
||||
if (text && measured)
|
||||
{
|
||||
double *rp = renderPoints->GetPoint(0);
|
||||
text->SetDisplayPosition(rp[0] + 10, rp[1] - 20);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,12 +91,43 @@ bool OpenPolyAnnotationActor::onMeasureLeftButtonUp(vtkRenderWindowInteractor *
|
||||
return true;
|
||||
}
|
||||
|
||||
OpenPolyAnnotationActor::OpenPolyAnnotationActor() {
|
||||
OpenPolyAnnotationActor::OpenPolyAnnotationActor():
|
||||
Closed(0),
|
||||
measured(false)
|
||||
{
|
||||
//auto controlP1 = ControlPointRActor::New();
|
||||
|
||||
text = vtkActor2D::New();
|
||||
vtkNew<vtkTextMapper> textMapper;
|
||||
textMapper->SetInput("0");
|
||||
text->SetMapper(textMapper);
|
||||
textProperty = textMapper->GetTextProperty();
|
||||
textProperty->SetBold(true);
|
||||
if (LanguageHelper::getLanguage() == ChineseSimple && QFile::exists(FONT_FILE_PATH))
|
||||
{
|
||||
textProperty->SetFontFamily(VTK_FONT_FILE);
|
||||
textProperty->SetFontFile(FONT_FILE_PATH);
|
||||
}
|
||||
else{
|
||||
textProperty->SetFontFamilyToArial();
|
||||
textProperty->SetBold(1);
|
||||
}
|
||||
textProperty->SetFontSize(16);
|
||||
textProperty->SetColor(0.8, 0.8, 0.0);
|
||||
textProperty->SetOpacity(0.75);
|
||||
textProperty->SetFrame(false);
|
||||
//textProperty->SetFrameColor(1.0,0.0,0.0);
|
||||
textProperty->SetBackgroundColor(1.0, 0.0, 0.0);
|
||||
textProperty->SetBackgroundOpacity(0.3);
|
||||
text->SetVisibility(0);
|
||||
BaseDataPoints->SetNumberOfPoints(0);
|
||||
renderPoints->SetNumberOfPoints(0);
|
||||
this->AddObserver(DraggableActorEvents::DragEvent, this, &OpenPolyAnnotationActor::selfDragCb);
|
||||
mUnitmm = QCoreApplication::translate("OpenPolyAnnotationActor","mm");
|
||||
mUnitcm = QCoreApplication::translate("OpenPolyAnnotationActor","cm");
|
||||
mUnitmm2 = QCoreApplication::translate("OpenPolyAnnotationActor","mm²");
|
||||
mUnitcm2 = QCoreApplication::translate("OpenPolyAnnotationActor","cm²");
|
||||
mDistanceName = QCoreApplication::translate("OpenPolyAnnotationActor", "Distance");
|
||||
mAreaName = QCoreApplication::translate("OpenPolyAnnotationActor", "Area");
|
||||
}
|
||||
|
||||
OpenPolyAnnotationActor::~OpenPolyAnnotationActor() {
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
class ControlPointRActor;
|
||||
|
||||
class vtkTextProperty;
|
||||
|
||||
class OpenPolyAnnotationActor : public DraggableActor, public Measure {
|
||||
public:
|
||||
//@{
|
||||
@@ -69,11 +71,20 @@ protected:
|
||||
}
|
||||
|
||||
std::vector<ControlPointRActor *> controlPointList;
|
||||
vtkTypeBool Closed = 0;
|
||||
vtkTypeBool Closed;
|
||||
|
||||
void selfDragCb(vtkObject *, unsigned long event, void *data);
|
||||
|
||||
void controlPointCb(vtkObject *sender, unsigned long event, void *data);
|
||||
|
||||
vtkTextProperty *textProperty;
|
||||
bool measured;
|
||||
QString mUnitmm ;
|
||||
QString mUnitcm ;
|
||||
QString mUnitmm2;
|
||||
QString mUnitcm2;
|
||||
QString mDistanceName;
|
||||
QString mAreaName;
|
||||
};
|
||||
|
||||
#endif //OMEGAV_OPENPOLYANNOTATIONACTOR_H
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
#include <vtkTextMapper.h>
|
||||
#include <vtkTextProperty.h>
|
||||
|
||||
#include <QFile>
|
||||
#include "Common/QGlobals.h"
|
||||
|
||||
#include "Interaction/ActorDraggableInteractorStyle.h"
|
||||
#include "Rendering/Core/ControlPointActor.h"
|
||||
#include "UI/Widget/Measure/calibrationWidget.h"
|
||||
@@ -23,8 +26,15 @@ RulerAnnotationActor::RulerAnnotationActor() {
|
||||
textMapper->SetInput("0");
|
||||
text->SetMapper(textMapper);
|
||||
textProperty = textMapper->GetTextProperty();
|
||||
textProperty->SetBold(true);
|
||||
if (LanguageHelper::getLanguage() == ChineseSimple && QFile::exists(FONT_FILE_PATH))
|
||||
{
|
||||
textProperty->SetFontFamily(VTK_FONT_FILE);
|
||||
textProperty->SetFontFile(FONT_FILE_PATH);
|
||||
}
|
||||
else{
|
||||
textProperty->SetFontFamilyToArial();
|
||||
textProperty->SetBold(1);
|
||||
}
|
||||
textProperty->SetFontSize(16);
|
||||
textProperty->SetColor(0.8, 0.8, 0.0);
|
||||
textProperty->SetOpacity(0.75);
|
||||
@@ -34,6 +44,9 @@ RulerAnnotationActor::RulerAnnotationActor() {
|
||||
textProperty->SetBackgroundOpacity(0.3);
|
||||
this->AddObserver(DraggableStyleEvents::RightButtonClickEvent, this,
|
||||
&RulerAnnotationActor::selfCalibCb);
|
||||
mUnitmm = QCoreApplication::translate("RulerAnnotationActor","mm");
|
||||
mUnitcm = QCoreApplication::translate("RulerAnnotationActor","cm");
|
||||
mDistance = QCoreApplication::translate("RulerAnnotationActor","Distance");
|
||||
}
|
||||
|
||||
RulerAnnotationActor::~RulerAnnotationActor() {
|
||||
@@ -58,13 +71,15 @@ void RulerAnnotationActor::BuildShape() {
|
||||
} else {
|
||||
dis = realDistance;
|
||||
}
|
||||
char str[100];
|
||||
sprintf_s(str, "Distance:%.2f mm", dis);
|
||||
bool unitFlag = dis>100;
|
||||
QString textValue = QString("%1: %2 %3").arg(mDistance)
|
||||
.arg(unitFlag?dis/10:dis,0,'f',2).arg(unitFlag?mUnitcm:mUnitmm);
|
||||
double *rp = renderPoints->GetPoint(0);
|
||||
if (isCalibration) {
|
||||
textProperty->SetBackgroundColor(0.0, 1.0, 0.0);
|
||||
}
|
||||
vtkTextMapper::SafeDownCast(text->GetMapper())->SetInput(str);
|
||||
// vtkTextMapper::SafeDownCast(text->GetMapper())->SetInput(str);
|
||||
vtkTextMapper::SafeDownCast(text->GetMapper())->SetInput(textValue.toUtf8().constData());
|
||||
text->SetDisplayPosition(rp[0] + 10, rp[1] - 20);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,9 @@ private:
|
||||
double realDistance;
|
||||
double calibDistance;
|
||||
bool isCalibration = false;
|
||||
QString mUnitmm;
|
||||
QString mUnitcm;
|
||||
QString mDistance;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <vtkRenderWindow.h>
|
||||
#include <vtkRenderWindowInteractor.h>
|
||||
|
||||
#include <QFile>
|
||||
|
||||
#include "UI/Widget/Measure/pqFontPropertyWidget.h"
|
||||
#include "Interaction/ActorDraggableInteractorStyle.h"
|
||||
|
||||
@@ -48,8 +50,15 @@ void TextAnnotationActor::ResetTextProp() {
|
||||
mTextProperty->SetBold(true);
|
||||
mTextProperty->SetItalic(false);
|
||||
mTextProperty->SetShadow(false);
|
||||
|
||||
if (QFile::exists(FONT_FILE_PATH))
|
||||
{
|
||||
mTextProperty->SetFontFamily(VTK_FONT_FILE);
|
||||
mTextProperty->SetFontFile(FONT_FILE_PATH);
|
||||
}
|
||||
else{
|
||||
mTextProperty->SetFontFamilyToArial();
|
||||
}
|
||||
|
||||
mTextProperty->SetFontSize(16);
|
||||
mTextProperty->SetColor(0.8, 0.8, 0.0);
|
||||
mTextProperty->SetOpacity(0.75);
|
||||
|
||||
@@ -63,8 +63,8 @@ void MyTitleBar::initControl()
|
||||
|
||||
// m_pButtonMin->setToolTip(QStringLiteral("minimize"));
|
||||
// m_pButtonRestore->setToolTip(QStringLiteral("reduction"));
|
||||
m_pButtonMax->setToolTip(QStringLiteral("maximize"));
|
||||
m_pButtonClose->setToolTip(QStringLiteral("shut down"));
|
||||
m_pButtonMax->setToolTip(tr("maximize"));
|
||||
m_pButtonClose->setToolTip(tr("shut down"));
|
||||
|
||||
|
||||
QHBoxLayout* mylayout = new QHBoxLayout(this);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include "UI/Widget/ImageView/dicomimageview.h"
|
||||
#include <vtkRenderWindowInteractor.h>
|
||||
#include "qcolordialog.h"
|
||||
//#include "QFontDialog.h"
|
||||
|
||||
//pqFontPropertyWidget* pqFontPropertyWidget::instance = nullptr;
|
||||
//pqFontPropertyWidget* pqFontPropertyWidget::GetInstance() {
|
||||
@@ -73,8 +72,9 @@ void pqFontPropertyWidget::SetTextInput()
|
||||
if (this->textActor)
|
||||
{
|
||||
QString qstr = ui.led_TextInput->text();
|
||||
QByteArray ba = qstr.toLatin1();
|
||||
this->textActor->SetTextInput(ba.data());
|
||||
QByteArray ba = qstr.toUtf8();
|
||||
|
||||
this->textActor->SetTextInput(ba.constData());
|
||||
this->tRender->Render();
|
||||
}
|
||||
|
||||
@@ -148,7 +148,6 @@ void pqFontPropertyWidget::reloadProperties()
|
||||
//char * str = vtkTextMapper::SafeDownCast(this->textActor->GetTextProp())->GetInput();
|
||||
|
||||
ui.led_TextInput->setText(this->textActor->GetTextInput());
|
||||
ui.cbx_FontFamily->setCurrentIndex(tprop->GetFontFamily());
|
||||
ui.spx_FontSize->setValue(tprop->GetFontSize());
|
||||
ui.dspx_Opacity->setValue(tprop->GetOpacity());
|
||||
|
||||
|
||||
@@ -9,20 +9,20 @@
|
||||
#include "Common/QGlobals.h"
|
||||
#include "ExportToolButton.h"
|
||||
|
||||
typedef tuple<const char *, const char *, int> ActionProperty;
|
||||
typedef tuple< const char *, int> ActionProperty;
|
||||
namespace {
|
||||
const char *SYNC_MANUAL_URL = ":/InfiniteViewer/Icon/sync/sync_manual.png";
|
||||
const char *SYNC_AUTO_URL = ":/InfiniteViewer/Icon/sync/sync_auto.png";
|
||||
const char *SYNC_DIS_URL = ":/InfiniteViewer/Icon/sync/sync_dis.png";
|
||||
const int ACTION_COUNT = 7;
|
||||
const ActionProperty MEASURE_ACTIIONS[ACTION_COUNT] = {
|
||||
{"Length", ":/InfiniteViewer/Icon/distance.png", AnnotationActorType::RulerAnn},
|
||||
{"Angle", ":/InfiniteViewer/Icon/angle.png", AnnotationActorType::AngleAnn},
|
||||
{"Closed polygon", ":/InfiniteViewer/Icon/polygon.png", AnnotationActorType::ClosedPolygonAnn},
|
||||
{"Open polygon", ":/InfiniteViewer/Icon/polyline.png", AnnotationActorType::OpenPolygonAnn},
|
||||
{"Arrow", ":/InfiniteViewer/Icon/arrow.png", AnnotationActorType::ArrowAnn},
|
||||
{"Ellipse", ":/InfiniteViewer/Icon/ellipse.png", AnnotationActorType::EllipseAnn},
|
||||
{"Text", ":/InfiniteViewer/Icon/text.png", AnnotationActorType::TextAnn}
|
||||
{ ":/InfiniteViewer/Icon/distance.png", AnnotationActorType::RulerAnn},
|
||||
{ ":/InfiniteViewer/Icon/angle.png", AnnotationActorType::AngleAnn},
|
||||
{ ":/InfiniteViewer/Icon/polygon.png", AnnotationActorType::ClosedPolygonAnn},
|
||||
{ ":/InfiniteViewer/Icon/polyline.png", AnnotationActorType::OpenPolygonAnn},
|
||||
{ ":/InfiniteViewer/Icon/arrow.png", AnnotationActorType::ArrowAnn},
|
||||
{ ":/InfiniteViewer/Icon/ellipse.png", AnnotationActorType::EllipseAnn},
|
||||
{ ":/InfiniteViewer/Icon/text.png", AnnotationActorType::TextAnn}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -184,13 +184,14 @@ void DefaultToolBar::initToolBarButtons() {
|
||||
void DefaultToolBar::initFileButton() {
|
||||
mBtnFile->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
// Menu
|
||||
mBtnFile->setToolTip(QString("Open Dicom series from directory"));
|
||||
mBtnFile->setToolTip(tr("Open Dicom series from directory"));
|
||||
QMenu *m;
|
||||
m = new QMenu(this);
|
||||
m->addAction(tr("Open DICOM folder"), this, &DefaultToolBar::openFolder);
|
||||
|
||||
m->addAction(tr("Open DICOM file"), this, &DefaultToolBar::openFile);
|
||||
|
||||
m->addSeparator();
|
||||
m->addAction(tr("Change Language"), this, &DefaultToolBar::parentWindowLanguageChange);
|
||||
m->addSeparator();
|
||||
m->addAction(tr("Quit"), this, &DefaultToolBar::parentWindowClose);
|
||||
mBtnFile->setPopupMode(QToolButton::MenuButtonPopup);
|
||||
@@ -201,19 +202,19 @@ void DefaultToolBar::initFileButton() {
|
||||
}
|
||||
|
||||
void DefaultToolBar::initImportButton() {
|
||||
mBtnImport->setToolTip(QString("Search and download studies from PACS locations"));
|
||||
mBtnImport->setToolTip(tr("Search and download studies from PACS locations"));
|
||||
connect(mBtnImport, &QToolButton::clicked, this, &DefaultToolBar::import);
|
||||
}
|
||||
|
||||
void DefaultToolBar::initExportButton() {
|
||||
mBtnSave->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
mBtnSave->setToolTip(QString("Export images"));
|
||||
mBtnSave->setToolTip(tr("Export images"));
|
||||
connect(mBtnSave, &QToolButton::clicked, this, &DefaultToolBar::save);
|
||||
}
|
||||
|
||||
void DefaultToolBar::initGridButton() {
|
||||
mBtnGrid->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
mBtnGrid->setToolTip(QString("Layout"));
|
||||
mBtnGrid->setToolTip(tr("Layout"));
|
||||
// connect
|
||||
connect(mBtnGrid, &QToolButton::clicked, this, [=](){
|
||||
emit showGrid(mBtnGrid);
|
||||
@@ -222,26 +223,26 @@ void DefaultToolBar::initGridButton() {
|
||||
|
||||
void DefaultToolBar::initSyncButton() {
|
||||
mBtnSync->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
mBtnSync->setToolTip(QString("Toggle series synchronization"));
|
||||
mBtnSync->setToolTip(tr("Toggle series synchronization"));
|
||||
// Menu
|
||||
QMenu * m = new QMenu(this);
|
||||
|
||||
SyncState curst = SyncHelper::getSyncState();
|
||||
mActionSyncState = m->addAction(QString(tr("CUR STATE: %1")).arg(SyncHelper::SyncStateName[curst]));
|
||||
mActionSyncState->setCheckable(false);
|
||||
addSeparator();
|
||||
// SyncState curst = SyncHelper::getSyncState();
|
||||
// mActionSyncState = m->addAction(QString(tr("CUR STATE: %1")).arg(SyncHelper::SyncStateName[curst]));
|
||||
// mActionSyncState->setCheckable(false);
|
||||
// addSeparator();
|
||||
|
||||
#define ADD_SYNC_ITEM(index,text,type)\
|
||||
mSyncActions[index] = m->addAction(tr(text), this, [&](bool value) {\
|
||||
mSyncActions[index] = m->addAction(text, this, [&](bool value) {\
|
||||
SyncHelper::setSyncItem(type, value);\
|
||||
});\
|
||||
mSyncActions[index]->setCheckable(true);\
|
||||
mSyncActions[index]->setChecked(false);\
|
||||
mSyncActions[index]->setDisabled(true);
|
||||
|
||||
ADD_SYNC_ITEM(0,"Sychronize slice",SyncItem::SLICE_POS)
|
||||
ADD_SYNC_ITEM(1,"Sychronize zoom & pan",SyncItem::ZOOM_PAN)
|
||||
ADD_SYNC_ITEM(2,"Sychronize window level & width",SyncItem::WIDTH_LEVEL)
|
||||
ADD_SYNC_ITEM(0,tr("Sychronize slice"),SyncItem::SLICE_POS)
|
||||
ADD_SYNC_ITEM(1,tr("Sychronize zoom & pan"),SyncItem::ZOOM_PAN)
|
||||
ADD_SYNC_ITEM(2,tr("Sychronize window level & width"),SyncItem::WIDTH_LEVEL)
|
||||
|
||||
//hide zoom& pan action
|
||||
mSyncActions[1]->setVisible(false);
|
||||
@@ -290,7 +291,7 @@ void DefaultToolBar::syncStateChanged() const {
|
||||
|
||||
void DefaultToolBar::initModeButtons() {
|
||||
mBtnWindow->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
mBtnWindow->setToolTip(QString("Adjust window level"));
|
||||
mBtnWindow->setToolTip(tr("Adjust window level"));
|
||||
connect(mBtnWindow, &QToolButton::clicked, this, [=]() {
|
||||
emit modeChanged(7);
|
||||
});
|
||||
@@ -306,17 +307,17 @@ void DefaultToolBar::initModeButtons() {
|
||||
mBtnWindow->setPopupMode(QToolButton::MenuButtonPopup);
|
||||
mBtnWindow->setMenu(m);
|
||||
|
||||
mBtnPan->setToolTip(QString("Pan image"));
|
||||
mBtnPan->setToolTip(tr("Pan image"));
|
||||
connect(mBtnPan, &QToolButton::clicked, this, [=]() {
|
||||
emit modeChanged(5);
|
||||
});
|
||||
|
||||
mBtnZoom->setToolTip(QString("Zoom image"));
|
||||
mBtnZoom->setToolTip(tr("Zoom image"));
|
||||
connect(mBtnZoom, &QToolButton::clicked, this, [=]() {
|
||||
emit modeChanged(6);
|
||||
});
|
||||
|
||||
mBtnSlice->setToolTip(QString("Browse series"));
|
||||
mBtnSlice->setToolTip(tr("Browse series"));
|
||||
connect(mBtnSlice, &QToolButton::clicked, this, [=]() {
|
||||
emit modeChanged(4);
|
||||
});
|
||||
@@ -326,7 +327,7 @@ void DefaultToolBar::initModeButtons() {
|
||||
|
||||
void DefaultToolBar::initAnonymizeButton() {
|
||||
mBtnAnonymize->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
mBtnAnonymize->setToolTip(QString("Toggle annotations"));
|
||||
mBtnAnonymize->setToolTip(tr("Toggle annotations"));
|
||||
mBtnAnonymize->setCheckable(true);
|
||||
QMenu *m;
|
||||
m = new QMenu(this);
|
||||
@@ -375,22 +376,31 @@ void DefaultToolBar::initAnonymizeButton() {
|
||||
}
|
||||
|
||||
void DefaultToolBar::initMeasureButton() {
|
||||
|
||||
QStringList measures={tr("Length"),
|
||||
tr("Angle"),
|
||||
tr("Closed polygon"),
|
||||
tr("Open polygon"),
|
||||
tr("Arrow"),
|
||||
tr("Ellipse"),
|
||||
tr("Text")};
|
||||
|
||||
#define ADD_MEASURE_ACTION(index)\
|
||||
m->addAction(tr(std::get<0>(MEASURE_ACTIIONS[index])), this, [=] {\
|
||||
m->addAction(measures[index], this, [=] {\
|
||||
mBtnMeasure->setChecked(true);\
|
||||
QPixmap map(std::get<1>(MEASURE_ACTIIONS[index]));\
|
||||
QPixmap map(std::get<0>(MEASURE_ACTIIONS[index]));\
|
||||
mBtnMeasure->setIcon(QIcon(map));\
|
||||
MeasureHelper::setMeasureType(std::get<2>(MEASURE_ACTIIONS[index]));\
|
||||
MeasureHelper::setMeasureType(std::get<1>(MEASURE_ACTIIONS[index]));\
|
||||
})
|
||||
|
||||
|
||||
#define ADD_DEL_ACTION(text, type)\
|
||||
m->addAction(tr(text),this,[]{\
|
||||
m->addAction(text,this,[]{\
|
||||
MeasureHelper::deleteMeasure(type);\
|
||||
});
|
||||
|
||||
mBtnMeasure->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
mBtnMeasure->setToolTip(QString("Measurements"));
|
||||
mBtnMeasure->setToolTip(tr("Measurements"));
|
||||
|
||||
connect(mBtnMeasure, &QToolButton::clicked, [=](){
|
||||
MeasureHelper::setMeasureType(MeasureHelper::getMeasureType());
|
||||
@@ -403,49 +413,54 @@ void DefaultToolBar::initMeasureButton() {
|
||||
ADD_MEASURE_ACTION(j);
|
||||
}
|
||||
m->addSeparator();
|
||||
ADD_DEL_ACTION("Delete selected", AnnotationDeleteType::DeleteSelectedAnn);
|
||||
ADD_DEL_ACTION("Delete all in current slice", AnnotationDeleteType::DeleteSliceAnn);
|
||||
ADD_DEL_ACTION("Delete all in current series", AnnotationDeleteType::DeleteSeriesAnn);
|
||||
ADD_DEL_ACTION(tr("Delete selected"), AnnotationDeleteType::DeleteSelectedAnn);
|
||||
ADD_DEL_ACTION(tr("Delete all in current slice"), AnnotationDeleteType::DeleteSliceAnn);
|
||||
ADD_DEL_ACTION(tr("Delete all in current series"), AnnotationDeleteType::DeleteSeriesAnn);
|
||||
mBtnMeasure->setPopupMode(QToolButton::MenuButtonPopup);
|
||||
mBtnMeasure->setMenu(m);
|
||||
|
||||
m->addSeparator();
|
||||
// m->addAction(tr("Localtion Point"), this,[=](){
|
||||
// emit modeChanged(38);
|
||||
// });
|
||||
}
|
||||
|
||||
void DefaultToolBar::initFusionButton() {
|
||||
mBtnFusion->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
mBtnFusion->setToolTip(QString("Fusion"));
|
||||
mBtnFusion->setToolTip(tr("Fusion"));
|
||||
connect(mBtnFusion, &QToolButton::clicked, this, &DefaultToolBar::fusion);
|
||||
mBtnFusion->setEnabled(false);
|
||||
}
|
||||
|
||||
void DefaultToolBar::initCineButton() {
|
||||
mBtnCine->setToolTip(QString("Cine"));
|
||||
mBtnCine->setToolTip(tr("Cine"));
|
||||
mBtnCine->setCheckable(true);
|
||||
connect(mBtnCine, &QToolButton::clicked, this, &DefaultToolBar::cine);
|
||||
}
|
||||
|
||||
void DefaultToolBar::initClearButton() {
|
||||
mBtnClear->setToolTip(QString("Delete current series"));
|
||||
mBtnClear->setToolTip(tr("Delete current series"));
|
||||
connect(mBtnClear, &QToolButton::clicked, this, &DefaultToolBar::clear);
|
||||
}
|
||||
|
||||
void DefaultToolBar::initTransformButton() {
|
||||
mBtnFlip->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
mBtnFlip->setToolTip(QString("Transformations"));
|
||||
mBtnFlip->setToolTip(tr("Transformations"));
|
||||
QMenu *m = new QMenu(this);
|
||||
|
||||
#define ADD_TRANSFORM_ACTION(text,type)\
|
||||
m->addAction(tr(text), this, [&] {\
|
||||
m->addAction(text, this, [&] {\
|
||||
emit transform(type);\
|
||||
});
|
||||
|
||||
ADD_TRANSFORM_ACTION("Rotate 90 CCW",ROTATE_90_CCW);
|
||||
ADD_TRANSFORM_ACTION("Rotate 90 CW", ROTATE_90_CW);
|
||||
ADD_TRANSFORM_ACTION("Rotate 180",ROTATE_180);
|
||||
ADD_TRANSFORM_ACTION(tr("Rotate 90 CCW"),ROTATE_90_CCW);
|
||||
ADD_TRANSFORM_ACTION(tr("Rotate 90 CW"), ROTATE_90_CW);
|
||||
ADD_TRANSFORM_ACTION(tr("Rotate 180"),ROTATE_180);
|
||||
m->addSeparator();
|
||||
ADD_TRANSFORM_ACTION("Flip horizontal",H_FLIP);
|
||||
ADD_TRANSFORM_ACTION("Flip vertical",V_FLIP);
|
||||
ADD_TRANSFORM_ACTION(tr("Flip horizontal"),H_FLIP);
|
||||
ADD_TRANSFORM_ACTION(tr("Flip vertical"),V_FLIP);
|
||||
m->addSeparator();
|
||||
ADD_TRANSFORM_ACTION("Clear transformations",CLEAR);
|
||||
ADD_TRANSFORM_ACTION(tr("Clear transformations"),CLEAR);
|
||||
mBtnFlip->setPopupMode(QToolButton::MenuButtonPopup);
|
||||
mBtnFlip->setMenu(m);
|
||||
connect(mBtnFlip, &QPushButton::clicked, this,[=](){
|
||||
@@ -455,7 +470,7 @@ void DefaultToolBar::initTransformButton() {
|
||||
|
||||
void DefaultToolBar::initMPRButton(){
|
||||
mBtnMPR->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
mBtnMPR->setToolTip(QString("MPR"));
|
||||
mBtnMPR->setToolTip(tr("MPR"));
|
||||
QMenu *m = new QMenu(this);
|
||||
auto group = new QActionGroup(this);
|
||||
auto actionMPR= m->addAction(tr("3D MPR"));
|
||||
@@ -556,7 +571,7 @@ void DefaultToolBar::updateNeedCheckFunctionButtons(ViewFunctionState state)
|
||||
}
|
||||
|
||||
void DefaultToolBar::initScreenButtons() {
|
||||
mBtnFullScreen->setToolTip(QString("Full screen"));
|
||||
mBtnFullScreen->setToolTip(tr("Full screen"));
|
||||
connect(mBtnFullScreen, &QToolButton::clicked, this, [=] {
|
||||
mActionFullScreen->setVisible(false);
|
||||
mActionMinimize->setVisible(true);
|
||||
@@ -566,7 +581,7 @@ void DefaultToolBar::initScreenButtons() {
|
||||
emit parentWindowStateChange(Qt::WindowState::WindowFullScreen);
|
||||
});
|
||||
|
||||
mBtnMaximize->setToolTip(QString("Exit full screen mode"));
|
||||
mBtnMaximize->setToolTip(tr("Exit full screen mode"));
|
||||
connect(mBtnMaximize, &QToolButton::clicked, this, [=] {
|
||||
mActionFullScreen->setVisible(true);
|
||||
mActionMinimize->setVisible(false);
|
||||
@@ -576,12 +591,12 @@ void DefaultToolBar::initScreenButtons() {
|
||||
emit parentWindowStateChange(Qt::WindowState::WindowMaximized);
|
||||
});
|
||||
|
||||
mBtnMinimize->setToolTip(QString("Minimize"));
|
||||
mBtnMinimize->setToolTip(tr("Minimize"));
|
||||
connect(mBtnMinimize, &QToolButton::clicked, this, [=] {
|
||||
emit parentWindowStateChange(Qt::WindowState::WindowMinimized);
|
||||
});
|
||||
|
||||
mBtnClose->setToolTip(QString("Close"));
|
||||
mBtnClose->setToolTip(tr("Close"));
|
||||
connect(mBtnClose, &QToolButton::clicked, this, &DefaultToolBar::parentWindowClose);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ signals:
|
||||
void clear();
|
||||
void parentWindowStateChange(Qt::WindowState state);
|
||||
void parentWindowClose();
|
||||
void parentWindowLanguageChange();
|
||||
|
||||
void transform(TransFormType type);
|
||||
void showMeta();
|
||||
void volumeRendering();
|
||||
|
||||
@@ -282,6 +282,12 @@ void QDicomViewer::displayThumbnailBar(bool value) {
|
||||
|
||||
void QDicomViewer::initScreenControl() {
|
||||
connect(ui->toolBar,&DefaultToolBar::parentWindowStateChange,this,&QDicomViewer::setWindowState);
|
||||
connect(ui->toolBar,&DefaultToolBar::parentWindowLanguageChange, [=](){
|
||||
int result = QMessageBox::question(this,tr("confirm"),tr("Change Language will reload the application, please confirm to do this!"),
|
||||
tr("Ok"),tr("Cancel"));
|
||||
if (result!=0) return;
|
||||
QCoreApplication::exit(99);
|
||||
});
|
||||
connect(ui->toolBar,&DefaultToolBar::parentWindowClose, this, &QWidget::close);
|
||||
}
|
||||
|
||||
@@ -294,7 +300,7 @@ void QDicomViewer::openDICOMFromPACS(int err, std::string dirName) {
|
||||
openDICOM(dirName, DIR_OPEN_MODE);
|
||||
} else {
|
||||
//pop out msg box
|
||||
QMessageBox::warning(this, "Warning", "open DICOM Images From PACS Fail");
|
||||
QMessageBox::warning(this, tr("Warning"), tr("open DICOM Images From PACS Fail"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <vtkAutoInit.h>
|
||||
#include "UI/Window/QDicomViewer.h"
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QTranslator>
|
||||
#include <QSurfaceFormat>
|
||||
#include "QVTKOpenGLNativeWidget.h"
|
||||
#include <QTextCodec.h>
|
||||
@@ -10,6 +10,9 @@ VTK_MODULE_INIT(vtkInteractionStyle);
|
||||
VTK_MODULE_INIT(vtkRenderingFreeType)
|
||||
VTK_MODULE_INIT(vtkRenderingVolumeOpenGL2)
|
||||
|
||||
#include "UI/Window/QDicomViewer.h"
|
||||
#include "Common/QGlobals.h"
|
||||
|
||||
//#define vtkRenderingCore_AUTOINIT 4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeType,vtkRenderingOpenGL2)
|
||||
|
||||
#ifndef _DEBUG
|
||||
@@ -31,14 +34,56 @@ int main(int argc, char* argv[])
|
||||
|
||||
QFont font;
|
||||
font.setFamily(QString::fromUtf8("Arial"));
|
||||
//QFont font("Microsoft YaHei"
|
||||
//QFont font("Courier");
|
||||
//font.setStyleHint(QFont::);
|
||||
|
||||
|
||||
QString cachePath = QDir::currentPath()+"/.cache";
|
||||
if (!QFile::exists(cachePath))
|
||||
{
|
||||
QFile cache(cachePath);
|
||||
cache.open(QFile::NewOnly);
|
||||
cache.close();
|
||||
}
|
||||
QSettings setting(cachePath,QSettings::IniFormat);
|
||||
QString lang = setting.value("Lang").toString();
|
||||
QTranslator translator;
|
||||
if (lang == "CN")
|
||||
{
|
||||
translator.load("./zh_CN.qm");
|
||||
LanguageHelper::setLanguage(ChineseSimple);
|
||||
}
|
||||
else{
|
||||
translator.load("./en_US.qm");
|
||||
LanguageHelper::setLanguage(English);
|
||||
}
|
||||
|
||||
QApplication::installTranslator(&translator);
|
||||
QApplication::setFont(font);
|
||||
|
||||
//qDebug() << desktop_width << desktop_height;
|
||||
int exitCode = 0;
|
||||
vtkObject::SetGlobalWarningDisplay(0);
|
||||
{
|
||||
QDicomViewer w;
|
||||
w.show();
|
||||
exitCode = a.exec();
|
||||
}
|
||||
while (exitCode == 99){
|
||||
lang = setting.value("Lang").toString();
|
||||
if (lang == "CN")
|
||||
{
|
||||
translator.load("./en_US.qm");
|
||||
setting.setValue("Lang","EN");
|
||||
LanguageHelper::setLanguage(English);
|
||||
}
|
||||
else{
|
||||
translator.load("./zh_CN.qm");
|
||||
setting.setValue("Lang","CN");
|
||||
LanguageHelper::setLanguage(ChineseSimple);
|
||||
}
|
||||
QApplication::installTranslator(&translator);
|
||||
QDicomViewer w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
exitCode = a.exec();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1154
src/translations/en_US.ts
Normal file
1154
src/translations/en_US.ts
Normal file
File diff suppressed because it is too large
Load Diff
1173
src/translations/zh_CN.ts
Normal file
1173
src/translations/zh_CN.ts
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user