From e2de64d6f1beb9e492daf5b886e19933c1fa41dd Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- krec/krecnewproperties.cpp | 102 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 krec/krecnewproperties.cpp (limited to 'krec/krecnewproperties.cpp') diff --git a/krec/krecnewproperties.cpp b/krec/krecnewproperties.cpp new file mode 100644 index 00000000..b63cd032 --- /dev/null +++ b/krec/krecnewproperties.cpp @@ -0,0 +1,102 @@ +/*************************************************************************** + copyright : (C) 2003 by Arnold Krille + email : arnold@arnoldarts.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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; version 2 of the License. * + * * + ***************************************************************************/ + +#include "krecnewproperties.h" +#include "krecnewproperties.moc" + +#include "krecglobal.h" +#include "krecconfig_fileswidget.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +KRecNewProperties::KRecNewProperties( QWidget* p, const char* n ) + : QDialog( p,n, 0, Qt::WType_Dialog|Qt::WStyle_Customize|Qt::WStyle_DialogBorder ) + , _filename( QString::null ) + , _samplerate( 44100 ), _channels( 2 ), _bits( 16 ) +{ +kdDebug( 60005 ) << k_funcinfo << endl; + KConfig *config = KRecGlobal::kconfig(); + config->setGroup( "FileDefaults" ); + _samplerate = config->readNumEntry( "SamplingRate", 44100 ); + _channels = config->readNumEntry( "Channels", 2 ); + _bits = config->readNumEntry( "Bits", 16 ); + _usedefaults = config->readBoolEntry( "UseDefaults", false ); + + _layout = new QVBoxLayout( this, 5, 5 ); + + QLabel *captionlabel = new QLabel( this ); + QFont labelfont( captionlabel->font() ); + labelfont.setPointSize( labelfont.pointSize()*3/2 ); + captionlabel->setFont( labelfont ); + captionlabel->setText( i18n( "Properties for the new File" ) ); + captionlabel->setAlignment( AlignCenter ); + _layout->addWidget( captionlabel ); + + _filewidget = new KRecConfigFilesWidget( this ); + connect( _filewidget, SIGNAL( sRateChanged( int ) ), this, SLOT( ratechanged( int ) ) ); + connect( _filewidget, SIGNAL( sChannelsChanged( int ) ), this, SLOT( channelschanged( int ) ) ); + connect( _filewidget, SIGNAL( sBitsChanged( int ) ), this, SLOT( bitschanged( int ) ) ); + connect( _filewidget, SIGNAL( sUseDefaultsChanged( bool ) ), this, SLOT( usedefaultschanged( bool ) ) ); + + QWidget *_btnWidget = new QWidget( this ); + _layoutbuttons = new QHBoxLayout( _btnWidget ); + _layoutbuttons->addStretch( 100 ); + _btnok = new KPushButton( KStdGuiItem::ok(), _btnWidget ); + connect( _btnok, SIGNAL( clicked() ), this, SLOT( accept() ) ); + _layoutbuttons->addWidget( _btnok, 0 ); + + _layout->addWidget( new KSeparator( KSeparator::HLine, this ) ); + _layout->addWidget( _filewidget ); + _layout->addWidget( new KSeparator( KSeparator::HLine, this ) ); + _layout->addWidget( _btnWidget ); + + setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum ); +} +KRecNewProperties::~KRecNewProperties() { +kdDebug( 60005 ) << k_funcinfo << endl; +} + +QString KRecNewProperties::filename() { return _filename; } +int KRecNewProperties::samplerate() { return _samplerate; } +int KRecNewProperties::channels() { return _channels; } +int KRecNewProperties::bits() { return _bits; } +bool KRecNewProperties::usedefaults() { return _usedefaults; } + +void KRecNewProperties::ratechanged( int rate ) { _samplerate = rate; } +void KRecNewProperties::channelschanged( int channels ) { _channels = channels; } +void KRecNewProperties::bitschanged( int bits ) { _bits = bits; } +void KRecNewProperties::usedefaultschanged( bool n ) { + _usedefaults = n; + KRecGlobal::kconfig()->setGroup( "FileDefaults" ); + KRecGlobal::kconfig()->writeEntry( "UseDefaults", _usedefaults ); +} + +void KRecNewProperties::done( int r ) { +kdDebug( 60005 ) << k_funcinfo << endl; + QDialog::done( r ); +} + -- cgit v1.2.1