VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSettingsSelector.h@ 10468

Last change on this file since 10468 was 10468, checked in by vboxsync, 17 years ago

FE/Qt4: Added an interface class for the settings selector. Implemented the
classical tree view approach.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt4 GUI ("VirtualBox"):
4 * VBoxSettingsSelector class declaration
5 */
6
7/*
8 * Copyright (C) 2008 Sun Microsystems, Inc.
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.215389.xyz. 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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19 * Clara, CA 95054 USA or visit http://www.sun.com if you need
20 * additional information or have any questions.
21 */
22
23#ifndef __VBoxSettingsSelector_h__
24#define __VBoxSettingsSelector_h__
25
26/* Qt includes */
27#include <QObject>
28
29class QITreeWidget;
30
31class QTreeWidget;
32class QTreeWidgetItem;
33class QIcon;
34
35class VBoxSettingsSelector: public QObject
36{
37 Q_OBJECT;
38
39public:
40
41 VBoxSettingsSelector (QWidget *aParent = NULL);
42
43 virtual QWidget *widget() const = 0;
44
45 virtual void addItem (const QIcon &aIcon, const QString &aText, int aId, const QString &aLink) = 0;
46 virtual QString itemText (int aId) const = 0;
47 virtual QString itemTextByIndex (int aIndex) const { return itemText (indexToId (aIndex)); }
48
49 virtual int currentId () const = 0;
50 virtual int idToIndex (int aId) const = 0;
51 virtual int indexToId (int aIndex) const = 0;
52 virtual int linkToId (const QString &aLink) const = 0;
53 virtual void selectById (int aId) = 0;
54 virtual void selectByLink (const QString &aLink) { selectById (linkToId (aLink)); }
55 virtual void setVisibleById (int aId, bool aShow) = 0;
56
57 virtual void clear() = 0;
58
59 virtual void retranslateUi() = 0;
60
61signals:
62
63 void categoryChanged (int);
64
65};
66
67class VBoxSettingsTreeSelector: public VBoxSettingsSelector
68{
69 Q_OBJECT;
70
71public:
72
73 VBoxSettingsTreeSelector (QWidget *aParent = NULL);
74
75 virtual QWidget *widget() const;
76
77 virtual void addItem (const QIcon &aIcon, const QString &aText, int aIndex, const QString &aLink);
78 virtual QString itemText (int aId) const;
79
80 virtual int currentId() const;
81 virtual int idToIndex (int aId) const;
82 virtual int indexToId (int aIndex) const;
83 virtual int linkToId (const QString &aLink) const;
84 virtual void selectById (int aId);
85 virtual void setVisibleById (int aId, bool aShow);
86
87 virtual void clear();
88
89 virtual void retranslateUi();
90
91private slots:
92
93 void settingsGroupChanged (QTreeWidgetItem *aItem, QTreeWidgetItem *aPrevItem);
94
95private:
96
97 QString pagePath (const QString &aMatch) const;
98 QTreeWidgetItem* findItem (QTreeWidget *aView, const QString &aMatch, int aColumn) const;
99 QString idToString (int aId) const;
100
101 /* Private member vars */
102 QITreeWidget *mTwSelector;
103};
104
105#endif /* __VBoxSettingsSelector_h__ */
Note: See TracBrowser for help on using the repository browser.

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