From b8af6f604cd86897c8a04825700892fd9970a616 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Sat, 11 Feb 2012 20:46:02 +0400 Subject: The first prepare QtSerialPort to the form of add-on, with the requirements of "Creating a new module or tool for Qt" Change-Id: I62bba3590a8873bfd03ed6836ac105e0a30d35ba Reviewed-by: Denis Shienkov --- examples/consoleportinfo/consoleportinfo.pro | 27 ----- examples/consoleportinfo/main.cpp | 22 ---- examples/examples.pro | 2 - examples/guiportinfo/guiportinfo.pro | 28 ----- examples/guiportinfo/main.cpp | 11 -- examples/guiportinfo/portinfodialog.cpp | 93 ---------------- examples/guiportinfo/portinfodialog.h | 29 ----- examples/guiportinfo/portinfodialog.ui | 158 --------------------------- 8 files changed, 370 deletions(-) delete mode 100644 examples/consoleportinfo/consoleportinfo.pro delete mode 100644 examples/consoleportinfo/main.cpp delete mode 100644 examples/examples.pro delete mode 100644 examples/guiportinfo/guiportinfo.pro delete mode 100644 examples/guiportinfo/main.cpp delete mode 100644 examples/guiportinfo/portinfodialog.cpp delete mode 100644 examples/guiportinfo/portinfodialog.h delete mode 100644 examples/guiportinfo/portinfodialog.ui (limited to 'examples') diff --git a/examples/consoleportinfo/consoleportinfo.pro b/examples/consoleportinfo/consoleportinfo.pro deleted file mode 100644 index 9bdd996e..00000000 --- a/examples/consoleportinfo/consoleportinfo.pro +++ /dev/null @@ -1,27 +0,0 @@ -TEMPLATE = app -CONFIG += console -QT -= gui -OBJECTS_DIR = obj -MOC_DIR = moc - -linux*:DEFINES += HAVE_LIBUDEV - -INCLUDEPATH += \ - ../../include - -HEADERS += \ - ../../include/serialport.h \ - ../../include/serialportinfo.h - -include(../../src/src.pri) - -SOURCES += main.cpp - -CONFIG(debug, debug|release) { - DESTDIR = debug - TARGET = consoleinfod -} else { - DESTDIR = release - TARGET = consoleinfo -} - diff --git a/examples/consoleportinfo/main.cpp b/examples/consoleportinfo/main.cpp deleted file mode 100644 index c1a3d564..00000000 --- a/examples/consoleportinfo/main.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include -#include - -#include "serialportinfo.h" - -int main(int argc, char *argv[]) -{ - QCoreApplication a(argc, argv); - - QList list = SerialPortInfo::availablePorts(); - int item = 0; - foreach(SerialPortInfo info, list) { - qDebug() << "--> Item: " << item++; - qDebug() << "Port name : " << info.portName(); - qDebug() << "Port location : " << info.systemLocation(); - qDebug() << "Port description : " << info.description(); - qDebug() << "Port manufacturer: " << info.manufacturer(); - } - - return a.exec(); -} diff --git a/examples/examples.pro b/examples/examples.pro deleted file mode 100644 index 43c38e28..00000000 --- a/examples/examples.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += consoleportinfo diff --git a/examples/guiportinfo/guiportinfo.pro b/examples/guiportinfo/guiportinfo.pro deleted file mode 100644 index df2671e7..00000000 --- a/examples/guiportinfo/guiportinfo.pro +++ /dev/null @@ -1,28 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2011-09-21T13:44:17 -# -#------------------------------------------------- - -QT += core gui - -TARGET = guiportinfo -TEMPLATE = app - -linux*:DEFINES += HAVE_LIBUDEV - -INCLUDEPATH += \ - ../../include - -HEADERS += \ - ../../include/serialport.h \ - ../../include/serialportinfo.h - -include(../../src/src.pri) - -SOURCES += main.cpp\ - portinfodialog.cpp - -HEADERS += portinfodialog.h - -FORMS += portinfodialog.ui diff --git a/examples/guiportinfo/main.cpp b/examples/guiportinfo/main.cpp deleted file mode 100644 index 2bdf2faf..00000000 --- a/examples/guiportinfo/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include "portinfodialog.h" - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - Dialog w; - w.show(); - - return a.exec(); -} diff --git a/examples/guiportinfo/portinfodialog.cpp b/examples/guiportinfo/portinfodialog.cpp deleted file mode 100644 index 7954e437..00000000 --- a/examples/guiportinfo/portinfodialog.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include "portinfodialog.h" -#include "ui_portinfodialog.h" - -#include "serialportinfo.h" - -#include - -Q_DECLARE_METATYPE(SerialPortInfo) - -Dialog::Dialog(QWidget *parent) - : QDialog(parent) - , ui(new Ui::Dialog) -{ - ui->setupUi(this); - procUpdateAvailablePorts(); - procItemPortChanged(0); - - connect(ui->updateButton, SIGNAL(clicked()), this, SLOT(procUpdateAvailablePorts())); - connect(ui->portsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(procItemPortChanged(int))); - connect(ui->busyButton, SIGNAL(clicked()), this, SLOT(procBusyButtonClick())); - connect(ui->validButton, SIGNAL(clicked()), this, SLOT(procValidButtonClick())); - connect(ui->ratesButton, SIGNAL(clicked()), this, SLOT(procRatesButtonClick())); -} - -Dialog::~Dialog() -{ - delete ui; -} - -void Dialog::procUpdateAvailablePorts() -{ - ui->portsComboBox->clear(); - foreach (SerialPortInfo info, SerialPortInfo::availablePorts()) { - QVariant v; - v.setValue(info); - ui->portsComboBox->addItem(info.portName(), v); - } -} - -void Dialog::procItemPortChanged(int idx) -{ - QVariant v = ui->portsComboBox->itemData(idx); - if (v.isValid()) { - SerialPortInfo info = v.value(); - - ui->locationValueLabel->setText(info.systemLocation()); - ui->descriptionValueLabel->setText(info.description()); - ui->manufacturerValueLabel->setText(info.manufacturer()); - - ui->busyLabel->setText("***"); - ui->validLabel->setText("***"); - ui->ratesComboBox->clear(); - } -} - -void Dialog::procBusyButtonClick() -{ - int idx = ui->portsComboBox->currentIndex(); - if (idx >= 0) { - QVariant v = ui->portsComboBox->itemData(idx); - if (v.isValid()) { - SerialPortInfo info = v.value(); - ui->busyLabel->setText(info.isBusy() ? tr("Busy") : tr("Free")); - } - } -} - -void Dialog::procValidButtonClick() -{ - int idx = ui->portsComboBox->currentIndex(); - if (idx >= 0) { - QVariant v = ui->portsComboBox->itemData(idx); - if (v.isValid()) { - SerialPortInfo info = v.value(); - ui->validLabel->setText(info.isValid() ? tr("Valid") : tr("Invalid")); - } - } -} - -void Dialog::procRatesButtonClick() -{ - ui->ratesComboBox->clear(); - int idx = ui->portsComboBox->currentIndex(); - if (idx >= 0) { - QVariant v = ui->portsComboBox->itemData(idx); - if (v.isValid()) { - SerialPortInfo info = v.value(); - - foreach (qint32 rate, info.standardRates()) - ui->ratesComboBox->addItem(QString::number(rate)); - } - } -} diff --git a/examples/guiportinfo/portinfodialog.h b/examples/guiportinfo/portinfodialog.h deleted file mode 100644 index 9032be7e..00000000 --- a/examples/guiportinfo/portinfodialog.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef PORTINFODIALOG_H -#define PORTINFODIALOG_H - -#include - -namespace Ui { - class Dialog; -} - -class Dialog : public QDialog -{ - Q_OBJECT - -public: - explicit Dialog(QWidget *parent = 0); - ~Dialog(); - -private slots: - void procUpdateAvailablePorts(); - void procItemPortChanged(int idx); - void procBusyButtonClick(); - void procValidButtonClick(); - void procRatesButtonClick(); - -private: - Ui::Dialog *ui; -}; - -#endif // PORTINFODIALOG_H diff --git a/examples/guiportinfo/portinfodialog.ui b/examples/guiportinfo/portinfodialog.ui deleted file mode 100644 index abe58ecf..00000000 --- a/examples/guiportinfo/portinfodialog.ui +++ /dev/null @@ -1,158 +0,0 @@ - - - Dialog - - - - 0 - 0 - 293 - 255 - - - - Simple port info application - - - - - - Available ports: - - - - - - Current port name: - - - - - - - - - - Update - - - - - - - Qt::Horizontal - - - - 0 - 20 - - - - - - - - - - - Current port info: - - - - - - - - Location: - - - - - - - *** - - - - - - - Description: - - - - - - - *** - - - - - - - Manufacturer: - - - - - - - *** - - - - - - - - - - - Check valid - - - - - - - *** - - - - - - - Check busy - - - - - - - *** - - - - - - - Get rates - - - - - - - - - - - - - - - - - -- cgit v1.2.3