Skip to content

Commit

Permalink
Merge pull request #20 from NickvisionApps/2024.2.0
Browse files Browse the repository at this point in the history
V2024.2.0
  • Loading branch information
nlogozzo authored Jan 30, 2024
2 parents 6ccedc7 + 9684767 commit 821c450
Show file tree
Hide file tree
Showing 89 changed files with 5,500 additions and 5,363 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
pkgs: boost-locale curl gettext-libintl glib gtest jsoncpp libsecret libuuid maddy openssl
triplet: x64-linux
cache-key: ${{ matrix.config.os }}
revision: 7032c5759f823fc8699a5c37d5f7072464ccb9a8
revision: 4a2c30139309a6e4690ce929df33e85a1706a0e2
token: ${{ secrets.GITHUB_TOKEN }}
- name: "Build"
working-directory: ${{github.workspace}}/build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
pkgs: boost-locale curl gettext-libintl gtest jsoncpp maddy openssl
triplet: x64-windows
cache-key: ${{ matrix.config.os }}
revision: 7032c5759f823fc8699a5c37d5f7072464ccb9a8
revision: 4a2c30139309a6e4690ce929df33e85a1706a0e2
token: ${{ secrets.GITHUB_TOKEN }}
- name: "Build"
working-directory: ${{github.workspace}}/build
Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

#libnick Definition
project ("libnick" LANGUAGES C CXX VERSION 2024.1.13 DESCRIPTION "A cross-platform base for native Nickvision applications.")
project ("libnick" LANGUAGES C CXX VERSION 2024.2.0 DESCRIPTION "A cross-platform base for native Nickvision applications.")
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
include(CTest)
Expand All @@ -31,10 +31,10 @@ if(LINUX)
add_compile_definitions(HAVE_USLEEP)
endif()
add_library (${PROJECT_NAME}
"src/aura/appinfo.cpp"
"src/aura/aura.cpp"
"src/aura/configurationbase.cpp"
"src/aura/interprocesscommunicator.cpp"
"src/app/appinfo.cpp"
"src/app/aura.cpp"
"src/app/configurationbase.cpp"
"src/app/interprocesscommunicator.cpp"
"src/filesystem/filesystemchangedeventargs.cpp"
"src/filesystem/filesystemwatcher.cpp"
"src/filesystem/systemdirectories.cpp"
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ For example, assume a class has an event defined as `Nickvision::Events::Event<N
This means that the class provides the following method, allowing consumers to register callbacks to the event using the `+=` operator: `Nickvision::Events::Event<Nickvision::Events::EventArgs>& saved()`.

## Modules
- [Nickvision::Aura](aura.md)
- [Nickvision::App](app.md)
- [Nickvision::Events](events.md)
- [Nickvision::Filesystem](filesystem.md)
- [Nickvision::Helpers](helpers.md)
Expand Down
51 changes: 40 additions & 11 deletions docs/aura.md → docs/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Interface: [appinfo.h](/include/aura/appinfo.h)

Type: `class`

Path: `Nickvision::Aura::AppInfo`
Path: `Nickvision::App::AppInfo`

### Member Variables
- ```
Expand Down Expand Up @@ -131,17 +131,37 @@ Interface: [aura.h](/include/aura/aura.h)
Type: `class`
Path: `Nickvision::Aura::Aura`
Path: `Nickvision::App::Aura`
### Member Variables
- ```
Nickvision::Aura::AppInfo& AppInfo: get
Nickvision::App::AppInfo& AppInfo: get
```
- The AppInfo object for the application
- ```
std::filesystem::path& ExecutableDirectory: get
```
- The path of the executable's directory.
- ```
bool IsRunningOnWindows: get
```
- Whether or not the app is running on Windows
- ```
bool IsRunningOnLinux: get
```
- Whether or not the app is running on Linux
- ```
bool IsRunningViaFlatpak: get
```
- Whether or not the app is running via Flatpak
- ```
bool IsRunningViaSnap: get
```
- Whether or not the app is running via Snap
- ```
bool IsRunningViaLocal: get
```
- Whether or not the app is running locally

### Methods
- ```cpp
Expand Down Expand Up @@ -203,7 +223,7 @@ Interface: [configurationbase.h](/include/aura/configurationbase.h)

Type: `class`

Path: `Nickvision::Aura::ConfigurationBase`
Path: `Nickvision::App::ConfigurationBase`

### Member Variables
- ```
Expand Down Expand Up @@ -242,10 +262,13 @@ Here are some key points when defining your own configuration objects:

Here is an example of a custom configuration object using `ConfigurationBase`:
```cpp
using namespace Nickvision::App;

class AppConfig : public ConfigurationBase
{
public:
AppConfig(const std::string& key) : ConfigurationBase{ key }
AppConfig(const std::string& key)
: ConfigurationBase{ key }
{

}
Expand All @@ -264,11 +287,14 @@ public:
```
This object can now be used by an Aura-based application:
```cpp
using namespace Nickvision::App;
using namespace Nickvision::Events;

int main()
{
Aura::getActive().init(...);
AppConfig& config{ Aura::getActive().getConfig<AppConfig>("config") };
config.saved() += [](const Nickvision::Events::EventArgs& e) { std::cout << "Config saved to disk." << std::endl; };
config.saved() += [](const EventArgs& e) { std::cout << "Config saved to disk." << std::endl; };
if(config.getPreviousCount() > 0)
{
std::cout << config.getPreviousCount() << std::endl;
Expand Down Expand Up @@ -301,7 +327,7 @@ Interface: [interprocesscommunicator.h](/include/aura/interprocesscommunicator.h

Type: `class`

Path: `Nickvision::Aura::InterProcessCommunicator`
Path: `Nickvision::App::InterProcessCommunicator`

### Member Variables
- ```
Expand All @@ -322,10 +348,11 @@ Path: `Nickvision::Aura::InterProcessCommunicator`

### Methods
- ```cpp
InterProcessCommunicator()
InterProcessCommunicator(const std::string& id)
```
- Constructs an InterProcessCommunicator.
- Note: If this is the first IPC instance for all processes of this AppInfo::id, this instance will become an IPC server.
- Accepts: The id of the ipc, id. id should be the same value for all instances of ipc that must talk to each other.
- Note: If this is the first IPC instance for all processes of id, this instance will become an IPC server.
- Note: If this is not the first IPC instance, this instance will become an IPC client.
- Throws: `std::runtime_error` if the client or server IPC cannot be created.
- ```cpp
Expand All @@ -351,9 +378,11 @@ Let's consider an example scenario for using the `InterProcessCommunicator`. Ass
Here's the code for this:
```cpp
using namespace Nickvision::App;
int main(int argc, char*[] argv)
{
Aura::getActive().init(...); //ensures AppInfo::id
Aura::getActive().init(...);
std::vector<std::string> modernArgs;
for(int i = 0; i < argc; i++)
{
Expand All @@ -362,7 +391,7 @@ int main(int argc, char*[] argv)
modernArgs.push_back({ argv[i] });
}
}
InterProcessCommunicator ipc;
InterProcessCommunicator& ipc{ Aura::getActuve().getIPC() };
ipc.commandReceived() += [](const Events::ParamEventArgs<std::vector<std::string>>& args) { ... };
ipc.communicate(modernArgs, true);
}
Expand Down
4 changes: 4 additions & 0 deletions docs/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ Path: `Nickvision::Events::Event`
void operator-=(const std::function<void(const T&)>& handler)
```
- Accepts: A `std::function` with signature `void handler(const T&)` to remove as a callback for the event, handler.
- ```cpp
void operator()(const T& param)
```
- Accepts: A `T` object to pass as a parameter, param, as all registered callbacks are called on this event.
- ```cpp
Event& operator=(const Event& e)
```
Expand Down
6 changes: 3 additions & 3 deletions docs/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ Path: `Nickvision::Update::Updater`

### Methods
- ```cpp
Updater(std::string githubRepoUrl = "")
Updater(std::string githubRepoUrl)
```
- Constructs an Updater.
- Accepts: The url of a GitHub repo to check for updates, githubRepoUrl. If githubRepoUrl is empty, the url will attempt to be determined from `Aura::getActive().getAppInfo().getSourceRepo()`.
- Throws: `std::invalid_argument` if no valid GitHub url can be determined.
- Accepts: The url of a GitHub repo to check for updates, githubRepoUrl.
- Throws: `std::invalid_argument` if the GitHub url is not of valid format
- ```cpp
Nickvision::Version fetchCurrentStableVersion()
```
Expand Down
Loading

0 comments on commit 821c450

Please sign in to comment.