diff --git a/src/k3bsplash.cpp b/src/k3bsplash.cpp index 25c00e828..a9de2eb37 100644 --- a/src/k3bsplash.cpp +++ b/src/k3bsplash.cpp @@ -1,105 +1,105 @@ /* * * Copyright (C) 2003-2008 Sebastian Trueg * * This file is part of the K3b project. * Copyright (C) 1998-2008 Sebastian Trueg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * See the file "COPYING" for the exact licensing terms. */ #include "k3bsplash.h" #include "k3bthememanager.h" #include "k3bapplication.h" #include #include #include #include #include #include #include #include #include #include K3b::Splash::Splash( QWidget* parent ) : QWidget( parent) { setAttribute( Qt::WA_DeleteOnClose ); setWindowFlags(Qt::FramelessWindowHint| Qt::SplashScreen| Qt::WindowStaysOnTopHint| Qt::X11BypassWindowManagerHint); QPalette pal( palette() ); pal.setColor( QPalette::Window, Qt::black ); pal.setColor( QPalette::WindowText, Qt::white ); setPalette( pal ); QLabel* copyrightLabel = new QLabel( KAboutData::applicationData().copyrightStatement(), this ); - copyrightLabel->setMargin( 5 ); + copyrightLabel->setContentsMargins( 5, 5, 5, 5 ); copyrightLabel->setAlignment( Qt::AlignRight ); QLabel* picLabel = new QLabel( this ); if( K3b::Theme* theme = k3bappcore->themeManager()->currentTheme() ) { picLabel->setPalette( theme->palette() ); picLabel->setPixmap( theme->pixmap( K3b::Theme::SPLASH ) ); } m_infoBox = new QLabel( this ); - m_infoBox->setMargin( 5 ); + m_infoBox->setContentsMargins( 5, 5, 5, 5 ); QVBoxLayout* layout = new QVBoxLayout( this ); layout->setContentsMargins( 0, 0, 0, 0 ); layout->setSpacing( 0 ); layout->addWidget( copyrightLabel ); layout->addWidget( picLabel ); layout->addWidget( m_infoBox ); // Set geometry, with support for Xinerama systems QRect r; r.setSize(sizeHint()); int ps = QApplication::desktop()->primaryScreen(); r.moveCenter( QApplication::desktop()->screenGeometry(ps).center() ); setGeometry(r); } K3b::Splash::~Splash() { } void K3b::Splash::mousePressEvent( QMouseEvent* ) { close(); } void K3b::Splash::show() { QWidget::show(); // make sure the splash screen is shown immediately qApp->processEvents(); } void K3b::Splash::addInfo( const QString& s ) { m_infoBox->setText( s ); qApp->processEvents(); } void K3b::Splash::hide() { QWidget::hide(); qApp->processEvents(); } diff --git a/src/k3bthemedheader.cpp b/src/k3bthemedheader.cpp index 6ebc0e6ad..3038fd31b 100644 --- a/src/k3bthemedheader.cpp +++ b/src/k3bthemedheader.cpp @@ -1,143 +1,143 @@ /* * * Copyright (C) 2006-2008 Sebastian Trueg * Copyright (C) 2010 Michal Malek * * This file is part of the K3b project. * Copyright (C) 1998-2008 Sebastian Trueg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * See the file "COPYING" for the exact licensing terms. */ #include "k3bthemedheader.h" #include "k3bthememanager.h" #include "k3bapplication.h" #include "k3btitlelabel.h" #include #include #include K3b::ThemedHeader::ThemedHeader( QWidget* parent ) : QFrame( parent ) { init(); } K3b::ThemedHeader::ThemedHeader( const QString& title, const QString& subtitle, QWidget* parent ) : QFrame( parent ) { setTitle( title ); setSubTitle( subtitle ); init(); } K3b::ThemedHeader::~ThemedHeader() { } void K3b::ThemedHeader::setTitle( const QString& title, const QString& subtitle ) { m_titleLabel->setTitle( title, subtitle ); } void K3b::ThemedHeader::setSubTitle( const QString& subtitle ) { m_titleLabel->setSubTitle( subtitle ); } void K3b::ThemedHeader::setLeftPixmap( K3b::Theme::PixmapType p ) { m_leftPix = p; slotThemeChanged(); } void K3b::ThemedHeader::setRightPixmap( K3b::Theme::PixmapType p ) { m_rightPix = p; slotThemeChanged(); } void K3b::ThemedHeader::setAlignment( Qt::Alignment alignment ) { m_titleLabel->setAlignment( alignment ); } void K3b::ThemedHeader::init() { // Hardcode layou direction to LTR to prevent // switching places of our left/right pixmaps. // Usually our themes aren't designed for this setLayoutDirection( Qt::LeftToRight ); setFrameShape( QFrame::StyledPanel ); setFrameShadow( QFrame::Sunken ); setLineWidth( 1 ); //setMargin( 1 ); m_leftLabel = new QLabel( this ); m_leftLabel->setScaledContents( false ); m_leftLabel->setAutoFillBackground( true ); m_titleLabel = new K3b::TitleLabel( this ); // Bring back default layout direction for label m_titleLabel->setLayoutDirection( QApplication::layoutDirection() ); m_rightLabel = new QLabel( this ); m_rightLabel->setScaledContents( false ); m_rightLabel->setAutoFillBackground( true ); QHBoxLayout* layout = new QHBoxLayout( this ); - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing( 0 ); layout->addWidget( m_leftLabel ); layout->addWidget( m_titleLabel ); layout->setStretchFactor( m_titleLabel, 1 ); layout->addWidget( m_rightLabel ); m_leftPix = K3b::Theme::DIALOG_LEFT; m_rightPix = K3b::Theme::DIALOG_RIGHT; slotThemeChanged(); connect( k3bappcore->themeManager(), SIGNAL(themeChanged()), this, SLOT(slotThemeChanged()) ); } bool K3b::ThemedHeader::event( QEvent *event ) { if( event->type() == QEvent::StyleChange ) { slotThemeChanged(); } return QFrame::event( event ); } void K3b::ThemedHeader::slotThemeChanged() { if( K3b::Theme* theme = k3bappcore->themeManager()->currentTheme() ) { m_leftLabel->setPalette( theme->palette() ); m_leftLabel->setPixmap( theme->pixmap( m_leftPix ) ); m_rightLabel->setPalette( theme->palette() ); m_rightLabel->setPixmap( theme->pixmap( m_rightPix ) ); m_titleLabel->setPalette( theme->palette() ); } }