diff options
author | Ruslan Kabatsayev <b7.10110111@gmail.com> | 2024-02-29 15:03:44 +0400 |
---|---|---|
committer | Ruslan Kabatsayev <b7.10110111@gmail.com> | 2024-02-29 15:04:33 +0400 |
commit | ef5b1d7e0db0fbff3ccc9dab14171c0b978b3ef7 (patch) | |
tree | 84119f1daa767bcfdde0a9be1f86178ea58d224f | |
parent | be30f1841fc99c5fd444b002136ccd2a52793ab4 (diff) |
Rename ButtonBarsPath -> ButtonBarsFrame
This lets us change the implementation while retaining purpose.
-rw-r--r-- | src/gui/SkyGui.cpp | 28 | ||||
-rw-r--r-- | src/gui/SkyGui.hpp | 2 | ||||
-rw-r--r-- | src/gui/StelGuiItems.cpp | 6 | ||||
-rw-r--r-- | src/gui/StelGuiItems.hpp | 6 |
4 files changed, 21 insertions, 21 deletions
diff --git a/src/gui/SkyGui.cpp b/src/gui/SkyGui.cpp index 70e3ab0368..e2aef11095 100644 --- a/src/gui/SkyGui.cpp +++ b/src/gui/SkyGui.cpp @@ -202,7 +202,7 @@ SkyGui::SkyGui(QGraphicsItem * parent) connect(&StelApp::getInstance(), SIGNAL(progressBarRemoved(const StelProgressController*)), progressBarMgr, SLOT(removeProgressBar(const StelProgressController*))); // The path drawn around the button bars - buttonBarsPath = new StelBarsPath(this); + buttonBarsFrame = new StelBarsFrame(this); animLeftBarTimeLine = new QTimeLine(200, this); animLeftBarTimeLine->setEasingCurve(QEasingCurve(QEasingCurve::InOutSine)); @@ -247,13 +247,13 @@ void SkyGui::init(StelGui* astelGui) animLeftBarTimeLine->start(); } - buttonBarsPath->setZValue(-0.1); + buttonBarsFrame->setZValue(-0.1); updateBarsPos(); connect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(const QString&)), this, SLOT(setStelStyle(const QString&))); connect(bottomBar, SIGNAL(sizeChanged()), this, SLOT(updateBarsPos())); // The first draw of path may show overshooting date line if there are too few buttons in the bottom bar. // Correct this by a redraw 1/2s after startup - QTimer::singleShot(500, this, [=](){buttonBarsPath->updatePath(bottomBar, leftBar);}); + QTimer::singleShot(500, this, [=](){buttonBarsFrame->updatePath(bottomBar, leftBar);}); } void SkyGui::resizeEvent(QGraphicsSceneResizeEvent* event) @@ -268,8 +268,8 @@ void SkyGui::hoverMoveEvent(QGraphicsSceneHoverEvent* event) const double x = event->pos().x(); const double y = event->pos().y(); - double maxX = leftBar->boundingRect().width()+2.*buttonBarsPath->getRoundSize(); - double maxY = hh-(leftBar->boundingRect().height()+bottomBar->boundingRect().height()+2.*buttonBarsPath->getRoundSize()); + double maxX = leftBar->boundingRect().width()+2.*buttonBarsFrame->getRoundSize(); + double maxY = hh-(leftBar->boundingRect().height()+bottomBar->boundingRect().height()+2.*buttonBarsFrame->getRoundSize()); const double minX = 0; if (x<=maxX && y>=maxY && animLeftBarTimeLine->state()==QTimeLine::NotRunning && leftBar->pos().x()<minX) @@ -283,8 +283,8 @@ void SkyGui::hoverMoveEvent(QGraphicsSceneHoverEvent* event) animLeftBarTimeLine->start(); } - maxX = leftBar->boundingRect().width()+bottomBar->boundingRect().width()+2.*buttonBarsPath->getRoundSize(); - maxY = hh-bottomBar->boundingRect().height()+2.*buttonBarsPath->getRoundSize(); + maxX = leftBar->boundingRect().width()+bottomBar->boundingRect().width()+2.*buttonBarsFrame->getRoundSize(); + maxY = hh-bottomBar->boundingRect().height()+2.*buttonBarsFrame->getRoundSize(); if (x<=maxX && y>=maxY && animBottomBarTimeLine->state()==QTimeLine::NotRunning && animBottomBarTimeLine->currentValue()<1.) { animBottomBarTimeLine->setDirection(QTimeLine::Forward); @@ -334,8 +334,8 @@ void SkyGui::updateBarsPos() bool updatePath = false; // Use a position cache to avoid useless redraw triggered by the position set if the bars don't move - const double rangeX = leftBar->boundingRectNoHelpLabel().width()+2.*buttonBarsPath->getRoundSize()+1.; - const qreal newLeftBarX = buttonBarsPath->getRoundSize()-(1.-animLeftBarTimeLine->currentValue())*rangeX-0.5; + const double rangeX = leftBar->boundingRectNoHelpLabel().width()+2.*buttonBarsFrame->getRoundSize()+1.; + const qreal newLeftBarX = buttonBarsFrame->getRoundSize()-(1.-animLeftBarTimeLine->currentValue())*rangeX-0.5; const qreal newLeftBarY = hh-leftBar->boundingRectNoHelpLabel().height()-bottomBar->boundingRectNoHelpLabel().height()-20; if (!qFuzzyCompare(leftBar->pos().x(), newLeftBarX) || !qFuzzyCompare(leftBar->pos().y(), newLeftBarY)) { @@ -344,8 +344,8 @@ void SkyGui::updateBarsPos() } const double rangeY = bottomBar->getButtonsBoundingRect().height()+1.5+bottomBar->getGap(); - const qreal newBottomBarX = leftBar->boundingRectNoHelpLabel().right()+buttonBarsPath->getRoundSize(); - const qreal newBottomBarY = hh-bottomBar->boundingRectNoHelpLabel().height()+bottomBar->getGap()-buttonBarsPath->getRoundSize()+0.5+(1.-animBottomBarTimeLine->currentValue())*rangeY; + const qreal newBottomBarX = leftBar->boundingRectNoHelpLabel().right()+buttonBarsFrame->getRoundSize(); + const qreal newBottomBarY = hh-bottomBar->boundingRectNoHelpLabel().height()+bottomBar->getGap()-buttonBarsFrame->getRoundSize()+0.5+(1.-animBottomBarTimeLine->currentValue())*rangeY; if (!qFuzzyCompare(bottomBar->pos().x(), newBottomBarX) || !qFuzzyCompare(bottomBar->pos().y(), newBottomBarY)) { @@ -360,7 +360,7 @@ void SkyGui::updateBarsPos() } if (updatePath) - buttonBarsPath->updatePath(bottomBar, leftBar); + buttonBarsFrame->updatePath(bottomBar, leftBar); const qreal newProgressBarX = ww-progressBarMgr->boundingRect().width()-20; const qreal newProgressBarY = hh-progressBarMgr->boundingRect().height()+7; @@ -379,8 +379,8 @@ void SkyGui::updateBarsPos() void SkyGui::setStelStyle(const QString& style) { Q_UNUSED(style) - buttonBarsPath->setPen(QColor::fromRgbF(0.7,0.7,0.7,0.5)); - buttonBarsPath->setBrush(QColor::fromRgbF(0.15, 0.16, 0.19, 0.2)); + buttonBarsFrame->setPen(QColor::fromRgbF(0.7,0.7,0.7,0.5)); + buttonBarsFrame->setBrush(QColor::fromRgbF(0.15, 0.16, 0.19, 0.2)); bottomBar->setColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9)); leftBar->setColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9)); } diff --git a/src/gui/SkyGui.hpp b/src/gui/SkyGui.hpp index 325683634b..624c03aaf6 100644 --- a/src/gui/SkyGui.hpp +++ b/src/gui/SkyGui.hpp @@ -91,7 +91,7 @@ public slots: void updateBarsPos(); private: - class StelBarsPath* buttonBarsPath; + class StelBarsFrame* buttonBarsFrame; QTimeLine* animLeftBarTimeLine; QTimeLine* animBottomBarTimeLine; int lastBottomBarWidth; diff --git a/src/gui/StelGuiItems.cpp b/src/gui/StelGuiItems.cpp index b3ee23d778..2b03d26d17 100644 --- a/src/gui/StelGuiItems.cpp +++ b/src/gui/StelGuiItems.cpp @@ -1046,7 +1046,7 @@ void BottomStelBar::buttonHoverChanged(bool b) StelMainView::getInstance().thereWasAnEvent(); } -StelBarsPath::StelBarsPath(QGraphicsItem* parent) : QGraphicsPathItem(parent), roundSize(6) +StelBarsFrame::StelBarsFrame(QGraphicsItem* parent) : QGraphicsPathItem(parent), roundSize(6) { setBrush(QBrush(QColor::fromRgbF(0.22, 0.22, 0.23, 0.2))); QPen aPen(QColor::fromRgbF(0.7,0.7,0.7,0.5)); @@ -1054,7 +1054,7 @@ StelBarsPath::StelBarsPath(QGraphicsItem* parent) : QGraphicsPathItem(parent), r setPen(aPen); } -void StelBarsPath::updatePath(BottomStelBar* bottom, LeftStelBar* left) +void StelBarsFrame::updatePath(BottomStelBar* bottom, LeftStelBar* left) { const QPointF l = left->pos() + QPointF(-0.5,0.5); // pos() is the top-left point in the parent's coordinate system. const QRectF lB = left->boundingRectNoHelpLabel(); @@ -1073,7 +1073,7 @@ void StelBarsPath::updatePath(BottomStelBar* bottom, LeftStelBar* left) setPath(path); } -void StelBarsPath::setBackgroundOpacity(double opacity) +void StelBarsFrame::setBackgroundOpacity(double opacity) { setBrush(QBrush(QColor::fromRgbF(0.22, 0.22, 0.23, opacity))); } diff --git a/src/gui/StelGuiItems.hpp b/src/gui/StelGuiItems.hpp index 2b2523eb66..a0bf40d4cf 100644 --- a/src/gui/StelGuiItems.hpp +++ b/src/gui/StelGuiItems.hpp @@ -342,11 +342,11 @@ private: QGraphicsSimpleTextItem* helpLabel; }; -//! @class StelBarsPath: The path around the bottom and left button bars -class StelBarsPath : public QGraphicsPathItem +//! @class StelBarsFrame: The path around the bottom and left button bars +class StelBarsFrame : public QGraphicsPathItem { public: - StelBarsPath(QGraphicsItem* parent); + StelBarsFrame(QGraphicsItem* parent); //! defines a line around the two button bars void updatePath(BottomStelBar* bottom, LeftStelBar* left); //! return radius of corner arc |