File indexing completed on 2024-06-16 04:33:37

0001 /*
0002     SPDX-FileCopyrightText: 2005-2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #include "k3bglobalsettings.h"
0009 
0010 #include <KConfig>
0011 #include <KConfigGroup>
0012 #include <QStandardPaths>
0013 #include <QFileInfo>
0014 
0015 K3b::GlobalSettings::GlobalSettings()
0016     : m_eject(true),
0017       m_burnfree(true),
0018       m_overburn(false),
0019       m_useManualBufferSize(false),
0020       m_bufferSize(4),
0021       m_force(false)
0022 {
0023 }
0024 
0025 
0026 K3b::GlobalSettings::~GlobalSettings()
0027 {
0028 }
0029 
0030 
0031 void K3b::GlobalSettings::readSettings( const KConfigGroup& c )
0032 {
0033     m_eject = !c.readEntry( "No cd eject", false );
0034     m_burnfree = c.readEntry( "burnfree", true );
0035     m_overburn = c.readEntry( "Allow overburning", false );
0036     m_useManualBufferSize = c.readEntry( "Manual buffer size", false );
0037     m_bufferSize = c.readEntry( "Fifo buffer", 4 );
0038     m_force = c.readEntry( "Force unsafe operations", false );
0039     m_defaultTempPath = c.readPathEntry("Temp Dir",
0040             QStandardPaths::writableLocation(QStandardPaths::MoviesLocation));
0041     QFileInfo checkPath(m_defaultTempPath);
0042     if (!checkPath.exists()) {
0043         m_defaultTempPath =
0044             QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
0045     }
0046 }
0047 
0048 
0049 void K3b::GlobalSettings::saveSettings( KConfigGroup c )
0050 {
0051     c.writeEntry( "No cd eject", !m_eject );
0052     c.writeEntry( "burnfree", m_burnfree );
0053     c.writeEntry( "Allow overburning", m_overburn );
0054     c.writeEntry( "Manual buffer size", m_useManualBufferSize );
0055     c.writeEntry( "Fifo buffer", m_bufferSize );
0056     c.writeEntry( "Force unsafe operations", m_force );
0057     c.writeEntry( "Temp Dir", m_defaultTempPath );
0058 }