File indexing completed on 2024-12-29 04:50:59
0001 /* 0002 SPDX-FileCopyrightText: 2019 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "config-kitinerary.h" 0008 #include "popplerglobalparams_p.h" 0009 0010 #include <qglobal.h> 0011 0012 #include <GlobalParams.h> 0013 0014 #include <memory> 0015 0016 using namespace KItinerary; 0017 0018 static std::unique_ptr<GlobalParams> s_globalParams; 0019 0020 PopplerGlobalParams::PopplerGlobalParams() 0021 { 0022 if (!s_globalParams) { 0023 s_globalParams = std::make_unique<GlobalParams>(); 0024 } 0025 0026 #if KPOPPLER_VERSION <= QT_VERSION_CHECK(0, 82, 0) 0027 m_prev.reset(globalParams); 0028 globalParams = s_globalParams.get(); 0029 #else 0030 std::swap(globalParams, m_prev); 0031 std::swap(s_globalParams, globalParams); 0032 #endif 0033 } 0034 0035 PopplerGlobalParams::~PopplerGlobalParams() 0036 { 0037 #if KPOPPLER_VERSION <= QT_VERSION_CHECK(0, 82, 0) 0038 globalParams = m_prev.release(); 0039 #else 0040 std::swap(s_globalParams, globalParams); 0041 std::swap(globalParams, m_prev); 0042 #endif 0043 }