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)) {