-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
53 lines (41 loc) · 1.34 KB
/
main.cpp
File metadata and controls
53 lines (41 loc) · 1.34 KB
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
48
49
50
51
52
53
#include <iostream>
#include <QApplication>
#include "browserclient.h"
#include "clienthandler.h"
#include "qbrowserwindow.h"
#include "cef_app.h"
int main(int argc, char **argv) {
// Provide CEF with command-line arguments.
#ifdef __linux__
CefMainArgs main_args(argc, argv);
#endif
#ifdef _WINDOWS
HINSTANCE h = GetModuleHandle(nullptr);
CefMainArgs main_args(h);
#endif
// CEF applications have multiple sub-processes (render, GPU, etc) that share
// the same executable. This function checks the command-line and, if this is
// a sub-process, executes the appropriate logic.
int exit_code = CefExecuteProcess(main_args, nullptr, nullptr);
if (exit_code >= 0) {
// The sub-process has completed so return here.
return exit_code;
}
// Parse command-line arguments for use in this method.
CefRefPtr<CefCommandLine> command_line = CefCommandLine::CreateCommandLine();
#ifdef __linux__
command_line->InitFromArgv(argc, argv);
#endif
#ifdef _WINDOWS
#endif
// Specify CEF global settings here.
CefSettings settings;
CefString(&settings.locale).FromString("zh-CN");
CefString(&settings.accept_language_list).FromString("zh-CN");
CefRefPtr<CefApp> app;
CefInitialize(main_args, settings, app.get(), nullptr);
QApplication a(argc, argv);
QBrowserWindow w("bilibili.com");
CefRunMessageLoop();
CefShutdown();
}