| 1 |
/****************************************************************************** |
| 2 |
This source file is part of the Avogadro project. |
| 3 |
This source code is released under the 3-Clause BSD License, (see "LICENSE"). |
| 4 |
******************************************************************************/ |
| 5 |
|
| 6 |
#include "banddialog.h" |
| 7 |
|
| 8 |
#include "ui_banddialog.h" |
| 9 |
|
| 10 |
#include <QSettings> |
| 11 |
|
| 12 |
namespace Avogadro::QtPlugins { |
| 13 |
|
| 14 |
BandDialog::BandDialog(QWidget* aParent, YaehmopSettings& yaehmopSettings) |
| 15 |
: QDialog(aParent), m_ui(new Ui::BandDialog), |
| 16 |
m_yaehmopSettings(yaehmopSettings) |
| 17 |
{ |
| 18 |
m_ui->setupUi(this); |
| 19 |
} |
| 20 |
|
| 21 |
// Destructor must be defined after Ui::BandDialog has been resovled |
| 22 |
BandDialog::~BandDialog() = default; |
| 23 |
|
| 24 |
int BandDialog::exec() |
| 25 |
{ |
| 26 |
// Load the settings then exec |
| 27 |
m_ui->spin_numKPoints->setValue(m_yaehmopSettings.numBandKPoints); |
| 28 |
m_ui->edit_specialKPoints->setText(m_yaehmopSettings.specialKPoints); |
| 29 |
m_ui->cb_displayYaehmopInput->setChecked( |
| 30 |
m_yaehmopSettings.displayYaehmopInput); |
| 31 |
m_ui->cb_limitY->setChecked(m_yaehmopSettings.limitY); |
| 32 |
m_ui->spin_minY->setValue(m_yaehmopSettings.minY); |
| 33 |
m_ui->spin_maxY->setValue(m_yaehmopSettings.maxY); |
| 34 |
m_ui->cb_plotFermi->setChecked(m_yaehmopSettings.plotFermi); |
| 35 |
m_ui->spin_fermi->setValue(m_yaehmopSettings.fermi); |
| 36 |
m_ui->cb_zeroFermi->setChecked(m_yaehmopSettings.zeroFermi); |
| 37 |
m_ui->spin_numDim->setValue(m_yaehmopSettings.numDim); |
| 38 |
|
| 39 |
return QDialog::exec(); |
| 40 |
} |
| 41 |
|
| 42 |
void BandDialog::accept() |
| 43 |
{ |
| 44 |
// Save the settings and accept |
| 45 |
m_yaehmopSettings.numBandKPoints = m_ui->spin_numKPoints->value(); |
| 46 |
m_yaehmopSettings.specialKPoints = m_ui->edit_specialKPoints->toPlainText(); |
| 47 |
m_yaehmopSettings.displayYaehmopInput = |
| 48 |
m_ui->cb_displayYaehmopInput->isChecked(); |
| 49 |
m_yaehmopSettings.limitY = m_ui->cb_limitY->isChecked(); |
| 50 |
m_yaehmopSettings.minY = m_ui->spin_minY->value(); |
| 51 |
m_yaehmopSettings.maxY = m_ui->spin_maxY->value(); |
| 52 |
m_yaehmopSettings.plotFermi = m_ui->cb_plotFermi->isChecked(); |
| 53 |
m_yaehmopSettings.fermi = m_ui->spin_fermi->value(); |
| 54 |
m_yaehmopSettings.zeroFermi = m_ui->cb_zeroFermi->isChecked(); |
| 55 |
m_yaehmopSettings.numDim = m_ui->spin_numDim->value(); |
| 56 |
|
| 57 |
QDialog::accept(); |
| 58 |
} |
| 59 |
|
| 60 |
} // namespace Avogadro::QtPlugins |