12#include "SegmentedIndicators_p.h" 
   13#include "../DropArea_p.h" 
   17#include <QPainterPath> 
   21int SegmentedIndicators::s_segmentGirth = 50;
 
   22int SegmentedIndicators::s_segmentPenWidth = 4;
 
   23qreal SegmentedIndicators::s_draggedWindowOpacity = 0.7;
 
   25QColor SegmentedIndicators::s_segmentBrushColor = 
QColor(0xbb, 0xd5, 0xee, 200);
 
   26QColor SegmentedIndicators::s_hoveredSegmentBrushColor = 
QColor(0x3574c5);
 
   27int SegmentedIndicators::s_centralIndicatorMaxWidth = 300;
 
   28int SegmentedIndicators::s_centralIndicatorMaxHeight = 160;
 
   31SegmentedIndicators::SegmentedIndicators(DropArea *dropArea)
 
   32    : DropIndicatorOverlayInterface(dropArea)
 
   38    const bool userChoseOpacity = !qIsNaN(
Config::self().draggedWindowOpacity());
 
   39    if (!userChoseOpacity)
 
   43SegmentedIndicators::~SegmentedIndicators()
 
   49    m_hoveredPt = mapFromGlobal(pt);
 
   51    setCurrentDropLocation(dropLocationForPos(m_hoveredPt));
 
   53    return currentDropLocation();
 
   58    for (
auto it = m_segments.cbegin(), end = m_segments.cend(); it != end; ++it) {
 
   76    const int halfPenWidth = s_segmentPenWidth / 2;
 
   78    const int l = s_segmentGirth;
 
   79    const int top = (r.
y() == 0 && useOffset) ? l : r.y();
 
   80    const int left = (r.
x() == 0 && useOffset) ? l : r.x();
 
   82    const int bottom = (rect().bottom() == r.
bottom() && useOffset) ? r.
bottom() - l : r.
bottom();
 
   83    const QPoint topLeft = { 
left + halfPenWidth, top + halfPenWidth };
 
   84    const QPoint topRight = { 
right, top + halfPenWidth };
 
   85    const QPoint bottomLeft = { 
left + halfPenWidth, bottom };
 
   90                                         topLeft + 
QPoint(l, l), topLeft };
 
   93                                          bottomRight + 
QPoint(-l, -l),
 
   94                                          topRight + 
QPoint(-l, l) };
 
  101                                           bottomRight + 
QPoint(-l, -l),
 
  102                                           bottomLeft + 
QPoint(l, -l) };
 
  107                                            bottomRight + 
QPoint(-l, -l),
 
  108                                            bottomLeft + 
QPoint(l, -l) };
 
  113        const int indicatorWidth = qMin(s_centralIndicatorMaxWidth, maxWidth - 100);
 
  114        const int indicatorHeight = qMin(s_centralIndicatorMaxHeight, 
int(indicatorWidth * 0.60));
 
  115        const int tabWidth = int(indicatorWidth * 0.267);
 
  116        const int tabHeight = int(indicatorHeight * 0.187);
 
  117        const int centerRectLeft = centerPos.
x() - indicatorWidth / 2;
 
  118        const int centerRectRight = centerPos.
x() + indicatorWidth / 2;
 
  119        const int centerRectBottom = centerPos.
y() + indicatorHeight / 2;
 
  120        const int centerRectTop = centerPos.
y() - indicatorHeight / 2;
 
  124            { centerRectLeft, centerRectTop },
 
  125            { centerRectLeft + tabWidth, centerRectTop },
 
  126            { centerRectLeft + tabWidth, centerRectTop + tabHeight },
 
  127            { centerRectRight, centerRectTop + tabHeight },
 
  128            { centerRectRight, centerRectBottom },
 
  129            { centerRectLeft, centerRectBottom },
 
  149void SegmentedIndicators::updateSegments()
 
  153    const auto outterSegments = segmentsForRect(rect(), 
false);
 
  156        if (dropIndicatorVisible(indicator)) {
 
  157            m_segments.insert(indicator, outterSegments.value(indicator));
 
  161    const bool hasOutter = !m_segments.isEmpty();
 
  162    const bool useOffset = hasOutter;
 
  163    const auto innerSegments = segmentsForRect(hoveredFrameRect(), 
true, useOffset);
 
  166        if (dropIndicatorVisible(indicator)) {
 
  167            m_segments.insert(indicator, innerSegments.value(indicator));
 
  174void SegmentedIndicators::drawSegments(
QPainter *p)
 
  185        drawSegment(p, m_segments.value(loc));
 
  193    QPen pen(s_segmentPenColor);
 
  194    pen.setWidth(s_segmentPenWidth);
 
  196    QColor brush(s_segmentBrushColor);
 
  199        brush = s_hoveredSegmentBrushColor;
 
Application-wide config to tune certain behaviours of the framework.
void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule)
void setBrush(const QBrush &brush)
void setPen(const QColor &color)
QRect boundingRect() const const
bool containsPoint(const QPoint &point, Qt::FillRule fillRule) const const
QPoint center() const const
QTextStream & center(QTextStream &stream)
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)
bool isEmpty() const const