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