~siretart/ubuntu/raring/virtualbox-ose/bug.1101867

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-01-30 23:27:25 UTC
  • mfrom: (0.3.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20110130232725-2ouajjd2ggdet0zd
Tags: 4.0.2-dfsg-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add Apport hook.
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Drop *-source packages.
* Drop ubuntu-01-fix-build-gcc45.patch, fixed upstream.
* Drop ubuntu-02-as-needed.patch, added to the Debian package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** @file
 
2
 *
 
3
 * VBox frontends: Qt4 GUI ("VirtualBox"):
 
4
 * UIMachineSettingsSF class declaration
 
5
 */
 
6
 
 
7
/*
 
8
 * Copyright (C) 2008-2010 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 __UIMachineSettingsSF_h__
 
20
#define __UIMachineSettingsSF_h__
 
21
 
 
22
/* Local includes */
 
23
#include "UISettingsPage.h"
 
24
#include "UIMachineSettingsSF.gen.h"
 
25
 
 
26
/* Local forwards */
 
27
class SFTreeViewItem;
 
28
 
 
29
enum UISharedFolderType
 
30
{
 
31
    WrongType   = 0x00,
 
32
    MachineType = 0x01,
 
33
    ConsoleType = 0x02
 
34
};
 
35
typedef QPair <QString, UISharedFolderType> SFolderName;
 
36
typedef QList <SFolderName> SFoldersNameList;
 
37
 
 
38
/* Machine settings / Shared Folders page / Folder data: */
 
39
struct UISharedFolderData
 
40
{
 
41
    UISharedFolderType m_type;
 
42
    QString m_strName;
 
43
    QString m_strHostPath;
 
44
    bool m_fAutoMount;
 
45
    bool m_fWritable;
 
46
    bool m_fEdited;
 
47
};
 
48
 
 
49
/* Machine settings / Shared Folders page / Cache: */
 
50
struct UISettingsCacheMachineSFolders
 
51
{
 
52
    QList<UISharedFolderData> m_items;
 
53
};
 
54
 
 
55
class UIMachineSettingsSF : public UISettingsPageMachine,
 
56
                         public Ui::UIMachineSettingsSF
 
57
{
 
58
    Q_OBJECT;
 
59
 
 
60
public:
 
61
 
 
62
    UIMachineSettingsSF();
 
63
 
 
64
    void loadDirectlyFrom(const CConsole &console);
 
65
    void saveDirectlyTo(CConsole &console);
 
66
 
 
67
protected:
 
68
 
 
69
    /* Load data to cashe from corresponding external object(s),
 
70
     * this task COULD be performed in other than GUI thread: */
 
71
    void loadToCacheFrom(QVariant &data);
 
72
    void loadToCacheFromMachine(const CMachine &machine);
 
73
    void loadToCacheFromConsole(const CConsole &console);
 
74
    void loadToCacheFromVector(const CSharedFolderVector &vector, UISharedFolderType type);
 
75
    /* Load data to corresponding widgets from cache,
 
76
     * this task SHOULD be performed in GUI thread only: */
 
77
    void getFromCache();
 
78
 
 
79
    /* Save data from corresponding widgets to cache,
 
80
     * this task SHOULD be performed in GUI thread only: */
 
81
    void putToCache();
 
82
    /* Save data from cache to corresponding external object(s),
 
83
     * this task COULD be performed in other than GUI thread: */
 
84
    void saveFromCacheTo(QVariant &data);
 
85
    void saveFromCacheToMachine(CMachine &machine);
 
86
    void saveFromCacheToConsole(CConsole &console);
 
87
 
 
88
    void setOrderAfter (QWidget *aWidget);
 
89
 
 
90
    void retranslateUi();
 
91
 
 
92
private slots:
 
93
 
 
94
    void addTriggered();
 
95
    void edtTriggered();
 
96
    void delTriggered();
 
97
 
 
98
    void processCurrentChanged (QTreeWidgetItem *aCurrentItem);
 
99
    void processDoubleClick (QTreeWidgetItem *aItem);
 
100
    void showContextMenu (const QPoint &aPos);
 
101
 
 
102
    void adjustList();
 
103
    void adjustFields();
 
104
 
 
105
private:
 
106
 
 
107
    void resizeEvent (QResizeEvent *aEvent);
 
108
 
 
109
    void showEvent (QShowEvent *aEvent);
 
110
 
 
111
    SFTreeViewItem* root(UISharedFolderType type);
 
112
    SFoldersNameList usedList (bool aIncludeSelected);
 
113
 
 
114
    UISharedFolderType m_type;
 
115
 
 
116
    QAction  *mNewAction;
 
117
    QAction  *mEdtAction;
 
118
    QAction  *mDelAction;
 
119
    bool      mIsListViewChanged;
 
120
    QString   mTrFull;
 
121
    QString   mTrReadOnly;
 
122
    QString   mTrYes;
 
123
 
 
124
    /* Cache: */
 
125
    UISettingsCacheMachineSFolders m_cache;
 
126
};
 
127
 
 
128
#endif // __UIMachineSettingsSF_h__
 
129