Skip to content

Commit

Permalink
Further encapsulation of state into Application class
Browse files Browse the repository at this point in the history
- consolidate and hide step state
- more invocation shims
- move molWidget subwidgets into own classes
  • Loading branch information
sgsaenger committed Dec 3, 2023
1 parent f9814ee commit 3b073bd
Show file tree
Hide file tree
Showing 24 changed files with 1,298 additions and 1,105 deletions.
369 changes: 37 additions & 332 deletions gui/qt/mainwidgets/molwidget.cpp

Large diffs are not rendered by default.

44 changes: 0 additions & 44 deletions gui/qt/mainwidgets/molwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
#include <QItemSelection>
#include "vipster/molecule.h"
#include "../basewidget.h"
#include "molwidget_aux/atommodel.h"
#include "molwidget_aux/bondmodel.h"
#include "molwidget_aux/cellmodel.h"

namespace Ui {
class MolWidget;
Expand All @@ -23,18 +20,6 @@ class MolWidget : public BaseWidget
void updateWidget(Vipster::GUI::change_t change) override;

private slots:
// atom slots
void on_atomFmtBox_currentIndexChanged(int index);
void on_atomFmtButton_clicked();
void atomSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
void on_atomHelpButton_clicked();

// cell slots
void on_cellEnabledBox_toggled(bool checked);
void on_cellFmt_currentIndexChanged(int idx);
void on_cellDimBox_valueChanged(double cdm);
void on_cellTrajecButton_clicked();

// kpoint slots
void on_kFmtButton_clicked();
void on_bands_stateChanged(int);
Expand All @@ -45,47 +30,18 @@ private slots:
void on_discretetable_itemSelectionChanged();
void on_discretetable_cellChanged(int row, int column);

// bond slots
void on_bondSetButton_clicked();
void on_bondHelpButton_clicked();
void on_bondModeBox_currentIndexChanged(int index);
void on_ovlpTable_itemSelectionChanged();

// pte slots
void on_clearTableButton_clicked();
void on_newElemButton_clicked();

private:
void setActiveStep(Vipster::Step &step, Vipster::Step::selection &sel);
void updateStep(Vipster::Step &step);
void updateSelection(Vipster::Step::selection &sel);

void setActiveMol(Vipster::Molecule &mol);

bool scale();
void checkOverlap(void);
void fillCell(void);
void fillKPoints(void);
Ui::MolWidget *ui;
Vipster::Step *curStep;
Vipster::Step::selection *curSel;
std::unique_ptr<Vipster::Step::formatter> ownStep;
Vipster::Molecule* curMol;
AtomModel atomModel{this};
BondModel bondModel{this};
friend class CellModel;
CellModel cellModel{this};
QList<QAction*> headerActions;
int curKPoint{-1};
static constexpr const char* inactiveKpoints[] = {"Gamma", "Monkhorst-Pack grid", "Discrete"};
static constexpr const char* activeKpoints[] = {"Gamma (active)",
"Monkhorst-Pack grid (active)",
"Discrete (active)"};
static constexpr const char* inactiveFmt[] = { "Crystal", "Alat", "Angstrom", "Bohr" };
static constexpr const char* activeFmt[] = {"Crystal (active)",
"Alat (active)",
"Angstrom (active)",
"Bohr (active)"};
};

#endif // MOLWIDGET_H
Loading

0 comments on commit 3b073bd

Please sign in to comment.