#include "framedialog.h"

FrameDialog::FrameDialog(QWidget *parent)
	: QDialog(parent)
{
	ui.setupUi(this);
	setWindowTitle(tr("Frame Settings"));

	// События кнопки "Применить": нажатие
	connect(ui.btnAccept, SIGNAL(clicked()), this, SLOT(accept()));
	// События кнопки "Закрыть": нажатие
	connect(ui.btnReject, SIGNAL(clicked()), this, SLOT(reject()));
	//frame = parent->returnFrame();
}

FrameDialog::~FrameDialog()
{

}

void FrameDialog::setStartStatus(Frame frame)
{
    qDebug("Start1");
	ui.authorLine->setText(frame.authorLine);
	ui.projectLine->setText(frame.projectLine);
	ui.versionLine->setText(frame.versionLine);
	ui.commentsLine->setText(frame.commentsLine);
	ui.usingLine->setText(frame.usingLine);
	ui.nodeLine->setText(frame.nodeLine);
	ui.nameLine->setText(frame.nameLine);
	ui.numberLine->setText(frame.numberLine);
	
	QDate date = QDate::fromString(frame.dateLine, "dd.MM.yyyy");
	ui.dateEdit->setDate(QDate::fromString(frame.dateLine, "dd.MM.yyyy"));
	ui.timeEdit->setTime(QTime::fromString(frame.timeLine, "H:mm:ss"));
	
	ui.checkBox->setChecked(frame.check);

}
Frame FrameDialog::frameChange()
{
	Frame frame;
	frame.authorLine = ui.authorLine->text();
	frame.projectLine = ui.projectLine->text();
	frame.versionLine = ui.versionLine->text();
	frame.commentsLine = ui.commentsLine->text();
	frame.usingLine = ui.usingLine->text();
	frame.nodeLine = ui.nodeLine->text();
	frame.nameLine = ui.nameLine->text();
	frame.numberLine = ui.numberLine->text();

	frame.dateLine = ui.dateEdit->date().toString("dd.MM.yyyy");
	frame.timeLine = ui.timeEdit->text();

    frame.check = ui.checkBox->isChecked();
    return frame;
}
