From 2fe98299baff89c26b594704ea6baf6bd8336346 Mon Sep 17 00:00:00 2001 From: gregory guy Date: Sat, 7 Aug 2021 11:45:47 +0200 Subject: [PATCH] Conversion to the cmake building system. Added a man page taken from the Debian packaging system. Changed the doc folder's layout. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: gregory guy CMake: Use tde_add_project_translations common macro. Signed-off-by: Slávek Banko --- CMakeLists.txt | 78 ++++++++++++++++++ ConfigureChecks.cmake | 39 +++++++++ config.h.cmake | 11 +++ doc/en/Makefile.am | 6 +- .../calculation-history.png | Bin .../calculator-buttons.png | Bin doc/en/{qalculate_tde => }/completion.png | Bin .../convert-number-bases.png | Bin doc/en/{qalculate_tde => }/convert-unit.png | Bin doc/en/{qalculate_tde => }/edit-function.png | Bin doc/en/{qalculate_tde => }/edit-matrix.png | Bin doc/en/{qalculate_tde => }/edit-unit.png | Bin doc/en/{qalculate_tde => }/edit-variable.png | Bin .../{qalculate_tde => }/function-manager.png | Bin doc/en/{qalculate_tde => }/functions.docbook | 0 doc/en/{qalculate_tde => }/gnuplot.png | Bin doc/en/{qalculate_tde => }/import-csv.png | Bin doc/en/{qalculate_tde => }/index.docbook | 0 .../{qalculate_tde => }/insert-function.png | Bin doc/en/{qalculate_tde => }/mainwindow.png | Bin doc/en/{qalculate_tde => }/plot-data.png | Bin doc/en/{qalculate_tde => }/plot-settings.png | Bin doc/en/qalculate_tde/Makefile.am | 2 - doc/en/{qalculate_tde => }/rpn-mode.png | Bin doc/en/{qalculate_tde => }/store-variable.png | Bin doc/en/{qalculate_tde => }/unit-manager.png | Bin doc/en/{qalculate_tde => }/units.docbook | 0 .../{qalculate_tde => }/variable-manager.png | Bin doc/en/{qalculate_tde => }/variables.docbook | 0 doc/man/qalculate-tde.1 | 16 ++++ po/CMakeLists.txt | 1 + src/CMakeLists.txt | 62 ++++++++++++++ src/qalculateexpressionedit.cpp | 4 +- src/qalculateinsertmatrixvectordialog.cpp | 12 +-- 34 files changed, 217 insertions(+), 14 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 ConfigureChecks.cmake create mode 100644 config.h.cmake rename doc/en/{qalculate_tde => }/calculation-history.png (100%) rename doc/en/{qalculate_tde => }/calculator-buttons.png (100%) rename doc/en/{qalculate_tde => }/completion.png (100%) rename doc/en/{qalculate_tde => }/convert-number-bases.png (100%) rename doc/en/{qalculate_tde => }/convert-unit.png (100%) rename doc/en/{qalculate_tde => }/edit-function.png (100%) rename doc/en/{qalculate_tde => }/edit-matrix.png (100%) rename doc/en/{qalculate_tde => }/edit-unit.png (100%) rename doc/en/{qalculate_tde => }/edit-variable.png (100%) rename doc/en/{qalculate_tde => }/function-manager.png (100%) rename doc/en/{qalculate_tde => }/functions.docbook (100%) rename doc/en/{qalculate_tde => }/gnuplot.png (100%) rename doc/en/{qalculate_tde => }/import-csv.png (100%) rename doc/en/{qalculate_tde => }/index.docbook (100%) rename doc/en/{qalculate_tde => }/insert-function.png (100%) rename doc/en/{qalculate_tde => }/mainwindow.png (100%) rename doc/en/{qalculate_tde => }/plot-data.png (100%) rename doc/en/{qalculate_tde => }/plot-settings.png (100%) delete mode 100644 doc/en/qalculate_tde/Makefile.am rename doc/en/{qalculate_tde => }/rpn-mode.png (100%) rename doc/en/{qalculate_tde => }/store-variable.png (100%) rename doc/en/{qalculate_tde => }/unit-manager.png (100%) rename doc/en/{qalculate_tde => }/units.docbook (100%) rename doc/en/{qalculate_tde => }/variable-manager.png (100%) rename doc/en/{qalculate_tde => }/variables.docbook (100%) create mode 100644 doc/man/qalculate-tde.1 create mode 100644 po/CMakeLists.txt create mode 100644 src/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..80777ec --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,78 @@ +############################################ +# # +# Improvements and feedbacks are welcome # +# # +# This file is released under GPL >= 3 # +# # +############################################ + + +cmake_minimum_required( VERSION 2.8.12 ) + + +#### general package setup + +project( qalculate_tde ) +set( VERSION R14.1.0 ) + + +#### include essential cmake modules + +include( FindPkgConfig ) +include( CheckFunctionExists ) +include( CheckSymbolExists ) +include( CheckIncludeFile ) +include( CheckLibraryExists ) +include( CheckCSourceCompiles ) +include( CheckCXXSourceCompiles ) + + +#### include our cmake modules + +set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ) +include( TDEMacros ) + + +##### setup install paths + +include( TDESetupPaths ) +tde_setup_paths( ) + + +##### optional stuff + +option( WITH_ALL_OPTIONS "Enable all optional support" OFF ) +option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} ) + + +##### user requested modules + +option( BUILD_ALL "Build all" ON ) +option( BUILD_DOC "Build documentation" ${BUILD_ALL} ) +option( BUILD_TRANSLATIONS "Build translations" ${BUILD_ALL} ) + + +##### configure checks + +include( ConfigureChecks.cmake ) + + +###### global compiler settings + +add_definitions( -DHAVE_CONFIG_H -UTQT_NO_ASCII_CAST ) + +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" ) +set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" ) +set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" ) + + +##### directories + +add_subdirectory( src ) +tde_conditional_add_project_docs( BUILD_DOC ) +tde_conditional_add_subdirectory( BUILD_TRANSLATIONS po ) + + +##### write configure files + +configure_file( config.h.cmake config.h @ONLY ) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake new file mode 100644 index 0000000..2f6cb2a --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,39 @@ +########################################### +# # +# Improvements and feedback are welcome # +# # +# This file is released under GPL >= 3 # +# # +########################################### + +# required stuff +find_package( TQt ) +find_package( TDE ) + +tde_setup_architecture_flags( ) + +include(TestBigEndian) +test_big_endian(WORDS_BIGENDIAN) + +tde_setup_largefiles( ) + + +##### check for gcc visibility support + +if( WITH_GCC_VISIBILITY ) + tde_setup_gcc_visibility( ) +endif( WITH_GCC_VISIBILITY ) + + +##### Threading support + +find_package( Threads ) + + +##### look for libqalculate + +pkg_search_module( QALCULATE libqalculate ) + +if( NOT QALCULATE_FOUND ) + tde_message_fatal( "libqalculate is required but was not found on your system." ) +endif( NOT QALCULATE_FOUND ) diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..a326e62 --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,11 @@ +#define VERSION "@VERSION@" + +// Defined if you have fvisibility and fvisibility-inlines-hidden support. +#cmakedefine __TDE_HAVE_GCC_VISIBILITY 1 + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@ + +/* Defined for .rc file and icons */ +#define PACKAGE "qalculate_tde" diff --git a/doc/en/Makefile.am b/doc/en/Makefile.am index 2f9ab2c..dacaeed 100644 --- a/doc/en/Makefile.am +++ b/doc/en/Makefile.am @@ -1,4 +1,2 @@ -# the SUBDIRS is filled automatically by am_edit. If files are -# in this directory they are installed into the english dir - -SUBDIRS = qalculate_tde +KDE_DOCS = qalculate_tde +KDE_LANG = en diff --git a/doc/en/qalculate_tde/calculation-history.png b/doc/en/calculation-history.png similarity index 100% rename from doc/en/qalculate_tde/calculation-history.png rename to doc/en/calculation-history.png diff --git a/doc/en/qalculate_tde/calculator-buttons.png b/doc/en/calculator-buttons.png similarity index 100% rename from doc/en/qalculate_tde/calculator-buttons.png rename to doc/en/calculator-buttons.png diff --git a/doc/en/qalculate_tde/completion.png b/doc/en/completion.png similarity index 100% rename from doc/en/qalculate_tde/completion.png rename to doc/en/completion.png diff --git a/doc/en/qalculate_tde/convert-number-bases.png b/doc/en/convert-number-bases.png similarity index 100% rename from doc/en/qalculate_tde/convert-number-bases.png rename to doc/en/convert-number-bases.png diff --git a/doc/en/qalculate_tde/convert-unit.png b/doc/en/convert-unit.png similarity index 100% rename from doc/en/qalculate_tde/convert-unit.png rename to doc/en/convert-unit.png diff --git a/doc/en/qalculate_tde/edit-function.png b/doc/en/edit-function.png similarity index 100% rename from doc/en/qalculate_tde/edit-function.png rename to doc/en/edit-function.png diff --git a/doc/en/qalculate_tde/edit-matrix.png b/doc/en/edit-matrix.png similarity index 100% rename from doc/en/qalculate_tde/edit-matrix.png rename to doc/en/edit-matrix.png diff --git a/doc/en/qalculate_tde/edit-unit.png b/doc/en/edit-unit.png similarity index 100% rename from doc/en/qalculate_tde/edit-unit.png rename to doc/en/edit-unit.png diff --git a/doc/en/qalculate_tde/edit-variable.png b/doc/en/edit-variable.png similarity index 100% rename from doc/en/qalculate_tde/edit-variable.png rename to doc/en/edit-variable.png diff --git a/doc/en/qalculate_tde/function-manager.png b/doc/en/function-manager.png similarity index 100% rename from doc/en/qalculate_tde/function-manager.png rename to doc/en/function-manager.png diff --git a/doc/en/qalculate_tde/functions.docbook b/doc/en/functions.docbook similarity index 100% rename from doc/en/qalculate_tde/functions.docbook rename to doc/en/functions.docbook diff --git a/doc/en/qalculate_tde/gnuplot.png b/doc/en/gnuplot.png similarity index 100% rename from doc/en/qalculate_tde/gnuplot.png rename to doc/en/gnuplot.png diff --git a/doc/en/qalculate_tde/import-csv.png b/doc/en/import-csv.png similarity index 100% rename from doc/en/qalculate_tde/import-csv.png rename to doc/en/import-csv.png diff --git a/doc/en/qalculate_tde/index.docbook b/doc/en/index.docbook similarity index 100% rename from doc/en/qalculate_tde/index.docbook rename to doc/en/index.docbook diff --git a/doc/en/qalculate_tde/insert-function.png b/doc/en/insert-function.png similarity index 100% rename from doc/en/qalculate_tde/insert-function.png rename to doc/en/insert-function.png diff --git a/doc/en/qalculate_tde/mainwindow.png b/doc/en/mainwindow.png similarity index 100% rename from doc/en/qalculate_tde/mainwindow.png rename to doc/en/mainwindow.png diff --git a/doc/en/qalculate_tde/plot-data.png b/doc/en/plot-data.png similarity index 100% rename from doc/en/qalculate_tde/plot-data.png rename to doc/en/plot-data.png diff --git a/doc/en/qalculate_tde/plot-settings.png b/doc/en/plot-settings.png similarity index 100% rename from doc/en/qalculate_tde/plot-settings.png rename to doc/en/plot-settings.png diff --git a/doc/en/qalculate_tde/Makefile.am b/doc/en/qalculate_tde/Makefile.am deleted file mode 100644 index e97402c..0000000 --- a/doc/en/qalculate_tde/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -KDE_DOCS = AUTO -KDE_LANG = en diff --git a/doc/en/qalculate_tde/rpn-mode.png b/doc/en/rpn-mode.png similarity index 100% rename from doc/en/qalculate_tde/rpn-mode.png rename to doc/en/rpn-mode.png diff --git a/doc/en/qalculate_tde/store-variable.png b/doc/en/store-variable.png similarity index 100% rename from doc/en/qalculate_tde/store-variable.png rename to doc/en/store-variable.png diff --git a/doc/en/qalculate_tde/unit-manager.png b/doc/en/unit-manager.png similarity index 100% rename from doc/en/qalculate_tde/unit-manager.png rename to doc/en/unit-manager.png diff --git a/doc/en/qalculate_tde/units.docbook b/doc/en/units.docbook similarity index 100% rename from doc/en/qalculate_tde/units.docbook rename to doc/en/units.docbook diff --git a/doc/en/qalculate_tde/variable-manager.png b/doc/en/variable-manager.png similarity index 100% rename from doc/en/qalculate_tde/variable-manager.png rename to doc/en/variable-manager.png diff --git a/doc/en/qalculate_tde/variables.docbook b/doc/en/variables.docbook similarity index 100% rename from doc/en/qalculate_tde/variables.docbook rename to doc/en/variables.docbook diff --git a/doc/man/qalculate-tde.1 b/doc/man/qalculate-tde.1 new file mode 100644 index 0000000..90682e5 --- /dev/null +++ b/doc/man/qalculate-tde.1 @@ -0,0 +1,16 @@ +.TH QALC 1 "28 December 2008" +.SH NAME +qalculate-tde \- Powerful and easy to use desktop calculator +.SH SYNOPSIS +.B qalculate-tde +.SH DESCRIPTION +Qalculate! is a small and simple to use calculator but with much power and +versatility underneath. Features include customizable functions, units, +arbitrary precision using a one-line fault-tolerant expression entry. +.PP +\fBqalculate-tde\fP is the TDE version of Qalculate!. +.SH AUTHORS +Original qalculate-kde was written by Niklas Knutsson . +.PP +This manual page was originally written by Vincent Legout , +for the Debian system (but may be used by others). diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 0000000..24e3bd8 --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1 @@ +tde_add_project_translations() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..4996d27 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,62 @@ + +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${QALCULATE_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${TDE_LIB_DIR} +) + + +##### qalculate-tde (executable) + +tde_add_executable( qalculate-tde AUTOMOC + + SOURCES + buttonwithindexsignal.cpp kqalculate.cpp + main.cpp preferences.cpp qalculatebuttonwithdata.cpp + qalculateconvertnumberbasesdialog.cpp + qalculateconvertunitsdialog.cpp qalculatedatasetsdialog.cpp + qalculatedecimalsdialog.cpp qalculateeditdataobjectdialog.cpp + qalculateeditdatasetdialog.cpp qalculateeditfunctiondialog.cpp + qalculateeditmatrixvectordialog.cpp qalculateeditnamesdialog.cpp + qalculateeditunitdialog.cpp qalculateeditunknownvariabledialog.cpp + qalculateeditvariabledialog.cpp qalculateexportcsvdialog.cpp + qalculateexpressionedit.cpp qalculatefunctionsdialog.cpp + qalculateimportcsvdialog.cpp qalculateinsertfunctiondialog.cpp + qalculateinsertmatrixvectordialog.cpp qalculate_tde_utils.cpp + qalculateperiodictabledialog.cpp qalculateplotdialog.cpp + qalculateprecisiondialog.cpp qalculatepreferencesdialog.cpp + qalculatesetbasedialog.cpp qalculateunitsdialog.cpp + qalculatevariablesdialog.cpp qalculateresultdisplay.cpp + LINK + tdecore-shared + tdeui-shared + tdeio-shared + ${CMAKE_THREAD_LIBS_INIT} + ${QALCULATE_LIBRARIES} + + DESTINATION ${BIN_INSTALL_DIR} +) + + +##### icons + +tde_install_icons( ) + + +##### other data + +install( + FILES qalculate_tdeui.rc + DESTINATION ${DATA_INSTALL_DIR}/qalculate_tde +) + + +tde_create_translated_desktop( qalculate_tde.desktop ) diff --git a/src/qalculateexpressionedit.cpp b/src/qalculateexpressionedit.cpp index 3eff804..0dfc5b9 100644 --- a/src/qalculateexpressionedit.cpp +++ b/src/qalculateexpressionedit.cpp @@ -413,7 +413,7 @@ void QalculateExpressionEdit::keyPressEvent(TQKeyEvent *e) { switch(e->key()) { case Key_Period: { if(e->state() == Keypad) { - insert(CALCULATOR->getDecimalPoint()); + insert(CALCULATOR->getDecimalPoint().c_str()); e->accept(); return; } @@ -421,7 +421,7 @@ void QalculateExpressionEdit::keyPressEvent(TQKeyEvent *e) { } case Key_Comma: { if(e->state() == Keypad) { - insert(CALCULATOR->getDecimalPoint()); + insert(CALCULATOR->getDecimalPoint().c_str()); e->accept(); return; } diff --git a/src/qalculateinsertmatrixvectordialog.cpp b/src/qalculateinsertmatrixvectordialog.cpp index 07835aa..d8791e9 100644 --- a/src/qalculateinsertmatrixvectordialog.cpp +++ b/src/qalculateinsertmatrixvectordialog.cpp @@ -170,7 +170,7 @@ void QalculateInsertMatrixVectorDialog::slotOk() { TQString str2 = elementsTable->text(index_r, index_c).stripWhiteSpace(); if(!str2.isEmpty()) { if(b) { - matrixstr += CALCULATOR->getComma(); + matrixstr += CALCULATOR->getComma().c_str(); matrixstr += " "; } else { b = true; @@ -186,7 +186,7 @@ void QalculateInsertMatrixVectorDialog::slotOk() { bool b1 = false; for(int index_r = 0; index_r < r; index_r++) { if(b1) { - matrixstr += CALCULATOR->getComma(); + matrixstr += CALCULATOR->getComma().c_str(); matrixstr += " "; } else { b1 = true; @@ -195,7 +195,7 @@ void QalculateInsertMatrixVectorDialog::slotOk() { bool b2 = false; for(int index_c = 0; index_c < c; index_c++) { if(b2) { - matrixstr += CALCULATOR->getComma(); + matrixstr += CALCULATOR->getComma().c_str(); matrixstr += " "; } else { b2 = true; @@ -219,7 +219,7 @@ void QalculateInsertMatrixVectorDialog::insertSelection() { TQString str2 = elementsTable->text(index_r, index_c).stripWhiteSpace(); if(!str2.isEmpty()) { if(b) { - matrixstr += CALCULATOR->getComma(); + matrixstr += CALCULATOR->getComma().c_str(); matrixstr += " "; } else { b = true; @@ -235,7 +235,7 @@ void QalculateInsertMatrixVectorDialog::insertSelection() { bool b1 = false; for(int index_r = sel.topRow(); index_r <= sel.bottomRow(); index_r++) { if(b1) { - matrixstr += CALCULATOR->getComma(); + matrixstr += CALCULATOR->getComma().c_str(); matrixstr += " "; } else { b1 = true; @@ -244,7 +244,7 @@ void QalculateInsertMatrixVectorDialog::insertSelection() { bool b2 = false; for(int index_c = sel.leftCol(); index_c <= sel.rightCol(); index_c++) { if(b2) { - matrixstr += CALCULATOR->getComma(); + matrixstr += CALCULATOR->getComma().c_str(); matrixstr += " "; } else { b2 = true;