VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlDialog.cpp@ 100347

Last change on this file since 100347 was 98876, checked in by vboxsync, 23 months ago

FE/Qt: bugref:10322: Build fix for r156201.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 KB
Line 
1/* $Id: UIGuestProcessControlDialog.cpp 98876 2023-03-08 10:04:54Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIGuestProcessControlDialog class implementation.
4 */
5
6/*
7 * Copyright (C) 2010-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28/* Qt includes: */
29#include <QPushButton>
30#include <QVBoxLayout>
31
32/* GUI includes: */
33#include "UICommon.h"
34#include "UIDesktopWidgetWatchdog.h"
35#include "UIExtraDataManager.h"
36#include "UIIconPool.h"
37#include "UIGuestControlConsole.h"
38#include "UIGuestProcessControlDialog.h"
39#include "UIMachine.h"
40#include "UISession.h"
41
42
43/*********************************************************************************************************************************
44* Class UIGuestProcessControlDialogFactory implementation. *
45*********************************************************************************************************************************/
46
47UIGuestProcessControlDialogFactory::UIGuestProcessControlDialogFactory()
48{
49}
50
51void UIGuestProcessControlDialogFactory::create(QIManagerDialog *&pDialog, QWidget *pCenterWidget)
52{
53 pDialog = new UIGuestProcessControlDialog(pCenterWidget);
54}
55
56
57/*********************************************************************************************************************************
58* Class UIGuestProcessControlDialog implementation. *
59*********************************************************************************************************************************/
60
61UIGuestProcessControlDialog::UIGuestProcessControlDialog(QWidget *pCenterWidget)
62 : QIWithRetranslateUI<QIManagerDialog>(pCenterWidget)
63 , m_comGuest(gpMachine->uisession()->guest())
64 , m_strMachineName(gpMachine->machineName())
65{
66}
67
68void UIGuestProcessControlDialog::retranslateUi()
69{
70 /* Translate window title: */
71 setWindowTitle(tr("%1 - Guest Control").arg(m_strMachineName));
72 /* Translate buttons: */
73 button(ButtonType_Close)->setText(tr("Close"));
74}
75
76void UIGuestProcessControlDialog::configure()
77{
78 /* Apply window icons: */
79 setWindowIcon(UIIconPool::iconSetFull(":/vm_show_logs_32px.png", ":/vm_show_logs_16px.png"));
80}
81
82void UIGuestProcessControlDialog::configureCentralWidget()
83{
84 /* Create widget: */
85 UIGuestControlConsole *pConsole = new UIGuestControlConsole(m_comGuest);
86
87 if (pConsole)
88 {
89 /* Configure widget: */
90 setWidget(pConsole);
91 //setWidgetMenu(pWidget->menu());
92#ifdef VBOX_WS_MAC
93 //setWidgetToolbar(pWidget->toolbar());
94#endif
95 /* Add into layout: */
96 centralWidget()->layout()->addWidget(pConsole);
97 }
98}
99
100void UIGuestProcessControlDialog::finalize()
101{
102 /* Apply language settings: */
103 retranslateUi();
104}
105
106void UIGuestProcessControlDialog::loadSettings()
107{
108 /* Invent default window geometry: */
109 const QRect availableGeo = gpDesktop->availableGeometry(this);
110 const int iDefaultWidth = availableGeo.width() / 2;
111 const int iDefaultHeight = availableGeo.height() * 3 / 4;
112 QRect defaultGeo(0, 0, iDefaultWidth, iDefaultHeight);
113
114 /* Load geometry from extradata: */
115 QRect geo = gEDataManager->guestProcessControlDialogGeometry(this, centerWidget(), defaultGeo);
116 LogRel2(("GUI: UIGuestProcessControlDialog: Restoring geometry to: Origin=%dx%d, Size=%dx%d\n",
117 geo.x(), geo.y(), geo.width(), geo.height()));
118 restoreGeometry(geo);
119}
120
121void UIGuestProcessControlDialog::saveSettings()
122{
123 /* Save geometry to extradata: */
124 const QRect geo = currentGeometry();
125 LogRel2(("GUI: UIGuestProcessControlDialog: Saving geometry as: Origin=%dx%d, Size=%dx%d\n",
126 geo.x(), geo.y(), geo.width(), geo.height()));
127 gEDataManager->setGuestProcessControlDialogGeometry(geo, isCurrentlyMaximized());
128}
129
130bool UIGuestProcessControlDialog::shouldBeMaximized() const
131{
132 return gEDataManager->guestProcessControlDialogShouldBeMaximized();
133}
134
135void UIGuestProcessControlDialog::sltSetCloseButtonShortCut(QKeySequence shortcut)
136{
137 if (button(ButtonType_Close))
138 button(ButtonType_Close)->setShortcut(shortcut);
139}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette