mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 16:55:36 +08:00
@@ -34,7 +34,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<spacer name="vs_NetworkSettings">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -47,8 +47,41 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="gb_Services">
|
||||
<property name="title">
|
||||
<string>Services</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CSettingsVatsimReadersComponent" name="comp_ReaderSettings">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CSettingsVatsimReadersComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/settingsvatsimreaderscomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -38,7 +38,6 @@ namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
|
||||
CSettingsNetworkServersComponent::CSettingsNetworkServersComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::CSettingsNetworkServersComponent)
|
||||
|
||||
79
src/blackgui/components/settingsvatsimreaderscomponent.cpp
Normal file
79
src/blackgui/components/settingsvatsimreaderscomponent.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
/* 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 "settingsvatsimreaderscomponent.h"
|
||||
#include "ui_settingsvatsimreaderscomponent.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackCore;
|
||||
using namespace BlackCore::Settings;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
CSettingsVatsimReadersComponent::CSettingsVatsimReadersComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::CSettingsVatsimReadersComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(ui->pb_Save, &QPushButton::clicked, this, &CSettingsVatsimReadersComponent::ps_save);
|
||||
connect(ui->pb_Reload, &QPushButton::clicked, this, &CSettingsVatsimReadersComponent::ps_reload);
|
||||
this->initValues();
|
||||
}
|
||||
|
||||
CSettingsVatsimReadersComponent::~CSettingsVatsimReadersComponent()
|
||||
{ }
|
||||
|
||||
void CSettingsVatsimReadersComponent::ps_settingsChanged()
|
||||
{
|
||||
this->initValues();
|
||||
}
|
||||
|
||||
void CSettingsVatsimReadersComponent::ps_save()
|
||||
{
|
||||
const int metarSec = this->m_settingsMetars.get().getPeriodicTime().toMs() / 1000;
|
||||
const int bookingsSec = this->m_settingsBookings.get().getPeriodicTime().toMs() / 1000;
|
||||
const int dataFileSec = this->m_settingsDataFile.get().getPeriodicTime().toMs() / 1000;
|
||||
|
||||
const int newMetarSec = ui->sb_Metar->value();
|
||||
if (newMetarSec != metarSec)
|
||||
{
|
||||
this->m_settingsMetars.setAndSaveProperty(CSettingsReader::IndexPeriodicTime, CVariant::fromValue(CTime{static_cast<double>(newMetarSec), CTimeUnit::s()}));
|
||||
}
|
||||
const int newBookingsSec = ui->sb_Bookings->value();
|
||||
if (newBookingsSec != bookingsSec)
|
||||
{
|
||||
this->m_settingsBookings.setAndSaveProperty(CSettingsReader::IndexPeriodicTime, CVariant::fromValue(CTime{static_cast<double>(newBookingsSec), CTimeUnit::s()}));
|
||||
}
|
||||
const int newDataFileSec = ui->sb_DataFile->value();
|
||||
if (newDataFileSec != dataFileSec)
|
||||
{
|
||||
this->m_settingsBookings.setAndSaveProperty(CSettingsReader::IndexPeriodicTime, CVariant::fromValue(CTime{static_cast<double>(newDataFileSec), CTimeUnit::s()}));
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingsVatsimReadersComponent::ps_reload()
|
||||
{
|
||||
this->initValues();
|
||||
}
|
||||
|
||||
void CSettingsVatsimReadersComponent::initValues()
|
||||
{
|
||||
const int metarSec = this->m_settingsMetars.get().getPeriodicTime().toMs() / 1000;
|
||||
const int bookingsSec = this->m_settingsBookings.get().getPeriodicTime().toMs() / 1000;
|
||||
const int dataFileSec = this->m_settingsDataFile.get().getPeriodicTime().toMs() / 1000;
|
||||
|
||||
ui->sb_Metar->setValue(metarSec);
|
||||
ui->sb_Bookings->setValue(bookingsSec);
|
||||
ui->sb_DataFile->setValue(dataFileSec);
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
55
src/blackgui/components/settingsvatsimreaderscomponent.h
Normal file
55
src/blackgui/components/settingsvatsimreaderscomponent.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* 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_SETTINGSVATSIMREADERSCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_SETTINGSVATSIMREADERSCOMPONENT_H
|
||||
|
||||
#include "blackcore/settings/reader.h"
|
||||
#include <QFrame>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CSettingsVatsimReadersComponent; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
/*!
|
||||
* Settings for readers
|
||||
*/
|
||||
class CSettingsVatsimReadersComponent : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CSettingsVatsimReadersComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CSettingsVatsimReadersComponent();
|
||||
|
||||
private slots:
|
||||
void ps_settingsChanged();
|
||||
void ps_save();
|
||||
void ps_reload();
|
||||
|
||||
private:
|
||||
void initValues();
|
||||
|
||||
QScopedPointer<Ui::CSettingsVatsimReadersComponent> ui;
|
||||
BlackMisc::CSetting<BlackCore::Settings::SettingsVatsimBookings> m_settingsBookings { this, &CSettingsVatsimReadersComponent::ps_settingsChanged };
|
||||
BlackMisc::CSetting<BlackCore::Settings::SettingsVatsimDataFile> m_settingsDataFile { this, &CSettingsVatsimReadersComponent::ps_settingsChanged };
|
||||
BlackMisc::CSetting<BlackCore::Settings::SettingsVatsimMetars> m_settingsMetars { this, &CSettingsVatsimReadersComponent::ps_settingsChanged };
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
116
src/blackgui/components/settingsvatsimreaderscomponent.ui
Normal file
116
src/blackgui/components/settingsvatsimreaderscomponent.ui
Normal file
@@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CSettingsVatsimReadersComponent</class>
|
||||
<widget class="QFrame" name="CSettingsVatsimReadersComponent">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>204</width>
|
||||
<height>147</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_Metars">
|
||||
<property name="text">
|
||||
<string>METARs (secs.)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="sb_Metar">
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>500</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_DataFile">
|
||||
<property name="text">
|
||||
<string>Data file (secs.)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="sb_DataFile">
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>500</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_Bookings">
|
||||
<property name="text">
|
||||
<string>Bookings (secs.)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="sb_Bookings">
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>500</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QWidget" name="wi_Buttons" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_Reload">
|
||||
<property name="text">
|
||||
<string>reload</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_Save">
|
||||
<property name="text">
|
||||
<string>save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user