Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,141 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for MeteoDataManagement - Meteo Data Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#include "mdm_meteo_data.h"
|
||||
#include "ui_mdm_meteo_data.h"
|
||||
#include "mdm_static_meteo_data_edit.h"
|
||||
|
||||
#include <LtsSession/lts_session_manager.h>
|
||||
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace MeteoDataManagement
|
||||
{
|
||||
|
||||
MeteoDataView::MeteoDataView(const QString &menuGroup, LtsSession::LtsSession *session, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_menuGroup(menuGroup)
|
||||
, m_model(nullptr)
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_session(session)
|
||||
, m_ui(new Ui::MeteoDataView)
|
||||
, m_logger(getLogger("MeteoDataManagementDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->widget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
||||
// connects fuer Widgetaenderungen
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged,
|
||||
this, &MeteoDataView::onSelectionChanged);
|
||||
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked, this, &MeteoDataView::onEditStaticMeteoData);
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalEnterPressed, this, &MeteoDataView::onEditStaticMeteoData);
|
||||
|
||||
// Edit-Button erzeugen
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &MeteoDataView::onEditStaticMeteoData);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, false);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &MeteoDataView::onPrint);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Weather_Stations"));
|
||||
} // end of ctor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
MeteoDataView::~MeteoDataView()
|
||||
{
|
||||
delete m_ui;
|
||||
} // end of dtor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MeteoDataView::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Weather Stations"));
|
||||
}
|
||||
|
||||
bool MeteoDataView::init(const std::shared_ptr<MeteoDataManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<MeteoDataManagement::Interface::Ftc> &ftc)
|
||||
{
|
||||
if (!dtc || !ftc)
|
||||
return false;
|
||||
|
||||
m_dtc = dtc;
|
||||
m_ftc = ftc;
|
||||
m_model = new MeteoDataModel(this);
|
||||
m_model->initModel(m_dtc);
|
||||
m_ui->widget->setModel(m_model);
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->widget->hideColumn(MeteoDataModel::Id);
|
||||
#endif
|
||||
return true;
|
||||
} // end of init()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MeteoDataView::onSelectionChanged()
|
||||
{
|
||||
const QModelIndex idx = m_ui->widget->currentIndex();
|
||||
|
||||
int row = idx.row();
|
||||
if (row < 0)
|
||||
return;
|
||||
|
||||
MeteoDataManagement::MeteoData meteoData = m_model->getRowData(row);
|
||||
|
||||
if(meteoData.isStaticMeteoData())
|
||||
{
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, false);
|
||||
}
|
||||
} // end of onSelectionChanged()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MeteoDataView::onEditStaticMeteoData()
|
||||
{
|
||||
const QModelIndex idx = m_ui->widget->currentIndex();
|
||||
|
||||
int row = idx.row();
|
||||
if (row < 0)
|
||||
return;
|
||||
|
||||
MeteoDataManagement::MeteoData meteoData = m_model->getRowData(row);
|
||||
|
||||
DEBUG_LOG(m_logger) << "--- onEditStaticMeteoData() "
|
||||
<< " id: " << meteoData.id()
|
||||
<< " mduId: " << meteoData.weatherStationId()
|
||||
<< " isStaticData: " << meteoData.isStaticMeteoData()
|
||||
<< " WindDirection: " << meteoData.windDirection()
|
||||
<< " WindSpeed: " << meteoData.windSpeed()
|
||||
<< " Temp: " << meteoData.temperature()
|
||||
<< " Pressure: " << meteoData.pressure()
|
||||
<< " Humidity: " << meteoData.humidity()
|
||||
;
|
||||
|
||||
if(meteoData.isStaticMeteoData())
|
||||
{
|
||||
StaticMeteoDataEdit *dialog = new StaticMeteoDataEdit(this);
|
||||
dialog->init(m_dtc, m_ftc, m_session);
|
||||
addDialog(dialog, m_menuGroup, QLatin1String("mdmSetStaticMeteoData"), LtsWidgets::LayoutArea::eDialogTab);
|
||||
}
|
||||
} // end of onEditStaticMeteoData()
|
||||
//-----------------------------------------------------------------------------
|
||||
void MeteoDataView::onPrint()
|
||||
{
|
||||
LtsPrinting::printView(m_session, this, m_ui->widget->treeView() );
|
||||
} // end of onPrint()
|
||||
|
||||
void MeteoDataView::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
} // namespace MeteoDataManagement
|
||||
Reference in new issue
Block a user