#include "usbdiskfuncdialog.h"
#include "ui_usbdiskfuncdialog.h"
#include "loapptools.h"
UsbDiskFuncDialog::UsbDiskFuncDialog(QWidget *parent) :
    LoQDialog(parent),
    ui(new Ui::UsbDiskFuncDialog)
{
    ui->setupUi(this);
    ui->lineEditPassword->setEchoMode(QLineEdit::Password);
    ui->lineEditPassword->setPlaceholderText(tr("Input password"));
    ui->lineEditPath->setPlaceholderText(tr("Please select path for usb playback"));
    connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(onSelectOutPath()));
    connect(this, SIGNAL(accepted()), this, SLOT(onAccepted()));

}

UsbDiskFuncDialog::~UsbDiskFuncDialog()
{
    delete ui;
}
void UsbDiskFuncDialog::onAccepted()
{
    emit sigAcceptData(ui->lineEditPath->text(),ui->lineEditPassword->text());
}
void UsbDiskFuncDialog::SetPathDefault(QString strPath)
{
    ui->lineEditPath->setText(strPath);
}
void UsbDiskFuncDialog::onSelectOutPath()
{
    QString strDir = QFileDialog::getExistingDirectory(this, tr("Choose Directory"),
                                                    "/home",
                                                    QFileDialog::ShowDirsOnly
                                                    | QFileDialog::DontResolveSymlinks);

    SetPathDefault(strDir);

}
