Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwinoptions/windows.cpp
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | |||||
94 | } | 94 | } | ||
95 | 95 | | |||
96 | // removed the LCD display over the slider - this is not good GUI design :) RNolden 051701 | 96 | // removed the LCD display over the slider - this is not good GUI design :) RNolden 051701 | ||
97 | KFocusConfig::KFocusConfig(bool _standAlone, KConfig *_config, QWidget * parent) | 97 | KFocusConfig::KFocusConfig(bool _standAlone, KConfig *_config, QWidget * parent) | ||
98 | : KCModule(parent), config(_config), standAlone(_standAlone) | 98 | : KCModule(parent), config(_config), standAlone(_standAlone) | ||
99 | , m_ui(new KWinFocusConfigForm(this)) | 99 | , m_ui(new KWinFocusConfigForm(this)) | ||
100 | { | 100 | { | ||
101 | connect(m_ui->focusStealing, SIGNAL(activated(int)), SLOT(changed())); | 101 | connect(m_ui->focusStealing, SIGNAL(activated(int)), SLOT(changed())); | ||
102 | connect(m_ui->windowFocusPolicy, SIGNAL(valueChanged(int)), SLOT(changed())); | 102 | connect(m_ui->windowFocusPolicyCombo, SIGNAL(currentIndexChanged(int)), SLOT(changed())); | ||
103 | connect(m_ui->windowFocusPolicy, SIGNAL(valueChanged(int)), this, SLOT(focusPolicyChanged())); | 103 | connect(m_ui->windowFocusPolicyCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(focusPolicyChanged())); | ||
104 | connect(m_ui->windowFocusPolicy, SIGNAL(valueChanged(int)), this, SLOT(setDelayFocusEnabled())); | 104 | connect(m_ui->windowFocusPolicyCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setDelayFocusEnabled())); | ||
105 | connect(m_ui->windowFocusPolicy, SIGNAL(valueChanged(int)), this, SLOT(updateActiveMouseScreen())); | 105 | connect(m_ui->windowFocusPolicyCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActiveMouseScreen())); | ||
106 | connect(m_ui->autoRaiseOn, SIGNAL(clicked()), SLOT(changed())); | 106 | connect(m_ui->autoRaiseOn, SIGNAL(clicked()), SLOT(changed())); | ||
107 | connect(m_ui->autoRaiseOn, SIGNAL(toggled(bool)), SLOT(autoRaiseOnTog(bool))); | 107 | connect(m_ui->autoRaiseOn, SIGNAL(toggled(bool)), SLOT(autoRaiseOnTog(bool))); | ||
108 | connect(m_ui->clickRaiseOn, SIGNAL(clicked()), SLOT(changed())); | 108 | connect(m_ui->clickRaiseOn, SIGNAL(clicked()), SLOT(changed())); | ||
109 | connect(m_ui->autoRaise, SIGNAL(valueChanged(int)), SLOT(changed())); | 109 | connect(m_ui->autoRaise, SIGNAL(valueChanged(int)), SLOT(changed())); | ||
110 | connect(m_ui->delayFocus, SIGNAL(valueChanged(int)), SLOT(changed())); | 110 | connect(m_ui->delayFocus, SIGNAL(valueChanged(int)), SLOT(changed())); | ||
111 | connect(m_ui->separateScreenFocus, SIGNAL(clicked()), SLOT(changed())); | 111 | connect(m_ui->separateScreenFocus, SIGNAL(clicked()), SLOT(changed())); | ||
112 | connect(m_ui->activeMouseScreen, SIGNAL(clicked()), SLOT(changed())); | 112 | connect(m_ui->activeMouseScreen, SIGNAL(clicked()), SLOT(changed())); | ||
113 | 113 | | |||
114 | connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), SLOT(updateMultiScreen())); | 114 | connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), SLOT(updateMultiScreen())); | ||
115 | updateMultiScreen(); | 115 | updateMultiScreen(); | ||
116 | 116 | | |||
117 | load(); | 117 | load(); | ||
118 | } | 118 | } | ||
119 | 119 | | |||
120 | void KFocusConfig::updateMultiScreen() | 120 | void KFocusConfig::updateMultiScreen() | ||
121 | { | 121 | { | ||
122 | m_ui->multiscreenBox->setVisible(QApplication::screens().count() > 1); | 122 | m_ui->multiscreenBehaviorLabel->setVisible(QApplication::screens().count() > 1); | ||
123 | m_ui->activeMouseScreen->setVisible(QApplication::screens().count() > 1); | ||||
124 | m_ui->separateScreenFocus->setVisible(QApplication::screens().count() > 1); | ||||
123 | } | 125 | } | ||
124 | 126 | | |||
125 | 127 | | |||
126 | int KFocusConfig::getFocus() | 128 | int KFocusConfig::getFocus() | ||
127 | { | 129 | { | ||
128 | int policy = m_ui->windowFocusPolicy->value(); | 130 | int policy = m_ui->windowFocusPolicyCombo->currentIndex(); | ||
129 | if (policy == 1 || policy == 3) | 131 | if (policy == 1 || policy == 3) | ||
130 | --policy; // fix the NextFocusPrefersMouse condition | 132 | --policy; // fix the NextFocusPrefersMouse condition | ||
131 | return policy; | 133 | return policy; | ||
132 | } | 134 | } | ||
133 | 135 | | |||
134 | void KFocusConfig::setFocus(int foc) | 136 | void KFocusConfig::setFocus(int foc) | ||
135 | { | 137 | { | ||
136 | m_ui->windowFocusPolicy->setValue(foc); | 138 | m_ui->windowFocusPolicyCombo->setCurrentIndex(foc); | ||
137 | 139 | | |||
138 | // this will disable/hide the auto raise delay widget if focus==click | 140 | // this will disable/hide the auto raise delay widget if focus==click | ||
139 | focusPolicyChanged(); | 141 | focusPolicyChanged(); | ||
140 | } | 142 | } | ||
141 | 143 | | |||
142 | void KFocusConfig::setAutoRaiseInterval(int tb) | 144 | void KFocusConfig::setAutoRaiseInterval(int tb) | ||
143 | { | 145 | { | ||
144 | m_ui->autoRaise->setValue(tb); | 146 | m_ui->autoRaise->setValue(tb); | ||
Show All 21 Lines | |||||
166 | 168 | | |||
167 | void KFocusConfig::setClickRaise(bool on) | 169 | void KFocusConfig::setClickRaise(bool on) | ||
168 | { | 170 | { | ||
169 | m_ui->clickRaiseOn->setChecked(on); | 171 | m_ui->clickRaiseOn->setChecked(on); | ||
170 | } | 172 | } | ||
171 | 173 | | |||
172 | void KFocusConfig::focusPolicyChanged() | 174 | void KFocusConfig::focusPolicyChanged() | ||
173 | { | 175 | { | ||
174 | int policyIndex = getFocus(); | 176 | int policyIndex = getFocus(); | ||
zzag: Style: a switch statement should look like
```lang=cpp
switch (foo) {
case Foo:
break… | |||||
175 | 177 | | |||
176 | // the auto raise related widgets are: autoRaise | 178 | // the auto raise related widgets are: autoRaise | ||
177 | m_ui->autoRaiseOn->setEnabled(policyIndex != CLICK_TO_FOCUS); | 179 | m_ui->autoRaiseOn->setEnabled(policyIndex != CLICK_TO_FOCUS); | ||
178 | autoRaiseOnTog(policyIndex != CLICK_TO_FOCUS && m_ui->autoRaiseOn->isChecked()); | 180 | autoRaiseOnTog(policyIndex != CLICK_TO_FOCUS && m_ui->autoRaiseOn->isChecked()); | ||
179 | 181 | | |||
180 | m_ui->focusStealing->setDisabled(policyIndex == FOCUS_UNDER_MOUSE || policyIndex == FOCUS_STRICTLY_UNDER_MOUSE); | 182 | m_ui->focusStealing->setDisabled(policyIndex == FOCUS_UNDER_MOUSE || policyIndex == FOCUS_STRICTLY_UNDER_MOUSE); | ||
181 | m_ui->focusStealingLabel->setEnabled(m_ui->focusStealing->isEnabled()); | 183 | m_ui->focusStealingLabel->setEnabled(m_ui->focusStealing->isEnabled()); | ||
182 | 184 | | |||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Line(s) | 289 | if (v == CLICK_TO_FOCUS) | |||
288 | cg.writeEntry(KWIN_FOCUS, "ClickToFocus"); | 290 | cg.writeEntry(KWIN_FOCUS, "ClickToFocus"); | ||
289 | else if (v == FOCUS_UNDER_MOUSE) | 291 | else if (v == FOCUS_UNDER_MOUSE) | ||
290 | cg.writeEntry(KWIN_FOCUS, "FocusUnderMouse"); | 292 | cg.writeEntry(KWIN_FOCUS, "FocusUnderMouse"); | ||
291 | else if (v == FOCUS_STRICTLY_UNDER_MOUSE) | 293 | else if (v == FOCUS_STRICTLY_UNDER_MOUSE) | ||
292 | cg.writeEntry(KWIN_FOCUS, "FocusStrictlyUnderMouse"); | 294 | cg.writeEntry(KWIN_FOCUS, "FocusStrictlyUnderMouse"); | ||
293 | else | 295 | else | ||
294 | cg.writeEntry(KWIN_FOCUS, "FocusFollowsMouse"); | 296 | cg.writeEntry(KWIN_FOCUS, "FocusFollowsMouse"); | ||
295 | 297 | | |||
296 | cg.writeEntry("NextFocusPrefersMouse", v != m_ui->windowFocusPolicy->value()); | 298 | cg.writeEntry("NextFocusPrefersMouse", v != m_ui->windowFocusPolicyCombo->currentIndex()); | ||
297 | 299 | | |||
298 | v = getAutoRaiseInterval(); | 300 | v = getAutoRaiseInterval(); | ||
299 | if (v < 0) v = 0; | 301 | if (v < 0) v = 0; | ||
300 | cg.writeEntry(KWIN_AUTORAISE_INTERVAL, v); | 302 | cg.writeEntry(KWIN_AUTORAISE_INTERVAL, v); | ||
301 | 303 | | |||
302 | v = getDelayFocusInterval(); | 304 | v = getDelayFocusInterval(); | ||
303 | if (v < 0) v = 0; | 305 | if (v < 0) v = 0; | ||
304 | cg.writeEntry(KWIN_DELAYFOCUS_INTERVAL, v); | 306 | cg.writeEntry(KWIN_DELAYFOCUS_INTERVAL, v); | ||
Show All 14 Lines | |||||
319 | if (standAlone) { | 321 | if (standAlone) { | ||
320 | config->sync(); | 322 | config->sync(); | ||
321 | // Send signal to all kwin instances | 323 | // Send signal to all kwin instances | ||
322 | QDBusMessage message = | 324 | QDBusMessage message = | ||
323 | QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); | 325 | QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); | ||
324 | QDBusConnection::sessionBus().send(message); | 326 | QDBusConnection::sessionBus().send(message); | ||
325 | } | 327 | } | ||
326 | emit KCModule::changed(false); | 328 | emit KCModule::changed(false); | ||
329 | | ||||
330 | int policyIndex = getFocus(); | ||||
zzag: Why is it here? | |||||
327 | } | 331 | } | ||
328 | 332 | | |||
329 | void KFocusConfig::defaults() | 333 | void KFocusConfig::defaults() | ||
330 | { | 334 | { | ||
331 | setAutoRaiseInterval(0); | 335 | setAutoRaiseInterval(0); | ||
332 | setDelayFocusInterval(0); | 336 | setDelayFocusInterval(0); | ||
333 | setFocus(CLICK_TO_FOCUS); | 337 | setFocus(CLICK_TO_FOCUS); | ||
334 | setAutoRaise(false); | 338 | setAutoRaise(false); | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 367 | { | |||
380 | m_ui->inactiveTabsSkipTaskbar->setVisible(false); // TODO: We want translations in case this is fixed... | 384 | m_ui->inactiveTabsSkipTaskbar->setVisible(false); // TODO: We want translations in case this is fixed... | ||
381 | load(); | 385 | load(); | ||
382 | 386 | | |||
383 | } | 387 | } | ||
384 | 388 | | |||
385 | void KAdvancedConfig::setShadeHover(bool on) | 389 | void KAdvancedConfig::setShadeHover(bool on) | ||
386 | { | 390 | { | ||
387 | m_ui->shadeHoverOn->setChecked(on); | 391 | m_ui->shadeHoverOn->setChecked(on); | ||
388 | m_ui->shadeHoverLabel->setEnabled(on); | | |||
389 | m_ui->shadeHover->setEnabled(on); | 392 | m_ui->shadeHover->setEnabled(on); | ||
390 | } | 393 | } | ||
391 | 394 | | |||
392 | void KAdvancedConfig::setShadeHoverInterval(int k) | 395 | void KAdvancedConfig::setShadeHoverInterval(int k) | ||
393 | { | 396 | { | ||
394 | m_ui->shadeHover->setValue(k); | 397 | m_ui->shadeHover->setValue(k); | ||
395 | } | 398 | } | ||
396 | 399 | | |||
397 | int KAdvancedConfig::getShadeHoverInterval() | 400 | int KAdvancedConfig::getShadeHoverInterval() | ||
398 | { | 401 | { | ||
399 | 402 | | |||
400 | return m_ui->shadeHover->value(); | 403 | return m_ui->shadeHover->value(); | ||
401 | } | 404 | } | ||
402 | 405 | | |||
403 | void KAdvancedConfig::shadeHoverChanged(bool a) | 406 | void KAdvancedConfig::shadeHoverChanged(bool a) | ||
404 | { | 407 | { | ||
405 | m_ui->shadeHoverLabel->setEnabled(a); | | |||
406 | m_ui->shadeHover->setEnabled(a); | 408 | m_ui->shadeHover->setEnabled(a); | ||
407 | } | 409 | } | ||
408 | 410 | | |||
409 | void KAdvancedConfig::showEvent(QShowEvent *ev) | 411 | void KAdvancedConfig::showEvent(QShowEvent *ev) | ||
410 | { | 412 | { | ||
411 | if (!standAlone) { | 413 | if (!standAlone) { | ||
412 | QWidget::showEvent(ev); | 414 | QWidget::showEvent(ev); | ||
413 | return; | 415 | return; | ||
▲ Show 20 Lines • Show All 241 Lines • Show Last 20 Lines |
Style: a switch statement should look like
i.e. cases are not indented and opening brace is kept on the same line as switch keyword.