Skip to content

Commit

Permalink
Merge pull request #92 from oblivioncth/dev
Browse files Browse the repository at this point in the history
Merge to master for v0.4.2
  • Loading branch information
oblivioncth authored Dec 26, 2022
2 parents c587008 + a35bd11 commit 6752fd5
Show file tree
Hide file tree
Showing 12 changed files with 223 additions and 153 deletions.
26 changes: 6 additions & 20 deletions .github/workflows/build-qx-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,9 @@ jobs:
key: ${{ env.qt_install_url }}
- name: Install megatools
if: steps.cache-qt.outputs.cache-hit != 'true'
env:
mt_build: megatools-1.11.0.20220519-linux-x86_64
mt_arch_ext: tar.gz
mt_repo: https://megatools.megous.com/builds/builds/
run: |
curl "$mt_repo/$mt_build.$mt_arch_ext" --output "$general_download_dir/$mt_build.$mt_arch_ext" --create-dirs --location --silent --show-error
cd $general_download_dir
tar xf "$mt_build.$mt_arch_ext"
cd "$mt_build"
cp -p megatools /usr/local/bin
uses: oblivioncth/actions/ubuntu/install-megatools-from-megous@dev
with:
version: 1.11.0.20220519
- name: Create Qt Download Directory
if: steps.cache-qt.outputs.cache-hit != 'true'
run: mkdir -p "${{ env.qt_download_dir }}"
Expand All @@ -97,16 +90,9 @@ jobs:
- name: Install XCB Related libs
run: sudo apt-get install libx11-xcb-dev libxkbcommon-dev libxkbcommon-x11-dev libxcb-*-dev
- name: Install Doxygen
env:
doxy_build: doxygen-1.9.5
doxy_arch_ext: linux.bin.tar.gz
doxy_repo: https://www.doxygen.nl/files
run: |
curl "$doxy_repo/$doxy_build.$doxy_arch_ext" --output "$general_download_dir/$doxy_build.$doxy_arch_ext" --create-dirs --location --silent --show-error
cd $general_download_dir
tar xf "$doxy_build.$doxy_arch_ext"
cd "$doxy_build"
sudo make install
uses: oblivioncth/actions/ubuntu/install-doxygen-from-sourceforge@dev
with:
version: 1.9.4
- name: Install Graphviz
run: sudo apt-get install graphviz
- name: Install Ninja
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/build-qx-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
run: 7z x ${{ env.qt_install_dest }} -o${{ env.qt_install_dir }}
- name: Install Doxygen & Graphviz
run: |
choco install doxygen.install --version 1.9.5
choco install doxygen.install --version 1.9.4
choco install graphviz
- name: Checkout Qx
uses: actions/checkout@v3
Expand All @@ -93,13 +93,11 @@ jobs:
- name: Build/Install Qx
working-directory: ${{ env.qx_src_dir }}
shell: cmd
env:
doxygen_root: C:\Program Files\doxygen # Required because of #42
run: |
echo "Setup C++ Build Environment..."
CALL "${{ env.vs_dir }}\Common7\Tools\VsDevCmd.bat" -arch=amd64
echo "Configure CMake using Qt wrapper..."
CALL "${{ env.qt_cmake }}" -G "${{ env.cmake_gen }}" -S "${{ env.qx_src_dir}}" -B "${{ env.qx_build_dir }}" -D QX_DOCS_TARGET=ON -D Doxygen_ROOT="${{ env.doxygen_root }}"
CALL "${{ env.qt_cmake }}" -G "${{ env.cmake_gen }}" -S "${{ env.qx_src_dir}}" -B "${{ env.qx_build_dir }}" -D QX_DOCS_TARGET=ON"
echo "Changing to build directory..."
cd "%qx_build_dir%"
echo "Building Qx debug..."
Expand Down
39 changes: 4 additions & 35 deletions .github/workflows/master-pull-request-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,9 @@ on:
branches: master

jobs:
ensure-higher-version:
name: Ensure higher version than last tag has been set
check-pr-correctness:
name: Master PR correctness check
runs-on: windows-latest
env:
qx_src_suffix: Qx/Source/
qx_src_dir: ${{ github.workspace }}/Qx/Source/
steps:
- name: Checkout Qx
uses: actions/checkout@v3
with:
path: ${{ env.qx_src_suffix }}
fetch-depth: 0 # Required for tag search to find previous tag
- name: Compare versions
env:
match_start: set\(QX_BASE_VERSION
match_end: \)
run: |
cd "${{ env.qx_src_dir }}"
echo "Checking for version tags..."
if(git tag -l v*.*){
echo "Version tags found, comparing new and last tag..."
$last_tag_version = $(git describe --abbrev=0 --match v*.*).substring(1)
echo "Last tag version: ${last_tag_version}"
$project_lists = Get-Content -Raw CMakeLists.txt
if(!($project_lists -match '(?<=${{ env.match_start }})(.*)(?=${{ env.match_end }})')){
throw "Could not get project version!"
}
$new_tag_version = $Matches[1].Trim()
echo "New tag version: ${new_tag_version}"
if(!([version]$new_tag_version -gt [version]$last_tag_version)){
throw "Project version was not increased to be above previous tagged version!"
}
}
else{
echo "No existing version tags present. Proceeding..."
}
- name: Ensure higher version
uses: oblivioncth/actions/cmake/ensure-project-version-gt-tag@dev
30 changes: 13 additions & 17 deletions .github/workflows/master-pull-request-merge-reaction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
branches:
- 'master'
env:
ci_bot_username: ObyBotCI
ci_bot_email: [email protected]
qx_qtd_win_artifact_path: ${{ github.workspace }}/QxQtDWin
qx_qts_win_artifact_path: ${{ github.workspace }}/QxQtSWin
qx_qtd_linux_artifact_path: ${{ github.workspace }}/QxQtDLinux
Expand All @@ -20,29 +18,26 @@ jobs:
outputs:
version_tag: ${{ steps.tag_master.outputs.new_tag }}
steps:
- name: Checkout Qx Master
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup git user for bot
run: |
git config --global user.name "${{ env.ci_bot_username }}"
git config --global user.email "${{ env.ci_bot_email }}"
- name: Get project version
id: get-proj-ver
uses: oblivioncth/actions/cmake/get-project-version@dev
- name: Set Git user to ObyBotCI
uses: oblivioncth/actions/git/set-git-user-to-oby-bot@dev
- name: Checkout Project
id: proj-checkout
uses: oblivioncth/actions/git/smart-checkout@dev
- name: Tag master with new version tag
id: tag_master
working-directory: ${{ steps.proj-checkout.outputs.path }}
env:
match_start: set\(QX_BASE_VERSION
match_end: \)
new_version: ${{ steps.get-proj-ver.outputs.version }}
run: |
$project_lists = Get-Content -Raw CMakeLists.txt
if(!($project_lists -match '(?<=${{ env.match_start }})(.*)(?=${{ env.match_end }})')){
throw "Could not get base version!"
}
$new_tag = "v$($Matches[1].Trim())"
$new_tag = "v${Env:new_version}"
echo "new_tag=$new_tag" >> $Env:GITHUB_OUTPUT
git tag -a $new_tag -m "Release $new_tag"
git push --tags
- name: Move 'latest' tag
working-directory: ${{ steps.proj-checkout.outputs.path }}
run: |
echo "Checking for 'latest' tag..."
if(git tag -l latest){
Expand All @@ -57,6 +52,7 @@ jobs:
git push origin latest
- name: Fast-forward merge master into to dev
if: always()
working-directory: ${{ steps.proj-checkout.outputs.path }}
run: |
git checkout dev
git merge master --ff-only
Expand Down
27 changes: 4 additions & 23 deletions .github/workflows/pull-request-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,9 @@ on:
types: [opened]

jobs:
label_master_pr:
name: Label master pull-request
if: github.base_ref == 'master'
label_pr:
name: Label pull-request
runs-on: ubuntu-latest
steps:
- name: Create label
uses: actions-ecosystem/action-add-labels@v1
with:
labels: release-pr
label_other_pr:
name: Label other standard pull-requests
if: github.base_ref != 'master'
runs-on: ubuntu-latest
steps:
- name: Label bugfix PR
if: startsWith(github.head_ref, 'bugfix/')
uses: actions-ecosystem/action-add-labels@v1
with:
labels: bug
- name: Label feature PR
if: startsWith(github.head_ref, 'feature/')
uses: actions-ecosystem/action-add-labels@v1
with:
labels: enhancement

- name: Label via convention
uses: oblivioncth/actions/pull-request/label-pr-conventionally@dev
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#================= Project Setup ==========================

# CMake
cmake_minimum_required(VERSION 3.21.1)
cmake_minimum_required(VERSION 3.25.0)
if(NOT ${GENERATOR_IS_MULTI_CONFIG})
message(FATAL_ERROR "This project currently only supports multi-config generators!")
endif()
Expand All @@ -14,9 +14,8 @@ set(TRUE_CMAKE_MINIMUM_REQUIRED ${CMAKE_MINIMUM_REQUIRED_VERSION})
# NOTE: For versions stick to w.x.y.z, where z is generally
# avoided and only used for hotfixes. DON'T USE TRAILING
# ZEROS IN VERSIONS
set(QX_BASE_VERSION 0.4.1) # Required for CI/CD
project(Qx
VERSION ${QX_BASE_VERSION}
VERSION 0.4.2
LANGUAGES CXX
DESCRIPTION "Qt Extensions Library"
)
Expand Down
5 changes: 3 additions & 2 deletions cmake/module/Qx/ComponentHelper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ macro(register_qx_component)
# Determine component name via folder name
get_filename_component(COMPONENT_NAME_LC "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
string_to_proper_case(${COMPONENT_NAME_LC} COMPONENT_NAME)
string(TOUPPER ${COMPONENT_NAME} COMPONENT_NAME_UC)
create_header_guard(${PROJECT_NAME} ${COMPONENT_NAME} COMPONENT_HEADER_GUARD)

# Name here needs to be as unique as possible for when this project is inlcuded
Expand Down Expand Up @@ -178,9 +179,9 @@ macro(register_qx_component)
)

# Install public headers
install(DIRECTORY include/${PROJECT_NAME_LC}
install(DIRECTORY include/
COMPONENT ${COMPONENT_TARGET_NAME}
DESTINATION "include/${COMPONENT_NAME_LC}"
DESTINATION "include/${COMPONENT_NAME_LC}/"
${SUB_PROJ_EXCLUDE_FROM_ALL} # "EXCLUDE_FROM_ALL" if project is not top-level
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_NAME_LC}/${COMPONENT_NAME_LC}.h"
Expand Down
13 changes: 13 additions & 0 deletions comp/core/include/qx/core/qx-cumulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
// Extra-component Includes
#include "qx/utility/qx-concepts.h"

/* TODO: An iterator can't be added to this class unless it deferences to a special class like the QJsonValueRef
* approach since when the value is modified the running total would need to be changed as well. That or the running
* total needs to be done away with and the total() method needs to calculate the total each time its called (ehhhh)
*/

namespace Qx
{

Expand Down Expand Up @@ -169,10 +174,18 @@ class Cumulation
bool contains(K component) const { return mComponents.contains(component); }
V value(K component) const { return mComponents.value(component); }
V total() const { return mTotal; }
QList<K> components() const { return mComponents.keys(); }

qsizetype count() const { return mComponents.count(); }
bool isEmpty() const { return mComponents.isEmpty(); }
V mean() const { return sMean<V>(); }

bool operator==(const Cumulation& other) const
{
return mComponents == other.mComponents && mScalers == other.mScalers && mTotal == other.mTotal;
}

bool operator!=(const Cumulation& other) const { return !(*this == other); }
};

}
Expand Down
18 changes: 13 additions & 5 deletions comp/core/include/qx/core/qx-table.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,15 @@ class Table

void insertColumn(qsizetype i, const QList<T>& c)
{
Q_ASSERT_X(i >= 0 && i <= columnCount(), "QTable<T>::insertColumn", "index out of range");

// Expand height if c is larger than current height
qsizetype rows = rowCount();
qsizetype rowGrowth = rows - c.size();
if(rowGrowth > 0)
if(c.size() > rows)
{
resizeRows(c.size());
rows = c.size();
}

// Insert values from column, or default values if column is smaller than height
for(qsizetype r = 0; r < rows; r++)
Expand All @@ -220,15 +224,19 @@ class Table

void insertRow(qsizetype i, const QList<T>& r)
{
Q_ASSERT_X(i >= 0 && i <= rowCount(), "QTable<T>::insertRow", "index out of range");

// Expand width if r is larger than current width
qsizetype columns = columnCount();
qsizetype columnGrowth = columns - r.size();
if(columnGrowth > 0)
if(r.size() > columns)
{
resizeColumns(r.size());
columns = r.size();
}

// Insert row, then expand it if it's smaller than the current width
mTable.insert(i, r);
if(columnGrowth < 0)
if(r.size() < columns)
mTable[i].resize(columns);
}

Expand Down
22 changes: 22 additions & 0 deletions comp/core/src/qx-cumulation.dox
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ namespace Qx
* Returns the current total of the cumulation, which is the sum of all its component values.
*/

/*!
* @fn template <typename K, typename V> QList<K> Cumulation<K, V>::components() const
*
* Returns a list containing all the components in the cumulation, in an arbitrary order.
*
* This function creates a new list, in linear time.
*/

/*!
* @fn template <typename K, typename V> qsizetype Cumulation<K, V>::count() const
*
Expand All @@ -151,4 +159,18 @@ namespace Qx
* If @a V is an integral type, the result is rounded to the nearest integer.
*/

/*!
* @fn template <typename K, typename V> V Cumulation<K, V>::operator==(const Cumulation& other) const
*
* Returns @c true if this Cumulation and @a other Cumulation are the same;
* otherwise, returns @c false.
*/

/*!
* @fn template <typename K, typename V> V Cumulation<K, V>::operator!=(const Cumulation& other) const
*
* Returns @c true if this Cumulation and @a other Cumulation are not the same;
* otherwise, returns @c false.
*/

}
6 changes: 4 additions & 2 deletions comp/core/src/qx-table.dox
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ namespace Qx
/*!
* @fn template<typename T> void Table<T>::insertColumn(qsizetype i, const QList<T>& c)
*
* Inserts @a c as a column to column index @a i in the table.
* Inserts @a c as a column to column index @a i in the table. If @a i is 0, the column is prepended to the
* table. If @a i is columnSize(), the column is appended to the table.
*
* If @a c is smaller than the current height (rowCount()) of the table, it will be expanded with
* default-constructed values after insertion to match the current height. If @a c is larger than the
Expand All @@ -312,7 +313,8 @@ namespace Qx
/*!
* @fn template<typename T> void Table<T>::insertRow(qsizetype i, const QList<T>& r)
*
* Inserts @a r as a row to row index @a i in the table.
* Inserts @a r as a row to row index @a i in the table. If @a i is 0, the row is prepended to the
* table. If @a i is rowSize(), the row is appended to the table.
*
* If @a r is smaller than the current width (columnCount()) of the table, it will be expanded with
* default-constructed values after insertion to match the current width. If @a r is larger than the
Expand Down
Loading

0 comments on commit 6752fd5

Please sign in to comment.