#include "QEcoherentAndAdditive.h"
#include "ui_QEcoherentAndAdditive.h"
#include <QFileDialog>
#include <QMessageBox>


QEcoherentAndAdditiveDialog::QEcoherentAndAdditiveDialog(QWidget *parent)
	: QDialog(parent)
	,ui(new Ui::QEcoherentAndAdditiveClass)
{
	ui->setupUi(this);

	QObject::connect(ui->pushButtonEchoDataAddSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoDataAddSelectClicked()));
	QObject::connect(ui->pushButtonEchoDataSelect, SIGNAL(clicked()), this, SLOT(onpushButtonEchoDataSelectClicked()));
 	QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onaccepted()));
	QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onrejected()));
 }

QEcoherentAndAdditiveDialog::~QEcoherentAndAdditiveDialog()
{}

void QEcoherentAndAdditiveDialog::onpushButtonEchoDataAddSelectClicked()
{
	QString  fileNames = QFileDialog::getOpenFileName(
		this,                           // 父窗口
		tr(u8"选择影像文件"),               // 标题
		QString(),                      // 默认路径
		tr(u8"xml Files (*.xml);;All Files (*)")  // 文件过滤器
	);

	// 如果用户选择了文件
	if (!fileNames.isEmpty()) {
		QString message = "选择的文件有：\n";
		this->ui->lineEditEchoDataAddPath->setText(fileNames);
	}
	else {
		QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
	}
}

void QEcoherentAndAdditiveDialog::onpushButtonEchoDataSelectClicked()
{
	QString  fileNames = QFileDialog::getOpenFileName(
		this,                           // 父窗口
		tr(u8"选择影像文件"),               // 标题
		QString(),                      // 默认路径
		tr(u8"xml Files (*.xml);;All Files (*)")  // 文件过滤器
	);

	// 如果用户选择了文件
	if (!fileNames.isEmpty()) {
		QString message = "选择的文件有：\n";
		this->ui->lineEditEchoDataAdd2Path->setText(fileNames);
	}
	else {
		QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
	}
}

void QEcoherentAndAdditiveDialog::onaccepted()
{
	QString echo1Path = this->ui->lineEditEchoDataAddPath->text();
	QString echo2Path = this->ui->lineEditEchoDataAdd2Path->text();





	QMessageBox::information(this, tr(u8"提示"), tr(u8"完成"));
}

void QEcoherentAndAdditiveDialog::onrejected()
{
}
