#ifndef FLANGEITEMBJXPGW_H
#define FLANGEITEMBJXPGW_H

#include <QtCore/QVariant>
#include <QtWidgets/QApplication>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QWidget>
#include "../HTTPClient/client.h"
#include "tools.h"

#include <QDebug>
QT_BEGIN_NAMESPACE

class FlangeItem:public QWidget
{
public:
    QHBoxLayout *horizontalLayout_2;
    QLabel *flangePic;
    QHBoxLayout *horizontalLayout;
    QLabel *state1;
    QLabel *state2;
    QLabel *state3;
    QLabel *state4;
    QLabel *state5;
    QLabel *state6;
    QLabel *state7;
    QLabel *state8;
    QLabel *state9;
    QLabel *state10;
    QLabel *state11;
    QLabel *state12;
    QPushButton *pushButton;

    FlangeClass flange;

    void setupUi(QWidget *FlangeItem)
    {
        if (FlangeItem->objectName().isEmpty())
            FlangeItem->setObjectName(QString::fromUtf8("FlangeItem"));
        FlangeItem->resize(960, 500);
        horizontalLayout_2 = new QHBoxLayout(FlangeItem);
        horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
        flangePic = new QLabel(FlangeItem);
        flangePic->setObjectName(QString::fromUtf8("flangePic"));
        flangePic->setScaledContents(true);

        horizontalLayout_2->addWidget(flangePic);

        horizontalLayout = new QHBoxLayout();
        horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
        state1 = new QLabel(FlangeItem);
        state1->setObjectName(QString::fromUtf8("state1"));
        state1->setScaledContents(true);

        horizontalLayout->addWidget(state1);

        state2 = new QLabel(FlangeItem);
        state2->setObjectName(QString::fromUtf8("state2"));
        state2->setScaledContents(true);

        horizontalLayout->addWidget(state2);

        state3 = new QLabel(FlangeItem);
        state3->setObjectName(QString::fromUtf8("state3"));
        state3->setScaledContents(true);

        horizontalLayout->addWidget(state3);

        state4 = new QLabel(FlangeItem);
        state4->setObjectName(QString::fromUtf8("state4"));
        state4->setScaledContents(true);

        horizontalLayout->addWidget(state4);

        state5 = new QLabel(FlangeItem);
        state5->setObjectName(QString::fromUtf8("state5"));
        state5->setScaledContents(true);

        horizontalLayout->addWidget(state5);

        state6 = new QLabel(FlangeItem);
        state6->setObjectName(QString::fromUtf8("state6"));
        state6->setScaledContents(true);

        horizontalLayout->addWidget(state6);

        state7 = new QLabel(FlangeItem);
        state7->setObjectName(QString::fromUtf8("state7"));
        state7->setScaledContents(true);

        horizontalLayout->addWidget(state7);

        state8 = new QLabel(FlangeItem);
        state8->setObjectName(QString::fromUtf8("state8"));
        state8->setScaledContents(true);

        horizontalLayout->addWidget(state8);

        state9 = new QLabel(FlangeItem);
        state9->setObjectName(QString::fromUtf8("state9"));
        state9->setScaledContents(true);

        horizontalLayout->addWidget(state9);

        state10 = new QLabel(FlangeItem);
        state10->setObjectName(QString::fromUtf8("state10"));
        state10->setScaledContents(true);

        horizontalLayout->addWidget(state10);

        state11 = new QLabel(FlangeItem);
        state11->setObjectName(QString::fromUtf8("state11"));
        state11->setScaledContents(true);

        horizontalLayout->addWidget(state11);

        state12 = new QLabel(FlangeItem);
        state12->setObjectName(QString::fromUtf8("state12"));
        state12->setScaledContents(true);

        horizontalLayout->addWidget(state12);
        horizontalLayout->setSpacing(3);


        horizontalLayout_2->addLayout(horizontalLayout);

        pushButton = new QPushButton(FlangeItem);
        pushButton->setObjectName(QString::fromUtf8("pushButton"));

        horizontalLayout_2->addWidget(pushButton);

        horizontalLayout_2->setStretch(0, 1);
        horizontalLayout_2->setStretch(1, 10);
        horizontalLayout_2->setStretch(2, 1);

        retranslateUi(FlangeItem);

        QMetaObject::connectSlotsByName(FlangeItem);
        setIcon();

    } // setupUi

    void retranslateUi(QWidget *FlangeItem)
    {
        FlangeItem->setWindowTitle(QCoreApplication::translate("FlangeItem", "Form", nullptr));
        pushButton->setText(QCoreApplication::translate("FlangeItem", "\346\232\202\347\225\231", nullptr));
    } // retranslateUi

    void setIcon()
    {
        if (flange.flangeState == QString("故障")){
            QPixmap pixmap(":/Static/flangeError.png");
            flangePic->setPixmap(pixmap);
        }else if (flange.flangeState == QString("正常")){
            QPixmap pixmap(":/Static/flangeNromal.png");
            flangePic->setPixmap(pixmap);
        }
        QPixmap normalPix(":/Static/normal.png");
        QPixmap errorPixmap(":/Static/error.png");
        state1->setPixmap(normalPix);
        state2->setPixmap(normalPix);
        state3->setPixmap(normalPix);
        state4->setPixmap(normalPix);
        state5->setPixmap(normalPix);
        state6->setPixmap(normalPix);
        state7->setPixmap(normalPix);
        state8->setPixmap(normalPix);
        state9->setPixmap(normalPix);
        state10->setPixmap(normalPix);
        state11->setPixmap(normalPix);
        state12->setPixmap(normalPix);
    }

    FlangeItem(FlangeClass flange) : flange(flange){
        setupUi(this);
    }

};

QT_END_NAMESPACE

#endif // FLANGEITEMBJXPGW_H
