source: terepaima/terepaima-0.4.16/sources/mainwindow.h @ 35bdadc

stretch
Last change on this file since 35bdadc was 35bdadc, checked in by pbuitrago@…>, 7 years ago

Se agregaron las librerias necesarias para la gestion de dispositivos criptograficos y se modifico mainwindow.cpp y mainwindow.h para la gestion de los dispositivos criptograficos

  • Property mode set to 100644
File size: 17.6 KB
Line 
1/*
2
3Copyright 2014 S. Razi Alavizadeh
4Copyright 2012-2015 Adam Reichold
5Copyright 2012 Michał Trybus
6Copyright 2012 Alexander Volkov
7
8This file is part of qpdfview.
9
10qpdfview is free software: you can redistribute it and/or modify
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation, either version 2 of the License, or
13(at your option) any later version.
14
15qpdfview is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with qpdfview.  If not, see <http://www.gnu.org/licenses/>.
22
23*/
24
25#ifndef MAINWINDOW_H
26#define MAINWINDOW_H
27
28#include <QMainWindow>
29
30#include <QPointer>
31
32#ifdef WITH_DBUS
33
34#include <QDBusAbstractAdaptor>
35#include <QListWidget>
36#include <QStandardItemModel>
37
38//__________________________________
39#include <QHBoxLayout>
40#include <QVBoxLayout>
41#include <QLabel>
42#include <QLineEdit>
43#include <QPushButton>
44#include <QDialog>
45#include "cryptotoken.h"
46//__________________________________
47
48#endif // WITH_DBUS
49
50class QCheckBox;
51class QDateTime;
52class QGraphicsView;
53class QFileInfo;
54class QModelIndex;
55class QShortcut;
56class QTableView;
57class QTreeView;
58class QWidgetAction;
59
60#include "renderparam.h"
61
62namespace qpdfview
63{
64
65class Settings;
66class DocumentView;
67class TabWidget;
68class TreeView;
69class ComboBox;
70class MappingSpinBox;
71class SearchLineEdit;
72class SearchableMenu;
73class RecentlyUsedMenu;
74class RecentlyClosedMenu;
75class BookmarkModel;
76class Database;
77class ShortcutHandler;
78class HelpDialog;
79
80class MainWindow : public QMainWindow
81{
82    Q_OBJECT
83
84    friend class MainWindowAdaptor;
85
86public:
87    explicit MainWindow(QWidget* parent = 0);
88
89    QSize sizeHint() const;
90    QMenu* createPopupMenu();
91
92public slots:
93    void show();
94
95    bool open(const QString& filePath, int page = -1, const QRectF& highlight = QRectF(), bool quiet = false);
96    bool openInNewTab(const QString& filePath, int page = -1, const QRectF& highlight = QRectF(), bool quiet = false);
97
98    bool jumpToPageOrOpenInNewTab(const QString& filePath, int page = -1, bool refreshBeforeJump = false, const QRectF& highlight = QRectF(), bool quiet = false);
99
100    void startSearch(const QString& text);
101
102    //void on_gestionar_PIN();
103
104    //void closeDialog(QDialog *ventana);
105
106protected slots:
107
108    void on_tabWidget_currentChanged(int index);
109    void on_tabWidget_tabCloseRequested(int index);
110    void on_tabWidget_tabContextMenuRequested(const QPoint& globalPos, int index);
111
112    void on_currentTab_documentChanged();
113    void on_currentTab_documentModified();
114
115    void on_currentTab_numberOfPagesChaned(int numberOfPages);
116    void on_currentTab_currentPageChanged(int currentPage);
117
118    void on_currentTab_canJumpChanged(bool backward, bool forward);
119
120    void on_currentTab_continuousModeChanged(bool continuousMode);
121    void on_currentTab_layoutModeChanged(LayoutMode layoutMode);
122    void on_currentTab_rightToLeftModeChanged(bool rightToLeftMode);
123    void on_currentTab_scaleModeChanged(ScaleMode scaleMode);
124    void on_currentTab_scaleFactorChanged(qreal scaleFactor);
125    void on_currentTab_rotationChanged(Rotation rotation);
126
127    void on_currentTab_linkClicked(int page);
128    void on_currentTab_linkClicked(bool newTab, const QString& filePath, int page);
129
130    void on_currentTab_renderFlagsChanged(qpdfview::RenderFlags renderFlags);
131
132    void on_currentTab_invertColorsChanged(bool invertColors);
133    void on_currentTab_convertToGrayscaleChanged(bool convertToGrayscale);
134    void on_currentTab_trimMarginsChanged(bool trimMargins);
135
136    void on_currentTab_compositionModeChanged(CompositionMode compositionMode);
137
138    void on_currentTab_highlightAllChanged(bool highlightAll);
139    void on_currentTab_rubberBandModeChanged(RubberBandMode rubberBandMode);
140
141    void on_currentTab_searchFinished();
142    void on_currentTab_searchProgressChanged(int progress);
143
144    void on_currentTab_customContextMenuRequested(const QPoint& pos);
145
146    void on_currentPage_editingFinished();
147    void on_currentPage_returnPressed();
148
149    void on_scaleFactor_activated(int index);
150    void on_scaleFactor_editingFinished();
151    void on_scaleFactor_returnPressed();
152
153    void on_open_triggered();
154    void on_openInNewTab_triggered();
155    void on_openCopyInNewTab_triggered();
156    void on_openContainingFolder_triggered();
157    void on_refresh_triggered();
158    void on_saveCopy_triggered();
159    void on_saveAs_triggered();
160    void on_print_triggered();
161
162    void on_recentlyUsed_openTriggered(const QString& filePath);
163
164    void on_previousPage_triggered();
165    void on_nextPage_triggered();
166    void on_firstPage_triggered();
167    void on_lastPage_triggered();
168
169    void on_setFirstPage_triggered();
170
171    void on_jumpToPage_triggered();
172
173    void on_jumpBackward_triggered();
174    void on_jumpForward_triggered();
175
176    void on_search_triggered();
177    void on_findPrevious_triggered();
178    void on_findNext_triggered();
179    void on_cancelSearch_triggered();
180
181    void on_copyToClipboardMode_triggered(bool checked);
182    void on_addAnnotationMode_triggered(bool checked);
183
184    void on_settings_triggered();
185
186    void on_continuousMode_triggered(bool checked);
187    void on_twoPagesMode_triggered(bool checked);
188    void on_twoPagesWithCoverPageMode_triggered(bool checked);
189    void on_multiplePagesMode_triggered(bool checked);
190
191    void on_rightToLeftMode_triggered(bool checked);
192
193    void on_zoomIn_triggered();
194    void on_zoomOut_triggered();
195    void on_originalSize_triggered();
196
197    void on_fitToPageWidthMode_triggered(bool checked);
198    void on_fitToPageSizeMode_triggered(bool checked);
199
200    void on_rotateLeft_triggered();
201    void on_rotateRight_triggered();
202
203    void on_invertColors_triggered(bool checked);
204    void on_convertToGrayscale_triggered(bool checked);
205    void on_trimMargins_triggered(bool checked);
206    void on_darkenWithPaperColor_triggered(bool checked);
207    void on_lightenWithPaperColor_triggered(bool checked);
208
209    void on_fonts_triggered();
210
211    void on_fullscreen_triggered(bool checked);
212    void on_presentation_triggered();
213
214    void on_previousTab_triggered();
215    void on_nextTab_triggered();
216    void on_closeTab_triggered();
217    void on_closeAllTabs_triggered();
218    void on_closeAllTabsButCurrentTab_triggered();
219
220    void on_restoreMostRecentlyClosedTab_triggered();
221
222    void on_recentlyClosed_tabActionTriggered(QAction* tabAction);
223
224    void on_tabAction_triggered();
225    void on_tabShortcut_activated();
226
227    void on_previousBookmark_triggered();
228    void on_nextBookmark_triggered();
229    void on_addBookmark_triggered();
230    void on_removeBookmark_triggered();
231    void on_removeAllBookmarks_triggered();
232
233    void on_bookmarksMenu_aboutToShow();
234
235    void on_bookmark_openTriggered(const QString& absoluteFilePath);
236    void on_bookmark_openInNewTabTriggered(const QString& absoluteFilePath);
237    void on_bookmark_jumpToPageTriggered(const QString& absoluteFilePath, int page);
238    void on_bookmark_removeBookmarkTriggered(const QString& absoluteFilePath);
239
240    void on_contents_triggered();
241    void on_about_triggered();
242
243    void on_focusCurrentPage_activated();
244    void on_focusScaleFactor_activated();
245
246    void on_toggleToolBars_triggered(bool checked);
247    void on_toggleMenuBar_triggered(bool checked);
248
249    void on_searchInitiated(const QString& text, bool modified);
250    void on_highlightAll_clicked(bool checked);
251
252    void on_dock_dockLocationChanged(Qt::DockWidgetArea area);
253
254    void on_outline_sectionCountChanged();
255    void on_outline_clicked(const QModelIndex& index);
256
257    void on_properties_sectionCountChanged();
258    void on_detailsSignatureView_sectionCountChanged();
259
260    void on_thumbnails_dockLocationChanged(Qt::DockWidgetArea area);
261    void on_thumbnails_verticalScrollBar_valueChanged(int value);
262
263    void on_bookmarks_sectionCountChanged();
264    void on_bookmarks_clicked(const QModelIndex& index);
265    void on_bookmarks_contextMenuRequested(const QPoint& pos);
266
267    void on_search_sectionCountChanged();
268    void on_search_visibilityChanged(bool visible);
269    void on_search_clicked(const QModelIndex& index);
270
271    void on_saveDatabase_timeout();
272//_______________________________________________________________________________________________
273    void on_verify_signature();
274    void on_signature();
275    void on_windowCertificate();
276    void on_selectCertificate();
277
278    void on_managePIN();
279    void on_windowPIN(int x);
280    void on_currentChanged_selection();
281    void on_close_windowCertificate();
282    void on_close_windowPIN();
283    //QString verify_signature();
284    //QStringList verify_signature();
285    QStandardItemModel* verify_signature();
286    QStandardItemModel* view_table_verify_signature();
287    //QList<QStringList> certificateInformationListN;
288//_______________________________________________________________________________________________
289
290protected:
291    bool eventFilter(QObject* target, QEvent* event);
292
293    void closeEvent(QCloseEvent* event);
294
295    void dragEnterEvent(QDragEnterEvent* event);
296    void dropEvent(QDropEvent* event);
297
298private:
299    Q_DISABLE_COPY(MainWindow)
300
301    static Settings* s_settings;
302    static Database* s_database;
303    static ShortcutHandler* s_shortcutHandler;
304
305    void prepareStyle();
306
307    TabWidget* m_tabWidget;
308
309    DocumentView* currentTab() const;
310    DocumentView* tab(int index) const;
311    QList< DocumentView* > tabs() const;
312
313    bool senderIsCurrentTab() const;
314
315    int addTab(DocumentView* tab);
316    void closeTab(DocumentView* tab);
317
318    bool saveModifications(DocumentView* tab);
319
320    void disconnectCurrentTabChanged();
321    void reconnectCurrentTabChanged();
322
323    void setWindowTitleForCurrentTab();
324    void setCurrentPageSuffixForCurrentTab();
325
326    BookmarkModel* bookmarkModelForCurrentTab(bool create = false);
327
328    QAction* sourceLinkActionForCurrentTab(QObject* parent, const QPoint& pos);
329
330    class RestoreTab;
331
332    QTimer* m_saveDatabaseTimer;
333
334    void prepareDatabase();
335
336    void scheduleSaveDatabase();
337    void scheduleSaveTabs();
338    void scheduleSaveBookmarks();
339    void scheduleSavePerFileSettings();
340
341    class TextValueMapper;
342
343    MappingSpinBox* m_currentPageSpinBox;
344    QWidgetAction* m_currentPageAction;
345
346    ComboBox* m_scaleFactorComboBox;
347    QWidgetAction* m_scaleFactorAction;
348
349    SearchLineEdit* m_searchLineEdit;
350    QCheckBox* m_matchCaseCheckBox;
351    QCheckBox* m_wholeWordsCheckBox;
352    QCheckBox* m_highlightAllCheckBox;
353
354    void createWidgets();
355
356    QAction* m_openAction;
357    QAction* m_openInNewTabAction;
358    QAction* m_openCopyInNewTabAction;
359    QAction* m_openContainingFolderAction;
360    QAction* m_refreshAction;
361    QAction* m_saveCopyAction;
362    QAction* m_saveAsAction;
363    QAction* m_printAction;
364    QAction* m_exitAction;
365    QAction* m_verify_signature;
366
367    QAction* m_previousPageAction;
368    QAction* m_nextPageAction;
369    QAction* m_firstPageAction;
370    QAction* m_lastPageAction;
371
372    QAction* m_setFirstPageAction;
373
374    QAction* m_jumpToPageAction;
375
376    QAction* m_jumpBackwardAction;
377    QAction* m_jumpForwardAction;
378
379    QAction* m_searchAction;
380    QAction* m_findPreviousAction;
381    QAction* m_findNextAction;
382    QAction* m_cancelSearchAction;
383
384    QAction* m_copyToClipboardModeAction;
385    QAction* m_addAnnotationModeAction;
386
387    QAction* m_settingsAction;
388
389    QAction* m_continuousModeAction;
390    QAction* m_twoPagesModeAction;
391    QAction* m_twoPagesWithCoverPageModeAction;
392    QAction* m_multiplePagesModeAction;
393
394    QAction* m_rightToLeftModeAction;
395
396    QAction* m_zoomInAction;
397    QAction* m_zoomOutAction;
398    QAction* m_originalSizeAction;
399
400    QAction* m_fitToPageWidthModeAction;
401    QAction* m_fitToPageSizeModeAction;
402
403    QAction* m_rotateLeftAction;
404    QAction* m_rotateRightAction;
405
406    QAction* m_invertColorsAction;
407    QAction* m_convertToGrayscaleAction;
408    QAction* m_trimMarginsAction;
409    QAction* m_darkenWithPaperColorAction;
410    QAction* m_lightenWithPaperColorAction;
411
412    QAction* m_fontsAction;
413
414    QAction* m_fullscreenAction;
415    QAction* m_presentationAction;
416
417    QAction* m_previousTabAction;
418    QAction* m_nextTabAction;
419
420    QAction* m_closeTabAction;
421    QAction* m_closeAllTabsAction;
422    QAction* m_closeAllTabsButCurrentTabAction;
423
424    QAction* m_restoreMostRecentlyClosedTabAction;
425
426    QShortcut* m_tabShortcuts[9];
427
428    QAction* m_previousBookmarkAction;
429    QAction* m_nextBookmarkAction;
430
431    QAction* m_addBookmarkAction;
432    QAction* m_removeBookmarkAction;
433    QAction* m_removeAllBookmarksAction;
434
435    QAction* m_contentsAction;
436    QAction* m_aboutAction;
437
438    QAction* createAction(const QString& text, const QString& objectName, const QIcon& icon, const QList< QKeySequence >& shortcuts, const char* member, bool checkable = false, bool checked = false);
439    QAction* createAction(const QString& text, const QString& objectName, const QIcon& icon, const QKeySequence& shortcut, const char* member, bool checkable = false, bool checked = false);
440    QAction* createAction(const QString& text, const QString& objectName, const QString& iconName, const QList< QKeySequence >& shortcuts, const char* member, bool checkable = false, bool checked = false);
441    QAction* createAction(const QString& text, const QString& objectName, const QString& iconName, const QKeySequence& shortcut, const char* member, bool checkable = false, bool checked = false);
442
443    void createActions();
444
445    QToolBar* m_fileToolBar;
446    QToolBar* m_editToolBar;
447    QToolBar* m_viewToolBar;
448
449    QShortcut* m_focusCurrentPageShortcut;
450    QShortcut* m_focusScaleFactorShortcut;
451
452    QToolBar* createToolBar(const QString& text, const QString& objectName, const QStringList& actionNames, const QList< QAction* >& actions);
453
454    void createToolBars();
455
456    QDockWidget* m_outlineDock;
457    TreeView* m_outlineView;
458
459    QDockWidget* m_propertiesDock;
460    QDockWidget* m_detailsSignatureDock;
461    QTableView* m_propertiesView;
462    QTableView* m_detailsSignatureView;
463    //QListWidget* m_detailsSignatureView;
464    QTableView* m_tableVerifySign;
465
466    QDockWidget* m_thumbnailsDock;
467    QGraphicsView* m_thumbnailsView;
468
469    QDockWidget* m_bookmarksDock;
470    QTableView* m_bookmarksView;
471
472    QDockWidget* m_searchDock;
473    QTreeView* m_searchView;
474    QWidget* m_searchWidget;
475
476    QDockWidget* createDock(const QString& text, const QString& objectName, const QKeySequence& toggleViewShortcut);
477
478
479
480    void createSearchDock();
481
482    void createDocks();
483
484    QMenu* m_fileMenu;
485    RecentlyUsedMenu* m_recentlyUsedMenu;
486    QMenu* m_editMenu;
487    QMenu* m_viewMenu;
488    QMenu* m_compositionModeMenu;
489    SearchableMenu* m_tabsMenu;
490    RecentlyClosedMenu* m_recentlyClosedMenu;
491    SearchableMenu* m_bookmarksMenu;
492    QMenu* m_helpMenu;
493
494    //_______________________________________________________________________
495
496    QMenu* m_security;
497    QAction* m_signature;
498    QDialog* m_pin;
499    QHBoxLayout* m_layoutContrasenia;
500    QHBoxLayout* m_layoutBotones;
501    QVBoxLayout* m_layoutPrincipal;
502    QVBoxLayout* m_layoutmesage;
503    QLabel* m_mesage;
504    QLabel* m_etiquetaContrasenia;
505    QLineEdit* m_campoContrasenia;
506    QPushButton* m_botonAceptar;
507    QPushButton* m_botonCancelar;
508
509    QDialog* m_certificate;
510    QHBoxLayout* m_layoutmensaje;
511    QHBoxLayout* m_ClayoutBotones;
512    QHBoxLayout* m_layoutTableView;
513    QVBoxLayout* m_ClayoutPrincipal;
514
515    QLabel* m_mensaje;
516
517    QTableView* m_listCertificate;
518    QStandardItemModel* m_model;
519
520    QPushButton* m_CbotonAceptar;
521    QPushButton* m_CbotonCancelar;
522    CryptoToken* m_nct;
523    int certSelect; //indice del certificado seleccionado
524    QList<QStringList> certificateInformationListN;
525    QString close_windowCertificate;
526    QString close_PIN;
527
528    //_______________________________________________________________________
529    bool m_bookmarksMenuIsDirty;
530
531    void createMenus();
532
533    int m_tabBarHadPolicy;
534
535    bool m_fileToolBarWasVisible;
536    bool m_editToolBarWasVisible;
537    bool m_viewToolBarWasVisible;
538
539    QAction* m_toggleToolBarsAction;
540    QAction* m_toggleMenuBarAction;
541
542    QPointer< HelpDialog > m_helpDialog;
543
544};
545
546#ifdef WITH_DBUS
547
548class MainWindowAdaptor : public QDBusAbstractAdaptor
549{
550    Q_OBJECT
551    Q_CLASSINFO("D-Bus Interface", "local.qpdfview.MainWindow")
552
553public:
554    explicit MainWindowAdaptor(MainWindow* mainWindow);
555
556public slots:
557    Q_NOREPLY void raiseAndActivate();
558
559    bool open(const QString& absoluteFilePath, int page = -1, const QRectF& highlight = QRectF(), bool quiet = false);
560    bool openInNewTab(const QString& absoluteFilePath, int page = -1, const QRectF& highlight = QRectF(), bool quiet = false);
561
562    bool jumpToPageOrOpenInNewTab(const QString& absoluteFilePath, int page = -1, bool refreshBeforeJump = false, const QRectF& highlight = QRectF(), bool quiet = false);
563
564    Q_NOREPLY void startSearch(const QString& text);
565
566
567    Q_NOREPLY void previousPage();
568    Q_NOREPLY void nextPage();
569    Q_NOREPLY void firstPage();
570    Q_NOREPLY void lastPage();
571
572    Q_NOREPLY void previousBookmark();
573    Q_NOREPLY void nextBookmark();
574
575    bool jumpToBookmark(const QString& label);
576
577
578    Q_NOREPLY void continuousModeAction(bool checked);
579    Q_NOREPLY void twoPagesModeAction(bool checked);
580    Q_NOREPLY void twoPagesWithCoverPageModeAction(bool checked);
581    Q_NOREPLY void multiplePagesModeAction(bool checked);
582
583    Q_NOREPLY void fitToPageWidthModeAction(bool checked);
584    Q_NOREPLY void fitToPageSizeModeAction(bool checked);
585
586    Q_NOREPLY void convertToGrayscaleAction(bool checked);
587    Q_NOREPLY void invertColorsAction(bool checked);
588
589    Q_NOREPLY void fullscreenAction(bool checked);
590    Q_NOREPLY void presentationAction();
591
592
593    Q_NOREPLY void closeTab();
594    Q_NOREPLY void closeAllTabs();
595    Q_NOREPLY void closeAllTabsButCurrentTab();
596
597    bool closeTab(const QString& absoluteFilePath);
598
599private:
600    MainWindow* mainWindow() const;
601
602};
603
604#endif // WITH_DBUS
605
606} // qpdfview
607
608#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.