Falkon
Develop
Cross-platform Qt-based web browser
main.cpp
Go to the documentation of this file.
1
/* ============================================================
2
* Falkon - Qt web browser
3
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
* ============================================================ */
18
#include "
mainapplication.h
"
19
#include "
proxystyle.h
"
20
21
#include <iostream>
22
23
#ifndef Q_OS_WIN
24
void
msgHandler
(QtMsgType type,
const
QMessageLogContext &context,
const
QString &msg)
25
{
26
if
(msg.startsWith(
QL1S
(
"QSslSocket: cannot resolve SSL"
)))
27
return
;
28
if
(msg.startsWith(
QL1S
(
"Remote debugging server started successfully."
)))
29
return
;
30
31
switch
(type) {
32
case
QtDebugMsg:
33
case
QtInfoMsg:
34
case
QtWarningMsg:
35
case
QtCriticalMsg:
36
std::cerr << qPrintable(qFormatLogMessage(type, context, msg)) << std::endl;
37
break
;
38
39
case
QtFatalMsg:
40
std::cerr <<
"Fatal: "
<< qPrintable(qFormatLogMessage(type, context, msg)) << std::endl;
41
abort();
42
43
default
:
44
break
;
45
}
46
}
47
#endif
48
49
int
main
(
int
argc,
char
* argv[])
50
{
51
#ifndef Q_OS_WIN
52
qInstallMessageHandler(&
msgHandler
);
53
#endif
54
55
// Hack to fix QT_STYLE_OVERRIDE with QProxyStyle
56
const
QByteArray style = qgetenv(
"QT_STYLE_OVERRIDE"
);
57
if
(!style.isEmpty()) {
58
char
** args = (
char
**) malloc(
sizeof
(
char
*) * (argc + 1));
59
for
(
int
i
= 0;
i
< argc; ++
i
)
60
args[
i
] = argv[
i
];
61
62
QString stylecmd =
QL1S
(
"-style="
) + QString::fromUtf8(style);
63
args[argc++] = qstrdup(stylecmd.toUtf8().constData());
64
argv = args;
65
}
66
67
MainApplication
app(argc, argv);
68
69
if
(app.
isClosing
())
70
return
0;
71
72
app.
setProxyStyle
(
new
ProxyStyle
);
73
74
return
app.exec();
75
}
MainApplication
Definition:
mainapplication.h:59
MainApplication::setProxyStyle
void setProxyStyle(ProxyStyle *style)
Definition:
mainapplication.cpp:539
MainApplication::isClosing
bool isClosing() const
Definition:
mainapplication.cpp:417
ProxyStyle
Definition:
proxystyle.h:26
main
int main(int argc, char *argv[])
Definition:
main.cpp:49
msgHandler
void msgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
Definition:
main.cpp:24
mainapplication.h
i18n.i
i
Definition:
i18n.py:23
proxystyle.h
QL1S
#define QL1S(x)
Definition:
qzcommon.h:44
src
main
main.cpp
Generated by
1.9.3