Changeset a885c3d9d2 in tspsg for src


Ignore:
Timestamp:
Mar 24, 2011, 8:06:01 PM (14 years ago)
Author:
Oleksii Serdiuk
Branches:
0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
Children:
23ad8db4a5
Parents:
d97db6d321
git-author:
Oleksii Serdiuk <contacts@…> (03/24/11 20:06:01)
git-committer:
Oleksii Serdiuk <contacts@…> (06/29/12 19:45:58)
Message:
  • Default page setup for printing can now be configured through the config file (tspsg.ini), also see ticket #5.
  • Some very slight improvements to the solution output.
Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/defaults.h

    rd97db6d321 ra885c3d9d2  
    103103#define DEF_ALTERNATE_COLOR QColor(0xA00000)
    104104
     105#ifndef QT_NO_PRINTER
     106#   define DEF_PAGE_SIZE QPrinter::A4
     107#   define DEF_PAGE_ORIENTATION QPrinter::Portrait
     108#   define DEF_MARGIN_LEFT 25
     109#   define DEF_MARGIN_TOP 15
     110#   define DEF_MARGIN_RIGHT DEF_MARGIN_TOP
     111#   define DEF_MARGIN_BOTTOM DEF_MARGIN_TOP
     112#endif
     113
    105114#endif // DEFAULTS_H
  • src/globals.h

    rd97db6d321 ra885c3d9d2  
    142142#ifndef DOXYGEN_EXCLUDE
    143143
     144#ifndef QT_NO_PRINTER
     145    Q_DECLARE_METATYPE(QPrinter::PageSize)
     146    Q_DECLARE_METATYPE(QPrinter::Orientation)
     147#endif
     148
    144149#ifdef HANDHELD
    145150#   define ICON_SIZE "48x48"
  • src/mainwindow.cpp

    rd97db6d321 ra885c3d9d2  
    6161#ifndef QT_NO_PRINTER
    6262    printer = new QPrinter(QPrinter::HighResolution);
     63    settings->beginGroup("Printer");
     64    printer->setPageSize(qvariant_cast<QPrinter::PageSize>(settings->value("PageSize", DEF_PAGE_SIZE)));
     65    printer->setOrientation(qvariant_cast<QPrinter::Orientation>(settings->value("PageOrientation", DEF_PAGE_ORIENTATION)));
     66    printer->setPageMargins(
     67        settings->value("MarginLeft", DEF_MARGIN_LEFT).toDouble(),
     68        settings->value("MarginTop", DEF_MARGIN_TOP).toDouble(),
     69        settings->value("MarginRight", DEF_MARGIN_RIGHT).toDouble(),
     70        settings->value("MarginBottom", DEF_MARGIN_BOTTOM).toDouble(),
     71        QPrinter::Millimeter);
     72    settings->endGroup();
    6373#endif // QT_NO_PRINTER
    6474
     
    347357    connect(&ppd,SIGNAL(paintRequested(QPrinter *)),SLOT(printPreview(QPrinter *)));
    348358    ppd.exec();
     359    settings->beginGroup("Printer");
     360    settings->setValue("PageSize", printer->pageSize());
     361    settings->setValue("PageOrientation", printer->orientation());
     362    /*! \todo TODO: There's no way to get printer margins set with QPrinter::setPageMargins()
     363         for now. Have to figure out a workaround for this (calculate it from other metrics?). */
     364    settings->endGroup();
    349365}
    350366
     
    783799    cur.insertText(tr("Variant #%1 Task").arg(spinVariant->value()), fmt_default);
    784800    cur.insertBlock(fmt_paragraph);
    785     cur.insertText(tr("Task:"));
     801    cur.insertText(tr("Task:"), fmt_default);
    786802    outputMatrix(cur, matrix);
    787803    if (settings->value("Output/ShowGraph", DEF_SHOW_GRAPH).toBool()) {
     
    838854        cur.beginEditBlock();
    839855        cur.insertBlock(fmt_paragraph);
    840         cur.insertText(tr("Step #%1").arg(n));
     856        cur.insertText(tr("Step #%1").arg(n), fmt_default);
    841857        if (settings->value("Output/ShowMatrix", DEF_SHOW_MATRIX).toBool() && (!settings->value("Output/UseShowMatrixLimit", DEF_USE_SHOW_MATRIX_LIMIT).toBool() || (settings->value("Output/UseShowMatrixLimit", DEF_USE_SHOW_MATRIX_LIMIT).toBool() && (spinCities->value() <= settings->value("Output/ShowMatrixLimit", DEF_SHOW_MATRIX_LIMIT).toInt())))) {
    842858            outputMatrix(cur, *step);
     
    11731189    solutionText->document()->setDefaultFont(qvariant_cast<QFont>(settings->value("Output/Font", QFont(DEF_FONT_FACE, DEF_FONT_SIZE))));
    11741190
    1175     fmt_paragraph.setTopMargin(0);
     1191    fmt_paragraph.setTopMargin(5);
    11761192    fmt_paragraph.setRightMargin(10);
    11771193    fmt_paragraph.setBottomMargin(0);
     
    11801196    fmt_table.setTopMargin(5);
    11811197    fmt_table.setRightMargin(10);
    1182     fmt_table.setBottomMargin(5);
     1198    fmt_table.setBottomMargin(0);
    11831199    fmt_table.setLeftMargin(10);
    11841200    fmt_table.setBorder(0);
Note: See TracChangeset for help on using the changeset viewer.