VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNode.cpp

Last change on this file was 104251, checked in by vboxsync, 2 months ago

FE/Qt. bugref:10622. Using new UITranslationEventListener in the manager UI classes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 KB
RevLine 
[42529]1/* $Id: UIChooserNode.cpp 104251 2024-04-09 12:36:47Z vboxsync $ */
2/** @file
[77636]3 * VBox Qt GUI - UIChooserNode class definition.
[42529]4 */
5
6/*
[98103]7 * Copyright (C) 2012-2023 Oracle and/or its affiliates.
[42529]8 *
[96407]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
[42529]26 */
27
28/* GUI includes: */
[77636]29#include "UIChooserNode.h"
30#include "UIChooserNodeGroup.h"
31#include "UIChooserNodeGlobal.h"
32#include "UIChooserNodeMachine.h"
[42529]33
[83063]34/* Other VBox includes: */
35#include "iprt/cpp/utils.h"
[52730]36
[83063]37
[77636]38UIChooserNode::UIChooserNode(UIChooserNode *pParent /* = 0 */, bool fFavorite /* = false */)
[104251]39 : QObject(pParent)
[77061]40 , m_pParent(pParent)
[77346]41 , m_fFavorite(fFavorite)
[83063]42 , m_pModel(0)
[77701]43 , m_fDisabled(false)
[42529]44{
45}
46
[77638]47UIChooserNode::~UIChooserNode()
48{
49 if (!m_pItem.isNull())
50 delete m_pItem.data();
51}
52
[77636]53UIChooserNodeGroup *UIChooserNode::toGroupNode()
[77366]54{
[77636]55 return static_cast<UIChooserNodeGroup*>(this);
[77366]56}
57
[77636]58UIChooserNodeGlobal *UIChooserNode::toGlobalNode()
[42529]59{
[77636]60 return static_cast<UIChooserNodeGlobal*>(this);
[42529]61}
62
[77636]63UIChooserNodeMachine *UIChooserNode::toMachineNode()
[73600]64{
[77636]65 return static_cast<UIChooserNodeMachine*>(this);
[73600]66}
[77638]67
[83063]68UIChooserNode *UIChooserNode::rootNode() const
69{
70 return isRoot() ? unconst(this) : parentNode()->rootNode();
71}
72
73UIChooserAbstractModel *UIChooserNode::model() const
74{
75 return m_pModel ? m_pModel : rootNode()->model();
76}
77
[77638]78int UIChooserNode::position()
79{
80 return parentNode() ? parentNode()->positionOf(this) : 0;
81}
[77701]82
83bool UIChooserNode::isDisabled() const
84{
85 return m_fDisabled;
86}
87
88void UIChooserNode::setDisabled(bool fDisabled)
89{
90 if (fDisabled == m_fDisabled)
91 return;
92 m_fDisabled = fDisabled;
93 if (m_pItem)
[84583]94 m_pItem->setDisabledEffect(m_fDisabled);
[77701]95}
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use