Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kumir2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kumir
kumir2
Commits
a6442965
Commit
a6442965
authored
Jun 02, 2015
by
Victor Yacovlev
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.lpm.org.ru:niisi/kumir2
parents
dcf05e6d
d6203b81
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
49 deletions
+18
-49
src/tools/courseeditor/course_model.cpp
src/tools/courseeditor/course_model.cpp
+3
-3
src/tools/courseeditor/course_model.h
src/tools/courseeditor/course_model.h
+0
-2
src/tools/courseeditor/mainwindow.cpp
src/tools/courseeditor/mainwindow.cpp
+10
-34
src/tools/courseeditor/mainwindow.h
src/tools/courseeditor/mainwindow.h
+4
-9
src/tools/courseeditor/taskControlInterface.h
src/tools/courseeditor/taskControlInterface.h
+1
-1
No files found.
src/tools/courseeditor/course_model.cpp
View file @
a6442965
...
...
@@ -143,7 +143,7 @@ QVariant courseModel::data(const QModelIndex &index, int role) const
QDomNode
child_n
=
nodeById
(
child
.
internalId
(),
root
);
// if(child_n.isNull())return QModelIndex();
QDomNode
par
=
child_n
.
parentNode
();
if
(
par
.
toElement
().
attribute
(
"id"
).
toInt
()
==
0
)
return
QModelIndex
(
);
if
(
par
.
toElement
().
attribute
(
"id"
).
toInt
()
==
0
)
return
createIndex
(
0
,
0
,
0
);
return
createIndex
(
domRow
(
par
),
0
,
idByNode
(
par
));
};
int
courseModel
::
columnCount
(
const
QModelIndex
&
parent
)
const
...
...
@@ -207,7 +207,7 @@ QVariant courseModel::data(const QModelIndex &index, int role) const
}
QModelIndex
courseModel
::
createMyIndex
(
int
row
,
int
column
,
QModelIndex
parent
)
const
{
if
(
!
parent
.
isValid
())
return
QModelIndex
(
);
if
(
!
parent
.
isValid
())
return
createIndex
(
0
,
0
,
0
);
int
id
=
parent
.
internalId
();
if
(
id
<
0
)
return
QModelIndex
();
QDomNode
par
=
nodeById
(
id
,
root
);
...
...
@@ -446,7 +446,7 @@ QString courseModel::Script(int index,QString isp)
}
csEl
=
csEl
.
nextSiblingElement
(
"ISP"
);
};
return
QDomElement
();
};
void
courseModel
::
removeEvn
(
QDomElement
ispElement
,
QString
fieldStr
)
{
...
...
src/tools/courseeditor/course_model.h
View file @
a6442965
#ifndef COURSE_MODEL_H
#define COURSE_MODEL_H
#include <QAbstractItemModel>
#include <QApplication>
#include <QFile>
#include <QDebug>
#include <QStringList>
#include <QFont>
#include <QDomDocument>
#include <QIcon>
#include <QUrl>
...
...
src/tools/courseeditor/mainwindow.cpp
View file @
a6442965
...
...
@@ -86,7 +86,6 @@ cursFile="";
// QMessageBox::information( 0, "", trUtf8("Setup add "), 0,0,0);
ui
->
ispSel
->
addItem
(
"Robot"
);
ui
->
ispSel
->
addItem
(
trUtf8
(
"Водолей"
));
ui
->
ispSel
->
addItem
(
trUtf8
(
"Файл ввода"
));
ui
->
actionup
->
setIcon
(
QIcon
(
":/arrow_up.png"
));
ui
->
actionDown
->
setIcon
(
QIcon
(
":/arrow_down.png"
));
changed
=
false
;
...
...
@@ -524,7 +523,7 @@ void MainWindowTask::startTask()
}
QString
progFile
=
course
->
progFile
(
curTaskIdx
.
internalId
());
csI
nterface
->
setTesting
(
loadTestAlg
(
course
->
getTaskCheck
(
curTaskIdx
)));
i
nterface
->
setTesting
(
loadTestAlg
(
course
->
getTaskCheck
(
curTaskIdx
)));
task
.
isps
=
course
->
Modules
(
curTaskIdx
.
internalId
());
qDebug
()
<<
"ISPS"
<<
task
.
isps
;
for
(
int
i
=
0
;
i
<
task
.
isps
.
count
();
i
++
)
...
...
@@ -544,16 +543,14 @@ void MainWindowTask::startTask()
qDebug
()
<<
"Fields!!!!"
<<
task
.
fields
;
}
qDebug
()
<<
"MODULES:"
<<
course
->
Modules
(
curTaskIdx
.
internalId
());
if
(
!
csInterface
->
startNewTask
(
course
->
Modules
(
curTaskIdx
.
internalId
())))
QMessageBox
::
about
(
NULL
,
trUtf8
(
"Невозможно выполнить задание"
),
trUtf8
(
"Нет неоходимых исполнителей"
));
if
(
!
interface
->
startNewTask
(
course
->
Modules
(
curTaskIdx
.
internalId
())))
QMessageBox
::
about
(
NULL
,
trUtf8
(
"Невозможно выполнить задание"
),
trUtf8
(
"Нет неоходимых исполнителей"
));
if
(
course
->
getUserText
(
curTaskIdx
.
internalId
())
!=
""
)
{
csI
nterface
->
setPreProgram
(
QVariant
(
course
->
getUserText
(
curTaskIdx
.
internalId
())));
i
nterface
->
setPreProgram
(
QVariant
(
course
->
getUserText
(
curTaskIdx
.
internalId
())));
ui
->
actionReset
->
setEnabled
(
true
);
}
else
if
(
!
progFile
.
isEmpty
())
csInterface
->
setPreProgram
(
QVariant
(
curDir
+
'/'
+
progFile
));
if
(
!
progFile
.
isEmpty
())
interface
->
setPreProgram
(
QVariant
(
curDir
+
'/'
+
progFile
));
...
...
@@ -580,7 +577,7 @@ if(!cursWorkFile.exists()){
saveCourse
();
};
course
->
setMark
(
curTaskIdx
.
internalId
(),
0
);
csI
nterface
->
startProgram
(
QVariant
(
"TODO LOAD SCRIPT"
));
i
nterface
->
startProgram
(
QVariant
(
"TODO LOAD SCRIPT"
));
ui
->
treeView
->
setEnabled
(
false
);
ui
->
loadCurs
->
setEnabled
(
true
);
};
...
...
@@ -685,7 +682,7 @@ void MainWindowTask::markProgChange()
qDebug
()
<<
"Dummy call MainWindowTask::markProgChange()"
;
return
;
course
->
setUserText
(
curTaskIdx
,
csI
nterface
->
getText
());
course
->
setUserText
(
curTaskIdx
,
i
nterface
->
getText
());
if
(
progChange
.
indexOf
(
curTaskIdx
.
internalId
())
==-
1
)
progChange
.
append
(
curTaskIdx
.
internalId
());
if
(
!
cursWorkFile
.
exists
())
{
...
...
@@ -713,28 +710,8 @@ void MainWindowTask::Close()
//saveBaseKurs();
close
();
};
void
MainWindowTask
::
showEvent
(
QShowEvent
*
event
)
{
QStringList
settlist
=
settings
->
value
(
"SpliterPos"
).
toString
().
split
(
" "
);
QList
<
int
>
sizes
;
for
(
int
i
=
0
;
i
<
settlist
.
count
();
i
++
)
{
sizes
.
append
(
settlist
.
at
(
i
).
toInt
());
}
ui
->
splitter
->
setSizes
(
sizes
);
};
void
MainWindowTask
::
closeEvent
(
QCloseEvent
*
event
)
{
QString
sizes
=
""
;
for
(
int
i
=
0
;
i
<
ui
->
splitter
->
sizes
().
count
();
i
++
)
{
sizes
+=
QString
::
number
(
ui
->
splitter
->
sizes
().
at
(
i
))
+
" "
;
}
settings
->
setValue
(
"SpliterPos"
,
sizes
);
qDebug
()
<<
"CLOSE TASK WINDOW"
;
if
(
!
course
)
{
close
();
return
;
...
...
@@ -745,7 +722,7 @@ void MainWindowTask::closeEvent(QCloseEvent *event)
QMessageBox
::
StandardButton
ans
;
ans
=
QMessageBox
::
question
(
this
,
trUtf8
(
"Курсы"
),
trUtf8
(
"Вы хотите сохранить работу?"
),
QMessageBox
::
Yes
|
QMessageBox
::
No
|
QMessageBox
::
Cancel
,
QMessageBox
::
Yes
);
if
(
ans
==
QMessageBox
::
No
)
if
(
(
ans
==
QMessageBox
::
No
)
)
{
event
->
accept
();
...
...
@@ -758,14 +735,14 @@ void MainWindowTask::closeEvent(QCloseEvent *event)
saveBaseKurs
();
}
;
qDebug
()
<<
"CLOSE TASK WINDOW"
;
close
();
};
void
MainWindowTask
::
returnTested
()
{
csI
nterface
->
setPreProgram
(
QVariant
(
course
->
getUserTestedText
(
curTaskIdx
.
internalId
())));
i
nterface
->
setPreProgram
(
QVariant
(
course
->
getUserTestedText
(
curTaskIdx
.
internalId
())));
};
QString
MainWindowTask
::
loadTestAlg
(
QString
file_name
)
{
...
...
@@ -1083,7 +1060,6 @@ QString MainWindowTask::getFileTypes()
{
if
(
ui
->
ispList
->
currentItem
()
->
text
()
==
"Robot"
)
return
"(*.fil)"
;
if
(
ui
->
ispList
->
currentItem
()
->
text
()
==
trUtf8
(
"Водолей"
))
return
"(*.vod)"
;
if
(
ui
->
ispList
->
currentItem
()
->
text
()
==
trUtf8
(
"Файл ввода"
))
return
"(*.txt)"
;
return
"(*.*)"
;
}
...
...
src/tools/courseeditor/mainwindow.h
View file @
a6442965
...
...
@@ -33,16 +33,12 @@ class MainWindowTask : public QMainWindow {
public:
MainWindowTask
(
QWidget
*
parent
=
0
);
~
MainWindowTask
();
void
setInterface
(
CSInterface
*
csInterface
){
this
->
csI
nterface
=
csInterface
;};
void
setInterface
(
CSInterface
*
csInterface
){
i
nterface
=
csInterface
;};
void
setCS
(
QString
cs
){
CS
=
cs
;};
KumZadanie
task
;
void
setup
();
QString
getFileName
(
QString
fileName
);
QFileInfo
baseCourceFile
()
{
return
baseKursFile
;
}
public
slots
:
void
aboutToQuit
();
void
loadCourse
();
...
...
@@ -88,7 +84,7 @@ public slots:
protected:
void
changeEvent
(
QEvent
*
e
);
void
closeEvent
(
QCloseEvent
*
event
);
void
showEvent
(
QShowEvent
*
event
);
private:
bool
checkInList
(
int
id
,
QModelIndexList
list
);
//Поиск id среди списка индексов
void
enableMkSect
(
bool
flag
);
...
...
@@ -107,10 +103,9 @@ private:
QString
curDir
;
courseModel
*
course
;
QModelIndex
curTaskIdx
;
CSInterface
*
csI
nterface
;
CSInterface
*
i
nterface
;
QString
CS
;
bool
onTask
;
QMenu
*
practMenu
;
courseChanges
changes
;
QString
cursFile
;
QList
<
int
>
progChange
;
...
...
src/tools/courseeditor/taskControlInterface.h
View file @
a6442965
...
...
@@ -41,7 +41,7 @@ class taskControlInterface
public:
virtual
void
start
(
QString
csName
)
=
0
;
virtual
void
setCSmode
(
int
mode
)
=
0
;
virtual
void
setCSinterface
(
CSInterface
*
csI
nterface
)
=
0
;
virtual
void
setCSinterface
(
CSInterface
*
i
nterface
)
=
0
;
virtual
void
setWindowGeometry
(
QRect
retc
)
=
0
;
virtual
void
show
()
=
0
;
virtual
void
checkFinished
(
int
mark
)
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment