[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/multimedia/kmplayer/src
From:       Koos Vriezen <koos.vriezen () gmail ! com>
Date:       2009-05-31 20:31:29
Message-ID: 1243801889.647247.5091.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 976080 by vriezen:

Change whether backgrounds are painted, plugin now has no background

BUG:161282

 M  +1 -10     kmplayer_part.cpp  
 M  +1 -1      kmplayerapp.cpp  
 M  +2 -2      kmplayerpartbase.cpp  
 M  +1 -1      kmplayerpartbase.h  
 M  +6 -5      kmplayerview.cpp  
 M  +1 -1      kmplayerview.h  
 M  +20 -12    viewarea.cpp  
 M  +2 -1      viewarea.h  


--- trunk/extragear/multimedia/kmplayer/src/kmplayer_part.cpp #976079:976080
@@ -206,7 +206,7 @@
         kmplayerpart_static->ref ();
     setComponentData (KMPlayerFactory::componentData ());
     init (actionCollection (),
-            QString ("/KMPlayerPart%1").arg(kmplayerpart_static->counter++));
+         QString ("/KMPlayerPart%1").arg(kmplayerpart_static->counter++), true);
     createBookmarkMenu (m_view->controlPanel ()->bookmarkMenu, actionCollection ());
     m_view->controlPanel ()->bookmarkAction->setVisible (true);
     ///*KAction *playact =*/ new KAction(i18n("P&lay"), QString ("player_play"), \
KShortcut (), this, SLOT(play ()), actionCollection (), "play"); @@ -420,15 +420,6 @@
         m_group.truncate (0);
     kmplayerpart_static->partlist.push_back (this);
 
-    QWidget *pwidget = view ()->parentWidget ();
-    if (pwidget) {
-        QPalette palette = m_view->viewArea()->palette ();
-        palette.setColor (m_view->viewArea()->backgroundRole(),
-                pwidget->palette ().color (pwidget->backgroundRole ()));
-        m_view->viewArea()->setPalette (palette);
-     // m_view->viewer()->setBackgroundColor(pwidget->paletteBackgroundColor());
-    }
-
     if (m_view->isFullScreen () != show_fullscreen)
         m_view->fullScreen ();
 }
--- trunk/extragear/multimedia/kmplayer/src/kmplayerapp.cpp #976079:976080
@@ -111,7 +111,7 @@
     //connect (m_broadcastconfig, SIGNAL (broadcastStarted()), this, SLOT \
                (broadcastStarted()));
     //connect (m_broadcastconfig, SIGNAL (broadcastStopped()), this, SLOT \
(broadcastStopped()));  initStatusBar();
-    m_player->init (actionCollection (), "/KMPlayerPart");
+    m_player->init (actionCollection (), "/KMPlayerPart", false);
     m_view->initDock (m_view->viewArea ());
     //m_player->mediaManager ()->processInfos () ["xvideo"] =
     //    new XvProcessInfo (m_player->mediaManager ());
--- trunk/extragear/multimedia/kmplayer/src/kmplayerpartbase.cpp #976079:976080
@@ -148,9 +148,9 @@
     m_bookmark_manager->emitChanged (b);
 }
 
-void PartBase::init (KActionCollection * action_collection, const QString &objname) \
{ +void PartBase::init (KActionCollection * action_collection, const QString \
&objname, bool transparent) {  KParts::Part::setWidget (m_view);
-    m_view->init (action_collection);
+    m_view->init (action_collection, transparent);
     connect(m_settings, SIGNAL(configChanged()), this, SLOT(settingsChanged()));
     m_settings->readConfig ();
     m_settings->applyColorSetting (false);
--- trunk/extragear/multimedia/kmplayer/src/kmplayerpartbase.h #976079:976080
@@ -88,7 +88,7 @@
 public:
     PartBase (QWidget *parent, QObject *objParent, KSharedConfigPtr);
     ~PartBase ();
-    void init (KActionCollection *ac, const QString &objname);
+    void init (KActionCollection *ac, const QString &objname, bool transparent);
     virtual KMediaPlayer::View* view ();
     View* viewWidget () const { return m_view; }
     static KAboutData* createAboutData ();
--- trunk/extragear/multimedia/kmplayer/src/kmplayerview.cpp #976079:976080
@@ -143,7 +143,10 @@
     m_revert_fullscreen (false),
     m_no_info (false),
     m_edit_mode (false)
-{}
+{
+    setAttribute (Qt::WA_NoSystemBackground, true);
+    setAutoFillBackground (false);
+}
 
 KDE_NO_EXPORT void View::dropEvent (QDropEvent * de) {
     KUrl::List uris = KUrl::List::fromMimeData( de->mimeData() );
@@ -195,13 +198,11 @@
     m_view_area->resizeEvent (0L);
 }
 
-KDE_NO_EXPORT void View::init (KActionCollection * action_collection) {
-    setAutoFillBackground (false); // prevents flashing
-    QPalette pal (QColor (64, 64,64), QColor (32, 32, 32));
+KDE_NO_EXPORT void View::init (KActionCollection *action_collection, bool \
transparent) {  QVBoxLayout * viewbox = new QVBoxLayout;
     viewbox->setContentsMargins (0, 0, 0, 0);
     setLayout (viewbox);
-    m_view_area = new ViewArea (NULL, this);
+    m_view_area = new ViewArea (NULL, this, !transparent);
     m_playlist = new PlayListView (NULL, this, action_collection);
 
     m_picture = new PictureWidget (m_view_area, this);
--- trunk/extragear/multimedia/kmplayer/src/kmplayerview.h #976079:976080
@@ -102,7 +102,7 @@
     ~View();
 
     void addText (const QString &, bool eol=false);
-    void init (KActionCollection * ac);
+    void init (KActionCollection * ac, bool transparent);
     void initDock (QWidget *central);
     void reset ();
     //void print(QPrinter *pPrinter);
--- trunk/extragear/multimedia/kmplayer/src/viewarea.cpp #976079:976080
@@ -1783,7 +1783,7 @@
 
 }
 
-KDE_NO_CDTOR_EXPORT ViewArea::ViewArea (QWidget *, View * view)
+KDE_NO_CDTOR_EXPORT ViewArea::ViewArea (QWidget *, View * view, bool paint_bg)
 // : QWidget (parent, "kde_kmplayer_viewarea", WResizeNoErase | WRepaintNoErase),
  : //QWidget (parent),
    d (new ViewerAreaPrivate (this)),
@@ -1795,11 +1795,10 @@
    m_repaint_timer (0),
    m_fullscreen (false),
    m_minimal (false),
-   m_updaters_enabled (true) {
-#ifdef KMPLAYER_WITH_CAIRO
-    setAttribute (Qt::WA_OpaquePaintEvent, true);
-    setAttribute (Qt::WA_PaintOnScreen, true);
-#endif
+   m_updaters_enabled (true),
+   m_paint_background (paint_bg) {
+    if (!paint_bg)
+        setAttribute (Qt::WA_NoSystemBackground, true);
     QPalette palette;
     palette.setColor (backgroundRole(), QColor (0, 0, 0));
     setPalette (palette);
@@ -1980,6 +1979,7 @@
         scheduleRepaint (IRect (pe->rect ().x (), pe->rect ().y (), pe->rect \
().width (), pe->rect ().height ()));  else
 #endif
+        if (m_fullscreen || m_paint_background)
     {
         QPainter p (this);
         p.fillRect (pe->rect (), QBrush (palette ().color (backgroundRole ())));
@@ -2085,15 +2085,22 @@
     //m_view->viewer()->resetBackgroundColor ();
     if (mrl) {
         updateSurfaceBounds ();
+#ifdef KMPLAYER_WITH_CAIRO
+        setAttribute (Qt::WA_OpaquePaintEvent, true);
+        setAttribute (Qt::WA_PaintOnScreen, true);
+#endif
         return surface.ptr ();
-    }
+    } else {
 #ifdef KMPLAYER_WITH_CAIRO
-    else if (surface->surface) {
-        cairo_surface_destroy (surface->surface);
-        surface->surface = 0L;
-        d->destroyBackingStore ();
+        setAttribute (Qt::WA_OpaquePaintEvent, false);
+        setAttribute (Qt::WA_PaintOnScreen, false);
+        if (surface->surface) {
+            cairo_surface_destroy (surface->surface);
+            surface->surface = 0L;
+            d->destroyBackingStore ();
+        }
+#endif
     }
-#endif
     scheduleRepaint (IRect (0, 0, width (), height ()));
     return 0L;
 }
@@ -2376,6 +2383,7 @@
              this, SLOT (fullScreenChanged ()));
     kDebug() << "VideoOutput::VideoOutput" << endl;
     setMonitoring (MonitorAll);
+    setAttribute (Qt::WA_NoSystemBackground, true);
     //setProtocol (QXEmbed::XPLAIN);
 }
 
--- trunk/extragear/multimedia/kmplayer/src/viewarea.h #976079:976080
@@ -43,7 +43,7 @@
 class KMPLAYER_EXPORT ViewArea : public QWidget {
     Q_OBJECT
 public:
-    ViewArea (QWidget * parent, View * view);
+    ViewArea (QWidget *parent, View *view, bool paint_bg);
     ~ViewArea ();
     KDE_NO_EXPORT bool isFullScreen () const { return m_fullscreen; }
     KDE_NO_EXPORT bool isMinimalMode () const { return m_minimal; }
@@ -100,6 +100,7 @@
     bool m_fullscreen;
     bool m_minimal;
     bool m_updaters_enabled;
+    bool m_paint_background;
 };
 
 /*


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic