1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * UIConverterBackend declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 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 __UIConverterBackend_h__
|
---|
20 | #define __UIConverterBackend_h__
|
---|
21 |
|
---|
22 | /* Qt includes: */
|
---|
23 | #include <QString>
|
---|
24 | #include <QColor>
|
---|
25 | #include <QPixmap>
|
---|
26 |
|
---|
27 | /* GUI includes: */
|
---|
28 | #include "UIDefs.h"
|
---|
29 |
|
---|
30 | /* Determines if 'Object of type X' can be converted to object of other type.
|
---|
31 | * This function always returns 'false' until re-determined for specific object type. */
|
---|
32 | template<class X> bool canConvert() { return false; }
|
---|
33 |
|
---|
34 | /* Converts passed 'Object X' to QColor.
|
---|
35 | * This function returns null QColor for any object type until re-determined for specific one. */
|
---|
36 | template<class X> QColor toColor(const X & /* xobject */) { Assert(0); return QColor(); }
|
---|
37 |
|
---|
38 | /* Converts passed 'Object X' to QPixmap.
|
---|
39 | * This function returns null QPixmap for any object type until re-determined for specific one. */
|
---|
40 | template<class X> QPixmap toPixmap(const X & /* xobject */) { Assert(0); return QPixmap(); }
|
---|
41 |
|
---|
42 | /* Converts passed 'Object of type X' to QString.
|
---|
43 | * This function returns null QString for any object type until re-determined for specific one. */
|
---|
44 | template<class X> QString toString(const X & /* xobject */) { Assert(0); return QString(); }
|
---|
45 | /* Converts passed QString to 'Object of type X'.
|
---|
46 | * This function returns default constructed object for any object type until re-determined for specific one. */
|
---|
47 | template<class X> X fromString(const QString & /* strData */) { Assert(0); return X(); }
|
---|
48 |
|
---|
49 | /* Converts passed 'Object of type X' to non-translated QString.
|
---|
50 | * This function returns null QString for any object type until re-determined for specific one. */
|
---|
51 | template<class X> QString toInternalString(const X & /* xobject */) { Assert(0); return QString(); }
|
---|
52 | /* Converts passed non-translated QString to 'Object of type X'.
|
---|
53 | * This function returns default constructed object for any object type until re-determined for specific one. */
|
---|
54 | template<class X> X fromInternalString(const QString & /* strData */) { Assert(0); return X(); }
|
---|
55 |
|
---|
56 | /* Declare global canConvert specializations: */
|
---|
57 | template<> bool canConvert<StorageSlot>();
|
---|
58 | template<> bool canConvert<DetailsElementType>();
|
---|
59 |
|
---|
60 | /* Declare COM canConvert specializations: */
|
---|
61 | template<> bool canConvert<KMachineState>();
|
---|
62 | template<> bool canConvert<KSessionState>();
|
---|
63 | template<> bool canConvert<KDeviceType>();
|
---|
64 | template<> bool canConvert<KClipboardMode>();
|
---|
65 | template<> bool canConvert<KDragAndDropMode>();
|
---|
66 | template<> bool canConvert<KMediumType>();
|
---|
67 | template<> bool canConvert<KMediumVariant>();
|
---|
68 | template<> bool canConvert<KNetworkAttachmentType>();
|
---|
69 | template<> bool canConvert<KNetworkAdapterType>();
|
---|
70 | template<> bool canConvert<KNetworkAdapterPromiscModePolicy>();
|
---|
71 | template<> bool canConvert<KPortMode>();
|
---|
72 | template<> bool canConvert<KUSBDeviceState>();
|
---|
73 | template<> bool canConvert<KUSBDeviceFilterAction>();
|
---|
74 | template<> bool canConvert<KAudioDriverType>();
|
---|
75 | template<> bool canConvert<KAudioControllerType>();
|
---|
76 | template<> bool canConvert<KAuthType>();
|
---|
77 | template<> bool canConvert<KStorageBus>();
|
---|
78 | template<> bool canConvert<KStorageControllerType>();
|
---|
79 | template<> bool canConvert<KChipsetType>();
|
---|
80 | template<> bool canConvert<KNATProtocol>();
|
---|
81 |
|
---|
82 | /* Declare global conversion specializations: */
|
---|
83 | template<> QString toString(const StorageSlot &storageSlot);
|
---|
84 | template<> StorageSlot fromString<StorageSlot>(const QString &strStorageSlot);
|
---|
85 | template<> QString toString(const DetailsElementType &detailsElementType);
|
---|
86 | template<> DetailsElementType fromString<DetailsElementType>(const QString &strDetailsElementType);
|
---|
87 | template<> QString toInternalString(const DetailsElementType &detailsElementType);
|
---|
88 | template<> DetailsElementType fromInternalString<DetailsElementType>(const QString &strDetailsElementType);
|
---|
89 |
|
---|
90 | /* Declare COM conversion specializations: */
|
---|
91 | template<> QColor toColor(const KMachineState &state);
|
---|
92 | template<> QPixmap toPixmap(const KMachineState &state);
|
---|
93 | template<> QString toString(const KMachineState &state);
|
---|
94 | template<> QString toString(const KSessionState &state);
|
---|
95 | template<> QString toString(const KDeviceType &type);
|
---|
96 | template<> QString toString(const KClipboardMode &mode);
|
---|
97 | template<> QString toString(const KDragAndDropMode &mode);
|
---|
98 | template<> QString toString(const KMediumType &type);
|
---|
99 | template<> QString toString(const KMediumVariant &variant);
|
---|
100 | template<> QString toString(const KNetworkAttachmentType &type);
|
---|
101 | template<> QString toString(const KNetworkAdapterType &type);
|
---|
102 | template<> QString toString(const KNetworkAdapterPromiscModePolicy &policy);
|
---|
103 | template<> QString toString(const KPortMode &mode);
|
---|
104 | template<> QString toString(const KUSBDeviceState &state);
|
---|
105 | template<> QString toString(const KUSBDeviceFilterAction &action);
|
---|
106 | template<> QString toString(const KAudioDriverType &type);
|
---|
107 | template<> QString toString(const KAudioControllerType &type);
|
---|
108 | template<> QString toString(const KAuthType &type);
|
---|
109 | template<> QString toString(const KStorageBus &bus);
|
---|
110 | template<> QString toString(const KStorageControllerType &type);
|
---|
111 | template<> QString toString(const KChipsetType &type);
|
---|
112 | template<> QString toString(const KNATProtocol &protocol);
|
---|
113 | template<> KPortMode fromString<KPortMode>(const QString &strMode);
|
---|
114 | template<> KUSBDeviceFilterAction fromString<KUSBDeviceFilterAction>(const QString &strAction);
|
---|
115 | template<> KAudioDriverType fromString<KAudioDriverType>(const QString &strType);
|
---|
116 | template<> KAudioControllerType fromString<KAudioControllerType>(const QString &strType);
|
---|
117 | template<> KAuthType fromString<KAuthType>(const QString &strType);
|
---|
118 | template<> KStorageControllerType fromString<KStorageControllerType>(const QString &strType);
|
---|
119 |
|
---|
120 | #endif /* __UIConverterBackend_h__ */
|
---|
121 |
|
---|