File: GridEditor.h

package info (click to toggle)
dyssol 1.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,184 kB
  • sloc: cpp: 53,870; sh: 85; python: 59; makefile: 11
file content (64 lines) | stat: -rw-r--r-- 1,902 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* Copyright (c) 2020, Dyssol Development Team.
 * Copyright (c) 2023, DyssolTEC GmbH.
 * All rights reserved. This file is part of Dyssol. See LICENSE file for license information. */

#pragma once

#include "ui_GridEditor.h"
#include "DimensionParameters.h"
#include "MultidimensionalGrid.h"
#include "QtDialog.h"

class CFlowsheet;

class CGridEditor
	: public CQtDialog
{
	Q_OBJECT
	Ui::CGridEditorClass ui{};

	const CMaterialsDatabase& m_materialsDB;	// Reference to a global database of materials.
	CFlowsheet* m_flowsheet;					// Pointer to the flowsheet.
	CMultidimensionalGrid m_grid;				// Working copy of the grid.

public:
	CGridEditor(CFlowsheet* _flowsheet, const CMaterialsDatabase& _materialsDB, QWidget* _parent = nullptr, Qt::WindowFlags _flags = Qt::WindowFlags());

	// Connects all signals and slots.
	void InitializeConnections() const;

	// Change visibility of the dialog.
	void setVisible(bool _visible) override;
	// Tries to apply all changes and closes the dialog on success.
	void accept() override;

	void UpdateFromFlowsheet();
	// Updates all widgets.
	void UpdateWholeView();

private:
	// Updates the list of grids sources.
	void UpdateGridsList() const;
	// Updates the list of grid dimensions.
	void UpdateDimensionsList();

	// Called when new grid is selected.
	void GridSelected();
	// Called when activity of unit-specific changes.
	void GridActivityChanged(const QCheckBox* _checkbox, const QTreeWidgetItem* _item);
	// Called when add distribution button clicked.
	void AddDistributionClicked();
	// Called when remove distribution button clicked.
	void RemDistributionClicked();

	// Adds new grid dimension widget to the view.
	CDimensionParameters* AddGridDimension(const CGridDimension& _dim);

	// Tries to apply all changes if they are valid.
	bool ApplyChanges();
	// Checks validity of all settings.
	bool IsValid();

signals:
	void DataChanged();
};