Changeset View
Changeset View
Standalone View
Standalone View
options.cpp
Show First 20 Lines • Show All 140 Lines • ▼ Show 20 Line(s) | 88 | Options::Options(QObject *parent) | |||
---|---|---|---|---|---|
141 | , CmdAllWheel(Options::defaultCommandAllWheel()) | 141 | , CmdAllWheel(Options::defaultCommandAllWheel()) | ||
142 | , CmdAllModKey(Options::defaultKeyCmdAllModKey()) | 142 | , CmdAllModKey(Options::defaultKeyCmdAllModKey()) | ||
143 | , electric_border_maximize(false) | 143 | , electric_border_maximize(false) | ||
144 | , electric_border_tiling(false) | 144 | , electric_border_tiling(false) | ||
145 | , electric_border_corner_ratio(0.0) | 145 | , electric_border_corner_ratio(0.0) | ||
146 | , borderless_maximized_windows(false) | 146 | , borderless_maximized_windows(false) | ||
147 | , show_geometry_tip(false) | 147 | , show_geometry_tip(false) | ||
148 | , condensed_title(false) | 148 | , condensed_title(false) | ||
149 | , animationSpeed(Options::defaultAnimationSpeed()) | | |||
150 | { | 149 | { | ||
151 | m_settings->setDefaults(); | 150 | m_settings->setDefaults(); | ||
152 | syncFromKcfgc(); | 151 | syncFromKcfgc(); | ||
152 | | ||||
153 | m_configWatcher = KConfigWatcher::create(m_settings->sharedConfig()); | ||||
154 | connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) { | ||||
155 | if (group.name() == QLatin1String("KDE") && names.contains(QByteArrayLiteral("AnimationDurationFactor"))) { | ||||
156 | emit animationSpeedChanged(); | ||||
157 | } | ||||
158 | }); | ||||
153 | } | 159 | } | ||
154 | 160 | | |||
155 | Options::~Options() | 161 | Options::~Options() | ||
156 | { | 162 | { | ||
157 | } | 163 | } | ||
158 | 164 | | |||
159 | void Options::setFocusPolicy(FocusPolicy focusPolicy) | 165 | void Options::setFocusPolicy(FocusPolicy focusPolicy) | ||
160 | { | 166 | { | ||
▲ Show 20 Lines • Show All 800 Lines • ▼ Show 20 Line(s) | 937 | { | |||
961 | if (hps == 4) | 967 | if (hps == 4) | ||
962 | previews = HiddenPreviewsNever; | 968 | previews = HiddenPreviewsNever; | ||
963 | else if (hps == 5) | 969 | else if (hps == 5) | ||
964 | previews = HiddenPreviewsShown; | 970 | previews = HiddenPreviewsShown; | ||
965 | else if (hps == 6) | 971 | else if (hps == 6) | ||
966 | previews = HiddenPreviewsAlways; | 972 | previews = HiddenPreviewsAlways; | ||
967 | setHiddenPreviews(previews); | 973 | setHiddenPreviews(previews); | ||
968 | 974 | | |||
969 | // TOOD: add setter | | |||
970 | animationSpeed = qBound(0, config.readEntry("AnimationSpeed", Options::defaultAnimationSpeed()), 6); | | |||
971 | | ||||
972 | auto interfaceToKey = [](OpenGLPlatformInterface interface) { | 975 | auto interfaceToKey = [](OpenGLPlatformInterface interface) { | ||
973 | switch (interface) { | 976 | switch (interface) { | ||
974 | case GlxPlatformInterface: | 977 | case GlxPlatformInterface: | ||
975 | return QStringLiteral("glx"); | 978 | return QStringLiteral("glx"); | ||
976 | case EglPlatformInterface: | 979 | case EglPlatformInterface: | ||
977 | return QStringLiteral("egl"); | 980 | return QStringLiteral("egl"); | ||
978 | default: | 981 | default: | ||
979 | return QString(); | 982 | return QString(); | ||
▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Line(s) | 1081 | { | |||
1094 | default: | 1097 | default: | ||
1095 | return MouseNothing; | 1098 | return MouseNothing; | ||
1096 | } | 1099 | } | ||
1097 | } | 1100 | } | ||
1098 | #endif | 1101 | #endif | ||
1099 | 1102 | | |||
1100 | double Options::animationTimeFactor() const | 1103 | double Options::animationTimeFactor() const | ||
1101 | { | 1104 | { | ||
1102 | const double factors[] = { 0, 0.2, 0.5, 1, 2, 4, 20 }; | 1105 | #ifndef KCMRULES | ||
1103 | return factors[ animationSpeed ]; | 1106 | return m_settings->animationDurationFactor(); | ||
1107 | #else | ||||
1108 | return 0; | ||||
broulik: Shouldn't this be `1`? | |||||
It shouldn't matter, but I wonder whether #endif above can be advanced a bit further. zzag: It shouldn't matter, but I wonder whether `#endif` above can be advanced a bit further. | |||||
1109 | #endif | ||||
anthonyfieroni: Where this come from? | |||||
zzag: Window Rules KCM(kcmkwin/kwinrules) includes portions of KWin core. | |||||
1104 | } | 1110 | } | ||
1105 | 1111 | | |||
1106 | Options::WindowOperation Options::operationMaxButtonClick(Qt::MouseButtons button) const | 1112 | Options::WindowOperation Options::operationMaxButtonClick(Qt::MouseButtons button) const | ||
1107 | { | 1113 | { | ||
1108 | return button == Qt::RightButton ? opMaxButtonRightClick : | 1114 | return button == Qt::RightButton ? opMaxButtonRightClick : | ||
1109 | button == Qt::MidButton ? opMaxButtonMiddleClick : | 1115 | button == Qt::MidButton ? opMaxButtonMiddleClick : | ||
1110 | opMaxButtonLeftClick; | 1116 | opMaxButtonLeftClick; | ||
1111 | } | 1117 | } | ||
Show All 12 Lines |
Shouldn't this be 1?