@@ -43,6 +43,9 @@ OptionsParser::Options parseOptions(int argc, char *argv[])
"Set configuration of a camera stream", "stream", true);
parser.addOption(OptVerbose, OptionNone,
"Print verbose log messages", "verbose");
+ parser.addOption(OptCaptureScript, OptionString,
+ "Load a capture session configuration script from a file",
+ "script", ArgumentRequired, "script");
OptionsParser::Options options = parser.parse(argc, argv);
if (options.isSet(OptHelp))
@@ -151,6 +151,15 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)
return;
}
+ if (options_.isSet(OptCaptureScript)) {
+ std::string scriptName = options_[OptCaptureScript].toString();
+ script_ = std::make_unique<CaptureScript>(camera_, scriptName);
+ if (!script_->valid()) {
+ QMessageBox::critical(this, tr("Invalid Script"), tr("Couldn't execute the capture script"));
+ script_.reset();
+ }
+ }
+
startStopAction_->setChecked(true);
}
@@ -42,6 +42,7 @@ enum {
OptRenderer = 'r',
OptStream = 's',
OptVerbose = 'v',
+ OptCaptureScript = 256,
};
class MainWindow : public QMainWindow
Add --script as an individual option to load capture scripts. Load the capture script before starting the capture. Signed-off-by: Utkarsh Tiwari <utkarsh02t@gmail.com> --- src/qcam/main.cpp | 3 +++ src/qcam/main_window.cpp | 9 +++++++++ src/qcam/main_window.h | 1 + 3 files changed, 13 insertions(+)