-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-1.0.4-to-main
- Loading branch information
Showing
18 changed files
with
1,105 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- windows-latest | ||
- macos-latest | ||
|
||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install ninja-build tool | ||
uses: turtlesec-no/get-ninja@main | ||
|
||
- name: Make sure MSVC is found when Ninja generator is in use | ||
uses: ilammy/msvc-dev-cmd@v1 | ||
if: ${{ runner.os == 'Windows' }} | ||
|
||
- name: Configure project | ||
run: cmake --preset=ci | ||
|
||
- name: Build Project | ||
run: cmake --build --preset=ci | ||
|
||
- name: Run tests | ||
run: ctest --preset=ci | ||
|
||
- name: Read tests log when it fails | ||
uses: andstor/file-reader-action@v1 | ||
if: ${{ failure() }} | ||
with: | ||
path: "./build/Testing/Temporary/LastTest.log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
name: CI Static Checks | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
|
||
config: | ||
- name: clang-tidy | ||
|
||
- name: clazy | ||
apt_pgks: | ||
- clazy | ||
|
||
steps: | ||
- name: Install ninja-build tool | ||
uses: turtlesec-no/get-ninja@main | ||
|
||
- name: Install dependencies on Ubuntu (${{ join(matrix.config.apt_pgks, ' ') }}) | ||
if: ${{ runner.os == 'Linux' && matrix.config.apt_pgks }} | ||
run: | | ||
sudo apt update -qq | ||
echo ${{ join(matrix.config.apt_pgks, ' ') }} | xargs sudo apt install -y | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Fetch Git submodules | ||
run: git submodule update --init --recursive | ||
|
||
- name: Configure project | ||
run: cmake --preset=${{ matrix.config.name }} | ||
|
||
- name: Build Project | ||
id: ctest | ||
run: cmake --build --preset=${{ matrix.config.name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,7 @@ imgui.ini | |
|
||
.vscode/* | ||
build/* | ||
build-* | ||
serenity_metatype.* | ||
output.json | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{ | ||
"version": 2, | ||
"configurePresets": [ | ||
{ | ||
"name": "dev", | ||
"displayName": "dev", | ||
"generator": "Ninja", | ||
"binaryDir": "${sourceDir}/build-dev", | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Debug", | ||
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON", | ||
"KDBindings_TESTS" : "ON", | ||
"KDBindings_EXAMPLES" : "ON" | ||
} | ||
}, | ||
{ | ||
"name": "ci", | ||
"displayName": "ci", | ||
"generator": "Ninja", | ||
"binaryDir": "${sourceDir}/build-ci", | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Release", | ||
"CMAKE_EXPORT_COMPILE_COMMANDS" : "ON", | ||
"KDBindings_TESTS" : "ON", | ||
"KDBindings_EXAMPLES" : "ON", | ||
"KDBindings_DOCS" : "ON" | ||
} | ||
}, | ||
{ | ||
"name": "clazy", | ||
"displayName": "clazy", | ||
"generator": "Ninja", | ||
"binaryDir": "${sourceDir}/build-clazy", | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Debug", | ||
"CMAKE_CXX_COMPILER" : "clazy", | ||
"KDBindings_TESTS" : "ON", | ||
"KDBindings_EXAMPLES" : "ON" | ||
}, | ||
"warnings": { | ||
"uninitialized": true | ||
}, | ||
"errors": { | ||
"dev": true | ||
} | ||
}, | ||
{ | ||
"name": "clang-tidy", | ||
"displayName": "clang-tidy", | ||
"generator": "Ninja", | ||
"binaryDir": "${sourceDir}/build-clang-tidy", | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Debug", | ||
"CMAKE_CXX_CLANG_TIDY" : "clang-tidy", | ||
"KDBindings_TESTS" : "ON", | ||
"KDBindings_EXAMPLES" : "ON" | ||
}, | ||
"warnings": { | ||
"uninitialized": true | ||
}, | ||
"errors": { | ||
"dev": true | ||
} | ||
} | ||
|
||
], | ||
"buildPresets": [ | ||
{ | ||
"name": "ci", | ||
"configurePreset": "ci" | ||
}, | ||
{ | ||
"name": "dev", | ||
"configurePreset": "dev" | ||
}, | ||
{ | ||
"name": "clazy", | ||
"configurePreset": "clazy" | ||
}, | ||
{ | ||
"name": "clang-tidy", | ||
"configurePreset": "clang-tidy" | ||
} | ||
], | ||
"testPresets": [ | ||
{ | ||
"name": "ci", | ||
"configurePreset": "ci", | ||
"output": {"outputOnFailure": true}, | ||
"execution": {"noTestsAction": "error", "stopOnFailure": true} | ||
}, | ||
{ | ||
"name": "dev", | ||
"configurePreset": "dev", | ||
"output": {"outputOnFailure": true}, | ||
"execution": {"noTestsAction": "error", "stopOnFailure": false} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# This file is part of KDBindings. | ||
# | ||
# SPDX-FileCopyrightText: 2021 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
# Author: Leon Matthes <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
# | ||
# Contact KDAB at <[email protected]> for commercial licensing options. | ||
# | ||
|
||
project(08-managing-connections VERSION 0.1 LANGUAGES CXX) | ||
|
||
add_executable(${PROJECT_NAME} | ||
main.cpp | ||
) | ||
target_link_libraries(${PROJECT_NAME} KDAB::KDBindings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
This file is part of KDBindings. | ||
SPDX-FileCopyrightText: 2021 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
Author: Leon Matthes <[email protected]> | ||
SPDX-License-Identifier: MIT | ||
Contact KDAB at <[email protected]> for commercial licensing options. | ||
*/ | ||
|
||
#include <ios> | ||
#include <kdbindings/signal.h> | ||
|
||
#include <iostream> | ||
#include <string> | ||
|
||
using namespace KDBindings; | ||
|
||
void displayLabelled(const std::string &label, int value) | ||
{ | ||
std::cout << label << ": " << value << std::endl; | ||
} | ||
|
||
int main() | ||
{ | ||
Signal<int> signal; | ||
|
||
{ | ||
// A ScopedConnection will disconnect the connection once it goes out of scope. | ||
// It is especially useful if you're connecting to a member function. | ||
// Storing a ScopedConnection in the object that contains the slot ensures the connection | ||
// is disconnected when the object is destructed. | ||
// This ensures that there are no dangling connections. | ||
ScopedConnection guard = signal.connect(displayLabelled, "Guard is connected"); | ||
|
||
signal.emit(1); | ||
} // The connection is disconnected here | ||
|
||
signal.emit(2); | ||
|
||
ConnectionHandle handle = signal.connect(displayLabelled, "Connection is not blocked"); | ||
|
||
signal.emit(3); | ||
{ | ||
// A ConnectionBlocker will block a connection for the duration of its scope. | ||
// This is a good way to avoid endless-recursion, or to suppress updates for a short time. | ||
ConnectionBlocker blocker(handle); // The connection is blocked here | ||
|
||
signal.emit(4); | ||
} // The connection is un-blocked here | ||
|
||
signal.emit(5); | ||
|
||
return 0; | ||
} |
Oops, something went wrong.