## It has been automatically generated by configure
## Use "Options/Reconfigure" if you need to update it after a
## configuration change.
-## "ModuleName" "filename" "Description" "Packages" "Requires" "Excludes" "Category"
+## "ModuleName" "filename" "Description" "Packages" "Requires" "Excludes" "Category" "Local"
''')
# build the list of available modules
cm.write(line + '\n')
cm.close()
- return (b'"%s" "%s" "%s" "%s" "%s" "%s" "%s"\n'
- % (modname, filename, desc, pkgs, req, excl, catgy))
+ local = "true"
+ if (file.startswith(srcdir)):
+ local = "false"
+ return (b'"%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s"\n'
+ % (modname, filename, desc, pkgs, req, excl, catgy, local))
def checkCiteEnginesConfig():
LyXModule::LyXModule(string const & n, string const & i,
string const & d, vector<string> const & p,
vector<string> const & r, vector<string> const & e,
- string const & c):
+ string const & c, bool const local):
name_(n), id_(i), description_(d), package_list_(p),
required_modules_(r), excluded_modules_(e), category_(c),
- checked_(false), available_(false)
+ checked_(false), available_(false), local_(local)
{
filename_ = id_ + ".module";
}
break;
string const catgy = lex.getString();
LYXERR(Debug::TCLASS, "Category: " << catgy);
+ if (!lex.next())
+ break;
+ bool const local = lex.getString() == "true";
+ LYXERR(Debug::TCLASS, "Local: " << local);
// This code is run when we have
- // modName, fname, desc, pkgs, req, exc, and catgy
- addLayoutModule(modname, fname, desc, pkgs, req, exc, catgy);
+ // modName, fname, desc, pkgs, req, exc, catgy, and local
+ addLayoutModule(modname, fname, desc, pkgs, req, exc, catgy, local);
} // end switch
} //end while
void ModuleList::addLayoutModule(string const & modname,
string const & filename, string const & description,
vector<string> const & pkgs, vector<string> const & req,
- vector<string> const & exc, string const & catgy)
+ vector<string> const & exc, string const & catgy, bool const local)
{
- LyXModule lm(modname, filename, description, pkgs, req, exc, catgy);
+ LyXModule lm(modname, filename, description, pkgs, req, exc, catgy, local);
modlist_.push_back(lm);
}
std::vector<std::string> const & packagelist,
std::vector<std::string> const & requires,
std::vector<std::string> const & excludes,
- std::string const & catgy);
+ std::string const & catgy, bool const local);
/// whether the required packages are available
bool isAvailable() const;
/// the missing prerequisites, if any
{ return excluded_modules_; }
///
std::string category() const { return category_; }
+ /// Is this a local module (from the user directory)?
+ bool isLocal() const { return local_; }
/// \return true if the module is compatible with this one, i.e.,
/// it does not exclude us and we do not exclude it.
/// this will also return true if modname is unknown and we do not
///
mutable bool available_;
///
+ mutable bool local_;
+ ///
mutable std::vector<std::string> prerequisites_;
};
void addLayoutModule(std::string const &, std::string const &,
std::string const &, std::vector<std::string> const &,
std::vector<std::string> const &, std::vector<std::string> const &,
- std::string const &);
+ std::string const &, bool const);
///
std::vector<LyXModule> modlist_;
};
#include <QDirIterator>
#include <QFontDatabase>
#include <QHeaderView>
+#include <QPixmap>
#include <QScrollBar>
#include <QTextBoundaryFinder>
#include <QTextCursor>
modInfoList.sort([](modInfoStruct const & a, modInfoStruct const & b) {
return 0 < b.name.localeAwareCompare(a.name);
});
+
+ QIcon user_icon(getPixmap("images/", "lyxfiles-user", "svgz,png"));
+ QIcon system_icon(getPixmap("images/", "lyxfiles-system", "svgz,png"));
+
int i = 0;
for (modInfoStruct const & m : modInfoList) {
if (m.name.contains(str, Qt::CaseInsensitive) || contains(m.id, fromqstr(str))) {
item->setData(m.name, Qt::DisplayRole);
item->setData(toqstr(m.id), Qt::UserRole);
item->setData(m.description, Qt::ToolTipRole);
+ if (m.local)
+ item->setIcon(user_icon);
+ else
+ item->setIcon(system_icon);
modules_av_model_.insertRow(i, item);
++i;
}
modInfoList.sort([](modInfoStruct const & a, modInfoStruct const & b) {
return 0 < b.name.localeAwareCompare(a.name);
});
+ QIcon user_icon(getPixmap("images/", "lyxfiles-user", "svgz,png"));
+ QIcon system_icon(getPixmap("images/", "lyxfiles-system", "svgz,png"));
int i = 0;
QFont catfont;
catfont.setBold(true);
+ QBrush unavbrush;
+ unavbrush.setColor(Qt::gray);
for (modInfoStruct const & m : modInfoList) {
QStandardItem * item = new QStandardItem();
QStandardItem * catItem = new QStandardItem();
item->setEditable(false);
catItem->setEditable(false);
item->setData(m.name, Qt::DisplayRole);
+ if (m.missingreqs)
+ item->setForeground(unavbrush);
item->setData(toqstr(m.id), Qt::UserRole);
item->setData(m.description, Qt::ToolTipRole);
+ if (m.local)
+ item->setIcon(user_icon);
+ else
+ item->setIcon(system_icon);
catItem->appendRow(item);
}
modules_av_model_.sort(0);
else {
m.id = name;
m.name = toqstr(name + " (") + qt_("Not Found") + toqstr(")");
+ m.local = false;
+ m.missingreqs = true;
}
mInfo.push_back(m);
}
// change requires a lot of others
modInfoStruct m;
m.id = mod.getID();
- m.name = toqstr(translateIfPossible(from_utf8(mod.getName())));
+ QString const guiname = toqstr(translateIfPossible(from_utf8(mod.getName())));
+ m.missingreqs = !isModuleAvailable(mod.getID());
+ if (m.missingreqs) {
+ m.name = QString(qt_("%1 (missing req.)")).arg(guiname);
+ } else
+ m.name = guiname;
m.category = mod.category().empty() ? qt_("Miscellaneous")
: toqstr(translateIfPossible(from_utf8(mod.category())));
QString desc = toqstr(translateIfPossible(from_utf8(mod.getDescription())));
int pos = bf.toNextBoundary();
if (pos > 0)
desc.truncate(pos);
- QString modulename = QString(qt_("(Module name: %1)")).arg(toqstr(m.id));
- // Tooltip is the desc followed by the module name
- m.description = QString("%1<i>%2</i>")
+ m.local = mod.isLocal();
+ QString const mtype = m.local ? qt_("personal module") : qt_("distributed module");
+ QString modulename = QString(qt_("<b>Module name:</b> <i>%1</i> (%2)")).arg(toqstr(m.id)).arg(mtype);
+ // Tooltip is the desc followed by the module name and the type
+ m.description = QString("%1%2")
.arg(desc.isEmpty() ? QString() : QString("<p>%1</p>").arg(desc),
modulename);
+ if (m.missingreqs)
+ m.description += QString("<p>%1</p>").arg(qt_("<b>Note:</b> Some requirements for this module are missing!"));
return m;
}
std::string id;
QString description;
QString category;
+ bool local;
+ bool missingreqs;
};
///
static modInfoStruct modInfo(LyXModule const & mod);