diff --git a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataSelector.h b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataSelector.h
index 1ac3e9c..39e4dd7 100644
|
a
|
b
|
namespace MantidQt |
| 122 | 122 | bool m_autoLoad; |
| 123 | 123 | /// Flag to show or hide the load button. By default this is set to true. |
| 124 | 124 | bool m_showLoad; |
| | 125 | |
| | 126 | protected: |
| | 127 | void dropEvent(QDropEvent *); |
| | 128 | void dragEnterEvent(QDragEnterEvent *); |
| 125 | 129 | }; |
| 126 | 130 | |
| 127 | 131 | } /* namespace MantidWidgets */ |
diff --git a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/MWRunFiles.h b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/MWRunFiles.h
index be5e810..613ca1f 100644
|
a
|
b
|
namespace MantidQt |
| 106 | 106 | Q_PROPERTY(LiveButtonOpts liveButton READ liveButtonState WRITE liveButtonState) |
| 107 | 107 | Q_ENUMS(ButtonOpts) |
| 108 | 108 | Q_ENUMS(LiveButtonOpts) |
| 109 | | |
| | 109 | friend class DataSelector; |
| 110 | 110 | public: |
| 111 | 111 | /// options for bringing up the load file dialog |
| 112 | 112 | enum ButtonOpts |
| … |
… |
namespace MantidQt |
| 275 | 275 | QString m_fileFilter; |
| 276 | 276 | /// Thread to allow asynchronous finding of files. |
| 277 | 277 | FindFilesThread * m_thread; |
| | 278 | |
| | 279 | protected: |
| | 280 | void dropEvent(QDropEvent *); |
| | 281 | void dragEnterEvent(QDragEnterEvent *); |
| 278 | 282 | }; |
| 279 | 283 | } |
| 280 | 284 | } |
diff --git a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/WorkspaceSelector.h b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/WorkspaceSelector.h
index 1b51904..e584339 100644
|
a
|
b
|
namespace MantidWidgets |
| 67 | 67 | Q_PROPERTY(bool Optional READ isOptional WRITE setOptional) |
| 68 | 68 | Q_PROPERTY(QStringList Suffix READ getSuffixes WRITE setSuffixes) |
| 69 | 69 | Q_PROPERTY(QString Algorithm READ getValidatingAlgorithm WRITE setValidatingAlgorithm) |
| 70 | | |
| | 70 | friend class DataSelector; |
| 71 | 71 | public: |
| 72 | 72 | /// Default Constructor |
| 73 | 73 | WorkspaceSelector(QWidget *parent = NULL, bool init = true); |
| … |
… |
namespace MantidWidgets |
| 121 | 121 | // Algorithm to validate against |
| 122 | 122 | boost::shared_ptr<Mantid::API::Algorithm> m_algorithm; |
| 123 | 123 | |
| | 124 | protected: |
| | 125 | void dragEnterEvent(QDragEnterEvent*); |
| | 126 | void dropEvent(QDropEvent*); |
| 124 | 127 | }; |
| 125 | 128 | |
| 126 | 129 | } |
diff --git a/Code/Mantid/MantidQt/MantidWidgets/src/DataSelector.cpp b/Code/Mantid/MantidQt/MantidWidgets/src/DataSelector.cpp
index c75598f..7e9a13b 100644
|
a
|
b
|
|
| 6 | 6 | |
| 7 | 7 | #include <QFileInfo> |
| 8 | 8 | |
| | 9 | #include <QDropEvent> |
| | 10 | #include <QMimeData> |
| | 11 | #include <QDebug> |
| | 12 | #include <QUrl> |
| | 13 | |
| 9 | 14 | namespace MantidQt |
| 10 | 15 | { |
| 11 | 16 | namespace MantidWidgets |
| … |
… |
namespace MantidQt |
| 24 | 29 | connect(m_uiForm.pbLoadFile, SIGNAL(clicked()), this, SLOT(handleFileInput())); |
| 25 | 30 | |
| 26 | 31 | connect(&m_algRunner, SIGNAL(algorithmComplete(bool)), this, SLOT(handleAutoLoadComplete(bool))); |
| | 32 | m_uiForm.rfFileInput->setAcceptDrops(false); |
| 27 | 33 | } |
| 28 | 34 | |
| 29 | 35 | DataSelector::~DataSelector() |
| … |
… |
namespace MantidQt |
| 351 | 357 | m_showLoad = load; |
| 352 | 358 | } |
| 353 | 359 | |
| | 360 | |
| | 361 | void DataSelector::dropEvent(QDropEvent *de) |
| | 362 | { |
| | 363 | const QMimeData *mimeData = de->mimeData(); |
| | 364 | auto before_action = de->dropAction(); |
| | 365 | |
| | 366 | if (de->mimeData() && mimeData->text().contains(" = mtd[\"")){ |
| | 367 | m_uiForm.wsWorkspaceInput->dropEvent(de); |
| | 368 | if (de->dropAction() == before_action){ |
| | 369 | m_uiForm.cbInputType->setCurrentIndex(1); |
| | 370 | return; |
| | 371 | } |
| | 372 | de->setDropAction(before_action); |
| | 373 | } |
| | 374 | |
| | 375 | m_uiForm.rfFileInput->dropEvent(de); |
| | 376 | if (de->dropAction() == before_action){ |
| | 377 | m_uiForm.cbInputType->setCurrentIndex(0); |
| | 378 | } |
| | 379 | } |
| | 380 | |
| | 381 | void DataSelector::dragEnterEvent(QDragEnterEvent *de) |
| | 382 | { |
| | 383 | const QMimeData *mimeData = de->mimeData(); |
| | 384 | if (mimeData->hasText() || mimeData->hasUrls()) |
| | 385 | de->acceptProposedAction(); |
| | 386 | } |
| | 387 | |
| | 388 | |
| 354 | 389 | } /* namespace MantidWidgets */ |
| 355 | 390 | } /* namespace MantidQt */ |
diff --git a/Code/Mantid/MantidQt/MantidWidgets/src/MWRunFiles.cpp b/Code/Mantid/MantidQt/MantidWidgets/src/MWRunFiles.cpp
index 42d0b80..95ed011 100644
|
a
|
b
|
|
| 12 | 12 | #include <QFileDialog> |
| 13 | 13 | #include <QFileInfo> |
| 14 | 14 | #include <QHash> |
| | 15 | #include <QDropEvent> |
| | 16 | #include <QDragEnterEvent> |
| | 17 | #include <QMimeData> |
| | 18 | #include <QUrl> |
| 15 | 19 | #include <QtConcurrentRun> |
| 16 | 20 | #include <Poco/File.h> |
| 17 | 21 | |
| … |
… |
void MWRunFiles::checkEntry() |
| 1064 | 1068 | |
| 1065 | 1069 | setEntryNumProblem(""); |
| 1066 | 1070 | } |
| | 1071 | |
| | 1072 | |
| | 1073 | void MWRunFiles::dropEvent(QDropEvent *de) |
| | 1074 | { |
| | 1075 | const QMimeData *mimeData = de->mimeData(); |
| | 1076 | if (mimeData->hasUrls()){ |
| | 1077 | auto url_list = mimeData->urls(); |
| | 1078 | m_uiForm.fileEditor->setText(url_list[0].toLocalFile()); |
| | 1079 | de->acceptProposedAction(); |
| | 1080 | }else if (mimeData->hasText()){ |
| | 1081 | QString text = mimeData->text(); |
| | 1082 | if (text.contains(" = mtd[\"")) |
| | 1083 | return; |
| | 1084 | m_uiForm.fileEditor->setText(text); |
| | 1085 | de->acceptProposedAction(); |
| | 1086 | } |
| | 1087 | |
| | 1088 | } |
| | 1089 | |
| | 1090 | void MWRunFiles::dragEnterEvent(QDragEnterEvent *de) |
| | 1091 | { |
| | 1092 | const QMimeData *mimeData = de->mimeData(); |
| | 1093 | if (mimeData->hasUrls()){ |
| | 1094 | auto listurl = mimeData->urls(); |
| | 1095 | if (listurl.empty()) |
| | 1096 | return; |
| | 1097 | if (!listurl[0].isLocalFile()) |
| | 1098 | return; |
| | 1099 | de->acceptProposedAction(); |
| | 1100 | } |
| | 1101 | else if(mimeData->hasText()) |
| | 1102 | { |
| | 1103 | de->acceptProposedAction(); |
| | 1104 | } |
| | 1105 | } |
diff --git a/Code/Mantid/MantidQt/MantidWidgets/src/WorkspaceSelector.cpp b/Code/Mantid/MantidQt/MantidWidgets/src/WorkspaceSelector.cpp
index dbdebe8..170fbd1 100644
|
a
|
b
|
|
| 10 | 10 | |
| 11 | 11 | #include "MantidAPI/AlgorithmManager.h" |
| 12 | 12 | |
| | 13 | #include <QDropEvent> |
| | 14 | #include <QMimeData> |
| | 15 | #include <QUrl> |
| | 16 | #include <QDebug> |
| 13 | 17 | using namespace MantidQt::MantidWidgets; |
| 14 | 18 | |
| 15 | 19 | /** |
| … |
… |
void WorkspaceSelector::refresh() |
| 313 | 317 | } |
| 314 | 318 | } |
| 315 | 319 | } |
| | 320 | |
| | 321 | void WorkspaceSelector::dropEvent(QDropEvent *de) |
| | 322 | { |
| | 323 | const QMimeData *mimeData = de->mimeData(); |
| | 324 | QString text = mimeData->text(); |
| | 325 | int equal_pos = text.indexOf("="); |
| | 326 | QString ws_name = text.left(equal_pos-1); |
| | 327 | QString ws_name_test = text.mid(equal_pos + 7, equal_pos-1); |
| | 328 | |
| | 329 | if (ws_name == ws_name_test){ |
| | 330 | int index = findText(ws_name); |
| | 331 | if (index >= 0){ |
| | 332 | setCurrentIndex(index); |
| | 333 | de->acceptProposedAction(); |
| | 334 | } |
| | 335 | } |
| | 336 | |
| | 337 | } |
| | 338 | |
| | 339 | void WorkspaceSelector::dragEnterEvent(QDragEnterEvent *de) |
| | 340 | { |
| | 341 | const QMimeData *mimeData = de->mimeData(); |
| | 342 | if(mimeData->hasText()) |
| | 343 | { |
| | 344 | QString text = mimeData->text(); |
| | 345 | if (text.contains(" = mtd[\"")) |
| | 346 | de->acceptProposedAction(); |
| | 347 | } |
| | 348 | } |