Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
248b7b32
Commit
248b7b32
authored
9 years ago
by
Martyn Gigg
Browse files
Options
Downloads
Patches
Plain Diff
Refactor to put members in the same order as the header.
Refs #13265
parent
94438332
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Mantid/MantidPlot/src/ScriptingWindow.cpp
+72
-64
72 additions, 64 deletions
Code/Mantid/MantidPlot/src/ScriptingWindow.cpp
Code/Mantid/MantidPlot/src/ScriptingWindow.h
+5
-6
5 additions, 6 deletions
Code/Mantid/MantidPlot/src/ScriptingWindow.h
with
77 additions
and
70 deletions
Code/Mantid/MantidPlot/src/ScriptingWindow.cpp
+
72
−
64
View file @
248b7b32
...
@@ -408,6 +408,63 @@ void ScriptingWindow::acceptCloseEvent(const bool value) {
...
@@ -408,6 +408,63 @@ void ScriptingWindow::acceptCloseEvent(const bool value) {
m_acceptClose
=
value
;
m_acceptClose
=
value
;
}
}
//-------------------------------------------
// Protected non-slot member functions
//-------------------------------------------
/**
* Accept a custom event and in this case test if it is a ScriptingChangeEvent
* @param event :: The custom event
*/
void
ScriptingWindow
::
customEvent
(
QEvent
*
event
)
{
if
(
!
m_manager
->
isExecuting
()
&&
event
->
type
()
==
SCRIPTING_CHANGE_EVENT
)
{
ScriptingChangeEvent
*
sce
=
static_cast
<
ScriptingChangeEvent
*>
(
event
);
setWindowTitle
(
"MantidPlot: "
+
sce
->
scriptingEnv
()
->
languageName
()
+
" Window"
);
}
}
/**
* Accept a drag enter event and selects whether to accept the action
* @param de :: The drag enter event
*/
void
ScriptingWindow
::
dragEnterEvent
(
QDragEnterEvent
*
de
)
{
const
QMimeData
*
mimeData
=
de
->
mimeData
();
if
(
mimeData
->
hasUrls
())
{
if
(
extractPyFiles
(
mimeData
->
urls
()).
size
()
>
0
)
{
de
->
acceptProposedAction
();
}
}
}
/**
* Accept a drag move event and selects whether to accept the action
* @param de :: The drag move event
*/
void
ScriptingWindow
::
dragMoveEvent
(
QDragMoveEvent
*
de
)
{
const
QMimeData
*
mimeData
=
de
->
mimeData
();
if
(
mimeData
->
hasUrls
())
{
if
(
extractPyFiles
(
mimeData
->
urls
()).
size
()
>
0
)
{
de
->
accept
();
}
}
}
/**
* Accept a drag drop event and process the data appropriately
* @param de :: The drag drop event
*/
void
ScriptingWindow
::
dropEvent
(
QDropEvent
*
de
)
{
const
QMimeData
*
mimeData
=
de
->
mimeData
();
if
(
mimeData
->
hasUrls
())
{
QStringList
filenames
=
extractPyFiles
(
mimeData
->
urls
());
de
->
acceptProposedAction
();
for
(
int
i
=
0
;
i
<
filenames
.
size
();
++
i
)
{
m_manager
->
openInNewTab
(
filenames
[
i
]);
}
}
}
//-------------------------------------------
//-------------------------------------------
// Private non-slot member functions
// Private non-slot member functions
//-------------------------------------------
//-------------------------------------------
...
@@ -681,68 +738,30 @@ void ScriptingWindow::initHelpMenuActions() {
...
@@ -681,68 +738,30 @@ void ScriptingWindow::initHelpMenuActions() {
}
}
/**
/**
* Returns the current execution mode set in the menu
* Opens a set of files in new tabs
* @param tabsToOpen A list of filenames to open in new tabs
*/
*/
Script
::
ExecutionMode
ScriptingWindow
::
getExecutionMode
()
const
{
void
ScriptingWindow
::
openPreviousTabs
(
const
QStringList
&
tabsToOpen
)
{
if
(
m_execParallel
->
isChecked
())
const
int
totalFiles
=
tabsToOpen
.
size
();
return
Script
::
Asynchronous
;
if
(
totalFiles
==
0
)
{
else
m_manager
->
newTab
();
return
Script
::
Serialised
;
}
else
{
}
for
(
int
i
=
0
;
i
<
totalFiles
;
i
++
)
{
m_manager
->
newTab
(
i
,
tabsToOpen
[
i
]);
/**
* Accept a custom event and in this case test if it is a ScriptingChangeEvent
* @param event :: The custom event
*/
void
ScriptingWindow
::
customEvent
(
QEvent
*
event
)
{
if
(
!
m_manager
->
isExecuting
()
&&
event
->
type
()
==
SCRIPTING_CHANGE_EVENT
)
{
ScriptingChangeEvent
*
sce
=
static_cast
<
ScriptingChangeEvent
*>
(
event
);
setWindowTitle
(
"MantidPlot: "
+
sce
->
scriptingEnv
()
->
languageName
()
+
" Window"
);
}
}
/**
* Accept a drag move event and selects whether to accept the action
* @param de :: The drag move event
*/
void
ScriptingWindow
::
dragMoveEvent
(
QDragMoveEvent
*
de
)
{
const
QMimeData
*
mimeData
=
de
->
mimeData
();
if
(
mimeData
->
hasUrls
())
{
if
(
extractPyFiles
(
mimeData
->
urls
()).
size
()
>
0
)
{
de
->
accept
();
}
}
}
}
}
}
/**
/**
* Accept a drag enter event and selects whether to accept the action
* Returns the current execution mode set in the menu
* @param de :: The drag enter event
*/
*/
void
ScriptingWindow
::
dragEnterEvent
(
QDragEnterEvent
*
de
)
{
Script
::
ExecutionMode
ScriptingWindow
::
getExecutionMode
()
const
{
const
QMimeData
*
mimeData
=
de
->
mimeData
();
if
(
m_execParallel
->
isChecked
())
if
(
mimeData
->
hasUrls
())
{
return
Script
::
Asynchronous
;
if
(
extractPyFiles
(
mimeData
->
urls
()).
size
()
>
0
)
{
else
de
->
acceptProposedAction
();
return
Script
::
Serialised
;
}
}
}
}
/**
* Accept a drag drop event and process the data appropriately
* @param de :: The drag drop event
*/
void
ScriptingWindow
::
dropEvent
(
QDropEvent
*
de
)
{
const
QMimeData
*
mimeData
=
de
->
mimeData
();
if
(
mimeData
->
hasUrls
())
{
QStringList
filenames
=
extractPyFiles
(
mimeData
->
urls
());
de
->
acceptProposedAction
();
for
(
int
i
=
0
;
i
<
filenames
.
size
();
++
i
)
{
m_manager
->
openInNewTab
(
filenames
[
i
]);
}
}
}
QStringList
ScriptingWindow
::
extractPyFiles
(
const
QList
<
QUrl
>
&
urlList
)
const
{
QStringList
ScriptingWindow
::
extractPyFiles
(
const
QList
<
QUrl
>
&
urlList
)
const
{
QStringList
filenames
;
QStringList
filenames
;
...
@@ -758,14 +777,3 @@ QStringList ScriptingWindow::extractPyFiles(const QList<QUrl> &urlList) const {
...
@@ -758,14 +777,3 @@ QStringList ScriptingWindow::extractPyFiles(const QList<QUrl> &urlList) const {
}
}
return
filenames
;
return
filenames
;
}
}
void
ScriptingWindow
::
openPreviousTabs
(
const
QStringList
&
tabsToOpen
)
{
const
int
totalFiles
=
tabsToOpen
.
size
();
if
(
totalFiles
==
0
)
{
m_manager
->
newTab
();
}
else
{
for
(
int
i
=
0
;
i
<
totalFiles
;
i
++
)
{
m_manager
->
newTab
(
i
,
tabsToOpen
[
i
]);
}
}
}
This diff is collapsed.
Click to expand it.
Code/Mantid/MantidPlot/src/ScriptingWindow.h
+
5
−
6
View file @
248b7b32
...
@@ -65,9 +65,11 @@ signals:
...
@@ -65,9 +65,11 @@ signals:
void
hideMe
();
void
hideMe
();
protected:
protected:
void
dropEvent
(
QDropEvent
*
de
);
/// Accept a custom defined event
void
dragMoveEvent
(
QDragMove
Event
*
d
e
);
void
customEvent
(
Q
Event
*
e
vent
);
void
dragEnterEvent
(
QDragEnterEvent
*
de
);
void
dragEnterEvent
(
QDragEnterEvent
*
de
);
void
dragMoveEvent
(
QDragMoveEvent
*
de
);
void
dropEvent
(
QDropEvent
*
de
);
private
slots
:
private
slots
:
/// Populate file menu
/// Populate file menu
...
@@ -126,15 +128,12 @@ private:
...
@@ -126,15 +128,12 @@ private:
void
initWindowMenuActions
();
void
initWindowMenuActions
();
/// Create the help menu actions
/// Create the help menu actions
void
initHelpMenuActions
();
void
initHelpMenuActions
();
/// Opens tabs based on QStringList
/// Opens tabs based on QStringList
void
openPreviousTabs
(
const
QStringList
&
tabsToOpen
);
void
openPreviousTabs
(
const
QStringList
&
tabsToOpen
);
/// Returns the current execution mode
/// Returns the current execution mode
Script
::
ExecutionMode
getExecutionMode
()
const
;
Script
::
ExecutionMode
getExecutionMode
()
const
;
/// Accept a custom defined event
void
customEvent
(
QEvent
*
event
);
/// Extract py files from urllist
/// Extract py files from urllist
QStringList
extractPyFiles
(
const
QList
<
QUrl
>
&
urlList
)
const
;
QStringList
extractPyFiles
(
const
QList
<
QUrl
>
&
urlList
)
const
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment