cleaned up the missing helper storage class
This commit is contained in:
parent
f9aff8fecc
commit
b8963db4b1
@ -496,54 +496,43 @@ void FileInterner::checkExternalMissing(const string& msg, const string& mt)
|
|||||||
it++;
|
it++;
|
||||||
if (*it == "HELPERNOTFOUND") {
|
if (*it == "HELPERNOTFOUND") {
|
||||||
it++;
|
it++;
|
||||||
for (; it < verr.end(); it++) {
|
for (; it != verr.end(); it++) {
|
||||||
m_missingdatap->m_missingExternal.insert(*it);
|
m_missingdatap->addMissing(*it, mt);
|
||||||
m_missingdatap->m_typesForMissing[*it].insert(mt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileInterner::getMissingExternal(FIMissingStore *st, string& out)
|
void FIMissingStore::getMissingExternal(string& out)
|
||||||
{
|
{
|
||||||
if (st)
|
for (map<string, set<string> >::const_iterator it =
|
||||||
stringsToString(st->m_missingExternal, out);
|
m_typesForMissing.begin(); it != m_typesForMissing.end(); it++) {
|
||||||
|
out += string(" ") + it->first;
|
||||||
|
}
|
||||||
|
trimstring(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileInterner::getMissingDescription(FIMissingStore *st, string& out)
|
void FIMissingStore::getMissingDescription(string& out)
|
||||||
{
|
{
|
||||||
if (st == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
out.erase();
|
out.erase();
|
||||||
|
|
||||||
for (set<string>::const_iterator it =
|
for (map<string, set<string> >::const_iterator it =
|
||||||
st->m_missingExternal.begin();
|
m_typesForMissing.begin(); it != m_typesForMissing.end(); it++) {
|
||||||
it != st->m_missingExternal.end(); it++) {
|
out += it->first + " (";
|
||||||
out += *it;
|
set<string>::const_iterator it3;
|
||||||
map<string, set<string> >::const_iterator it2;
|
for (it3 = it->second.begin();
|
||||||
it2 = st->m_typesForMissing.find(*it);
|
it3 != it->second.end(); it3++) {
|
||||||
if (it2 != st->m_typesForMissing.end()) {
|
out += *it3 + " ";
|
||||||
out += " (";
|
|
||||||
set<string>::const_iterator it3;
|
|
||||||
for (it3 = it2->second.begin();
|
|
||||||
it3 != it2->second.end(); it3++) {
|
|
||||||
out += *it3;
|
|
||||||
out += string(" ");
|
|
||||||
}
|
|
||||||
trimstring(out);
|
|
||||||
out += ")";
|
|
||||||
}
|
}
|
||||||
|
trimstring(out);
|
||||||
|
out += ")";
|
||||||
out += "\n";
|
out += "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileInterner::getMissingFromDescription(FIMissingStore *st, const string& in)
|
FIMissingStore::FIMissingStore(const string& in)
|
||||||
{
|
{
|
||||||
if (st == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// The "missing" file is text. Each line defines a missing filter
|
// The "missing" file is text. Each line defines a missing filter
|
||||||
// and the list of mime types actually encountered that needed it
|
// and the list of mime types actually encountered that needed it
|
||||||
// (see method getMissingDescription())
|
// (see method getMissingDescription())
|
||||||
@ -575,10 +564,9 @@ void FileInterner::getMissingFromDescription(FIMissingStore *st, const string& i
|
|||||||
if (filter.empty())
|
if (filter.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
st->m_missingExternal.insert(filter);
|
|
||||||
for (vector<string>::const_iterator itt = mtypes.begin();
|
for (vector<string>::const_iterator itt = mtypes.begin();
|
||||||
itt != mtypes.end(); itt++) {
|
itt != mtypes.end(); itt++) {
|
||||||
st->m_typesForMissing[filter].insert(*itt);
|
m_typesForMissing[filter].insert(*itt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ using std::set;
|
|||||||
|
|
||||||
class RclConfig;
|
class RclConfig;
|
||||||
namespace Rcl {
|
namespace Rcl {
|
||||||
class Doc;
|
class Doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct stat;
|
struct stat;
|
||||||
@ -47,8 +47,19 @@ struct stat;
|
|||||||
*/
|
*/
|
||||||
class FIMissingStore {
|
class FIMissingStore {
|
||||||
public:
|
public:
|
||||||
|
FIMissingStore() {}
|
||||||
|
FIMissingStore(const string& in);
|
||||||
|
virtual ~FIMissingStore() {}
|
||||||
|
virtual void addMissing(const string& prog, const string& mt)
|
||||||
|
{
|
||||||
|
m_typesForMissing[prog].insert(mt);
|
||||||
|
}
|
||||||
|
// Get simple progs list string
|
||||||
|
virtual void getMissingExternal(string& out);
|
||||||
|
// Get progs + assoc mtypes description string
|
||||||
|
virtual void getMissingDescription(string& out);
|
||||||
|
|
||||||
// Missing external programs
|
// Missing external programs
|
||||||
set<string> m_missingExternal;
|
|
||||||
map<string, set<string> > m_typesForMissing;
|
map<string, set<string> > m_typesForMissing;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -766,7 +766,7 @@ class LoadThread : public QThread {
|
|||||||
imgtmp = interner.get_imgtmp();
|
imgtmp = interner.get_imgtmp();
|
||||||
} else {
|
} else {
|
||||||
out.mimetype = interner.getMimetype();
|
out.mimetype = interner.getMimetype();
|
||||||
interner.getMissingExternal(&mst, missing);
|
mst.getMissingExternal(missing);
|
||||||
*statusp = -1;
|
*statusp = -1;
|
||||||
}
|
}
|
||||||
} catch (CancelExcept) {
|
} catch (CancelExcept) {
|
||||||
|
|||||||
@ -1127,11 +1127,11 @@ void RclMain::showActiveTypes()
|
|||||||
mtypesfromdbconf.insert(*it);
|
mtypesfromdbconf.insert(*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Substract the types for missing helpers (the docs are indexed by name only):
|
// Substract the types for missing helpers (the docs are indexed
|
||||||
|
// by name only):
|
||||||
string miss = theconfig->getMissingHelperDesc();
|
string miss = theconfig->getMissingHelperDesc();
|
||||||
if (!miss.empty()) {
|
if (!miss.empty()) {
|
||||||
FIMissingStore st;
|
FIMissingStore st(miss);
|
||||||
FileInterner::getMissingFromDescription(&st, miss);
|
|
||||||
map<string, set<string> >::const_iterator it;
|
map<string, set<string> >::const_iterator it;
|
||||||
for (it = st.m_typesForMissing.begin();
|
for (it = st.m_typesForMissing.begin();
|
||||||
it != st.m_typesForMissing.end(); it++) {
|
it != st.m_typesForMissing.end(); it++) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user