From: Richard Heck Date: Thu, 17 Apr 2008 03:27:20 +0000 (+0000) Subject: Give us some useful tooltips for modules. X-Git-Tag: 1.6.10~5149 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=ffa42cb236db3a1bf71e7427ad8f468f780e70ad;p=features.git Give us some useful tooltips for modules. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24312 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 7960fa55a8..5b07599360 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -2093,11 +2093,12 @@ void GuiDocument::saveDocDefault() void GuiDocument::updateAvailableModules() { modules_av_model_.clear(); - vector const modInfoList = getModuleInfo(); + vector const & modInfoList = getModuleInfo(); int const mSize = modInfoList.size(); for (int i = 0; i != mSize; ++i) { modInfoStruct const & modInfo = modInfoList[i]; - modules_av_model_.insertRow(i, qt_(modInfo.name), modInfo.id); + modules_av_model_.insertRow(i, modInfo.name, modInfo.id, + modInfo.description); } } @@ -2110,7 +2111,8 @@ void GuiDocument::updateSelectedModules() int const sSize = selModList.size(); for (int i = 0; i != sSize; ++i) { modInfoStruct const & modInfo = selModList[i]; - modules_sel_model_.insertRow(i, qt_(modInfo.name), modInfo.id); + modules_sel_model_.insertRow(i, modInfo.name, modInfo.id, + modInfo.description); } } @@ -2228,9 +2230,9 @@ vector const GuiDocument::getSelectedModules() m.id = *it; LyXModule * mod = moduleList[*it]; if (mod) - m.name = mod->getName(); + m.name = qt_(mod->getName()); else - m.name = *it + " (Not Found)"; + m.name = toqstr(*it) + toqstr(" (") + qt_("Not Found") + toqstr(")"); mInfo.push_back(m); } return mInfo; @@ -2361,7 +2363,13 @@ void GuiDocument::loadModuleInfo() for (; it != end; ++it) { modInfoStruct m; m.id = it->getID(); - m.name = it->getName(); + m.name = qt_(it->getName()); + // this is supposed to give us the first sentence of the description + QString desc = qt_(it->getDescription()); + int const pos = desc.indexOf("."); + if (pos > 0) + desc.truncate(pos + 1); + m.description = desc; moduleNames_.push_back(m); } } diff --git a/src/frontends/qt4/GuiDocument.h b/src/frontends/qt4/GuiDocument.h index e846f90ac5..7cefd593d6 100644 --- a/src/frontends/qt4/GuiDocument.h +++ b/src/frontends/qt4/GuiDocument.h @@ -224,8 +224,9 @@ protected: BufferId id() const; /// struct modInfoStruct { - std::string name; + QString name; std::string id; + QString description; }; /// List of available modules std::vector const & getModuleInfo();