21 bool changed =
m_total != total;
30 float newpos = position /
m_total;
32 if (newpos < 0.0F || newpos > 1.0F)
44 if (
m_total >= end && end >= start && start >= 0.0)
71 QRect keeparea = QRect();
72 QRect cutarea = QRect();
108 if (position && keeparea.isValid())
110 int offset = position->
GetArea().width() / 2;
112 int newy = position->
GetArea().top();
129 auto *leftshape =
dynamic_cast<MythUIShape *
>(cuttoleft);
130 auto *leftimage =
dynamic_cast<MythUIImage *
>(cuttoleft);
131 auto *rightshape =
dynamic_cast<MythUIShape *
>(cuttoright);
132 auto *rightimage =
dynamic_cast<MythUIImage *
>(cuttoright);
134 QListIterator<QPair<float, float> > regions(
m_regions);
136 while (regions.hasNext() && cutarea.isValid())
138 QPair<float, float> region = regions.next();
139 int left = lroundf(region.first * cutarea.width());
140 int right = lroundf(region.second * cutarea.width());
147 AddBar(barshape, barimage, QRect(left, cutarea.top(), right - left,
151 if (cuttoleft && (region.second < 1.0F))
152 AddMark(leftshape, leftimage, right,
true);
154 if (cuttoright && (region.first > 0.0F))
155 AddMark(rightshape, rightimage, left,
false);
162 leftshape =
dynamic_cast<MythUIShape *
>(keeptoleft);
163 leftimage =
dynamic_cast<MythUIImage *
>(keeptoleft);
164 rightshape =
dynamic_cast<MythUIShape *
>(keeptoright);
165 rightimage =
dynamic_cast<MythUIImage *
>(keeptoright);
167 QListIterator<QPair<float, float> > regions2(
m_invregions);
169 while (regions2.hasNext() && keeparea.isValid())
171 QPair<float, float> region = regions2.next();
172 int left = lroundf(region.first * keeparea.width());
173 int right = lroundf(region.second * keeparea.width());
180 AddBar(barshape, barimage, QRect(left, keeparea.top(), right - left,
184 if (keeptoleft && (region.second < 1.0F))
185 AddMark(leftshape, leftimage, right,
true);
187 if (keeptoright && (region.first > 0.0F))
188 AddMark(rightshape, rightimage, left,
false);
206 shape->
SetCropRect(area.left(), area.top(), area.width(), area.height());
209 image->SetCropRect(area.left(), area.top(), area.width(), area.height());
216 int start,
bool left)
223 start -= add->
GetArea().width();
231 QString name = QString(
"editbarimage_%1").arg(
m_images.size());
239 newshape->CopyFrom(shape);
240 newshape->SetVisible(
true);
251 newimage->CopyFrom(image);
252 newimage->SetVisible(
true);
267 QListIterator<QPair<float, float> > regions(
m_regions);
269 while (regions.hasNext())
271 QPair<float, float> region = regions.next();
275 if (region.first > 0.0F)
278 start = region.second;
284 start = region.second;
311 QListIterator<QPair<float, float> > it(
m_regions);
314 editbar->m_regions.append(it.next());
325 editbar->CopyFrom(
this);
A narrow purpose widget used to represent cut positions and regions when editing a video.
void CreateCopy(MythUIType *parent) override
Copy the state of this widget to the one given, it must be of the same type.
void AddBar(MythUIShape *shape, MythUIImage *image, QRect area)
QList< QPair< float, float > > m_invregions
void CopyFrom(MythUIType *base) override
Copy this widgets state from another.
void SetEditPosition(double position)
MythUIType * GetNew(MythUIShape *shape, MythUIImage *image)
void AddRegion(double start, double end)
MythUIEditBar(MythUIType *parent, const QString &name)
void CalcInverseRegions(void)
void AddMark(MythUIShape *shape, MythUIImage *image, int start, bool left)
void Finalize(void) override
Perform any post-xml parsing initialisation tasks.
void SetTotal(double total)
QList< MythUIType * > m_images
QList< QPair< float, float > > m_regions
Image widget, displays a single image or multiple images in sequence.
void SetCropRect(int x, int y, int width, int height)
Crop the image using the given rectangle, useful for removing unsightly edges from imported images or...
A widget for rendering primitive shapes and lines.
The base class on which all widgets and screens are based.
virtual void SetVisible(bool visible)
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
virtual MythRect GetArea(void) const
If the object has a minimum area defined, return it, other wise return the default area.
void SetPosition(int x, int y)
Convenience method, calls SetPosition(const MythPoint&) Override that instead to change functionality...
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
void DeleteChild(const QString &name)
Delete a named child of this UIType.