From 4cecde89414277645d50f05da064d03a1799b92a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 10 Jul 2015 12:49:37 +0300 Subject: [PATCH] Long life tape. --HG-- branch : feature --- src/app/app.pro | 3 +- src/app/tape/main.cpp | 39 ++++++++ src/app/tape/stable.cpp | 30 +++++++ src/app/tape/stable.h | 74 ++++++++++++++++ src/app/tape/tape.pri | 14 +++ src/app/tape/tape.pro | 167 +++++++++++++++++++++++++++++++++++ src/app/tape/tmainwindow.cpp | 44 +++++++++ src/app/tape/tmainwindow.h | 52 +++++++++++ src/app/tape/tmainwindow.ui | 24 +++++ 9 files changed, 446 insertions(+), 1 deletion(-) create mode 100644 src/app/tape/main.cpp create mode 100644 src/app/tape/stable.cpp create mode 100644 src/app/tape/stable.h create mode 100644 src/app/tape/tape.pri create mode 100644 src/app/tape/tape.pro create mode 100644 src/app/tape/tmainwindow.cpp create mode 100644 src/app/tape/tmainwindow.h create mode 100644 src/app/tape/tmainwindow.ui diff --git a/src/app/app.pro b/src/app/app.pro index 9e3840a62..c438c9e7c 100644 --- a/src/app/app.pro +++ b/src/app/app.pro @@ -1,3 +1,4 @@ TEMPLATE = subdirs SUBDIRS = \ - valentina + valentina \ + tape diff --git a/src/app/tape/main.cpp b/src/app/tape/main.cpp new file mode 100644 index 000000000..db061854b --- /dev/null +++ b/src/app/tape/main.cpp @@ -0,0 +1,39 @@ +/************************************************************************ + ** + ** @file main.cpp + ** @author Roman Telezhynskyi + ** @date 10 7, 2015 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina 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. + ** + ** Valentina 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 Valentina. If not, see . + ** + *************************************************************************/ + +#include "tmainwindow.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + TMainWindow w; + w.show(); + + return a.exec(); +} diff --git a/src/app/tape/stable.cpp b/src/app/tape/stable.cpp new file mode 100644 index 000000000..e291c2801 --- /dev/null +++ b/src/app/tape/stable.cpp @@ -0,0 +1,30 @@ +/************************************************************************ + ** + ** @file stable.cpp + ** @author Roman Telezhynskyi + ** @date November 15, 2013 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013-2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina 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. + ** + ** Valentina 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 Valentina. If not, see . + ** + *************************************************************************/ + +// Build the precompiled headers. +#include "stable.h" diff --git a/src/app/tape/stable.h b/src/app/tape/stable.h new file mode 100644 index 000000000..290e8baf4 --- /dev/null +++ b/src/app/tape/stable.h @@ -0,0 +1,74 @@ +/************************************************************************ + ** + ** @file stable.h + ** @author Roman Telezhynskyi + ** @date November 15, 2013 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013-2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina 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. + ** + ** Valentina 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 Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef STABLE_H +#define STABLE_H + +/* I like to include this pragma too, so the build log indicates if pre-compiled headers were in use. */ +#ifndef __clang__ +#pragma message("Compiling precompiled headers for tape utility.\n") +#endif + +/* Add C includes here */ + +#if defined __cplusplus +/* Add C++ includes here */ +#include + +/*In all cases we need include core header for getting defined values*/ +#ifdef QT_CORE_LIB +# include +#endif + +#ifdef QT_GUI_LIB +# include +#endif + +#ifdef QT_XML_LIB +# include +#endif + +//In Windows you can't use same header in all modes. +#if !defined(Q_OS_WIN) +# ifdef QT_WIDGETS_LIB +# include +# endif + + //Build doesn't work, if include this headers on Windows. +# ifdef QT_XMLPATTERNS_LIB +# include +# endif + +# ifdef QT_NETWORK_LIB +# include +# endif +#endif/*Q_OS_WIN*/ + +#endif /*__cplusplus*/ + +#endif // STABLE_H diff --git a/src/app/tape/tape.pri b/src/app/tape/tape.pri new file mode 100644 index 000000000..bf0208ced --- /dev/null +++ b/src/app/tape/tape.pri @@ -0,0 +1,14 @@ +# ADD TO EACH PATH $$PWD VARIABLE!!!!!! +# This need for corect working file translations.pro + +SOURCES += \ + $$PWD/main.cpp \ + $$PWD/tmainwindow.cpp \ + $$PWD/stable.cpp + +HEADERS += \ + $$PWD/tmainwindow.h \ + $$PWD/stable.h + +FORMS += \ + $$PWD/tmainwindow.ui diff --git a/src/app/tape/tape.pro b/src/app/tape/tape.pro new file mode 100644 index 000000000..ab6a4cac1 --- /dev/null +++ b/src/app/tape/tape.pro @@ -0,0 +1,167 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2015-07-07T14:35:12 +# +#------------------------------------------------- + +# File with common stuff for whole project +include(../../../common.pri) + +QT += core gui widgets + +# Name of binary file +TARGET = tape + +# We want create executable file +TEMPLATE = app + +# Use out-of-source builds (shadow builds) +CONFIG -= debug_and_release debug_and_release_target + +# We use C++11 standard +CONFIG += c++11 + +# Since Qt 5.4.0 the source code location is recorded only in debug builds. +# We need this information also in release builds. For this need define QT_MESSAGELOGCONTEXT. +DEFINES += QT_MESSAGELOGCONTEXT + +# Directory for executable file +DESTDIR = bin + +# Directory for files created moc +MOC_DIR = moc + +# Directory for objecs files +OBJECTS_DIR = obj + +# Directory for files created rcc +RCC_DIR = rcc + +# Directory for files created uic +UI_DIR = uic + +# Suport subdirectories. Just better project code tree. +include(tape.pri) + +# Set using ccache. Function enable_ccache() defined in common.pri. +macx { + CONFIG(debug, debug|release){ + $$enable_ccache()# Use only in debug mode on Mac + } +} else { + $$enable_ccache() +} + +# Set precompiled headers. Function set_PCH() defined in common.pri. +$$set_PCH() + +CONFIG(debug, debug|release){ + # Debug mode + unix { + #Turn on compilers warnings. + *-g++{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${UI_DIR}" \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } + } + clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${UI_DIR}" \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + } + } else { + *-g++{ + QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + } + } + + #Calculate latest tag distance and build revision only in release mode. Change number each time requare + #recompilation precompiled headers file. + DEFINES += "LATEST_TAG_DISTANCE=0" + DEFINES += "BUILD_REVISION=\\\"unknown\\\"" +}else{ + # Release mode + DEFINES += V_NO_ASSERT + !unix:*-g++{ + QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll + } + + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols + # do nothing + } else { + # Turn on debug symbols in release mode on Unix systems. + # On Mac OS X temporarily disabled. Need find way how to strip binary file. + !macx:!win32-msvc*{ + QMAKE_CXXFLAGS_RELEASE += -g -gdwarf-3 + QMAKE_CFLAGS_RELEASE += -g -gdwarf-3 + QMAKE_LFLAGS_RELEASE = + } + } + + macx{ + HG = /usr/local/bin/hg # Can't defeat PATH variable on Mac OS. + }else { + HG = hg # All other platforms all OK. + } + #latest tag distance number for using in version + HG_DISTANCE=$$system($${HG} log -r. --template '{latesttagdistance}') + isEmpty(HG_DISTANCE){ + HG_DISTANCE = 0 # if we can't find local revision left 0. + } + message("Latest tag distance:" $${HG_DISTANCE}) + DEFINES += "LATEST_TAG_DISTANCE=$${HG_DISTANCE}" # Make available latest tag distance number in sources. + + #build revision number for using in version + unix { + HG_HESH=$$system("$${HG} log -r. --template '{node|short}'") + } else { + # Use escape character before "|" on Windows + HG_HESH=$$system($${HG} log -r. --template "{node^|short}") + } + isEmpty(HG_HESH){ + HG_HESH = "unknown" # if we can't find build revision left unknown. + } + message("Build revision:" $${HG_HESH}) + DEFINES += "BUILD_REVISION=\\\"$${HG_HESH}\\\"" # Make available build revision number in sources. +} + +noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols + # do nothing +} else { + noStripDebugSymbols { # For enable run qmake with CONFIG+=noStripDebugSymbols + # do nothing + } else { + # Strip after you link all libaries. + CONFIG(release, debug|release){ + win32:!win32-msvc*{ + # Strip debug symbols. + QMAKE_POST_LINK += objcopy --only-keep-debug bin/${TARGET} bin/${TARGET}.dbg && + QMAKE_POST_LINK += objcopy --strip-debug bin/${TARGET} && + QMAKE_POST_LINK += objcopy --add-gnu-debuglink="bin/${TARGET}.dbg" bin/${TARGET} + } + + unix:!macx{ + # Strip debug symbols. + QMAKE_POST_LINK += objcopy --only-keep-debug ${TARGET} ${TARGET}.dbg && + QMAKE_POST_LINK += objcopy --strip-debug ${TARGET} && + QMAKE_POST_LINK += objcopy --add-gnu-debuglink="${TARGET}.dbg" ${TARGET} + } + } + } +} diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp new file mode 100644 index 000000000..2c902dc00 --- /dev/null +++ b/src/app/tape/tmainwindow.cpp @@ -0,0 +1,44 @@ +/************************************************************************ + ** + ** @file tmainwindow.cpp + ** @author Roman Telezhynskyi + ** @date 10 7, 2015 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina 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. + ** + ** Valentina 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 Valentina. If not, see . + ** + *************************************************************************/ + +#include "tmainwindow.h" +#include "ui_tmainwindow.h" + +//--------------------------------------------------------------------------------------------------------------------- +TMainWindow::TMainWindow(QWidget *parent) + :QMainWindow(parent), + ui(new Ui::TMainWindow) +{ + ui->setupUi(this); +} + +//--------------------------------------------------------------------------------------------------------------------- +TMainWindow::~TMainWindow() +{ + delete ui; +} diff --git a/src/app/tape/tmainwindow.h b/src/app/tape/tmainwindow.h new file mode 100644 index 000000000..00854643c --- /dev/null +++ b/src/app/tape/tmainwindow.h @@ -0,0 +1,52 @@ +/************************************************************************ + ** + ** @file tmainwindow.h + ** @author Roman Telezhynskyi + ** @date 10 7, 2015 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina 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. + ** + ** Valentina 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 Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef TMAINWINDOW_H +#define TMAINWINDOW_H + +#include + +namespace Ui +{ + class TMainWindow; +} + +class TMainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit TMainWindow(QWidget *parent = 0); + virtual ~TMainWindow() Q_DECL_OVERRIDE; + +private: + Q_DISABLE_COPY(TMainWindow) + Ui::TMainWindow *ui; +}; + +#endif // TMAINWINDOW_H diff --git a/src/app/tape/tmainwindow.ui b/src/app/tape/tmainwindow.ui new file mode 100644 index 000000000..8576cb849 --- /dev/null +++ b/src/app/tape/tmainwindow.ui @@ -0,0 +1,24 @@ + + TMainWindow + + + + 0 + 0 + 400 + 300 + + + + TMainWindow + + + + + + + + + + +