mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
refs #933, UI for MCX setup
This commit is contained in:
committed by
Mathew Sutcliffe
parent
8eb9a8b217
commit
45f0cea083
@@ -32,7 +32,7 @@
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="2" column="4">
|
||||
<item row="3" column="4">
|
||||
<widget class="QGroupBox" name="gb_DistributorPreferences">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
@@ -76,11 +76,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="gb_SwiftDb">
|
||||
<widget class="QGroupBox" name="gb_Models">
|
||||
<property name="title">
|
||||
<string>swift DB</string>
|
||||
<string>Models</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_SwiftDB">
|
||||
<layout class="QVBoxLayout" name="vl_ModelSettings">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
@@ -93,26 +93,13 @@
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<spacer name="vs_SwiftDb">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CSettingsModelComponent" name="comp_ModelSettings">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="BlackGui::Components::CDbLoginComponent" name="comp_LoginComponent">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>175</height>
|
||||
</size>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -169,12 +156,12 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="gb_Models">
|
||||
<item row="3" column="0">
|
||||
<widget class="QGroupBox" name="gb_SwiftDb">
|
||||
<property name="title">
|
||||
<string>Models</string>
|
||||
<string>swift DB</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_ModelSettings">
|
||||
<layout class="QGridLayout" name="gl_SwiftDB">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
@@ -187,20 +174,33 @@
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CSettingsModelComponent" name="comp_ModelSettings">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
<item row="1" column="0">
|
||||
<spacer name="vs_SwiftDb">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="BlackGui::Components::CDbLoginComponent" name="comp_LoginComponent">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>175</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4" rowspan="2">
|
||||
<item row="0" column="4" rowspan="3">
|
||||
<widget class="QGroupBox" name="gb_Simulator">
|
||||
<property name="title">
|
||||
<string>Simulator</string>
|
||||
@@ -231,6 +231,30 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="gb_ExternalTools">
|
||||
<property name="title">
|
||||
<string>External tools</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_ExternalTools">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CModelConverterXSetupComponent" name="comp_ModelConverterX"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@@ -264,6 +288,12 @@
|
||||
<header>blackgui/components/settingsmodelcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CModelConverterXSetupComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/modelconverterxsetupcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
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
|
||||
50
src/blackgui/components/modelconverterxsetupcomponent.h
Normal file
50
src/blackgui/components/modelconverterxsetupcomponent.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* Copyright (C) 2017
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_COMPONENTS_MODELCONVERTERXSETUPCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_MODELCONVERTERXSETUPCOMPONENT_H
|
||||
|
||||
#include "blackmisc/simulation/modelconverterx.h"
|
||||
#include <QFrame>
|
||||
|
||||
namespace Ui { class CModelConverterXSetupComponent; }
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
/**
|
||||
* Setup to start ModelConverterX
|
||||
*/
|
||||
class CModelConverterXSetupComponent : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Ctor
|
||||
explicit CModelConverterXSetupComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Dtor
|
||||
virtual ~CModelConverterXSetupComponent();
|
||||
|
||||
private:
|
||||
//! File dialog
|
||||
void selectBinary();
|
||||
|
||||
//! Save the settings
|
||||
void saveSettings();
|
||||
|
||||
QScopedPointer<Ui::CModelConverterXSetupComponent> ui;
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::TModelConverterXBinary> m_setting { this };
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
50
src/blackgui/components/modelconverterxsetupcomponent.ui
Normal file
50
src/blackgui/components/modelconverterxsetupcomponent.ui
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CModelConverterXSetupComponent</class>
|
||||
<widget class="QFrame" name="CModelConverterXSetupComponent">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>181</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>ModelConverteX binary</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="hl_ModelConverterX">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_McxBinary">
|
||||
<property name="placeholderText">
|
||||
<string>ModelConverterX binary</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_DirBrowser">
|
||||
<property name="toolTip">
|
||||
<string>directory browser</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user