Skip to content

Commit

Permalink
Make the shortcut assignment easier and OS agnostic
Browse files Browse the repository at this point in the history
Signed-off-by: Pietro Natale <[email protected]>
  • Loading branch information
Milziade committed Nov 23, 2024
1 parent db14e88 commit 99ec841
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 17 deletions.
5 changes: 3 additions & 2 deletions avogadro/qtplugins/bondcentrictool/bondcentrictool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,17 @@ BondCentricTool::BondCentricTool(QObject* parent_)
m_molecule(nullptr), m_renderer(nullptr), m_moveState(IgnoreMove),
m_planeSnapIncr(10.f), m_snapPlaneToBonds(true)
{
QString shortcut = tr("Ctrl+7", "control-key 7");
m_activateAction->setText(tr("Bond-Centric Manipulation"));
m_activateAction->setToolTip(
tr("Bond Centric Manipulation Tool \tCtrl+7\n\n"
tr("Bond Centric Manipulation Tool \t(%1)\n\n"
"Left Mouse: \tClick and drag to rotate the view.\n"
"Middle Mouse: \tClick and drag to zoom in or out.\n"
"Right Mouse: \tClick and drag to move the view.\n"
"Double-Click: \tReset the view.\n\n"
"Left Click & Drag on a Bond to set the Manipulation Plane:\n"
"Left Click & Drag one of the Atoms in the Bond to change the angle\n"
"Right Click & Drag one of the Atoms in the Bond to change the length"));
"Right Click & Drag one of the Atoms in the Bond to change the length").arg(shortcut));
setIcon();
}

Expand Down
5 changes: 3 additions & 2 deletions avogadro/qtplugins/editor/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ Editor::Editor(QObject* parent_)
m_clickedAtomicNumber(INVALID_ATOMIC_NUMBER), m_bondAdded(false),
m_fixValenceLater(false), m_layerManager("Editor")
{
QString shortcut = tr("Ctrl+2", "control-key 2");
m_activateAction->setText(tr("Draw"));
m_activateAction->setToolTip(
tr("Draw Tool \tCtrl+2\n\n"
tr("Draw Tool \t(%1)\n\n"
"Left Mouse: \tClick and Drag to create Atoms and Bond\n"
"Right Mouse: \tDelete Atom"));
"Right Mouse: \tDelete Atom").arg(shortcut));
setIcon();
reset();
}
Expand Down
5 changes: 3 additions & 2 deletions avogadro/qtplugins/label/labeleditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ LabelEditor::LabelEditor(QObject* parent_)
m_molecule(nullptr), m_glWidget(nullptr), m_renderer(nullptr),
m_selected(false), m_text("")
{
QString shortcut = tr("Ctrl+4", "control-key 4");
m_activateAction->setText(tr("Edit Labels"));
m_activateAction->setToolTip(
tr("Atom Label Tool \tCtrl+4\n\n"
"Left Mouse: \tClick on Atoms to add Custom Labels"));
tr("Atom Label Tool \t(%1)\n\n"
"Left Mouse: \tClick on Atoms to add Custom Labels").arg(shortcut));
setIcon();
}

Expand Down
5 changes: 3 additions & 2 deletions avogadro/qtplugins/manipulator/manipulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ Manipulator::Manipulator(QObject* parent_)
m_toolWidget(new ManipulateWidget(dynamic_cast<QWidget*>(parent_))),
m_currentAction(Nothing)
{
QString shortcut = tr("Ctrl+6", "control-key 6");
m_activateAction->setText(tr("Manipulate"));
m_activateAction->setToolTip(
tr("Manipulation Tool \tCtrl+6\n\n"
tr("Manipulation Tool \t(%1)\n\n"
"Left Mouse: \tClick and drag to move atoms\n"
"Right Mouse: \tClick and drag to rotate atoms.\n"));
"Right Mouse: \tClick and drag to rotate atoms.\n").arg(shortcut));
setIcon();
connect(m_toolWidget->buttonBox, SIGNAL(clicked(QAbstractButton*)), this,
SLOT(buttonClicked(QAbstractButton*)));
Expand Down
5 changes: 3 additions & 2 deletions avogadro/qtplugins/measuretool/measuretool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ MeasureTool::MeasureTool(QObject* parent_)
: QtGui::ToolPlugin(parent_), m_activateAction(new QAction(this)),
m_molecule(nullptr), m_rwMolecule(nullptr), m_renderer(nullptr)
{
QString shortcut = tr("Ctrl+8", "control-key 8");
m_activateAction->setText(tr("Measure"));
m_activateAction->setToolTip(
tr("Measure Tool \tCtrl+8\n\n"
tr("Measure Tool \t(%1)\n\n"
"Left Mouse: \tSelect up to four Atoms.\n"
"\tDistances are measured between 1-2 and 2-3\n"
"\tAngle is measured between 1-3 using 2 as the common point\n"
"\tDihedral is measured between 1-2-3-4\n"
"Right Mouse: \tReset the measurements."));
"Right Mouse: \tReset the measurements.").arg(shortcut));
setIcon();
}

Expand Down
5 changes: 3 additions & 2 deletions avogadro/qtplugins/navigator/navigator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ Navigator::Navigator(QObject* parent_)
m_renderer(nullptr), m_pressedButtons(Qt::NoButton),
m_currentAction(Nothing)
{
QString shortcut = tr("Ctrl+1", "control-key 1");
m_activateAction->setText(tr("Navigate"));
m_activateAction->setToolTip(
tr("Navigation Tool \tCtrl+1\n\n"
tr("Navigation Tool \t(%1)\n\n"
"Left Mouse: \tClick and drag to rotate the view.\n"
"Middle Mouse: \tClick and drag to zoom in or out.\n"
"Right Mouse: \tClick and drag to move the view.\n"));
"Right Mouse: \tClick and drag to move the view.\n").arg(shortcut));
setIcon();
QSettings settings;
m_zoomDirection = settings.value("navigator/zoom", 1).toInt();
Expand Down
3 changes: 2 additions & 1 deletion avogadro/qtplugins/playertool/playertool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ PlayerTool::PlayerTool(QObject* parent_)
m_molecule(nullptr), m_renderer(nullptr), m_currentFrame(0),
m_toolWidget(nullptr), m_frameIdx(nullptr), m_slider(nullptr)
{
QString shortcut = tr("Ctrl+9", "control-key 9");
m_activateAction->setText(tr("Player"));
m_activateAction->setToolTip(tr("Animation Tool \tCtrl+9"));
m_activateAction->setToolTip(tr("Animation Tool \t(%1)").arg(shortcut));
setIcon();
}

Expand Down
5 changes: 3 additions & 2 deletions avogadro/qtplugins/selectiontool/selectiontool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ SelectionTool::SelectionTool(QObject* parent_)
m_drawSelectionBox(false), m_doubleClick(false), m_initSelectionBox(false),
m_layerManager("Selection Tool")
{
QString shortcut = tr("Ctrl+5", "control-key 5");
m_activateAction->setText(tr("Selection"));
m_activateAction->setToolTip(
tr("Selection Tool \tCtrl+5\n\n"
tr("Selection Tool \t(%1)\n\n"
"Left Mouse: \tClick to pick individual atoms, residues, or fragments\n"
"\tDrag to select a range of atoms\n"
"Right Mouse: \tClick outside the molecule to clear selection\n"
"Use Ctrl to toggle the selection and shift to add to the selection.\n"
"Double-Click: \tSelect an entire fragment."));
"Double-Click: \tSelect an entire fragment.").arg(shortcut));
setIcon();
}

Expand Down
5 changes: 3 additions & 2 deletions avogadro/qtplugins/templatetool/templatetool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ TemplateTool::TemplateTool(QObject* parent_)
m_clickedAtomicNumber(INVALID_ATOMIC_NUMBER), m_bondAdded(false),
m_fixValenceLater(false)
{
QString shortcut = tr("Ctrl+3", "control-key 3");
m_activateAction->setText(tr("Template"));
m_activateAction->setToolTip(
tr("Template Tool \tCtrl+3\n\n"
tr("Template Tool \t(%1)\n\n"
"Insert fragments, including metal centers.\n"
"Select an element and coordination geometry,"
"then click to insert a fragment.\n\n"
"Select a ligand or functional group and click"
"on a hydrogen atom to attach it."));
"on a hydrogen atom to attach it.").arg(shortcut));
setIcon();
reset();
}
Expand Down

0 comments on commit 99ec841

Please sign in to comment.