configinfodlg.cpp 3.45 KB
#include <QMap>
#include <QLabel>
#include <QDebug>
#include "configinfodlg.h"
#include "ui_configinfodlg.h"
#include "soundplayer.h"

ConfigInfoDlg::ConfigInfoDlg(QWidget *parent, ConfigType type) :
    QDialog(parent),
    ui(new Ui::ConfigInfoDlg)
{
    Config* cfg = Config::getInstance();
    ui->setupUi(this);
    this->setWindowFlags( Qt::FramelessWindowHint);
    this->setAttribute( Qt::WA_DeleteOnClose);

    foreach (QPushButton *button, findChildren<QPushButton *>())
        connect(button, &QPushButton::pressed, SoundPlayer::playClick);

    m_nType = type;

    ui->ctrTitle->setText(cfg->getTitleString(type));

    switch(type){
    case config_hotline_chef:
        loadHotlineChefInfo();
        break;
    case config_hotline_service:
        loadHotlineServiceInfo();
        break;
    case config_software_info:
    default:
        loadSoftwareInfo();
        break;
    }
}

ConfigInfoDlg::~ConfigInfoDlg()
{
    delete ui;
}

void ConfigInfoDlg::on_ctrBtnOk_clicked()
{
    deleteLater();
}

void ConfigInfoDlg::loadSoftwareInfo(){
    QString strTemp;
    QMap<QString , QString> mapInfos;
    QLabel* label;

    QString itemname[] = {
        "모델명",
        "제조일자",
        "제조국",
        "제조사",
        "제품번호",
        "소프트웨어버전",
        "현재모델"
    };


    mapInfos["모델명"] = "PRIME ST-01";
    mapInfos["제조일자"] = "2017-06";
    mapInfos["제조국"] = "한국";
    mapInfos["제조사"] = "프라임";
    mapInfos["제품번호"] = "01";
    mapInfos["소프트웨어버전"] ="0.1 BETA";
    mapInfos["현재모델"] = "한국";


    for(int i =0;i<MAX_SOFTWARE_INFO_CNT;i++){
        strTemp = mapInfos[itemname[i]];
        label = new QLabel(this);
        label ->setText(tr(software_item_name[i]).append(":"));
        ui->gridLayout_info->addWidget(label,i,0);
        label = new QLabel(this);
        label->setText(strTemp);
        ui->gridLayout_info->addWidget(label,i,1);
    }
}

void ConfigInfoDlg::loadHotlineChefInfo(){
    QString strTemp;
    QMap<QString , QString> mapInfos;
    QLabel* label;

    QString itemname[] = {
        "쉐프연락처",
        "쉐프이름",
        "쉐프위치정보"
    };

    mapInfos["쉐프연락처"] = "010-3004-6517";
    mapInfos["쉐프이름"] = "김성우";
    mapInfos["쉐프위치정보"] ="인천광역시 남동구 남동동로 34번길 56";

    for(int i =0;i<MAX_HOTLINE_CHEF_CNT;i++){
        strTemp = mapInfos[itemname[i]];
        label = new QLabel(this);
        label ->setText(tr(hotline_chef_item_name[i]).append(":"));
        ui->gridLayout_info->addWidget(label,i,0);
        label = new QLabel(this);
        label->setText(strTemp);
        ui->gridLayout_info->addWidget(label,i,1);
    }
}

void ConfigInfoDlg::loadHotlineServiceInfo(){
    QString strTemp;
    QMap<QString , QString> mapInfos;
    QLabel* label;

    QString itemname[] = {
        "서비스연락처",
        "서비스위치정보"
    };
    mapInfos["서비스연락처"] = "1644-9533";
    mapInfos["서비스위치정보"] ="인천광역시 남동구 남동동로 34번길 56";

    for(int i =0;i<MAX_HOTLINE_SERVICE_CNT;i++){
        strTemp = mapInfos[itemname[i]];
        label = new QLabel(this);
        label ->setText(tr(hotline_service_item_name[i]).append(":"));
        ui->gridLayout_info->addWidget(label,i,0);
        label = new QLabel(this);
        label->setText(strTemp);
        ui->gridLayout_info->addWidget(label,i,1);
    }
}