Skip to content

Commit

Permalink
chore: Unify with pro
Browse files Browse the repository at this point in the history
  • Loading branch information
vasylskorych committed Dec 3, 2023
1 parent eca17d2 commit 6232d8a
Show file tree
Hide file tree
Showing 51 changed files with 488 additions and 263 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ env:
QT_VERSION: 5.15.2
QT_VS_VERSION: msvc2019_64
QT_VS_ADDIN_VERSION: 2.7.2
ZLIB_VERSION: 1.2.13
ZLIB_VERSION: 1.3
SUNDIALS_VERSION: 6.4.1
HDF5_VERSION: 1.12.2
GRAPHVIZ_VERSION: 7.0.4
Expand Down
90 changes: 45 additions & 45 deletions Documentation/001_ui/cli.rst

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Documentation/sources/001_ui/export_svg_to_png.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@
"C:\Program Files\Inkscape\bin\inkscape.exe" --export-type="png" tabs.svg
"C:\Program Files\Inkscape\bin\inkscape.exe" --export-type="png" tools_mdb.svg
"C:\Program Files\Inkscape\bin\inkscape.exe" --export-type="png" tools_models.svg
"C:\Program Files\Inkscape\bin\inkscape.exe" --export-type="png" tools_settings.svg
41 changes: 25 additions & 16 deletions DyssolMainWindow/Dyssol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,33 @@ Dyssol::Dyssol(QWidget *parent /*= 0*/, Qt::WindowFlags flags /*= {}*/)
SetupCache();

// create help class for showing help files in main window
m_helpHelper = new CMainWindowHelpHelper(&m_ModelsManager, this);
m_helpHelper = new CMainWindowHelpHelper{ this };

// create dialogs and windows
m_pModelsManagerTab = new CModulesManagerTab(&m_ModelsManager, m_pSettings, this);
m_pCalcSequenceEditor = new CCalculationSequenceEditor(&m_Flowsheet, &m_ModelsManager, this);
m_pMaterialsDatabaseTab = new CMaterialsDatabaseTab(&m_MaterialsDatabase, &m_ModelsManager, m_pSettings, this);
m_pCompoundsManager = new CCompoundsManager(&m_Flowsheet, &m_MaterialsDatabase, &m_ModelsManager, this);
m_pFlowsheetEditor = new CFlowsheetEditor(&m_Flowsheet, &m_MaterialsDatabase, &m_ModelsManager, m_pSettings, this);
m_pGridEditor = new CGridEditor(&m_Flowsheet, m_MaterialsDatabase, &m_ModelsManager, this);
m_pHoldupsEditor = new CHoldupsEditor(&m_Flowsheet, &m_MaterialsDatabase, &m_ModelsManager, this);
m_pOptionsEditor = new COptionsEditor(&m_Flowsheet, &m_MaterialsDatabase, &m_ModelsManager, this);
m_pPhasesEditor = new CPhasesEditor(&m_Flowsheet, &m_ModelsManager, this);
m_pSimulatorTab = new CSimulatorTab(&m_Flowsheet, &m_Simulator, &m_ModelsManager, this);
m_pStreamsViewer = new CStreamsViewer(&m_Flowsheet, &m_MaterialsDatabase, &m_ModelsManager, this);
m_pUnitsViewer = new CUnitsViewer(&m_Flowsheet, &m_MaterialsDatabase, &m_ModelsManager, this);
m_pTearStreamsEditor = new CTearStreamsEditor(&m_Flowsheet, &m_MaterialsDatabase, &m_ModelsManager, this);
m_pDustTesterTab = new CDustFormationTesterTab(&m_Flowsheet, &m_MaterialsDatabase, &m_ModelsManager, this);
m_pSettingsEditor = new CSettingsEditor(m_pSettings, &m_ModelsManager, this);
m_pModelsManagerTab = new CModulesManagerTab(this);
m_pCalcSequenceEditor = new CCalculationSequenceEditor(&m_Flowsheet, this);
m_pMaterialsDatabaseTab = new CMaterialsDatabaseTab(&m_MaterialsDatabase, this);
m_pCompoundsManager = new CCompoundsManager(&m_Flowsheet, &m_MaterialsDatabase, this);
m_pFlowsheetEditor = new CFlowsheetEditor(&m_Flowsheet, &m_MaterialsDatabase, this);
m_pGridEditor = new CGridEditor(&m_Flowsheet, m_MaterialsDatabase, this);
m_pHoldupsEditor = new CHoldupsEditor(&m_Flowsheet, &m_MaterialsDatabase, this);
m_pOptionsEditor = new COptionsEditor(&m_Flowsheet, &m_MaterialsDatabase, this);
m_pPhasesEditor = new CPhasesEditor(&m_Flowsheet, this);
m_pSimulatorTab = new CSimulatorTab(&m_Flowsheet, &m_Simulator, this);
m_pStreamsViewer = new CStreamsViewer(&m_Flowsheet, &m_MaterialsDatabase, this);
m_pUnitsViewer = new CUnitsViewer(&m_Flowsheet, &m_MaterialsDatabase, this);
m_pTearStreamsEditor = new CTearStreamsEditor(&m_Flowsheet, &m_MaterialsDatabase, this);
m_pDustTesterTab = new CDustFormationTesterTab(&m_Flowsheet, &m_MaterialsDatabase, this);
m_pSettingsEditor = new CSettingsEditor(this);

// gather pointers to all dialogs
m_dialogs = { m_pCalcSequenceEditor, m_pMaterialsDatabaseTab, m_pCompoundsManager, m_pFlowsheetEditor,
m_pGridEditor, m_pHoldupsEditor, m_pModelsManagerTab, m_pOptionsEditor, m_pPhasesEditor,
m_pSimulatorTab, m_pStreamsViewer, m_pUnitsViewer, m_pTearStreamsEditor, m_pDustTesterTab,
m_pSettingsEditor };

for (auto* d : m_dialogs)
d->SetPointers(&m_ModelsManager, m_pSettings);

// setup main window: add tabs to mainTabWidget
int tab = ui.mainTabWidget->addTab(m_pFlowsheetEditor, StrConst::Dyssol_FlowsheetTabName);
Expand Down
11 changes: 7 additions & 4 deletions DyssolMainWindow/Dyssol.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* Copyright (c) 2020, Dyssol Development Team. All rights reserved. This file is part of Dyssol. See LICENSE file for license information. */
/* 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

Expand Down Expand Up @@ -38,8 +40,8 @@ class CStatusWindow;
class CMainWindowHelpHelper : public CQtDialog
{
public:
CMainWindowHelpHelper(CModelsManager* _modelsManager, QWidget* _parent = nullptr)
: CQtDialog{ _modelsManager, _parent } {}
explicit CMainWindowHelpHelper(QWidget* _parent = nullptr)
: CQtDialog{ _parent } {}
};

//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -78,6 +80,8 @@ class Dyssol : public QMainWindow
CDustFormationTesterTab* m_pDustTesterTab;
CSettingsEditor* m_pSettingsEditor;

std::vector<CDyssolBaseWidget*> m_dialogs{}; // List of all dialogs for unified access.

QList<QAction*> m_vRecentFilesActions; // list of actions for recent files
bool m_bFlowsheetChanged; // if the flowsheet has been changed after loading

Expand Down Expand Up @@ -140,7 +144,6 @@ private slots:
void LoadingFinished(); // loading process is finished

void ShowAboutDialog(); // open about dialog

void SlotSaveAndReopen();
void SlotRestart();
void SlotClearCache();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* Copyright (c) 2020, Dyssol Development Team. All rights reserved. This file is part of Dyssol. See LICENSE file for license information. */
/* 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. */

#include "CalculationSequenceEditor.h"
#include "Flowsheet.h"
Expand All @@ -7,8 +9,8 @@
#include <QMessageBox>
#include "DyssolStringConstants.h"

CCalculationSequenceEditor::CCalculationSequenceEditor(CFlowsheet* _pFlowsheet, CModelsManager* _modelsManager, QWidget* _parent, Qt::WindowFlags _flags)
: CQtDialog{ _modelsManager, _parent, _flags }
CCalculationSequenceEditor::CCalculationSequenceEditor(CFlowsheet* _pFlowsheet, QWidget* _parent, Qt::WindowFlags _flags)
: CQtDialog{ _parent, _flags }
, m_pFlowsheet{ _pFlowsheet }
, m_pSequence{ _pFlowsheet->GetCalculationSequence() }
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* Copyright (c) 2020, Dyssol Development Team. All rights reserved. This file is part of Dyssol. See LICENSE file for license information. */
/* 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

Expand All @@ -8,7 +10,8 @@
class CCalculationSequence;
class CFlowsheet;

class CCalculationSequenceEditor: public CQtDialog
class CCalculationSequenceEditor
: public CQtDialog
{
Q_OBJECT

Expand All @@ -27,7 +30,7 @@ class CCalculationSequenceEditor: public CQtDialog
CCalculationSequence* m_pSequence; // Pointer to the calculation sequence.

public:
CCalculationSequenceEditor(CFlowsheet* _pFlowsheet, CModelsManager* _modelsManager, QWidget* _parent = nullptr, Qt::WindowFlags _flags = Qt::WindowFlags());
CCalculationSequenceEditor(CFlowsheet* _pFlowsheet, QWidget* _parent = nullptr, Qt::WindowFlags _flags = Qt::WindowFlags());

void InitializeConnections() const;

Expand Down
8 changes: 5 additions & 3 deletions GUIDialogs/CompoundsManager/CompoundsManager.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/* Copyright (c) 2020, Dyssol Development Team. All rights reserved. This file is part of Dyssol. See LICENSE file for license information. */
/* 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. */

#include "CompoundsManager.h"
#include "MaterialsDatabase.h"
#include "Flowsheet.h"

CCompoundsManager::CCompoundsManager(CFlowsheet* _pFlowsheet, CMaterialsDatabase* _pDatabase, CModelsManager* _modelsManager, QWidget* _parent)
: CQtDialog{ _modelsManager, _parent }
CCompoundsManager::CCompoundsManager(CFlowsheet* _pFlowsheet, CMaterialsDatabase* _pDatabase, QWidget* _parent)
: CQtDialog{ _parent }
{
ui.setupUi(this);
m_pFlowsheet = _pFlowsheet;
Expand Down
9 changes: 6 additions & 3 deletions GUIDialogs/CompoundsManager/CompoundsManager.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* Copyright (c) 2020, Dyssol Development Team. All rights reserved. This file is part of Dyssol. See LICENSE file for license information. */
/* 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

Expand All @@ -8,7 +10,8 @@
class CFlowsheet;
class CMaterialsDatabase;

class CCompoundsManager: public CQtDialog
class CCompoundsManager
: public CQtDialog
{
Q_OBJECT
private:
Expand All @@ -29,7 +32,7 @@ public slots:
void accept();

public:
CCompoundsManager(CFlowsheet* _pFlowsheet, CMaterialsDatabase* _pDatabase, CModelsManager* _modelsManager, QWidget* _parent = nullptr);
CCompoundsManager(CFlowsheet* _pFlowsheet, CMaterialsDatabase* _pDatabase, QWidget* _parent = nullptr);

void InitializeConnections();

Expand Down
8 changes: 5 additions & 3 deletions GUIDialogs/DustFormationTesterTab/DustFormationTesterTab.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
/* Copyright (c) 2020, Dyssol Development Team. All rights reserved. This file is part of Dyssol. See LICENSE file for license information. */
/* 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. */

#include "DustFormationTesterTab.h"
#include "Flowsheet.h"
#include "BaseUnit.h"
#include "Stream.h"
#include "MaterialsDatabase.h"

CDustFormationTesterTab::CDustFormationTesterTab(const CFlowsheet* _pFlowsheet, const CMaterialsDatabase* _matrialsDB, CModelsManager* _modelsManager, QWidget *_parent)
: CQtDialog{ _modelsManager, _parent }
CDustFormationTesterTab::CDustFormationTesterTab(const CFlowsheet* _pFlowsheet, const CMaterialsDatabase* _matrialsDB, QWidget *_parent)
: CQtDialog{ _parent }
, m_pFlowsheet{ _pFlowsheet }
, m_matrialsDB{ _matrialsDB }
{
Expand Down
9 changes: 6 additions & 3 deletions GUIDialogs/DustFormationTesterTab/DustFormationTesterTab.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* Copyright (c) 2020, Dyssol Development Team. All rights reserved. This file is part of Dyssol. See LICENSE file for license information. */
/* 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

Expand All @@ -13,7 +15,8 @@ class CStream;
class CHoldup;
class CMaterialsDatabase;

class CDustFormationTesterTab : public CQtDialog
class CDustFormationTesterTab
: public CQtDialog
{
Q_OBJECT
private:
Expand All @@ -24,7 +27,7 @@ class CDustFormationTesterTab : public CQtDialog
enum class EType { STREAMS = 0, UNITS = 1 } m_focusType{ EType::STREAMS };

public:
CDustFormationTesterTab(const CFlowsheet* _pFlowsheet, const CMaterialsDatabase* _matrialsDB, CModelsManager* _modelsManager, QWidget* _parent = nullptr);
CDustFormationTesterTab(const CFlowsheet* _pFlowsheet, const CMaterialsDatabase* _matrialsDB, QWidget* _parent = nullptr);

void InitializeConnections();
void UpdateWholeView();
Expand Down
18 changes: 14 additions & 4 deletions GUIDialogs/FlowsheetEditor/FlowsheetEditor.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* Copyright (c) 2020, Dyssol Development Team. All rights reserved. This file is part of Dyssol. See LICENSE file for license information. */
/* 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. */

#include "FlowsheetEditor.h"
#include "Flowsheet.h"
Expand All @@ -15,16 +17,18 @@
#include <sstream>


CFlowsheetEditor::CFlowsheetEditor(CFlowsheet* _pFlowsheet, const CMaterialsDatabase* _matrialsDB, CModelsManager* _modelsManager, QSettings* _settings, QWidget* _parent)
: CQtDialog{ _modelsManager, _parent }
CFlowsheetEditor::CFlowsheetEditor(CFlowsheet* _pFlowsheet, const CMaterialsDatabase* _matrialsDB, QWidget* _parent)
: CQtDialog{ _parent }
, m_pFlowsheet{ _pFlowsheet }
, m_materialsDB{ _matrialsDB }
, m_pSelectedModel{ nullptr }
, m_pSelectedStream{ nullptr }
, m_viewer{ new CFlowsheetViewer{ _pFlowsheet, _settings } }
, m_viewer{ new CFlowsheetViewer{ _pFlowsheet } }
{
ui.setupUi(this);
ui.tableListValues->EnablePasting(false);
// set focus policy to enable focus to switch back to flowsheet editor
this->setFocusPolicy(Qt::ClickFocus);

SetHelpLink("001_ui/gui.html#sec-gui-tabs-flowsheet");
}
Expand All @@ -34,6 +38,12 @@ CFlowsheetEditor::~CFlowsheetEditor()
delete m_viewer;
}

void CFlowsheetEditor::SetPointers(CModelsManager* _modelsManager, QSettings* _settings)
{
CQtDialog::SetPointers(_modelsManager, _settings);
m_viewer->SetPointers(_modelsManager, _settings);
}

void CFlowsheetEditor::InitializeConnections()
{
connect(ui.buttonAddModel, &QPushButton::clicked, this, &CFlowsheetEditor::AddModel);
Expand Down
10 changes: 7 additions & 3 deletions GUIDialogs/FlowsheetEditor/FlowsheetEditor.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* Copyright (c) 2020, Dyssol Development Team. All rights reserved. This file is part of Dyssol. See LICENSE file for license information. */
/* 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

Expand All @@ -14,7 +16,8 @@ class CUnitParametersManager;
class CFlowsheetViewer;
class QSettings;

class CFlowsheetEditor : public CQtDialog
class CFlowsheetEditor
: public CQtDialog
{
Q_OBJECT

Expand All @@ -27,9 +30,10 @@ class CFlowsheetEditor : public CQtDialog
CFlowsheetViewer* m_viewer; // Flowsheet diagram viewer.

public:
CFlowsheetEditor(CFlowsheet* _pFlowsheet, const CMaterialsDatabase* _matrialsDB, CModelsManager* _modelsManager, QSettings* _settings, QWidget* _parent = nullptr);
CFlowsheetEditor(CFlowsheet* _pFlowsheet, const CMaterialsDatabase* _matrialsDB, QWidget* _parent = nullptr);
~CFlowsheetEditor() override;

void SetPointers(CModelsManager* _modelsManager, QSettings* _settings) override;
void InitializeConnections();

public slots:
Expand Down
31 changes: 19 additions & 12 deletions GUIDialogs/FlowsheetEditor/FlowsheetViewer.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* Copyright (c) 2021, Dyssol Development Team. All rights reserved. This file is part of Dyssol. See LICENSE file for license information. */
/* Copyright (c) 2021, Dyssol Development Team.
* Copyright (c) 2023, DyssolTEC GmbH.
* All rights reserved. This file is part of Dyssol. See LICENSE file for license information. */

#include "FlowsheetViewer.h"
#include "Flowsheet.h"
Expand All @@ -13,25 +15,15 @@

namespace fs = std::filesystem;

CFlowsheetViewer::CFlowsheetViewer(const CFlowsheet* _flowsheet, QSettings* _settings, QWidget* _parent)
CFlowsheetViewer::CFlowsheetViewer(const CFlowsheet* _flowsheet, QWidget* _parent)
: QDialog{ _parent }
, m_settings{ _settings }
, m_flowsheet{ _flowsheet }
{
ui.setupUi(this);
ui.scrollArea->viewport()->setStyleSheet("background-color: white;");
ui.scrollArea->viewport()->installEventFilter(this);
setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint);

// where to temporary store images
const std::filesystem::path cachePath = _settings->value(StrConst::Dyssol_ConfigCachePath).toString().toStdString() + StrConst::Dyssol_CacheDir;
if (!fs::exists(cachePath))
fs::create_directory(cachePath);
const fs::path path = fs::exists(cachePath) ? cachePath : fs::current_path();
m_imageFullName = QString::fromStdU16String((path / (StringFunctions::GenerateRandomKey() + ".png")).u16string());

LoadSettings();
CreateMenu();
InitializeConnections();
}

Expand All @@ -49,6 +41,21 @@ CFlowsheetViewer::~CFlowsheetViewer()
}
}

void CFlowsheetViewer::SetPointers(CModelsManager* _modelsManager, QSettings* _settings)
{
CDyssolBaseWidget::SetPointers(_modelsManager, _settings);

// where to temporary store images
const std::filesystem::path cachePath = m_settings->value(StrConst::Dyssol_ConfigCachePath).toString().toStdString() + StrConst::Dyssol_CacheDir;
if (!fs::exists(cachePath))
fs::create_directory(cachePath);
const fs::path path = fs::exists(cachePath) ? cachePath : fs::current_path();
m_imageFullName = QString::fromStdU16String((path / (StringFunctions::GenerateRandomKey() + ".png")).u16string());

LoadSettings();
CreateMenu();
}

void CFlowsheetViewer::InitializeConnections() const
{
connect(ui.actionSaveAs , &QAction::triggered , this, &CFlowsheetViewer::SaveAs);
Expand Down
Loading

0 comments on commit 6232d8a

Please sign in to comment.