Коммит fa9efd98 создал по автору OMP Education's avatar OMP Education Зафиксировано автором k.sagalakova
Просмотр файлов

[notes] Add pageIndex for Note.



Co-Authored-By: default avatarAnton Zernin <a.zernin@omp.ru>
владелец 0b052d6c
// SPDX-FileCopyrightText: 2022 Open Mobile Platform LLC <community@omp.ru> // SPDX-FileCopyrightText: 2022-2023 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause // SPDX-License-Identifier: BSD-3-Clause
import QtQuick 2.0 import QtQuick 2.0
...@@ -34,7 +34,7 @@ Rectangle { ...@@ -34,7 +34,7 @@ Rectangle {
signal clicked() signal clicked()
signal clickedUrl(string url) signal clickedUrl(string url)
signal noteActivate(string noteText, string author) signal noteActivate(string noteText, string author, int pageIndex)
signal contentChanged() signal contentChanged()
signal documentSaved(bool saveStatus) signal documentSaved(bool saveStatus)
signal holding(var lastMouse, var screenCoordinates) signal holding(var lastMouse, var screenCoordinates)
...@@ -91,7 +91,7 @@ Rectangle { ...@@ -91,7 +91,7 @@ Rectangle {
onItemScaleChanged: root.correctPosition() onItemScaleChanged: root.correctPosition()
onClickedUrl: root.clickedUrl(url) onClickedUrl: root.clickedUrl(url)
onClickedGoToPage: root.correctPosition() onClickedGoToPage: root.correctPosition()
onNoteActivated: root.noteActivate(noteText, author) onNoteActivated: root.noteActivate(noteText, author, pageIndex)
onDocumentSaved: root.documentSaved(saveStatus) onDocumentSaved: root.documentSaved(saveStatus)
onNoteRemoved: root.noteRemoved(pageIndex, noteId, result) onNoteRemoved: root.noteRemoved(pageIndex, noteId, result)
}, },
......
// SPDX-FileCopyrightText: 2022 - 2023 Open Mobile Platform LLC <community@omp.ru> // SPDX-FileCopyrightText: 2022-2023 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause // SPDX-License-Identifier: BSD-3-Clause
#include "QQuickWindow" #include "QQuickWindow"
...@@ -538,7 +538,7 @@ void PdfPageContainer::_loadAnnotations() ...@@ -538,7 +538,7 @@ void PdfPageContainer::_loadAnnotations()
if (annotation->type == BaseAnnotation::AnnotationType::HighLight if (annotation->type == BaseAnnotation::AnnotationType::HighLight
|| annotation->type == BaseAnnotation::AnnotationType::Text) { || annotation->type == BaseAnnotation::AnnotationType::Text) {
auto noteItem = new PdfSimpleNote(this, annotation); auto noteItem = new PdfSimpleNote(this, annotation);
connect(noteItem, &PdfSimpleNote::triggered, this, &PdfPageContainer::noteActivate); connect(noteItem, &PdfSimpleNote::triggered, this, &PdfPageContainer::_noteActivate);
connect(this, &PdfPageContainer::yChanged, noteItem, &PdfSimpleNote::clearHighlight); connect(this, &PdfPageContainer::yChanged, noteItem, &PdfSimpleNote::clearHighlight);
noteItem->setOpacity(m_notesPaint ? 1.0 : 0.0); noteItem->setOpacity(m_notesPaint ? 1.0 : 0.0);
noteItem->setX(annotation->rect.x() * pageRate); noteItem->setX(annotation->rect.x() * pageRate);
...@@ -575,3 +575,8 @@ void PdfPageContainer::_prepareBackgroundPage() ...@@ -575,3 +575,8 @@ void PdfPageContainer::_prepareBackgroundPage()
m_backgroundPage->setRenderable(true); m_backgroundPage->setRenderable(true);
m_backgroundPage->setZ(-1); m_backgroundPage->setZ(-1);
} }
void PdfPageContainer::_noteActivate(QString noteText, QString author)
{
emit noteActivate(noteText, author, m_pageSource->pageNumber());
}
// SPDX-FileCopyrightText: 2022 - 2023 Open Mobile Platform LLC <community@omp.ru> // SPDX-FileCopyrightText: 2022-2023 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause // SPDX-License-Identifier: BSD-3-Clause
#ifndef PDFPAGECONTAINER_H #ifndef PDFPAGECONTAINER_H
...@@ -70,7 +70,7 @@ signals: ...@@ -70,7 +70,7 @@ signals:
void annotationsLoaded(); void annotationsLoaded();
void annotationActivate(BaseAnnotation *); void annotationActivate(BaseAnnotation *);
void notesPaintChanged(bool notesPaint); void notesPaintChanged(bool notesPaint);
void noteActivate(QString, QString); void noteActivate(QString, QString, int);
void noteRemoved(int, bool); void noteRemoved(int, bool);
void noteEdited(int, bool); void noteEdited(int, bool);
...@@ -80,6 +80,7 @@ private slots: ...@@ -80,6 +80,7 @@ private slots:
void _updateVisible(); void _updateVisible();
void _loadAnnotations(); void _loadAnnotations();
void _prepareBackgroundPage(); void _prepareBackgroundPage();
void _noteActivate(QString noteText, QString author);
private: private:
PageGeometry m_pageGeometry; PageGeometry m_pageGeometry;
......
// SPDX-FileCopyrightText: 2022 Open Mobile Platform LLC <community@omp.ru> // SPDX-FileCopyrightText: 2022-2023 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause // SPDX-License-Identifier: BSD-3-Clause
#include <QQuickWindow> #include <QQuickWindow>
......
// SPDX-FileCopyrightText: 2022 Open Mobile Platform LLC <community@omp.ru> // SPDX-FileCopyrightText: 2022-2023 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause // SPDX-License-Identifier: BSD-3-Clause
#ifndef PDFSIMPLENOTE_H #ifndef PDFSIMPLENOTE_H
......
...@@ -124,7 +124,7 @@ signals: ...@@ -124,7 +124,7 @@ signals:
void clickedUrl(QString url) const; void clickedUrl(QString url) const;
void clickedGoToPage(int pageNumber, QPointF coordinateOnPage) const; void clickedGoToPage(int pageNumber, QPointF coordinateOnPage) const;
void notesPaintChanged(bool notesPaint); void notesPaintChanged(bool notesPaint);
void noteActivated(QString noteText, QString author); void noteActivated(QString noteText, QString author, int pageIndex);
void documentProviderChanged(BaseDocument* documentProvider); void documentProviderChanged(BaseDocument* documentProvider);
void pdfPathChanged(QString pdfPath); void pdfPathChanged(QString pdfPath);
void pageRangeChanged(QString pageRange); void pageRangeChanged(QString pageRange);
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать