Load sizes for variable-size controllers in CLI mode

This commit is contained in:
Adam Honse
2020-03-20 13:50:54 -05:00
parent ce9508aa88
commit 69651b3f91
2 changed files with 10 additions and 11 deletions

View File

@@ -7,8 +7,7 @@
#include "RGBController.h"
#include "i2c_smbus.h"
extern std::vector<i2c_smbus_interface*> busses;
extern std::vector<RGBController*> rgb_controllers;
static std::vector<RGBController*> rgb_controllers;
struct DeviceOptions
{
@@ -325,8 +324,10 @@ void ApplyOptions(DeviceOptions& options)
}
}
int cli_main(int argc, char *argv[])
int cli_main(int argc, char *argv[], std::vector<RGBController *> rgb_controllers_in)
{
rgb_controllers = rgb_controllers_in;
if (argc == 2 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")))
{
PrintHelp();
@@ -339,8 +340,6 @@ int cli_main(int argc, char *argv[])
return 0;
}
DetectRGBControllers();
Options options;
if (!ProcessOptions(argc, argv, &options))
{

View File

@@ -21,7 +21,7 @@ extern std::vector<i2c_smbus_interface*> busses;
extern std::vector<RGBController*> rgb_controllers;
// See cli.cpp
extern int cli_main(int argc, char *argv[]);
extern int cli_main(int argc, char *argv[], std::vector<RGBController *> rgb_controllers_in);
/******************************************************************************************\
* *
@@ -35,15 +35,15 @@ int main(int argc, char* argv[])
{
ProfileManager profile_manager(rgb_controllers);
if (argc > 1 && strcmp(argv[1], "--gui"))
{
return cli_main(argc, argv);
}
DetectRGBControllers();
profile_manager.LoadSizeFromProfile("sizes.ors");
if (argc > 1 && strcmp(argv[1], "--gui"))
{
return cli_main(argc, argv, rgb_controllers);
}
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication a(argc, argv);