QTfrontend/ui/page/pagedrawmap.cpp
author Wuzzy <Wuzzy2@mail.ru>
Thu, 04 Oct 2018 21:17:21 +0200
changeset 13862 b2cc4e4e380c
parent 13212 e9e4cc867b6e
permissions -rw-r--r--
Merge Racer/TechRacer tie handling
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     1
/*
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
11046
47a8c19ecb60 more copyright fixes
sheepluva
parents: 10700
diff changeset
     3
 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com>
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     4
 *
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     8
 *
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    12
 * GNU General Public License for more details.
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    13
 *
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
10108
c68cf030eded update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents: 9998
diff changeset
    16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    17
 */
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    18
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    19
#include <QGridLayout>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    20
#include <QPushButton>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    21
#include <QFileDialog>
6873
30840365af0a Eraser tool
unc0rr
parents: 6781
diff changeset
    22
#include <QCheckBox>
9551
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
    23
#include <QRadioButton>
13209
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
    24
#include <QSpinBox>
13212
e9e4cc867b6e Add default directory DrawnMaps to put hand-drawn maps into
Wuzzy <Wuzzy2@mail.ru>
parents: 13209
diff changeset
    25
#include <QDir>
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    26
5204
e1a5f4d5d86a split pages.h into several header files
koda
parents: 5078
diff changeset
    27
#include "pagedrawmap.h"
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    28
#include "drawmapwidget.h"
13212
e9e4cc867b6e Add default directory DrawnMaps to put hand-drawn maps into
Wuzzy <Wuzzy2@mail.ru>
parents: 13209
diff changeset
    29
#include "hwconsts.h"
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    30
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6009
diff changeset
    31
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6009
diff changeset
    32
QLayout * PageDrawMap::bodyLayoutDefinition()
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    33
{
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6009
diff changeset
    34
    QGridLayout * pageLayout = new QGridLayout();
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    35
6873
30840365af0a Eraser tool
unc0rr
parents: 6781
diff changeset
    36
    cbEraser = new QCheckBox(tr("Eraser"), this);
30840365af0a Eraser tool
unc0rr
parents: 6781
diff changeset
    37
    pageLayout->addWidget(cbEraser, 0, 0);
9551
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
    38
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
    39
    rbPolyline = new QRadioButton(tr("Polyline"), this);
13205
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    40
    pageLayout->addWidget(rbPolyline, 1, 0);
9551
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
    41
    rbRectangle = new QRadioButton(tr("Rectangle"), this);
13205
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    42
    pageLayout->addWidget(rbRectangle, 2, 0);
9551
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
    43
    rbEllipse = new QRadioButton(tr("Ellipse"), this);
13205
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    44
    pageLayout->addWidget(rbEllipse, 3, 0);
9551
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
    45
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
    46
    rbPolyline->setChecked(true);
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
    47
13209
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
    48
    sbBrushSize = new QSpinBox(this);
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
    49
    sbBrushSize->setWhatsThis(tr("Brush size"));
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
    50
    sbBrushSize->setRange(DRAWN_MAP_BRUSH_SIZE_MIN, DRAWN_MAP_BRUSH_SIZE_MAX);
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
    51
    sbBrushSize->setValue(DRAWN_MAP_BRUSH_SIZE_START);
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
    52
    sbBrushSize->setSingleStep(DRAWN_MAP_BRUSH_SIZE_STEP);
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
    53
    pageLayout->addWidget(sbBrushSize, 4, 0);
13205
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    54
13209
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
    55
    pbUndo = addButton(tr("Undo"), pageLayout, 5, 0);
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
    56
    pbClear = addButton(tr("Clear"), pageLayout, 6, 0);
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
    57
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
    58
    pbOptimize = addButton(tr("Optimize"), pageLayout, 7, 0);
13205
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    59
    // The optimize button is quite buggy, so we disable it for now.
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    60
    // TODO: Re-enable optimize button when it's finished.
10700
a979c857d8c5 Hide "optimize" button
unc0rr
parents: 10235
diff changeset
    61
    pbOptimize->setVisible(false);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    62
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    63
    drawMapWidget = new DrawMapWidget(this);
10235
bafca1686867 Drawn maps optimizer - first steps:
unc0rr
parents: 10108
diff changeset
    64
    pageLayout->addWidget(drawMapWidget, 0, 1, 10, 1);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    65
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6009
diff changeset
    66
    return pageLayout;
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6009
diff changeset
    67
}
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6009
diff changeset
    68
13205
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    69
QLayout * PageDrawMap::footerLayoutDefinition()
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    70
{
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    71
    QHBoxLayout * bottomLayout = new QHBoxLayout();
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    72
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    73
    bottomLayout->addStretch();
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    74
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    75
    pbLoad = addButton(":/res/Load.png", bottomLayout, 0, true, Qt::AlignBottom);
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    76
    pbLoad ->setWhatsThis(tr("Load"));
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    77
    pbLoad->setStyleSheet("QPushButton{margin: 24px 0 0 0;}");
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    78
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    79
    pbSave = addButton(":/res/Save.png", bottomLayout, 0, true, Qt::AlignBottom);
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    80
    pbSave ->setWhatsThis(tr("Save"));
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    81
    pbSave->setStyleSheet("QPushButton{margin: 24px 0 0 0;}");
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    82
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    83
    return bottomLayout;
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    84
}
c681492df36d Drawn map page: Move save and load buttons, fix points label overlap
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    85
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6009
diff changeset
    86
void PageDrawMap::connectSignals()
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6009
diff changeset
    87
{
6873
30840365af0a Eraser tool
unc0rr
parents: 6781
diff changeset
    88
    connect(cbEraser, SIGNAL(toggled(bool)), drawMapWidget, SLOT(setErasing(bool)));
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    89
    connect(pbUndo, SIGNAL(clicked()), drawMapWidget, SLOT(undo()));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    90
    connect(pbClear, SIGNAL(clicked()), drawMapWidget, SLOT(clear()));
10235
bafca1686867 Drawn maps optimizer - first steps:
unc0rr
parents: 10108
diff changeset
    91
    connect(pbOptimize, SIGNAL(clicked()), drawMapWidget, SLOT(optimize()));
13209
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
    92
    connect(sbBrushSize, SIGNAL(valueChanged(int)), drawMapWidget, SLOT(setBrushSize(int)));
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
    93
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
    94
    connect(drawMapWidget, SIGNAL(brushSizeChanged(int)), this, SLOT(brushSizeChanged(int)));
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
    95
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    96
    connect(pbLoad, SIGNAL(clicked()), this, SLOT(load()));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    97
    connect(pbSave, SIGNAL(clicked()), this, SLOT(save()));
9551
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
    98
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
    99
    connect(rbPolyline, SIGNAL(toggled(bool)), this, SLOT(pathTypeSwitched(bool)));
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
   100
    connect(rbRectangle, SIGNAL(toggled(bool)), this, SLOT(pathTypeSwitched(bool)));
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
   101
    connect(rbEllipse, SIGNAL(toggled(bool)), this, SLOT(pathTypeSwitched(bool)));
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   102
}
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   103
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6009
diff changeset
   104
PageDrawMap::PageDrawMap(QWidget* parent) : AbstractPage(parent)
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6009
diff changeset
   105
{
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6009
diff changeset
   106
    initPage();
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6009
diff changeset
   107
}
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6009
diff changeset
   108
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   109
void PageDrawMap::load()
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   110
{
13212
e9e4cc867b6e Add default directory DrawnMaps to put hand-drawn maps into
Wuzzy <Wuzzy2@mail.ru>
parents: 13209
diff changeset
   111
    QString loadDir = QDir(cfgdir->absolutePath() + "/DrawnMaps").absolutePath();
e9e4cc867b6e Add default directory DrawnMaps to put hand-drawn maps into
Wuzzy <Wuzzy2@mail.ru>
parents: 13209
diff changeset
   112
    QString fileName = QFileDialog::getOpenFileName(this, tr("Load drawn map"), loadDir, tr("Drawn Maps") + " (*.hwmap);;" + tr("All files") + " (*)");
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   113
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   114
    if(!fileName.isEmpty())
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   115
        drawMapWidget->load(fileName);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   116
}
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   117
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   118
void PageDrawMap::save()
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   119
{
13212
e9e4cc867b6e Add default directory DrawnMaps to put hand-drawn maps into
Wuzzy <Wuzzy2@mail.ru>
parents: 13209
diff changeset
   120
    QString saveDir = QDir(cfgdir->absolutePath() + "/DrawnMaps/map.hwmap").absolutePath();
e9e4cc867b6e Add default directory DrawnMaps to put hand-drawn maps into
Wuzzy <Wuzzy2@mail.ru>
parents: 13209
diff changeset
   121
    QString fileName = QFileDialog::getSaveFileName(this, tr("Save drawn map"), saveDir, tr("Drawn Maps") + " (*.hwmap);;" + tr("All files") + " (*)");
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   122
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   123
    if(!fileName.isEmpty())
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   124
        drawMapWidget->save(fileName);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   125
}
9551
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
   126
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
   127
void PageDrawMap::pathTypeSwitched(bool b)
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
   128
{
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
   129
    if(b)
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
   130
    {
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
   131
        if(rbPolyline->isChecked()) drawMapWidget->setPathType(DrawMapScene::Polyline);
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
   132
        else if(rbRectangle->isChecked()) drawMapWidget->setPathType(DrawMapScene::Rectangle);
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
   133
        else if(rbEllipse->isChecked()) drawMapWidget->setPathType(DrawMapScene::Ellipse);
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
   134
    }
61f160dfd0f1 Draw rectangles and ellipses!
unc0rr
parents: 9080
diff changeset
   135
}
13209
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
   136
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
   137
void PageDrawMap::brushSizeChanged(int brushSize)
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
   138
{
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
   139
    sbBrushSize->setValue(brushSize);
f5d36be88c61 Drawn map menu: Add spin box to change brush size by hand
Wuzzy <Wuzzy2@mail.ru>
parents: 13205
diff changeset
   140
}