Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a language layout switching button #14

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

Johannes-bichler
Copy link

Hello,
This keyboard does support multiple layouts, but does not support switching between them at runtime.
For this purpose, I've implemented a button (LanguageKey), that switches between a List of Layouts that can be set via a property (availableLanguageLayouts) in InputPanel.
As this layout switching was added, the Greek Layout was changed to be similar to the others, as the internal layout switcher
(greek-latin) is no longer needed.
If this property is kept empty, it will be automatically set to En, but the property languageLayout overrides this.
If only one language is selected, the layout changer will not be visible.
If an invalid layout is added to the list property, it will fallback to "En".

@AndreaRicchi AndreaRicchi force-pushed the main branch 2 times, most recently from 33a0d09 to 489e5db Compare April 24, 2024 09:55
Copy link
Contributor

@AndreaRicchi AndreaRicchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution, this is a great improvement. Some minor comments regarding code formatting. Also, I suggest squashing the two commits for a cleaner history.

@@ -227,7 +227,12 @@ ColumnLayout {
property real keyWeight: 154

SymbolKey {
weight: 217
weight: availableLanguageLayouts.length === 1? 217 : 108.5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is not formatted! Also all the other layouts.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Johannes-bichler I think this one from
weight: availableLanguageLayouts.length === 1? 217 : 108.5
to
weight: availableLanguageLayouts.length === 1 ? 217 : 108.5

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@panicking I have used the QtCreator included QML Formatter and it worked exactly like you proposed. 😁

@@ -135,6 +142,13 @@ Item {
}
}

Connections{
target: InputPanel
onLanguageLayoutChanged:{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same: not formatted

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Johannes-bichler from Connections{ to Connections {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same: not formatted

Added a button to switch language with an Icon and a property to set a list of available languages as StringList, same Format as languageLayout

Reformatted code according to  requested changes
@Johannes-bichler
Copy link
Author

Formatting has been completed and commits were squashed, everything should look fine now.

@AndreaRicchi
Copy link
Contributor

@Johannes-bichler you can also use the QML formatter included in the Qt SDK!

@AndreaRicchi AndreaRicchi merged commit 6371090 into amarula:main Apr 30, 2024
1 check passed
@dpurgin dpurgin deleted the layout-switch-button branch May 2, 2024 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants