Skip to content

Commit

Permalink
Refacto widgets/tools wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sguionni committed Jun 11, 2024
1 parent e81d914 commit 5fcefc5
Show file tree
Hide file tree
Showing 41 changed files with 62,963 additions and 183 deletions.
62,846 changes: 62,846 additions & 0 deletions data/md_0_1.gro

Large diffs are not rendered by default.

16 changes: 0 additions & 16 deletions lib/core/include/core/chemdb/unknown_residue_data.hpp

This file was deleted.

35 changes: 3 additions & 32 deletions lib/io/src/io/reader/molecule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,37 +99,7 @@ namespace VTX::IO::Reader
p_molecule.residueOriginalIds[ residueIdx ] = residueId;

const ChemDB::Residue::SYMBOL residueSymbol = VTX::Core::ChemDB::Residue::getSymbolFromName( residueName );

// TODO: delete?
// int symbolValue;

// if ( residueSymbol == ChemDB::Residue::SYMBOL::UNKNOWN )
//{
// const int symbolIndex = 0;
// // int symbolIndex = p_molecule.getUnknownResidueSymbolIndex( residueSymbol );
// // VTX::Core::ChemDB::UnknownResidueData * unknownResidueData;

// // if ( symbolIndex >= 0 )
// //{
// // unknownResidueData = p_molecule.getUnknownResidueSymbol( symbolIndex );
// // }
// // else
// //{
// // unknownResidueData = new VTX::Core::ChemDB::UnknownResidueData();
// // unknownResidueData->symbolStr = residueSymbol;
// // unknownResidueData->symbolName = Util::App::Molecule::getResidueFullName( residueSymbol );

// // symbolIndex = p_molecule.addUnknownResidueSymbol( unknownResidueData );
// //}

// symbolValue = int( ChemDB::Residue::SYMBOL::COUNT ) + symbolIndex;
//}
// else
//{
// symbolValue = int( residueSymbol );
//}

p_molecule.residueSymbols[ residueIdx ] = residueSymbol;
p_molecule.residueSymbols[ residueIdx ] = residueSymbol;
if ( residueSymbol == ChemDB::Residue::SYMBOL::UNKNOWN )
{
p_molecule.residueUnknownNames[ residueIdx ] = residueName;
Expand Down Expand Up @@ -174,6 +144,7 @@ namespace VTX::IO::Reader
modelFrame[ atomIndex ] = p_chemfileStruct.getCurrentAtomPosition();
}

// TODO: Useless?
//// Check residue full of solvent/ion.
//// This is working only with pdb/psf files,
//// not with arc/prm because arc do not contains topology.
Expand Down Expand Up @@ -357,7 +328,7 @@ namespace VTX::IO::Reader
if ( p_fileExtension == "pdb" || p_fileExtension == "mmcif" || p_fileExtension == "mmtf" )
{
// TODO : Move that in Core::ChemDB
// res = Util::App::Old::Molecule::getResidueCategory( p_residueSymbol );
// auto res = Util::App::Old::Molecule::getResidueCategory( p_residueSymbol );
res = VTX::Core::ChemDB::Category::TYPE::POLYMER;
}
else
Expand Down
4 changes: 3 additions & 1 deletion lib/io/src/io/reader/residue_data_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
#include "io/internal/filesystem.hpp"
#include "io/struct/bond_data.hpp"
#include <util/filesystem.hpp>
#include <util/logger.hpp>

namespace VTX::IO::Reader
{
bool ResidueDataReader::readResidueData( const std::string & p_residueSymbol, Struct::ResidueData & p_residueData )
{
const FilePath filepath = Internal::Filesystem::getResidueDataFilePath( p_residueSymbol );

if ( !std::filesystem::exists( filepath ) )
if ( not std::filesystem::exists( filepath ) )
{
VTX_WARNING( "Residue data file not found: {}", filepath.string() );
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/renderer/include/renderer/renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ namespace VTX::Renderer
bool showRibbons = true;
bool showVoxels = false;

bool forceUpdate = true;
bool forceUpdate = false;
bool logDurations = false;

static const size_t BUFFER_COUNT = 2;
Expand Down
File renamed without changes.
Empty file removed lib/tool/include/tool/blank.hpp
Empty file.
File renamed without changes.
File renamed without changes.
51 changes: 51 additions & 0 deletions lib/tool/include/tool/core/layout_descriptor.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ifndef __VTX_UI_CORE_LAYOUT_DESCRIPTOR__
#define __VTX_UI_CORE_LAYOUT_DESCRIPTOR__

#include <string>
#include <vector>

namespace VTX::UI::Core
{
using ToolIdentifier = std::string;
inline static const ToolIdentifier UNKNOWN_TOOL_IDENTIFIER = "";

class ToolLayoutData
{
public:
std::string tabName;
std::string blockName;

std::string contextualMenuName;
};

class ToolDescriptor
{
public:
ToolDescriptor();
ToolDescriptor( const ToolIdentifier & p_identifier );
ToolDescriptor( const ToolIdentifier & p_identifier, const ToolLayoutData p_layoutData );

const ToolIdentifier & getIdentifier() const { return _identifier; }
const ToolLayoutData & getLayoutData() const { return _layoutData; }

void setIdentifier( const ToolIdentifier & p_identifier ) { _identifier = p_identifier; }
void setToolLayoutData( const ToolLayoutData & p_layoutData ) { _layoutData = p_layoutData; }

private:
ToolIdentifier _identifier;
ToolLayoutData _layoutData = ToolLayoutData();
};

class LayoutDescriptor
{
public:
void addTool( const ToolDescriptor & p_toolDescriptor );
const std::vector<ToolDescriptor> & getTools() const { return _tools; };

private:
std::vector<ToolDescriptor> _tools;
};

} // namespace VTX::UI::Core

#endif
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions lib/tool/include/tool/qt/base_qt_widget.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef __VTX_UI_QT_BASE_QT_TOOL__
#define __VTX_UI_QT_BASE_QT_TOOL__

#include "ui/core/base_ui_tool.hpp"
#include <QObject>

namespace VTX::UI::QT
{
class BaseQtTool : public VTX::UI::Core::BaseVTXUITool, public QObject
{
public:
BaseQtTool();
};
} // namespace VTX::UI::QT

#endif
Empty file removed lib/tool/src/tool/blank.cpp
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 4 additions & 2 deletions lib/ui/include/ui/core/layout_descriptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

namespace VTX::UI::Core
{
using ToolIdentifier = std::string;
inline static const ToolIdentifier UNKNOWN_TOOL_IDENTIFIER = "";
// using ToolIdentifier = std::string;
// inline static const ToolIdentifier UNKNOWN_TOOL_IDENTIFIER = "";

class ToolLayoutData
{
Expand All @@ -18,6 +18,7 @@ namespace VTX::UI::Core
std::string contextualMenuName;
};

/*
class ToolDescriptor
{
public:
Expand Down Expand Up @@ -45,6 +46,7 @@ namespace VTX::UI::Core
private:
std::vector<ToolDescriptor> _tools;
};
*/

} // namespace VTX::UI::Core

Expand Down
14 changes: 2 additions & 12 deletions lib/ui/include/ui/qt/widget/console_widget.hpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
#ifndef __VTX_UI_TOOL_CONSOLE_WINDOW__
#define __VTX_UI_TOOL_CONSOLE_WINDOW__

#include "ui/core/tool_registry.hpp"
#include "ui/qt/base_qt_widget.hpp"
#include <string>

namespace VTX::UI::QT::Widget
{
class ConsoleWidget : public BaseQtTool
class ConsoleWidget
{
public:
inline static const UI::Core::ToolIdentifier TOOL_KEY = "CONSOLE_TOOL_KEY";
inline static const std::string CONSOLE_PANEL_KEY = "CONSOLE_TOOL_KEY";

private:
inline static const UI::Core::ToolRegistry::Registration<ConsoleWidget> _reg { TOOL_KEY };

public:
inline static const std::string CONSOLE_PANEL_KEY = "CONSOLE_PANEL_KEY";

public:
ConsoleWidget();
void instantiateTool() override;
};
} // namespace VTX::UI::QT::Widget

Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
#ifndef __VTX_UI_QT_TOOL_MISCELLANEOUS_ORIENT_ON_FIRST_MOLECULE_LOADED__
#define __VTX_UI_QT_TOOL_MISCELLANEOUS_ORIENT_ON_FIRST_MOLECULE_LOADED__

#include "ui/core/tool_registry.hpp"
#include "ui/qt/base_qt_widget.hpp"
#include <app/component/scene/scene_item_component.hpp>

namespace VTX::UI::QT::Widget::Miscellaneous
{
class OrientOnFirstMoleculeLoadedTool : public BaseQtTool
class OrientOnFirstMoleculeLoadedTool
{
public:
inline static const UI::Core::ToolIdentifier TOOL_KEY = "MISCELLANEOUS_ORIENT_ON_FIRST_MOLECULE_LOADED";

private:
inline static const UI::Core::ToolRegistry::Registration<OrientOnFirstMoleculeLoadedTool> _reg { TOOL_KEY };

public:
OrientOnFirstMoleculeLoadedTool();
void instantiateTool() override;

private:
void _onItemAddedInScene( const App::Component::Scene::SceneItemComponent & p_item ) const;
};
} // namespace VTX::UI::QT::Widget::Miscellaneous

Expand Down
12 changes: 1 addition & 11 deletions lib/ui/include/ui/qt/widget/pytx_widget.hpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
#ifndef __VTX_UI_TOOL_PYTX_TOOL__
#define __VTX_UI_TOOL_PYTX_TOOL__

#include "ui/core/tool_registry.hpp"
#include "ui/qt/base_qt_widget.hpp"

namespace VTX::UI::QT::Widget
{
class PyTXWidget : public BaseQtTool
class PyTXWidget
{
public:
inline static const UI::Core::ToolIdentifier TOOL_KEY = "PYTX_TOOL_KEY";

private:
inline static const UI::Core::ToolRegistry::Registration<PyTXWidget> _reg { TOOL_KEY };

public:
PyTXWidget();
void instantiateTool() override;
};
} // namespace VTX::UI::QT::Widget

Expand Down
13 changes: 1 addition & 12 deletions lib/ui/include/ui/qt/widget/renderer_widget.hpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
#ifndef __VTX_UI_TOOL_DEFAULT_RENDER_WINDOW__
#define __VTX_UI_TOOL_DEFAULT_RENDER_WINDOW__

#include "ui/core/tool_registry.hpp"
#include "ui/qt/base_qt_widget.hpp"

namespace VTX::UI::QT::Widget
{
class RendererWidget : public BaseQtTool
class RendererWidget
{
public:
inline static const UI::Core::ToolIdentifier TOOL_KEY = "RENDER_WINDOW_KEY";

private:
inline static const UI::Core::ToolRegistry::Registration<RendererWidget> _reg { TOOL_KEY };

public:
RendererWidget();

void instantiateTool() override;

private:
void _setupContextualMenu() const;
};
Expand Down
16 changes: 1 addition & 15 deletions lib/ui/include/ui/qt/widget/scene_widget.hpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
#ifndef __VTX_UI_TOOL_SCENE_WINDOW__
#define __VTX_UI_TOOL_SCENE_WINDOW__

#include "ui/core/tool_registry.hpp"
#include "ui/qt/base_qt_widget.hpp"
#include <string>

namespace VTX::UI::QT::Widget
{
class SceneWidget : public BaseQtTool
class SceneWidget
{
public:
inline static const UI::Core::ToolIdentifier TOOL_KEY = "SCENE_TOOL_KEY";

private:
inline static const UI::Core::ToolRegistry::Registration<SceneWidget> _reg { TOOL_KEY };

public:
inline static const std::string SCENE_PANEL_KEY = "SCENE_PANEL_KEY";

public:
SceneWidget();
void instantiateTool() override;
};
} // namespace VTX::UI::QT::Widget

Expand Down
12 changes: 2 additions & 10 deletions lib/ui/include/ui/qt/widget/ui_features/quit.hpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
#ifndef __VTX_UI_QT_TOOL_UI_FEATURES_QUIT__
#define __VTX_UI_QT_TOOL_UI_FEATURES_QUIT__

#include "ui/core/tool_registry.hpp"
#include "ui/qt/base_qt_widget.hpp"
#include <QObject>

namespace VTX::UI::QT::Widget::UIFeatures
{
class QuitTool : public BaseQtTool
class QuitTool : public QObject
{
public:
inline static const UI::Core::ToolIdentifier TOOL_KEY = "UI_FEATURE_QUIT";

private:
inline static const UI::Core::ToolRegistry::Registration<QuitTool> _reg { TOOL_KEY };

public:
QuitTool();
void instantiateTool() override;

private:
void _addButtonsInMainMenu();
Expand Down
12 changes: 2 additions & 10 deletions lib/ui/include/ui/qt/widget/ui_features/visualization.hpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
#ifndef __VTX_UI_QT_TOOL_UI_FEATURES_VISUALIZATION__
#define __VTX_UI_QT_TOOL_UI_FEATURES_VISUALIZATION__

#include "ui/core/tool_registry.hpp"
#include "ui/qt/base_qt_widget.hpp"
#include <QObject>

namespace VTX::UI::QT::Widget::UIFeatures
{
class VisualizationTool : public BaseQtTool
class VisualizationTool : public QObject
{
public:
inline static const UI::Core::ToolIdentifier TOOL_KEY = "UI_FEATURE_VISUALIZATION";

private:
inline static const UI::Core::ToolRegistry::Registration<VisualizationTool> _reg { TOOL_KEY };

public:
VisualizationTool();
void instantiateTool() override;

private:
void _addButtonsInMainMenu();
Expand Down
Loading

0 comments on commit 5fcefc5

Please sign in to comment.