cleanup variable names.

This commit is contained in:
Hugo Pereira Da Costa 2011-02-24 17:47:38 +01:00
parent 0960942f4e
commit 3c290e07cd
10 changed files with 223 additions and 223 deletions

View file

@ -59,14 +59,14 @@ namespace Oxygen
KGlobal::locale()->insertCatalog("kwin_clients");
configuration_ = new KConfig( "oxygenrc" );
KConfigGroup configurationGroup( configuration_, "Windeco");
_configuration = new KConfig( "oxygenrc" );
KConfigGroup configurationGroup( _configuration, "Windeco");
userInterface_ = new ConfigurationUi( parent );
ui = new ConfigurationUi( parent );
load( configurationGroup );
connect( userInterface_, SIGNAL(changed()), SLOT( updateChanged() ) );
userInterface_->show();
connect( ui, SIGNAL(changed()), SLOT( updateChanged() ) );
ui->show();
}
@ -74,31 +74,31 @@ namespace Oxygen
//_______________________________________________________________________
Config::~Config()
{
delete userInterface_;
delete configuration_;
delete ui;
delete _configuration;
}
//_______________________________________________________________________
void Config::toggleExpertMode( bool value )
{ userInterface_->toggleExpertMode( value ); }
{ ui->toggleExpertMode( value ); }
//_______________________________________________________________________
void Config::load( const KConfigGroup& )
{
// load standard configuration
loadConfiguration( Configuration( KConfigGroup( configuration_, "Windeco") ) );
loadShadowConfiguration( QPalette::Active, ShadowConfiguration( QPalette::Active, KConfigGroup( configuration_, "ActiveShadow") ) );
loadShadowConfiguration( QPalette::Inactive, ShadowConfiguration( QPalette::Inactive, KConfigGroup( configuration_, "InactiveShadow") ) );
loadConfiguration( Configuration( KConfigGroup( _configuration, "Windeco") ) );
loadShadowConfiguration( QPalette::Active, ShadowConfiguration( QPalette::Active, KConfigGroup( _configuration, "ActiveShadow") ) );
loadShadowConfiguration( QPalette::Inactive, ShadowConfiguration( QPalette::Inactive, KConfigGroup( _configuration, "InactiveShadow") ) );
// load exceptions
ExceptionList exceptions;
exceptions.read( *configuration_ );
exceptions.read( *_configuration );
if( exceptions.empty() )
{ exceptions = ExceptionList::defaultList(); }
// install in ui
userInterface_->ui.exceptions->setExceptions( exceptions );
ui->ui.exceptions->setExceptions( exceptions );
updateChanged();
}
@ -107,29 +107,29 @@ namespace Oxygen
void Config::updateChanged( void )
{
Configuration configuration( KConfigGroup( configuration_, "Windeco") );
Configuration configuration( KConfigGroup( _configuration, "Windeco") );
bool modified( false );
if( userInterface_->ui.titleAlignment->currentIndex() != userInterface_->ui.titleAlignment->findText( configuration.titleAlignmentName( true ) ) ) modified = true;
else if( userInterface_->ui.buttonSize->currentIndex() != userInterface_->ui.buttonSize->findText( configuration.buttonSizeName( true ) ) ) modified = true;
else if( userInterface_->ui.blendColor->currentIndex() != userInterface_->ui.blendColor->findText( configuration.blendColorName( true ) ) ) modified = true;
else if( userInterface_->ui.frameBorder->currentIndex() != userInterface_->ui.frameBorder->findText( configuration.frameBorderName( true ) ) ) modified = true;
else if( userInterface_->ui.sizeGripMode->currentIndex() != userInterface_->ui.sizeGripMode->findText( configuration.sizeGripModeName( true ) ) ) modified = true;
else if( userInterface_->ui.shadowMode->currentIndex() != userInterface_->ui.shadowMode->findText( configuration.shadowModeName( true ) ) ) modified = true;
else if( userInterface_->ui.shadowCacheMode->currentIndex() != userInterface_->ui.shadowCacheMode->findText( configuration.shadowCacheModeName( true ) ) ) modified = true;
if( ui->ui.titleAlignment->currentIndex() != ui->ui.titleAlignment->findText( configuration.titleAlignmentName( true ) ) ) modified = true;
else if( ui->ui.buttonSize->currentIndex() != ui->ui.buttonSize->findText( configuration.buttonSizeName( true ) ) ) modified = true;
else if( ui->ui.blendColor->currentIndex() != ui->ui.blendColor->findText( configuration.blendColorName( true ) ) ) modified = true;
else if( ui->ui.frameBorder->currentIndex() != ui->ui.frameBorder->findText( configuration.frameBorderName( true ) ) ) modified = true;
else if( ui->ui.sizeGripMode->currentIndex() != ui->ui.sizeGripMode->findText( configuration.sizeGripModeName( true ) ) ) modified = true;
else if( ui->ui.shadowMode->currentIndex() != ui->ui.shadowMode->findText( configuration.shadowModeName( true ) ) ) modified = true;
else if( ui->ui.shadowCacheMode->currentIndex() != ui->ui.shadowCacheMode->findText( configuration.shadowCacheModeName( true ) ) ) modified = true;
else if( userInterface_->ui.separatorMode->currentIndex() != configuration.separatorMode() ) modified = true;
else if( userInterface_->ui.titleOutline->isChecked() != configuration.drawTitleOutline() ) modified = true;
else if( userInterface_->ui.tabsEnabled->isChecked() != configuration.tabsEnabled() ) modified = true;
else if( userInterface_->ui.useAnimations->isChecked() != configuration.useAnimations() ) modified = true;
else if( userInterface_->ui.animateTitleChange->isChecked() != configuration.animateTitleChange() ) modified = true;
else if( userInterface_->ui.narrowButtonSpacing->isChecked() != configuration.useNarrowButtonSpacing() ) modified = true;
else if( ui->ui.separatorMode->currentIndex() != configuration.separatorMode() ) modified = true;
else if( ui->ui.titleOutline->isChecked() != configuration.drawTitleOutline() ) modified = true;
else if( ui->ui.tabsEnabled->isChecked() != configuration.tabsEnabled() ) modified = true;
else if( ui->ui.useAnimations->isChecked() != configuration.useAnimations() ) modified = true;
else if( ui->ui.animateTitleChange->isChecked() != configuration.animateTitleChange() ) modified = true;
else if( ui->ui.narrowButtonSpacing->isChecked() != configuration.useNarrowButtonSpacing() ) modified = true;
// shadow configurations
else if( userInterface_->shadowConfigurations[0]->isChecked() != configuration.useOxygenShadows() ) modified = true;
else if( userInterface_->shadowConfigurations[1]->isChecked() != configuration.useDropShadows() ) modified = true;
else if( shadowConfigurationChanged( ShadowConfiguration( QPalette::Active, KConfigGroup( configuration_, "ActiveShadow") ), *userInterface_->shadowConfigurations[0] ) ) modified = true;
else if( shadowConfigurationChanged( ShadowConfiguration( QPalette::Inactive, KConfigGroup( configuration_, "InactiveShadow") ), *userInterface_->shadowConfigurations[1] ) ) modified = true;
else if( ui->shadowConfigurations[0]->isChecked() != configuration.useOxygenShadows() ) modified = true;
else if( ui->shadowConfigurations[1]->isChecked() != configuration.useDropShadows() ) modified = true;
else if( shadowConfigurationChanged( ShadowConfiguration( QPalette::Active, KConfigGroup( _configuration, "ActiveShadow") ), *ui->shadowConfigurations[0] ) ) modified = true;
else if( shadowConfigurationChanged( ShadowConfiguration( QPalette::Inactive, KConfigGroup( _configuration, "InactiveShadow") ), *ui->shadowConfigurations[1] ) ) modified = true;
// exceptions
else if( exceptionListChanged() ) modified = true;
@ -146,37 +146,37 @@ namespace Oxygen
// create configuration from UI
Configuration configuration;
configuration.setTitleAlignment( Configuration::titleAlignment( userInterface_->ui.titleAlignment->currentText(), true ) );
configuration.setCenterTitleOnFullWidth( userInterface_->ui.titleAlignment->currentText() == Configuration::titleAlignmentName( Qt::AlignHCenter, true, true ) );
configuration.setButtonSize( Configuration::buttonSize( userInterface_->ui.buttonSize->currentText(), true ) );
configuration.setBlendColor( Configuration::blendColor( userInterface_->ui.blendColor->currentText(), true ) );
configuration.setFrameBorder( Configuration::frameBorder( userInterface_->ui.frameBorder->currentText(), true ) );
configuration.setSizeGripMode( Configuration::sizeGripMode( userInterface_->ui.sizeGripMode->currentText(), true ) );
configuration.setShadowCacheMode( Configuration::shadowCacheMode( userInterface_->ui.shadowCacheMode->currentText(), true ) );
configuration.setShadowMode( Configuration::shadowMode( userInterface_->ui.shadowMode->currentText(), true ) );
configuration.setSeparatorMode( (Oxygen::Configuration::SeparatorMode) userInterface_->ui.separatorMode->currentIndex() );
configuration.setDrawTitleOutline( userInterface_->ui.titleOutline->isChecked() );
configuration.setUseDropShadows( userInterface_->shadowConfigurations[1]->isChecked() );
configuration.setUseOxygenShadows( userInterface_->shadowConfigurations[0]->isChecked() );
configuration.setTabsEnabled( userInterface_->ui.tabsEnabled->isChecked() );
configuration.setUseAnimations( userInterface_->ui.useAnimations->isChecked() );
configuration.setAnimateTitleChange( userInterface_->ui.animateTitleChange->isChecked() );
configuration.setUseNarrowButtonSpacing( userInterface_->ui.narrowButtonSpacing->isChecked() );
configuration.setTitleAlignment( Configuration::titleAlignment( ui->ui.titleAlignment->currentText(), true ) );
configuration.setCenterTitleOnFullWidth( ui->ui.titleAlignment->currentText() == Configuration::titleAlignmentName( Qt::AlignHCenter, true, true ) );
configuration.setButtonSize( Configuration::buttonSize( ui->ui.buttonSize->currentText(), true ) );
configuration.setBlendColor( Configuration::blendColor( ui->ui.blendColor->currentText(), true ) );
configuration.setFrameBorder( Configuration::frameBorder( ui->ui.frameBorder->currentText(), true ) );
configuration.setSizeGripMode( Configuration::sizeGripMode( ui->ui.sizeGripMode->currentText(), true ) );
configuration.setShadowCacheMode( Configuration::shadowCacheMode( ui->ui.shadowCacheMode->currentText(), true ) );
configuration.setShadowMode( Configuration::shadowMode( ui->ui.shadowMode->currentText(), true ) );
configuration.setSeparatorMode( (Oxygen::Configuration::SeparatorMode) ui->ui.separatorMode->currentIndex() );
configuration.setDrawTitleOutline( ui->ui.titleOutline->isChecked() );
configuration.setUseDropShadows( ui->shadowConfigurations[1]->isChecked() );
configuration.setUseOxygenShadows( ui->shadowConfigurations[0]->isChecked() );
configuration.setTabsEnabled( ui->ui.tabsEnabled->isChecked() );
configuration.setUseAnimations( ui->ui.useAnimations->isChecked() );
configuration.setAnimateTitleChange( ui->ui.animateTitleChange->isChecked() );
configuration.setUseNarrowButtonSpacing( ui->ui.narrowButtonSpacing->isChecked() );
// save standard configuration
KConfigGroup configurationGroup( configuration_, "Windeco");
KConfigGroup configurationGroup( _configuration, "Windeco");
configurationGroup.deleteGroup();
configuration.write( configurationGroup );
// write exceptions
userInterface_->ui.exceptions->exceptions().write( *configuration_ );
ui->ui.exceptions->exceptions().write( *_configuration );
// write shadow configuration
saveShadowConfiguration( QPalette::Active, *userInterface_->shadowConfigurations[0] );
saveShadowConfiguration( QPalette::Inactive, *userInterface_->shadowConfigurations[1] );
saveShadowConfiguration( QPalette::Active, *ui->shadowConfigurations[0] );
saveShadowConfiguration( QPalette::Inactive, *ui->shadowConfigurations[1] );
// sync configuration
configuration_->sync();
_configuration->sync();
QDBusMessage message( QDBusMessage::createSignal("/OxygenWindeco", "org.kde.Oxygen.Style", "reparseConfiguration") );
QDBusConnection::sessionBus().send(message);
@ -199,7 +199,7 @@ namespace Oxygen
configuration.setUseOuterColor( ui.ui.useOuterColor->isChecked() );
// save shadow configuration
KConfigGroup configurationGroup( configuration_, ( (colorGroup == QPalette::Active) ? "ActiveShadow":"InactiveShadow" ) );
KConfigGroup configurationGroup( _configuration, ( (colorGroup == QPalette::Active) ? "ActiveShadow":"InactiveShadow" ) );
configurationGroup.deleteGroup();
configuration.write( configurationGroup );
@ -217,7 +217,7 @@ namespace Oxygen
loadShadowConfiguration( QPalette::Inactive, ShadowConfiguration( QPalette::Inactive ) );
// install default exceptions
userInterface_->ui.exceptions->setExceptions( ExceptionList::defaultList() );
ui->ui.exceptions->setExceptions( ExceptionList::defaultList() );
updateChanged();
@ -227,29 +227,29 @@ namespace Oxygen
void Config::loadConfiguration( const Configuration& configuration )
{
userInterface_->ui.titleAlignment->setCurrentIndex( userInterface_->ui.titleAlignment->findText( configuration.titleAlignmentName( true ) ) );
userInterface_->ui.buttonSize->setCurrentIndex( userInterface_->ui.buttonSize->findText( configuration.buttonSizeName( true ) ) );
userInterface_->ui.blendColor->setCurrentIndex( userInterface_->ui.blendColor->findText( configuration.blendColorName( true ) ) );
userInterface_->ui.frameBorder->setCurrentIndex( userInterface_->ui.frameBorder->findText( configuration.frameBorderName( true ) ) );
userInterface_->ui.sizeGripMode->setCurrentIndex( userInterface_->ui.sizeGripMode->findText( configuration.sizeGripModeName( true ) ) );
ui->ui.titleAlignment->setCurrentIndex( ui->ui.titleAlignment->findText( configuration.titleAlignmentName( true ) ) );
ui->ui.buttonSize->setCurrentIndex( ui->ui.buttonSize->findText( configuration.buttonSizeName( true ) ) );
ui->ui.blendColor->setCurrentIndex( ui->ui.blendColor->findText( configuration.blendColorName( true ) ) );
ui->ui.frameBorder->setCurrentIndex( ui->ui.frameBorder->findText( configuration.frameBorderName( true ) ) );
ui->ui.sizeGripMode->setCurrentIndex( ui->ui.sizeGripMode->findText( configuration.sizeGripModeName( true ) ) );
userInterface_->ui.separatorMode->setCurrentIndex( configuration.separatorMode() );
userInterface_->ui.titleOutline->setChecked( configuration.drawTitleOutline() );
userInterface_->shadowConfigurations[0]->setChecked( configuration.useOxygenShadows() );
userInterface_->shadowConfigurations[1]->setChecked( configuration.useDropShadows() );
userInterface_->ui.tabsEnabled->setChecked( configuration.tabsEnabled() );
userInterface_->ui.useAnimations->setChecked( configuration.useAnimations() );
userInterface_->ui.animateTitleChange->setChecked( configuration.animateTitleChange() );
userInterface_->ui.narrowButtonSpacing->setChecked( configuration.useNarrowButtonSpacing() );
userInterface_->ui.shadowMode->setCurrentIndex( userInterface_->ui.shadowMode->findText( configuration.shadowModeName( true ) ) );
userInterface_->ui.shadowCacheMode->setCurrentIndex( userInterface_->ui.shadowCacheMode->findText( configuration.shadowCacheModeName( true ) ) );
ui->ui.separatorMode->setCurrentIndex( configuration.separatorMode() );
ui->ui.titleOutline->setChecked( configuration.drawTitleOutline() );
ui->shadowConfigurations[0]->setChecked( configuration.useOxygenShadows() );
ui->shadowConfigurations[1]->setChecked( configuration.useDropShadows() );
ui->ui.tabsEnabled->setChecked( configuration.tabsEnabled() );
ui->ui.useAnimations->setChecked( configuration.useAnimations() );
ui->ui.animateTitleChange->setChecked( configuration.animateTitleChange() );
ui->ui.narrowButtonSpacing->setChecked( configuration.useNarrowButtonSpacing() );
ui->ui.shadowMode->setCurrentIndex( ui->ui.shadowMode->findText( configuration.shadowModeName( true ) ) );
ui->ui.shadowCacheMode->setCurrentIndex( ui->ui.shadowCacheMode->findText( configuration.shadowCacheModeName( true ) ) );
}
//_______________________________________________________________________
void Config::loadShadowConfiguration( QPalette::ColorGroup colorGroup, const ShadowConfiguration& configuration )
{
assert( colorGroup == QPalette::Active || colorGroup == QPalette::Inactive );
ShadowConfigurationUi* ui = userInterface_->shadowConfigurations[ (colorGroup == QPalette::Active) ? 0:1 ];
ShadowConfigurationUi* ui = this->ui->shadowConfigurations[ (colorGroup == QPalette::Active) ? 0:1 ];
ui->ui.shadowSize->setValue( configuration.shadowSize() );
ui->ui.verticalOffset->setValue( 10*configuration.verticalOffset() );
ui->ui.innerColor->setColor( configuration.innerColor() );
@ -276,12 +276,12 @@ namespace Oxygen
// get saved list
ExceptionList exceptions;
exceptions.read( *configuration_ );
exceptions.read( *_configuration );
if( exceptions.empty() )
{ exceptions = ExceptionList::defaultList(); }
// compare to current
return exceptions != userInterface_->ui.exceptions->exceptions();
return exceptions != ui->ui.exceptions->exceptions();
}

View file

@ -100,10 +100,10 @@ namespace Oxygen {
bool exceptionListChanged( void ) const;
//! user interface
ConfigurationUi *userInterface_;
ConfigurationUi *ui;
//! kconfiguration object
KConfig *configuration_;
KConfig *_configuration;
};

View file

@ -40,7 +40,7 @@ namespace Oxygen
//_________________________________________________________
ConfigurationUi::ConfigurationUi( QWidget* parent ):
QWidget( parent ),
expertMode_( false )
_expertMode( false )
{
ui.setupUi( this );
@ -136,18 +136,18 @@ namespace Oxygen
void ConfigurationUi::toggleExpertMode( bool value )
{
expertMode_ = value;
ui.animateTitleChange->setVisible( expertMode_ );
ui.narrowButtonSpacing->setVisible( expertMode_ );
_expertMode = value;
ui.animateTitleChange->setVisible( _expertMode );
ui.narrowButtonSpacing->setVisible( _expertMode );
// size grip mode
ui.sizeGripModeLabel->setVisible( expertMode_ );
ui.sizeGripMode->setVisible( expertMode_ );
ui.sizeGripModeLabel->setVisible( _expertMode );
ui.sizeGripMode->setVisible( _expertMode );
// shadow mode
ui.shadowsExpertWidget->setVisible( expertMode_ );
ui.shadowsExpertWidget->setVisible( _expertMode );
if( expertMode_ ) ui.shadowSpacer->changeSize(0,0, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
if( _expertMode ) ui.shadowSpacer->changeSize(0,0, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
else ui.shadowSpacer->changeSize(0,0, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
}

View file

@ -71,7 +71,7 @@ namespace Oxygen
private:
//! expert mode
bool expertMode_;
bool _expertMode;
};

View file

@ -49,7 +49,7 @@ namespace Oxygen
//_________________________________________________________
DetectDialog::DetectDialog( QWidget* parent ):
KDialog( parent ),
grabber( 0 )
_grabber( 0 )
{
// define buttons
@ -81,18 +81,18 @@ namespace Oxygen
return;
}
info = KWindowSystem::windowInfo( window, -1U, -1U );
if( !info.valid())
_info = KWindowSystem::windowInfo( window, -1U, -1U );
if( !_info.valid())
{
emit detectionDone( false );
return;
}
QString wmclass_class = info.windowClassClass();
QString wmclass_name = info.windowClassName();
QString title = info.name();
QString wmClassClass = _info.windowClassClass();
QString wmClassName = _info.windowClassName();
QString title = _info.name();
ui.windowClass->setText( wmclass_class + " (" + wmclass_name + ' ' + wmclass_class + ')' );
ui.windowClass->setText( wmClassClass + " (" + wmClassName + ' ' + wmClassClass + ')' );
ui.windowTitle->setText( title );
emit detectionDone( exec() == KDialog::Accepted );
@ -107,12 +107,12 @@ namespace Oxygen
// use a dialog, so that all user input is blocked
// use WX11BypassWM and moving away so that it's not actually visible
// grab only mouse, so that keyboard can be used e.g. for switching windows
grabber = new KDialog( 0, Qt::X11BypassWindowManagerHint );
grabber->move( -1000, -1000 );
grabber->setModal( true );
grabber->show();
grabber->grabMouse( Qt::CrossCursor );
grabber->installEventFilter( this );
_grabber = new KDialog( 0, Qt::X11BypassWindowManagerHint );
_grabber->move( -1000, -1000 );
_grabber->setModal( true );
_grabber->show();
_grabber->grabMouse( Qt::CrossCursor );
_grabber->installEventFilter( this );
}
@ -120,12 +120,12 @@ namespace Oxygen
bool DetectDialog::eventFilter( QObject* o, QEvent* e )
{
// check object and event type
if( o != grabber ) return false;
if( o != _grabber ) return false;
if( e->type() != QEvent::MouseButtonRelease ) return false;
// delete old grabber
delete grabber;
grabber = 0;
// delete old _grabber
delete _grabber;
_grabber = 0;
// check button
if( static_cast< QMouseEvent* >( e )->button() != Qt::LeftButton ) return true;

View file

@ -63,7 +63,7 @@ namespace Oxygen
//! window information
const KWindowInfo& windowInfo() const
{ return info; }
{ return _info; }
//! exception type
Exception::Type exceptionType() const
@ -102,10 +102,10 @@ namespace Oxygen
Ui_DetectWidget ui;
//! invisible dialog used to grab mouse
KDialog* grabber;
KDialog* _grabber;
//! current window information
KWindowInfo info;
KWindowInfo _info;
};

View file

@ -36,7 +36,7 @@ namespace Oxygen
//___________________________________________
ExceptionDialog::ExceptionDialog( QWidget* parent ):
KDialog( parent ),
detectDialog(0)
_detectDialog(0)
{
// define buttons
@ -66,7 +66,7 @@ namespace Oxygen
<< Configuration::frameBorderName( Configuration::BorderOversized, true )
);
ui.frameBorderComboBox->setEnabled( false );
checkboxes_.insert( std::make_pair( Exception::FrameBorder, ui.frameBorderCheckBox ) );
_checkBoxes.insert( std::make_pair( Exception::FrameBorder, ui.frameBorderCheckBox ) );
connect( ui.frameBorderCheckBox, SIGNAL( toggled( bool ) ), ui.frameBorderComboBox, SLOT( setEnabled( bool ) ) );
// blend color
@ -76,7 +76,7 @@ namespace Oxygen
<< Exception::blendColorName( Exception::BlendFromStyle, true )
);
ui.blendColorComboBox->setEnabled( false );
checkboxes_.insert( std::make_pair( Exception::BlendColor, ui.blendColorCheckBox ) );
_checkBoxes.insert( std::make_pair( Exception::BlendColor, ui.blendColorCheckBox ) );
connect( ui.blendColorCheckBox, SIGNAL( toggled( bool ) ), ui.blendColorComboBox, SLOT( setEnabled( bool ) ) );
// size grip
@ -85,18 +85,18 @@ namespace Oxygen
<< Configuration::sizeGripModeName( Configuration::SizeGripWhenNeeded, true )
);
ui.sizeGripComboBox->setEnabled( false );
checkboxes_.insert( std::make_pair( Exception::SizeGripMode, ui.sizeGripCheckBox ) );
_checkBoxes.insert( std::make_pair( Exception::SizeGripMode, ui.sizeGripCheckBox ) );
connect( ui.sizeGripCheckBox, SIGNAL( toggled( bool ) ), ui.sizeGripComboBox, SLOT( setEnabled( bool ) ) );
// outline active window title
ui.titleOutlineComboBox->insertItems(0, QStringList() << i18nc( "outline window title", "Enabled" ) << i18nc( "outline window title", "Disabled" ) );
ui.titleOutlineComboBox->setEnabled( false );
checkboxes_.insert( std::make_pair( Exception::TitleOutline, ui.titleOutlineCheckBox ) );
_checkBoxes.insert( std::make_pair( Exception::TitleOutline, ui.titleOutlineCheckBox ) );
connect( ui.titleOutlineCheckBox, SIGNAL( toggled( bool ) ), ui.titleOutlineComboBox, SLOT( setEnabled( bool ) ) );
// separator
ui.separatorComboBox->setEnabled( false );
checkboxes_.insert( std::make_pair( Exception::DrawSeparator, ui.separatorCheckBox ) );
_checkBoxes.insert( std::make_pair( Exception::DrawSeparator, ui.separatorCheckBox ) );
connect( ui.separatorCheckBox, SIGNAL( toggled( bool ) ), ui.separatorComboBox, SLOT( setEnabled( bool ) ) );
}
@ -106,7 +106,7 @@ namespace Oxygen
{
// store exception internally
exception_ = exception;
_exception = exception;
// type
ui.exceptionType->setCurrentIndex( ui.exceptionType->findText( exception.typeName( true ) ) );
@ -119,7 +119,7 @@ namespace Oxygen
ui.hideTitleBar->setChecked( exception.hideTitleBar() );
// mask
for( CheckBoxMap::iterator iter = checkboxes_.begin(); iter != checkboxes_.end(); ++iter )
for( CheckBoxMap::iterator iter = _checkBoxes.begin(); iter != _checkBoxes.end(); ++iter )
{ iter->second->setChecked( exception.mask() & iter->first ); }
}
@ -127,7 +127,7 @@ namespace Oxygen
//___________________________________________
Exception ExceptionDialog::exception( void ) const
{
Exception exception( exception_ );
Exception exception( _exception );
exception.setType( Exception::type( ui.exceptionType->currentText(), true ) );
exception.regExp().setPattern( ui.exceptionEditor->text() );
exception.setFrameBorder( Exception::frameBorder( ui.frameBorderComboBox->currentText(), true ) );
@ -148,7 +148,7 @@ namespace Oxygen
// mask
unsigned int mask = Exception::None;
for( CheckBoxMap::const_iterator iter = checkboxes_.begin(); iter != checkboxes_.end(); ++iter )
for( CheckBoxMap::const_iterator iter = _checkBoxes.begin(); iter != _checkBoxes.end(); ++iter )
{ if( iter->second->isChecked() ) mask |= iter->first; }
exception.setMask( mask );
@ -161,30 +161,30 @@ namespace Oxygen
{
// create widget
if( !detectDialog )
if( !_detectDialog )
{
detectDialog = new DetectDialog( this );
connect( detectDialog, SIGNAL( detectionDone( bool ) ), SLOT( readWindowProperties( bool ) ) );
_detectDialog = new DetectDialog( this );
connect( _detectDialog, SIGNAL( detectionDone( bool ) ), SLOT( readWindowProperties( bool ) ) );
}
detectDialog->detect(0);
_detectDialog->detect(0);
}
//___________________________________________
void ExceptionDialog::readWindowProperties( bool valid )
{
assert( detectDialog );
assert( _detectDialog );
if( valid )
{
// type
ui.exceptionType->setCurrentIndex( ui.exceptionType->findText( Exception::typeName( detectDialog->exceptionType(), true ) ) );
ui.exceptionType->setCurrentIndex( ui.exceptionType->findText( Exception::typeName( _detectDialog->exceptionType(), true ) ) );
// window info
const KWindowInfo& info( detectDialog->windowInfo() );
const KWindowInfo& info( _detectDialog->windowInfo() );
switch( detectDialog->exceptionType() )
switch( _detectDialog->exceptionType() )
{
case Exception::WindowClassName:
ui.exceptionEditor->setText( info.windowClassClass() );
@ -200,8 +200,8 @@ namespace Oxygen
}
delete detectDialog;
detectDialog = 0;
delete _detectDialog;
_detectDialog = 0;
}

View file

@ -71,13 +71,13 @@ namespace Oxygen
typedef std::map< Exception::AttributesMask, QCheckBox*> CheckBoxMap;
//! map mask and checkbox
CheckBoxMap checkboxes_;
CheckBoxMap _checkBoxes;
//! internal exception
Exception exception_;
Exception _exception;
//! detection dialog
DetectDialog* detectDialog;
DetectDialog* _detectDialog;
};

View file

@ -36,9 +36,9 @@ namespace Oxygen
{
//__________________________________________________________
ExceptionListWidget::ExceptionListWidget( QWidget* parent, Configuration default_configuration ):
ExceptionListWidget::ExceptionListWidget( QWidget* parent, Configuration defaultConfiguration ):
QWidget( parent ),
default_configuration_( default_configuration )
_defaultConfiguration( defaultConfiguration )
{
//! ui
@ -48,7 +48,7 @@ namespace Oxygen
ui.exceptionListView->setAllColumnsShowFocus( true );
ui.exceptionListView->setRootIsDecorated( false );
ui.exceptionListView->setSortingEnabled( false );
ui.exceptionListView->setModel( &_model() );
ui.exceptionListView->setModel( &model() );
ui.exceptionListView->sortByColumn( ExceptionModel::TYPE );
ui.exceptionListView->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Ignored ) );
@ -59,18 +59,18 @@ namespace Oxygen
ui.removeButton->setIcon( KIcon( "list-remove", icon_loader ) );
ui.editButton->setIcon( KIcon( "edit-rename", icon_loader ) );
connect( ui.addButton, SIGNAL( clicked() ), SLOT( _add() ) );
connect( ui.editButton, SIGNAL( clicked() ), SLOT( _edit() ) );
connect( ui.removeButton, SIGNAL( clicked() ), SLOT( _remove() ) );
connect( ui.moveUpButton, SIGNAL( clicked() ), SLOT( _up() ) );
connect( ui.moveDownButton, SIGNAL( clicked() ), SLOT( _down() ) );
connect( ui.addButton, SIGNAL( clicked() ), SLOT( add() ) );
connect( ui.editButton, SIGNAL( clicked() ), SLOT( edit() ) );
connect( ui.removeButton, SIGNAL( clicked() ), SLOT( remove() ) );
connect( ui.moveUpButton, SIGNAL( clicked() ), SLOT( up() ) );
connect( ui.moveDownButton, SIGNAL( clicked() ), SLOT( down() ) );
connect( ui.exceptionListView, SIGNAL( activated( const QModelIndex& ) ), SLOT( _edit() ) );
connect( ui.exceptionListView, SIGNAL( clicked( const QModelIndex& ) ), SLOT( _toggle( const QModelIndex& ) ) );
connect( ui.exceptionListView->selectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), SLOT( _updateButtons() ) );
connect( ui.exceptionListView, SIGNAL( activated( const QModelIndex& ) ), SLOT( edit() ) );
connect( ui.exceptionListView, SIGNAL( clicked( const QModelIndex& ) ), SLOT( toggle( const QModelIndex& ) ) );
connect( ui.exceptionListView->selectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), SLOT( updateButtons() ) );
_updateButtons();
_resizeColumns();
updateButtons();
resizeColumns();
}
@ -78,15 +78,15 @@ namespace Oxygen
//__________________________________________________________
void ExceptionListWidget::setExceptions( const ExceptionList& exceptions )
{
_model().set( ExceptionModel::List( exceptions.begin(), exceptions.end() ) );
_resizeColumns();
model().set( ExceptionModel::List( exceptions.begin(), exceptions.end() ) );
resizeColumns();
}
//__________________________________________________________
ExceptionList ExceptionListWidget::exceptions( void ) const
{
ExceptionModel::List exceptions( _model().get() );
ExceptionModel::List exceptions( model().get() );
ExceptionList out;
for( ExceptionModel::List::const_iterator iter = exceptions.begin(); iter != exceptions.end(); ++iter )
{ out.push_back( *iter ); }
@ -95,58 +95,58 @@ namespace Oxygen
}
//__________________________________________________________
void ExceptionListWidget::_updateButtons( void )
void ExceptionListWidget::updateButtons( void )
{
bool has_selection( !ui.exceptionListView->selectionModel()->selectedRows().empty() );
ui.removeButton->setEnabled( has_selection );
ui.editButton->setEnabled( has_selection );
bool hasSelection( !ui.exceptionListView->selectionModel()->selectedRows().empty() );
ui.removeButton->setEnabled( hasSelection );
ui.editButton->setEnabled( hasSelection );
ui.moveUpButton->setEnabled( has_selection && !ui.exceptionListView->selectionModel()->isRowSelected( 0, QModelIndex() ) );
ui.moveDownButton->setEnabled( has_selection && !ui.exceptionListView->selectionModel()->isRowSelected( _model().rowCount()-1, QModelIndex() ) );
ui.moveUpButton->setEnabled( hasSelection && !ui.exceptionListView->selectionModel()->isRowSelected( 0, QModelIndex() ) );
ui.moveDownButton->setEnabled( hasSelection && !ui.exceptionListView->selectionModel()->isRowSelected( model().rowCount()-1, QModelIndex() ) );
}
//_______________________________________________________
void ExceptionListWidget::_add( void )
void ExceptionListWidget::add( void )
{
// map dialog
QSharedPointer<ExceptionDialog> dialog( new ExceptionDialog( this ) );
dialog->setException( default_configuration_ );
dialog->setException( _defaultConfiguration );
if( dialog->exec() == QDialog::Rejected ) return;
// retrieve exception and check
Exception exception( dialog->exception() );
if( !_checkException( exception ) ) return;
if( !checkException( exception ) ) return;
// create new item
_model().add( exception );
model().add( exception );
// make sure item is selected
QModelIndex index( _model().index( exception ) );
QModelIndex index( model().index( exception ) );
if( index != ui.exceptionListView->selectionModel()->currentIndex() )
{
ui.exceptionListView->selectionModel()->select( index, QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows );
ui.exceptionListView->selectionModel()->setCurrentIndex( index, QItemSelectionModel::Current|QItemSelectionModel::Rows );
}
_resizeColumns();
resizeColumns();
emit changed();
return;
}
//_______________________________________________________
void ExceptionListWidget::_edit( void )
void ExceptionListWidget::edit( void )
{
// retrieve selection
QModelIndex current( ui.exceptionListView->selectionModel()->currentIndex() );
if( !current.isValid() ) return;
Exception& exception( _model().get( current ) );
Exception& exception( model().get( current ) );
// create dialog
QSharedPointer<ExceptionDialog> dialog( new ExceptionDialog( this ) );
@ -154,48 +154,48 @@ namespace Oxygen
// map dialog
if( dialog->exec() == QDialog::Rejected ) return;
Exception new_exception = dialog->exception();
Exception newException = dialog->exception();
// check if exception was changed
if( exception == new_exception ) return;
if( exception == newException ) return;
// check new exception validity
if( !_checkException( new_exception ) ) return;
if( !checkException( newException ) ) return;
// asign new exception
*&exception = new_exception;
_resizeColumns();
*&exception = newException;
resizeColumns();
emit changed();
return;
}
//_______________________________________________________
void ExceptionListWidget::_remove( void )
void ExceptionListWidget::remove( void )
{
// should use a konfirmation dialog
if( KMessageBox::questionYesNo( this, i18n("Remove selected exception?") ) == KMessageBox::No ) return;
// remove
_model().remove( _model().get( ui.exceptionListView->selectionModel()->selectedRows() ) );
_resizeColumns();
model().remove( model().get( ui.exceptionListView->selectionModel()->selectedRows() ) );
resizeColumns();
emit changed();
return;
}
//_______________________________________________________
void ExceptionListWidget::_toggle( const QModelIndex& index )
void ExceptionListWidget::toggle( const QModelIndex& index )
{
if( !index.isValid() ) return;
if( index.column() != ExceptionModel::ENABLED ) return;
// get matching exception
Exception& exception( _model().get( index ) );
Exception& exception( model().get( index ) );
exception.setEnabled( !exception.enabled() );
_model().add( exception );
model().add( exception );
emit changed();
return;
@ -203,44 +203,44 @@ namespace Oxygen
}
//_______________________________________________________
void ExceptionListWidget::_up( void )
void ExceptionListWidget::up( void )
{
ExceptionModel::List selection( _model().get( ui.exceptionListView->selectionModel()->selectedRows() ) );
ExceptionModel::List selection( model().get( ui.exceptionListView->selectionModel()->selectedRows() ) );
if( selection.empty() ) { return; }
// retrieve selected indexes in list and store in model
QModelIndexList selected_indexes( ui.exceptionListView->selectionModel()->selectedRows() );
ExceptionModel::List selected_exceptions( _model().get( selected_indexes ) );
QModelIndexList selectedIndices( ui.exceptionListView->selectionModel()->selectedRows() );
ExceptionModel::List selectedExceptions( model().get( selectedIndices ) );
ExceptionModel::List current_exceptions( _model().get() );
ExceptionModel::List new_exceptions;
ExceptionModel::List currentException( model().get() );
ExceptionModel::List newExceptions;
for( ExceptionModel::List::const_iterator iter = current_exceptions.begin(); iter != current_exceptions.end(); ++iter )
for( ExceptionModel::List::const_iterator iter = currentException.begin(); iter != currentException.end(); ++iter )
{
// check if new list is not empty, current index is selected and last index is not.
// if yes, move.
if(
!( new_exceptions.empty() ||
selected_indexes.indexOf( _model().index( *iter ) ) == -1 ||
selected_indexes.indexOf( _model().index( new_exceptions.back() ) ) != -1
!( newExceptions.empty() ||
selectedIndices.indexOf( model().index( *iter ) ) == -1 ||
selectedIndices.indexOf( model().index( newExceptions.back() ) ) != -1
) )
{
Exception last( new_exceptions.back() );
new_exceptions.pop_back();
new_exceptions.push_back( *iter );
new_exceptions.push_back( last );
} else new_exceptions.push_back( *iter );
Exception last( newExceptions.back() );
newExceptions.pop_back();
newExceptions.push_back( *iter );
newExceptions.push_back( last );
} else newExceptions.push_back( *iter );
}
_model().set( new_exceptions );
model().set( newExceptions );
// restore selection
ui.exceptionListView->selectionModel()->select( _model().index( selected_exceptions.front() ), QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows );
for( ExceptionModel::List::const_iterator iter = selected_exceptions.begin(); iter != selected_exceptions.end(); ++iter )
{ ui.exceptionListView->selectionModel()->select( _model().index( *iter ), QItemSelectionModel::Select|QItemSelectionModel::Rows ); }
ui.exceptionListView->selectionModel()->select( model().index( selectedExceptions.front() ), QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows );
for( ExceptionModel::List::const_iterator iter = selectedExceptions.begin(); iter != selectedExceptions.end(); ++iter )
{ ui.exceptionListView->selectionModel()->select( model().index( *iter ), QItemSelectionModel::Select|QItemSelectionModel::Rows ); }
emit changed();
return;
@ -248,46 +248,46 @@ namespace Oxygen
}
//_______________________________________________________
void ExceptionListWidget::_down( void )
void ExceptionListWidget::down( void )
{
ExceptionModel::List selection( _model().get( ui.exceptionListView->selectionModel()->selectedRows() ) );
ExceptionModel::List selection( model().get( ui.exceptionListView->selectionModel()->selectedRows() ) );
if( selection.empty() )
{ return; }
// retrieve selected indexes in list and store in model
QModelIndexList selected_indexes( ui.exceptionListView->selectionModel()->selectedIndexes() );
ExceptionModel::List selected_exceptions( _model().get( selected_indexes ) );
QModelIndexList selectedIndices( ui.exceptionListView->selectionModel()->selectedIndexes() );
ExceptionModel::List selectedExceptions( model().get( selectedIndices ) );
ExceptionModel::List current_exceptions( _model().get() );
ExceptionModel::List new_exceptions;
ExceptionModel::List currentException( model().get() );
ExceptionModel::List newExceptions;
for( ExceptionModel::List::reverse_iterator iter = current_exceptions.rbegin(); iter != current_exceptions.rend(); ++iter )
for( ExceptionModel::List::reverse_iterator iter = currentException.rbegin(); iter != currentException.rend(); ++iter )
{
// check if new list is not empty, current index is selected and last index is not.
// if yes, move.
if(
!( new_exceptions.empty() ||
selected_indexes.indexOf( _model().index( *iter ) ) == -1 ||
selected_indexes.indexOf( _model().index( new_exceptions.back() ) ) != -1
!( newExceptions.empty() ||
selectedIndices.indexOf( model().index( *iter ) ) == -1 ||
selectedIndices.indexOf( model().index( newExceptions.back() ) ) != -1
) )
{
Exception last( new_exceptions.back() );
new_exceptions.pop_back();
new_exceptions.push_back( *iter );
new_exceptions.push_back( last );
Exception last( newExceptions.back() );
newExceptions.pop_back();
newExceptions.push_back( *iter );
newExceptions.push_back( last );
} else new_exceptions.push_back( *iter );
} else newExceptions.push_back( *iter );
}
_model().set( ExceptionModel::List( new_exceptions.rbegin(), new_exceptions.rend() ) );
model().set( ExceptionModel::List( newExceptions.rbegin(), newExceptions.rend() ) );
// restore selection
ui.exceptionListView->selectionModel()->select( _model().index( selected_exceptions.front() ), QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows );
for( ExceptionModel::List::const_iterator iter = selected_exceptions.begin(); iter != selected_exceptions.end(); ++iter )
{ ui.exceptionListView->selectionModel()->select( _model().index( *iter ), QItemSelectionModel::Select|QItemSelectionModel::Rows ); }
ui.exceptionListView->selectionModel()->select( model().index( selectedExceptions.front() ), QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows );
for( ExceptionModel::List::const_iterator iter = selectedExceptions.begin(); iter != selectedExceptions.end(); ++iter )
{ ui.exceptionListView->selectionModel()->select( model().index( *iter ), QItemSelectionModel::Select|QItemSelectionModel::Rows ); }
emit changed();
return;
@ -295,7 +295,7 @@ namespace Oxygen
}
//_______________________________________________________
void ExceptionListWidget::_resizeColumns( void ) const
void ExceptionListWidget::resizeColumns( void ) const
{
ui.exceptionListView->resizeColumnToContents( ExceptionModel::ENABLED );
ui.exceptionListView->resizeColumnToContents( ExceptionModel::TYPE );
@ -303,7 +303,7 @@ namespace Oxygen
}
//_______________________________________________________
bool ExceptionListWidget::_checkException( Exception& exception )
bool ExceptionListWidget::checkException( Exception& exception )
{
while( !exception.regExp().isValid() )

View file

@ -42,7 +42,7 @@ namespace Oxygen
public:
//! constructor
explicit ExceptionListWidget( QWidget* = 0, Configuration default_configuration = Configuration() );
explicit ExceptionListWidget( QWidget* = 0, Configuration defaultConfiguration = Configuration() );
//! set exceptions
void setExceptions( const ExceptionList& );
@ -58,49 +58,49 @@ namespace Oxygen
protected:
//! model
const ExceptionModel& _model() const
{ return model_; }
const ExceptionModel& model() const
{ return _model; }
//! model
ExceptionModel& _model()
{ return model_; }
ExceptionModel& model()
{ return _model; }
protected slots:
//! update button states
virtual void _updateButtons( void );
virtual void updateButtons( void );
//! add
virtual void _add( void );
virtual void add( void );
//! edit
virtual void _edit( void );
virtual void edit( void );
//! remove
virtual void _remove( void );
virtual void remove( void );
//! toggle
virtual void _toggle( const QModelIndex& );
virtual void toggle( const QModelIndex& );
//! move up
virtual void _up( void );
virtual void up( void );
//! move down
virtual void _down( void );
virtual void down( void );
private:
//! resize columns
void _resizeColumns( void ) const;
void resizeColumns( void ) const;
//! check exception
bool _checkException( Exception& );
bool checkException( Exception& );
//! default configuration
Configuration default_configuration_;
Configuration _defaultConfiguration;
//! model
ExceptionModel model_;
ExceptionModel _model;
//! ui
Ui_OxygenExceptionListWidget ui;