Changeset 160 in tspsg-svn


Ignore:
Timestamp:
Apr 9, 2011, 3:38:21 AM (14 years ago)
Author:
laleppa
Message:
  • Somehow, I overlooked the documentation. There is a way to get page margins from printer. Implemented saving of marings after running print preview dialog (see ticket #5).
  • Renamed Printer/PageSize? setting in tspsg.ini to Printer/PaperSize?.
  • If a file nime doesn't have an extension after running Save As dialog, .tspt is automatically appended.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mainwindow.cpp

    r159 r160  
    6262    printer = new QPrinter(QPrinter::HighResolution);
    6363    settings->beginGroup("Printer");
    64     printer->setPageSize(qvariant_cast<QPrinter::PageSize>(settings->value("PageSize", DEF_PAGE_SIZE)));
     64    printer->setPaperSize(qvariant_cast<QPrinter::PaperSize>(settings->value("PaperSize", DEF_PAGE_SIZE)));
    6565    printer->setOrientation(qvariant_cast<QPrinter::Orientation>(settings->value("PageOrientation", DEF_PAGE_ORIENTATION)));
    6666    printer->setPageMargins(
     
    357357    connect(&ppd,SIGNAL(paintRequested(QPrinter *)),SLOT(printPreview(QPrinter *)));
    358358    ppd.exec();
     359
     360qreal l, t, r, b;
     361    printer->getPageMargins(&l, &t, &r, &b, QPrinter::Millimeter);
     362
    359363    settings->beginGroup("Printer");
    360     settings->setValue("PageSize", printer->pageSize());
     364    settings->setValue("PaperSize", printer->paperSize());
    361365    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?). */
     366    settings->setValue("MarginLeft", l);
     367    settings->setValue("MarginTop", t);
     368    settings->setValue("MarginRight", r);
     369    settings->setValue("MarginBottom", b);
    364370    settings->endGroup();
    365371}
     
    11221128void MainWindow::drawNode(QPainter &pic, int nstep, bool left, SStep *step)
    11231129{
    1124 int r;
     1130qreal r;
    11251131    if (settings->value("Output/HQGraph", DEF_HQ_GRAPH).toBool())
    11261132        r = logicalDpiX() / 1.27;
     
    11281134        r = logicalDpiX() / 2.54;
    11291135#ifdef Q_WS_S60
    1130         /*! \hack HACK: Solution graph on Symbian is visually larger than on
     1136    /*! \hack HACK: Solution graph on Symbian is visually larger than on
    11311137     *   Windows Mobile. This coefficient makes it about the same size.
    11321138     */
     
    15301536    else if (settings->value("SaveLastUsed", DEF_SAVE_LAST_USED).toBool())
    15311537        settings->setValue(OS"/LastUsed/TaskSavePath", QFileInfo(file).path());
     1538    if (QFileInfo(file).suffix().isEmpty()) {
     1539        file.append(".tspt");
     1540    }
    15321541
    15331542    if (tspmodel->saveTask(file)) {
Note: See TracChangeset for help on using the changeset viewer.