refs #933, UI for MCX setup

This commit is contained in:
Klaus Basan
2017-04-10 16:41:14 +02:00
committed by Mathew Sutcliffe
parent 8eb9a8b217
commit 45f0cea083
4 changed files with 220 additions and 34 deletions

View File

@@ -0,0 +1,56 @@
/* Copyright (C) 2013
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "modelconverterxsetupcomponent.h"
#include "ui_modelconverterxsetupcomponent.h"
#include "blackmisc/statusmessage.h"
#include "blackmisc/logmessage.h"
#include <QFileDialog>
using namespace BlackMisc;
namespace BlackGui
{
namespace Components
{
CModelConverterXSetupComponent::CModelConverterXSetupComponent(QWidget *parent) :
QFrame(parent),
ui(new Ui::CModelConverterXSetupComponent)
{
ui->setupUi(this);
connect(ui->pb_DirBrowser, &QPushButton::clicked, this, &CModelConverterXSetupComponent::selectBinary);
connect(ui->le_McxBinary, &QLineEdit::returnPressed, this, &CModelConverterXSetupComponent::saveSettings);
ui->le_McxBinary->setText(m_setting.get());
}
CModelConverterXSetupComponent::~CModelConverterXSetupComponent()
{ }
void CModelConverterXSetupComponent::selectBinary()
{
QString defaultValue = m_setting.get();
if (defaultValue.isEmpty())
{
defaultValue = QDir::currentPath();
}
const QString fileName = QFileDialog::getOpenFileName(nullptr,
tr("ModelConverterX binary"), defaultValue,
"*.exe");
ui->le_McxBinary->setText(fileName);
this->saveSettings();
}
void CModelConverterXSetupComponent::saveSettings()
{
const QString t = ui->le_McxBinary->text();
const CStatusMessage msg = m_setting.setAndSave(t);
CLogMessage::preformatted(msg);
}
} // ns
} // ns