#include "logininfo.h"
#include "global.h"

#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QLabel>
#include <QDateTime>
#include <QFrame>

LoginInfo::LoginInfo(QWidget *parent)
    : CFramelessWindow(parent)
{
    initUI();
}

LoginInfo::~LoginInfo()
{

}

void LoginInfo::setOut(bool out)
{
    mOut = out;
}

bool LoginInfo::isOut()
{
    return mOut;
}

void LoginInfo::setAnimationState(bool state)
{
    mAnimation = state;
}

bool LoginInfo::isAnimationState()
{
    return mAnimation;
}

void LoginInfo::initUI()
{
    mTopHLayout = new QHBoxLayout;
    mHeadLabel = new QLabel;
    mHeadLabel->setFixedSize(40, 40);
    mHeadLabel->setScaledContents(true);
    mHeadLabel->setPixmap(QPixmap(Global::Instance()->resourceDirPath() + "/image/fries.png"));


    mNameLabel = new QLabel;
    mNameLabel->setText("留存的香味");
    mNameLabel->setObjectName("LoginInfoNameLabel");
    mTopHLayout->addWidget(mHeadLabel);
    mTopHLayout->addSpacerItem(new QSpacerItem(20, 10, QSizePolicy::Fixed, QSizePolicy::Fixed));
    mTopHLayout->addWidget(mNameLabel);

    mVerticalLine = new QFrame;
    mVerticalLine->setFrameShape(QFrame::HLine);
    mVerticalLine->setObjectName("LoginInfoVLine");

    mInfoGLayout = new QGridLayout;
    mInfo11Label = new QLabel;
    mInfo11Label->setText("身份:");
    mInfo11Label->setObjectName("LoginInfoInfLabel");
    mInfo12Label = new QLabel;
    mInfo12Label->setText("工程师");
    mInfo12Label->setObjectName("LoginInfoInfLabel");
    mInfo21Label = new QLabel;
    mInfo21Label->setText("登录时间:");
    mInfo21Label->setObjectName("LoginInfoInfLabel");
    mInfo22Label = new QLabel;
    mInfo22Label->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm"));
    mInfo22Label->setObjectName("LoginInfoInfLabel");
    mInfo31Label = new QLabel;
    mInfo31Label->setText("座右铭:");
    mInfo31Label->setObjectName("LoginInfoInfLabel");
    mInfo32Label = new QLabel;
    mInfo32Label->setText("尘世间寻找心灵的安慰");
    mInfo32Label->setObjectName("LoginInfoInfLabel");
    mInfoGLayout->addWidget(mInfo11Label, 0, 0);
    mInfoGLayout->addWidget(mInfo12Label, 0, 1);
    mInfoGLayout->addWidget(mInfo21Label, 1, 0);
    mInfoGLayout->addWidget(mInfo22Label, 1, 1);
    mInfoGLayout->addWidget(mInfo31Label, 2, 0);
    mInfoGLayout->addWidget(mInfo32Label, 2, 1);

    mMainVLayout = new QVBoxLayout;
    mMainVLayout->addLayout(mTopHLayout, 1);
    mMainVLayout->addWidget(mVerticalLine);
    mMainVLayout->addLayout(mInfoGLayout, 3);

    mCentralWidget = new QWidget;
    mCentralWidget->setLayout(mMainVLayout);

    this->setCentralWidget(mCentralWidget);
    mCentralWidget->setObjectName("LoginInfoCentralWidget");
    mOut = false;
    mAnimation = false;
}


