QTfrontend/drawmapscene.h
author Zorg <zorgiepoo@gmail.com>
Wed, 08 Jun 2011 03:36:54 -0400
changeset 5229 148d581b17ab
parent 4976 088d40d8aba2
child 5858 1f4a8cf9efcb
permissions -rw-r--r--
Attempt to fix issue #125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4976
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
     1
/*
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
     2
 * Hedgewars, a free turn based strategy game
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
     3
 * Copyright (c) 2011 Andrey Korotaev <unC0Rr@gmail.com>
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
     4
 *
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
     8
 *
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
    12
 * GNU General Public License for more details.
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
    13
 *
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
    14
 * You should have received a copy of the GNU General Public License
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
    15
 * along with this program; if not, write to the Free Software
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
    17
 */
088d40d8aba2 Happy 2011 :)
koda
parents: 4560
diff changeset
    18
4423
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    19
#ifndef DRAWMAPSCENE_H
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    20
#define DRAWMAPSCENE_H
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    21
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    22
#include <QGraphicsScene>
4442
f8424e1bc936 - Implement decode() function.
unc0rr
parents: 4439
diff changeset
    23
#include <QPainterPath>
4423
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    24
4426
969e411c72aa Improve map editor a bit
unc0rr
parents: 4424
diff changeset
    25
class QGraphicsPathItem;
969e411c72aa Improve map editor a bit
unc0rr
parents: 4424
diff changeset
    26
4427
c5193713055f Basic encoding of drawn map
unc0rr
parents: 4426
diff changeset
    27
typedef QList<QList<QPoint> > Paths;
c5193713055f Basic encoding of drawn map
unc0rr
parents: 4426
diff changeset
    28
4423
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    29
class DrawMapScene : public QGraphicsScene
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    30
{
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    31
Q_OBJECT
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    32
public:
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    33
    explicit DrawMapScene(QObject *parent = 0);
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    34
4427
c5193713055f Basic encoding of drawn map
unc0rr
parents: 4426
diff changeset
    35
    QByteArray encode();
4442
f8424e1bc936 - Implement decode() function.
unc0rr
parents: 4439
diff changeset
    36
    void decode(QByteArray data);
4427
c5193713055f Basic encoding of drawn map
unc0rr
parents: 4426
diff changeset
    37
4423
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    38
signals:
4427
c5193713055f Basic encoding of drawn map
unc0rr
parents: 4426
diff changeset
    39
    void pathChanged();
4423
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    40
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    41
public slots:
4426
969e411c72aa Improve map editor a bit
unc0rr
parents: 4424
diff changeset
    42
    void undo();
4560
5d6c7f88db73 - Some work on drawMap widget and scene to allow undo, clear, save and load operations
unc0rr
parents: 4520
diff changeset
    43
    void clearMap();
4439
27a896207aae Some more improvements
unC0Rr
parents: 4434
diff changeset
    44
    void simplifyLast();
4423
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    45
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    46
private:
4424
3225ea34e415 Some basic functionality
unc0rr
parents: 4423
diff changeset
    47
    QPen m_pen;
3225ea34e415 Some basic functionality
unc0rr
parents: 4423
diff changeset
    48
    QBrush m_brush;
4426
969e411c72aa Improve map editor a bit
unc0rr
parents: 4424
diff changeset
    49
    QGraphicsPathItem  * m_currPath;
4427
c5193713055f Basic encoding of drawn map
unc0rr
parents: 4426
diff changeset
    50
    Paths paths;
4424
3225ea34e415 Some basic functionality
unc0rr
parents: 4423
diff changeset
    51
4423
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    52
    virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent);
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    53
    virtual void mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent);
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    54
    virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * mouseEvent);
4442
f8424e1bc936 - Implement decode() function.
unc0rr
parents: 4439
diff changeset
    55
f8424e1bc936 - Implement decode() function.
unc0rr
parents: 4439
diff changeset
    56
    QPainterPath pointsToPath(const QList<QPoint> points);
4423
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    57
};
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    58
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    59
#endif // DRAWMAPSCENE_H