VirtualBox

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

Last change on this file since 104158 was 103710, checked in by vboxsync, 9 months ago

FE/Qt: Get rid of unwanted UICommon includes across whole the GUI.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1/* $Id: UIGuestProcessControlDialog.cpp 103710 2024-03-06 16:53:27Z 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 "UIDesktopWidgetWatchdog.h"
34#include "UIExtraDataManager.h"
35#include "UIIconPool.h"
36#include "UIGuestControlConsole.h"
37#include "UIGuestProcessControlDialog.h"
38#include "UILoggingDefs.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#ifndef VBOX_WS_MAC
79 /* Assign window icon: */
80 setWindowIcon(UIIconPool::iconSetFull(":/performance_monitor_32px.png" ,":/performance_monitor_16px.png"));
81#endif
82}
83
84void UIGuestProcessControlDialog::configureCentralWidget()
85{
86 /* Create widget: */
87 UIGuestControlConsole *pConsole = new UIGuestControlConsole(m_comGuest);
88
89 if (pConsole)
90 {
91 /* Configure widget: */
92 setWidget(pConsole);
93 //setWidgetMenu(pWidget->menu());
94#ifdef VBOX_WS_MAC
95 //setWidgetToolbar(pWidget->toolbar());
96#endif
97 /* Add into layout: */
98 centralWidget()->layout()->addWidget(pConsole);
99 }
100}
101
102void UIGuestProcessControlDialog::finalize()
103{
104 /* Apply language settings: */
105 retranslateUi();
106}
107
108void UIGuestProcessControlDialog::loadSettings()
109{
110 /* Invent default window geometry: */
111 const QRect availableGeo = gpDesktop->availableGeometry(this);
112 const int iDefaultWidth = availableGeo.width() / 2;
113 const int iDefaultHeight = availableGeo.height() * 3 / 4;
114 QRect defaultGeo(0, 0, iDefaultWidth, iDefaultHeight);
115
116 /* Load geometry from extradata: */
117 QRect geo = gEDataManager->guestProcessControlDialogGeometry(this, centerWidget(), defaultGeo);
118 LogRel2(("GUI: UIGuestProcessControlDialog: Restoring geometry to: Origin=%dx%d, Size=%dx%d\n",
119 geo.x(), geo.y(), geo.width(), geo.height()));
120 restoreGeometry(geo);
121}
122
123void UIGuestProcessControlDialog::saveSettings()
124{
125 /* Save geometry to extradata: */
126 const QRect geo = currentGeometry();
127 LogRel2(("GUI: UIGuestProcessControlDialog: Saving geometry as: Origin=%dx%d, Size=%dx%d\n",
128 geo.x(), geo.y(), geo.width(), geo.height()));
129 gEDataManager->setGuestProcessControlDialogGeometry(geo, isCurrentlyMaximized());
130}
131
132bool UIGuestProcessControlDialog::shouldBeMaximized() const
133{
134 return gEDataManager->guestProcessControlDialogShouldBeMaximized();
135}
136
137void UIGuestProcessControlDialog::sltSetCloseButtonShortCut(QKeySequence shortcut)
138{
139 if (button(ButtonType_Close))
140 button(ButtonType_Close)->setShortcut(shortcut);
141}
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