2020-02-21 00:45:53 +07:00
|
|
|
#include "apptranslator.h"
|
|
|
|
|
#include "manager.h"
|
|
|
|
|
#include "singleapplication.h"
|
2020-05-20 00:15:43 +07:00
|
|
|
#include "widgetstate.h"
|
2020-02-21 00:45:53 +07:00
|
|
|
|
2013-11-23 13:48:34 +07:00
|
|
|
#include <QApplication>
|
2020-02-21 00:45:53 +07:00
|
|
|
#include <QCommandLineParser>
|
|
|
|
|
|
2020-07-15 02:51:00 +07:00
|
|
|
#include <locale.h>
|
|
|
|
|
|
2020-02-21 00:45:53 +07:00
|
|
|
#define STR2(XXX) #XXX
|
|
|
|
|
#define STR(XXX) STR2(XXX)
|
2013-11-23 13:48:34 +07:00
|
|
|
|
2020-02-21 00:45:53 +07:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
QApplication a(argc, argv);
|
|
|
|
|
a.setApplicationName("ScreenTranslator");
|
|
|
|
|
a.setOrganizationName("Gres");
|
|
|
|
|
a.setApplicationVersion(STR(VERSION));
|
2015-09-24 00:51:20 +07:00
|
|
|
|
2020-02-21 00:45:53 +07:00
|
|
|
a.setQuitOnLastWindowClosed(false);
|
2013-11-23 13:48:34 +07:00
|
|
|
|
2020-02-21 00:45:53 +07:00
|
|
|
{
|
2020-03-22 15:39:36 +07:00
|
|
|
service::AppTranslator appTranslator({"screentranslator"});
|
2020-02-21 00:45:53 +07:00
|
|
|
appTranslator.retranslate();
|
2015-09-24 00:51:20 +07:00
|
|
|
}
|
2020-02-21 00:45:53 +07:00
|
|
|
|
|
|
|
|
{
|
|
|
|
|
QCommandLineParser parser;
|
|
|
|
|
parser.setApplicationDescription(QObject::tr("OCR and translation tool"));
|
|
|
|
|
parser.addHelpOption();
|
|
|
|
|
parser.addVersionOption();
|
2020-05-20 00:15:43 +07:00
|
|
|
service::WidgetState::addHelp(parser);
|
2020-02-21 00:45:53 +07:00
|
|
|
|
|
|
|
|
parser.process(a);
|
2014-02-08 21:04:42 +07:00
|
|
|
}
|
|
|
|
|
|
2020-03-22 15:39:36 +07:00
|
|
|
service::SingleApplication guard;
|
2020-02-21 00:45:53 +07:00
|
|
|
if (!guard.isValid())
|
|
|
|
|
return 1;
|
|
|
|
|
|
2020-03-12 01:06:25 +07:00
|
|
|
// tesseract recommends
|
2020-02-21 00:45:53 +07:00
|
|
|
setlocale(LC_NUMERIC, "C");
|
|
|
|
|
|
2013-11-23 13:48:34 +07:00
|
|
|
Manager manager;
|
|
|
|
|
|
2020-02-21 00:45:53 +07:00
|
|
|
return a.exec();
|
2013-11-23 13:48:34 +07:00
|
|
|
}
|