//=============================================== void GWindow::on_actionOpen_triggered(bool checked) { QMessageBox::information(this , "Enregistrement des données" , "Aucune donnée n'a été collectée\n" "connectez-vous d'abord à un appareil" ); } //===============================================
//=============================================== void GWindow::on_actionOpen_triggered(bool checked) { QMessageBox::critical(this , "Erreur d'enregistrement des données" , "Impossible d'écrire dans le fichier" ); } //===============================================
//=============================================== void GWindow::on_actionOpen_triggered(bool checked) { QString lFilename = QFileDialog::getSaveFileName(this , "Enregistrement des données" , QString() , "Text (*.txt)"); if(!lFilename.isNull()) { qDebug() << lFilename; } else { qDebug() << "Aucun fichier n'a été sélectionné."; } } //===============================================
//=============================================== void GWindow::on_actionOpen_triggered(bool checked) { QString lFilename = QFileDialog::getOpenFileName(this ,"Chargement des paramètres" , QString() , "Settings (*.ini)" ); if(!lFilename.isNull()) { qDebug() << lFilename; } else { qDebug() << "Aucun fichier n'a été sélectionné."; } } //===============================================
//=============================================== void GWindow::on_actionOpen_triggered(bool checked) { QMessageBox::about(this , "À propos" , "<p><b>ReadyScope</b> - v1.0</p>" "" "<p>ReadyScope est un oscilloscope numérique " "pour le streaming de données textuelles ou binaires " "via TCP, ports série et Bluetooth RFCOMM. " "Il offre un rendu flexible et un format de streaming " "binaire ou des flux de texte hautement configurables.</p>" "" "<p>@ 2017-2023 | ReadyDev<br>" "Produit par <b>Gérard KESSE</b><br>" "Polytech'Montpellier<br></p>" ); } //===============================================
//=============================================== void GWindow::on_actionOpen_triggered(bool checked) { QFile lFile("howto.html"); lFile.open(QIODevice::ReadOnly | QIODevice::Text); QByteArray lFileData = lFile.readAll(); GHelperDialog lHelperDialog; lHelperDialog.setText(lFileData); lHelperDialog.exec(); } //=============================================== GHelperDialog::GHelperDialog(QWidget *parent) : QDialog(parent) , ui(new Ui::GHelperDialog) { ui->setupUi(this); ui->label->setWordWrap(true); ui->label->setOpenExternalLinks(true); ui->label->setFixedWidth(380); } //=============================================== void GHelperDialog::setText(const QString& _text) { ui->label->setText(_text); } //===============================================
//=============================================== void GWindow::on_actionOpen_triggered(bool checked) { GScopeWindow* lScopeWindow = new GScopeWindow; lScopeWindow->show(); } //=============================================== GScopeWindow::GScopeWindow(QWidget* parent) { setWindowTitle("ReadyScope"); resize(400, 300); setAttribute(Qt::WA_DeleteOnClose); } //=============================================== void GScopeWindow::paintEvent(QPaintEvent* event) { qDebug() << __PRETTY_FUNCTION__; } //===============================================
//=============================================== void GWindow::on_actionOpen_triggered(bool checked) { GScopeWindow* lScopeWindow = new GScopeWindow; lScopeWindow->show(); } //=============================================== GScopeWindow::GScopeWindow(QWidget* parent) { setWindowTitle("ReadyScope"); resize(400, 300); setAttribute(Qt::WA_DeleteOnClose); } //=============================================== void GScopeWindow::mousePressEvent(QMouseEvent* event ) { qDebug() << __PRETTY_FUNCTION__; } //===============================================
//=============================================== void GWindow::on_actionOpen_triggered(bool checked) { GScopeWindow* lScopeWindow = new GScopeWindow; lScopeWindow->show(); } //=============================================== GScopeWindow::GScopeWindow(QWidget* parent) { setWindowTitle("ReadyScope"); resize(400, 300); setAttribute(Qt::WA_DeleteOnClose); } //=============================================== void GScopeWindow::wheelEvent(QWheelEvent* event) { qDebug() << __PRETTY_FUNCTION__; } //===============================================
//=============================================== void GWindow::on_actionOpen_triggered(bool checked) { QFile lFile("data.txt"); if (lFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { QTextStream lOutput(&lFile); for(int i = 0; i < 5; i++) { for(int j = 0; j < 10; j++) { lOutput << (i + j + i*j) << " "; } lOutput << "\n"; } lFile.close(); } } //===============================================
//=============================================== void GWindow::on_actionOpen_triggered(bool checked) { QFile lFile("howto.html"); lFile.open(QIODevice::ReadOnly | QIODevice::Text); QByteArray lFileData = lFile.readAll(); qDebug() << lFileData; } //===============================================
//=============================================== void GWindow::on_actionOpen_triggered(bool checked) { QList<QSerialPortInfo> lPorts = QSerialPortInfo::availablePorts(); for (int i = 0; i < lPorts.size(); i++) { QSerialPortInfo lPort = lPorts.at(i); qDebug() << "portName-----------: " << lPort.portName(); qDebug() << "description--------: " << lPort.description(); qDebug() << "manufacturer-------: " << lPort.manufacturer(); qDebug() << "productIdentifier--: " << lPort.productIdentifier(); qDebug() << "vendorIdentifier---: " << lPort.vendorIdentifier(); qDebug() << "serialNumber-------: " << lPort.serialNumber(); qDebug() << ""; } } //===============================================
//=============================================== GPortDialog::GPortDialog(QWidget *parent) : QDialog(parent) , ui(new Ui::GPortDialog) { ui->setupUi(this); QList<QSerialPortInfo> lPorts = QSerialPortInfo::availablePorts(); ui->tableWidget->setRowCount(lPorts.size()); ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); for (int i = 0; i < lPorts.size(); i++) { QTableWidgetItem* lNewItem; QSerialPortInfo lPort = lPorts.at(i); // portName lNewItem = new QTableWidgetItem(lPort.portName()); ui->tableWidget->setItem(i, 0, lNewItem); // description lNewItem = new QTableWidgetItem(lPort.description()); ui->tableWidget->setItem(i, 1, lNewItem); // manufacturer lNewItem = new QTableWidgetItem(lPort.manufacturer()); ui->tableWidget->setItem(i, 2, lNewItem); // productIdentifier lNewItem = new QTableWidgetItem(QString::number(lPort.productIdentifier())); ui->tableWidget->setItem(i, 3, lNewItem); // vendorIdentifier lNewItem = new QTableWidgetItem(QString::number(lPort.vendorIdentifier())); ui->tableWidget->setItem(i, 4, lNewItem); // serialNumber lNewItem = new QTableWidgetItem(lPort.serialNumber()); ui->tableWidget->setItem(i, 5, lNewItem); } ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); ui->tableWidget->horizontalHeader()->setStretchLastSection(true); if(lPorts.size() > 0) { ui->tableWidget->selectRow(0); } } //===============================================
//=============================================== void GPortDialog::on_tableWidget_cellDoubleClicked(int row, int column) { accept(); } //===============================================
//=============================================== void GPortDialog::accept() { int row = ui->tableWidget->currentRow(); if(row != -1) { m_portName = ui->tableWidget->item(row, 0)->text(); } QDialog::accept(); qDebug() << m_portName; } //===============================================
//=============================================== const QString& GPortDialog::getPortName() const { return m_portName; } //===============================================
//=============================================== void GWindow::on_actionOpen_triggered(bool checked) { QSettings *lSettings; lSettings = new QSettings("settings.ini", QSettings::IniFormat); if(lSettings->status() != QSettings::NoError) return; QString lDisplayFormat = "DisplayFormat"; QString lBinaryFormat = "BinaryFormat"; QString lInputDevice = "InputDevice"; int lBufferSize = 10000; int lNanValue = 0; int lAfterGlow = 0; int lRefreshRate = 30; double lScalingA = 1.0; double lScalingB = 0.0; bool lScalingEnabled = false; lSettings->setValue("DisplayFormat", lDisplayFormat); lSettings->setValue("BinaryFormat", lBinaryFormat); lSettings->setValue("InputDevice", lInputDevice); lSettings->setValue("BufferSize", lBufferSize); lSettings->setValue("NanValue", lNanValue); lSettings->setValue("RefreshRate", lRefreshRate); lSettings->setValue("AfterGlow", lAfterGlow); lSettings->setValue("ScalingA", lScalingA); lSettings->setValue("ScalingB", lScalingB); lSettings->setValue("ScalingEnabled", lScalingEnabled); delete lSettings; } //===============================================
//=============================================== void GWindow::on_actionOpen_triggered(bool checked) { QSettings *lSettings; lSettings = new QSettings("settings.ini", QSettings::IniFormat); if(lSettings->status() != QSettings::NoError) return; QString lDisplayFormat = lSettings->value("DisplayFormat", "").toString(); QString lBinaryFormat = lSettings->value("BinaryFormat", "").toString(); QString lInputDevice = lSettings->value("InputDevice", "").toString(); int lBufferSize = lSettings->value("BufferSize", 100000).toInt(); int lNanValue = lSettings->value("NanValue", 0).toInt(); int lAfterGlow = lSettings->value("AfterGlow", 0).toInt(); int lRefreshRate = lSettings->value("RefreshRate", 10).toInt(); double lScalingA = lSettings->value("ScalingA", 1.0).toDouble(); double lScalingB = lSettings->value("ScalingB", 0.0).toDouble(); bool lScalingEnabled = lSettings->value("ScalingEnabled", false).toBool(); qDebug() << "DisplayFormat-------: " << lDisplayFormat; qDebug() << "BinaryFormat--------: " << lBinaryFormat; qDebug() << "InputDevice---------: " << lInputDevice; qDebug() << "BufferSize----------: " << lBufferSize; qDebug() << "NanValue------------: " << lNanValue; qDebug() << "AfterGlow-----------: " << lAfterGlow; qDebug() << "RefreshRate---------: " << lRefreshRate; qDebug() << "ScalingA------------: " << lScalingA; qDebug() << "ScalingB------------: " << lScalingB; qDebug() << "ScalingEnabled------: " << lScalingEnabled; } //===============================================