Robert Bieber | 02c3774 | 2010-06-17 20:44:11 +0000 | [diff] [blame^] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2010 Robert Bieber |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License |
| 14 | * as published by the Free Software Foundation; either version 2 |
| 15 | * of the License, or (at your option) any later version. |
| 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
| 20 | ****************************************************************************/ |
| 21 | |
| 22 | #ifndef RBSCREEN_H |
| 23 | #define RBSCREEN_H |
| 24 | |
| 25 | #include <QGraphicsItem> |
| 26 | |
| 27 | #include "projectmodel.h" |
| 28 | |
| 29 | class RBScreen : public QGraphicsItem |
| 30 | { |
| 31 | |
| 32 | public: |
| 33 | RBScreen(ProjectModel* project = 0, QGraphicsItem *parent = 0); |
| 34 | virtual ~RBScreen(); |
| 35 | |
| 36 | QPainterPath shape() const; |
| 37 | QRectF boundingRect() const; |
| 38 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, |
| 39 | QWidget *widget); |
| 40 | |
| 41 | static QString safeSetting(ProjectModel* project, QString key, |
| 42 | QString fallback) |
| 43 | { |
| 44 | if(project) |
| 45 | return project->getSetting(key, fallback); |
| 46 | else |
| 47 | return fallback; |
| 48 | } |
| 49 | |
| 50 | static QColor stringToColor(QString str, QColor fallback); |
| 51 | |
| 52 | private: |
| 53 | int width; |
| 54 | int height; |
| 55 | QColor bgColor; |
| 56 | QColor fgColor; |
| 57 | QPixmap* backdrop; |
| 58 | |
| 59 | ProjectModel* project; |
| 60 | |
| 61 | }; |
| 62 | |
| 63 | #endif // RBSCREEN_H |