/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#ifndef DETAILPAGE_H
#define DETAILPAGE_H
#include <QWidget>
#include <QLabel>
#include <QFormLayout>
#include <QPainter>
#include <QCheckBox>
#include <QSpacerItem>
#include <QDebug>
#include <QListWidget>
#include <QApplication>

#include "detailwidget.h"
#include "coninfo.h"

class DetailPage : public QFrame
{
    Q_OBJECT
public:
    DetailPage(bool isPppoe, QWidget *parent = nullptr);

    void setSSID(const QString &ssid);
    void setProtocol(const QString &protocol);
    void setSecType(const QString &secType);
    void setHz(const QString &hz);
    void setChan(const QString &chan);
    void setBandWidth(const QString &brandWidth);
    void setIpv4(const QString &ipv4);
    void setIpv4Dns(const QString &ipv4Dns);
    void setIpv6(const QString &ipv6);
    void setMac(const QString &mac);

private:
    void initUI();
    void addDetailItem(QListWidget *listWidget, DetailWidget *detailWidget);

public:
    QListWidget * m_listWidget = nullptr;
    DetailWidget * m_ssidWidget = nullptr;
    DetailWidget * m_protocolWidget = nullptr;
    DetailWidget * m_bandwidthWidget = nullptr;
    DetailWidget * m_ipv4Widget = nullptr;
    DetailWidget * m_ipv4DnsWidget = nullptr;
    DetailWidget * m_ipv6Widget = nullptr;
    DetailWidget * m_macWidget = nullptr;

    LineEdit *mSSIDEdit;
    FixLabel *mSSIDLabel;
    QLabel *mProtocol;
    QLabel *mBandWidth;
    QLabel *mIPV4;
    QLabel *mIPV4Dns;
    FixLabel *mIPV6;
    QLabel *mMac;

private:
    QVBoxLayout *layout;
    QVBoxLayout *mDetailLayout;
    bool m_isPppoe;
private Q_SLOTS:
    void setEnableOfSaveBtn();

Q_SIGNALS:
     void setDetailPageState(bool);

};

#endif // DETAILPAGE_H
