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" |
Robert Bieber | e1d8a3d | 2010-06-21 20:11:58 +0000 | [diff] [blame] | 28 | #include "rbrenderinfo.h" |
Robert Bieber | ac9287b | 2010-06-22 07:55:50 +0000 | [diff] [blame] | 29 | #include "rbimage.h" |
Robert Bieber | 6d61566 | 2010-06-23 20:18:31 +0000 | [diff] [blame] | 30 | #include "rbfont.h" |
Robert Bieber | 8114979 | 2010-06-30 19:35:00 +0000 | [diff] [blame] | 31 | #include "rbalbumart.h" |
| 32 | #include "rbviewport.h" |
Robert Bieber | 02c3774 | 2010-06-17 20:44:11 +0000 | [diff] [blame] | 33 | |
| 34 | class RBScreen : public QGraphicsItem |
| 35 | { |
| 36 | |
| 37 | public: |
Robert Bieber | 5300c70 | 2010-06-26 05:51:07 +0000 | [diff] [blame] | 38 | RBScreen(const RBRenderInfo& info, bool remote = false, |
| 39 | QGraphicsItem *parent = 0); |
Robert Bieber | 02c3774 | 2010-06-17 20:44:11 +0000 | [diff] [blame] | 40 | virtual ~RBScreen(); |
| 41 | |
| 42 | QPainterPath shape() const; |
| 43 | QRectF boundingRect() const; |
| 44 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, |
| 45 | QWidget *widget); |
| 46 | |
Robert Bieber | d8827b5 | 2010-06-18 21:10:01 +0000 | [diff] [blame] | 47 | int getWidth() const{ return width; } |
| 48 | int getHeight() const{ return height; } |
| 49 | |
Robert Bieber | 481bcf2 | 2010-06-24 18:55:04 +0000 | [diff] [blame] | 50 | void loadViewport(QString name, RBViewport* view); |
Robert Bieber | e1d8a3d | 2010-06-21 20:11:58 +0000 | [diff] [blame] | 51 | void showViewport(QString name); |
Robert Bieber | 1fbea62 | 2010-06-29 21:09:29 +0000 | [diff] [blame] | 52 | bool viewPortDisplayed(QString name) |
| 53 | { |
| 54 | return displayedViewports.contains(name); |
| 55 | } |
Robert Bieber | 02c3774 | 2010-06-17 20:44:11 +0000 | [diff] [blame] | 56 | |
Robert Bieber | ac9287b | 2010-06-22 07:55:50 +0000 | [diff] [blame] | 57 | void loadImage(QString name, RBImage* image) |
| 58 | { |
| 59 | images.insert(name, image); |
Robert Bieber | d302705 | 2010-06-23 07:18:22 +0000 | [diff] [blame] | 60 | image->hide(); |
Robert Bieber | ac9287b | 2010-06-22 07:55:50 +0000 | [diff] [blame] | 61 | } |
| 62 | RBImage* getImage(QString name){ return images.value(name, 0); } |
| 63 | |
Robert Bieber | 6d61566 | 2010-06-23 20:18:31 +0000 | [diff] [blame] | 64 | void loadFont(int id, RBFont* font); |
| 65 | RBFont* getFont(int id); |
| 66 | |
Robert Bieber | ac9287b | 2010-06-22 07:55:50 +0000 | [diff] [blame] | 67 | void setBackdrop(QString filename); |
Robert Bieber | 273b9d6 | 2010-06-25 05:14:13 +0000 | [diff] [blame] | 68 | bool hasBackdrop(){ return backdrop != 0; } |
Robert Bieber | deab1bb | 2010-06-23 19:41:30 +0000 | [diff] [blame] | 69 | void makeCustomUI(QString id); |
Robert Bieber | 2f68e5b | 2010-07-03 22:57:42 +0000 | [diff] [blame] | 70 | void setCustomUI(RBViewport* viewport){ customUI = viewport; } |
| 71 | RBViewport* getCustomUI(){ return customUI; } |
Robert Bieber | ac9287b | 2010-06-22 07:55:50 +0000 | [diff] [blame] | 72 | |
Robert Bieber | 02c3774 | 2010-06-17 20:44:11 +0000 | [diff] [blame] | 73 | static QColor stringToColor(QString str, QColor fallback); |
| 74 | |
Robert Bieber | 273b9d6 | 2010-06-25 05:14:13 +0000 | [diff] [blame] | 75 | QColor foreground(){ return fgColor; } |
| 76 | QColor background(){ return bgColor; } |
| 77 | |
Robert Bieber | 8114979 | 2010-06-30 19:35:00 +0000 | [diff] [blame] | 78 | void setAlbumArt(RBAlbumArt* art){ albumArt = art; } |
| 79 | void showAlbumArt(RBViewport* view) |
| 80 | { |
| 81 | if(albumArt) |
| 82 | { |
| 83 | albumArt->setParentItem(view); |
| 84 | albumArt->show(); |
Robert Bieber | 265ee15 | 2010-08-05 08:03:32 +0000 | [diff] [blame] | 85 | albumArt->enableMove(); |
Robert Bieber | 8114979 | 2010-06-30 19:35:00 +0000 | [diff] [blame] | 86 | } |
| 87 | } |
| 88 | |
Robert Bieber | d1a392a | 2010-08-09 19:37:23 +0000 | [diff] [blame] | 89 | void setDefault(RBViewport* view){ defaultView = view; } |
| 90 | void endSbsRender(); |
Robert Bieber | 2f68e5b | 2010-07-03 22:57:42 +0000 | [diff] [blame] | 91 | void breakSBS(); |
Robert Bieber | d8827b5 | 2010-06-18 21:10:01 +0000 | [diff] [blame] | 92 | |
Robert Bieber | 1ee2cdd | 2010-08-12 23:05:53 +0000 | [diff] [blame] | 93 | void RtlMirror(){ ax = true; } |
| 94 | bool isRtlMirrored(){ bool ret = ax; ax = false; return ret; } |
| 95 | |
Robert Bieber | df1ff11 | 2010-08-06 20:53:50 +0000 | [diff] [blame] | 96 | protected: |
| 97 | void hoverMoveEvent(QGraphicsSceneHoverEvent *event); |
| 98 | |
Robert Bieber | 02c3774 | 2010-06-17 20:44:11 +0000 | [diff] [blame] | 99 | private: |
| 100 | int width; |
| 101 | int height; |
Robert Bieber | 2f68e5b | 2010-07-03 22:57:42 +0000 | [diff] [blame] | 102 | int fullWidth; |
| 103 | int fullHeight; |
Robert Bieber | 02c3774 | 2010-06-17 20:44:11 +0000 | [diff] [blame] | 104 | QColor bgColor; |
| 105 | QColor fgColor; |
| 106 | QPixmap* backdrop; |
Robert Bieber | ac9287b | 2010-06-22 07:55:50 +0000 | [diff] [blame] | 107 | QString themeBase; |
Robert Bieber | 02c3774 | 2010-06-17 20:44:11 +0000 | [diff] [blame] | 108 | |
| 109 | ProjectModel* project; |
| 110 | |
Robert Bieber | 481bcf2 | 2010-06-24 18:55:04 +0000 | [diff] [blame] | 111 | QMap<QString, QList<RBViewport*>*> namedViewports; |
Robert Bieber | ac9287b | 2010-06-22 07:55:50 +0000 | [diff] [blame] | 112 | QMap<QString, RBImage*> images; |
| 113 | QMap<QString, QString>* settings; |
Robert Bieber | 6d61566 | 2010-06-23 20:18:31 +0000 | [diff] [blame] | 114 | QMap<int, RBFont*> fonts; |
Robert Bieber | 1fbea62 | 2010-06-29 21:09:29 +0000 | [diff] [blame] | 115 | QList<QString> displayedViewports; |
Robert Bieber | e1d8a3d | 2010-06-21 20:11:58 +0000 | [diff] [blame] | 116 | |
Robert Bieber | 8114979 | 2010-06-30 19:35:00 +0000 | [diff] [blame] | 117 | RBAlbumArt* albumArt; |
Robert Bieber | 2f68e5b | 2010-07-03 22:57:42 +0000 | [diff] [blame] | 118 | RBViewport* customUI; |
Robert Bieber | d1a392a | 2010-08-09 19:37:23 +0000 | [diff] [blame] | 119 | RBViewport* defaultView; |
| 120 | |
| 121 | QList<QGraphicsItem*> sbsChildren; |
Robert Bieber | 1ee2cdd | 2010-08-12 23:05:53 +0000 | [diff] [blame] | 122 | |
| 123 | bool ax; |
Robert Bieber | 02c3774 | 2010-06-17 20:44:11 +0000 | [diff] [blame] | 124 | }; |
| 125 | |
| 126 | #endif // RBSCREEN_H |