Changeset 127 in tspsg-svn


Ignore:
Timestamp:
Sep 1, 2010, 8:31:16 PM (14 years ago)
Author:
laleppa
Message:

Added an option to select graph quality, because higher graph quality looked uglier on the screen while looked nicer when printing.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/defaults.h

    r119 r127  
    6969//! Default for "Save solution graph as"
    7070#define DEF_GRAPH_IMAGE_FORMAT "png"
     71//! Default for "Draw solution graph in higher quality"
     72#define DEF_HQ_GRAPH false
    7173//! Default for "Show solution steps' matrices for every solution step"
    7274#define DEF_SHOW_MATRIX true
  • trunk/src/mainwindow.cpp

    r126 r127  
    480480
    481481QString credits;
    482         credits += tr("This software was created using LGPL version of <b>Qt framework</b>,<br>\n"
     482        credits += tr("%1 was created using <b>Qt&nbsp;framework</b> licensed "
     483                "under the terms of the GNU Lesser General Public License,<br>\n"
    483484                "see <a href=\"http://qt.nokia.com/\">qt.nokia.com</a><br>\n"
    484485                "<br>\n"
    485                 "Most icons used in this software are part of <b>Oxygen Icons</b> project "
     486                "Most icons used in %1 are part of <b>Oxygen&nbsp;Icons</b> project "
    486487                "licensed according to the GNU Lesser General Public License,<br>\n"
    487488                "see <a href=\"http://www.oxygen-icons.org/\">www.oxygen-icons.org</a><br>\n"
    488489                "<br>\n"
    489                 "Country flag icons used in this software are part of the free "
    490                 "<b>Flag Icons</b> collection created by <b>IconDrawer</b>,<br>\n"
    491                 "see <a href=\"http://www.icondrawer.com/\">www.icondrawer.com</a>");
     490                "Country flag icons used in %1 are part of the free "
     491                "<b>Flag&nbsp;Icons</b> collection created by <b>IconDrawer</b>,<br>\n"
     492                "see <a href=\"http://www.icondrawer.com/\">www.icondrawer.com</a>")
     493                        .arg(QApplication::applicationName());
    492494
    493495QFile f(":/files/COPYING");
     
    736738                pic.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
    737739QFont font = settings->value("Output/Font", QFont(getDefaultFont(), 9)).value<QFont>();
    738 //              font.setBold(true);
    739                 font.setPointSizeF(font.pointSizeF() * 2);
     740                if (settings->value("Output/HQGraph", DEF_HQ_GRAPH).toBool()) {
     741                        font.setWeight(QFont::DemiBold);
     742                        font.setPointSizeF(font.pointSizeF() * 2);
     743                }
    740744                pic.setFont(font);
    741745                pic.setBrush(QBrush(QColor(Qt::white)));
     746                if (settings->value("Output/HQGraph", DEF_HQ_GRAPH).toBool()) {
    742747QPen pen = pic.pen();
    743                 pen.setWidth(2);
    744                 pic.setPen(pen);
     748                        pen.setWidth(2);
     749                        pic.setPen(pen);
     750                }
    745751                pic.setBackgroundMode(Qt::OpaqueMode);
    746752        }
     
    874880                pic.end();
    875881
    876 QImage i(graph.width() + 2, graph.height() + 2, QImage::Format_ARGB32);
    877                 i.fill(0);
     882QImage i(graph.width() + 1, graph.height() + 1, QImage::Format_RGB32);
     883                i.fill(0xFFFFFF);
    878884                pic.begin(&i);
    879885                pic.drawPicture(1, 1, graph);
     
    883889QTextImageFormat img;
    884890                img.setName("tspsg://graph.pic");
    885                 img.setWidth(i.width() / 2);
    886                 img.setHeight(i.height() / 2);
     891                if (settings->value("Output/HQGraph", DEF_HQ_GRAPH).toBool()) {
     892                        img.setWidth(i.width() / 2);
     893                        img.setHeight(i.height() / 2);
     894                } else {
     895                        img.setWidth(i.width());
     896                        img.setHeight(i.height());
     897                }
    887898
    888899                cur.setPosition(imgpos);
     
    10481059void MainWindow::drawNode(QPainter &pic, int nstep, bool left, SStep *step)
    10491060{
    1050 const int r = 70;
     1061int r;
     1062        if (settings->value("Output/HQGraph", DEF_HQ_GRAPH).toBool())
     1063                r = 70;
     1064        else
     1065                r = 35;
    10511066qreal x, y;
    10521067        if (step != NULL)
  • trunk/src/settingsdialog.cpp

    r121 r127  
    5555        p.setColor(QPalette::Window, p.color(QPalette::Text));
    5656        lineHorizontal->setPalette(p);
     57
     58#ifndef QT_NO_PRINTER
     59        cbHQGraph = new QCheckBox(bgWhite);
     60        cbHQGraph->setObjectName("cbHQGraph");
     61#ifndef QT_NO_STATUSTIP
     62        cbHQGraph->setStatusTip(tr("Higher quality graph looks much better when printing but uglier on the screen"));
     63#endif // QT_NO_STATUSTIP
     64        cbHQGraph->setText(tr("Draw solution graph in higher quality"));
     65        cbHQGraph->setCursor(QCursor(Qt::PointingHandCursor));
     66
     67QBoxLayout *box = static_cast<QBoxLayout *>(tabOutput->layout());
     68QHBoxLayout *hbox1 = new QHBoxLayout();
     69        hbox1->addSpacing(10);
     70        hbox1->addWidget(cbHQGraph);
     71        box->insertLayout(box->indexOf(cbShowGraph) + 1, hbox1);
     72        connect(cbShowGraph, SIGNAL(toggled(bool)), cbHQGraph, SLOT(setEnabled(bool)));
     73#endif
    5774
    5875#ifdef HANDHELD
     
    87104#else // HANDHELD
    88105        // Layout helper elements
    89 QVBoxLayout *vbox1, *vbox2;
    90 QHBoxLayout *hbox1;
     106QVBoxLayout *vbox;
     107QHBoxLayout *hbox;
    91108
    92109#ifdef Q_OS_WIN32
     
    139156
    140157        // Top line
    141         hbox1 = new QHBoxLayout();
    142         hbox1->addWidget(imgIcon);
    143         hbox1->addWidget(lineVertical);
    144         hbox1->addWidget(bgWhite);
    145 
    146         vbox1 = static_cast<QVBoxLayout *>(tabGeneral->layout());
    147         vbox1->insertWidget(vbox1->indexOf(cbUseNativeDialogs) + 1, cbSaveState);
     158        hbox = new QHBoxLayout();
     159        hbox->addWidget(imgIcon);
     160        hbox->addWidget(lineVertical);
     161        hbox->addWidget(bgWhite);
     162
     163#ifdef QT_NO_PRINTER
     164QBoxLayout *box;
     165#endif
     166        box = static_cast<QBoxLayout *>(tabGeneral->layout());
     167        box->insertWidget(box->indexOf(cbUseNativeDialogs) + 1, cbSaveState);
    148168#ifdef Q_OS_WIN32
    149169        if (QtWin::isCompositionEnabled())
    150                 vbox1->insertWidget(vbox1->indexOf(cbUseNativeDialogs) + 1, cbUseTranslucency);
     170                box->insertWidget(box->indexOf(cbUseNativeDialogs) + 1, cbUseTranslucency);
    151171#endif // Q_OS_WIN32
    152172
     
    155175
    156176        // Central layout
    157         vbox2 = new QVBoxLayout(this);
    158         vbox2->setMargin(0);
    159         vbox2->setSpacing(0);
    160         vbox2->addLayout(hbox1);
    161         vbox2->addWidget(bgGrey);
    162         setLayout(vbox2);
     177        vbox = new QVBoxLayout(this);
     178        vbox->setMargin(0);
     179        vbox->setSpacing(0);
     180        vbox->addLayout(hbox);
     181        vbox->addWidget(bgGrey);
     182        setLayout(vbox);
    163183#endif // HANDHELD
    164184
     
    167187        connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(desktopResized(int)));
    168188#endif // Q_OS_WINCE_WM
    169         connect(spinRandMin,SIGNAL(valueChanged(int)),this,SLOT(spinRandMinValueChanged(int)));
    170         connect(buttonFont,SIGNAL(clicked()),this,SLOT(buttonFontClicked()));
    171         connect(buttonColor,SIGNAL(clicked()),this,SLOT(buttonColorClicked()));
     189        connect(spinRandMin, SIGNAL(valueChanged(int)), SLOT(spinRandMinValueChanged(int)));
     190        connect(buttonFont, SIGNAL(clicked()), SLOT(buttonFontClicked()));
     191        connect(buttonColor, SIGNAL(clicked()), SLOT(buttonColorClicked()));
    172192        setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
    173193#ifndef HANDHELD
     
    201221        settings->beginGroup("Output");
    202222        cbShowGraph->setChecked(settings->value("ShowGraph", DEF_SHOW_GRAPH).toBool());
     223
     224#ifndef QT_NO_PRINTER
     225        cbHQGraph->setEnabled(cbShowGraph->isChecked());
     226        cbHQGraph->setChecked(settings->value("HQGraph", DEF_HQ_GRAPH && cbShowGraph->isChecked()).toBool());
     227#endif
    203228
    204229#if !defined(NOSVG) && (QT_VERSION >= 0x040500)
     
    311336        settings->beginGroup("Output");
    312337        settings->setValue("ShowGraph", cbShowGraph->isChecked());
     338#ifndef QT_NO_PRINTER
     339        settings->setValue("HQGraph", cbShowGraph->isChecked() && cbHQGraph->isChecked());
     340#endif
    313341        if (cbShowGraph->isChecked()) {
    314342                if (comboGraphImageFormat->currentIndex() >= 0)
  • trunk/src/settingsdialog.h

    r121 r127  
    5959        QCheckBox *cbUseTranslucency;
    6060#endif // Q_OS_WIN32
     61#ifndef QT_NO_PRINTER
     62        QCheckBox *cbHQGraph;
     63#endif
    6164#ifdef Q_OS_WINCE_WM
    6265        QRect currentGeometry;
Note: See TracChangeset for help on using the changeset viewer.