diff --git a/src/lib/common/Settings.cpp b/src/lib/common/Settings.cpp index 047b2623a..742ba998c 100644 --- a/src/lib/common/Settings.cpp +++ b/src/lib/common/Settings.cpp @@ -204,7 +204,7 @@ QVariant Settings::defaultValue(const QString &key) if (key == Daemon::LogFile) return QStringLiteral("%1/%2-daemon.log").arg(Settings::settingsPath(), kAppId); - if (key == Client::YScrollScale) + if (key == Client::YScrollScale || key == Client::XScrollScale) return 1.0; return QVariant(); diff --git a/src/lib/common/Settings.h b/src/lib/common/Settings.h index 4b235ccc2..8c7ee8079 100644 --- a/src/lib/common/Settings.h +++ b/src/lib/common/Settings.h @@ -35,7 +35,9 @@ public: struct Client { inline static const auto InvertYScroll = QStringLiteral("client/invertYScroll"); + inline static const auto InvertXScroll = QStringLiteral("client/invertXScroll"); inline static const auto YScrollScale = QStringLiteral("client/yScrollScale"); + inline static const auto XScrollScale = QStringLiteral("client/xScrollScale"); inline static const auto LanguageSync = QStringLiteral("client/languageSync"); inline static const auto RemoteHost = QStringLiteral("client/remoteHost"); inline static const auto XdpRestoreToken = QStringLiteral("client/xdpRestoreToken"); @@ -192,9 +194,11 @@ private: inline static const QStringList m_validKeys = { Settings::Client::InvertYScroll + , Settings::Client::InvertXScroll , Settings::Client::LanguageSync , Settings::Client::RemoteHost , Settings::Client::YScrollScale + , Settings::Client::XScrollScale , Settings::Client::XdpRestoreToken , Settings::Core::CoreMode , Settings::Core::Interface @@ -247,6 +251,7 @@ private: , Settings::Core::UseWlClipboard , Settings::Server::ExternalConfig , Settings::Client::InvertYScroll + , Settings::Client::InvertXScroll , Settings::Log::ToFile , Settings::Log::GuiDebug }; diff --git a/src/lib/deskflow/ISecondaryScreen.h b/src/lib/deskflow/ISecondaryScreen.h index 2453de99a..fe4879690 100644 --- a/src/lib/deskflow/ISecondaryScreen.h +++ b/src/lib/deskflow/ISecondaryScreen.h @@ -22,8 +22,10 @@ class ISecondaryScreen public: ISecondaryScreen() { - m_invertScroll = Settings::value(Settings::Client::InvertYScroll).toBool(); - m_scrollScale = std::clamp(Settings::value(Settings::Client::YScrollScale).toDouble(), 0.1, 10.0); + m_invertYScroll = Settings::value(Settings::Client::InvertYScroll).toBool(); + m_yScrollScale = std::clamp(Settings::value(Settings::Client::YScrollScale).toDouble(), 0.1, 10.0); + m_invertXScroll = Settings::value(Settings::Client::InvertXScroll).toBool(); + m_xScrollScale = std::clamp(Settings::value(Settings::Client::XScrollScale).toDouble(), 0.1, 10.0); } virtual ~ISecondaryScreen() = default; @@ -63,21 +65,34 @@ public: */ ScrollDelta applyScrollModifier(ScrollDelta delta) const { - delta.y = static_cast(m_invertScroll ? delta.y * -m_scrollScale : delta.y * m_scrollScale); + delta.y = static_cast(m_invertYScroll ? delta.y * -m_yScrollScale : delta.y * m_yScrollScale); + delta.x = static_cast(m_invertXScroll ? delta.x * -m_xScrollScale : delta.x * m_xScrollScale); return delta; } private: /** - * @brief this member is used to modify the scroll direction. + * @brief this member is used to modify the verical scroll direction. * It is used in the applyScrollModifier method */ - bool m_invertScroll = false; + bool m_invertYScroll = false; /** - * @brief this member is used to modify the scroll scale. + * @brief this member is used to modify the vertical scroll scale. * It is used in the applyScrollModifier method */ - double m_scrollScale = 1.0; + double m_yScrollScale = 1.0; + + /** + * @brief this member is used to modify the horizontal scroll direction. + * It is used in the applyScrollModifier method + */ + bool m_invertXScroll = false; + + /** + * @brief this member is used to modify the horizontal scroll scale. + * It is used in the applyScrollModifier method + */ + double m_xScrollScale = 1.0; //@} }; diff --git a/src/lib/gui/dialogs/ClientConfigDialog.cpp b/src/lib/gui/dialogs/ClientConfigDialog.cpp index 823ecfcdc..02a6e7250 100644 --- a/src/lib/gui/dialogs/ClientConfigDialog.cpp +++ b/src/lib/gui/dialogs/ClientConfigDialog.cpp @@ -55,20 +55,26 @@ void ClientConfigDialog::initConnections() const connect(ui->cbLanguageSync, &QCheckBox::checkStateChanged, this, &ClientConfigDialog::setButtonBoxEnabledButtons); connect(ui->cbYScrollInvert, &QCheckBox::checkStateChanged, this, &ClientConfigDialog::setButtonBoxEnabledButtons); connect(ui->sbYScrollScale, &QDoubleSpinBox::valueChanged, this, &ClientConfigDialog::setButtonBoxEnabledButtons); + connect(ui->cbXScrollInvert, &QCheckBox::checkStateChanged, this, &ClientConfigDialog::setButtonBoxEnabledButtons); + connect(ui->sbXScrollScale, &QDoubleSpinBox::valueChanged, this, &ClientConfigDialog::setButtonBoxEnabledButtons); } bool ClientConfigDialog::isModified() const { return (ui->cbLanguageSync->isChecked() != Settings::value(Settings::Client::LanguageSync).toBool()) || (ui->cbYScrollInvert->isChecked() != Settings::value(Settings::Client::InvertYScroll).toBool()) || - (ui->sbYScrollScale->value() != Settings::value(Settings::Client::YScrollScale).toDouble()); + (ui->sbYScrollScale->value() != Settings::value(Settings::Client::YScrollScale).toDouble()) || + (ui->cbXScrollInvert->isChecked() != Settings::value(Settings::Client::InvertXScroll).toBool()) || + (ui->sbXScrollScale->value() != Settings::value(Settings::Client::XScrollScale).toDouble()); } bool ClientConfigDialog::isDefault() const { return (ui->cbLanguageSync->isChecked() == Settings::defaultValue(Settings::Client::LanguageSync).toBool()) && (ui->cbYScrollInvert->isChecked() == Settings::defaultValue(Settings::Client::InvertYScroll).toBool()) && - (ui->sbYScrollScale->value() == Settings::defaultValue(Settings::Client::YScrollScale).toDouble()); + (ui->sbYScrollScale->value() == Settings::defaultValue(Settings::Client::YScrollScale).toDouble()) && + (ui->cbXScrollInvert->isChecked() == Settings::defaultValue(Settings::Client::InvertXScroll).toBool()) && + (ui->sbXScrollScale->value() == Settings::defaultValue(Settings::Client::XScrollScale).toDouble()); } void ClientConfigDialog::setButtonBoxEnabledButtons() const @@ -84,6 +90,8 @@ void ClientConfigDialog::load() ui->cbLanguageSync->setChecked(Settings::value(Settings::Client::LanguageSync).toBool()); ui->cbYScrollInvert->setChecked(Settings::value(Settings::Client::InvertYScroll).toBool()); ui->sbYScrollScale->setValue(Settings::value(Settings::Client::YScrollScale).toDouble()); + ui->cbXScrollInvert->setChecked(Settings::value(Settings::Client::InvertXScroll).toBool()); + ui->sbXScrollScale->setValue(Settings::value(Settings::Client::XScrollScale).toDouble()); } void ClientConfigDialog::resetToDefault() @@ -91,6 +99,8 @@ void ClientConfigDialog::resetToDefault() ui->cbLanguageSync->setChecked(Settings::defaultValue(Settings::Client::LanguageSync).toBool()); ui->cbYScrollInvert->setChecked(Settings::defaultValue(Settings::Client::InvertYScroll).toBool()); ui->sbYScrollScale->setValue(Settings::defaultValue(Settings::Client::YScrollScale).toDouble()); + ui->cbXScrollInvert->setChecked(Settings::defaultValue(Settings::Client::InvertXScroll).toBool()); + ui->sbXScrollScale->setValue(Settings::defaultValue(Settings::Client::XScrollScale).toDouble()); } void ClientConfigDialog::save() @@ -98,5 +108,7 @@ void ClientConfigDialog::save() Settings::setValue(Settings::Client::LanguageSync, ui->cbLanguageSync->isChecked()); Settings::setValue(Settings::Client::InvertYScroll, ui->cbYScrollInvert->isChecked()); Settings::setValue(Settings::Client::YScrollScale, ui->sbYScrollScale->value()); + Settings::setValue(Settings::Client::InvertXScroll, ui->cbXScrollInvert->isChecked()); + Settings::setValue(Settings::Client::XScrollScale, ui->sbXScrollScale->value()); QDialog::accept(); } diff --git a/src/lib/gui/dialogs/ClientConfigDialog.ui b/src/lib/gui/dialogs/ClientConfigDialog.ui index 5421f1dcd..bf994e99f 100644 --- a/src/lib/gui/dialogs/ClientConfigDialog.ui +++ b/src/lib/gui/dialogs/ClientConfigDialog.ui @@ -2,14 +2,6 @@ ClientConfigDialog - - - 0 - 0 - 425 - 148 - - 0 @@ -28,70 +20,132 @@ - - - Invert vertical scroll direction on this computer + + + Scroll Modifiers + + + + + Invert + + + + + + + Invert + + + + + + + + + + 0 + 0 + + + + Scale + + + + + + + + 0 + 0 + + + + true + + + QAbstractSpinBox::CorrectionMode::CorrectToNearestValue + + + 0.100000000000000 + + + 10.000000000000000 + + + 0.100000000000000 + + + 1.000000000000000 + + + + + + + + + + + + 0 + 0 + + + + Scale + + + + + + + + 0 + 0 + + + + true + + + QAbstractSpinBox::CorrectionMode::CorrectToNearestValue + + + 0.100000000000000 + + + 10.000000000000000 + + + 0.100000000000000 + + + 1.000000000000000 + + + + + + + + + Horizontal Scroll + + + + + + + Vertical Scroll + + + + - - - - - - - 0 - 0 - - - - Vertical Scroll Scale - - - - - - - - 0 - 0 - - - - true - - - QAbstractSpinBox::CorrectionMode::CorrectToNearestValue - - - 0.100000000000000 - - - 10.000000000000000 - - - 0.100000000000000 - - - 1.000000000000000 - - - - - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - @@ -105,38 +159,5 @@ - - - buttonBox - accepted() - ClientConfigDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - ClientConfigDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - + diff --git a/translations/deskflow_es.ts b/translations/deskflow_es.ts index ee485eac1..7a04f8297 100644 --- a/translations/deskflow_es.ts +++ b/translations/deskflow_es.ts @@ -150,12 +150,24 @@ p, li { white-space: pre-wrap; } Utilice el idioma del teclado del servidor en esta computadora - Invert vertical scroll direction on this computer - Invertir la dirección del desplazamiento vertical en este ordenador + Scroll Modifiers + Modificadores de desplazamiento - Vertical Scroll Scale - Escala de desplazamiento vertical + Invert + Invertir + + + Horizontal Scroll + Desplazamiento horizontal + + + Vertical Scroll + Desplazamiento vertical + + + Scale + Escala Close and save changes diff --git a/translations/deskflow_it.ts b/translations/deskflow_it.ts index 1aac3ad10..3d637b60d 100644 --- a/translations/deskflow_it.ts +++ b/translations/deskflow_it.ts @@ -150,12 +150,24 @@ p, li { white-space: pre-wrap; } Usa la lingua della tastiera del server su questo computer - Invert vertical scroll direction on this computer - Inverti la direzione dello scorrimento verticale su questo computer + Scroll Modifiers + Modificatori di scorrimento - Vertical Scroll Scale - Scala di scorrimento verticale + Invert + Invertire + + + Horizontal Scroll + Scorrimento orizzontale + + + Vertical Scroll + Scorrimento verticale + + + Scale + Scala Close and save changes diff --git a/translations/deskflow_ja.ts b/translations/deskflow_ja.ts index 4eb021b31..67752d3da 100644 --- a/translations/deskflow_ja.ts +++ b/translations/deskflow_ja.ts @@ -150,12 +150,24 @@ p, li { white-space: pre-wrap; } サーバー側のキーボード言語をこのコンピューターで使用する - Invert vertical scroll direction on this computer - このコンピューターで垂直スクロールの方向を反転させる + Scroll Modifiers + スクロール修飾子 - Vertical Scroll Scale - 垂直スクロールスケール + Invert + 反転 + + + Horizontal Scroll + 水平スクロール + + + Vertical Scroll + 垂直スクロール + + + Scale + 規模 Close and save changes diff --git a/translations/deskflow_ko.ts b/translations/deskflow_ko.ts index a0e6c4e1e..4c99190ec 100644 --- a/translations/deskflow_ko.ts +++ b/translations/deskflow_ko.ts @@ -150,12 +150,24 @@ p, li { white-space: pre-wrap; } 이 컴퓨터에서 서버의 키보드 언어 사용 - Invert vertical scroll direction on this computer - 이 컴퓨터에서 세로 스크롤 방향을 반전합니다 + Scroll Modifiers + 스크롤 수정자 - Vertical Scroll Scale - 수직 스크롤 스케일 + Invert + 거꾸로 하다 + + + Horizontal Scroll + 가로 스크롤 + + + Vertical Scroll + 세로 스크롤 + + + Scale + 규모 Close and save changes diff --git a/translations/deskflow_ru.ts b/translations/deskflow_ru.ts index 2ec05529e..f44ed0a0b 100644 --- a/translations/deskflow_ru.ts +++ b/translations/deskflow_ru.ts @@ -150,12 +150,24 @@ p, li { white-space: pre-wrap; } Использовать язык клавиатуры сервера на этом компьютере - Invert vertical scroll direction on this computer - Инвертировать направление вертикальной прокрутки на этом компьютере + Scroll Modifiers + Модификаторы прокрутки - Vertical Scroll Scale - Вертикальная шкала прокрутки + Invert + Инвертировать + + + Horizontal Scroll + Горизонтальная прокрутка + + + Vertical Scroll + Вертикальная прокрутка + + + Scale + Шкала Close and save changes diff --git a/translations/deskflow_zh_CN.ts b/translations/deskflow_zh_CN.ts index e73a63f60..8b40bb599 100644 --- a/translations/deskflow_zh_CN.ts +++ b/translations/deskflow_zh_CN.ts @@ -150,12 +150,24 @@ p, li { white-space: pre-wrap; } 在此计算机上使用服务器的键盘语言 - Invert vertical scroll direction on this computer - 在此计算机上反转垂直滚动方向 + Scroll Modifiers + 滚动修饰符 - Vertical Scroll Scale - 垂直滚动比例 + Invert + 倒置 + + + Horizontal Scroll + 水平滚动 + + + Vertical Scroll + 垂直滚动 + + + Scale + 规模 Close and save changes