~ubuntu-branches/ubuntu/trusty/virtualbox-lts-xenial/trusty-updates

« back to all changes in this revision

Viewing changes to src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.h

  • Committer: Package Import Robot
  • Author(s): Gianfranco Costamagna
  • Date: 2016-02-23 14:28:26 UTC
  • Revision ID: package-import@ubuntu.com-20160223142826-bdu69el2z6wa2a44
Tags: upstream-4.3.36-dfsg
ImportĀ upstreamĀ versionĀ 4.3.36-dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** @file
 
2
 *
 
3
 * VBox frontends: Qt4 GUI ("VirtualBox"):
 
4
 * UIMachineSettingsParallel 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 __UIMachineSettingsParallel_h__
 
20
#define __UIMachineSettingsParallel_h__
 
21
 
 
22
/* GUI includes: */
 
23
#include "UISettingsPage.h"
 
24
#include "UIMachineSettingsParallel.gen.h"
 
25
 
 
26
/* Forward declarations: */
 
27
class UIMachineSettingsParallelPage;
 
28
class QITabWidget;
 
29
 
 
30
/* Machine settings / Parallel page / Port data: */
 
31
struct UIDataSettingsMachineParallelPort
 
32
{
 
33
    /* Default constructor: */
 
34
    UIDataSettingsMachineParallelPort()
 
35
        : m_iSlot(-1)
 
36
        , m_fPortEnabled(false)
 
37
        , m_uIRQ(0)
 
38
        , m_uIOBase(0)
 
39
        , m_strPath(QString()) {}
 
40
    /* Functions: */
 
41
    bool equal(const UIDataSettingsMachineParallelPort &other) const
 
42
    {
 
43
        return (m_iSlot == other.m_iSlot) &&
 
44
               (m_fPortEnabled == other.m_fPortEnabled) &&
 
45
               (m_uIRQ == other.m_uIRQ) &&
 
46
               (m_uIOBase == other.m_uIOBase) &&
 
47
               (m_strPath == other.m_strPath);
 
48
    }
 
49
    /* Operators: */
 
50
    bool operator==(const UIDataSettingsMachineParallelPort &other) const { return equal(other); }
 
51
    bool operator!=(const UIDataSettingsMachineParallelPort &other) const { return !equal(other); }
 
52
    /* Variables: */
 
53
    int m_iSlot;
 
54
    bool m_fPortEnabled;
 
55
    ulong m_uIRQ;
 
56
    ulong m_uIOBase;
 
57
    QString m_strPath;
 
58
};
 
59
typedef UISettingsCache<UIDataSettingsMachineParallelPort> UICacheSettingsMachineParallelPort;
 
60
 
 
61
/* Machine settings / Parallel page / Ports data: */
 
62
struct UIDataSettingsMachineParallel
 
63
{
 
64
    /* Default constructor: */
 
65
    UIDataSettingsMachineParallel() {}
 
66
    /* Operators: */
 
67
    bool operator==(const UIDataSettingsMachineParallel& /* other */) const { return true; }
 
68
    bool operator!=(const UIDataSettingsMachineParallel& /* other */) const { return false; }
 
69
};
 
70
typedef UISettingsCachePool<UIDataSettingsMachineParallel, UICacheSettingsMachineParallelPort> UICacheSettingsMachineParallel;
 
71
 
 
72
class UIMachineSettingsParallel : public QIWithRetranslateUI<QWidget>,
 
73
                               public Ui::UIMachineSettingsParallel
 
74
{
 
75
    Q_OBJECT;
 
76
 
 
77
public:
 
78
 
 
79
    UIMachineSettingsParallel(UIMachineSettingsParallelPage *pParent);
 
80
 
 
81
    void polishTab();
 
82
 
 
83
    void fetchPortData(const UICacheSettingsMachineParallelPort &portCache);
 
84
    void uploadPortData(UICacheSettingsMachineParallelPort &portCache);
 
85
 
 
86
    QWidget* setOrderAfter (QWidget *aAfter);
 
87
 
 
88
    QString pageTitle() const;
 
89
    bool isUserDefined();
 
90
 
 
91
protected:
 
92
 
 
93
    void retranslateUi();
 
94
 
 
95
private slots:
 
96
 
 
97
    void mGbParallelToggled (bool aOn);
 
98
    void mCbNumberActivated (const QString &aText);
 
99
 
 
100
private:
 
101
 
 
102
    /* Helper: Prepare stuff: */
 
103
    void prepareValidation();
 
104
 
 
105
    UIMachineSettingsParallelPage *m_pParent;
 
106
    int m_iSlot;
 
107
};
 
108
 
 
109
/* Machine settings / Parallel page: */
 
110
class UIMachineSettingsParallelPage : public UISettingsPageMachine
 
111
{
 
112
    Q_OBJECT;
 
113
 
 
114
public:
 
115
 
 
116
    UIMachineSettingsParallelPage();
 
117
 
 
118
protected:
 
119
 
 
120
    /* Load data to cache from corresponding external object(s),
 
121
     * this task COULD be performed in other than GUI thread: */
 
122
    void loadToCacheFrom(QVariant &data);
 
123
    /* Load data to corresponding widgets from cache,
 
124
     * this task SHOULD be performed in GUI thread only: */
 
125
    void getFromCache();
 
126
 
 
127
    /* Save data from corresponding widgets to cache,
 
128
     * this task SHOULD be performed in GUI thread only: */
 
129
    void putToCache();
 
130
    /* Save data from cache to corresponding external object(s),
 
131
     * this task COULD be performed in other than GUI thread: */
 
132
    void saveFromCacheTo(QVariant &data);
 
133
 
 
134
    /* Page changed: */
 
135
    bool changed() const { return m_cache.wasChanged(); }
 
136
 
 
137
    /* API: Validation stuff: */
 
138
    bool validate(QList<UIValidationMessage> &messages);
 
139
 
 
140
    void retranslateUi();
 
141
 
 
142
private:
 
143
 
 
144
    void polishPage();
 
145
 
 
146
    QITabWidget *mTabWidget;
 
147
 
 
148
    /* Cache: */
 
149
    UICacheSettingsMachineParallel m_cache;
 
150
};
 
151
 
 
152
#endif // __UIMachineSettingsParallel_h__
 
153