diff --git a/bin/0.json b/bin/0.json deleted file mode 100644 index 6651381..0000000 --- a/bin/0.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "A1": { - "x": 2, - "y": 402 - }, - "A2": { - "x": 761, - "y": 402 - }, - "C3": { - "x": 252, - "y": 406 - }, - "C4": { - "x": 503, - "y": 403 - }, - "Cz": { - "x": 382, - "y": 404 - }, - "F3": { - "x": 287, - "y": 246 - }, - "F4": { - "x": 477, - "y": 249 - }, - "F7": { - "x": 189, - "y": 218 - }, - "F8": { - "x": 577, - "y": 222 - }, - "Fp1": { - "x": 300, - "y": 146 - }, - "Fp2": { - "x": 474, - "y": 148 - }, - "Fz": { - "x": 384, - "y": 259 - }, - "O1": { - "x": 302, - "y": 667 - }, - "O2": { - "x": 471, - "y": 669 - }, - "P3": { - "x": 288, - "y": 568 - }, - "P4": { - "x": 477, - "y": 568 - }, - "Pz": { - "x": 383, - "y": 558 - }, - "T3": { - "x": 129, - "y": 400 - }, - "T4": { - "x": 635, - "y": 403 - }, - "T5": { - "x": 191, - "y": 594 - }, - "T6": { - "x": 574, - "y": 595 - } -} diff --git a/bin/xyylMCWEACSystem.exe b/bin/xyylMCWEACSystem.exe index 8050e37..bdb4ccc 100644 Binary files a/bin/xyylMCWEACSystem.exe and b/bin/xyylMCWEACSystem.exe differ diff --git a/xyylMCWEACSystem/leadscheme.cpp b/xyylMCWEACSystem/leadscheme.cpp index 9e6a33d..25873a7 100644 --- a/xyylMCWEACSystem/leadscheme.cpp +++ b/xyylMCWEACSystem/leadscheme.cpp @@ -6,6 +6,7 @@ #include "operatorjson.h" #include #include +#include "logger.h" LeadScheme::LeadScheme(QWidget * parent ):QWidget (parent) { init(); @@ -101,26 +102,27 @@ bool LeadScheme::initconnect() bCon = connect(&m_btnOK,SIGNAL(clicked(bool)),this,SLOT(slotSave())); if(!bCon) { - qDebug()<<"connect failed"<setMaximumHeight(40); btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); pButtonGroup0->addButton(btn); //gridShech->addWidget( btn,i+1,0); m_vlayHH->addWidget(btn); btn->setCheckable(true); + m_listBtnsSchemes.append(btn); } m_vlayHH->addStretch(); @@ -359,7 +363,8 @@ void LeadScheme::initLay() QJsonObject json; OperatorJson Ojson; - Ojson.readJson(QApplication::applicationDirPath()+"/0.json",json); + Ojson.readJson(QApplication::applicationDirPath()+"/Scheme/0.json",json); + qDebug()<<"hahaha"<widget(); - - if(w->inherits("QAbstractButton")) - { - QPushButton * btn = static_cast(w); - if(btn) - { - - bool ok = btn->text().compare("8通道")== 0 ||btn->text().compare("16通道")== 0 ||btn->text().compare("64通道")== 0 ; - if(ok) - { - continue; - } - } - - } - m_vlayHH->removeWidget(child->widget()); child->widget()->setParent(0); if (w) @@ -431,6 +420,87 @@ void LeadScheme::reLay() } } +} +void LeadScheme::slotUpdateCurScheme() +{ + //1获取方案名称 + QPushButton *btn = static_cast( sender()); + if(btn) + { + m_CurScheme = btn->text(); + } + //2检查对应的方案名称是否存在 + //(2.1)存在就加载原来的 + QString sFileName = QApplication::applicationDirPath()+"/Scheme/"+m_CurScheme+".json"; + if(QFile::exists(sFileName)) + { + int radius = 50; + QJsonObject json; + OperatorJson Ojson; + Ojson.readJson(sFileName,json); + + for(int i = 0 ; i< json.keys().size();i++) + { + for(int j =0 ;j < m_listMoveBtns.size();j++) + { + if(m_listMoveBtns.at(j)->getText().compare(json.keys().at(i)) ==0) + { + MoveButton * btn = m_listMoveBtns.at(j); + int x =json[json.keys().at(i)].toObject()["x"].toInt(); + int y = json[json.keys().at(i)].toObject()["y"].toInt(); + + btn->setGeometry(x,y, radius, radius); + } + + } + + } + + } + else // (2.2)不存在就加载模版 + { + int radius = 50; + QJsonObject json; + OperatorJson Ojson; + Ojson.readJson(QApplication::applicationDirPath()+"/Scheme/0.json",json); + for(int i = 0 ; i< json.keys().size();i++) + { + for(int j =0 ;j < m_listMoveBtns.size();j++) + { + if(m_listMoveBtns.at(j)->getText().compare(json.keys().at(i)) ==0) + { + MoveButton * btn = m_listMoveBtns.at(j); + int x =json[json.keys().at(i)].toObject()["x"].toInt(); + int y = json[json.keys().at(i)].toObject()["y"].toInt(); + + btn->setGeometry(x,y, radius, radius); + } + + } + + } + } + + //保存最新的位置 + QJsonObject jsonSave; + + for(int i = 0;i< m_listMoveBtns.size();i++ ) + { + auto btn = m_listMoveBtns.at(i); + QString text = btn->getText(); + int x = btn->x(); + int y = btn->y(); + QJsonObject perJson; + perJson.insert("x",x); + perJson.insert("y",y); + jsonSave.insert(text,perJson); + qDebug()<text(); + if(name.compare(schemeName)== 0) + { + logError()<<"Shech Name is repeated!"<setMaximumHeight(40); + btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + pButtonGroup0->addButton(btn); + //gridShech->addWidget( btn,i+1,0); + m_vlayHH->addWidget(btn); + btn->setCheckable(true); + m_listBtnsSchemes.append(btn); + } + m_vlayHH->addStretch(); } void LeadScheme::slotDelete() { - + //1 获取当前列表,从当前列表中获取出被选中的要删除的 + QString sDeleName; + QStringList listNames; + for(int i = 0 ; i< m_listBtnsSchemes.size();i++) + { + if(m_listBtnsSchemes.at(i)->isChecked()) + { + //logError()<<"delete:"<text()<text(); + continue; + } + listNames.append(m_listBtnsSchemes.at(i)->text()); + } + //2 重新布局 + m_listBtnsSchemes.clear(); + reLay(); + //3 + for (int i= 0 ; isetMaximumHeight(40); + btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + pButtonGroup0->addButton(btn); + //gridShech->addWidget( btn,i+1,0); + m_vlayHH->addWidget(btn); + btn->setCheckable(true); + m_listBtnsSchemes.append(btn); + } + m_vlayHH->addStretch(); } diff --git a/xyylMCWEACSystem/leadscheme.h b/xyylMCWEACSystem/leadscheme.h index b80d703..0db5aab 100644 --- a/xyylMCWEACSystem/leadscheme.h +++ b/xyylMCWEACSystem/leadscheme.h @@ -10,6 +10,7 @@ #include #include "operatorjson.h" #include +#include class LeadScheme:public QWidget { Q_OBJECT @@ -26,7 +27,9 @@ private slots: void slotSave(); void slotNew(); void slotDelete(); + void slotUpdateCurScheme(); private: + QString m_CurScheme; QPushButton m_btnNew; QPushButton m_btndelete; QPushButton m_btnCancel; @@ -34,5 +37,7 @@ private: QVBoxLayout * m_vlayHH ; QList m_listMoveBtns; QLineEdit m_editShecName; + QList m_listBtnsSchemes; + QButtonGroup *pButtonGroup0; }; #endif // LEADSCHEME_H diff --git a/xyylMCWEACSystem/logger.cpp b/xyylMCWEACSystem/logger.cpp new file mode 100644 index 0000000..ab0e339 --- /dev/null +++ b/xyylMCWEACSystem/logger.cpp @@ -0,0 +1,35 @@ +#include "logger.h" +void MessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) +{ + QString txt; +#if 0 + switch (type) + { + case QtDebugMsg: + txt = QString("Debug: %1").arg(msg);//调试信息 + break; + case QtInfoMsg: + txt = QString("Info: %1").arg(msg);//一般信息 + break; + case QtWarningMsg: + txt = QString("Warning: %1").arg(msg);//警告信息 + break; + case QtCriticalMsg: + txt = QString("Critical: %1").arg(msg);//严重错误信息 + break; + case QtFatalMsg: + txt = QString("Fatal: %1").arg(msg);//致命错误信息 + break; + } +#endif + if(type != QtCriticalMsg ) + { + return ; + } + txt =msg;// txt + QString(" line:%1").arg(context.line); + + QFile logFile("log.txt"); + logFile.open(QIODevice::WriteOnly | QIODevice::Append); + QTextStream in(&logFile); + in << txt << endl; +} diff --git a/xyylMCWEACSystem/logger.h b/xyylMCWEACSystem/logger.h new file mode 100644 index 0000000..8c5d13c --- /dev/null +++ b/xyylMCWEACSystem/logger.h @@ -0,0 +1,21 @@ +#ifndef LOGGER_H +#define LOGGER_H + +#include +#include +#include +#include +#include +#ifndef logData +#define logData "["<< __TIME__ <<"]"<<"[line:"<<__LINE__<<"]"<<"[fuction:"<<__FUNCTION__<<"]"<<"[ID:"< -#include "regwidget.h" -#include "loginwidget.h" -#include "medicalrecordwidget.h" -#include "medicalrecordmanager.h" -#include "hospitalinfo.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include @@ -26,27 +9,22 @@ #include #include #include -#include "curchatwidget.h" -#include "DevConWidget.h" + #include "framewindow.h" #include -#include "navlistwidget.h" #include "framelesswindow.h" -#include "medicalrecordmanager.h" -#include "parametersettingswidget.h" -#include -#include "datamanager.h" -#include "leadscheme.h" #include -#include "MoveButton.h" -#include "operatorjson.h" + +#include "logger.h" + int main(int argc, char *argv[]) { QApplication a(argc, argv); + qInstallMessageHandler(MessageHandler); QTextCodec *codec = QTextCodec::codecForName("GBK"); - QTextCodec::setCodecForLocale(codec); + QTextCodec::setCodecForLocale(codec); FrameWindow *mainw = new FrameWindow; // FramelessWindow *window = new FramelessWindow(mainw); //window->resize(300, 400); diff --git a/xyylMCWEACSystem/xyylMCWEACSystem.pro b/xyylMCWEACSystem/xyylMCWEACSystem.pro index db7eadb..acd7c8e 100644 --- a/xyylMCWEACSystem/xyylMCWEACSystem.pro +++ b/xyylMCWEACSystem/xyylMCWEACSystem.pro @@ -40,6 +40,7 @@ SOURCES += \ framewindow.cpp \ hospitalinfo.cpp \ leadscheme.cpp \ + logger.cpp \ loginwidget.cpp \ main.cpp \ mainwindow.cpp \ @@ -68,11 +69,11 @@ HEADERS += \ framewindow.h \ hospitalinfo.h \ leadscheme.h \ + logger.h \ loginwidget.h \ mainwindow.h \ medicalrecordmanager.h \ medicalrecordwidget.h \ - mrmanagement.h \ navlistwidget.h \ operatorjson.h \ parametersettingswidget.h \