Fix imaginary j setting (preservation after restart and keypad button) (issue #29); Remove debug output
This commit is contained in:
parent
bc1031875a
commit
2f133672db
@ -1866,7 +1866,6 @@ void ExpressionEdit::showCurrentStatus() {
|
||||
std::string str_nohtml = unhtmlize(current_status_text.toStdString());
|
||||
std::string current_text = toPlainText().toStdString();
|
||||
remove_spaces(current_text);
|
||||
qDebug() << str_nohtml.length();
|
||||
if(current_status_is_expression && settings->auto_calculate && str_nohtml.length() <= 2000) {
|
||||
bool b_comp = false, is_approximate = false;
|
||||
PrintOptions po = settings->printops;
|
||||
|
@ -207,7 +207,8 @@ KeypadWidget::KeypadWidget(QWidget *parent) : QWidget(parent) {
|
||||
button->setText("x!");
|
||||
c++;
|
||||
ITEM_BUTTON3(CALCULATOR->getVariableById(VARIABLE_ID_PI), CALCULATOR->getVariableById(VARIABLE_ID_E), CALCULATOR->getVariableById(VARIABLE_ID_EULER), SIGN_PI, c, 3);
|
||||
ITEM_OPERATOR_ITEM_BUTTON(CALCULATOR->getVariableById(VARIABLE_ID_I), "∠", CALCULATOR->getFunctionById(FUNCTION_ID_ARG), "i", c, 2);
|
||||
ITEM_OPERATOR_ITEM_BUTTON(CALCULATOR->getVariableById(VARIABLE_ID_I), "∠", CALCULATOR->getFunctionById(FUNCTION_ID_ARG), CALCULATOR->getVariableById(VARIABLE_ID_I)->hasName("j") > 0 ? "j" : "i", c, 2);
|
||||
imaginaryButton = button;
|
||||
QFont ifont(button->font());
|
||||
ifont.setStyle(QFont::StyleItalic);
|
||||
button->setFont(ifont);
|
||||
@ -358,6 +359,7 @@ KeypadWidget::KeypadWidget(QWidget *parent) : QWidget(parent) {
|
||||
KeypadWidget::~KeypadWidget() {}
|
||||
|
||||
void KeypadWidget::updateSymbols() {
|
||||
multiplicationButton->setText(settings->multiplicationSign());
|
||||
multiplicationButton->setText(settings->multiplicationSign());
|
||||
multiplicationButton->setProperty(BUTTON_DATA, settings->multiplicationSign());
|
||||
divisionButton->setText(settings->divisionSign());
|
||||
@ -366,6 +368,7 @@ void KeypadWidget::updateSymbols() {
|
||||
commaButton->setProperty(BUTTON_DATA, QString::fromStdString(CALCULATOR->getComma()));
|
||||
dotButton->setText(QString::fromStdString(CALCULATOR->getDecimalPoint()));
|
||||
dotButton->setProperty(BUTTON_DATA, QString::fromStdString(CALCULATOR->getDecimalPoint()));
|
||||
imaginaryButton->setText(CALCULATOR->getVariableById(VARIABLE_ID_I)->hasName("j") > 0 ? "j" : "i");
|
||||
}
|
||||
void KeypadWidget::changeEvent(QEvent *e) {
|
||||
if(e->type() == QEvent::PaletteChange || e->type() == QEvent::ApplicationPaletteChange) {
|
||||
|
@ -65,7 +65,7 @@ class KeypadWidget : public QWidget {
|
||||
|
||||
protected:
|
||||
|
||||
KeypadButton *sinButton, *cosButton, *tanButton, *delButton, *acButton, *backButton, *forwardButton, *dotButton, *commaButton, *multiplicationButton, *divisionButton;
|
||||
KeypadButton *sinButton, *cosButton, *tanButton, *delButton, *acButton, *backButton, *forwardButton, *dotButton, *commaButton, *multiplicationButton, *divisionButton, *imaginaryButton;
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
protected slots:
|
||||
|
@ -150,6 +150,15 @@ int main(int argc, char **argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(settings->do_imaginary_j && CALCULATOR->getVariableById(VARIABLE_ID_I)->hasName("j") == 0) {
|
||||
Variable *v_i = CALCULATOR->getVariableById(VARIABLE_ID_I);
|
||||
ExpressionName ename = v_i->getName(1);
|
||||
ename.name = "j";
|
||||
ename.reference = false;
|
||||
v_i->addName(ename, 1, true);
|
||||
v_i->setChanged(false);
|
||||
}
|
||||
|
||||
settings->f_answer->setCategory(CALCULATOR->getFunctionById(FUNCTION_ID_WARNING)->category());
|
||||
settings->f_answer->setChanged(false);
|
||||
|
||||
|
@ -329,6 +329,7 @@ void PreferencesDialog::imaginaryJToggled(bool b) {
|
||||
v_i->setChanged(false);
|
||||
}
|
||||
emit expressionFormatUpdated(false);
|
||||
emit symbolsUpdated();
|
||||
}
|
||||
void PreferencesDialog::decimalCommaToggled(bool b) {
|
||||
settings->decimal_comma = b;
|
||||
|
@ -744,13 +744,6 @@ void QalculateQtSettings::loadPreferences() {
|
||||
ename.name = "MRC";
|
||||
v_memory->addName(ename);
|
||||
CALCULATOR->addVariable(v_memory);
|
||||
if(do_imaginary_j && CALCULATOR->v_i->hasName("j") == 0) {
|
||||
ExpressionName ename = CALCULATOR->v_i->getName(1);
|
||||
ename.name = "j";
|
||||
ename.reference = false;
|
||||
CALCULATOR->v_i->addName(ename, 1, true);
|
||||
CALCULATOR->v_i->setChanged(false);
|
||||
}
|
||||
|
||||
if(style >= 0) updateStyle();
|
||||
else if(palette >= 0) updatePalette();
|
||||
@ -936,7 +929,7 @@ void QalculateQtSettings::savePreferences(bool) {
|
||||
fprintf(file, "use_unicode_signs=%i\n", printops.use_unicode_signs);
|
||||
fprintf(file, "lower_case_numbers=%i\n", printops.lower_case_numbers);
|
||||
fprintf(file, "e_notation=%i\n", printops.lower_case_e);
|
||||
fprintf(file, "imaginary_j=%i\n", CALCULATOR->v_i->hasName("j") > 0);
|
||||
fprintf(file, "imaginary_j=%i\n", CALCULATOR->getVariableById(VARIABLE_ID_I)->hasName("j") > 0);
|
||||
fprintf(file, "base_display=%i\n", printops.base_display);
|
||||
if(tc_set) fprintf(file, "temperature_calculation=%i\n", CALCULATOR->getTemperatureCalculationMode());
|
||||
fprintf(file, "auto_update_exchange_rates=%i\n", auto_update_exchange_rates);
|
||||
|
Loading…
x
Reference in New Issue
Block a user