File indexing completed on 2024-10-06 04:25:58

0001 /*
0002     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 #include "k3bcontentsview.h"
0006 
0007 #include "k3bthemedheader.h"
0008 
0009 #include <QLabel>
0010 #include <QVBoxLayout>
0011 
0012 
0013 K3b::ContentsView::ContentsView( bool withHeader,
0014                                  QWidget* parent )
0015     : QWidget( parent ),
0016       m_header(0),
0017       m_centerWidget(0),
0018       m_active(false)
0019 {
0020     if( withHeader ) {
0021         QVBoxLayout* lay = new QVBoxLayout( this );
0022         lay->setContentsMargins( 0, 0, 0, 0 );
0023         lay->setSpacing( 0 );
0024 
0025         m_header = new K3b::ThemedHeader( this );
0026         lay->addWidget( m_header );
0027 
0028         m_header->setLeftPixmap( K3b::Theme::MEDIA_LEFT );
0029         m_header->setRightPixmap( K3b::Theme::MEDIA_NONE );
0030     }
0031 }
0032 
0033 
0034 K3b::ContentsView::~ContentsView()
0035 {
0036 }
0037 
0038 
0039 void K3b::ContentsView::setMainWidget( QWidget* w )
0040 {
0041     m_centerWidget = w;
0042     layout()->addWidget( w );
0043 }
0044 
0045 
0046 QWidget* K3b::ContentsView::mainWidget()
0047 {
0048     if( !m_centerWidget )
0049         setMainWidget( new QWidget( this ) );
0050     return m_centerWidget;
0051 }
0052 
0053 
0054 void K3b::ContentsView::setTitle( const QString& title, const QString& subtitle )
0055 {
0056     if( m_header )
0057         m_header->setTitle( title, subtitle );
0058 }
0059 
0060 
0061 void K3b::ContentsView::setLeftPixmap( K3b::Theme::PixmapType s )
0062 {
0063     if( m_header )
0064         m_header->setLeftPixmap( s );
0065 }
0066 
0067 
0068 void K3b::ContentsView::setRightPixmap( K3b::Theme::PixmapType s )
0069 {
0070     if( m_header )
0071         m_header->setRightPixmap( s );
0072 }
0073 
0074 
0075 void K3b::ContentsView::activate( bool active )
0076 {
0077     m_active = active;
0078 }
0079 
0080 #include "moc_k3bcontentsview.cpp"