Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize menus - fix #474 #564

Merged
merged 1 commit into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion avogadro/qtplugins/apbs/apbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Apbs::~Apbs()

QStringList Apbs::menuPath(QAction*) const
{
return QStringList() << tr("&Extensions") << tr("&APBS");
return QStringList() << tr("&Input") << tr("&APBS");
}

void Apbs::setMolecule(QtGui::Molecule* mol)
Expand Down
2 changes: 1 addition & 1 deletion avogadro/qtplugins/cp2kinput/cp2kinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ QList<QAction*> Cp2kInput::actions() const
QStringList Cp2kInput::menuPath(QAction*) const
{
QStringList path;
path << tr("&Quantum") << tr("Input Generators");
path << tr("&Input");
return path;
}

Expand Down
2 changes: 1 addition & 1 deletion avogadro/qtplugins/gamessinput/gamessinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ QList<QAction*> GamessInput::actions() const
QStringList GamessInput::menuPath(QAction*) const
{
QStringList path;
path << tr("&Quantum") << tr("Input Generators");
path << tr("&Input");
return path;
}

Expand Down
2 changes: 1 addition & 1 deletion avogadro/qtplugins/lammpsinput/lammpsinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ QList<QAction*> LammpsInput::actions() const
QStringList LammpsInput::menuPath(QAction*) const
{
QStringList path;
path << tr("&Extensions") << tr("Molecular Dynamics");
path << tr("&Input");
return path;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MolecularProperties::MolecularProperties(QObject* parent_)
m_dialog(nullptr), m_molecule(nullptr)
{
m_action->setEnabled(true);
m_action->setText("&Molecular Properties...");
m_action->setText("&Molecular...");
connect(m_action, SIGNAL(triggered()), SLOT(showDialog()));
}

Expand All @@ -50,7 +50,7 @@ QList<QAction*> MolecularProperties::actions() const

QStringList MolecularProperties::menuPath(QAction*) const
{
return QStringList() << tr("&View");
return QStringList() << tr("&Analysis") << tr("&Properties");
}

void MolecularProperties::setMolecule(QtGui::Molecule* mol)
Expand Down
2 changes: 1 addition & 1 deletion avogadro/qtplugins/openmminput/openmminput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ QList<QAction*> OpenMMInput::actions() const
QStringList OpenMMInput::menuPath(QAction*) const
{
QStringList path;
path << tr("&Extensions") << tr("Molecular Dynamics");
path << tr("&Input");
return path;
}

Expand Down
2 changes: 1 addition & 1 deletion avogadro/qtplugins/qtaim/qtaimextension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ QList<QAction*> QTAIMExtension::actions() const

QStringList QTAIMExtension::menuPath(QAction*) const
{
return QStringList() << tr("E&xtensions") << tr("QTAIM");
return QStringList() << tr("&Analysis") << tr("QTAIM");
}

void QTAIMExtension::setMolecule(QtGui::Molecule* molecule)
Expand Down
23 changes: 17 additions & 6 deletions avogadro/qtplugins/quantuminput/quantuminput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ using MoleQueue::InputGenerator;
using MoleQueue::InputGeneratorDialog;
using ::MoleQueue::JobObject;

const int ConfigureAction = -1; // to find the configuration action

QuantumInput::QuantumInput(QObject* parent_)
: ExtensionPlugin(parent_)
, m_molecule(nullptr)
Expand All @@ -69,10 +71,16 @@ QList<QAction*> QuantumInput::actions() const
return m_actions;
}

QStringList QuantumInput::menuPath(QAction*) const
QStringList QuantumInput::menuPath(QAction*action) const
{
QStringList path;
path << tr("&Quantum") << tr("Input Generators");
if (action == nullptr)
return path;

if (action->data() == ConfigureAction)
path << tr("&Extensions");
else
path << tr("&Input");
return path;
}

Expand Down Expand Up @@ -212,10 +220,6 @@ void QuantumInput::updateActions()
{
m_actions.clear();

QAction* action = new QAction(tr("Set Python Path..."), this);
connect(action, SIGNAL(triggered()), SLOT(configurePython()));
m_actions << action;

foreach (const QString& programName, m_inputGeneratorScripts.uniqueKeys()) {
QStringList scripts = m_inputGeneratorScripts.values(programName);
// Include the full path if there are multiple generators with the same
Expand All @@ -228,6 +232,13 @@ void QuantumInput::updateActions()
}
}
}

// Last one is the configuration action
// TODO: set this globally via the app
QAction* action = new QAction(tr("Set Python Path..."), this);
action->setData(ConfigureAction);
connect(action, SIGNAL(triggered()), SLOT(configurePython()));
m_actions << action;
}

void QuantumInput::addAction(const QString& label,
Expand Down
2 changes: 1 addition & 1 deletion avogadro/qtplugins/spectra/spectra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ QList<QAction*> Spectra::actions() const
QStringList Spectra::menuPath(QAction*) const
{
QStringList path;
path << tr("&Quantum");
path << tr("&Analysis");
return path;
}

Expand Down
2 changes: 1 addition & 1 deletion avogadro/qtplugins/surfaces/surfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ QList<QAction*> Surfaces::actions() const
QStringList Surfaces::menuPath(QAction*) const
{
QStringList path;
path << tr("&Extensions");
path << tr("&Analysis");
return path;
}

Expand Down
4 changes: 2 additions & 2 deletions avogadro/qtplugins/symmetry/symmetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Symmetry::Symmetry(QObject* parent_)

m_ctx = msymCreateContext();

m_viewSymmetryAction->setText(tr("Symmetry Properties..."));
m_viewSymmetryAction->setText(tr("Symmetry..."));
connect(m_viewSymmetryAction, SIGNAL(triggered()), SLOT(viewSymmetry()));
m_actions.push_back(m_viewSymmetryAction);
m_viewSymmetryAction->setProperty("menu priority", -50);
Expand Down Expand Up @@ -91,7 +91,7 @@ QList<QAction*> Symmetry::actions() const

QStringList Symmetry::menuPath(QAction*) const
{
return QStringList() << tr("&View");
return QStringList() << tr("&Analysis") << tr("&Properties");
}

void Symmetry::setMolecule(QtGui::Molecule* mol)
Expand Down