Changeset 20e8115cee in tspsg
- Timestamp:
- Apr 14, 2011, 1:09:20 AM (14 years ago)
- Branches:
- 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
- Children:
- 8f2427aaf0
- Parents:
- 144fbe6b96
- git-author:
- Oleksii Serdiuk <contacts@…> (04/14/11 01:09:20)
- git-committer:
- Oleksii Serdiuk <contacts@…> (06/29/12 19:45:58)
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/defaults.h
r144fbe6b96 r20e8115cee 49 49 //! Default for "Save main window state and position" 50 50 #define DEF_SAVEPOS true 51 //! Default for "Use translucency effects in Vista/7" 52 #define DEF_USE_TRANSLUCENCY true 51 /*! 52 * \def DEF_USE_TRANSLUCENCY 53 * \brief Default for "Use translucency effects" 54 */ 55 #ifdef Q_WS_WIN 56 # define DEF_USE_TRANSLUCENCY true 57 #else 58 # define DEF_USE_TRANSLUCENCY false 59 #endif 53 60 //! Default for "Check for updates" 54 61 #define DEF_CHECK_FOR_UPDATES false -
src/mainwindow.cpp
r144fbe6b96 r20e8115cee 62 62 printer = new QPrinter(QPrinter::HighResolution); 63 63 settings->beginGroup("Printer"); 64 printer->setPaperSize(qvariant_cast<QPrinter::PaperSize>(settings->value("PaperSize", DEF_PAGE_SIZE))); 64 QPrinter::PaperSize size = qvariant_cast<QPrinter::PaperSize>(settings->value("PaperSize", DEF_PAGE_SIZE)); 65 if (size != QPrinter::Custom) { 66 printer->setPaperSize(size); 67 } else { 68 printer->setPaperSize(QSizeF(settings->value("PaperWidth").toReal(), settings->value("PaperHeight").toReal()), 69 QPrinter::Millimeter); 70 } 71 65 72 printer->setOrientation(qvariant_cast<QPrinter::Orientation>(settings->value("PageOrientation", DEF_PAGE_ORIENTATION))); 66 73 printer->setPageMargins( 67 settings->value("MarginLeft", DEF_MARGIN_LEFT).to Double(),68 settings->value("MarginTop", DEF_MARGIN_TOP).to Double(),69 settings->value("MarginRight", DEF_MARGIN_RIGHT).to Double(),70 settings->value("MarginBottom", DEF_MARGIN_BOTTOM).to Double(),74 settings->value("MarginLeft", DEF_MARGIN_LEFT).toReal(), 75 settings->value("MarginTop", DEF_MARGIN_TOP).toReal(), 76 settings->value("MarginRight", DEF_MARGIN_RIGHT).toReal(), 77 settings->value("MarginBottom", DEF_MARGIN_BOTTOM).toReal(), 71 78 QPrinter::Millimeter); 72 79 settings->endGroup(); … … 85 92 #ifndef QT_NO_PRINTER 86 93 connect(actionFilePrintPreview, SIGNAL(triggered()), SLOT(actionFilePrintPreviewTriggered())); 94 connect(actionFilePageSetup, SIGNAL(triggered()), SLOT(actionFilePageSetupTriggered())); 87 95 connect(actionFilePrint, SIGNAL(triggered()), SLOT(actionFilePrintTriggered())); 88 96 #endif // QT_NO_PRINTER … … 363 371 settings->beginGroup("Printer"); 364 372 settings->setValue("PaperSize", printer->paperSize()); 373 if (printer->paperSize() == QPrinter::Custom) { 374 QSizeF size(printer->paperSize(QPrinter::Millimeter)); 375 settings->setValue("PaperWidth", size.width()); 376 settings->setValue("PaperHeight", size.height()); 377 } 378 settings->setValue("PageOrientation", printer->orientation()); 379 settings->setValue("MarginLeft", l); 380 settings->setValue("MarginTop", t); 381 settings->setValue("MarginRight", r); 382 settings->setValue("MarginBottom", b); 383 settings->endGroup(); 384 } 385 386 void MainWindow::actionFilePageSetupTriggered() 387 { 388 QPageSetupDialog psd(printer, this); 389 if (psd.exec() != QDialog::Accepted) 390 return; 391 392 qreal l, t, r ,b; 393 printer->getPageMargins(&l, &t, &r, &b, QPrinter::Millimeter); 394 395 settings->beginGroup("Printer"); 396 settings->setValue("PaperSize", printer->paperSize()); 397 if (printer->paperSize() == QPrinter::Custom) { 398 QSizeF size(printer->paperSize(QPrinter::Millimeter)); 399 settings->setValue("PaperWidth", size.width()); 400 settings->setValue("PaperHeight", size.height()); 401 } 365 402 settings->setValue("PageOrientation", printer->orientation()); 366 403 settings->setValue("MarginLeft", l); … … 784 821 pic.begin(&graph); 785 822 pic.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); 786 QFont font = qvariant_cast<QFont>(settings->value("Output/Font", QFont(DEF_FONT_FACE, 9))); 823 QFont font = qvariant_cast<QFont>(settings->value("Output/Font", QFont(DEF_FONT_FACE))); 824 //! \todo FIXME: Get rid of the "magic number" in the code. 825 font.setPixelSize(logicalDpiX() / 7); 787 826 if (settings->value("Output/HQGraph", DEF_HQ_GRAPH).toBool()) { 788 827 font.setWeight(QFont::DemiBold); 789 font.setP ointSizeF(font.pointSizeF() * 2);828 font.setPixelSize(font.pixelSize() * 2); 790 829 } 791 830 pic.setFont(font); … … 1129 1168 { 1130 1169 qreal r; 1170 //! \todo FIXME: Get rid of the "magic numbers" in the code. 1131 1171 if (settings->value("Output/HQGraph", DEF_HQ_GRAPH).toBool()) 1132 1172 r = logicalDpiX() / 1.27; … … 1478 1518 #ifndef QT_NO_STATUSTIP 1479 1519 actionFilePrintPreview->setStatusTip(tr("Preview current solution results before printing")); 1480 actionFileExit->setStatusTip(tr("Exit %1").arg(QCoreApplication::applicationName())); 1520 #endif // QT_NO_STATUSTIP 1521 1522 actionFilePageSetup->setText(tr("Pa&ge Setup...")); 1523 #ifndef QT_NO_TOOLTIP 1524 actionFilePageSetup->setToolTip(tr("Setup print options")); 1525 #endif // QT_NO_TOOLTIP 1526 #ifndef QT_NO_STATUSTIP 1527 actionFilePageSetup->setStatusTip(tr("Setup page-related options for printing")); 1481 1528 #endif // QT_NO_STATUSTIP 1482 1529 … … 1490 1537 actionFilePrint->setShortcut(tr("Ctrl+P")); 1491 1538 #endif // QT_NO_PRINTER 1539 1540 #ifndef QT_NO_STATUSTIP 1541 actionFileExit->setStatusTip(tr("Exit %1").arg(QCoreApplication::applicationName())); 1542 #endif // QT_NO_STATUSTIP 1492 1543 1493 1544 #ifndef HANDHELD … … 1640 1691 actionFilePrintPreview->setIcon(GET_ICON("document-print-preview")); 1641 1692 1693 actionFilePageSetup = new QAction(this); 1694 actionFilePageSetup->setObjectName("actionFilePrintSetup"); 1695 // actionFilePageSetup->setEnabled(false); 1696 #if QT_VERSION >= 0x040600 1697 actionFilePageSetup->setIcon(QIcon::fromTheme("document-page-setup", QIcon(":/trolltech/dialogs/qprintpreviewdialog/images/page-setup-32.png"))); 1698 #else 1699 actionFilePageSetup->setIcon(QIcon(":/trolltech/dialogs/qprintpreviewdialog/images/page-setup-32.png")); 1700 #endif 1701 1642 1702 actionFilePrint = new QAction(this); 1643 1703 actionFilePrint->setObjectName("actionFilePrint"); … … 1645 1705 actionFilePrint->setIcon(GET_ICON("document-print")); 1646 1706 1647 menuFile->insertAction(actionFileExit,actionFilePrintPreview); 1648 menuFile->insertAction(actionFileExit,actionFilePrint); 1707 menuFile->insertAction(actionFileExit, actionFilePrintPreview); 1708 menuFile->insertAction(actionFileExit, actionFilePageSetup); 1709 menuFile->insertAction(actionFileExit, actionFilePrint); 1649 1710 menuFile->insertSeparator(actionFileExit); 1650 1711 … … 1684 1745 1685 1746 #ifndef HANDHELD 1686 toolBarManager = new QtToolBarManager ;1747 toolBarManager = new QtToolBarManager(this); 1687 1748 toolBarManager->setMainWindow(this); 1688 1749 QString cat = toolBarMain->windowTitle(); … … 1690 1751 #ifndef QT_NO_PRINTER 1691 1752 toolBarManager->addAction(actionFilePrintPreview, cat); 1753 toolBarManager->addAction(actionFilePageSetup, cat); 1692 1754 #endif // QT_NO_PRINTER 1693 1755 toolBarManager->addAction(actionHelpContents, cat); 1694 1756 toolBarManager->addAction(actionHelpContextual, cat); 1695 // toolBarManager->addAction(action, cat);1696 1757 toolBarManager->restoreState(settings->value("MainWindow/Toolbars").toByteArray()); 1697 1758 #else -
src/mainwindow.h
r144fbe6b96 r20e8115cee 64 64 #ifndef QT_NO_PRINTER 65 65 void actionFilePrintPreviewTriggered(); 66 void actionFilePageSetupTriggered(); 66 67 void actionFilePrintTriggered(); 67 68 #endif // QT_NO_PRINTER … … 109 110 QPrinter *printer; 110 111 QAction *actionFilePrintPreview; 112 QAction *actionFilePageSetup; 111 113 QAction *actionFilePrint; 112 114 #endif // QT_NO_PRINTER
Note: See TracChangeset
for help on using the changeset viewer.