mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
refs #933, UI for MCX setup
This commit is contained in:
committed by
Mathew Sutcliffe
parent
8eb9a8b217
commit
45f0cea083
56
src/blackgui/components/modelconverterxsetupcomponent.cpp
Normal file
56
src/blackgui/components/modelconverterxsetupcomponent.cpp
Normal 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
|
||||
Reference in New Issue
Block a user