Fix double-space period, shift double-tap; settings; letters from system keymap
- Double-space replaced the space via a Backspace keysym, which clients apply after the commit: use delete_surrounding_text with the commit - Tests use a shared FakeEngine that applies ops to a simulated field - Double-tap shift locks at a sentence start; typing between taps doesn't - Organization name set: config lives in ~/.config/sloposk/ - Settings (auto-capitalization, double-space period) with a ⚙ panel - Letter rows come from the compositor's XKB keymap; other letters of the layout become long-press alternates; globe switches the system layout over org.kde.keyboard - One JSON template for non-letter layers; stretch keys even out rows Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#include "Settings.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
namespace {
|
||||
constexpr auto AutoCapitalizeKey = "typing/autoCapitalize";
|
||||
constexpr auto DoubleSpacePeriodKey = "typing/doubleSpacePeriod";
|
||||
}
|
||||
|
||||
Settings::Settings(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
const QSettings store;
|
||||
const TypingOptions defaults;
|
||||
m_typing.autoCapitalize = store.value(AutoCapitalizeKey, defaults.autoCapitalize).toBool();
|
||||
m_typing.doubleSpacePeriod = store.value(DoubleSpacePeriodKey, defaults.doubleSpacePeriod).toBool();
|
||||
}
|
||||
|
||||
void Settings::setAutoCapitalize(bool enabled)
|
||||
{
|
||||
TypingOptions options = m_typing;
|
||||
options.autoCapitalize = enabled;
|
||||
setTypingOptions(options);
|
||||
}
|
||||
|
||||
void Settings::setDoubleSpacePeriod(bool enabled)
|
||||
{
|
||||
TypingOptions options = m_typing;
|
||||
options.doubleSpacePeriod = enabled;
|
||||
setTypingOptions(options);
|
||||
}
|
||||
|
||||
void Settings::setTypingOptions(const TypingOptions &options)
|
||||
{
|
||||
if (options == m_typing)
|
||||
return;
|
||||
m_typing = options;
|
||||
QSettings store;
|
||||
store.setValue(AutoCapitalizeKey, m_typing.autoCapitalize);
|
||||
store.setValue(DoubleSpacePeriodKey, m_typing.doubleSpacePeriod);
|
||||
Q_EMIT typingOptionsChanged();
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include "input/TypingOptions.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QtQml/qqmlregistration.h>
|
||||
|
||||
// User preferences, persisted with QSettings (~/.config/sloposk/sloposk.conf)
|
||||
// and editable from the keyboard's settings panel.
|
||||
class Settings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_UNCREATABLE("Created in C++")
|
||||
Q_PROPERTY(bool autoCapitalize READ autoCapitalize WRITE setAutoCapitalize NOTIFY typingOptionsChanged)
|
||||
Q_PROPERTY(bool doubleSpacePeriod READ doubleSpacePeriod WRITE setDoubleSpacePeriod NOTIFY typingOptionsChanged)
|
||||
|
||||
public:
|
||||
explicit Settings(QObject *parent = nullptr);
|
||||
|
||||
TypingOptions typingOptions() const { return m_typing; }
|
||||
|
||||
bool autoCapitalize() const { return m_typing.autoCapitalize; }
|
||||
void setAutoCapitalize(bool enabled);
|
||||
bool doubleSpacePeriod() const { return m_typing.doubleSpacePeriod; }
|
||||
void setDoubleSpacePeriod(bool enabled);
|
||||
|
||||
Q_SIGNALS:
|
||||
void typingOptionsChanged();
|
||||
|
||||
private:
|
||||
void setTypingOptions(const TypingOptions &options);
|
||||
|
||||
TypingOptions m_typing;
|
||||
};
|
||||
Reference in New Issue
Block a user