Allow specifying --gui and --server together

This commit is contained in:
Adam Honse
2020-06-28 02:18:28 -05:00
parent 199db16ec0
commit 58aba0a147
2 changed files with 118 additions and 58 deletions

View File

@@ -21,9 +21,18 @@
extern std::vector<i2c_smbus_interface*> busses;
extern std::vector<RGBController*> rgb_controllers;
// See cli.cpp
/*-------------------------------------------------------------*\
| Command line functionality and return flags |
\*-------------------------------------------------------------*/
extern unsigned int cli_main(int argc, char *argv[], std::vector<RGBController *> rgb_controllers_in, ProfileManager* profile_manager_in, NetworkServer* network_server_in);
enum
{
RET_FLAG_PRINT_HELP = 1,
RET_FLAG_START_GUI = 2,
RET_FLAG_I2C_TOOLS = 4,
};
/******************************************************************************************\
* *
* main *
@@ -41,30 +50,39 @@ int main(int argc, char* argv[])
profile_manager.LoadSizeFromProfile("sizes.ors");
unsigned int ret_flags = 0;
/*---------------------------------------------------------*\
| Process command line arguments |
\*---------------------------------------------------------*/
unsigned int ret_flags = RET_FLAG_START_GUI;
if(argc > 1)
{
ret_flags = cli_main(argc, argv, rgb_controllers, &profile_manager, &server);
}
if(ret_flags && 2)
/*---------------------------------------------------------*\
| If the command line parser indicates that the GUI should |
| run, or if there were no command line arguments, start the|
| GUI. |
\*---------------------------------------------------------*/
if(ret_flags & RET_FLAG_START_GUI)
{
//GUI is enabled
}
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication a(argc, argv);
bool show_i2c_tools = false;
if(ret_flags && 4)
bool show_i2c_tools = false;
if(ret_flags & RET_FLAG_I2C_TOOLS)
{
//I2C Tools is enabled
show_i2c_tools = true;
}
Ui::OpenRGBDialog2 dlg(busses, rgb_controllers, &profile_manager, &server, show_i2c_tools);
dlg.show();
return a.exec();
}
else
{
//I2C Tools is enabled
show_i2c_tools = true;
return 0;
}
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication a(argc, argv);
Ui::OpenRGBDialog2 dlg(busses, rgb_controllers, &profile_manager, &server, show_i2c_tools);
dlg.show();
return a.exec();
}