Commit 8037c901 authored by Gerrit Erichsen's avatar Gerrit Erichsen
Browse files

made Preferences more universally available

parent 5ccd389a
......@@ -474,12 +474,12 @@ void CharLGui::initWidgets()
m_locationsWidget = new LocationsWidget(m_modelLocations, m_modelSelectNode,
m_modelSelectWindData, m_modelSelectSolarData,
m_modelSelectTemperatureData, m_modelSelectPowerDemandData,
this);
m_preferences, this);
m_locationsWidget->setObjectName("LocationsWidget");
m_nodeWidget = new NodesWidget(m_modelNodes,
m_modelSelectPlant, m_modelSelectStorage, m_modelSelectWind,
m_modelSelectPV, m_modelSelectLocation, this);
m_modelSelectPV, m_modelSelectLocation, m_preferences, this);
m_nodeWidget->setObjectName("NodeWidget");
m_gridWidget = new GridWidget(m_modelGridCapacities, m_modelGridImpedances,
......
......@@ -526,6 +526,8 @@ void PreferencesDialog::fillEntriesFromPreferences()
{
//General
m_chbUseCommaOutput->setChecked(m_preferences->useComma());
m_chbAssignData->setChecked(m_preferences->assignDataFromMap());
m_chbAssignLocations->setChecked(m_preferences->assignLocationsFromMap());
m_leAcceptableBlackout->setText(QString::number(m_preferences->getAccptableBlackout()));
m_chbKeepAllResults->setChecked(m_preferences->keepAllResults());
m_chbKeepAllTimeSeries->setChecked(m_preferences->keepAllTimeSeries()); //tb
......
......@@ -3,7 +3,10 @@
#include <QHeaderView>
#include <QMessageBox>
DataWidget::DataWidget(DataTableModel * modelWind, DataTableModel * modelSolar, DataTableModel * modelTemperature, DataTableModel * modelPowerDemand, Preferences * preferences, QWidget * parent) : QWidget(parent),
DataWidget::DataWidget(DataTableModel * modelWind, DataTableModel * modelSolar,
DataTableModel * modelTemperature, DataTableModel * modelPowerDemand,
const Preferences * preferences,
QWidget * parent) : QWidget(parent),
m_modelWindData(modelWind),
m_modelSolarData(modelSolar),
m_modelTemperatureData(modelTemperature),
......
......@@ -27,6 +27,7 @@
#include <QVariant>
#include "../Models/DataTableModel.h"
#include "Preferences.h"
class DataWidget : public QWidget
{
......@@ -36,8 +37,8 @@ public:
DataTableModel * modelSolar,
DataTableModel * modelTemperature,
DataTableModel * modelPowerDemand,
Preferences * preferences,
QWidget *parent = 0);
const Preferences * preferences,
QWidget *parent = nullptr);
QString copyFromTable(QString tableName);
void pasteToTable(QString pasteText, QString tableName);
......@@ -75,6 +76,8 @@ private:
QPushButton * m_btnNewItemWeather;
QPushButton * m_btnRemoveItemWeather;
const Preferences * m_preferences;
};
#endif // DATAWIDGET_H
......@@ -20,8 +20,10 @@ LocationsWidget::LocationsWidget(LocationsTableModel * locationsTableModel,
SelectorListModel * solarDataSelect,
SelectorListModel * temperatureDataSelect,
SelectorListModel * powerDemandDataSelect,
const Preferences * preferences,
QWidget * parent) : QWidget(parent),
m_locationsTableModel(locationsTableModel)
m_locationsTableModel(locationsTableModel),
m_preferences(preferences)
{
initSettings();
initMap();
......
......@@ -27,6 +27,7 @@ public:
SelectorListModel * solarDataSelect,
SelectorListModel * temperatureDataSelect,
SelectorListModel * powerDemandDataSelect,
const Preferences * preferences,
QWidget * parent = nullptr);
~LocationsWidget();
......@@ -116,6 +117,9 @@ private:
// member variables
bool m_showAdvancedOptions;
QMutex m_mutex;
//preferences
const Preferences * m_preferences;
};
#endif // LOCATIONSWIDGET_H
......@@ -15,9 +15,10 @@
NodesWidget::NodesWidget(NodesTableModel * nodeTableModel, SelectorListModel * plantSelect,
SelectorListModel * storageSelect, SelectorListModel * windSelect,
SelectorListModel * pvSelect, SelectorListModel * locationSelect,
QWidget * parent) :
const Preferences * preferences, QWidget * parent) :
QWidget(parent),
m_modelNodesTable(nodeTableModel)
m_modelNodesTable(nodeTableModel),
m_preferences(preferences)
{
m_settings = new QSettings("CharL", "CharL");
m_settings->beginGroup("NodesWidget");
......
......@@ -26,6 +26,7 @@
#include "../Models/NodesTableModel.h"
#include "../Models/ConfigTableModel.h"
#include "ConfigurationWidget.h"
#include "Preferences.h"
#include "MapGraphicsView.h"
#include "ShapeFileRW.h"
......@@ -41,6 +42,7 @@ public:
SelectorListModel * windSelect,
SelectorListModel * pvSelect,
SelectorListModel * locationSelect,
const Preferences * preferences,
QWidget * parent = nullptr);
~NodesWidget();
......@@ -90,6 +92,8 @@ private:
m_SFFileName;
MapGraphicsView * m_viewMap;
MapGraphicsScene * m_scene;
const Preferences * m_preferences;
};
#endif // NODESWIDGET_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment