<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <title>kwin Library: ruleswidget.cpp Source File (kwin Library)</title> <link href="../../common/doxygen.css" rel="stylesheet" type="text/css"> </head> <div class="header"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td rowspan="2" width="92"> <a href="../../index.html" title="The API documentation main page"><img src="../../common/docheadergears.png" style="border:0px;" alt=""></a> </td> <td width="95%"> <h1>kwin Library API Documentation</h1> </td> </tr> <tr> <td valign="bottom"> <table class="links" border=0 cellspacing=0> <tr> <td><a href="index.html">Overview</a></td> <td><a href="hierarchy.html" title="Inheritance list, sorted roughly alphabetically">Class Hierarchy</a></td> <td><a href="classes.html" title="Alphabetical list of classes">Classes</a></td> <td><a href="annotated.html" title="Classes, structs, unions and interfaces with brief descriptions">Classes (annotated)</a></td> <td><a href="functions.html" title="Documented class members with links to the classes they belong to">Members</a></td> <td><a href="namespaces.html" title="All documented namespaces with brief descriptions">Namespaces</a></td> <td><a href="files.html" title="A list of all documented files with brief descriptions">Source Files</a></td> </tr> </table> </td></tr></table> </div> <div id="hgrad"></div> <div class="text"> <!-- Generated by Doxygen 1.4.4 --> <div class="nav"> <a class="el" href="dir_000003.html">kcmkwin</a> » <a class="el" href="dir_000016.html">kwinrules</a></div> <h1>ruleswidget.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> * Copyright (c) 2004 Lubos Lunak <l.lunak@kde.org></span> <a name="l00003"></a>00003 <span class="comment"> *</span> <a name="l00004"></a>00004 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span> <a name="l00005"></a>00005 <span class="comment"> * it under the terms of the GNU General Public License as published by</span> <a name="l00006"></a>00006 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span> <a name="l00007"></a>00007 <span class="comment"> * (at your option) any later version.</span> <a name="l00008"></a>00008 <span class="comment"> *</span> <a name="l00009"></a>00009 <span class="comment"> * This program is distributed in the hope that it will be useful,</span> <a name="l00010"></a>00010 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00011"></a>00011 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> <a name="l00012"></a>00012 <span class="comment"> * GNU General Public License for more details.</span> <a name="l00013"></a>00013 <span class="comment"> *</span> <a name="l00014"></a>00014 <span class="comment"> * You should have received a copy of the GNU General Public License</span> <a name="l00015"></a>00015 <span class="comment"> * along with this program; if not, write to the Free Software</span> <a name="l00016"></a>00016 <span class="comment"> * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span> <a name="l00017"></a>00017 <span class="comment"> */</span> <a name="l00018"></a>00018 <a name="l00019"></a>00019 <span class="preprocessor">#include "ruleswidget.h"</span> <a name="l00020"></a>00020 <a name="l00021"></a>00021 <span class="preprocessor">#include <klineedit.h></span> <a name="l00022"></a>00022 <span class="preprocessor">#include <krestrictedline.h></span> <a name="l00023"></a>00023 <span class="preprocessor">#include <kcombobox.h></span> <a name="l00024"></a>00024 <span class="preprocessor">#include <qcheckbox.h></span> <a name="l00025"></a>00025 <span class="preprocessor">#include <kpushbutton.h></span> <a name="l00026"></a>00026 <span class="preprocessor">#include <qlabel.h></span> <a name="l00027"></a>00027 <span class="preprocessor">#include <kwinmodule.h></span> <a name="l00028"></a>00028 <span class="preprocessor">#include <klocale.h></span> <a name="l00029"></a>00029 <span class="preprocessor">#include <qregexp.h></span> <a name="l00030"></a>00030 <span class="preprocessor">#include <qwhatsthis.h></span> <a name="l00031"></a>00031 <span class="preprocessor">#include <assert.h></span> <a name="l00032"></a>00032 <span class="preprocessor">#include <kmessagebox.h></span> <a name="l00033"></a>00033 <span class="preprocessor">#include <qtabwidget.h></span> <a name="l00034"></a>00034 <a name="l00035"></a>00035 <span class="preprocessor">#include "../../rules.h"</span> <a name="l00036"></a>00036 <a name="l00037"></a>00037 <span class="preprocessor">#include "detectwidget.h"</span> <a name="l00038"></a>00038 <a name="l00039"></a>00039 <span class="keyword">namespace </span>KWinInternal <a name="l00040"></a>00040 { <a name="l00041"></a>00041 <a name="l00042"></a>00042 <span class="preprocessor">#define SETUP( var, type ) \</span> <a name="l00043"></a>00043 <span class="preprocessor"> connect( enable_##var, SIGNAL( toggled( bool )), rule_##var, SLOT( setEnabled( bool ))); \</span> <a name="l00044"></a>00044 <span class="preprocessor"> connect( enable_##var, SIGNAL( toggled( bool )), this, SLOT( updateEnable##var())); \</span> <a name="l00045"></a>00045 <span class="preprocessor"> connect( rule_##var, SIGNAL( activated( int )), this, SLOT( updateEnable##var())); \</span> <a name="l00046"></a>00046 <span class="preprocessor"> QWhatsThis::add( enable_##var, enableDesc ); \</span> <a name="l00047"></a>00047 <span class="preprocessor"> QWhatsThis::add( rule_##var, type##RuleDesc );</span> <a name="l00048"></a>00048 <span class="preprocessor"></span> <a name="l00049"></a><a class="code" href="classKWinInternal_1_1RulesWidget.html#a0">00049</a> <a class="code" href="classKWinInternal_1_1RulesWidget.html#a0">RulesWidget::RulesWidget</a>( QWidget* parent, <span class="keyword">const</span> <span class="keywordtype">char</span>* name ) <a name="l00050"></a>00050 : <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html">RulesWidgetBase</a>( parent, name ) <a name="l00051"></a>00051 , detect_dlg( NULL ) <a name="l00052"></a>00052 { <a name="l00053"></a>00053 QString enableDesc = <a name="l00054"></a>00054 i18n( <span class="stringliteral">"Enable this checkbox to alter this window property for the specified window(s)."</span> ); <a name="l00055"></a>00055 QString setRuleDesc = <a name="l00056"></a>00056 i18n( <span class="stringliteral">"Specify how the window property should be affected:<ul>"</span> <a name="l00057"></a>00057 <span class="stringliteral">"<li><em>Do Not Affect:</em> The window property will not be affected and therefore"</span> <a name="l00058"></a>00058 <span class="stringliteral">" the default handling for it will be used. Specifying this will block more generic"</span> <a name="l00059"></a>00059 <span class="stringliteral">" window settings from taking effect.</li>"</span> <a name="l00060"></a>00060 <span class="stringliteral">"<li><em>Apply Initially:</em> The window property will be only set to the given value"</span> <a name="l00061"></a>00061 <span class="stringliteral">" after the window is created. No further changes will be affected.</li>"</span> <a name="l00062"></a>00062 <span class="stringliteral">"<li><em>Remember:</em> The value of the window property will be remembered and every time"</span> <a name="l00063"></a>00063 <span class="stringliteral">" time the window is created, the last remembered value will be applied.</li>"</span> <a name="l00064"></a>00064 <span class="stringliteral">"<li><em>Force:</em> The window property will be always forced to the given value.</li></ul>"</span> ); <a name="l00065"></a>00065 QString forceRuleDesc = <a name="l00066"></a>00066 i18n( <span class="stringliteral">"Specify how the window property should be affected:<ul>"</span> <a name="l00067"></a>00067 <span class="stringliteral">"<li><em>Do Not Affect:</em> The window property will not be affected and therefore"</span> <a name="l00068"></a>00068 <span class="stringliteral">" the default handling for it will be used. Specifying this will block more generic"</span> <a name="l00069"></a>00069 <span class="stringliteral">" window settings from taking effect.</li>"</span> <a name="l00070"></a>00070 <span class="stringliteral">"<li><em>Force:</em> The window property will be always forced to the given value.</li></ul>"</span> ); <a name="l00071"></a>00071 <span class="comment">// window tabs have enable signals done in designer</span> <a name="l00072"></a>00072 <span class="comment">// geometry tab</span> <a name="l00073"></a>00073 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o35">position</a>, set ); <a name="l00074"></a>00074 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o32">size</a>, set ); <a name="l00075"></a>00075 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o47">desktop</a>, set ); <a name="l00076"></a>00076 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o41">maximizehoriz</a>, set ); <a name="l00077"></a>00077 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o37">maximizevert</a>, set ); <a name="l00078"></a>00078 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o52">minimize</a>, set ); <a name="l00079"></a>00079 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o50">shade</a>, set ); <a name="l00080"></a>00080 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o39">fullscreen</a>, set ); <a name="l00081"></a>00081 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o55">placement</a>, force ); <a name="l00082"></a>00082 <span class="comment">// preferences tab</span> <a name="l00083"></a>00083 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o69">above</a>, set ); <a name="l00084"></a>00084 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o70">below</a>, set ); <a name="l00085"></a>00085 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o71">noborder</a>, set ); <a name="l00086"></a>00086 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o72">skiptaskbar</a>, set ); <a name="l00087"></a>00087 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o73">skippager</a>, set ); <a name="l00088"></a>00088 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o74">acceptfocus</a>, force ); <a name="l00089"></a>00089 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o75">closeable</a>, force ); <a name="l00090"></a>00090 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o68">opacityactive</a>, force ); <a name="l00091"></a>00091 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o84">opacityinactive</a>, force ); <a name="l00092"></a>00092 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o89">shortcut</a>, force ); <a name="l00093"></a>00093 <span class="comment">// workarounds tab</span> <a name="l00094"></a>00094 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o99">fsplevel</a>, force ); <a name="l00095"></a>00095 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o94">moveresizemode</a>, force ); <a name="l00096"></a>00096 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o93">type</a>, force ); <a name="l00097"></a>00097 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o108">ignoreposition</a>, force ); <a name="l00098"></a>00098 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o104">minsize</a>, force ); <a name="l00099"></a>00099 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o100">maxsize</a>, force ); <a name="l00100"></a>00100 SETUP( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o111">strictgeometry</a>, force ); <a name="l00101"></a>00101 KWinModule module; <a name="l00102"></a>00102 <span class="keywordtype">int</span> i; <a name="l00103"></a>00103 <span class="keywordflow">for</span>( i = 1; <a name="l00104"></a>00104 i <= module.numberOfDesktops(); <a name="l00105"></a>00105 ++i ) <a name="l00106"></a>00106 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o47">desktop</a>->insertItem( QString::number( i ).rightJustify( 2 ) + <span class="stringliteral">":"</span> + module.desktopName( i )); <a name="l00107"></a>00107 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o47">desktop</a>->insertItem( i18n( <span class="stringliteral">"All Desktops"</span> )); <a name="l00108"></a>00108 } <a name="l00109"></a>00109 <a name="l00110"></a>00110 <span class="preprocessor">#undef SETUP</span> <a name="l00111"></a>00111 <span class="preprocessor"></span> <a name="l00112"></a>00112 <span class="preprocessor">#define UPDATE_ENABLE_SLOT( var ) \</span> <a name="l00113"></a>00113 <span class="preprocessor">void RulesWidget::updateEnable##var() \</span> <a name="l00114"></a>00114 <span class="preprocessor"> { \</span> <a name="l00115"></a>00115 <span class="preprocessor"> </span><span class="comment">/* leave the label readable label_##var->setEnabled( enable_##var->isChecked() && rule_##var->currentItem() != 0 );*/</span> \ <a name="l00116"></a>00116 var->setEnabled( enable_##var->isChecked() && rule_##var->currentItem() != 0 ); \ <a name="l00117"></a>00117 } <a name="l00118"></a>00118 <a name="l00119"></a>00119 <span class="comment">// geometry tab</span> <a name="l00120"></a>00120 UPDATE_ENABLE_SLOT( position ) <a name="l00121"></a>00121 UPDATE_ENABLE_SLOT( size ) <a name="l00122"></a>00122 UPDATE_ENABLE_SLOT( desktop ) <a name="l00123"></a>00123 UPDATE_ENABLE_SLOT( maximizehoriz ) <a name="l00124"></a>00124 UPDATE_ENABLE_SLOT( maximizevert ) <a name="l00125"></a>00125 UPDATE_ENABLE_SLOT( minimize ) <a name="l00126"></a>00126 UPDATE_ENABLE_SLOT( shade ) <a name="l00127"></a>00127 UPDATE_ENABLE_SLOT( fullscreen ) <a name="l00128"></a>00128 UPDATE_ENABLE_SLOT( placement ) <a name="l00129"></a>00129 <span class="comment">// preferences tab</span> <a name="l00130"></a>00130 UPDATE_ENABLE_SLOT( above ) <a name="l00131"></a>00131 UPDATE_ENABLE_SLOT( below ) <a name="l00132"></a>00132 UPDATE_ENABLE_SLOT( noborder ) <a name="l00133"></a>00133 UPDATE_ENABLE_SLOT( skiptaskbar ) <a name="l00134"></a>00134 UPDATE_ENABLE_SLOT( skippager ) <a name="l00135"></a>00135 UPDATE_ENABLE_SLOT( acceptfocus ) <a name="l00136"></a>00136 UPDATE_ENABLE_SLOT( closeable ) <a name="l00137"></a>00137 UPDATE_ENABLE_SLOT( opacityactive ) <a name="l00138"></a>00138 UPDATE_ENABLE_SLOT( opacityinactive ) <a name="l00139"></a>00139 <span class="keywordtype">void</span> <a class="code" href="classKWinInternal_1_1RulesWidget.html">RulesWidget</a>::updateEnableshortcut() <a name="l00140"></a>00140 { <a name="l00141"></a>00141 shortcut->setEnabled( enable_shortcut->isChecked() && rule_shortcut->currentItem() != 0 ); <a name="l00142"></a>00142 shortcut_edit->setEnabled( enable_shortcut->isChecked() && rule_shortcut->currentItem() != 0 ); <a name="l00143"></a>00143 } <a name="l00144"></a>00144 <span class="comment">// workarounds tab</span> <a name="l00145"></a>00145 UPDATE_ENABLE_SLOT( fsplevel ) <a name="l00146"></a>00146 UPDATE_ENABLE_SLOT( moveresizemode ) <a name="l00147"></a>00147 UPDATE_ENABLE_SLOT( type ) <a name="l00148"></a>00148 UPDATE_ENABLE_SLOT( ignoreposition ) <a name="l00149"></a>00149 UPDATE_ENABLE_SLOT( minsize ) <a name="l00150"></a>00150 UPDATE_ENABLE_SLOT( maxsize ) <a name="l00151"></a>00151 UPDATE_ENABLE_SLOT( strictgeometry ) <a name="l00152"></a>00152 <a name="l00153"></a>00153 #undef UPDATE_ENABLE_SLOT <a name="l00154"></a>00154 <a name="l00155"></a><a class="code" href="namespaceKWinInternal.html#a9">00155</a> static const <span class="keywordtype">int</span> <a class="code" href="namespaceKWinInternal.html#a9">set_rule_to_combo</a>[] = <a name="l00156"></a>00156 { <a name="l00157"></a>00157 0, <span class="comment">// Unused</span> <a name="l00158"></a>00158 0, <span class="comment">// Don't Affect</span> <a name="l00159"></a>00159 3, <span class="comment">// Force</span> <a name="l00160"></a>00160 1, <span class="comment">// Apply</span> <a name="l00161"></a>00161 2, <span class="comment">// Remember</span> <a name="l00162"></a>00162 }; <a name="l00163"></a>00163 <a name="l00164"></a><a class="code" href="namespaceKWinInternal.html#a10">00164</a> <span class="keyword">static</span> <span class="keyword">const</span> Rules::SetRule <a class="code" href="namespaceKWinInternal.html#a10">combo_to_set_rule</a>[] = <a name="l00165"></a>00165 { <a name="l00166"></a>00166 ( Rules::SetRule )Rules::DontAffect, <a name="l00167"></a>00167 ( Rules::SetRule )Rules::Apply, <a name="l00168"></a>00168 ( Rules::SetRule )Rules::Remember, <a name="l00169"></a>00169 ( Rules::SetRule )Rules::Force <a name="l00170"></a>00170 }; <a name="l00171"></a>00171 <a name="l00172"></a><a class="code" href="namespaceKWinInternal.html#a11">00172</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="namespaceKWinInternal.html#a11">force_rule_to_combo</a>[] = <a name="l00173"></a>00173 { <a name="l00174"></a>00174 0, <span class="comment">// Unused</span> <a name="l00175"></a>00175 0, <span class="comment">// Don't Affect</span> <a name="l00176"></a>00176 1 <span class="comment">// Force</span> <a name="l00177"></a>00177 }; <a name="l00178"></a>00178 <a name="l00179"></a><a class="code" href="namespaceKWinInternal.html#a12">00179</a> <span class="keyword">static</span> <span class="keyword">const</span> Rules::ForceRule <a class="code" href="namespaceKWinInternal.html#a12">combo_to_force_rule</a>[] = <a name="l00180"></a>00180 { <a name="l00181"></a>00181 ( Rules::ForceRule )Rules::DontAffect, <a name="l00182"></a>00182 ( Rules::ForceRule )Rules::Force <a name="l00183"></a>00183 }; <a name="l00184"></a>00184 <a name="l00185"></a><a class="code" href="namespaceKWinInternal.html#a79">00185</a> <span class="keyword">static</span> QString <a class="code" href="namespaceKWinInternal.html#a79">positionToStr</a>( <span class="keyword">const</span> QPoint& p ) <a name="l00186"></a>00186 { <a name="l00187"></a>00187 <span class="keywordflow">if</span>( p == invalidPoint ) <a name="l00188"></a>00188 <span class="keywordflow">return</span> QString::null; <a name="l00189"></a>00189 <span class="keywordflow">return</span> QString::number( p.x()) + <span class="stringliteral">","</span> + QString::number( p.y()); <a name="l00190"></a>00190 } <a name="l00191"></a>00191 <a name="l00192"></a><a class="code" href="namespaceKWinInternal.html#a80">00192</a> <span class="keyword">static</span> QPoint <a class="code" href="namespaceKWinInternal.html#a80">strToPosition</a>( <span class="keyword">const</span> QString& str ) <a name="l00193"></a>00193 { <span class="comment">// two numbers, with + or -, separated by any of , x X :</span> <a name="l00194"></a>00194 QRegExp reg( <span class="stringliteral">"\\s*([+-]?[0-9]*)\\s*[,xX:]\\s*([+-]?[0-9]*)\\s*"</span> ); <a name="l00195"></a>00195 <span class="keywordflow">if</span>( !reg.exactMatch( str )) <a name="l00196"></a>00196 <span class="keywordflow">return</span> invalidPoint; <a name="l00197"></a>00197 <span class="keywordflow">return</span> QPoint( reg.cap( 1 ).toInt(), reg.cap( 2 ).toInt()); <a name="l00198"></a>00198 } <a name="l00199"></a>00199 <a name="l00200"></a><a class="code" href="namespaceKWinInternal.html#a81">00200</a> <span class="keyword">static</span> QString <a class="code" href="namespaceKWinInternal.html#a81">sizeToStr</a>( <span class="keyword">const</span> QSize& s ) <a name="l00201"></a>00201 { <a name="l00202"></a>00202 <span class="keywordflow">if</span>( !s.isValid()) <a name="l00203"></a>00203 <span class="keywordflow">return</span> QString::null; <a name="l00204"></a>00204 <span class="keywordflow">return</span> QString::number( s.width()) + <span class="stringliteral">","</span> + QString::number( s.height()); <a name="l00205"></a>00205 } <a name="l00206"></a>00206 <a name="l00207"></a><a class="code" href="namespaceKWinInternal.html#a82">00207</a> <span class="keyword">static</span> QSize <a class="code" href="namespaceKWinInternal.html#a82">strToSize</a>( <span class="keyword">const</span> QString& str ) <a name="l00208"></a>00208 { <span class="comment">// two numbers, with + or -, separated by any of , x X :</span> <a name="l00209"></a>00209 QRegExp reg( <span class="stringliteral">"\\s*([+-]?[0-9]*)\\s*[,xX:]\\s*([+-]?[0-9]*)\\s*"</span> ); <a name="l00210"></a>00210 <span class="keywordflow">if</span>( !reg.exactMatch( str )) <a name="l00211"></a>00211 <span class="keywordflow">return</span> QSize(); <a name="l00212"></a>00212 <span class="keywordflow">return</span> QSize( reg.cap( 1 ).toInt(), reg.cap( 2 ).toInt()); <a name="l00213"></a>00213 } <a name="l00214"></a>00214 <a name="l00215"></a>00215 <span class="comment">//used for opacity settings</span> <a name="l00216"></a><a class="code" href="namespaceKWinInternal.html#a83">00216</a> <span class="keyword">static</span> QString <a class="code" href="namespaceKWinInternal.html#a83">intToStr</a>( <span class="keyword">const</span> <span class="keywordtype">int</span>& s ) <a name="l00217"></a>00217 { <a name="l00218"></a>00218 <span class="keywordflow">if</span>( s < 1 || s > 100 ) <a name="l00219"></a>00219 <span class="keywordflow">return</span> QString::null; <a name="l00220"></a>00220 <span class="keywordflow">return</span> QString::number(s); <a name="l00221"></a>00221 } <a name="l00222"></a>00222 <a name="l00223"></a><a class="code" href="namespaceKWinInternal.html#a84">00223</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="namespaceKWinInternal.html#a84">strToInt</a>( <span class="keyword">const</span> QString& str ) <a name="l00224"></a>00224 { <a name="l00225"></a>00225 <span class="keywordtype">int</span> tmp = str.toInt(); <a name="l00226"></a>00226 <span class="keywordflow">if</span>( tmp < 1 || tmp > 100 ) <a name="l00227"></a>00227 <span class="keywordflow">return</span> 100; <a name="l00228"></a>00228 <span class="keywordflow">return</span> tmp; <a name="l00229"></a>00229 } <a name="l00230"></a>00230 <a name="l00231"></a>00231 <span class="keywordtype">int</span> RulesWidget::desktopToCombo( <span class="keywordtype">int</span> d )<span class="keyword"> const</span> <a name="l00232"></a>00232 <span class="keyword"> </span>{ <a name="l00233"></a>00233 <span class="keywordflow">if</span>( d >= 1 && d < desktop->count()) <a name="l00234"></a>00234 <span class="keywordflow">return</span> d - 1; <a name="l00235"></a>00235 <span class="keywordflow">return</span> desktop->count() - 1; <span class="comment">// on all desktops</span> <a name="l00236"></a>00236 } <a name="l00237"></a>00237 <a name="l00238"></a>00238 <span class="keywordtype">int</span> RulesWidget::comboToDesktop( <span class="keywordtype">int</span> val )<span class="keyword"> const</span> <a name="l00239"></a>00239 <span class="keyword"> </span>{ <a name="l00240"></a>00240 <span class="keywordflow">if</span>( val == desktop->count() - 1 ) <a name="l00241"></a>00241 <span class="keywordflow">return</span> NET::OnAllDesktops; <a name="l00242"></a>00242 <span class="keywordflow">return</span> val + 1; <a name="l00243"></a>00243 } <a name="l00244"></a>00244 <a name="l00245"></a><a class="code" href="namespaceKWinInternal.html#a85">00245</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="namespaceKWinInternal.html#a85">placementToCombo</a>( <a class="code" href="classKWinInternal_1_1Placement.html#w9">Placement::Policy</a> placement ) <a name="l00246"></a>00246 { <a name="l00247"></a>00247 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> conv[] = <a name="l00248"></a>00248 { <a name="l00249"></a>00249 1, <span class="comment">// NoPlacement</span> <a name="l00250"></a>00250 0, <span class="comment">// Default</span> <a name="l00251"></a>00251 5, <span class="comment">// Random</span> <a name="l00252"></a>00252 2, <span class="comment">// Smart</span> <a name="l00253"></a>00253 3, <span class="comment">// Cascade</span> <a name="l00254"></a>00254 4, <span class="comment">// Centered</span> <a name="l00255"></a>00255 6, <span class="comment">// ZeroCornered</span> <a name="l00256"></a>00256 7, <span class="comment">// UnderMouse</span> <a name="l00257"></a>00257 8 <span class="comment">// OnMainWindow</span> <a name="l00258"></a>00258 }; <a name="l00259"></a>00259 <span class="keywordflow">return</span> conv[ placement ]; <a name="l00260"></a>00260 } <a name="l00261"></a>00261 <a name="l00262"></a><a class="code" href="namespaceKWinInternal.html#a86">00262</a> <span class="keyword">static</span> <a class="code" href="classKWinInternal_1_1Placement.html#w9">Placement::Policy</a> <a class="code" href="namespaceKWinInternal.html#a86">comboToPlacement</a>( <span class="keywordtype">int</span> val ) <a name="l00263"></a>00263 { <a name="l00264"></a>00264 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="classKWinInternal_1_1Placement.html#w9">Placement::Policy</a> conv[] = <a name="l00265"></a>00265 { <a name="l00266"></a>00266 Placement::Default, <a name="l00267"></a>00267 Placement::NoPlacement, <a name="l00268"></a>00268 Placement::Smart, <a name="l00269"></a>00269 Placement::Cascade, <a name="l00270"></a>00270 Placement::Centered, <a name="l00271"></a>00271 Placement::Random, <a name="l00272"></a>00272 Placement::ZeroCornered, <a name="l00273"></a>00273 Placement::UnderMouse, <a name="l00274"></a>00274 Placement::OnMainWindow <a name="l00275"></a>00275 }; <a name="l00276"></a>00276 <span class="keywordflow">return</span> conv[ val ]; <a name="l00277"></a>00277 } <a name="l00278"></a>00278 <a name="l00279"></a><a class="code" href="namespaceKWinInternal.html#a87">00279</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="namespaceKWinInternal.html#a87">moveresizeToCombo</a>( <a class="code" href="classKWinInternal_1_1Options.html#w31">Options::MoveResizeMode</a> mode ) <a name="l00280"></a>00280 { <a name="l00281"></a>00281 <span class="keywordflow">return</span> mode == Options::Opaque ? 0 : 1; <a name="l00282"></a>00282 } <a name="l00283"></a>00283 <a name="l00284"></a><a class="code" href="namespaceKWinInternal.html#a88">00284</a> <span class="keyword">static</span> <a class="code" href="classKWinInternal_1_1Options.html#w31">Options::MoveResizeMode</a> <a class="code" href="namespaceKWinInternal.html#a88">comboToMoveResize</a>( <span class="keywordtype">int</span> val ) <a name="l00285"></a>00285 { <a name="l00286"></a>00286 <span class="keywordflow">return</span> val == 0 ? Options::Opaque : Options::Transparent; <a name="l00287"></a>00287 } <a name="l00288"></a>00288 <a name="l00289"></a><a class="code" href="namespaceKWinInternal.html#a89">00289</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="namespaceKWinInternal.html#a89">typeToCombo</a>( NET::WindowType type ) <a name="l00290"></a>00290 { <a name="l00291"></a>00291 <span class="keywordflow">if</span>( type < NET::Normal || type > NET::Splash ) <a name="l00292"></a>00292 <span class="keywordflow">return</span> 0; <span class="comment">// Normal</span> <a name="l00293"></a>00293 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> conv[] = <a name="l00294"></a>00294 { <a name="l00295"></a>00295 0, <span class="comment">// Normal</span> <a name="l00296"></a>00296 7, <span class="comment">// Desktop</span> <a name="l00297"></a>00297 3, <span class="comment">// Dock</span> <a name="l00298"></a>00298 4, <span class="comment">// Toolbar</span> <a name="l00299"></a>00299 5, <span class="comment">// Menu</span> <a name="l00300"></a>00300 1, <span class="comment">// Dialog</span> <a name="l00301"></a>00301 8, <span class="comment">// Override</span> <a name="l00302"></a>00302 9, <span class="comment">// TopMenu</span> <a name="l00303"></a>00303 2, <span class="comment">// Utility</span> <a name="l00304"></a>00304 6 <span class="comment">// Splash</span> <a name="l00305"></a>00305 }; <a name="l00306"></a>00306 <span class="keywordflow">return</span> conv[ type ]; <a name="l00307"></a>00307 } <a name="l00308"></a>00308 <a name="l00309"></a><a class="code" href="namespaceKWinInternal.html#a90">00309</a> <span class="keyword">static</span> NET::WindowType <a class="code" href="namespaceKWinInternal.html#a90">comboToType</a>( <span class="keywordtype">int</span> val ) <a name="l00310"></a>00310 { <a name="l00311"></a>00311 <span class="keyword">static</span> <span class="keyword">const</span> NET::WindowType conv[] = <a name="l00312"></a>00312 { <a name="l00313"></a>00313 NET::Normal, <a name="l00314"></a>00314 NET::Dialog, <a name="l00315"></a>00315 NET::Utility, <a name="l00316"></a>00316 NET::Dock, <a name="l00317"></a>00317 NET::Toolbar, <a name="l00318"></a>00318 NET::Menu, <a name="l00319"></a>00319 NET::Splash, <a name="l00320"></a>00320 NET::Desktop, <a name="l00321"></a>00321 NET::Override, <a name="l00322"></a>00322 NET::TopMenu <a name="l00323"></a>00323 }; <a name="l00324"></a>00324 <span class="keywordflow">return</span> conv[ val ]; <a name="l00325"></a>00325 } <a name="l00326"></a>00326 <a name="l00327"></a>00327 <span class="preprocessor">#define GENERIC_RULE( var, func, Type, type, uimethod, uimethod0 ) \</span> <a name="l00328"></a>00328 <span class="preprocessor"> if( rules->var##rule == Rules::Unused##Type##Rule ) \</span> <a name="l00329"></a>00329 <span class="preprocessor"> { \</span> <a name="l00330"></a>00330 <span class="preprocessor"> enable_##var->setChecked( false ); \</span> <a name="l00331"></a>00331 <span class="preprocessor"> rule_##var->setCurrentItem( 0 ); \</span> <a name="l00332"></a>00332 <span class="preprocessor"> var->uimethod0; \</span> <a name="l00333"></a>00333 <span class="preprocessor"> updateEnable##var(); \</span> <a name="l00334"></a>00334 <span class="preprocessor"> } \</span> <a name="l00335"></a>00335 <span class="preprocessor"> else \</span> <a name="l00336"></a>00336 <span class="preprocessor"> { \</span> <a name="l00337"></a>00337 <span class="preprocessor"> enable_##var->setChecked( true ); \</span> <a name="l00338"></a>00338 <span class="preprocessor"> rule_##var->setCurrentItem( type##_rule_to_combo[ rules->var##rule ] ); \</span> <a name="l00339"></a>00339 <span class="preprocessor"> var->uimethod( func( rules->var )); \</span> <a name="l00340"></a>00340 <span class="preprocessor"> updateEnable##var(); \</span> <a name="l00341"></a>00341 <span class="preprocessor"> }</span> <a name="l00342"></a>00342 <span class="preprocessor"></span> <a name="l00343"></a>00343 <span class="preprocessor">#define CHECKBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, setChecked, setChecked( false ))</span> <a name="l00344"></a>00344 <span class="preprocessor"></span><span class="preprocessor">#define LINEEDIT_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, setText, setText( "" ))</span> <a name="l00345"></a>00345 <span class="preprocessor"></span><span class="preprocessor">#define COMBOBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, setCurrentItem, setCurrentItem( 0 ))</span> <a name="l00346"></a>00346 <span class="preprocessor"></span><span class="preprocessor">#define CHECKBOX_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, setChecked, setChecked( false ))</span> <a name="l00347"></a>00347 <span class="preprocessor"></span><span class="preprocessor">#define LINEEDIT_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, setText, setText( "" ))</span> <a name="l00348"></a>00348 <span class="preprocessor"></span><span class="preprocessor">#define COMBOBOX_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, setCurrentItem, setCurrentItem( 0 ))</span> <a name="l00349"></a>00349 <span class="preprocessor"></span> <a name="l00350"></a><a class="code" href="classKWinInternal_1_1RulesWidget.html#a1">00350</a> <span class="keywordtype">void</span> RulesWidget::setRules( <a class="code" href="classKWinInternal_1_1Rules.html">Rules</a>* rules ) <a name="l00351"></a>00351 { <a name="l00352"></a>00352 <a class="code" href="classKWinInternal_1_1Rules.html">Rules</a> tmp; <a name="l00353"></a>00353 <span class="keywordflow">if</span>( rules == NULL ) <a name="l00354"></a>00354 rules = &tmp; <span class="comment">// empty</span> <a name="l00355"></a>00355 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o3">description</a>->setText( rules-><a class="code" href="classKWinInternal_1_1Rules.html#r1">description</a> ); <a name="l00356"></a>00356 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o11">wmclass</a>->setText( rules-><a class="code" href="classKWinInternal_1_1Rules.html#r2">wmclass</a> ); <a name="l00357"></a>00357 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o12">whole_wmclass</a>->setChecked( rules-><a class="code" href="classKWinInternal_1_1Rules.html#r4">wmclasscomplete</a> ); <a name="l00358"></a>00358 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o9">wmclass_match</a>->setCurrentItem( rules-><a class="code" href="classKWinInternal_1_1Rules.html#r3">wmclassmatch</a> ); <a name="l00359"></a>00359 wmclassMatchChanged(); <a name="l00360"></a>00360 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o6">role</a>->setText( rules-><a class="code" href="classKWinInternal_1_1Rules.html#r5">windowrole</a> ); <a name="l00361"></a>00361 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o7">role_match</a>->setCurrentItem( rules-><a class="code" href="classKWinInternal_1_1Rules.html#r6">windowrolematch</a> ); <a name="l00362"></a>00362 roleMatchChanged(); <a name="l00363"></a>00363 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->setSelected( 0, rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> & NET::NormalMask ); <a name="l00364"></a>00364 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->setSelected( 1, rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> & NET::DialogMask ); <a name="l00365"></a>00365 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->setSelected( 2, rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> & NET::UtilityMask ); <a name="l00366"></a>00366 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->setSelected( 3, rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> & NET::DockMask ); <a name="l00367"></a>00367 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->setSelected( 4, rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> & NET::ToolbarMask ); <a name="l00368"></a>00368 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->setSelected( 5, rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> & NET::MenuMask ); <a name="l00369"></a>00369 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->setSelected( 6, rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> & NET::SplashMask ); <a name="l00370"></a>00370 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->setSelected( 7, rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> & NET::DesktopMask ); <a name="l00371"></a>00371 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->setSelected( 8, rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> & NET::OverrideMask ); <a name="l00372"></a>00372 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->setSelected( 9, rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> & NET::TopMenuMask ); <a name="l00373"></a>00373 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o19">title</a>->setText( rules-><a class="code" href="classKWinInternal_1_1Rules.html#r7">title</a> ); <a name="l00374"></a>00374 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o24">title_match</a>->setCurrentItem( rules-><a class="code" href="classKWinInternal_1_1Rules.html#r8">titlematch</a> ); <a name="l00375"></a>00375 titleMatchChanged(); <a name="l00376"></a>00376 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o21">extra</a>->setText( rules-><a class="code" href="classKWinInternal_1_1Rules.html#r9">extrarole</a> ); <a name="l00377"></a>00377 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o26">extra_match</a>->setCurrentItem( rules-><a class="code" href="classKWinInternal_1_1Rules.html#r10">extrarolematch</a> ); <a name="l00378"></a>00378 extraMatchChanged(); <a name="l00379"></a>00379 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o23">machine</a>->setText( rules-><a class="code" href="classKWinInternal_1_1Rules.html#r11">clientmachine</a> ); <a name="l00380"></a>00380 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o28">machine_match</a>->setCurrentItem( rules-><a class="code" href="classKWinInternal_1_1Rules.html#r12">clientmachinematch</a> ); <a name="l00381"></a>00381 machineMatchChanged(); <a name="l00382"></a>00382 LINEEDIT_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o35">position</a>, <a class="code" href="namespaceKWinInternal.html#a79">positionToStr</a> ); <a name="l00383"></a>00383 LINEEDIT_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o32">size</a>, <a class="code" href="namespaceKWinInternal.html#a81">sizeToStr</a> ); <a name="l00384"></a>00384 COMBOBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o47">desktop</a>, desktopToCombo ); <a name="l00385"></a>00385 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o41">maximizehoriz</a>, ); <a name="l00386"></a>00386 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o37">maximizevert</a>, ); <a name="l00387"></a>00387 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o52">minimize</a>, ); <a name="l00388"></a>00388 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o50">shade</a>, ); <a name="l00389"></a>00389 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o39">fullscreen</a>, ); <a name="l00390"></a>00390 COMBOBOX_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o55">placement</a>, <a class="code" href="namespaceKWinInternal.html#a85">placementToCombo</a> ); <a name="l00391"></a>00391 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o69">above</a>, ); <a name="l00392"></a>00392 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o70">below</a>, ); <a name="l00393"></a>00393 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o71">noborder</a>, ); <a name="l00394"></a>00394 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o72">skiptaskbar</a>, ); <a name="l00395"></a>00395 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o73">skippager</a>, ); <a name="l00396"></a>00396 CHECKBOX_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o74">acceptfocus</a>, ); <a name="l00397"></a>00397 CHECKBOX_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o75">closeable</a>, ); <a name="l00398"></a>00398 LINEEDIT_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o68">opacityactive</a>, <a class="code" href="namespaceKWinInternal.html#a83">intToStr</a> ); <a name="l00399"></a>00399 LINEEDIT_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o84">opacityinactive</a>, <a class="code" href="namespaceKWinInternal.html#a83">intToStr</a> ); <a name="l00400"></a>00400 LINEEDIT_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o89">shortcut</a>, ); <a name="l00401"></a>00401 COMBOBOX_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o99">fsplevel</a>, ); <a name="l00402"></a>00402 COMBOBOX_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o94">moveresizemode</a>, <a class="code" href="namespaceKWinInternal.html#a87">moveresizeToCombo</a> ); <a name="l00403"></a>00403 COMBOBOX_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o93">type</a>, <a class="code" href="namespaceKWinInternal.html#a89">typeToCombo</a> ); <a name="l00404"></a>00404 CHECKBOX_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o108">ignoreposition</a>, ); <a name="l00405"></a>00405 LINEEDIT_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o104">minsize</a>, <a class="code" href="namespaceKWinInternal.html#a81">sizeToStr</a> ); <a name="l00406"></a>00406 LINEEDIT_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o100">maxsize</a>, <a class="code" href="namespaceKWinInternal.html#a81">sizeToStr</a> ); <a name="l00407"></a>00407 CHECKBOX_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o111">strictgeometry</a>, ); <a name="l00408"></a>00408 } <a name="l00409"></a>00409 <a name="l00410"></a>00410 <span class="preprocessor">#undef GENERIC_RULE</span> <a name="l00411"></a>00411 <span class="preprocessor"></span><span class="preprocessor">#undef CHECKBOX_SET_RULE</span> <a name="l00412"></a>00412 <span class="preprocessor"></span><span class="preprocessor">#undef LINEEDIT_SET_RULE</span> <a name="l00413"></a>00413 <span class="preprocessor"></span><span class="preprocessor">#undef COMBOBOX_SET_RULE</span> <a name="l00414"></a>00414 <span class="preprocessor"></span><span class="preprocessor">#undef CHECKBOX_FORCE_RULE</span> <a name="l00415"></a>00415 <span class="preprocessor"></span><span class="preprocessor">#undef LINEEDIT_FORCE_RULE</span> <a name="l00416"></a>00416 <span class="preprocessor"></span><span class="preprocessor">#undef COMBOBOX_FORCE_RULE</span> <a name="l00417"></a>00417 <span class="preprocessor"></span> <a name="l00418"></a>00418 <span class="preprocessor">#define GENERIC_RULE( var, func, Type, type, uimethod ) \</span> <a name="l00419"></a>00419 <span class="preprocessor"> if( enable_##var->isChecked()) \</span> <a name="l00420"></a>00420 <span class="preprocessor"> { \</span> <a name="l00421"></a>00421 <span class="preprocessor"> rules->var##rule = combo_to_##type##_rule[ rule_##var->currentItem() ]; \</span> <a name="l00422"></a>00422 <span class="preprocessor"> rules->var = func( var->uimethod()); \</span> <a name="l00423"></a>00423 <span class="preprocessor"> } \</span> <a name="l00424"></a>00424 <span class="preprocessor"> else \</span> <a name="l00425"></a>00425 <span class="preprocessor"> rules->var##rule = Rules::Unused##Type##Rule;</span> <a name="l00426"></a>00426 <span class="preprocessor"></span> <a name="l00427"></a>00427 <span class="preprocessor">#define CHECKBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, isChecked )</span> <a name="l00428"></a>00428 <span class="preprocessor"></span><span class="preprocessor">#define LINEEDIT_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, text )</span> <a name="l00429"></a>00429 <span class="preprocessor"></span><span class="preprocessor">#define COMBOBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, currentItem )</span> <a name="l00430"></a>00430 <span class="preprocessor"></span><span class="preprocessor">#define CHECKBOX_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, isChecked )</span> <a name="l00431"></a>00431 <span class="preprocessor"></span><span class="preprocessor">#define LINEEDIT_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, text )</span> <a name="l00432"></a>00432 <span class="preprocessor"></span><span class="preprocessor">#define COMBOBOX_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, currentItem )</span> <a name="l00433"></a>00433 <span class="preprocessor"></span> <a name="l00434"></a><a class="code" href="classKWinInternal_1_1RulesWidget.html#a2">00434</a> <a class="code" href="classKWinInternal_1_1Rules.html">Rules</a>* <a class="code" href="classKWinInternal_1_1RulesWidget.html#a2">RulesWidget::rules</a>()<span class="keyword"> const</span> <a name="l00435"></a>00435 <span class="keyword"> </span>{ <a name="l00436"></a>00436 <a class="code" href="classKWinInternal_1_1Rules.html">Rules</a>* <a class="code" href="classKWinInternal_1_1RulesWidget.html#a2">rules</a> = <span class="keyword">new</span> <a class="code" href="classKWinInternal_1_1Rules.html">Rules</a>(); <a name="l00437"></a>00437 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r1">description</a> = <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o3">description</a>->text(); <a name="l00438"></a>00438 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r2">wmclass</a> = <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o11">wmclass</a>->text().utf8(); <a name="l00439"></a>00439 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r4">wmclasscomplete</a> = <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o12">whole_wmclass</a>->isChecked(); <a name="l00440"></a>00440 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r3">wmclassmatch</a> = static_cast< Rules::StringMatch >( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o9">wmclass_match</a>->currentItem()); <a name="l00441"></a>00441 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r5">windowrole</a> = <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o6">role</a>->text().utf8(); <a name="l00442"></a>00442 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r6">windowrolematch</a> = static_cast< Rules::StringMatch >( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o7">role_match</a>->currentItem()); <a name="l00443"></a>00443 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> = 0; <a name="l00444"></a>00444 <span class="keywordtype">bool</span> all_types = <span class="keyword">true</span>; <a name="l00445"></a>00445 <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; <a name="l00446"></a>00446 i < <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->count(); <a name="l00447"></a>00447 ++i ) <a name="l00448"></a>00448 <span class="keywordflow">if</span>( !<a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->isSelected( i )) <a name="l00449"></a>00449 all_types = <span class="keyword">false</span>; <a name="l00450"></a>00450 <span class="keywordflow">if</span>( all_types ) <span class="comment">// if all types are selected, use AllTypesMask (for future expansion)</span> <a name="l00451"></a>00451 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> = NET::AllTypesMask; <a name="l00452"></a>00452 <span class="keywordflow">else</span> <a name="l00453"></a>00453 { <a name="l00454"></a>00454 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> |= <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->isSelected( 0 ) ? NET::NormalMask : 0; <a name="l00455"></a>00455 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> |= <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->isSelected( 1 ) ? NET::DialogMask : 0; <a name="l00456"></a>00456 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> |= <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->isSelected( 2 ) ? NET::UtilityMask : 0; <a name="l00457"></a>00457 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> |= <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->isSelected( 3 ) ? NET::DockMask : 0; <a name="l00458"></a>00458 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> |= <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->isSelected( 4 ) ? NET::ToolbarMask : 0; <a name="l00459"></a>00459 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> |= <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->isSelected( 5 ) ? NET::MenuMask : 0; <a name="l00460"></a>00460 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> |= <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->isSelected( 6 ) ? NET::SplashMask : 0; <a name="l00461"></a>00461 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> |= <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->isSelected( 7 ) ? NET::DesktopMask : 0; <a name="l00462"></a>00462 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> |= <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->isSelected( 8 ) ? NET::OverrideMask : 0; <a name="l00463"></a>00463 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> |= <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->isSelected( 9 ) ? NET::TopMenuMask : 0; <a name="l00464"></a>00464 } <a name="l00465"></a>00465 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r7">title</a> = <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o19">title</a>->text(); <a name="l00466"></a>00466 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r8">titlematch</a> = static_cast< Rules::StringMatch >( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o24">title_match</a>->currentItem()); <a name="l00467"></a>00467 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r9">extrarole</a> = <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o21">extra</a>->text().utf8(); <a name="l00468"></a>00468 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r10">extrarolematch</a> = static_cast< Rules::StringMatch >( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o26">extra_match</a>->currentItem()); <a name="l00469"></a>00469 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r11">clientmachine</a> = <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o23">machine</a>->text().utf8(); <a name="l00470"></a>00470 rules-><a class="code" href="classKWinInternal_1_1Rules.html#r12">clientmachinematch</a> = static_cast< Rules::StringMatch >( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o28">machine_match</a>->currentItem()); <a name="l00471"></a>00471 LINEEDIT_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o35">position</a>, <a class="code" href="namespaceKWinInternal.html#a80">strToPosition</a> ); <a name="l00472"></a>00472 LINEEDIT_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o32">size</a>, <a class="code" href="namespaceKWinInternal.html#a82">strToSize</a> ); <a name="l00473"></a>00473 COMBOBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o47">desktop</a>, comboToDesktop ); <a name="l00474"></a>00474 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o41">maximizehoriz</a>, ); <a name="l00475"></a>00475 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o37">maximizevert</a>, ); <a name="l00476"></a>00476 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o52">minimize</a>, ); <a name="l00477"></a>00477 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o50">shade</a>, ); <a name="l00478"></a>00478 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o39">fullscreen</a>, ); <a name="l00479"></a>00479 COMBOBOX_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o55">placement</a>, <a class="code" href="namespaceKWinInternal.html#a86">comboToPlacement</a> ); <a name="l00480"></a>00480 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o69">above</a>, ); <a name="l00481"></a>00481 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o70">below</a>, ); <a name="l00482"></a>00482 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o71">noborder</a>, ); <a name="l00483"></a>00483 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o72">skiptaskbar</a>, ); <a name="l00484"></a>00484 CHECKBOX_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o73">skippager</a>, ); <a name="l00485"></a>00485 CHECKBOX_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o74">acceptfocus</a>, ); <a name="l00486"></a>00486 CHECKBOX_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o75">closeable</a>, ); <a name="l00487"></a>00487 LINEEDIT_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o68">opacityactive</a>, <a class="code" href="namespaceKWinInternal.html#a84">strToInt</a> ); <a name="l00488"></a>00488 LINEEDIT_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o84">opacityinactive</a>, <a class="code" href="namespaceKWinInternal.html#a84">strToInt</a> ); <a name="l00489"></a>00489 LINEEDIT_SET_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o89">shortcut</a>, ); <a name="l00490"></a>00490 COMBOBOX_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o99">fsplevel</a>, ); <a name="l00491"></a>00491 COMBOBOX_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o94">moveresizemode</a>, <a class="code" href="namespaceKWinInternal.html#a88">comboToMoveResize</a> ); <a name="l00492"></a>00492 COMBOBOX_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o93">type</a>, <a class="code" href="namespaceKWinInternal.html#a90">comboToType</a> ); <a name="l00493"></a>00493 CHECKBOX_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o108">ignoreposition</a>, ); <a name="l00494"></a>00494 LINEEDIT_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o104">minsize</a>, <a class="code" href="namespaceKWinInternal.html#a82">strToSize</a> ); <a name="l00495"></a>00495 LINEEDIT_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o100">maxsize</a>, <a class="code" href="namespaceKWinInternal.html#a82">strToSize</a> ); <a name="l00496"></a>00496 CHECKBOX_FORCE_RULE( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o111">strictgeometry</a>, ); <a name="l00497"></a>00497 <span class="keywordflow">return</span> rules; <a name="l00498"></a>00498 } <a name="l00499"></a>00499 <a name="l00500"></a>00500 <span class="preprocessor">#undef GENERIC_RULE</span> <a name="l00501"></a>00501 <span class="preprocessor"></span><span class="preprocessor">#undef CHECKBOX_SET_RULE</span> <a name="l00502"></a>00502 <span class="preprocessor"></span><span class="preprocessor">#undef LINEEDIT_SET_RULE</span> <a name="l00503"></a>00503 <span class="preprocessor"></span><span class="preprocessor">#undef COMBOBOX_SET_RULE</span> <a name="l00504"></a>00504 <span class="preprocessor"></span><span class="preprocessor">#undef CHECKBOX_FORCE_RULE</span> <a name="l00505"></a>00505 <span class="preprocessor"></span><span class="preprocessor">#undef LINEEDIT_FORCE_RULE</span> <a name="l00506"></a>00506 <span class="preprocessor"></span><span class="preprocessor">#undef COMBOBOX_FORCE_RULE</span> <a name="l00507"></a>00507 <span class="preprocessor"></span> <a name="l00508"></a>00508 <span class="preprocessor">#define STRING_MATCH_COMBO( type ) \</span> <a name="l00509"></a>00509 <span class="preprocessor">void RulesWidget::type##MatchChanged() \</span> <a name="l00510"></a>00510 <span class="preprocessor"> { \</span> <a name="l00511"></a>00511 <span class="preprocessor"> edit_reg_##type->setEnabled( type##_match->currentItem() == Rules::RegExpMatch ); \</span> <a name="l00512"></a>00512 <span class="preprocessor"> type->setEnabled( type##_match->currentItem() != Rules::UnimportantMatch ); \</span> <a name="l00513"></a>00513 <span class="preprocessor"> }</span> <a name="l00514"></a>00514 <span class="preprocessor"></span> <a name="l00515"></a>00515 STRING_MATCH_COMBO( wmclass ) <a name="l00516"></a>00516 STRING_MATCH_COMBO( role ) <a name="l00517"></a>00517 STRING_MATCH_COMBO( title ) <a name="l00518"></a>00518 STRING_MATCH_COMBO( extra ) <a name="l00519"></a>00519 STRING_MATCH_COMBO( machine ) <a name="l00520"></a>00520 <a name="l00521"></a>00521 #undef STRING_MATCH_COMBO <a name="l00522"></a>00522 <a name="l00523"></a><a class="code" href="classKWinInternal_1_1RulesWidget.html#j0">00523</a> <span class="keywordtype">void</span> <a class="code" href="classKWinInternal_1_1RulesWidget.html">RulesWidget</a>::detectClicked() <a name="l00524"></a>00524 { <a name="l00525"></a>00525 assert( detect_dlg == NULL ); <a name="l00526"></a>00526 detect_dlg = <span class="keyword">new</span> <a class="code" href="classKWinInternal_1_1DetectDialog.html">DetectDialog</a>; <a name="l00527"></a>00527 connect( detect_dlg, SIGNAL( detectionDone( <span class="keywordtype">bool</span> )), <span class="keyword">this</span>, SLOT( detected( <span class="keywordtype">bool</span> ))); <a name="l00528"></a>00528 detect_dlg->detect( 0 ); <a name="l00529"></a>00529 } <a name="l00530"></a>00530 <a name="l00531"></a>00531 <span class="keywordtype">void</span> RulesWidget::detected( <span class="keywordtype">bool</span> ok ) <a name="l00532"></a>00532 { <a name="l00533"></a>00533 <span class="keywordflow">if</span>( ok ) <a name="l00534"></a>00534 { <a name="l00535"></a>00535 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o11">wmclass</a>->setText( detect_dlg-><a class="code" href="classKWinInternal_1_1DetectDialog.html#a2">selectedClass</a>()); <a name="l00536"></a>00536 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o9">wmclass_match</a>->setCurrentItem( Rules::ExactMatch ); <a name="l00537"></a>00537 wmclassMatchChanged(); <span class="comment">// grrr</span> <a name="l00538"></a>00538 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o12">whole_wmclass</a>->setChecked( detect_dlg-><a class="code" href="classKWinInternal_1_1DetectDialog.html#a3">selectedWholeClass</a>()); <a name="l00539"></a>00539 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o6">role</a>->setText( detect_dlg-><a class="code" href="classKWinInternal_1_1DetectDialog.html#a4">selectedRole</a>()); <a name="l00540"></a>00540 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o7">role_match</a>->setCurrentItem( detect_dlg-><a class="code" href="classKWinInternal_1_1DetectDialog.html#a4">selectedRole</a>().isEmpty() <a name="l00541"></a>00541 ? Rules::UnimportantMatch : Rules::ExactMatch ); <a name="l00542"></a>00542 roleMatchChanged(); <a name="l00543"></a>00543 <span class="keywordflow">if</span>( detect_dlg-><a class="code" href="classKWinInternal_1_1DetectDialog.html#a5">selectedWholeApp</a>()) <a name="l00544"></a>00544 { <a name="l00545"></a>00545 <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; <a name="l00546"></a>00546 i < <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->count(); <a name="l00547"></a>00547 ++i ) <a name="l00548"></a>00548 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->setSelected( i, <span class="keyword">true</span> ); <a name="l00549"></a>00549 } <a name="l00550"></a>00550 <span class="keywordflow">else</span> <a name="l00551"></a>00551 { <a name="l00552"></a>00552 NET::WindowType <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o93">type</a> = detect_dlg->selectedType(); <a name="l00553"></a>00553 <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; <a name="l00554"></a>00554 i < <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->count(); <a name="l00555"></a>00555 ++i ) <a name="l00556"></a>00556 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->setSelected( i, <span class="keyword">false</span> ); <a name="l00557"></a>00557 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->setSelected( <a class="code" href="namespaceKWinInternal.html#a89">typeToCombo</a>( type ), <span class="keyword">true</span> ); <a name="l00558"></a>00558 } <a name="l00559"></a>00559 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o19">title</a>->setText( detect_dlg->selectedTitle()); <a name="l00560"></a>00560 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o24">title_match</a>->setCurrentItem( detect_dlg->titleMatch()); <a name="l00561"></a>00561 titleMatchChanged(); <a name="l00562"></a>00562 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o23">machine</a>->setText( detect_dlg->selectedMachine()); <a name="l00563"></a>00563 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o28">machine_match</a>->setCurrentItem( Rules::UnimportantMatch ); <a name="l00564"></a>00564 machineMatchChanged(); <a name="l00565"></a>00565 <span class="comment">// prefill values from to window to settings which already set</span> <a name="l00566"></a>00566 <span class="keyword">const</span> KWin::WindowInfo& info = detect_dlg->windowInfo(); <a name="l00567"></a>00567 prefillUnusedValues( info ); <a name="l00568"></a>00568 } <a name="l00569"></a>00569 <span class="keyword">delete</span> detect_dlg; <a name="l00570"></a>00570 detect_dlg = NULL; <a name="l00571"></a>00571 detect_dlg_ok = ok; <a name="l00572"></a>00572 } <a name="l00573"></a>00573 <a name="l00574"></a>00574 <span class="preprocessor">#define GENERIC_PREFILL( var, func, info, uimethod ) \</span> <a name="l00575"></a>00575 <span class="preprocessor"> if( !enable_##var->isChecked()) \</span> <a name="l00576"></a>00576 <span class="preprocessor"> { \</span> <a name="l00577"></a>00577 <span class="preprocessor"> var->uimethod( func( info )); \</span> <a name="l00578"></a>00578 <span class="preprocessor"> }</span> <a name="l00579"></a>00579 <span class="preprocessor"></span> <a name="l00580"></a>00580 <span class="preprocessor">#define CHECKBOX_PREFILL( var, func, info ) GENERIC_PREFILL( var, func, info, setChecked )</span> <a name="l00581"></a>00581 <span class="preprocessor"></span><span class="preprocessor">#define LINEEDIT_PREFILL( var, func, info ) GENERIC_PREFILL( var, func, info, setText )</span> <a name="l00582"></a>00582 <span class="preprocessor"></span><span class="preprocessor">#define COMBOBOX_PREFILL( var, func, info ) GENERIC_PREFILL( var, func, info, setCurrentItem )</span> <a name="l00583"></a>00583 <span class="preprocessor"></span> <a name="l00584"></a>00584 <span class="keywordtype">void</span> RulesWidget::prefillUnusedValues( <span class="keyword">const</span> KWin::WindowInfo& info ) <a name="l00585"></a>00585 { <a name="l00586"></a>00586 LINEEDIT_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o35">position</a>, <a class="code" href="namespaceKWinInternal.html#a79">positionToStr</a>, info.frameGeometry().topLeft() ); <a name="l00587"></a>00587 LINEEDIT_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o32">size</a>, <a class="code" href="namespaceKWinInternal.html#a81">sizeToStr</a>, info.frameGeometry().size() ); <a name="l00588"></a>00588 COMBOBOX_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o47">desktop</a>, desktopToCombo, info.desktop() ); <a name="l00589"></a>00589 CHECKBOX_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o41">maximizehoriz</a>,, info.state() & NET::MaxHoriz ); <a name="l00590"></a>00590 CHECKBOX_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o37">maximizevert</a>,, info.state() & NET::MaxVert ); <a name="l00591"></a>00591 CHECKBOX_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o52">minimize</a>,, info.isMinimized() ); <a name="l00592"></a>00592 CHECKBOX_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o50">shade</a>,, info.state() & NET::Shaded ); <a name="l00593"></a>00593 CHECKBOX_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o39">fullscreen</a>,, info.state() & NET::FullScreen ); <a name="l00594"></a>00594 <span class="comment">//COMBOBOX_PREFILL( placement, placementToCombo );</span> <a name="l00595"></a>00595 CHECKBOX_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o69">above</a>,, info.state() & NET::KeepAbove ); <a name="l00596"></a>00596 CHECKBOX_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o70">below</a>,, info.state() & NET::KeepBelow ); <a name="l00597"></a>00597 <span class="comment">// noborder is only internal KWin information, so let's guess</span> <a name="l00598"></a>00598 CHECKBOX_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o71">noborder</a>,, info.frameGeometry() == info.geometry() ); <a name="l00599"></a>00599 CHECKBOX_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o72">skiptaskbar</a>,, info.state() & NET::SkipTaskbar ); <a name="l00600"></a>00600 CHECKBOX_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o73">skippager</a>,, info.state() & NET::SkipPager ); <a name="l00601"></a>00601 <span class="comment">//CHECKBOX_PREFILL( acceptfocus, );</span> <a name="l00602"></a>00602 <span class="comment">//CHECKBOX_PREFILL( closeable, );</span> <a name="l00603"></a>00603 LINEEDIT_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o68">opacityactive</a>, <a class="code" href="namespaceKWinInternal.html#a83">intToStr</a>, 100 <span class="comment">/*get the actual opacity somehow*/</span>); <a name="l00604"></a>00604 LINEEDIT_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o84">opacityinactive</a>, <a class="code" href="namespaceKWinInternal.html#a83">intToStr</a>, 100 <span class="comment">/*get the actual opacity somehow*/</span>); <a name="l00605"></a>00605 <span class="comment">//LINEEDIT_PREFILL( shortcut, );</span> <a name="l00606"></a>00606 <span class="comment">//COMBOBOX_PREFILL( fsplevel, );</span> <a name="l00607"></a>00607 <span class="comment">//COMBOBOX_PREFILL( moveresizemode, moveresizeToCombo );</span> <a name="l00608"></a>00608 COMBOBOX_PREFILL( type, <a class="code" href="namespaceKWinInternal.html#a89">typeToCombo</a>, info.windowType( <a class="code" href="namespaceKWinInternal.html#a22">SUPPORTED_WINDOW_TYPES_MASK</a> ) ); <a name="l00609"></a>00609 <span class="comment">//CHECKBOX_PREFILL( ignoreposition, );</span> <a name="l00610"></a>00610 LINEEDIT_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o104">minsize</a>, <a class="code" href="namespaceKWinInternal.html#a81">sizeToStr</a>, info.frameGeometry().size() ); <a name="l00611"></a>00611 LINEEDIT_PREFILL( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o100">maxsize</a>, <a class="code" href="namespaceKWinInternal.html#a81">sizeToStr</a>, info.frameGeometry().size() ); <a name="l00612"></a>00612 <span class="comment">//CHECKBOX_PREFILL( strictgeometry, );</span> <a name="l00613"></a>00613 } <a name="l00614"></a>00614 <a name="l00615"></a>00615 <span class="preprocessor">#undef GENERIC_PREFILL</span> <a name="l00616"></a>00616 <span class="preprocessor"></span><span class="preprocessor">#undef CHECKBOX_PREFILL</span> <a name="l00617"></a>00617 <span class="preprocessor"></span><span class="preprocessor">#undef LINEEDIT_PREFILL</span> <a name="l00618"></a>00618 <span class="preprocessor"></span><span class="preprocessor">#undef COMBOBOX_PREFILL</span> <a name="l00619"></a>00619 <span class="preprocessor"></span> <a name="l00620"></a><a class="code" href="classKWinInternal_1_1RulesWidget.html#a3">00620</a> <span class="keywordtype">bool</span> <a class="code" href="classKWinInternal_1_1RulesWidget.html#a3">RulesWidget::finalCheck</a>() <a name="l00621"></a>00621 { <a name="l00622"></a>00622 <span class="keywordflow">if</span>( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o3">description</a>->text().isEmpty()) <a name="l00623"></a>00623 { <a name="l00624"></a>00624 <span class="keywordflow">if</span>( !<a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o11">wmclass</a>->text().isEmpty()) <a name="l00625"></a>00625 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o3">description</a>->setText( i18n( <span class="stringliteral">"Settings for %1"</span> ).arg( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o11">wmclass</a>->text())); <a name="l00626"></a>00626 <span class="keywordflow">else</span> <a name="l00627"></a>00627 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o3">description</a>->setText( i18n( <span class="stringliteral">"Unnamed entry"</span> )); <a name="l00628"></a>00628 } <a name="l00629"></a>00629 <span class="keywordtype">bool</span> all_types = <span class="keyword">true</span>; <a name="l00630"></a>00630 <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; <a name="l00631"></a>00631 i < <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->count(); <a name="l00632"></a>00632 ++i ) <a name="l00633"></a>00633 <span class="keywordflow">if</span>( !<a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o17">types</a>->isSelected( i )) <a name="l00634"></a>00634 all_types = <span class="keyword">false</span>; <a name="l00635"></a>00635 <span class="keywordflow">if</span>( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o9">wmclass_match</a>->currentItem() == Rules::UnimportantMatch && all_types ) <a name="l00636"></a>00636 { <a name="l00637"></a>00637 <span class="keywordflow">if</span>( KMessageBox::warningContinueCancel( topLevelWidget(), <a name="l00638"></a>00638 i18n( <span class="stringliteral">"You have specified the window class as unimportant.\n"</span> <a name="l00639"></a>00639 <span class="stringliteral">"This means the settings will possibly apply to windows from all applications. "</span> <a name="l00640"></a>00640 <span class="stringliteral">"If you really want to create a generic setting, it is recommended you at least "</span> <a name="l00641"></a>00641 <span class="stringliteral">"limit the window types to avoid special window types."</span> )) != KMessageBox::Continue ) <a name="l00642"></a>00642 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00643"></a>00643 } <a name="l00644"></a>00644 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00645"></a>00645 } <a name="l00646"></a>00646 <a name="l00647"></a><a class="code" href="classKWinInternal_1_1RulesWidget.html#a4">00647</a> <span class="keywordtype">void</span> <a class="code" href="classKWinInternal_1_1RulesWidget.html#a4">RulesWidget::prepareWindowSpecific</a>( WId window ) <a name="l00648"></a>00648 { <a name="l00649"></a>00649 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o0">tabs</a>->setCurrentPage( 2 ); <span class="comment">// geometry tab, skip tabs for window identification</span> <a name="l00650"></a>00650 KWin::WindowInfo info( window, -1U, -1U ); <span class="comment">// read everything</span> <a name="l00651"></a>00651 prefillUnusedValues( info ); <a name="l00652"></a>00652 } <a name="l00653"></a>00653 <a name="l00654"></a><a class="code" href="classKWinInternal_1_1RulesWidget.html#j6">00654</a> <span class="keywordtype">void</span> <a class="code" href="classKWinInternal_1_1RulesWidget.html#j6">RulesWidget::shortcutEditClicked</a>() <a name="l00655"></a>00655 { <a name="l00656"></a>00656 <a class="code" href="classKWinInternal_1_1EditShortcutDialog.html">EditShortcutDialog</a> dlg( topLevelWidget()); <a name="l00657"></a>00657 dlg.<a class="code" href="classKWinInternal_1_1EditShortcutDialog.html#a1">setShortcut</a>( <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o89">shortcut</a>->text()); <a name="l00658"></a>00658 <span class="keywordflow">if</span>( dlg.exec() == QDialog::Accepted ) <a name="l00659"></a>00659 <a class="code" href="classKWinInternal_1_1RulesWidgetBase.html#o89">shortcut</a>->setText( dlg.<a class="code" href="classKWinInternal_1_1EditShortcutDialog.html#a2">shortcut</a>()); <a name="l00660"></a>00660 } <a name="l00661"></a>00661 <a name="l00662"></a><a class="code" href="classKWinInternal_1_1RulesDialog.html#a0">00662</a> <a class="code" href="classKWinInternal_1_1RulesDialog.html#a0">RulesDialog::RulesDialog</a>( QWidget* parent, <span class="keyword">const</span> <span class="keywordtype">char</span>* name ) <a name="l00663"></a>00663 : KDialogBase( parent, name, true, i18n( <span class="stringliteral">"Edit Window-Specific Settings"</span> ), Ok | Cancel ) <a name="l00664"></a>00664 { <a name="l00665"></a>00665 widget = <span class="keyword">new</span> <a class="code" href="classKWinInternal_1_1RulesWidget.html">RulesWidget</a>( <span class="keyword">this</span> ); <a name="l00666"></a>00666 setMainWidget( widget ); <a name="l00667"></a>00667 } <a name="l00668"></a>00668 <a name="l00669"></a>00669 <span class="comment">// window is set only for Alt+F3/Window-specific settings, because the dialog</span> <a name="l00670"></a>00670 <span class="comment">// is then related to one specific window</span> <a name="l00671"></a><a class="code" href="classKWinInternal_1_1RulesDialog.html#a1">00671</a> <a class="code" href="classKWinInternal_1_1Rules.html">Rules</a>* <a class="code" href="classKWinInternal_1_1RulesDialog.html#a1">RulesDialog::edit</a>( <a class="code" href="classKWinInternal_1_1Rules.html">Rules</a>* r, WId window ) <a name="l00672"></a>00672 { <a name="l00673"></a>00673 rules = r; <a name="l00674"></a>00674 widget-><a class="code" href="classKWinInternal_1_1RulesWidget.html#a1">setRules</a>( rules ); <a name="l00675"></a>00675 <span class="keywordflow">if</span>( window != 0 ) <a name="l00676"></a>00676 widget-><a class="code" href="classKWinInternal_1_1RulesWidget.html#a4">prepareWindowSpecific</a>( window ); <a name="l00677"></a>00677 exec(); <a name="l00678"></a>00678 <span class="keywordflow">return</span> rules; <a name="l00679"></a>00679 } <a name="l00680"></a>00680 <a name="l00681"></a><a class="code" href="classKWinInternal_1_1RulesDialog.html#b0">00681</a> <span class="keywordtype">void</span> <a class="code" href="classKWinInternal_1_1RulesDialog.html#b0">RulesDialog::accept</a>() <a name="l00682"></a>00682 { <a name="l00683"></a>00683 <span class="keywordflow">if</span>( !widget-><a class="code" href="classKWinInternal_1_1RulesWidget.html#a3">finalCheck</a>()) <a name="l00684"></a>00684 <span class="keywordflow">return</span>; <a name="l00685"></a>00685 rules = widget-><a class="code" href="classKWinInternal_1_1RulesWidget.html#a2">rules</a>(); <a name="l00686"></a>00686 KDialogBase::accept(); <a name="l00687"></a>00687 } <a name="l00688"></a>00688 <a name="l00689"></a><a class="code" href="classKWinInternal_1_1EditShortcut.html#a0">00689</a> <a class="code" href="classKWinInternal_1_1EditShortcut.html#a0">EditShortcut::EditShortcut</a>( QWidget* parent, <span class="keyword">const</span> <span class="keywordtype">char</span>* name ) <a name="l00690"></a>00690 : <a class="code" href="classEditShortcutBase.html">EditShortcutBase</a>( parent, name ) <a name="l00691"></a>00691 { <a name="l00692"></a>00692 } <a name="l00693"></a>00693 <a name="l00694"></a><a class="code" href="classKWinInternal_1_1EditShortcut.html#b0">00694</a> <span class="keywordtype">void</span> <a class="code" href="classKWinInternal_1_1EditShortcut.html#b0">EditShortcut::editShortcut</a>() <a name="l00695"></a>00695 { <a name="l00696"></a>00696 <a class="code" href="classKWinInternal_1_1ShortcutDialog.html">ShortcutDialog</a> dlg( KShortcut( <a class="code" href="classEditShortcutBase.html#o2">shortcut</a>->text()), topLevelWidget()); <a name="l00697"></a>00697 <span class="keywordflow">if</span>( dlg.exec() == QDialog::Accepted ) <a name="l00698"></a>00698 <a class="code" href="classEditShortcutBase.html#o2">shortcut</a>->setText( dlg.shortcut().toString()); <a name="l00699"></a>00699 } <a name="l00700"></a>00700 <a name="l00701"></a><a class="code" href="classKWinInternal_1_1EditShortcut.html#b1">00701</a> <span class="keywordtype">void</span> <a class="code" href="classKWinInternal_1_1EditShortcut.html#b1">EditShortcut::clearShortcut</a>() <a name="l00702"></a>00702 { <a name="l00703"></a>00703 <a class="code" href="classEditShortcutBase.html#o2">shortcut</a>->setText( <span class="stringliteral">""</span> ); <a name="l00704"></a>00704 } <a name="l00705"></a>00705 <a name="l00706"></a><a class="code" href="classKWinInternal_1_1EditShortcutDialog.html#a0">00706</a> <a class="code" href="classKWinInternal_1_1EditShortcutDialog.html#a0">EditShortcutDialog::EditShortcutDialog</a>( QWidget* parent, <span class="keyword">const</span> <span class="keywordtype">char</span>* name ) <a name="l00707"></a>00707 : KDialogBase( parent, name, true, i18n( <span class="stringliteral">"Edit Shortcut"</span> ), Ok | Cancel ) <a name="l00708"></a>00708 { <a name="l00709"></a>00709 widget = <span class="keyword">new</span> <a class="code" href="classKWinInternal_1_1EditShortcut.html">EditShortcut</a>( <span class="keyword">this</span> ); <a name="l00710"></a>00710 setMainWidget( widget ); <a name="l00711"></a>00711 } <a name="l00712"></a>00712 <a name="l00713"></a><a class="code" href="classKWinInternal_1_1EditShortcutDialog.html#a1">00713</a> <span class="keywordtype">void</span> <a class="code" href="classKWinInternal_1_1EditShortcutDialog.html#a1">EditShortcutDialog::setShortcut</a>( <span class="keyword">const</span> QString& cut ) <a name="l00714"></a>00714 { <a name="l00715"></a>00715 widget-><a class="code" href="classEditShortcutBase.html#o2">shortcut</a>->setText( cut ); <a name="l00716"></a>00716 } <a name="l00717"></a>00717 <a name="l00718"></a><a class="code" href="classKWinInternal_1_1EditShortcutDialog.html#a2">00718</a> QString <a class="code" href="classKWinInternal_1_1EditShortcutDialog.html#a2">EditShortcutDialog::shortcut</a>()<span class="keyword"> const</span> <a name="l00719"></a>00719 <span class="keyword"> </span>{ <a name="l00720"></a>00720 <span class="keywordflow">return</span> widget-><a class="code" href="classEditShortcutBase.html#o2">shortcut</a>->text(); <a name="l00721"></a>00721 } <a name="l00722"></a>00722 <a name="l00723"></a>00723 ShortcutDialog::ShortcutDialog( <span class="keyword">const</span> KShortcut& cut, QWidget* parent, <span class="keyword">const</span> <span class="keywordtype">char</span>* name ) <a name="l00724"></a>00724 : KShortcutDialog( cut, false <span class="comment">/*TODO???*/</span>, parent, name ) <a name="l00725"></a>00725 { <a name="l00726"></a>00726 } <a name="l00727"></a>00727 <a name="l00728"></a>00728 <span class="keywordtype">void</span> ShortcutDialog::accept() <a name="l00729"></a>00729 { <a name="l00730"></a>00730 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i = 0; <a name="l00731"></a>00731 ; <a name="l00732"></a>00732 ++i ) <a name="l00733"></a>00733 { <a name="l00734"></a>00734 KKeySequence seq = <a class="code" href="classKWinInternal_1_1EditShortcutDialog.html#a2">shortcut</a>().seq( i ); <a name="l00735"></a>00735 <span class="keywordflow">if</span>( seq.isNull()) <a name="l00736"></a>00736 <span class="keywordflow">break</span>; <a name="l00737"></a>00737 <span class="keywordflow">if</span>( seq.key( 0 ) == Key_Escape ) <a name="l00738"></a>00738 { <a name="l00739"></a>00739 reject(); <a name="l00740"></a>00740 <span class="keywordflow">return</span>; <a name="l00741"></a>00741 } <a name="l00742"></a>00742 <span class="keywordflow">if</span>( seq.key( 0 ) == Key_Space ) <a name="l00743"></a>00743 { <span class="comment">// clear</span> <a name="l00744"></a>00744 <a class="code" href="classKWinInternal_1_1EditShortcutDialog.html#a1">setShortcut</a>( KShortcut()); <a name="l00745"></a>00745 KShortcutDialog::accept(); <a name="l00746"></a>00746 <span class="keywordflow">return</span>; <a name="l00747"></a>00747 } <a name="l00748"></a>00748 <span class="keywordflow">if</span>( seq.key( 0 ).modFlags() == 0 ) <a name="l00749"></a>00749 { <span class="comment">// no shortcuts without modifiers</span> <a name="l00750"></a>00750 KShortcut cut = <a class="code" href="classKWinInternal_1_1EditShortcutDialog.html#a2">shortcut</a>(); <a name="l00751"></a>00751 cut.setSeq( i, KKeySequence()); <a name="l00752"></a>00752 <a class="code" href="classKWinInternal_1_1EditShortcutDialog.html#a1">setShortcut</a>( cut ); <a name="l00753"></a>00753 <span class="keywordflow">return</span>; <a name="l00754"></a>00754 } <a name="l00755"></a>00755 } <a name="l00756"></a>00756 KShortcutDialog::accept(); <a name="l00757"></a>00757 } <a name="l00758"></a>00758 <a name="l00759"></a>00759 } <span class="comment">// namespace</span> <a name="l00760"></a>00760 <a name="l00761"></a>00761 <span class="preprocessor">#include "ruleswidget.moc"</span> </pre></div></div> <div id="bottom-nav"> <img src="../../common/bottom2.png" align="right" height="59" width="227" alt="KDE Logo"> </div> <div class="bottom"> This file is part of the documentation for kwin Library Version 3.4.2. </div> <div class="bottom" style="color:#cccccc"> Documentation copyright © 1996-2004 the KDE developers.<br> Generated on Wed Jun 14 19:06:10 2006 by <a href="http://www.doxygen.org/index.html">doxygen</a> 1.4.4 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2003 </div> </body> </html>