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.
590 lines
16 KiB
590 lines
16 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.
|
||
|
*/
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
|
||
14 years ago
|
#include <tqcheckbox.h>
|
||
13 years ago
|
#include <tqlayout.h>
|
||
14 years ago
|
#include <tqlineedit.h>
|
||
|
#include <tqvbox.h>
|
||
|
#include <tqbuttongroup.h>
|
||
|
#include <tqradiobutton.h>
|
||
15 years ago
|
|
||
12 years ago
|
#include <tdeaccel.h>
|
||
15 years ago
|
#include <kbuttonbox.h>
|
||
12 years ago
|
#include <tdeapplication.h>
|
||
12 years ago
|
#include <tdelocale.h>
|
||
15 years ago
|
#include <kcolorbutton.h>
|
||
12 years ago
|
#include <tdefiledialog.h>
|
||
12 years ago
|
#include <tdemessagebox.h>
|
||
15 years ago
|
#include <kdebug.h>
|
||
|
#include <kurlrequester.h>
|
||
|
|
||
11 years ago
|
#include "tdeiconconfig.h"
|
||
|
#include "tdeiconedit.h"
|
||
15 years ago
|
|
||
|
#ifndef PICS_INCLUDED
|
||
|
#define PICS_INCLUDED
|
||
|
#include "pics/logo.xpm"
|
||
|
#endif
|
||
|
|
||
|
// little helper:
|
||
14 years ago
|
static inline TQPixmap loadIcon( const char * name )
|
||
15 years ago
|
{
|
||
12 years ago
|
return TDEGlobal::instance()->iconLoader()
|
||
12 years ago
|
->loadIcon( TQString::fromLatin1(name), TDEIcon::NoGroup, TDEIcon::SizeMedium );
|
||
15 years ago
|
}
|
||
|
|
||
13 years ago
|
KTemplateEditDlg::KTemplateEditDlg(TQWidget *parent)
|
||
|
: KDialogBase(parent, "KTemplateEditDlg", true, i18n( "Icon Template" ),
|
||
15 years ago
|
Ok|Cancel )
|
||
|
{
|
||
14 years ago
|
TQFrame *frame = makeMainWidget();
|
||
|
TQVBoxLayout *ml = new TQVBoxLayout(frame);
|
||
|
TQGroupBox *grp = new TQGroupBox(i18n("Template"), frame);
|
||
15 years ago
|
grp->setColumnLayout(0, Qt::Vertical);
|
||
13 years ago
|
grp->layout()->setSpacing(spacingHint());
|
||
|
grp->layout()->setMargin(marginHint());
|
||
|
TQGridLayout *l = new TQGridLayout(grp->layout());
|
||
15 years ago
|
|
||
14 years ago
|
ln_name = new TQLineEdit( grp );
|
||
|
connect( ln_name, TQT_SIGNAL( textChanged( const TQString & ) ),
|
||
|
TQT_SLOT( slotTextChanged() ) );
|
||
|
TQLabel* lb_name = new TQLabel( ln_name, i18n( "Description:" ), grp );
|
||
15 years ago
|
|
||
|
ln_path = new KURLRequester(grp);
|
||
14 years ago
|
connect( ln_path, TQT_SIGNAL( textChanged( const TQString & ) ),
|
||
|
TQT_SLOT( slotTextChanged() ) );
|
||
|
TQLabel* lb_path = new TQLabel( ln_path, i18n( "Path:" ), grp );
|
||
15 years ago
|
|
||
|
l->addWidget(lb_name, 0, 0);
|
||
|
l->addWidget(ln_name, 0, 1);
|
||
|
l->addWidget(lb_path, 1, 0);
|
||
|
l->addWidget(ln_path, 1, 1);
|
||
|
|
||
|
ml->addWidget( grp, 1);
|
||
|
|
||
|
slotTextChanged();
|
||
|
|
||
|
setMinimumSize( 400, 150 );
|
||
|
}
|
||
|
|
||
|
void KTemplateEditDlg::slotTextChanged()
|
||
|
{
|
||
14 years ago
|
TQString name = ln_name->text(), path = ln_path->url();
|
||
15 years ago
|
enableButtonOK(name.length() && path.length());
|
||
|
}
|
||
|
|
||
14 years ago
|
void KTemplateEditDlg::setName(const TQString & name)
|
||
15 years ago
|
{
|
||
|
ln_name->setText(name);
|
||
|
}
|
||
|
|
||
14 years ago
|
TQString KTemplateEditDlg::name()
|
||
15 years ago
|
{
|
||
|
return ln_name->text();
|
||
|
}
|
||
|
|
||
14 years ago
|
void KTemplateEditDlg::setPath(const TQString & path)
|
||
15 years ago
|
{
|
||
|
ln_path->setURL(path);
|
||
|
}
|
||
|
|
||
14 years ago
|
TQString KTemplateEditDlg::path()
|
||
15 years ago
|
{
|
||
|
return ln_path->url();
|
||
|
}
|
||
|
|
||
13 years ago
|
KTemplateConfig::KTemplateConfig(TQWidget *parent) : TQWidget(parent)
|
||
15 years ago
|
{
|
||
|
kdDebug(4640) << "KTemplateConfig constructor" << endl;
|
||
|
|
||
|
btadd = btremove = btedit = 0L;
|
||
|
|
||
14 years ago
|
TQGroupBox* grp = new TQGroupBox( i18n( "Templates" ), this );
|
||
15 years ago
|
grp->setColumnLayout( 0, Qt::Horizontal );
|
||
|
|
||
12 years ago
|
templates = new TDEIconListBox( grp );
|
||
14 years ago
|
connect( templates, TQT_SIGNAL( highlighted( int ) ),
|
||
|
TQT_SLOT( checkSelection( int ) ) );
|
||
|
connect( templates, TQT_SIGNAL(doubleClicked( TQListBoxItem * ) ),
|
||
|
TQT_SLOT( edit() ) );
|
||
15 years ago
|
|
||
14 years ago
|
TQVBoxLayout* ml = new TQVBoxLayout( this );
|
||
15 years ago
|
ml->addWidget( grp );
|
||
|
|
||
13 years ago
|
TQVBoxLayout* l = new TQVBoxLayout( grp->layout(), KDialog::spacingHint() );
|
||
15 years ago
|
l->addWidget( templates );
|
||
|
|
||
12 years ago
|
for( unsigned int i = 0; i < TDEIconTemplateContainer::self()->count(); i++ )
|
||
|
templates->insertItem( new TDEIconListBoxItem( *TDEIconTemplateContainer::self()->at( i ) ) ) ;
|
||
15 years ago
|
|
||
|
KButtonBox *bbox = new KButtonBox( grp );
|
||
|
|
||
|
btadd = bbox->addButton( i18n( "&Add..." ) );
|
||
14 years ago
|
connect( btadd, TQT_SIGNAL( clicked() ), TQT_SLOT( add() ) );
|
||
15 years ago
|
|
||
|
btedit = bbox->addButton( i18n( "&Edit..." ) );
|
||
14 years ago
|
connect( btedit, TQT_SIGNAL( clicked() ), TQT_SLOT( edit() ) );
|
||
15 years ago
|
btedit->setEnabled( false );
|
||
|
|
||
|
btremove = bbox->addButton( i18n( "&Remove" ) );
|
||
14 years ago
|
connect( btremove, TQT_SIGNAL( clicked() ), TQT_SLOT( remove() ) );
|
||
15 years ago
|
btremove->setEnabled( false );
|
||
|
|
||
|
bbox->addStretch( 1 );
|
||
|
|
||
13 years ago
|
bbox->layout();
|
||
15 years ago
|
l->addWidget( bbox );
|
||
|
}
|
||
|
|
||
|
KTemplateConfig::~KTemplateConfig()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void KTemplateConfig::saveSettings()
|
||
|
{
|
||
|
kdDebug(4640) << "KTemplateConfig::saveSettings" << endl;
|
||
|
|
||
12 years ago
|
TDEIconTemplateContainer::self()->clear();
|
||
15 years ago
|
|
||
|
for(int i = 0; i < (int)templates->count(); i++)
|
||
|
{
|
||
12 years ago
|
TDEIconTemplateContainer::self()->append(templates->iconTemplate(i));
|
||
15 years ago
|
}
|
||
12 years ago
|
TDEIconTemplateContainer::self()->save();
|
||
15 years ago
|
kdDebug(4640) << "KTemplateConfig::saveSettings - done" << endl;
|
||
|
|
||
|
}
|
||
|
|
||
|
void KTemplateConfig::checkSelection(int)
|
||
|
{
|
||
|
kdDebug(4640) << "KTemplateConfig::checkSelection" << endl;
|
||
|
if(templates->currentItem() != -1)
|
||
|
{
|
||
|
if(btremove) btremove->setEnabled(true);
|
||
|
if(btedit) btedit->setEnabled(true);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if(btremove) btremove->setEnabled(false);
|
||
|
if(btedit) btedit->setEnabled(false);
|
||
|
}
|
||
|
kdDebug(4640) << "KTemplateConfig::checkSelection - done" << endl;
|
||
|
}
|
||
|
|
||
|
void KTemplateConfig::remove()
|
||
|
{
|
||
|
templates->removeItem(templates->currentItem());
|
||
|
}
|
||
|
|
||
|
void KTemplateConfig::add()
|
||
|
{
|
||
|
KTemplateEditDlg dlg(this);
|
||
|
if(dlg.exec())
|
||
|
{
|
||
12 years ago
|
TDEIconTemplate it;
|
||
15 years ago
|
it.path = dlg.path();
|
||
|
it.title = dlg.name();
|
||
12 years ago
|
templates->insertItem(new TDEIconListBoxItem(it));
|
||
15 years ago
|
}
|
||
|
}
|
||
|
|
||
|
void KTemplateConfig::edit()
|
||
|
{
|
||
|
KTemplateEditDlg dlg(this);
|
||
|
dlg.setPath(templates->path(templates->currentItem()));
|
||
|
dlg.setName(templates->text(templates->currentItem()));
|
||
|
templates->item(templates->currentItem());
|
||
|
if(dlg.exec())
|
||
|
{
|
||
|
//Edit the entry
|
||
12 years ago
|
TDEIconTemplate &it=templates->iconTemplate(templates->currentItem());
|
||
15 years ago
|
it.path = dlg.path();
|
||
|
it.title = dlg.name();
|
||
12 years ago
|
static_cast<TDEIconListBoxItem*>(templates->item(templates->currentItem()))->reloadIcon();
|
||
15 years ago
|
templates->update();
|
||
|
}
|
||
|
}
|
||
|
|
||
13 years ago
|
KBackgroundConfig::KBackgroundConfig( TQWidget* parent )
|
||
|
: TQWidget( parent )
|
||
15 years ago
|
{
|
||
|
kdDebug(4640) << "KBackgroundConfig - constructor" << endl;
|
||
|
|
||
|
lb_ex = 0L;
|
||
|
|
||
12 years ago
|
TDEIconEditProperties *props = TDEIconEditProperties::self();
|
||
15 years ago
|
|
||
|
pixpath = props->bgPixmap();
|
||
|
pix.load(pixpath);
|
||
|
if(pix.isNull())
|
||
|
{
|
||
|
kdDebug(4640) << "BGPIX: " << pixpath << " not valid!" << endl;
|
||
14 years ago
|
TQPixmap pmlogo((const char**)logo);
|
||
15 years ago
|
pix = pmlogo;
|
||
|
}
|
||
|
|
||
14 years ago
|
TQVBoxLayout *mainLayout = new TQVBoxLayout( this );
|
||
15 years ago
|
|
||
14 years ago
|
TQGroupBox *grp1 = new TQGroupBox( i18n( "Select Background" ), this );
|
||
15 years ago
|
grp1->setColumnLayout(0, Qt::Vertical );
|
||
13 years ago
|
grp1->layout()->setSpacing( KDialog::spacingHint() );
|
||
|
grp1->layout()->setMargin( KDialog::marginHint() );
|
||
15 years ago
|
mainLayout->addWidget( grp1 );
|
||
|
|
||
13 years ago
|
TQGridLayout *grp1Layout = new TQGridLayout( grp1->layout(), 3, 2 );
|
||
15 years ago
|
|
||
14 years ago
|
TQButtonGroup* btngrp = new TQButtonGroup( grp1 );
|
||
15 years ago
|
btngrp->setExclusive( true );
|
||
14 years ago
|
btngrp->setFrameStyle( TQFrame::NoFrame );
|
||
|
connect( btngrp, TQT_SIGNAL( clicked( int ) ), TQT_SLOT( slotBackgroundMode( int ) ) );
|
||
15 years ago
|
grp1Layout->addWidget( btngrp, 0, 0 );
|
||
|
|
||
14 years ago
|
TQVBoxLayout *bgl = new TQVBoxLayout( btngrp, 5 );
|
||
15 years ago
|
|
||
14 years ago
|
TQRadioButton *rbc = new TQRadioButton( i18n( "Use co&lor" ), btngrp );
|
||
15 years ago
|
btngrp->insert( rbc, 0 );
|
||
|
bgl->addWidget( rbc );
|
||
|
|
||
14 years ago
|
TQRadioButton *rbp = new TQRadioButton( i18n( "Use pix&map" ), btngrp );
|
||
15 years ago
|
btngrp->insert( rbp, 1 );
|
||
|
bgl->addWidget( rbp );
|
||
|
|
||
|
bgl->addStretch( 1 );
|
||
|
|
||
14 years ago
|
TQVBox *bbox = new TQVBox( grp1 );
|
||
15 years ago
|
grp1Layout->addWidget( bbox, 0, 1 );
|
||
|
|
||
|
btcolor = new KColorButton(props->bgColor(), bbox) ;
|
||
14 years ago
|
connect(btcolor, TQT_SIGNAL(changed(const TQColor &)),
|
||
|
TQT_SLOT( selectColor(const TQColor &)));
|
||
15 years ago
|
|
||
14 years ago
|
btpix = new TQPushButton(i18n( "Choose..." ), bbox);
|
||
|
connect( btpix, TQT_SIGNAL( clicked() ), TQT_SLOT( selectPixmap() ) );
|
||
15 years ago
|
|
||
14 years ago
|
TQGroupBox *grp2 = new TQGroupBox( i18n( "Preview" ), this );
|
||
15 years ago
|
mainLayout->addWidget( grp2, 1 );
|
||
|
|
||
14 years ago
|
TQBoxLayout *l2 = new TQVBoxLayout( grp2, 15 );
|
||
15 years ago
|
|
||
|
l2->addSpacing( 10 );
|
||
|
|
||
14 years ago
|
lb_ex = new TQLabel( grp2 );
|
||
|
lb_ex->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
|
||
15 years ago
|
l2->addWidget( lb_ex );
|
||
|
|
||
|
/*
|
||
|
l1->addWidget( btngrp, 0, AlignLeft );
|
||
|
l1->addLayout( l1r );
|
||
|
*/
|
||
|
bgmode = props->bgMode();
|
||
|
|
||
14 years ago
|
if( bgmode == TQWidget::FixedPixmap )
|
||
15 years ago
|
{
|
||
|
btngrp->setButton( 1 );
|
||
|
btcolor->setEnabled( false );
|
||
|
lb_ex->setBackgroundPixmap( pix );
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
btngrp->setButton( 0 );
|
||
|
btpix->setEnabled( false );
|
||
|
lb_ex->setBackgroundColor(btcolor->color());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
KBackgroundConfig::~KBackgroundConfig()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void KBackgroundConfig::slotBackgroundMode(int id)
|
||
|
{
|
||
|
if(id == 0)
|
||
|
{
|
||
14 years ago
|
bgmode = TQWidget::FixedColor;
|
||
15 years ago
|
btpix->setEnabled(false);
|
||
|
btcolor->setEnabled(true);
|
||
|
if(lb_ex)
|
||
|
lb_ex->setBackgroundColor(btcolor->color());
|
||
|
}
|
||
|
else
|
||
|
{
|
||
14 years ago
|
bgmode = TQWidget::FixedPixmap;
|
||
15 years ago
|
btpix->setEnabled(true);
|
||
|
btcolor->setEnabled(false);
|
||
|
if(lb_ex)
|
||
|
lb_ex->setBackgroundPixmap(pix);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void KBackgroundConfig::saveSettings()
|
||
|
{
|
||
|
kdDebug(4640) << "KBackgroundConfig::saveSettings" << endl;
|
||
12 years ago
|
TDEIconEditProperties *props = TDEIconEditProperties::self();
|
||
15 years ago
|
props->setBgMode( bgmode );
|
||
|
props->setBgPixmap( pixpath );
|
||
|
props->setBgColor( btcolor->color() );
|
||
|
kdDebug(4640) << "KBackgroundConfig::saveSettings - done" << endl;
|
||
|
}
|
||
|
|
||
14 years ago
|
void KBackgroundConfig::selectColor(const TQColor & newColor)
|
||
15 years ago
|
{
|
||
|
lb_ex->setBackgroundColor(newColor);
|
||
|
}
|
||
|
|
||
|
void KBackgroundConfig::selectPixmap()
|
||
|
{
|
||
|
// KURL url = KFileDialog::getOpenURL("/", "*.xpm");
|
||
|
KURL url = KFileDialog::getImageOpenURL("/");
|
||
|
|
||
|
if( url.isEmpty() )
|
||
|
return;
|
||
|
|
||
|
if( !url.isLocalFile() )
|
||
|
{
|
||
|
KMessageBox::sorry( 0L, i18n( "Only local files are supported yet." ) );
|
||
|
return;
|
||
|
}
|
||
|
|
||
14 years ago
|
TQPixmap p(url.path());
|
||
15 years ago
|
|
||
|
if( !p.isNull() )
|
||
|
{
|
||
|
lb_ex->setBackgroundPixmap( p );
|
||
|
pixpath = url.path();
|
||
|
}
|
||
|
}
|
||
|
|
||
13 years ago
|
KMiscConfig::KMiscConfig(TQWidget *parent) : TQWidget(parent)
|
||
15 years ago
|
{
|
||
|
kdDebug(4640) << "KMiscConfig - constructor" << endl;
|
||
|
|
||
12 years ago
|
TDEIconEditProperties* props = TDEIconEditProperties::self();
|
||
15 years ago
|
|
||
14 years ago
|
TQBoxLayout *ml = new TQVBoxLayout( this, 0, 5 );
|
||
15 years ago
|
|
||
14 years ago
|
TQCheckBox *cbp = new TQCheckBox( i18n( "Paste &transparent pixels" ), this );
|
||
|
connect( cbp, TQT_SIGNAL( toggled( bool ) ), TQT_SLOT( pasteMode( bool ) ) );
|
||
15 years ago
|
ml->addWidget(cbp);
|
||
|
|
||
14 years ago
|
TQCheckBox *cbr = new TQCheckBox( i18n( "Show &rulers" ), this );
|
||
|
connect( cbr, TQT_SIGNAL( toggled( bool ) ), TQT_SLOT( showRulers( bool ) ) );
|
||
15 years ago
|
ml->addWidget(cbr);
|
||
|
|
||
14 years ago
|
TQButtonGroup* btngrp = new TQButtonGroup( i18n( "Transparency Display" ), this);
|
||
15 years ago
|
btngrp->setExclusive( true );
|
||
14 years ago
|
connect( btngrp, TQT_SIGNAL( clicked( int ) ), TQT_SLOT( slotTransparencyDisplayType( int ) ) );
|
||
15 years ago
|
ml->addWidget( btngrp );
|
||
|
|
||
14 years ago
|
TQVBoxLayout *tgl = new TQVBoxLayout( btngrp, KDialog::marginHint(), KDialog::spacingHint() );
|
||
15 years ago
|
tgl->insertSpacing(0, 10);
|
||
|
|
||
14 years ago
|
TQHBoxLayout *hl = new TQHBoxLayout(tgl);
|
||
15 years ago
|
|
||
14 years ago
|
TQRadioButton *solidColorRButton = new TQRadioButton( i18n( "&Solid color:" ), btngrp );
|
||
15 years ago
|
btngrp->insert( solidColorRButton, 0 );
|
||
|
hl->addWidget( solidColorRButton );
|
||
|
|
||
|
m_solidColorButton = new KColorButton(props->transparencySolidColor(), btngrp);
|
||
|
btngrp->insert( m_solidColorButton, 2 );
|
||
|
hl->addWidget(m_solidColorButton);
|
||
14 years ago
|
//connect(btcolor, TQT_SIGNAL(changed(const TQColor &)),
|
||
|
// TQT_SLOT( selectColor(const TQColor &)));
|
||
15 years ago
|
|
||
14 years ago
|
TQRadioButton *checkerboardRButton = new TQRadioButton( i18n( "Checker&board" ), btngrp );
|
||
15 years ago
|
btngrp->insert( checkerboardRButton, 1 );
|
||
|
tgl->addWidget( checkerboardRButton );
|
||
|
|
||
14 years ago
|
TQGridLayout *grid = new TQGridLayout(tgl, 3, 3);
|
||
15 years ago
|
grid->addColSpacing(0, 40);
|
||
|
grid->setColStretch(1, 1);
|
||
|
grid->setColStretch(2, 1);
|
||
|
|
||
14 years ago
|
m_checkerboardSizeCombo = new TQComboBox(btngrp);
|
||
15 years ago
|
m_checkerboardSizeCombo->insertItem( i18n( "Small" ) );
|
||
|
m_checkerboardSizeCombo->insertItem( i18n( "Medium" ) );
|
||
|
m_checkerboardSizeCombo->insertItem( i18n( "Large" ) );
|
||
|
m_checkerboardSizeCombo->setCurrentItem(props->checkerboardSize());
|
||
|
|
||
14 years ago
|
TQLabel *label = new TQLabel(m_checkerboardSizeCombo, i18n("Si&ze:"), btngrp);
|
||
15 years ago
|
|
||
|
grid->addWidget(label, 0, 1);
|
||
|
grid->addWidget(m_checkerboardSizeCombo, 0, 2);
|
||
|
|
||
|
m_checkerboardColor1Button = new KColorButton(props->checkerboardColor1(), btngrp);
|
||
14 years ago
|
label = new TQLabel(m_checkerboardColor1Button, i18n("Color &1:"), btngrp);
|
||
15 years ago
|
|
||
|
grid->addWidget(label, 1, 1);
|
||
|
grid->addWidget(m_checkerboardColor1Button, 1, 2);
|
||
|
|
||
|
m_checkerboardColor2Button = new KColorButton(props->checkerboardColor2(), btngrp);
|
||
14 years ago
|
label = new TQLabel(m_checkerboardColor2Button, i18n("Color &2:"), btngrp);
|
||
15 years ago
|
|
||
|
grid->addWidget(label, 2, 1);
|
||
|
grid->addWidget(m_checkerboardColor2Button, 2, 2);
|
||
|
|
||
12 years ago
|
if(props->transparencyDisplayType() == TDEIconEditGrid::TRD_CHECKERBOARD)
|
||
15 years ago
|
{
|
||
|
checkerboardRButton->setChecked(true);
|
||
|
m_checkerboardColor1Button->setEnabled(true);
|
||
|
m_checkerboardColor2Button->setEnabled(true);
|
||
|
m_checkerboardSizeCombo->setEnabled(true);
|
||
|
|
||
|
solidColorRButton->setChecked(false);
|
||
|
m_solidColorButton->setEnabled(false);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
checkerboardRButton->setChecked(false);
|
||
|
m_checkerboardColor1Button->setEnabled(false);
|
||
|
m_checkerboardColor2Button->setEnabled(false);
|
||
|
m_checkerboardSizeCombo->setEnabled(false);
|
||
|
|
||
|
solidColorRButton->setChecked(true);
|
||
|
m_solidColorButton->setEnabled(true);
|
||
|
}
|
||
|
|
||
|
ml->addStretch(1);
|
||
|
|
||
|
cbp->setChecked( props->pasteTransparent() );
|
||
|
cbr->setChecked( props->showRulers() );
|
||
|
}
|
||
|
|
||
|
KMiscConfig::~KMiscConfig()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
void KMiscConfig::saveSettings()
|
||
|
{
|
||
|
kdDebug(4640) << "KMiscConfig::saveSettings" << endl;
|
||
12 years ago
|
TDEIconEditProperties* props = TDEIconEditProperties::self();
|
||
15 years ago
|
props->setPasteTransparent( pastemode );
|
||
|
props->setShowRulers( showrulers );
|
||
|
if(m_solidColorButton->isEnabled())
|
||
|
{
|
||
12 years ago
|
props->setTransparencyDisplayType(TDEIconEditGrid::TRD_SOLIDCOLOR);
|
||
15 years ago
|
props->setTransparencySolidColor(m_solidColorButton->color());
|
||
|
}
|
||
|
else
|
||
|
{
|
||
12 years ago
|
props->setTransparencyDisplayType(TDEIconEditGrid::TRD_CHECKERBOARD);
|
||
15 years ago
|
props->setCheckerboardColor1(m_checkerboardColor1Button->color());
|
||
|
props->setCheckerboardColor2(m_checkerboardColor2Button->color());
|
||
12 years ago
|
props->setCheckerboardSize((TDEIconEditGrid::CheckerboardSize)m_checkerboardSizeCombo->currentItem());
|
||
15 years ago
|
}
|
||
|
}
|
||
|
|
||
|
void KMiscConfig::pasteMode(bool mode)
|
||
|
{
|
||
|
pastemode = mode;
|
||
|
}
|
||
|
|
||
|
void KMiscConfig::showRulers(bool mode)
|
||
|
{
|
||
|
showrulers = mode;
|
||
|
}
|
||
|
|
||
|
void KMiscConfig::slotTransparencyDisplayType(int id)
|
||
|
{
|
||
|
if(id == 0)
|
||
|
{
|
||
|
m_checkerboardColor1Button->setEnabled(false);
|
||
|
m_checkerboardColor2Button->setEnabled(false);
|
||
|
m_checkerboardSizeCombo->setEnabled(false);
|
||
|
|
||
|
m_solidColorButton->setEnabled(true);
|
||
|
}
|
||
|
else
|
||
|
if(id == 1)
|
||
|
{
|
||
|
m_checkerboardColor1Button->setEnabled(true);
|
||
|
m_checkerboardColor2Button->setEnabled(true);
|
||
|
m_checkerboardSizeCombo->setEnabled(true);
|
||
|
|
||
|
m_solidColorButton->setEnabled(false);
|
||
|
}
|
||
|
}
|
||
|
|
||
12 years ago
|
TDEIconConfig::TDEIconConfig(TQWidget *parent)
|
||
15 years ago
|
: KDialogBase(KDialogBase::IconList, i18n("Configure"),
|
||
|
KDialogBase::Help |
|
||
|
KDialogBase::Ok |
|
||
|
KDialogBase::Apply |
|
||
|
KDialogBase::Cancel,
|
||
|
KDialogBase::Ok,
|
||
13 years ago
|
parent, "configDialog", true, true)
|
||
15 years ago
|
{
|
||
14 years ago
|
setHelp(TQString());
|
||
15 years ago
|
//KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
|
||
14 years ago
|
connect(this, TQT_SIGNAL(finished()), this, TQT_SLOT(finis()));
|
||
15 years ago
|
|
||
14 years ago
|
TQVBox* page = addVBoxPage(i18n("Icon Templates"), TQString(), loadIcon("icons"));
|
||
15 years ago
|
temps = new KTemplateConfig(page);
|
||
|
|
||
14 years ago
|
page = addVBoxPage(i18n("Background"), TQString(), loadIcon("background"));
|
||
15 years ago
|
backs = new KBackgroundConfig(page);
|
||
|
|
||
11 years ago
|
page = addVBoxPage(i18n("Icon Grid"), TQString(), loadIcon("tdeiconedit"));
|
||
15 years ago
|
misc = new KMiscConfig(page);
|
||
|
|
||
14 years ago
|
TQSize min(300, 400);
|
||
15 years ago
|
|
||
13 years ago
|
if (300 < sizeHint().width()) { min.setWidth(sizeHint().width()); }
|
||
|
if (400 < sizeHint().height()) { min.setHeight(sizeHint().height()); }
|
||
15 years ago
|
|
||
|
resize(min);
|
||
|
}
|
||
|
|
||
12 years ago
|
TDEIconConfig::~TDEIconConfig()
|
||
15 years ago
|
{
|
||
|
//delete dict;
|
||
|
}
|
||
|
|
||
12 years ago
|
void TDEIconConfig::slotApply()
|
||
15 years ago
|
{
|
||
12 years ago
|
kdDebug(4640) << "TDEIconEditConfig::saveSettings" << endl;
|
||
15 years ago
|
|
||
|
temps->saveSettings();
|
||
|
backs->saveSettings();
|
||
|
misc->saveSettings();
|
||
|
|
||
12 years ago
|
for (TDEIconEdit* window = TDEIconEdit::windowList.first();
|
||
15 years ago
|
window;
|
||
12 years ago
|
window = TDEIconEdit::windowList.next())
|
||
15 years ago
|
{
|
||
|
window->updateProperties();
|
||
|
}
|
||
|
}
|
||
|
|
||
12 years ago
|
void TDEIconConfig::slotOk()
|
||
15 years ago
|
{
|
||
|
slotApply();
|
||
|
KDialogBase::slotOk();
|
||
|
}
|
||
|
|
||
12 years ago
|
void TDEIconConfig::finis()
|
||
15 years ago
|
{
|
||
|
delayedDestruct();
|
||
|
}
|
||
|
|
||
11 years ago
|
#include "tdeiconconfig.moc"
|