Changeset View
Changeset View
Standalone View
Standalone View
options.cpp
Show First 20 Lines • Show All 137 Lines • ▼ Show 20 Line(s) | 88 | Options::Options(QObject *parent) | |||
---|---|---|---|---|---|
138 | , CmdAllWheel(Options::defaultCommandAllWheel()) | 138 | , CmdAllWheel(Options::defaultCommandAllWheel()) | ||
139 | , CmdAllModKey(Options::defaultKeyCmdAllModKey()) | 139 | , CmdAllModKey(Options::defaultKeyCmdAllModKey()) | ||
140 | , electric_border_maximize(false) | 140 | , electric_border_maximize(false) | ||
141 | , electric_border_tiling(false) | 141 | , electric_border_tiling(false) | ||
142 | , electric_border_corner_ratio(0.0) | 142 | , electric_border_corner_ratio(0.0) | ||
143 | , borderless_maximized_windows(false) | 143 | , borderless_maximized_windows(false) | ||
144 | , show_geometry_tip(false) | 144 | , show_geometry_tip(false) | ||
145 | , condensed_title(false) | 145 | , condensed_title(false) | ||
146 | , animationSpeed(Options::defaultAnimationSpeed()) | | |||
147 | { | 146 | { | ||
148 | m_settings->setDefaults(); | 147 | m_settings->setDefaults(); | ||
149 | syncFromKcfgc(); | 148 | syncFromKcfgc(); | ||
149 | | ||||
150 | m_configWatcher = KConfigWatcher::create(m_settings->sharedConfig()); | ||||
151 | connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) { | ||||
152 | if (group.name() == QLatin1String("KDE") && names.contains(QByteArrayLiteral("AnimationDurationFactor"))) { | ||||
153 | emit animationSpeedChanged(); | ||||
154 | } | ||||
155 | }); | ||||
150 | } | 156 | } | ||
151 | 157 | | |||
152 | Options::~Options() | 158 | Options::~Options() | ||
153 | { | 159 | { | ||
154 | } | 160 | } | ||
155 | 161 | | |||
156 | void Options::setFocusPolicy(FocusPolicy focusPolicy) | 162 | void Options::setFocusPolicy(FocusPolicy focusPolicy) | ||
157 | { | 163 | { | ||
▲ Show 20 Lines • Show All 770 Lines • ▼ Show 20 Line(s) | 904 | { | |||
928 | if (hps == 4) | 934 | if (hps == 4) | ||
929 | previews = HiddenPreviewsNever; | 935 | previews = HiddenPreviewsNever; | ||
930 | else if (hps == 5) | 936 | else if (hps == 5) | ||
931 | previews = HiddenPreviewsShown; | 937 | previews = HiddenPreviewsShown; | ||
932 | else if (hps == 6) | 938 | else if (hps == 6) | ||
933 | previews = HiddenPreviewsAlways; | 939 | previews = HiddenPreviewsAlways; | ||
934 | setHiddenPreviews(previews); | 940 | setHiddenPreviews(previews); | ||
935 | 941 | | |||
936 | // TOOD: add setter | | |||
937 | animationSpeed = qBound(0, config.readEntry("AnimationSpeed", Options::defaultAnimationSpeed()), 6); | | |||
938 | | ||||
939 | auto interfaceToKey = [](OpenGLPlatformInterface interface) { | 942 | auto interfaceToKey = [](OpenGLPlatformInterface interface) { | ||
940 | switch (interface) { | 943 | switch (interface) { | ||
941 | case GlxPlatformInterface: | 944 | case GlxPlatformInterface: | ||
942 | return QStringLiteral("glx"); | 945 | return QStringLiteral("glx"); | ||
943 | case EglPlatformInterface: | 946 | case EglPlatformInterface: | ||
944 | return QStringLiteral("egl"); | 947 | return QStringLiteral("egl"); | ||
945 | default: | 948 | default: | ||
946 | return QString(); | 949 | return QString(); | ||
▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Line(s) | 1046 | { | |||
1057 | default: | 1060 | default: | ||
1058 | return MouseNothing; | 1061 | return MouseNothing; | ||
1059 | } | 1062 | } | ||
1060 | } | 1063 | } | ||
1061 | #endif | 1064 | #endif | ||
1062 | 1065 | | |||
1063 | double Options::animationTimeFactor() const | 1066 | double Options::animationTimeFactor() const | ||
1064 | { | 1067 | { | ||
1065 | const double factors[] = { 0, 0.2, 0.5, 1, 2, 4, 20 }; | 1068 | #ifndef KCMRULES | ||
1066 | return factors[ animationSpeed ]; | 1069 | return m_settings->animationDurationFactor(); | ||
1070 | #else | ||||
1071 | 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. | |||||
1072 | #endif | ||||
anthonyfieroni: Where this come from? | |||||
zzag: Window Rules KCM(kcmkwin/kwinrules) includes portions of KWin core. | |||||
1067 | } | 1073 | } | ||
1068 | 1074 | | |||
1069 | Options::WindowOperation Options::operationMaxButtonClick(Qt::MouseButtons button) const | 1075 | Options::WindowOperation Options::operationMaxButtonClick(Qt::MouseButtons button) const | ||
1070 | { | 1076 | { | ||
1071 | return button == Qt::RightButton ? opMaxButtonRightClick : | 1077 | return button == Qt::RightButton ? opMaxButtonRightClick : | ||
1072 | button == Qt::MidButton ? opMaxButtonMiddleClick : | 1078 | button == Qt::MidButton ? opMaxButtonMiddleClick : | ||
1073 | opMaxButtonLeftClick; | 1079 | opMaxButtonLeftClick; | ||
1074 | } | 1080 | } | ||
Show All 12 Lines |
Shouldn't this be 1?