cleanup UI compiler includes writer

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-06-18 21:19:06 +00:00
parent 14d98abe79
commit ac3f25c3b7
2 changed files with 3 additions and 16 deletions

View file

@ -70,15 +70,6 @@ static const ClassInfoEntry qclass_lib_map[] = {
#undef QT_CLASS_LIB
};
// Format a module header as 'QtCore/QObject'
static inline QString moduleHeader(const QString &module, const QString &header)
{
QString rc = module;
rc += QLatin1Char('/');
rc += header;
return rc;
}
namespace CPP {
WriteIncludes::WriteIncludes(Uic *uic)
@ -89,11 +80,10 @@ WriteIncludes::WriteIncludes(Uic *uic)
const ClassInfoEntry *classLibEnd = qclass_lib_map + sizeof(qclass_lib_map)/sizeof(ClassInfoEntry);
for(const ClassInfoEntry *it = qclass_lib_map; it < classLibEnd; ++it) {
const QString klass = QLatin1String(it->klass);
const QString module = QLatin1String(it->module);
const QLatin1String header = QLatin1String(it->header);
const QString newHeader = moduleHeader(module, klass);
// Format a module header as 'QtCore/QObject'
const QString newHeader = QLatin1String(it->module) + QLatin1Char('/') + header;
m_classToHeader.insert(klass, newHeader);
m_oldHeaderToNewHeader.insert(header, newHeader);
}
}
@ -298,9 +288,7 @@ void WriteIncludes::writeHeaders(const OrderedSet &headers, bool global)
// Check for the old headers 'qslider.h' and replace by 'QtGui/QSlider'
const OrderedSet::const_iterator cend = headers.constEnd();
for (OrderedSet::const_iterator sit = headers.constBegin(); sit != cend; ++sit) {
const StringMap::const_iterator hit = m_oldHeaderToNewHeader.constFind(sit.key());
const bool mapped = hit != m_oldHeaderToNewHeader.constEnd();
const QString header = mapped ? hit.value() : sit.key();
const QString header = sit.key();
if (!header.trimmed().isEmpty()) {
m_output << "#include " << openingQuote << header << closingQuote << QLatin1Char('\n');
}

View file

@ -104,7 +104,6 @@ private:
typedef QMap<QString, QString> StringMap;
StringMap m_classToHeader;
StringMap m_oldHeaderToNewHeader;
bool m_scriptsActivated;
bool m_laidOut;