diff --git a/avogadro/qtgui/layermodel.cpp b/avogadro/qtgui/layermodel.cpp index 507652d9fd..4f3c21d7fd 100644 --- a/avogadro/qtgui/layermodel.cpp +++ b/avogadro/qtgui/layermodel.cpp @@ -110,7 +110,7 @@ QVariant LayerModel::data(const QModelIndex& idx, int role) const if (idx.column() == ColumnType::Name) { switch (role) { case Qt::DisplayRole: { - return " " + tr(name.c_str()); // should already be translated + return " " + getTranslatedName(name); // should already be translated } } } @@ -119,6 +119,32 @@ QVariant LayerModel::data(const QModelIndex& idx, int role) const return QVariant(); } +const QString LayerModel::getTranslatedName(const std::string& name) const +{ + // This is a bad hack, but whatever.. + // Put all the strings that show up as layer options + if (name == "Ball and Stick") + return tr("Ball and Stick"); + else if (name == "Cartoons") + return tr("Cartoons", "protein ribbon / cartoon rendering"); + else if (name == "Close Contacts") + return tr("Close Contacts", "rendering of non-covalent close contacts"); + else if (name == "Labels") + return tr("Labels"); + else if (name == "Licorice") + return tr("Licorice", "stick / licorice rendering"); + else if (name == "Non-Covalent") + return tr("Non-Covalent"); + else if (name == "Van der Waals") + return tr("Van der Waals"); + else if (name == "Van der Waals (AO)") + return tr("Van der Waals (AO)", "ambient occlusion"); + else if (name == "Wireframe") + return tr("Wireframe"); + + return QString(); +} + QModelIndex LayerModel::index(int row, int column, const QModelIndex& p) const { if (!p.isValid()) diff --git a/avogadro/qtgui/layermodel.h b/avogadro/qtgui/layermodel.h index 9ba32822e2..cdc45a6494 100644 --- a/avogadro/qtgui/layermodel.h +++ b/avogadro/qtgui/layermodel.h @@ -67,6 +67,7 @@ public slots: void updateRows(); private: + const QString getTranslatedName(const std::string& name) const; size_t m_item; }; diff --git a/avogadro/qtplugins/vanderwaals/vanderwaals.h b/avogadro/qtplugins/vanderwaals/vanderwaals.h index 39275e470d..a7708b5b60 100644 --- a/avogadro/qtplugins/vanderwaals/vanderwaals.h +++ b/avogadro/qtplugins/vanderwaals/vanderwaals.h @@ -26,7 +26,7 @@ class VanDerWaals : public QtGui::ScenePlugin void process(const QtGui::Molecule& molecule, Rendering::GroupNode& node) override; - QString name() const override { return tr(m_name.c_str()); } + QString name() const override { return tr("Van der Waals"); } QString description() const override { diff --git a/avogadro/qtplugins/vanderwaalsao/vanderwaalsao.h b/avogadro/qtplugins/vanderwaalsao/vanderwaalsao.h index 096bbfc37a..7d7953eac1 100644 --- a/avogadro/qtplugins/vanderwaalsao/vanderwaalsao.h +++ b/avogadro/qtplugins/vanderwaalsao/vanderwaalsao.h @@ -26,7 +26,7 @@ class VanDerWaalsAO : public QtGui::ScenePlugin void process(const QtGui::Molecule& molecule, Rendering::GroupNode& node) override; - QString name() const override { return tr(m_name.c_str()); } + QString name() const override { return tr("Van der Waals (AO)", "ambient occlusion"); } QString description() const override {