Browse Source

Changed command-line arguments to keep backwards compatibility. Changed check on arguments to force the usage of mode when color preset is changed (original behavior). Updated README

master^2
Juan Ramón Troncoso 8 years ago
parent
commit
26fd4b5894
  1. 18
      README
  2. 10
      main.cpp

18
README

@ -1,4 +1,4 @@
This program can change the colors on your MSI steelseries keyboard. The keyboards have 3 regions that can have different colors for each one.
This program can change the colors on your MSI steelseries keyboard. Depending on the model, the keyboards have 3 or 7 regions that can have different colors for each one.
Prerequisites (tested on Ubuntu 14.04 only):
@ -22,11 +22,12 @@ Options:
-h, --help Displays this help.
-v, --version Displays version information.
-m, --mode <mode> set color <mode>: normal, gaming, breathe, demo, wave
-c, --color <color> set a <color> using the format: region,red,green,blue
with rgb values between 0 and 255
-p, --preset <preset> set a color <preset> using the format:
region,color,intensity (only valid for
left/middle/right regions)
-r, --rgb <rgb> set an <rgb> color using the format:
region,red,green,blue with rgb values between 0 and 255
-c, --color <color> set a <color> preset using the format:
region,color,intensity (only valid for left/middle/right
regions). When using this option, a mode must be
specified with -m
Available regions:
@ -59,8 +60,7 @@ light
Example:
./msi-keyboard -m normal -p left,red,high -p middle,purple,high -p right,sky,high -c touchpad,255,0,0
./msi-keyboard -m normal -c left,red,high -c middle,purple,high -c right,sky,high -r touchpad,255,0,0 -r logo,255,255,255
Licensing:
@ -72,4 +72,4 @@ Copyright (c) 2013 | Steve Lacy slacy.me | Fractal wearefractal.com contact@wear
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
$The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

10
main.cpp

@ -154,8 +154,8 @@ CommandLineParseResult parseCommandLine(QCommandLineParser &parser, KeyboardOpti
QCommandLineOption versionOption = parser.addVersionOption();
QCommandLineOption mode(QStringList() << "m" << "mode", "set color <mode>: normal, gaming, breathe, demo, wave", "mode");
QCommandLineOption color(QStringList() << "c" << "color", "set a <color> using the format: region,red,green,blue with rgb values between 0 and 255", "color");
QCommandLineOption colorPreset(QStringList() << "p" << "preset", "set a color <preset> using the format: region,color,intensity (only valid for left/middle/right regions)", "preset");
QCommandLineOption color(QStringList() << "r" << "rgb", "set an <rgb> color using the format: region,red,green,blue with rgb values between 0 and 255", "rgb");
QCommandLineOption colorPreset(QStringList() << "c" << "color", "set a <color> preset using the format: region,color,intensity (only valid for left/middle/right regions). When using this option, a mode must be specified with -m", "color");
parser.addOption(mode);
parser.addOption(color);
@ -237,7 +237,7 @@ Available preset intensities (only for left/middle/right regions):
Example:
%4
)").arg(regions.join('\n')).arg(colors.join('\n')).arg(intensities.join('\n')).arg(QString(argv[0]) + " -m normal -p left,red,high -p middle,purple,high -p right,sky,high -c touchpad,255,0,0");
)").arg(regions.join('\n')).arg(colors.join('\n')).arg(intensities.join('\n')).arg(QString(argv[0]) + " -m normal -c left,red,high -c middle,purple,high -c right,sky,high -r touchpad,255,0,0 -r logo,255,255,255");
std::cout << qPrintable(colorHelp) << std::endl;
@ -245,8 +245,8 @@ Example:
}
}
if(!keyboardOptions.modeSet && !keyboardOptions.colorSet && !keyboardOptions.presetSet) {
std::cerr << "Please set a mode or at least one color region to change." << std::endl;
if((!keyboardOptions.modeSet || !keyboardOptions.presetSet) && !keyboardOptions.colorSet ) {
std::cerr << "Please set either a mode together with at least one region to change a color preset, or a color region to change rgb color." << std::endl;
return 1;
}else{
Keyboard k;

Loading…
Cancel
Save