diff --git a/avogadro/qtplugins/yaehmop/banddialog.cpp b/avogadro/qtplugins/yaehmop/banddialog.cpp index e8a9d9bd08..3bbfad3d8e 100644 --- a/avogadro/qtplugins/yaehmop/banddialog.cpp +++ b/avogadro/qtplugins/yaehmop/banddialog.cpp @@ -4,12 +4,12 @@ ******************************************************************************/ #include "banddialog.h" + #include "ui_banddialog.h" #include -namespace Avogadro { -namespace QtPlugins { +namespace Avogadro::QtPlugins { BandDialog::BandDialog(QWidget* aParent, YaehmopSettings& yaehmopSettings) : QDialog(aParent), m_ui(new Ui::BandDialog), @@ -18,6 +18,9 @@ BandDialog::BandDialog(QWidget* aParent, YaehmopSettings& yaehmopSettings) m_ui->setupUi(this); } +// Destructor must be defined after Ui::BandDialog has been resovled +BandDialog::~BandDialog() = default; + int BandDialog::exec() { // Load the settings then exec @@ -54,5 +57,4 @@ void BandDialog::accept() QDialog::accept(); } -} // namespace QtPlugins -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/yaehmop/banddialog.h b/avogadro/qtplugins/yaehmop/banddialog.h index 684f8e37d7..8ed7c76b77 100644 --- a/avogadro/qtplugins/yaehmop/banddialog.h +++ b/avogadro/qtplugins/yaehmop/banddialog.h @@ -6,14 +6,13 @@ #ifndef AVOGADRO_QTPLUGINS_YAEHMOPBANDDIALOG_H #define AVOGADRO_QTPLUGINS_YAEHMOPBANDDIALOG_H -#include +#include "yaehmopsettings.h" #include -#include "yaehmopsettings.h" +#include -namespace Avogadro { -namespace QtPlugins { +namespace Avogadro::QtPlugins { namespace Ui { class BandDialog; @@ -28,7 +27,7 @@ class BandDialog : public QDialog public: explicit BandDialog(QWidget* parent, YaehmopSettings& yaehmopSettings); - ~BandDialog() = default; + ~BandDialog(); public slots: int exec() override; @@ -41,6 +40,6 @@ protected slots: YaehmopSettings& m_yaehmopSettings; }; -} // namespace QtPlugins -} // namespace Avogadro +} // namespace Avogadro::QtPlugins + #endif // AVOGADRO_QTPLUGINS_YAEHMOPBANDDIALOG_H diff --git a/avogadro/qtplugins/yaehmop/specialkpointsdata.h b/avogadro/qtplugins/yaehmop/specialkpointsdata.h index cdd6d6d719..63abb7aa1c 100644 --- a/avogadro/qtplugins/yaehmop/specialkpointsdata.h +++ b/avogadro/qtplugins/yaehmop/specialkpointsdata.h @@ -6,8 +6,7 @@ #ifndef AVOGADRO_QTPLUGINS_YAEHMOP_SPECIALKPOINTSDATA_H #define AVOGADRO_QTPLUGINS_YAEHMOP_SPECIALKPOINTSDATA_H -namespace Avogadro { -namespace QtPlugins { +namespace Avogadro::QtPlugins { // There are 230 of these (not including the first value, which is null) // One point for each space group. @@ -392,7 +391,6 @@ const char* special_k_points[] = { "GM 0 0 0,H 0.5 -0.5 0.5,P 0.25 0.25 0.25,N 0 0 0.5" // 230 }; -} // namespace QtPlugins -} // namespace Avogadro +} // namespace Avogadro::QtPlugins #endif diff --git a/avogadro/qtplugins/yaehmop/yaehmop.cpp b/avogadro/qtplugins/yaehmop/yaehmop.cpp index c48278e46f..6eb16bb84f 100644 --- a/avogadro/qtplugins/yaehmop/yaehmop.cpp +++ b/avogadro/qtplugins/yaehmop/yaehmop.cpp @@ -3,6 +3,20 @@ This source code is released under the 3-Clause BSD License, (see "LICENSE"). ******************************************************************************/ +#include "yaehmop.h" + +#include "banddialog.h" +#include "specialkpoints.h" +#include "yaehmopout.h" + +#include +#include +#include +#include +#include +#include +#include + #include #include #include @@ -17,20 +31,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include - -#include "banddialog.h" -#include "specialkpoints.h" -#include "yaehmopout.h" - -#include "yaehmop.h" - using Avogadro::Vector3; using Avogadro::Vector3i; using Avogadro::Core::Array; @@ -38,8 +38,7 @@ using Avogadro::Core::Elements; using Avogadro::Core::UnitCell; using Avogadro::QtGui::Molecule; -namespace Avogadro { -namespace QtPlugins { +namespace Avogadro::QtPlugins { Yaehmop::Yaehmop(QObject* parent_) : Avogadro::QtGui::ExtensionPlugin(parent_), m_actions(QList()), @@ -132,7 +131,7 @@ void Yaehmop::moleculeChanged(unsigned int c) { Q_ASSERT(m_molecule == qobject_cast(sender())); - Molecule::MoleculeChanges changes = static_cast(c); + auto changes = static_cast(c); if (changes & Molecule::UnitCell) { if (changes & Molecule::Added || changes & Molecule::Removed) @@ -586,15 +585,15 @@ bool Yaehmop::executeYaehmop(const QByteArray& input, QByteArray& output, void Yaehmop::showYaehmopInput(const QString& input) { - QDialog* dialog = new QDialog(qobject_cast(this->parent())); + auto* dialog = new QDialog(qobject_cast(this->parent())); // Make sure this gets deleted upon closing dialog->setAttribute(Qt::WA_DeleteOnClose); - QVBoxLayout* layout = new QVBoxLayout(dialog); + auto* layout = new QVBoxLayout(dialog); dialog->setLayout(layout); dialog->setWindowTitle(tr("Yaehmop Input")); - QTextEdit* edit = new QTextEdit(dialog); + auto* edit = new QTextEdit(dialog); layout->addWidget(edit); dialog->resize(500, 500); @@ -603,5 +602,4 @@ void Yaehmop::showYaehmopInput(const QString& input) dialog->show(); } -} // namespace QtPlugins -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/yaehmop/yaehmop.h b/avogadro/qtplugins/yaehmop/yaehmop.h index 3782ae8f95..6256377f2b 100644 --- a/avogadro/qtplugins/yaehmop/yaehmop.h +++ b/avogadro/qtplugins/yaehmop/yaehmop.h @@ -6,14 +6,15 @@ #ifndef AVOGADRO_QTPLUGINS_YAEHMOP_H #define AVOGADRO_QTPLUGINS_YAEHMOP_H +#include "banddialog.h" +#include "yaehmopsettings.h" + #include #include #include -#include "yaehmopsettings.h" - // Forward declarations class QByteArray; @@ -21,10 +22,7 @@ namespace VTK { class ChartDialog; } -namespace Avogadro { -namespace QtPlugins { - -class BandDialog; +namespace Avogadro::QtPlugins { /** * @brief Perform extended Hückel calculations with yaehmop. @@ -36,13 +34,13 @@ class Yaehmop : public Avogadro::QtGui::ExtensionPlugin explicit Yaehmop(QObject* parent_ = nullptr); ~Yaehmop(); - QString name() const { return tr("Yaehmop"); } - QString description() const; - QList actions() const; - QStringList menuPath(QAction*) const; + QString name() const override { return tr("Yaehmop"); } + QString description() const override; + QList actions() const override; + QStringList menuPath(QAction*) const override; public slots: - void setMolecule(QtGui::Molecule* mol); + void setMolecule(QtGui::Molecule* mol) override; void moleculeChanged(unsigned int changes); @@ -88,7 +86,6 @@ inline QString Yaehmop::description() const return tr("Perform extended Hückel calculations with yaehmop."); } -} // namespace QtPlugins -} // namespace Avogadro +} // namespace Avogadro::QtPlugins #endif // AVOGADRO_QTPLUGINS_YAEHMOPEXTENSION_H diff --git a/avogadro/qtplugins/yaehmop/yaehmopout.cpp b/avogadro/qtplugins/yaehmop/yaehmopout.cpp index 1eacfa2fe4..48c3171263 100644 --- a/avogadro/qtplugins/yaehmop/yaehmopout.cpp +++ b/avogadro/qtplugins/yaehmop/yaehmopout.cpp @@ -5,15 +5,14 @@ #include "yaehmopout.h" +#include + #include #include #include #include -#include - -namespace Avogadro { -namespace QtPlugins { +namespace Avogadro::QtPlugins { inline bool printAndReturnFalse(const QString& error) { @@ -134,5 +133,4 @@ bool YaehmopOut::readBandData(const QString& data, return true; } -} // namespace QtPlugins -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/yaehmop/yaehmopout.h b/avogadro/qtplugins/yaehmop/yaehmopout.h index 0e26440dbb..87ce2b25ec 100644 --- a/avogadro/qtplugins/yaehmop/yaehmopout.h +++ b/avogadro/qtplugins/yaehmop/yaehmopout.h @@ -11,14 +11,13 @@ #include -namespace Avogadro { -namespace QtPlugins { +namespace Avogadro::QtPlugins { -typedef struct +using specialKPoint = struct { QString label; Vector3 coords; -} specialKPoint; +}; // Static class for Yaehmop output class YaehmopOut @@ -34,7 +33,6 @@ class YaehmopOut QVector& specialKPoints); }; -} // namespace QtPlugins -} // namespace Avogadro +} // namespace Avogadro::QtPlugins #endif // AVOGADRO_QTPLUGINS_YAEHMOPOUT_H diff --git a/avogadro/qtplugins/yaehmop/yaehmopsettings.h b/avogadro/qtplugins/yaehmop/yaehmopsettings.h index b2de520eb9..991fb8d68e 100644 --- a/avogadro/qtplugins/yaehmop/yaehmopsettings.h +++ b/avogadro/qtplugins/yaehmop/yaehmopsettings.h @@ -8,8 +8,7 @@ #include -namespace Avogadro { -namespace QtPlugins { +namespace Avogadro::QtPlugins { static const char* YAEHMOP_DEFAULT_SPECIAL_KPOINTS = "GM 0 0 0"; @@ -32,6 +31,6 @@ struct YaehmopSettings unsigned short numDim; }; -} // namespace QtPlugins -} // namespace Avogadro +} // namespace Avogadro::QtPlugins + #endif // AVOGADRO_QTPLUGINS_YAEHMOPSETTINGS_H diff --git a/tests/core/elementtest.cpp b/tests/core/elementtest.cpp index f0eb76114a..6f06f4920a 100644 --- a/tests/core/elementtest.cpp +++ b/tests/core/elementtest.cpp @@ -16,6 +16,7 @@ #include +#include #include #include