cutelyst
4.3.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
main.cpp
1
/*
2
* SPDX-FileCopyrightText: (C) 2016-2017 Daniel Nicoletti <dantti12@gmail.com>
3
* SPDX-License-Identifier: BSD-3-Clause
4
*/
5
#include "config.h"
6
#include "server.h"
7
8
#include <QCoreApplication>
9
#include <QLibraryInfo>
10
#include <QLocale>
11
#include <QTranslator>
12
13
int
main(
int
argc,
char
*argv[])
14
{
15
QCoreApplication::setOrganizationName
(QStringLiteral(
"Cutelyst"
));
16
QCoreApplication::setOrganizationDomain
(QStringLiteral(
"cutelyst.org"
));
17
QCoreApplication::setApplicationName
(QStringLiteral(
"cutelystd"
));
18
QCoreApplication::setApplicationVersion
(QStringLiteral(CUTELYST_VERSION));
19
20
Cutelyst::Server
server;
21
22
QObject::connect
(&server, &
Cutelyst::Server::errorOccured
, [](
const
QString
&error) {
23
qFatal(
"Server terminated due to error %s"
, qPrintable(error));
24
});
25
26
QCoreApplication
app(argc, argv);
27
28
QTranslator
appTranslator;
29
if
(appTranslator.
load
(
QLocale
(),
30
QStringLiteral(
"cutelystserver"
),
31
QStringLiteral(
"."
),
32
QStringLiteral(CUTELYST_I18N_DIR))) {
33
QCoreApplication::installTranslator
(&appTranslator);
34
}
35
36
server.
parseCommandLine
(app.arguments());
37
38
// QTranslator qtTranslator;
39
// qtTranslator.load(QLatin1String("qt_") % QLocale::system().name(),
40
// QLibraryInfo::location(QLibraryInfo::TranslationsPath));
41
// QCoreApplication::installTranslator(&qtTranslator);
42
43
return
server.
exec
();
44
}
Cutelyst::Server
Implements a web server.
Definition
server.h:60
Cutelyst::Server::errorOccured
void errorOccured(const QString &error)
Cutelyst::Server::exec
int exec(Cutelyst::Application *app=nullptr)
Definition
server.cpp:676
Cutelyst::Server::parseCommandLine
void parseCommandLine(const QStringList &args)
Definition
server.cpp:94
QCoreApplication
QCoreApplication::setApplicationName
void setApplicationName(const QString &application)
QCoreApplication::setApplicationVersion
void setApplicationVersion(const QString &version)
QCoreApplication::installTranslator
bool installTranslator(QTranslator *translationFile)
QCoreApplication::setOrganizationDomain
void setOrganizationDomain(const QString &orgDomain)
QCoreApplication::setOrganizationName
void setOrganizationName(const QString &orgName)
QLocale
QObject::connect
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QString
QTranslator
QTranslator::load
bool load(const QLocale &locale, const QString &filename, const QString &prefix, const QString &directory, const QString &suffix)
Cutelyst
Server
main.cpp
Generated by
1.9.8