Removed old model/views for aircraft, now all with simulated aircraft

Updates of models in view now manually / automatic possible
Allow to reload models (in backend)
This commit is contained in:
Klaus Basan
2015-03-19 23:56:08 +01:00
parent afed33dbbf
commit 48dc360237
22 changed files with 143 additions and 182 deletions

View File

@@ -38,6 +38,11 @@ namespace BlackGui
this->m_model->setAircraftModelMode(mode);
}
bool CAircraftModelView::displayAutomatically() const
{
return m_displayAutomatically;
}
bool CAircraftModelView::ps_filterDialogFinished(int status)
{
if (CViewBase::ps_filterDialogFinished(status)) { return true; }
@@ -47,6 +52,24 @@ namespace BlackGui
return true;
}
void CAircraftModelView::customMenu(QMenu &menu) const
{
QAction *a = menu.addAction(CIcons::appMappings16(), "Automatically display", this, SLOT(ps_toggleAutoDisplay()));
a->setCheckable(true);
a->setChecked(m_displayAutomatically);
menu.addAction(CIcons::refresh16(), "Reload model data", this, SIGNAL(requestModelReload()));
menu.addSeparator();
CViewBase::customMenu(menu);
}
void CAircraftModelView::ps_toggleAutoDisplay()
{
QAction *a = qobject_cast<QAction *>(QObject::sender());
if (!a) { return; }
Q_ASSERT(a->isCheckable());
this->m_displayAutomatically = a->isChecked();
}
CAircraftModelFilterForm *CAircraftModelView::getFilterForm() const
{
return static_cast<CAircraftModelFilterForm *>(this->m_filterDialog.data());

View File

@@ -23,6 +23,7 @@ namespace BlackGui
//! Aircrafts view
class CAircraftModelView : public CViewBase<Models::CAircraftModelListModel, BlackMisc::Simulation::CAircraftModelList, BlackMisc::Simulation::CAircraftModel>
{
Q_OBJECT
public:
@@ -32,14 +33,30 @@ namespace BlackGui
//! Set display mode
void setAircraftModelMode(Models::CAircraftModelListModel::AircraftModelMode mode);
//! Display automatically (when models are loaded)
bool displayAutomatically() const;
signals:
//! Request reloading of backend models
void requestModelReload();
protected slots:
//! \copydoc CViewBaseNonTemplate::ps_filterDialogFinished
virtual bool ps_filterDialogFinished(int status) override;
protected:
//! \copydoc CViewBase::customMenu
virtual void customMenu(QMenu &menu) const override;
private slots:
//! Toggle auto display
void ps_toggleAutoDisplay();
private:
//! Filter form
CAircraftModelFilterForm *getFilterForm() const;
bool m_displayAutomatically = false;
};
}
}
} // ns
} // ns
#endif // guard

View File

@@ -1,26 +0,0 @@
/* 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 "aircraftview.h"
#include <QHeaderView>
using namespace BlackMisc;
using namespace BlackGui::Models;
namespace BlackGui
{
namespace Views
{
CAircraftView::CAircraftView(QWidget *parent) : CViewBase(parent)
{
this->standardInit(new CAircraftListModel(this));
}
} // ns
} // ns

View File

@@ -1,34 +0,0 @@
/* 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_AIRCRAFTVIEW_H
#define BLACKGUI_AIRCRAFTVIEW_H
#include "viewbase.h"
#include "../models/aircraftlistmodel.h"
namespace BlackGui
{
namespace Views
{
//! Aircrafts view
//! \deprecated use simulated aircraft instead
class CAircraftView : public CViewBase<Models::CAircraftListModel, BlackMisc::Aviation::CAircraftList, BlackMisc::Aviation::CAircraft>
{
public:
//! Constructor
explicit CAircraftView(QWidget *parent = nullptr);
};
} // namespace
} // namespace
#endif // guard

View File

@@ -11,7 +11,6 @@
#include "../models/statusmessagelistmodel.h"
#include "../models/namevariantpairlistmodel.h"
#include "../models/atcstationlistmodel.h"
#include "../models/aircraftlistmodel.h"
#include "../models/aircraftmodellistmodel.h"
#include "../models/textmessagelistmodel.h"
#include "../models/airportlistmodel.h"
@@ -87,8 +86,14 @@ namespace BlackGui
}
if (!menu.isEmpty()) { menu.addSeparator(); }
menu.addAction(BlackMisc::CIcons::resize16(), "Full resize", this, SLOT(fullResizeToContents()));
menu.addAction(BlackMisc::CIcons::resizeVertical16(), "Resize rows to content", this, SLOT(rowsResizeModeToContent()));
menu.addAction(BlackMisc::CIcons::resizeVertical16(), "Resize rows interactive", this, SLOT(rowsResizeModeToInteractive()));
if (m_rowResizeMode == Interactive)
{
menu.addAction(BlackMisc::CIcons::resizeVertical16(), "Resize rows to content", this, SLOT(rowsResizeModeToContent()));
}
else
{
menu.addAction(BlackMisc::CIcons::resizeVertical16(), "Resize rows interactive", this, SLOT(rowsResizeModeToInteractive()));
}
// resize to content might decrease performance,
// so I only allow changing to "content resizing" if size matches
@@ -398,7 +403,6 @@ namespace BlackGui
template class CViewBase<BlackGui::Models::CStatusMessageListModel, BlackMisc::CStatusMessageList, BlackMisc::CStatusMessage>;
template class CViewBase<BlackGui::Models::CNameVariantPairModel, BlackMisc::CNameVariantPairList, BlackMisc::CNameVariantPair>;
template class CViewBase<BlackGui::Models::CAtcStationListModel, BlackMisc::Aviation::CAtcStationList, BlackMisc::Aviation::CAtcStation>;
template class CViewBase<BlackGui::Models::CAircraftListModel, BlackMisc::Aviation::CAircraftList, BlackMisc::Aviation::CAircraft>;
template class CViewBase<BlackGui::Models::CAirportListModel, BlackMisc::Aviation::CAirportList, BlackMisc::Aviation::CAirport>;
template class CViewBase<BlackGui::Models::CServerListModel, BlackMisc::Network::CServerList, BlackMisc::Network::CServer>;
template class CViewBase<BlackGui::Models::CUserListModel, BlackMisc::Network::CUserList, BlackMisc::Network::CUser>;