示例#1
0
文件: uiMsg.cpp 项目: Koulio/MJL_BANK
void UIMsg::showCombineErrMsgWithAutoClose(const ErrIndex ucErrorCode, int timeout)
{
    unsigned char ucCode;
    long hostErr;

    switch(ucErrorCode)
    {
    case ERR_HOSTCODE:
        hostErr = GetHostError();
        showHostErrMsgWithAutoClose(HostErrIndex(hostErr),timeout);
        break;
    case ERR_XFILE_WRITE:
        ucCode = GetFileError();
        showFileErrMsgWithAutoClose(FileErrIndex(ucCode),timeout);
        break;
    case ERR_COMMUNICATION:
        ucCode = GetCommsError();
        showCommErrMsgWithAutoClose(CommsErrIndex(ucCode),timeout);
        break;
    default:
        ucCode = ucErrorCode;
        showErrMsgWithAutoClose(ErrIndex(ucCode),timeout);
        break;
    }
}
示例#2
0
//_______________________________________________________________________
int main (int argc, char *argv[])
{
	int ref;
	
	if (argc != 2) usage (argv[0]);
	CheckMidiShare (argv[0]);
	
	ref = MidiGetIndAppl (GetIndex (argv[1]));
	if (!CheckRef (ref)) ErrIndex (argv[0], argv[1]);
	fprintf (stdout, "%d\n", ref);
	return 0;        
}
示例#3
0
文件: uiMsg.cpp 项目: Koulio/MJL_BANK
UIMsg::UIMsg(ErrorType errortype, unsigned char ucErrorCode, QDialog *parent, Qt::WindowFlags f) :
    QDialog(parent,f)
{
    // 初始化错误代码
    this->initalErrorMsg();
    this->initalNoticeMsg();
    this->initalFileErrorMsg();
    this->initalCommErrorMsg();
    this->initalHostErrorMsg();

    QPixmap bg;
    bg.load(":/images/commonbg.png");
    QPalette palette;
    palette.setBrush(backgroundRole(),QBrush(bg));
    this->setPalette(palette);
    this->setAutoFillBackground(true);
    this->setAttribute(Qt::WA_DeleteOnClose);
    this->setGeometry(20,FRAME420_THVALUE+50,FRAME420_WIDTH,FRAME420_HEIGHT-50);
    this->setFixedSize(FRAME420_WIDTH-40,FRAME420_HEIGHT-80);
    this->setStyleSheet("QDialog{border: 6px solid silver;}");

    QFont font("Helvetica",12,QFont::Bold);
    QFont font2("Helvetica",14,QFont::Bold);
    QFont font3("Helvetica",8,QFont::Bold);

    //--------------define--------------------//
    lbHead=new QLabel();
    QFont fontH("Helvetica",18,QFont::Bold);
    lbHead->setFont(fontH);
    lbHead->setAlignment(Qt::AlignCenter);
    lbHead->setMinimumHeight(40);
    lbHead->setMaximumHeight(40);
    lbHead->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);

    lbMsg=new QLabel();
    lbReturnCode=new QLabel();
    lbMsg->setFont(font2);
    lbReturnCode->setFont(font2);
    lbMsg->setAlignment(Qt::AlignCenter);
    lbReturnCode->setAlignment(Qt::AlignCenter);
    lbMsg->setMinimumHeight(40);
    lbReturnCode->setMinimumHeight(40);

    btnSubmit=new QPushButton;
    btnSubmit->setText(tr("OK"));
    btnSubmit->setFont(font2);
    btnSubmit->setMinimumHeight(30);
    btnSubmit->setStyleSheet(BTN_GREY_STYLE);


    this->beepTwice();   //beep

    switch(errortype)
    {
    case NORMAL_ERROR:
    {
        lbHead->setText("ERROR");
        lbHead->setStyleSheet("background-color: rgb(255,0,0);");

        lbMsg->setText(hashError.value(ErrIndex(ucErrorCode)));

        break;
    }
    case NOTICE_ERROR:
    {
        lbHead->setText("NOTICE");
        lbHead->setStyleSheet("background-color: rgb(0, 153, 255);");

        lbMsg->setText(hashNotice.value(MsgTabIndex(ucErrorCode)));

        break;
    }
    case FILE_ERROR:
    {
        lbHead->setText("FILE ERROR");
        lbHead->setStyleSheet("background-color: rgb(255,0,0);");
        lbMsg->setText(hashFileError.value(FileErrIndex(ucErrorCode)));


        break;
    }
    case COMM_ERROR:
    {
        lbHead->setText("COMM ERROR");
        lbHead->setStyleSheet("background-color: rgb(255,0,0);");
        lbMsg->setText(hashCommError.value(CommsErrIndex(ucErrorCode)));

        break;
    }
    case HOST_ERROR:
    {
        qDebug()<<"不应该在这里处理";
        break;
    }
    }

    unsigned char  ucCode;
    ucCode = ucErrorCode;

    unsigned char  aucErrorCode[PARAM_ANSWER_LEN + 1] = {0};
    hex_str(aucErrorCode, &ucCode, PARAM_ANSWER_LEN);
    lbReturnCode->setText("Return Code : "+QString::fromAscii((const char*)aucErrorCode));

    // -----------layout------------//
    QSpacerItem *sp1=new QSpacerItem(1,1,QSizePolicy::Expanding,QSizePolicy::Expanding);
    QSpacerItem *sp2=new QSpacerItem(1,1,QSizePolicy::Expanding,QSizePolicy::Expanding);
    QSpacerItem *sp3=new QSpacerItem(1,1,QSizePolicy::Expanding,QSizePolicy::Expanding);
    QHBoxLayout *h1Lay=new QHBoxLayout();
    h1Lay->addSpacing(6);
    h1Lay->addWidget(lbHead);
    h1Lay->addSpacing(6);

    QVBoxLayout *v1Lay=new QVBoxLayout();
    v1Lay->addSpacing(6);
    v1Lay->addLayout(h1Lay);
    v1Lay->addItem(sp1);
    v1Lay->addWidget(lbMsg);
    v1Lay->addItem(sp2);
    if(errortype!=NOTICE_ERROR)
    {
        v1Lay->addWidget(lbReturnCode);
    }
    v1Lay->addItem(sp3);

    QHBoxLayout *h2Lay=new QHBoxLayout();
    h2Lay->addSpacing(10);
    h2Lay->addWidget(btnSubmit);
    h2Lay->addSpacing(10);

    QVBoxLayout *layout=new QVBoxLayout(this);
    layout->addLayout(v1Lay);
    layout->addLayout(h2Lay);

    layout->setContentsMargins(0,0,0,10);

    connect(btnSubmit,SIGNAL(clicked()),this,SLOT(close()));

}