Открыть боковую панель
Aurora OS
Libraries
AmberPDF QML Plugin
Коммиты
7d351ab6
Коммит
7d351ab6
создал
Ноя 21, 2024
по автору
2eg01nd
Просмотр файлов
[FIX] Fix the bug when the page wasn't reredered after updating the document path.
владелец
d857a48a
Изменения
9
Скрыть пробелы
Построчно
Рядом
plugin/src/documentmapper.cpp
Просмотр файла @
7d351ab6
...
@@ -176,9 +176,6 @@ void DocumentMapper::setDocumentProvider(BasePdfDocument *documentProvider)
...
@@ -176,9 +176,6 @@ void DocumentMapper::setDocumentProvider(BasePdfDocument *documentProvider)
if
(
documentProvider
==
nullptr
)
if
(
documentProvider
==
nullptr
)
return
;
return
;
if
(
m_documentProvider
==
documentProvider
)
return
;
m_documentProvider
=
documentProvider
;
m_documentProvider
=
documentProvider
;
const
auto
pageCount
=
m_documentProvider
->
count
();
const
auto
pageCount
=
m_documentProvider
->
count
();
...
@@ -502,7 +499,7 @@ PagePosition DocumentMapper::actualPagePosition(int pageIndex) const
...
@@ -502,7 +499,7 @@ PagePosition DocumentMapper::actualPagePosition(int pageIndex) const
PageGeometry
DocumentMapper
::
originalPageGeometry
(
int
pageIndex
)
const
PageGeometry
DocumentMapper
::
originalPageGeometry
(
int
pageIndex
)
const
{
{
if
(
pageIndex
<
0
||
pageIndex
>
m_originalPagesMap
.
pages
.
size
())
if
(
!
(
pageIndex
>=
0
&&
pageIndex
<
m_originalPagesMap
.
pages
.
size
())
)
return
{
};
return
{
};
return
m_originalPagesMap
.
pages
.
at
(
pageIndex
);
return
m_originalPagesMap
.
pages
.
at
(
pageIndex
);
...
...
plugin/src/notesmodel.cpp
Просмотр файла @
7d351ab6
...
@@ -69,6 +69,13 @@ bool NotesModel::isLoading() const
...
@@ -69,6 +69,13 @@ bool NotesModel::isLoading() const
return
m_loading
;
return
m_loading
;
}
}
void
NotesModel
::
clear
()
{
beginResetModel
();
m_notes
.
clear
();
endResetModel
();
}
void
NotesModel
::
_collectNotes
()
void
NotesModel
::
_collectNotes
()
{
{
beginResetModel
();
beginResetModel
();
...
@@ -81,9 +88,8 @@ void NotesModel::_collectNotes()
...
@@ -81,9 +88,8 @@ void NotesModel::_collectNotes()
if
(
annotation
->
type
==
BaseAnnotation
::
AnnotationType
::
HighLight
if
(
annotation
->
type
==
BaseAnnotation
::
AnnotationType
::
HighLight
||
annotation
->
type
==
BaseAnnotation
::
AnnotationType
::
Text
)
{
||
annotation
->
type
==
BaseAnnotation
::
AnnotationType
::
Text
)
{
m_notes
.
append
(
annotation
);
if
(
!
annotation
->
isSearchResult
)
m_notes
.
append
(
annotation
);
continue
;
}
}
}
}
...
...
plugin/src/notesmodel.h
Просмотр файла @
7d351ab6
...
@@ -31,6 +31,7 @@ public:
...
@@ -31,6 +31,7 @@ public:
void
setPageSource
(
QSharedPointer
<
BasePage
>
pageSource
);
void
setPageSource
(
QSharedPointer
<
BasePage
>
pageSource
);
bool
isLoading
()
const
;
bool
isLoading
()
const
;
void
clear
();
signals:
signals:
void
loadingChanged
(
bool
);
void
loadingChanged
(
bool
);
...
...
plugin/src/pageswithnotesmodel.cpp
Просмотр файла @
7d351ab6
...
@@ -57,6 +57,17 @@ QHash<int, QByteArray> PagesWithNotesModel::roleNames() const
...
@@ -57,6 +57,17 @@ QHash<int, QByteArray> PagesWithNotesModel::roleNames() const
};
};
}
}
void
PagesWithNotesModel
::
clear
()
{
beginResetModel
();
QMap
<
int
,
NotesModel
*>::
const_iterator
i
;
for
(
i
=
m_notesModels
.
constBegin
();
i
!=
m_notesModels
.
constEnd
();
++
i
)
{
i
.
value
()
->
clear
();
i
.
value
()
->
deleteLater
();
}
m_notesModels
.
clear
();
endResetModel
();
}
void
PagesWithNotesModel
::
setNewData
(
BasePdfDocument
*
provider
)
void
PagesWithNotesModel
::
setNewData
(
BasePdfDocument
*
provider
)
{
{
if
(
provider
==
nullptr
||
provider
==
m_documentProvider
)
if
(
provider
==
nullptr
||
provider
==
m_documentProvider
)
...
...
plugin/src/pageswithnotesmodel.h
Просмотр файла @
7d351ab6
...
@@ -29,6 +29,7 @@ public:
...
@@ -29,6 +29,7 @@ public:
void
setNewData
(
BasePdfDocument
*
newData
);
void
setNewData
(
BasePdfDocument
*
newData
);
void
clear
();
public
slots
:
public
slots
:
void
preLoadAllNotes
();
void
preLoadAllNotes
();
...
...
plugin/src/pdfium-provider/pdfdocumentitem.cpp
Просмотр файла @
7d351ab6
...
@@ -253,6 +253,7 @@ void PdfDocumentItem::setPath(const QString &path)
...
@@ -253,6 +253,7 @@ void PdfDocumentItem::setPath(const QString &path)
m_loadedPages
.
clear
();
m_loadedPages
.
clear
();
m_pagesInProcess
.
clear
();
m_pagesInProcess
.
clear
();
m_baseBookmarks
.
clear
();
m_baseBookmarks
.
clear
();
m_foundPhrases
.
clear
();
if
(
m_pdfiumDocument
==
nullptr
)
{
if
(
m_pdfiumDocument
==
nullptr
)
{
m_status
=
DocumentStatus
::
Error
;
m_status
=
DocumentStatus
::
Error
;
...
...
plugin/src/pdfview.cpp
Просмотр файла @
7d351ab6
...
@@ -685,8 +685,14 @@ void PdfView::setDocumentProvider(BasePdfDocument *documentProvider)
...
@@ -685,8 +685,14 @@ void PdfView::setDocumentProvider(BasePdfDocument *documentProvider)
m_mapper
->
setSpecialPageIndexes
(
indexIntervals
,
pageIndexes
);
m_mapper
->
setSpecialPageIndexes
(
indexIntervals
,
pageIndexes
);
}
}
m_specialPagesCount
=
m_mapper
->
specialPagesCount
();
m_specialPagesCount
=
m_mapper
->
specialPagesCount
();
m_pages
.
clear
();
m_paintedPages
.
clear
();
m_pageCheckerItems
.
clear
();
m_pageNumberItems
.
clear
();
m_documentProvider
->
startLoadBookmarks
();
m_documentProvider
->
startLoadBookmarks
();
m_pagesWithNotesModel
->
clear
();
m_pagesWithNotesModel
->
setNewData
(
m_documentProvider
);
m_pagesWithNotesModel
->
setNewData
(
m_documentProvider
);
m_searchPhraseModel
->
clear
();
emit
countChanged
(
m_count
);
emit
countChanged
(
m_count
);
emit
specialPagesCountChanged
(
m_specialPagesCount
);
emit
specialPagesCountChanged
(
m_specialPagesCount
);
emit
maxPageIndexChanged
(
m_mapper
->
maxSpecialIndex
());
emit
maxPageIndexChanged
(
m_mapper
->
maxSpecialIndex
());
...
...
plugin/src/pdfwordmodel.cpp
Просмотр файла @
7d351ab6
...
@@ -44,11 +44,20 @@ QHash<int, QByteArray> PdfWordModel::roleNames() const
...
@@ -44,11 +44,20 @@ QHash<int, QByteArray> PdfWordModel::roleNames() const
};
};
}
}
void
PdfWordModel
::
setNewData
(
QString
phrase
,
const
QVector
<
BaseWord
*>
&
newData
)
void
PdfWordModel
::
clear
()
{
{
beginResetModel
();
beginResetModel
();
qDeleteAll
(
m_data
);
qDeleteAll
(
m_data
);
m_data
.
clear
();
m_data
.
clear
();
m_phrase
=
""
;
endResetModel
();
}
void
PdfWordModel
::
setNewData
(
QString
phrase
,
const
QVector
<
BaseWord
*>
&
newData
)
{
clear
();
beginResetModel
();
m_data
=
newData
;
m_data
=
newData
;
m_phrase
=
phrase
;
m_phrase
=
phrase
;
endResetModel
();
endResetModel
();
...
...
plugin/src/pdfwordmodel.h
Просмотр файла @
7d351ab6
...
@@ -30,6 +30,7 @@ public:
...
@@ -30,6 +30,7 @@ public:
void
setNewData
(
QString
phrase
,
const
QVector
<
BaseWord
*>
&
newData
);
void
setNewData
(
QString
phrase
,
const
QVector
<
BaseWord
*>
&
newData
);
Q_INVOKABLE
QString
getPhrase
();
Q_INVOKABLE
QString
getPhrase
();
void
clear
();
private:
private:
QVector
<
BaseWord
*>
m_data
;
QVector
<
BaseWord
*>
m_data
;
QString
m_phrase
;
QString
m_phrase
;
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать