SYNERGY-907 Client tray language switcher reverts to EN (#6989)

* SYNERGY-907 Client tray language switcher reverts to EN
*Dummy commit to update test coverage statistic

* SYNERGY-907 Client tray language switcher reverts to EN
*Update changelog

* SYNERGY-907 Client tray language switcher reverts to EN
* Test code to generate code coverage

* SYNERGY-907 Client tray language switcher reverts to EN
*Add first test for Windows hooks

* SYNERGY-907 Client tray language switcher reverts to EN
*Add parameter for language sync in client app

* SYNERGY-907 Client tray language switcher reverts to EN
*Remove debug code

* SYNERGY-907 Client tray language switcher reverts to EN
*Add sync language support in gui

* SYNERGY-907 Client tray language switcher reverts to EN
*Fix code smells

* SYNERGY-907 Client tray language switcher reverts to EN
*Add language sync checkbox to UI

* SYNERGY-907 Client tray language switcher reverts to EN
*Fix code smells

* SYNERGY-907 Client tray language switcher reverts to EN
*Change language sync to disable as default
*Bug fix

* SYNERGY-907 Client tray language switcher reverts to EN
*Hide language sync in GUI for server

Co-authored-by: Andrii Batyiev <andrii-external@symless.com>
Co-authored-by: Serhii Hadzhilov <serhii-external@symless.com>
This commit is contained in:
Andrey Batyiev 2021-05-13 09:30:24 +03:00 committed by GitHub
parent 350e2e247b
commit 431433f78a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 39 additions and 6 deletions

View file

@ -11,9 +11,10 @@ Bug fixes:
- #6976 Fix windows builds
- #6979 Manual config error in client mode
- #6983 Fix that mac client listens on ipv4 only
- #6989 Fix client tray language switcher reverts to EN
- #6993 Fix issues with prefences UI
- #6992 UI issues and use cases
=======
===========
Enhancements:
- #6954 Move language selection to advanced section

View file

@ -77,6 +77,7 @@ const char* AppConfig::m_SynergySettingsName[] = {
"serverHostname",
"tlsCertPath",
"tlsKeyLength",
"languageSync",
};
static const char* logLevelNames[] =
@ -239,6 +240,7 @@ void AppConfig::loadSettings()
m_UseInternalConfig = loadSetting(kUseInternalConfig, false).toBool();
m_ClientGroupChecked = loadSetting(kGroupClientCheck, false).toBool();
m_ServerHostname = loadSetting(kServerHostname).toString();
m_LanguageSync = loadSetting(kLanguageSync, false).toBool();
//only change the serial key if the settings being loaded contains a key
bool updateSerial = ConfigWriter::make()
@ -299,6 +301,7 @@ void AppConfig::saveSettings()
setSetting(kUseInternalConfig, m_UseInternalConfig);
setSetting(kGroupClientCheck, m_ClientGroupChecked);
setSetting(kServerHostname, m_ServerHostname);
setSetting(kLanguageSync, m_LanguageSync);
}
m_unsavedChanges = false;
@ -448,6 +451,12 @@ void AppConfig::setMinimizeToTray(bool newValue) {
setSettingModified(m_MinimizeToTray, newValue);
}
bool AppConfig::getLanguageSync() const { return m_LanguageSync; }
void AppConfig::setLanguageSync(bool newValue) {
setSettingModified(m_LanguageSync, newValue);
}
bool AppConfig::getMinimizeToTray() { return m_MinimizeToTray; }
QString AppConfig::settingName(AppConfig::Setting name) {

View file

@ -112,6 +112,8 @@ class AppConfig: public QObject, public GUI::Config::ConfigBase
void setAutoHide(bool b);
bool getAutoHide();
void setLanguageSync(bool b);
bool getLanguageSync() const;
#ifndef SYNERGY_ENTERPRISE
bool activationHasRun() const;
AppConfig& activationHasRun(bool value);
@ -200,6 +202,7 @@ protected:
kServerHostname,
kTLSCertPath,
kTLSKeyLength,
kLanguageSync
};
void setScreenName(const QString& s);
@ -242,6 +245,7 @@ protected:
int m_LastExpiringWarningTime;
bool m_ActivationHasRun;
bool m_MinimizeToTray;
bool m_LanguageSync = false;
bool m_ServerGroupChecked;
bool m_UseExternalConfig;

View file

@ -753,6 +753,12 @@ bool MainWindow::clientArgs(QStringList& args, QString& app)
args << "--log" << appConfig().logFilenameCmd();
}
if (appConfig().getLanguageSync())
{
args << "--sync-language";
}
#if !defined(SYNERGY_ENTERPRISE) && defined(SYNERGY_AUTOCONFIG)
// check auto config first, if it is disabled or no server detected,
// use line edit host name if it is not empty

View file

@ -52,6 +52,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
buttonBox->button(QDialogButtonBox::Save)->setEnabled(false);
enableControls(appConfig().isWritable());
m_pCheckBoxLanguageSync->setVisible(m_pMainWindow->synergyType() == MainWindow::synergyClient);
const auto& serveConfig = m_pMainWindow->serverConfig();
m_pLineEditScreenName->setValidator(new validators::ScreenNameValidator(m_pLineEditScreenName, m_pLabelNameError, (&serveConfig.screens())));
@ -61,6 +62,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
connect(m_pCheckBoxAutoConfig, SIGNAL(clicked()), this, SLOT(onChange()));
connect(m_pCheckBoxMinimizeToTray, SIGNAL(clicked()), this, SLOT(onChange()));
connect(m_pCheckBoxAutoHide, SIGNAL(clicked()), this, SLOT(onChange()));
connect(m_pCheckBoxLanguageSync, SIGNAL(clicked()), this, SLOT(onChange()));
connect(m_pLineEditInterface, SIGNAL(textEdited(QString)), this, SLOT(onChange()));
connect(m_pSpinBoxPort, SIGNAL(valueChanged(int)), this, SLOT(onChange()));
connect(m_pLineEditScreenName, SIGNAL(textEdited(QString)), this, SLOT(onChange()));
@ -81,6 +83,7 @@ void SettingsDialog::accept()
appConfig().setLanguage(m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString());
appConfig().setElevateMode(static_cast<ElevateMode>(m_pComboElevate->currentIndex()));
appConfig().setAutoHide(m_pCheckBoxAutoHide->isChecked());
appConfig().setLanguageSync(m_pCheckBoxLanguageSync->isChecked());
appConfig().setAutoConfig(m_pCheckBoxAutoConfig->isChecked());
appConfig().setMinimizeToTray(m_pCheckBoxMinimizeToTray->isChecked());
appConfig().setTLSCertPath(m_pLineEditCertificatePath->text());
@ -139,6 +142,7 @@ void SettingsDialog::loadFromConfig() {
m_pLineEditLogFilename->setText(appConfig().logFilename());
setIndexFromItemData(m_pComboLanguage, appConfig().language());
m_pCheckBoxAutoHide->setChecked(appConfig().getAutoHide());
m_pCheckBoxLanguageSync->setChecked(appConfig().getLanguageSync());
m_pCheckBoxMinimizeToTray->setChecked(appConfig().getMinimizeToTray());
m_pLineEditCertificatePath->setText(appConfig().getTLSCertPath());
m_pCheckBoxEnableCrypto->setChecked(m_appConfig.getCryptoEnabled());
@ -326,6 +330,7 @@ bool SettingsDialog::isModified()
|| appConfig().language() != m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString()
|| appConfig().elevateMode() != static_cast<ElevateMode>(m_pComboElevate->currentIndex())
|| appConfig().getAutoHide() != m_pCheckBoxAutoHide->isChecked()
|| appConfig().getLanguageSync() != m_pCheckBoxLanguageSync->isChecked()
|| appConfig().autoConfig() != m_pCheckBoxAutoConfig->isChecked()
|| appConfig().getMinimizeToTray() != m_pCheckBoxMinimizeToTray->isChecked()
|| appConfig().getTLSCertPath() != m_pLineEditCertificatePath->text()
@ -344,6 +349,7 @@ void SettingsDialog::enableControls(bool enable) {
m_pComboLanguage->setEnabled(enable);
m_pComboElevate->setEnabled(enable);
m_pCheckBoxAutoHide->setEnabled(enable);
m_pCheckBoxLanguageSync->setEnabled(enable);
m_pCheckBoxAutoConfig->setEnabled(enable);
m_pCheckBoxMinimizeToTray->setEnabled(enable);
m_pLineEditCertificatePath->setEnabled(enable);

View file

@ -101,13 +101,16 @@ ArgParser::parseClientArgs(lib::synergy::ClientArgs& args, int argc, const char*
++i;
continue;
}
else if (isArg(i, argc, argv, NULL, "--camp")) {
else if (isArg(i, argc, argv, nullptr, "--sync-language")) {
argsBase().m_enableLangSync = true;
}
else if (isArg(i, argc, argv, nullptr, "--camp")) {
// ignore -- included for backwards compatibility
}
else if (isArg(i, argc, argv, NULL, "--no-camp")) {
else if (isArg(i, argc, argv, nullptr, "--no-camp")) {
// ignore -- included for backwards compatibility
}
else if (isArg(i, argc, argv, NULL, "--yscroll", 1)) {
else if (isArg(i, argc, argv, nullptr, "--yscroll", 1)) {
// define scroll
args.m_yscroll = atoi(argv[++i]);
}

View file

@ -57,6 +57,7 @@ namespace lib {
String m_profileDirectory; /// @brief The profile DIR to use for the application
String m_pluginDirectory; /// @brief //TODO Plugins? Get set in ARCH but doesn't seem to get used
String m_tlsCertFile; /// @brief Contains the location of the TLS certificate file
bool m_enableLangSync = false; /// @brief Should keyboard input be in same language as on server
#if SYSAPI_WIN32
bool m_debugServiceWait = false;
@ -76,4 +77,4 @@ namespace lib {
}
}
#endif //SYNERGY_CORE_ARGSBASE_H
#endif //SYNERGY_CORE_ARGSBASE_H

View file

@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/App.h"
#include "synergy/ArgsBase.h"
#include "synergy/KeyMap.h"
#include "synergy/key_types.h"
#include "base/Log.h"
@ -761,7 +763,8 @@ KeyMap::keysForKeyItem(const KeyItem& keyItem, SInt32& group,
KeyModifierAltGr | KeyModifierNumLock | KeyModifierScrollLock;
// add keystrokes to adjust the group
if (group != keyItem.m_group) {
if (App::instance().argsBase().m_enableLangSync &&
group != keyItem.m_group) {
group = keyItem.m_group;
keystrokes.push_back(Keystroke(group, true, false));
}