[Libreoffice-commits] core.git: avmedia/inc avmedia/source sfx2/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Feb 13 08:49:38 UTC 2020
avmedia/inc/mediacontrol.hxx | 11 +------
avmedia/source/framework/mediacontrol.cxx | 41 +++++------------------------
avmedia/source/framework/mediatoolbox.cxx | 4 --
avmedia/source/viewer/mediawindow_impl.cxx | 2 -
sfx2/source/control/InterimItemWindow.cxx | 2 -
5 files changed, 13 insertions(+), 47 deletions(-)
New commits:
commit 9733174ea00e525c91b4edf1bbc6ab4897f5fbf8
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Feb 12 16:27:06 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Feb 13 09:49:00 2020 +0100
inherit MediaControl from InterimItemWindow
to de-dup some code
Change-Id: I8bf20d4b57f3ec7bd2902f01e11278da8ded194b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88550
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/avmedia/inc/mediacontrol.hxx b/avmedia/inc/mediacontrol.hxx
index 9899418a6052..254c29dbc434 100644
--- a/avmedia/inc/mediacontrol.hxx
+++ b/avmedia/inc/mediacontrol.hxx
@@ -21,7 +21,7 @@
#include <avmedia/mediaitem.hxx>
-#include <vcl/ctrl.hxx>
+#include <sfx2/InterimItemWindow.hxx>
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
#include <vcl/weld.hxx>
@@ -34,15 +34,13 @@ namespace avmedia
class MediaItem;
-class MediaControl : public Control, public MediaControlBase
+class MediaControl : public InterimItemWindow, public MediaControlBase
{
public:
MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyle );
virtual ~MediaControl() override;
virtual void dispose() override;
- Size getMinSizePixel() const;
-
void setState( const MediaItem& rItem );
void UpdateURLField( MediaItem const & maItem );
@@ -51,7 +49,6 @@ protected:
virtual void update() = 0;
virtual void execute( const MediaItem& rItem ) = 0;
- virtual void Resize() override;
virtual void InitializeWidgets() override;
std::unique_ptr<weld::Label> mxMediaPath;
@@ -64,10 +61,6 @@ private:
DECL_LINK(implZoomSelectHdl, weld::ComboBox&, void);
DECL_LINK(implTimeoutHdl, Timer*, void);
- std::unique_ptr<weld::Builder> m_xBuilder;
- VclPtr<vcl::Window> m_xVclContentArea;
- std::unique_ptr<weld::Container> m_xContainer;
-
Idle maIdle;
Idle maChangeTimeIdle;
MediaItem maItem;
diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx
index a9c144b1e455..596234771ef1 100644
--- a/avmedia/source/framework/mediacontrol.cxx
+++ b/avmedia/source/framework/mediacontrol.cxx
@@ -36,7 +36,12 @@ namespace avmedia
{
MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyle ) :
- Control( pParent ),
+ // MEDIACONTROLSTYLE_MULTILINE is the normal docking windows of tools->media player
+ // MEDIACONTROLSTYLE_SINGLELINE is the toolbar of view->toolbar->media playback
+ InterimItemWindow(pParent, eControlStyle == MEDIACONTROLSTYLE_MULTILINE ?
+ OUString("svx/ui/mediawindow.ui") :
+ OUString("svx/ui/medialine.ui"),
+ "MediaWindow"),
MediaControlBase(),
maIdle( "avmedia MediaControl Idle" ),
maChangeTimeIdle( "avmedia MediaControl Change Time Idle" ),
@@ -45,18 +50,6 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl
meControlStyle( eControlStyle ),
mfTime(0.0)
{
- SetStyle(GetStyle() | WB_DIALOGCONTROL);
-
- m_xVclContentArea = VclPtr<VclVBox>::Create(this);
- m_xVclContentArea->Show();
- // MEDIACONTROLSTYLE_MULTILINE is the normal docking windows of tools->media player
- // MEDIACONTROLSTYLE_SINGLELINE is the toolbar of view->toolbar->media playback
- m_xBuilder.reset(Application::CreateInterimBuilder(m_xVclContentArea,
- eControlStyle == MEDIACONTROLSTYLE_MULTILINE ?
- OUString("svx/ui/mediawindow.ui") :
- OUString("svx/ui/medialine.ui")));
- m_xContainer = m_xBuilder->weld_container("MediaWindow");
-
mxPlayToolBox = m_xBuilder->weld_toolbar("playtoolbox");
mxTimeSlider = m_xBuilder->weld_scale("timeslider");
mxMuteToolBox = m_xBuilder->weld_toolbar("mutetoolbox");
@@ -65,9 +58,7 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl
mxTimeEdit = m_xBuilder->weld_entry("timeedit");
mxMediaPath = m_xBuilder->weld_label("url");
- SetBackground();
- SetPaintTransparent( true );
- SetParentClipMode( ParentClipMode::NoClip );
+ // TODO SetParentClipMode( ParentClipMode::NoClip );
InitializeWidgets();
@@ -123,15 +114,7 @@ void MediaControl::dispose()
{
disposeWidgets();
mxMediaPath.reset();
- m_xContainer.reset();
- m_xBuilder.reset();
- m_xVclContentArea.disposeAndClear();
- Control::dispose();
-}
-
-Size MediaControl::getMinSizePixel() const
-{
- return VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild));
+ InterimItemWindow::dispose();
}
void MediaControl::UpdateURLField(MediaItem const & tempItem)
@@ -140,14 +123,6 @@ void MediaControl::UpdateURLField(MediaItem const & tempItem)
mxMediaPath->set_label(aURL);
}
-void MediaControl::Resize()
-{
- vcl::Window *pChild = GetWindow(GetWindowType::FirstChild);
- assert(pChild);
- VclContainer::setLayoutAllocation(*pChild, Point(0, 0), GetSizePixel());
- Control::Resize();
-}
-
void MediaControl::setState( const MediaItem& rItem )
{
double fTime = rItem.getTime();
diff --git a/avmedia/source/framework/mediatoolbox.cxx b/avmedia/source/framework/mediatoolbox.cxx
index b085d8a77f39..a291218da6c5 100644
--- a/avmedia/source/framework/mediatoolbox.cxx
+++ b/avmedia/source/framework/mediatoolbox.cxx
@@ -46,15 +46,13 @@ private:
MediaToolBoxControl* mpToolBoxControl;
};
-
MediaToolBoxControl_Impl::MediaToolBoxControl_Impl( vcl::Window& rParent, MediaToolBoxControl& rControl ) :
MediaControl( &rParent, MEDIACONTROLSTYLE_SINGLELINE ),
mpToolBoxControl( &rControl )
{
- SetSizePixel( getMinSizePixel() );
+ SetSizePixel(m_xContainer->get_preferred_size());
}
-
void MediaToolBoxControl_Impl::update()
{
mpToolBoxControl->implUpdateMediaControl();
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index fdc78575f8b7..3e95252d6ad0 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -125,7 +125,7 @@ MediaWindowImpl::MediaWindowImpl(vcl::Window* pParent, MediaWindow* pMediaWindow
{
if (mpMediaWindowControl)
{
- mpMediaWindowControl->SetSizePixel(mpMediaWindowControl->getMinSizePixel());
+ mpMediaWindowControl->SetSizePixel(mpMediaWindowControl->GetOptimalSize());
mpMediaWindowControl->Show();
}
}
diff --git a/sfx2/source/control/InterimItemWindow.cxx b/sfx2/source/control/InterimItemWindow.cxx
index 6f26b99acab5..1263f2e56aa2 100644
--- a/sfx2/source/control/InterimItemWindow.cxx
+++ b/sfx2/source/control/InterimItemWindow.cxx
@@ -11,7 +11,7 @@
InterimItemWindow::InterimItemWindow(vcl::Window* pParent, const OUString& rUIXMLDescription,
const OString& rID)
- : Control(pParent, WB_TABSTOP)
+ : Control(pParent, WB_TABSTOP | WB_DIALOGCONTROL)
{
m_xVclContentArea = VclPtr<VclVBox>::Create(this);
m_xVclContentArea->Show();
More information about the Libreoffice-commits
mailing list