# HG changeset patch # User Hasan Yavuz ÖZDERYA # Date 2017-02-22 10:41:58 # Node ID 2b91e872282e0bd6f4c2f6f48a04ea457f522ae0 # Parent c1bf9f78ee5505f2968af80030651214b1d2fddf added led widget library for control signals diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,9 +55,10 @@ else (BUILD_QWT) endif (BUILD_QWT) include(BuildQColorWidgets) +include(BuildLedWidget) # includes -include_directories("./src" ${QWT_INCLUDE_DIR} ${QCW_INCLUDE_DIR}) +include_directories("./src" ${QWT_INCLUDE_DIR} ${QCW_INCLUDE_DIR} ${LEDW_INCLUDE_DIR}) # flags set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QCW_FLAGS}") @@ -133,11 +134,11 @@ add_executable(${PROGRAM_NAME} WIN32 ) # Use the Widgets module from Qt 5. -target_link_libraries(${PROGRAM_NAME} ${QWT_LIBRARY} ${QCW_LIBRARY}) +target_link_libraries(${PROGRAM_NAME} ${QWT_LIBRARY} ${QCW_LIBRARY} ${LEDW_LIBRARY}) qt5_use_modules(${PROGRAM_NAME} Widgets SerialPort) if (BUILD_QWT) - add_dependencies(${PROGRAM_NAME} QWT) + add_dependencies(${PROGRAM_NAME} QWT LEDW) endif (BUILD_QWT) # set compiler flags diff --git a/cmake/modules/BuildLedWidget.cmake b/cmake/modules/BuildLedWidget.cmake new file mode 100644 --- /dev/null +++ b/cmake/modules/BuildLedWidget.cmake @@ -0,0 +1,31 @@ +# +# 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(ExternalProject) + +ExternalProject_Add(LEDW + PREFIX ledw + HG_REPOSITORY https://bitbucket.org/hyOzd/ledwidget + UPDATE_COMMAND "" + INSTALL_COMMAND "") + +ExternalProject_Get_Property(LEDW binary_dir source_dir) +set(LEDW_INCLUDE_DIR ${source_dir}/src) +message(${LEDW_INCLUDE_DIR}) +set(LEDW_LIBRARY ${binary_dir}/libledwidget.a) diff --git a/src/portcontrol.cpp b/src/portcontrol.cpp --- a/src/portcontrol.cpp +++ b/src/portcontrol.cpp @@ -1,5 +1,5 @@ /* - Copyright © 2016 Hasan Yavuz Özderya + Copyright © 2017 Hasan Yavuz Özderya This file is part of serialplot. @@ -130,6 +130,9 @@ PortControl::PortControl(QSerialPort* po SELECT::OVERLOAD_OF(&QButtonGroup::buttonClicked), this, &PortControl::selectFlowControl); + // test code + connect(ui->pbDTR, &QPushButton::clicked, ui->ledDTR, &LedWidget::toggle); + loadPortList(); loadBaudRateList(); ui->cbBaudRate->setCurrentIndex(ui->cbBaudRate->findText("9600")); diff --git a/src/portcontrol.ui b/src/portcontrol.ui --- a/src/portcontrol.ui +++ b/src/portcontrol.ui @@ -301,6 +301,81 @@ + + + 2 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 40 + 16777215 + + + + DTR + + + + + + + + 15 + 15 + + + + + 15 + 15 + + + + + + + + DCE + + + Qt::AlignCenter + + + + + + + + 15 + 15 + + + + + 15 + 15 + + + + + + + Qt::Vertical @@ -317,6 +392,14 @@ + + + LedWidget + QWidget +
ledwidget.h
+ 1 +
+
cbPortList pbReloadPorts