Kaydet (Commit) ba8cdfca authored tarafından Ryan McCoskrie's avatar Ryan McCoskrie Kaydeden (comit) Katarina Behrens

tdf#92649: Converted pointers to unique_ptr's in vcl/unx/kde4

Change-Id: I1bab95a9a3db765d3b3bd34345dc006ccd33caf0
üst 773aecc8
......@@ -288,48 +288,44 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
// Menu
style.SetSkipDisabledInMenus( TRUE );
KMenuBar* pMenuBar = new KMenuBar();
if ( pMenuBar )
{
// Color
QPalette qMenuCG = pMenuBar->palette();
// Menu text and background color, theme specific
Color aMenuFore = toColor( qMenuCG.color( QPalette::WindowText ) );
Color aMenuBack = toColor( qMenuCG.color( QPalette::Window ) );
style.SetMenuTextColor( aMenuFore );
style.SetMenuBarTextColor( style.GetPersonaMenuBarTextColor().get_value_or( aMenuFore ) );
style.SetMenuColor( aMenuBack );
style.SetMenuBarColor( aMenuBack );
style.SetMenuHighlightColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) );
style.SetMenuHighlightTextColor( aMenuFore );
// set special menubar higlight text color
if ( QApplication::style()->inherits( "HighContrastStyle" ) )
ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = toColor( qMenuCG.color( QPalette::HighlightedText ) );
else
ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore;
// set menubar rollover color
if ( pMenuBar->style()->styleHint( QStyle::SH_MenuBar_MouseTracking ) )
{
style.SetMenuBarRolloverColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) );
style.SetMenuBarRolloverTextColor( ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor );
}
else
{
style.SetMenuBarRolloverColor( aMenuBack );
style.SetMenuBarRolloverTextColor( aMenuFore );
}
style.SetMenuBarHighlightTextColor(style.GetMenuHighlightTextColor());
std::unique_ptr<KMenuBar> pMenuBar = std::unique_ptr<KMenuBar>( new KMenuBar() );
// Color
QPalette qMenuCG = pMenuBar->palette();
// Menu text and background color, theme specific
Color aMenuFore = toColor( qMenuCG.color( QPalette::WindowText ) );
Color aMenuBack = toColor( qMenuCG.color( QPalette::Window ) );
style.SetMenuTextColor( aMenuFore );
style.SetMenuBarTextColor( style.GetPersonaMenuBarTextColor().get_value_or( aMenuFore ) );
style.SetMenuColor( aMenuBack );
style.SetMenuBarColor( aMenuBack );
style.SetMenuHighlightColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) );
style.SetMenuHighlightTextColor( aMenuFore );
// Font
aFont = toFont( pMenuBar->font(), rSettings.GetUILanguageTag().getLocale() );
style.SetMenuFont( aFont );
// set special menubar higlight text color
if ( QApplication::style()->inherits( "HighContrastStyle" ) )
ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = toColor( qMenuCG.color( QPalette::HighlightedText ) );
else
ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore;
// set menubar rollover color
if ( pMenuBar->style()->styleHint( QStyle::SH_MenuBar_MouseTracking ) )
{
style.SetMenuBarRolloverColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) );
style.SetMenuBarRolloverTextColor( ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor );
}
else
{
style.SetMenuBarRolloverColor( aMenuBack );
style.SetMenuBarRolloverTextColor( aMenuFore );
}
style.SetMenuBarHighlightTextColor(style.GetMenuHighlightTextColor());
delete pMenuBar;
// Font
aFont = toFont( pMenuBar->font(), rSettings.GetUILanguageTag().getLocale() );
style.SetMenuFont( aFont );
// Scroll bar size
style.SetScrollBarSize( QApplication::style()->pixelMetric( QStyle::PM_ScrollBarExtent ) );
......@@ -366,7 +362,6 @@ KDESalFrame::~KDESalFrame()
KDESalFrame::GraphicsHolder::~GraphicsHolder()
{
delete pGraphics;
}
SalGraphics* KDESalFrame::AcquireGraphics()
......
......@@ -19,6 +19,8 @@
#pragma once
#include <memory>
#include <unx/saldisp.hxx>
#include <unx/salframe.h>
......@@ -32,7 +34,7 @@ class KDESalFrame : public X11SalFrame
X11SalGraphics* pGraphics;
bool bInUse;
GraphicsHolder() : pGraphics(0),bInUse( false ) {}
GraphicsHolder() : pGraphics(nullptr),bInUse( false ) {}
~GraphicsHolder();
};
......
This diff is collapsed.
......@@ -19,6 +19,8 @@
#pragma once
#include <memory>
#include <rtl/string.hxx>
#include <unx/saldisp.hxx>
#include <unx/salgdi.h>
......@@ -28,13 +30,10 @@
/** handles graphics drawings requests and performs the needed drawing operations */
class KDESalGraphics : public X11SalGraphics
{
QImage* m_image;
std::unique_ptr<QImage> m_image;
QRect lastPopupRect;
public:
KDESalGraphics();
virtual ~KDESalGraphics();
/**
What widgets can be drawn the native way.
@param type Type of the widget.
......
......@@ -49,7 +49,7 @@
#endif
KDEXLib::KDEXLib() :
SalXLib(), m_bStartupDone(false), m_pApplication(0),
SalXLib(), m_bStartupDone(false),
m_pFreeCmdLineArgs(0), m_pAppCmdLineArgs(0), m_nFakeCmdLineArgs( 0 ),
m_frameWidth( -1 ), m_isGlibEventLoopType(false),
m_allowKdeDialogs(false), blockIdleTimeout(false)
......@@ -86,7 +86,6 @@ KDEXLib::KDEXLib() :
KDEXLib::~KDEXLib()
{
delete m_pApplication;
// free the faked cmdline arguments no longer needed by KApplication
for( int i = 0; i < m_nFakeCmdLineArgs; i++ )
......@@ -175,7 +174,7 @@ void KDEXLib::Init()
session_manager = strdup( getenv( "SESSION_MANAGER" ));
unsetenv( "SESSION_MANAGER" );
}
m_pApplication = new VCLKDEApplication();
m_pApplication.reset( new VCLKDEApplication() );
if( session_manager != NULL )
{
// coverity[tainted_string] - trusted source for setenv
......
......@@ -19,6 +19,8 @@
#pragma once
#include <memory>
#include <unx/saldisp.hxx>
#include <fixx11h.h>
......@@ -36,7 +38,7 @@ class KDEXLib : public QObject, public SalXLib
Q_OBJECT
private:
bool m_bStartupDone;
VCLKDEApplication* m_pApplication;
std::unique_ptr<VCLKDEApplication> m_pApplication;
char** m_pFreeCmdLineArgs;
char** m_pAppCmdLineArgs;
int m_nFakeCmdLineArgs;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment