QTfrontend/ui/widget/colorwidget.h
author dag10
Mon, 14 Jan 2013 11:19:59 +0100
changeset 8377 869f80966a77
parent 7750 31e4f6c1834b
child 8434 4821897a0f10
permissions -rw-r--r--
GCI2012: Improve Game Configuration Widget - Refactored mapmodel+datamanager to have two separate map models for static and mission maps, and then three static MapInfos in MapModel for the three special maps (random, maze, drawn). - Created theme selector dialog. - Created seed view/edit dialog. - Enlarged start icon on pagemultiplayer and pagenetgame, and added Start.png. - Moved "Settings" button on pagemultiplayer and pagenetgame from middle of page to page footer. - Added "load drawing" button to mapcontainer widget. - Map preview is no longer the randomize button; The randomize functionality is now in a button of its own. - Map preview no longer grays out (isn't disabled) when in slave mode. - Seed is now viewable and copyable when in slave mode -- but not editable. - You should now use the property master (isMaster() and setMaster()) on gamecfgwidget and mapcontainer instead of the enabled property. This is because some widgets (e.g. "view/edit seed" button and map preview) shouldn't be disabled, when all other widgets should be. - Added mission map descriptions w/ locale support in INI format in mapname/desc.txt if applicable. Use '|' for line break.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7130
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
     1
#ifndef COLORWIDGET_H
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
     2
#define COLORWIDGET_H
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
     3
7749
edad8a7bcaea Convert ColorWidget from QWidget to QFrame and make use of The Box Model(tm) in stylesheet
unc0rr
parents: 7130
diff changeset
     4
#include <QFrame>
7130
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
     5
#include <QModelIndex>
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
     6
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
     7
namespace Ui {
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
     8
class ColorWidget;
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
     9
}
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    10
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    11
class QStandardItemModel;
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    12
7749
edad8a7bcaea Convert ColorWidget from QWidget to QFrame and make use of The Box Model(tm) in stylesheet
unc0rr
parents: 7130
diff changeset
    13
class ColorWidget : public QFrame
7130
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    14
{
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    15
    Q_OBJECT
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    16
    
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    17
public:
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    18
    explicit ColorWidget(QStandardItemModel *colorsModel, QWidget *parent = 0);
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    19
    ~ColorWidget();
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    20
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    21
    void setColors(QStandardItemModel * colorsModel);
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    22
    void setColor(int color);
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    23
    int getColor();
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    24
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    25
signals:
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    26
    void colorChanged(int color);
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    27
    
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    28
private:
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    29
    int m_color;
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    30
    QStandardItemModel * m_colorsModel;
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    31
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    32
private slots:
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    33
    void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    34
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    35
protected:
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    36
    void mousePressEvent(QMouseEvent * event);
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    37
    void wheelEvent(QWheelEvent * event);
7750
31e4f6c1834b small tweak. (reverse mouse wheel directions for color change)
sheepluva
parents: 7749
diff changeset
    38
    void nextColor();
31e4f6c1834b small tweak. (reverse mouse wheel directions for color change)
sheepluva
parents: 7749
diff changeset
    39
    void previousColor();
7130
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    40
};
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    41
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    42
#endif // COLORWIDGET_H