1 /*
2  * DesktopGwtWindow.hpp
3  *
4  * Copyright (C) 2021 by RStudio, PBC
5  *
6  * Unless you have received this program directly from RStudio pursuant
7  * to the terms of a commercial license agreement with RStudio, then
8  * this program is licensed to you under the terms of version 3 of the
9  * GNU Affero General Public License. This program is distributed WITHOUT
10  * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
11  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
12  * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
13  *
14  */
15 
16 #ifndef DESKTOP_GWT_WINDOW_HPP
17 #define DESKTOP_GWT_WINDOW_HPP
18 
19 #include "DesktopBrowserWindow.hpp"
20 #include "DesktopWebPage.hpp"
21 
22 namespace rstudio {
23 namespace desktop {
24 
25 class GwtWindow : public BrowserWindow
26 {
27     Q_OBJECT
28 public:
29    explicit GwtWindow(bool showToolbar,
30                       bool adjustTitle,
31                       QString name,
32                       QUrl baseUrl = QUrl(),
33                       QWidget *parent = nullptr,
34                       WebPage* opener = nullptr,
35                       bool isRemoteDesktop = false);
36 
zoomLevels() const37    const std::vector<double>& zoomLevels() const { return zoomLevels_; }
38 
39 public Q_SLOTS:
40    void onCloseWindowShortcut();
41 
42    void zoomActualSize();
43    void setZoomLevel(double zoomLevel);
44    void zoomIn();
45    void zoomOut();
46 
47 protected Q_SLOTS:
48    void finishLoading(bool) override;
49 
50 protected:
51    bool event(QEvent* pEvent) override;
52 
53 private:
onActivated()54    virtual void onActivated()
55    {
56    }
57 
58    std::vector<double> zoomLevels_;
59    double zoomLevel_;
60    QElapsedTimer lastZoomTimer_;
61 };
62 
63 } // namespace desktop
64 } // namespace rstudio
65 
66 #endif // DESKTOP_GWT_WINDOW_HPP
67