VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h@ 104158

Last change on this file since 104158 was 101607, checked in by vboxsync, 16 months ago

FE/Qt: bugref:10513: Machine settings / Serial page: Renaming UIMachineSettingsSerialPage to UIMachineSettingsSerial, similarly to other pages.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.3 KB
Line 
1/* $Id: UIMachineSettingsSerial.h 101607 2023-10-26 14:14:46Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIMachineSettingsSerial class declaration.
4 */
5
6/*
7 * Copyright (C) 2006-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#ifndef FEQT_INCLUDED_SRC_settings_machine_UIMachineSettingsSerial_h
29#define FEQT_INCLUDED_SRC_settings_machine_UIMachineSettingsSerial_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* GUI includes: */
35#include "UISettingsPage.h"
36
37/* Forward declarations: */
38class QITabWidget;
39class UISerialSettingsEditor;
40struct UIDataSettingsMachineSerial;
41struct UIDataSettingsMachineSerialPort;
42typedef UISettingsCache<UIDataSettingsMachineSerialPort> UISettingsCacheMachineSerialPort;
43typedef UISettingsCachePool<UIDataSettingsMachineSerial, UISettingsCacheMachineSerialPort> UISettingsCacheMachineSerial;
44
45/** Machine settings: Serial page. */
46class SHARED_LIBRARY_STUFF UIMachineSettingsSerial : public UISettingsPageMachine
47{
48 Q_OBJECT;
49
50public:
51
52 /** Constructs Serial settings page. */
53 UIMachineSettingsSerial();
54 /** Destructs Serial settings page. */
55 virtual ~UIMachineSettingsSerial() RT_OVERRIDE;
56
57 /** Returns ports. */
58 QVector<QPair<QString, QString> > ports() const { return m_ports; }
59 /** Returns paths. */
60 QVector<QString> paths() const { return m_paths; }
61
62protected:
63
64 /** Returns whether the page content was changed. */
65 virtual bool changed() const RT_OVERRIDE;
66
67 /** Loads settings from external object(s) packed inside @a data to cache.
68 * @note This task WILL be performed in other than the GUI thread, no widget interactions! */
69 virtual void loadToCacheFrom(QVariant &data) RT_OVERRIDE;
70 /** Loads data from cache to corresponding widgets.
71 * @note This task WILL be performed in the GUI thread only, all widget interactions here! */
72 virtual void getFromCache() RT_OVERRIDE;
73
74 /** Saves data from corresponding widgets to cache.
75 * @note This task WILL be performed in the GUI thread only, all widget interactions here! */
76 virtual void putToCache() RT_OVERRIDE;
77 /** Saves settings from cache to external object(s) packed inside @a data.
78 * @note This task WILL be performed in other than the GUI thread, no widget interactions! */
79 virtual void saveFromCacheTo(QVariant &data) RT_OVERRIDE;
80
81 /** Performs validation, updates @a messages list if something is wrong. */
82 virtual bool validate(QList<UIValidationMessage> &messages) RT_OVERRIDE;
83
84 /** Handles translation event. */
85 virtual void retranslateUi() RT_OVERRIDE;
86
87 /** Performs final page polishing. */
88 virtual void polishPage() RT_OVERRIDE;
89
90private slots:
91
92 /** Handles port change. */
93 void sltHandlePortChange();
94 /** Handles path change. */
95 void sltHandlePathChange();
96
97private:
98
99 /** Prepares all. */
100 void prepare();
101 /** Prepares widgets. */
102 void prepareWidgets();
103 /** Prepare tab. */
104 void prepareTab();
105 /** Prepares connections. */
106 void prepareConnections(UISerialSettingsEditor *pTabEditor);
107 /** Cleanups all. */
108 void cleanup();
109
110 /** Performs tab polishing for specified @a iSlot. */
111 void polishTab(int iSlot);
112
113 /** Loads port data for specified @a iSlot from @a portCache to corresponding widgets. */
114 void getFromCache(int iSlot, const UISettingsCacheMachineSerialPort &portCache);
115 /** Saves port data for specified @a iSlot from corresponding widgets to @a portCache. */
116 void putToCache(int iSlot, UISettingsCacheMachineSerialPort &portCache);
117
118 /** Returns IRQ for specified @a iSlot. */
119 QString irq(int iSlot) const;
120 /** Returns IO address for specified @a iSlot. */
121 QString ioAddress(int iSlot) const;
122
123 /** Performs validation for specified @a iSlot, updates @a messages list if something is wrong. */
124 bool validate(int iSlot, QList<UIValidationMessage> &messages);
125
126 /** Repopulates ports. */
127 void refreshPorts();
128 /** Repopulates paths. */
129 void refreshPaths();
130
131 /** Returns tab title for specified @a iSlot. */
132 static QString tabTitle(int iSlot);
133
134 /** Saves existing data from cache. */
135 bool saveData();
136 /** Saves existing port data from cache. */
137 bool savePortData(int iSlot);
138
139 /** Holds the ports. */
140 QVector<QPair<QString, QString> > m_ports;
141 /** Holds the paths. */
142 QVector<QString> m_paths;
143
144 /** Holds the page data cache instance. */
145 UISettingsCacheMachineSerial *m_pCache;
146
147 /** Holds the tab-widget instance. */
148 QITabWidget *m_pTabWidget;
149
150 /** Holds the list of tab-editors. */
151 QList<UISerialSettingsEditor*> m_tabEditors;
152};
153
154#endif /* !FEQT_INCLUDED_SRC_settings_machine_UIMachineSettingsSerial_h */
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