Set max. column count to 90

This commit is contained in:
Alex Spataru 2021-01-22 09:12:53 -05:00
parent d84d8a4a86
commit 08f4bfd0d0
8 changed files with 31 additions and 47 deletions

View File

@ -88,7 +88,7 @@ IndentWidth: 4
#StatementMacros ['Q_OBJECT', 'Q_UNUSED']
ColumnLimit: 80
ColumnLimit: 90

View File

@ -189,9 +189,8 @@ void CsvPlayer::toggle()
void CsvPlayer::openFile()
{
// Get file name
auto file = QFileDialog::getOpenFileName(Q_NULLPTR, tr("Select CSV file"),
QDir::homePath(),
tr("CSV files") + " (*.csv)");
auto file = QFileDialog::getOpenFileName(
Q_NULLPTR, tr("Select CSV file"), QDir::homePath(), tr("CSV files") + " (*.csv)");
// Open CSV file
if (!file.isEmpty())
@ -272,8 +271,7 @@ void CsvPlayer::openFile(const QString &filePath)
if (sm->connected())
{
LOG_INFO() << "Serial device open, asking user what to do...";
auto response
= NiceMessageBox(tr("Serial port open, do you want to continue?"),
auto response = NiceMessageBox(tr("Serial port open, do you want to continue?"),
tr("In order to use this feature, its necessary "
"to disconnect from the serial port"),
qAppName(), QMessageBox::No | QMessageBox::Yes);
@ -314,8 +312,7 @@ void CsvPlayer::openFile(const QString &filePath)
// Show error to the user
else
{
NiceMessageBox(
tr("There is an error with the data in the CSV file"),
NiceMessageBox(tr("There is an error with the data in the CSV file"),
tr("Please verify that the CSV file was created with Serial "
"Studio"));
}
@ -583,8 +580,7 @@ QJsonDocument CsvPlayer::getJsonFrame(const int row)
auto dataset = datasets.at(j).toObject();
if (dataset.value("t") == datasetKey)
{
auto value = values.at(
getDatasetIndex(groupKey, datasetKey));
auto value = values.at(getDatasetIndex(groupKey, datasetKey));
dataset.remove("v");
dataset.insert("v", value);
}
@ -638,8 +634,7 @@ QString CsvPlayer::getCellValue(int row, int column, bool *error)
* Returns the column/index for the dataset key that belongs to the given
* group key.
*/
int CsvPlayer::getDatasetIndex(const QString &groupKey,
const QString &datasetKey)
int CsvPlayer::getDatasetIndex(const QString &groupKey, const QString &datasetKey)
{
if (m_datasetIndexes.contains(groupKey))
{

View File

@ -159,8 +159,7 @@ void DataProvider::update()
void DataProvider::resetData()
{
// Stop if dev. man is not disconnected or if CSV file is open
if (SerialManager::getInstance()->connected()
|| CsvPlayer::getInstance()->isOpen())
if (SerialManager::getInstance()->connected() || CsvPlayer::getInstance()->isOpen())
return;
// Delete existing groups

View File

@ -142,8 +142,7 @@ void Export::openCurrentCsv()
RevealFile(m_csvFile.fileName());
else
QMessageBox::critical(Q_NULLPTR, tr("CSV file not open"),
tr("Cannot find CSV export file!"),
QMessageBox::Ok);
tr("Cannot find CSV export file!"), QMessageBox::Ok);
}
/**
@ -228,8 +227,7 @@ void Export::writeValues()
// Construct dataset title from group, dataset title & units
QString title;
if (datasetUnits.isEmpty())
title
= QString("(%1) %2").arg(groupTitle).arg(datasetTitle);
title = QString("(%1) %2").arg(groupTitle).arg(datasetTitle);
else
title = QString("(%1) %2 [%3]")
.arg(groupTitle)

View File

@ -57,8 +57,7 @@ GraphProvider::GraphProvider()
qRegisterMetaType<QAbstractAxis *>();
// Update graph values as soon as QML Bridge interprets data
connect(DataProvider::getInstance(), SIGNAL(updated()), this,
SLOT(updateValues()));
connect(DataProvider::getInstance(), SIGNAL(updated()), this, SLOT(updateValues()));
// Avoid issues when CSV player goes backwards
connect(CsvPlayer::getInstance(), SIGNAL(timestampChanged()), this,
@ -219,8 +218,7 @@ void GraphProvider::updateValues()
// Remove older items
if (m_points.at(i)->count() >= displayedPoints())
m_points.at(i)->remove(0,
m_points.at(i)->count() - displayedPoints());
m_points.at(i)->remove(0, m_points.at(i)->count() - displayedPoints());
// Add values
m_points.at(i)->append(getValue(i));

View File

@ -75,8 +75,7 @@ JsonGenerator::JsonGenerator()
m_dataFormatErrors = 0;
auto sm = SerialManager::getInstance();
connect(sm, SIGNAL(portChanged()), this, SLOT(reset()));
connect(sm, SIGNAL(packetReceived(QByteArray)), this,
SLOT(readData(QByteArray)));
connect(sm, SIGNAL(packetReceived(QByteArray)), this, SLOT(readData(QByteArray)));
LOG_INFO() << "Initialized JsonParser module";
}
@ -149,9 +148,9 @@ JsonGenerator::OperationMode JsonGenerator::operationMode() const
*/
void JsonGenerator::loadJsonMap()
{
auto file = QFileDialog::getOpenFileName(
Q_NULLPTR, tr("Select JSON map file"), QDir::homePath(),
tr("JSON files") + " (*.json)");
auto file
= QFileDialog::getOpenFileName(Q_NULLPTR, tr("Select JSON map file"),
QDir::homePath(), tr("JSON files") + " (*.json)");
if (!file.isEmpty())
loadJsonMap(file);
@ -201,9 +200,9 @@ void JsonGenerator::loadJsonMap(const QString &path, const bool silent)
writeSettings(path);
m_jsonMapData = QString::fromUtf8(data);
if (!silent)
NiceMessageBox(tr("JSON map file loaded successfully!"),
tr("File \"%1\" loaded into memory")
.arg(jsonMapFilename()));
NiceMessageBox(
tr("JSON map file loaded successfully!"),
tr("File \"%1\" loaded into memory").arg(jsonMapFilename()));
}
}

View File

@ -35,10 +35,9 @@ static SerialManager *INSTANCE = nullptr;
* QStringList of all known control characters
*/
static const QStringList CONTROL_STR
= { "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
" BS", " HT", " LF", " VT", " FF", " CR", " SO", " SI",
"DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB",
"CAN", " EM", "SUB", "ESC", " FS", " GS", " RS", " US" };
= { "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", " BS", " HT", " LF",
" VT", " FF", " CR", " SO", " SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK",
"SYN", "ETB", "CAN", " EM", "SUB", "ESC", " FS", " GS", " RS", " US" };
/**
* Returns a string that displays unknown characters in hexadecimal format
@ -481,8 +480,7 @@ void SerialManager::disconnectDevice()
// Disconnect signals/slots
port()->disconnect(this, SLOT(onDataReceived()));
port()->disconnect(this, SLOT(disconnectDevice()));
port()->disconnect(this,
SLOT(handleError(QSerialPort::SerialPortError)));
port()->disconnect(this, SLOT(handleError(QSerialPort::SerialPortError)));
// Close & delete serial port handler
port()->close();
@ -535,8 +533,7 @@ void SerialManager::sendData(const QString &data)
// Bytes not equal to data length
if (bytes != bin.length())
LOG_WARNING()
<< "Written data length not equal to request data length";
LOG_WARNING() << "Written data length not equal to request data length";
// Emit signals
else
@ -615,8 +612,7 @@ void SerialManager::setPort(const quint8 portIndex)
if (port()->open(mode))
{
emit connectedChanged();
LOG_INFO() << Q_FUNC_INFO
<< "Serial port opened successfully in RW mode";
LOG_INFO() << Q_FUNC_INFO << "Serial port opened successfully in RW mode";
}
// Close serial port on error

View File

@ -80,8 +80,7 @@ int main(int argc, char **argv)
// Begin logging
LOG_INFO() << QDateTime::currentDateTime();
LOG_INFO() << APP_NAME << APP_VERSION;
LOG_INFO() << "Running on"
<< QSysInfo::prettyProductName().toStdString().c_str();
LOG_INFO() << "Running on" << QSysInfo::prettyProductName().toStdString().c_str();
// Change application palette
QPalette palette;