Stamp annotation creation tool

This commit is contained in:
Jakub Melka
2020-12-10 19:27:26 +01:00
parent 75f7f38984
commit 11ad8f2821
7 changed files with 428 additions and 25 deletions

View File

@@ -95,6 +95,7 @@ PDFViewerMainWindow::PDFViewerMainWindow(QWidget* parent) :
m_taskbarButton(new QWinTaskbarButton(this)),
m_progressTaskbarIndicator(nullptr),
m_insertStickyNoteGroup(nullptr),
m_insertStampGroup(nullptr),
m_futureWatcher(nullptr),
m_progressDialog(nullptr),
m_isBusy(false),
@@ -187,6 +188,23 @@ PDFViewerMainWindow::PDFViewerMainWindow(QWidget* parent) :
m_insertStickyNoteGroup->addAction(ui->actionStickyNoteNote);
m_insertStickyNoteGroup->addAction(ui->actionStickyNoteParagraph);
m_insertStampGroup = new QActionGroup(this);
m_insertStampGroup->setExclusionPolicy(QActionGroup::ExclusionPolicy::ExclusiveOptional);
for (pdf::Stamp stamp : { pdf::Stamp::Approved, pdf::Stamp::AsIs, pdf::Stamp::Confidential,
pdf::Stamp::Departmental, pdf::Stamp::Draft, pdf::Stamp::Experimental,
pdf::Stamp::Expired, pdf::Stamp::Final, pdf::Stamp::ForComment,
pdf::Stamp::ForPublicRelease, pdf::Stamp::NotApproved, pdf::Stamp::NotForPublicRelease,
pdf::Stamp::Sold, pdf::Stamp::TopSecret })
{
QString text = pdf::PDFStampAnnotation::getText(stamp);
QAction* action = new QAction(text, this);
action->setObjectName(QString("Stamp_%1").arg(int(stamp)));
action->setData(int(stamp));
action->setCheckable(true);
m_insertStampGroup->addAction(action);
ui->menuStamp->addAction(action);
}
ui->actionStickyNoteComment->setData(int(pdf::TextAnnotationIcon::Comment));
ui->actionStickyNoteHelp->setData(int(pdf::TextAnnotationIcon::Help));
ui->actionStickyNoteInsert->setData(int(pdf::TextAnnotationIcon::Insert));
@@ -349,6 +367,8 @@ PDFViewerMainWindow::PDFViewerMainWindow(QWidget* parent) :
m_toolManager->addTool(createEllipseTool);
pdf::PDFCreateFreehandCurveTool* createFreehandCurveTool = new pdf::PDFCreateFreehandCurveTool(m_pdfWidget->getDrawWidgetProxy(), m_toolManager, ui->actionCreateFreehandCurve, this);
m_toolManager->addTool(createFreehandCurveTool);
pdf::PDFCreateStampTool* createStampTool = new pdf::PDFCreateStampTool(m_pdfWidget->getDrawWidgetProxy(), m_toolManager, m_insertStampGroup, this);
m_toolManager->addTool(createStampTool);
m_annotationManager = new pdf::PDFWidgetAnnotationManager(m_pdfWidget->getDrawWidgetProxy(), this);
connect(m_annotationManager, &pdf::PDFWidgetAnnotationManager::actionTriggered, this, &PDFViewerMainWindow::onActionTriggered);

View File

@@ -191,6 +191,7 @@ private:
pdf::PDFCertificateStore m_certificateStore;
std::vector<pdf::PDFSignatureVerificationResult> m_signatures;
QActionGroup* m_insertStickyNoteGroup;
QActionGroup* m_insertStampGroup;
QFuture<AsyncReadingResult> m_future;
QFutureWatcher<AsyncReadingResult>* m_futureWatcher;

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>431</width>
<height>333</height>
<width>590</width>
<height>476</height>
</rect>
</property>
<property name="windowTitle">
@@ -19,7 +19,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>431</width>
<width>590</width>
<height>21</height>
</rect>
</property>
@@ -146,6 +146,11 @@
<addaction name="actionStickyNoteNote"/>
<addaction name="actionStickyNoteParagraph"/>
</widget>
<widget class="QMenu" name="menuStamp">
<property name="title">
<string>Stamp</string>
</property>
</widget>
<addaction name="menuSticky_Note"/>
<addaction name="actionCreateHyperlink"/>
<addaction name="actionInlineText"/>
@@ -154,6 +159,7 @@
<addaction name="actionCreatePolygon"/>
<addaction name="actionCreateEllipse"/>
<addaction name="actionCreateFreehandCurve"/>
<addaction name="menuStamp"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>