Add option to disable cursor blinking

This commit is contained in:
Hanna K. 2024-12-03 12:32:53 +01:00
parent 151aa07af3
commit eda024688a
5 changed files with 15 additions and 1 deletions

View File

@ -205,6 +205,7 @@ int main(int argc, char **argv) {
settings->loadPreferences();
if(!parser->value(wOption).isEmpty()) settings->loadWorkspace(parser->value(wOption).toLocal8Bit().data());
if(settings->disable_cursor_blinking) app.setCursorFlashTime(0);
CALCULATOR->loadExchangeRates();
@ -261,6 +262,7 @@ int main(int argc, char **argv) {
}
win->setCommandLineParser(parser);
win->show();
app.processEvents();
win->initFinished();

View File

@ -24,8 +24,8 @@
#include <QFontDialog>
#include <QStyleFactory>
#include <QMessageBox>
#include <QApplication>
#if defined _WIN32 && (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
# include <QApplication>
# include <QStyleHints>
#endif
#include <QDebug>
@ -165,6 +165,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) : QDialog(parent) {
#else
BOX(tr("Dark mode"), settings->palette == 1, darkModeToggled(bool));
#endif
BOX(tr("Disable cursor blinking"), settings->disable_cursor_blinking, disableCursorBlinkingToggled(bool));
BOX(tr("Colorize result"), settings->colorize_result, colorizeToggled(bool));
BOX(tr("Format result"), settings->format_result, formatToggled(bool));
BOX1(tr("Custom result font:"), settings->use_custom_result_font, resultFontToggled(bool));
@ -693,6 +694,11 @@ void PreferencesDialog::automaticDigitGroupingToggled(bool b) {
void PreferencesDialog::closeWithEscToggled(bool b) {
settings->close_with_esc = b;
}
void PreferencesDialog::disableCursorBlinkingToggled(bool b) {
settings->disable_cursor_blinking = b;
if(b) qApp->setCursorFlashTime(0);
else qApp->setCursorFlashTime(1000);
}
void PreferencesDialog::mixedUnitsToggled(bool b) {
if(b) settings->evalops.mixed_units_conversion = MIXED_UNITS_CONVERSION_DEFAULT;
else settings->evalops.mixed_units_conversion = MIXED_UNITS_CONVERSION_NONE;

View File

@ -109,6 +109,7 @@ class PreferencesDialog : public QDialog {
void caretAsXorToggled(bool);
void automaticDigitGroupingToggled(bool);
void closeWithEscToggled(bool);
void disableCursorBlinkingToggled(bool);
public:

View File

@ -702,6 +702,8 @@ void QalculateQtSettings::readPreferenceValue(const std::string &svar, const std
#else
palette = v;
#endif
} else if(svar == "disable_cursor_blinking") {
disable_cursor_blinking = v;
} else if(svar == "color") {
colorize_result = v;
} else if(svar == "format") {
@ -1030,6 +1032,7 @@ void QalculateQtSettings::loadPreferences() {
custom_app_font = "";
style = "";
palette = -1;
disable_cursor_blinking = false;
replace_expression = KEEP_EXPRESSION;
autocopy_result = false;
save_mode_on_exit = true;
@ -1470,6 +1473,7 @@ bool QalculateQtSettings::savePreferences(const char *filename, bool is_workspac
fprintf(file, "separate_keypad_menu_buttons=%i\n", separate_keypad_menu_buttons);
fprintf(file, "palette=%i\n", palette);
fprintf(file, "color=%i\n", colorize_result);
if(disable_cursor_blinking) fprintf(file, "disable_cursor_blinking=%i\n", disable_cursor_blinking);
if(!format_result) fprintf(file, "format=%i\n", format_result);
fprintf(file, "use_custom_result_font=%i\n", use_custom_result_font);
fprintf(file, "use_custom_expression_font=%i\n", use_custom_expression_font);

View File

@ -281,6 +281,7 @@ class QalculateQtSettings : QObject {
QByteArray units_geometry, units_vsplitter_state, units_hsplitter_state;
QByteArray variables_geometry, variables_vsplitter_state, variables_hsplitter_state;
QByteArray datasets_geometry, datasets_vsplitter_state, datasets_hsplitter_state;
bool disable_cursor_blinking;
bool wayland_platform;
int preserve_history_height;