VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPageValidator.h@ 103977

Last change on this file since 103977 was 100969, checked in by vboxsync, 16 months ago

FE/Qt: UISettingsDialog: Moving code specific for page validator from dialog to corresponding class.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/* $Id: UISettingsPageValidator.h 100969 2023-08-25 12:15:39Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - Qt extensions: UISettingsPageValidator 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_UISettingsPageValidator_h
29#define FEQT_INCLUDED_SRC_settings_UISettingsPageValidator_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QObject>
36#include <QPixmap>
37
38/* GUI includes: */
39#include "UILibraryDefs.h"
40
41/* Forward declarations: */
42class QString;
43class UISettingsPage;
44
45/** QObject sub-class,
46 * used as settings-page validator. */
47class SHARED_LIBRARY_STUFF UISettingsPageValidator : public QObject
48{
49 Q_OBJECT;
50
51signals:
52
53 /** Notifies about validity change for @a pValidator. */
54 void sigValidityChanged(UISettingsPageValidator *pValidator);
55
56 /** Asks listener to show warning icon. */
57 void sigShowWarningIcon();
58 /** Asks listener to hide warning icon. */
59 void sigHideWarningIcon();
60
61public:
62
63 /** Constructs page validator for a certain @a pPage,
64 * passing @a pParent to the base-class. */
65 UISettingsPageValidator(QObject *pParent, UISettingsPage *pPage);
66
67 /** Returns page. */
68 UISettingsPage *page() const { return m_pPage; }
69
70 /** Returns warning pixmap. */
71 QPixmap warningPixmap() const;
72 /** Returns internal name. */
73 QString internalName() const;
74
75 /** Defines title @a strPrefix. */
76 void setTitlePrefix(const QString &strPrefix);
77
78 /** Returns whether validator is valid. */
79 bool isValid() const { return m_fIsValid; }
80 /** Defines whether validator @a fIsValid. */
81 void setValid(bool fIsValid) { m_fIsValid = fIsValid; }
82
83 /** Returns last message. */
84 QString lastMessage() const { return m_strLastMessage; }
85 /** Defines @a strLastMessage. */
86 void setLastMessage(const QString &strLastMessage);
87
88 /** Invalidates validator, notifying listener(s). */
89 void invalidate();
90
91 /** Revalidate validator. */
92 void revalidate();
93
94private:
95
96 /** Holds the validated page. */
97 UISettingsPage *m_pPage;
98
99 /** Holds the title prefix. */
100 QString m_strPrefix;
101
102 /** Holds whether the page is valid. */
103 bool m_fIsValid;
104
105 /** Holds the last message. */
106 QString m_strLastMessage;
107};
108
109#endif /* !FEQT_INCLUDED_SRC_settings_UISettingsPageValidator_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