mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 18:55:38 +08:00
refs #452 filter UI elements
This commit is contained in:
committed by
Mathew Sutcliffe
parent
35c41156f6
commit
93e6e1d38e
88
src/blackgui/filters/aircrafticaofilterbar.cpp
Normal file
88
src/blackgui/filters/aircrafticaofilterbar.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "aircrafticaofilterbar.h"
|
||||
#include "ui_aircrafticaofilterbar.h"
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackGui::Models;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
CAircraftIcaoFilterBar::CAircraftIcaoFilterBar(QWidget *parent) :
|
||||
CFilterWidget(parent),
|
||||
ui(new Ui::CAircraftIcaoFilterBar)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setButtonsAndCount(this->ui->filter_Buttons);
|
||||
connect(ui->le_Designator, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_Manufacturer, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_Description, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
}
|
||||
|
||||
CAircraftIcaoFilterBar::~CAircraftIcaoFilterBar()
|
||||
{ }
|
||||
|
||||
std::unique_ptr<BlackGui::Models::IModelFilter<CAircraftIcaoCodeList> > CAircraftIcaoFilterBar::createModelFilter() const
|
||||
{
|
||||
return std::unique_ptr<CAircraftIcaoFilter>(
|
||||
new CAircraftIcaoFilter(
|
||||
this->ui->le_Designator->text(),
|
||||
this->ui->le_Manufacturer->text(),
|
||||
this->ui->le_Description->text(),
|
||||
this->ui->combinedtype_Selector->getCombinedType()
|
||||
));
|
||||
}
|
||||
|
||||
void CAircraftIcaoFilterBar::filter(const CAircraftIcaoCode &icao)
|
||||
{
|
||||
bool filter = false;
|
||||
if (icao.hasDesignator())
|
||||
{
|
||||
this->ui->le_Designator->setText(icao.getDesignator());
|
||||
filter = true;
|
||||
}
|
||||
if (icao.hasManufacturer())
|
||||
{
|
||||
this->ui->le_Manufacturer->setText(icao.getManufacturer());
|
||||
filter = true;
|
||||
}
|
||||
if (icao.hasModelDescription())
|
||||
{
|
||||
this->ui->le_Manufacturer->setText("*" + icao.getModelDescription() + "*");
|
||||
filter = true;
|
||||
}
|
||||
if (filter)
|
||||
{
|
||||
this->ui->filter_Buttons->clickButton(CFilterBarButtons::Filter);
|
||||
}
|
||||
}
|
||||
|
||||
void CAircraftIcaoFilterBar::onRowCountChanged(int count, bool withFilter)
|
||||
{
|
||||
this->ui->filter_Buttons->onRowCountChanged(count, withFilter);
|
||||
}
|
||||
|
||||
void CAircraftIcaoFilterBar::clearForm()
|
||||
{
|
||||
ui->le_Designator->clear();
|
||||
ui->le_Manufacturer->clear();
|
||||
ui->le_Description->clear();
|
||||
ui->combinedtype_Selector->clear();
|
||||
}
|
||||
|
||||
void CAircraftIcaoFilterBar::setProvider(BlackMisc::Network::IWebDataServicesProvider *webDataReaderProvider)
|
||||
{
|
||||
Q_UNUSED(webDataReaderProvider);
|
||||
}
|
||||
|
||||
} // ns
|
||||
} // nss
|
||||
68
src/blackgui/filters/aircrafticaofilterbar.h
Normal file
68
src/blackgui/filters/aircrafticaofilterbar.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_FILTERS_AIRCRAFTICAOFILTERBAR_H
|
||||
#define BLACKGUI_FILTERS_AIRCRAFTICAOFILTERBAR_H
|
||||
|
||||
#include "blackguiexport.h"
|
||||
#include "blackgui/filters/filterwidget.h"
|
||||
#include "blackgui/models/aircrafticaofilter.h"
|
||||
#include "blackmisc/network/webdataservicesprovider.h"
|
||||
#include <QFrame>
|
||||
|
||||
namespace Ui { class CAircraftIcaoFilterBar; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
/*!
|
||||
* Aircraft ICAO filter bar
|
||||
*/
|
||||
class BLACKGUI_EXPORT CAircraftIcaoFilterBar :
|
||||
public CFilterWidget,
|
||||
public BlackGui::Models::IModelFilterProvider<BlackMisc::Aviation::CAircraftIcaoCodeList>,
|
||||
public BlackMisc::Network::CWebDataServicesAware
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CAircraftIcaoFilterBar(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CAircraftIcaoFilterBar();
|
||||
|
||||
//! \copydoc CWebDataReaderAware::setProvider
|
||||
virtual void setProvider(BlackMisc::Network::IWebDataServicesProvider *webDataReaderProvider) override;
|
||||
|
||||
//! \copydoc CFilterWidget::getModelFilter
|
||||
std::unique_ptr<BlackGui::Models::IModelFilter<BlackMisc::Aviation::CAircraftIcaoCodeList> > createModelFilter() const;
|
||||
|
||||
//! Filter by ICAO object as default values
|
||||
void filter(const BlackMisc::Aviation::CAircraftIcaoCode &icao);
|
||||
|
||||
public slots:
|
||||
//! \copydoc CFilterWidget::onRowCountChanged
|
||||
virtual void onRowCountChanged(int count, bool withFilter) override;
|
||||
|
||||
protected:
|
||||
//! \copydoc CFilterWidget::clearForm
|
||||
void clearForm();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CAircraftIcaoFilterBar> ui;
|
||||
};
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
159
src/blackgui/filters/aircrafticaofilterbar.ui
Normal file
159
src/blackgui/filters/aircrafticaofilterbar.ui
Normal file
@@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CAircraftIcaoFilterBar</class>
|
||||
<widget class="QFrame" name="CAircraftIcaoFilterBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>574</width>
|
||||
<height>44</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</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="QGridLayout" name="gl_CAircraftIcaoFilterBar">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="lbl_Manufacturer">
|
||||
<property name="text">
|
||||
<string>Manufacturer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QLineEdit" name="le_Manufacturer">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Manufacturer, e.g. Airbus, Boeing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<spacer name="hs_AircraftIcaoFilterBar">
|
||||
<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 row="0" column="2">
|
||||
<widget class="QLineEdit" name="le_Designator">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>ICAO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lbl_Designator">
|
||||
<property name="text">
|
||||
<string>Designator:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="BlackGui::Filters::CFilterBarButtons" name="filter_Buttons">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QLabel" name="lbl_Description">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QLineEdit" name="le_Description"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="5">
|
||||
<widget class="BlackGui::CAircraftCombinedTypeSelector" name="combinedtype_Selector">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::CAircraftCombinedTypeSelector</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/aircraftcombinedtypeselector.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Filters::CFilterBarButtons</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/filters/filterbarbuttons.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>le_Designator</tabstop>
|
||||
<tabstop>le_Manufacturer</tabstop>
|
||||
<tabstop>le_Description</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
70
src/blackgui/filters/aircraftmodelfilterbar.cpp
Normal file
70
src/blackgui/filters/aircraftmodelfilterbar.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "aircraftmodelfilterbar.h"
|
||||
#include "ui_aircraftmodelfilterbar.h"
|
||||
|
||||
using namespace BlackGui::Models;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
CAircraftModelFilterBar::CAircraftModelFilterBar(QWidget *parent) :
|
||||
CFilterWidget(parent),
|
||||
ui(new Ui::CAircraftModelFilterBar)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->ui->frp_SimulatorSelector->setAll();
|
||||
this->setButtonsAndCount(this->ui->filter_Buttons);
|
||||
connect(ui->le_AircraftIcao, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_AircraftManufacturer, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_AirlineIcao, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_AirlineName, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_LiveryCode, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_ModelDescription, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_ModelKey, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
}
|
||||
|
||||
CAircraftModelFilterBar::~CAircraftModelFilterBar()
|
||||
{ }
|
||||
|
||||
std::unique_ptr<BlackGui::Models::IModelFilter<BlackMisc::Simulation::CAircraftModelList> > CAircraftModelFilterBar::createModelFilter() const
|
||||
{
|
||||
return std::unique_ptr<CAircraftModelFilter>(
|
||||
new CAircraftModelFilter(
|
||||
this->ui->le_ModelKey->text(),
|
||||
this->ui->le_ModelDescription->text(),
|
||||
this->ui->le_AircraftIcao->text(),
|
||||
this->ui->le_AircraftManufacturer->text(),
|
||||
this->ui->le_AirlineIcao->text(),
|
||||
this->ui->le_AirlineName->text(),
|
||||
this->ui->le_LiveryCode->text(),
|
||||
this->ui->frp_SimulatorSelector->getValue()
|
||||
));
|
||||
}
|
||||
|
||||
void CAircraftModelFilterBar::onRowCountChanged(int count, bool withFilter)
|
||||
{
|
||||
this->ui->filter_Buttons->onRowCountChanged(count, withFilter);
|
||||
}
|
||||
|
||||
void CAircraftModelFilterBar::clearForm()
|
||||
{
|
||||
this->ui->le_ModelKey->clear();
|
||||
this->ui->le_ModelDescription->clear();
|
||||
this->ui->le_AircraftIcao->clear();
|
||||
this->ui->le_AircraftManufacturer->clear();
|
||||
this->ui->le_AirlineIcao->clear();
|
||||
this->ui->le_AirlineName->clear();
|
||||
this->ui->le_LiveryCode->clear();
|
||||
this->ui->frp_SimulatorSelector->setAll();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
61
src/blackgui/filters/aircraftmodelfilterbar.h
Normal file
61
src/blackgui/filters/aircraftmodelfilterbar.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_FILTERS_FILTERBARAIRCRAFTMODEL_H
|
||||
#define BLACKGUI_FILTERS_FILTERBARAIRCRAFTMODEL_H
|
||||
|
||||
#include "blackguiexport.h"
|
||||
#include "blackgui/models/aircraftmodelfilter.h"
|
||||
#include "blackgui/filters/filterwidget.h"
|
||||
#include "blackmisc/network/webdataservicesprovider.h"
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CAircraftModelFilterBar; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
/*!
|
||||
* Filter bar for aircraft models
|
||||
*/
|
||||
class BLACKGUI_EXPORT CAircraftModelFilterBar :
|
||||
public CFilterWidget,
|
||||
public BlackGui::Models::IModelFilterProvider<BlackMisc::Simulation::CAircraftModelList>,
|
||||
public BlackMisc::Network::CWebDataServicesAware
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CAircraftModelFilterBar(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CAircraftModelFilterBar();
|
||||
|
||||
//! \copydoc IModelFilter::getModelFilter
|
||||
virtual std::unique_ptr<BlackGui::Models::IModelFilter<BlackMisc::Simulation::CAircraftModelList>> createModelFilter() const override;
|
||||
|
||||
public slots:
|
||||
//! \copydoc CFilterWidget::onRowCountChanged
|
||||
virtual void onRowCountChanged(int count, bool withFilter) override;
|
||||
|
||||
protected:
|
||||
//! Clear form
|
||||
virtual void clearForm() override;
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CAircraftModelFilterBar> ui;
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
198
src/blackgui/filters/aircraftmodelfilterbar.ui
Normal file
198
src/blackgui/filters/aircraftmodelfilterbar.ui
Normal file
@@ -0,0 +1,198 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CAircraftModelFilterBar</class>
|
||||
<widget class="QFrame" name="CAircraftModelFilterBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>658</width>
|
||||
<height>44</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="QGridLayout" name="gl_FilterBarAircraftModel">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="11">
|
||||
<widget class="QLineEdit" name="le_AircraftManufacturer">
|
||||
<property name="placeholderText">
|
||||
<string>manufacturer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="10">
|
||||
<widget class="QLineEdit" name="le_AircraftIcao">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>ICAO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QLabel" name="lbl_Model">
|
||||
<property name="text">
|
||||
<string>Model:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="10">
|
||||
<widget class="QLineEdit" name="le_AirlineIcao">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>ICAO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="7">
|
||||
<widget class="QLineEdit" name="le_LiveryCode">
|
||||
<property name="placeholderText">
|
||||
<string>code</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="11">
|
||||
<widget class="QLineEdit" name="le_AirlineName">
|
||||
<property name="placeholderText">
|
||||
<string>airline name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QLabel" name="lbl_Livery">
|
||||
<property name="text">
|
||||
<string>Livery:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="9">
|
||||
<widget class="QLabel" name="lbl_Airline">
|
||||
<property name="text">
|
||||
<string>Airline:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<widget class="QLineEdit" name="le_ModelDescription">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<widget class="QLineEdit" name="le_ModelKey">
|
||||
<property name="placeholderText">
|
||||
<string>key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="9">
|
||||
<widget class="QLabel" name="lbl_Aircraft">
|
||||
<property name="text">
|
||||
<string>Aircraft:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="4" alignment="Qt::AlignLeft">
|
||||
<widget class="BlackGui::Filters::CFilterBarButtons" name="filter_Buttons">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<spacer name="hs_FilterButtons">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="6">
|
||||
<widget class="BlackGui::CSimulatorSelector" name="frp_SimulatorSelector"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Filters::CFilterBarButtons</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/filters/filterbarbuttons.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::CSimulatorSelector</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/simulatorselector.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>le_ModelKey</tabstop>
|
||||
<tabstop>le_ModelDescription</tabstop>
|
||||
<tabstop>le_AircraftIcao</tabstop>
|
||||
<tabstop>le_AircraftManufacturer</tabstop>
|
||||
<tabstop>le_LiveryCode</tabstop>
|
||||
<tabstop>le_AirlineIcao</tabstop>
|
||||
<tabstop>le_AirlineName</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
37
src/blackgui/filters/aircraftmodelfilterdialog.cpp
Normal file
37
src/blackgui/filters/aircraftmodelfilterdialog.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/* 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 "aircraftmodelfilterdialog.h"
|
||||
#include "ui_aircraftmodelfilterdialog.h"
|
||||
|
||||
using namespace BlackGui::Models;
|
||||
using namespace BlackMisc::Simulation;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
CAircraftModelFilterDialog::CAircraftModelFilterDialog(QWidget *parent) :
|
||||
CFilterDialog(parent),
|
||||
ui(new Ui::CAircraftModelFilterDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowTitle("Filter models");
|
||||
this->resize(640, 100);
|
||||
}
|
||||
|
||||
CAircraftModelFilterDialog::~CAircraftModelFilterDialog()
|
||||
{ }
|
||||
|
||||
std::unique_ptr<IModelFilter<CAircraftModelList>> CAircraftModelFilterDialog::createModelFilter() const
|
||||
{
|
||||
return ui->filter_Models->createModelFilter();
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
51
src/blackgui/filters/aircraftmodelfilterdialog.h
Normal file
51
src/blackgui/filters/aircraftmodelfilterdialog.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_FILTERS_AIRCRAFTMODELFILTERFORM_H
|
||||
#define BLACKGUI_FILTERS_AIRCRAFTMODELFILTERFORM_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "filterdialog.h"
|
||||
#include "blackgui/models/aircraftmodelfilter.h"
|
||||
#include <QDialog>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CAircraftModelFilterDialog; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
//! Form for a aircraft model filter
|
||||
class BLACKGUI_EXPORT CAircraftModelFilterDialog :
|
||||
public CFilterDialog,
|
||||
public BlackGui::Models::IModelFilterProvider<BlackMisc::Simulation::CAircraftModelList>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CAircraftModelFilterDialog(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CAircraftModelFilterDialog();
|
||||
|
||||
//! \copydoc IModelFilterProvider::getModelFilter
|
||||
virtual std::unique_ptr<BlackGui::Models::IModelFilter<BlackMisc::Simulation::CAircraftModelList>> createModelFilter() const override;
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CAircraftModelFilterDialog> ui;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
82
src/blackgui/filters/aircraftmodelfilterdialog.ui
Normal file
82
src/blackgui/filters/aircraftmodelfilterdialog.ui
Normal file
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CAircraftModelFilterDialog</class>
|
||||
<widget class="QDialog" name="CAircraftModelFilterDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>336</width>
|
||||
<height>95</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_AircraftModelFilterForm">
|
||||
<item>
|
||||
<widget class="BlackGui::Filters::CAircraftModelFilterBar" name="filter_Models">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="bb_ButtonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Filters::CAircraftModelFilterBar</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/filters/aircraftmodelfilterbar.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>bb_ButtonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>CAircraftModelFilterDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>bb_ButtonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>CAircraftModelFilterDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
86
src/blackgui/filters/airlineicaofilterbar.cpp
Normal file
86
src/blackgui/filters/airlineicaofilterbar.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "airlineicaofilterbar.h"
|
||||
#include "ui_airlineicaofilterbar.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackGui::Models;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
CAirlineIcaoFilterBar::CAirlineIcaoFilterBar(QWidget *parent) :
|
||||
CFilterWidget(parent),
|
||||
ui(new Ui::CAirlineIcaoFilterBar)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setButtonsAndCount(this->ui->filter_Buttons);
|
||||
|
||||
connect(ui->le_Designator, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_Name, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
}
|
||||
|
||||
CAirlineIcaoFilterBar::~CAirlineIcaoFilterBar() { }
|
||||
|
||||
std::unique_ptr<BlackGui::Models::IModelFilter<CAirlineIcaoCodeList> > CAirlineIcaoFilterBar::createModelFilter() const
|
||||
{
|
||||
return std::unique_ptr<CAirlineIcaoFilter>(
|
||||
new CAirlineIcaoFilter(
|
||||
this->ui->le_Designator->text(),
|
||||
this->ui->le_Name->text(),
|
||||
this->ui->country_Selector->isSet() ? this->ui->country_Selector->getCountry().getIsoCode() : "",
|
||||
this->ui->cb_RealAirline->isChecked(),
|
||||
this->ui->cb_VirtualAirline->isChecked()
|
||||
));
|
||||
}
|
||||
|
||||
void CAirlineIcaoFilterBar::setProvider(Network::IWebDataServicesProvider *webDataReaderProvider)
|
||||
{
|
||||
this->ui->country_Selector->setProvider(webDataReaderProvider);
|
||||
}
|
||||
|
||||
void CAirlineIcaoFilterBar::filter(const CAirlineIcaoCode &icao)
|
||||
{
|
||||
bool filter = false;
|
||||
if (icao.hasValidDesignator())
|
||||
{
|
||||
this->ui->le_Designator->setText(icao.getVDesignator());
|
||||
filter = true;
|
||||
}
|
||||
if (icao.hasName())
|
||||
{
|
||||
this->ui->le_Name->setText(icao.getName());
|
||||
filter = true;
|
||||
}
|
||||
|
||||
if (filter)
|
||||
{
|
||||
this->ui->filter_Buttons->clickButton(CFilterBarButtons::Filter);
|
||||
}
|
||||
}
|
||||
|
||||
void CAirlineIcaoFilterBar::onRowCountChanged(int count, bool withFilter)
|
||||
{
|
||||
this->ui->filter_Buttons->onRowCountChanged(count, withFilter);
|
||||
}
|
||||
|
||||
void CAirlineIcaoFilterBar::clearForm()
|
||||
{
|
||||
this->ui->le_Designator->clear();
|
||||
this->ui->le_Name->clear();
|
||||
this->ui->country_Selector->clear();
|
||||
this->ui->cb_RealAirline->setChecked(true);
|
||||
this->ui->cb_VirtualAirline->setChecked(true);
|
||||
}
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
68
src/blackgui/filters/airlineicaofilterbar.h
Normal file
68
src/blackgui/filters/airlineicaofilterbar.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_FILTERS_AIRLINEICAOFILTERBAR_H
|
||||
#define BLACKGUI_FILTERS_AIRLINEICAOFILTERBAR_H
|
||||
|
||||
#include "blackguiexport.h"
|
||||
#include "blackgui/filters/filterwidget.h"
|
||||
#include "blackgui/models/airlineicaofilter.h"
|
||||
#include "blackmisc/network/webdataservicesprovider.h"
|
||||
#include <QFrame>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CAirlineIcaoFilterBar; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
/*!
|
||||
* Airline ICAO filter bar
|
||||
*/
|
||||
class BLACKGUI_EXPORT CAirlineIcaoFilterBar :
|
||||
public CFilterWidget,
|
||||
public BlackGui::Models::IModelFilterProvider<BlackMisc::Aviation::CAirlineIcaoCodeList>,
|
||||
public BlackMisc::Network::CWebDataServicesAware
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CAirlineIcaoFilterBar(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CAirlineIcaoFilterBar();
|
||||
|
||||
//! \copydoc IModelFilter::getModelFilter
|
||||
virtual std::unique_ptr<BlackGui::Models::IModelFilter<BlackMisc::Aviation::CAirlineIcaoCodeList>> createModelFilter() const override;
|
||||
|
||||
//! \copydoc CWebDataReaderAware::setProvider
|
||||
virtual void setProvider(BlackMisc::Network::IWebDataServicesProvider *webDataReaderProvider) override;
|
||||
|
||||
//! Filter default values by ICAO code
|
||||
void filter(const BlackMisc::Aviation::CAirlineIcaoCode &icao);
|
||||
|
||||
public slots:
|
||||
//! \copydoc CFilterWidget::onRowCountChanged
|
||||
virtual void onRowCountChanged(int count, bool withFilter) override;
|
||||
|
||||
protected:
|
||||
//! Clear form
|
||||
virtual void clearForm() override;
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CAirlineIcaoFilterBar> ui;
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
162
src/blackgui/filters/airlineicaofilterbar.ui
Normal file
162
src/blackgui/filters/airlineicaofilterbar.ui
Normal file
@@ -0,0 +1,162 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CAirlineIcaoFilterBar</class>
|
||||
<widget class="QFrame" name="CAirlineIcaoFilterBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>492</width>
|
||||
<height>22</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="QGridLayout" name="gl_AirlineIcaoFilterBar">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="BlackGui::Filters::CFilterBarButtons" name="filter_Buttons">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<widget class="BlackGui::Components::CDbCountrySelectorComponent" name="country_Selector">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="le_Designator">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>ICAO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="lbl_Designator">
|
||||
<property name="text">
|
||||
<string>Airline:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<widget class="QCheckBox" name="cb_RealAirline">
|
||||
<property name="text">
|
||||
<string>Real airline</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="9">
|
||||
<widget class="QCheckBox" name="cb_VirtualAirline">
|
||||
<property name="text">
|
||||
<string>Virtual airline</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QLineEdit" name="le_Name">
|
||||
<property name="placeholderText">
|
||||
<string>Name of airline</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="10">
|
||||
<spacer name="hs_FilterBar">
|
||||
<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 row="0" column="4">
|
||||
<widget class="QLabel" name="lbl_Name">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QLabel" name="lbl_Country">
|
||||
<property name="text">
|
||||
<string>Country:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CDbCountrySelectorComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/dbcountryselectorcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Filters::CFilterBarButtons</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/filters/filterbarbuttons.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>le_Designator</tabstop>
|
||||
<tabstop>le_Name</tabstop>
|
||||
<tabstop>cb_RealAirline</tabstop>
|
||||
<tabstop>cb_VirtualAirline</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
50
src/blackgui/filters/countryfilterbar.cpp
Normal file
50
src/blackgui/filters/countryfilterbar.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
#include "countryfilterbar.h"
|
||||
#include "ui_countryfilterbar.h"
|
||||
|
||||
using namespace BlackGui::Models;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Network;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
CCountryFilterBar::CCountryFilterBar(QWidget *parent) :
|
||||
CFilterWidget(parent),
|
||||
ui(new Ui::CCountryFilterBar)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setButtonsAndCount(this->ui->filter_Buttons);
|
||||
connect(ui->le_IsoCode, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_Name, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
}
|
||||
|
||||
CCountryFilterBar::~CCountryFilterBar()
|
||||
{ }
|
||||
|
||||
std::unique_ptr<BlackGui::Models::IModelFilter<CCountryList> > CCountryFilterBar::createModelFilter() const
|
||||
{
|
||||
return std::unique_ptr<CCountryFilter>(
|
||||
new CCountryFilter(
|
||||
ui->le_IsoCode->text(),
|
||||
ui->le_Name->text()
|
||||
));
|
||||
}
|
||||
|
||||
void CCountryFilterBar::setProvider(IWebDataServicesProvider *webDataReaderProvider)
|
||||
{
|
||||
Q_UNUSED(webDataReaderProvider);
|
||||
}
|
||||
|
||||
void CCountryFilterBar::onRowCountChanged(int count, bool withFilter)
|
||||
{
|
||||
this->ui->filter_Buttons->onRowCountChanged(count, withFilter);
|
||||
}
|
||||
|
||||
void CCountryFilterBar::clearForm()
|
||||
{
|
||||
ui->le_IsoCode->clear();
|
||||
ui->le_Name->clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
51
src/blackgui/filters/countryfilterbar.h
Normal file
51
src/blackgui/filters/countryfilterbar.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#ifndef BLACKGUI_FILTERS_COUNTRYFILTERBAR_H
|
||||
#define BLACKGUI_FILTERS_COUNTRYFILTERBAR_H
|
||||
|
||||
#include "blackguiexport.h"
|
||||
#include "blackgui/filters/filterwidget.h"
|
||||
#include "blackgui/models/countryfilter.h"
|
||||
#include "blackmisc/network/webdataservicesprovider.h"
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CCountryFilterBar; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
/*!
|
||||
* Country filter bar
|
||||
*/
|
||||
class BLACKGUI_EXPORT CCountryFilterBar :
|
||||
public CFilterWidget,
|
||||
public BlackGui::Models::IModelFilterProvider<BlackMisc::CCountryList>,
|
||||
public BlackMisc::Network::CWebDataServicesAware
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CCountryFilterBar(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CCountryFilterBar();
|
||||
|
||||
//! \copydoc IModelFilter::getModelFilter
|
||||
virtual std::unique_ptr<BlackGui::Models::IModelFilter<BlackMisc::CCountryList>> createModelFilter() const override;
|
||||
|
||||
//! \copydoc CWebDataReaderAware::setProvider
|
||||
virtual void setProvider(BlackMisc::Network::IWebDataServicesProvider *webDataReaderProvider) override;
|
||||
|
||||
public slots:
|
||||
//! \copydoc CFilterWidget::onRowCountChanged
|
||||
virtual void onRowCountChanged(int count, bool withFilter) override;
|
||||
|
||||
protected:
|
||||
//! Clear form
|
||||
virtual void clearForm() override;
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CCountryFilterBar> ui;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // guard
|
||||
114
src/blackgui/filters/countryfilterbar.ui
Normal file
114
src/blackgui/filters/countryfilterbar.ui
Normal file
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CCountryFilterBar</class>
|
||||
<widget class="QFrame" name="CCountryFilterBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>384</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Country filter bat</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="le_IsoCode">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>ISO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="BlackGui::Filters::CFilterBarButtons" name="filter_Buttons">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QLineEdit" name="le_Name">
|
||||
<property name="placeholderText">
|
||||
<string>Name of country</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="lbl_Name">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<spacer name="hs_CountryFilterBar">
|
||||
<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 row="0" column="1">
|
||||
<widget class="QLabel" name="lbl_CountryIso">
|
||||
<property name="toolTip">
|
||||
<string>Country ISO, e.g. DE, US, FR</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Country ISO:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Filters::CFilterBarButtons</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/filters/filterbarbuttons.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>le_IsoCode</tabstop>
|
||||
<tabstop>le_Name</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
64
src/blackgui/filters/filterbarbuttons.cpp
Normal file
64
src/blackgui/filters/filterbarbuttons.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "filterbarbuttons.h"
|
||||
#include "ui_filterbarbuttons.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
CFilterBarButtons::CFilterBarButtons(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::CFilterBarButtons)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(this->ui->tb_ClearForm, &QToolButton::clicked, this, &CFilterBarButtons::ps_buttonClicked);
|
||||
connect(this->ui->tb_Filter, &QToolButton::clicked, this, &CFilterBarButtons::ps_buttonClicked);
|
||||
connect(this->ui->tb_RemoveFilter, &QToolButton::clicked, this, &CFilterBarButtons::ps_buttonClicked);
|
||||
}
|
||||
|
||||
CFilterBarButtons::~CFilterBarButtons()
|
||||
{ }
|
||||
|
||||
void CFilterBarButtons::ps_buttonClicked()
|
||||
{
|
||||
QObject *sender = QObject::sender();
|
||||
if (sender == ui->tb_ClearForm) { emit buttonClicked(ClearForm); }
|
||||
else if (sender == ui->tb_Filter) { emit buttonClicked(Filter); }
|
||||
else if (sender == ui->tb_RemoveFilter) { emit buttonClicked(RemoveFilter); }
|
||||
}
|
||||
|
||||
void CFilterBarButtons::onRowCountChanged(int count, bool withFilter)
|
||||
{
|
||||
QString v = QString::number(count);
|
||||
if (withFilter) { v += "F";}
|
||||
this->ui->le_Count->setText(v);
|
||||
}
|
||||
|
||||
void CFilterBarButtons::clickButton(CFilterBarButtons::FilterButton filterButton)
|
||||
{
|
||||
switch (filterButton)
|
||||
{
|
||||
case ClearForm:
|
||||
this->ui->tb_ClearForm->click();
|
||||
break;
|
||||
case RemoveFilter:
|
||||
this->ui->tb_RemoveFilter->click();
|
||||
break;
|
||||
case Filter:
|
||||
this->ui->tb_Filter->click();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
71
src/blackgui/filters/filterbarbuttons.h
Normal file
71
src/blackgui/filters/filterbarbuttons.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_FILTERS_FILTERBARBUTTONS_H
|
||||
#define BLACKGUI_FILTERS_FILTERBARBUTTONS_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include <QFrame>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CFilterBarButtons; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
/*!
|
||||
* Filter bar buttons
|
||||
*/
|
||||
class BLACKGUI_EXPORT CFilterBarButtons : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Buttons
|
||||
enum FilterButton
|
||||
{
|
||||
ClearForm,
|
||||
Filter,
|
||||
RemoveFilter
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
explicit CFilterBarButtons(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CFilterBarButtons();
|
||||
|
||||
signals:
|
||||
//! Filter button clicked
|
||||
void buttonClicked(FilterButton filterButton);
|
||||
|
||||
public slots:
|
||||
//! Row count has been changed
|
||||
void onRowCountChanged(int count, bool withFilter);
|
||||
|
||||
//! Trigger button
|
||||
void clickButton(FilterButton filterButton);
|
||||
|
||||
private slots:
|
||||
//! Button was clicked
|
||||
void ps_buttonClicked();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CFilterBarButtons> ui;
|
||||
};
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
Q_DECLARE_METATYPE(BlackGui::Filters::CFilterBarButtons::FilterButton)
|
||||
|
||||
#endif // guard
|
||||
139
src/blackgui/filters/filterbarbuttons.ui
Normal file
139
src/blackgui/filters/filterbarbuttons.ui
Normal file
@@ -0,0 +1,139 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CFilterBarButtons</class>
|
||||
<widget class="QFrame" name="CFilterBarButtons">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>140</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Filter bar buttons</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="hl_filterBarButtons">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_Count">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of entries</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="hs_FilterBarButtons">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tb_Filter">
|
||||
<property name="toolTip">
|
||||
<string>filter</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>filter</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../blackmisc/blackmisc.qrc">
|
||||
<normaloff>:/diagona/icons/diagona/icons/application-search-result.png</normaloff>:/diagona/icons/diagona/icons/application-search-result.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QToolButton" name="tb_RemoveFilter">
|
||||
<property name="toolTip">
|
||||
<string>remove filter</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>remove filter</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../blackmisc/blackmisc.qrc">
|
||||
<normaloff>:/diagona/icons/diagona/icons/cross-circle.png</normaloff>:/diagona/icons/diagona/icons/cross-circle.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tb_ClearForm">
|
||||
<property name="toolTip">
|
||||
<string>clear form</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>clear form</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../blackmisc/blackmisc.qrc">
|
||||
<normaloff>:/diagona/icons/diagona/icons/cross-white.png</normaloff>:/diagona/icons/diagona/icons/cross-white.png</iconset>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../blackmisc/blackmisc.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
36
src/blackgui/filters/filterdialog.cpp
Normal file
36
src/blackgui/filters/filterdialog.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
/* 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 "filterdialog.h"
|
||||
#include "blackgui/stylesheetutility.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
CFilterDialog::CFilterDialog(QWidget *parent) : QDialog(parent, Qt::Tool)
|
||||
{
|
||||
this->setWindowTitle("Filter dialog");
|
||||
ps_onStyleSheetChanged();
|
||||
connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &CFilterDialog::ps_onStyleSheetChanged);
|
||||
}
|
||||
|
||||
CFilterDialog::~CFilterDialog()
|
||||
{ }
|
||||
|
||||
void CFilterDialog::ps_onStyleSheetChanged()
|
||||
{
|
||||
const QString qss = CStyleSheetUtility::instance().style(CStyleSheetUtility::fileNameFilterDialog());
|
||||
this->setStyleSheet(qss);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
|
||||
40
src/blackgui/filters/filterdialog.h
Normal file
40
src/blackgui/filters/filterdialog.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_FILTERS_FILTERDIALOG_H
|
||||
#define BLACKGUI_FILTERS_FILTERDIALOG_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include <QDialog>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
//! Base for filter dialog
|
||||
class BLACKGUI_EXPORT CFilterDialog : public QDialog
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CFilterDialog(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CFilterDialog();
|
||||
|
||||
private slots:
|
||||
//! Stylesheet changed
|
||||
void ps_onStyleSheetChanged();
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
68
src/blackgui/filters/filterwidget.cpp
Normal file
68
src/blackgui/filters/filterwidget.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "filterwidget.h"
|
||||
#include "blackgui/stylesheetutility.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
CFilterWidget::CFilterWidget(QWidget *parent) : QFrame(parent)
|
||||
{
|
||||
this->setWindowTitle("Filter widget");
|
||||
ps_onStyleSheetChanged();
|
||||
connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &CFilterWidget::ps_onStyleSheetChanged);
|
||||
}
|
||||
|
||||
CFilterWidget::~CFilterWidget()
|
||||
{ }
|
||||
|
||||
void CFilterWidget::setButtonsAndCount(CFilterBarButtons *buttons)
|
||||
{
|
||||
if (buttons)
|
||||
{
|
||||
bool s = connect(buttons, &CFilterBarButtons::buttonClicked, this, &CFilterWidget::ps_filterButtonClicked);
|
||||
Q_ASSERT_X(s, Q_FUNC_INFO, "filter button connect");
|
||||
Q_UNUSED(s);
|
||||
}
|
||||
}
|
||||
|
||||
void CFilterWidget::triggerFilter()
|
||||
{
|
||||
this->ps_filterButtonClicked(CFilterBarButtons::Filter);
|
||||
}
|
||||
|
||||
void CFilterWidget::ps_onStyleSheetChanged()
|
||||
{
|
||||
const QString qss = CStyleSheetUtility::instance().style(CStyleSheetUtility::fileNameFilterDialog());
|
||||
this->setStyleSheet(qss);
|
||||
}
|
||||
|
||||
void CFilterWidget::ps_filterButtonClicked(CFilterBarButtons::FilterButton filterButton)
|
||||
{
|
||||
switch (filterButton)
|
||||
{
|
||||
case CFilterBarButtons::Filter:
|
||||
emit changeFilter(true);
|
||||
break;
|
||||
case CFilterBarButtons::RemoveFilter:
|
||||
emit changeFilter(false);
|
||||
break;
|
||||
case CFilterBarButtons::ClearForm:
|
||||
clearForm();
|
||||
emit changeFilter(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
|
||||
64
src/blackgui/filters/filterwidget.h
Normal file
64
src/blackgui/filters/filterwidget.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_FILTERS_FILTERWIDGET_H
|
||||
#define BLACKGUI_FILTERS_FILTERWIDGET_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/filters/filterbarbuttons.h"
|
||||
#include <QFrame>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
//! Base for filter dialog
|
||||
class BLACKGUI_EXPORT CFilterWidget : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
CFilterWidget(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CFilterWidget();
|
||||
|
||||
public slots:
|
||||
//! Row count has been changed
|
||||
virtual void onRowCountChanged(int count, bool withFilter) = 0;
|
||||
|
||||
//! Trigger filtering
|
||||
virtual void triggerFilter();
|
||||
|
||||
signals:
|
||||
//! Change the filter by enabling or disabling it
|
||||
void changeFilter(bool enable);
|
||||
|
||||
protected:
|
||||
//! Set and connect filter bar buttonsd
|
||||
void setButtonsAndCount(CFilterBarButtons *buttons);
|
||||
|
||||
//! Clear the filter form
|
||||
virtual void clearForm() = 0;
|
||||
|
||||
private slots:
|
||||
//! Button clicked
|
||||
void ps_filterButtonClicked(CFilterBarButtons::FilterButton filterButton);
|
||||
|
||||
//! Stylesheet changed
|
||||
void ps_onStyleSheetChanged();
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
106
src/blackgui/filters/liveryfilterbar.cpp
Normal file
106
src/blackgui/filters/liveryfilterbar.cpp
Normal file
@@ -0,0 +1,106 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "liveryfilterbar.h"
|
||||
#include "ui_liveryfilterbar.h"
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackGui::Models;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
CLiveryFilterBar::CLiveryFilterBar(QWidget *parent) :
|
||||
CFilterWidget(parent),
|
||||
ui(new Ui::CLiveryFilterBar)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setButtonsAndCount(this->ui->filter_Buttons);
|
||||
|
||||
connect(ui->le_AirlineIcaoCode, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_Description, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_LiveryCode, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->color_Fuselage, &CColorSelector::colorChanged, this, &CLiveryFilterBar::ps_colorChanged);
|
||||
connect(ui->color_Tail, &CColorSelector::colorChanged, this, &CLiveryFilterBar::ps_colorChanged);
|
||||
connect(ui->cb_Airlines, &QCheckBox::released, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->cb_Colors, &QCheckBox::released, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->hs_ColorDistance, &QSlider::valueChanged, this, &CLiveryFilterBar::ps_colorDistanceChanged);
|
||||
}
|
||||
|
||||
CLiveryFilterBar::~CLiveryFilterBar()
|
||||
{ }
|
||||
|
||||
std::unique_ptr<BlackGui::Models::IModelFilter<CLiveryList> > CLiveryFilterBar::createModelFilter() const
|
||||
{
|
||||
double maxColorDistance = ui->hs_ColorDistance->value() / 100.0;
|
||||
return std::unique_ptr<CLiveryFilter>(
|
||||
new CLiveryFilter(
|
||||
this->ui->le_LiveryCode->text(),
|
||||
this->ui->le_Description->text(),
|
||||
this->ui->le_AirlineIcaoCode->text(),
|
||||
this->ui->color_Fuselage->getColor(),
|
||||
this->ui->color_Tail->getColor(),
|
||||
maxColorDistance,
|
||||
this->ui->cb_Colors->isChecked(),
|
||||
this->ui->cb_Airlines->isChecked()
|
||||
));
|
||||
}
|
||||
|
||||
void CLiveryFilterBar::setProvider(BlackMisc::Network::IWebDataServicesProvider *webDataReaderProvider)
|
||||
{
|
||||
Q_UNUSED(webDataReaderProvider);
|
||||
}
|
||||
|
||||
void CLiveryFilterBar::filter(const CLivery &livery)
|
||||
{
|
||||
if (livery.hasCombinedCode())
|
||||
{
|
||||
this->ui->le_LiveryCode->setText(livery.getCombinedCode());
|
||||
}
|
||||
else if (livery.hasValidAirlineDesignator())
|
||||
{
|
||||
this->ui->le_AirlineIcaoCode->setText(livery.getAirlineIcaoCodeDesignator());
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
this->ui->filter_Buttons->clickButton(CFilterBarButtons::Filter);
|
||||
}
|
||||
|
||||
void CLiveryFilterBar::onRowCountChanged(int count, bool withFilter)
|
||||
{
|
||||
this->ui->filter_Buttons->onRowCountChanged(count, withFilter);
|
||||
}
|
||||
|
||||
void CLiveryFilterBar::clearForm()
|
||||
{
|
||||
ui->le_AirlineIcaoCode->clear();
|
||||
ui->le_LiveryCode->clear();
|
||||
ui->le_Description->clear();
|
||||
ui->color_Fuselage->clear();
|
||||
ui->color_Tail->clear();
|
||||
ui->hs_ColorDistance->setValue(0.25 * 100.0);
|
||||
}
|
||||
|
||||
void CLiveryFilterBar::ps_colorChanged(const BlackMisc::CRgbColor &color)
|
||||
{
|
||||
this->triggerFilter();
|
||||
Q_UNUSED(color);
|
||||
}
|
||||
|
||||
void CLiveryFilterBar::ps_colorDistanceChanged(int distance)
|
||||
{
|
||||
this->triggerFilter();
|
||||
Q_UNUSED(distance);
|
||||
}
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
75
src/blackgui/filters/liveryfilterbar.h
Normal file
75
src/blackgui/filters/liveryfilterbar.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_FILTERS_LIVERYFILTERBAR_H
|
||||
#define BLACKGUI_FILTERS_LIVERYFILTERBAR_H
|
||||
|
||||
#include "blackguiexport.h"
|
||||
#include "blackgui/filters/filterwidget.h"
|
||||
#include "blackgui/models/liveryfilter.h"
|
||||
#include "blackmisc/network/webdataservicesprovider.h"
|
||||
#include <QFrame>
|
||||
|
||||
namespace Ui { class CLiveryFilterBar; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Filters
|
||||
{
|
||||
/*!
|
||||
* Livery filter bar
|
||||
*/
|
||||
class BLACKGUI_EXPORT CLiveryFilterBar :
|
||||
public CFilterWidget,
|
||||
public BlackGui::Models::IModelFilterProvider<BlackMisc::Aviation::CLiveryList>,
|
||||
public BlackMisc::Network::CWebDataServicesAware
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CLiveryFilterBar(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CLiveryFilterBar();
|
||||
|
||||
//! \copydoc IModelFilter::getModelFilter
|
||||
virtual std::unique_ptr<BlackGui::Models::IModelFilter<BlackMisc::Aviation::CLiveryList>> createModelFilter() const override;
|
||||
|
||||
//! \copydoc CWebDataReaderAware::setProvider
|
||||
virtual void setProvider(BlackMisc::Network::IWebDataServicesProvider *webDataReaderProvider) override;
|
||||
|
||||
//! Filter by livery as default values
|
||||
void filter(const BlackMisc::Aviation::CLivery &livery);
|
||||
|
||||
public slots:
|
||||
//! \copydoc CFilterWidget::onRowCountChanged
|
||||
virtual void onRowCountChanged(int count, bool withFilter) override;
|
||||
|
||||
protected:
|
||||
//! Clear form
|
||||
virtual void clearForm() override;
|
||||
|
||||
private slots:
|
||||
//! Color changed
|
||||
void ps_colorChanged(const BlackMisc::CRgbColor &color);
|
||||
|
||||
//! Color distance changed
|
||||
void ps_colorDistanceChanged(int distance);
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CLiveryFilterBar> ui;
|
||||
};
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
261
src/blackgui/filters/liveryfilterbar.ui
Normal file
261
src/blackgui/filters/liveryfilterbar.ui
Normal file
@@ -0,0 +1,261 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CLiveryFilterBar</class>
|
||||
<widget class="QFrame" name="CLiveryFilterBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>597</width>
|
||||
<height>44</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</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="QGridLayout" name="gl_CLiveryFilterBar">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="lbl_AirlineIcaoCode">
|
||||
<property name="text">
|
||||
<string>Airline:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lbl_LiveryCode">
|
||||
<property name="text">
|
||||
<string>Code:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QLabel" name="lbl_Description">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="le_LiveryCode">
|
||||
<property name="placeholderText">
|
||||
<string>Livery code</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="BlackGui::Filters::CFilterBarButtons" name="filter_Buttons">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QLineEdit" name="le_Description"/>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QLineEdit" name="le_AirlineIcaoCode">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>ICAO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3" colspan="4">
|
||||
<widget class="QWidget" name="wi_Colors" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_Colors">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_Color">
|
||||
<property name="text">
|
||||
<string>Color (F/Tl):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BlackGui::CColorSelector" name="color_Fuselage">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BlackGui::CColorSelector" name="color_Tail">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="hs_ColorDistance">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Color distance</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>25</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QWidget" name="wi_Flags" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_Flags">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cb_Colors">
|
||||
<property name="text">
|
||||
<string>Color liveries</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cb_Airlines">
|
||||
<property name="text">
|
||||
<string>Airline liveries</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="hs_Flags">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<spacer name="hs_Row1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::CColorSelector</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/colorselector.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Filters::CFilterBarButtons</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/filters/filterbarbuttons.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>le_LiveryCode</tabstop>
|
||||
<tabstop>le_AirlineIcaoCode</tabstop>
|
||||
<tabstop>le_Description</tabstop>
|
||||
<tabstop>cb_Colors</tabstop>
|
||||
<tabstop>cb_Airlines</tabstop>
|
||||
<tabstop>hs_ColorDistance</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user