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
36a0453e
Commit
36a0453e
authored
Jun 17, 2013
by
Denis Khachko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cource manager. Lock /unlock actions
parent
99867a35
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
22 deletions
+69
-22
src/plugins/coursemanager/coursemanager_plugin.cpp
src/plugins/coursemanager/coursemanager_plugin.cpp
+64
-21
src/plugins/coursemanager/coursemanager_plugin.h
src/plugins/coursemanager/coursemanager_plugin.h
+2
-0
src/plugins/coursemanager/task/mainwindow.cpp
src/plugins/coursemanager/task/mainwindow.cpp
+3
-1
No files found.
src/plugins/coursemanager/coursemanager_plugin.cpp
View file @
36a0453e
...
...
@@ -18,9 +18,12 @@ Plugin::Plugin()
MW
->
setup
();
mainWindow_
=
MW
;
field_no
=
0
;
prevFld
=
new
QAction
(
"Предыдущая обстановка"
,
this
);
nextFld
=
new
QAction
(
"Следующая обстановка"
,
this
);
prevFld
=
new
QAction
(
trUtf8
(
"Предыдущая обстановка"
),
this
);
nextFld
=
new
QAction
(
trUtf8
(
"Следующая обстановка"
),
this
);
connect
(
nextFld
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
nextField
()));
connect
(
prevFld
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
prevField
()));
nextFld
->
setEnabled
(
false
);
prevFld
->
setEnabled
(
false
);
}
QList
<
QMenu
*>
Plugin
::
menus
()
const
{
...
...
@@ -81,6 +84,15 @@ bool Plugin::startNewTask(QStringList isps,KumZadanie* task)
qDebug
()
<<
"Set field"
<<
task
->
field
(
isps
.
at
(
i
),
field_no
);
actor
->
loadActorData
(
field_data
);
}
if
(
task
->
minFieldCount
()
>
1
){
nextFld
->
setEnabled
(
true
);
prevFld
->
setEnabled
(
false
);
}
else
{
nextFld
->
setEnabled
(
false
);
prevFld
->
setEnabled
(
false
);
}
cur_task
=
task
;
return
true
;
};
QWidget
*
Plugin
::
mainWindow
()
const
...
...
@@ -98,23 +110,27 @@ AI * Plugin::getActor(QString name)
}
return
NULL
;
}
void
Plugin
::
checkNext
(
KumZadanie
*
task
)
{
GI
*
gui
=
ExtensionSystem
::
PluginManager
::
instance
()
->
findPlugin
<
GI
>
();
for
(
int
i
=
0
;
i
<
task
->
isps
.
count
();
i
++
)
void
Plugin
::
selectNext
(
KumZadanie
*
task
)
{
AI
*
actor
=
getActor
(
task
->
isps
.
at
(
i
));
if
(
!
actor
)
for
(
int
i
=
0
;
i
<
task
->
isps
.
count
();
i
++
)
{
QMessageBox
::
information
(
NULL
,
""
,
QString
::
fromUtf8
(
"Нет исполнтеля:"
)
+
task
->
isps
.
at
(
i
),
0
,
0
,
0
);
return
;
}
//TODO LOAD FIELDS;
QFile
*
field_data
=
new
QFile
(
task
->
field
(
task
->
isps
.
at
(
i
),
field_no
));
actor
->
loadActorData
(
field_data
);
AI
*
actor
=
getActor
(
task
->
isps
.
at
(
i
));
if
(
!
actor
)
{
QMessageBox
::
information
(
NULL
,
""
,
QString
::
fromUtf8
(
"Нет исполнтеля:"
)
+
task
->
isps
.
at
(
i
),
0
,
0
,
0
);
return
;
}
//TODO LOAD FIELDS;
QFile
*
field_data
=
new
QFile
(
task
->
field
(
task
->
isps
.
at
(
i
),
field_no
));
actor
->
loadActorData
(
field_data
);
}
}
void
Plugin
::
checkNext
(
KumZadanie
*
task
)
{
GI
*
gui
=
ExtensionSystem
::
PluginManager
::
instance
()
->
findPlugin
<
GI
>
();
selectNext
(
task
);
gui
->
startTesting
();
};
void
Plugin
::
startProgram
(
QVariant
param
,
KumZadanie
*
task
)
...
...
@@ -183,17 +199,42 @@ void Plugin::changeCurrentDirectory(const QString &path)
}
void
Plugin
::
nextField
()
{
if
(
field_no
<
cur_task
->
minFieldCount
()
)
{
field_no
++
;
selectNext
(
cur_task
);
}
prevFld
->
setEnabled
(
field_no
>
0
);
nextFld
->
setEnabled
((
field_no
+
1
)
<
cur_task
->
minFieldCount
()
&&
cur_task
->
minFieldCount
()
>
0
);
};
void
Plugin
::
prevField
()
{
if
(
field_no
>-
1
)
{
field_no
--
;
selectNext
(
cur_task
);
}
prevFld
->
setEnabled
(
field_no
>
0
);
nextFld
->
setEnabled
(
field_no
<
cur_task
->
minFieldCount
()
&&
cur_task
->
minFieldCount
()
>
0
);
};
void
Plugin
::
lockContrls
()
{
prevFld
->
setEnabled
(
false
);
nextFld
->
setEnabled
(
false
);
}
void
Plugin
::
changeGlobalState
(
ExtensionSystem
::
GlobalState
old
,
ExtensionSystem
::
GlobalState
current
)
{
if
(
current
==
ExtensionSystem
::
GS_Running
)
MW
->
lockControls
();
if
(
current
==
ExtensionSystem
::
GS_Observe
)
MW
->
unlockControls
();
if
(
current
==
ExtensionSystem
::
GS_Running
)
{
MW
->
lockControls
();
nextFld
->
setEnabled
(
false
);
prevFld
->
setEnabled
(
false
);
};
if
(
current
==
ExtensionSystem
::
GS_Observe
)
{
MW
->
unlockControls
();
prevFld
->
setEnabled
(
field_no
>
0
);
nextFld
->
setEnabled
(
field_no
<
cur_task
->
minFieldCount
()
&&
cur_task
->
minFieldCount
()
>
0
);
};
}
QString
Plugin
::
initialize
(
const
QStringList
&
arguments
)
...
...
@@ -211,6 +252,8 @@ QString Plugin::initialize(const QStringList &arguments)
QString
error
;
isp_no
=
0
;
field_no
=
0
;
courseMenu
->
addAction
(
nextFld
);
courseMenu
->
addAction
(
prevFld
);
return
error
;
}
...
...
src/plugins/coursemanager/coursemanager_plugin.h
View file @
36a0453e
...
...
@@ -40,6 +40,7 @@ public slots:
void
setTestingResult
(
ProgramRunStatus
status
,
int
value
);
void
nextField
();
void
prevField
();
void
lockContrls
();
private
/*methods*/
:
void
saveSession
()
const
;
void
restoreSession
();
...
...
@@ -61,6 +62,7 @@ private /*fields*/:
MainWindowTask
*
MW
;
bool
setTextFromFile
(
QString
fname
);
int
isp_no
,
field_no
;
void
selectNext
(
KumZadanie
*
task
);
KumZadanie
*
cur_task
;
};
...
...
src/plugins/coursemanager/task/mainwindow.cpp
View file @
36a0453e
...
...
@@ -248,7 +248,8 @@ void MainWindowTask::loadCourse()
}
else
ui
->
webView
->
setHtml
(
cText
);
if
(
isTeacher
)
ui
->
actionEdit
->
setEnabled
(
true
);
setWindowTitle
(
course
->
name
()
+
trUtf8
(
" - Практикум"
));
interface
->
lockContrls
();
ui
->
checkTask
->
setEnabled
(
false
);
};
...
...
@@ -391,6 +392,7 @@ if(ioDir.isFile())
task
.
isps
=
course
->
Modules
(
curTaskIdx
.
internalId
());
task
.
name
=
course
->
getTitle
(
curTaskIdx
.
internalId
());
qDebug
()
<<
"ISPS"
<<
task
.
isps
;
task
.
fields
.
clear
();
for
(
int
i
=
0
;
i
<
task
.
isps
.
count
();
i
++
)
{
// task.Scripts.append(loadScript(course->Script(curTaskIdx.internalId(),task.isps[i])));
...
...
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