Changeset - e931abef3465
[Not reviewed]
default
0 4 0
Hasan Yavuz ÖZDERYA - 10 years ago 2015-05-10 14:03:34
hy@ozderya.net
added mercurial revision id to about dialog
4 files changed with 30 insertions and 7 deletions:
0 comments (0 inline, 0 general)
CMakeLists.txt
Show inline comments
 
@@ -12,29 +12,24 @@
 
# 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 <http://www.gnu.org/licenses/>.
 
#
 

	
 
cmake_minimum_required(VERSION 2.8.11)
 

	
 
project(serialplot)
 

	
 
set(MAJOR_VERSION 0)
 
set(MINOR_VERSION 1)
 
set(PATCH_VERSION 0)
 
set(VERSION_STRING "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}")
 

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

	
 
@@ -66,24 +61,50 @@ qt5_use_modules(serialplot Widgets Seria
 
# 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()
 

	
 
# version number
 
set(MAJOR_VERSION 0)
 
set(MINOR_VERSION 1)
 
set(PATCH_VERSION 0)
 
set(VERSION_STRING "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}")
 

	
 
# get revision number from mercurial
 
find_program(MERCURIAL hg)
 

	
 
if (MERCURIAL)
 
  execute_process(COMMAND ${MERCURIAL} id -i
 
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 
    RESULT_VARIABLE MERCURIAL_RESULT
 
    OUTPUT_VARIABLE VERSION_REVISION
 
    OUTPUT_STRIP_TRAILING_WHITESPACE)
 
  if(NOT MERCURIAL_RESULT EQUAL 0)
 
    set(VERSION_SCM_REVISION false)
 
  endif(NOT MERCURIAL_RESULT EQUAL 0)
 
endif (MERCURIAL)
 

	
 
if (NOT VERSION_REVISION)
 
  set(VERSION_REVISION "0")
 
endif (NOT VERSION_REVISION)
 

	
 
message("SCM revision: ${VERSION_REVISION}")
 

	
 
# configure version file
 
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/version.h")
 

	
 
# add make run target
 
add_custom_target(run
 
    COMMAND serialplot
 
    DEPENDS serialplot
 
    WORKING_DIRECTORY ${CMAKE_PROJECT_DIR}
 
)
 

	
 
# installing
 
install(TARGETS serialplot DESTINATION bin)
about_dialog.ui
Show inline comments
 
<?xml version="1.0" encoding="UTF-8"?>
 
<ui version="4.0">
 
 <class>AboutDialog</class>
 
 <widget class="QDialog" name="AboutDialog">
 
  <property name="geometry">
 
   <rect>
 
    <x>0</x>
 
    <y>0</y>
 
    <width>487</width>
 
    <height>300</height>
 
    <height>325</height>
 
   </rect>
 
  </property>
 
  <property name="windowTitle">
 
   <string>About</string>
 
  </property>
 
  <layout class="QVBoxLayout" name="verticalLayout">
 
   <item>
 
    <widget class="QLabel" name="lbAbout">
 
     <property name="text">
 
      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;SerialPlot&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;$VERSION_STRING$&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Developed by Hasan Yavuz Özderya&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Using Qt and Qwt (&lt;a href=&quot;http://qwt.sf.net&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://qwt.sf.net&lt;/span&gt;&lt;/a&gt;)&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;This software is GPL licensed. You can obtain source code from &lt;a href=&quot;https://bitbucket.org/hyOzd/serialplot&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://bitbucket.org/hyOzd/serialplot&lt;/span&gt;&lt;/a&gt;.&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
 
      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;SerialPlot&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;$VERSION_STRING$&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Developed by Hasan Yavuz Özderya&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Using Qt and Qwt (&lt;a href=&quot;http://qwt.sf.net&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://qwt.sf.net&lt;/span&gt;&lt;/a&gt;)&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;This software is GPL licensed. You can obtain source code from &lt;a href=&quot;https://bitbucket.org/hyOzd/serialplot&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://bitbucket.org/hyOzd/serialplot&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p align=&quot;right&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;RevID: $VERSION_REVISION$&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
 
     </property>
 
     <property name="wordWrap">
 
      <bool>true</bool>
 
     </property>
 
     <property name="openExternalLinks">
 
      <bool>true</bool>
 
     </property>
 
    </widget>
 
   </item>
 
   <item>
 
    <layout class="QHBoxLayout" name="horizontalLayout">
 
     <item>
mainwindow.cpp
Show inline comments
 
@@ -206,24 +206,25 @@ MainWindow::~MainWindow()
 
}
 

	
 
void MainWindow::setupAboutDialog()
 
{
 
    Ui_AboutDialog uiAboutDialog;
 
    uiAboutDialog.setupUi(&aboutDialog);
 

	
 
    QObject::connect(uiAboutDialog.pbAboutQt, &QPushButton::clicked,
 
                     [](){ QApplication::aboutQt();});
 

	
 
    QString aboutText = uiAboutDialog.lbAbout->text();
 
    aboutText.replace("$VERSION_STRING$", VERSION_STRING);
 
    aboutText.replace("$VERSION_REVISION$", VERSION_REVISION);
 
    uiAboutDialog.lbAbout->setText(aboutText);
 
}
 

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

	
 
    ui->cbPortList->clear();
 

	
 
    for (auto port : QSerialPortInfo::availablePorts())
 
    {
 
        ui->cbPortList->addItem(port.portName());
version.h.in
Show inline comments
 
@@ -12,12 +12,13 @@
 
  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 <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#define MAJOR_VERSION    @MAJOR_VERSION@
 
#define MINOR_VERSION    @MINOR_VERSION@
 
#define PATCH_VERSION    @PATCH_VERSION@
 
#define VERSION_STRING   "@VERSION_STRING@"
 
#define VERSION_REVISION "@VERSION_REVISION@"
0 comments (0 inline, 0 general)