1
#ifndef oxygenexception_h
2
#define oxygenexception_h
4
//////////////////////////////////////////////////////////////////////////////
6
// window decoration exception
9
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
11
// Permission is hereby granted, free of charge, to any person obtaining a copy
12
// of this software and associated documentation files (the "Software"), to
13
// deal in the Software without restriction, including without limitation the
14
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
15
// sell copies of the Software, and to permit persons to whom the Software is
16
// furnished to do so, subject to the following conditions:
18
// The above copyright notice and this permission notice shall be included in
19
// all copies or substantial portions of the Software.
21
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
28
//////////////////////////////////////////////////////////////////////////////
30
#include <QtCore/QRegExp>
31
#include "oxygenconfiguration.h"
34
namespace OxygenConfig
37
//! needed for exceptions
38
static const QString TYPE = "Type";
39
static const QString PATTERN = "Pattern";
40
static const QString ENABLED = "Enabled";
41
static const QString MASK = "Mask";
49
class Exception: public Configuration
63
TitleAlignment = 1<<0,
69
All = TitleAlignment|DrawSeparator|TitleOutline|FrameBorder|BlendColor|SizeGripMode
73
Exception( Configuration configuration = Configuration() ):
74
Configuration( configuration ),
76
_type( WindowClassName ),
81
Exception( KConfigGroup );
84
virtual ~Exception( void )
88
bool operator == (const Exception& exception ) const
91
enabled() == exception.enabled() &&
92
type() == exception.type() &&
93
regExp().pattern() == exception.regExp().pattern() &&
94
mask() == exception.mask() &&
95
Configuration::operator == ( exception );
98
//! less than operator
99
bool operator < (const Exception& exception ) const
101
if( enabled() != exception.enabled() ) return enabled() < exception.enabled();
102
else if( mask() != exception.mask() ) return mask() < exception.mask();
103
else if( type() != exception.type() ) return type() < exception.type();
104
else return regExp().pattern() < exception.regExp().pattern();
107
//! write to kconfig group
108
virtual void write( KConfigGroup& ) const;
113
bool enabled( void ) const
116
void setEnabled( bool enabled )
117
{ _enabled = enabled; }
121
//!@name exception type
124
static QString typeName( Type, bool );
125
static Type type( const QString& name, bool );
127
virtual QString typeName( bool translated ) const
128
{ return typeName( type(), translated ); }
130
virtual Type type( void ) const
133
virtual void setType( Type value )
138
//!@name regular expression
141
virtual QRegExp regExp( void ) const
144
virtual QRegExp& regExp( void )
153
unsigned int mask( void ) const
156
void setMask( unsigned int mask )
169
//! regular expression to match window caption