FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
rstudio/src/cpp/desktop/DesktopBrowserWindow.cpp at master · usersbin/rstudio · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
usersbin
/
rstudio
Public
forked from
rstudio/rstudio
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
rstudio
/
src
/
cpp
/
desktop
/
DesktopBrowserWindow.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
93 lines (79 loc) · 2.69 KB
Breadcrumbs
rstudio
/
src
/
cpp
/
desktop
/
DesktopBrowserWindow.cpp
Copy path
File metadata and controls
93 lines (79 loc) · 2.69 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* DesktopBrowserWindow.cpp
*
* Copyright (C) 2009-11 by RStudio, Inc.
*
* This program is licensed to you under the terms of version 3 of the
* GNU Affero General Public License. This program is distributed WITHOUT
* ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
* AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
*
*/
#
include
"
DesktopBrowserWindow.hpp
"
#
include
<
QWebFrame
>
#
include
"
DesktopWebView.hpp
"
namespace
desktop
{
BrowserWindow::BrowserWindow
(
bool
showToolbar,
bool
adjustTitle,
QUrl baseUrl,
QWidget* pParent) :
QMainWindow
(pParent)
{
adjustTitle_ = adjustTitle;
progress_ =
0
;
pView_ =
new
WebView
(baseUrl,
this
);
QWebFrame* mainFrame = pView_->
page
()->
mainFrame
();
connect
(mainFrame,
SIGNAL
(
javaScriptWindowObjectCleared
()),
this
,
SLOT
(
onJavaScriptWindowObjectCleared
()));
connect
(pView_,
SIGNAL
(
titleChanged
(QString)),
SLOT
(
adjustTitle
()));
connect
(pView_,
SIGNAL
(
loadProgress
(
int
)),
SLOT
(
setProgress
(
int
)));
connect
(pView_,
SIGNAL
(
loadFinished
(
bool
)),
SLOT
(
finishLoading
(
bool
)));
connect
(pView_->
page
(),
SIGNAL
(
printRequested
(QWebFrame*)),
this
,
SLOT
(
printRequested
(QWebFrame*)));
//
Kind of a hack to new up a toolbar and not attach it to anything.
//
Once it is clear what secondary browser windows look like we can
//
decide whether to keep this.
pToolbar_ = showToolbar ?
addToolBar
(
tr
(
"
Navigation
"
)) :
new
QToolBar
();
pToolbar_->
setMovable
(
false
);
setCentralWidget
(pView_);
setUnifiedTitleAndToolBarOnMac
(
true
);
QShortcut* copyShortcut =
new
QShortcut
(QKeySequence::Copy,
this
);
connect
(copyShortcut,
SIGNAL
(
activated
()),
pView_->
pageAction
(QWebPage::Copy),
SLOT
(
trigger
()));
}
void
BrowserWindow::printRequested
(QWebFrame* frame)
{
QPrintPreviewDialog
dialog
(
window
());
dialog.
setWindowModality
(Qt::WindowModal);
connect
(&dialog,
SIGNAL
(
paintRequested
(QPrinter*)),
frame,
SLOT
(
print
(QPrinter*)));
dialog.
exec
();
}
void
BrowserWindow::adjustTitle
()
{
if
(adjustTitle_)
setWindowTitle
(pView_->
title
());
}
void
BrowserWindow::setProgress
(
int
p)
{
progress_ = p;
adjustTitle
();
}
void
BrowserWindow::finishLoading
(
bool
)
{
progress_ =
100
;
adjustTitle
();
}
WebView*
BrowserWindow::webView
()
{
return
pView_;
}
void
BrowserWindow::avoidMoveCursorIfNecessary
()
{
#
ifdef
Q_WS_MACX
webView
()->
page
()->
mainFrame
()->
evaluateJavaScript
(
QString::fromAscii
(
"
document.body.className = document.body.className + ' avoid-move-cursor'
"
));
#
endif
}
}
//
namespace desktop
Back
|
FazBrowse Home
|
New Git URL