diff --git a/.hgignore b/.hgignore new file mode 100644 --- /dev/null +++ b/.hgignore @@ -0,0 +1,3 @@ +mode=blob + +build/* diff --git a/serialplot.pro b/serialplot.pro deleted file mode 100644 --- a/serialplot.pro +++ /dev/null @@ -1,194 +0,0 @@ -# -# Copyright © 2019 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 . -# - -#------------------------------------------------- -# -# Project created by QtCreator 2015-03-04T08:20:06 -# -#------------------------------------------------- - -QT += core gui serialport network svg - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -TARGET = serialplot -TEMPLATE = app - -CONFIG += qwt -# LIBS += -lqwt # enable this line if qwt pri files aren't installed - -DEFINES += PROGRAM_NAME="\\\"serialplot\\\"" - -DEFINES += VERSION_MAJOR=10 VERSION_MINOR=0 VERSION_PATCH=0 VERSION_STRING=\\\"10.0.0\\\" - -SOURCES += \ - src/main.cpp \ - src/mainwindow.cpp \ - src/portcontrol.cpp \ - src/plot.cpp \ - src/zoomer.cpp \ - src/scrollzoomer.cpp \ - src/scrollbar.cpp \ - src/hidabletabwidget.cpp \ - src/scalepicker.cpp \ - src/scalezoomer.cpp \ - src/portlist.cpp \ - src/snapshot.cpp \ - src/snapshotview.cpp \ - src/snapshotmanager.cpp \ - src/plotsnapshotoverlay.cpp \ - src/commandpanel.cpp \ - src/commandwidget.cpp \ - src/commandedit.cpp \ - src/dataformatpanel.cpp \ - src/plotcontrolpanel.cpp \ - src/recordpanel.cpp \ - src/datarecorder.cpp \ - src/tooltipfilter.cpp \ - src/sneakylineedit.cpp \ - src/stream.cpp \ - src/streamchannel.cpp \ - src/channelinfomodel.cpp \ - src/ringbuffer.cpp \ - src/indexbuffer.cpp \ - src/linindexbuffer.cpp \ - src/readonlybuffer.cpp \ - src/framebufferseries.cpp \ - src/numberformatbox.cpp \ - src/endiannessbox.cpp \ - src/abstractreader.cpp \ - src/binarystreamreader.cpp \ - src/binarystreamreadersettings.cpp \ - src/asciireader.cpp \ - src/asciireadersettings.cpp \ - src/demoreader.cpp \ - src/demoreadersettings.cpp \ - src/framedreader.cpp \ - src/framedreadersettings.cpp \ - src/plotmanager.cpp \ - src/plotmenu.cpp \ - src/barplot.cpp \ - src/barchart.cpp \ - src/barscaledraw.cpp \ - src/numberformat.cpp \ - src/updatechecker.cpp \ - src/versionnumber.cpp \ - src/updatecheckdialog.cpp \ - src/samplepack.cpp \ - src/source.cpp \ - src/sink.cpp \ - src/samplecounter.cpp \ - src/ledwidget.cpp \ - src/datatextview.cpp \ - src/bpslabel.cpp - -HEADERS += \ - src/mainwindow.h \ - src/utils.h \ - src/portcontrol.h \ - src/floatswap.h \ - src/plot.h \ - src/hidabletabwidget.h \ - src/framebuffer.h \ - src/scalepicker.h \ - src/scalezoomer.h \ - src/portlist.h \ - src/snapshotview.h \ - src/snapshotmanager.h \ - src/snapshot.h \ - src/plotsnapshotoverlay.h \ - src/commandpanel.h \ - src/commandwidget.h \ - src/commandedit.h \ - src/dataformatpanel.h \ - src/tooltipfilter.h \ - src/sneakylineedit.h \ - src/framebufferseries.h \ - src/plotcontrolpanel.h \ - src/numberformatbox.h \ - src/endiannessbox.h \ - src/framedreadersettings.h \ - src/abstractreader.h \ - src/binarystreamreader.h \ - src/binarystreamreadersettings.h \ - src/asciireadersettings.h \ - src/asciireader.h \ - src/demoreader.h \ - src/framedreader.h \ - src/plotmanager.h \ - src/setting_defines.h \ - src/numberformat.h \ - src/recordpanel.h \ - src/updatechecker.h \ - src/updatecheckdialog.h \ - src/demoreadersettings.h \ - src/datatextview.h \ - src/bpslabel.h \ - src/barchart.h \ - src/barplot.h \ - src/barscaledraw.h \ - src/channelinfomodel.h \ - src/datarecorder.h \ - src/defines.h \ - src/indexbuffer.h \ - src/ledwidget.h \ - src/linindexbuffer.h \ - src/plotmenu.h \ - src/readonlybuffer.h \ - src/ringbuffer.h \ - src/samplecounter.h \ - src/samplepack.h \ - src/scrollbar.h \ - src/scrollzoomer.h \ - src/sink.h \ - src/source.h \ - src/streamchannel.h \ - src/stream.h \ - src/version.h \ - src/versionnumber.h \ - src/zoomer.h - -FORMS += \ - src/mainwindow.ui \ - src/about_dialog.ui \ - src/portcontrol.ui \ - src/snapshotview.ui \ - src/commandpanel.ui \ - src/commandwidget.ui \ - src/dataformatpanel.ui \ - src/plotcontrolpanel.ui \ - src/numberformatbox.ui \ - src/endiannessbox.ui \ - src/framedreadersettings.ui \ - src/binarystreamreadersettings.ui \ - src/asciireadersettings.ui \ - src/recordpanel.ui \ - src/updatecheckdialog.ui \ - src/demoreadersettings.ui \ - src/datatextview.ui - -INCLUDEPATH += qmake/ src/ - -CONFIG += c++11 - -RESOURCES += misc/icons.qrc - -win32 { - RESOURCES += misc/winicons.qrc -} diff --git a/src/about_dialog.ui b/src/about_dialog.ui --- a/src/about_dialog.ui +++ b/src/about_dialog.ui @@ -6,8 +6,8 @@ 0 0 - 487 - 325 + 516 + 360 @@ -23,7 +23,7 @@ - <html><head/><body><p align="center"><span style=" font-size:14pt;">SerialPlot</span></p><p align="center"><span style=" font-size:10pt;">$VERSION_STRING$</span></p><p align="center">Developed by Hasan Yavuz Özderya</p><p align="center">Using Qt (<a href="https://www.qt.io/"><span style=" text-decoration: underline; color:#0000ff;">https://www.qt.io/</span></a>) and Qwt (<a href="http://qwt.sf.net"><span style=" text-decoration: underline; color:#0000ff;">http://qwt.sf.net</span></a>)</p><p align="center"><br/></p><p align="center">This software is GPL licensed. You can obtain source code from <a href="https://bitbucket.org/hyOzd/serialplot"><span style=" text-decoration: underline; color:#0000ff;">https://bitbucket.org/hyOzd/serialplot</span></a>.</p><p align="center"><br/></p><p align="right"><span style=" font-size:8pt;">RevID: $VERSION_REVISION$<br/></span></p></body></html> + <html><head/><body><p align="center"><span style=" font-size:14pt;">Tempo Thermocouple Plotter</span></p><p align="center">$VERSION_STRING$</p><p align="center">Based on SerialPlot</p><p align="center">Developed by Hasan Yavuz Özderya</p><p align="center">Adapted by Ethan Zonca</p><p align="center">Using Qt (<a href="https://www.qt.io/"><span style=" text-decoration: underline; color:#0000ff;">https://www.qt.io/</span></a>) and Qwt (<a href="http://qwt.sf.net"><span style=" text-decoration: underline; color:#0000ff;">http://qwt.sf.net</span></a>)</p><p align="center"><br/></p><p align="center">This software is GPL licensed. Original source code is avialable here: <a href="https://bitbucket.org/hyOzd/serialplot"><span style=" text-decoration: underline; color:#0000ff;">https://bitbucket.org/hyOzd/serialplot</span></a>.</p><p align="center"><br/></p><p align="right"><span style=" font-size:8pt;">RevID: $VERSION_REVISION$<br/></span></p></body></html> true diff --git a/src/bpslabel.cpp b/src/bpslabel.cpp --- a/src/bpslabel.cpp +++ b/src/bpslabel.cpp @@ -48,7 +48,7 @@ void BPSLabel::onBpsTimeout() prevBytesRead = curBytesRead; unsigned bits = bytesRead * 8; - unsigned maxBps = _portControl->maxBitRate(); + unsigned maxBps = 1000000; // EMZ FIXME QString str; if (bits >= maxBps) { diff --git a/src/dataformatpanel.cpp b/src/dataformatpanel.cpp --- a/src/dataformatpanel.cpp +++ b/src/dataformatpanel.cpp @@ -47,21 +47,22 @@ DataFormatPanel::DataFormatPanel(QSerial ui->rbBinary->setChecked(true); ui->horizontalLayout->addWidget(bsReader.settingsWidget(), 1); - // initalize reader selection buttons - connect(ui->rbBinary, &QRadioButton::toggled, [this](bool checked) - { - if (checked) selectReader(&bsReader); - }); + selectReader(&asciiReader); +// // initalize reader selection buttons +// connect(ui->rbBinary, &QRadioButton::toggled, [this](bool checked) +// { +// if (checked) selectReader(&bsReader); +// }); - connect(ui->rbAscii, &QRadioButton::toggled, [this](bool checked) - { - if (checked) selectReader(&asciiReader); - }); +// connect(ui->rbAscii, &QRadioButton::toggled, [this](bool checked) +// { +// if (checked) selectReader(&asciiReader); +// }); - connect(ui->rbFramed, &QRadioButton::toggled, [this](bool checked) - { - if (checked) selectReader(&framedReader); - }); +// connect(ui->rbFramed, &QRadioButton::toggled, [this](bool checked) +// { +// if (checked) selectReader(&framedReader); +// }); } DataFormatPanel::~DataFormatPanel() diff --git a/src/dataformatpanel.ui b/src/dataformatpanel.ui --- a/src/dataformatpanel.ui +++ b/src/dataformatpanel.ui @@ -25,18 +25,24 @@ Simple Binary - true + false + + true + Data is sent in the form of ASCII text as comma seperated values. Easy to implement. ASCII + + true + diff --git a/src/main.cpp b/src/main.cpp --- a/src/main.cpp +++ b/src/main.cpp @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) a.installEventFilter(&ttf); // log application information - qDebug() << "SerialPlot" << VERSION_STRING; + qDebug() << "Tempo Plotter" << VERSION_STRING; qDebug() << "Revision" << VERSION_REVISION; w.show(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -53,13 +53,13 @@ Q_IMPORT_PLUGIN(QWindowsIntegrationPlugi // TODO: depends on tab insertion order, a better solution would be to use object names const QMap panelSettingMap({ - {0, "Port"}, - {1, "DataFormat"}, - {2, "Plot"}, - {3, "Commands"}, - {4, "Record"}, - {5, "TextView"}, - {6, "Log"} + // {0, "Port"}, + // {0, "DataFormat"}, + {0, "Plot"}, + {1, "Commands"}, + {2, "Record"}, + //{3, "TextView"}, + {3, "Log"} }); MainWindow::MainWindow(QWidget *parent) : @@ -73,19 +73,18 @@ MainWindow::MainWindow(QWidget *parent) dataFormatPanel(&serialPort), recordPanel(&stream), textView(&stream), - updateCheckDialog(this), bpsLabel(&portControl, &dataFormatPanel, this) { ui->setupUi(this); plotMan = new PlotManager(ui->plotArea, &plotMenu, &stream); - ui->tabWidget->insertTab(0, &portControl, "Port"); - ui->tabWidget->insertTab(1, &dataFormatPanel, "Data Format"); - ui->tabWidget->insertTab(2, &plotControlPanel, "Plot"); - ui->tabWidget->insertTab(3, &commandPanel, "Commands"); - ui->tabWidget->insertTab(4, &recordPanel, "Record"); - ui->tabWidget->insertTab(5, &textView, "Text View"); +// ui->tabWidget->insertTab(0, &portControl, "Port"); +// ui->tabWidget->insertTab(0, &dataFormatPanel, "Data Format"); + ui->tabWidget->insertTab(0, &plotControlPanel, "Plot"); + ui->tabWidget->insertTab(1, &commandPanel, "Commands"); + ui->tabWidget->insertTab(2, &recordPanel, "Record"); +// ui->tabWidget->insertTab(3, &textView, "Text View"); ui->tabWidget->setCurrentIndex(0); auto tbPortControl = portControl.toolBar(); addToolBar(tbPortControl); @@ -113,6 +112,8 @@ MainWindow::MainWindow(QWidget *parent) tbMenu->addAction(ui->plotToolBar->toggleViewAction()); tbMenu->addAction(portControl.toolBar()->toggleViewAction()); + + // init secondary plot menu auto group = new QActionGroup(this); group->addAction(ui->actionVertical); @@ -124,6 +125,7 @@ MainWindow::MainWindow(QWidget *parent) connect(ui->actionBarPlot, &QAction::triggered, this, &MainWindow::showBarPlot); + connect(ui->actionVertical, &QAction::triggered, [this](bool checked) { @@ -140,9 +142,6 @@ MainWindow::MainWindow(QWidget *parent) QObject::connect(ui->actionHelpAbout, &QAction::triggered, &aboutDialog, &QWidget::show); - QObject::connect(ui->actionCheckUpdate, &QAction::triggered, - &updateCheckDialog, &QWidget::show); - QObject::connect(ui->actionReportBug, &QAction::triggered, [](){QDesktopServices::openUrl(QUrl(BUG_REPORT_URL));}); @@ -224,6 +223,9 @@ MainWindow::MainWindow(QWidget *parent) stream.setNumSamples(numOfSamples); plotControlPanel.setChannelInfoModel(stream.infoModel()); + // Show bar plot EMZ + this->showBarPlot(true); + // init scales stream.setXAxis(plotControlPanel.xAxisAsIndex(), plotControlPanel.xMin(), plotControlPanel.xMax()); @@ -303,7 +305,7 @@ void MainWindow::closeEvent(QCloseEvent if (!snapshotMan.isAllSaved()) { auto clickedButton = QMessageBox::warning( - this, "Closing SerialPlot", + this, "Closing Tempo Plotter", "There are un-saved snapshots. If you close you will loose the data.", QMessageBox::Discard, QMessageBox::Cancel); if (clickedButton == QMessageBox::Cancel) @@ -325,13 +327,13 @@ void MainWindow::closeEvent(QCloseEvent if (settings.status() == QSettings::AccessError) { QString file = settings.fileName(); - errorText = QString("Serialplot cannot save settings due to access error. \ + errorText = QString("Tempo Plotter cannot save settings due to access error. \ This happens if you have run serialplot as root (with sudo for ex.) previously. \ Try fixing the permissions of file: %1, or just delete it.").arg(file); } else { - errorText = QString("Serialplot cannot save settings due to unknown error: %1").\ + errorText = QString("Tempo Plotter cannot save settings due to unknown error: %1").\ arg(settings.status()); } @@ -508,29 +510,27 @@ void MainWindow::messageHandler(QtMsgTyp void MainWindow::saveAllSettings(QSettings* settings) { saveMWSettings(settings); - portControl.saveSettings(settings); - dataFormatPanel.saveSettings(settings); - stream.saveSettings(settings); - plotControlPanel.saveSettings(settings); - plotMenu.saveSettings(settings); - commandPanel.saveSettings(settings); - recordPanel.saveSettings(settings); - textView.saveSettings(settings); - updateCheckDialog.saveSettings(settings); +// portControl.saveSettings(settings); +// dataFormatPanel.saveSettings(settings); +// stream.saveSettings(settings); +// plotControlPanel.saveSettings(settings); +// plotMenu.saveSettings(settings); +// commandPanel.saveSettings(settings); +// recordPanel.saveSettings(settings); +// textView.saveSettings(settings); } void MainWindow::loadAllSettings(QSettings* settings) { loadMWSettings(settings); - portControl.loadSettings(settings); - dataFormatPanel.loadSettings(settings); - stream.loadSettings(settings); - plotControlPanel.loadSettings(settings); - plotMenu.loadSettings(settings); - commandPanel.loadSettings(settings); - recordPanel.loadSettings(settings); - textView.loadSettings(settings); - updateCheckDialog.loadSettings(settings); +// portControl.loadSettings(settings); +// dataFormatPanel.loadSettings(settings); +// stream.loadSettings(settings); +// plotControlPanel.loadSettings(settings); +// plotMenu.loadSettings(settings); +// commandPanel.loadSettings(settings); +// recordPanel.loadSettings(settings); +// textView.loadSettings(settings); } void MainWindow::saveMWSettings(QSettings* settings) @@ -650,10 +650,6 @@ void MainWindow::handleCommandLineOption portControl.selectPort(parser.value(portOpt)); } - if (parser.isSet(baudrateOpt)) - { - portControl.selectBaudrate(parser.value(baudrateOpt)); - } if (parser.isSet(openPortOpt)) { diff --git a/src/mainwindow.h b/src/mainwindow.h --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -44,7 +44,6 @@ #include "snapshotmanager.h" #include "plotmanager.h" #include "plotmenu.h" -#include "updatecheckdialog.h" #include "samplecounter.h" #include "datatextview.h" #include "bpslabel.h" @@ -91,7 +90,6 @@ private: PlotControlPanel plotControlPanel; PlotMenu plotMenu; DataTextView textView; - UpdateCheckDialog updateCheckDialog; BPSLabel bpsLabel; void handleCommandLineOptions(const QCoreApplication &app); diff --git a/src/mainwindow.ui b/src/mainwindow.ui --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -11,7 +11,7 @@ - SerialPlot + Tempo Thermocouple Plotter @@ -101,16 +101,13 @@ 0 0 653 - 24 + 30 &Help - - - @@ -220,7 +217,7 @@ &Report a Bug - Report a Bug on SerialPlot Website + Report a Bug on Tempo Plotter Website @@ -248,6 +245,9 @@ true + + true + Bar Plot diff --git a/src/plotcontrolpanel.cpp b/src/plotcontrolpanel.cpp --- a/src/plotcontrolpanel.cpp +++ b/src/plotcontrolpanel.cpp @@ -136,25 +136,8 @@ PlotControlPanel::PlotControlPanel(QWidg connect(ui->spPlotWidth, SIGNAL(valueChanged(int)), this, SLOT(onPlotWidthChanged())); - // init scale range preset list - for (int nbits = 8; nbits <= 24; nbits++) // signed binary formats - { - int rmax = pow(2, nbits-1)-1; - int rmin = -rmax-1; - Range r = {double(rmin), double(rmax)}; - ui->cbRangePresets->addItem( - QString().sprintf("Signed %d bits %d to +%d", nbits, rmin, rmax), - QVariant::fromValue(r)); - } - for (int nbits = 8; nbits <= 24; nbits++) // unsigned binary formats - { - int rmax = pow(2, nbits)-1; - ui->cbRangePresets->addItem( - QString().sprintf("Unsigned %d bits %d to +%d", nbits, 0, rmax), - QVariant::fromValue(Range{0, double(rmax)})); - } - ui->cbRangePresets->addItem("-1 to +1", QVariant::fromValue(Range{-1, +1})); - ui->cbRangePresets->addItem("0 to +1", QVariant::fromValue(Range{0, +1})); + + ui->cbRangePresets->addItem("-100 to +100", QVariant::fromValue(Range{-100, +100})); ui->cbRangePresets->addItem("0 to +100", QVariant::fromValue(Range{0, +100})); diff --git a/src/portcontrol.cpp b/src/portcontrol.cpp --- a/src/portcontrol.cpp +++ b/src/portcontrol.cpp @@ -31,12 +31,6 @@ #define TBPORTLIST_MINWIDTH (200) -// setting mappings -const QMap paritySettingMap({ - {QSerialPort::NoParity, "none"}, - {QSerialPort::OddParity, "odd"}, - {QSerialPort::EvenParity, "even"}, - }); PortControl::PortControl(QSerialPort* port, QWidget* parent) : QWidget(parent), @@ -88,87 +82,8 @@ PortControl::PortControl(QSerialPort* po ui->pbOpenPort->setDefaultAction(&openAction); ui->pbReloadPorts->setDefaultAction(&loadPortListAction); - // setup baud rate selection widget - QObject::connect(ui->cbBaudRate, - SELECT::OVERLOAD_OF(&QComboBox::activated), - this, &PortControl::_selectBaudRate); - - // setup parity selection buttons - parityButtons.addButton(ui->rbNoParity, (int) QSerialPort::NoParity); - parityButtons.addButton(ui->rbEvenParity, (int) QSerialPort::EvenParity); - parityButtons.addButton(ui->rbOddParity, (int) QSerialPort::OddParity); - - QObject::connect(&parityButtons, - SELECT::OVERLOAD_OF(&QButtonGroup::buttonClicked), - this, &PortControl::selectParity); - - // setup data bits selection buttons - dataBitsButtons.addButton(ui->rb8Bits, (int) QSerialPort::Data8); - dataBitsButtons.addButton(ui->rb7Bits, (int) QSerialPort::Data7); - dataBitsButtons.addButton(ui->rb6Bits, (int) QSerialPort::Data6); - dataBitsButtons.addButton(ui->rb5Bits, (int) QSerialPort::Data5); - - QObject::connect(&dataBitsButtons, - SELECT::OVERLOAD_OF(&QButtonGroup::buttonClicked), - this, &PortControl::selectDataBits); - - // setup stop bits selection buttons - stopBitsButtons.addButton(ui->rb1StopBit, (int) QSerialPort::OneStop); - stopBitsButtons.addButton(ui->rb2StopBit, (int) QSerialPort::TwoStop); - - QObject::connect(&stopBitsButtons, - SELECT::OVERLOAD_OF(&QButtonGroup::buttonClicked), - this, &PortControl::selectStopBits); - - // setup flow control selection buttons - flowControlButtons.addButton(ui->rbNoFlowControl, - (int) QSerialPort::NoFlowControl); - flowControlButtons.addButton(ui->rbHardwareControl, - (int) QSerialPort::HardwareControl); - flowControlButtons.addButton(ui->rbSoftwareControl, - (int) QSerialPort::SoftwareControl); - - QObject::connect(&flowControlButtons, - SELECT::OVERLOAD_OF(&QButtonGroup::buttonClicked), - this, &PortControl::selectFlowControl); - - // initialize signal leds - ui->ledDTR->setOn(true); - ui->ledRTS->setOn(true); - - // connect output signals - connect(ui->pbDTR, &QPushButton::clicked, [this]() - { - // toggle DTR - ui->ledDTR->toggle(); - if (serialPort->isOpen()) - { - serialPort->setDataTerminalReady(ui->ledDTR->isOn()); - } - }); - - connect(ui->pbRTS, &QPushButton::clicked, [this]() - { - // toggle RTS - ui->ledRTS->toggle(); - if (serialPort->isOpen()) - { - serialPort->setRequestToSend(ui->ledRTS->isOn()); - } - }); - - // setup pin update leds - ui->ledDCD->setColor(Qt::yellow); - ui->ledDSR->setColor(Qt::yellow); - ui->ledRI->setColor(Qt::yellow); - ui->ledCTS->setColor(Qt::yellow); - - pinUpdateTimer.setInterval(1000); // ms - connect(&pinUpdateTimer, &QTimer::timeout, this, &PortControl::updatePinLeds); loadPortList(); - loadBaudRateList(); - ui->cbBaudRate->setCurrentIndex(ui->cbBaudRate->findText("9600")); } PortControl::~PortControl() @@ -188,15 +103,6 @@ void PortControl::loadPortList() } } -void PortControl::loadBaudRateList() -{ - ui->cbBaudRate->clear(); - - for (auto baudRate : QSerialPortInfo::standardBaudRates()) - { - ui->cbBaudRate->addItem(QString::number(baudRate)); - } -} void PortControl::_selectBaudRate(QString baudRate) { @@ -209,55 +115,10 @@ void PortControl::_selectBaudRate(QStrin } } -void PortControl::selectParity(int parity) -{ - if (serialPort->isOpen()) - { - if(!serialPort->setParity((QSerialPort::Parity) parity)) - { - qCritical() << "Can't set parity option!"; - } - } -} - -void PortControl::selectDataBits(int dataBits) -{ - if (serialPort->isOpen()) - { - if(!serialPort->setDataBits((QSerialPort::DataBits) dataBits)) - { - qCritical() << "Can't set numer of data bits!"; - } - } -} - -void PortControl::selectStopBits(int stopBits) -{ - if (serialPort->isOpen()) - { - if(!serialPort->setStopBits((QSerialPort::StopBits) stopBits)) - { - qCritical() << "Can't set number of stop bits!"; - } - } -} - -void PortControl::selectFlowControl(int flowControl) -{ - if (serialPort->isOpen()) - { - if(!serialPort->setFlowControl((QSerialPort::FlowControl) flowControl)) - { - qCritical() << "Can't set flow control option!"; - } - } -} - void PortControl::togglePort() { if (serialPort->isOpen()) { - pinUpdateTimer.stop(); serialPort->close(); qDebug() << "Closed port:" << serialPort->portName(); emit portToggled(false); @@ -289,19 +150,7 @@ void PortControl::togglePort() if (serialPort->open(QIODevice::ReadWrite)) { // set port settings - _selectBaudRate(ui->cbBaudRate->currentText()); - selectParity((QSerialPort::Parity) parityButtons.checkedId()); - selectDataBits((QSerialPort::DataBits) dataBitsButtons.checkedId()); - selectStopBits((QSerialPort::StopBits) stopBitsButtons.checkedId()); - selectFlowControl((QSerialPort::FlowControl) flowControlButtons.checkedId()); - - // set output signals - serialPort->setDataTerminalReady(ui->ledDTR->isOn()); - serialPort->setRequestToSend(ui->ledRTS->isOn()); - - // update pin signals - updatePinLeds(); - pinUpdateTimer.start(); + _selectBaudRate("115200"); qDebug() << "Opened port:" << serialPort->portName(); emit portToggled(true); @@ -446,36 +295,6 @@ required privileges or device is already } } -void PortControl::updatePinLeds(void) -{ - auto pins = serialPort->pinoutSignals(); - ui->ledDCD->setOn(pins & QSerialPort::DataCarrierDetectSignal); - ui->ledDSR->setOn(pins & QSerialPort::DataSetReadySignal); - ui->ledRI->setOn(pins & QSerialPort::RingIndicatorSignal); - ui->ledCTS->setOn(pins & QSerialPort::ClearToSendSignal); -} - -QString PortControl::currentParityText() -{ - return paritySettingMap.value( - (QSerialPort::Parity) parityButtons.checkedId()); -} - -QString PortControl::currentFlowControlText() -{ - if (flowControlButtons.checkedId() == QSerialPort::HardwareControl) - { - return "hardware"; - } - else if (flowControlButtons.checkedId() == QSerialPort::SoftwareControl) - { - return "software"; - } - else // no parity - { - return "none"; - } -} void PortControl::selectPort(QString portName) { @@ -492,19 +311,6 @@ void PortControl::selectPort(QString por selectListedPort(portName); } -void PortControl::selectBaudrate(QString baudRate) -{ - int baudRateIndex = ui->cbBaudRate->findText(baudRate); - if (baudRateIndex < 0) - { - ui->cbBaudRate->setCurrentText(baudRate); - } - else - { - ui->cbBaudRate->setCurrentIndex(baudRateIndex); - } - _selectBaudRate(baudRate); -} void PortControl::openPort() { @@ -514,36 +320,10 @@ void PortControl::openPort() } } -unsigned PortControl::maxBitRate() const -{ - float baud = serialPort->baudRate(); - float dataBits = serialPort->dataBits(); - float parityBits = serialPort->parity() == QSerialPort::NoParity ? 0 : 1; - - float stopBits; - if (serialPort->stopBits() == QSerialPort::OneAndHalfStop) - { - stopBits = 1.5; - } - else - { - stopBits = serialPort->stopBits(); - } - - float frame_size = 1 /* start bit */ + dataBits + parityBits + stopBits; - - return float(baud) / frame_size; -} - void PortControl::saveSettings(QSettings* settings) { settings->beginGroup(SettingGroup_Port); settings->setValue(SG_Port_SelectedPort, selectedPortName()); - settings->setValue(SG_Port_BaudRate, ui->cbBaudRate->currentText()); - settings->setValue(SG_Port_Parity, currentParityText()); - settings->setValue(SG_Port_DataBits, dataBitsButtons.checkedId()); - settings->setValue(SG_Port_StopBits, stopBitsButtons.checkedId()); - settings->setValue(SG_Port_FlowControl, currentFlowControlText()); settings->endGroup(); } @@ -562,52 +342,5 @@ void PortControl::loadSettings(QSettings if (index > -1) ui->cbPortList->setCurrentIndex(index); } - // load baud rate setting if it exists in baud rate list - QString baudSetting = settings->value( - SG_Port_BaudRate, ui->cbBaudRate->currentText()).toString(); - int baudIndex = ui->cbBaudRate->findText(baudSetting); - if (baudIndex > -1) ui->cbBaudRate->setCurrentIndex(baudIndex); - - // load parity setting - QString parityText = - settings->value(SG_Port_Parity, currentParityText()).toString(); - QSerialPort::Parity paritySetting = paritySettingMap.key( - parityText, (QSerialPort::Parity) parityButtons.checkedId()); - parityButtons.button(paritySetting)->setChecked(true); - - // load number of bits - int dataBits = settings->value(SG_Port_DataBits, dataBitsButtons.checkedId()).toInt(); - if (dataBits >=5 && dataBits <= 8) - { - dataBitsButtons.button((QSerialPort::DataBits) dataBits)->setChecked(true); - } - - // load stop bits - int stopBits = settings->value(SG_Port_StopBits, stopBitsButtons.checkedId()).toInt(); - if (stopBits == QSerialPort::OneStop) - { - ui->rb1StopBit->setChecked(true); - } - else if (stopBits == QSerialPort::TwoStop) - { - ui->rb2StopBit->setChecked(true); - } - - // load flow control - QString flowControlSetting = - settings->value(SG_Port_FlowControl, currentFlowControlText()).toString(); - if (flowControlSetting == "hardware") - { - ui->rbHardwareControl->setChecked(true); - } - else if (flowControlSetting == "software") - { - ui->rbSoftwareControl->setChecked(true); - } - else - { - ui->rbNoFlowControl->setChecked(true); - } - settings->endGroup(); } diff --git a/src/portcontrol.h b/src/portcontrol.h --- a/src/portcontrol.h +++ b/src/portcontrol.h @@ -61,44 +61,24 @@ public: private: Ui::PortControl *ui; - QButtonGroup parityButtons; - QButtonGroup dataBitsButtons; - QButtonGroup stopBitsButtons; - QButtonGroup flowControlButtons; - QToolBar portToolBar; QAction openAction; QAction loadPortListAction; QComboBox tbPortList; PortList portList; - /// Used to refresh pinout signal leds periodically - QTimer pinUpdateTimer; - /// Returns the currently selected (entered) "portName" in the UI QString selectedPortName(); - /// Returns currently selected parity as text to be saved in settings - QString currentParityText(); - /// Returns currently selected flow control as text to be saved in settings - QString currentFlowControlText(); private slots: void loadPortList(); - void loadBaudRateList(); void togglePort(); void selectListedPort(QString portName); - void _selectBaudRate(QString baudRate); - void selectParity(int parity); // parity must be one of QSerialPort::Parity - void selectDataBits(int dataBits); // bits must be one of QSerialPort::DataBits - void selectStopBits(int stopBits); // stopBits must be one of QSerialPort::StopBits - void selectFlowControl(int flowControl); // flowControl must be one of QSerialPort::FlowControl - void openActionTriggered(bool checked); void onCbPortListActivated(int index); void onTbPortListActivated(int index); void onPortError(QSerialPort::SerialPortError error); - void updatePinLeds(void); signals: void portToggled(bool open); diff --git a/src/portcontrol.ui b/src/portcontrol.ui --- a/src/portcontrol.ui +++ b/src/portcontrol.ui @@ -7,7 +7,7 @@ 0 0 631 - 232 + 64 @@ -18,13 +18,6 @@ - - - - Port: - - - @@ -39,25 +32,18 @@ true - - - - - - You can enter a custom baud rate if it's supported by your OS/adapter. + + QComboBox::AdjustToContents - - Qt::ImhPreferNumbers - - - true + + 22 - - + + - Baud Rate: + Port: @@ -83,183 +69,29 @@ - - - - - - - - QFrame::NoFrame + + + + + 0 + 0 + - - - - - No Parity - - - true - - - - - - - Odd Parity - - - - - - - Even Parity - - - - - - - Qt::Vertical - - - - 20 - 2 - - - - - - - - - - - - - - 8 bits - - - true - - - - - - - 7 bits - - - - - - - 6 bits - - - - - - - 5 bits - - - - - - - Qt::Vertical - - - - 20 - 2 - - - - - - - - - - - - - - 1 Stop Bit - - - true - - - - - - - 2 Stop Bit - - - - - - - Qt::Vertical - - - - 20 - 2 - - - - - - - - - - - - - - No Flow Control - - - true - - - - - - - Hardware Control - - - - - - - Software Control - - - - - - - Qt::Vertical - - - - 20 - 2 - - - - - + + + 85 + 25 + + + + Toggle port status + + + Open + + + true + @@ -280,292 +112,13 @@ - - - - - - 0 - 0 - - - - - 85 - 50 - - - - Toggle port status - - - Open - - - true - - - - - - - 2 - - - - - - 15 - 15 - - - - - 15 - 15 - - - - Request To Send - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 40 - 20 - - - - Data Terminal Ready - - - DTR - - - - - - - - 15 - 15 - - - - - 15 - 15 - - - - Data Terminal Ready - - - - - - - - 15 - 15 - - - - - 15 - 15 - - - - Data Set Ready - - - - - - - Data Set Ready - - - DSR - - - Qt::AlignCenter - - - - - - - - 40 - 20 - - - - Request To Send - - - RTS - - - - - - - Data Carrier Detect - - - DCD - - - Qt::AlignCenter - - - - - - - - 15 - 15 - - - - - 15 - 15 - - - - Data Carrier Detect - - - - - - - Ring Indicator - - - RI - - - Qt::AlignCenter - - - - - - - - 15 - 15 - - - - - 15 - 15 - - - - Ring Indicator - - - - - - - - 15 - 15 - - - - - 15 - 15 - - - - Clear To Send - - - - - - - Clear To Send - - - CTS - - - Qt::AlignCenter - - - - - - - - - Qt::Vertical - - - - 20 - 1 - - - - - + - - - LedWidget - QWidget -
ledwidget.h
- 1 -
-
cbPortList pbReloadPorts - pbOpenPort - cbBaudRate - rbNoParity - rbOddParity - rbEvenParity - rb8Bits - rb7Bits - rb6Bits - rb5Bits - rb1StopBit - rb2StopBit - rbNoFlowControl - rbHardwareControl - rbSoftwareControl diff --git a/src/updatecheckdialog.cpp b/src/updatecheckdialog.cpp deleted file mode 100644 --- a/src/updatecheckdialog.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - Copyright © 2017 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 . -*/ - -#include "setting_defines.h" -#include "updatecheckdialog.h" -#include "ui_updatecheckdialog.h" - -UpdateCheckDialog::UpdateCheckDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::UpdateCheckDialog) -{ - ui->setupUi(this); - - // by default start from yesterday, so that we check at first run - lastCheck = QDate::currentDate().addDays(-1); - - connect(&updateChecker, &UpdateChecker::checkFailed, - [this](QString errorMessage) - { - lastCheck = QDate::currentDate(); - ui->label->setText(QString("Update check failed.\n") + errorMessage); - }); - - connect(&updateChecker, &UpdateChecker::checkFinished, - [this](bool found, QString newVersion, QString downloadUrl) - { - QString text; - if (!found) - { - text = "There is no update yet."; - } - else - { - show(); -#ifdef UPDATE_TYPE_PKGMAN - text = QString("There is a new version: %1. " - "Use your package manager to update" - " or click to download.")\ - .arg(newVersion).arg(downloadUrl); -#else - text = QString("Found update to version %1. Click to download.")\ - .arg(newVersion).arg(downloadUrl); -#endif - } - - lastCheck = QDate::currentDate(); - ui->label->setText(text); - }); -} - -UpdateCheckDialog::~UpdateCheckDialog() -{ - delete ui; -} - -void UpdateCheckDialog::showEvent(QShowEvent *event) -{ - updateChecker.checkUpdate(); - ui->label->setText("Checking update..."); -} - -void UpdateCheckDialog::closeEvent(QShowEvent *event) -{ - if (updateChecker.isChecking()) updateChecker.cancelCheck(); -} - -void UpdateCheckDialog::saveSettings(QSettings* settings) -{ - settings->beginGroup(SettingGroup_UpdateCheck); - settings->setValue(SG_UpdateCheck_Periodic, ui->cbPeriodic->isChecked()); - settings->setValue(SG_UpdateCheck_LastCheck, lastCheck.toString(Qt::ISODate)); - settings->endGroup(); -} - -void UpdateCheckDialog::loadSettings(QSettings* settings) -{ - settings->beginGroup(SettingGroup_UpdateCheck); - ui->cbPeriodic->setChecked(settings->value(SG_UpdateCheck_Periodic, - ui->cbPeriodic->isChecked()).toBool()); - auto lastCheckS = settings->value(SG_UpdateCheck_LastCheck, lastCheck.toString(Qt::ISODate)).toString(); - lastCheck = QDate::fromString(lastCheckS, Qt::ISODate); - settings->endGroup(); - - // start the periodic update if required - if (ui->cbPeriodic->isChecked() && lastCheck < QDate::currentDate()) - { - updateChecker.checkUpdate(); - } -} diff --git a/src/updatecheckdialog.h b/src/updatecheckdialog.h deleted file mode 100644 --- a/src/updatecheckdialog.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright © 2017 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 . -*/ - -#ifndef UPDATECHECKDIALOG_H -#define UPDATECHECKDIALOG_H - -#include -#include -#include -#include "updatechecker.h" - -namespace Ui { -class UpdateCheckDialog; -} - -class UpdateCheckDialog : public QDialog -{ - Q_OBJECT - -public: - explicit UpdateCheckDialog(QWidget *parent = 0); - ~UpdateCheckDialog(); - - /// Stores update settings into a `QSettings`. - void saveSettings(QSettings* settings); - /// Loads update settings from a `QSettings`. - void loadSettings(QSettings* settings); - -private: - Ui::UpdateCheckDialog *ui; - UpdateChecker updateChecker; - QDate lastCheck; - - void showEvent(QShowEvent *event); - void closeEvent(QShowEvent *event); -}; - -#endif // UPDATECHECKDIALOG_H diff --git a/src/updatecheckdialog.ui b/src/updatecheckdialog.ui deleted file mode 100644 --- a/src/updatecheckdialog.ui +++ /dev/null @@ -1,71 +0,0 @@ - - - UpdateCheckDialog - - - - 0 - 0 - 400 - 148 - - - - Check Update - - - - - - Checking update... - - - true - - - - - - - Updates will be checked only once a day at first start of the application - - - Check updates periodically - - - true - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close - - - - - - - - - buttonBox - clicked(QAbstractButton*) - UpdateCheckDialog - close() - - - 199 - 125 - - - 199 - 73 - - - - - diff --git a/src/updatechecker.cpp b/src/updatechecker.cpp deleted file mode 100644 --- a/src/updatechecker.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/* - Copyright © 2018 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 . -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include "updatechecker.h" - -// This link returns the list of downloads in JSON format. Note that we only use -// the first page because results are sorted new to old. -const char BB_DOWNLOADS_URL[] = "https://api.bitbucket.org/2.0/repositories/hyozd/serialplot/downloads?fields=values.name,values.links.self.href"; - -UpdateChecker::UpdateChecker(QObject *parent) : - QObject(parent), nam(this) -{ - activeReply = NULL; - - connect(&nam, &QNetworkAccessManager::finished, - this, &UpdateChecker::onReqFinished); -} - -bool UpdateChecker::isChecking() const -{ - return activeReply != NULL && !activeReply->isFinished(); -} - -void UpdateChecker::checkUpdate() -{ - if (isChecking()) return; - - auto req = QNetworkRequest(QUrl(BB_DOWNLOADS_URL)); - activeReply = nam.get(req); -} - -void UpdateChecker::cancelCheck() -{ - if (activeReply != NULL) activeReply->abort(); -} - -void UpdateChecker::onReqFinished(QNetworkReply* reply) -{ - if (reply->error() != QNetworkReply::NoError) - { - emit checkFailed(QString("Network error: ") + reply->errorString()); - } - else - { - QJsonParseError error; - auto data = QJsonDocument::fromJson(reply->readAll(), &error); - if (error.error != QJsonParseError::NoError) - { - emit checkFailed(QString("JSon parsing error: ") + error.errorString()); - } - else - { - QList files; - if (!parseData(data, files)) - { - // TODO: emit detailed data contents for logging - emit checkFailed("Data parsing error."); - } - else - { - FileInfo updateFile; - if (findUpdate(files, updateFile)) - { - emit checkFinished( - true, updateFile.version.toString(), updateFile.link); - } - else - { - emit checkFinished(false, "", ""); - } - } - } - } - reply->deleteLater(); - activeReply = NULL; -} - -bool UpdateChecker::parseData(const QJsonDocument& data, QList& files) const -{ - /* Data is expected to be in this form: - - { - "values": [ - { - "name": "serialplot-0.9.1-x86_64.AppImage", - "links": { - "self": { - "href": "https://api.bitbucket.org/2.0/repositories/hyOzd/serialplot/downloads/serialplot-0.9.1-x86_64.AppImage" - } - } - }, ... ] - } - */ - - if (!data.isObject()) return false; - - auto values = data.object().value("values"); - if (values == QJsonValue::Undefined || !values.isArray()) return false; - - for (auto value : values.toArray()) - { - if (!value.isObject()) return false; - - auto name = value.toObject().value("name"); - if (name.isUndefined() || !name.isString()) - return false; - - auto links = value.toObject().value("links"); - if (links.isUndefined() || !links.isObject()) - return false; - - auto self = links.toObject().value("self"); - if (self.isUndefined() || !self.isObject()) - return false; - - auto href = self.toObject().value("href"); - if (href.isUndefined() || !href.isString()) - return false; - - FileInfo finfo; - finfo.name = name.toString(); - finfo.link = href.toString(); - finfo.hasVersion = VersionNumber::extract(name.toString(), finfo.version); - - if (finfo.name.contains("amd64") || - finfo.name.contains("x86_64") || - finfo.name.contains("win64")) - { - finfo.arch = FileArch::amd64; - } - else if (finfo.name.contains("win32") || - finfo.name.contains("i386")) - { - finfo.arch = FileArch::_i386; - } - else - { - finfo.arch = FileArch::unknown; - } - - files += finfo; - } - - return true; -} - -bool UpdateChecker::findUpdate(const QList& files, FileInfo& foundFile) const -{ - QList fflist; - - // filter the file list according to extension and version number - for (int i = 0; i < files.length(); i++) - { - // file type to look -#if defined(Q_OS_WIN) - const char ext[] = ".exe"; -#else // of course linux - const char ext[] = ".appimage"; -#endif - - // file architecture to look -#if defined(Q_PROCESSOR_X86_64) - const FileArch arch = FileArch::amd64; -#elif defined(Q_PROCESSOR_X86_32) - const FileArch arch = FileArch::_i386; -#elif defined(Q_PROCESSOR_ARM) - const FileArch arch = FileArch::arm; -#else - #error Unknown architecture for update file detection. -#endif - - // filter the file list - auto file = files[i]; - if (file.name.contains(ext, Qt::CaseInsensitive) && - file.arch == arch && - file.hasVersion && file.version > CurrentVersion) - { - fflist += file; - } - } - - // sort and find most up to date file - if (!fflist.empty()) - { - std::sort(fflist.begin(), fflist.end(), - [](const FileInfo& a, const FileInfo& b) - { - return a.version > b.version; - }); - - foundFile = fflist[0]; - return true; - } - else - { - return false; - } -} diff --git a/src/updatechecker.h b/src/updatechecker.h deleted file mode 100644 --- a/src/updatechecker.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright © 2018 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 . -*/ - -#ifndef UPDATECHECKER_H -#define UPDATECHECKER_H - -#include -#include -#include -#include - -#include "versionnumber.h" - -class UpdateChecker : public QObject -{ - Q_OBJECT -public: - explicit UpdateChecker(QObject *parent = 0); - - bool isChecking() const; - -signals: - void checkFinished(bool found, QString newVersion, QString downloadUrl); - void checkFailed(QString errorMessage); - -public slots: - void checkUpdate(); - void cancelCheck(); - -private: - enum class FileArch - { - unknown, - _i386, - amd64, - arm - }; - - struct FileInfo - { - QString name; - QString link; - bool hasVersion; - VersionNumber version; - FileArch arch; - }; - - QNetworkAccessManager nam; - QNetworkReply* activeReply; - - /// Parses json and creates a list of files - bool parseData(const QJsonDocument& data, QList& files) const; - /// Finds the update file in the file list. Returns `-1` if no new version - /// is found. - bool findUpdate(const QList& files, FileInfo& foundFile) const; - -private slots: - void onReqFinished(QNetworkReply* reply); -}; - -#endif // UPDATECHECKER_H diff --git a/tempo-plotter.pro b/tempo-plotter.pro new file mode 100644 --- /dev/null +++ b/tempo-plotter.pro @@ -0,0 +1,189 @@ +# +# Copyright © 2019 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 . +# + +#------------------------------------------------- +# +# Project created by QtCreator 2015-03-04T08:20:06 +# +#------------------------------------------------- + +QT += core gui serialport network svg + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = tempo-plotter +TEMPLATE = app + +CONFIG += qwt +# LIBS += -lqwt # enable this line if qwt pri files aren't installed + +DEFINES += PROGRAM_NAME="\\\"tempo-plotter\\\"" + +DEFINES += VERSION_MAJOR=10 VERSION_MINOR=0 VERSION_PATCH=0 VERSION_STRING=\\\"10.0.0\\\" + +SOURCES += \ + src/main.cpp \ + src/mainwindow.cpp \ + src/portcontrol.cpp \ + src/plot.cpp \ + src/zoomer.cpp \ + src/scrollzoomer.cpp \ + src/scrollbar.cpp \ + src/hidabletabwidget.cpp \ + src/scalepicker.cpp \ + src/scalezoomer.cpp \ + src/portlist.cpp \ + src/snapshot.cpp \ + src/snapshotview.cpp \ + src/snapshotmanager.cpp \ + src/plotsnapshotoverlay.cpp \ + src/commandpanel.cpp \ + src/commandwidget.cpp \ + src/commandedit.cpp \ + src/dataformatpanel.cpp \ + src/plotcontrolpanel.cpp \ + src/recordpanel.cpp \ + src/datarecorder.cpp \ + src/tooltipfilter.cpp \ + src/sneakylineedit.cpp \ + src/stream.cpp \ + src/streamchannel.cpp \ + src/channelinfomodel.cpp \ + src/ringbuffer.cpp \ + src/indexbuffer.cpp \ + src/linindexbuffer.cpp \ + src/readonlybuffer.cpp \ + src/framebufferseries.cpp \ + src/numberformatbox.cpp \ + src/endiannessbox.cpp \ + src/abstractreader.cpp \ + src/binarystreamreader.cpp \ + src/binarystreamreadersettings.cpp \ + src/asciireader.cpp \ + src/asciireadersettings.cpp \ + src/demoreader.cpp \ + src/demoreadersettings.cpp \ + src/framedreader.cpp \ + src/framedreadersettings.cpp \ + src/plotmanager.cpp \ + src/plotmenu.cpp \ + src/barplot.cpp \ + src/barchart.cpp \ + src/barscaledraw.cpp \ + src/numberformat.cpp \ + src/versionnumber.cpp \ + src/samplepack.cpp \ + src/source.cpp \ + src/sink.cpp \ + src/samplecounter.cpp \ + src/ledwidget.cpp \ + src/datatextview.cpp \ + src/bpslabel.cpp + +HEADERS += \ + src/mainwindow.h \ + src/utils.h \ + src/portcontrol.h \ + src/floatswap.h \ + src/plot.h \ + src/hidabletabwidget.h \ + src/framebuffer.h \ + src/scalepicker.h \ + src/scalezoomer.h \ + src/portlist.h \ + src/snapshotview.h \ + src/snapshotmanager.h \ + src/snapshot.h \ + src/plotsnapshotoverlay.h \ + src/commandpanel.h \ + src/commandwidget.h \ + src/commandedit.h \ + src/dataformatpanel.h \ + src/tooltipfilter.h \ + src/sneakylineedit.h \ + src/framebufferseries.h \ + src/plotcontrolpanel.h \ + src/numberformatbox.h \ + src/endiannessbox.h \ + src/framedreadersettings.h \ + src/abstractreader.h \ + src/binarystreamreader.h \ + src/binarystreamreadersettings.h \ + src/asciireadersettings.h \ + src/asciireader.h \ + src/demoreader.h \ + src/framedreader.h \ + src/plotmanager.h \ + src/setting_defines.h \ + src/numberformat.h \ + src/recordpanel.h \ + src/demoreadersettings.h \ + src/datatextview.h \ + src/bpslabel.h \ + src/barchart.h \ + src/barplot.h \ + src/barscaledraw.h \ + src/channelinfomodel.h \ + src/datarecorder.h \ + src/defines.h \ + src/indexbuffer.h \ + src/ledwidget.h \ + src/linindexbuffer.h \ + src/plotmenu.h \ + src/readonlybuffer.h \ + src/ringbuffer.h \ + src/samplecounter.h \ + src/samplepack.h \ + src/scrollbar.h \ + src/scrollzoomer.h \ + src/sink.h \ + src/source.h \ + src/streamchannel.h \ + src/stream.h \ + src/version.h \ + src/versionnumber.h \ + src/zoomer.h + +FORMS += \ + src/mainwindow.ui \ + src/about_dialog.ui \ + src/portcontrol.ui \ + src/snapshotview.ui \ + src/commandpanel.ui \ + src/commandwidget.ui \ + src/dataformatpanel.ui \ + src/plotcontrolpanel.ui \ + src/numberformatbox.ui \ + src/endiannessbox.ui \ + src/framedreadersettings.ui \ + src/binarystreamreadersettings.ui \ + src/asciireadersettings.ui \ + src/recordpanel.ui \ + src/demoreadersettings.ui \ + src/datatextview.ui + +INCLUDEPATH += qmake/ src/ + +CONFIG += c++11 + +RESOURCES += misc/icons.qrc + +win32 { + RESOURCES += misc/winicons.qrc +}