18 Commits

Author SHA1 Message Date
Krad
9d85acaac5 v0.6.10beta2 2022-04-06 09:50:25 +08:00
Krad
bc8f5cdeb2 Merge fix 2022-04-06 09:29:17 +08:00
Krad
73cd96333d File arrangement 2022-04-06 09:16:26 +08:00
Krad
5dafb1e816 Refactor a setPatientDetail method. 2022-04-02 14:52:21 +08:00
Krad
2c686d6179 Change editpatientform to a only detail display widget. 2022-04-02 14:49:10 +08:00
Krad
19786da9fe Remove redundant 'V' Embedded Software version text. 2022-04-02 14:46:14 +08:00
Krad
23065c6cc5 v0.6.10 beta1 2022-04-02 09:39:17 +08:00
Krad
9bffca90ae Change SelectFormWidget, use EditPatientDialog instead of EditPatientForm to fulfill patient edit and adding. 2022-04-01 15:33:50 +08:00
Krad
3fecd89689 Add new components, ListBox and EditPatientDialog. 2022-04-01 15:32:23 +08:00
Krad
3835339758 Add new components, DateSlidePickerBox and DateSelectDialog. 2022-04-01 15:31:38 +08:00
Krad
01bcd510e6 Add disable and enable item method, resizeLabelWidth method;, valueChanged signal to SlidePickerBox. 2022-04-01 15:30:39 +08:00
Krad
da284a2d0b Change setAvailableDates to setValues of SelectDialog 2022-04-01 15:28:18 +08:00
Krad
27832c6d76 Fake version for shimlib. 2022-04-01 15:24:57 +08:00
Krad
96e848750c Style Change, new style for editvalBtn. 2022-04-01 15:24:27 +08:00
Krad
e2301c3139 Shrink long word wrap text in data model. 2022-04-01 15:23:42 +08:00
Krad
04b7191702 Read and show embed ware version 2022-03-16 17:00:03 +08:00
Krad
f4fdb4d223 Embed ware version interface in shimlib 2022-03-16 16:59:44 +08:00
Krad
fb525d3cdd Change Version number to v0.6.9 2022-03-16 13:03:22 +08:00
82 changed files with 999 additions and 459 deletions

View File

@@ -7,4 +7,5 @@
#define GUI_VERSION_MAJOR @GUI_VERSION_MAJOR@
#define GUI_VERSION_MINOR @GUI_VERSION_MINOR@
#define GUI_VERSION_BUILD @GUI_VERSION_BUILD@
#define GUI_VERSION_BETA @GUI_VERSION_BETA@
#endif //GUI_VERSION_H

View File

@@ -8,7 +8,8 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
# GUI Version
set(GUI_VERSION_MAJOR 0)
set(GUI_VERSION_MINOR 6)
set(GUI_VERSION_BUILD 8)
set(GUI_VERSION_BUILD 10)
set(GUI_VERSION_BETA 1)
# use AppVersion.h as a configure file
configure_file(
"AppVersion.h.in"

5
docs/v0.6.10.txt Normal file
View File

@@ -0,0 +1,5 @@
v0.6.10
重写了整个Patient的修改和新增逻辑使用模态对话框替代的原来界面内的显示。
去除了原来界面内编辑区域,只做显示使用。
此外,使用滑动块替换了性别选择,日期选择的功能。

37
src/DateSelectDialog.cpp Normal file
View File

@@ -0,0 +1,37 @@
//
// Created by Krad on 2022/3/24.
//
#include "DateSelectDialog.h"
#include <QVBoxLayout>
#include "components/DateSlidePickerBox.h"
#include <QDate>
DateSelectDialog::DateSelectDialog(QWidget *parent, Qt::WindowFlags f) : GUIFormBaseDialog(parent, f) {
this->setFixedSize(460, 380);
QVBoxLayout* layout = new QVBoxLayout(formWidget);
box = new DateSlidePickerBox(formWidget);
box->setObjectName("slider_one");
box->setSelectedValue("1990-01-01");
layout->addWidget(box);
}
DateSelectDialog::~DateSelectDialog() {
}
QString DateSelectDialog::getSelectedValue() {
return box->getSelectedValue();
}
void DateSelectDialog::setSelectedValue(const QString &val) {
box->setSelectedValue(val);
box->resizeLabel();
}
bool DateSelectDialog::updateReferenceData() {
return true;
}
void DateSelectDialog::showEvent(QShowEvent * event) {
QDialog::showEvent(event);
}

24
src/DateSelectDialog.h Normal file
View File

@@ -0,0 +1,24 @@
//
// Created by Krad on 2022/3/24.
//
#ifndef GUI_DATESELECTDIALOG_H
#define GUI_DATESELECTDIALOG_H
#include "dialogs/GUIFormBaseDialog.h"
class DateSlidePickerBox;
class DateSelectDialog:public GUIFormBaseDialog{
Q_OBJECT
public:
explicit DateSelectDialog(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
~DateSelectDialog() override;
QString getSelectedValue();
void setSelectedValue(const QString& val);
void showEvent(QShowEvent *) override;
protected:
bool updateReferenceData() override;
DateSlidePickerBox* box;
};
#endif //GUI_DATESELECTDIALOG_H

212
src/EditPatientDialog.cpp Normal file
View File

@@ -0,0 +1,212 @@
//
// Created by Krad on 2022/3/21.
//
#include <QVBoxLayout>
#include <QLabel>
#include <QDateTime>
#include <QLineEdit>
#include <QTextEdit>
#include <QToolButton>
#include <QSqlTableModel>
#include <QUuid>
#include "EditPatientDialog.h"
#include "dialogs/SelectDialog.h"
#include "DateSelectDialog.h"
#include "components/Listbox.h"
int queryValue(QSqlTableModel* model, int colID, QVariant var)
{
for (int i = 0; i < model->rowCount(); ++i) {
if (model->data(model->index(i, colID)) == var) return i;
}
return -1;
}
EditPatientDialog::EditPatientDialog(QWidget *parent, Qt::WindowFlags f) : GUIFormBaseDialog(parent, f) {
QVBoxLayout* layout = new QVBoxLayout(formWidget);
layout->setSpacing(10);
// add title
QLabel* lbl_title = new QLabel(this);
lbl_title->setAlignment(Qt::AlignCenter);
lbl_title->setText(tr("Edit Patient"));
lbl_title->setObjectName("title");
layout->addWidget(lbl_title);
//add old password
QLabel* lbl_id = new QLabel(this);
lbl_id->setText(tr("ID"));
le_id = new QLineEdit(this);
layout->addWidget(lbl_id);
layout->addWidget(le_id);
QLabel* lbl_endline1 = new QLabel(this);
lbl_endline1->setObjectName("endline");
layout->addWidget(lbl_endline1);
QLabel* lbl_name= new QLabel(this);
lbl_name->setText(tr("Name"));
le_name = new QLineEdit(this);
layout->addWidget(lbl_name);
layout->addWidget(le_name);
QLabel* lbl_endline2 = new QLabel(this);
lbl_endline2->setObjectName("endline");
layout->addWidget(lbl_endline2);
QLabel* lbl_sex= new QLabel(this);
lbl_sex->setText(tr("Gender"));
layout->addWidget(lbl_sex);
btnSex = new Listbox(this);
btnSex->setText(tr("Female"));
btnSex->setProperty("idx",0);
btnSex->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
btnSex->setLayoutDirection(Qt::RightToLeft);
btnSex->setObjectName("editvalBtn");
btnSex->setIcon(QIcon(":/icons/arrow-down.png"));
btnSex->setIconSize({30, 30});
btnSex->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
connect(btnSex, &QToolButton::clicked,[=](){
SelectDialog dialog(this);
QStringList items;
items<<tr("Female")<<tr("Male")<<tr("Other");
dialog.setValues(items);
dialog.setSelectedValue(items[btnSex->property("idx").toInt()]);
dialog.setWindowModality(Qt::WindowModal);
if (dialog.exec() == QDialog::Accepted){
btnSex->setText(dialog.getSelectedValue());
btnSex->setProperty("idx",items.indexOf(dialog.getSelectedValue()));
}
});
layout->addWidget(btnSex);
QLabel *lbl_endline9 = new QLabel(this);
lbl_endline9->setFixedHeight(2);
lbl_endline9->setObjectName("endline");
layout->addWidget(lbl_endline9);
QLabel* lbl_date = new QLabel(this);
lbl_date->setText(tr("Birth Date"));
layout->addWidget(lbl_date);
btnDate = new Listbox(this);
btnDate->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
btnDate->setLayoutDirection(Qt::RightToLeft);
btnDate->setObjectName("editvalBtn");
btnDate->setIcon(QIcon(":/icons/arrow-down.png"));
btnDate->setIconSize({30, 30});
btnDate->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
btnDate->setText("1990-06-15");
connect(btnDate, &QToolButton::clicked,[=](){
DateSelectDialog dialog(this);
dialog.setSelectedValue(btnDate->text());
dialog.setWindowModality(Qt::WindowModal);
if (dialog.exec() == QDialog::Accepted){
btnDate->setText(dialog.getSelectedValue());
}
});
layout->addWidget(btnDate);
QLabel* lbl_endline5 = new QLabel(this);
lbl_endline5->setObjectName("endline");
layout->addWidget(lbl_endline5);
QLabel* lbl_comment = new QLabel(this);
lbl_comment->setText(tr("Comment"));
te_comment = new QTextEdit(this);
layout->addWidget(lbl_comment);
layout->addWidget(te_comment);
QLabel* lbl_endline6 = new QLabel(this);
lbl_endline6->setObjectName("endline");
layout->addWidget(lbl_endline6);
lbl_error = new QLabel(this);
lbl_error->setObjectName("warn");
layout->addWidget(lbl_error);
}
EditPatientDialog::~EditPatientDialog() {
}
void EditPatientDialog::setPatientInformation(PatientInformation* information) {
if (information)
{
le_id->setText(information->ID);
btnSex->setText(information->Sex == tr("F")?tr("Female"):(information->Sex == tr("M")?tr("Male"):tr("Other")));
le_name->setText(information->Name);
te_comment->setText(information->Comment);
btnDate->setText(information->BirthDate);
currentPatientUID = information->PatientUID;
AddDate = information->AddDate;
le_id->setEnabled(false);
}
}
void EditPatientDialog::clearPatientInformation() {
le_id->setText("");
// le_date->setText("");
le_name->setText("");
te_comment->setText("");
}
void EditPatientDialog::storePatientInformation() {
store.PatientUID = currentPatientUID;
// store.AddDate = AddDate;
store.ID = le_id->text();
store.BirthDate = le_date->text();
store.Name = le_name->text();
store.Sex = le_sex->text();
store.Comment = te_comment->toPlainText();
}
bool EditPatientDialog::updateReferenceData() {
PatientInformation* inf = getPatientInformation();
if (le_id->text().isEmpty()){
lbl_error->setText("ID can't be empty!");
lbl_error->setVisible(true);
return false;
}
inf->ID = le_id->text().trimmed();
if (le_name->text().isEmpty()){
lbl_error->setText("Patient Name can't be empty!");
lbl_error->setVisible(true);
return false;
}
inf->Name = le_name->text().trimmed();
int selectedRow = 0;
bool isAdd = currentPatientUID.isEmpty();
if (isAdd) {
int ref_rowid = queryValue(model, 1, inf->ID);
if (ref_rowid >= 0)
{
lbl_error->setText("The ID is already existed!");
lbl_error->setVisible(true);
return false;
}
inf->PatientUID = QUuid::createUuid().toString();
inf->AddDate = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss");
model->insertRow(0);
}
else{
inf->PatientUID = currentPatientUID;
selectedRow = queryValue(model, 1, inf->ID);
inf->AddDate = AddDate;
}
inf->Sex = btnSex->text()==tr("Female")?"F":(tr("Male")==btnSex->text()?"M":"O");
inf->BirthDate = btnDate->text();
inf->Comment = te_comment->toPlainText();
#define ADD_PATIENT_PROPERTY(val)\
model->setData(model->index(selectedRow,PatientInformationEnum:: val),inf-> val);
EDIT_PATIENT()
#undef ADD_PATIENT_PROPERTY
if (model->submitAll())
{
return true;
}
else {
lbl_error->setText("Submit to database error!");
lbl_error->setVisible(true);
return false;
}
}

53
src/EditPatientDialog.h Normal file
View File

@@ -0,0 +1,53 @@
//
// Created by Krad on 2022/3/21.
//
#ifndef GUI_EDITPATIENTDIALOG_H
#define GUI_EDITPATIENTDIALOG_H
#include "dialogs/GUIFormBaseDialog.h"
#include "forms/select/editpatientform.h"
class QLineEdit;
class QTextEdit;
class QLabel;
class QToolButton;
class QSqlTableModel;
class EditPatientDialog :public GUIFormBaseDialog{
Q_OBJECT
public:
explicit EditPatientDialog(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
~EditPatientDialog();
void setModel(QSqlTableModel * m){
model=m;
}
PatientInformation * getPatientInformation(){
return &store;
}
void setPatientInformation(PatientInformation * information);
void clearPatientInformation();
void storePatientInformation();
protected:
bool updateReferenceData() override;
private:
QLineEdit* le_id= nullptr;
QLineEdit* le_name = nullptr;
QLineEdit* le_sex = nullptr;
QLineEdit* le_date = nullptr;
QTextEdit* te_comment = nullptr;
QLabel* lbl_error = nullptr;
PatientInformation store;
QString currentPatientUID;
QString AddDate;
QToolButton* btnSex = nullptr;
QToolButton* btnDate = nullptr;
QSqlTableModel* model = nullptr;
};
#endif //GUI_EDITPATIENTDIALOG_H

View File

@@ -111,6 +111,8 @@ const char* GetDeviceInfo(DeviceInfo infoType) {
switch (infoType) {
case MEAN_TEMPERATURE:
return "28";
case VERSION:
return "6.6.06";
}
return "";
}

View File

@@ -29,7 +29,8 @@ typedef enum {
//kinds of device information
typedef enum {
MEAN_TEMPERATURE
MEAN_TEMPERATURE,
VERSION
} DeviceInfo;
extern int InitLib(void(*)(const char *msg));

View File

@@ -13,8 +13,8 @@
#include <QTableView>
#include "components/SlideableTableView.h"
#include <QPushButton>
#include "SelectDialog.h"
#include "mainwindow.h"
#include "src/dialogs/SelectDialog.h"
#include "src/windows/mainwindow.h"
#include "event/EventCenter.h"
QString fileNameToDate(QString fileName)
{
@@ -51,7 +51,7 @@ UserOperationLogForm::UserOperationLogForm(QWidget* parent) {
dialog = new SelectDialog(this);
dialog->setWindowModality(Qt::WindowModal);
}
dialog->setAvailableDates(dates);
dialog->setValues(dates);
if (!selectedDateStr.isEmpty()) dialog->setSelectedValue(selectedDateStr);
if (dialog->exec() == QDialog::Accepted)
{

View File

@@ -0,0 +1,152 @@
//
// Created by Krad on 2022/3/24.
//
#include "DateSlidePickerBox.h"
#include <QHBoxLayout>
#include <QLabel>
#include <QDate>
DateSlidePickerBox::DateSlidePickerBox(QWidget *parent) {
layout = new QHBoxLayout(this);
myear = new SlidePickerBox(this);
QStringList centry;
centry<<"19"<<"20";
myear->setFixedWidth(56);
myear->setItems(centry);
layout->addWidget(myear);
tyear = new SlidePickerBox(this);
QStringList m_centry;
m_centry << "0" << "1" << "2" << "3" << "4" << "5" << "6" << "7" << "8" << "9";
tyear->setItems(m_centry);
tyear->setFixedWidth(50);
layout->addWidget(tyear);
year = new SlidePickerBox(this);
year->setItems(m_centry);
year->setFixedWidth(50);
layout->addWidget(year);
QLabel* label = new QLabel(this);
label->setText("/");
// label->setFixedHeight(110);
label->setAlignment(Qt::AlignCenter);
label->setFixedWidth(50);
label->setObjectName("sliderSpliterLabel");
layout->addWidget(label);
month = new SlidePickerBox(this);
QStringList m_mouth;
m_mouth << "01" << "02" << "03" << "04" << "05" << "06" << "07" << "08" << "09"<<"10"<<"11"<<"12";
month->setItems(m_mouth);
month->setFixedWidth(56);
layout->addWidget(month);
QLabel* label2 = new QLabel(this);
label2->setText("/");
// label2->setFixedHeight(110);
label2->setAlignment(Qt::AlignCenter);
// label2->setFixedHeight(80);
label2->setFixedWidth(50);
label2->setObjectName("sliderSpliterLabel");
layout->addWidget(label2);
day = new SlidePickerBox(this);
QStringList days;
days << "01" << "02" << "03" << "04" << "05" << "06" << "07" << "08" << "09";
for (int i=10;i<=31;i++){
days<<QString("%1").arg(i);
}
day->setFixedWidth(56);
day->setItems(days);
layout->addWidget(day);
bigMonth << "01" << "03" << "05" << "07" << "08" << "10" << "12";
connect(myear,&SlidePickerBox::valueChanged,this,&DateSlidePickerBox::leapYearAndFebruaryAdjust);
connect(tyear,&SlidePickerBox::valueChanged,this,&DateSlidePickerBox::leapYearAndFebruaryAdjust);
connect(year,&SlidePickerBox::valueChanged,this,&DateSlidePickerBox::leapYearAndFebruaryAdjust);
connect(month,&SlidePickerBox::valueChanged,this,&DateSlidePickerBox::leapYearAndFebruaryAdjust);
}
void DateSlidePickerBox::resizeLabel() {
myear->resizeLabelWidth();
tyear->resizeLabelWidth();
year->resizeLabelWidth();
month->resizeLabelWidth();
day->resizeLabelWidth();
}
QString DateSlidePickerBox::getSelectedValue() {
return QString("%1%2%3-%4-%5").arg(myear->getSelectedValue()).
arg(tyear->getSelectedValue()).arg(year->getSelectedValue())
.arg(month->getSelectedValue()).arg(day->getSelectedValue());
}
void DateSlidePickerBox::setSelectedValue(const QString &val) {
myear->setSelectedValue(val.left(2));
tyear->setSelectedValue(val.left(3).right(1));
year->setSelectedValue(val.left(4).right(1));
QStringList sary = val.split('-');
month->setSelectedValue(sary[1]);
day->setSelectedValue(sary[2]);
}
int DateSlidePickerBox::getYear() {
return QString("%1%2%3").arg(myear->getSelectedValue()).
arg(tyear->getSelectedValue()).arg(year->getSelectedValue()).toInt();
}
void DateSlidePickerBox::leapYearAndFebruaryAdjust() {
QString d = day->getSelectedValue();
//闰年且二月
if (QDate::isLeapYear(getYear()) && month->getSelectedValue() == "02") {
//seq is important, must enable item firstly
day->enableItem("29");
if (d.toInt() > 29) {
day->setSelectedValue("29");
}
day->disableItem("30");
day->disableItem("31");
}
//普通年份2月或其他月份
else{
//普通年份2月
if (month->getSelectedValue() == "02") {
//seq is important, must set selected value firstly
if (d.toInt() > 28) {
day->setSelectedValue("28");
}
day->disableItem("29");
day->disableItem("30");
day->disableItem("31");
}
//其他月份
else{
day->enableItem("29");
day->enableItem("30");
if (isBigMonth()){
day->enableItem("31");
}
else{
//seq is important, must set selected value firstly
if (d == "31") {
day->setSelectedValue("30");
}
day->disableItem("31");
}
}
}
// day->setSelectedValue(d);
}
bool DateSlidePickerBox::isBigMonth() {
return bigMonth.contains(month->getSelectedValue());
}

View File

@@ -0,0 +1,34 @@
//
// Created by Krad on 2022/3/24.
//
#ifndef GUI_DATESLIDEPICKERBOX_H
#define GUI_DATESLIDEPICKERBOX_H
#include <QWidget>
#include "SlidePickerBox.h"
#include <QDate>
class QHBoxLayout;
class DateSlidePickerBox:public QWidget {
Q_OBJECT
public:
explicit DateSlidePickerBox(QWidget *parent = nullptr);
QString getSelectedValue();
void setSelectedValue(const QString& val);
void resizeLabel();
SlidePickerBox* myear;
SlidePickerBox* tyear;
SlidePickerBox* year;
SlidePickerBox* month;
SlidePickerBox* day;
public Q_SLOTS:
void leapYearAndFebruaryAdjust();
private:
int getYear();
QStringList bigMonth;
bool isBigMonth();
QHBoxLayout* layout;
};
#endif //GUI_DATESLIDEPICKERBOX_H

View File

@@ -0,0 +1,20 @@
//
// Created by Krad on 2022/3/21.
//
#include <QtWidgets/qstyleoption.h>
#include <QPaintEvent>
#include <QStylePainter>
#include "Listbox.h"
void Listbox::paintEvent(QPaintEvent *e) {
QString temp = this->text();
this->setText("");
QToolButton::paintEvent(e);
this->setText(temp);
QStylePainter p(this);
QStyleOptionToolButton opt;
initStyleOption(&opt);
p.drawText((size().width()-this->iconSize().width())/2-(this->text().length()*opt.font.pixelSize())/4,this->iconSize().height()+2,this->text());
}

21
src/components/Listbox.h Normal file
View File

@@ -0,0 +1,21 @@
//
// Created by Krad on 2022/3/21.
//
#ifndef GUI_LISTBOX_H
#define GUI_LISTBOX_H
#include <QToolButton>
class Listbox: public QToolButton {
public:
explicit Listbox(QWidget* parent = nullptr){};
virtual ~Listbox(){};
protected:
virtual void paintEvent(QPaintEvent* e) override;
private:
};
#endif //GUI_LISTBOX_H

View File

@@ -19,7 +19,7 @@ SlidePickerBox::SlidePickerBox(QWidget *parent):QWidget(parent) {
label->setObjectName("sliderPickerLabel");
label->setFixedHeight(fontSize);
label->setFixedWidth(320);
QPoint p = this->mapToGlobal({this->contentsMargins().left(),50-fontSize/2});
QPoint p = {0,50-fontSize/2};
label->move(p);
lbls.push_back(label);
QLabel* label1 = new QLabel(this);
@@ -29,7 +29,7 @@ SlidePickerBox::SlidePickerBox(QWidget *parent):QWidget(parent) {
label1->setObjectName("sliderPickerLabel");
label1->setFixedHeight(fontSize);
label1->setFixedWidth(320);
QPoint p1 = this->mapToGlobal({this->contentsMargins().left(),150-fontSize/2});
QPoint p1 = {0,150-fontSize/2};
label1->move(p1);
lbls.push_back(label1);
QLabel* label2 = new QLabel(this);
@@ -39,7 +39,7 @@ SlidePickerBox::SlidePickerBox(QWidget *parent):QWidget(parent) {
label2->setObjectName("sliderPickerLabel");
label2->setFixedHeight(fontSize);
label2->setFixedWidth(320);
QPoint p2 = this->mapToGlobal({this->contentsMargins().left(),250-fontSize/2});
QPoint p2 = {0,250-fontSize/2};
label2->move(p2);
lbls.push_back(label2);
@@ -51,7 +51,7 @@ SlidePickerBox::SlidePickerBox(QWidget *parent):QWidget(parent) {
line1->setFixedSize(320,100);
line1->setObjectName("topBottomLine");
line1->raise();
QPoint lp = this->mapToGlobal({this->contentsMargins().left(),100});
QPoint lp = {0,100};
line1->move(lp);
selectedIndex = 1;
@@ -76,11 +76,13 @@ void SlidePickerBox::mouseMoveEvent(QMouseEvent *ev) {
}
//防止拉过头
int selectItemCenter = selectedLbl->geometry().center().y();
if (selectedLbl == lbls.last() && selectItemCenter<=150 && offset<0) return;
if (selectedLbl == lbls.first() && selectItemCenter>=150 && offset>0) return;
if (selectedLbl == getEnabledLastLabel() && selectItemCenter<=150 && offset<0) return;
if (selectedLbl == getEnabledFirstLabel() && selectItemCenter>=150 && offset>0) return;
int i = 0;
for (auto item : lbls)
{
if (disableItems.contains(item->text()))continue;
//不需要横向
//int nx = item->geometry().left()+(ev->pos().x()-o_x);
int ny = item->geometry().top() + offset;
@@ -109,6 +111,8 @@ void SlidePickerBox::mouseReleaseEvent(QMouseEvent *ev) {
isDragging = false;
adjustPositon();
QWidget::mouseReleaseEvent(ev);
QString v = getSelectedValue();
emit valueChanged(v);
}
void SlidePickerBox::adjustPositon() const {
@@ -163,7 +167,7 @@ void SlidePickerBox::setItems(QStringList itemsList) {
lbl->setFixedHeight(fontSize);
lbl->setFixedWidth(320);
lbls.push_back(lbl);
QPoint p = this->mapToGlobal({this->contentsMargins().left(),-150});
QPoint p = {0,-150};
lbl->move(p);
}
selectedIndex = lbls.count()-1;
@@ -178,36 +182,32 @@ QString SlidePickerBox::getSelectedValue() {
void SlidePickerBox::setCurrentLabel(QLabel *label) {
if (selectedLbl)hideLabel(selectedLbl);
if (label) {
QPoint lp = this->mapToGlobal({this->contentsMargins().left(), 100});
QPoint lp = {0, 100};
label->move(lp);
label->show();
selectedLbl = label;
}
}
void SlidePickerBox::setNextLabel(QLabel *label) {
if (nextLbl)hideLabel(nextLbl);
if (label){
QPoint lp = this->mapToGlobal({this->contentsMargins().left(),200});
label->move(lp);
label->show();
nextLbl = label;
QLabel * SlidePickerBox::getEnabledFirstLabel() {
if (disableItems.empty()) return lbls.first();
for(int idx = 0; idx<disableItems.size(); idx++){
if(disableItems.contains(lbls[idx]->text()))continue;
return lbls[idx];
}
}
void SlidePickerBox::setPrevLabel(QLabel *label) {
if (prevLbl)hideLabel(prevLbl);
if (label) {
QPoint lp = this->mapToGlobal({this->contentsMargins().left(), 0});
label->move(lp);
label->show();
prevLbl = label;
QLabel * SlidePickerBox::getEnabledLastLabel() {
if (disableItems.empty()) return lbls.last();
for(int idx = lbls.size()-1; idx>=0; idx--){
if(disableItems.contains(lbls[idx]->text()))continue;
return lbls[idx];
}
}
void SlidePickerBox::hideLabel(QLabel *label) {
if (!label) return;
QPoint lp = this->mapToGlobal({this->contentsMargins().left(), -150});
QPoint lp = {0, -150};
label->move(lp);
}
@@ -221,11 +221,53 @@ void SlidePickerBox::setSelectedValue(const QString& val) {
}
int first_y = -100 * (selectedIndex-1);
for (int i = 0; i < lbls.count() ; ++i) {
QPoint lp = {this->contentsMargins().left(), first_y+i*100};
QPoint lp = this->mapTo(this,{0, first_y+i*100});
lbls[i]->move(lp);
lbls[i]->show();
lbls[i]->setStyleSheet("background:transparent");
lbls[i]->lower();
}
selectedLbl = lbls[selectedIndex];
lbls[selectedIndex]->setStyleSheet("color:white");
adjustPositon();
}
void SlidePickerBox::resizeLabelWidth() {
for (int i = 0; i < lbls.count() ; ++i) {
lbls[i]->setAlignment(defaultAlign);
lbls[i]->setFixedWidth(this->width()+this->contentsMargins().left()+this->contentsMargins().right());
}
}
void SlidePickerBox::disableItem(const QString& val) {
if (!disableItems.contains(val)){
disableItems.append(val);
rearrangeLabels();
}
}
void SlidePickerBox::enableItem(const QString &val) {
if (disableItems.contains(val)){
disableItems.removeOne(val);
rearrangeLabels();
}
}
void SlidePickerBox::rearrangeLabels() {
int first_y = -100 * (selectedIndex-1);
int r_index = 0;
for (int i = 0; i < lbls.count() ; ++i) {
if (disableItems.contains(lbls[i]->text())){
lbls[i]->hide();
continue;
}
QPoint lp = this->mapTo(this,{0, first_y+r_index*100});
r_index++;
lbls[i]->move(lp);
lbls[i]->show();
lbls[i]->setStyleSheet("background:transparent");
}
selectedLbl = lbls[selectedIndex];
lbls[selectedIndex]->setStyleSheet("color:white");

View File

@@ -13,11 +13,21 @@ public:
explicit SlidePickerBox(QWidget *parent = nullptr);
QString getSelectedValue();
void setItems(QStringList itemsList);
void addItem(QString& item)
{
void addItem(QString& item) {
this->items.append(item);
}
void disableItem(const QString& val);
void enableItem(const QString& val);
int getItemsCount(){
return items.size();
}
void setSelectedValue(const QString& val);
void resizeLabelWidth();
void setDefaultAlignment(QFlags<Qt::AlignmentFlag> align){
this->defaultAlign = align;
}
signals:
void valueChanged(QString & value);
protected:
bool isDragging;
@@ -33,9 +43,10 @@ protected:
}
void setCurrentLabel(QLabel* label);
void setPrevLabel(QLabel* label);
void setNextLabel(QLabel* label);
QLabel * getEnabledLastLabel();
QLabel * getEnabledFirstLabel();
void hideLabel(QLabel* label);
void rearrangeLabels();
private:
int o_x=0,o_y=10;
int selectedIndex = -1;
@@ -44,7 +55,8 @@ private:
QLabel* nextLbl = nullptr;
QList<QLabel*> lbls;
QStringList items;
QStringList disableItems;
QFlags<Qt::AlignmentFlag> defaultAlign= Qt::AlignCenter;
void adjustPositon() const;
};

View File

@@ -15,7 +15,15 @@ protected:
QVariant data(const QModelIndex& index, int role) const override {
if (index.column() >0 && role == Qt::TextAlignmentRole) {
return Qt::AlignCenter;
} else {
}
if (index.column() >0 && role == Qt::DisplayRole){
auto val = QSqlTableModel::data(index,role).toString();
QStringList list = val.split("\n");
if (list.size()>1)
return QString("%1...").arg(list[0].left(list[0].length()<20?list[0].length():20));
return val;
}
else {
return QSqlTableModel::data(index,role);
}
}

View File

@@ -310,3 +310,7 @@ void DeviceManager::close() {
previewDataCaller->terminate();
delete previewDataCaller;
}
QString DeviceManager::getSoftwareVersion() {
return GetDeviceInfo(VERSION);
}

View File

@@ -20,6 +20,7 @@ public:
void setErrorOccurred(bool v){
errorOccurred = v;
}
QString getSoftwareVersion();
bool getErrorOccurred(){
return errorOccurred;
}

View File

@@ -24,7 +24,7 @@ bool SelectDialog::updateReferenceData() {
return true;
}
void SelectDialog::setAvailableDates(QStringList dates) {
void SelectDialog::setValues(QStringList dates) {
box->setItems(dates);
}

View File

@@ -12,7 +12,7 @@ class SelectDialog :public GUIFormBaseDialog{
public:
explicit SelectDialog(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
~SelectDialog() override;
void setAvailableDates(QStringList dates);
void setValues(QStringList values);
QString getSelectedValue();
void setSelectedValue(const QString& val);
protected:

View File

@@ -1,167 +0,0 @@
#include "editpatientform.h"
#include "ui_editpatientform.h"
#include <QListView>
#include <QHBoxLayout>
#include <QToolButton>
#include <QButtonGroup>
#include "guimacros.h"
#include <qdebug.h>
#include "event/EventCenter.h"
EditPatientForm::EditPatientForm(QWidget* parent) :
QWidget(parent),
ui(new Ui::EditPatientForm)
{
// this->layout()->setContentsMargins(5,5,5,5);
ui->setupUi(this);
//ui->lbl_Sex->setText(tr("Gender"));
QHBoxLayout* sexlayout = new QHBoxLayout(ui->sexpanelwidget);
sexlayout->setMargin(6);
ADD_TOOL_SIZE_BTN_TO_LAYOUT(F, ":/icons/female_d.png", 30, sexlayout);
ADD_TOOL_SIZE_BTN_TO_LAYOUT(M, ":/icons/male_d.png", 30, sexlayout);
btnF->setText(tr("Female"));
btnM->setText(tr("Male"));
ui->hideBtn->setSizePolicy(QSizePolicy::Policy::Expanding,QSizePolicy::Policy::Preferred);
ui->hideBtn->setObjectName("hideeditBtn");
ui->hideBtn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
ui->hideBtn->setIcon(QIcon(":/icons/hidearrow.png"));
ui->hideBtn->setIconSize({30,30});
ui->hideBtn->setText(tr(" Hide Panel"));
connect(ui->hideBtn,&QToolButton::clicked,[=](){
emit hideBtnClicked();
});
// btnFemale->setToolButtonStyle(Qt::ToolButtonIconOnly);
// btnMale->setToolButtonStyle(Qt::ToolButtonIconOnly);
btnF->setObjectName("sexBtn");
btnM->setObjectName("sexBtn");
//btnF->setText("Female");
//btnM->setText("Male");
ui->sexpanelwidget->setEnabled(editEnable);
btnF->setEnabled(editEnable);
btnM->setEnabled(editEnable);
btnF->setCheckable(true);
btnM->setCheckable(true);
QButtonGroup* group = new QButtonGroup(this);
group->addButton(btnF);
group->addButton(btnM);
btnF->setChecked(true);
btnFemale = btnF;
btnMale = btnM;
QHBoxLayout* layout = new QHBoxLayout(this->ui->editcmdWidget);
ADD_TOOL_BTN(Cancel, ":/icons/close_circle.png");
ADD_TOOL_BTN(Accpet, ":/icons/selected.png");
btnCancel->setText(tr("Cancel"));
btnAccpet->setText(tr("Accept"));
btnCancel->setEnabled(editEnable);
btnCancel->setToolButtonStyle(Qt::ToolButtonIconOnly);
btnCancel->setIcon(QIcon(editEnable ? ":/icons/close_circle.png" : ":/icons/close_circle_d.png"));
btnAccpet->setEnabled(editEnable);
btnAccpet->setToolButtonStyle(Qt::ToolButtonIconOnly);
btnAccpet->setIcon(QIcon(editEnable ? ":/icons/selected.png" : ":/icons/selected_d.png"));
btnEditAccept = btnAccpet;
btnEditCancel = btnCancel;
connect(btnEditCancel, &QToolButton::clicked, [=]() {
clearPatientInformation();
this->setEditEnable(false);
restorePatientInformation();
emit editCancel();
});
connect(btnEditAccept, &QToolButton::clicked, [=]() {
if (ui->tbx_ID->text().isEmpty())return;
if (ui->tbx_Name->text().isEmpty())return;
storePatientInformation();
bool result = true;
emit editAccept(getPatientInformation(), result);
if (result) this->setEditEnable(false);
});
ui->tbx_Dob->setDisplayFormat("yyyy/MM/dd");
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
ui->retranslateUi(this);
btnF->setText(tr("Female"));
btnM->setText(tr("Male"));
btnCancel->setText(tr("Cancel"));
btnAccpet->setText(tr("Accept"));
});
}
EditPatientForm::~EditPatientForm()
{
delete ui;
}
void EditPatientForm::setPatientInformation(PatientInformation* information) {
if (information)
{
ui->tbx_ID->setText(information->ID);
ui->tbx_Dob->setDate(QDate::fromString(information->BirthDate, "yyyy-MM-dd"));
ui->tbx_Name->setText(information->Name);
ui->rtbx_Comment->setText(information->Comment);
btnFemale->setChecked(information->Sex == "F");
btnMale->setChecked(information->Sex != "F");
currentPatientUID = information->PatientUID;
AddDate = information->AddDate;
storePatientInformation();
}
}
void EditPatientForm::clearPatientInformation() {
ui->tbx_ID->setText("");
ui->tbx_Dob->setDate(QDate::currentDate());
ui->tbx_Name->setText("");
btnFemale->setChecked(true);
btnMale->setChecked(false);
ui->rtbx_Comment->setText("");
currentPatientUID = "";
AddDate = "";
}
void EditPatientForm::setEditEnable(bool enable) {
ui->tbx_ID->setEnabled(enable);
ui->tbx_Dob->setEnabled(enable);
ui->tbx_Name->setEnabled(enable);
ui->sexpanelwidget->setEnabled(enable);
btnFemale->setEnabled(enable);
btnFemale->setIcon(QIcon(enable ? ":/icons/female.png" : ":/icons/female_d.png"));
btnMale->setEnabled(enable);
btnMale->setIcon(QIcon(enable ? ":/icons/male.png" : ":/icons/male_d.png"));
ui->rtbx_Comment->setEnabled(enable);
btnEditAccept->setEnabled(enable);
btnEditCancel->setEnabled(enable);
btnEditCancel->setIcon(QIcon(enable ? ":/icons/close_circle.png" : ":/icons/close_circle_d.png"));
btnEditAccept->setIcon(QIcon(enable ? ":/icons/selected.png" : ":/icons/selected_d.png"));
editEnable = enable;
// ui->->setEnabled(enable);
}
void EditPatientForm::storePatientInformation() {
store.PatientUID = currentPatientUID;
store.AddDate = AddDate;
store.ID = ui->tbx_ID->text();
store.BirthDate = ui->tbx_Dob->date().toString("yyyy-MM-dd");
store.Name = ui->tbx_Name->text();
store.Sex = btnFemale->isChecked() ? "F" : "M";
store.Comment = ui->rtbx_Comment->toPlainText();
qDebug() << store.PatientUID << "," << store.ID << "," << store.BirthDate << "," << store.Name << "," << store.Sex;
}
void EditPatientForm::restorePatientInformation() {
currentPatientUID = store.PatientUID;
AddDate = store.AddDate;
ui->tbx_ID->setText(store.ID);
ui->tbx_Dob->setDate(QDate::fromString(store.BirthDate, "yyyy-MM-dd"));
ui->tbx_Name->setText(store.Name);
ui->rtbx_Comment->setText(store.Comment);
btnFemale->setChecked(store.Sex == "F");
btnMale->setChecked(store.Sex != "F");
// ui->cb_Sex->setCurrentText(store.Sex=="F"?"Female":(store.Name=="M"?"Male":"Other"));
}

View File

@@ -1,152 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditPatientForm</class>
<widget class="QWidget" name="EditPatientForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>466</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="hideBtn">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="lbl_ID">
<property name="text">
<string>ID</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="tbx_ID">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_Name">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="tbx_Name">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_Sex">
<property name="text">
<string>Gender</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="sexpanelwidget" native="true"/>
</item>
<item>
<widget class="QLabel" name="lbl_DOB">
<property name="text">
<string>Date Of Birth</string>
</property>
</widget>
</item>
<item>
<widget class="QDateEdit" name="tbx_Dob">
<property name="enabled">
<bool>false</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>1</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_Comment">
<property name="text">
<string>Comment</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="rtbx_Comment">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="editcmdWidget" native="true"/>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -8,7 +8,7 @@
#include <QToolButton>
#include "ui_tabformwidget.h"
#include "guimacros.h"
#include "patientinformationform.h"
#include "src/forms/scan/patientinformationform.h"
#include <QButtonGroup>
#include "event/EventCenter.h"
#include <QImage>

View File

@@ -5,7 +5,7 @@
#ifndef GUI_SCANFORMWIDGET_H
#define GUI_SCANFORMWIDGET_H
#include "tabformwidget.h"
#include "src/forms/tabformwidget.h"
#include <functional>
class PatientInformationForm;
class ScanFormWidget :public TabFormWidget {

View File

@@ -2,7 +2,7 @@
#define PATIENTINFORMATIONFORM_H
#include <QWidget>
#include "editpatientform.h"
#include "src/forms/select/editpatientform.h"
namespace Ui {
class PatientInformationForm;
}

View File

@@ -14,29 +14,17 @@
#include "editpatientform.h"
#include "guimacros.h"
#include "event/EventCenter.h"
#include "AccountFormDialog.h"
#include "src/dialogs/AccountFormDialog.h"
#include <QDebug>
#include "log/UserOperationLog.h"
#include <QSortFilterProxyModel>
#include "src/components/VerticalTextToolButton.h"
#include "AlertDialog.h"
#include "dialogs/AlertDialog.h"
#include <QScroller>
#define ADD_CENTER_ITEM(row,col,text)\
item = new QTableWidgetItem(text);\
item->setTextAlignment(Qt::AlignmentFlag::AlignCenter);\
table->setItem(row,col,item);
int queryValue(QSqlTableModel* model, int colID, QVariant var)
{
for (int i = 0; i < model->rowCount(); ++i) {
if (model->data(model->index(i, colID)) == var) return i;
}
return -1;
}
SelectFormWidget::SelectFormWidget(QWidget* parent) :
TabFormWidget(parent)
{
@@ -136,13 +124,8 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
if (model->rowCount() > 0)
{
table->selectRow(0);
PatientInformation pat;
#define ADD_PATIENT_PROPERTY(val)\
pat. val = model->data(model->index(table->currentIndex().row(),PatientInformationEnum:: val)).toString();
EDIT_PATIENT()
#undef ADD_PATIENT_PROPERTY
edit_patient->setPatientInformation(&pat);
}
setPatientDetail(table, model, edit_patient);
}
//events----------------------------------------------------------------------
//prepare button state
auto prepareButtons = [=](bool disableALL){
@@ -154,12 +137,7 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
};
//table current row selection changing event
connect(table, &SlideableTableView::currentRowChanged, [=](int row) {
PatientInformation pat;
#define ADD_PATIENT_PROPERTY(val)\
pat. val = model->data(model->index(row,PatientInformationEnum:: val)).toString();
EDIT_PATIENT()
#undef ADD_PATIENT_PROPERTY
edit_patient->setPatientInformation(&pat);
setPatientDetail(table, model, edit_patient);
prepareButtons(false);
});
@@ -171,20 +149,32 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
// btn add slot
connect(btnAdd, &QToolButton::clicked, [=]() {
edit_patient->show();
btnShowEdit->hide();
edit_patient->clearPatientInformation();
edit_patient->setEditEnable(true);
btnSelect->setEnabled(false);
});
EditPatientDialog dialog(this);
dialog.clearPatientInformation();
dialog.setWindowModality(Qt::WindowModal);
dialog.setModel(model);
// accept change
if (dialog.exec() == QDialog::Accepted) {
table->selectRow(0);
model->selectRow(0);
}
LOG_USER_OPERATION(AddPatient);
btnSelect->setEnabled(true);
});
// btn edit slot
connect(btnEdit, &QToolButton::clicked, [=]() {
edit_patient->show();
btnShowEdit->hide();
table->clicked(table->currentIndex());
edit_patient->setEditEnable(true);
btnSelect->setEnabled(false);
EditPatientDialog dialog(this);
dialog.setPatientInformation(edit_patient->getPatientInformation());
dialog.setWindowModality(Qt::WindowModal);
dialog.setModel(model);
// accept change
if (dialog.exec() == QDialog::Accepted) {
table->clicked(table->currentIndex());
setPatientDetail(table, model, edit_patient);
LOG_USER_OPERATION(AddPatient);
btnSelect->setEnabled(true);
}
});
// btn add slot
@@ -198,17 +188,6 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
int selectedRow = table->currentIndex().row();
bool isAdd = inf->PatientUID.isEmpty();
if (isAdd) {
int ref_rowid = queryValue(model, 1, inf->ID);
if (ref_rowid >= 0)
{
//非触屏时,如果被选中的行在选中区域外,以下代码可能会出错
//但是触屏时一般没问题
qDebug() << ref_rowid;
table->scrollTo(model->index(ref_rowid, 3));
table->selectRow(ref_rowid);
result = false;
return;
}
selectedRow = model->rowCount();
inf->PatientUID = QUuid::createUuid().toString();
inf->AddDate = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss");
@@ -216,10 +195,10 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
selectedRow = 0;
}
qDebug() << inf->PatientUID << inf->AddDate;
#define ADD_PATIENT_PROPERTY(val)\
#define ADD_PATIENT_PROPERTY(val)\
model->setData(model->index(selectedRow,PatientInformationEnum:: val),inf-> val);
EDIT_PATIENT()
#undef ADD_PATIENT_PROPERTY
#undef ADD_PATIENT_PROPERTY
if (model->submitAll())
{
table->selectRow(selectedRow);
@@ -259,7 +238,6 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
dialog.setAlertMessage(QString(tr("Delete Patient \"%1\" ?")).arg(pat_name));
if (dialog.exec() != QDialog::Accepted) return;
// need delete clear edit panel detail
edit_patient->setEditEnable(false);
edit_patient->clearPatientInformation();
model->setData(model->index(table->currentIndex().row(), PatientInformationEnum::Flag), 9);
@@ -268,16 +246,15 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
if (model->rowCount() > 0) {
table->selectRow(0);
model->selectRow(0);
PatientInformation pat;
#define ADD_PATIENT_PROPERTY(val)\
pat. val = model->data(model->index(0,PatientInformationEnum:: val)).toString();
EDIT_PATIENT()
#undef ADD_PATIENT_PROPERTY
edit_patient->setPatientInformation(&pat);
setPatientDetail(table, model, edit_patient);
LOG_USER_OPERATION(DeletePatient);
}
} else {
//TODO:error handle
dialog.setButtonMode(OkOnly);
dialog.setTitle(tr("Alert"));
dialog.setAlertMessage(QString(tr("Can't delete selected Patient , db submit error!")));
dialog.exec();
}
prepareButtons(false);
@@ -330,6 +307,16 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
prepareButtons(false);
}
void SelectFormWidget::setPatientDetail(const SlideableTableView *table, const QSqlTableModel *model,
EditPatientForm *edit_patient) const {
PatientInformation pat;
#define ADD_PATIENT_PROPERTY(val)\
pat. val = model->data(model->index(table->currentIndex().row(),PatientInformationEnum:: val),Qt::EditRole).toString();
EDIT_PATIENT()
#undef ADD_PATIENT_PROPERTY
edit_patient->setPatientInformation(&pat);
}
SelectFormWidget::~SelectFormWidget()
{

View File

@@ -5,8 +5,11 @@
#ifndef GUI_SELECTFORMWIDGET_H
#define GUI_SELECTFORMWIDGET_H
#include "tabformwidget.h"
#include "forms/tabformwidget.h"
#include "EditPatientDialog.h"
class EditPatientForm;
class SlideableTableView;
class SelectFormWidget: public TabFormWidget {
Q_OBJECT
public:
@@ -15,6 +18,9 @@ public:
private:
QString selectedPatientUID;
void
setPatientDetail(const SlideableTableView *table, const QSqlTableModel *model, EditPatientForm *edit_patient) const;
};

View File

@@ -0,0 +1,88 @@
#include "editpatientform.h"
#include "ui_editpatientform.h"
#include <QListView>
#include <QHBoxLayout>
#include <QToolButton>
#include <QButtonGroup>
#include "guimacros.h"
#include <qdebug.h>
#include "event/EventCenter.h"
EditPatientForm::EditPatientForm(QWidget* parent) :
QWidget(parent),
ui(new Ui::EditPatientForm)
{
// this->layout()->setContentsMargins(5,5,5,5);
ui->setupUi(this);
ui->hideBtn->setSizePolicy(QSizePolicy::Policy::Expanding,QSizePolicy::Policy::Preferred);
ui->hideBtn->setObjectName("hideeditBtn");
ui->hideBtn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
ui->hideBtn->setIcon(QIcon(":/icons/hidearrow.png"));
ui->hideBtn->setIconSize({30,30});
ui->hideBtn->setText(tr(" Hide Panel"));
connect(ui->hideBtn,&QToolButton::clicked,[=](){
emit hideBtnClicked();
});
ui->tbx_Dob->setDisplayFormat("yyyy/MM/dd");
ui->tbx_ID->setEnabled(false);
ui->tbx_ID->setObjectName("display_tbx");
ui->tbx_Dob->setEnabled(false);
ui->tbx_Dob->setObjectName("display_tbx");
ui->tbx_Name->setEnabled(false);
ui->tbx_Name->setObjectName("display_tbx");
ui->tbx_Sex->setEnabled(false);
ui->tbx_Sex->setObjectName("display_tbx");
ui->rtbx_Comment->setEnabled(false);
ui->rtbx_Comment->setObjectName("display_tbx");
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
ui->retranslateUi(this);
ui->tbx_Sex->setText(store.Sex == "F"?tr("Female"):(store.Sex=="M"?tr("Male"):tr("Other")));
});
}
EditPatientForm::~EditPatientForm()
{
delete ui;
}
void EditPatientForm::setPatientInformation(PatientInformation* information) {
if (information)
{
ui->tbx_ID->setText(information->ID);
ui->tbx_Dob->setDate(QDate::fromString(information->BirthDate, "yyyy-MM-dd"));
ui->tbx_Name->setText(information->Name);
ui->rtbx_Comment->setText(information->Comment);
ui->tbx_Sex->setText(information->Sex == "F"?tr("Female"):(information->Sex=="M"?tr("Male"):tr("Other")));
currentPatientUID = information->PatientUID;
AddDate = information->AddDate;
store.Sex = information->Sex;
storePatientInformation();
}
}
void EditPatientForm::clearPatientInformation() {
ui->tbx_ID->setText("");
ui->tbx_Dob->setDate(QDate::currentDate());
ui->tbx_Name->setText("");
ui->tbx_Sex->setText("");
ui->rtbx_Comment->setText("");
currentPatientUID = "";
AddDate = "";
}
void EditPatientForm::storePatientInformation() {
store.PatientUID = currentPatientUID;
store.AddDate = AddDate;
store.ID = ui->tbx_ID->text();
store.BirthDate = ui->tbx_Dob->date().toString("yyyy-MM-dd");
store.Name = ui->tbx_Name->text();
store.Comment = ui->rtbx_Comment->toPlainText();
}

View File

@@ -29,6 +29,10 @@ enum PatientInformationEnum{
#undef ADD_PATIENT_PROPERTY
};
/**
* @brief this class was designed to be a edit form,
* but now has been change to a detail display class.
*/
class PatientInformation:public QObject{
Q_OBJECT
public:
@@ -65,9 +69,8 @@ public:
}
void clearPatientInformation();
void storePatientInformation();
void restorePatientInformation();
void setEditEnable(bool enable);
signals:
signals:
void editAccept(PatientInformation * detail,bool & accept);
void editCancel();
signals:
@@ -77,11 +80,6 @@ private:
QString currentPatientUID;
QString AddDate;
PatientInformation store;
bool editEnable=false;
QToolButton* btnEditAccept;
QToolButton* btnEditCancel;
QToolButton* btnFemale;
QToolButton* btnMale;
};
#endif // EDITPATIENTFORM_H

View File

@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditPatientForm</class>
<widget class="QWidget" name="EditPatientForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>466</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QToolButton" name="hideBtn">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_ID">
<property name="text">
<string>ID</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="tbx_ID">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_Name">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="tbx_Name">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_Sex">
<property name="text">
<string>Gender</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="tbx_Sex">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_DOB">
<property name="text">
<string>Date Of Birth</string>
</property>
</widget>
</item>
<item>
<widget class="QDateEdit" name="tbx_Dob">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>1</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_Comment">
<property name="text">
<string>Comment</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="rtbx_Comment">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="editcmdWidget" native="true"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -9,12 +9,12 @@
#include <QHeaderView>
#include "components/AccountRoleComboDelegate.h"
#include "guimacros.h"
#include "AlertDialog.h"
#include "src/dialogs/AlertDialog.h"
#include "db/SQLHelper.h"
#include "models/User.h"
#include <QSqlRecord>
#include "components/SlideableTableView.h"
#include "AccountFormDialog.h"
#include "src/dialogs/AccountFormDialog.h"
#include "event/EventCenter.h"
AccountTableForm::AccountTableForm(QWidget* parent) {
layout = new QVBoxLayout(this);

View File

@@ -7,7 +7,7 @@
#include <QStackedWidget>
#include <QStringListModel>
#include <QListWidget>
#include "tabformwidget.h"
#include "src/forms/tabformwidget.h"
#include <QListWidgetItem>
#include "ui_tabformwidget.h"
#include <QLabel>

View File

@@ -5,7 +5,7 @@
#ifndef GUI_ADMINSETTINGFORM_H
#define GUI_ADMINSETTINGFORM_H
#include "tabformwidget.h"
#include "src/forms/tabformwidget.h"
class AdminSettingForm:public TabFormWidget {
Q_OBJECT

View File

@@ -8,6 +8,7 @@
#include "json/cmdhelper.h"
#include <QThread>
#include "AppVersion.h"
#include "device/DeviceManager.h"
AboutWidget::AboutWidget(QWidget* parent)
: QWidget(parent)
@@ -76,7 +77,7 @@ void AboutWidget::initUi()
pMainLayout->addWidget(pGuiVer);
pEmbededSoftVer = new QLabel(this);
pEmbededSoftVer->setText(tr("Embedded Software V1.5"));
pEmbededSoftVer->setText(tr("Embedded Software %1").arg(getEmbVersion()));
pEmbededSoftVer->setContentsMargins(subContentMargin, 0, 0, 0);
pMainLayout->addWidget(pEmbededSoftVer);
@@ -156,7 +157,7 @@ void AboutWidget::initUi()
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 V1.5"));
pEmbededSoftVer->setText(tr("Embedded Software %1").arg(getEmbVersion()));
pReconSotfVer->setText(tr("Reconstruction Software V1.2"));
pFEBVer->setText(tr("FEB Information"));
});
@@ -180,5 +181,13 @@ void AboutWidget::openHelpFile()
}
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();
}

View File

@@ -21,6 +21,7 @@ public:
~AboutWidget();
QString getGUIVersion();
QString getEmbVersion();
private slots:
void openHelpFile();

View File

@@ -10,10 +10,10 @@
#include <QEvent>
#include "event/EventCenter.h"
#include "json/jsonobject.h"
#include "SelectDialog.h"
#include "src/dialogs/SelectDialog.h"
#include "locker.h"
#include "languageswitcher.h"
#include "src/utilities/locker.h"
#include "src/utilities/languageswitcher.h"
GeneralForm::GeneralForm(QWidget* parent) : QWidget(parent)
{
@@ -93,7 +93,7 @@ GeneralForm::GeneralForm(QWidget* parent) : QWidget(parent)
dialog = new SelectDialog(this);
dialog->setWindowModality(Qt::WindowModal);
}
dialog->setAvailableDates(JsonObject::Instance()->language());
dialog->setValues(JsonObject::Instance()->language());
dialog->setSelectedValue(JsonObject::Instance()->defaultLanguage());
if (dialog->exec() == QDialog::Accepted)
{

View File

@@ -10,7 +10,7 @@
#include <QEvent>
#include <QToolButton>
#include "SelectDialog.h"
#include "src/dialogs/SelectDialog.h"
#include "components/imageswitch.h"
#include "network/networkcfgdialog.h"
#include "network/dicomcfgdialog.h"
@@ -116,7 +116,7 @@ systemSettingForm::systemSettingForm(QWidget* parent) :
sd_protocal = new SelectDialog(this);
sd_protocal->setWindowModality(Qt::WindowModal);
}
sd_protocal->setAvailableDates(JsonObject::Instance()->protocals());
sd_protocal->setValues(JsonObject::Instance()->protocals());
sd_protocal->setSelectedValue(JsonObject::Instance()->defaultProtocal());
if (sd_protocal->exec() == QDialog::Accepted)
{
@@ -132,7 +132,7 @@ systemSettingForm::systemSettingForm(QWidget* parent) :
sd_filter = new SelectDialog(this);
sd_filter->setWindowModality(Qt::WindowModal);
}
sd_filter->setAvailableDates(JsonObject::Instance()->worklistFilters());
sd_filter->setValues(JsonObject::Instance()->worklistFilters());
sd_filter->setSelectedValue(JsonObject::Instance()->defaultFilter());
if (sd_filter->exec() == QDialog::Accepted)
{

View File

@@ -1,7 +1,7 @@
#include "mainwindow.h"
#include "src/windows/mainwindow.h"
#include <QApplication>
#include "loginwindow.h"
#include "InputObject.h"
#include "src/windows/loginwindow.h"
#include "src/utilities/InputObject.h"
#include <QQmlApplicationEngine>
#include "db/SQLHelper.h"
#include <QTextCodec>
@@ -13,8 +13,8 @@
#include <QTranslator>
#include <src/device/DeviceManager.h>
#include "json/jsonobject.h"
#include "locker.h"
#include "languageswitcher.h"
#include "src/utilities/locker.h"
#include "src/utilities/languageswitcher.h"
QString loadFontFromFile(QString path)
{
static QString font;

View File

@@ -5,7 +5,7 @@
#ifndef GUI_GETADMINPSW_H
#define GUI_GETADMINPSW_H
#include "GUIFormBaseDialog.h"
#include "src/dialogs/GUIFormBaseDialog.h"
class QLineEdit;
class QLabel;
class GetAdminPsw :public GUIFormBaseDialog {

View File

@@ -5,7 +5,7 @@
#ifndef GUI_GETIPDIALOG_H
#define GUI_GETIPDIALOG_H
#include "GUIFormBaseDialog.h"
#include "src/dialogs/GUIFormBaseDialog.h"
class QLineEdit;
class QLabel;
class GetIPDialog :public GUIFormBaseDialog {

View File

@@ -5,7 +5,7 @@
#ifndef GUI_GetRouteDialog_H
#define GUI_GETROUTEDIALOG_H
#include "GUIFormBaseDialog.h"
#include "src/dialogs/GUIFormBaseDialog.h"
class QLineEdit;
class QLabel;
class GetRouteDialog :public GUIFormBaseDialog {

View File

@@ -8,7 +8,7 @@
#include <QItemSelectionModel>
#include <QGraphicsDropShadowEffect>
#include "guimessagedialog.h"
#include "src/dialogs/guimessagedialog.h"
#include <QThread>
networkCfgDialog::networkCfgDialog(QWidget* parent) :

File diff suppressed because one or more lines are too long

View File

@@ -10,11 +10,11 @@
#include <QCryptographicHash>
#include <src/event/EventCenter.h>
#include "db/SQLHelper.h"
#include "InputObject.h"
#include "src/utilities/InputObject.h"
#include "models/User.h"
#include "log/UserOperationLog.h"
#include "json/jsonobject.h"
#include "guimessagedialog.h"
#include "src/dialogs/guimessagedialog.h"
LoginWindow::LoginWindow(QWidget* parent)
: QDialog(parent)

View File

@@ -4,22 +4,22 @@
#include <QSizePolicy>
#include <QHBoxLayout>
#include "event/EventCenter.h"
#include "tabformwidget.h"
#include "SelectFormWidget.h"
#include "ScanFormWidget.h"
#include "guimessagedialog.h"
#include "src/forms/tabformwidget.h"
#include "src/forms/select/SelectFormWidget.h"
#include "src/forms/scan/ScanFormWidget.h"
#include "src/dialogs/guimessagedialog.h"
#include "device/DeviceManager.h"
#include "errorhandle/GUIErrorHandle.h"
#include "loginwindow.h"
#include <QTextEdit>
#include <QScrollBar>
#include "models/User.h"
#include "AdminSettingForm.h"
#include "src/forms/settings/AdminSettingForm.h"
#include "appvals/AppGlobalValues.h"
#include <fstream>
#include <sstream>
#include <QDateTime>
#include "TopBarWidget.h"
#include "src/forms/TopBarWidget.h"
#include <QGestureEvent>
#include <QDockWidget>

View File

@@ -4,7 +4,7 @@
#include <QMainWindow>
#include <QDebug>
#include <QTimer>
#include "StdOutRedirector.h"
#include "src/utilities/StdOutRedirector.h"
#include "json/cJSON.h"
#include "loginwindow.h"