Changeset - 58db5f6bf2b1
[Not reviewed]
default
0 0 11
Hasan Yavuz Ă–zderya - 11 years ago 2015-03-07 09:30:52
hy@ozderya.net
initial commit, port selection, open/close is working, received data is written to stdout
11 files changed with 867 insertions and 0 deletions:
0 comments (0 inline, 0 general)
CMakeLists.txt
Show inline comments
 
new file 100644
 
cmake_minimum_required(VERSION 2.8.11)
 

	
 
project(serialplot)
 

	
 
# Find includes in corresponding build directories
 
set(CMAKE_INCLUDE_CURRENT_DIR ON)
 

	
 
# Instruct CMake to run moc automatically when needed.
 
set(CMAKE_AUTOMOC ON)
 

	
 
# add local path for cmake modules
 
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
 

	
 
# Find the QtWidgets library
 
find_package(Qt5Widgets)
 
find_package(Qwt 6.1 REQUIRED)
 

	
 
# includes
 
include_directories(${QWT_INCLUDE_DIR})
 

	
 
# wrap UI files
 
qt5_wrap_ui(UI_FILES mainwindow.ui)
 

	
 
# Tell CMake to create the helloworld executable
 
add_executable(serialplot main.cpp mainwindow.cpp customcheckablebutton.cpp ${UI_FILES})
 

	
 
# Use the Widgets module from Qt 5.
 
qt5_use_modules(serialplot Widgets SerialPort)
 
target_link_libraries(serialplot ${QWT_LIBRARY})
 

	
 
# Enable C++11 support, fail if not supported
 
include(CheckCXXCompilerFlag)
 
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
 
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
 
if(COMPILER_SUPPORTS_CXX11)
 
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
 
elseif(COMPILER_SUPPORTS_CXX0X)
 
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
 
else()
 
  message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
 
endif()
 

	
 
# add make run target
 
add_custom_target(run
 
    COMMAND serialplot
 
    DEPENDS serialplot
 
    WORKING_DIRECTORY ${CMAKE_PROJECT_DIR}
 
)
 
\ No newline at end of file
README.md
Show inline comments
 
new file 100644
 

	
 
Small and simple software for plotting data from serial port.
 

	
 
# Dependencies
 
- Qt 5, including serialport module
 
- qwt 6.1
 
- libudev-dev (required for QSerialPort)
cmake/modules/FindQwt.cmake
Show inline comments
 
new file 100644
 
# Qt Widgets for Technical Applications
 
# available at http://www.http://qwt.sourceforge.net/
 
#
 
# The module defines the following variables:
 
#  QWT_FOUND - the system has Qwt
 
#  QWT_INCLUDE_DIR - where to find qwt_plot.h
 
#  QWT_INCLUDE_DIRS - qwt includes
 
#  QWT_LIBRARY - where to find the Qwt library
 
#  QWT_LIBRARIES - aditional libraries
 
#  QWT_MAJOR_VERSION - major version
 
#  QWT_MINOR_VERSION - minor version
 
#  QWT_PATCH_VERSION - patch version
 
#  QWT_VERSION_STRING - version (ex. 5.2.1)
 
#  QWT_ROOT_DIR - root dir (ex. /usr/local)
 

	
 
#=============================================================================
 
# Copyright 2010-2013, Julien Schueller
 
# All rights reserved.
 
# 
 
# Redistribution and use in source and binary forms, with or without
 
# modification, are permitted provided that the following conditions are met: 
 
# 
 
# 1. Redistributions of source code must retain the above copyright notice, this
 
#    list of conditions and the following disclaimer. 
 
# 2. Redistributions in binary form must reproduce the above copyright notice,
 
#    this list of conditions and the following disclaimer in the documentation
 
#    and/or other materials provided with the distribution. 
 
#
 
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 

	
 
# The views and conclusions contained in the software and documentation are those
 
# of the authors and should not be interpreted as representing official policies, 
 
# either expressed or implied, of the FreeBSD Project.
 
#=============================================================================
 

	
 
# TODO: handle multiple versions of qwt
 
file(GLOB QWT_GLOB_DIR "/usr/local/qwt*/")
 

	
 
find_path ( QWT_INCLUDE_DIR
 
  NAMES qwt_plot.h
 
  HINTS ${QT_INCLUDE_DIR} "${QWT_GLOB_DIR}/include"
 
  PATH_SUFFIXES qwt qwt-qt3 qwt-qt4 qwt-qt5
 
)
 

	
 
set ( QWT_INCLUDE_DIRS ${QWT_INCLUDE_DIR} )
 

	
 
# version
 
set ( _VERSION_FILE ${QWT_INCLUDE_DIR}/qwt_global.h )
 
if ( EXISTS ${_VERSION_FILE} )
 
  file ( STRINGS ${_VERSION_FILE} _VERSION_LINE REGEX "define[ ]+QWT_VERSION_STR" )
 
  if ( _VERSION_LINE )
 
    string ( REGEX REPLACE ".*define[ ]+QWT_VERSION_STR[ ]+\"(.*)\".*" "\\1" QWT_VERSION_STRING "${_VERSION_LINE}" )
 
    string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" QWT_MAJOR_VERSION "${QWT_VERSION_STRING}" )
 
    string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" QWT_MINOR_VERSION "${QWT_VERSION_STRING}" )
 
    string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\3" QWT_PATCH_VERSION "${QWT_VERSION_STRING}" )
 
  endif ()
 
endif ()
 

	
 

	
 
# check version
 
set ( _QWT_VERSION_MATCH TRUE )
 
if ( Qwt_FIND_VERSION AND QWT_VERSION_STRING )
 
  if ( Qwt_FIND_VERSION_EXACT )
 
    if ( NOT Qwt_FIND_VERSION VERSION_EQUAL QWT_VERSION_STRING )
 
      set ( _QWT_VERSION_MATCH FALSE )
 
    endif ()
 
  else ()
 
    if ( QWT_VERSION_STRING VERSION_LESS Qwt_FIND_VERSION )
 
      set ( _QWT_VERSION_MATCH FALSE )
 
    endif ()
 
  endif ()
 
endif ()
 

	
 

	
 
find_library ( QWT_LIBRARY
 
  NAMES qwt qwt-qt3 qwt-qt4 qwt-qt5
 
  HINTS ${QT_LIBRARY_DIR} "${QWT_GLOB_DIR}/lib"
 
)
 

	
 
set ( QWT_LIBRARIES ${QWT_LIBRARY} )
 

	
 

	
 
# try to guess root dir from include dir
 
if ( QWT_INCLUDE_DIR )
 
  string ( REGEX REPLACE "(.*)/include.*" "\\1" QWT_ROOT_DIR ${QWT_INCLUDE_DIR} )
 
# try to guess root dir from library dir
 
elseif ( QWT_LIBRARY )
 
  string ( REGEX REPLACE "(.*)/lib[/|32|64].*" "\\1" QWT_ROOT_DIR ${QWT_LIBRARY} )
 
endif ()
 

	
 

	
 
# handle the QUIETLY and REQUIRED arguments
 
include ( FindPackageHandleStandardArgs )
 
if ( CMAKE_VERSION LESS 2.8.3 )
 
  find_package_handle_standard_args( Qwt DEFAULT_MSG QWT_LIBRARY QWT_INCLUDE_DIR _QWT_VERSION_MATCH )
 
else ()
 
  find_package_handle_standard_args( Qwt REQUIRED_VARS QWT_LIBRARY QWT_INCLUDE_DIR _QWT_VERSION_MATCH VERSION_VAR QWT_VERSION_STRING )
 
endif ()
 

	
 

	
 
mark_as_advanced (
 
  QWT_LIBRARY 
 
  QWT_LIBRARIES
 
  QWT_INCLUDE_DIR
 
  QWT_INCLUDE_DIRS
 
  QWT_MAJOR_VERSION
 
  QWT_MINOR_VERSION
 
  QWT_PATCH_VERSION
 
  QWT_VERSION_STRING
 
  QWT_ROOT_DIR
 
)
customcheckablebutton.cpp
Show inline comments
 
new file 100644
 
#include "customcheckablebutton.h"
 

	
 
CustomCheckableButton::CustomCheckableButton(QWidget *parent) :
 
    QPushButton(parent)
 
{
 
    this->setCheckable(true);
 
}
 

	
 
void CustomCheckableButton::nextCheckState()
 
{
 
    /* Do nothing! Check state will be altered by parent. */
 
}
customcheckablebutton.h
Show inline comments
 
new file 100644
 
#ifndef CUSTOMCHECKABLEBUTTON_H
 
#define CUSTOMCHECKABLEBUTTON_H
 

	
 
#include <QPushButton>
 

	
 
class CustomCheckableButton : public QPushButton
 
{
 
    Q_OBJECT
 
public:
 
    explicit CustomCheckableButton(QWidget *parent = 0);
 

	
 
signals:
 

	
 
public slots:
 

	
 
private:
 
    void nextCheckState();
 

	
 
};
 

	
 
#endif // CUSTOMCHECKABLEBUTTON_H
main.cpp
Show inline comments
 
new file 100644
 
#include "mainwindow.h"
 
#include <QApplication>
 

	
 
int main(int argc, char *argv[])
 
{
 
    QApplication a(argc, argv);
 
    MainWindow w;
 
    w.show();
 

	
 
    return a.exec();
 
}
mainwindow.cpp
Show inline comments
 
new file 100644
 
#include "mainwindow.h"
 
#include "ui_mainwindow.h"
 
#include <QSerialPortInfo>
 
#include <QtDebug>
 

	
 
#include "utils.h"
 

	
 
MainWindow::MainWindow(QWidget *parent) :
 
    QMainWindow(parent),
 
    ui(new Ui::MainWindow)
 
{
 
    ui->setupUi(this);
 

	
 
    // init UI signals
 
    QObject::connect(ui->pbReloadPorts, &QPushButton::clicked,
 
                     this, &MainWindow::loadPortList);
 

	
 
    QObject::connect(ui->pbOpenPort, &QPushButton::clicked,
 
                     this, &MainWindow::togglePort);
 

	
 
    QObject::connect(this, &MainWindow::portToggled,
 
                     this, &MainWindow::onPortToggled);
 

	
 
    QObject::connect(ui->cbPortList,
 
                     SELECT<const QString&>::OVERLOAD_OF(&QComboBox::activated),
 
                     this, &MainWindow::selectPort);
 

	
 
    QObject::connect(ui->cbBaudRate,
 
                     SELECT<const QString&>::OVERLOAD_OF(&QComboBox::activated),
 
                     this, &MainWindow::selectBaudRate);
 

	
 
    QObject::connect(&(this->serialPort), &QSerialPort::readyRead,
 
                     this, &MainWindow::onDataReady);
 

	
 
    loadPortList();
 
    loadBaudRateList();
 
    ui->cbBaudRate->setCurrentIndex(ui->cbBaudRate->findText("9600"));
 
}
 

	
 
MainWindow::~MainWindow()
 
{
 
    delete ui;
 
}
 

	
 
void MainWindow::loadPortList()
 
{
 
    QString currentSelection = ui->cbPortList->currentText();
 

	
 
    ui->cbPortList->clear();
 

	
 
    for (auto port : QSerialPortInfo::availablePorts())
 
    {
 
        ui->cbPortList->addItem(port.portName());
 
    }
 

	
 
    // find current selection in the new list, maybe it doesn't exist anymore?
 
    int currentSelectionIndex = ui->cbPortList->findText(currentSelection);
 
    if (currentSelectionIndex >= 0)
 
    {
 
        ui->cbPortList->setCurrentIndex(currentSelectionIndex);
 
    }
 
    else // our port doesn't exist anymore, close port if it's open
 
    {
 
        if (serialPort.isOpen()) togglePort();
 
    }
 
}
 

	
 
void MainWindow::loadBaudRateList()
 
{
 
    ui->cbBaudRate->clear();
 

	
 
    for (auto baudRate : QSerialPortInfo::standardBaudRates())
 
    {
 
        ui->cbBaudRate->addItem(QString::number(baudRate));
 
    }
 
}
 

	
 
void MainWindow::togglePort()
 
{
 
    if (serialPort.isOpen())
 
    {
 
        serialPort.close();
 
        qDebug() << "Port closed, " << serialPort.portName();
 
        emit portToggled(false);
 
    }
 
    else
 
    {
 
        serialPort.setPortName(ui->cbPortList->currentText());
 

	
 
        // open port
 
        if (serialPort.open(QIODevice::ReadWrite))
 
        {
 
            qDebug() << "Port opened, " << serialPort.portName();
 
            emit portToggled(true);
 

	
 
            // set baud rate
 
            if (!serialPort.setBaudRate(ui->cbBaudRate->currentText().toInt()))
 
            {
 
                qDebug() << "Set baud rate failed during port opening: "
 
                         << serialPort.error();
 
            }
 
        }
 
        else
 
        {
 
            qDebug() << "Port open error: " << serialPort.error();
 
        }
 
    }
 
}
 

	
 
void MainWindow::selectPort(QString portName)
 
{
 
    // has selection actually changed
 
    if (portName != serialPort.portName())
 
    {
 
        // if another port is already open, close it by toggling
 
        if (serialPort.isOpen())
 
        {
 
            togglePort();
 

	
 
            // open new selection by toggling
 
            togglePort();
 
        }
 
    }
 
}
 

	
 
void MainWindow::selectBaudRate(QString baudRate)
 
{
 
    if (serialPort.isOpen())
 
    {
 
        if (!serialPort.setBaudRate(baudRate.toInt()))
 
        {
 
            qDebug() << "Set baud rate failed during select: "
 
                     << serialPort.error();
 
        }
 
        else
 
        {
 
            qDebug() << "Baud rate changed: " << serialPort.baudRate();
 
        }
 
    }
 
}
 

	
 
void MainWindow::onPortToggled(bool open)
 
{
 
    ui->pbOpenPort->setChecked(open);
 
}
 

	
 
void MainWindow::onDataReady()
 
{
 
    qDebug() << "Data: " << serialPort.readAll().toHex();
 
}
mainwindow.h
Show inline comments
 
new file 100644
 
#ifndef MAINWINDOW_H
 
#define MAINWINDOW_H
 

	
 
#include <QMainWindow>
 
#include <QString>
 
#include <QSerialPort>
 

	
 
namespace Ui {
 
class MainWindow;
 
}
 

	
 
class MainWindow : public QMainWindow
 
{
 
    Q_OBJECT
 

	
 
public:
 
    explicit MainWindow(QWidget *parent = 0);
 
    ~MainWindow();
 

	
 
private:
 
    Ui::MainWindow *ui;
 
    QSerialPort serialPort;
 

	
 
private slots:
 
    void loadPortList();
 
    void loadBaudRateList();
 
    void togglePort();
 
    void selectPort(QString portName);
 
    void onPortToggled(bool open);
 
    void selectBaudRate(QString baudRate);
 

	
 
    void onDataReady();
 

	
 
signals:
 
    void portToggled(bool open);
 
};
 

	
 
#endif // MAINWINDOW_H
mainwindow.ui
Show inline comments
 
new file 100644
 
<?xml version="1.0" encoding="UTF-8"?>
 
<ui version="4.0">
 
 <class>MainWindow</class>
 
 <widget class="QMainWindow" name="MainWindow">
 
  <property name="geometry">
 
   <rect>
 
    <x>0</x>
 
    <y>0</y>
 
    <width>652</width>
 
    <height>534</height>
 
   </rect>
 
  </property>
 
  <property name="windowTitle">
 
   <string>MainWindow</string>
 
  </property>
 
  <widget class="QWidget" name="centralWidget">
 
   <layout class="QVBoxLayout" name="verticalLayout_2">
 
    <item>
 
     <widget class="QwtPlot" name="plot" native="true">
 
      <property name="sizePolicy">
 
       <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
 
        <horstretch>0</horstretch>
 
        <verstretch>0</verstretch>
 
       </sizepolicy>
 
      </property>
 
     </widget>
 
    </item>
 
    <item>
 
     <widget class="QTabWidget" name="tabWidget">
 
      <property name="sizePolicy">
 
       <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
 
        <horstretch>0</horstretch>
 
        <verstretch>0</verstretch>
 
       </sizepolicy>
 
      </property>
 
      <property name="minimumSize">
 
       <size>
 
        <width>0</width>
 
        <height>0</height>
 
       </size>
 
      </property>
 
      <property name="maximumSize">
 
       <size>
 
        <width>16777215</width>
 
        <height>16777215</height>
 
       </size>
 
      </property>
 
      <property name="currentIndex">
 
       <number>0</number>
 
      </property>
 
      <property name="movable">
 
       <bool>false</bool>
 
      </property>
 
      <widget class="QWidget" name="tabPort">
 
       <attribute name="title">
 
        <string>Port</string>
 
       </attribute>
 
       <layout class="QHBoxLayout" name="horizontalLayout">
 
        <item>
 
         <layout class="QVBoxLayout" name="verticalLayout_3">
 
          <item>
 
           <layout class="QGridLayout" name="gridLayout">
 
            <item row="0" column="0">
 
             <widget class="QLabel" name="label">
 
              <property name="text">
 
               <string>Port:</string>
 
              </property>
 
             </widget>
 
            </item>
 
            <item row="0" column="1">
 
             <widget class="QComboBox" name="cbPortList">
 
              <property name="sizePolicy">
 
               <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
 
                <horstretch>0</horstretch>
 
                <verstretch>0</verstretch>
 
               </sizepolicy>
 
              </property>
 
             </widget>
 
            </item>
 
            <item row="1" column="1">
 
             <widget class="QComboBox" name="cbBaudRate">
 
              <property name="inputMethodHints">
 
               <set>Qt::ImhPreferNumbers</set>
 
              </property>
 
              <property name="editable">
 
               <bool>true</bool>
 
              </property>
 
             </widget>
 
            </item>
 
            <item row="1" column="0">
 
             <widget class="QLabel" name="label_2">
 
              <property name="text">
 
               <string>Baud Rate:</string>
 
              </property>
 
             </widget>
 
            </item>
 
            <item row="0" column="2">
 
             <widget class="QPushButton" name="pbReloadPorts">
 
              <property name="sizePolicy">
 
               <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
 
                <horstretch>0</horstretch>
 
                <verstretch>0</verstretch>
 
               </sizepolicy>
 
              </property>
 
              <property name="maximumSize">
 
               <size>
 
                <width>30</width>
 
                <height>16777215</height>
 
               </size>
 
              </property>
 
              <property name="text">
 
               <string>🔄</string>
 
              </property>
 
             </widget>
 
            </item>
 
           </layout>
 
          </item>
 
          <item>
 
           <layout class="QHBoxLayout" name="horizontalLayout_2">
 
            <item>
 
             <widget class="QFrame" name="frame">
 
              <property name="frameShape">
 
               <enum>QFrame::NoFrame</enum>
 
              </property>
 
              <layout class="QVBoxLayout" name="verticalLayout_5">
 
               <item>
 
                <widget class="QRadioButton" name="rbNoParity">
 
                 <property name="text">
 
                  <string>No Parity</string>
 
                 </property>
 
                </widget>
 
               </item>
 
               <item>
 
                <widget class="QRadioButton" name="rbOddParity">
 
                 <property name="text">
 
                  <string>Odd Parity</string>
 
                 </property>
 
                </widget>
 
               </item>
 
               <item>
 
                <widget class="QRadioButton" name="rbEvenParity">
 
                 <property name="text">
 
                  <string>Even Parity</string>
 
                 </property>
 
                </widget>
 
               </item>
 
               <item>
 
                <spacer name="verticalSpacer_2">
 
                 <property name="orientation">
 
                  <enum>Qt::Vertical</enum>
 
                 </property>
 
                 <property name="sizeHint" stdset="0">
 
                  <size>
 
                   <width>20</width>
 
                   <height>2</height>
 
                  </size>
 
                 </property>
 
                </spacer>
 
               </item>
 
              </layout>
 
             </widget>
 
            </item>
 
            <item>
 
             <widget class="QFrame" name="frame_3">
 
              <layout class="QVBoxLayout" name="verticalLayout_7">
 
               <item>
 
                <widget class="QRadioButton" name="rb8Bits">
 
                 <property name="text">
 
                  <string>8 bits</string>
 
                 </property>
 
                </widget>
 
               </item>
 
               <item>
 
                <widget class="QRadioButton" name="rb7Bits">
 
                 <property name="text">
 
                  <string>7 bits</string>
 
                 </property>
 
                </widget>
 
               </item>
 
               <item>
 
                <widget class="QRadioButton" name="rb6Bits">
 
                 <property name="text">
 
                  <string>6 bits</string>
 
                 </property>
 
                </widget>
 
               </item>
 
               <item>
 
                <widget class="QRadioButton" name="rb5Bits">
 
                 <property name="text">
 
                  <string>5 bits</string>
 
                 </property>
 
                </widget>
 
               </item>
 
              </layout>
 
             </widget>
 
            </item>
 
            <item>
 
             <widget class="QFrame" name="frame_4">
 
              <layout class="QVBoxLayout" name="verticalLayout">
 
               <item>
 
                <widget class="QRadioButton" name="rb1StopBit">
 
                 <property name="text">
 
                  <string>1 Stop Bit</string>
 
                 </property>
 
                </widget>
 
               </item>
 
               <item>
 
                <widget class="QRadioButton" name="rb2StopBit">
 
                 <property name="text">
 
                  <string>2 Stop Bit</string>
 
                 </property>
 
                </widget>
 
               </item>
 
               <item>
 
                <spacer name="verticalSpacer_4">
 
                 <property name="orientation">
 
                  <enum>Qt::Vertical</enum>
 
                 </property>
 
                 <property name="sizeHint" stdset="0">
 
                  <size>
 
                   <width>20</width>
 
                   <height>2</height>
 
                  </size>
 
                 </property>
 
                </spacer>
 
               </item>
 
              </layout>
 
             </widget>
 
            </item>
 
            <item>
 
             <widget class="QFrame" name="frame_2">
 
              <layout class="QVBoxLayout" name="verticalLayout_6">
 
               <item>
 
                <widget class="QRadioButton" name="rbNoFlowControl">
 
                 <property name="text">
 
                  <string>No Flow Control</string>
 
                 </property>
 
                </widget>
 
               </item>
 
               <item>
 
                <widget class="QRadioButton" name="rbHardwareControl">
 
                 <property name="text">
 
                  <string>Hardware Control</string>
 
                 </property>
 
                </widget>
 
               </item>
 
               <item>
 
                <widget class="QRadioButton" name="rbSoftwareControl">
 
                 <property name="text">
 
                  <string>Software Control</string>
 
                 </property>
 
                </widget>
 
               </item>
 
               <item>
 
                <spacer name="verticalSpacer_5">
 
                 <property name="orientation">
 
                  <enum>Qt::Vertical</enum>
 
                 </property>
 
                 <property name="sizeHint" stdset="0">
 
                  <size>
 
                   <width>20</width>
 
                   <height>2</height>
 
                  </size>
 
                 </property>
 
                </spacer>
 
               </item>
 
              </layout>
 
             </widget>
 
            </item>
 
           </layout>
 
          </item>
 
         </layout>
 
        </item>
 
        <item>
 
         <spacer name="horizontalSpacer">
 
          <property name="orientation">
 
           <enum>Qt::Horizontal</enum>
 
          </property>
 
          <property name="sizeHint" stdset="0">
 
           <size>
 
            <width>10000</width>
 
            <height>20</height>
 
           </size>
 
          </property>
 
         </spacer>
 
        </item>
 
        <item>
 
         <layout class="QVBoxLayout" name="verticalLayout_4">
 
          <item>
 
           <widget class="CustomCheckableButton" name="pbOpenPort">
 
            <property name="minimumSize">
 
             <size>
 
              <width>0</width>
 
              <height>50</height>
 
             </size>
 
            </property>
 
            <property name="text">
 
             <string>Open</string>
 
            </property>
 
            <property name="checkable">
 
             <bool>true</bool>
 
            </property>
 
           </widget>
 
          </item>
 
          <item>
 
           <widget class="QPushButton" name="pbSkipByte">
 
            <property name="text">
 
             <string>Skip Byte</string>
 
            </property>
 
           </widget>
 
          </item>
 
          <item>
 
           <spacer name="verticalSpacer">
 
            <property name="orientation">
 
             <enum>Qt::Vertical</enum>
 
            </property>
 
            <property name="sizeHint" stdset="0">
 
             <size>
 
              <width>20</width>
 
              <height>40</height>
 
             </size>
 
            </property>
 
           </spacer>
 
          </item>
 
         </layout>
 
        </item>
 
       </layout>
 
      </widget>
 
      <widget class="QWidget" name="tab_2">
 
       <attribute name="title">
 
        <string>Tab 2</string>
 
       </attribute>
 
      </widget>
 
     </widget>
 
    </item>
 
   </layout>
 
  </widget>
 
  <widget class="QMenuBar" name="menuBar">
 
   <property name="geometry">
 
    <rect>
 
     <x>0</x>
 
     <y>0</y>
 
     <width>652</width>
 
     <height>20</height>
 
    </rect>
 
   </property>
 
   <widget class="QMenu" name="menuFile">
 
    <property name="title">
 
     <string>File</string>
 
    </property>
 
    <addaction name="actionFileLoadProfile"/>
 
    <addaction name="actionFileSaveProfile"/>
 
   </widget>
 
   <widget class="QMenu" name="menuHelp">
 
    <property name="title">
 
     <string>Help</string>
 
    </property>
 
    <addaction name="actionHelpDataFormats"/>
 
    <addaction name="actionHelpAbout"/>
 
   </widget>
 
   <addaction name="menuFile"/>
 
   <addaction name="menuHelp"/>
 
  </widget>
 
  <widget class="QToolBar" name="mainToolBar">
 
   <attribute name="toolBarArea">
 
    <enum>TopToolBarArea</enum>
 
   </attribute>
 
   <attribute name="toolBarBreak">
 
    <bool>false</bool>
 
   </attribute>
 
   <addaction name="actionStart"/>
 
   <addaction name="actionClear"/>
 
  </widget>
 
  <widget class="QStatusBar" name="statusBar"/>
 
  <action name="actionStart">
 
   <property name="checkable">
 
    <bool>true</bool>
 
   </property>
 
   <property name="text">
 
    <string>Start</string>
 
   </property>
 
  </action>
 
  <action name="actionClear">
 
   <property name="text">
 
    <string>Clear</string>
 
   </property>
 
  </action>
 
  <action name="actionHelpDataFormats">
 
   <property name="text">
 
    <string>Data Formats</string>
 
   </property>
 
  </action>
 
  <action name="actionHelpAbout">
 
   <property name="text">
 
    <string>About</string>
 
   </property>
 
  </action>
 
  <action name="actionFileLoadProfile">
 
   <property name="text">
 
    <string>Load Profile</string>
 
   </property>
 
  </action>
 
  <action name="actionFileSaveProfile">
 
   <property name="text">
 
    <string>Save Profile</string>
 
   </property>
 
  </action>
 
 </widget>
 
 <layoutdefault spacing="6" margin="11"/>
 
 <customwidgets>
 
  <customwidget>
 
   <class>QwtPlot</class>
 
   <extends>QWidget</extends>
 
   <header>qwt_plot.h</header>
 
   <container>1</container>
 
  </customwidget>
 
  <customwidget>
 
   <class>CustomCheckableButton</class>
 
   <extends>QPushButton</extends>
 
   <header>customcheckablebutton.h</header>
 
  </customwidget>
 
 </customwidgets>
 
 <resources/>
 
 <connections/>
 
</ui>
serialplot.pro
Show inline comments
 
new file 100644
 
#-------------------------------------------------
 
#
 
# Project created by QtCreator 2015-03-04T08:20:06
 
#
 
#-------------------------------------------------
 

	
 
QT       += core gui serialport
 

	
 
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 

	
 
TARGET = serialplot
 
TEMPLATE = app
 

	
 
CONFIG += qwt
 

	
 

	
 
SOURCES += main.cpp\
 
        mainwindow.cpp \
 
    customcheckablebutton.cpp
 

	
 
HEADERS  += mainwindow.h \
 
    utils.h \
 
    customcheckablebutton.h
 

	
 
FORMS    += mainwindow.ui
 

	
 
CONFIG += c++11
utils.h
Show inline comments
 
new file 100644
 

	
 
// credits: peppe@stackoverflow [http://stackoverflow.com/a/16795664/432492]
 
template<typename... Args> struct SELECT {
 
    template<typename C, typename R>
 
    static constexpr auto OVERLOAD_OF( R (C::*pmf)(Args...) ) -> decltype(pmf) {
 
        return pmf;
 
    }
 
};
0 comments (0 inline, 0 general)