Changeset 39451 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 29, 2011 10:38:55 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 75091
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r39337 r39451 111 111 $(if $(VBOX_WITH_EXTPACK),VBOX_WITH_EXTPACK) \ 112 112 $(if $(VBOX_WITH_EHCI),VBOX_WITH_EHCI) \ 113 $(if $(VBOX_WITH_DRAG_AND_DROP),VBOX_WITH_DRAG_AND_DROP) \ 113 114 $(if $(VBOX_WITH_CRHGSMI),VBOX_WITH_CRHGSMI) \ 114 115 $(if $(VBOX_WITH_VIRTIO),VBOX_WITH_VIRTIO) \ … … 558 559 src/platform/darwin/UICocoaApplication.mm \ 559 560 src/platform/darwin/UICocoaSpecialControls.mm \ 561 src/platform/darwin/UICocoaWindowTarget.mm \ 560 562 src/platform/darwin/UIDesktopServices_darwin.cpp \ 561 563 src/platform/darwin/UIDesktopServices_darwin_cocoa.mm \ … … 583 585 src/VBoxFBQGL.cpp \ 584 586 src/VBoxGLSupportInfo.cpp 587 endif 588 589 ifdef VBOX_WITH_DRAG_AND_DROP 590 VirtualBox_SOURCES += \ 591 src/runtime/UIDnDHandler.cpp 592 VirtualBox_QT_MOCSRCS += \ 593 src/runtime/UIDnDHandler.cpp 585 594 endif 586 595 -
trunk/src/VBox/Frontends/VirtualBox/VirtualBox2.qrc
r38774 r39451 164 164 <file alias="progress_snapshot_discard_90px.png">images/progress_snapshot_discard_90px.png</file> 165 165 <file alias="progress_clone_90px.png">images/progress_clone_90px.png</file> 166 <file alias="progress_dnd_gh_90px.png">images/progress_dnd_gh_90px.png</file> 167 <file alias="progress_dnd_hg_90px.png">images/progress_dnd_hg_90px.png</file> 166 168 <file alias="status_check_16px.png">images/status_check_16px.png</file> 167 169 <file alias="status_check_32px.png">images/status_check_32px.png</file> -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r39326 r39451 2880 2880 } 2881 2881 2882 #ifdef VBOX_WITH_DRAG_AND_DROP 2883 void UIMessageCenter::cannotDropData(const CGuest &guest, 2884 QWidget *pParent /* = 0 */) const 2885 { 2886 message(pParent ? pParent : mainWindowShown(), 2887 Error, 2888 tr("Failed to drop data."), 2889 formatErrorInfo(guest)); 2890 } 2891 2892 void UIMessageCenter::cannotDropData(const CProgress &progress, 2893 QWidget *pParent /* = 0 */) const 2894 { 2895 AssertWrapperOk(progress); 2896 2897 message(pParent ? pParent : mainWindowShown(), 2898 Error, 2899 tr("Failed to drop data."), 2900 formatErrorInfo(progress.GetErrorInfo())); 2901 } 2902 #endif /* VBOX_WITH_DRAG_AND_DROP */ 2903 2882 2904 void UIMessageCenter::remindAboutWrongColorDepth(ulong uRealBPP, ulong uWantedBPP) 2883 2905 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r39326 r39451 426 426 void cannotRemoveSharedFolder(const CConsole &console, const QString &strName, 427 427 const QString &strPath, QWidget *pParent = 0); 428 #ifdef VBOX_WITH_DRAG_AND_DROP 429 void cannotDropData(const CGuest &guest, QWidget *pParent = 0) const; 430 void cannotDropData(const CProgress &progress, QWidget *pParent = 0) const; 431 #endif /* VBOX_WITH_DRAG_AND_DROP */ 428 432 void remindAboutWrongColorDepth(ulong uRealBPP, ulong uWantedBPP); 429 433 void remindAboutUnsupportedUSB2(const QString &strExtPackName, QWidget *pParent = 0); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
r39073 r39451 177 177 ulong height() { return m_height; } 178 178 179 inline int convertGuestXTo(int x) const { return m_scaledSize.isValid() ? qRound((double)m_scaledSize.width() / m_width * x) : x; } 180 inline int convertGuestYTo(int y) const { return m_scaledSize.isValid() ? qRound((double)m_scaledSize.height() / m_height * y) : y; } 181 inline int convertHostXTo(int x) const { return m_scaledSize.isValid() ? qRound((double)m_width / m_scaledSize.width() * x) : x; } 182 inline int convertHostYTo(int y) const { return m_scaledSize.isValid() ? qRound((double)m_height / m_scaledSize.height() * y) : y; } 183 179 184 virtual QSize scaledSize() const { return m_scaledSize; } 180 185 virtual void setScaledSize(const QSize &size = QSize()) { m_scaledSize = size; } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r39156 r39451 24 24 #include <QPainter> 25 25 #include <QScrollBar> 26 #include <QMainWindow> 26 27 #include <VBox/VBoxVideo.h> 27 28 #include <iprt/asm.h> … … 45 46 #include "UIMachineViewSeamless.h" 46 47 #include "UIMachineViewScale.h" 48 49 #ifdef VBOX_WITH_DRAG_AND_DROP 50 # include "UIDnDHandler.h" 51 #endif 47 52 48 53 #ifdef Q_WS_X11 … … 460 465 /* Setup focus policy: */ 461 466 setFocusPolicy(Qt::WheelFocus); 467 468 #ifdef VBOX_WITH_DRAG_AND_DROP 469 /* Enable Drag & Drop. */ 470 setAcceptDrops(true); 471 #endif /* VBOX_WITH_DRAG_AND_DROP */ 462 472 } 463 473 … … 1092 1102 } 1093 1103 1104 #ifdef VBOX_WITH_DRAG_AND_DROP 1105 1106 void UIMachineView::dragEnterEvent(QDragEnterEvent *pEvent) 1107 { 1108 /* The guest object to talk to. */ 1109 CGuest guest = session().GetConsole().GetGuest(); 1110 1111 /* Get mouse-pointer location */ 1112 const QPoint &cpnt = viewportToContents(pEvent->pos()); 1113 1114 /* Ask the guest for starting a DnD event. */ 1115 Qt::DropAction result = gDnD->dragHGEnter(guest, 1116 screenId(), 1117 frameBuffer()->convertHostXTo(cpnt.x()), 1118 frameBuffer()->convertHostYTo(cpnt.y()), 1119 pEvent->proposedAction(), 1120 pEvent->possibleActions(), 1121 pEvent->mimeData(), this); 1122 1123 /* Set the DnD action returned by the guest. */ 1124 pEvent->setDropAction(result); 1125 pEvent->accept(); 1126 } 1127 1128 void UIMachineView::dragMoveEvent(QDragMoveEvent *pEvent) 1129 { 1130 /* The guest object to talk to. */ 1131 CGuest guest = session().GetConsole().GetGuest(); 1132 1133 /* Get mouse-pointer location */ 1134 const QPoint &cpnt = viewportToContents(pEvent->pos()); 1135 1136 /* Ask the guest for moving the drop cursor. */ 1137 Qt::DropAction result = gDnD->dragHGMove(guest, 1138 screenId(), 1139 frameBuffer()->convertHostXTo(cpnt.x()), 1140 frameBuffer()->convertHostYTo(cpnt.y()), 1141 pEvent->proposedAction(), 1142 pEvent->possibleActions(), 1143 pEvent->mimeData(), this); 1144 1145 /* Set the DnD action returned by the guest. */ 1146 pEvent->setDropAction(result); 1147 pEvent->accept(); 1148 } 1149 1150 void UIMachineView::dragLeaveEvent(QDragLeaveEvent *pEvent) 1151 { 1152 /* The guest object to talk to. */ 1153 CGuest guest = session().GetConsole().GetGuest(); 1154 1155 /* Ask the guest for stopping this DnD event. */ 1156 gDnD->dragHGLeave(guest, screenId(), this); 1157 pEvent->accept(); 1158 } 1159 1160 void UIMachineView::dropEvent(QDropEvent *pEvent) 1161 { 1162 /* The guest object to talk to. */ 1163 CGuest guest = session().GetConsole().GetGuest(); 1164 1165 /* Get mouse-pointer location */ 1166 const QPoint &cpnt = viewportToContents(pEvent->pos()); 1167 1168 /* Ask the guest for dropping data. */ 1169 Qt::DropAction result = gDnD->dragHGDrop(guest, 1170 screenId(), 1171 frameBuffer()->convertHostXTo(cpnt.x()), 1172 frameBuffer()->convertHostYTo(cpnt.y()), 1173 pEvent->proposedAction(), 1174 pEvent->possibleActions(), 1175 pEvent->mimeData(), this); 1176 1177 /* Set the DnD action returned by the guest. */ 1178 pEvent->setDropAction(result); 1179 pEvent->accept(); 1180 } 1181 1182 void UIMachineView::handleGHDnd() 1183 { 1184 /* The guest object to talk to. */ 1185 CGuest guest = session().GetConsole().GetGuest(); 1186 1187 /* Check for a pending DnD event within the guest and if so, handle all the 1188 * magic. */ 1189 gDnD->dragGHPending(session(), screenId(), this); 1190 } 1191 1192 #endif /* VBOX_WITH_DRAG_AND_DROP */ 1193 1094 1194 #if defined(Q_WS_WIN) 1095 1195 … … 1151 1251 1152 1252 #endif 1253 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r39110 r39451 192 192 void paintEvent(QPaintEvent *pEvent); 193 193 194 #ifdef VBOX_WITH_DRAG_AND_DROP 195 void dragEnterEvent(QDragEnterEvent *pEvent); 196 void dragLeaveEvent(QDragLeaveEvent *pEvent); 197 void dragMoveEvent(QDragMoveEvent *pEvent); 198 void dropEvent(QDropEvent *pEvent); 199 200 void handleGHDnd(); 201 #endif /* VBOX_WITH_DRAG_AND_DROP */ 202 194 203 /* Platform specific event processors: */ 195 204 #if defined(Q_WS_WIN) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
r38798 r39451 816 816 cpnt.setY((int)(cpnt.y() * yRatio)); 817 817 818 if ( cpnt.x() < 0 819 || cpnt.x() > iCw - 1 820 || cpnt.y() < 0 821 || cpnt.y() > iCh - 1) 822 { 823 if ((mouseButtons.testFlag(Qt::LeftButton))) 824 { 825 m_views[uScreenId]->handleGHDnd(); 826 827 return false; 828 } 829 } 830 818 831 /* Bound coordinates: */ 819 832 if (cpnt.x() < 0) cpnt.setX(0);
Note:
See TracChangeset
for help on using the changeset viewer.