-
Notifications
You must be signed in to change notification settings - Fork 160
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
Adding of features asked for in issue #397 #643
base: master
Are you sure you want to change the base?
Conversation
Added shortcuts for clearing source text, switching languages and switching engine in settings
Added the requiere lines to be able to save the shortcuts
Assigned the clear text shortcut to its existing button in the main UI
QKeySequence clearShortcut() const; | ||
void setClearShortcut(const QKeySequence &shortcut); | ||
static QKeySequence defaultClearShortcut(); | ||
|
||
QKeySequence switchSourceShortcut() const; | ||
void setSwitchSourceShortcut(const QKeySequence &shortcut); | ||
static QKeySequence defaultSwitchSourceShortcut(); | ||
|
||
QKeySequence switchTranslationShortcut() const; | ||
void setSwitchTranslationShortcut(const QKeySequence &shortcut); | ||
static QKeySequence defaultSwitchTranslationShortcut(); | ||
|
||
QKeySequence switchEngineShortcut() const; | ||
void setSwitchEngineShortcut(const QKeySequence &shortcut); | ||
static QKeySequence defaultSwitchEngineShortcut(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add definitions of these function in appsettings.cpp
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid i don't really know how this would be done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just look into similar functions and copy them with minor edits :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to start with clear
button. Just only this one in this PR to learn how it's usually done.
@@ -1063,6 +1063,7 @@ void MainWindow::loadAppSettings() | |||
ui->translateButton->setShortcut(settings.translateShortcut()); | |||
ui->swapButton->setShortcut(settings.swapShortcut()); | |||
ui->copyTranslationButton->setShortcut(settings.copyTranslationShortcut()); | |||
ui->clearButton->setShortcut(settings.clearShortcut()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct, but you also need to assign other buttons. Search for their names in mainwindow.ui
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there are buttons for the other actions. I don't have the knowledge to code them either, sadly
More than a year ago i suggested what keymaps to be used for the shortcuts asked in #397. Maintainer explained what would have to be done in the code to add these to the project, but i preferred to left that to someone else back then because i have almost no knowledge of C++ or programming in general. Since the Issue thread went silent after that, i eventually decided to give it a try and do it myself following the instruction of Shatur. I don't think i knew what i was doing and I'm not sure if i did it right, if i forgot something, if i followed the style of the project or if i broke things rather than improving them, but i hope these commits will at least be helpful in finally adding the features and closing the issue.
I'll await for your feedback and corrections.