#include "property_list_window.h"
#include "ui_property_list_window.h"

PropertyListWindow::PropertyListWindow(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::PropertyListWindow)
{
    ui->setupUi(this);
    ui->cancelButton->setText(tr("Cancel"));
    ui->acceptButton->setText(tr("Confirm"));
    connect(ui->acceptButton, &QPushButton::clicked, this, &PropertyListWindow::saveRequest);
    connect(ui->cancelButton, &QPushButton::clicked, this, &PropertyListWindow::closeRequest);
}

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

QStackedWidget *PropertyListWindow::getStackedWidget()
{
    return ui->stackedWidget;
}

QLabel *PropertyListWindow::getNameLabel()
{
    return ui->label;
}

QPushButton *PropertyListWindow::getAcceptButton()
{
    return ui->acceptButton;
}

ProperyListWidget *PropertyListWindow::getListWidget(int index)
{
    switch (index)
    {
    case 0:
        return ui->basePropertyListWid;
        break;
    case 1:
        return ui->advancePropertyListWid;
    default:
        break;
    }
    return nullptr;
}


ProperyListWidget::ProperyListWidget(QWidget *parent) : QListWidget(parent)
{
    this->setViewMode(QListView::ListMode);
    this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    this->setFrameShape(QFrame::NoFrame);
    this->setFocusPolicy(Qt::NoFocus);
    this->setAcceptDrops(false);
}
