mirror of
https://invent.kde.org/graphics/okular
synced 2024-07-05 00:58:46 +00:00
Port away from more QLinkedLists
QLinkedList is gone from Qt6 The almost 1:1 port is std::list but we don't need iterator stability on removal/insertion so just port to QList
This commit is contained in:
parent
8941e43488
commit
0741ef1838
|
@ -61,7 +61,7 @@ void CalculateTextTest::testSimpleCalculate()
|
|||
// Field names in test document are:
|
||||
// field1, field2, field3, Sum, AVG, Prod, Min, Max
|
||||
|
||||
const QLinkedList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
const QList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
for (Okular::FormField *ff : pageFormFields) {
|
||||
fields.insert(ff->name(), static_cast<Okular::FormFieldText *>(ff));
|
||||
}
|
||||
|
|
|
@ -72,16 +72,14 @@ void EditFormsTest::init()
|
|||
QVERIFY(!m_document->canRedo());
|
||||
|
||||
const Okular::Page *page = m_document->page(0);
|
||||
QLinkedList<Okular::FormField *> pageFields = page->formFields();
|
||||
const QList<Okular::FormField *> pageFields = page->formFields();
|
||||
|
||||
// Clear lists
|
||||
m_checkBoxForms.clear();
|
||||
m_radioButtonForms.clear();
|
||||
|
||||
// Collect forms of the various types
|
||||
QLinkedList<Okular::FormField *>::const_iterator ffIt = pageFields.constBegin(), ffEnd = pageFields.constEnd();
|
||||
for (; ffIt != ffEnd; ++ffIt) {
|
||||
Okular::FormField *ff = *ffIt;
|
||||
for (Okular::FormField *ff : pageFields) {
|
||||
ff->type();
|
||||
|
||||
switch (ff->type()) {
|
||||
|
|
|
@ -61,7 +61,7 @@ void FormatTest::initTestCase()
|
|||
});
|
||||
|
||||
const Okular::Page *page = m_document->page(0);
|
||||
const QLinkedList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
const QList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
for (Okular::FormField *ff : pageFormFields) {
|
||||
m_fields.insert(ff->name(), ff);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ void KeystrokeTest::initTestCase()
|
|||
QCOMPARE(m_document->openDocument(testFile, QUrl(), mime), Okular::Document::OpenSuccess);
|
||||
|
||||
const Okular::Page *page = m_document->page(0);
|
||||
const QLinkedList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
const QList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
for (Okular::FormField *ff : pageFormFields) {
|
||||
m_fields.insert(ff->name(), ff);
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ void KJSFunctionsTest::initTestCase()
|
|||
QCOMPARE(m_document->openDocument(testFile, QUrl(), mime), Okular::Document::OpenSuccess);
|
||||
|
||||
const Okular::Page *page = m_document->page(0);
|
||||
const QLinkedList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
const QList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
for (Okular::FormField *ff : pageFormFields) {
|
||||
m_fields.insert(ff->name(), ff);
|
||||
}
|
||||
|
|
|
@ -1317,7 +1317,7 @@ void PartTest::testSaveAsUndoStackForms()
|
|||
Okular::Part part(nullptr, nullptr, QVariantList());
|
||||
part.openDocument(file);
|
||||
|
||||
const QLinkedList<Okular::FormField *> pageFormFields = part.m_document->page(0)->formFields();
|
||||
const QList<Okular::FormField *> pageFormFields = part.m_document->page(0)->formFields();
|
||||
for (FormField *ff : pageFormFields) {
|
||||
if (ff->id() == 65537) {
|
||||
QCOMPARE(ff->type(), FormField::FormText);
|
||||
|
@ -1474,7 +1474,7 @@ void PartTest::testCheckBoxReadOnly()
|
|||
// Field names in test document are:
|
||||
// CBMakeRW, CBMakeRO, TargetDefaultRO, TargetDefaultRW
|
||||
|
||||
const QLinkedList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
const QList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
for (Okular::FormField *ff : pageFormFields) {
|
||||
fields.insert(ff->name(), static_cast<Okular::FormField *>(ff));
|
||||
}
|
||||
|
@ -1550,7 +1550,7 @@ void PartTest::testCheckBoxReadOnly()
|
|||
fields.clear();
|
||||
|
||||
{
|
||||
const QLinkedList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
const QList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
for (Okular::FormField *ff : pageFormFields) {
|
||||
fields.insert(ff->name(), static_cast<Okular::FormField *>(ff));
|
||||
}
|
||||
|
@ -1706,7 +1706,7 @@ void PartTest::testAdditionalActionTriggers()
|
|||
// For target fields: <trigger_name>_focus_target, <trigger_name>_cursor_target,
|
||||
// <trigger_name>_mouse_target
|
||||
const Okular::Page *page = part.m_document->page(0);
|
||||
const QLinkedList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
const QList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
for (Okular::FormField *ff : pageFormFields) {
|
||||
fields.insert(ff->name(), static_cast<Okular::FormField *>(ff));
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ void SignatureFormTest::testSignatureForm()
|
|||
QCOMPARE(m_document->openDocument(testFile, QUrl(), mime), Okular::Document::OpenSuccess);
|
||||
|
||||
const Okular::Page *page = m_document->page(0);
|
||||
QLinkedList<Okular::FormField *> pageFields = page->formFields();
|
||||
const QList<Okular::FormField *> pageFields = page->formFields();
|
||||
QCOMPARE(pageFields.size(), 1);
|
||||
QCOMPARE(pageFields.first()->type(), Okular::FormField::FormSignature);
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ void SignUnsignedFieldTest::cleanup()
|
|||
|
||||
void SignUnsignedFieldTest::testSignUnsignedField()
|
||||
{
|
||||
const QLinkedList<Okular::FormField *> forms = m_document->page(0)->formFields();
|
||||
const QList<Okular::FormField *> forms = m_document->page(0)->formFields();
|
||||
QCOMPARE(forms.count(), 1);
|
||||
Okular::FormFieldSignature *ffs = dynamic_cast<Okular::FormFieldSignature *>(forms.first());
|
||||
|
||||
|
@ -111,7 +111,7 @@ void SignUnsignedFieldTest::testSignUnsignedField()
|
|||
const QMimeType mime = db.mimeTypeForFile(f.fileName());
|
||||
QCOMPARE(m_document->openDocument(f.fileName(), QUrl(), mime), Okular::Document::OpenSuccess);
|
||||
|
||||
const QLinkedList<Okular::FormField *> newForms = m_document->page(0)->formFields();
|
||||
const QList<Okular::FormField *> newForms = m_document->page(0)->formFields();
|
||||
QCOMPARE(newForms.count(), 1);
|
||||
ffs = dynamic_cast<Okular::FormFieldSignature *>(newForms.first());
|
||||
QCOMPARE(ffs->signatureType(), Okular::FormFieldSignature::AdbePkcs7detached);
|
||||
|
|
|
@ -57,7 +57,7 @@ void VisibilityTest::initTestCase()
|
|||
// With two radio buttons named TargetRadio.
|
||||
|
||||
const Okular::Page *page = m_document->page(0);
|
||||
const QLinkedList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
const QList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
for (Okular::FormField *ff : pageFormFields) {
|
||||
m_fields.insert(ff->name(), ff);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ void VisibilityTest::testSaveLoad()
|
|||
const Okular::Page *page = newDoc->page(0);
|
||||
|
||||
bool anyChecked = false; // Saveguard against accidental test passing here ;-)
|
||||
const QLinkedList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
const QList<Okular::FormField *> pageFormFields = page->formFields();
|
||||
for (Okular::FormField *ff : pageFormFields) {
|
||||
if (ff->name().startsWith(QStringLiteral("Target"))) {
|
||||
QVERIFY(!ff->isVisible());
|
||||
|
|
|
@ -1176,7 +1176,7 @@ void DocumentPrivate::recalculateForms()
|
|||
const Page *p = m_parent->page(pageIdx);
|
||||
if (p) {
|
||||
bool pageNeedsRefresh = false;
|
||||
const QLinkedList<Okular::FormField *> forms = p->formFields();
|
||||
const QList<Okular::FormField *> forms = p->formFields();
|
||||
for (FormField *form : forms) {
|
||||
if (form->id() == formId) {
|
||||
Action *action = form->additionalAction(FormField::CalculateField);
|
||||
|
@ -2145,7 +2145,7 @@ void DocumentPrivate::loadSyncFile(const QString &filePath)
|
|||
}
|
||||
}
|
||||
|
||||
QVector<QLinkedList<Okular::SourceRefObjectRect *>> refRects(m_pagesVector.size());
|
||||
QVector<QList<Okular::SourceRefObjectRect *>> refRects(m_pagesVector.size());
|
||||
for (const pdfsyncpoint &pt : qAsConst(points)) {
|
||||
// drop pdfsync points not completely valid
|
||||
if (pt.page < 0 || pt.page >= m_pagesVector.size()) {
|
||||
|
@ -2663,7 +2663,7 @@ void Document::closeDocument()
|
|||
}
|
||||
}
|
||||
|
||||
const QLinkedList<FormField *> forms = p->formFields();
|
||||
const QList<FormField *> forms = p->formFields();
|
||||
for (const FormField *form : forms) {
|
||||
const QList<Action *> additionalActions = form->additionalActions();
|
||||
for (const Action *a : additionalActions) {
|
||||
|
|
|
@ -541,7 +541,7 @@ const Action *Page::pageAction(PageAction action) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
QLinkedList<FormField *> Page::formFields() const
|
||||
QList<FormField *> Page::formFields() const
|
||||
{
|
||||
return d->formfields;
|
||||
}
|
||||
|
@ -641,7 +641,7 @@ void PagePrivate::setTextSelections(RegularAreaRect *r, const QColor &color)
|
|||
}
|
||||
}
|
||||
|
||||
void Page::setSourceReferences(const QLinkedList<SourceRefObjectRect *> &refRects)
|
||||
void Page::setSourceReferences(const QList<SourceRefObjectRect *> &refRects)
|
||||
{
|
||||
deleteSourceReferences();
|
||||
for (SourceRefObjectRect *rect : refRects) {
|
||||
|
@ -746,7 +746,7 @@ void Page::setPageAction(PageAction action, Action *link)
|
|||
}
|
||||
}
|
||||
|
||||
void Page::setFormFields(const QLinkedList<FormField *> &fields)
|
||||
void Page::setFormFields(const QList<FormField *> &fields)
|
||||
{
|
||||
qDeleteAll(d->formfields);
|
||||
d->formfields = fields;
|
||||
|
@ -967,11 +967,7 @@ void PagePrivate::saveLocalContents(QDomNode &parentNode, QDomDocument &document
|
|||
QDomElement formListElement = document.createElement(QStringLiteral("forms"));
|
||||
|
||||
// add every form data to the formList
|
||||
QLinkedList<FormField *>::const_iterator fIt = formfields.constBegin(), fItEnd = formfields.constEnd();
|
||||
for (; fIt != fItEnd; ++fIt) {
|
||||
// get the form field
|
||||
const FormField *f = *fIt;
|
||||
|
||||
for (const FormField *f : formfields) {
|
||||
QString newvalue = f->d_ptr->value();
|
||||
if (f->d_ptr->m_default == newvalue) {
|
||||
continue;
|
||||
|
|
|
@ -263,7 +263,7 @@ public:
|
|||
/**
|
||||
* Returns the list of FormField of the page.
|
||||
*/
|
||||
QLinkedList<FormField *> formFields() const;
|
||||
QList<FormField *> formFields() const;
|
||||
|
||||
/**
|
||||
* Sets the region described by @p rect with @p pixmap for the
|
||||
|
@ -293,7 +293,7 @@ public:
|
|||
/**
|
||||
* Sets the list of source reference objects @p rects.
|
||||
*/
|
||||
void setSourceReferences(const QLinkedList<SourceRefObjectRect *> &rects);
|
||||
void setSourceReferences(const QList<SourceRefObjectRect *> &rects);
|
||||
|
||||
/**
|
||||
* Sets the duration of the page to @p seconds when displayed in presentation mode.
|
||||
|
@ -353,7 +353,7 @@ public:
|
|||
/**
|
||||
* Sets @p fields as list of FormField of the page.
|
||||
*/
|
||||
void setFormFields(const QLinkedList<FormField *> &fields);
|
||||
void setFormFields(const QList<FormField *> &fields);
|
||||
|
||||
/**
|
||||
* Deletes the pixmap for the given @p observer
|
||||
|
|
|
@ -158,7 +158,7 @@ public:
|
|||
TextPage *m_text;
|
||||
PageTransition *m_transition;
|
||||
HighlightAreaRect *m_textSelections;
|
||||
QLinkedList<FormField *> formfields;
|
||||
QList<FormField *> formfields;
|
||||
Action *m_openingAction;
|
||||
Action *m_closingAction;
|
||||
double m_duration;
|
||||
|
|
|
@ -190,11 +190,10 @@ static KJSObject docGetField(KJSContext *context, void *object, const KJSArgumen
|
|||
|
||||
QVector<Page *>::const_iterator pIt = doc->m_pagesVector.constBegin(), pEnd = doc->m_pagesVector.constEnd();
|
||||
for (; pIt != pEnd; ++pIt) {
|
||||
const QLinkedList<Okular::FormField *> pageFields = (*pIt)->formFields();
|
||||
QLinkedList<Okular::FormField *>::const_iterator ffIt = pageFields.constBegin(), ffEnd = pageFields.constEnd();
|
||||
for (; ffIt != ffEnd; ++ffIt) {
|
||||
if ((*ffIt)->fullyQualifiedName() == cName) {
|
||||
return JSField::wrapField(context, *ffIt, *pIt);
|
||||
const QList<Okular::FormField *> pageFields = (*pIt)->formFields();
|
||||
for (FormField *form : pageFields) {
|
||||
if (form->fullyQualifiedName() == cName) {
|
||||
return JSField::wrapField(context, form, *pIt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -250,12 +249,12 @@ static KJSObject docGetNthFieldName(KJSContext *ctx, void *object, const KJSArgu
|
|||
int numField = arguments.at(0).toInt32(ctx);
|
||||
|
||||
for (const Page *pIt : qAsConst(doc->m_pagesVector)) {
|
||||
const QLinkedList<Okular::FormField *> pageFields = pIt->formFields();
|
||||
const QList<Okular::FormField *> pageFields = pIt->formFields();
|
||||
|
||||
if (numField < pageFields.size()) {
|
||||
const auto ffIt = pageFields.begin() + numField;
|
||||
const Okular::FormField *form = pageFields[numField];
|
||||
|
||||
return KJSString((*ffIt)->fullyQualifiedName());
|
||||
return KJSString(form->fullyQualifiedName());
|
||||
}
|
||||
|
||||
numField -= pageFields.size();
|
||||
|
|
|
@ -453,7 +453,7 @@ void DviGenerator::loadPages(QVector<Okular::Page *> &pagesVector)
|
|||
|
||||
// filling the pages with the source references rects
|
||||
const QVector<DVI_SourceFileAnchor> &sourceAnchors = m_dviRenderer->sourceAnchors();
|
||||
QVector<QLinkedList<Okular::SourceRefObjectRect *>> refRects(numofpages);
|
||||
QVector<QList<Okular::SourceRefObjectRect *>> refRects(numofpages);
|
||||
for (const DVI_SourceFileAnchor &sfa : sourceAnchors) {
|
||||
if (sfa.page < 1 || (int)sfa.page > numofpages) {
|
||||
continue;
|
||||
|
|
|
@ -825,7 +825,7 @@ void PDFGenerator::loadPages(QVector<Okular::Page *> &pagesVector, int rotation,
|
|||
page->setDuration(p->duration());
|
||||
page->setLabel(p->label());
|
||||
|
||||
QLinkedList<Okular::FormField *> okularFormFields;
|
||||
QList<Okular::FormField *> okularFormFields;
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(0, 89, 0)
|
||||
if (i > 0) { // for page 0 we handle the form fields at the end
|
||||
okularFormFields = getFormFields(p);
|
||||
|
@ -859,7 +859,7 @@ void PDFGenerator::loadPages(QVector<Okular::Page *> &pagesVector, int rotation,
|
|||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(0, 89, 0)
|
||||
const QVector<Poppler::FormFieldSignature *> allSignatures = pdfdoc->signatures();
|
||||
std::unique_ptr<Poppler::Page> page0(pdfdoc->page(0));
|
||||
QLinkedList<Okular::FormField *> page0FormFields = getFormFields(page0.get());
|
||||
QList<Okular::FormField *> page0FormFields = getFormFields(page0.get());
|
||||
|
||||
for (Poppler::FormFieldSignature *s : allSignatures) {
|
||||
bool createSignature = true;
|
||||
|
@ -868,7 +868,7 @@ void PDFGenerator::loadPages(QVector<Okular::Page *> &pagesVector, int rotation,
|
|||
|
||||
// See if the signature is in one of the already loaded page (i.e. 1 to end)
|
||||
for (Okular::Page *p : qAsConst(pagesVector)) {
|
||||
const QLinkedList<Okular::FormField *> pageFormFields = p->formFields();
|
||||
const QList<Okular::FormField *> pageFormFields = p->formFields();
|
||||
if (std::find_if(pageFormFields.begin(), pageFormFields.end(), compareSignatureByFullyQualifiedName) != pageFormFields.end()) {
|
||||
delete s;
|
||||
createSignature = false;
|
||||
|
@ -1296,7 +1296,7 @@ void PDFGenerator::resolveMediaLinkReferences(Okular::Page *page)
|
|||
}
|
||||
}
|
||||
|
||||
const QLinkedList<Okular::FormField *> fields = page->formFields();
|
||||
const QList<Okular::FormField *> fields = page->formFields();
|
||||
for (Okular::FormField *field : fields) {
|
||||
resolveMediaLinkReference(field->activationAction());
|
||||
}
|
||||
|
@ -1913,14 +1913,14 @@ void PDFGenerator::addTransition(Poppler::Page *pdfPage, Okular::Page *page)
|
|||
page->setTransition(transition);
|
||||
}
|
||||
|
||||
QLinkedList<Okular::FormField *> PDFGenerator::getFormFields(Poppler::Page *popplerPage)
|
||||
QList<Okular::FormField *> PDFGenerator::getFormFields(Poppler::Page *popplerPage)
|
||||
{
|
||||
if (!popplerPage) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const QList<Poppler::FormField *> popplerFormFields = popplerPage->formFields();
|
||||
QLinkedList<Okular::FormField *> okularFormFields;
|
||||
QList<Okular::FormField *> okularFormFields;
|
||||
for (Poppler::FormField *f : popplerFormFields) {
|
||||
Okular::FormField *of = nullptr;
|
||||
switch (f->type()) {
|
||||
|
|
|
@ -127,7 +127,7 @@ private:
|
|||
// fetch the transition information and add it to the page
|
||||
void addTransition(Poppler::Page *pdfPage, Okular::Page *page);
|
||||
// fetch the poppler page form fields
|
||||
QLinkedList<Okular::FormField *> getFormFields(Poppler::Page *popplerPage);
|
||||
QList<Okular::FormField *> getFormFields(Poppler::Page *popplerPage);
|
||||
|
||||
Okular::TextPage *abstractTextPage(const QList<Poppler::TextBox *> &text, double height, double width, int rot);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ QVector<const Okular::FormFieldSignature *> getSignatureFormFields(const Okular:
|
|||
const uint endPage = doc->pages() - 1;
|
||||
QVector<const Okular::FormFieldSignature *> signatureFormFields;
|
||||
while (curPage <= endPage) {
|
||||
const QLinkedList<Okular::FormField *> formFields = doc->page(curPage++)->formFields();
|
||||
const QList<Okular::FormField *> formFields = doc->page(curPage++)->formFields();
|
||||
for (Okular::FormField *f : formFields) {
|
||||
if (f->type() == Okular::FormField::FormSignature) {
|
||||
signatureFormFields.append(static_cast<Okular::FormFieldSignature *>(f));
|
||||
|
@ -178,7 +178,7 @@ std::pair<KMessageWidget::MessageType, QString> documentSignatureMessageWidgetTe
|
|||
const uint numPages = doc->pages();
|
||||
bool isDigitallySigned = false;
|
||||
for (uint i = 0; i < numPages; i++) {
|
||||
const QLinkedList<Okular::FormField *> formFields = doc->page(i)->formFields();
|
||||
const QList<Okular::FormField *> formFields = doc->page(i)->formFields();
|
||||
for (const Okular::FormField *f : formFields) {
|
||||
if (f->type() == Okular::FormField::FormSignature) {
|
||||
isDigitallySigned = true;
|
||||
|
|
|
@ -94,7 +94,7 @@ SignatureModelPrivate::~SignatureModelPrivate()
|
|||
static void updateFormFieldSignaturePointer(SignatureItem *item, const QVector<Okular::Page *> &pages)
|
||||
{
|
||||
if (item->form) {
|
||||
const QLinkedList<Okular::FormField *> formFields = pages[item->page]->formFields();
|
||||
const QList<Okular::FormField *> formFields = pages[item->page]->formFields();
|
||||
for (Okular::FormField *f : formFields) {
|
||||
if (item->form->id() == f->id()) {
|
||||
item->form = static_cast<Okular::FormFieldSignature *>(f);
|
||||
|
|
|
@ -1262,7 +1262,7 @@ void PageView::notifySetup(const QVector<Okular::Page *> &pageSet, int setupFlag
|
|||
#ifdef PAGEVIEW_DEBUG
|
||||
qCDebug(OkularUiDebug).nospace() << "cropped geom for " << d->items.last()->pageNumber() << " is " << d->items.last()->croppedGeometry();
|
||||
#endif
|
||||
const QLinkedList<Okular::FormField *> pageFields = page->formFields();
|
||||
const QList<Okular::FormField *> pageFields = page->formFields();
|
||||
for (Okular::FormField *ff : pageFields) {
|
||||
FormWidgetIface *w = FormWidgetFactory::createWidget(ff, this);
|
||||
if (w) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user