refs #844, UI for ATC stations settings (inline)

This commit is contained in:
Klaus Basan
2016-12-24 23:38:40 +01:00
committed by Mathew Sutcliffe
parent 97819f0154
commit b98a1408ae
3 changed files with 155 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
/* Copyright (C) 2016
* 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 "settingsatcstationsinlinecomponent.h"
#include "ui_settingsatcstationsinlinecomponent.h"
using namespace BlackGui::Settings;
namespace BlackGui
{
namespace Components
{
CSettingsAtcStationsInlineComponent::CSettingsAtcStationsInlineComponent(QWidget *parent) :
QFrame(parent),
ui(new Ui::CSettingsAtcStationsInlineComponent)
{
ui->setupUi(this);
connect(ui->rb_InRange, &QRadioButton::released, this, &CSettingsAtcStationsInlineComponent::changeSettings);
}
CSettingsAtcStationsInlineComponent::~CSettingsAtcStationsInlineComponent()
{ }
void CSettingsAtcStationsInlineComponent::settingsChanged()
{
const CAtcStationsSettings s = m_atcSettings.getThreadLocal();
ui->rb_InRange->setChecked(s.showOnlyInRange());
}
void CSettingsAtcStationsInlineComponent::changeSettings()
{
CAtcStationsSettings s = m_atcSettings.getThreadLocal();
s.setShowOnlyInRange(ui->rb_InRange->isChecked());
m_atcSettings.setAndSave(s);
}
} // ns
} // ns

View File

@@ -0,0 +1,49 @@
/* Copyright (C) 2016
* 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_SETTINGSATCSTATIONSINLINECOMPONENT_H
#define BLACKGUI_COMPONENTS_SETTINGSATCSTATIONSINLINECOMPONENT_H
#include "blackgui/settings/atcstationssettings.h"
#include <QFrame>
namespace Ui { class CSettingsAtcStationsInlineComponent; }
namespace BlackGui
{
namespace Components
{
/*!
* How ATC stations will be displayed
*/
class CSettingsAtcStationsInlineComponent : public QFrame
{
Q_OBJECT
public:
//! Constructor
explicit CSettingsAtcStationsInlineComponent(QWidget *parent = nullptr);
//! Destructor
virtual ~CSettingsAtcStationsInlineComponent();
private:
//! Settings have been changed
void settingsChanged();
//! Change the settings
void changeSettings();
QScopedPointer<Ui::CSettingsAtcStationsInlineComponent> ui;
BlackMisc::CSetting<BlackGui::Settings::TAtcStationsSettings> m_atcSettings { this, &CSettingsAtcStationsInlineComponent::settingsChanged };
};
} // ns
} // ns
#endif // guard

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CSettingsAtcStationsInlineComponent</class>
<widget class="QFrame" name="CSettingsAtcStationsInlineComponent">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>159</width>
<height>26</height>
</rect>
</property>
<property name="windowTitle">
<string>Frame</string>
</property>
<layout class="QHBoxLayout" name="hl_AtcStationsSettins">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<spacer name="hs_AtcStationsInline">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="rb_All">
<property name="text">
<string>all</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rb_InRange">
<property name="text">
<string>in range</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>