#ifndef __PROPERTY_WINDOW_H__
#define __PROPERTY_WINDOW_H__

#include <kysdk/applications/kdialog.h>
#include <kysdk/applications/knavigationbar.h>

#include "ukui_printer.h"
#include "size_para.h"
class ProperytItemWidget;
class PropertyListWindow;
class QHBoxLayout;
class SelectPpdDialog;


class PropertyWindow : public kdk::KDialog
{
    Q_OBJECT
public:
    explicit PropertyWindow(const UkuiUsbPrinter &printerInfo, QWidget *parent = nullptr);
    ~PropertyWindow();

    void onShow();
    void setQSSFontSize(QFont curFont);

private slots:
    void updatePPD(QString text);
    void selectPPDDialogShow();
    bool checkPrinterNameIsLegal(QString);
    void checkOptionConflicts(QString optionName, QString curVal);

private:
    // 后续如果使用kiwdget,则无需使用这些
    QHBoxLayout *mainLayout;
    QWidget *sideBar;
    QWidget *baseBar;
    QHBoxLayout *m_leftLayout;
    QHBoxLayout *m_rightLayout;
    kdk::KNavigationBar *m_navigationBar;
    PropertyListWindow *m_propertyListWindow;

    UkuiUsbPrinter m_currentPrinterInfo;

    void initUi();
    void initConnect();

    void addTab(const QString &name);

    void doSave();
    void insertItemListLayout();
    void updateItemListLayout(const UkuiUsbPrinter& printerInfo);
    void setAllConflicts(QString option, QMap<QString, QString> conflicts);
    void getZhPropertyfromEn(SelectableProperty& enProperty);
    SelectPpdDialog *m_pSelectPPDDialog = nullptr;


    ProperytItemWidget *createItem(int index, PropertyBoxStyle style, const QString &propertyName);
    ProperytItemWidget *findItem(const QString &propertyName);

    QMap<QString, ProperytItemWidget *> *m_itemMap;
};
#endif // __PROPERTY_WINDOW_H__
