From 0d8d437a5796bb4f8e94595e5f4a7d0bde3716ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Tue, 29 Oct 2024 09:21:53 +0100 Subject: [PATCH 01/32] Add filled vrsion for ci.yml --- .github/workflows/ci.yml | 1608 +++++++++++++++++++------------------- 1 file changed, 804 insertions(+), 804 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78581ceb5..af0bd382a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,804 +1,804 @@ ---- -name: "CI: Test, Build and create release" - -# yamllint disable -on: - # yamllint enable - push: - branches: - - main - - develop - tags: - - "[0-9]+.[0-9]+.[0-9]+" - paths: - - "**.cpp" - - "**.h" - - "**.hpp" - - "**.py" - - cmake/** - - src/** - - CMakeLists.txt - - conanfile.py - - ".github/workflows/ci.yml" - - "deploy/flatpak.yaml" - - "snap/snapcraft.yaml" - - pull_request: - # The branches below must be a subset of the branches above - types: [ opened, synchronize, reopened ] - paths: - - "**.cpp" - - "**.h" - - "**.hpp" - - "**.py" - - cmake/** - - src/** - - CMakeLists.txt - - conanfile.py - - ".github/workflows/ci.yml" - - "deploy/flatpak.yaml" - - "snap/snapcraft.yaml" - - workflow_dispatch: - - -env: - # Target - TARGET_NAME: jmbde - PROJECT_NAME: jmbde-QT - # Conan cache environment variables - CONAN_SYSREQUIRES_MODE: enabled - CONAN_USER_HOME: "${{ github.workspace }}/conan-cache" - CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short" - CLANG_TIDY_VERSION: "13.0.0" - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - QT_VERSION: "6.4.1" - QT_TARGET: "desktop" - -jobs: - # format - clang-format: - name: "๐Ÿ’Ž CLang-Format" - runs-on: ubuntu-latest - steps: - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: "๐ŸŸจ Use clang-format" - uses: DoozyX/clang-format-lint-action@v0.17 - with: - source: "." - exclude: "./third_party ./external" - extensions: "c,h,cpp,hpp" - clangFormatVersion: 14 - inplace: true - - - uses: EndBug/add-and-commit@v9 - with: - author_name: Clang Robot - author_email: robot@example.com - message: ":art: Committing clang-format changes" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - cmake-format: - name: "๐Ÿ’Ž CMake-Format" - runs-on: ubuntu-latest - steps: - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper - # list of changed files within `super-linter` - fetch-depth: 0 - - - name: "๐ŸŸจ Setup Python" - uses: actions/setup-python@v5 - with: - # Read python version from a file .python-version - python-version-file: ".python-version" - # check-latest: true - cache: pip - - - name: "๐ŸŸจ Install cmakelang" - uses: BSFishy/pip-action@v1 - with: - packages: cmakelang pyyaml jinja2 - - - name: "๐ŸŸจ Use cmake-format" - run: find . \( -name '*.cmake' -o -name 'CMakeLists.txt' \) -exec cmake-format -i {} \; - - - name: "๐Ÿ“จ Use Commit" - uses: EndBug/add-and-commit@v9 - with: - author_name: github_actions - message: ":art: Committing format changes" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # lint: - - # tests: - tests: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - - # Recommendations: - # * support at least 2 operating systems - # * support at least 2 compilers - # * make sure all supported configurations for your project are built - # - # Disable/enable builds in this list to meet the above recommendations - # and your own projects needs - matrix: - os: [ ubuntu-latest, ubuntu-22.04 ] - generator: - - "Ninja" - build_type: - - Debug - qt_version: [ 5.15.2, 6.4.0 ] - - permissions: - actions: read - contents: read - security-events: write - - steps: - - name: "Cancel Previous Runs" - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: "โš™๏ธ Install Python" - id: python - uses: actions/setup-python@v5 - with: - # Read python version from a file .python-version - python-version-file: ".python-version" - # check-latest: true - cache: pip - - - name: "'โš™๏ธ Install Python dependencies" - shell: bash - id: python-deps - run: | - python -m pip install --upgrade pip - pip3 install "conan<2" - - - name: "๐Ÿง โš™๏ธ Install Linux dependencies" - if: runner.os == 'Linux' - run: | - sudo apt-get update && DEBIAN_FRONTEND=--noninteractive \ - sudo apt-get --no-install-recommends --assume-yes install \ - libclang-dev \ - ninja-build \ - gcovr \ - ccache \ - cppcheck \ - googletest - echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV - echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV - echo "CXX=g++-10" >> $GITHUB_ENV - echo "CC=gcc-10" >> $GITHUB_ENV - - - name: Configure Conan - shell: bash - run: | - echo "Setup conan" - conan user - conan config init - conan profile show default - - - name: "๐Ÿ”ง Setup Cache" - uses: ./.github/actions/setup_cache - with: - build_type: ${{ matrix.build_type }} - generator: ${{ matrix.generator }} - - - name: "โš™๏ธ Install Qt Version ${{ matrix.qt_version }}" - uses: jurplel/install-qt-action@v4 - with: - version: "${{ matrix.qt_version }}" - dir: "${{ env.QT_DIR }}" - # host: ${{ runner.os }} - arch: "${{ env.QT_ARCH }}" - target: "${{ env.QT_TARGET }}" - tools: "${{ env.QT_TOOLS }}" - setup-python: "true" - cache: "true" - cache-key-prefix: "${{ runner.os }}-install-qt-action" - set-env: "true" - install-deps: "true" - - uses: hendrikmuhs/ccache-action@v1 - if: runner.os == 'Linux' - with: - key: ${{ matrix.os }}-${{ matrix.build_type }} - max-size: 50M - - - name: restore ccache - uses: pat-s/always-upload-cache@v3.0.11 - with: - path: ${{runner.workspace}}/ccache - key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}-${{ github.sha }} - restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}} - - - name: check ccache stats prior to build - run: ccache --zero-stats --show-stats - - - name: "Cleanup Conan system packages (they are not properly cached)" - run: | - conan remove -f '*/system' - - - name: "Add GCC problem matcher" - uses: ammaraskar/gcc-problem-matcher@master - - - name: "Create Build Environment" - # Some projects don't allow in-source building, so create a separate build directory - # We'll use this as our working directory for all subsequent commands - run: cmake -E make_directory build - # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage - # has meaningful results - - name: "Configure CMake" - working-directory: build - shell: bash - run: | - mkdir -pv usr - cmake -S .. -B . -G "${{matrix.generator}}" \ - -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ - -DCMAKE_INSTALL_PREFIX:PATH="./usr" \ - -DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} \ - -DBUILD_TESTING:BOOL=${{ matrix.build_type == 'Debug' }} \ - -DENABLE_CACHE="ON" - - - name: "๐Ÿšง Build" - # Execute the build. You can specify a specific target with "--target " - run: | - cmake --build ./build --config ${{matrix.build_type}} - - - name: check ccache stats prior to build - run: ccache --zero-stats --show-stats - - - name: "๐Ÿง ๐Ÿงช Test and coverage" - working-directory: build - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: | - ctest -C ${{matrix.build_type}} - gcovr -j ${{env.nproc}} --delete --root ../ --print-summary --xml-pretty --xml coverage.xml - - - name: "Publish to codecov" - uses: codecov/codecov-action@v3 - with: - flags: ${{ runner.os }} - name: ${{ runner.os }}-coverage - files: ./build/coverage.xml - - build: - # if: startsWith(github.event.ref, 'refs/tags/') - name: "Build for ${{ matrix.name }}" - - runs-on: ${{ matrix.os }} - needs: tests - - strategy: - fail-fast: false - matrix: - name: - [ - ubuntu-latest-clang++, - macos-latest-clang++, - windows-latest-cl.exe - ] - include: - - name: ubuntu-latest-clang++ - os: ubuntu-latest - build_type: Release - qt_arch: gcc_64 - compiler: clang++-14 - ccompiler: clang-14 - clang-tidy: "" - generators: Ninja - - name: windows-latest-cl.exe - os: windows-latest - build_type: Release - qt_arch: win64_msvc2019_64 - arch: x64 - pak_arch: win64 - compiler: cl.exe - ccompiler: cl.exe - clang-tidy: "" - generators: Ninja - - name: macos-latest-clang++ - os: macos-latest - build_type: Release - qt_arch: clang_64 - arch: clang_64 - compiler: clang++ - ccompiler: clang - generators: Ninja - - env: - CXX: ${{ matrix.compiler }} - CC: ${{ matrix.ccompiler }} - - permissions: - actions: read - contents: read - security-events: write - - steps: - - name: "โš™๏ธ Get the version" - id: get_version - shell: bash - run: | - echo ::set-output name=VERSION::"$(echo $GITHUB_REF | cut -d / -f 3)" - - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: "โš™๏ธ Install Python" - id: python - uses: actions/setup-python@v5 - with: - # Read python version from a file .python-version - python-version-file: ".python-version" - # check-latest: true - cache: pip - - - name: "โš™๏ธ Install Python dependencies" - shell: bash - id: python-deps - run: | - python -m pip install --upgrade pip - pip3 install "conan<2" - - - name: "๐Ÿ”ง Setup Cache" - uses: ./.github/actions/setup_cache - with: - build_type: ${{ matrix.build_type }} - generator: ${{ matrix.generator }} - - - name: "๐Ÿง โš™๏ธ Install Linux dependencies" - if: runner.os == 'Linux' - run: | - sudo apt-get update && DEBIAN_FRONTEND=--noninteractive \ - sudo apt-get --no-install-recommends --assume-yes install \ - libclang-dev \ - ninja-build \ - ccache - echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV - echo "CXX=clang++-12" >> $GITHUB_ENV - echo "CC=clang-12" >> $GITHUB_ENV - - - name: "โš™๏ธ ๐ŸŽ Install macos dependencies" - if: runner.os == 'macOS' - env: - HOMEBREW_NO_ANALYTICS: "ON" - HOMEBREW_NO_AUTO_UPDATE: "ON" - HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON" - HOMEBREW_NO_INSTALL_CLEANUP: "ON" - run: | - brew install ninja ccache pkg-config - echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH - echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV - # Use latest available XCode - sudo xcode-select -s "/Applications/Xcode_13.2.1.app" - echo "DEVELOPER_DIR=/Applications/Xcode_13.2.1.app/Contents/Developer" >> $GITHUB_ENV - - - name: "๐ŸงŠ โš™๏ธ Install Windows dependencies" - if: runner.os == 'Windows' - run: | - cinst ninja ccache - - - name: "๐ŸงŠ โš™๏ธ Configure MSVC" - if: runner.os == 'Windows' - uses: ilammy/msvc-dev-cmd@v1.13.0 - with: - # 14.1 is for vs2017, 14.2 is vs2019, following the upstream vcpkg build from Qv2ray-deps repo - toolset: 14.2 - arch: ${{ matrix.confg.pak_arch }} - - - name: Configure Conan - shell: bash - run: | - echo "Setup conan" - conan user - conan config init - conan profile show default - - - name: (Linux/macOS) restore ccache - if: runner.os == 'Linux' || runner.os == 'macOS' - uses: pat-s/always-upload-cache@v3.0.11 - with: - path: ${{runner.workspace}}/ccache - key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}-${{ github.sha }} - restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}} - - - name: (Linux/macOS) check ccache stats prior to build - if: runner.os == 'Linux' || runner.os == 'macOS' - run: ccache --zero-stats --show-stats - - - name: "Add GCC problem matcher" - if: runner.os == 'Linux' - uses: ammaraskar/gcc-problem-matcher@master - - - name: "โš™๏ธ Install Qt Version ${{ env.QT_VERSION }}" - uses: jurplel/install-qt-action@v4 - with: - version: ${{ env.QT_VERSION }} - # host: ${{ runner.os }} - target: ${{ env.QT_TARGET }} - arch: ${{ matrix.config.qt_arch }} - dir: "${{ github.workspace }}/build/" - install-deps: "true" - # modules: 'qtcharts qtwebengine' - cached: "${{ steps.cache-qt.outputs.cache-hit }}" - setup-python: "true" - # tools: "tools_ifw" - set-env: "true" - - - name: "Cleanup Conan system packages (they are not properly cached)" - run: | - conan remove -f '*/system' - - - name: "Create Build Environment" - # Some projects don't allow in-source building, so create a separate build directory - # We'll use this as our working directory for all subsequent commands - run: cmake -E make_directory build - - # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage - # has meaningful results - - name: "โš™๏ธ ๐ŸงŠ Configure CMake" - if: runner.os == 'Windows' - working-directory: build - shell: pwsh - run: | - cmake ` - -S .. -B . ` - -G "${{matrix.generators}}" ` - -DCMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} ` - -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/install" ` - -DBUILD_SHARED_LIBS:BOOL="TRUE" - # -G "Visual Studio 16 2019" -A "x64" ` - # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage - # has meaningful results. - - - name: "โš™๏ธ ๐Ÿง Configure CMake" - if: runner.os == 'Linux' - working-directory: build - shell: bash - run: |+ - cmake -S .. -B . -G "${{matrix.generator}}" \ - -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ - -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/AppDir/usr" \ - -DBUILD_SHARED_LIBS:BOOL="TRUE" \ - -DENABLE_CACHE="ON" - - - name: "โš™๏ธ ๐ŸŽ Configure CMake" - working-directory: build - shell: bash - if: runner.os == 'macOS' - run: |+ - cmake -S .. -B . -G "${{matrix.generator}}" \ - -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ - -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/install" \ - -DBUILD_SHARED_LIBS:BOOL="TRUE" \ - -DENABLE_CACHE="ON" - - # TODO: Stored in install. Build DMG with CPack - - name: "๐Ÿ“ฆ ๐ŸŽ Build and package application (macdeployqt and zipfile)" - working-directory: build - if: runner.os == 'macOS' - run: | - cmake --build . --config ${{matrix.build_type}} - cpack -C "${{matrix.build_type}}" -G "DragNDrop;ZIP" - - # TODO: Stored in install. Build installer with CPack - - name: "โš™๏ธ ๐ŸงŠ Build" - if: runner.os == 'Windows' - working-directory: build - run: | - cmake --build . --config ${{matrix.build_type}} - cpack -C "${{matrix.build_type}}" -G "WIX;ZIP" - - - name: "โš™๏ธ ๐Ÿง Build" - if: runner.os == 'Linux' - working-directory: build - # Execute the build. You can specify a specific target with "--target " - run: | - sudo apt-get -y --no-install-recommends install tree - cmake --build . --config ${{matrix.build_type}} --target install - - - name: "โš™๏ธ ๐Ÿง Install go-appimage tool" - if: runner.os == 'Linux' - # Will not use linuxdeployqt anymore, because it suopprts currently still-supported mainstream distribution, - # which is glibc 2.23. For more information, please see https://github.com/probonopd/linuxdeployqt/issues/340. - # Will try new tool https://github.com/probonopd/go-appimage written in golang by probonopd. - run: | - wget $(curl https://api.github.com/repos/probonopd/go-appimage/releases | jq -r '.[] | select(.tag_name == "continuous") | .assets[] | select((.name | endswith("x86_64.AppImage")) and (.name | contains("appimagetool"))) | .browser_download_url') -O appimagetool - chmod +x appimagetool - env: - APPIMAGETOOL_ARCH: x86_64 - - # TODO: Stored in build directory - - name: "๐Ÿง ๐Ÿ“ฆ Create AppImage" - if: runner.os == 'Linux' - shell: bash - run: | - APPIMAGE_DST_PATH="${{github.workspace}}/AppDir" - cd $GITHUB_WORKSPACE - cp $GITHUB_WORKSPACE/assets/icons/icons8-app-symbol-80.png $APPIMAGE_DST_PATH/io.github.jmuelbert.${TARGET_NAME}.png - $GITHUB_WORKSPACE/appimagetool -s deploy ${APPIMAGE_DST_PATH}/usr/share/applications/io.github.jmuelbert.${TARGET_NAME}.desktop - mkdir -p ${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts - if [ -f "${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0" ]; then - rm ${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0 - fi - chmod +x ${APPIMAGE_DST_PATH}/usr/lib64/ld-*.so.* - $GITHUB_WORKSPACE/appimagetool ${APPIMAGE_DST_PATH} - - - name: "๐Ÿง ๐Ÿ“ค Upload Linux artifacts" - if: runner.os == 'Linux' - uses: actions/upload-artifact@v4 - with: - name: AppImage - path: "./*.AppImage*" - - - name: "๐ŸŽ ๐Ÿ“ค Upload macOS artifacts" - if: runner.os == 'macOS' - uses: actions/upload-artifact@v4 - with: - name: macos-artifacts - path: | - build/*.dmg - build/*.zip - - - name: "๐ŸงŠ ๐Ÿ“ค Upload artifact: Windows Installer" - if: runner.os == 'Windows' - uses: actions/upload-artifact@v4 - with: - name: windows-artifacts - path: | - build/*.msi - build/*.zip - - flatpak-build: - name: "๐Ÿง Build flatpak on ubuntu-latest" - runs-on: ubuntu-latest - needs: tests - - permissions: - actions: read - contents: read - security-events: write - - steps: - - name: "โš™๏ธ Get the version" - id: get_version - shell: bash - run: echo ::set-output name=VERSION::"$(echo $GITHUB_REF | cut -d / -f 3)" - - - name: "Cancel Previous Runs" - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: "Setup Flatpak" - run: | - sudo apt-get -y -qq update - sudo apt-get install -y flatpak flatpak-builder - - - name: "Setup Flatpak" - run: | - sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive \ - apt-get --no-install-recommends --assume-yes install \ - flatpak flatpak-builder elfutils - - - name: "Setup Flathub" - run: | - flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - - - name: "๐Ÿ“ฆ Create flatpak" - run: | - mkdir -pv $GITHUB_WORKSPACE/install - BUNDLE="io.github.jmuelbert.${{env.TARGET_NAME}}.flatpak" - MANIFEST_PATH=$GITHUB_WORKSPACE/deploy/flatpak.yaml - RUNTIME_REPO="https://flathub.org/repo/flathub.flatpakrepo" - APP_ID="io.github.jmuelbert.${{env.TARGET_NAME}}" - - flatpak-builder --user --disable-rofiles-fuse --repo=repo --force-clean flatpak_app ${MANIFEST_PATH} --install-deps-from=flathub - flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID} - mv $GITHUB_WORKSPACE/$BUNDLE $GITHUB_WORKSPACE/io.github.jmuelbert.${{env.TARGET_NAME}}_${{ steps.get_version.outputs.VERSION }}.x86_64.flatpak - ls -al - - - name: "๐Ÿ“ค Upload artifact: FlatPak" - uses: actions/upload-artifact@v4 - with: - name: flatpak-artifact - path: | - ./install/*.flatpak - - snap-build: - name: "๐Ÿง Build snap on ubuntu-20.04" - runs-on: ubuntu-20.04 - needs: tests - - steps: - - name: "โš™๏ธ Get the version" - id: get_version - shell: bash - run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) - - - name: "Cancel Previous Runs" - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: "๐Ÿ“ฆ Create snap" - uses: snapcore/action-build@v1 - id: snapcraft - with: - snapcraft-args: --enable-experimental-extensions - - - name: "Rename snap name" - shell: bash - run: | - mv ${{ steps.snapcraft.outputs.snap }} $GITHUB_WORKSPACE/${TARGET_NAME}_${{ steps.get_version.outputs.VERSION }}_amd64.snap - ls - - - name: "๐Ÿง ๐Ÿ“ค Upload artifact: SnapPack" - uses: actions/upload-artifact@v4 - with: - name: snapcraft-artifact - path: | - $GITHUB_WORKSPACE/${{ env.TARGET_NAME}}_*_amd64.snap - - diagram: - name: "Build diagram" - needs: tests - runs-on: ubuntu-latest - - steps: - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@master - - - name: "Update diagram" - uses: githubocto/repo-visualizer@0.9.1 - with: - output_file: "images/diagram.svg" - excluded_paths: "dist,node_modules" - - releaseNotes: - # if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - needs: upload - steps: - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: "Build Releasenotes" - id: github_releasenotes - uses: release-drafter/release-drafter@v5.25.0 - with: - publish: "${{ steps.check-version.outputs.tag != '' }}" - tag: "${{ steps.check-version.outputs.tag }}" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - changeLog: - # if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - needs: upload - steps: - - name: Build Changelog - id: github_release - uses: mikepenz/release-changelog-builder-action@v4 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create Release - uses: mikepenz/action-gh-release@v0.2.0-a03 #softprops/action-gh-release - with: - body: ${{steps.github_release.outputs.changelog}} - - # Upload continous build - upload: - name: "๐Ÿ—‚ Create release and upload artifacts" - needs: - - build - - flatpak-build - - snap-build - - runs-on: ubuntu-latest - steps: - - name: "๐Ÿ“ฅ Download artifacts" - uses: actions/download-artifact@v4 - - name: "๐Ÿ—‚ Inspect directory after downloading artifacts" - run: ls -alFR - - - name: "๐Ÿ“ค Upload Release: AppImage" - if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{runner.workspace}}/${{env.TARGET_NAME}}.appimage - asset_name: ${{env.TARGET_NAME}}.appimage - tag: ${{ github.ref }} - overwrite: true - - - name: "๐Ÿ“ค Upload Release: FlatPak" - if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{runner.workspace}}/${{env.TARGET_NAME}}.flatpak - asset_name: ${{env.TARGET_NAME}}.flatpak - tag: ${{ github.ref }} - overwrite: true - - - name: "๐Ÿ“ค Upload Release: snap" - if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{runner.workspace}}/${{env.TARGET_NAME}}.amd64.snap - asset_name: ${{env.TARGET_NAME}}.amd64.snap - tag: ${{ github.ref }} - overwrite: true - - - name: "๐Ÿ“ค Upload Release: macOS" - if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{runner.workspace}}/${{env.TARGET_NAME}}.dmg - asset_name: ${{env.TARGET_NAME}}.dmg - tag: ${{ github.ref }} - overwrite: true - - - name: "๐Ÿ“ค Upload Release: windows" - if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./${{ env.TARGET_NAME }}.exe - asset_name: ${{ env.TARGET_NAME}}-win.exe - tag: ${{ github.ref }} - overwrite: true - - - name: "๐Ÿ“ค Upload Release: zip for windows" - if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./${{ env.archiveName }}-win.zip - asset_name: ${{ env.TARGET_NAME}}-win-${{ steps.get_version.outputs.VERSION }}.zip - tag: ${{ github.ref }} - overwrite: true +--- +name: "CI: Test, Build and create release" + +# yamllint disable +on: + # yamllint enable + push: + branches: + - main + - develop + tags: + - "[0-9]+.[0-9]+.[0-9]+" + paths: + - "**.cpp" + - "**.h" + - "**.hpp" + - "**.py" + - cmake/** + - src/** + - CMakeLists.txt + - conanfile.py + - ".github/workflows/ci.yml" + - "deploy/flatpak.yaml" + - "snap/snapcraft.yaml" + + pull_request: + # The branches below must be a subset of the branches above + types: [ opened, synchronize, reopened ] + paths: + - "**.cpp" + - "**.h" + - "**.hpp" + - "**.py" + - cmake/** + - src/** + - CMakeLists.txt + - conanfile.py + - ".github/workflows/ci.yml" + - "deploy/flatpak.yaml" + - "snap/snapcraft.yaml" + + workflow_dispatch: + + +env: + # Target + TARGET_NAME: jmbde + PROJECT_NAME: jmbde-QT + # Conan cache environment variables + CONAN_SYSREQUIRES_MODE: enabled + CONAN_USER_HOME: "${{ github.workspace }}/conan-cache" + CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short" + CLANG_TIDY_VERSION: "13.0.0" + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + QT_VERSION: "6.4.1" + QT_TARGET: "desktop" + +jobs: + # format + clang-format: + name: "๐Ÿ’Ž CLang-Format" + runs-on: ubuntu-latest + steps: + - name: "๐Ÿงฐ Checkout" + uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: "๐ŸŸจ Use clang-format" + uses: DoozyX/clang-format-lint-action@v0.17 + with: + source: "." + exclude: "./third_party ./external" + extensions: "c,h,cpp,hpp" + clangFormatVersion: 14 + inplace: true + + - uses: EndBug/add-and-commit@v9 + with: + author_name: Clang Robot + author_email: robot@example.com + message: ":art: Committing clang-format changes" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + cmake-format: + name: "๐Ÿ’Ž CMake-Format" + runs-on: ubuntu-latest + steps: + - name: "๐Ÿงฐ Checkout" + uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper + # list of changed files within `super-linter` + fetch-depth: 0 + + - name: "๐ŸŸจ Setup Python" + uses: actions/setup-python@v5 + with: + # Read python version from a file .python-version + python-version-file: ".python-version" + # check-latest: true + cache: pip + + - name: "๐ŸŸจ Install cmakelang" + uses: BSFishy/pip-action@v1 + with: + packages: cmakelang pyyaml jinja2 + + - name: "๐ŸŸจ Use cmake-format" + run: find . \( -name '*.cmake' -o -name 'CMakeLists.txt' \) -exec cmake-format -i {} \; + + - name: "๐Ÿ“จ Use Commit" + uses: EndBug/add-and-commit@v9 + with: + author_name: github_actions + message: ":art: Committing format changes" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # lint: + + # tests: + tests: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + + # Recommendations: + # * support at least 2 operating systems + # * support at least 2 compilers + # * make sure all supported configurations for your project are built + # + # Disable/enable builds in this list to meet the above recommendations + # and your own projects needs + matrix: + os: [ ubuntu-latest, ubuntu-22.04 ] + generator: + - "Ninja" + build_type: + - Debug + qt_version: [ 5.15.2, 6.4.0 ] + + permissions: + actions: read + contents: read + security-events: write + + steps: + - name: "Cancel Previous Runs" + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: "๐Ÿงฐ Checkout" + uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: "โš™๏ธ Install Python" + id: python + uses: actions/setup-python@v5 + with: + # Read python version from a file .python-version + python-version-file: ".python-version" + # check-latest: true + cache: pip + + - name: "'โš™๏ธ Install Python dependencies" + shell: bash + id: python-deps + run: | + python -m pip install --upgrade pip + pip3 install "conan<2" + + - name: "๐Ÿง โš™๏ธ Install Linux dependencies" + if: runner.os == 'Linux' + run: | + sudo apt-get update && DEBIAN_FRONTEND=--noninteractive \ + sudo apt-get --no-install-recommends --assume-yes install \ + libclang-dev \ + ninja-build \ + gcovr \ + ccache \ + cppcheck \ + googletest + echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV + echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV + echo "CXX=g++-10" >> $GITHUB_ENV + echo "CC=gcc-10" >> $GITHUB_ENV + + - name: Configure Conan + shell: bash + run: | + echo "Setup conan" + conan user + conan config init + conan profile show default + + - name: "๐Ÿ”ง Setup Cache" + uses: ./.github/actions/setup_cache + with: + build_type: ${{ matrix.build_type }} + generator: ${{ matrix.generator }} + + - name: "โš™๏ธ Install Qt Version ${{ matrix.qt_version }}" + uses: jurplel/install-qt-action@v4 + with: + version: "${{ matrix.qt_version }}" + dir: "${{ env.QT_DIR }}" + # host: ${{ runner.os }} + arch: "${{ env.QT_ARCH }}" + target: "${{ env.QT_TARGET }}" + tools: "${{ env.QT_TOOLS }}" + setup-python: "true" + cache: "true" + cache-key-prefix: "${{ runner.os }}-install-qt-action" + set-env: "true" + install-deps: "true" + - uses: hendrikmuhs/ccache-action@v1 + if: runner.os == 'Linux' + with: + key: ${{ matrix.os }}-${{ matrix.build_type }} + max-size: 50M + + - name: restore ccache + uses: pat-s/always-upload-cache@v3.0.11 + with: + path: ${{runner.workspace}}/ccache + key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}-${{ github.sha }} + restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}} + + - name: check ccache stats prior to build + run: ccache --zero-stats --show-stats + + - name: "Cleanup Conan system packages (they are not properly cached)" + run: | + conan remove -f '*/system' + + - name: "Add GCC problem matcher" + uses: ammaraskar/gcc-problem-matcher@master + + - name: "Create Build Environment" + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands + run: cmake -E make_directory build + # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage + # has meaningful results + - name: "Configure CMake" + working-directory: build + shell: bash + run: | + mkdir -pv usr + cmake -S .. -B . -G "${{matrix.generator}}" \ + -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ + -DCMAKE_INSTALL_PREFIX:PATH="./usr" \ + -DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} \ + -DBUILD_TESTING:BOOL=${{ matrix.build_type == 'Debug' }} \ + -DENABLE_CACHE="ON" + + - name: "๐Ÿšง Build" + # Execute the build. You can specify a specific target with "--target " + run: | + cmake --build ./build --config ${{matrix.build_type}} + + - name: check ccache stats prior to build + run: ccache --zero-stats --show-stats + + - name: "๐Ÿง ๐Ÿงช Test and coverage" + working-directory: build + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: | + ctest -C ${{matrix.build_type}} + gcovr -j ${{env.nproc}} --delete --root ../ --print-summary --xml-pretty --xml coverage.xml + + - name: "Publish to codecov" + uses: codecov/codecov-action@v3 + with: + flags: ${{ runner.os }} + name: ${{ runner.os }}-coverage + files: ./build/coverage.xml + + build: + # if: startsWith(github.event.ref, 'refs/tags/') + name: "Build for ${{ matrix.name }}" + + runs-on: ${{ matrix.os }} + needs: tests + + strategy: + fail-fast: false + matrix: + name: + [ + ubuntu-latest-clang++, + macos-latest-clang++, + windows-latest-cl.exe + ] + include: + - name: ubuntu-latest-clang++ + os: ubuntu-latest + build_type: Release + qt_arch: gcc_64 + compiler: clang++-14 + ccompiler: clang-14 + clang-tidy: "" + generators: Ninja + - name: windows-latest-cl.exe + os: windows-latest + build_type: Release + qt_arch: win64_msvc2019_64 + arch: x64 + pak_arch: win64 + compiler: cl.exe + ccompiler: cl.exe + clang-tidy: "" + generators: Ninja + - name: macos-latest-clang++ + os: macos-latest + build_type: Release + qt_arch: clang_64 + arch: clang_64 + compiler: clang++ + ccompiler: clang + generators: Ninja + + env: + CXX: ${{ matrix.compiler }} + CC: ${{ matrix.ccompiler }} + + permissions: + actions: read + contents: read + security-events: write + + steps: + - name: "โš™๏ธ Get the version" + id: get_version + shell: bash + run: | + echo ::set-output name=VERSION::"$(echo $GITHUB_REF | cut -d / -f 3)" + + - name: "๐Ÿงฐ Checkout" + uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: "โš™๏ธ Install Python" + id: python + uses: actions/setup-python@v5 + with: + # Read python version from a file .python-version + python-version-file: ".python-version" + # check-latest: true + cache: pip + + - name: "โš™๏ธ Install Python dependencies" + shell: bash + id: python-deps + run: | + python -m pip install --upgrade pip + pip3 install "conan<2" + + - name: "๐Ÿ”ง Setup Cache" + uses: ./.github/actions/setup_cache + with: + build_type: ${{ matrix.build_type }} + generator: ${{ matrix.generator }} + + - name: "๐Ÿง โš™๏ธ Install Linux dependencies" + if: runner.os == 'Linux' + run: | + sudo apt-get update && DEBIAN_FRONTEND=--noninteractive \ + sudo apt-get --no-install-recommends --assume-yes install \ + libclang-dev \ + ninja-build \ + ccache + echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV + echo "CXX=clang++-12" >> $GITHUB_ENV + echo "CC=clang-12" >> $GITHUB_ENV + + - name: "โš™๏ธ ๐ŸŽ Install macos dependencies" + if: runner.os == 'macOS' + env: + HOMEBREW_NO_ANALYTICS: "ON" + HOMEBREW_NO_AUTO_UPDATE: "ON" + HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON" + HOMEBREW_NO_INSTALL_CLEANUP: "ON" + run: | + brew install ninja ccache pkg-config + echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH + echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV + # Use latest available XCode + sudo xcode-select -s "/Applications/Xcode_13.2.1.app" + echo "DEVELOPER_DIR=/Applications/Xcode_13.2.1.app/Contents/Developer" >> $GITHUB_ENV + + - name: "๐ŸงŠ โš™๏ธ Install Windows dependencies" + if: runner.os == 'Windows' + run: | + cinst ninja ccache + + - name: "๐ŸงŠ โš™๏ธ Configure MSVC" + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1.13.0 + with: + # 14.1 is for vs2017, 14.2 is vs2019, following the upstream vcpkg build from Qv2ray-deps repo + toolset: 14.2 + arch: ${{ matrix.confg.pak_arch }} + + - name: Configure Conan + shell: bash + run: | + echo "Setup conan" + conan user + conan config init + conan profile show default + + - name: (Linux/macOS) restore ccache + if: runner.os == 'Linux' || runner.os == 'macOS' + uses: pat-s/always-upload-cache@v3.0.11 + with: + path: ${{runner.workspace}}/ccache + key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}-${{ github.sha }} + restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}} + + - name: (Linux/macOS) check ccache stats prior to build + if: runner.os == 'Linux' || runner.os == 'macOS' + run: ccache --zero-stats --show-stats + + - name: "Add GCC problem matcher" + if: runner.os == 'Linux' + uses: ammaraskar/gcc-problem-matcher@master + + - name: "โš™๏ธ Install Qt Version ${{ env.QT_VERSION }}" + uses: jurplel/install-qt-action@v4 + with: + version: ${{ env.QT_VERSION }} + # host: ${{ runner.os }} + target: ${{ env.QT_TARGET }} + arch: ${{ matrix.config.qt_arch }} + dir: "${{ github.workspace }}/build/" + install-deps: "true" + # modules: 'qtcharts qtwebengine' + cached: "${{ steps.cache-qt.outputs.cache-hit }}" + setup-python: "true" + # tools: "tools_ifw" + set-env: "true" + + - name: "Cleanup Conan system packages (they are not properly cached)" + run: | + conan remove -f '*/system' + + - name: "Create Build Environment" + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands + run: cmake -E make_directory build + + # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage + # has meaningful results + - name: "โš™๏ธ ๐ŸงŠ Configure CMake" + if: runner.os == 'Windows' + working-directory: build + shell: pwsh + run: | + cmake ` + -S .. -B . ` + -G "${{matrix.generators}}" ` + -DCMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} ` + -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/install" ` + -DBUILD_SHARED_LIBS:BOOL="TRUE" + # -G "Visual Studio 16 2019" -A "x64" ` + # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage + # has meaningful results. + + - name: "โš™๏ธ ๐Ÿง Configure CMake" + if: runner.os == 'Linux' + working-directory: build + shell: bash + run: |+ + cmake -S .. -B . -G "${{matrix.generator}}" \ + -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ + -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/AppDir/usr" \ + -DBUILD_SHARED_LIBS:BOOL="TRUE" \ + -DENABLE_CACHE="ON" + + - name: "โš™๏ธ ๐ŸŽ Configure CMake" + working-directory: build + shell: bash + if: runner.os == 'macOS' + run: |+ + cmake -S .. -B . -G "${{matrix.generator}}" \ + -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ + -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/install" \ + -DBUILD_SHARED_LIBS:BOOL="TRUE" \ + -DENABLE_CACHE="ON" + + # TODO: Stored in install. Build DMG with CPack + - name: "๐Ÿ“ฆ ๐ŸŽ Build and package application (macdeployqt and zipfile)" + working-directory: build + if: runner.os == 'macOS' + run: | + cmake --build . --config ${{matrix.build_type}} + cpack -C "${{matrix.build_type}}" -G "DragNDrop;ZIP" + + # TODO: Stored in install. Build installer with CPack + - name: "โš™๏ธ ๐ŸงŠ Build" + if: runner.os == 'Windows' + working-directory: build + run: | + cmake --build . --config ${{matrix.build_type}} + cpack -C "${{matrix.build_type}}" -G "WIX;ZIP" + + - name: "โš™๏ธ ๐Ÿง Build" + if: runner.os == 'Linux' + working-directory: build + # Execute the build. You can specify a specific target with "--target " + run: | + sudo apt-get -y --no-install-recommends install tree + cmake --build . --config ${{matrix.build_type}} --target install + + - name: "โš™๏ธ ๐Ÿง Install go-appimage tool" + if: runner.os == 'Linux' + # Will not use linuxdeployqt anymore, because it suopprts currently still-supported mainstream distribution, + # which is glibc 2.23. For more information, please see https://github.com/probonopd/linuxdeployqt/issues/340. + # Will try new tool https://github.com/probonopd/go-appimage written in golang by probonopd. + run: | + wget $(curl https://api.github.com/repos/probonopd/go-appimage/releases | jq -r '.[] | select(.tag_name == "continuous") | .assets[] | select((.name | endswith("x86_64.AppImage")) and (.name | contains("appimagetool"))) | .browser_download_url') -O appimagetool + chmod +x appimagetool + env: + APPIMAGETOOL_ARCH: x86_64 + + # TODO: Stored in build directory + - name: "๐Ÿง ๐Ÿ“ฆ Create AppImage" + if: runner.os == 'Linux' + shell: bash + run: | + APPIMAGE_DST_PATH="${{github.workspace}}/AppDir" + cd $GITHUB_WORKSPACE + cp $GITHUB_WORKSPACE/assets/icons/icons8-app-symbol-80.png $APPIMAGE_DST_PATH/io.github.jmuelbert.${TARGET_NAME}.png + $GITHUB_WORKSPACE/appimagetool -s deploy ${APPIMAGE_DST_PATH}/usr/share/applications/io.github.jmuelbert.${TARGET_NAME}.desktop + mkdir -p ${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts + if [ -f "${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0" ]; then + rm ${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0 + fi + chmod +x ${APPIMAGE_DST_PATH}/usr/lib64/ld-*.so.* + $GITHUB_WORKSPACE/appimagetool ${APPIMAGE_DST_PATH} + + - name: "๐Ÿง ๐Ÿ“ค Upload Linux artifacts" + if: runner.os == 'Linux' + uses: actions/upload-artifact@v4 + with: + name: AppImage + path: "./*.AppImage*" + + - name: "๐ŸŽ ๐Ÿ“ค Upload macOS artifacts" + if: runner.os == 'macOS' + uses: actions/upload-artifact@v4 + with: + name: macos-artifacts + path: | + build/*.dmg + build/*.zip + + - name: "๐ŸงŠ ๐Ÿ“ค Upload artifact: Windows Installer" + if: runner.os == 'Windows' + uses: actions/upload-artifact@v4 + with: + name: windows-artifacts + path: | + build/*.msi + build/*.zip + + flatpak-build: + name: "๐Ÿง Build flatpak on ubuntu-latest" + runs-on: ubuntu-latest + needs: tests + + permissions: + actions: read + contents: read + security-events: write + + steps: + - name: "โš™๏ธ Get the version" + id: get_version + shell: bash + run: echo ::set-output name=VERSION::"$(echo $GITHUB_REF | cut -d / -f 3)" + + - name: "Cancel Previous Runs" + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: "๐Ÿงฐ Checkout" + uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: "Setup Flatpak" + run: | + sudo apt-get -y -qq update + sudo apt-get install -y flatpak flatpak-builder + + - name: "Setup Flatpak" + run: | + sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive \ + apt-get --no-install-recommends --assume-yes install \ + flatpak flatpak-builder elfutils + + - name: "Setup Flathub" + run: | + flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + + - name: "๐Ÿ“ฆ Create flatpak" + run: | + mkdir -pv $GITHUB_WORKSPACE/install + BUNDLE="io.github.jmuelbert.${{env.TARGET_NAME}}.flatpak" + MANIFEST_PATH=$GITHUB_WORKSPACE/deploy/flatpak.yaml + RUNTIME_REPO="https://flathub.org/repo/flathub.flatpakrepo" + APP_ID="io.github.jmuelbert.${{env.TARGET_NAME}}" + + flatpak-builder --user --disable-rofiles-fuse --repo=repo --force-clean flatpak_app ${MANIFEST_PATH} --install-deps-from=flathub + flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID} + mv $GITHUB_WORKSPACE/$BUNDLE $GITHUB_WORKSPACE/io.github.jmuelbert.${{env.TARGET_NAME}}_${{ steps.get_version.outputs.VERSION }}.x86_64.flatpak + ls -al + + - name: "๐Ÿ“ค Upload artifact: FlatPak" + uses: actions/upload-artifact@v4 + with: + name: flatpak-artifact + path: | + ./install/*.flatpak + + snap-build: + name: "๐Ÿง Build snap on ubuntu-20.04" + runs-on: ubuntu-20.04 + needs: tests + + steps: + - name: "โš™๏ธ Get the version" + id: get_version + shell: bash + run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) + + - name: "Cancel Previous Runs" + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: "๐Ÿงฐ Checkout" + uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: "๐Ÿ“ฆ Create snap" + uses: snapcore/action-build@v1 + id: snapcraft + with: + snapcraft-args: --enable-experimental-extensions + + - name: "Rename snap name" + shell: bash + run: | + mv ${{ steps.snapcraft.outputs.snap }} $GITHUB_WORKSPACE/${TARGET_NAME}_${{ steps.get_version.outputs.VERSION }}_amd64.snap + ls + + - name: "๐Ÿง ๐Ÿ“ค Upload artifact: SnapPack" + uses: actions/upload-artifact@v4 + with: + name: snapcraft-artifact + path: | + $GITHUB_WORKSPACE/${{ env.TARGET_NAME}}_*_amd64.snap + + diagram: + name: "Build diagram" + needs: tests + runs-on: ubuntu-latest + + steps: + - name: "๐Ÿงฐ Checkout" + uses: actions/checkout@master + + - name: "Update diagram" + uses: githubocto/repo-visualizer@0.9.1 + with: + output_file: "images/diagram.svg" + excluded_paths: "dist,node_modules" + + releaseNotes: + # if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + needs: upload + steps: + - name: "๐Ÿงฐ Checkout" + uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: "Build Releasenotes" + id: github_releasenotes + uses: release-drafter/release-drafter@v5.25.0 + with: + publish: "${{ steps.check-version.outputs.tag != '' }}" + tag: "${{ steps.check-version.outputs.tag }}" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + changeLog: + # if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + needs: upload + steps: + - name: Build Changelog + id: github_release + uses: mikepenz/release-changelog-builder-action@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create Release + uses: mikepenz/action-gh-release@v0.2.0-a03 #softprops/action-gh-release + with: + body: ${{steps.github_release.outputs.changelog}} + + # Upload continous build + upload: + name: "๐Ÿ—‚ Create release and upload artifacts" + needs: + - build + - flatpak-build + - snap-build + + runs-on: ubuntu-latest + steps: + - name: "๐Ÿ“ฅ Download artifacts" + uses: actions/download-artifact@v4 + - name: "๐Ÿ—‚ Inspect directory after downloading artifacts" + run: ls -alFR + + - name: "๐Ÿ“ค Upload Release: AppImage" + if: startsWith(github.event.ref, 'refs/tags/') + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{runner.workspace}}/${{env.TARGET_NAME}}.appimage + asset_name: ${{env.TARGET_NAME}}.appimage + tag: ${{ github.ref }} + overwrite: true + + - name: "๐Ÿ“ค Upload Release: FlatPak" + if: startsWith(github.event.ref, 'refs/tags/') + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{runner.workspace}}/${{env.TARGET_NAME}}.flatpak + asset_name: ${{env.TARGET_NAME}}.flatpak + tag: ${{ github.ref }} + overwrite: true + + - name: "๐Ÿ“ค Upload Release: snap" + if: startsWith(github.event.ref, 'refs/tags/') + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{runner.workspace}}/${{env.TARGET_NAME}}.amd64.snap + asset_name: ${{env.TARGET_NAME}}.amd64.snap + tag: ${{ github.ref }} + overwrite: true + + - name: "๐Ÿ“ค Upload Release: macOS" + if: startsWith(github.event.ref, 'refs/tags/') + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{runner.workspace}}/${{env.TARGET_NAME}}.dmg + asset_name: ${{env.TARGET_NAME}}.dmg + tag: ${{ github.ref }} + overwrite: true + + - name: "๐Ÿ“ค Upload Release: windows" + if: startsWith(github.event.ref, 'refs/tags/') + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./${{ env.TARGET_NAME }}.exe + asset_name: ${{ env.TARGET_NAME}}-win.exe + tag: ${{ github.ref }} + overwrite: true + + - name: "๐Ÿ“ค Upload Release: zip for windows" + if: startsWith(github.event.ref, 'refs/tags/') + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./${{ env.archiveName }}-win.zip + asset_name: ${{ env.TARGET_NAME}}-win-${{ steps.get_version.outputs.VERSION }}.zip + tag: ${{ github.ref }} + overwrite: true From da12b37c0eec2740cdb36877e40f34fecb5f4cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Thu, 31 Oct 2024 11:54:02 +0100 Subject: [PATCH 02/32] fix issiues on ci.yml workflow --- .devcontainer/docker-compose.yml | 8 +- .github/ISSUE_TEMPLATE/01-bug-report.yml | 6 +- .github/ISSUE_TEMPLATE/02-feature-request.yml | 6 + .github/ISSUE_TEMPLATE/config.yml | 19 - .github/workflows/ci.yml | 563 ++++++++---------- .github/workflows/cmake-requirements.txt | 3 + .github/workflows/codacy-analysis.yml | 4 +- .github/workflows/conan-requirements.txt | 1 + .github/workflows/pages-astro.yml | 10 +- .github/workflows/pages.yml | 55 -- .github/workflows/styles.yml | 2 +- packaging/flatpak/org.jmuelbert.jmbde-QT.yml | 3 +- 12 files changed, 261 insertions(+), 419 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/workflows/cmake-requirements.txt create mode 100644 .github/workflows/conan-requirements.txt delete mode 100644 .github/workflows/pages.yml diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index e83fe4551..c31b7b982 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -3,11 +3,11 @@ services: web: build: . ports: - - '8000:80' + - 8000:80 depends_on: - db db: - image: 'microsoft/mssql-server-linux' + image: microsoft/mssql-server-linux environment: - SA_PASSWORD: 'Your_password123' - ACCEPT_EULA: 'Y' + SA_PASSWORD: Your_password123 + ACCEPT_EULA: Y diff --git a/.github/ISSUE_TEMPLATE/01-bug-report.yml b/.github/ISSUE_TEMPLATE/01-bug-report.yml index 600b31cfe..b802207b6 100644 --- a/.github/ISSUE_TEMPLATE/01-bug-report.yml +++ b/.github/ISSUE_TEMPLATE/01-bug-report.yml @@ -1,7 +1,7 @@ -name: "Bug Report" +name: Bug Report description: Report an issue or possible bug title: "[Bug]: " -labels: ["bug", "triage"] +labels: [bug, triage] assignees: - jmuelbert body: @@ -19,7 +19,7 @@ body: validations: required: true - type: input - id: Qt Version + id: qt-Version attributes: label: What version of `Qt` are you using? placeholder: 6.5.2 diff --git a/.github/ISSUE_TEMPLATE/02-feature-request.yml b/.github/ISSUE_TEMPLATE/02-feature-request.yml index b7542d300..8490d0072 100644 --- a/.github/ISSUE_TEMPLATE/02-feature-request.yml +++ b/.github/ISSUE_TEMPLATE/02-feature-request.yml @@ -1,3 +1,9 @@ +name: Featuri Request +description: Request for a missing or a new Feature. +title: "[Request]: " +labels: [request] +assignees: + - jmuelbert body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index dc4e9d816..000000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -blank_issues_enabled: false -contact_links: - - name: ๐Ÿ’ก Feature Request - url: https://github.com/jmuelbert/jmbde-QT/discussions/new?category=feature-requests - about: Suggest an improvement youโ€™d like to see added to jmbde-QT - - name: FAQ - url: https://github.com/jmuelbert/jmbde-QT/wiki/FAQ - about: You may find your question and the answer to it here. - - name: Documentation - url: https://jmuelbert.github.io/jmbde-QT/ - about: The documentation tells you how to use jmbde. - - name: GitHub Community Support - url: https://github.com/orgs/community/discussions - about: Please ask and answer questions here. - - name: GitHub Security Bug Bounty - url: https://bounty.github.com/ - about: Please report security vulnerabilities here. - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af0bd382a..22f831ee7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,4 @@ ---- name: "CI: Test, Build and create release" - # yamllint disable on: # yamllint enable @@ -19,13 +17,12 @@ on: - src/** - CMakeLists.txt - conanfile.py - - ".github/workflows/ci.yml" - - "deploy/flatpak.yaml" - - "snap/snapcraft.yaml" - + - .github/workflows/ci.yml + - packaging/flatpak/org.jmuelbert.jmbde-QT.yaml + - snap/snapcraft.yaml pull_request: # The branches below must be a subset of the branches above - types: [ opened, synchronize, reopened ] + types: [opened, synchronize, reopened] paths: - "**.cpp" - "**.h" @@ -35,85 +32,93 @@ on: - src/** - CMakeLists.txt - conanfile.py - - ".github/workflows/ci.yml" - - "deploy/flatpak.yaml" - - "snap/snapcraft.yaml" - + - .github/workflows/ci.yml + - packaging/flatpak/org.jmuelbert.jmbde-QT.yaml + - snap/snapcraft.yaml workflow_dispatch: - - env: # Target TARGET_NAME: jmbde PROJECT_NAME: jmbde-QT # Conan cache environment variables + CONAN_SYSREQUIRES_MODE: enabled CONAN_USER_HOME: "${{ github.workspace }}/conan-cache" CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short" - CLANG_TIDY_VERSION: "13.0.0" + CLANG_TIDY_VERSION: 13.0.0 # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - QT_VERSION: "6.4.1" - QT_TARGET: "desktop" + BUILD_TYPE: Release + QT_VERSION: 6.7.2 + QT_TARGET: desktop +permissions: + contents: read +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true jobs: # format clang-format: - name: "๐Ÿ’Ž CLang-Format" + # Skip any PR created by dependabot to avoid permission issues: + if: (github.actor != 'dependabot[bot]') + name: ๐Ÿ’Ž CLang-Format runs-on: ubuntu-latest + permissions: + contents: write steps: - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@v4 + # Checkout the repository to the GitHub Actions runner + - name: ๐Ÿงฐ Checkout Source Code + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 - - - name: "๐ŸŸจ Use clang-format" - uses: DoozyX/clang-format-lint-action@v0.17 + - name: ๐ŸŸจ Use clang-format + uses: DoozyX/clang-format-lint-action@c71d0bf4e21876ebec3e5647491186f8797fde31 # v0.18.2 with: - source: "." - exclude: "./third_party ./external" - extensions: "c,h,cpp,hpp" + source: . + exclude: ./third_party ./external + extensions: c,h,cpp,hpp clangFormatVersion: 14 inplace: true - - - uses: EndBug/add-and-commit@v9 + - name: Add and commit + uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.4.1 with: author_name: Clang Robot author_email: robot@example.com message: ":art: Committing clang-format changes" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - cmake-format: - name: "๐Ÿ’Ž CMake-Format" + # Skip any PR created by dependabot to avoid permission issues: + if: (github.actor != 'dependabot[bot]') + name: ๐Ÿ’Ž CMake-Format runs-on: ubuntu-latest + permissions: + contents: write steps: - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@v4 + # Checkout the repository to the GitHub Actions runner + - name: ๐Ÿงฐ Checkout Source Code + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: # Full git history is needed to get a proper # list of changed files within `super-linter` fetch-depth: 0 - - - name: "๐ŸŸจ Setup Python" - uses: actions/setup-python@v5 + - name: ๐ŸŸจ Setup Python + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: # Read python version from a file .python-version - python-version-file: ".python-version" + python-version-file: .python-version # check-latest: true - cache: pip - - name: "๐ŸŸจ Install cmakelang" - uses: BSFishy/pip-action@v1 - with: - packages: cmakelang pyyaml jinja2 - - - name: "๐ŸŸจ Use cmake-format" + cache: pip + - name: ๐ŸŸจ Install cmakelang + run: | + python -m pip install --upgrade pip + pip3 install -r ./cmake-requirements.txt + - name: ๐ŸŸจ Use cmake-format run: find . \( -name '*.cmake' -o -name 'CMakeLists.txt' \) -exec cmake-format -i {} \; - - - name: "๐Ÿ“จ Use Commit" - uses: EndBug/add-and-commit@v9 + - name: ๐Ÿ“จ Use Commit + uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.4.1 with: author_name: github_actions message: ":art: Committing format changes" @@ -123,11 +128,13 @@ jobs: # tests: tests: + # Skip any PR created by dependabot to avoid permission issues: + if: (github.actor != 'dependabot[bot]') runs-on: ${{ matrix.os }} strategy: fail-fast: false - # Recommendations: + # * support at least 2 operating systems # * support at least 2 compilers # * make sure all supported configurations for your project are built @@ -135,47 +142,40 @@ jobs: # Disable/enable builds in this list to meet the above recommendations # and your own projects needs matrix: - os: [ ubuntu-latest, ubuntu-22.04 ] + os: [ubuntu-latest, ubuntu-22.04] generator: - - "Ninja" + - Ninja build_type: - Debug - qt_version: [ 5.15.2, 6.4.0 ] - + qt_version: [5.15.2, 6.7.2] permissions: actions: read contents: read security-events: write - steps: - - name: "Cancel Previous Runs" - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} + - name: ๐Ÿงฐ Checkout Source Code + # Checkout the repository to the GitHub Actions runner - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@v4 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 - - - name: "โš™๏ธ Install Python" + - name: โš™๏ธ Install Python id: python - uses: actions/setup-python@v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: # Read python version from a file .python-version - python-version-file: ".python-version" + python-version-file: .python-version # check-latest: true - cache: pip - - name: "'โš™๏ธ Install Python dependencies" + cache: pip + - name: โš™๏ธ Install Python dependencies shell: bash id: python-deps run: | python -m pip install --upgrade pip - pip3 install "conan<2" - - - name: "๐Ÿง โš™๏ธ Install Linux dependencies" + pip3 install -r ./conan-requirements.txt + - name: ๐Ÿง โš™๏ธ Install Linux dependencies if: runner.os == 'Linux' run: | sudo apt-get update && DEBIAN_FRONTEND=--noninteractive \ @@ -190,27 +190,20 @@ jobs: echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV echo "CXX=g++-10" >> $GITHUB_ENV echo "CC=gcc-10" >> $GITHUB_ENV - - name: Configure Conan shell: bash run: | echo "Setup conan" conan user conan config init - conan profile show default - - - name: "๐Ÿ”ง Setup Cache" - uses: ./.github/actions/setup_cache - with: - build_type: ${{ matrix.build_type }} - generator: ${{ matrix.generator }} - - - name: "โš™๏ธ Install Qt Version ${{ matrix.qt_version }}" - uses: jurplel/install-qt-action@v4 + conan profile show default + - name: โš™๏ธ Install Qt Version ${{ matrix.qt_version }} + uses: jurplel/install-qt-action@f03f05556819ceb3781ee2f455ec44c339d683c0 # v4.0.0 with: version: "${{ matrix.qt_version }}" dir: "${{ env.QT_DIR }}" # host: ${{ runner.os }} + arch: "${{ env.QT_ARCH }}" target: "${{ env.QT_TARGET }}" tools: "${{ env.QT_TOOLS }}" @@ -219,86 +212,74 @@ jobs: cache-key-prefix: "${{ runner.os }}-install-qt-action" set-env: "true" install-deps: "true" - - uses: hendrikmuhs/ccache-action@v1 + - uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14 if: runner.os == 'Linux' with: key: ${{ matrix.os }}-${{ matrix.build_type }} max-size: 50M - - name: restore ccache - uses: pat-s/always-upload-cache@v3.0.11 + uses: pat-s/always-upload-cache@9a0d1c3e1a8260b05500f9b67a5be8f2a1299819 # v3.0.11 with: - path: ${{runner.workspace}}/ccache - key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}-${{ github.sha }} - restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}} - + path: ${{github.workspace}}/ccache + key: ccache-${{matrix.os}}-${{matrix.qt_version}}-${{ github.sha }} + restore-keys: ccache-${{matrix.os}}-${{matrix.qt_version}} - name: check ccache stats prior to build run: ccache --zero-stats --show-stats - - - name: "Cleanup Conan system packages (they are not properly cached)" + - name: Cleanup Conan system packages (they are not properly cached) run: | conan remove -f '*/system' - - - name: "Add GCC problem matcher" - uses: ammaraskar/gcc-problem-matcher@master - - - name: "Create Build Environment" + - name: Add GCC problem matcher + uses: ammaraskar/gcc-problem-matcher@0f9c86f9e693db67dacf53986e1674de5f2e5f28 # v0.3.0 + - name: Create Build Environment # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands run: cmake -E make_directory build # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage + - name: Configure CMake # has meaningful results - - name: "Configure CMake" + working-directory: build shell: bash run: | mkdir -pv usr cmake -S .. -B . -G "${{matrix.generator}}" \ + -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" \ -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ -DCMAKE_INSTALL_PREFIX:PATH="./usr" \ -DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} \ -DBUILD_TESTING:BOOL=${{ matrix.build_type == 'Debug' }} \ -DENABLE_CACHE="ON" - - - name: "๐Ÿšง Build" + - name: ๐Ÿšง Build # Execute the build. You can specify a specific target with "--target " + run: | cmake --build ./build --config ${{matrix.build_type}} - - name: check ccache stats prior to build run: ccache --zero-stats --show-stats - - - name: "๐Ÿง ๐Ÿงช Test and coverage" + - name: ๐Ÿง ๐Ÿงช Test and coverage working-directory: build # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail run: | ctest -C ${{matrix.build_type}} gcovr -j ${{env.nproc}} --delete --root ../ --print-summary --xml-pretty --xml coverage.xml - - - name: "Publish to codecov" - uses: codecov/codecov-action@v3 + - name: Publish to codecov + uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 v4.6.0 with: flags: ${{ runner.os }} name: ${{ runner.os }}-coverage files: ./build/coverage.xml - build: # if: startsWith(github.event.ref, 'refs/tags/') name: "Build for ${{ matrix.name }}" - runs-on: ${{ matrix.os }} needs: tests - strategy: fail-fast: false matrix: - name: - [ - ubuntu-latest-clang++, - macos-latest-clang++, - windows-latest-cl.exe - ] + name: [ubuntu-latest-clang++, macos-latest-clang++, windows-latest-cl.exe] include: - name: ubuntu-latest-clang++ os: ubuntu-latest @@ -307,7 +288,7 @@ jobs: compiler: clang++-14 ccompiler: clang-14 clang-tidy: "" - generators: Ninja + generator: Ninja - name: windows-latest-cl.exe os: windows-latest build_type: Release @@ -317,7 +298,7 @@ jobs: compiler: cl.exe ccompiler: cl.exe clang-tidy: "" - generators: Ninja + generator: Ninja - name: macos-latest-clang++ os: macos-latest build_type: Release @@ -325,53 +306,42 @@ jobs: arch: clang_64 compiler: clang++ ccompiler: clang - generators: Ninja - + generator: Ninja env: CXX: ${{ matrix.compiler }} CC: ${{ matrix.ccompiler }} - permissions: actions: read contents: read security-events: write - steps: - - name: "โš™๏ธ Get the version" + - name: โš™๏ธ Get the version id: get_version shell: bash - run: | - echo ::set-output name=VERSION::"$(echo $GITHUB_REF | cut -d / -f 3)" + run: echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> "$GITHUB_OUTPUT" + - name: ๐Ÿงฐ Checkout Source Code + # Checkout the repository to the GitHub Actions runner - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@v4 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 - - - name: "โš™๏ธ Install Python" + - name: โš™๏ธ Install Python id: python - uses: actions/setup-python@v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: # Read python version from a file .python-version - python-version-file: ".python-version" + python-version-file: .python-version # check-latest: true - cache: pip - - name: "โš™๏ธ Install Python dependencies" + cache: pip + - name: โš™๏ธ Install Python dependencies shell: bash id: python-deps run: | python -m pip install --upgrade pip - pip3 install "conan<2" - - - name: "๐Ÿ”ง Setup Cache" - uses: ./.github/actions/setup_cache - with: - build_type: ${{ matrix.build_type }} - generator: ${{ matrix.generator }} - - - name: "๐Ÿง โš™๏ธ Install Linux dependencies" + pip3 install -r ./conan-requirements.txt + - name: ๐Ÿง โš™๏ธ Install Linux dependencies if: runner.os == 'Linux' run: | sudo apt-get update && DEBIAN_FRONTEND=--noninteractive \ @@ -379,11 +349,10 @@ jobs: libclang-dev \ ninja-build \ ccache - echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV - echo "CXX=clang++-12" >> $GITHUB_ENV - echo "CC=clang-12" >> $GITHUB_ENV - - - name: "โš™๏ธ ๐ŸŽ Install macos dependencies" + echo "CCACHE_DIR=${{github.workspace}}/ccache" >> "$GITHUB_ENV" + echo "CXX=clang++-12" >> "$GITHUB_ENV" + echo "CC=clang-12" >> "$GITHUB_ENV" + - name: โš™๏ธ ๐ŸŽ Install macos dependencies if: runner.os == 'macOS' env: HOMEBREW_NO_ANALYTICS: "ON" @@ -392,25 +361,22 @@ jobs: HOMEBREW_NO_INSTALL_CLEANUP: "ON" run: | brew install ninja ccache pkg-config - echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH - echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV + echo "/usr/local/opt/ccache/libexec" >> "$GITHUB_PATH" + echo "CCACHE_DIR=${{github.workspace}}/ccache" >> "$GITHUB_ENV" # Use latest available XCode sudo xcode-select -s "/Applications/Xcode_13.2.1.app" - echo "DEVELOPER_DIR=/Applications/Xcode_13.2.1.app/Contents/Developer" >> $GITHUB_ENV - - - name: "๐ŸงŠ โš™๏ธ Install Windows dependencies" + echo "DEVELOPER_DIR=/Applications/Xcode_13.2.1.app/Contents/Developer" >> "$GITHUB_ENV" + - name: ๐ŸงŠ โš™๏ธ Install Windows dependencies if: runner.os == 'Windows' run: | cinst ninja ccache - - - name: "๐ŸงŠ โš™๏ธ Configure MSVC" + - name: ๐ŸงŠ โš™๏ธ Configure MSVC if: runner.os == 'Windows' - uses: ilammy/msvc-dev-cmd@v1.13.0 + uses: ilammy/msvc-dev-cmd@ 0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 with: # 14.1 is for vs2017, 14.2 is vs2019, following the upstream vcpkg build from Qv2ray-deps repo toolset: 14.2 - arch: ${{ matrix.confg.pak_arch }} - + arch: ${{ matrix.pak_arch }} - name: Configure Conan shell: bash run: | @@ -418,300 +384,226 @@ jobs: conan user conan config init conan profile show default - - name: (Linux/macOS) restore ccache if: runner.os == 'Linux' || runner.os == 'macOS' uses: pat-s/always-upload-cache@v3.0.11 with: - path: ${{runner.workspace}}/ccache - key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}-${{ github.sha }} - restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}} - + path: ${{github.workspace}}/ccache + key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{env.QT_VERSION}}-${{ github.sha }} + restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{env.QT_VERSION}} - name: (Linux/macOS) check ccache stats prior to build if: runner.os == 'Linux' || runner.os == 'macOS' run: ccache --zero-stats --show-stats - - - name: "Add GCC problem matcher" + - name: Add GCC problem matcher if: runner.os == 'Linux' - uses: ammaraskar/gcc-problem-matcher@master - + uses: ammaraskar/gcc-problem-matcher@0f9c86f9e693db67dacf53986e1674de5f2e5f28 # v0.3.0 - name: "โš™๏ธ Install Qt Version ${{ env.QT_VERSION }}" - uses: jurplel/install-qt-action@v4 + uses: jurplel/install-qt-action@f03f05556819ceb3781ee2f455ec44c339d683c0 # v4.0.0 with: version: ${{ env.QT_VERSION }} # host: ${{ runner.os }} + target: ${{ env.QT_TARGET }} - arch: ${{ matrix.config.qt_arch }} + arch: ${{ matrix.qt_arch }} dir: "${{ github.workspace }}/build/" install-deps: "true" # modules: 'qtcharts qtwebengine' - cached: "${{ steps.cache-qt.outputs.cache-hit }}" + setup-python: "true" # tools: "tools_ifw" - set-env: "true" - - name: "Cleanup Conan system packages (they are not properly cached)" + set-env: "true" + - name: Cleanup Conan system packages (they are not properly cached) run: | conan remove -f '*/system' - - - name: "Create Build Environment" + - name: Create Build Environment # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands run: cmake -E make_directory build + - name: โš™๏ธ ๐ŸงŠ Configure CMake + # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage - # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage - # has meaningful results - - name: "โš™๏ธ ๐ŸงŠ Configure CMake" + # has meaningful results if: runner.os == 'Windows' working-directory: build shell: pwsh run: | cmake ` -S .. -B . ` - -G "${{matrix.generators}}" ` + -G "${{matrix.generator}}" ` + -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" ` -DCMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} ` -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/install" ` -DBUILD_SHARED_LIBS:BOOL="TRUE" # -G "Visual Studio 16 2019" -A "x64" ` + - name: โš™๏ธ ๐Ÿง Configure CMake # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage - # has meaningful results. - - name: "โš™๏ธ ๐Ÿง Configure CMake" + # has meaningful results. if: runner.os == 'Linux' working-directory: build shell: bash - run: |+ + run: | cmake -S .. -B . -G "${{matrix.generator}}" \ - -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ - -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/AppDir/usr" \ - -DBUILD_SHARED_LIBS:BOOL="TRUE" \ - -DENABLE_CACHE="ON" - - - name: "โš™๏ธ ๐ŸŽ Configure CMake" + -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" \ + -DCMAKE_BUILD_TYPE:STRING="${{matrix.build_type}}" \ + -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/AppDir/usr" \ + -DBUILD_SHARED_LIBS:BOOL="TRUE" \ + -DENABLE_CACHE="ON" + - name: โš™๏ธ ๐ŸŽ Configure CMake working-directory: build shell: bash if: runner.os == 'macOS' - run: |+ + run: | cmake -S .. -B . -G "${{matrix.generator}}" \ - -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ - -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/install" \ - -DBUILD_SHARED_LIBS:BOOL="TRUE" \ - -DENABLE_CACHE="ON" - - # TODO: Stored in install. Build DMG with CPack - - name: "๐Ÿ“ฆ ๐ŸŽ Build and package application (macdeployqt and zipfile)" + -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" \ + -DCMAKE_BUILD_TYPE:STRING="${{matrix.build_type}}" \ + -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/install" \ + -DBUILD_SHARED_LIBS:BOOL="TRUE" \ + -DENABLE_CACHE="ON" + - name: ๐Ÿ“ฆ ๐ŸŽ Build and package application (macdeployqt and zipfile) + # TODO: Stored in install. Build DMG with CPack + working-directory: build if: runner.os == 'macOS' run: | cmake --build . --config ${{matrix.build_type}} cpack -C "${{matrix.build_type}}" -G "DragNDrop;ZIP" + - name: โš™๏ธ ๐ŸงŠ Build + # TODO: Stored in install. Build installer with CPack - # TODO: Stored in install. Build installer with CPack - - name: "โš™๏ธ ๐ŸงŠ Build" if: runner.os == 'Windows' working-directory: build run: | cmake --build . --config ${{matrix.build_type}} cpack -C "${{matrix.build_type}}" -G "WIX;ZIP" - - - name: "โš™๏ธ ๐Ÿง Build" + - name: โš™๏ธ ๐Ÿง Build if: runner.os == 'Linux' working-directory: build # Execute the build. You can specify a specific target with "--target " + run: | sudo apt-get -y --no-install-recommends install tree cmake --build . --config ${{matrix.build_type}} --target install - - - name: "โš™๏ธ ๐Ÿง Install go-appimage tool" + - name: โš™๏ธ ๐Ÿง Install go-appimage tool if: runner.os == 'Linux' # Will not use linuxdeployqt anymore, because it suopprts currently still-supported mainstream distribution, + # which is glibc 2.23. For more information, please see https://github.com/probonopd/linuxdeployqt/issues/340. # Will try new tool https://github.com/probonopd/go-appimage written in golang by probonopd. run: | - wget $(curl https://api.github.com/repos/probonopd/go-appimage/releases | jq -r '.[] | select(.tag_name == "continuous") | .assets[] | select((.name | endswith("x86_64.AppImage")) and (.name | contains("appimagetool"))) | .browser_download_url') -O appimagetool - chmod +x appimagetool + wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimaged-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2) -P "$GITHUB_WORKSPACE" + chmod +x "$GITHUB_WORKSPACE/appimaged-*.AppImage" env: APPIMAGETOOL_ARCH: x86_64 + - name: ๐Ÿง ๐Ÿ“ฆ Create AppImage + # TODO: Stored in build directory - # TODO: Stored in build directory - - name: "๐Ÿง ๐Ÿ“ฆ Create AppImage" if: runner.os == 'Linux' shell: bash run: | APPIMAGE_DST_PATH="${{github.workspace}}/AppDir" - cd $GITHUB_WORKSPACE - cp $GITHUB_WORKSPACE/assets/icons/icons8-app-symbol-80.png $APPIMAGE_DST_PATH/io.github.jmuelbert.${TARGET_NAME}.png - $GITHUB_WORKSPACE/appimagetool -s deploy ${APPIMAGE_DST_PATH}/usr/share/applications/io.github.jmuelbert.${TARGET_NAME}.desktop - mkdir -p ${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts + cd "$GITHUB_WORKSPACE" + cp "$GITHUB_WORKSPACE/assets/icons/icons8-app-symbol-80.png" "$APPIMAGE_DST_PATH/io.github.jmuelbert.${TARGET_NAME}.png" + "$GITHUB_WORKSPACE/appimaged-*.AppImage" -s deploy "${APPIMAGE_DST_PATH}/usr/share/applications/io.github.jmuelbert.${TARGET_NAME}.desktop" + mkdir -p "${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts" if [ -f "${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0" ]; then - rm ${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0 + rm "${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0" fi - chmod +x ${APPIMAGE_DST_PATH}/usr/lib64/ld-*.so.* - $GITHUB_WORKSPACE/appimagetool ${APPIMAGE_DST_PATH} - - - name: "๐Ÿง ๐Ÿ“ค Upload Linux artifacts" + chmod +x "${APPIMAGE_DST_PATH}/usr/lib64/ld-*.so.*" + "$GITHUB_WORKSPACE/appimaged-*.AppImage" "${APPIMAGE_DST_PATH}" + - name: ๐Ÿง ๐Ÿ“ค Upload Linux artifacts if: runner.os == 'Linux' uses: actions/upload-artifact@v4 with: name: AppImage - path: "./*.AppImage*" - - - name: "๐ŸŽ ๐Ÿ“ค Upload macOS artifacts" + path: ./*.AppImage* + - name: ๐ŸŽ ๐Ÿ“ค Upload macOS artifacts if: runner.os == 'macOS' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: macos-artifacts path: | build/*.dmg build/*.zip - - name: "๐ŸงŠ ๐Ÿ“ค Upload artifact: Windows Installer" if: runner.os == 'Windows' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: windows-artifacts path: | build/*.msi build/*.zip - flatpak-build: name: "๐Ÿง Build flatpak on ubuntu-latest" runs-on: ubuntu-latest needs: tests - permissions: actions: read contents: read security-events: write - steps: - name: "โš™๏ธ Get the version" id: get_version shell: bash - run: echo ::set-output name=VERSION::"$(echo $GITHUB_REF | cut -d / -f 3)" + run: echo "VERSION=$(echo ${GITHUB_REF} | cut -d / -f 3)" >> "$GITHUB_OUTPUT" + - name: ๐Ÿงฐ Checkout Source Code + # Checkout the repository to the GitHub Actions runner - - name: "Cancel Previous Runs" - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@v4 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 - - - name: "Setup Flatpak" + - name: Install Flatpak run: | sudo apt-get -y -qq update sudo apt-get install -y flatpak flatpak-builder - - - name: "Setup Flatpak" + - name: Setup Flatpak run: | sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive \ apt-get --no-install-recommends --assume-yes install \ flatpak flatpak-builder elfutils - - - name: "Setup Flathub" + - name: Flatpak add user run: | flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - - - name: "๐Ÿ“ฆ Create flatpak" - run: | - mkdir -pv $GITHUB_WORKSPACE/install - BUNDLE="io.github.jmuelbert.${{env.TARGET_NAME}}.flatpak" - MANIFEST_PATH=$GITHUB_WORKSPACE/deploy/flatpak.yaml - RUNTIME_REPO="https://flathub.org/repo/flathub.flatpakrepo" - APP_ID="io.github.jmuelbert.${{env.TARGET_NAME}}" - - flatpak-builder --user --disable-rofiles-fuse --repo=repo --force-clean flatpak_app ${MANIFEST_PATH} --install-deps-from=flathub - flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID} - mv $GITHUB_WORKSPACE/$BUNDLE $GITHUB_WORKSPACE/io.github.jmuelbert.${{env.TARGET_NAME}}_${{ steps.get_version.outputs.VERSION }}.x86_64.flatpak - ls -al - - - name: "๐Ÿ“ค Upload artifact: FlatPak" - uses: actions/upload-artifact@v4 + - name: ๐Ÿ“ฆ Create package + run: "mkdir -pv \"$GITHUB_WORKSPACE/install\"\nBUNDLE=\"io.github.jmuelbert.${{env.TARGET_NAME}}.flatpak\"\nMANIFEST_PATH=\"$GITHUB_WORKSPACE/packging/flatpak/org.jmuelbert.jmbde.QT.yaml\"\nRUNTIME_REPO=\"https://flathub.org/repo/flathub.flatpakrepo\"\nAPP_ID=\"io.github.jmuelbert.${{env.TARGET_NAME}}\"\n\nflatpak-builder --user --disable-rofiles-fuse --repo=repo --force-clean flatpak_app \"${MANIFEST_PATH}\" --install-deps-from=flathub\nflatpak build-bundle repo ${BUNDLE} --runtime-repo=\"${RUNTIME_REPO}\" \"${APP_ID}\"\nmv \"$GITHUB_WORKSPACE/$BUNDLE\" \"$GITHUB_WORKSPACE/io.github.jmuelbert.${{env.TARGET_NAME}}_${{ steps.get_version.outputs.VERSION }}.x86_64.flatpak\"\nls -al \n" + - name: ๐Ÿ“ค Upload artifact FlatPak + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: flatpak-artifact path: | ./install/*.flatpak - snap-build: - name: "๐Ÿง Build snap on ubuntu-20.04" + name: ๐Ÿง Build snap on ubuntu-20.04 runs-on: ubuntu-20.04 needs: tests - steps: - - name: "โš™๏ธ Get the version" + - name: โš™๏ธ Get the version id: get_version shell: bash - run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) + run: echo "VERSION=$(echo ${GITHUB_REF} | cut -d / -f 3)" >> "$GITHUB_OUTPUT" + - name: ๐Ÿงฐ Checkout Source Code + # Checkout the repository to the GitHub Actions runner - - name: "Cancel Previous Runs" - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: "๐Ÿ“ฆ Create snap" - uses: snapcore/action-build@v1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 + - name: ๐Ÿ“ฆ Create snap + uses: snapcore/action-build@3bdaa03e1ba6bf59a65f84a751d943d549a54e79 # v1.3.0 id: snapcraft with: snapcraft-args: --enable-experimental-extensions - - name: "Rename snap name" shell: bash run: | - mv ${{ steps.snapcraft.outputs.snap }} $GITHUB_WORKSPACE/${TARGET_NAME}_${{ steps.get_version.outputs.VERSION }}_amd64.snap - ls - - - name: "๐Ÿง ๐Ÿ“ค Upload artifact: SnapPack" - uses: actions/upload-artifact@v4 + mv "${{ steps.snapcraft.outputs.snap }}" "$GITHUB_WORKSPACE/${TARGET_NAME}_${{ steps.get_version.outputs.VERSION }}_amd64.snap" + ls -lah + - name: ๐Ÿง ๐Ÿ“ค Upload artifact SnapPack + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: snapcraft-artifact path: | $GITHUB_WORKSPACE/${{ env.TARGET_NAME}}_*_amd64.snap - - diagram: - name: "Build diagram" - needs: tests - runs-on: ubuntu-latest - - steps: - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@master - - - name: "Update diagram" - uses: githubocto/repo-visualizer@0.9.1 - with: - output_file: "images/diagram.svg" - excluded_paths: "dist,node_modules" - - releaseNotes: - # if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - needs: upload - steps: - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: "Build Releasenotes" - id: github_releasenotes - uses: release-drafter/release-drafter@v5.25.0 - with: - publish: "${{ steps.check-version.outputs.tag != '' }}" - tag: "${{ steps.check-version.outputs.tag }}" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - changeLog: # if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest @@ -719,86 +611,95 @@ jobs: steps: - name: Build Changelog id: github_release - uses: mikepenz/release-changelog-builder-action@v4 + uses: mikepenz/release-changelog-builder-action@69817ffbda9792da9756c52efd06b5a6103f39dc # v5 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Create Release - uses: mikepenz/action-gh-release@v0.2.0-a03 #softprops/action-gh-release + uses: mikepenz/action-gh-release@9a604afa5167a745eab07256a54e2f578a1a0c5e # v1 with: body: ${{steps.github_release.outputs.changelog}} + # Upload continuous build - # Upload continous build upload: - name: "๐Ÿ—‚ Create release and upload artifacts" + name: ๐Ÿ—‚ Create release and upload artifacts needs: - build - flatpak-build - snap-build - runs-on: ubuntu-latest steps: - - name: "๐Ÿ“ฅ Download artifacts" - uses: actions/download-artifact@v4 - - name: "๐Ÿ—‚ Inspect directory after downloading artifacts" + - name: "โš™๏ธ Get the version" + id: get_version + shell: bash + run: echo "VERSION=$(echo ${GITHUB_REF} | cut -d / -f 3)" >> "$GITHUB_OUTPUT" + - name: ๐Ÿ“ฅ Download artifacts + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + - name: ๐Ÿ—‚ Inspect directory after downloading artifacts run: ls -alFR - - name: "๐Ÿ“ค Upload Release: AppImage" if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 + uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{runner.workspace}}/${{env.TARGET_NAME}}.appimage + file: ${{github.workspace}}/${{env.TARGET_NAME}}.appimage asset_name: ${{env.TARGET_NAME}}.appimage tag: ${{ github.ref }} overwrite: true - - name: "๐Ÿ“ค Upload Release: FlatPak" if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 + uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{runner.workspace}}/${{env.TARGET_NAME}}.flatpak + file: ${{github.workspace}}/${{env.TARGET_NAME}}.flatpak asset_name: ${{env.TARGET_NAME}}.flatpak tag: ${{ github.ref }} overwrite: true - - name: "๐Ÿ“ค Upload Release: snap" if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 + uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{runner.workspace}}/${{env.TARGET_NAME}}.amd64.snap + file: ${{github.workspace}}/${{env.TARGET_NAME}}.amd64.snap asset_name: ${{env.TARGET_NAME}}.amd64.snap tag: ${{ github.ref }} overwrite: true - - name: "๐Ÿ“ค Upload Release: macOS" if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 + uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{runner.workspace}}/${{env.TARGET_NAME}}.dmg + file: ${{github.workspace}}/${{env.TARGET_NAME}}.dmg asset_name: ${{env.TARGET_NAME}}.dmg tag: ${{ github.ref }} overwrite: true - - name: "๐Ÿ“ค Upload Release: windows" if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 + uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ./${{ env.TARGET_NAME }}.exe asset_name: ${{ env.TARGET_NAME}}-win.exe tag: ${{ github.ref }} overwrite: true - - name: "๐Ÿ“ค Upload Release: zip for windows" if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 + uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ./${{ env.archiveName }}-win.zip asset_name: ${{ env.TARGET_NAME}}-win-${{ steps.get_version.outputs.VERSION }}.zip tag: ${{ github.ref }} overwrite: true + release-all-green: # This job does nothing and is only used for the branch protection + if: always() + needs: + - clang-format + - cmake-format + - tests + - build + runs-on: ubuntu-latest + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@223e4bb7a751b91f43eda76992bcfbf23b8b0302 # v1.2.2 + with: + jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/cmake-requirements.txt b/.github/workflows/cmake-requirements.txt new file mode 100644 index 000000000..53ddc8a9a --- /dev/null +++ b/.github/workflows/cmake-requirements.txt @@ -0,0 +1,3 @@ +cmakelang ~= 0.6.13 +PyYaml ~= 6.0.2 +Jinja2 ~= 3.1.4 diff --git a/.github/workflows/codacy-analysis.yml b/.github/workflows/codacy-analysis.yml index dc9949623..2472755a6 100644 --- a/.github/workflows/codacy-analysis.yml +++ b/.github/workflows/codacy-analysis.yml @@ -33,7 +33,7 @@ concurrency: jobs: codacy-security-scan: # Skip any PR created by dependabot to avoid permission issues: - if: (github.actor != 'dependabot[bot]') + if: (githu.actor != 'dependabot[bot]') name: Codacy Security Scan runs-on: ubuntu-latest permissions: @@ -66,4 +66,4 @@ jobs: - name: ๐Ÿ“ค Upload SARIF results file uses: github/codeql-action/upload-sarif@b7cec7526559c32f1616476ff32d17ba4c59b2d6 # v3.25.5 with: - sarif_file: codeql-results.sarif \ No newline at end of file + sarif_file: codeql-results.sarif diff --git a/.github/workflows/conan-requirements.txt b/.github/workflows/conan-requirements.txt new file mode 100644 index 000000000..af42e569e --- /dev/null +++ b/.github/workflows/conan-requirements.txt @@ -0,0 +1 @@ +conan ~= 2.9.0 diff --git a/.github/workflows/pages-astro.yml b/.github/workflows/pages-astro.yml index 3db6e925c..0ae2254dd 100644 --- a/.github/workflows/pages-astro.yml +++ b/.github/workflows/pages-astro.yml @@ -12,17 +12,21 @@ permissions: contents: read pages: write id-token: write + on: # yamllint disable-line rule:truthy push: branches: [main, develop, release] pull_request: # The branches below must be a subset of the branches above types: [opened, synchronize, reopened] + workflow_dispatch: + # Allow one concurrent deployment concurrency: group: pages cancel-in-progress: true + jobs: build: runs-on: ubuntu-latest @@ -34,11 +38,12 @@ jobs: - name: Build and Upload Site uses: withastro/action@acfe56dffc635abfb9506c77d51ce097030360d1 # v2.0.0 with: - path: ./docs - # The root location of your Astro project inside the + path: ./pages + # The location of your Astro project inside the # repository. (optional) # node-version: 16 # The specific version of Node that should be used to build your site. Defaults to 16. (optional) package-manager: pnpm@latest + deploy: environment: name: github-pages @@ -50,6 +55,7 @@ jobs: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 + # https://github.com/marketplace/actions/alls-green#wh release-all-green: # This job does nothing and is only used for the branch protection if: always() diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml deleted file mode 100644 index 0130a8100..000000000 --- a/.github/workflows/pages.yml +++ /dev/null @@ -1,55 +0,0 @@ ---- -# Sample workflow for building and deploying a Jekyll site to GitHub Pages -name: Deploy Jekyll with GitHub Pages dependencies preinstalled - -on: - # Runs on pushes targeting the default branch - push: - branches: ["main"] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow one concurrent deployment -concurrency: - group: "pages" - cancel-in-progress: true - -jobs: - # Build job - build: - runs-on: ubuntu-latest - steps: - - name: "๐Ÿงฐ Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: Setup Pages - uses: actions/configure-pages@v4.0.0 - - name: Build with Jekyll - uses: actions/jekyll-build-pages@v1 - with: - source: ./ - destination: ./_site - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - - # Deployment job - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: build - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 diff --git a/.github/workflows/styles.yml b/.github/workflows/styles.yml index 8b77a8d37..4d91124fd 100644 --- a/.github/workflows/styles.yml +++ b/.github/workflows/styles.yml @@ -3,7 +3,7 @@ name: Style on: push: - branches: [main, develop, release, improve_build-workflow] + branches: [main, develop, release] paths-ignore: - 'docs/**' diff --git a/packaging/flatpak/org.jmuelbert.jmbde-QT.yml b/packaging/flatpak/org.jmuelbert.jmbde-QT.yml index 376bc0945..e446708fb 100644 --- a/packaging/flatpak/org.jmuelbert.jmbde-QT.yml +++ b/packaging/flatpak/org.jmuelbert.jmbde-QT.yml @@ -1,4 +1,4 @@ ---- +# TODO: Update to use Qt6.x app-id: org.jmuelbert.jmbde_QT runtime: org.kde.Platform runtime-version: '5.15' @@ -20,7 +20,6 @@ finish-args: # Notification access - --talk-name=org.freedesktop.Notifications # System Tray Icon - modules: - name: jmbde buildsystem: cmake-ninja From a1a0853c2fc6d3c9c85e5b18358dc98e9c094cd7 Mon Sep 17 00:00:00 2001 From: Clang Robot Date: Thu, 31 Oct 2024 11:13:00 +0000 Subject: [PATCH 03/32] :art: Committing clang-format changes --- apps/jmbde-widgets/src/main.cpp | 3 +- .../libs/models/include/jmbdemodels/account.h | 356 ++- .../models/include/jmbdemodels/chipcard.h | 383 +-- .../models/include/jmbdemodels/chipcarddoor.h | 369 +-- .../include/jmbdemodels/chipcardprofile.h | 360 +-- .../include/jmbdemodels/chipcardprofiledoor.h | 325 +- .../models/include/jmbdemodels/cityname.h | 290 +- .../models/include/jmbdemodels/commondata.h | 268 +- .../libs/models/include/jmbdemodels/company.h | 444 +-- .../models/include/jmbdemodels/computer.h | 820 ++--- .../include/jmbdemodels/computersoftware.h | 275 +- .../models/include/jmbdemodels/datacontext.h | 404 ++- .../models/include/jmbdemodels/department.h | 375 +-- .../models/include/jmbdemodels/devicename.h | 292 +- .../models/include/jmbdemodels/devicetype.h | 294 +- .../models/include/jmbdemodels/document.h | 311 +- .../models/include/jmbdemodels/employee.h | 985 +++--- .../include/jmbdemodels/employeeaccount.h | 325 +- .../include/jmbdemodels/employeedocument.h | 325 +- apps/libs/models/include/jmbdemodels/fax.h | 643 ++-- .../models/include/jmbdemodels/function.h | 319 +- .../models/include/jmbdemodels/inventory.h | 354 ++- .../models/include/jmbdemodels/manufacturer.h | 565 ++-- apps/libs/models/include/jmbdemodels/mobile.h | 612 ++-- apps/libs/models/include/jmbdemodels/os.h | 367 +-- apps/libs/models/include/jmbdemodels/phone.h | 571 ++-- apps/libs/models/include/jmbdemodels/place.h | 352 ++- .../libs/models/include/jmbdemodels/printer.h | 704 +++-- .../models/include/jmbdemodels/processor.h | 344 ++- .../models/include/jmbdemodels/software.h | 383 +-- .../models/include/jmbdemodels/systemdata.h | 358 +-- apps/libs/models/include/jmbdemodels/title.h | 301 +- .../libs/models/include/jmbdemodels/zipcity.h | 321 +- .../libs/models/include/jmbdemodels/zipcode.h | 294 +- apps/libs/models/src/account.cpp | 104 +- apps/libs/models/src/chipcard.cpp | 106 +- apps/libs/models/src/chipcarddoor.cpp | 111 +- apps/libs/models/src/chipcardprofile.cpp | 109 +- apps/libs/models/src/chipcardprofiledoor.cpp | 107 +- apps/libs/models/src/cityname.cpp | 105 +- apps/libs/models/src/commondata.cpp | 38 +- apps/libs/models/src/company.cpp | 125 +- apps/libs/models/src/computer.cpp | 143 +- apps/libs/models/src/computersoftware.cpp | 107 +- apps/libs/models/src/datacontext.cpp | 515 ++-- apps/libs/models/src/department.cpp | 111 +- apps/libs/models/src/devicename.cpp | 105 +- apps/libs/models/src/devicetype.cpp | 105 +- apps/libs/models/src/document.cpp | 107 +- apps/libs/models/src/employee.cpp | 159 +- apps/libs/models/src/employeeaccount.cpp | 107 +- apps/libs/models/src/employeedocument.cpp | 107 +- apps/libs/models/src/fax.cpp | 127 +- apps/libs/models/src/function.cpp | 107 +- apps/libs/models/src/inventory.cpp | 109 +- apps/libs/models/src/manufacturer.cpp | 123 +- apps/libs/models/src/mobile.cpp | 129 +- apps/libs/models/src/os.cpp | 111 +- apps/libs/models/src/phone.cpp | 127 +- apps/libs/models/src/place.cpp | 109 +- apps/libs/models/src/printer.cpp | 137 +- apps/libs/models/src/processor.cpp | 109 +- apps/libs/models/src/software.cpp | 111 +- apps/libs/models/src/systemdata.cpp | 107 +- apps/libs/models/src/title.cpp | 105 +- apps/libs/models/src/zipcity.cpp | 105 +- apps/libs/models/src/zipcode.cpp | 103 +- .../libs/models/test_package/example_test.cpp | 5 +- .../quick/autotests/src/tst_quicktest.cpp | 30 +- apps/libs/quick/autotests/src/tst_quicktest.h | 1 - .../quick/include/jmbdequick/maincontroller.h | 10 +- .../include/jmbdequick/models/employeemodel.h | 71 +- apps/libs/quick/src/models/employeemodel.cpp | 180 +- apps/libs/quick/src/quick/maincontroller.cpp | 29 +- .../quick/test_package/src/tst_quicktest.cpp | 30 +- .../autotests/src/tst_jmbdewidgets.cpp | 5 +- .../include/jmbdewidgets/aboutdialog.h | 11 +- .../include/jmbdewidgets/accountinputarea.h | 179 +- .../jmbdewidgets/chipcarddoorinputarea.h | 171 +- .../include/jmbdewidgets/chipcardinputarea.h | 171 +- .../chipcardprofiledoorinputarea.h | 171 +- .../jmbdewidgets/chipcardprofileinputarea.h | 171 +- .../include/jmbdewidgets/cityinputarea.h | 171 +- .../include/jmbdewidgets/companyinputarea.h | 171 +- .../include/jmbdewidgets/computerinputarea.h | 171 +- .../jmbdewidgets/computersoftwareinputarea.h | 171 +- .../include/jmbdewidgets/csvimportdialog.h | 63 +- .../include/jmbdewidgets/definitions.h | 73 +- .../jmbdewidgets/departmentinputarea.h | 171 +- .../jmbdewidgets/devicenameinputarea.h | 171 +- .../jmbdewidgets/devicetypeinputarea.h | 171 +- .../include/jmbdewidgets/documentinputarea.h | 171 +- .../jmbdewidgets/employeeaccountinputarea.h | 171 +- .../jmbdewidgets/employeedocumentinputarea.h | 171 +- .../include/jmbdewidgets/employeeinputarea.h | 179 +- .../include/jmbdewidgets/employeetable.h | 251 +- .../include/jmbdewidgets/faxinputarea.h | 171 +- .../include/jmbdewidgets/functioninputarea.h | 171 +- .../include/jmbdewidgets/inventoryinputarea.h | 171 +- .../widgets/include/jmbdewidgets/mainwindow.h | 565 ++-- .../jmbdewidgets/manufacturerinputarea.h | 171 +- .../include/jmbdewidgets/mobileinputarea.h | 171 +- .../include/jmbdewidgets/osinputarea.h | 171 +- .../include/jmbdewidgets/phoneinputarea.h | 171 +- .../include/jmbdewidgets/placeinputarea.h | 171 +- .../include/jmbdewidgets/preferencesdialog.h | 77 +- .../include/jmbdewidgets/printerinputarea.h | 171 +- .../include/jmbdewidgets/processorinputarea.h | 171 +- .../include/jmbdewidgets/softwareinputarea.h | 171 +- .../jmbdewidgets/systemdatainputarea.h | 171 +- .../include/jmbdewidgets/titleinputarea.h | 171 +- .../include/jmbdewidgets/zipcitiyinputarea.h | 171 +- .../include/jmbdewidgets/zipcodeinputarea.h | 171 +- apps/libs/widgets/src/aboutdialog.cpp | 17 +- apps/libs/widgets/src/accountinputarea.cpp | 175 +- .../widgets/src/chipcarddoorinputarea.cpp | 175 +- apps/libs/widgets/src/chipcardinputarea.cpp | 177 +- .../src/chipcardprofiledoorinputarea.cpp | 154 +- .../widgets/src/chipcardprofileinputarea.cpp | 173 +- apps/libs/widgets/src/cityinputarea.cpp | 167 +- apps/libs/widgets/src/companyinputarea.cpp | 205 +- apps/libs/widgets/src/computerinputarea.cpp | 239 +- .../widgets/src/computersoftwareinputarea.cpp | 150 +- apps/libs/widgets/src/csvimportdialog.cpp | 146 +- apps/libs/widgets/src/departmentinputarea.cpp | 185 +- apps/libs/widgets/src/devicenameinputarea.cpp | 168 +- apps/libs/widgets/src/devicetypeinputarea.cpp | 168 +- apps/libs/widgets/src/documentinputarea.cpp | 167 +- .../widgets/src/employeeaccountinputarea.cpp | 155 +- .../widgets/src/employeedocumentinputarea.cpp | 154 +- apps/libs/widgets/src/employeeinputarea.cpp | 277 +- apps/libs/widgets/src/employeetable.cpp | 203 +- apps/libs/widgets/src/faxinputarea.cpp | 212 +- apps/libs/widgets/src/functioninputarea.cpp | 173 +- apps/libs/widgets/src/inventoryinputarea.cpp | 175 +- apps/libs/widgets/src/mainwindow.cpp | 2659 ++++++++--------- .../widgets/src/manufacturerinputarea.cpp | 191 +- apps/libs/widgets/src/mobileinputarea.cpp | 215 +- apps/libs/widgets/src/osinputarea.cpp | 180 +- apps/libs/widgets/src/phoneinputarea.cpp | 213 +- apps/libs/widgets/src/placeinputarea.cpp | 173 +- apps/libs/widgets/src/preferencesdialog.cpp | 108 +- apps/libs/widgets/src/printerinputarea.cpp | 231 +- apps/libs/widgets/src/processorinputarea.cpp | 175 +- apps/libs/widgets/src/softwareinputarea.cpp | 177 +- apps/libs/widgets/src/systemdatainputarea.cpp | 173 +- apps/libs/widgets/src/titleinputarea.cpp | 171 +- apps/libs/widgets/src/zipcityinputarea.cpp | 155 +- apps/libs/widgets/src/zipcodeinputarea.cpp | 168 +- 149 files changed, 17250 insertions(+), 16054 deletions(-) diff --git a/apps/jmbde-widgets/src/main.cpp b/apps/jmbde-widgets/src/main.cpp index cce6c38ae..f62512a0c 100644 --- a/apps/jmbde-widgets/src/main.cpp +++ b/apps/jmbde-widgets/src/main.cpp @@ -101,7 +101,8 @@ auto main(int argc, char *argv[]) -> int /** * Use file based translations from translations directory */ - qDebug() << "Use file based translations from: " << "Translation Directory"; + qDebug() << "Use file based translations from: " + << "Translation Directory"; qDebug() << "Use file based translations from: " << "Translation Directory"; if (translator.load(QLocale(), QLatin1String("jmbde"), QLatin1String("_"), QLatin1String("translations"))) { diff --git a/apps/libs/models/include/jmbdemodels/account.h b/apps/libs/models/include/jmbdemodels/account.h index fc707ba95..e0fc791b7 100644 --- a/apps/libs/models/include/jmbdemodels/account.h +++ b/apps/libs/models/include/jmbdemodels/account.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class Account \brief The Account class @@ -35,175 +36,198 @@ namespace Model { class Account : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn Account() - - \brief Constructor for the Account - */ - explicit JMBDEMODELS_EXPORT Account(); - /*! - \fn ~Account(); - - \brief Destructor for Account - */ - JMBDEMODELS_EXPORT ~Account() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int getAccountIdIndex() const - - \brief Get the index of the fieldname AccountId from the database - - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getAccountIdIndex() const -> int { return m_AccountIdIndex; } - - /*! - \fn int getUserNameIndex() const - - \brief Get the index of the fieldname UserName form the database - - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getUserNameIndex() const -> int { return m_UserNameIndex; } - - /*! - \fn int getPasswordIndex() const - - \brief Get the index of the fieldname Password form the database - - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getPasswordIndex() const -> int { return m_PasswordIndex; } - - /*! - \fn int getSystemDataIndex() - - \brief Get the index of the fieldname SystemData form the database - - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getSystemDataIndex() const -> int { return m_SystemDataIdIndex; } + /*! + \fn Account() + + \brief Constructor for the Account + */ + explicit JMBDEMODELS_EXPORT Account(); + /*! + \fn ~Account(); + + \brief Destructor for Account + */ + JMBDEMODELS_EXPORT ~Account() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int getAccountIdIndex() const + + \brief Get the index of the fieldname AccountId from the database + + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getAccountIdIndex() const -> int + { + return m_AccountIdIndex; + } + + /*! + \fn int getUserNameIndex() const + + \brief Get the index of the fieldname UserName form the database + + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getUserNameIndex() const -> int + { + return m_UserNameIndex; + } + + /*! + \fn int getPasswordIndex() const + + \brief Get the index of the fieldname Password form the database + + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getPasswordIndex() const -> int + { + return m_PasswordIndex; + } + + /*! + \fn int getSystemDataIndex() + + \brief Get the index of the fieldname SystemData form the database + + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getSystemDataIndex() const -> int + { + return m_SystemDataIdIndex; + } + + /*! + \fn int getLastUpdateIndex() + + \brief Get the index of the fieldname LastUpdate form the database + + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getLastUpdateIndex() const -> int + { + return m_LastUpdateIndex; + } - /*! - \fn int getLastUpdateIndex() +private: + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("account"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_AccountIdIndex + \brief The value of the AccountIdIndex + */ + int m_AccountIdIndex{0}; + + /*! + \var int m_UserNameIndex + \brief The value of the UserNameIndex + */ + int m_UserNameIndex{0}; - \brief Get the index of the fieldname LastUpdate form the database + /*! + \var int m_PasswordIndex; + \brief The value of the PasswordIndex + */ + int m_PasswordIndex{0}; - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getLastUpdateIndex() const -> int { return m_LastUpdateIndex; } + /*! + \var int m_SystemDataIdIndex + \brief The value of the SystemDataIdIndex + */ + int m_SystemDataIdIndex{0}; -private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("account"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_AccountIdIndex - \brief The value of the AccountIdIndex - */ - int m_AccountIdIndex{ 0 }; - - /*! - \var int m_UserNameIndex - \brief The value of the UserNameIndex - */ - int m_UserNameIndex{ 0 }; - - /*! - \var int m_PasswordIndex; - \brief The value of the PasswordIndex - */ - int m_PasswordIndex{ 0 }; - - /*! - \var int m_SystemDataIdIndex - \brief The value of the SystemDataIdIndex - */ - int m_SystemDataIdIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/chipcard.h b/apps/libs/models/include/jmbdemodels/chipcard.h index c3b6258ba..253d94287 100644 --- a/apps/libs/models/include/jmbdemodels/chipcard.h +++ b/apps/libs/models/include/jmbdemodels/chipcard.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class ChipCard \brief The ChipDataModel class @@ -34,187 +35,213 @@ namespace Model { */ class ChipCard : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn ChipCard() - - \brief Constructor forChipCard - */ - explicit JMBDEMODELS_EXPORT ChipCard(); - - /*! - \fn ~ChipCard() override - - \brief Destructor for the ChipCard - */ - JMBDEMODELS_EXPORT ~ChipCard() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int ChipCardIdIndex() - - \brief Get the index of the fieldname ChipCardId from the database + /*! + \fn ChipCard() - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getChipCardIdIndex() const -> int { return m_ChipCardIdIndex; } - - /*! - \fn int NumberIndex() - - \brief Get the index of the fieldname Number from the database - - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getNumberIndex() const -> int { return m_NumberIndex; } - - /*! - \fn int ChipCardDoorIdIndex() - - \brief Get the index of the fieldname ChipCardDoorId from the database - - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getChipCardDoorIdIndex() const -> int { return m_ChipCardDoorIdIndex; } - - /*! - \fn int ChipCardProfileIdIndex() - - \brief Get the index of the fieldname ChipCardProfileId from the - database - - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getChipCardProfileIdIndex() const -> int { return m_ChipCardProfileIdIndex; } - - /*! - \fn int EmployeeIdIndex() - - \brief Get the index of the fieldname EmployeeId from the database - - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getEmployeeIdIndex() const -> int { return m_EmployeeIdIndex; } - - /*! - \fn int LastUpdateIndex() - - \brief Get the index of the fieldname LastUpdate form the database - - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getLastUpdateIndex() const -> int { return m_LastUpdateIndex; } + \brief Constructor forChipCard + */ + explicit JMBDEMODELS_EXPORT ChipCard(); + + /*! + \fn ~ChipCard() override + + \brief Destructor for the ChipCard + */ + JMBDEMODELS_EXPORT ~ChipCard() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int ChipCardIdIndex() + + \brief Get the index of the fieldname ChipCardId from the database + + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getChipCardIdIndex() const -> int + { + return m_ChipCardIdIndex; + } + + /*! + \fn int NumberIndex() + + \brief Get the index of the fieldname Number from the database + + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getNumberIndex() const -> int + { + return m_NumberIndex; + } + + /*! + \fn int ChipCardDoorIdIndex() + + \brief Get the index of the fieldname ChipCardDoorId from the database + + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getChipCardDoorIdIndex() const -> int + { + return m_ChipCardDoorIdIndex; + } + + /*! + \fn int ChipCardProfileIdIndex() + + \brief Get the index of the fieldname ChipCardProfileId from the + database + + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getChipCardProfileIdIndex() const -> int + { + return m_ChipCardProfileIdIndex; + } + + /*! + \fn int EmployeeIdIndex() + + \brief Get the index of the fieldname EmployeeId from the database + + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getEmployeeIdIndex() const -> int + { + return m_EmployeeIdIndex; + } + + /*! + \fn int LastUpdateIndex() + + \brief Get the index of the fieldname LastUpdate form the database + + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getLastUpdateIndex() const -> int + { + return m_LastUpdateIndex; + } private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("chip_card"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \brief The value of the ChipCardIdIndex - */ - int m_ChipCardIdIndex{ 0 }; - - /*! - \brief The value of the NumberIndex - */ - int m_NumberIndex{ 0 }; - - /*! - \brief The value of the ChipCardDoorIdIndex - */ - int m_ChipCardDoorIdIndex{ 0 }; - - /*! - \brief The value of the hipCardProfileIdIndex - */ - int m_ChipCardProfileIdIndex{ 0 }; - - /*! - \brief The value of the EmployeeIdIndex - */ - int m_EmployeeIdIndex{ 0 }; - - /*! - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("chip_card"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \brief The value of the ChipCardIdIndex + */ + int m_ChipCardIdIndex{0}; + + /*! + \brief The value of the NumberIndex + */ + int m_NumberIndex{0}; + + /*! + \brief The value of the ChipCardDoorIdIndex + */ + int m_ChipCardDoorIdIndex{0}; + + /*! + \brief The value of the hipCardProfileIdIndex + */ + int m_ChipCardProfileIdIndex{0}; + + /*! + \brief The value of the EmployeeIdIndex + */ + int m_EmployeeIdIndex{0}; + + /*! + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/chipcarddoor.h b/apps/libs/models/include/jmbdemodels/chipcarddoor.h index a448f9ecf..0f5bcf931 100644 --- a/apps/libs/models/include/jmbdemodels/chipcarddoor.h +++ b/apps/libs/models/include/jmbdemodels/chipcarddoor.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class ChipCardDoor \brief The ChipCardDoor class @@ -34,186 +35,212 @@ namespace Model { */ class ChipCardDoor : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn ChipCardDoor() - - \brief Constructor for the ChipCardDoor - \param parent The pointer to the parent Object - */ - explicit JMBDEMODELS_EXPORT ChipCardDoor(); - - /*! - * \fn ~ChipCardDoor() override; - * - * \brief Destructor for ChipCardDoor - */ - JMBDEMODELS_EXPORT ~ChipCardDoor() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int ChipCardDoorIdIndex() - - \brief Get the index of the fieldname ChipCardDoorId from the database - - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getChipCardDoorIdIndex() const -> int { return m_ChipCardDoorIdIndex; } - - /*! - \fn int NumberIndex() - - \brief Get the index of the fieldname Number form the database - - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getNumberIndex() const -> int { return m_NumberIndex; } - - /*! - \fn int PlaceIdIndex() - - \brief Get the index of the fieldname PlaceId form the database - - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getPlaceIdIndex() const -> int { return m_PlaceIdIndex; } - - /*! - \fn int DepartmetIdIndex() - - \brief Get the index of the fieldname DepartmetId form the database - - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getDepartmentIdIndex() const -> int { return m_DepartmetIdIndex; } - - /*! - \fn int EmployeeIdIndex() - - \brief Get the index of the fieldname EmployeeIdform the database - - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getEmployeeIdIndex() const -> int { return m_EmployeeIdIndex; } + /*! + \fn ChipCardDoor() + + \brief Constructor for the ChipCardDoor + \param parent The pointer to the parent Object + */ + explicit JMBDEMODELS_EXPORT ChipCardDoor(); + + /*! + * \fn ~ChipCardDoor() override; + * + * \brief Destructor for ChipCardDoor + */ + JMBDEMODELS_EXPORT ~ChipCardDoor() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int ChipCardDoorIdIndex() + + \brief Get the index of the fieldname ChipCardDoorId from the database + + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getChipCardDoorIdIndex() const -> int + { + return m_ChipCardDoorIdIndex; + } + + /*! + \fn int NumberIndex() + + \brief Get the index of the fieldname Number form the database + + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getNumberIndex() const -> int + { + return m_NumberIndex; + } + + /*! + \fn int PlaceIdIndex() + + \brief Get the index of the fieldname PlaceId form the database + + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getPlaceIdIndex() const -> int + { + return m_PlaceIdIndex; + } + + /*! + \fn int DepartmetIdIndex() + + \brief Get the index of the fieldname DepartmetId form the database + + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getDepartmentIdIndex() const -> int + { + return m_DepartmetIdIndex; + } + + /*! + \fn int EmployeeIdIndex() + + \brief Get the index of the fieldname EmployeeIdform the database + + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getEmployeeIdIndex() const -> int + { + return m_EmployeeIdIndex; + } - /*! - \fn int LastUpdateIndex() + /*! + \fn int LastUpdateIndex() - \brief Get the index of the fieldname LastUpdate form the database + \brief Get the index of the fieldname LastUpdate form the database - \return the value of the index - */ - JMBDEMODELS_EXPORT auto getLastUpdateIndex() const -> int { return m_LastUpdateIndex; } + \return the value of the index + */ + JMBDEMODELS_EXPORT auto getLastUpdateIndex() const -> int + { + return m_LastUpdateIndex; + } private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("chip_card_door"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \brief The value of the ChipCardDoorIdIndex - */ - int m_ChipCardDoorIdIndex{ 0 }; - - /*! - \brief The value of the NumberIndex - */ - int m_NumberIndex{ 0 }; + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("chip_card_door"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \brief The value of the ChipCardDoorIdIndex + */ + int m_ChipCardDoorIdIndex{0}; - /*! - \brief The value of the PlaceIdIndex - */ - int m_PlaceIdIndex{ 0 }; + /*! + \brief The value of the NumberIndex + */ + int m_NumberIndex{0}; - /*! - \brief The value of the DepartmetIdIndex - */ - int m_DepartmetIdIndex{ 0 }; + /*! + \brief The value of the PlaceIdIndex + */ + int m_PlaceIdIndex{0}; - /*! - \brief The value of the EmployeeIdIndex -*/ - int m_EmployeeIdIndex{ 0 }; + /*! + \brief The value of the DepartmetIdIndex + */ + int m_DepartmetIdIndex{0}; - /*! - \brief The value of the LastUpdateIndex + /*! + \brief The value of the EmployeeIdIndex */ - int m_LastUpdateIndex{ 0 }; + int m_EmployeeIdIndex{0}; + + /*! + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/chipcardprofile.h b/apps/libs/models/include/jmbdemodels/chipcardprofile.h index 72c56e247..d0c3f67da 100644 --- a/apps/libs/models/include/jmbdemodels/chipcardprofile.h +++ b/apps/libs/models/include/jmbdemodels/chipcardprofile.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class ChipCardProfile \brief The ChipCardProfile class @@ -34,178 +35,201 @@ namespace Model { */ class ChipCardProfile : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn ChipCardProfile() - - \brief The Constructor for the ChipCardProfile - */ - explicit JMBDEMODELS_EXPORT ChipCardProfile(); - - /*! - \fn ~ChipCardProfile() - - \brief The destructor for the ChipCardProfile() - */ - JMBDEMODELS_EXPORT ~ChipCardProfile() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int ChipCardProfileIdIndex() - - \brief Get the index of the fieldname ChipCardProfileId form the - database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getChipCardProfileIdIndex() const { return m_ChipCardProfileIdIndex; } - - /*! - \fn int NumberIndex() - - \brief Get the index of the fieldname Number form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNumberIndex() const { return m_NumberIndex; } - - /*! - \fn int ChipCardDoorIdIndex() - - \brief Get the index of the fieldname ChipCardDoorId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getChipCardDoorIdIndex() const { return m_ChipCardDoorIdIndex; } - - /*! - \fn int EmployeeIdIndex() - - \brief Get the index of the fieldname EmployeeIdIndex() form the - database + /*! + \fn ChipCardProfile() + + \brief The Constructor for the ChipCardProfile + */ + explicit JMBDEMODELS_EXPORT ChipCardProfile(); + + /*! + \fn ~ChipCardProfile() + + \brief The destructor for the ChipCardProfile() + */ + JMBDEMODELS_EXPORT ~ChipCardProfile() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int ChipCardProfileIdIndex() + + \brief Get the index of the fieldname ChipCardProfileId form the + database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getChipCardProfileIdIndex() const + { + return m_ChipCardProfileIdIndex; + } + + /*! + \fn int NumberIndex() + + \brief Get the index of the fieldname Number form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNumberIndex() const + { + return m_NumberIndex; + } + + /*! + \fn int ChipCardDoorIdIndex() + + \brief Get the index of the fieldname ChipCardDoorId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getChipCardDoorIdIndex() const + { + return m_ChipCardDoorIdIndex; + } + + /*! + \fn int EmployeeIdIndex() + + \brief Get the index of the fieldname EmployeeIdIndex() form the + database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getEmployeeIdIndex() const + { + return m_EmployeeIdIndex; + } + + /*! + \fn int LastUpdateIndex() + + \brief Get the index of the fieldname LastUpdate form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getEmployeeIdIndex() const { return m_EmployeeIdIndex; } +private: + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("chip_card_profile"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_ChipCardProfileIdIndex + \brief The value of the ChipCardProfileIdIndex + */ + int m_ChipCardProfileIdIndex{0}; ///< int m_ChipCardProfileIdIndex - /*! - \fn int LastUpdateIndex() + /*! + \var int m_NumberIndex + \brief The value of the NumberIndex + */ + int m_NumberIndex{0}; ///< int m_NumberIndex - \brief Get the index of the fieldname LastUpdate form the database + /*! + \var int m_ChipCardDoorIdIndex + \brief The value of the ChipCardDoorIdIndex + */ + int m_ChipCardDoorIdIndex{0}; ///< int m_ChipCardDoorIdIndex - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \var int m_EmployeeIdIndex + \brief The value of the EmployeeIdIndex + */ + int m_EmployeeIdIndex{0}; ///< int m_EmployeeIdIndex -private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("chip_card_profile"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_ChipCardProfileIdIndex - \brief The value of the ChipCardProfileIdIndex - */ - int m_ChipCardProfileIdIndex{ 0 };///< int m_ChipCardProfileIdIndex - - /*! - \var int m_NumberIndex - \brief The value of the NumberIndex - */ - int m_NumberIndex{ 0 };///< int m_NumberIndex - - /*! - \var int m_ChipCardDoorIdIndex - \brief The value of the ChipCardDoorIdIndex - */ - int m_ChipCardDoorIdIndex{ 0 };///< int m_ChipCardDoorIdIndex - - /*! - \var int m_EmployeeIdIndex - \brief The value of the EmployeeIdIndex - */ - int m_EmployeeIdIndex{ 0 };///< int m_EmployeeIdIndex - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 };///< int m_LastUpdateIndex + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; ///< int m_LastUpdateIndex }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/chipcardprofiledoor.h b/apps/libs/models/include/jmbdemodels/chipcardprofiledoor.h index bee4d2216..b1004c218 100644 --- a/apps/libs/models/include/jmbdemodels/chipcardprofiledoor.h +++ b/apps/libs/models/include/jmbdemodels/chipcardprofiledoor.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class ChipCardProfileDoor \brief The ChipCardProfileDoor class @@ -35,159 +36,179 @@ namespace Model { */ class ChipCardProfileDoor : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn ChipCardProfileDoor() - - \brief Constructor for the ChipCardProfileDoor - */ - explicit JMBDEMODELS_EXPORT ChipCardProfileDoor(); - - /*! - * \fn ~ChipCardProfileDoor() override; - * - * \brief Destructor for ChipCardProfileDoor - */ - JMBDEMODELS_EXPORT ~ChipCardProfileDoor() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int ChipCardProfileDoorIdIndex() - - \brief Get the index of the fieldname ChipCardProfileDoorId form the - database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getChipCardProfileDoorIdIndex() const { return m_ChipCardProfileDoorIdIndex; } - - /*! - \fn int ChipCardProfileIdIndex() - - \brief Get the index of the fieldname ChipCardProfileId form the - database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getChipCardProfileIdIndex() const { return m_ChipCardProfileIdIndex; } - - /*! - \fn int ChipCardDoorsIdIndex() - - \brief Get the index of the fieldname ChipCardDoorsId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getChipCardDoorsIdIndex() const { return m_ChipCardDoorsIdIndex; } - - /*! - \fn int LastUpdateIndex() - - \brief Get the index of the fieldname LastUpdate form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \fn ChipCardProfileDoor() + + \brief Constructor for the ChipCardProfileDoor + */ + explicit JMBDEMODELS_EXPORT ChipCardProfileDoor(); + + /*! + * \fn ~ChipCardProfileDoor() override; + * + * \brief Destructor for ChipCardProfileDoor + */ + JMBDEMODELS_EXPORT ~ChipCardProfileDoor() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int ChipCardProfileDoorIdIndex() + + \brief Get the index of the fieldname ChipCardProfileDoorId form the + database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getChipCardProfileDoorIdIndex() const + { + return m_ChipCardProfileDoorIdIndex; + } + + /*! + \fn int ChipCardProfileIdIndex() + + \brief Get the index of the fieldname ChipCardProfileId form the + database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getChipCardProfileIdIndex() const + { + return m_ChipCardProfileIdIndex; + } + + /*! + \fn int ChipCardDoorsIdIndex() + + \brief Get the index of the fieldname ChipCardDoorsId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getChipCardDoorsIdIndex() const + { + return m_ChipCardDoorsIdIndex; + } + + /*! + \fn int LastUpdateIndex() + + \brief Get the index of the fieldname LastUpdate form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("chip_card_profile_door"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \brief The value of the ChipCardProfileDoorIdIndex - */ - int m_ChipCardProfileDoorIdIndex{ 0 }; - - /*! - \brief The value of the ChipCardProfileIdIndex - */ - int m_ChipCardProfileIdIndex{ 0 }; - - /*! - \brief The value of the ChipCardDoorsIdIndex - */ - int m_ChipCardDoorsIdIndex{ 0 }; - - /*! - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("chip_card_profile_door"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \brief The value of the ChipCardProfileDoorIdIndex + */ + int m_ChipCardProfileDoorIdIndex{0}; + + /*! + \brief The value of the ChipCardProfileIdIndex + */ + int m_ChipCardProfileIdIndex{0}; + + /*! + \brief The value of the ChipCardDoorsIdIndex + */ + int m_ChipCardDoorsIdIndex{0}; + + /*! + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/cityname.h b/apps/libs/models/include/jmbdemodels/cityname.h index 8e82d8f64..0b0e98c3e 100644 --- a/apps/libs/models/include/jmbdemodels/cityname.h +++ b/apps/libs/models/include/jmbdemodels/cityname.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class CityName \brief The CityName class. Handle the City Names @@ -34,143 +35,160 @@ namespace Model { */ class CityName : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn CityName() - - \brief The Constructor of the CityName - */ - explicit JMBDEMODELS_EXPORT CityName(); - - /*! - * \fn ~CityName() override - * - * \brief Destructor for CityName - */ - JMBDEMODELS_EXPORT ~CityName() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int CityNameIdIndex() - - \brief Get the index of the fieldname CityNameId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getCityNameIdIndex() const { return m_CityNameIdIndex; } - - /*! - \fn int NameIndex() - - \brief Get the index of the fieldname Name form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNameIndex() const { return m_NameIndex; } - - /*! - \fn int LastUpdateIndex() - - \brief Get the index of the fieldname LastUpdate form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \fn CityName() + + \brief The Constructor of the CityName + */ + explicit JMBDEMODELS_EXPORT CityName(); + + /*! + * \fn ~CityName() override + * + * \brief Destructor for CityName + */ + JMBDEMODELS_EXPORT ~CityName() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int CityNameIdIndex() + + \brief Get the index of the fieldname CityNameId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getCityNameIdIndex() const + { + return m_CityNameIdIndex; + } + + /*! + \fn int NameIndex() + + \brief Get the index of the fieldname Name form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNameIndex() const + { + return m_NameIndex; + } + + /*! + \fn int LastUpdateIndex() + + \brief Get the index of the fieldname LastUpdate form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("city_name"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \brief The value of the CityNameIdIndex - */ - int m_CityNameIdIndex{ 0 }; - - /*! - \brief The value of the NameIndex - */ - int m_NameIndex{ 0 }; - - /*! - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("city_name"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \brief The value of the CityNameIdIndex + */ + int m_CityNameIdIndex{0}; + + /*! + \brief The value of the NameIndex + */ + int m_NameIndex{0}; + + /*! + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/commondata.h b/apps/libs/models/include/jmbdemodels/commondata.h index 8ba743240..40226e1c3 100644 --- a/apps/libs/models/include/jmbdemodels/commondata.h +++ b/apps/libs/models/include/jmbdemodels/commondata.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class CommonData @@ -36,138 +37,153 @@ namespace Model { class CommonData : public QAbstractTableModel { - Q_OBJECT + Q_OBJECT public: - /*! - \fn CommonData() - \brief The Constructor for the CommonData - */ - explicit JMBDEMODELS_EXPORT CommonData() : m_model(nullptr), m_selectionModel(nullptr) {} - - /*! - \fn ~CommonData() - - \brief the Destructor for the CommonData - */ - virtual JMBDEMODELS_EXPORT ~CommonData() {} - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() = 0; - - /*! - \fn virtual QSqlRelationalTableModel *initializeRelationalModel() final - \brief set the QSqlRelationalTableModel for the DataModel - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * = 0; - - /*! - \fn virtual QSqlRelationalTableModel *initializeInputDataModel() final - \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * = 0; - - /*! - \fn virtual QSqlTableModel *initializeViewModel() final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * = 0; - - /*! - \fn QSqlTableModel *initializeListModel(); - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * = 0; - - /*! - * \fn virtual auto generateTableString( - const QString &header) final - \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString = 0; - - /*! - \fn virtual auto generateFormularString( - const QString &header) final - \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString = 0; - - /*! - \fn QTextDocument *createSheet() - \brief Create a TextDocument for the Output to the Printer - - Returns The Pointer to the generated TextDocument - - \sa QTextDocument - */ - static JMBDEMODELS_EXPORT QTextDocument *createSheet(); - - /*! - \fn QString setOutTableStyle() - \brief Initialize a String with the css-style for the output table - - Returns The initialized QString - - \sa QString - */ - static JMBDEMODELS_EXPORT QString setOutTableStyle(); - - /*! - \fn QString setOutFormularStyle() - \brief Initialize a String with the css-style for the output formular - \details This is now just the Header - - Returns The initialized QString - - \sa QString - */ - static JMBDEMODELS_EXPORT QString setOutFormularStyle(); - - JMBDEMODELS_EXPORT int rowCount(const QModelIndex & = QModelIndex()) const override { return 200; } - - JMBDEMODELS_EXPORT int columnCount(const QModelIndex & = QModelIndex()) const override { return 200; } - - JMBDEMODELS_EXPORT QVariant data(const QModelIndex &index, int role) const override - { - switch (role) { - case Qt::DisplayRole: - return QString(QLatin1String("%1, %2")).arg(index.column()).arg(index.row()); - default: - break; + /*! + \fn CommonData() + \brief The Constructor for the CommonData + */ + explicit JMBDEMODELS_EXPORT CommonData() + : m_model(nullptr) + , m_selectionModel(nullptr) + { + } + + /*! + \fn ~CommonData() + + \brief the Destructor for the CommonData + */ + virtual JMBDEMODELS_EXPORT ~CommonData() + { } - return QVariant(); - } + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() = 0; + + /*! + \fn virtual QSqlRelationalTableModel *initializeRelationalModel() final + \brief set the QSqlRelationalTableModel for the DataModel + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * = 0; + + /*! + \fn virtual QSqlRelationalTableModel *initializeInputDataModel() final + \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * = 0; + + /*! + \fn virtual QSqlTableModel *initializeViewModel() final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * = 0; + + /*! + \fn QSqlTableModel *initializeListModel(); + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * = 0; + + /*! + * \fn virtual auto generateTableString( + const QString &header) final + \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString = 0; + + /*! + \fn virtual auto generateFormularString( + const QString &header) final + \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString = 0; + + /*! + \fn QTextDocument *createSheet() + \brief Create a TextDocument for the Output to the Printer + + Returns The Pointer to the generated TextDocument + + \sa QTextDocument + */ + static JMBDEMODELS_EXPORT QTextDocument *createSheet(); + + /*! + \fn QString setOutTableStyle() + \brief Initialize a String with the css-style for the output table + + Returns The initialized QString - JMBDEMODELS_EXPORT QHash roleNames() const override { return { { Qt::DisplayRole, "display" } }; } + \sa QString + */ + static JMBDEMODELS_EXPORT QString setOutTableStyle(); + + /*! + \fn QString setOutFormularStyle() + \brief Initialize a String with the css-style for the output formular + \details This is now just the Header + + Returns The initialized QString + + \sa QString + */ + static JMBDEMODELS_EXPORT QString setOutFormularStyle(); + + JMBDEMODELS_EXPORT int rowCount(const QModelIndex & = QModelIndex()) const override + { + return 200; + } + + JMBDEMODELS_EXPORT int columnCount(const QModelIndex & = QModelIndex()) const override + { + return 200; + } + + JMBDEMODELS_EXPORT QVariant data(const QModelIndex &index, int role) const override + { + switch (role) { + case Qt::DisplayRole: + return QString(QLatin1String("%1, %2")).arg(index.column()).arg(index.row()); + default: + break; + } + + return QVariant(); + } + + JMBDEMODELS_EXPORT QHash roleNames() const override + { + return {{Qt::DisplayRole, "display"}}; + } protected: - /*! - \brief holds an initialised pointer to the Relationmodel - \sa QSqlRelationalTableModel - */ - QSqlRelationalTableModel *m_model{ nullptr }; - - /*! - \brief holds an initialised pointer to the ItemSelectioModel - \sa QItemSelectionModel - */ - QItemSelectionModel *m_selectionModel{ nullptr }; + /*! + \brief holds an initialised pointer to the Relationmodel + \sa QSqlRelationalTableModel + */ + QSqlRelationalTableModel *m_model{nullptr}; + + /*! + \brief holds an initialised pointer to the ItemSelectioModel + \sa QItemSelectionModel + */ + QItemSelectionModel *m_selectionModel{nullptr}; private: - int m_LastUpdateIndex{ 0 }; + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/company.h b/apps/libs/models/include/jmbdemodels/company.h index 82e38ec98..e008357af 100644 --- a/apps/libs/models/include/jmbdemodels/company.h +++ b/apps/libs/models/include/jmbdemodels/company.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class Company \brief The Companyl class @@ -35,229 +36,276 @@ namespace Model { class Company : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn Company() - - \brief Constructor for the Company - */ - explicit JMBDEMODELS_EXPORT Company(); - - /*! - * \fn ~Company() override; - * - * \brief Destructor for Company() - */ - JMBDEMODELS_EXPORT ~Company() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int getCompanyIdIndex() - - \brief Get the index of the fieldname CompanyId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getCompanyIdIndex() const { return m_CompanyIdIndex; } - - /*! - \fn int getNameIndex() - - \brief Get the index of the fieldname Name form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNameIndex() const { return m_NameIndex; } - - /*! - \fn int getName2Index() - - \brief Get the index of the fieldname Name2 form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getName2Index() const { return m_Name2Index; } - - /*! - \fn int getStreetIndex() - - \brief Get the index of the fieldname Street form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getStreetIndex() const { return m_StreetIndex; } - - /*! - \fn int getCityIndex() - - \brief Get the index of the fieldname City form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getCityIndex() const { return m_CityIndex; } + /*! + \fn Company() + + \brief Constructor for the Company + */ + explicit JMBDEMODELS_EXPORT Company(); + + /*! + * \fn ~Company() override; + * + * \brief Destructor for Company() + */ + JMBDEMODELS_EXPORT ~Company() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int getCompanyIdIndex() + + \brief Get the index of the fieldname CompanyId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getCompanyIdIndex() const + { + return m_CompanyIdIndex; + } + + /*! + \fn int getNameIndex() + + \brief Get the index of the fieldname Name form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNameIndex() const + { + return m_NameIndex; + } + + /*! + \fn int getName2Index() + + \brief Get the index of the fieldname Name2 form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getName2Index() const + { + return m_Name2Index; + } + + /*! + \fn int getStreetIndex() + + \brief Get the index of the fieldname Street form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getStreetIndex() const + { + return m_StreetIndex; + } + + /*! + \fn int getCityIndex() + + \brief Get the index of the fieldname City form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getCityIndex() const + { + return m_CityIndex; + } - /*! - \fn int getZipCodeIndex() + /*! + \fn int getZipCodeIndex() - \brief Get the index of the fieldname ZipCode form the database + \brief Get the index of the fieldname ZipCode form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getZipCodeIndex() const { return m_ZipCodeIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getZipCodeIndex() const + { + return m_ZipCodeIndex; + } - /*! - \fn int getPhoneNumberIndex() + /*! + \fn int getPhoneNumberIndex() - \brief Get the index of the fieldname PhoneNumber form the database + \brief Get the index of the fieldname PhoneNumber form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPhoneNumberIndex() const { return m_PhoneNumberIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPhoneNumberIndex() const + { + return m_PhoneNumberIndex; + } - /*! - \fn int getFaxNumberIndex() + /*! + \fn int getFaxNumberIndex() - \brief Get the index of the fieldname FaxNumber form the database + \brief Get the index of the fieldname FaxNumber form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getFaxNumberIndex() const { return m_FaxNumberIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getFaxNumberIndex() const + { + return m_FaxNumberIndex; + } - /*! - \fn int getMobileNumberIndex() + /*! + \fn int getMobileNumberIndex() - \brief Get the index of the fieldname FaxNumber form the database + \brief Get the index of the fieldname FaxNumber form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getMobileNumberIndex() const { return m_MobileNumberIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getMobileNumberIndex() const + { + return m_MobileNumberIndex; + } - /*! - \fn int getMailAddressIndex() + /*! + \fn int getMailAddressIndex() - \brief Get the index of the fieldname MailAddress form the database + \brief Get the index of the fieldname MailAddress form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getMailAddressIndex() const { return m_MailAddressIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getMailAddressIndex() const + { + return m_MailAddressIndex; + } - /*! - \fn int getActiveIndex() + /*! + \fn int getActiveIndex() - \brief Get the index of the fieldname Active form the database + \brief Get the index of the fieldname Active form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getActiveIndex() const { return m_ActiveIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getActiveIndex() const + { + return m_ActiveIndex; + } - /*! - \fn int getEmployeeIdIndex() + /*! + \fn int getEmployeeIdIndex() - \brief Get the index of the fieldname EmployeeId form the database + \brief Get the index of the fieldname EmployeeId form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getEmployeeIdIndex() const { return m_EmployeeIdIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getEmployeeIdIndex() const + { + return m_EmployeeIdIndex; + } - /*! - \fn int getLastUpdateIndex() + /*! + \fn int getLastUpdateIndex() - \brief Get the index of the fieldname LastUpdate form the database + \brief Get the index of the fieldname LastUpdate form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } private: - const QString m_tableName = QLatin1String("company");///< QString m_tableName - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - int m_CompanyIdIndex{ 0 };///< int CompanyIdIndex - int m_NameIndex{ 0 };///< int NameIndex - int m_Name2Index{ 0 };///< int Name2Index - int m_StreetIndex{ 0 };///< int m_StreetIndex - int m_CityIndex{ 0 };///< int CityIndex - int m_ZipCodeIndex{ 0 };///< int ZipCodeIndex - int m_PhoneNumberIndex{ 0 };///< int PhoneNumberIndex - int m_FaxNumberIndex{ 0 };///< int FaxNumberIndex - int m_MobileNumberIndex{ 0 };///< int MobileNumberIndex - int m_MailAddressIndex{ 0 };///< int MailAddressIndex - int m_ActiveIndex{ 0 };///< int ActiveIndex - int m_EmployeeIdIndex{ 0 };///< int EmployeeIdIndex - int m_LastUpdateIndex{ 0 };///< int LastUpdateIndex + const QString m_tableName = QLatin1String("company"); ///< QString m_tableName + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + int m_CompanyIdIndex{0}; ///< int CompanyIdIndex + int m_NameIndex{0}; ///< int NameIndex + int m_Name2Index{0}; ///< int Name2Index + int m_StreetIndex{0}; ///< int m_StreetIndex + int m_CityIndex{0}; ///< int CityIndex + int m_ZipCodeIndex{0}; ///< int ZipCodeIndex + int m_PhoneNumberIndex{0}; ///< int PhoneNumberIndex + int m_FaxNumberIndex{0}; ///< int FaxNumberIndex + int m_MobileNumberIndex{0}; ///< int MobileNumberIndex + int m_MailAddressIndex{0}; ///< int MailAddressIndex + int m_ActiveIndex{0}; ///< int ActiveIndex + int m_EmployeeIdIndex{0}; ///< int EmployeeIdIndex + int m_LastUpdateIndex{0}; ///< int LastUpdateIndex }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/computer.h b/apps/libs/models/include/jmbdemodels/computer.h index d1eb32402..8a1087106 100644 --- a/apps/libs/models/include/jmbdemodels/computer.h +++ b/apps/libs/models/include/jmbdemodels/computer.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class Computer \brief The Computer class @@ -34,438 +35,515 @@ namespace Model { */ class Computer : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn Computer() - - \brief Constructor for the Account - */ - explicit JMBDEMODELS_EXPORT Computer(); - /*! - \fn ~Computer() override; - - \brief Destructor for Computer - */ - JMBDEMODELS_EXPORT ~Computer() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int getComputerIdIndex() - - \brief Get the index of the fieldname ComputerId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getComputerIdIndex() const { return m_ComputerIdIndex; } - - /*! - \fn int getDeviceNameIdIndex() - - \brief Get the index of the fieldname DeviceNameId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDeviceNameIdIndex() const { return m_DeviceNameIdIndex; } - - /*! - \fn int getSerialNumberIndex() - - \brief Get the index of the fieldname SerialNumber form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getSerialNumberIndex() const { return m_SerialNumberIndex; } + /*! + \fn Computer() + + \brief Constructor for the Account + */ + explicit JMBDEMODELS_EXPORT Computer(); + /*! + \fn ~Computer() override; + + \brief Destructor for Computer + */ + JMBDEMODELS_EXPORT ~Computer() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int getComputerIdIndex() + + \brief Get the index of the fieldname ComputerId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getComputerIdIndex() const + { + return m_ComputerIdIndex; + } + + /*! + \fn int getDeviceNameIdIndex() + + \brief Get the index of the fieldname DeviceNameId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDeviceNameIdIndex() const + { + return m_DeviceNameIdIndex; + } + + /*! + \fn int getSerialNumberIndex() + + \brief Get the index of the fieldname SerialNumber form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getSerialNumberIndex() const + { + return m_SerialNumberIndex; + } + + /*! + \fn int getServiceTagIndex() + + \brief Get the index of the fieldname ServiceTag form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getServiceTagIndex() const + { + return m_ServiceTagIndex; + } - /*! - \fn int getServiceTagIndex() + /*! + \fn int getServiceNumberIndex() - \brief Get the index of the fieldname ServiceTag form the database + \brief Get the index of the fieldname ServiceNumber form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getServiceTagIndex() const { return m_ServiceTagIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getServiceNumberIndex() const + { + return m_ServiceNumberIndex; + } - /*! - \fn int getServiceNumberIndex() + /*! + \fn int getMemoryIndex() - \brief Get the index of the fieldname ServiceNumber form the database + \brief Get the index of the fieldname Memory form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getServiceNumberIndex() const { return m_ServiceNumberIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getMemoryIndex() const + { + return m_MemoryIndex; + } - /*! - \fn int getMemoryIndex() + /*! + \fn int getNetworkIndex() - \brief Get the index of the fieldname Memory form the database + \brief Get the index of the fieldname Network form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getMemoryIndex() const { return m_MemoryIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNetworkIndex() const + { + return m_NetworkIndex; + } - /*! - \fn int getNetworkIndex() + /*! + \fn int getNetworkNameIndex() - \brief Get the index of the fieldname Network form the database + \brief Get the index of the fieldname Network_Name from the database + */ + JMBDEMODELS_EXPORT int getNetworkNameIndex() const + { + return m_NetworkNameIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNetworkIndex() const { return m_NetworkIndex; } + /*! + \fn int getNetworkIPAddressIndex() - /*! - \fn int getNetworkNameIndex() + \brief Get the index of the fieldname network_ip_address from the database + */ + JMBDEMODELS_EXPORT int getNetworkIPAddressIndex() const + { + return m_NetworkIPAddressIndex; + } - \brief Get the index of the fieldname Network_Name from the database - */ - JMBDEMODELS_EXPORT int getNetworkNameIndex() const { return m_NetworkNameIndex; } + JMBDEMODELS_EXPORT int getNetworkIpAddressIndex() const + { + return m_NetworkIpAddressIndex; + } - /*! - \fn int getNetworkIPAddressIndex() + /*! + \fn int getActiveIndex() - \brief Get the index of the fieldname network_ip_address from the database - */ - JMBDEMODELS_EXPORT int getNetworkIPAddressIndex() const { return m_NetworkIPAddressIndex; } + \brief Get the index of the fieldname Active form the database - JMBDEMODELS_EXPORT int getNetworkIpAddressIndex() const { return m_NetworkIpAddressIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getActiveIndex() const + { + return m_ActiveIndex; + } - /*! - \fn int getActiveIndex() + /*! + \fn int getReplaceIndex() - \brief Get the index of the fieldname Active form the database + \brief Get the index of the fieldname Replace form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getActiveIndex() const { return m_ActiveIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getReplaceIndex() const + { + return m_ReplaceIndex; + } - /*! - \fn int getReplaceIndex() + /*! + \fn int getDeviceTypeIdIndex() - \brief Get the index of the fieldname Replace form the database + \brief Get the index of the fieldname DeviceTypeId form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getReplaceIndex() const { return m_ReplaceIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDeviceTypeIdIndex() const + { + return m_DeviceTypeIdIndex; + } - /*! - \fn int getDeviceTypeIdIndex() + /*! + \fn int getEmployeeIdIndex() - \brief Get the index of the fieldname DeviceTypeId form the database + \brief Get the index of the fieldname EmployeeId form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDeviceTypeIdIndex() const { return m_DeviceTypeIdIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getEmployeeIdIndex() const + { + return m_EmployeeIdIndex; + } - /*! - \fn int getEmployeeIdIndex() + /*! + \fn int getPlaceIdIndex() - \brief Get the index of the fieldname EmployeeId form the database + \brief Get the index of the fieldname PlaceId form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getEmployeeIdIndex() const { return m_EmployeeIdIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPlaceIdIndex() const + { + return m_PlaceIdIndex; + } - /*! - \fn int getPlaceIdIndex() + /*! + \fn int getDepartmentIdIndex() - \brief Get the index of the fieldname PlaceId form the database + \brief Get the index of the fieldname DepartmentId form the database Returns the value of the index */ - JMBDEMODELS_EXPORT int getPlaceIdIndex() const { return m_PlaceIdIndex; } + JMBDEMODELS_EXPORT int getDepartmentIdIndex() const + { + return m_DepartmentIdIndex; + } - /*! - \fn int getDepartmentIdIndex() + /*! + \fn int getManufacturerIdIndex() - \brief Get the index of the fieldname DepartmentId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDepartmentIdIndex() const { return m_DepartmentIdIndex; } + \brief Get the index of the fieldname ManufacturerId form the database - /*! - \fn int getManufacturerIdIndex() + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getManufacturerIdIndex() const + { + return m_ManufacturerIdIndex; + } - \brief Get the index of the fieldname ManufacturerId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getManufacturerIdIndex() const { return m_ManufacturerIdIndex; } + /*! + \fn int getInventoryIdIndex() - /*! - \fn int getInventoryIdIndex() + \brief Get the index of the fieldname InventoryId form the database - \brief Get the index of the fieldname InventoryId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getInventoryIdIndex() const + { + return m_InventoryIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getInventoryIdIndex() const { return m_InventoryIdIndex; } + /*! + \fn int getProcessorIdIndex() - /*! - \fn int getProcessorIdIndex() + \brief Get the index of the fieldname ProcessorId form the database - \brief Get the index of the fieldname ProcessorId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getProcessorIdIndex() const + { + return m_ProcessorIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getProcessorIdIndex() const { return m_ProcessorIdIndex; } + /*! + \fn int getOSIdIndex() - /*! - \fn int getOSIdIndex() + \brief Get the index of the fieldname OSId form the database - \brief Get the index of the fieldname OSId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getOSIdIndex() const + { + return m_OSIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getOSIdIndex() const { return m_OSIdIndex; } + /*! + \fn int getComputerSoftwareIdIndex() - /*! - \fn int getComputerSoftwareIdIndex() + \brief Get the index of the fieldname ComputerSoftwareId form the + database - \brief Get the index of the fieldname ComputerSoftwareId form the - database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getComputerSoftwareIdIndex() const + { + return m_ComputerSoftwareIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getComputerSoftwareIdIndex() const { return m_ComputerSoftwareIdIndex; } + /*! + \fn int getPrinterIdIndex() - /*! - \fn int getPrinterIdIndex() + \brief Get the index of the fieldname PrinterId form the database - \brief Get the index of the fieldname PrinterId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPrinterIdIndex() const { return m_PrinterIdIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPrinterIdIndex() const + { + return m_PrinterIdIndex; + } - /*! - \fn int getLastUpdateIndex() + /*! + \fn int getLastUpdateIndex() - \brief Get the index of the fieldname LastUpdate form the database + \brief Get the index of the fieldname LastUpdate form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("computer"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_ComputerIdIndex - \brief The value of the ComputerIdIndex - */ - int m_ComputerIdIndex{ 0 }; - - /*! - \var int m_NameIndex - \brief The value of the NameIndex - */ - int m_NameIndex{ 0 }; - - /*! - \var int m_Name - \brief The value of the NameIndex - */ - int m_SerialNumberIndex{ 0 }; - - /*! - \var int m_ServiceTagIndex - \brief The value of the ServiceTagIndex - */ - int m_ServiceTagIndex{ 0 }; - - /*! - \var int m_ServiceNumberIndex - \brief The value of the ServiceNumberIndex - */ - int m_ServiceNumberIndex{ 0 }; - - /*! - \var int m_MemoryIndex - \brief The value of the NameIndex - */ - int m_MemoryIndex{ 0 }; - - /*! - \var nt m_NetworkIndex - \brief The value of the NetworkIndex - */ - int m_NetworkIndex{ 0 }; - - /*! - \var nt m_NetworkNameIndex - \brief The value of the NetworkIndex - */ - int m_NetworkNameIndex{ 0 }; - - /*! - \var nt m_NetworkIPAddressIndex - \brief The value of the NetworkIPAddressIndex - */ - int m_NetworkIPAddressIndex{ 0 }; - - int m_NetworkIpAddressIndex{ 0 }; - - /*! - \var int m_ActiveIndex - \brief The value of the ActiveIndex - */ - int m_ActiveIndex{ 0 }; - - /*! - \var int m_ReplaceIndex - \brief The value of the ReplaceIndex - */ - int m_ReplaceIndex{ 0 }; + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("computer"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_ComputerIdIndex + \brief The value of the ComputerIdIndex + */ + int m_ComputerIdIndex{0}; + + /*! + \var int m_NameIndex + \brief The value of the NameIndex + */ + int m_NameIndex{0}; + + /*! + \var int m_Name + \brief The value of the NameIndex + */ + int m_SerialNumberIndex{0}; - /*! - \var int m_DeviceNameIdIndex - \brief The value of the DeviceNameIdIndex - */ - int m_DeviceNameIdIndex{ 0 }; - - /*! - \var int m_DeviceTypeIdIndex - \brief The value of the DeviceTypeIdIndex - */ - int m_DeviceTypeIdIndex{ 0 }; - - /*! - \var int m_EmployeeIdIndex - \brief The value of the EmployeeIdIndexx - */ - int m_EmployeeIdIndex{ 0 }; - - /*! - \var int m_PlaceIdIndex - \brief The value of the NameIndex - */ - int m_PlaceIdIndex{ 0 }; + /*! + \var int m_ServiceTagIndex + \brief The value of the ServiceTagIndex + */ + int m_ServiceTagIndex{0}; - /*! - \var int m_DepartmentIdIndex - \brief The value of the DepartmentIdIndex - */ - int m_DepartmentIdIndex{ 0 }; + /*! + \var int m_ServiceNumberIndex + \brief The value of the ServiceNumberIndex + */ + int m_ServiceNumberIndex{0}; + + /*! + \var int m_MemoryIndex + \brief The value of the NameIndex + */ + int m_MemoryIndex{0}; + + /*! + \var nt m_NetworkIndex + \brief The value of the NetworkIndex + */ + int m_NetworkIndex{0}; + + /*! + \var nt m_NetworkNameIndex + \brief The value of the NetworkIndex + */ + int m_NetworkNameIndex{0}; + + /*! + \var nt m_NetworkIPAddressIndex + \brief The value of the NetworkIPAddressIndex + */ + int m_NetworkIPAddressIndex{0}; + + int m_NetworkIpAddressIndex{0}; + + /*! + \var int m_ActiveIndex + \brief The value of the ActiveIndex + */ + int m_ActiveIndex{0}; + + /*! + \var int m_ReplaceIndex + \brief The value of the ReplaceIndex + */ + int m_ReplaceIndex{0}; + + /*! + \var int m_DeviceNameIdIndex + \brief The value of the DeviceNameIdIndex + */ + int m_DeviceNameIdIndex{0}; + + /*! + \var int m_DeviceTypeIdIndex + \brief The value of the DeviceTypeIdIndex + */ + int m_DeviceTypeIdIndex{0}; - /*! - \var int m_ManufacturerIdIndex - \brief The value of the ManufacturerIdIndex - */ - int m_ManufacturerIdIndex{ 0 }; - - /*! - \var int m_InventoryIdIndex - \brief The value of the InventoryIdIndex - */ - int m_InventoryIdIndex{ 0 }; - - /*! - \var int m_ProcessorIdIndex - \brief The value of the ProcessorIdIndex - */ - int m_ProcessorIdIndex{ 0 }; - - /*! - \var int m_OSIdIndex - \brief The value of the OSIdIndex - */ - int m_OSIdIndex{ 0 }; - - /*! - \var int m_ComputerSoftwareIdIndex - \brief The value of the ComputerSoftwareIdIndex - */ - int m_ComputerSoftwareIdIndex{ 0 }; + /*! + \var int m_EmployeeIdIndex + \brief The value of the EmployeeIdIndexx + */ + int m_EmployeeIdIndex{0}; + + /*! + \var int m_PlaceIdIndex + \brief The value of the NameIndex + */ + int m_PlaceIdIndex{0}; + + /*! + \var int m_DepartmentIdIndex + \brief The value of the DepartmentIdIndex + */ + int m_DepartmentIdIndex{0}; + + /*! + \var int m_ManufacturerIdIndex + \brief The value of the ManufacturerIdIndex + */ + int m_ManufacturerIdIndex{0}; + + /*! + \var int m_InventoryIdIndex + \brief The value of the InventoryIdIndex + */ + int m_InventoryIdIndex{0}; - /*! - \var int m_PrinterIdIndex - \brief The value of the PrinterIdIndex - */ - int m_PrinterIdIndex{ 0 }; + /*! + \var int m_ProcessorIdIndex + \brief The value of the ProcessorIdIndex + */ + int m_ProcessorIdIndex{0}; - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \var int m_OSIdIndex + \brief The value of the OSIdIndex + */ + int m_OSIdIndex{0}; + + /*! + \var int m_ComputerSoftwareIdIndex + \brief The value of the ComputerSoftwareIdIndex + */ + int m_ComputerSoftwareIdIndex{0}; + + /*! + \var int m_PrinterIdIndex + \brief The value of the PrinterIdIndex + */ + int m_PrinterIdIndex{0}; + + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/computersoftware.h b/apps/libs/models/include/jmbdemodels/computersoftware.h index a108cf10b..5368c3a3f 100644 --- a/apps/libs/models/include/jmbdemodels/computersoftware.h +++ b/apps/libs/models/include/jmbdemodels/computersoftware.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class ComputerSoftware \brief The ComputerSoftware class @@ -35,162 +36,182 @@ namespace Model { */ class ComputerSoftware : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn ComputerSoftware() + /*! + \fn ComputerSoftware() - \brief Constructor for the ComputerSoftware - */ - explicit JMBDEMODELS_EXPORT ComputerSoftware(); + \brief Constructor for the ComputerSoftware + */ + explicit JMBDEMODELS_EXPORT ComputerSoftware(); - /*! - \fn ~ComputerSoftware() override; + /*! + \fn ~ComputerSoftware() override; - \brief Destructor for ComputerSoftware - */ - JMBDEMODELS_EXPORT ~ComputerSoftware() {} + \brief Destructor for ComputerSoftware + */ + JMBDEMODELS_EXPORT ~ComputerSoftware() + { + } - // implement the virtuals + // implement the virtuals - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } - /*! - \fn int getComputerSoftwareIdIndex() + /*! + \fn int getComputerSoftwareIdIndex() - \brief Get the index of the fieldname ComputerSoftwareId from the - database + \brief Get the index of the fieldname ComputerSoftwareId from the + database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getComputerSoftwareIdIndex() const { return m_ComputerSoftwareIdIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getComputerSoftwareIdIndex() const + { + return m_ComputerSoftwareIdIndex; + } - /*! - \fn int getComputerIdIndex() + /*! + \fn int getComputerIdIndex() - \brief Get the index of the fieldname ComputerId form the database + \brief Get the index of the fieldname ComputerId form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getComputerIdIndex() const { return m_ComputerIdIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getComputerIdIndex() const + { + return m_ComputerIdIndex; + } - /*! - \fn int getSoftwareIdIndex() + /*! + \fn int getSoftwareIdIndex() - \brief Get the index of the fieldname SoftwareId form the database + \brief Get the index of the fieldname SoftwareId form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getSoftwareIdIndex() const { return m_SoftwareIdIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getSoftwareIdIndex() const + { + return m_SoftwareIdIndex; + } - /*! - \fn int getLastUpdateIndex() + /*! + \fn int getLastUpdateIndex() - \brief Get the index of the fieldname getLastUpdate form the database + \brief Get the index of the fieldname getLastUpdate form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("computer_software"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_ComputerSoftwareIdIndex - \brief The value of the ComputerSoftwareIdIndex - */ - int m_ComputerSoftwareIdIndex{ 0 }; - - /*! - \var int m_ComputerIdIndex - \brief The value of the ComputerIdIndex - */ - int m_ComputerIdIndex{ 0 }; - - /*! - \var int m_SoftwareIdIndex - \brief The value of the SoftwareIdIndex - */ - int m_SoftwareIdIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("computer_software"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_ComputerSoftwareIdIndex + \brief The value of the ComputerSoftwareIdIndex + */ + int m_ComputerSoftwareIdIndex{0}; + + /*! + \var int m_ComputerIdIndex + \brief The value of the ComputerIdIndex + */ + int m_ComputerIdIndex{0}; + + /*! + \var int m_SoftwareIdIndex + \brief The value of the SoftwareIdIndex + */ + int m_SoftwareIdIndex{0}; + + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/datacontext.h b/apps/libs/models/include/jmbdemodels/datacontext.h index a1bf227a2..7ad694aa2 100644 --- a/apps/libs/models/include/jmbdemodels/datacontext.h +++ b/apps/libs/models/include/jmbdemodels/datacontext.h @@ -30,7 +30,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /** \class DataContext \brief The Main Database class @@ -45,239 +46,236 @@ namespace Model { */ class DataContext : public QObject { - Q_OBJECT + Q_OBJECT public: - // TODO: Add Constructor: DataContext(const QString &name, + init for mySQL - // etc.) - // TODO: Remove access of settings - - /*! - \fn DataContext(QObject *parent = nullptr) - - \brief Constructor for the DataContext - \details Constructur with a name for the database to use. - */ - explicit JMBDEMODELS_EXPORT DataContext(QObject *parent = nullptr); - - /*! - \fn DataContext( QObject *parent = nullptr, - const QString &name = QString() ); - - \brief Constructor for the DataContext - \details Constructur with a name for the database to use. - */ - explicit JMBDEMODELS_EXPORT DataContext(QObject *parent, const QString &name); - - /*! - \fn DataContext( QObject *parent = nullptr, - const QString &dbType = QString(), - const QString &name = QString(), - const QString &userName = QString(), - const QString &passWord = QString(), - const QString &hostName = QString(), - const int port = 0); - - - \brief Constructor for the DataContext - \details Constructur with a name for the database to use. - \param parent - QObject - \param name - Name of the Database - \param dbType - String for the Database Type {SQLITE, ODBC, PostgreSQL} - \param userName - Username for login in the Database Server - \param passWord - Password for login in the Database Server - \param hostName - Hostname or IP-Address from the Database Server - \param port - Port for connect to the Database Server - */ - - explicit JMBDEMODELS_EXPORT DataContext(QObject *parent, - const QString &name, - const QString &dbType, - const QString &userName, - const QString &passWord, - const QString &hostName, - const int port); - - /*! - \fn ~DataContext() override; - - \brief Destructor for DataContext() - \details Close the connection to the database. + // TODO: Add Constructor: DataContext(const QString &name, + init for mySQL + // etc.) + // TODO: Remove access of settings + + /*! + \fn DataContext(QObject *parent = nullptr) + + \brief Constructor for the DataContext + \details Constructur with a name for the database to use. + */ + explicit JMBDEMODELS_EXPORT DataContext(QObject *parent = nullptr); + + /*! + \fn DataContext( QObject *parent = nullptr, + const QString &name = QString() ); + + \brief Constructor for the DataContext + \details Constructur with a name for the database to use. */ - JMBDEMODELS_EXPORT ~DataContext(); + explicit JMBDEMODELS_EXPORT DataContext(QObject *parent, const QString &name); + + /*! + \fn DataContext( QObject *parent = nullptr, + const QString &dbType = QString(), + const QString &name = QString(), + const QString &userName = QString(), + const QString &passWord = QString(), + const QString &hostName = QString(), + const int port = 0); + + + \brief Constructor for the DataContext + \details Constructur with a name for the database to use. + \param parent - QObject + \param name - Name of the Database + \param dbType - String for the Database Type {SQLITE, ODBC, PostgreSQL} + \param userName - Username for login in the Database Server + \param passWord - Password for login in the Database Server + \param hostName - Hostname or IP-Address from the Database Server + \param port - Port for connect to the Database Server + */ + + explicit JMBDEMODELS_EXPORT DataContext(QObject *parent, + const QString &name, + const QString &dbType, + const QString &userName, + const QString &passWord, + const QString &hostName, + const int port); + + /*! + \fn ~DataContext() override; - /*! - \fn QSqlDatabase getDatabase() + \brief Destructor for DataContext() + \details Close the connection to the database. + */ + JMBDEMODELS_EXPORT ~DataContext(); - \brief get the reference to the QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDatabase() -> const QSqlDatabase { return m_db; } + /*! + \fn QSqlDatabase getDatabase() - /*! - \fn QSqlQuery getQuery(const QString &queryText); + \brief get the reference to the QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDatabase() -> const QSqlDatabase + { + return m_db; + } + + /*! + \fn QSqlQuery getQuery(const QString &queryText); - \brief get the result of the Query from the text - \param query - the db quey + \brief get the result of the Query from the text + \param query - the db quey - \return true if the execution successful - \sa QSqlQuery - */ + \return true if the execution successful + \sa QSqlQuery + */ - JMBDEMODELS_EXPORT static auto getQuery(const QString &query) -> QSqlQuery; + JMBDEMODELS_EXPORT static auto getQuery(const QString &query) -> QSqlQuery; - /* basic public actions */ + /* basic public actions */ - JMBDEMODELS_EXPORT auto checkExistence(const QString &tableName, const QString &searchId, const QString &search) - -> bool; + JMBDEMODELS_EXPORT auto checkExistence(const QString &tableName, const QString &searchId, const QString &search) -> bool; - /* useful actions */ + /* useful actions */ - /*! - \fn void open() + /*! + \fn void open() - \brief Open the Database with the given name - */ - JMBDEMODELS_EXPORT void open(); + \brief Open the Database with the given name + */ + JMBDEMODELS_EXPORT void open(); - /*! - \fn void openDB(const QString &name) + /*! + \fn void openDB(const QString &name) - \brief Open the Database with the given name - */ - JMBDEMODELS_EXPORT void open(const QString &name); + \brief Open the Database with the given name + */ + JMBDEMODELS_EXPORT void open(const QString &name); - /*! - \fn void renameDB(const QString &oldName, const QString &newName) + /*! + \fn void renameDB(const QString &oldName, const QString &newName) - \brief Rename the database to newName - */ - JMBDEMODELS_EXPORT void renameDB(const QString &newName); + \brief Rename the database to newName + */ + JMBDEMODELS_EXPORT void renameDB(const QString &newName); - /*! - \fn void deleteDB(const QString &name) + /*! + \fn void deleteDB(const QString &name) - \brief delete the database with the given name. - */ - JMBDEMODELS_EXPORT void deleteDB(const QString &name); + \brief delete the database with the given name. + */ + JMBDEMODELS_EXPORT void deleteDB(const QString &name); protected: - /*! - \fn void init() - - \brief Create the connection to the database - - \details calls from constructor. The CreateConnection - will Create for the four OS DB's the Connection. - By using sqlite is the system depend user directory - used. - - \todo init all tables - \todo check database version - \todo export and import all tables - */ - void init(); - - /*! - \fn void prepareDB() - - \brief Create the database from sql - */ - void prepareDB() const; - - /*! - \fn bool checkDBVersion() - \brief Check the Version of the DB - - \return False has the DB a wrong version - */ - auto checkDBVersion(const QString &actualVersion, - const QString &actualRevision /*, const QString &actualBuild */) const -> bool; - - /*! - \fn bool insert(const QString &tableName, const QVariantMap &insertData) - \brief insert the VariantMap in the table - - \return true is successful - - \sa QVariantMap - */ - auto insert(const QString &tableName, const QVariantMap &insertData) const -> bool; - - /*! - \fn bool update(const QString &table, const QString &column, - const QVariant &newValue, const QVariant &op, - const QString &id) - \brief Update the Data in the table - - \return true is successful - */ - auto update(const QString &table, - const QString &column, - const QVariant &newValue, - const QVariant &op, - const QString &id) const -> bool; - - /*! - \fn QString getSqliteName() - \brief Generate the Connection-Strig for the sqlite Database. - */ - void setDatabaseConnection(); - - enum DBTypes { SQLITE, PGSQL, ODBC }; + /*! + \fn void init() + + \brief Create the connection to the database + + \details calls from constructor. The CreateConnection + will Create for the four OS DB's the Connection. + By using sqlite is the system depend user directory + used. + + \todo init all tables + \todo check database version + \todo export and import all tables + */ + void init(); + + /*! + \fn void prepareDB() + + \brief Create the database from sql + */ + void prepareDB() const; + + /*! + \fn bool checkDBVersion() + \brief Check the Version of the DB + + \return False has the DB a wrong version + */ + auto checkDBVersion(const QString &actualVersion, const QString &actualRevision /*, const QString &actualBuild */) const -> bool; + + /*! + \fn bool insert(const QString &tableName, const QVariantMap &insertData) + \brief insert the VariantMap in the table + + \return true is successful + + \sa QVariantMap + */ + auto insert(const QString &tableName, const QVariantMap &insertData) const -> bool; + + /*! + \fn bool update(const QString &table, const QString &column, + const QVariant &newValue, const QVariant &op, + const QString &id) + \brief Update the Data in the table + + \return true is successful + */ + auto update(const QString &table, const QString &column, const QVariant &newValue, const QVariant &op, const QString &id) const -> bool; + + /*! + \fn QString getSqliteName() + \brief Generate the Connection-Strig for the sqlite Database. + */ + void setDatabaseConnection(); + + enum DBTypes { SQLITE, PGSQL, ODBC }; signals: - /*! - \fn void DBActionFinished() - \brief Signal for the DB-ACtion finished - */ - JMBDEMODELS_EXPORT void DBActionFinished(); + /*! + \fn void DBActionFinished() + \brief Signal for the DB-ACtion finished + */ + JMBDEMODELS_EXPORT void DBActionFinished(); public slots: private: - /*! - \var QString m_Name - \brief The holder for the DB-Name - */ - QString m_Name; - - /*! - \var QString m_connectionString for the SQliteDB - */ - QString m_connectionString; - - /*! - \var QSqlDatabase m_db - \brief the holder for the DB-Connection - */ - QSqlDatabase m_db; - - /*! - \var int m_dbType - \brief The holder for the DB-Type - */ - int m_dbType{ 0 }; - - /*! - \var QString m_dbHostName - \brief The holder for the DB-Hostname - */ - QString m_dbHostName; - - /*! - \var QString m_dbUserName - \brief The holder for the DB-Username - */ - QString m_dbUserName; + /*! + \var QString m_Name + \brief The holder for the DB-Name + */ + QString m_Name; - /*! - \var QString m_dbPassWord - \brief The holder for the DB-Password + /*! + \var QString m_connectionString for the SQliteDB */ - QString m_dbPassWord; + QString m_connectionString; + + /*! + \var QSqlDatabase m_db + \brief the holder for the DB-Connection + */ + QSqlDatabase m_db; + + /*! + \var int m_dbType + \brief The holder for the DB-Type + */ + int m_dbType{0}; + + /*! + \var QString m_dbHostName + \brief The holder for the DB-Hostname + */ + QString m_dbHostName; + + /*! + \var QString m_dbUserName + \brief The holder for the DB-Username + */ + QString m_dbUserName; + + /*! + \var QString m_dbPassWord + \brief The holder for the DB-Password + */ + QString m_dbPassWord; - int m_dbPort{ 0 }; + int m_dbPort{0}; }; -}// namespace Model +} // namespace Model // Q_GLOBAL_STATIC(DataContext, db) diff --git a/apps/libs/models/include/jmbdemodels/department.h b/apps/libs/models/include/jmbdemodels/department.h index b4ba946dc..27af2ea61 100644 --- a/apps/libs/models/include/jmbdemodels/department.h +++ b/apps/libs/models/include/jmbdemodels/department.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class Department \brief The Department class @@ -34,189 +35,215 @@ namespace Model { */ class Department : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn explicit Department() - \brief The Constructor for Department - */ - explicit JMBDEMODELS_EXPORT Department(); - - /*! - \fn ~Department() override; - - \brief Destructor for Department - */ - JMBDEMODELS_EXPORT ~Department() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int getDepartmentIdIndex() - - \brief Get the index of the fieldname DepartmentId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDepartmentIdIndex() const { return m_DepartmentIdIndex; } - - /*! - \fn int getNameIndex() - - \brief Get the index of the fieldname Name form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNameIndex() const { return m_NameIndex; } - - /*! - \fn int getPriorityIndex() - - \brief Get the index of the fieldname Priority form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPriorityIndex() const { return m_PriorityIndex; } - - /*! - \fn int getPrinterIdIndex() - - \brief Get the index of the fieldname PrinterId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPrinterIdIndex() const { return m_PrinterIdIndex; } - - /*! - \fn int getFaxIdIndex() + /*! + \fn explicit Department() + \brief The Constructor for Department + */ + explicit JMBDEMODELS_EXPORT Department(); + + /*! + \fn ~Department() override; + + \brief Destructor for Department + */ + JMBDEMODELS_EXPORT ~Department() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int getDepartmentIdIndex() + + \brief Get the index of the fieldname DepartmentId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDepartmentIdIndex() const + { + return m_DepartmentIdIndex; + } + + /*! + \fn int getNameIndex() + + \brief Get the index of the fieldname Name form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNameIndex() const + { + return m_NameIndex; + } + + /*! + \fn int getPriorityIndex() + + \brief Get the index of the fieldname Priority form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPriorityIndex() const + { + return m_PriorityIndex; + } + + /*! + \fn int getPrinterIdIndex() + + \brief Get the index of the fieldname PrinterId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPrinterIdIndex() const + { + return m_PrinterIdIndex; + } + + /*! + \fn int getFaxIdIndex() + + \brief Get the index of the fieldname LastUpdate form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getFaxIdIndex() const + { + return m_FaxIdIndex; + } + + /*! + \fn int getLastUpdateIndex() + + \brief Get the index of the fieldname LastUpdate form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } - \brief Get the index of the fieldname LastUpdate form the database +private: + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("department"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + /*! + \var int m_DepartmentIdIndex + \brief The value of the DepartmentIdIndex + */ + int m_DepartmentIdIndex{0}; - Returns the value of the index + /*! + \var int m_NameIndex + \brief The value of the NameIndex */ - JMBDEMODELS_EXPORT int getFaxIdIndex() const { return m_FaxIdIndex; } - - /*! - \fn int getLastUpdateIndex() + int m_NameIndex{0}; - \brief Get the index of the fieldname LastUpdate form the database - - Returns the value of the index + /*! + \var int m_PriorityIndex + \brief The value of the PriorityIndex */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + int m_PriorityIndex{0}; -private: - /*! - \brief The Tablename in the database \e is const + /*! + \var int m_PrinterIdIndex + \brief The value of the PrinterIdIndex */ - const QString m_tableName = QLatin1String("department"); + int m_PrinterIdIndex{0}; - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; + /*! + \var int m_FaxIdIndex + \brief The value of the FaxIdIndex + */ + int m_FaxIdIndex{0}; - /*! - * @brief DataContext + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex */ - Model::DataContext *m_dataContext = {}; - /*! - \var int m_DepartmentIdIndex - \brief The value of the DepartmentIdIndex - */ - int m_DepartmentIdIndex{ 0 }; - - /*! - \var int m_NameIndex - \brief The value of the NameIndex - */ - int m_NameIndex{ 0 }; - - /*! - \var int m_PriorityIndex - \brief The value of the PriorityIndex - */ - int m_PriorityIndex{ 0 }; - - /*! - \var int m_PrinterIdIndex - \brief The value of the PrinterIdIndex - */ - int m_PrinterIdIndex{ 0 }; - - /*! - \var int m_FaxIdIndex - \brief The value of the FaxIdIndex - */ - int m_FaxIdIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/devicename.h b/apps/libs/models/include/jmbdemodels/devicename.h index 3bbfb0ffa..0b5636844 100644 --- a/apps/libs/models/include/jmbdemodels/devicename.h +++ b/apps/libs/models/include/jmbdemodels/devicename.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class DeviceName \brief The DeviceNames class @@ -34,144 +35,161 @@ namespace Model { */ class DeviceName : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn explicit DeviceName() - \brief The Constructor for the DeviceName - */ - explicit JMBDEMODELS_EXPORT DeviceName(); - - /*! - \fn ~DeviceName() override; - - \brief Destructor for DeviceName - */ - JMBDEMODELS_EXPORT ~DeviceName() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int DeviceNameIdIndex() - - \brief Get the index of the fieldname DeviceNameId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDeviceNameIdIndex() const { return m_DeviceNameIdIndex; } - - /*! - \fn int NameIndex() - - \brief Get the index of the fieldname Name form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNameIndex() const { return m_NameIndex; } - - /*! - \fn int LastUpdateIndex() - - \brief Get the index of the fieldname LastUpdate form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \fn explicit DeviceName() + \brief The Constructor for the DeviceName + */ + explicit JMBDEMODELS_EXPORT DeviceName(); + + /*! + \fn ~DeviceName() override; + + \brief Destructor for DeviceName + */ + JMBDEMODELS_EXPORT ~DeviceName() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int DeviceNameIdIndex() + + \brief Get the index of the fieldname DeviceNameId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDeviceNameIdIndex() const + { + return m_DeviceNameIdIndex; + } + + /*! + \fn int NameIndex() + + \brief Get the index of the fieldname Name form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNameIndex() const + { + return m_NameIndex; + } + + /*! + \fn int LastUpdateIndex() + + \brief Get the index of the fieldname LastUpdate form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("device_name"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - /*! - \var int m_DeviceNameIdIndex - \brief The value of the DeviceNameIdIndexx - */ - int m_DeviceNameIdIndex{ 0 }; - - /*! - \var int m_NameIndex - \brief The value of the NameIndex - */ - int m_NameIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("device_name"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + /*! + \var int m_DeviceNameIdIndex + \brief The value of the DeviceNameIdIndexx + */ + int m_DeviceNameIdIndex{0}; + + /*! + \var int m_NameIndex + \brief The value of the NameIndex + */ + int m_NameIndex{0}; + + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/devicetype.h b/apps/libs/models/include/jmbdemodels/devicetype.h index 9aa7a2b00..ad478e0aa 100644 --- a/apps/libs/models/include/jmbdemodels/devicetype.h +++ b/apps/libs/models/include/jmbdemodels/devicetype.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class DeviceType \brief The DeviceType class @@ -34,145 +35,162 @@ namespace Model { */ class DeviceType : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn explicit DeviceType() - \brief The Constructor for the DeviceName - */ - explicit JMBDEMODELS_EXPORT DeviceType(); - - /*! - \fn ~DeviceType() override; - - \brief Destructor for DeviceType - */ - JMBDEMODELS_EXPORT ~DeviceType() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int DeviceTypeIdIndex() - - \brief Get the index of the fieldname DeviceTypeId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int DeviceTypeIdIndex() const { return m_DeviceTypeIdIndex; } - - /*! - \fn int getNameIndex() - - \brief Get the index of the fieldname Name form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNameIndex() const { return m_NameIndex; } - - /*! - \fn int getLastUpdateIndex() - - \brief Get the index of the fieldname LastUpdate form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \fn explicit DeviceType() + \brief The Constructor for the DeviceName + */ + explicit JMBDEMODELS_EXPORT DeviceType(); + + /*! + \fn ~DeviceType() override; + + \brief Destructor for DeviceType + */ + JMBDEMODELS_EXPORT ~DeviceType() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int DeviceTypeIdIndex() + + \brief Get the index of the fieldname DeviceTypeId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int DeviceTypeIdIndex() const + { + return m_DeviceTypeIdIndex; + } + + /*! + \fn int getNameIndex() + + \brief Get the index of the fieldname Name form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNameIndex() const + { + return m_NameIndex; + } + + /*! + \fn int getLastUpdateIndex() + + \brief Get the index of the fieldname LastUpdate form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("device_type"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_DeviceTypeIdIndex - \brief The value of the DeviceTypeIdIndexx - */ - int m_DeviceTypeIdIndex{ 0 }; - - /*! - \var int m_NameIndex - \brief The value of the NameIndex - */ - int m_NameIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("device_type"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_DeviceTypeIdIndex + \brief The value of the DeviceTypeIdIndexx + */ + int m_DeviceTypeIdIndex{0}; + + /*! + \var int m_NameIndex + \brief The value of the NameIndex + */ + int m_NameIndex{0}; + + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/document.h b/apps/libs/models/include/jmbdemodels/document.h index 65a8c6651..22c93789f 100644 --- a/apps/libs/models/include/jmbdemodels/document.h +++ b/apps/libs/models/include/jmbdemodels/document.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class Document \brief The Document class @@ -34,160 +35,180 @@ namespace Model { */ class Document : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn explicit Document() - \brief The Constructor for the Document - */ - explicit JMBDEMODELS_EXPORT Document(); - - /*! - \fn ~Document() override; - - \brief Destructor for Document - */ - JMBDEMODELS_EXPORT ~Document() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int DocumentIdIndex() - - \brief Get the index of the fieldname DocumentId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDocumentIdIndex() const { return m_DocumentIdIndex; } + /*! + \fn explicit Document() + \brief The Constructor for the Document + */ + explicit JMBDEMODELS_EXPORT Document(); + + /*! + \fn ~Document() override; + + \brief Destructor for Document + */ + JMBDEMODELS_EXPORT ~Document() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int DocumentIdIndex() + + \brief Get the index of the fieldname DocumentId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDocumentIdIndex() const + { + return m_DocumentIdIndex; + } + + /*! + \fn int NameIndex() + + \brief Get the index of the fieldname Name form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNameIndex() const + { + return m_NameIndex; + } - /*! - \fn int NameIndex() + /*! + \fn int DocumentDataIndex() - \brief Get the index of the fieldname Name form the database + \brief Get the index of the fieldname DocumentData form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNameIndex() const { return m_NameIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDocumentDataIndex() const + { + return m_DocumentDataIndex; + } - /*! - \fn int DocumentDataIndex() + /*! + \fn int LastUpdateIndex() - \brief Get the index of the fieldname DocumentData form the database + \brief Get the index of the fieldname LastUpdate form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDocumentDataIndex() const { return m_DocumentDataIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } - /*! - \fn int LastUpdateIndex() +private: + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("document"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_DocumentIdIndex + \brief The value of the DocumentIdIndex + */ + int m_DocumentIdIndex{0}; - \brief Get the index of the fieldname LastUpdate form the database + /*! + \var int m_NameIndex + \brief The value of the NameIndex + */ + int m_NameIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \var int m_DocumentDataIndex + \brief The value of the DocumentDataIndex + */ + int m_DocumentDataIndex{0}; -private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("document"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_DocumentIdIndex - \brief The value of the DocumentIdIndex - */ - int m_DocumentIdIndex{ 0 }; - - /*! - \var int m_NameIndex - \brief The value of the NameIndex - */ - int m_NameIndex{ 0 }; - - /*! - \var int m_DocumentDataIndex - \brief The value of the DocumentDataIndex - */ - int m_DocumentDataIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/employee.h b/apps/libs/models/include/jmbdemodels/employee.h index b69eb6abd..c0e48cd96 100644 --- a/apps/libs/models/include/jmbdemodels/employee.h +++ b/apps/libs/models/include/jmbdemodels/employee.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class Employee \brief The Employee class @@ -66,553 +67,651 @@ digraph g { */ class Employee : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn explicit Employee() - \brief The Constructor for the Employee - */ - explicit JMBDEMODELS_EXPORT Employee(); - - /*! - \fn ~Employee() override; + /*! + \fn explicit Employee() + \brief The Constructor for the Employee + */ + explicit JMBDEMODELS_EXPORT Employee(); - \brief Destructor for Employee - */ - JMBDEMODELS_EXPORT ~Employee() {} + /*! + \fn ~Employee() override; - // implement the virtuals + \brief Destructor for Employee + */ + JMBDEMODELS_EXPORT ~Employee() + { + } - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; + // implement the virtuals - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + /*! + \fn int getEmployeeIdIndex() - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString + \brief Get the index of the fieldname EmployeeId form the database - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getEmployeeIdIndex() const + { + return m_EmployeeIdIndex; + } - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } + /*! + \fn int getEmployeeNrIndex() - /*! - \fn int getEmployeeIdIndex() + \brief Get the index of the fieldname EmployeeNr form the database - \brief Get the index of the fieldname EmployeeId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getEmployeeNrIndex() const + { + return m_EmployeeNrIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getEmployeeIdIndex() const { return m_EmployeeIdIndex; } + /*! + \fn int getGenderIndex() - /*! - \fn int getEmployeeNrIndex() + \brief Get the index of the fieldname Gender form the database - \brief Get the index of the fieldname EmployeeNr form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getGenderIndex() const + { + return m_GenderIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getEmployeeNrIndex() const { return m_EmployeeNrIndex; } + /*! + \fn int getTitleIdIndex() - /*! - \fn int getGenderIndex() + \brief Get the index of the fieldname TitleId form the database - \brief Get the index of the fieldname Gender form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getTitleIdIndex() const + { + return m_TitleIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getGenderIndex() const { return m_GenderIndex; } + /*! + \fn int getFirstNameIndex() - /*! - \fn int getTitleIdIndex() + \brief Get the index of the fieldname FirstName form the database - \brief Get the index of the fieldname TitleId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getFirstNameIndex() const + { + return m_FirstNameIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getTitleIdIndex() const { return m_TitleIdIndex; } + /*! + \fn int getLastNameIndex() - /*! - \fn int getFirstNameIndex() + \brief Get the index of the fieldname LastName form the database - \brief Get the index of the fieldname FirstName form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastNameIndex() const + { + return m_LastNameIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getFirstNameIndex() const { return m_FirstNameIndex; } + /*! + \fn int getBirthDayIndex() - /*! - \fn int getLastNameIndex() + \brief Get the index of the fieldname BirthDay form the database - \brief Get the index of the fieldname LastName form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getBirthDayIndex() const + { + return m_BirthDayIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastNameIndex() const { return m_LastNameIndex; } + /*! + \fn int getAddressIndex() - /*! - \fn int getBirthDayIndex() + \brief Get the index of the fieldname Address form the database - \brief Get the index of the fieldname BirthDay form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getAddressIndex() const + { + return m_AddressIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getBirthDayIndex() const { return m_BirthDayIndex; } + /*! + \fn int getZipCityIdIndex() - /*! - \fn int getAddressIndex() + \brief Get the index of the fieldname ZipCityId form the database - \brief Get the index of the fieldname Address form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getZipCityIdIndex() const + { + return m_ZipCityIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getAddressIndex() const { return m_AddressIndex; } + /*! + \fn int getHomePhoneIndex() - /*! - \fn int getZipCityIdIndex() + \brief Get the index of the fieldname HomePhone form the database - \brief Get the index of the fieldname ZipCityId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getHomePhoneIndex() const + { + return m_HomePhoneIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getZipCityIdIndex() const { return m_ZipCityIdIndex; } + /*! + \fn int getHomeMobileIndex() - /*! - \fn int getHomePhoneIndex() + \brief Get the index of the fieldname HomeMobile form the database - \brief Get the index of the fieldname HomePhone form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getHomeMobileIndex() const + { + return m_HomeMobileIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getHomePhoneIndex() const { return m_HomePhoneIndex; } + /*! + \fn int getHomeMailIndex() - /*! - \fn int getHomeMobileIndex() + \brief Get the index of the fieldname HomeMail form the database - \brief Get the index of the fieldname HomeMobile form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getHomeMailIndex() const + { + return m_HomeMailIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getHomeMobileIndex() const { return m_HomeMobileIndex; } + /*! + \fn int getBusinessMailIndex() - /*! - \fn int getHomeMailIndex() + \brief Get the index of the fieldname BusinessMail form the database - \brief Get the index of the fieldname HomeMail form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getBusinessMailIndex() const + { + return m_BusinessMailIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getHomeMailIndex() const { return m_HomeMailIndex; } + /*! + \fn int getDataCareIndex() - /*! - \fn int getBusinessMailIndex() + \brief Get the index of the fieldname DataCare form the database - \brief Get the index of the fieldname BusinessMail form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDataCareIndex() const + { + return m_DataCareIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getBusinessMailIndex() const { return m_BusinessMailIndex; } + /*! + \fn int getActiveIndex() - /*! - \fn int getDataCareIndex() + \brief Get the index of the fieldname Active form the database - \brief Get the index of the fieldname DataCare form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getActiveIndex() const + { + return m_ActiveIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDataCareIndex() const { return m_DataCareIndex; } + /*! + \fn int getPhotoIndex() - /*! - \fn int getActiveIndex() + \brief Get the index of the fieldname Photo form the database - \brief Get the index of the fieldname Active form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPhotoIndex() const + { + return m_PhotoIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getActiveIndex() const { return m_ActiveIndex; } + /*! + \fn int getNotesIndex() - /*! - \fn int getPhotoIndex() + \brief Get the index of the fieldname Notes form the database - \brief Get the index of the fieldname Photo form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNotesIndex() const + { + return m_NotesIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPhotoIndex() const { return m_PhotoIndex; } + /*! + \fn int getHireDateIndex() - /*! - \fn int getNotesIndex() + \brief Get the index of the fieldname HireDate form the database - \brief Get the index of the fieldname Notes form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getHireDateIndex() const + { + return m_HireDateIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNotesIndex() const { return m_NotesIndex; } + /*! + \fn int getEndDateIndex() - /*! - \fn int getHireDateIndex() + \brief Get the index of the fieldname EndDate form the database - \brief Get the index of the fieldname HireDate form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getEndDateIndex() const + { + return m_EndDateIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getHireDateIndex() const { return m_HireDateIndex; } + /*! + \fn int getDepartmentIdIndex() - /*! - \fn int getEndDateIndex() + \brief Get the index of the fieldname DepartmentId form the database - \brief Get the index of the fieldname EndDate form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDepartmentIdIndex() const + { + return m_DepartmentIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getEndDateIndex() const { return m_EndDateIndex; } + /*! + \fn int getFunctionIdIndex() - /*! - \fn int getDepartmentIdIndex() + \brief Get the index of the fieldname FunctionId form the database - \brief Get the index of the fieldname DepartmentId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getFunctionIdIndex() const + { + return m_FunctionIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDepartmentIdIndex() const { return m_DepartmentIdIndex; } + /*! + \fn int getComputerIdIndex() - /*! - \fn int getFunctionIdIndex() + \brief Get the index of the fieldname ComputerId form the database - \brief Get the index of the fieldname FunctionId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getComputerIdIndex() const + { + return m_ComputerIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getFunctionIdIndex() const { return m_FunctionIdIndex; } + /*! + \fn int getPrinterIdIndex() - /*! - \fn int getComputerIdIndex() + \brief Get the index of the fieldname PrinterId form the database - \brief Get the index of the fieldname ComputerId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPrinterIdIndex() const + { + return m_PrinterIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getComputerIdIndex() const { return m_ComputerIdIndex; } + /*! + \fn int getPhoneIdIndex() - /*! - \fn int getPrinterIdIndex() + \brief Get the index of the fieldname PhoneId form the database - \brief Get the index of the fieldname PrinterId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPhoneIdIndex() const + { + return m_PhoneIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPrinterIdIndex() const { return m_PrinterIdIndex; } + /*! + \fn int getMobileIdIndex() - /*! - \fn int getPhoneIdIndex() + \brief Get the index of the fieldname MobileId form the database - \brief Get the index of the fieldname PhoneId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getMobileIdIndex() const + { + return m_MobileIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPhoneIdIndex() const { return m_PhoneIdIndex; } + /*! + \fn int getFaxIdIndex() - /*! - \fn int getMobileIdIndex() + \brief Get the index of the fieldname FaxId form the database - \brief Get the index of the fieldname MobileId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getFaxIdIndex() const + { + return m_FaxIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getMobileIdIndex() const { return m_MobileIdIndex; } + /*! + \fn int getEmployeeAccountIdIndex() - /*! - \fn int getFaxIdIndex() + \brief Get the index of the fieldname EmployeeAccountId form the + database - \brief Get the index of the fieldname FaxId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getEmployeeAccountIdIndex() const + { + return m_EmployeeAccountIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getFaxIdIndex() const { return m_FaxIdIndex; } + /*! + \fn int getEmployeeDocumentIdIndex() - /*! - \fn int getEmployeeAccountIdIndex() + \brief Get the index of the fieldname EmployeeDocumentId form the + database - \brief Get the index of the fieldname EmployeeAccountId form the - database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getEmployeeDocumentIdIndex() const + { + return m_EmployeeDocumentIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getEmployeeAccountIdIndex() const { return m_EmployeeAccountIdIndex; } + /*! + \fn int getChipCardIdIndex() - /*! - \fn int getEmployeeDocumentIdIndex() + \brief Get the index of the fieldname ChipCardId form the database - \brief Get the index of the fieldname EmployeeDocumentId form the - database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getChipCardIdIndex() const + { + return m_ChipCardIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getEmployeeDocumentIdIndex() const { return m_EmployeeDocumentIdIndex; } + /*! + \fn int getLastUpdateIndex() - /*! - \fn int getChipCardIdIndex() + \brief Get the index of the fieldname LastUpdate form the database - \brief Get the index of the fieldname ChipCardId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getChipCardIdIndex() const { return m_ChipCardIdIndex; } +protected: +private: + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("employee"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_EmployeeIdIndex + \brief The value of the EmployeeIdIndex + */ + int m_EmployeeIdIndex{0}; - /*! - \fn int getLastUpdateIndex() + /*! + \var int m_EmployeeNrIndex + \brief The value of the EmployeeNrIndex + */ + int m_EmployeeNrIndex{0}; - \brief Get the index of the fieldname LastUpdate form the database + /*! + \var int m_GenderIndex + \brief The value of the GenderIndex + */ + int m_GenderIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \var int m_TitleIdIndex + \brief The value of the TitleIdIndex + */ + int m_TitleIdIndex{0}; -protected: -private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("employee"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_EmployeeIdIndex - \brief The value of the EmployeeIdIndex - */ - int m_EmployeeIdIndex{ 0 }; - - /*! - \var int m_EmployeeNrIndex - \brief The value of the EmployeeNrIndex - */ - int m_EmployeeNrIndex{ 0 }; - - /*! - \var int m_GenderIndex - \brief The value of the GenderIndex - */ - int m_GenderIndex{ 0 }; - - /*! - \var int m_TitleIdIndex - \brief The value of the TitleIdIndex - */ - int m_TitleIdIndex{ 0 }; - - /*! - \var int m_FirstNameIndex - \brief The value of the FirstNameIndex - */ - int m_FirstNameIndex{ 0 }; - - /*! - \var int m_LastNameIndex - \brief The value of the LastNameIndex - */ - int m_LastNameIndex{ 0 }; - - /*! - \var int m_BirthDayIndex - \brief The value of the BirthDayIndex - */ - int m_BirthDayIndex{ 0 }; - - /*! - \var int m_AddressIndex - \brief The value of the AddressIndex - */ - int m_AddressIndex{ 0 }; - - /*! - \var int m_ZipCityIdIndex - \brief The value of the ZipCityIdIndex - */ - int m_ZipCityIdIndex{ 0 }; - - /*! - \var int m_HomePhoneIndex - \brief The value of the HomePhoneIndex - */ - int m_HomePhoneIndex{ 0 }; - - /*! - \var int m_HomeMobileIndex - \brief The value of the HomeMobileIndex - */ - int m_HomeMobileIndex{ 0 }; - - /*! - \var int m_HomeMailIndex - \brief The value of the HomeMailIndex - */ - int m_HomeMailIndex{ 0 }; - - /*! - \var int m_BusinessMailIndex - \brief The value of the BusinessMailIndex - */ - int m_BusinessMailIndex{ 0 }; - - /*! - \var int m_DataCareIndex - \brief The value of the DataCareIndex - */ - int m_DataCareIndex{ 0 }; - - /*! - \var int m_ActiveIndex - \brief The value of the ActiveIndex - */ - int m_ActiveIndex{ 0 }; - - /*! - \var int m_PhotoIndex - \brief The value of the PhotoIndex - */ - int m_PhotoIndex{ 0 }; - - /*! - \var int m_NotesIndex - \brief The value of the NotesIndex - */ - int m_NotesIndex{ 0 }; - - /*! - \var int m_HireDateIndex - \brief The value of the HireDateIndex - */ - int m_HireDateIndex{ 0 }; - - /*! - \var int m_EndDateIndex - \brief The value of the EndDateIndex - */ - int m_EndDateIndex{ 0 }; - - /*! - \var int m_DepartmentIdIndex - \brief The value of the DepartmentIdIndex - */ - int m_DepartmentIdIndex{ 0 }; - - /*! - \var int m_FunctionIdIndex - \brief The value of the FunctionIdIndex - */ - int m_FunctionIdIndex{ 0 }; - - /*! - \var int m_ComputerIdIndex - \brief The value of the ComputerIdIndex - */ - int m_ComputerIdIndex{ 0 }; - - /*! - \var int m_PrinterIdIndex - \brief The value of the PrinterIdIndex - */ - int m_PrinterIdIndex{ 0 }; - - /*! - \var int m_PhoneIdIndex - \brief The value of the PhoneIdIndex - */ - int m_PhoneIdIndex{ 0 }; - - /*! - \var int m_MobileIdIndex - \brief The value of the MobileIdIndex - */ - int m_MobileIdIndex{ 0 }; - - /*! - \var int m_FaxIdIndex - \brief The value of the FaxIdIndex - */ - int m_FaxIdIndex{ 0 }; - - /*! - \var int m_EmployeeAccountIdIndex - \brief The value of the EmployeeAccountIdIndex - */ - int m_EmployeeAccountIdIndex{ 0 }; - - /*! - \var int m_EmployeeDocumentIdIndex - \brief The value of the EmployeeDocumentIdIndex - */ - int m_EmployeeDocumentIdIndex{ 0 }; - - /*! - \var int m_ChipCardIdIndex - \brief The value of the ChipCardIdIndex - */ - int m_ChipCardIdIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \var int m_FirstNameIndex + \brief The value of the FirstNameIndex + */ + int m_FirstNameIndex{0}; + + /*! + \var int m_LastNameIndex + \brief The value of the LastNameIndex + */ + int m_LastNameIndex{0}; + + /*! + \var int m_BirthDayIndex + \brief The value of the BirthDayIndex + */ + int m_BirthDayIndex{0}; + + /*! + \var int m_AddressIndex + \brief The value of the AddressIndex + */ + int m_AddressIndex{0}; + + /*! + \var int m_ZipCityIdIndex + \brief The value of the ZipCityIdIndex + */ + int m_ZipCityIdIndex{0}; + + /*! + \var int m_HomePhoneIndex + \brief The value of the HomePhoneIndex + */ + int m_HomePhoneIndex{0}; + + /*! + \var int m_HomeMobileIndex + \brief The value of the HomeMobileIndex + */ + int m_HomeMobileIndex{0}; + + /*! + \var int m_HomeMailIndex + \brief The value of the HomeMailIndex + */ + int m_HomeMailIndex{0}; + + /*! + \var int m_BusinessMailIndex + \brief The value of the BusinessMailIndex + */ + int m_BusinessMailIndex{0}; + + /*! + \var int m_DataCareIndex + \brief The value of the DataCareIndex + */ + int m_DataCareIndex{0}; + + /*! + \var int m_ActiveIndex + \brief The value of the ActiveIndex + */ + int m_ActiveIndex{0}; + + /*! + \var int m_PhotoIndex + \brief The value of the PhotoIndex + */ + int m_PhotoIndex{0}; + + /*! + \var int m_NotesIndex + \brief The value of the NotesIndex + */ + int m_NotesIndex{0}; + + /*! + \var int m_HireDateIndex + \brief The value of the HireDateIndex + */ + int m_HireDateIndex{0}; + + /*! + \var int m_EndDateIndex + \brief The value of the EndDateIndex + */ + int m_EndDateIndex{0}; + + /*! + \var int m_DepartmentIdIndex + \brief The value of the DepartmentIdIndex + */ + int m_DepartmentIdIndex{0}; + + /*! + \var int m_FunctionIdIndex + \brief The value of the FunctionIdIndex + */ + int m_FunctionIdIndex{0}; + + /*! + \var int m_ComputerIdIndex + \brief The value of the ComputerIdIndex + */ + int m_ComputerIdIndex{0}; + + /*! + \var int m_PrinterIdIndex + \brief The value of the PrinterIdIndex + */ + int m_PrinterIdIndex{0}; + + /*! + \var int m_PhoneIdIndex + \brief The value of the PhoneIdIndex + */ + int m_PhoneIdIndex{0}; + + /*! + \var int m_MobileIdIndex + \brief The value of the MobileIdIndex + */ + int m_MobileIdIndex{0}; + + /*! + \var int m_FaxIdIndex + \brief The value of the FaxIdIndex + */ + int m_FaxIdIndex{0}; + + /*! + \var int m_EmployeeAccountIdIndex + \brief The value of the EmployeeAccountIdIndex + */ + int m_EmployeeAccountIdIndex{0}; + + /*! + \var int m_EmployeeDocumentIdIndex + \brief The value of the EmployeeDocumentIdIndex + */ + int m_EmployeeDocumentIdIndex{0}; + + /*! + \var int m_ChipCardIdIndex + \brief The value of the ChipCardIdIndex + */ + int m_ChipCardIdIndex{0}; + + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/employeeaccount.h b/apps/libs/models/include/jmbdemodels/employeeaccount.h index fcafe42e9..ad9468d4a 100644 --- a/apps/libs/models/include/jmbdemodels/employeeaccount.h +++ b/apps/libs/models/include/jmbdemodels/employeeaccount.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class EmployeeAccount \brief The EmployeeAccount class @@ -34,161 +35,181 @@ namespace Model { */ class EmployeeAccount : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn explicit EmployeeAccount() - \brief The Constructor for the EmployeeAccount - */ - explicit JMBDEMODELS_EXPORT EmployeeAccount(); - - /*! - \fn ~EmployeeAccount() override; - - \brief Destructor for EmployeeAccount - */ - JMBDEMODELS_EXPORT ~EmployeeAccount() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int EmployeeAccountIdIndex() - - \brief Get the index of the fieldname EmployeeAccountId form the - database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getEmployeeAccountIdIndex() const { return m_EmployeeAccountIdIndex; } - - /*! - \fn int EmployeeIdIndex() - - \brief Get the index of the fieldname EmployeeId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getEmployeeIdIndex() const { return m_EmployeeIdIndex; } - - /*! - \fn int AccountIdIndex() - - \brief Get the index of the fieldname AccountId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getAccountIdIndex() const { return m_AccountIdIndex; } + /*! + \fn explicit EmployeeAccount() + \brief The Constructor for the EmployeeAccount + */ + explicit JMBDEMODELS_EXPORT EmployeeAccount(); + + /*! + \fn ~EmployeeAccount() override; + + \brief Destructor for EmployeeAccount + */ + JMBDEMODELS_EXPORT ~EmployeeAccount() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int EmployeeAccountIdIndex() + + \brief Get the index of the fieldname EmployeeAccountId form the + database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getEmployeeAccountIdIndex() const + { + return m_EmployeeAccountIdIndex; + } + + /*! + \fn int EmployeeIdIndex() + + \brief Get the index of the fieldname EmployeeId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getEmployeeIdIndex() const + { + return m_EmployeeIdIndex; + } + + /*! + \fn int AccountIdIndex() + + \brief Get the index of the fieldname AccountId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getAccountIdIndex() const + { + return m_AccountIdIndex; + } + + /*! + \fn int LastUpdateIndex() + + \brief Get the index of the fieldname LastUpdate form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } - /*! - \fn int LastUpdateIndex() +private: + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("employee_account"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_EmployeeAccountIdIndex + \brief The value of the EmployeeAccountIdIndex + */ + int m_EmployeeAccountIdIndex{0}; - \brief Get the index of the fieldname LastUpdate form the database + /*! + \var int m_EmployeeIdIndex + \brief The value of the EmployeeIdIndex + */ + int m_EmployeeIdIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \var int m_AccountIdIndex + \brief The value of the AccountIdIndex + */ + int m_AccountIdIndex{0}; -private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("employee_account"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_EmployeeAccountIdIndex - \brief The value of the EmployeeAccountIdIndex - */ - int m_EmployeeAccountIdIndex{ 0 }; - - /*! - \var int m_EmployeeIdIndex - \brief The value of the EmployeeIdIndex - */ - int m_EmployeeIdIndex{ 0 }; - - /*! - \var int m_AccountIdIndex - \brief The value of the AccountIdIndex - */ - int m_AccountIdIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/employeedocument.h b/apps/libs/models/include/jmbdemodels/employeedocument.h index 9a1722fad..22b8de80d 100644 --- a/apps/libs/models/include/jmbdemodels/employeedocument.h +++ b/apps/libs/models/include/jmbdemodels/employeedocument.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class EmployeeDocument \brief The EmployeeDocument class @@ -34,161 +35,181 @@ namespace Model { */ class EmployeeDocument : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn explicit EmployeeDocument() - \brief The Constructor for the EmployeeDocument - */ - explicit JMBDEMODELS_EXPORT EmployeeDocument(); - - /*! - \fn ~EmployeeDocument() override; - - \brief Destructor for EmployeeDocument - */ - JMBDEMODELS_EXPORT ~EmployeeDocument() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int EmployeeDocumentIdIndex() - - \brief Get the index of the fieldname EmployeeDocumentId form the - database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getEmployeeDocumentIdIndex() const { return m_EmployeeDocumentIdIndex; } - - /*! - \fn int EmployeeIdIndex() - - \brief Get the index of the fieldname EmployeeId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getEmployeeIdIndex() const { return m_EmployeeIdIndex; } - - /*! - \fn int DocumentIdIndex() - - \brief Get the index of the fieldname DocumentId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDocumentIdIndex() const { return m_DocumentIdIndex; } + /*! + \fn explicit EmployeeDocument() + \brief The Constructor for the EmployeeDocument + */ + explicit JMBDEMODELS_EXPORT EmployeeDocument(); + + /*! + \fn ~EmployeeDocument() override; + + \brief Destructor for EmployeeDocument + */ + JMBDEMODELS_EXPORT ~EmployeeDocument() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int EmployeeDocumentIdIndex() + + \brief Get the index of the fieldname EmployeeDocumentId form the + database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getEmployeeDocumentIdIndex() const + { + return m_EmployeeDocumentIdIndex; + } + + /*! + \fn int EmployeeIdIndex() + + \brief Get the index of the fieldname EmployeeId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getEmployeeIdIndex() const + { + return m_EmployeeIdIndex; + } + + /*! + \fn int DocumentIdIndex() + + \brief Get the index of the fieldname DocumentId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDocumentIdIndex() const + { + return m_DocumentIdIndex; + } + + /*! + \fn int LastUpdateIndex() + + \brief Get the index of the fieldname LastUpdate form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } - /*! - \fn int LastUpdateIndex() +private: + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("employee_document"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_EmployeeDocumentIdIndex + \brief The value of the EmployeeDocumentIdIndex + */ + int m_EmployeeDocumentIdIndex{0}; - \brief Get the index of the fieldname LastUpdate form the database + /*! + \var int m_EmployeeIdIndex + \brief The value of the EmployeeIdIndex + */ + int m_EmployeeIdIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \var int m_DocumentIdIndex + \brief The value of the DocumentIdIndex + */ + int m_DocumentIdIndex{0}; -private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("employee_document"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_EmployeeDocumentIdIndex - \brief The value of the EmployeeDocumentIdIndex - */ - int m_EmployeeDocumentIdIndex{ 0 }; - - /*! - \var int m_EmployeeIdIndex - \brief The value of the EmployeeIdIndex - */ - int m_EmployeeIdIndex{ 0 }; - - /*! - \var int m_DocumentIdIndex - \brief The value of the DocumentIdIndex - */ - int m_DocumentIdIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/fax.h b/apps/libs/models/include/jmbdemodels/fax.h index dbdfaeff9..ea0782232 100644 --- a/apps/libs/models/include/jmbdemodels/fax.h +++ b/apps/libs/models/include/jmbdemodels/fax.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class Fax \brief The Fax class @@ -34,314 +35,364 @@ namespace Model { */ class Fax : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn explicit Fax() - \brief The Constructor for the Fax - */ - explicit JMBDEMODELS_EXPORT Fax(); - - /*! - \fn ~Fax() override; - - \brief Destructor for Fax - */ - JMBDEMODELS_EXPORT ~Fax() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int FaxIdIndex() - - \brief Get the index of the fieldname FaxId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getFaxIdIndex() const { return m_FaxIdIndex; } - - /*! - \fn int DeviceNameIdIndex() - - \brief Get the index of the fieldname DeviceNameId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDeviceNameIdIndex() const { return m_DeviceNameIdIndex; } - - /*! - \fn int SerialNumberIndex() - - \brief Get the index of the fieldname SerialNumberIndex form the - database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getSerialNumberIndex() const { return m_SerialNumberIndex; } - - /*! - \fn int NumberIndex() - - \brief Get the index of the fieldname NumberIndex form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNumberIndex() const { return m_NumberIndex; } - - /*! - \fn int PinIndex() - - \brief Get the index of the fieldname PinIndex form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPinIndex() const { return m_PinIndex; } - - /*! - \fn int ActiveIndex() - - \brief Get the index of the fieldname ActiveIndex form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getActiveIndex() const { return m_ActiveIndex; } - - /*! - \fn int ReplaceIndex() - - \brief Get the index of the fieldname ReplaceIndex form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getReplaceIndex() const { return m_ReplaceIndex; } - - /*! - \fn int DeviceTypeIdIndex() - - \brief Get the index of the fieldname DeviceTypeIdIndex form the - database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDeviceTypeIdIndex() const { return m_DeviceTypeIdIndex; } - - /*! - \fn int EmployeeIdIndex() - - \brief Get the index of the fieldname EmployeeIdIndex form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getEmployeeIdIndex() const { return m_EmployeeIdIndex; } - - /*! - \fn int PlaceIdIndex() - - \brief Get the index of the fieldname PlaceIdIndex form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPlaceIdIndex() const { return m_PlaceIdIndex; } - - /*! - \fn int DepartmentIdIndex() - - \brief Get the index of the fieldname DepartmentIdIndex form the - database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDepartmentIdIndex() const { return m_DepartmentIdIndex; } - - /*! - \fn int ManufacturerIdIndex() - - \brief Get the index of the fieldname ManufacturerIdIndex form the - database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getManufacturerIdIndex() const { return m_ManufacturerIdIndex; } + /*! + \fn explicit Fax() + \brief The Constructor for the Fax + */ + explicit JMBDEMODELS_EXPORT Fax(); + + /*! + \fn ~Fax() override; + + \brief Destructor for Fax + */ + JMBDEMODELS_EXPORT ~Fax() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int FaxIdIndex() + + \brief Get the index of the fieldname FaxId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getFaxIdIndex() const + { + return m_FaxIdIndex; + } + + /*! + \fn int DeviceNameIdIndex() + + \brief Get the index of the fieldname DeviceNameId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDeviceNameIdIndex() const + { + return m_DeviceNameIdIndex; + } + + /*! + \fn int SerialNumberIndex() + + \brief Get the index of the fieldname SerialNumberIndex form the + database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getSerialNumberIndex() const + { + return m_SerialNumberIndex; + } + + /*! + \fn int NumberIndex() + + \brief Get the index of the fieldname NumberIndex form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNumberIndex() const + { + return m_NumberIndex; + } + + /*! + \fn int PinIndex() + + \brief Get the index of the fieldname PinIndex form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPinIndex() const + { + return m_PinIndex; + } + + /*! + \fn int ActiveIndex() + + \brief Get the index of the fieldname ActiveIndex form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getActiveIndex() const + { + return m_ActiveIndex; + } - /*! - \fn int InventoryIdIndex() + /*! + \fn int ReplaceIndex() - \brief Get the index of the fieldname InventoryIdIndex form the database + \brief Get the index of the fieldname ReplaceIndex form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getInventoryIdIndex() const { return m_InventoryIdIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getReplaceIndex() const + { + return m_ReplaceIndex; + } + + /*! + \fn int DeviceTypeIdIndex() + + \brief Get the index of the fieldname DeviceTypeIdIndex form the + database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDeviceTypeIdIndex() const + { + return m_DeviceTypeIdIndex; + } + + /*! + \fn int EmployeeIdIndex() + + \brief Get the index of the fieldname EmployeeIdIndex form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getEmployeeIdIndex() const + { + return m_EmployeeIdIndex; + } + + /*! + \fn int PlaceIdIndex() + + \brief Get the index of the fieldname PlaceIdIndex form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPlaceIdIndex() const + { + return m_PlaceIdIndex; + } + + /*! + \fn int DepartmentIdIndex() + + \brief Get the index of the fieldname DepartmentIdIndex form the + database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDepartmentIdIndex() const + { + return m_DepartmentIdIndex; + } + + /*! + \fn int ManufacturerIdIndex() + + \brief Get the index of the fieldname ManufacturerIdIndex form the + database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getManufacturerIdIndex() const + { + return m_ManufacturerIdIndex; + } + + /*! + \fn int InventoryIdIndex() + + \brief Get the index of the fieldname InventoryIdIndex form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getInventoryIdIndex() const + { + return m_InventoryIdIndex; + } + + /*! + \fn int LastUpdateIndex() + + \brief Get the index of the fieldname LastUpdate form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } - /*! - \fn int LastUpdateIndex() +private: + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("fax"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_FaxIdIndex + \brief The value of the FaxIdIndex + */ + int m_FaxIdIndex{0}; - \brief Get the index of the fieldname LastUpdate form the database + /*! + \var int m_DeviceNameIdIndex + \brief The value of the DeviceNameIdIndex + */ + int m_DeviceNameIdIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \var int m_SerialNumberIndex + \brief The value of the SerialNumberIndex + */ + int m_SerialNumberIndex{0}; -private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("fax"); + /*! + \var int m_NumberIndex + \brief The value of the NumberIndex + */ + int m_NumberIndex{0}; - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; + /*! + \var int m_PinIndex + \brief The value of the PinIndex + */ + int m_PinIndex{0}; - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_FaxIdIndex - \brief The value of the FaxIdIndex - */ - int m_FaxIdIndex{ 0 }; - - /*! - \var int m_DeviceNameIdIndex - \brief The value of the DeviceNameIdIndex - */ - int m_DeviceNameIdIndex{ 0 }; - - /*! - \var int m_SerialNumberIndex - \brief The value of the SerialNumberIndex - */ - int m_SerialNumberIndex{ 0 }; - - /*! - \var int m_NumberIndex - \brief The value of the NumberIndex - */ - int m_NumberIndex{ 0 }; - - /*! - \var int m_PinIndex - \brief The value of the PinIndex - */ - int m_PinIndex{ 0 }; - - /*! - \var int m_ActiveIndex - \brief The value of the ActiveIndex - */ - int m_ActiveIndex{ 0 }; - - /*! - \var int m_ReplaceIndex - \brief The value of the ReplaceIndex - */ - int m_ReplaceIndex{ 0 }; - - /*! - \var int m_DeviceTypeIdIndex - \brief The value of the DeviceTypeIdIndex - */ - int m_DeviceTypeIdIndex{ 0 }; - - /*! - \var int m_EmployeeIdIndex - \brief The value of the EmployeeIdIndex - */ - int m_EmployeeIdIndex{ 0 }; - - /*! - \var int m_PlaceIdIndex - \brief The value of the PlaceIdIndex - */ - int m_PlaceIdIndex{ 0 }; + /*! + \var int m_ActiveIndex + \brief The value of the ActiveIndex + */ + int m_ActiveIndex{0}; - /*! - \var int m_DepartmentIdIndex - \brief The value of the DepartmentIdIndex - */ - int m_DepartmentIdIndex{ 0 }; + /*! + \var int m_ReplaceIndex + \brief The value of the ReplaceIndex + */ + int m_ReplaceIndex{0}; - /*! - \var int m_ManufacturerIdIndex - \brief The value of the ManufacturerIdIndex - */ - int m_ManufacturerIdIndex{ 0 }; + /*! + \var int m_DeviceTypeIdIndex + \brief The value of the DeviceTypeIdIndex + */ + int m_DeviceTypeIdIndex{0}; - /*! - \var int m_InventoryIdIndex - \brief The value of the InventoryIdIndex + /*! + \var int m_EmployeeIdIndex + \brief The value of the EmployeeIdIndex + */ + int m_EmployeeIdIndex{0}; + + /*! + \var int m_PlaceIdIndex + \brief The value of the PlaceIdIndex + */ + int m_PlaceIdIndex{0}; + + /*! + \var int m_DepartmentIdIndex + \brief The value of the DepartmentIdIndex + */ + int m_DepartmentIdIndex{0}; + + /*! + \var int m_ManufacturerIdIndex + \brief The value of the ManufacturerIdIndex + */ + int m_ManufacturerIdIndex{0}; + + /*! + \var int m_InventoryIdIndex + \brief The value of the InventoryIdIndex + */ + int m_InventoryIdIndex{0}; + + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex */ - int m_InventoryIdIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/function.h b/apps/libs/models/include/jmbdemodels/function.h index 2ce6b351f..fa5fe7774 100644 --- a/apps/libs/models/include/jmbdemodels/function.h +++ b/apps/libs/models/include/jmbdemodels/function.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class function \brief The Function class @@ -35,159 +36,179 @@ namespace Model { class Function : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn explicit Function() - \brief The Constructor for the EmployeeAccount - */ - explicit JMBDEMODELS_EXPORT Function(); - - /*! - \fn ~Function; - - \brief Destructor for ~Function - */ - JMBDEMODELS_EXPORT ~Function() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int FunctionIdIndex() - - \brief Get the index of the fieldname FunctionId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getFunctionIdIndex() const { return m_FunctionIdIndex; } - - /*! - \fn int NameIndex() - - \brief Get the index of the fieldname NameIn form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNameIndex() const { return m_NameIndex; } - - /*! - \fn int PriorityIndex() - - \brief Get the index of the fieldname Priority form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPriorityIndex() const { return m_PriorityIndex; } - - /*! - \fn int LastUpdateIndex() - - \brief Get the index of the fieldname LastUpdate form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \fn explicit Function() + \brief The Constructor for the EmployeeAccount + */ + explicit JMBDEMODELS_EXPORT Function(); + + /*! + \fn ~Function; + + \brief Destructor for ~Function + */ + JMBDEMODELS_EXPORT ~Function() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int FunctionIdIndex() + + \brief Get the index of the fieldname FunctionId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getFunctionIdIndex() const + { + return m_FunctionIdIndex; + } + + /*! + \fn int NameIndex() + + \brief Get the index of the fieldname NameIn form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNameIndex() const + { + return m_NameIndex; + } + + /*! + \fn int PriorityIndex() + + \brief Get the index of the fieldname Priority form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPriorityIndex() const + { + return m_PriorityIndex; + } + + /*! + \fn int LastUpdateIndex() + + \brief Get the index of the fieldname LastUpdate form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("function"); + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("function"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_FunctionIdIndex + \brief The value of the FunctionIdIndex + */ + int m_FunctionIdIndex{0}; - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; + /*! + \var int m_NameIndex + \brief The value of the NameIndex + */ + int m_NameIndex{0}; - /*! - * @brief DataContext + /*! + \var int m_PriorityIndex + \brief The value of the PriorityIndexx */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_FunctionIdIndex - \brief The value of the FunctionIdIndex - */ - int m_FunctionIdIndex{ 0 }; - - /*! - \var int m_NameIndex - \brief The value of the NameIndex - */ - int m_NameIndex{ 0 }; - - /*! - \var int m_PriorityIndex - \brief The value of the PriorityIndexx - */ - int m_PriorityIndex{ 0 }; + int m_PriorityIndex{0}; - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/inventory.h b/apps/libs/models/include/jmbdemodels/inventory.h index 032985ccf..57224dea7 100644 --- a/apps/libs/models/include/jmbdemodels/inventory.h +++ b/apps/libs/models/include/jmbdemodels/inventory.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class Inventory \brief The Inventory class @@ -35,175 +36,198 @@ namespace Model { class Inventory : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn explicit Inventory() - \brief The Constructor for the Inventory - */ - explicit JMBDEMODELS_EXPORT Inventory(); - - /*! - \fn ~Inventory() override; - - \brief Destructor for Inventory - */ - JMBDEMODELS_EXPORT ~Inventory() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int InventoryIdIndex() - - \brief Get the index of the fieldname InventoryId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getInventoryIdIndex() const { return m_InventoryIdIndex; } - - /*! - \fn int NumberIndex() - - \brief Get the index of the fieldname Number form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNumberIndex() const { return m_NumberIndex; } - - /*! - \fn int DescriptionIndex() - - \brief Get the index of the fieldname Description form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDescriptionIndex() const { return m_DescriptionIndex; } - - /*! - \fn int ActiveIndex() - - \brief Get the index of the fieldname Active form the database + /*! + \fn explicit Inventory() + \brief The Constructor for the Inventory + */ + explicit JMBDEMODELS_EXPORT Inventory(); + + /*! + \fn ~Inventory() override; + + \brief Destructor for Inventory + */ + JMBDEMODELS_EXPORT ~Inventory() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int InventoryIdIndex() + + \brief Get the index of the fieldname InventoryId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getInventoryIdIndex() const + { + return m_InventoryIdIndex; + } + + /*! + \fn int NumberIndex() + + \brief Get the index of the fieldname Number form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNumberIndex() const + { + return m_NumberIndex; + } + + /*! + \fn int DescriptionIndex() + + \brief Get the index of the fieldname Description form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDescriptionIndex() const + { + return m_DescriptionIndex; + } + + /*! + \fn int ActiveIndex() + + \brief Get the index of the fieldname Active form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getActiveIndex() const + { + return m_ActiveIndex; + } + + /*! + \fn int int LastUpateIndex() const + + \brief Get the index of the fieldname LastUpdate form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpateIndex() const + { + return m_LastUpdateIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getActiveIndex() const { return m_ActiveIndex; } +private: + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("inventory"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_InventoryIdIndex + \brief The value of the InventoryIdIndex + */ + int m_InventoryIdIndex{0}; - /*! - \fn int int LastUpateIndex() const + /*! + \var int m_NumberIndex + \brief The value of the NumberIndex + */ + int m_NumberIndex{0}; - \brief Get the index of the fieldname LastUpdate form the database + /*! + \var int m_DescriptionIndex + \brief The value of the DescriptionIndex + */ + int m_DescriptionIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpateIndex() const { return m_LastUpdateIndex; } + /*! + \var int m_ActiveIndex + \brief The value of the ActiveIndex + */ + int m_ActiveIndex{0}; -private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("inventory"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_InventoryIdIndex - \brief The value of the InventoryIdIndex - */ - int m_InventoryIdIndex{ 0 }; - - /*! - \var int m_NumberIndex - \brief The value of the NumberIndex - */ - int m_NumberIndex{ 0 }; - - /*! - \var int m_DescriptionIndex - \brief The value of the DescriptionIndex - */ - int m_DescriptionIndex{ 0 }; - - /*! - \var int m_ActiveIndex - \brief The value of the ActiveIndex - */ - int m_ActiveIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/manufacturer.h b/apps/libs/models/include/jmbdemodels/manufacturer.h index d8de8ef40..c6785eb04 100644 --- a/apps/libs/models/include/jmbdemodels/manufacturer.h +++ b/apps/libs/models/include/jmbdemodels/manufacturer.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class Manufacturer \brief The Manufacturer class @@ -34,280 +35,324 @@ namespace Model { */ class Manufacturer : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn explicit Manufacturer() - \brief The Constructor for the Manufacturer - */ - explicit JMBDEMODELS_EXPORT Manufacturer(); - - /*! - \fn ~Manufacturer(); - - \brief Destructor for Manufacturer - */ - JMBDEMODELS_EXPORT ~Manufacturer() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int ManufacturerIdIndex() - - \brief Get the index of the fieldname ManufacturerId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getManufacturerIdIndex() const { return m_ManufacturerIdIndex; } - - /*! - \fn int NameIndex() - - \brief Get the index of the fieldname Name form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNameIndex() const { return m_NameIndex; } - - /*! - \fn int Name2Index() - - \brief Get the index of the fieldname Name2 form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getName2Index() const { return m_Name2Index; } - - /*! - \fn int SupporterIndex() - - \brief Get the index of the fieldname Supporter form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getSupporterIndex() const { return m_SupporterIndex; } - - /*! - \fn int AddressIndex() - - \brief Get the index of the fieldname Address form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getAddressIndex() const { return m_AddressIndex; } - - /*! - \fn int Address2Index() - - \brief Get the index of the fieldname Address2 form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getAddress2Index() const { return m_Address2Index; } - - /*! - \fn int ZipCityIdIndex() - - \brief Get the index of the fieldname ZipCityId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getZipCityIdIndex() const { return m_ZipCityIdIndex; } - - /*! - \fn int MailAddressIndex() + /*! + \fn explicit Manufacturer() + \brief The Constructor for the Manufacturer + */ + explicit JMBDEMODELS_EXPORT Manufacturer(); + + /*! + \fn ~Manufacturer(); + + \brief Destructor for Manufacturer + */ + JMBDEMODELS_EXPORT ~Manufacturer() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int ManufacturerIdIndex() + + \brief Get the index of the fieldname ManufacturerId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getManufacturerIdIndex() const + { + return m_ManufacturerIdIndex; + } + + /*! + \fn int NameIndex() + + \brief Get the index of the fieldname Name form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNameIndex() const + { + return m_NameIndex; + } + + /*! + \fn int Name2Index() + + \brief Get the index of the fieldname Name2 form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getName2Index() const + { + return m_Name2Index; + } + + /*! + \fn int SupporterIndex() + + \brief Get the index of the fieldname Supporter form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getSupporterIndex() const + { + return m_SupporterIndex; + } + + /*! + \fn int AddressIndex() + + \brief Get the index of the fieldname Address form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getAddressIndex() const + { + return m_AddressIndex; + } + + /*! + \fn int Address2Index() + + \brief Get the index of the fieldname Address2 form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getAddress2Index() const + { + return m_Address2Index; + } + + /*! + \fn int ZipCityIdIndex() + + \brief Get the index of the fieldname ZipCityId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getZipCityIdIndex() const + { + return m_ZipCityIdIndex; + } + + /*! + \fn int MailAddressIndex() + + \brief Get the index of the fieldname MailAddress form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getMailAddressIndex() const + { + return m_MailAddressIndex; + } - \brief Get the index of the fieldname MailAddress form the database + /*! + \fn int PhoneNumberIndex() - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getMailAddressIndex() const { return m_MailAddressIndex; } + \brief Get the index of the fieldname PhoneNumber form the database - /*! - \fn int PhoneNumberIndex() + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPhoneNumberIndex() const + { + return m_PhoneNumberIndex; + } - \brief Get the index of the fieldname PhoneNumber form the database + /*! + \fn int FaxNumberIndex() - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPhoneNumberIndex() const { return m_PhoneNumberIndex; } + \brief Get the index of the fieldname FaxNumber form the database - /*! - \fn int FaxNumberIndex() + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getFaxNumberIndex() const + { + return m_FaxNumberIndex; + } - \brief Get the index of the fieldname FaxNumber form the database + /*! + \fn int HotlineNumberIndex() - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getFaxNumberIndex() const { return m_FaxNumberIndex; } + \brief Get the index of the fieldname HotlineNumber form the database - /*! - \fn int HotlineNumberIndex() + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getHotlineNumberIndex() const + { + return m_HotlineNumberIndex; + } - \brief Get the index of the fieldname HotlineNumber form the database + /*! + \fn int LastUpdateIndex() - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getHotlineNumberIndex() const { return m_HotlineNumberIndex; } + \brief Get the index of the fieldname LastUpdate form the database - /*! - \fn int LastUpdateIndex() + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } - \brief Get the index of the fieldname LastUpdate form the database +private: + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("manufacturer"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_ManufacturerIdIndex + \brief The value of the ManufacturerIdIndex + */ + int m_ManufacturerIdIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \var int m_NameIndex + \brief The value of the NameIndex + */ + int m_NameIndex{0}; -private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("manufacturer"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_ManufacturerIdIndex - \brief The value of the ManufacturerIdIndex - */ - int m_ManufacturerIdIndex{ 0 }; - - /*! - \var int m_NameIndex - \brief The value of the NameIndex - */ - int m_NameIndex{ 0 }; - - /*! - \var int m_Name2Index - \brief The value of the Name2Index - */ - int m_Name2Index{ 0 }; - - /*! - \var int m_SupporterIndex - \brief The value of the SupporterIndex - */ - int m_SupporterIndex{ 0 }; - - /*! - \var int m_AddressIndex - \brief The value of the AddressIndex - */ - int m_AddressIndex{ 0 }; - - /*! - \var int m_Address2Index - \brief The value of the Address2Index - */ - int m_Address2Index{ 0 }; - - /*! - \var int m_ZipCityIdIndex - \brief The value of the ZipCityIdIndex - */ - int m_ZipCityIdIndex{ 0 }; - - /*! - \var int m_MailAddressIndex - \brief The value of the MailAddressIndex - */ - int m_MailAddressIndex{ 0 }; - - /*! - \var int m_PhoneNumberIndex - \brief The value of the PhoneNumberIndex - */ - int m_PhoneNumberIndex{ 0 }; - - /*! - \var int m_FaxNumberIndex - \brief The value of the FaxNumberIndex - */ - int m_FaxNumberIndex{ 0 }; - - /*! - \var int m_HotlineNumberIndex - \brief The value of the HotlineNumberIndex - */ - int m_HotlineNumberIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \var int m_Name2Index + \brief The value of the Name2Index + */ + int m_Name2Index{0}; + + /*! + \var int m_SupporterIndex + \brief The value of the SupporterIndex + */ + int m_SupporterIndex{0}; + + /*! + \var int m_AddressIndex + \brief The value of the AddressIndex + */ + int m_AddressIndex{0}; + + /*! + \var int m_Address2Index + \brief The value of the Address2Index + */ + int m_Address2Index{0}; + + /*! + \var int m_ZipCityIdIndex + \brief The value of the ZipCityIdIndex + */ + int m_ZipCityIdIndex{0}; + + /*! + \var int m_MailAddressIndex + \brief The value of the MailAddressIndex + */ + int m_MailAddressIndex{0}; + + /*! + \var int m_PhoneNumberIndex + \brief The value of the PhoneNumberIndex + */ + int m_PhoneNumberIndex{0}; + + /*! + \var int m_FaxNumberIndex + \brief The value of the FaxNumberIndex + */ + int m_FaxNumberIndex{0}; + + /*! + \var int m_HotlineNumberIndex + \brief The value of the HotlineNumberIndex + */ + int m_HotlineNumberIndex{0}; + + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/mobile.h b/apps/libs/models/include/jmbdemodels/mobile.h index d29e22cf4..5c5221da0 100644 --- a/apps/libs/models/include/jmbdemodels/mobile.h +++ b/apps/libs/models/include/jmbdemodels/mobile.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class Mobile \brief The Mobile is the class to handle the mobiles @@ -34,321 +35,374 @@ namespace Model { */ class Mobile : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn explicit Mobile() - \brief The Constructor for the Mobile - */ - explicit JMBDEMODELS_EXPORT Mobile(); - - /*! - \fn ~Mobile - \brief The destructor for the Mobile - */ - JMBDEMODELS_EXPORT ~Mobile() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int MobileIdIndex() - - \brief Get the index of the fieldname MobileId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getMobileIdIndex() const { return m_MobileIdIndex; } - - /*! - \fn int DeviceNameIdIndex() - - \brief Get the index of the fieldname DeviceNameId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDeviceNameIdIndex() const { return m_DeviceNameIdIndex; } - - /*! - \fn int SerialNumberIndex() - - \brief Get the index of the fieldname SerialNumber form the database + /*! + \fn explicit Mobile() + \brief The Constructor for the Mobile + */ + explicit JMBDEMODELS_EXPORT Mobile(); + + /*! + \fn ~Mobile + \brief The destructor for the Mobile + */ + JMBDEMODELS_EXPORT ~Mobile() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int MobileIdIndex() + + \brief Get the index of the fieldname MobileId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getMobileIdIndex() const + { + return m_MobileIdIndex; + } + + /*! + \fn int DeviceNameIdIndex() + + \brief Get the index of the fieldname DeviceNameId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDeviceNameIdIndex() const + { + return m_DeviceNameIdIndex; + } + + /*! + \fn int SerialNumberIndex() + + \brief Get the index of the fieldname SerialNumber form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getSerialNumberIndex() const + { + return m_SerialNumberIndex; + } + + /*! + \fn int NumberIndex() + + \brief Get the index of the fieldname Number form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNumberIndex() const + { + return m_NumberIndex; + } + + /*! + \fn int PinIndex() + + \brief Get the index of the fieldname Pin form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPinIndex() const + { + return m_PinIndex; + } + + /*! + \fn int CardNumberIndex() + + \brief Get the index of the fieldname CardNumber form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getCardNumberIndex() const + { + return m_CardNumberIndex; + } + + /*! + \fn int ActiveIndex() + + \brief Get the index of the fieldname Active form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getActiveIndex() const + { + return m_ActiveIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getSerialNumberIndex() const { return m_SerialNumberIndex; } + /*! + \fn int ReplaceIndex() - /*! - \fn int NumberIndex() + \brief Get the index of the fieldname Replace form the database - \brief Get the index of the fieldname Number form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getReplaceIndex() const + { + return m_ReplaceIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNumberIndex() const { return m_NumberIndex; } + /*! + \fn int DeviceTypeIdIndex() - /*! - \fn int PinIndex() + \brief Get the index of the fieldname DeviceTypeId form the database - \brief Get the index of the fieldname Pin form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDeviceTypeIdIndex() const + { + return m_DeviceTypeIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPinIndex() const { return m_PinIndex; } + /*! + \fn int EmployeeIdIndex() - /*! - \fn int CardNumberIndex() + \brief Get the index of the fieldname EmployeeId form the database - \brief Get the index of the fieldname CardNumber form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getEmployeeIdIndex() const + { + return m_EmployeeIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getCardNumberIndex() const { return m_CardNumberIndex; } + /*! + \fn int PlaceIdIndex() - /*! - \fn int ActiveIndex() + \brief Get the index of the fieldname PlaceId form the database - \brief Get the index of the fieldname Active form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPlaceIdIndex() const + { + return m_PlaceIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getActiveIndex() const { return m_ActiveIndex; } + /*! + \fn int DepartmentIdIndex() - /*! - \fn int ReplaceIndex() + \brief Get the index of the fieldname DepartmentId form the database - \brief Get the index of the fieldname Replace form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDepartmentIdIndex() const + { + return m_DepartmentIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getReplaceIndex() const { return m_ReplaceIndex; } + /*! + \fn int ManufacturerIdIndex() - /*! - \fn int DeviceTypeIdIndex() + \brief Get the index of the fieldname ManufacturerId form the database - \brief Get the index of the fieldname DeviceTypeId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getManufacturerIdIndex() const + { + return m_ManufacturerIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDeviceTypeIdIndex() const { return m_DeviceTypeIdIndex; } + /*! + \fn int InventoryIdIndex() - /*! - \fn int EmployeeIdIndex() + \brief Get the index of the fieldname InventoryId form the database - \brief Get the index of the fieldname EmployeeId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getInventoryIdIndex() const + { + return m_InventoryIdIndex; + } + + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getEmployeeIdIndex() const { return m_EmployeeIdIndex; } +private: + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("mobile"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_MobileIdIndex + \brief The value of the MobileIdIndex + */ + int m_MobileIdIndex{0}; - /*! - \fn int PlaceIdIndex() + /*! + \var int m_DeviceNameIdIndex + \brief The value of the DeviceNameIdIndex + */ + int m_DeviceNameIdIndex{0}; - \brief Get the index of the fieldname PlaceId form the database + /*! + \var int m_SerialNumberIndex + \brief The value of the SerialNumberIndex + */ + int m_SerialNumberIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPlaceIdIndex() const { return m_PlaceIdIndex; } + /*! + \var int m_NumberIndex + \brief The value of the NumberIndex + */ + int m_NumberIndex{0}; - /*! - \fn int DepartmentIdIndex() + /*! + \var int m_PinIndex + \brief The value of the PinIndex + */ + int m_PinIndex{0}; - \brief Get the index of the fieldname DepartmentId form the database + /*! + \var int m_CardNumberIndex + \brief The value of the CardNumberIndex + */ + int m_CardNumberIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDepartmentIdIndex() const { return m_DepartmentIdIndex; } + /*! + \var int m_ActiveIndex + \brief The value of the ActiveIndex + */ + int m_ActiveIndex{0}; - /*! - \fn int ManufacturerIdIndex() + /*! + \var int m_ReplaceIndex + \brief The value of the ReplaceIndex + */ + int m_ReplaceIndex{0}; - \brief Get the index of the fieldname ManufacturerId form the database + /*! + \var int m_DeviceTypeIdIndex + \brief The value of the DeviceTypeIdIndex + */ + int m_DeviceTypeIdIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getManufacturerIdIndex() const { return m_ManufacturerIdIndex; } + /*! + \var int m_EmployeeIdIndex + \brief The value of the EmployeeIdIndex + */ + int m_EmployeeIdIndex{0}; - /*! - \fn int InventoryIdIndex() + /*! + \var int m_PlaceIdIndex + \brief The value of the PlaceIdIndex + */ + int m_PlaceIdIndex{0}; - \brief Get the index of the fieldname InventoryId form the database + /*! + \var int m_DepartmentIdIndex + \brief The value of the DepartmentIdIndex + */ + int m_DepartmentIdIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getInventoryIdIndex() const { return m_InventoryIdIndex; } + /*! + \var int m_ManufacturerIdIndex + \brief The value of the ManufacturerIdIndex + */ + int m_ManufacturerIdIndex{0}; - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \var int m_InventoryIdIndex + \brief The value of the InventoryIdIndex + */ + int m_InventoryIdIndex{0}; -private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("mobile"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_MobileIdIndex - \brief The value of the MobileIdIndex - */ - int m_MobileIdIndex{ 0 }; - - /*! - \var int m_DeviceNameIdIndex - \brief The value of the DeviceNameIdIndex - */ - int m_DeviceNameIdIndex{ 0 }; - - /*! - \var int m_SerialNumberIndex - \brief The value of the SerialNumberIndex + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex */ - int m_SerialNumberIndex{ 0 }; - - /*! - \var int m_NumberIndex - \brief The value of the NumberIndex - */ - int m_NumberIndex{ 0 }; - - /*! - \var int m_PinIndex - \brief The value of the PinIndex - */ - int m_PinIndex{ 0 }; - - /*! - \var int m_CardNumberIndex - \brief The value of the CardNumberIndex - */ - int m_CardNumberIndex{ 0 }; - - /*! - \var int m_ActiveIndex - \brief The value of the ActiveIndex - */ - int m_ActiveIndex{ 0 }; - - /*! - \var int m_ReplaceIndex - \brief The value of the ReplaceIndex - */ - int m_ReplaceIndex{ 0 }; - - /*! - \var int m_DeviceTypeIdIndex - \brief The value of the DeviceTypeIdIndex - */ - int m_DeviceTypeIdIndex{ 0 }; - - /*! - \var int m_EmployeeIdIndex - \brief The value of the EmployeeIdIndex - */ - int m_EmployeeIdIndex{ 0 }; - - /*! - \var int m_PlaceIdIndex - \brief The value of the PlaceIdIndex - */ - int m_PlaceIdIndex{ 0 }; - - /*! - \var int m_DepartmentIdIndex - \brief The value of the DepartmentIdIndex - */ - int m_DepartmentIdIndex{ 0 }; - - /*! - \var int m_ManufacturerIdIndex - \brief The value of the ManufacturerIdIndex - */ - int m_ManufacturerIdIndex{ 0 }; - - /*! - \var int m_InventoryIdIndex - \brief The value of the InventoryIdIndex - */ - int m_InventoryIdIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/os.h b/apps/libs/models/include/jmbdemodels/os.h index 7776a6a5e..eb278bdc6 100644 --- a/apps/libs/models/include/jmbdemodels/os.h +++ b/apps/libs/models/include/jmbdemodels/os.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class OS \brief The OS class @@ -34,190 +35,216 @@ namespace Model { */ class OS : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn explicit OS() - \brief The Constructor for the Inventory - */ - explicit JMBDEMODELS_EXPORT OS(); - - /*! - \fn ~OS(); - - \brief Destructor for OS - */ - JMBDEMODELS_EXPORT ~OS() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int OSIdIndex() - - \brief Get the index of the fieldname OSId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getOSIdIndex() const { return m_OSIdIndex; } - - /*! - \fn int NameIndex() const + /*! + \fn explicit OS() + \brief The Constructor for the Inventory + */ + explicit JMBDEMODELS_EXPORT OS(); + + /*! + \fn ~OS(); + + \brief Destructor for OS + */ + JMBDEMODELS_EXPORT ~OS() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int OSIdIndex() + + \brief Get the index of the fieldname OSId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getOSIdIndex() const + { + return m_OSIdIndex; + } + + /*! + \fn int NameIndex() const + + \brief Get the index of the fieldname Number form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNameIndex() const + { + return m_NameIndex; + } + + /*! + \fn int VersionIndex() + + \brief Get the index of the fieldname Version form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getVersionIndex() const + { + return m_VersionIndex; + } - \brief Get the index of the fieldname Number form the database + /*! + \fn int RevisionIndex() - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNameIndex() const { return m_NameIndex; } + \brief Get the index of the fieldname Revision form the database - /*! - \fn int VersionIndex() + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getRevisionIndex() const + { + return m_RevisionIndex; + } - \brief Get the index of the fieldname Version form the database + /*! + \fn int FixIndex() - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getVersionIndex() const { return m_VersionIndex; } + \brief Get the index of the fieldname Fix form the database - /*! - \fn int RevisionIndex() + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getFixIndex() const + { + return m_FixIndex; + } - \brief Get the index of the fieldname Revision form the database + /*! + \fn int LastUpdateIndex() - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getRevisionIndex() const { return m_RevisionIndex; } + \brief Get the index of the fieldname LastUpdate form the database - /*! - \fn int FixIndex() + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } - \brief Get the index of the fieldname Fix form the database +private: + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("os"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_OSIdIndex + \brief The value of the OSId + */ + int m_OSIdIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getFixIndex() const { return m_FixIndex; } + /*! + \var int m_NameIndex + \brief The value of the Name + */ + int m_NameIndex{0}; - /*! - \fn int LastUpdateIndex() + /*! + \var int m_VersionIndex + \brief The value of the Version + */ + int m_VersionIndex{0}; - \brief Get the index of the fieldname LastUpdate form the database + /*! + \var int m_RevisionIndex + \brief The value of the Revision + */ + int m_RevisionIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \var int m_FixIndex + \brief The value of the Fix + */ + int m_FixIndex{0}; -private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("os"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_OSIdIndex - \brief The value of the OSId - */ - int m_OSIdIndex{ 0 }; - - /*! - \var int m_NameIndex - \brief The value of the Name - */ - int m_NameIndex{ 0 }; - - /*! - \var int m_VersionIndex - \brief The value of the Version - */ - int m_VersionIndex{ 0 }; - - /*! - \var int m_RevisionIndex - \brief The value of the Revision - */ - int m_RevisionIndex{ 0 }; - - /*! - \var int m_FixIndex - \brief The value of the Fix - */ - int m_FixIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/phone.h b/apps/libs/models/include/jmbdemodels/phone.h index 0557635ee..cde1b7dac 100644 --- a/apps/libs/models/include/jmbdemodels/phone.h +++ b/apps/libs/models/include/jmbdemodels/phone.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class Phone \brief The Phone is the class to handle the phones @@ -36,307 +37,357 @@ namespace Model { */ class Phone : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn explicit Phone() - \brief The Constructor for the Phone - */ - explicit JMBDEMODELS_EXPORT Phone(); - - /*! - \fn ~Phone() - \brief The destructor for the Phone - */ - JMBDEMODELS_EXPORT ~Phone() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } + /*! + \fn explicit Phone() + \brief The Constructor for the Phone + */ + explicit JMBDEMODELS_EXPORT Phone(); + + /*! + \fn ~Phone() + \brief The destructor for the Phone + */ + JMBDEMODELS_EXPORT ~Phone() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int PhoneIdIndex() + + \brief Get the index of the fieldname PhoneId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPhoneIdIndex() const + { + return m_PhoneIdIndex; + } + + /*! + \fn int DeviceNameIdIndex() + + \brief Get the index of the fieldname DeviceNameId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDeviceNameIdIndex() const + { + return m_DeviceNameIdIndex; + } + + /*! + \fn int SerialNumberIndex() + + \brief Get the index of the fieldname SerialNumber form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getSerialNumberIndex() const + { + return m_SerialNumberIndex; + } + + /*! + \fn int NumberIndex() + + \brief Get the index of the fieldname Number form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNumberIndex() const + { + return m_NumberIndex; + } - /*! - \fn int PhoneIdIndex() + /*! + \fn int PinIndex() - \brief Get the index of the fieldname PhoneId form the database + \brief Get the index of the fieldname Pin form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPhoneIdIndex() const { return m_PhoneIdIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPinIndex() const + { + return m_PinIndex; + } - /*! - \fn int DeviceNameIdIndex() + /*! + \fn int ActiveIndex() - \brief Get the index of the fieldname DeviceNameId form the database + \brief Get the index of the fieldname Active form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDeviceNameIdIndex() const { return m_DeviceNameIdIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getActiveIndex() const + { + return m_ActiveIndex; + } - /*! - \fn int SerialNumberIndex() + /*! + \fn int ReplaceIndex() - \brief Get the index of the fieldname SerialNumber form the database + \brief Get the index of the fieldname Replace form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getSerialNumberIndex() const { return m_SerialNumberIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getReplaceIndex() const + { + return m_ReplaceIndex; + } - /*! - \fn int NumberIndex() + /*! + \fn int DeviceTypeIdIndex() - \brief Get the index of the fieldname Number form the database + \brief Get the index of the fieldname DeviceTypeId form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNumberIndex() const { return m_NumberIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDeviceTypeIdIndex() const + { + return m_DeviceTypeIdIndex; + } - /*! - \fn int PinIndex() + /*! + \fn int EmployeeIdIndex() - \brief Get the index of the fieldname Pin form the database + \brief Get the index of the fieldname EmployeeId form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPinIndex() const { return m_PinIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getEmployeeIdIndex() const + { + return m_EmployeeIdIndex; + } - /*! - \fn int ActiveIndex() + /*! + \fn int PlaceIdIndex() - \brief Get the index of the fieldname Active form the database + \brief Get the index of the fieldname PlaceId form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getActiveIndex() const { return m_ActiveIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPlaceIdIndex() const + { + return m_PlaceIdIndex; + } - /*! - \fn int ReplaceIndex() + /*! + \fn int DepartmentIdIndex() - \brief Get the index of the fieldname Replace form the database + \brief Get the index of the fieldname DepartmentId form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getReplaceIndex() const { return m_ReplaceIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDepartmentIdIndex() const + { + return m_DepartmentIdIndex; + } - /*! - \fn int DeviceTypeIdIndex() + /*! + \fn int ManufacturerIdIndex() - \brief Get the index of the fieldname DeviceTypeId form the database + \brief Get the index of the fieldname ManufacturerId form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDeviceTypeIdIndex() const { return m_DeviceTypeIdIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getManufacturerIdIndex() const + { + return m_ManufacturerIdIndex; + } - /*! - \fn int EmployeeIdIndex() + /*! + \fn int InventoryIdIndex() - \brief Get the index of the fieldname EmployeeId form the database + \brief Get the index of the fieldname InventoryId form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getEmployeeIdIndex() const { return m_EmployeeIdIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getInventoryIdIndex() const + { + return m_InventoryIdIndex; + } + + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } - /*! - \fn int PlaceIdIndex() +private: + /** + * @brief tableName - the name of the database table + * @ + */ + const QString m_tableName = QLatin1String("phone"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_PhoneIdIndex + \brief The value of the PhoneIdIndex + */ + int m_PhoneIdIndex{0}; - \brief Get the index of the fieldname PlaceId form the database + /*! + \var int m_DeviceNameIdIndex + \brief The value of the DeviceNameIdIndex + */ + int m_DeviceNameIdIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPlaceIdIndex() const { return m_PlaceIdIndex; } + /*! + \var int m_SerialNumberIndex + \brief The value of the SerialNumberIndex + */ + int m_SerialNumberIndex{0}; - /*! - \fn int DepartmentIdIndex() + /*! + \var int m_NumberIndex + \brief The value of the NumberIndex + */ + int m_NumberIndex{0}; - \brief Get the index of the fieldname DepartmentId form the database + /*! + \var int m_PinIndex + \brief The value of the PinIndex + */ + int m_PinIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDepartmentIdIndex() const { return m_DepartmentIdIndex; } + /*! + \var int m_ActiveIndex + \brief The value of the ActiveIndex + */ + int m_ActiveIndex{0}; - /*! - \fn int ManufacturerIdIndex() + /*! + \var int m_ReplaceIndex + \brief The value of the ReplaceIndex + */ + int m_ReplaceIndex{0}; - \brief Get the index of the fieldname ManufacturerId form the database + /*! + \var int m_DeviceTypeIdIndex + \brief The value of the DeviceTypeIdIndex + */ + int m_DeviceTypeIdIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getManufacturerIdIndex() const { return m_ManufacturerIdIndex; } + /*! + \var int m_EmployeeIdIndex + \brief The value of the EmployeeIdIndex + */ + int m_EmployeeIdIndex{0}; - /*! - \fn int InventoryIdIndex() + /*! + \var int m_PlaceIdIndex + \brief The value of the PlaceIdIndex + */ + int m_PlaceIdIndex{0}; - \brief Get the index of the fieldname InventoryId form the database + /*! + \var int m_DepartmentIdIndex + \brief The value of the DepartmentIdIndex + */ + int m_DepartmentIdIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getInventoryIdIndex() const { return m_InventoryIdIndex; } + /*! + \var int m_ManufacturerIdIndex + \brief The value of the ManufacturerIdIndex + */ + int m_ManufacturerIdIndex{0}; - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \var int m_InventoryIdIndex + \brief The value of the InventoryIdIndex + */ + int m_InventoryIdIndex{0}; -private: - /** - * @brief tableName - the name of the database table - * @ - */ - const QString m_tableName = QLatin1String("phone"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_PhoneIdIndex - \brief The value of the PhoneIdIndex - */ - int m_PhoneIdIndex{ 0 }; - - /*! - \var int m_DeviceNameIdIndex - \brief The value of the DeviceNameIdIndex - */ - int m_DeviceNameIdIndex{ 0 }; - - /*! - \var int m_SerialNumberIndex - \brief The value of the SerialNumberIndex + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex */ - int m_SerialNumberIndex{ 0 }; - - /*! - \var int m_NumberIndex - \brief The value of the NumberIndex - */ - int m_NumberIndex{ 0 }; - - /*! - \var int m_PinIndex - \brief The value of the PinIndex - */ - int m_PinIndex{ 0 }; - - /*! - \var int m_ActiveIndex - \brief The value of the ActiveIndex - */ - int m_ActiveIndex{ 0 }; - - /*! - \var int m_ReplaceIndex - \brief The value of the ReplaceIndex - */ - int m_ReplaceIndex{ 0 }; - - /*! - \var int m_DeviceTypeIdIndex - \brief The value of the DeviceTypeIdIndex - */ - int m_DeviceTypeIdIndex{ 0 }; - - /*! - \var int m_EmployeeIdIndex - \brief The value of the EmployeeIdIndex - */ - int m_EmployeeIdIndex{ 0 }; - - /*! - \var int m_PlaceIdIndex - \brief The value of the PlaceIdIndex - */ - int m_PlaceIdIndex{ 0 }; - - /*! - \var int m_DepartmentIdIndex - \brief The value of the DepartmentIdIndex - */ - int m_DepartmentIdIndex{ 0 }; - - /*! - \var int m_ManufacturerIdIndex - \brief The value of the ManufacturerIdIndex - */ - int m_ManufacturerIdIndex{ 0 }; - - /*! - \var int m_InventoryIdIndex - \brief The value of the InventoryIdIndex - */ - int m_InventoryIdIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/place.h b/apps/libs/models/include/jmbdemodels/place.h index 52ef55d40..d1f5af3b0 100644 --- a/apps/libs/models/include/jmbdemodels/place.h +++ b/apps/libs/models/include/jmbdemodels/place.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class Mobile \brief The Mobile is the class to handle the mobiles @@ -35,171 +36,194 @@ namespace Model { */ class Place : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn explicit Place(QObject *parent = nullptr) - \brief The Constructor for the Place - */ - explicit JMBDEMODELS_EXPORT Place(); - - /*! - \fn ~Place() - \brief The destructor for the Place - */ - JMBDEMODELS_EXPORT ~Place() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int PlaceIdIndex() - - \brief Get the index of the fieldname PlaceId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPlaceIdIndex() const { return m_PlaceIdIndex; } - - /*! - \fn int NameIndex() - - \brief Get the index of the fieldname Name form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNameIndex() const { return m_NameIndex; } - - /*! - \fn int RoomIndex() - - \brief Get the index of the fieldname Room form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getRoomIndex() const { return m_RoomIndex; } - - /*! - \fn int DeskIndex() - - \brief Get the index of the fieldname Desk form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDeskIndex() const { return m_DeskIndex; } - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \fn explicit Place(QObject *parent = nullptr) + \brief The Constructor for the Place + */ + explicit JMBDEMODELS_EXPORT Place(); + + /*! + \fn ~Place() + \brief The destructor for the Place + */ + JMBDEMODELS_EXPORT ~Place() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int PlaceIdIndex() + + \brief Get the index of the fieldname PlaceId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPlaceIdIndex() const + { + return m_PlaceIdIndex; + } + + /*! + \fn int NameIndex() + + \brief Get the index of the fieldname Name form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNameIndex() const + { + return m_NameIndex; + } + + /*! + \fn int RoomIndex() + + \brief Get the index of the fieldname Room form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getRoomIndex() const + { + return m_RoomIndex; + } + + /*! + \fn int DeskIndex() + + \brief Get the index of the fieldname Desk form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDeskIndex() const + { + return m_DeskIndex; + } + + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("place"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_PlaceIdIndex - \brief The value of the PlaceIdIndex - */ - int m_PlaceIdIndex{ 0 }; - - /*! - \var int m_NameIndex - \brief The value of the NameIndex - */ - int m_NameIndex{ 0 }; - - /*! - \var int m_RoomIndex - \brief The value of the RoomIndex - */ - int m_RoomIndex{ 0 }; - - /*! - \var int m_DeskIndex - \brief The value of the DeskIndex - */ - int m_DeskIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("place"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_PlaceIdIndex + \brief The value of the PlaceIdIndex + */ + int m_PlaceIdIndex{0}; + + /*! + \var int m_NameIndex + \brief The value of the NameIndex + */ + int m_NameIndex{0}; + + /*! + \var int m_RoomIndex + \brief The value of the RoomIndex + */ + int m_RoomIndex{0}; + + /*! + \var int m_DeskIndex + \brief The value of the DeskIndex + */ + int m_DeskIndex{0}; + + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/printer.h b/apps/libs/models/include/jmbdemodels/printer.h index 101cd6bd3..96bacd91e 100644 --- a/apps/libs/models/include/jmbdemodels/printer.h +++ b/apps/libs/models/include/jmbdemodels/printer.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class Printer \brief The Printer class @@ -35,383 +36,448 @@ namespace Model { class Printer : public CommonData { public: - /*! - \fn Printer() + /*! + \fn Printer() - \brief Constructor for the Account - */ - explicit JMBDEMODELS_EXPORT Printer(); + \brief Constructor for the Account + */ + explicit JMBDEMODELS_EXPORT Printer(); - /*! - \fn ~Printer() override; + /*! + \fn ~Printer() override; - \brief Destructor for Printer - */ - JMBDEMODELS_EXPORT ~Printer() {} + \brief Destructor for Printer + */ + JMBDEMODELS_EXPORT ~Printer() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int PrinterIdIndex() + + \brief Get the index of the fieldname PrinterId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPrinterIdIndex() const + { + return m_PrinterIdIndex; + } + + /*! + \fn nt SerialNumberIndex() const + + \brief Get the index of the fieldname ServiceNumber form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getSerialNumberIndex() const + { + return m_SerialNumberIndex; + } - // implement the virtuals + /*! + \fn int NetworkIndex() - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; + \brief Get the index of the fieldname Network form the database - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNetworkIndex() const + { + return m_NetworkIndex; + } - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel + /*! + \fn int NetworkNameIndex() - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + \brief Get the index of the fieldname NetworkName form the database - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNetworkNameIndex() const + { + return m_NetworkNameIndex; + } - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + /*! + \fn int NetworkIpAddressIndex() - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + \brief Get the index of the fieldname NetworkIpAddress form the database - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNetworkIpAddressIndex() const + { + return m_NetworkIpAddressIndex; + } - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + /*! + \fn int ActiveIndex() - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString + \brief Get the index of the fieldname Active form the database - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getActiveIndex() const + { + return m_ActiveIndex; + } - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } + /*! + \fn int ReplaceIndex() - /*! - \fn int PrinterIdIndex() + \brief Get the index of the fieldname Replace form the database - \brief Get the index of the fieldname PrinterId form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getReplaceIndex() const + { + return m_ReplaceIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPrinterIdIndex() const { return m_PrinterIdIndex; } + /*! + \fn int ResourcesIndex() - /*! - \fn nt SerialNumberIndex() const + \brief Get the index of the fieldname Resources form the database - \brief Get the index of the fieldname ServiceNumber form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getResourcesIndex() const + { + return m_ResourcesIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getSerialNumberIndex() const { return m_SerialNumberIndex; } + /*! + \fn int PaperSizeMaxIndex() - /*! - \fn int NetworkIndex() + \brief Get the index of the fieldname PaperSizeMax form the database - \brief Get the index of the fieldname Network form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPaperSizeMaxIndex() const + { + return m_PaperSizeMaxIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNetworkIndex() const { return m_NetworkIndex; } + /*! + \fn int ColorIndex() - /*! - \fn int NetworkNameIndex() + \brief Get the index of the fieldname Color form the database - \brief Get the index of the fieldname NetworkName form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getColorIndex() const + { + return m_ColorIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNetworkNameIndex() const { return m_NetworkNameIndex; } + /*! + \fn int DeviceNameIdIndex() - /*! - \fn int NetworkIpAddressIndex() + \brief Get the index of the fieldname DeviceName form the database - \brief Get the index of the fieldname NetworkIpAddress form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDeviceNameIdIndex() const + { + return m_DeviceNameIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNetworkIpAddressIndex() const { return m_NetworkIpAddressIndex; } + /*! + \fn int DeviceTypeIdIndex() - /*! - \fn int ActiveIndex() + \brief Get the index of the fieldname DeviceTypeId form the database - \brief Get the index of the fieldname Active form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getDeviceTypeIdIndex() const + { + return m_DeviceTypeIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getActiveIndex() const { return m_ActiveIndex; } + /*! + \fn int EmployeeIdIndex() - /*! - \fn int ReplaceIndex() + \brief Get the index of the fieldname EmployeeId form the database - \brief Get the index of the fieldname Replace form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getEmployeeIdIndex() const + { + return m_EmployeeIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getReplaceIndex() const { return m_ReplaceIndex; } + /*! + \fn int PlaceIdIndex() - /*! - \fn int ResourcesIndex() + \brief Get the index of the fieldname PlaceId form the database - \brief Get the index of the fieldname Resources form the database + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getPlaceIdIndex() const + { + return m_PlaceIdIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getResourcesIndex() const { return m_ResourcesIndex; } - - /*! - \fn int PaperSizeMaxIndex() - - \brief Get the index of the fieldname PaperSizeMax form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPaperSizeMaxIndex() const { return m_PaperSizeMaxIndex; } - - /*! - \fn int ColorIndex() - - \brief Get the index of the fieldname Color form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getColorIndex() const { return m_ColorIndex; } + /*! + \fn int DepartmentIdIndex() - /*! - \fn int DeviceNameIdIndex() - - \brief Get the index of the fieldname DeviceName form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDeviceNameIdIndex() const { return m_DeviceNameIdIndex; } - - /*! - \fn int DeviceTypeIdIndex() - - \brief Get the index of the fieldname DeviceTypeId form the database + \brief Get the index of the fieldname DepartmentId form the database Returns the value of the index */ - JMBDEMODELS_EXPORT int getDeviceTypeIdIndex() const { return m_DeviceTypeIdIndex; } + JMBDEMODELS_EXPORT int getDepartmentIdIndex() const + { + return m_DepartmentIdIndex; + } - /*! - \fn int EmployeeIdIndex() + /*! + \fn int ManufacurerIdIndex() const - \brief Get the index of the fieldname EmployeeId form the database + \brief Get the index of the fieldname ManufacturerId form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getEmployeeIdIndex() const { return m_EmployeeIdIndex; } - - /*! - \fn int PlaceIdIndex() + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getManufacurerIdIndex() const + { + return m_ManufacturerIdIndex; + } - \brief Get the index of the fieldname PlaceId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getPlaceIdIndex() const { return m_PlaceIdIndex; } + /*! + \fn int InventoryIdIndex() - /*! - \fn int DepartmentIdIndex() + \brief Get the index of the fieldname InventoryId form the database - \brief Get the index of the fieldname DepartmentId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getDepartmentIdIndex() const { return m_DepartmentIdIndex; } - - /*! - \fn int ManufacurerIdIndex() const - - \brief Get the index of the fieldname ManufacturerId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getManufacurerIdIndex() const { return m_ManufacturerIdIndex; } - - /*! - \fn int InventoryIdIndex() - - \brief Get the index of the fieldname InventoryId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getInventoryIdIndex() const { return m_InventoryIdIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getInventoryIdIndex() const + { + return m_InventoryIdIndex; + } - /*! - \fn int ComputerIdIndex() + /*! + \fn int ComputerIdIndex() - \brief Get the index of the fieldname ComputerId form the database + \brief Get the index of the fieldname ComputerId form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getComputerIdIndex() const { return m_ComputerIdIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getComputerIdIndex() const + { + return m_ComputerIdIndex; + } - /*! - \fn int LastUpdateIndex() + /*! + \fn int LastUpdateIndex() - \brief Get the index of the fieldname LastUpdate form the database + \brief Get the index of the fieldname LastUpdate form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("printer"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_PrinterrIdIndex - \brief The value of the PrinterIdIndex - */ - int m_PrinterIdIndex{ 0 }; - - /*! - \var int m_Name - \brief The value of the NameIndex - */ - int m_SerialNumberIndex{ 0 }; - - /*! - \var nt m_NetworkIndex - \brief The value of the NetworkIndex - */ - int m_NetworkIndex{ 0 }; - - /*! - \var nt m_NetworkNameIndex - \brief The value of the NetworkNameIndex - */ - int m_NetworkNameIndex{ 0 }; - - /*! - \var nt m_NetworkIpAddressIndex - \brief The value of the NetworkIpAddressIndex - */ - int m_NetworkIpAddressIndex{ 0 }; - - /*! - \var int m_ActiveIndex - \brief The value of the ActiveIndex - */ - int m_ActiveIndex{ 0 }; - - /*! - \var int m_ReplaceIndex - \brief The value of the ReplaceIndex - */ - int m_ReplaceIndex{ 0 }; - - /*! - \var int m_ResourcesIndex - \brief The value of the ResourcesIndex - */ - int m_ResourcesIndex{ 0 }; - - /*! - \var int m_PaperSizeMaxIndex - \brief The value of the PaperSizeMaxIndex - */ - int m_PaperSizeMaxIndex{ 0 }; - - /*! - \var int m_ColorIndex - \brief The value of the ColorIndex - */ - int m_ColorIndex{ 0 }; + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("printer"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_PrinterrIdIndex + \brief The value of the PrinterIdIndex + */ + int m_PrinterIdIndex{0}; + + /*! + \var int m_Name + \brief The value of the NameIndex + */ + int m_SerialNumberIndex{0}; + + /*! + \var nt m_NetworkIndex + \brief The value of the NetworkIndex + */ + int m_NetworkIndex{0}; + + /*! + \var nt m_NetworkNameIndex + \brief The value of the NetworkNameIndex + */ + int m_NetworkNameIndex{0}; + + /*! + \var nt m_NetworkIpAddressIndex + \brief The value of the NetworkIpAddressIndex + */ + int m_NetworkIpAddressIndex{0}; + + /*! + \var int m_ActiveIndex + \brief The value of the ActiveIndex + */ + int m_ActiveIndex{0}; + + /*! + \var int m_ReplaceIndex + \brief The value of the ReplaceIndex + */ + int m_ReplaceIndex{0}; + + /*! + \var int m_ResourcesIndex + \brief The value of the ResourcesIndex + */ + int m_ResourcesIndex{0}; + + /*! + \var int m_PaperSizeMaxIndex + \brief The value of the PaperSizeMaxIndex + */ + int m_PaperSizeMaxIndex{0}; + + /*! + \var int m_ColorIndex + \brief The value of the ColorIndex + */ + int m_ColorIndex{0}; + + /*! + \var int m_DeviceNameIdIndex + \brief The value of the DeviceNameIdIndex + */ + int m_DeviceNameIdIndex{0}; + + /*! + \var int m_DeviceTypeIdIndex + \brief The value of the DeviceTypeIdIndex + */ + int m_DeviceTypeIdIndex{0}; - /*! - \var int m_DeviceNameIdIndex - \brief The value of the DeviceNameIdIndex - */ - int m_DeviceNameIdIndex{ 0 }; - - /*! - \var int m_DeviceTypeIdIndex - \brief The value of the DeviceTypeIdIndex - */ - int m_DeviceTypeIdIndex{ 0 }; - - /*! - \var int m_EmployeeIdIndex - \brief The value of the EmployeeIdIndexx - */ - int m_EmployeeIdIndex{ 0 }; - - /*! - \var int m_Name - \brief The value of the NameIndex - */ - int m_PlaceIdIndex{ 0 }; + /*! + \var int m_EmployeeIdIndex + \brief The value of the EmployeeIdIndexx + */ + int m_EmployeeIdIndex{0}; + + /*! + \var int m_Name + \brief The value of the NameIndex + */ + int m_PlaceIdIndex{0}; + + /*! + \var int m_DepartmentIdIndex + \brief The value of the DepartmentIdIndex + */ + int m_DepartmentIdIndex{0}; + + /*! + \var int m_ManufacturerIdIndex + \brief The value of the ManufacturerIdIndex + */ + int m_ManufacturerIdIndex{0}; + + /*! + \var int m_InventoryIdIndex + \brief The value of the InventoryIdIndex + */ + int m_InventoryIdIndex{0}; - /*! - \var int m_DepartmentIdIndex - \brief The value of the DepartmentIdIndex - */ - int m_DepartmentIdIndex{ 0 }; + /*! + \var int m_ComputerIdIndex + \brief The value of the ComputerIdIndex + */ + int m_ComputerIdIndex{0}; - /*! - \var int m_ManufacturerIdIndex - \brief The value of the ManufacturerIdIndex - */ - int m_ManufacturerIdIndex{ 0 }; - - /*! - \var int m_InventoryIdIndex - \brief The value of the InventoryIdIndex - */ - int m_InventoryIdIndex{ 0 }; - - /*! - \var int m_ComputerIdIndex - \brief The value of the ComputerIdIndex - */ - int m_ComputerIdIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/processor.h b/apps/libs/models/include/jmbdemodels/processor.h index b0459f36d..b985a23db 100644 --- a/apps/libs/models/include/jmbdemodels/processor.h +++ b/apps/libs/models/include/jmbdemodels/processor.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class Processor \brief The Processor is the class to handle the processors @@ -36,168 +37,191 @@ namespace Model { class Processor : public CommonData { public: - /*! - \fn explicit Processor() - \brief The Constructor for the Processor - */ - explicit JMBDEMODELS_EXPORT Processor(); - - /*! - \fn ~Processor - \brief The destructor for the Processor - */ - JMBDEMODELS_EXPORT ~Processor() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int ProcessorIdIndex() - - \brief Get the index of the fieldname ProcessorId form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getProcessorIdIndex() const { return m_ProcessorIdIndex; } - - /*! - \fn int NameIndex() - - \brief Get the index of the fieldname Name form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNameIndex() const { return m_NameIndex; } - - /*! - \fn int ClockRateIndex() - - \brief Get the index of the fieldname ClockRate form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getClockRateIndex() const { return m_ClockRateIndex; } - - /*! - \fn int CoresIndex() + /*! + \fn explicit Processor() + \brief The Constructor for the Processor + */ + explicit JMBDEMODELS_EXPORT Processor(); + + /*! + \fn ~Processor + \brief The destructor for the Processor + */ + JMBDEMODELS_EXPORT ~Processor() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int ProcessorIdIndex() + + \brief Get the index of the fieldname ProcessorId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getProcessorIdIndex() const + { + return m_ProcessorIdIndex; + } + + /*! + \fn int NameIndex() + + \brief Get the index of the fieldname Name form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNameIndex() const + { + return m_NameIndex; + } + + /*! + \fn int ClockRateIndex() - \brief Get the index of the fieldname Cores form the database + \brief Get the index of the fieldname ClockRate form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getCoresIndex() const { return m_CoresIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getClockRateIndex() const + { + return m_ClockRateIndex; + } + + /*! + \fn int CoresIndex() + + \brief Get the index of the fieldname Cores form the database - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getCoresIndex() const + { + return m_CoresIndex; + } + + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("processor"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_ProcessorIdIndex - \brief The value of the ProcessorIdIndex - */ - int m_ProcessorIdIndex{ 0 }; - - /*! - \var int m_NameIndex - \brief The value of the Name - */ - int m_NameIndex{ 0 }; - - /*! - \var int m_ClockRateIndex - \brief The value of the ClockRate ndex - */ - int m_ClockRateIndex{ 0 }; - - /*! - \var int m_CoresIndex - \brief The value of the CoresIndex - */ - int m_CoresIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("processor"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_ProcessorIdIndex + \brief The value of the ProcessorIdIndex + */ + int m_ProcessorIdIndex{0}; + + /*! + \var int m_NameIndex + \brief The value of the Name + */ + int m_NameIndex{0}; + + /*! + \var int m_ClockRateIndex + \brief The value of the ClockRate ndex + */ + int m_ClockRateIndex{0}; + + /*! + \var int m_CoresIndex + \brief The value of the CoresIndex + */ + int m_CoresIndex{0}; + + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/software.h b/apps/libs/models/include/jmbdemodels/software.h index 32a0115e2..0b6793112 100644 --- a/apps/libs/models/include/jmbdemodels/software.h +++ b/apps/libs/models/include/jmbdemodels/software.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class Software \brief The Software class @@ -34,203 +35,229 @@ namespace Model { */ class Software : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn Software() - - \brief Constructor for the Software - */ - explicit JMBDEMODELS_EXPORT Software(); - - /*! - \fn ~Software(); - - \brief Destructor for Software - */ - JMBDEMODELS_EXPORT ~Software() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + /*! + \fn Software() + + \brief Constructor for the Software + */ + explicit JMBDEMODELS_EXPORT Software(); + + /*! + \fn ~Software(); + + \brief Destructor for Software + */ + JMBDEMODELS_EXPORT ~Software() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int SoftwareIdIndex() + + \brief Get the index of the fieldname SoftwareId form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getSoftwareIdIndex() const + { + return m_SoftwareIdIndex; + } + + /*! + \fn int NameIndex() + + \brief Get the index of the fieldname Name form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNameIndex() const + { + return m_NameIndex; + } + + /*! + \fn int VersionIndex() + + \brief Get the index of the fieldname Version form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getVersionIndex() const + { + return m_VersionIndex; + } - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString + /*! + \fn int RevisionIndex() - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + \brief Get the index of the fieldname Revision form the database - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase + Returns the value of the index */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } + JMBDEMODELS_EXPORT int getRevisionIndex() const + { + return m_RevisionIndex; + } - /*! - \fn int SoftwareIdIndex() + /*! + \fn int FixIndex() - \brief Get the index of the fieldname SoftwareId form the database + \brief Get the index of the fieldname Fix form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getSoftwareIdIndex() const { return m_SoftwareIdIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getFixIndex() const + { + return m_FixIndex; + } - /*! - \fn int NameIndex() + /*! + \fn int LastUpdateIndex() - \brief Get the index of the fieldname Name form the database + \brief Get the index of the fieldname LastUpdate form the database Returns the value of the index */ - JMBDEMODELS_EXPORT int getNameIndex() const { return m_NameIndex; } - - /*! - \fn int VersionIndex() - - \brief Get the index of the fieldname Version form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getVersionIndex() const { return m_VersionIndex; } - - /*! - \fn int RevisionIndex() - - \brief Get the index of the fieldname Revision form the database + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getRevisionIndex() const { return m_RevisionIndex; } - - /*! - \fn int FixIndex() - - \brief Get the index of the fieldname Fix form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getFixIndex() const { return m_FixIndex; } - - /*! - \fn int LastUpdateIndex() +private: + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("software"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + \brief holds an initialised pointer to the Relationmodel + \sa QSqlRelationalTableModel + */ + QSqlRelationalTableModel *m_model{nullptr}; + + /*! + \brief holds an initialised pointer to the ItemSelectioModel + \sa QItemSelectionModel + */ + QItemSelectionModel *m_selectionModel{nullptr}; - \brief Get the index of the fieldname LastUpdate form the database + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \var int m_SoftwareIdIndex + \brief The value of the SoftwareId + */ + int m_SoftwareIdIndex{0}; -private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("software"); + /*! + \var int m_NameIndex + \brief The value of the Name + */ + int m_NameIndex{0}; - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; + /*! + \var int m_VersionIndex + \brief The value of the Version + */ + int m_VersionIndex{0}; - /*! - \brief holds an initialised pointer to the Relationmodel - \sa QSqlRelationalTableModel - */ - QSqlRelationalTableModel *m_model{ nullptr }; + /*! + \var int m_RevisionIndex + \brief The value of the Revision + */ + int m_RevisionIndex{0}; - /*! - \brief holds an initialised pointer to the ItemSelectioModel - \sa QItemSelectionModel - */ - QItemSelectionModel *m_selectionModel{ nullptr }; + /*! + \var int m_FixIndex + \brief The value of the Fix + */ + int m_FixIndex{0}; - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_SoftwareIdIndex - \brief The value of the SoftwareId - */ - int m_SoftwareIdIndex{ 0 }; - - /*! - \var int m_NameIndex - \brief The value of the Name - */ - int m_NameIndex{ 0 }; - - /*! - \var int m_VersionIndex - \brief The value of the Version - */ - int m_VersionIndex{ 0 }; - - /*! - \var int m_RevisionIndex - \brief The value of the Revision - */ - int m_RevisionIndex{ 0 }; - - /*! - \var int m_FixIndex - \brief The value of the Fix - */ - int m_FixIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/systemdata.h b/apps/libs/models/include/jmbdemodels/systemdata.h index aba30ed48..e27a8e600 100644 --- a/apps/libs/models/include/jmbdemodels/systemdata.h +++ b/apps/libs/models/include/jmbdemodels/systemdata.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class SystemData \brief The SystemData class @@ -34,176 +35,199 @@ namespace Model { */ class SystemData : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn SystemData() - - \brief Constructor for the SystemData - */ - explicit JMBDEMODELS_EXPORT SystemData(); - - /*! - \fn ~SystemData() override; - - \brief Destructor for SystemData - */ - JMBDEMODELS_EXPORT ~SystemData() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int SystemDataIdIndex() - - \brief Get the index of the fieldname SystemDataId from the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getSystemDataIdIndex() const { return m_SystemDataIdIndex; } - - /*! - \fn int NameIndex() - - \brief Get the index of the fieldname Name from the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNameIndex() const { return m_NameIndex; } - - /*! - \fn int LocalIndex() - - \brief Get the index of the fieldname Local from the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLocalIndex() const { return m_LocalIndex; } - - /*! - \fn int CompanyIdIndex() - - \brief Get the index of the fieldname CompanyId from the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getCompanyIdIndex() const { return m_CompanyIdIndex; } + /*! + \fn SystemData() + + \brief Constructor for the SystemData + */ + explicit JMBDEMODELS_EXPORT SystemData(); + + /*! + \fn ~SystemData() override; + + \brief Destructor for SystemData + */ + JMBDEMODELS_EXPORT ~SystemData() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int SystemDataIdIndex() + + \brief Get the index of the fieldname SystemDataId from the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getSystemDataIdIndex() const + { + return m_SystemDataIdIndex; + } + + /*! + \fn int NameIndex() + + \brief Get the index of the fieldname Name from the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getNameIndex() const + { + return m_NameIndex; + } + + /*! + \fn int LocalIndex() + + \brief Get the index of the fieldname Local from the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLocalIndex() const + { + return m_LocalIndex; + } + + /*! + \fn int CompanyIdIndex() + + \brief Get the index of the fieldname CompanyId from the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getCompanyIdIndex() const + { + return m_CompanyIdIndex; + } + + /*! + \fn int LastUpdateIndex() + + \brief Get the index of the fieldname LastUpdate form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } - /*! - \fn int LastUpdateIndex() +private: + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("system_data"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_SystemDataIdIndex + \brief The value of the SystemDataIdIndex + */ + int m_SystemDataIdIndex{0}; + + /*! + \var int m_NameIndex + \brief The value of the NameIndex + */ + int m_NameIndex{0}; - \brief Get the index of the fieldname LastUpdate form the database + /*! + \var int m_LocalIndex + \brief The value of the LocalIndex + */ + int m_LocalIndex{0}; - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \var int m_CompanyIdIndex + \brief The value of the CompanyIdIndex + */ + int m_CompanyIdIndex{0}; -private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("system_data"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_SystemDataIdIndex - \brief The value of the SystemDataIdIndex - */ - int m_SystemDataIdIndex{ 0 }; - - /*! - \var int m_NameIndex - \brief The value of the NameIndex - */ - int m_NameIndex{ 0 }; - - /*! - \var int m_LocalIndex - \brief The value of the LocalIndex - */ - int m_LocalIndex{ 0 }; - - /*! - \var int m_CompanyIdIndex - \brief The value of the CompanyIdIndex - */ - int m_CompanyIdIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/title.h b/apps/libs/models/include/jmbdemodels/title.h index d6bb4400c..6c0e6ada9 100644 --- a/apps/libs/models/include/jmbdemodels/title.h +++ b/apps/libs/models/include/jmbdemodels/title.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class Title \brief The Title class @@ -34,157 +35,177 @@ namespace Model { */ class Title : public CommonData { - Q_OBJECT + Q_OBJECT public: - /*! - \fn Title() - - \brief Constructor for the Title - */ - explicit JMBDEMODELS_EXPORT Title(); - - /*! - \fn ~Title(); - - \brief Destructor for Title - */ - JMBDEMODELS_EXPORT ~Title() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int TitleIdIndex() - - \brief Get the index of the fieldname TitleId from the database + /*! + \fn Title() + + \brief Constructor for the Title + */ + explicit JMBDEMODELS_EXPORT Title(); + + /*! + \fn ~Title(); + + \brief Destructor for Title + */ + JMBDEMODELS_EXPORT ~Title() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int TitleIdIndex() + + \brief Get the index of the fieldname TitleId from the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getTitleIdIndex() const + { + return m_TitleIdIndex; + } + + /*! + \fn int NameIndex() + + \brief Get the index of the fieldname Name from the database Returns the value of the index */ - JMBDEMODELS_EXPORT int getTitleIdIndex() const { return m_TitleIdIndex; } - - /*! - \fn int NameIndex() - - \brief Get the index of the fieldname Name from the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getNameIndex() const { return m_NameIndex; } - - /*! - \fn int FromDateIndex() - - \brief Get the index of the fieldname FromDate from the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getFromDateIndex() const { return m_FromDateIndex; } + JMBDEMODELS_EXPORT int getNameIndex() const + { + return m_NameIndex; + } - /*! - \fn int LastUpdateIndex() + /*! + \fn int FromDateIndex() - \brief Get the index of the fieldname LastUpdate form the database + \brief Get the index of the fieldname FromDate from the database Returns the value of the index */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } - -private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("title"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; + JMBDEMODELS_EXPORT int getFromDateIndex() const + { + return m_FromDateIndex; + } - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_TitleIdIndex - \brief The value of the TitleIdIndex - */ - int m_TitleIdIndex{ 0 }; + /*! + \fn int LastUpdateIndex() - /*! - \var int m_NameIndex - \brief The value of the NameIndex - */ - int m_NameIndex{ 0 }; + \brief Get the index of the fieldname LastUpdate form the database - /*! - \var int m_FromDateIndex - \brief The value of the FromDateIndex - */ - int m_FromDateIndex{ 0 }; + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } - int m_LastUpdateIndex{ 0 }; +private: + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("title"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_TitleIdIndex + \brief The value of the TitleIdIndex + */ + int m_TitleIdIndex{0}; + + /*! + \var int m_NameIndex + \brief The value of the NameIndex + */ + int m_NameIndex{0}; + + /*! + \var int m_FromDateIndex + \brief The value of the FromDateIndex + */ + int m_FromDateIndex{0}; + + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/zipcity.h b/apps/libs/models/include/jmbdemodels/zipcity.h index b77f1556c..5703a2287 100644 --- a/apps/libs/models/include/jmbdemodels/zipcity.h +++ b/apps/libs/models/include/jmbdemodels/zipcity.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class ZipCity \brief The ZipCity class @@ -35,158 +36,178 @@ namespace Model { class ZipCity : public CommonData { public: - /*! - \fn ZipCity() - - \brief Constructor for the ZipCity - */ - explicit JMBDEMODELS_EXPORT ZipCity(); - - /*! - \fn ~ZipCity(); - - \brief Destructor for ZipCity - */ - JMBDEMODELS_EXPORT ~ZipCity() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int ZipCityIdIndex() - - \brief Get the index of the fieldname ZipCityId from the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getZipCityIdIndex() const { return m_ZipCityIdIndex; } - - /*! - \fn int ZipCodeIdIndex() - - \brief Get the index of the fieldname ZipCodeId from the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getZipCodeIdIndex() const { return m_ZipCodeIdIndex; } - - /*! - \fn int CityIdIndex() - - \brief Get the index of the fieldname CityId from the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getCityIdIndex() const { return m_CityIdIndex; } + /*! + \fn ZipCity() + + \brief Constructor for the ZipCity + */ + explicit JMBDEMODELS_EXPORT ZipCity(); + + /*! + \fn ~ZipCity(); + + \brief Destructor for ZipCity + */ + JMBDEMODELS_EXPORT ~ZipCity() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int ZipCityIdIndex() + + \brief Get the index of the fieldname ZipCityId from the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getZipCityIdIndex() const + { + return m_ZipCityIdIndex; + } + + /*! + \fn int ZipCodeIdIndex() + + \brief Get the index of the fieldname ZipCodeId from the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getZipCodeIdIndex() const + { + return m_ZipCodeIdIndex; + } + + /*! + \fn int CityIdIndex() + + \brief Get the index of the fieldname CityId from the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getCityIdIndex() const + { + return m_CityIdIndex; + } - /*! - \fn int LastUpdateIndex() + /*! + \fn int LastUpdateIndex() - \brief Get the index of the fieldname LastUpdate form the database + \brief Get the index of the fieldname LastUpdate form the database - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("zip_city"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_ZipCityIdIndex - \brief The value of the ZipCityIdIndex - */ - int m_ZipCityIdIndex{ 0 }; - - /*! - \var int m_ZipCodeIdIndex - \brief The value of the ZipCodeIdIndex - */ - int m_ZipCodeIdIndex{ 0 }; - - /*! - \var int m_CityIdIndex - \brief The value of the CityIdIndex - */ - int m_CityIdIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("zip_city"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_ZipCityIdIndex + \brief The value of the ZipCityIdIndex + */ + int m_ZipCityIdIndex{0}; + + /*! + \var int m_ZipCodeIdIndex + \brief The value of the ZipCodeIdIndex + */ + int m_ZipCodeIdIndex{0}; + + /*! + \var int m_CityIdIndex + \brief The value of the CityIdIndex + */ + int m_CityIdIndex{0}; + + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/include/jmbdemodels/zipcode.h b/apps/libs/models/include/jmbdemodels/zipcode.h index 59e0d4e16..723b5627c 100644 --- a/apps/libs/models/include/jmbdemodels/zipcode.h +++ b/apps/libs/models/include/jmbdemodels/zipcode.h @@ -21,7 +21,8 @@ #include "jmbdemodels_export.h" -namespace Model { +namespace Model +{ /*! \class ZipCode \brief The ZipCodet class @@ -35,143 +36,160 @@ namespace Model { class ZipCode : public CommonData { public: - /*! - \fn ZipCode() - - \brief Constructor for the ZipCode - */ - explicit JMBDEMODELS_EXPORT ZipCode(); - - /*! - \fn ~ZipCode(); - - \brief Destructor for ZipCode - */ - JMBDEMODELS_EXPORT ~ZipCode() {} - - // implement the virtuals - - /*! - \fn virtual void setIndexes() - \brief Set the fieldindexes from the datafieldnames of the db. - */ - virtual JMBDEMODELS_EXPORT void setIndexes() final; - - /*! - \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> - QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for - the DataModel \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* - fina \brief Initialize the InputDataModel - - \return The QSqlRelationalTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; - - /*! - \fn virtual auto initializeViewModel() -> QSqlTableModel* final - \brief Initialize the ViewModel - - \return QSqlTableModel - */ - virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; - - /*! - \fn virtual auto initializeListModel() -> QSqlTableModel* final - \brief Initiallize the list Model for select one dataset - */ - virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; - - /*! - * \fn virtual auto generateTableString(const QString& header) -> QString - final \brief generateTableString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; - - /*! - \fn virtual auto generateFormularString(const QString& header) -> QString - final \brief generateFormularString - - \return a QString with the generated Table for Output - */ - virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; - - // Getter - /*! - * \brief getTableName - * \return - */ - JMBDEMODELS_EXPORT auto getTableName() const -> QString { return this->m_tableName; } - /*! - \fn auot getDB() const -> QSqlDatabase - */ - JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase { return this->m_db; } - - /*! - \fn int ZipCodeIdIndex() - - \brief Get the index of the fieldname ZipCodeId from the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getZipCodeIdIndex() const { return m_ZipCodeIdIndex; } - - /*! - \fn int CodeIndex() - - \brief Get the index of the fieldname Code from the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getCodeIndex() const { return m_CodeIndex; } - - /*! - \fn int LastUpdateIndex() - - \brief Get the index of the fieldname LastUpdate form the database - - Returns the value of the index - */ - JMBDEMODELS_EXPORT int getLastUpdateIndex() const { return m_LastUpdateIndex; } + /*! + \fn ZipCode() + + \brief Constructor for the ZipCode + */ + explicit JMBDEMODELS_EXPORT ZipCode(); + + /*! + \fn ~ZipCode(); + + \brief Destructor for ZipCode + */ + JMBDEMODELS_EXPORT ~ZipCode() + { + } + + // implement the virtuals + + /*! + \fn virtual void setIndexes() + \brief Set the fieldindexes from the datafieldnames of the db. + */ + virtual JMBDEMODELS_EXPORT void setIndexes() final; + + /*! + \fn virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> + QSqlRelationalTableModel* final \brief set the QSqlRelationalTableModel for + the DataModel \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeRelationalModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeInputDataModel() -> QSqlRelationalTableModel* + fina \brief Initialize the InputDataModel + + \return The QSqlRelationalTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeInputDataModel() -> QSqlRelationalTableModel * final; + + /*! + \fn virtual auto initializeViewModel() -> QSqlTableModel* final + \brief Initialize the ViewModel + + \return QSqlTableModel + */ + virtual JMBDEMODELS_EXPORT auto initializeViewModel() -> QSqlTableModel * final; + + /*! + \fn virtual auto initializeListModel() -> QSqlTableModel* final + \brief Initiallize the list Model for select one dataset + */ + virtual JMBDEMODELS_EXPORT auto initializeListModel() -> QSqlTableModel * final; + + /*! + * \fn virtual auto generateTableString(const QString& header) -> QString + final \brief generateTableString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateTableString(const QString &header) -> QString final; + + /*! + \fn virtual auto generateFormularString(const QString& header) -> QString + final \brief generateFormularString + + \return a QString with the generated Table for Output + */ + virtual JMBDEMODELS_EXPORT auto generateFormularString(const QString &header) -> QString final; + + // Getter + /*! + * \brief getTableName + * \return + */ + JMBDEMODELS_EXPORT auto getTableName() const -> QString + { + return this->m_tableName; + } + /*! + \fn auot getDB() const -> QSqlDatabase + */ + JMBDEMODELS_EXPORT auto getDB() const -> QSqlDatabase + { + return this->m_db; + } + + /*! + \fn int ZipCodeIdIndex() + + \brief Get the index of the fieldname ZipCodeId from the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getZipCodeIdIndex() const + { + return m_ZipCodeIdIndex; + } + + /*! + \fn int CodeIndex() + + \brief Get the index of the fieldname Code from the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getCodeIndex() const + { + return m_CodeIndex; + } + + /*! + \fn int LastUpdateIndex() + + \brief Get the index of the fieldname LastUpdate form the database + + Returns the value of the index + */ + JMBDEMODELS_EXPORT int getLastUpdateIndex() const + { + return m_LastUpdateIndex; + } private: - /*! - \brief The Tablename in the database \e is const - */ - const QString m_tableName = QLatin1String("zip_code"); - - /*! - * @ brief m_db - */ - QSqlDatabase m_db = {}; - - /*! - * @brief DataContext - */ - Model::DataContext *m_dataContext = {}; - - /*! - \var int m_ZipCodeIdIndex - \brief The value of the ZipCodeIdIndex - */ - int m_ZipCodeIdIndex{ 0 }; - - /*! - \var int m_CodeIndex - \brief The value of the CodeIndex - */ - int m_CodeIndex{ 0 }; - - /*! - \var int m_LastUpdateIndex - \brief The value of the LastUpdateIndex - */ - int m_LastUpdateIndex{ 0 }; + /*! + \brief The Tablename in the database \e is const + */ + const QString m_tableName = QLatin1String("zip_code"); + + /*! + * @ brief m_db + */ + QSqlDatabase m_db = {}; + + /*! + * @brief DataContext + */ + Model::DataContext *m_dataContext = {}; + + /*! + \var int m_ZipCodeIdIndex + \brief The value of the ZipCodeIdIndex + */ + int m_ZipCodeIdIndex{0}; + + /*! + \var int m_CodeIndex + \brief The value of the CodeIndex + */ + int m_CodeIndex{0}; + + /*! + \var int m_LastUpdateIndex + \brief The value of the LastUpdateIndex + */ + int m_LastUpdateIndex{0}; }; -}// namespace Model +} // namespace Model diff --git a/apps/libs/models/src/account.cpp b/apps/libs/models/src/account.cpp index 1206655a4..810ef5d33 100644 --- a/apps/libs/models/src/account.cpp +++ b/apps/libs/models/src/account.cpp @@ -9,102 +9,100 @@ Model::Account::Account() { - this->m_dataContext = new Model::DataContext(); - this->m_db = m_dataContext->getDatabase(); + this->m_dataContext = new Model::DataContext(); + this->m_db = m_dataContext->getDatabase(); - // Set the Model - this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); - this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); + // Set the Model + this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model->setTable(this->m_tableName); + this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); - setIndexes(); + setIndexes(); } void Model::Account::setIndexes() { - m_AccountIdIndex = this->m_model->fieldIndex(QLatin1String("account_id")); - m_UserNameIndex = this->m_model->fieldIndex(QLatin1String("user_name")); - m_PasswordIndex = this->m_model->fieldIndex(QLatin1String("password")); - m_SystemDataIdIndex = this->m_model->fieldIndex(QLatin1String("system_data_id")); - m_LastUpdateIndex = this->m_model->fieldIndex(QLatin1String("last_update")); + m_AccountIdIndex = this->m_model->fieldIndex(QLatin1String("account_id")); + m_UserNameIndex = this->m_model->fieldIndex(QLatin1String("user_name")); + m_PasswordIndex = this->m_model->fieldIndex(QLatin1String("password")); + m_SystemDataIdIndex = this->m_model->fieldIndex(QLatin1String("system_data_id")); + m_LastUpdateIndex = this->m_model->fieldIndex(QLatin1String("last_update")); } auto Model::Account::initializeRelationalModel() -> QSqlRelationalTableModel * { - this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); - this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); + this->m_model->setTable(this->m_tableName); + this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); - this->m_model->select(); + this->m_model->select(); - return this->m_model; + return this->m_model; } auto Model::Account::initializeInputDataModel() -> QSqlRelationalTableModel * { - this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); + this->m_model->setTable(this->m_tableName); - return this->m_model; + return this->m_model; } auto Model::Account::initializeViewModel() -> QSqlTableModel * { - this->m_model->select(); + this->m_model->select(); - return this->m_model; + return this->m_model; } auto Model::Account::initializeListModel() -> QSqlTableModel * { - auto *listModel = new QSqlTableModel(this, this->m_db); - listModel->setTable(this->m_tableName); - listModel->setEditStrategy(QSqlTableModel::OnManualSubmit); - listModel->select(); + auto *listModel = new QSqlTableModel(this, this->m_db); + listModel->setTable(this->m_tableName); + listModel->setEditStrategy(QSqlTableModel::OnManualSubmit); + listModel->select(); - return listModel; + return listModel; } auto Model::Account::generateTableString(const QString &header) -> QString { - QString outString; + QString outString; - qDebug() << "Header:" << header << "( Columns: " << this->m_model->columnCount() - << " Rows: " << this->m_model->rowCount() << " )"; + qDebug() << "Header:" << header << "( Columns: " << this->m_model->columnCount() << " Rows: " << this->m_model->rowCount() << " )"; - QList set; + QList set; - // Document Title - outString = QLatin1String("

"); - outString += header; - outString += QLatin1String("

"); - outString += QLatin1String("
"); - outString += QLatin1String(R"()"); - outString += QLatin1String(""); + // Document Title + outString = QLatin1String("

"); + outString += header; + outString += QLatin1String("

"); + outString += QLatin1String("
"); + outString += QLatin1String(R"(
)"); + outString += QLatin1String(""); - for (const auto i : set) { - outString += QLatin1String(""); - } + for (const auto i : set) { + outString += QLatin1String(""); + } - return outString; + return outString; } auto Model::Account::generateFormularString(const QString &header) -> QString { - QString outString; + QString outString; - qDebug() << "Header:" << header << "( Columns: " << this->m_model->columnCount() - << " Rows: " << this->m_model->rowCount() << " )"; + qDebug() << "Header:" << header << "( Columns: " << this->m_model->columnCount() << " Rows: " << this->m_model->rowCount() << " )"; - // Document Title - outString = QLatin1String("

"); - outString += header; - outString += QLatin1String("

"); - outString += QLatin1String("
"); + // Document Title + outString = QLatin1String("

"); + outString += header; + outString += QLatin1String("

"); + outString += QLatin1String("
"); - return outString; + return outString; } diff --git a/apps/libs/models/src/chipcard.cpp b/apps/libs/models/src/chipcard.cpp index 48378c4e2..346093ada 100644 --- a/apps/libs/models/src/chipcard.cpp +++ b/apps/libs/models/src/chipcard.cpp @@ -9,103 +9,101 @@ Model::ChipCard::ChipCard() { - this->m_dataContext = new Model::DataContext(); - this->m_db = m_dataContext->getDatabase(); + this->m_dataContext = new Model::DataContext(); + this->m_db = m_dataContext->getDatabase(); - // Set the Model - this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); - this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); + // Set the Model + this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model->setTable(this->m_tableName); + this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); - setIndexes(); + setIndexes(); } void Model::ChipCard::setIndexes() { - m_ChipCardIdIndex = this->m_model->fieldIndex(QLatin1String("chip_card_id")); - m_NumberIndex = this->m_model->fieldIndex(QLatin1String("number")); - m_ChipCardDoorIdIndex = this->m_model->fieldIndex(QLatin1String("chip_card_door_id")); - m_ChipCardProfileIdIndex = this->m_model->fieldIndex(QLatin1String("chip_card_profile_id")); - m_EmployeeIdIndex = this->m_model->fieldIndex(QLatin1String("employee_id")); - m_LastUpdateIndex = this->m_model->fieldIndex(QLatin1String("last_update")); + m_ChipCardIdIndex = this->m_model->fieldIndex(QLatin1String("chip_card_id")); + m_NumberIndex = this->m_model->fieldIndex(QLatin1String("number")); + m_ChipCardDoorIdIndex = this->m_model->fieldIndex(QLatin1String("chip_card_door_id")); + m_ChipCardProfileIdIndex = this->m_model->fieldIndex(QLatin1String("chip_card_profile_id")); + m_EmployeeIdIndex = this->m_model->fieldIndex(QLatin1String("employee_id")); + m_LastUpdateIndex = this->m_model->fieldIndex(QLatin1String("last_update")); } auto Model::ChipCard::initializeRelationalModel() -> QSqlRelationalTableModel * { - this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); - this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); + this->m_model->setTable(this->m_tableName); + this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); - this->m_model->select(); + this->m_model->select(); - return this->m_model; + return this->m_model; } auto Model::ChipCard::initializeInputDataModel() -> QSqlRelationalTableModel * { - this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); + this->m_model->setTable(this->m_tableName); - return this->m_model; + return this->m_model; } auto Model::ChipCard::initializeViewModel() -> QSqlTableModel * { - this->m_model->select(); + this->m_model->select(); - return this->m_model; + return this->m_model; } auto Model::ChipCard::initializeListModel() -> QSqlTableModel * { - auto *listModel = new QSqlTableModel(this, this->m_db); - listModel->setTable(this->m_tableName); - listModel->setEditStrategy(QSqlTableModel::OnManualSubmit); - listModel->select(); + auto *listModel = new QSqlTableModel(this, this->m_db); + listModel->setTable(this->m_tableName); + listModel->setEditStrategy(QSqlTableModel::OnManualSubmit); + listModel->select(); - return listModel; + return listModel; } auto Model::ChipCard::generateTableString(const QString &header) -> QString { - QString outString; + QString outString; - qDebug() << "Header:" << header << "( Columns: " << this->m_model->columnCount() << " Rows: " << m_model->rowCount() - << " )"; + qDebug() << "Header:" << header << "( Columns: " << this->m_model->columnCount() << " Rows: " << m_model->rowCount() << " )"; - QList set; + QList set; - // Document Title - outString = QLatin1String("

"); - outString += header; - outString += QLatin1String("

"); - outString += QLatin1String("
"); - outString += QLatin1String(R"(
"); - outString.append(m_model->headerData(i, Qt::Horizontal).toString()); - outString += QLatin1String(""); + outString.append(m_model->headerData(i, Qt::Horizontal).toString()); + outString += QLatin1String("
)"); - outString += QLatin1String(""); + // Document Title + outString = QLatin1String("

"); + outString += header; + outString += QLatin1String("

"); + outString += QLatin1String("
"); + outString += QLatin1String(R"(
)"); + outString += QLatin1String(""); - for (const auto i : set) { - outString += QLatin1String(""); - } + for (const auto i : set) { + outString += QLatin1String(""); + } - return outString; + return outString; } auto Model::ChipCard::generateFormularString(const QString &header) -> QString { - QString outString; + QString outString; - qDebug() << "Header:" << header << "( Columns: " << this->m_model->columnCount() << " Rows: " << m_model->rowCount() - << " )"; + qDebug() << "Header:" << header << "( Columns: " << this->m_model->columnCount() << " Rows: " << m_model->rowCount() << " )"; - // Document Title - outString = QLatin1String("

"); - outString += header; - outString += QLatin1String("

"); - outString += QLatin1String("
"); + // Document Title + outString = QLatin1String("

"); + outString += header; + outString += QLatin1String("

"); + outString += QLatin1String("
"); - return outString; + return outString; } diff --git a/apps/libs/models/src/chipcarddoor.cpp b/apps/libs/models/src/chipcarddoor.cpp index 75c13aff5..e3465216a 100644 --- a/apps/libs/models/src/chipcarddoor.cpp +++ b/apps/libs/models/src/chipcarddoor.cpp @@ -7,106 +7,105 @@ #include "jmbdemodels/chipcarddoor.h" -Model::ChipCardDoor::ChipCardDoor() : CommonData() +Model::ChipCardDoor::ChipCardDoor() + : CommonData() { - this->m_dataContext = new Model::DataContext(); - this->m_db = m_dataContext->getDatabase(); + this->m_dataContext = new Model::DataContext(); + this->m_db = m_dataContext->getDatabase(); - // Set the Model - this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); - this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); + // Set the Model + this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model->setTable(this->m_tableName); + this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); - setIndexes(); + setIndexes(); } void Model::ChipCardDoor::setIndexes() { - m_ChipCardDoorIdIndex = m_model->fieldIndex(QLatin1String("chip_card_door_id")); - m_NumberIndex = m_model->fieldIndex(QLatin1String("number")); - m_PlaceIdIndex = m_model->fieldIndex(QLatin1String("place_id")); - m_DepartmetIdIndex = m_model->fieldIndex(QLatin1String("department_id")); - m_EmployeeIdIndex = m_model->fieldIndex(QLatin1String("employee_id")); - m_LastUpdateIndex = m_model->fieldIndex(QLatin1String("last_update")); + m_ChipCardDoorIdIndex = m_model->fieldIndex(QLatin1String("chip_card_door_id")); + m_NumberIndex = m_model->fieldIndex(QLatin1String("number")); + m_PlaceIdIndex = m_model->fieldIndex(QLatin1String("place_id")); + m_DepartmetIdIndex = m_model->fieldIndex(QLatin1String("department_id")); + m_EmployeeIdIndex = m_model->fieldIndex(QLatin1String("employee_id")); + m_LastUpdateIndex = m_model->fieldIndex(QLatin1String("last_update")); } auto Model::ChipCardDoor::initializeRelationalModel() -> QSqlRelationalTableModel * { - this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); - this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); + this->m_model->setTable(this->m_tableName); + this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); - this->m_model->select(); + this->m_model->select(); - return this->m_model; + return this->m_model; } auto Model::ChipCardDoor::initializeInputDataModel() -> QSqlRelationalTableModel * { - this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); + this->m_model->setTable(this->m_tableName); - return this->m_model; + return this->m_model; } auto Model::ChipCardDoor::initializeViewModel() -> QSqlTableModel * { - this->m_model->select(); + this->m_model->select(); - return this->m_model; + return this->m_model; } auto Model::ChipCardDoor::initializeListModel() -> QSqlTableModel * { - auto *listModel = new QSqlTableModel(this, this->m_db); - listModel->setTable(this->m_tableName); - listModel->setEditStrategy(QSqlTableModel::OnManualSubmit); - listModel->select(); + auto *listModel = new QSqlTableModel(this, this->m_db); + listModel->setTable(this->m_tableName); + listModel->setEditStrategy(QSqlTableModel::OnManualSubmit); + listModel->select(); - return listModel; + return listModel; } auto Model::ChipCardDoor::generateTableString(const QString &header) -> QString { - QString outString; + QString outString; - qDebug() << "Header:" << header << "( Columns: " << m_model->columnCount() << " Rows: " << m_model->rowCount() - << " )"; + qDebug() << "Header:" << header << "( Columns: " << m_model->columnCount() << " Rows: " << m_model->rowCount() << " )"; - QList set; + QList set; - // Document Title - outString = QLatin1String("

"); - outString += header; - outString += QLatin1String("

"); - outString += QLatin1String("
"); - outString += QLatin1String(R"(
"); - outString.append(m_model->headerData(i, Qt::Horizontal).toString()); - outString += QLatin1String(""); + outString.append(m_model->headerData(i, Qt::Horizontal).toString()); + outString += QLatin1String("
)"); - outString += QLatin1String(""); + // Document Title + outString = QLatin1String("

"); + outString += header; + outString += QLatin1String("

"); + outString += QLatin1String("
"); + outString += QLatin1String(R"(
)"); + outString += QLatin1String(""); - for (const auto i : set) { - qDebug() << "int i = " << i; - outString += QLatin1String(""); - } + for (const auto i : set) { + qDebug() << "int i = " << i; + outString += QLatin1String(""); + } - return outString; + return outString; } auto Model::ChipCardDoor::generateFormularString(const QString &header) -> QString { - QString outString; + QString outString; - qDebug() << "Header:" << header << "( Columns: " << m_model->columnCount() << " Rows: " << m_model->rowCount() - << " )"; + qDebug() << "Header:" << header << "( Columns: " << m_model->columnCount() << " Rows: " << m_model->rowCount() << " )"; - // Document Title - outString = QLatin1String("

"); - outString += header; - outString += QLatin1String("

"); - outString += QLatin1String("
"); + // Document Title + outString = QLatin1String("

"); + outString += header; + outString += QLatin1String("

"); + outString += QLatin1String("
"); - return outString; + return outString; } diff --git a/apps/libs/models/src/chipcardprofile.cpp b/apps/libs/models/src/chipcardprofile.cpp index 7eab48d05..184272d52 100644 --- a/apps/libs/models/src/chipcardprofile.cpp +++ b/apps/libs/models/src/chipcardprofile.cpp @@ -7,104 +7,103 @@ #include "jmbdemodels/chipcardprofile.h" -Model::ChipCardProfile::ChipCardProfile() : CommonData() +Model::ChipCardProfile::ChipCardProfile() + : CommonData() { - this->m_dataContext = new Model::DataContext(); - this->m_db = m_dataContext->getDatabase(); + this->m_dataContext = new Model::DataContext(); + this->m_db = m_dataContext->getDatabase(); - // Set the Model - this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); - this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); + // Set the Model + this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model->setTable(this->m_tableName); + this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); - setIndexes(); + setIndexes(); } void Model::ChipCardProfile::setIndexes() { - m_ChipCardProfileIdIndex = this->m_model->fieldIndex(QLatin1String("chip_card_profile_id")); - m_NumberIndex = this->m_model->fieldIndex(QLatin1String("number")); - m_ChipCardDoorIdIndex = this->m_model->fieldIndex(QLatin1String("chip_card_door_id")); - m_EmployeeIdIndex = this->m_model->fieldIndex(QLatin1String("employee_id")); - m_LastUpdateIndex = this->m_model->fieldIndex(QLatin1String("last_update")); + m_ChipCardProfileIdIndex = this->m_model->fieldIndex(QLatin1String("chip_card_profile_id")); + m_NumberIndex = this->m_model->fieldIndex(QLatin1String("number")); + m_ChipCardDoorIdIndex = this->m_model->fieldIndex(QLatin1String("chip_card_door_id")); + m_EmployeeIdIndex = this->m_model->fieldIndex(QLatin1String("employee_id")); + m_LastUpdateIndex = this->m_model->fieldIndex(QLatin1String("last_update")); } auto Model::ChipCardProfile::initializeRelationalModel() -> QSqlRelationalTableModel * { - this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); - this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); + this->m_model->setTable(this->m_tableName); + this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); - this->m_model->select(); + this->m_model->select(); - return this->m_model; + return this->m_model; } auto Model::ChipCardProfile::initializeInputDataModel() -> QSqlRelationalTableModel * { - m_model = new QSqlRelationalTableModel(this, this->m_db); + m_model = new QSqlRelationalTableModel(this, this->m_db); - m_model->setTable(this->m_tableName); + m_model->setTable(this->m_tableName); - return m_model; + return m_model; } auto Model::ChipCardProfile::initializeViewModel() -> QSqlTableModel * { - m_model->select(); + m_model->select(); - return m_model; + return m_model; } auto Model::ChipCardProfile::initializeListModel() -> QSqlTableModel * { - auto *listModel = new QSqlTableModel(this, this->m_db); - listModel->setTable(this->m_tableName); - listModel->setEditStrategy(QSqlTableModel::OnManualSubmit); - listModel->select(); + auto *listModel = new QSqlTableModel(this, this->m_db); + listModel->setTable(this->m_tableName); + listModel->setEditStrategy(QSqlTableModel::OnManualSubmit); + listModel->select(); - return listModel; + return listModel; } auto Model::ChipCardProfile::generateTableString(const QString &header) -> QString { - QString outString; + QString outString; - qDebug() << "Header:" << header << "( Columns: " << m_model->columnCount() << " Rows: " << m_model->rowCount() - << " )"; + qDebug() << "Header:" << header << "( Columns: " << m_model->columnCount() << " Rows: " << m_model->rowCount() << " )"; - QList set; + QList set; - // Document Title - outString = QLatin1String("

"); - outString += header; - outString += QLatin1String("

"); - outString += QLatin1String("
"); - outString += QLatin1String(R"(
"); - outString.append(m_model->headerData(i, Qt::Horizontal).toString()); - outString += QLatin1String(""); + outString.append(m_model->headerData(i, Qt::Horizontal).toString()); + outString += QLatin1String("
)"); - outString += QLatin1String(""); + // Document Title + outString = QLatin1String("

"); + outString += header; + outString += QLatin1String("

"); + outString += QLatin1String("
"); + outString += QLatin1String(R"(
)"); + outString += QLatin1String(""); - for (const auto i : set) { - qDebug() << "int i = " << i; - outString += QLatin1String(""); - } + for (const auto i : set) { + qDebug() << "int i = " << i; + outString += QLatin1String(""); + } - return outString; + return outString; } auto Model::ChipCardProfile::generateFormularString(const QString &header) -> QString { - QString outString; + QString outString; - qDebug() << "Header:" << header << "( Columns: " << m_model->columnCount() << " Rows: " << m_model->rowCount() - << " )"; + qDebug() << "Header:" << header << "( Columns: " << m_model->columnCount() << " Rows: " << m_model->rowCount() << " )"; - // Document Title - outString = QLatin1String("

"); - outString += header; - outString += QLatin1String("

"); - outString += QLatin1String("
"); + // Document Title + outString = QLatin1String("

"); + outString += header; + outString += QLatin1String("

"); + outString += QLatin1String("
"); - return outString; + return outString; } diff --git a/apps/libs/models/src/chipcardprofiledoor.cpp b/apps/libs/models/src/chipcardprofiledoor.cpp index 0a192e49e..ccbb4c29d 100644 --- a/apps/libs/models/src/chipcardprofiledoor.cpp +++ b/apps/libs/models/src/chipcardprofiledoor.cpp @@ -6,104 +6,103 @@ #include "jmbdemodels/chipcardprofiledoor.h" -Model::ChipCardProfileDoor::ChipCardProfileDoor() : CommonData() +Model::ChipCardProfileDoor::ChipCardProfileDoor() + : CommonData() { - this->m_dataContext = new Model::DataContext(); - this->m_db = m_dataContext->getDatabase(); + this->m_dataContext = new Model::DataContext(); + this->m_db = m_dataContext->getDatabase(); - // Set the Model - this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); - this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); + // Set the Model + this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model->setTable(this->m_tableName); + this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); - setIndexes(); + setIndexes(); } void Model::ChipCardProfileDoor::setIndexes() { - m_ChipCardProfileDoorIdIndex = this->m_model->fieldIndex(QLatin1String("chip_card_profile_door_id")); - m_ChipCardProfileIdIndex = this->m_model->fieldIndex(QLatin1String("chip_card_profile_id")); - m_ChipCardDoorsIdIndex = this->m_model->fieldIndex(QLatin1String("chip_card_door_id")); - m_LastUpdateIndex = this->m_model->fieldIndex(QLatin1String("last_update")); + m_ChipCardProfileDoorIdIndex = this->m_model->fieldIndex(QLatin1String("chip_card_profile_door_id")); + m_ChipCardProfileIdIndex = this->m_model->fieldIndex(QLatin1String("chip_card_profile_id")); + m_ChipCardDoorsIdIndex = this->m_model->fieldIndex(QLatin1String("chip_card_door_id")); + m_LastUpdateIndex = this->m_model->fieldIndex(QLatin1String("last_update")); } auto Model::ChipCardProfileDoor::initializeRelationalModel() -> QSqlRelationalTableModel * { - this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); - this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); + this->m_model->setTable(this->m_tableName); + this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); - this->m_model->select(); + this->m_model->select(); - return this->m_model; + return this->m_model; } auto Model::ChipCardProfileDoor::initializeInputDataModel() -> QSqlRelationalTableModel * { - this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); + this->m_model->setTable(this->m_tableName); - return this->m_model; + return this->m_model; } auto Model::ChipCardProfileDoor::initializeViewModel() -> QSqlTableModel * { - this->m_model->select(); + this->m_model->select(); - return this->m_model; + return this->m_model; } auto Model::ChipCardProfileDoor::initializeListModel() -> QSqlTableModel * { - auto *listModel = new QSqlTableModel(this, this->m_db); - listModel->setTable(this->m_tableName); - listModel->setEditStrategy(QSqlTableModel::OnManualSubmit); - listModel->select(); + auto *listModel = new QSqlTableModel(this, this->m_db); + listModel->setTable(this->m_tableName); + listModel->setEditStrategy(QSqlTableModel::OnManualSubmit); + listModel->select(); - return listModel; + return listModel; } auto Model::ChipCardProfileDoor::generateTableString(const QString &header) -> QString { - QString outString; + QString outString; - qDebug() << "Header:" << header << "( Columns: " << m_model->columnCount() << " Rows: " << m_model->rowCount() - << " )"; + qDebug() << "Header:" << header << "( Columns: " << m_model->columnCount() << " Rows: " << m_model->rowCount() << " )"; - QList set; + QList set; - // Document Title - outString = QLatin1String("

"); - outString += header; - outString += QLatin1String("

"); - outString += QLatin1String("
"); - outString += QLatin1String(R"(
"); - outString.append(m_model->headerData(i, Qt::Horizontal).toString()); - outString += QLatin1String(""); + outString.append(m_model->headerData(i, Qt::Horizontal).toString()); + outString += QLatin1String("
)"); - outString += QLatin1String(""); + // Document Title + outString = QLatin1String("

"); + outString += header; + outString += QLatin1String("

"); + outString += QLatin1String("
"); + outString += QLatin1String(R"(
)"); + outString += QLatin1String(""); - for (const auto i : set) { - qDebug() << "int i = " << i; - outString += QLatin1String(""); - } + for (const auto i : set) { + qDebug() << "int i = " << i; + outString += QLatin1String(""); + } - return outString; + return outString; } auto Model::ChipCardProfileDoor::generateFormularString(const QString &header) -> QString { - QString outString; + QString outString; - qDebug() << "Header:" << header << "( Columns: " << m_model->columnCount() << " Rows: " << m_model->rowCount() - << " )"; + qDebug() << "Header:" << header << "( Columns: " << m_model->columnCount() << " Rows: " << m_model->rowCount() << " )"; - // Document Title - outString = QLatin1String("

"); - outString += header; - outString += QLatin1String("

"); - outString += QLatin1String("
"); + // Document Title + outString = QLatin1String("

"); + outString += header; + outString += QLatin1String("

"); + outString += QLatin1String("
"); - return outString; + return outString; } diff --git a/apps/libs/models/src/cityname.cpp b/apps/libs/models/src/cityname.cpp index 6d396d61b..b3e8d1ecb 100644 --- a/apps/libs/models/src/cityname.cpp +++ b/apps/libs/models/src/cityname.cpp @@ -6,104 +6,103 @@ #include "jmbdemodels/cityname.h" -Model::CityName::CityName() : CommonData() +Model::CityName::CityName() + : CommonData() { - this->m_dataContext = new Model::DataContext(); - this->m_db = m_dataContext->getDatabase(); + this->m_dataContext = new Model::DataContext(); + this->m_db = m_dataContext->getDatabase(); - // Set the Model - this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); - this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); + // Set the Model + this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model->setTable(this->m_tableName); + this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); - setIndexes(); + setIndexes(); } void Model::CityName::setIndexes() { - m_CityNameIdIndex = this->m_model->fieldIndex(QLatin1String("city_name_id")); - m_NameIndex = this->m_model->fieldIndex(QLatin1String("name")); - m_LastUpdateIndex = this->m_model->fieldIndex(QLatin1String("last_update")); + m_CityNameIdIndex = this->m_model->fieldIndex(QLatin1String("city_name_id")); + m_NameIndex = this->m_model->fieldIndex(QLatin1String("name")); + m_LastUpdateIndex = this->m_model->fieldIndex(QLatin1String("last_update")); } auto Model::CityName::initializeRelationalModel() -> QSqlRelationalTableModel * { - this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); - this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); + this->m_model->setTable(this->m_tableName); + this->m_model->setEditStrategy(QSqlTableModel::OnManualSubmit); - this->m_model->select(); + this->m_model->select(); - return this->m_model; + return this->m_model; } auto Model::CityName::initializeListModel() -> QSqlTableModel * { - auto *listModel = new QSqlTableModel(this, this->m_db); - listModel->setTable(this->m_tableName); - listModel->setEditStrategy(QSqlTableModel::OnManualSubmit); - listModel->select(); + auto *listModel = new QSqlTableModel(this, this->m_db); + listModel->setTable(this->m_tableName); + listModel->setEditStrategy(QSqlTableModel::OnManualSubmit); + listModel->select(); - return listModel; + return listModel; } auto Model::CityName::initializeInputDataModel() -> QSqlRelationalTableModel * { - this->m_model = new QSqlRelationalTableModel(this, this->m_db); + this->m_model = new QSqlRelationalTableModel(this, this->m_db); - this->m_model->setTable(this->m_tableName); + this->m_model->setTable(this->m_tableName); - return this->m_model; + return this->m_model; } auto Model::CityName::initializeViewModel() -> QSqlTableModel * { - this->m_model->select(); + this->m_model->select(); - return this->m_model; + return this->m_model; } auto Model::CityName::generateTableString(const QString &header) -> QString { - QString outString; + QString outString; - qDebug() << "Header:" << header << "( Columns: " << m_model->columnCount() << " Rows: " << m_model->rowCount() - << " )"; + qDebug() << "Header:" << header << "( Columns: " << m_model->columnCount() << " Rows: " << m_model->rowCount() << " )"; - QList set; + QList set; - // Document Title - outString = QLatin1String("

"); - outString += header; - outString += QLatin1String("

"); - outString += QLatin1String("
"); - outString += QLatin1String(R"(
"); - outString.append(m_model->headerData(i, Qt::Horizontal).toString()); - outString += QLatin1String(""); + outString.append(m_model->headerData(i, Qt::Horizontal).toString()); + outString += QLatin1String("
)"); + // Document Title + outString = QLatin1String("

"); + outString += header; + outString += QLatin1String("

"); + outString += QLatin1String("
"); + outString += QLatin1String(R"(
)"); - outString += QLatin1String(""); + outString += QLatin1String(""); - for (const auto i : set) { - qDebug() << "int i = " << i; - outString += QLatin1String(""); - } + for (const auto i : set) { + qDebug() << "int i = " << i; + outString += QLatin1String(""); + } - return outString; + return outString; } auto Model::CityName::generateFormularString(const QString &header) -> QString { - QString outString; + QString outString; - qDebug() << "Header:" << header << "( Columns: " << m_model->columnCount() << " Rows: " << m_model->rowCount() - << " )"; + qDebug() << "Header:" << header << "( Columns: " << m_model->columnCount() << " Rows: " << m_model->rowCount() << " )"; - // Document Title - outString = QLatin1String("

"); - outString += header; - outString += QLatin1String("

"); - outString += QLatin1String("
"); + // Document Title + outString = QLatin1String("

"); + outString += header; + outString += QLatin1String("

"); + outString += QLatin1String("
"); - return outString; + return outString; } diff --git a/apps/libs/models/src/commondata.cpp b/apps/libs/models/src/commondata.cpp index 723ce93a0..2414f0bca 100644 --- a/apps/libs/models/src/commondata.cpp +++ b/apps/libs/models/src/commondata.cpp @@ -9,34 +9,34 @@ auto Model::CommonData::createSheet() -> QTextDocument * { - auto *document = new QTextDocument; + auto *document = new QTextDocument; - return document; + return document; } auto Model::CommonData::setOutTableStyle() -> QString { - QString css; - - css = QLatin1String(""); - - return css; + QString css; + + css = QLatin1String(""); + + return css; } auto Model::CommonData::setOutFormularStyle() -> QString { - QString css; + QString css; - css = QLatin1String("
"); - outString.append(m_model->headerData(i, Qt::Horizontal).toString()); - outString += QLatin1String(""); + outString.append(m_model->headerData(i, Qt::Horizontal).toString()); + outString += QLatin1String("