Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
piallai committed Dec 15, 2024
1 parent 9ea5add commit b64febc
Show file tree
Hide file tree
Showing 18 changed files with 11,157 additions and 10,563 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

cmake_minimum_required(VERSION 3.0.0)

PROJECT(Glove VERSION 0.7.4
PROJECT(Glove VERSION 0.7.5
DESCRIPTION "A Qt C++ library for simple GUI")

message(STATUS "Glove " ${PROJECT_VERSION})
Expand Down
37 changes: 32 additions & 5 deletions doc/readme/App/GlvApp.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The features that can be easily added are:
- CLI to GUI : Input arguments through a GUI
- Loop progress to GUI : Show and control progression of loops.
- Status infos to GUI : Show status messages
- Use program recurrently to simulate an interactive mode

**Go to [full example](/doc/readme/App/GlvApp_full.md) for an exhaustive example.**

Expand All @@ -25,19 +26,45 @@ Without relying on Qt, a simple parsing of a 'main' parametrization can be done.

An example detailing how to use all the features managed by a Glove application can be found [here](/doc/readme/App/GlvApp_full.md).

## Important macros
## Base macros

The <code>GLOVE_APP</code> macro transforms a program into a GUI application. To be used at the very beginning of the main.
Depending on your needs, several declinaison of the macro exist:

- <code>GLOVE_APP</code> : Enables Glove application by setting "-glove" as CLI argument
- <code>GLOVE_APP_AUTO</code> : no need to set "-glove", the program is turned into a GUI as default
- <code>GLOVE_APP_PARAM(Tparametrization)</code> : same as <code>GLOVE_APP</code>, adds CLI arguments by-pass through a parametrization widget defined by [Tparametrization](/doc/readme/Parametrization/Parametrization_basic.md).
- <code>GLOVE_APP_PARAM_AUTO(Tparametrization)</code> : same as <code>GLOVE_APP_AUTO</code>, adds CLI arguments by-pass through a parametrization widget defined by [Tparametrization](/doc/readme/Parametrization/Parametrization_basic.md).

For example, if one wants to create an application than can be launched using no cli arguments (double clicking on the app for instance), the <code>_AUTO</code> declinaison is more suited.
## Optional macros

To run the initial program in the same initial thread, add the macro <code>#define GLOVE_APP_THREAD_MODE false </code> before calling <code>GLOVE_APP</code>.
#### <code>GLOVE_APP_AUTO</code>

To create an application than can be launched using no cli arguments (double clicking on the app for instance), add the macro <code>#define GLOVE_APP_AUTO true</code> before calling <code>GLOVE_APP</code>.
Default is <code>false</code>.

#### <code>GLOVE_APP_RECURRENT_MODE</code>

To run the program recurrently, add the macro <code>#define GLOVE_APP_RECURRENT_MODE true</code> before calling <code>GLOVE_APP</code>.
Applies only if <code>GLOVE_APP_THREAD_MODE</code> is set to true.
Default is <code>false</code>.

#### <code>GLOVE_APP_RECURRENT_TYPE</code>

If <code>GLOVE_APP_RECURRENT_MODE</code> is set to <code>true</code>, the macro defines the type of the variable to be kept across all recurrent runs.
One can for example define a structure in charge of keeping data from a run to another. Set <code>#define GLOVE_APP_RECURRENT_TYPE *Type*</code> before calling <code>GLOVE_APP</code>.
Default is <code>int</code>.

#### <code>GLOVE_APP_THREAD_MODE</code>

To run the initial program in the same initial thread, add the macro <code>#define GLOVE_APP_THREAD_MODE false</code> before calling <code>GLOVE_APP</code>.
However, it will disable progress and status features. Input parametrization using a dedicated widget will still be active though.
Default is <code>true</code>.

#### <code>GLOVE_APP_MSVC_NO_CONSOLE</code>

Use <code>#pragma GLOVE_APP_MSVC_NO_CONSOLE</code> before <code>int main</code> to disable terminal when using MSVC.

#### <code>GLOVE_APP_CLI_PARAMETRIZATION_OUTPUT_DIRECTORY</code>

Use a parameter of the CLI parametrization as a location where to save the configuration file in addition to execution location.
Example: <code>GLOVE_APP_CLI_PARAMETRIZATION_OUTPUT_DIRECTORY(ParametersCLI, "-O")</code>. With <code>ParametersCLI</code> being the CLI parametrization.
If the parameter does not exist in the CLI parametrization, returns an empty string.
12 changes: 12 additions & 0 deletions doc/readme/App/GlvApp_full.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,21 @@ glvm_parametrization(ParametersCLI, "CLI parameters",
```

```cpp
struct RecurrentStruct {
int total_loops = 0;
};

int main(int argc, char* argv[]) {

GlvApp::get_progression("Loop1");
GlvApp::get_progression("Loop2");
GlvApp::get_progression("Loop3");

#define GLOVE_APP_RECURRENT_MODE true
#define GLOVE_APP_RECURRENT_TYPE RecurrentStruct
RecurrentStruct glove_recurrent_var;
glove_recurrent_var.total_loops = 0;

GLOVE_APP_PARAM(ParametersCLI);

int N1, N2, N3;
Expand All @@ -73,6 +82,7 @@ int main(int argc, char* argv[]) {
// Simulates computation
std::this_thread::sleep_for(std::chrono::milliseconds(10));

glove_recurrent_var.total_loops++;
}

}
Expand All @@ -85,6 +95,8 @@ int main(int argc, char* argv[]) {

}

GlvApp::show(SlvStatus(SlvStatus::statusType::information, "Total loops: " + std::to_string(glove_recurrent_var.total_loops)), true);

return 0;
}
```
Expand Down
Loading

0 comments on commit b64febc

Please sign in to comment.