You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
148 lines
4.5 KiB
148 lines
4.5 KiB
15 years ago
|
/*
|
||
13 years ago
|
TDE Icon Editor - a small graphics drawing program for the TDE
|
||
15 years ago
|
Copyright (C) 1998 Thomas Tanghus (tanghus@kde.org)
|
||
|
|
||
|
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.
|
||
|
|
||
|
This program is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
12 years ago
|
#include <tdeconfig.h>
|
||
15 years ago
|
#include <kdebug.h>
|
||
12 years ago
|
#include <tdeapplication.h>
|
||
15 years ago
|
|
||
|
#include "properties.h"
|
||
|
|
||
12 years ago
|
TDEIconEditProperties* TDEIconEditProperties::m_self = 0;
|
||
15 years ago
|
|
||
12 years ago
|
TDEIconEditProperties* TDEIconEditProperties::self()
|
||
15 years ago
|
{
|
||
|
if (!m_self)
|
||
12 years ago
|
m_self = new TDEIconEditProperties();
|
||
15 years ago
|
return m_self;
|
||
|
}
|
||
|
|
||
12 years ago
|
TDEIconEditProperties::TDEIconEditProperties() : TQObject()
|
||
15 years ago
|
{
|
||
12 years ago
|
TDEConfig *config = kapp->config();
|
||
15 years ago
|
|
||
|
config->setGroup( "Appearance" );
|
||
|
|
||
14 years ago
|
m_bgMode = (TQWidget::BackgroundMode)config->readNumEntry( "BackgroundMode", TQWidget::FixedPixmap);
|
||
15 years ago
|
m_bgColor = config->readColorEntry( "BackgroundColor", &gray);
|
||
|
m_bgPixmap = config->readPathEntry("BackgroundPixmap");
|
||
|
|
||
|
config->setGroup( "Grid" );
|
||
|
m_pasteTransparent = config->readBoolEntry( "PasteTransparent", false );
|
||
|
m_showGrid = config->readBoolEntry( "ShowGrid", true );
|
||
|
m_gridScale = config->readNumEntry( "GridScaling", 10 );
|
||
|
m_showRulers = config->readBoolEntry( "ShowRulers", true );
|
||
|
|
||
|
if(config->readEntry( "TransparencyDisplayType", "Checkerboard" ) == "Checkerboard")
|
||
|
{
|
||
12 years ago
|
m_transparencyDisplayType = TDEIconEditGrid::TRD_CHECKERBOARD;
|
||
15 years ago
|
}
|
||
|
else
|
||
|
{
|
||
12 years ago
|
m_transparencyDisplayType = TDEIconEditGrid::TRD_SOLIDCOLOR;
|
||
15 years ago
|
}
|
||
|
|
||
14 years ago
|
TQColor checkColor1(255, 255, 255);
|
||
|
TQColor checkColor2(127, 127, 127);
|
||
15 years ago
|
|
||
|
m_checkerboardColor1 = config->readColorEntry( "CheckerboardColor1", &checkColor1);
|
||
|
m_checkerboardColor2 = config->readColorEntry( "CheckerboardColor2", &checkColor2);
|
||
|
|
||
14 years ago
|
TQString checkerboardSize = config->readEntry( "CheckerboardSize", "Medium" );
|
||
15 years ago
|
|
||
|
if(checkerboardSize == "Small")
|
||
|
{
|
||
12 years ago
|
m_checkerboardSize = TDEIconEditGrid::CHK_SMALL;
|
||
15 years ago
|
}
|
||
|
else
|
||
|
if(checkerboardSize == "Medium")
|
||
|
{
|
||
12 years ago
|
m_checkerboardSize = TDEIconEditGrid::CHK_MEDIUM;
|
||
15 years ago
|
}
|
||
|
else
|
||
|
{
|
||
12 years ago
|
m_checkerboardSize = TDEIconEditGrid::CHK_LARGE;
|
||
15 years ago
|
}
|
||
|
|
||
14 years ago
|
TQColor solidColor(255, 255, 255);
|
||
15 years ago
|
m_transparencySolidColor = config->readColorEntry( "TransparencySolidColor", &solidColor);
|
||
|
}
|
||
|
|
||
12 years ago
|
TDEIconEditProperties::~TDEIconEditProperties()
|
||
15 years ago
|
{
|
||
12 years ago
|
kdDebug(4640) << "TDEIconEditProperties: Deleting properties" << endl;
|
||
15 years ago
|
m_self = 0;
|
||
|
}
|
||
|
|
||
12 years ago
|
void TDEIconEditProperties::save()
|
||
15 years ago
|
{
|
||
12 years ago
|
TDEConfig *config = kapp->config();
|
||
15 years ago
|
|
||
|
config->setGroup( "Appearance" );
|
||
|
|
||
|
config->writeEntry("BackgroundMode", m_bgMode );
|
||
|
config->writeEntry("BackgroundColor", m_bgColor );
|
||
|
config->writePathEntry("BackgroundPixmap", m_bgPixmap );
|
||
|
|
||
|
config->setGroup( "Grid" );
|
||
|
config->writeEntry("PasteTransparent", m_pasteTransparent );
|
||
|
config->writeEntry("ShowGrid", m_showGrid );
|
||
|
config->writeEntry("GridScaling", m_gridScale );
|
||
|
config->writeEntry("ShowRulers", m_showRulers );
|
||
|
|
||
14 years ago
|
TQString transparencyDisplayType;
|
||
15 years ago
|
|
||
|
switch(m_transparencyDisplayType)
|
||
|
{
|
||
12 years ago
|
case TDEIconEditGrid::TRD_SOLIDCOLOR:
|
||
15 years ago
|
transparencyDisplayType = "SolidColor";
|
||
|
break;
|
||
12 years ago
|
case TDEIconEditGrid::TRD_CHECKERBOARD:
|
||
15 years ago
|
default:
|
||
|
transparencyDisplayType = "Checkerboard";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
config->writeEntry( "TransparencyDisplayType", transparencyDisplayType );
|
||
|
config->writeEntry( "CheckerboardColor1", m_checkerboardColor1 );
|
||
|
config->writeEntry( "CheckerboardColor2", m_checkerboardColor2 );
|
||
|
|
||
14 years ago
|
TQString checkerboardSize;
|
||
15 years ago
|
|
||
|
switch(m_checkerboardSize)
|
||
|
{
|
||
12 years ago
|
case TDEIconEditGrid::CHK_SMALL:
|
||
15 years ago
|
checkerboardSize = "Small";
|
||
|
break;
|
||
12 years ago
|
case TDEIconEditGrid::CHK_MEDIUM:
|
||
15 years ago
|
checkerboardSize = "Medium";
|
||
|
break;
|
||
12 years ago
|
case TDEIconEditGrid::CHK_LARGE:
|
||
15 years ago
|
default:
|
||
|
checkerboardSize = "Large";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
config->writeEntry( "CheckerboardSize", checkerboardSize );
|
||
|
config->writeEntry( "TransparencySolidColor", m_transparencySolidColor );
|
||
|
|
||
|
config->sync();
|
||
|
}
|
||
|
|