StelGuiItems.hpp   StelGuiItems.hpp 
skipping to change at line 26 skipping to change at line 26
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef _STELGUIITEMS_HPP_ #ifndef _STELGUIITEMS_HPP_
#define _STELGUIITEMS_HPP_ #define _STELGUIITEMS_HPP_
#include <QGraphicsPixmapItem> #include <QGraphicsPixmapItem>
#include <QGraphicsWidget> #include <QGraphicsWidget>
#include <QDebug> #include <QDebug>
#include <QMap>
class QGraphicsSceneMouseEvent; class QGraphicsSceneMouseEvent;
class QTimeLine; class QTimeLine;
class QAction;
class QGraphicsTextItem; class QGraphicsTextItem;
class QTimer; class QTimer;
class StelProgressController;
class QProgressBar;
// Progess bars in the lower right corner // Progess bars in the lower right corner
class StelProgressBarMgr : public QGraphicsWidget class StelProgressBarMgr : public QGraphicsWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
StelProgressBarMgr(QGraphicsItem* parent); StelProgressBarMgr(QGraphicsItem* parent);
class QProgressBar* addProgressBar();
public slots:
void addProgressBar(const StelProgressController *p);
void removeProgressBar(const StelProgressController *p);
void oneBarChanged();
private:
QMap<const StelProgressController*, QProgressBar*> allBars;
}; };
// Buttons in the bottom left corner // Buttons in the bottom left corner
class CornerButtons : public QObject, public QGraphicsItem class CornerButtons : public QObject, public QGraphicsItem
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(QGraphicsItem); Q_INTERFACES(QGraphicsItem)
public: public:
CornerButtons(QGraphicsItem* parent=NULL); CornerButtons(QGraphicsItem* parent=NULL);
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
virtual QRectF boundingRect() const; virtual QRectF boundingRect() const;
void setOpacity(double opacity); void setOpacity(double opacity);
private: private:
mutable double lastOpacity; mutable double lastOpacity;
}; };
//! A Button Graphicsitem for use in Stellarium's graphic widgets //! A Button Graphicsitem for use in Stellarium's graphic widgets
skipping to change at line 72 skipping to change at line 80
public: public:
//! Constructor //! Constructor
//! @param parent the parent item //! @param parent the parent item
//! @param pixOn the pixmap to display when the button is toggled //! @param pixOn the pixmap to display when the button is toggled
//! @param pixOff the pixmap to display when the button is not toggl ed //! @param pixOff the pixmap to display when the button is not toggl ed
//! @param pixHover a pixmap slowly blended when mouse is over the b utton //! @param pixHover a pixmap slowly blended when mouse is over the b utton
//! @param action the associated action. Connections are automatical ly done with the signals if relevant. //! @param action the associated action. Connections are automatical ly done with the signals if relevant.
//! @param noBackground define whether the button background image h ave to be used //! @param noBackground define whether the button background image h ave to be used
StelButton(QGraphicsItem* parent, const QPixmap& pixOn, const QPixma p& pixOff, StelButton(QGraphicsItem* parent, const QPixmap& pixOn, const QPixma p& pixOff,
const QPixmap& pixHover=QPixmap(), const QPixmap& pixHover=QPixmap(),
QAction* action=NULL, bool noBackground=false); class StelAction* action=NULL, bool noBackground=
false);
StelButton(QGraphicsItem* parent, const QPixmap& pixOn, const QPixma
p& pixOff,
const QPixmap& pixHover=QPixmap(),
const QString& actionId=QString(), bool noBackgro
und=false);
//! Constructor //! Constructor
//! @param parent the parent item //! @param parent the parent item
//! @param pixOn the pixmap to display when the button is toggled //! @param pixOn the pixmap to display when the button is toggled
//! @param pixOff the pixmap to display when the button is not toggl ed //! @param pixOff the pixmap to display when the button is not toggl ed
//! @param pixNoChange the pixmap to display when the button state o f a tristate is not changed //! @param pixNoChange the pixmap to display when the button state o f a tristate is not changed
//! @param pixHover a pixmap slowly blended when mouse is over the b utton //! @param pixHover a pixmap slowly blended when mouse is over the b utton
//! @param action the associated action. Connections are automatical ly done with the signals if relevant. //! @param actionId the associated action. Connections are automatic ally done with the signals if relevant.
//! @param noBackground define whether the button background image h ave to be used //! @param noBackground define whether the button background image h ave to be used
//! @param isTristate define whether the button is a tristate or an on/off button //! @param isTristate define whether the button is a tristate or an on/off button
StelButton(QGraphicsItem* parent, const QPixmap& pixOn, const QPixma p& pixOff, const QPixmap& pixNoChange, StelButton(QGraphicsItem* parent, const QPixmap& pixOn, const QPixma p& pixOff, const QPixmap& pixNoChange,
const QPixmap& pixHover=QPixmap(), const QPixmap& pixHover=QPixmap(),
QAction* action=NULL, bool noBackground=false, bo const QString& actionId=QString(), bool noBackgro
ol isTristate=true); und=false, bool isTristate=true);
//! Button states //! Button states
enum {ButtonStateOff = 0, ButtonStateOn = 1, ButtonStateNoChange = 2 }; enum {ButtonStateOff = 0, ButtonStateOn = 1, ButtonStateNoChange = 2 };
//! Get whether the button is checked //! Get whether the button is checked
int isChecked() const {return checked;} int isChecked() const {return checked;}
//! Get the width of the button image. //! Get the width of the button image.
//! The width is based on pixOn. //! The width is based on pixOn.
int getButtonPixmapWidth() const {return pixOn.width();} int getButtonPixmapWidth() const {return pixOn.width();}
//! Set the button opacity //! Set the button opacity
void setOpacity(double v) {opacity=v; updateIcon();} void setOpacity(double v) {opacity=v; updateIcon();}
//! Activate red mode for this button, i.e. will reduce the non red
color component of the icon
void setRedMode(bool b) {redMode=b; updateIcon();}
//! Set the background pixmap of the button. //! Set the background pixmap of the button.
//! A variant for night vision mode (pixBackgroundRed) is automatica
lly
//! generated from the new background.
void setBackgroundPixmap(const QPixmap& newBackground); void setBackgroundPixmap(const QPixmap& newBackground);
//! Transform the pixmap so that it look red for night vision mode
static QPixmap makeRed(const QPixmap& p);
signals: signals:
//! Triggered when the button state changes //! Triggered when the button state changes
void toggled(bool); void toggled(bool);
//! Triggered when the button state changes //! Triggered when the button state changes
void triggered(); void triggered();
//! Emitted when the hover state change //! Emitted when the hover state change
//! @param b true if the mouse entered the button //! @param b true if the mouse entered the button
void hoverChanged(bool b); void hoverChanged(bool b);
public slots: public slots:
skipping to change at line 131 skipping to change at line 136
void setChecked(bool b) { setChecked((int)b); } void setChecked(bool b) { setChecked((int)b); }
protected: protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent* event); virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* event); virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* event);
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* event); virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
private slots: private slots:
void animValueChanged(qreal value); void animValueChanged(qreal value);
private: private:
void initCtor(const QPixmap& apixOn,
const QPixmap& apixOff,
const QPixmap& apixNoChange,
const QPixmap& apixHover,
StelAction* aaction,
bool noBackground,
bool isTristate);
void updateIcon(); void updateIcon();
int toggleChecked(int); int toggleChecked(int);
QPixmap pixOn; QPixmap pixOn;
QPixmap pixOff; QPixmap pixOff;
QPixmap pixNoChange; QPixmap pixNoChange;
QPixmap pixHover; QPixmap pixHover;
QPixmap pixBackground; QPixmap pixBackground;
QPixmap pixOnRed;
QPixmap pixOffRed;
QPixmap pixNoChangeRed;
QPixmap pixHoverRed;
QPixmap pixBackgroundRed;
int checked; int checked;
QTimeLine* timeLine; QTimeLine* timeLine;
QAction* action; class StelAction* action;
bool noBckground; bool noBckground;
bool isTristate_; bool isTristate_;
double opacity; double opacity;
double hoverOpacity; double hoverOpacity;
bool redMode;
}; };
// The button bar on the left containing windows toggle buttons // The button bar on the left containing windows toggle buttons
class LeftStelBar : public QObject, public QGraphicsItem class LeftStelBar : public QObject, public QGraphicsItem
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(QGraphicsItem); Q_INTERFACES(QGraphicsItem);
public: public:
LeftStelBar(QGraphicsItem* parent); LeftStelBar(QGraphicsItem* parent);
~LeftStelBar(); ~LeftStelBar();
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
virtual QRectF boundingRect() const; virtual QRectF boundingRect() const;
void addButton(StelButton* button); void addButton(StelButton* button);
QRectF boundingRectNoHelpLabel() const; QRectF boundingRectNoHelpLabel() const;
//! Set the color for all the sub elements //! Set the color for all the sub elements
void setColor(const QColor& c); void setColor(const QColor& c);
//! Activate red mode for the buttons, i.e. will reduce the non red
color component of the icon
void setRedMode(bool b);
private slots: private slots:
//! Update the help label when a button is hovered //! Update the help label when a button is hovered
void buttonHoverChanged(bool b); void buttonHoverChanged(bool b);
private: private:
QTimeLine* hideTimeLine; QTimeLine* hideTimeLine;
QGraphicsSimpleTextItem* helpLabel; QGraphicsSimpleTextItem* helpLabel;
}; };
// The button bar on the bottom containing actions toggle buttons // The button bar on the bottom containing actions toggle buttons
class BottomStelBar : public QObject, public QGraphicsItem class BottomStelBar : public QObject, public QGraphicsItem
skipping to change at line 213 skipping to change at line 215
void setGroupMargin(const QString& groupName, int left, int right); void setGroupMargin(const QString& groupName, int left, int right);
//! Set the background of a group //! Set the background of a group
void setGroupBackground(const QString& groupName, const QPixmap& pix Left=QPixmap(), void setGroupBackground(const QString& groupName, const QPixmap& pix Left=QPixmap(),
const QPixmap& pixRi ght=QPixmap(), const QPixmap& pixMiddle=QPixmap(), const QPixmap& pixRi ght=QPixmap(), const QPixmap& pixMiddle=QPixmap(),
const QPixmap& pixSi ngle=QPixmap()); const QPixmap& pixSi ngle=QPixmap());
//! Set the color for all the sub elements //! Set the color for all the sub elements
void setColor(const QColor& c); void setColor(const QColor& c);
//! Activate red mode for the buttons, i.e. will reduce the non red
color component of the icon
void setRedMode(bool b);
//! Set whether time must be displayed in the bottom bar //! Set whether time must be displayed in the bottom bar
void setFlagShowTime(bool b) {flagShowTime=b;} void setFlagShowTime(bool b) {flagShowTime=b;}
//! Set whether location info must be displayed in the bottom bar //! Set whether location info must be displayed in the bottom bar
void setFlagShowLocation(bool b) {flagShowLocation=b;} void setFlagShowLocation(bool b) {flagShowLocation=b;}
signals:
void sizeChanged();
private slots: private slots:
//! Update the help label when a button is hovered //! Update the help label when a button is hovered
void buttonHoverChanged(bool b); void buttonHoverChanged(bool b);
private: private:
void updateText(bool forceUpdatePos=false); void updateText(bool forceUpdatePos=false);
void updateButtonsGroups(); void updateButtonsGroups();
QRectF getButtonsBoundingRect() const; QRectF getButtonsBoundingRect() const;
QGraphicsSimpleTextItem* location; QGraphicsSimpleTextItem* location;
QGraphicsSimpleTextItem* datetime; QGraphicsSimpleTextItem* datetime;
 End of changes. 18 change blocks. 
33 lines changed or deleted 34 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/