Ref T82, removed add button for servers, only save

* save will add a new server when not already existing
* when saved with same name, it will override values
* default values for FSD setup
* adjusted validation
This commit is contained in:
Klaus Basan
2017-06-11 21:37:14 +02:00
parent 76e1a06c44
commit 699a8d0f9f
8 changed files with 53 additions and 52 deletions

View File

@@ -26,9 +26,11 @@ namespace BlackGui
{
ui->setupUi(this);
this->showEnableInfo(false);
this->resetToDefaultValues();
ui->cb_Enabled->setChecked(true);
ui->le_TextCodec->setCompleter(new QCompleter(textCodecNames(true, true), this));
connect(ui->cb_Enabled, &QCheckBox::toggled, this, &CFsdSetupForm::ps_enabledToggled);
connect(ui->cb_Enabled, &QCheckBox::toggled, this, &CFsdSetupForm::enabledToggled);
connect(ui->pb_SetDefaults, &QPushButton::clicked, this, &CFsdSetupForm::resetToDefaultValues);
}
CFsdSetupForm::~CFsdSetupForm()
@@ -100,7 +102,7 @@ namespace BlackGui
return msgs;
}
void CFsdSetupForm::ps_enabledToggled(bool enabled)
void CFsdSetupForm::enabledToggled(bool enabled)
{
Q_UNUSED(enabled);
this->setReadOnly(!enabled);
@@ -109,5 +111,14 @@ namespace BlackGui
this->setValue(CFsdSetup());
}
}
void CFsdSetupForm::resetToDefaultValues()
{
ui->cb_AircraftPartsReceive->setChecked(true);
ui->cb_AircraftPartsSend->setChecked(true);
ui->cb_FastPositionReceive->setChecked(true);
ui->cb_FastPositionSend->setChecked(true);
ui->le_TextCodec->setText("latin1");
}
} // ns
} // ns

View File

@@ -18,7 +18,6 @@
#include <QScopedPointer>
namespace Ui { class CFsdSetupForm; }
namespace BlackGui
{
namespace Editors
@@ -35,7 +34,7 @@ namespace BlackGui
explicit CFsdSetupForm(QWidget *parent = nullptr);
//! Constructor
~CFsdSetupForm();
virtual ~CFsdSetupForm();
//! FSD setup from GUI
BlackMisc::Network::CFsdSetup getValue() const;
@@ -55,17 +54,19 @@ namespace BlackGui
//! Show the enable info
void showEnableInfo(bool visible);
//! Set default values
void resetToDefaultValues();
//! \name Form class implementations
//! @{
virtual void setReadOnly(bool readonly) override;
virtual BlackMisc::CStatusMessageList validate(bool nested = false) const override;
//! @}
private slots:
//! Enable / disable
void ps_enabledToggled(bool enabled);
private:
//! Enable / disable
void enabledToggled(bool enabled);
QScopedPointer<Ui::CFsdSetupForm> ui;
};
} // ns

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>189</width>
<height>102</height>
<width>209</width>
<height>130</height>
</rect>
</property>
<property name="windowTitle">
@@ -81,8 +81,8 @@
</property>
</widget>
</item>
<item row="0" column="1" alignment="Qt::AlignHCenter">
<widget class="QCheckBox" name="cb_AircraftPartsSend">
<item row="1" column="1" alignment="Qt::AlignHCenter">
<widget class="QCheckBox" name="cb_FastPositionSend">
<property name="text">
<string>send</string>
</property>
@@ -95,8 +95,8 @@
</property>
</widget>
</item>
<item row="1" column="1" alignment="Qt::AlignHCenter">
<widget class="QCheckBox" name="cb_FastPositionSend">
<item row="0" column="1" alignment="Qt::AlignHCenter">
<widget class="QCheckBox" name="cb_AircraftPartsSend">
<property name="text">
<string>send</string>
</property>
@@ -109,6 +109,13 @@
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pb_SetDefaults">
<property name="text">
<string>set defaults</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -25,7 +25,6 @@
class QWidget;
namespace Ui { class CNetworkServerForm; }
namespace BlackGui
{
namespace Editors
@@ -40,7 +39,7 @@ namespace BlackGui
explicit CServerForm(QWidget *parent = nullptr);
//! Destructor
~CServerForm();
virtual ~CServerForm();
//! Set server
void setServer(const BlackMisc::Network::CServer &server);