Files
@ 12603d48a708
Branch filter:
Location: tempo-plotter/src/binarystreamreadersettings.cpp - annotation
12603d48a708
3.2 KiB
text/x-c++hdr
fix symbol show settings not loaded at startup
'toggled' is emitted for 'setChecked', 'triggered' is only emitted when user
actually clicks something
'toggled' is emitted for 'setChecked', 'triggered' is only emitted when user
actually clicks something
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 3da4b5482573 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 556aa6f24713 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 ecd02467c397 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 3da4b5482573 | /*
Copyright © 2016 Hasan Yavuz Özderya
This file is part of serialplot.
serialplot is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
serialplot is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with serialplot. If not, see <http://www.gnu.org/licenses/>.
*/
#include "binarystreamreadersettings.h"
#include "ui_binarystreamreadersettings.h"
#include "utils.h"
#include "setting_defines.h"
BinaryStreamReaderSettings::BinaryStreamReaderSettings(QWidget *parent) :
QWidget(parent),
ui(new Ui::BinaryStreamReaderSettings)
{
ui->setupUi(this);
// Note: if directly connected we get a runtime warning on incompatible signal arguments
connect(ui->spNumOfChannels, SELECT<int>::OVERLOAD_OF(&QSpinBox::valueChanged),
[this](int value)
{
emit numOfChannelsChanged(value);
});
connect(ui->nfBox, SIGNAL(selectionChanged(NumberFormat)),
this, SIGNAL(numberFormatChanged(NumberFormat)));
connect(ui->pbSkipByte, SIGNAL(clicked()), this, SIGNAL(skipByteRequested()));
connect(ui->pbSkipSample, SIGNAL(clicked()), this, SIGNAL(skipSampleRequested()));
}
BinaryStreamReaderSettings::~BinaryStreamReaderSettings()
{
delete ui;
}
unsigned BinaryStreamReaderSettings::numOfChannels()
{
return ui->spNumOfChannels->value();
}
NumberFormat BinaryStreamReaderSettings::numberFormat()
{
return ui->nfBox->currentSelection();
}
Endianness BinaryStreamReaderSettings::endianness()
{
return ui->endiBox->currentSelection();
}
void BinaryStreamReaderSettings::saveSettings(QSettings* settings)
{
settings->beginGroup(SettingGroup_Binary);
settings->setValue(SG_Binary_NumOfChannels, numOfChannels());
settings->setValue(SG_Binary_NumberFormat, numberFormatToStr(numberFormat()));
settings->setValue(SG_Binary_Endianness,
endianness() == LittleEndian ? "little" : "big");
settings->endGroup();
}
void BinaryStreamReaderSettings::loadSettings(QSettings* settings)
{
settings->beginGroup(SettingGroup_Binary);
// load number of channels
ui->spNumOfChannels->setValue(
settings->value(SG_Binary_NumOfChannels, numOfChannels()).toInt());
// load number format
NumberFormat nfSetting =
strToNumberFormat(settings->value(SG_Binary_NumberFormat,
QString()).toString());
if (nfSetting == NumberFormat_INVALID) nfSetting = numberFormat();
ui->nfBox->setSelection(nfSetting);
// load endianness
QString endiannessSetting =
settings->value(SG_Binary_Endianness, QString()).toString();
if (endiannessSetting == "little")
{
ui->endiBox->setSelection(LittleEndian);
}
else if (endiannessSetting == "big")
{
ui->endiBox->setSelection(BigEndian);
} // else don't change
settings->endGroup();
}
|