Files
@ 724d38d30fb1
Branch filter:
Location: tempo-plotter/src/framedreadersettings.cpp - annotation
724d38d30fb1
3.4 KiB
text/x-c++hdr
renamed hasFrameByte to hasSizeByte
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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 1bb06061a415 dcd6029a3bce 1bb06061a415 1bb06061a415 1bb06061a415 | /*
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 "utils.h"
#include "framedreadersettings.h"
#include "ui_framedreadersettings.h"
FramedReaderSettings::FramedReaderSettings(QWidget *parent) :
QWidget(parent),
ui(new Ui::FramedReaderSettings)
{
ui->setupUi(this);
ui->leSyncWord->setMode(false); // hex mode
connect(ui->cbChecksum, &QCheckBox::toggled,
[this](bool enabled)
{
emit checksumChanged(enabled);
});
connect(ui->rbFixedSize, &QRadioButton::toggled,
ui->spSize, &QWidget::setEnabled);
connect(ui->rbFixedSize, &QRadioButton::toggled,
[this](bool checked)
{
emit frameSizeChanged(frameSize());
});
// Note: if directly connected we get a runtime warning on incompatible signal arguments
connect(ui->spSize, SELECT<int>::OVERLOAD_OF(&QSpinBox::valueChanged),
[this](int value)
{
emit frameSizeChanged(value);
});
connect(ui->spNumOfChannels, SELECT<int>::OVERLOAD_OF(&QSpinBox::valueChanged),
[this](int value)
{
emit numOfChannelsChanged(value);
});
connect(ui->leSyncWord, &QLineEdit::textChanged,
this, &FramedReaderSettings::onSyncWordEdited);
connect(ui->nfBox, SIGNAL(selectionChanged(NumberFormat)),
this, SIGNAL(numberFormatChanged(NumberFormat)));
}
FramedReaderSettings::~FramedReaderSettings()
{
delete ui;
}
void FramedReaderSettings::showMessage(QString message, bool error)
{
ui->lMessage->setText(message);
if (error)
{
ui->lMessage->setStyleSheet("color: red;");
}
else
{
ui->lMessage->setStyleSheet("");
}
}
unsigned FramedReaderSettings::numOfChannels()
{
return ui->spNumOfChannels->value();
}
NumberFormat FramedReaderSettings::numberFormat()
{
return ui->nfBox->currentSelection();
}
Endianness FramedReaderSettings::endianness()
{
return ui->endiBox->currentSelection();
}
QByteArray FramedReaderSettings::syncWord()
{
QString text = ui->leSyncWord->text().remove(' ');
// check if nibble is missing
if (text.size() % 2 == 1)
{
// TODO: remove this warning
return QByteArray();
}
else
{
return QByteArray::fromHex(text.toLatin1());
}
}
void FramedReaderSettings::onSyncWordEdited()
{
// TODO: emit with a delay so that error message doesn't flash!
emit syncWordChanged(syncWord());
}
unsigned FramedReaderSettings::frameSize()
{
if (ui->rbFixedSize->isChecked())
{
return ui->spSize->value();
}
else
{
return 0; // frame byte is enabled
}
}
bool FramedReaderSettings::isChecksumEnabled()
{
return ui->cbChecksum->isChecked();
}
|