]> git.lyx.org Git - features.git/commitdiff
Give us some useful tooltips for modules.
authorRichard Heck <rgheck@comcast.net>
Thu, 17 Apr 2008 03:27:20 +0000 (03:27 +0000)
committerRichard Heck <rgheck@comcast.net>
Thu, 17 Apr 2008 03:27:20 +0000 (03:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24312 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiDocument.cpp
src/frontends/qt4/GuiDocument.h

index 7960fa55a8900aebfb4a034916c023dd7c90137f..5b07599360012ead1e2c23396d64cee6a4bd2363 100644 (file)
@@ -2093,11 +2093,12 @@ void GuiDocument::saveDocDefault()
 void GuiDocument::updateAvailableModules() 
 {
        modules_av_model_.clear();
-       vector<modInfoStruct> const modInfoList = getModuleInfo();
+       vector<modInfoStruct> 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<GuiDocument::modInfoStruct> 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);
        }
 }
index e846f90ac5cc446ba4be53ea113b2adcf392082b..7cefd593d6b5271633edf61d9fb2683c6eadc157 100644 (file)
@@ -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<modInfoStruct> const & getModuleInfo();