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

Fix some Edit and Build menu priorities #1078

Merged
merged 1 commit into from
Aug 13, 2022
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
3 changes: 3 additions & 0 deletions avogadro/qtplugins/bonding/bonding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ Bonding::Bonding(QObject* parent_)
m_minDistance = settings.value("bonding/minDistance", 0.32).toDouble();

m_action->setShortcut(QKeySequence("Ctrl+B"));
m_action->setProperty("menu priority", 750);
m_clearAction->setProperty("menu priority", 740);

connect(m_action, SIGNAL(triggered()), SLOT(bond()));
connect(m_clearAction, SIGNAL(triggered()), SLOT(clearBonds()));
connect(m_configAction, SIGNAL(triggered()), SLOT(configure()));
Expand Down
9 changes: 6 additions & 3 deletions avogadro/qtplugins/centroid/centroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ Centroid::Centroid(QObject* parent_)
m_centroidAction(new QAction(tr("Add Centroid"), this)),
m_comAction(new QAction(tr("Add Center of Mass"), this)),
m_normalAction(new QAction(
tr("Add Normal", "add a point normal to the plane of the molecule"),
tr("Add Perpendicular", "add a point normal to the plane of the molecule"),
this))
{
m_centroidAction->setProperty("menu priority", 190);
m_comAction->setProperty("menu priority", 180);
m_normalAction->setProperty("menu priority", 170);

connect(m_centroidAction, SIGNAL(triggered()), SLOT(addCentroid()));
connect(m_comAction, SIGNAL(triggered()), SLOT(addCenterOfMass()));
connect(m_normalAction, SIGNAL(triggered()), SLOT(normal()));
Expand All @@ -33,8 +37,7 @@ Centroid::~Centroid() {}
QList<QAction*> Centroid::actions() const
{
QList<QAction*> result;
return result << m_centroidAction << m_comAction;
// << m_normal;
return result << m_centroidAction << m_comAction << m_normalAction;
}

QStringList Centroid::menuPath(QAction*) const
Expand Down
1 change: 1 addition & 0 deletions avogadro/qtplugins/coordinateeditor/coordinateeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ CoordinateEditor::CoordinateEditor(QObject* parent_)
m_molecule(nullptr),
m_action(new QAction(tr("Atomic &Coordinate Editor…"), this))
{
m_action->setProperty("menu priority", 900);
connect(m_action, SIGNAL(triggered()), SLOT(triggered()));
}

Expand Down
12 changes: 8 additions & 4 deletions avogadro/qtplugins/copypaste/copypaste.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,24 @@ CopyPaste::CopyPaste(QObject* parent_)
m_clearAction(new QAction(tr("Clear"), this)),
m_pasteAction(new QAction(tr("Paste"), this))
{
m_copyAction->setShortcut(QKeySequence::Copy);
m_copyAction->setIcon(QIcon::fromTheme("edit-copy"));
connect(m_copyAction, SIGNAL(triggered()), SLOT(copy()));

m_cutAction->setShortcut(QKeySequence::Cut);
m_cutAction->setIcon(QIcon::fromTheme("edit-cut"));
m_cutAction->setProperty("menu priority", 550);
connect(m_cutAction, SIGNAL(triggered()), SLOT(cut()));

m_copyAction->setShortcut(QKeySequence::Copy);
m_copyAction->setIcon(QIcon::fromTheme("edit-copy"));
m_copyAction->setProperty("menu priority", 540);
connect(m_copyAction, SIGNAL(triggered()), SLOT(copy()));

m_pasteAction->setShortcut(QKeySequence::Paste);
m_pasteAction->setIcon(QIcon::fromTheme("edit-paste"));
m_pasteAction->setProperty("menu priority", 510);
connect(m_pasteAction, SIGNAL(triggered()), SLOT(paste()));

m_clearAction->setShortcut(QKeySequence::Delete);
m_clearAction->setIcon(QIcon::fromTheme("edit-clear"));
m_clearAction->setProperty("menu priority", 500);
connect(m_clearAction, SIGNAL(triggered()), SLOT(clear()));
}

Expand Down
4 changes: 4 additions & 0 deletions avogadro/qtplugins/hydrogens/hydrogens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@ Hydrogens::Hydrogens(QObject* parent_)
{
auto* action = new QAction(tr("&Adjust Hydrogens"), this);
action->setShortcut(QKeySequence("Ctrl+Alt+H"));
action->setProperty("menu priority", 760);
connect(action, SIGNAL(triggered()), SLOT(adjustHydrogens()));
m_actions.append(action);

action = new QAction(tr("Add Hydrogens"), this);
action->setProperty("menu priority", 750);
connect(action, SIGNAL(triggered()), SLOT(addHydrogens()));
m_actions.append(action);

action = new QAction(tr("Remove E&xtra Hydrogens"), this);
action->setProperty("menu priority", 740);
connect(action, SIGNAL(triggered()), SLOT(removeHydrogens()));
m_actions.append(action);

action = new QAction(tr("&Remove All Hydrogens"), this);
action->setProperty("menu priority", 730);
connect(action, SIGNAL(triggered()), SLOT(removeAllHydrogens()));
m_actions.append(action);
}
Expand Down
1 change: 1 addition & 0 deletions avogadro/qtplugins/insertdna/insertdna.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ InsertDna::InsertDna(QObject* parent_)
m_molecule(nullptr), m_dialog(nullptr)
{
auto* action = new QAction(tr("DNA/RNA…"), this);
action->setProperty("menu priority", 870);
connect(action, SIGNAL(triggered()), SLOT(showDialog()));

m_actions.append(action);
Expand Down
1 change: 1 addition & 0 deletions avogadro/qtplugins/insertfragment/insertfragment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ InsertFragment::InsertFragment(QObject* parent_)
m_moleculeDialog(nullptr), m_reader(nullptr), m_molecule(nullptr)
{
auto* action = new QAction(tr("Fragment…"), this);
action->setProperty("menu priority", 890);
action->setData("molecules"); // will also work for crystals
connect(action, SIGNAL(triggered()), SLOT(showDialog()));
m_actions.append(action);
Expand Down
2 changes: 2 additions & 0 deletions avogadro/qtplugins/lineformatinput/lineformatinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ LineFormatInput::LineFormatInput(QObject* parent_)
m_molecule(nullptr)
{
auto* action = new QAction(tr("SMILES…"), this);
action->setProperty("menu priority", 800);
action->setData("SMILES");
connect(action, SIGNAL(triggered()), SLOT(showDialog()));
m_actions.append(action);

action = new QAction(tr("InChI…"), this);
action->setProperty("menu priority", 810);
action->setData("InChI");
connect(action, SIGNAL(triggered()), SLOT(showDialog()));
m_actions.append(action);
Expand Down