-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ad451c
commit a38d07d
Showing
9 changed files
with
173 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,25 @@ | ||
#ifndef __VTX_TOOL_TOOLS_MDPREP__ | ||
#define __VTX_TOOL_TOOLS_MDPREP__ | ||
|
||
#include <memory> | ||
|
||
namespace VTX::Tool::Mdprep | ||
{ | ||
// Designed to be the self-contained window that allow the user to use the MDprep tool | ||
class MainWindow | ||
{ | ||
public: | ||
MainWindow(); | ||
|
||
void show() noexcept; | ||
|
||
private: | ||
class _impl; | ||
struct Del | ||
{ | ||
void operator()( _impl * ) noexcept; | ||
}; | ||
std::unique_ptr<_impl, Del> _pimpl = nullptr; | ||
}; | ||
} // namespace VTX::Tool::Mdprep | ||
#endif |
20 changes: 20 additions & 0 deletions
20
lib/tool/tools/mdprep/include/tools/mdprep/ui/main_window.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef __VTX_TOOL_TOOLS_MDPREP_UI_MAINWINDOW__ | ||
#define __VTX_TOOL_TOOLS_MDPREP_UI_MAINWINDOW__ | ||
|
||
#include <array> | ||
#include <string> | ||
|
||
namespace VTX::Tool::Mdprep::ui | ||
{ | ||
enum class E_MD_ENGINE | ||
{ | ||
gromacs, | ||
COUNT | ||
}; | ||
constexpr const size_t MD_ENGINE_NUMBER = static_cast<size_t>( E_MD_ENGINE::COUNT ); | ||
constexpr const char * string( const E_MD_ENGINE & ) noexcept; | ||
|
||
const std::array<const char *, MD_ENGINE_NUMBER> & mdEngineStrings(); | ||
} // namespace VTX::Tool::Mdprep::ui | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,81 @@ | ||
#include "tools/mdprep/mdprep.hpp" | ||
#include "tools/mdprep/ui/main_window.hpp" | ||
#include <qcombobox.h> | ||
#include <qformlayout.h> | ||
#include <qlineedit.h> | ||
#include <ui/qt/application_qt.hpp> | ||
#include <ui/qt/main_window.hpp> | ||
#include <util/logger.hpp> | ||
|
||
namespace VTX::QT::Mdprep | ||
{ | ||
class MainWindow : public UI::QT::QtDockablePanel | ||
{ | ||
private: | ||
inline static const QSize PREFERRED_SIZE { 640, 720 }; | ||
virtual void _setupUi( const QString & p_name ) | ||
{ | ||
auto _t = p_name.toLatin1(); | ||
std::string v( _t.begin(), _t.end() ); | ||
VTX::VTX_INFO( "info from Mdprep::MainWindow::_setupUi : <{}>", v ); | ||
QWidget * const mainWidget = _instantiateMainWidget( PREFERRED_SIZE, PREFERRED_SIZE ); | ||
|
||
UI::QT::QtDockablePanel::_setupUi( p_name ); | ||
|
||
this->setWindowTitle( "Molecular Dynamics Preparation" ); | ||
|
||
setWindowState( Qt::WindowState::WindowActive ); | ||
const QSize winsize = QSize( 640, 720 ); | ||
resize( winsize ); | ||
|
||
QVBoxLayout * windowLayout = new QVBoxLayout( mainWidget ); | ||
windowLayout->setContentsMargins( 0, 0, 0, 0 ); | ||
|
||
QComboBox * engineList = new QComboBox; | ||
for ( auto & it : VTX::Tool::Mdprep::ui::mdEngineStrings() ) | ||
engineList->addItem( QString( it ) ); | ||
|
||
QWidget * mainContainer = new QWidget( this ); | ||
mainContainer->setStyleSheet( "border: 1px solid red" ); | ||
mainContainer->setSizePolicy( QSizePolicy( QSizePolicy ::Expanding, QSizePolicy ::Expanding ) ); | ||
windowLayout->addWidget( mainContainer, 1 ); | ||
QHBoxLayout * hLayout = new QHBoxLayout( mainContainer ); | ||
|
||
auto layoutToAddThoseTextboxTo = hLayout; | ||
|
||
QLineEdit * textbox = new QLineEdit(); | ||
textbox->setText( "textbox" ); | ||
// QFormLayout * layout = new QFormLayout( this ); | ||
// layout->addRow( tr( "&Textbox:" ), textbox ); | ||
// layout->addRow( tr( "&Textbox2:" ), textbox2 ); | ||
// hLayout->addLayout( layout ); | ||
layoutToAddThoseTextboxTo->addWidget( engineList, 1 ); | ||
layoutToAddThoseTextboxTo->addWidget( textbox, 1 ); | ||
} | ||
virtual void _setupSlots() { VTX::VTX_INFO( "info from Mdprep::MainWindow::_setupSlots" ); } | ||
|
||
public: | ||
MainWindow( QWidget * const p_parent = nullptr ) : UI::QT::QtDockablePanel( p_parent ) | ||
{ | ||
_setupUi( "Is this parameter useful ?" ); | ||
} | ||
}; | ||
} // namespace VTX::QT::Mdprep | ||
|
||
namespace VTX::Tool::Mdprep | ||
{ | ||
|
||
class MainWindow::_impl | ||
{ | ||
VTX::QT::Mdprep::MainWindow _win { &VTX::UI::QT::QT_APP()->getMainWindow() }; | ||
|
||
public: | ||
_impl() {} | ||
void show() noexcept { _win.show(); } | ||
}; | ||
MainWindow::MainWindow() : _pimpl( new MainWindow::_impl() ) {} | ||
|
||
// Assumes pimpl is always valid ptr | ||
void MainWindow::show() noexcept { _pimpl->show(); } | ||
void MainWindow::Del::operator()( _impl * p_ ) noexcept { delete p_; } | ||
} // namespace VTX::Tool::Mdprep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "tools/mdprep/ui/main_window.hpp" | ||
|
||
namespace VTX::Tool::Mdprep::ui | ||
{ | ||
constexpr const char * string( const E_MD_ENGINE & p_ ) noexcept | ||
{ | ||
switch ( p_ ) | ||
{ | ||
case E_MD_ENGINE::gromacs: return { "Gromacs" }; | ||
default: break; | ||
} | ||
return "Please provide a user string for the MD engine"; // For developers that add new MD Engine support | ||
} | ||
namespace | ||
{ | ||
constexpr std::array<const char *, MD_ENGINE_NUMBER> createMdEngineStringList() | ||
{ | ||
std::array<const char *, MD_ENGINE_NUMBER> out; | ||
for ( int i = 0; i < MD_ENGINE_NUMBER; i++ ) | ||
{ | ||
out[ i ] = string( static_cast<E_MD_ENGINE>( i ) ); | ||
} | ||
return out; | ||
} | ||
} // namespace | ||
constexpr const std::array<const char *, MD_ENGINE_NUMBER> g_mdEngineStrings = createMdEngineStringList(); | ||
|
||
const std::array<const char *, MD_ENGINE_NUMBER> & mdEngineStrings() { return g_mdEngineStrings; } | ||
} // namespace VTX::Tool::Mdprep::ui |