Skip to content

Latest commit

 

History

History
70 lines (43 loc) · 3.53 KB

GlvApp.md

File metadata and controls

70 lines (43 loc) · 3.53 KB

Convert C++ application to GUI : All you need is Glove!

The framework includes simple methods to transform a C++ program with command line arguments into a basic application. 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 for an exhaustive example.

CLI to GUI

The framework includes a simple method to transform the command line arguments of a main into a basic GUI. The framework allows a flexible CLI approach, and can manage saving and loading of the arguments as presented just above.

Example : CLI to GUI

Remark

Without relying on Qt, a simple parsing of a 'main' parametrization can be done.

Example : CLI parametrization

Full

An example detailing how to use all the features managed by a Glove application can be found here.

Base macros

The GLOVE_APP 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:

  • GLOVE_APP : Enables Glove application by setting "-glove" as CLI argument
  • GLOVE_APP_PARAM(Tparametrization) : same as GLOVE_APP, adds CLI arguments by-pass through a parametrization widget defined by Tparametrization.

Optional macros

GLOVE_APP_AUTO

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

GLOVE_APP_RECURRENT_MODE

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

GLOVE_APP_RECURRENT_TYPE

If GLOVE_APP_RECURRENT_MODE is set to true, 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 #define GLOVE_APP_RECURRENT_TYPE Type before calling GLOVE_APP. Default is int.

GLOVE_APP_THREAD_MODE

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

GLOVE_APP_MSVC_NO_CONSOLE

Use #pragma GLOVE_APP_MSVC_NO_CONSOLE before int main to disable terminal when using MSVC.

GLOVE_APP_CLI_PARAMETRIZATION_OUTPUT_DIRECTORY

Use a parameter of the CLI parametrization as a location where to save the configuration file in addition to execution location. Example: GLOVE_APP_CLI_PARAMETRIZATION_OUTPUT_DIRECTORY(ParametersCLI, "-O"). With ParametersCLI being the CLI parametrization. If the parameter does not exist in the CLI parametrization, returns an empty string.