forked from gavrushkin/bldc-logger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
argprocessor.cpp
48 lines (41 loc) · 1.14 KB
/
argprocessor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "argprocessor.h"
#include <QTextStream>
ArgProcessor::ArgProcessor(QObject *parent) : QObject(parent)
{
QTextStream streamOut(stdout);
QTextStream streamIn(stdin);
#ifdef Q_OS_WIN
QString defaultPort_ = "COM3";
#elif defined(Q_OS_MAC)
QString defaultPort_ = "/dev/tty.usbmodem261";
#else
QString defaultPort_ = "/dev/ttyACM0";
#endif
streamOut << "Port (default is " + defaultPort_ + "): ";
streamOut.flush();
mPort = streamIn.readLine();
if(mPort.isEmpty()) {
mPort = defaultPort_;
}
streamOut << "Camera index (default is 0): ";
streamOut.flush();
mCamera = streamIn.readLine().toInt();
streamOut << "Camera width (default is 1280): ";
streamOut.flush();
mWidth = streamIn.readLine().toInt();
if(mWidth == 0) {
mWidth = 1280;
}
streamOut << "Camera height (default is 720): ";
streamOut.flush();
mHeight = streamIn.readLine().toInt();
if(mHeight == 0) {
mHeight = 720;
}
streamOut << "Camera fps (default is 25.0): ";
streamOut.flush();
mFps = streamIn.readLine().toInt();
if(mFps == 0) {
mFps = 25.0;
}
}