[e0e368b] | 1 | /* |
---|
| 2 | |
---|
| 3 | Copyright 2015 S. Razi Alavizadeh |
---|
| 4 | Copyright 2012-2015 Adam Reichold |
---|
| 5 | Copyright 2012 Alexander Volkov |
---|
| 6 | |
---|
| 7 | This file is part of qpdfview. |
---|
| 8 | |
---|
| 9 | qpdfview is free software: you can redistribute it and/or modify |
---|
| 10 | it under the terms of the GNU General Public License as published by |
---|
| 11 | the Free Software Foundation, either version 2 of the License, or |
---|
| 12 | (at your option) any later version. |
---|
| 13 | |
---|
| 14 | qpdfview is distributed in the hope that it will be useful, |
---|
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | GNU General Public License for more details. |
---|
| 18 | |
---|
| 19 | You should have received a copy of the GNU General Public License |
---|
| 20 | along with qpdfview. If not, see <http://www.gnu.org/licenses/>. |
---|
| 21 | |
---|
| 22 | */ |
---|
| 23 | |
---|
| 24 | #ifndef SETTINGS_H |
---|
| 25 | #define SETTINGS_H |
---|
| 26 | |
---|
| 27 | #include <QColor> |
---|
| 28 | #include <QIcon> |
---|
| 29 | #include <QKeySequence> |
---|
| 30 | #include <QObject> |
---|
| 31 | #include <QPrinter> |
---|
| 32 | |
---|
| 33 | class QSettings; |
---|
| 34 | |
---|
| 35 | #include "global.h" |
---|
| 36 | #include "printoptions.h" |
---|
| 37 | |
---|
| 38 | namespace qpdfview |
---|
| 39 | { |
---|
| 40 | |
---|
| 41 | class Settings : public QObject |
---|
| 42 | { |
---|
| 43 | Q_OBJECT |
---|
| 44 | |
---|
| 45 | public: |
---|
| 46 | static Settings* instance(); |
---|
| 47 | ~Settings(); |
---|
| 48 | |
---|
| 49 | // page item |
---|
| 50 | |
---|
| 51 | class PageItem |
---|
| 52 | { |
---|
| 53 | public: |
---|
| 54 | void sync(); |
---|
| 55 | |
---|
| 56 | int cacheSize() const { return m_cacheSize; } |
---|
| 57 | void setCacheSize(int cacheSize); |
---|
| 58 | |
---|
| 59 | bool useTiling() const { return m_useTiling; } |
---|
| 60 | void setUseTiling(bool useTiling); |
---|
| 61 | |
---|
| 62 | int tileSize() const { return m_tileSize; } |
---|
| 63 | |
---|
| 64 | const QIcon& progressIcon() const { return m_progressIcon; } |
---|
| 65 | void setProgressIcon(const QIcon& progressIcon) { m_progressIcon = progressIcon; } |
---|
| 66 | |
---|
| 67 | const QIcon& errorIcon() const { return m_errorIcon; } |
---|
| 68 | void setErrorIcon(const QIcon& errorIcon) { m_errorIcon = errorIcon; } |
---|
| 69 | |
---|
| 70 | bool keepObsoletePixmaps() const { return m_keepObsoletePixmaps; } |
---|
| 71 | void setKeepObsoletePixmaps(bool keepObsoletePixmaps); |
---|
| 72 | |
---|
| 73 | bool useDevicePixelRatio() const { return m_useDevicePixelRatio; } |
---|
| 74 | void setUseDevicePixelRatio(bool useDevicePixelRatio); |
---|
| 75 | |
---|
| 76 | bool decoratePages() const { return m_decoratePages; } |
---|
| 77 | void setDecoratePages(bool decoratePages); |
---|
| 78 | |
---|
| 79 | bool decorateLinks() const { return m_decorateLinks; } |
---|
| 80 | void setDecorateLinks(bool decorateLinks); |
---|
| 81 | |
---|
| 82 | bool decorateFormFields() const { return m_decorateFormFields; } |
---|
| 83 | void setDecorateFormFields(bool decorateFormFields); |
---|
| 84 | |
---|
| 85 | const QColor& backgroundColor() const { return m_backgroundColor; } |
---|
| 86 | void setBackgroundColor(const QColor& backgroundColor); |
---|
| 87 | |
---|
| 88 | const QColor& paperColor() const { return m_paperColor; } |
---|
| 89 | void setPaperColor(const QColor& paperColor); |
---|
| 90 | |
---|
| 91 | const QColor& highlightColor() const { return m_highlightColor; } |
---|
| 92 | void setHighlightColor(const QColor& highlightColor); |
---|
| 93 | |
---|
| 94 | QColor annotationColor() const; |
---|
| 95 | void setAnnotationColor(const QColor& annotationColor); |
---|
| 96 | |
---|
| 97 | Qt::KeyboardModifiers copyToClipboardModifiers() const; |
---|
| 98 | void setCopyToClipboardModifiers(const Qt::KeyboardModifiers& modifiers); |
---|
| 99 | |
---|
| 100 | Qt::KeyboardModifiers addAnnotationModifiers() const; |
---|
| 101 | void setAddAnnotationModifiers(const Qt::KeyboardModifiers& modifiers); |
---|
| 102 | |
---|
| 103 | Qt::KeyboardModifiers zoomToSelectionModifiers() const; |
---|
| 104 | void setZoomToSelectionModifiers(const Qt::KeyboardModifiers& modifiers); |
---|
| 105 | |
---|
| 106 | bool annotationOverlay() const; |
---|
| 107 | void setAnnotationOverlay(bool overlay); |
---|
| 108 | |
---|
| 109 | bool formFieldOverlay() const; |
---|
| 110 | void setFormFieldOverlay(bool overlay); |
---|
| 111 | |
---|
| 112 | private: |
---|
| 113 | PageItem(QSettings* settings); |
---|
| 114 | friend class Settings; |
---|
| 115 | |
---|
| 116 | QSettings* m_settings; |
---|
| 117 | |
---|
| 118 | int m_cacheSize; |
---|
| 119 | |
---|
| 120 | bool m_useTiling; |
---|
| 121 | int m_tileSize; |
---|
| 122 | |
---|
| 123 | QIcon m_progressIcon; |
---|
| 124 | QIcon m_errorIcon; |
---|
| 125 | |
---|
| 126 | bool m_keepObsoletePixmaps; |
---|
| 127 | bool m_useDevicePixelRatio; |
---|
| 128 | |
---|
| 129 | bool m_decoratePages; |
---|
| 130 | bool m_decorateLinks; |
---|
| 131 | bool m_decorateFormFields; |
---|
| 132 | |
---|
| 133 | QColor m_backgroundColor; |
---|
| 134 | QColor m_paperColor; |
---|
| 135 | |
---|
| 136 | QColor m_highlightColor; |
---|
| 137 | |
---|
| 138 | }; |
---|
| 139 | |
---|
| 140 | // presentation view |
---|
| 141 | |
---|
| 142 | class PresentationView |
---|
| 143 | { |
---|
| 144 | public: |
---|
| 145 | bool synchronize() const; |
---|
| 146 | void setSynchronize(bool synchronize); |
---|
| 147 | |
---|
| 148 | int screen() const; |
---|
| 149 | void setScreen(int screen); |
---|
| 150 | |
---|
| 151 | QColor backgroundColor() const; |
---|
| 152 | void setBackgroundColor(const QColor& backgroundColor); |
---|
| 153 | |
---|
| 154 | private: |
---|
| 155 | PresentationView(QSettings* settings); |
---|
| 156 | friend class Settings; |
---|
| 157 | |
---|
| 158 | QSettings* m_settings; |
---|
| 159 | |
---|
| 160 | }; |
---|
| 161 | |
---|
| 162 | // document view |
---|
| 163 | |
---|
| 164 | class DocumentView |
---|
| 165 | { |
---|
| 166 | public: |
---|
| 167 | void sync(); |
---|
| 168 | |
---|
| 169 | bool openUrl() const; |
---|
| 170 | void setOpenUrl(bool openUrl); |
---|
| 171 | |
---|
| 172 | bool autoRefresh() const; |
---|
| 173 | void setAutoRefresh(bool autoRefresh); |
---|
| 174 | |
---|
| 175 | int autoRefreshTimeout() const; |
---|
| 176 | |
---|
| 177 | bool prefetch() const { return m_prefetch; } |
---|
| 178 | void setPrefetch(bool prefetch); |
---|
| 179 | |
---|
| 180 | int prefetchDistance() const { return m_prefetchDistance; } |
---|
| 181 | void setPrefetchDistance(int prefetchDistance); |
---|
| 182 | |
---|
| 183 | int prefetchTimeout() const; |
---|
| 184 | |
---|
| 185 | int pagesPerRow() const { return m_pagesPerRow; } |
---|
| 186 | void setPagesPerRow(int pagesPerRow); |
---|
| 187 | |
---|
| 188 | bool minimalScrolling() const { return m_minimalScrolling; } |
---|
| 189 | void setMinimalScrolling(bool minimalScrolling); |
---|
| 190 | |
---|
| 191 | bool highlightCurrentThumbnail() const { return m_highlightCurrentThumbnail; } |
---|
| 192 | void setHighlightCurrentThumbnail(bool highlightCurrentThumbnail); |
---|
| 193 | |
---|
| 194 | bool limitThumbnailsToResults() const { return m_limitThumbnailsToResults; } |
---|
| 195 | void setLimitThumbnailsToResults(bool limitThumbnailsToResults); |
---|
| 196 | |
---|
| 197 | qreal minimumScaleFactor() const; |
---|
| 198 | qreal maximumScaleFactor() const; |
---|
| 199 | |
---|
| 200 | qreal zoomFactor() const; |
---|
| 201 | void setZoomFactor(qreal zoomFactor); |
---|
| 202 | |
---|
| 203 | qreal pageSpacing() const { return m_pageSpacing; } |
---|
| 204 | void setPageSpacing(qreal pageSpacing); |
---|
| 205 | |
---|
| 206 | qreal thumbnailSpacing() const { return m_thumbnailSpacing; } |
---|
| 207 | void setThumbnailSpacing(qreal thumbnailSpacing); |
---|
| 208 | |
---|
| 209 | qreal thumbnailSize() const { return m_thumbnailSize; } |
---|
| 210 | void setThumbnailSize(qreal thumbnailSize); |
---|
| 211 | |
---|
| 212 | bool matchCase() const; |
---|
| 213 | void setMatchCase(bool matchCase); |
---|
| 214 | |
---|
| 215 | bool wholeWords() const; |
---|
| 216 | void setWholeWords(bool wholeWords); |
---|
| 217 | |
---|
| 218 | int highlightDuration() const; |
---|
| 219 | void setHighlightDuration(int highlightDuration); |
---|
| 220 | |
---|
| 221 | QString sourceEditor() const; |
---|
| 222 | void setSourceEditor(const QString& sourceEditor); |
---|
| 223 | |
---|
| 224 | Qt::KeyboardModifiers zoomModifiers() const; |
---|
| 225 | void setZoomModifiers(const Qt::KeyboardModifiers& zoomModifiers); |
---|
| 226 | |
---|
| 227 | Qt::KeyboardModifiers rotateModifiers() const; |
---|
| 228 | void setRotateModifiers(const Qt::KeyboardModifiers& rotateModifiers); |
---|
| 229 | |
---|
| 230 | Qt::KeyboardModifiers scrollModifiers() const; |
---|
| 231 | void setScrollModifiers(const Qt::KeyboardModifiers& scrollModifiers); |
---|
| 232 | |
---|
| 233 | // per-tab settings |
---|
| 234 | |
---|
| 235 | bool continuousMode() const; |
---|
| 236 | void setContinuousMode(bool continuousMode); |
---|
| 237 | |
---|
| 238 | LayoutMode layoutMode() const; |
---|
| 239 | void setLayoutMode(LayoutMode layoutMode); |
---|
| 240 | |
---|
| 241 | bool rightToLeftMode() const; |
---|
| 242 | void setRightToLeftMode(bool rightToLeftMode); |
---|
| 243 | |
---|
| 244 | ScaleMode scaleMode() const; |
---|
| 245 | void setScaleMode(ScaleMode scaleMode); |
---|
| 246 | |
---|
| 247 | qreal scaleFactor() const; |
---|
| 248 | void setScaleFactor(qreal scaleFactor); |
---|
| 249 | |
---|
| 250 | Rotation rotation() const; |
---|
| 251 | void setRotation(Rotation rotation); |
---|
| 252 | |
---|
| 253 | bool invertColors() const; |
---|
| 254 | void setInvertColors(bool invertColors); |
---|
| 255 | |
---|
| 256 | bool convertToGrayscale() const; |
---|
| 257 | void setConvertToGrayscale(bool convertToGrayscale); |
---|
| 258 | |
---|
| 259 | bool trimMargins() const; |
---|
| 260 | void setTrimMargins(bool trimMargins); |
---|
| 261 | |
---|
| 262 | CompositionMode compositionMode() const; |
---|
| 263 | void setCompositionMode(CompositionMode compositionMode); |
---|
| 264 | |
---|
| 265 | bool highlightAll() const; |
---|
| 266 | void setHighlightAll(bool highlightAll); |
---|
| 267 | |
---|
| 268 | private: |
---|
| 269 | DocumentView(QSettings* settings); |
---|
| 270 | friend class Settings; |
---|
| 271 | |
---|
| 272 | QSettings* m_settings; |
---|
| 273 | |
---|
| 274 | bool m_prefetch; |
---|
| 275 | int m_prefetchDistance; |
---|
| 276 | |
---|
| 277 | int m_pagesPerRow; |
---|
| 278 | |
---|
| 279 | bool m_minimalScrolling; |
---|
| 280 | |
---|
| 281 | bool m_highlightCurrentThumbnail; |
---|
| 282 | bool m_limitThumbnailsToResults; |
---|
| 283 | |
---|
| 284 | qreal m_pageSpacing; |
---|
| 285 | qreal m_thumbnailSpacing; |
---|
| 286 | |
---|
| 287 | qreal m_thumbnailSize; |
---|
| 288 | |
---|
| 289 | }; |
---|
| 290 | |
---|
| 291 | // main window |
---|
| 292 | |
---|
| 293 | class MainWindow |
---|
| 294 | { |
---|
| 295 | public: |
---|
| 296 | bool trackRecentlyUsed() const; |
---|
| 297 | void setTrackRecentlyUsed(bool trackRecentlyUsed); |
---|
| 298 | |
---|
| 299 | int recentlyUsedCount() const; |
---|
| 300 | void setRecentlyUsedCount(int recentlyUsedCount); |
---|
| 301 | |
---|
| 302 | QStringList recentlyUsed() const; |
---|
| 303 | void setRecentlyUsed(const QStringList& recentlyUsed); |
---|
| 304 | |
---|
| 305 | bool keepRecentlyClosed() const; |
---|
| 306 | void setKeepRecentlyClosed(bool keepRecentlyClosed); |
---|
| 307 | |
---|
| 308 | int recentlyClosedCount() const; |
---|
| 309 | void setRecentlyClosedCount(int recentlyClosedCount); |
---|
| 310 | |
---|
| 311 | bool restoreTabs() const; |
---|
| 312 | void setRestoreTabs(bool restoreTabs); |
---|
| 313 | |
---|
| 314 | bool restoreBookmarks() const; |
---|
| 315 | void setRestoreBookmarks(bool restoreBookmarks); |
---|
| 316 | |
---|
| 317 | bool restorePerFileSettings() const; |
---|
| 318 | void setRestorePerFileSettings(bool restorePerFileSettings); |
---|
| 319 | |
---|
| 320 | int perFileSettingsLimit() const; |
---|
| 321 | |
---|
| 322 | int saveDatabaseInterval() const; |
---|
| 323 | void setSaveDatabaseInterval(int saveDatabaseInterval); |
---|
| 324 | |
---|
| 325 | int tabPosition() const; |
---|
| 326 | void setTabPosition(int tabPosition); |
---|
| 327 | |
---|
| 328 | int tabVisibility() const; |
---|
| 329 | void setTabVisibility(int tabVisibility); |
---|
| 330 | |
---|
| 331 | bool spreadTabs() const; |
---|
| 332 | void setSpreadTabs(bool spreadTabs); |
---|
| 333 | |
---|
| 334 | bool newTabNextToCurrentTab() const; |
---|
| 335 | void setNewTabNextToCurrentTab(bool newTabNextToCurrentTab); |
---|
| 336 | |
---|
| 337 | bool exitAfterLastTab() const; |
---|
| 338 | void setExitAfterLastTab(bool exitAfterLastTab); |
---|
| 339 | |
---|
| 340 | bool documentTitleAsTabTitle() const; |
---|
| 341 | void setDocumentTitleAsTabTitle(bool documentTitleAsTabTitle); |
---|
| 342 | |
---|
| 343 | bool currentPageInWindowTitle() const; |
---|
| 344 | void setCurrentPageInWindowTitle(bool currentPageInWindowTitle); |
---|
| 345 | |
---|
| 346 | bool instanceNameInWindowTitle() const; |
---|
| 347 | void setInstanceNameInWindowTitle(bool instanceNameInWindowTitle); |
---|
| 348 | |
---|
| 349 | bool extendedSearchDock() const; |
---|
| 350 | void setExtendedSearchDock(bool extendedSearchDock); |
---|
| 351 | |
---|
| 352 | bool usePageLabel() const; |
---|
| 353 | void setUsePageLabel(bool usePageLabel); |
---|
| 354 | |
---|
| 355 | bool synchronizeOutlineView() const; |
---|
| 356 | void setSynchronizeOutlineView(bool synchronizeOutlineView); |
---|
| 357 | |
---|
| 358 | QStringList fileToolBar() const; |
---|
| 359 | void setFileToolBar(const QStringList& fileToolBar); |
---|
| 360 | |
---|
| 361 | QStringList editToolBar() const; |
---|
| 362 | void setEditToolBar(const QStringList& editToolBar); |
---|
| 363 | |
---|
| 364 | QStringList viewToolBar() const; |
---|
| 365 | void setViewToolBar(const QStringList& viewToolBar); |
---|
| 366 | |
---|
| 367 | QStringList documentContextMenu() const; |
---|
| 368 | void setDocumentContextMenu(const QStringList& documentContextMenu); |
---|
| 369 | |
---|
| 370 | QStringList tabContextMenu() const; |
---|
| 371 | void setTabContextMenu(const QStringList& tabContextMenu); |
---|
| 372 | |
---|
| 373 | bool scrollableMenus() const; |
---|
| 374 | void setScrollableMenus(bool scrollableMenus); |
---|
| 375 | |
---|
| 376 | bool searchableMenus() const; |
---|
| 377 | void setSearchableMenus(bool searchableMenus); |
---|
| 378 | |
---|
| 379 | bool toggleToolAndMenuBarsWithFullscreen() const; |
---|
| 380 | void setToggleToolAndMenuBarsWithFullscreen(bool toggleToolAndMenuBarsWithFullscreen) const; |
---|
| 381 | |
---|
| 382 | bool hasIconTheme() const; |
---|
| 383 | QString iconTheme() const; |
---|
| 384 | |
---|
| 385 | bool hasStyleSheet() const; |
---|
| 386 | QString styleSheet() const; |
---|
| 387 | |
---|
| 388 | QByteArray geometry() const; |
---|
| 389 | void setGeometry(const QByteArray& geometry); |
---|
| 390 | |
---|
| 391 | QByteArray state() const; |
---|
| 392 | void setState(const QByteArray& state); |
---|
| 393 | |
---|
| 394 | QString openPath() const; |
---|
| 395 | void setOpenPath(const QString& openPath); |
---|
| 396 | |
---|
| 397 | QString savePath() const; |
---|
| 398 | void setSavePath(const QString& savePath); |
---|
| 399 | |
---|
| 400 | QSize settingsDialogSize(const QSize& sizeHint) const; |
---|
| 401 | void setSettingsDialogSize(const QSize& settingsDialogSize); |
---|
| 402 | |
---|
| 403 | QSize fontsDialogSize(const QSize& sizeHint) const; |
---|
| 404 | void setFontsDialogSize(const QSize& fontsDialogSize); |
---|
| 405 | |
---|
| 406 | QSize contentsDialogSize(const QSize& sizeHint) const; |
---|
| 407 | void setContentsDialogSize(const QSize& contentsDialogSize); |
---|
| 408 | |
---|
| 409 | private: |
---|
| 410 | MainWindow(QSettings* settings); |
---|
| 411 | friend class Settings; |
---|
| 412 | |
---|
| 413 | QSettings* m_settings; |
---|
| 414 | |
---|
| 415 | }; |
---|
| 416 | |
---|
| 417 | // print dialog |
---|
| 418 | |
---|
| 419 | class PrintDialog |
---|
| 420 | { |
---|
| 421 | public: |
---|
| 422 | bool collateCopies() const; |
---|
| 423 | void setCollateCopies(bool collateCopies); |
---|
| 424 | |
---|
| 425 | QPrinter::PageOrder pageOrder() const; |
---|
| 426 | void setPageOrder(QPrinter::PageOrder pageOrder); |
---|
| 427 | |
---|
| 428 | QPrinter::Orientation orientation() const; |
---|
| 429 | void setOrientation(QPrinter::Orientation orientation); |
---|
| 430 | |
---|
| 431 | QPrinter::ColorMode colorMode() const; |
---|
| 432 | void setColorMode(QPrinter::ColorMode colorMode); |
---|
| 433 | |
---|
| 434 | QPrinter::DuplexMode duplex() const; |
---|
| 435 | void setDuplex(QPrinter::DuplexMode duplex); |
---|
| 436 | |
---|
| 437 | bool fitToPage() const; |
---|
| 438 | void setFitToPage(bool fitToPage); |
---|
| 439 | |
---|
| 440 | #if QT_VERSION < QT_VERSION_CHECK(5,2,0) |
---|
| 441 | |
---|
| 442 | PrintOptions::PageSet pageSet() const; |
---|
| 443 | void setPageSet(PrintOptions::PageSet pageSet); |
---|
| 444 | |
---|
| 445 | PrintOptions::NumberUp numberUp() const; |
---|
| 446 | void setNumberUp(PrintOptions::NumberUp numberUp); |
---|
| 447 | |
---|
| 448 | PrintOptions::NumberUpLayout numberUpLayout() const; |
---|
| 449 | void setNumberUpLayout(PrintOptions::NumberUpLayout numberUpLayout); |
---|
| 450 | |
---|
| 451 | #endif // QT_VERSION |
---|
| 452 | |
---|
| 453 | private: |
---|
| 454 | PrintDialog(QSettings* settings); |
---|
| 455 | friend class Settings; |
---|
| 456 | |
---|
| 457 | QSettings* m_settings; |
---|
| 458 | |
---|
| 459 | }; |
---|
| 460 | |
---|
| 461 | void sync(); |
---|
| 462 | |
---|
| 463 | PageItem& pageItem() { return m_pageItem; } |
---|
| 464 | PresentationView& presentationView() { return m_presentationView; } |
---|
| 465 | DocumentView& documentView() { return m_documentView; } |
---|
| 466 | MainWindow& mainWindow() { return m_mainWindow; } |
---|
| 467 | PrintDialog& printDialog() { return m_printDialog; } |
---|
| 468 | |
---|
| 469 | private: |
---|
| 470 | Q_DISABLE_COPY(Settings) |
---|
| 471 | |
---|
| 472 | static Settings* s_instance; |
---|
| 473 | Settings(QObject* parent = 0); |
---|
| 474 | |
---|
| 475 | QSettings* m_settings; |
---|
| 476 | |
---|
| 477 | PageItem m_pageItem; |
---|
| 478 | PresentationView m_presentationView; |
---|
| 479 | DocumentView m_documentView; |
---|
| 480 | MainWindow m_mainWindow; |
---|
| 481 | PrintDialog m_printDialog; |
---|
| 482 | |
---|
| 483 | }; |
---|
| 484 | |
---|
| 485 | // defaults |
---|
| 486 | |
---|
| 487 | class Defaults |
---|
| 488 | { |
---|
| 489 | public: |
---|
| 490 | class PageItem |
---|
| 491 | { |
---|
| 492 | public: |
---|
| 493 | static int cacheSize() { return 32 * 1024 * 1024; } |
---|
| 494 | |
---|
| 495 | static bool useTiling() { return false; } |
---|
| 496 | static int tileSize() { return 1024; } |
---|
| 497 | |
---|
| 498 | static bool keepObsoletePixmaps() { return false; } |
---|
| 499 | static bool useDevicePixelRatio() { return false; } |
---|
| 500 | |
---|
| 501 | static bool decoratePages() { return true; } |
---|
| 502 | static bool decorateLinks() { return true; } |
---|
| 503 | static bool decorateFormFields() { return true; } |
---|
| 504 | |
---|
| 505 | static QColor backgroundColor() { return Qt::darkGray; } |
---|
| 506 | static QColor paperColor() { return Qt::white; } |
---|
| 507 | |
---|
| 508 | static QColor highlightColor() { return Qt::yellow; } |
---|
| 509 | static QColor annotationColor() { return Qt::yellow; } |
---|
| 510 | |
---|
| 511 | static Qt::KeyboardModifiers copyToClipboardModifiers() { return Qt::ShiftModifier; } |
---|
| 512 | static Qt::KeyboardModifiers addAnnotationModifiers() { return Qt::ControlModifier; } |
---|
| 513 | static Qt::KeyboardModifiers zoomToSelectionModifiers() { return Qt::ShiftModifier | Qt::ControlModifier; } |
---|
| 514 | |
---|
| 515 | static bool annotationOverlay() { return false; } |
---|
| 516 | static bool formFieldOverlay() { return true; } |
---|
| 517 | |
---|
| 518 | private: |
---|
| 519 | PageItem() {} |
---|
| 520 | |
---|
| 521 | }; |
---|
| 522 | |
---|
| 523 | class PresentationView |
---|
| 524 | { |
---|
| 525 | public: |
---|
| 526 | static bool synchronize() { return false; } |
---|
| 527 | static int screen() { return -1; } |
---|
| 528 | |
---|
| 529 | static QColor backgroundColor() { return QColor(); } |
---|
| 530 | |
---|
| 531 | private: |
---|
| 532 | PresentationView() {} |
---|
| 533 | |
---|
| 534 | }; |
---|
| 535 | |
---|
| 536 | class DocumentView |
---|
| 537 | { |
---|
| 538 | public: |
---|
| 539 | static bool openUrl() { return false; } |
---|
| 540 | |
---|
| 541 | static bool autoRefresh() { return false; } |
---|
| 542 | |
---|
| 543 | static int autoRefreshTimeout() { return 750; } |
---|
| 544 | |
---|
| 545 | static bool prefetch() { return false; } |
---|
| 546 | static int prefetchDistance() { return 1; } |
---|
| 547 | |
---|
| 548 | static int prefetchTimeout() { return 250; } |
---|
| 549 | |
---|
| 550 | static int pagesPerRow() { return 3; } |
---|
| 551 | |
---|
| 552 | static bool minimalScrolling() { return false; } |
---|
| 553 | |
---|
| 554 | static bool highlightCurrentThumbnail() { return false; } |
---|
| 555 | static bool limitThumbnailsToResults() { return false; } |
---|
| 556 | |
---|
| 557 | static qreal minimumScaleFactor() { return 0.1; } |
---|
| 558 | static qreal maximumScaleFactor() { return 50.0; } |
---|
| 559 | |
---|
| 560 | static qreal zoomFactor() { return 1.1; } |
---|
| 561 | |
---|
| 562 | static qreal pageSpacing() { return 5.0; } |
---|
| 563 | static qreal thumbnailSpacing() { return 3.0; } |
---|
| 564 | |
---|
| 565 | static qreal thumbnailSize() { return 150.0; } |
---|
| 566 | |
---|
| 567 | static CompositionMode compositionMode() { return DefaultCompositionMode; } |
---|
| 568 | |
---|
| 569 | static bool matchCase() { return false; } |
---|
| 570 | static bool wholeWords() { return false; } |
---|
| 571 | |
---|
| 572 | static int highlightDuration() { return 5 * 1000; } |
---|
| 573 | static QString sourceEditor() { return QString(); } |
---|
| 574 | |
---|
| 575 | static Qt::KeyboardModifiers zoomModifiers() { return Qt::ControlModifier; } |
---|
| 576 | static Qt::KeyboardModifiers rotateModifiers() { return Qt::ShiftModifier; } |
---|
| 577 | static Qt::KeyboardModifiers scrollModifiers() { return Qt::AltModifier; } |
---|
| 578 | |
---|
| 579 | // per-tab defaults |
---|
| 580 | |
---|
| 581 | static bool continuousMode() { return false; } |
---|
| 582 | static LayoutMode layoutMode() { return SinglePageMode; } |
---|
| 583 | static bool rightToLeftMode(); |
---|
| 584 | |
---|
| 585 | static ScaleMode scaleMode() { return ScaleFactorMode; } |
---|
| 586 | static qreal scaleFactor() { return 1.0; } |
---|
| 587 | static Rotation rotation() { return RotateBy0; } |
---|
| 588 | |
---|
| 589 | static bool invertColors() { return false; } |
---|
| 590 | static bool convertToGrayscale() { return false; } |
---|
| 591 | static bool trimMargins() { return false; } |
---|
| 592 | |
---|
| 593 | static bool highlightAll() { return false; } |
---|
| 594 | |
---|
| 595 | private: |
---|
| 596 | DocumentView() {} |
---|
| 597 | |
---|
| 598 | }; |
---|
| 599 | |
---|
| 600 | class MainWindow |
---|
| 601 | { |
---|
| 602 | public: |
---|
| 603 | static bool trackRecentlyUsed() { return false; } |
---|
| 604 | static int recentlyUsedCount() { return 10; } |
---|
| 605 | |
---|
| 606 | static bool keepRecentlyClosed() { return false; } |
---|
| 607 | static int recentlyClosedCount() { return 5; } |
---|
| 608 | |
---|
| 609 | static bool restoreTabs() { return false; } |
---|
| 610 | static bool restoreBookmarks() { return false; } |
---|
| 611 | static bool restorePerFileSettings() { return false; } |
---|
| 612 | |
---|
| 613 | static int perFileSettingsLimit() { return 1000; } |
---|
| 614 | |
---|
| 615 | static int saveDatabaseInterval() { return 5 * 60 * 1000; } |
---|
| 616 | |
---|
| 617 | static int tabPosition() { return 0; } |
---|
| 618 | static int tabVisibility() { return 0; } |
---|
| 619 | |
---|
| 620 | static bool spreadTabs() { return false; } |
---|
| 621 | |
---|
| 622 | static bool newTabNextToCurrentTab() { return true; } |
---|
| 623 | static bool exitAfterLastTab() { return false; } |
---|
| 624 | |
---|
| 625 | static bool documentTitleAsTabTitle() { return true; } |
---|
| 626 | |
---|
| 627 | static bool currentPageInWindowTitle() { return false; } |
---|
| 628 | static bool instanceNameInWindowTitle() { return false; } |
---|
| 629 | |
---|
| 630 | static bool extendedSearchDock() { return false; } |
---|
| 631 | |
---|
| 632 | static bool usePageLabel() { return true; } |
---|
| 633 | |
---|
| 634 | static bool synchronizeOutlineView() { return false; } |
---|
| 635 | |
---|
| 636 | static QStringList fileToolBar() { return QStringList() << "openInNewTab" << "refresh"; } |
---|
| 637 | static QStringList editToolBar() { return QStringList() << "currentPage" << "previousPage" << "nextPage"; } |
---|
| 638 | static QStringList viewToolBar() { return QStringList() << "scaleFactor" << "zoomIn" << "zoomOut"; } |
---|
| 639 | |
---|
| 640 | static QStringList documentContextMenu() { return QStringList() << "previousPage" << "nextPage" << "firstPage" << "lastPage" << "separator" << "jumpToPage" << "jumpBackward" << "jumpForward" << "separator" << "setFirstPage" << "separator" << "findPrevious" << "findNext" << "cancelSearch"; } |
---|
| 641 | static QStringList tabContexntMenu() { return QStringList() << "openCopyInNewTab" << "openContainingFolder" << "separator" << "closeAllTabs" << "closeAllTabsButThisOne" << "closeAllTabsToTheLeft" << "closeAllTabsToTheRight"; } |
---|
| 642 | |
---|
| 643 | static bool scrollableMenus() { return false; } |
---|
| 644 | static bool searchableMenus() { return false; } |
---|
| 645 | |
---|
| 646 | static bool toggleToolAndMenuBarsWithFullscreen() { return false; } |
---|
| 647 | |
---|
| 648 | static QString path(); |
---|
| 649 | |
---|
| 650 | private: |
---|
| 651 | MainWindow() {} |
---|
| 652 | |
---|
| 653 | }; |
---|
| 654 | |
---|
| 655 | class PrintDialog |
---|
| 656 | { |
---|
| 657 | public: |
---|
| 658 | static bool collateCopies() { return false; } |
---|
| 659 | |
---|
| 660 | static QPrinter::PageOrder pageOrder() { return QPrinter::FirstPageFirst; } |
---|
| 661 | |
---|
| 662 | static QPrinter::Orientation orientation() { return QPrinter::Portrait; } |
---|
| 663 | |
---|
| 664 | static QPrinter::ColorMode colorMode() { return QPrinter::Color; } |
---|
| 665 | |
---|
| 666 | static QPrinter::DuplexMode duplex() { return QPrinter::DuplexNone; } |
---|
| 667 | |
---|
| 668 | static bool fitToPage() { return false; } |
---|
| 669 | |
---|
| 670 | #if QT_VERSION < QT_VERSION_CHECK(5,2,0) |
---|
| 671 | |
---|
| 672 | static PrintOptions::PageSet pageSet() { return PrintOptions::AllPages; } |
---|
| 673 | |
---|
| 674 | static PrintOptions::NumberUp numberUp() { return PrintOptions::SinglePage; } |
---|
| 675 | static PrintOptions::NumberUpLayout numberUpLayout() { return PrintOptions::LeftRightTopBottom; } |
---|
| 676 | |
---|
| 677 | #endif // QT_VERSION |
---|
| 678 | |
---|
| 679 | private: |
---|
| 680 | PrintDialog() {} |
---|
| 681 | |
---|
| 682 | }; |
---|
| 683 | |
---|
| 684 | private: |
---|
| 685 | Defaults() {} |
---|
| 686 | |
---|
| 687 | }; |
---|
| 688 | |
---|
| 689 | } // qpdfview |
---|
| 690 | |
---|
| 691 | #endif // SETTINGS_H |
---|