VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIWidgetValidator.h@ 47563

Last change on this file since 47563 was 47563, checked in by vboxsync, 12 years ago

FE/Qt: Settings dialog: New validation stuff: Step 2 (Removing old validation stuff).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VirtualBox Qt extensions: QIWidgetValidator class declaration
5 */
6
7/*
8 * Copyright (C) 2006-2012 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#ifndef __QIWidgetValidator_h__
20#define __QIWidgetValidator_h__
21
22/* Qt includes: */
23#include <QValidator>
24
25/* Forward declarations: */
26class UISettingsPage;
27
28/* Page validator prototype: */
29class UIPageValidator : public QObject
30{
31 Q_OBJECT;
32
33signals:
34
35 /* Notifier: Validation stuff: */
36 void sigValidityChanged(UIPageValidator *pValidator);
37
38public:
39
40 /* Constructor: */
41 UIPageValidator(QObject *pParent, UISettingsPage *pPage);
42
43 /* API: Page stuff: */
44 UISettingsPage* page() const { return m_pPage; }
45
46 /* API: Validity stuff: */
47 bool isValid() const { return m_fIsValid; }
48 void setValid(bool fIsValid) { m_fIsValid = fIsValid; }
49
50 /* API: Message stuff: */
51 QString lastMessage() const { return m_strLastMessage; }
52 void setLastMessage(const QString &strLastMessage) { m_strLastMessage = strLastMessage; }
53
54public slots:
55
56 /* API/Handler: Validation stuff: */
57 void revalidate();
58
59private:
60
61 /* Variables: */
62 UISettingsPage *m_pPage;
63 bool m_fIsValid;
64 QString m_strLastMessage;
65};
66
67class QIULongValidator : public QValidator
68{
69public:
70
71 QIULongValidator (QObject *aParent)
72 : QValidator (aParent)
73 , mBottom (0), mTop (ULONG_MAX) {}
74
75 QIULongValidator (ulong aMinimum, ulong aMaximum,
76 QObject *aParent)
77 : QValidator (aParent)
78 , mBottom (aMinimum), mTop (aMaximum) {}
79
80 ~QIULongValidator() {}
81
82 State validate (QString &aInput, int &aPos) const;
83 void setBottom (ulong aBottom) { setRange (aBottom, mTop); }
84 void setTop (ulong aTop) { setRange (mBottom, aTop); }
85 void setRange (ulong aBottom, ulong aTop) { mBottom = aBottom; mTop = aTop; }
86 ulong bottom() const { return mBottom; }
87 ulong top() const { return mTop; }
88
89private:
90
91 ulong mBottom;
92 ulong mTop;
93};
94
95#endif // __QIWidgetValidator_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