use auto, range for, etc.
This commit is contained in:
parent
156ba2668f
commit
4df9106b46
@ -55,21 +55,22 @@ bool PlainToRichQtPreview::haveAnchors()
|
||||
|
||||
string PlainToRichQtPreview::PlainToRichQtPreview::header()
|
||||
{
|
||||
if (!m_inputhtml) {
|
||||
switch (prefs.previewPlainPre) {
|
||||
case PrefsPack::PP_BR:
|
||||
m_eolbr = true;
|
||||
return "<qt><head><title></title></head><body>";
|
||||
case PrefsPack::PP_PRE:
|
||||
m_eolbr = false;
|
||||
return "<qt><head><title></title></head><body><pre>";
|
||||
case PrefsPack::PP_PREWRAP:
|
||||
m_eolbr = false;
|
||||
return "<qt><head><title></title></head><body>"
|
||||
"<pre style=\"white-space: pre-wrap\">";
|
||||
}
|
||||
if (m_inputhtml) {
|
||||
return cstr_null;
|
||||
}
|
||||
switch (prefs.previewPlainPre) {
|
||||
case PrefsPack::PP_BR:
|
||||
m_eolbr = true;
|
||||
return "<qt><head><title></title></head><body>";
|
||||
case PrefsPack::PP_PRE:
|
||||
m_eolbr = false;
|
||||
return "<qt><head><title></title></head><body><pre>";
|
||||
case PrefsPack::PP_PREWRAP:
|
||||
default:
|
||||
m_eolbr = false;
|
||||
return "<qt><head><title></title></head><body>"
|
||||
"<pre style=\"white-space: pre-wrap\">";
|
||||
}
|
||||
return cstr_null;
|
||||
}
|
||||
|
||||
string PlainToRichQtPreview::startMatch(unsigned int grpidx)
|
||||
@ -117,10 +118,8 @@ string PlainToRichQtPreview::startChunk()
|
||||
int PlainToRichQtPreview::nextAnchorNum(int grpidx)
|
||||
{
|
||||
LOGDEB2("nextAnchorNum: group " << grpidx << "\n");
|
||||
map<unsigned int, unsigned int>::iterator curit =
|
||||
m_groupcuranchors.find(grpidx);
|
||||
map<unsigned int, vector<int> >::iterator vecit =
|
||||
m_groupanchors.find(grpidx);
|
||||
auto curit = m_groupcuranchors.find(grpidx);
|
||||
auto vecit = m_groupanchors.find(grpidx);
|
||||
if (grpidx == -1 || curit == m_groupcuranchors.end() ||
|
||||
vecit == m_groupanchors.end()) {
|
||||
if (m_curanchor >= m_lastanchor)
|
||||
@ -140,10 +139,8 @@ int PlainToRichQtPreview::nextAnchorNum(int grpidx)
|
||||
|
||||
int PlainToRichQtPreview::prevAnchorNum(int grpidx)
|
||||
{
|
||||
map<unsigned int, unsigned int>::iterator curit =
|
||||
m_groupcuranchors.find(grpidx);
|
||||
map<unsigned int, vector<int> >::iterator vecit =
|
||||
m_groupanchors.find(grpidx);
|
||||
auto curit = m_groupcuranchors.find(grpidx);
|
||||
auto vecit = m_groupanchors.find(grpidx);
|
||||
if (grpidx == -1 || curit == m_groupcuranchors.end() ||
|
||||
vecit == m_groupanchors.end()) {
|
||||
if (m_curanchor <= 1)
|
||||
@ -162,7 +159,7 @@ int PlainToRichQtPreview::prevAnchorNum(int grpidx)
|
||||
|
||||
QString PlainToRichQtPreview::curAnchorName() const
|
||||
{
|
||||
return QString::fromUtf8(termAnchorName(m_curanchor).c_str());
|
||||
return u8s2qs(termAnchorName(m_curanchor));
|
||||
}
|
||||
|
||||
|
||||
@ -189,8 +186,7 @@ void ToRichThread::run()
|
||||
}
|
||||
|
||||
// Convert C++ string list to QString list
|
||||
for (list<string>::iterator it = out.begin();
|
||||
it != out.end(); it++) {
|
||||
m_output.push_back(QString::fromUtf8(it->c_str(), it->length()));
|
||||
for (const auto& chunk : out) {
|
||||
m_output.push_back(u8s2qs(chunk));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user