fa834aba6c
Completely re-written the project to use the QT API. By using Qt, I've open up use of useful tools like QCryptographicHash, QString, QByteArray, QFile, etc.. In the future I could even make use of slots/signals. The code is also in general much more readable and thread management is by far much easier. General operation of the app should be the same, this commit just serves as a base for the migration over to QT.
56 lines
1.8 KiB
C++
56 lines
1.8 KiB
C++
// This file is part of Motion Watch.
|
|
|
|
// Motion Watch is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
|
|
// Motion Watch is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
#include "mo_detect.h"
|
|
#include "logger.h"
|
|
#include "web.h"
|
|
#include "camera.h"
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
QCoreApplication app(argc, argv);
|
|
|
|
QCoreApplication::setApplicationName(APP_NAME);
|
|
QCoreApplication::setApplicationVersion(APP_VER);
|
|
|
|
auto args = QCoreApplication::arguments();
|
|
auto ret = 0;
|
|
|
|
if (args.contains("-h"))
|
|
{
|
|
QTextStream(stdout) << "Motion Watch " << APP_VER << Qt::endl << Qt::endl;
|
|
QTextStream(stdout) << "Usage: mow <argument>" << Qt::endl << Qt::endl;
|
|
QTextStream(stdout) << "-h : display usage information about this application." << Qt::endl;
|
|
QTextStream(stdout) << "-c : path to the config file." << Qt::endl;
|
|
QTextStream(stdout) << "-v : display the current version." << Qt::endl << Qt::endl;
|
|
}
|
|
else if (args.contains("-v"))
|
|
{
|
|
QTextStream(stdout) << APP_VER << Qt::endl;
|
|
}
|
|
else if (args.contains("-c"))
|
|
{
|
|
auto *cam = new Camera(&app);
|
|
|
|
if (cam->start(args))
|
|
{
|
|
ret = QCoreApplication::exec();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
QTextStream(stderr) << "err: no config file(s) were given in -c" << Qt::endl;
|
|
}
|
|
|
|
return ret;
|
|
}
|