Открыть боковую панель
MOS
Исходные коды
mos-vkm
Коммиты
09244592
Коммит
09244592
создал
Авг 29, 2024
по автору
Коул Милена Ричардовна
Просмотр файлов
fix remembering login
владелец
6b7bd559
Изменения
2
Скрыть пробелы
Построчно
Рядом
webEngineWidgets/browser.cpp
Просмотр файла @
09244592
...
@@ -51,6 +51,8 @@
...
@@ -51,6 +51,8 @@
#include
"browser.h"
#include
"browser.h"
#include
"browserwindow.h"
#include
"browserwindow.h"
#include
<QWebEngineSettings>
Browser
::
Browser
()
Browser
::
Browser
()
{
{
// Quit application if the download manager window is the only remaining window
// Quit application if the download manager window is the only remaining window
...
@@ -63,13 +65,15 @@ Browser::Browser()
...
@@ -63,13 +65,15 @@ Browser::Browser()
BrowserWindow
*
Browser
::
createWindow
(
QString
vkm_link
,
bool
offTheRecord
)
BrowserWindow
*
Browser
::
createWindow
(
QString
vkm_link
,
bool
offTheRecord
)
{
{
if
(
offTheRecord
&&
!
m_otrProfile
)
{
if
(
!
offTheRecord
&&
!
m_profile
)
{
m_otrProfile
.
reset
(
new
QWebEngineProfile
);
m_profile
.
reset
(
new
QWebEngineProfile
(
QObject
::
connect
(
QString
::
fromLatin1
(
"mosvkm.%1"
).
arg
(
qWebEngineChromiumVersion
())));
m_otrProfile
.
get
(),
&
QWebEngineProfile
::
downloadRequested
,
m_profile
->
settings
()
->
setAttribute
(
QWebEngineSettings
::
PluginsEnabled
,
true
);
&
m_downloadManagerWidget
,
&
DownloadManagerWidget
::
downloadRequested
);
m_profile
->
settings
()
->
setAttribute
(
QWebEngineSettings
::
DnsPrefetchEnabled
,
true
);
QObject
::
connect
(
m_profile
.
get
(),
&
QWebEngineProfile
::
downloadRequested
,
&
m_downloadManagerWidget
,
&
DownloadManagerWidget
::
downloadRequested
);
}
}
auto
profile
=
offTheRecord
?
m_
otrP
rofile
.
get
()
:
QWebEngineProfile
::
defaultProfile
();
auto
profile
=
!
offTheRecord
?
m_
p
rofile
.
get
()
:
QWebEngineProfile
::
defaultProfile
();
auto
mainWindow
=
new
BrowserWindow
(
this
,
profile
,
vkm_link
,
false
);
auto
mainWindow
=
new
BrowserWindow
(
this
,
profile
,
vkm_link
,
false
);
m_windows
.
append
(
mainWindow
);
m_windows
.
append
(
mainWindow
);
QObject
::
connect
(
mainWindow
,
&
QObject
::
destroyed
,
[
this
,
mainWindow
]()
{
QObject
::
connect
(
mainWindow
,
&
QObject
::
destroyed
,
[
this
,
mainWindow
]()
{
...
@@ -81,13 +85,15 @@ BrowserWindow *Browser::createWindow(QString vkm_link, bool offTheRecord)
...
@@ -81,13 +85,15 @@ BrowserWindow *Browser::createWindow(QString vkm_link, bool offTheRecord)
LinkWindow
*
Browser
::
createLinkWindow
(
bool
offTheRecord
)
LinkWindow
*
Browser
::
createLinkWindow
(
bool
offTheRecord
)
{
{
if
(
offTheRecord
&&
!
m_otrProfile
)
{
if
(
!
offTheRecord
&&
!
m_profile
)
{
m_otrProfile
.
reset
(
new
QWebEngineProfile
);
m_profile
.
reset
(
new
QWebEngineProfile
(
QObject
::
connect
(
QString
::
fromLatin1
(
"mosvkm.%1"
).
arg
(
qWebEngineChromiumVersion
())));
m_otrProfile
.
get
(),
&
QWebEngineProfile
::
downloadRequested
,
m_profile
->
settings
()
->
setAttribute
(
QWebEngineSettings
::
PluginsEnabled
,
true
);
&
m_downloadManagerWidget
,
&
DownloadManagerWidget
::
downloadRequested
);
m_profile
->
settings
()
->
setAttribute
(
QWebEngineSettings
::
DnsPrefetchEnabled
,
true
);
QObject
::
connect
(
m_profile
.
get
(),
&
QWebEngineProfile
::
downloadRequested
,
&
m_downloadManagerWidget
,
&
DownloadManagerWidget
::
downloadRequested
);
}
}
auto
profile
=
offTheRecord
?
m_
otrP
rofile
.
get
()
:
QWebEngineProfile
::
defaultProfile
();
auto
profile
=
!
offTheRecord
?
m_
p
rofile
.
get
()
:
QWebEngineProfile
::
defaultProfile
();
auto
mainWindow
=
new
LinkWindow
(
this
,
profile
,
false
);
auto
mainWindow
=
new
LinkWindow
(
this
,
profile
,
false
);
mainWindow
->
show
();
mainWindow
->
show
();
return
mainWindow
;
return
mainWindow
;
...
...
webEngineWidgets/browser.h
Просмотр файла @
09244592
...
@@ -72,6 +72,6 @@ public:
...
@@ -72,6 +72,6 @@ public:
private:
private:
QVector
<
BrowserWindow
*>
m_windows
;
QVector
<
BrowserWindow
*>
m_windows
;
DownloadManagerWidget
m_downloadManagerWidget
;
DownloadManagerWidget
m_downloadManagerWidget
;
QScopedPointer
<
QWebEngineProfile
>
m_
otrP
rofile
;
QScopedPointer
<
QWebEngineProfile
>
m_
p
rofile
;
};
};
#endif // BROWSER_H
#endif // BROWSER_H
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать