Commit 48464303 authored by Victor Yacovlev's avatar Victor Yacovlev

Merge branch 'master' of /var/opt/gitlab/git-data/repositories/niisi/kumir2

parents b8894e29 9c6d4455
......@@ -8,7 +8,7 @@
кон|@protected
|@protected
алг цел длинна коридора|@protected
алг цел длина коридора|@protected
дано | Возможно, снизу от робота коридор|@protected
надо | Посчитано количество клеток коридора|@protected
| |и робот вернулся туда где был. |@protected
......
......@@ -3610,7 +3610,7 @@ void RobotModule::copyFromPult(QString log)
// The source should be ready-to-read QIODevice like QBuffer or QFile
qDebug()<<"Load env";
if(field->loadFromDataStream(source)!=0)return ;
m_pultWidget->clearLog();
m_pultWidget->Logger->ClearLog();
m_mainWidget->setWindowTitle(trUtf8("Робот - ")+source->objectName());
startField=field->Clone();
field->dropWasEdit();
......
......@@ -554,6 +554,7 @@ public:
QDomNode el=nodeById(index.internalId(),root);
return !el.nextSiblingElement("T").isNull();
};
QModelIndex moveUp(QModelIndex &index)
{
if(!hasUpSib(index))return index;
......
......@@ -53,6 +53,7 @@ cursFile="";
connect(ui->actionSaveK,SIGNAL(triggered()),this,SLOT(saveKurs()));
connect(ui->actionSaveKas,SIGNAL(triggered()),this,SLOT(saveKursAs()));
connect(ui->actionRemove,SIGNAL(triggered()),this,SLOT(deleteTask()));
connect(ui->actionNext,SIGNAL(triggered()),this,SLOT(nextTask()));
// newDialog=new newKursDialog();
// connect(ui->actionNewK,SIGNAL(triggered()),this,SLOT(newKurs()));
// editDialog = new EditDialog(this);
......@@ -71,6 +72,15 @@ isTeacher=false;
setupWebView();
//ui->textBrowser->setVisible(false);
};
void MainWindowTask::nextTask()
{
if(ui->treeView->indexBelow(curTaskIdx).isValid())
{
ui->treeView->setCurrentIndex(ui->treeView->indexBelow(curTaskIdx));
// curTaskIdx=ui->treeView->currentIndex();
showText(ui->treeView->currentIndex());
}
}
void MainWindowTask::setupWebView()
{
......@@ -598,11 +608,22 @@ if(ioDir.isFile())
ui->do_task->setEnabled(false);
ui->checkTask->setEnabled(true);
onTask=true;
QModelIndex nextT=ui->treeView->indexBelow(curTaskIdx);
if(nextT.isValid() && course->isTask(nextT.internalId()) && nextT.internalId()>0 && course->taskAvailable(nextT.internalId()))
ui->actionNext->setEnabled(true);
else
ui->actionNext->setEnabled(false);
//ui->loadCurs->setEnabled(false);
qDebug()<<"end load task";
if(progChange.indexOf(curTaskIdx.internalId())==-1)progChange.append(curTaskIdx.internalId());
};
void MainWindowTask::checkTask()
void MainWindowTask::checkTask()
{
qDebug()<<"CheckTASK";
if(!onTask){qDebug()<<"!onTASK";return;};
......@@ -627,13 +648,21 @@ interface->startProgram(QVariant("TODO LOAD SCRIPT"),&task);
ui->splitter->setEnabled(false);
ui->checkTask->setEnabled(false);
ui->loadCurs->setEnabled(false);
ui->actionNext->setEnabled(false);
};
void MainWindowTask::unlockControls()
{
ui->splitter->setEnabled(true);
ui->checkTask->setEnabled(true);
ui->loadCurs->setEnabled(true);
ui->loadCurs->setEnabled(true);
QModelIndex nextT=ui->treeView->indexBelow(curTaskIdx);
if(nextT.isValid() && course->isTask(nextT.internalId()) && nextT.internalId()>0 && course->taskAvailable(nextT.internalId()))
ui->actionNext->setEnabled(true);
else
ui->actionNext->setEnabled(false);
};
void MainWindowTask::setMark(int mark)
......
......@@ -137,7 +137,7 @@ public slots:
void unlockControls();
void updateLastFiles(const QString newFile );
void nextTask();
protected:
void changeEvent(QEvent *e);
......
......@@ -67,8 +67,7 @@
<bool>true</bool>
</property>
</widget>
<widget class="QWidget" name="webView">
</widget>
<widget class="QWidget" name="webView" native="true"/>
</widget>
</item>
</layout>
......@@ -83,6 +82,7 @@
<addaction name="loadCurs"/>
<addaction name="do_task"/>
<addaction name="checkTask"/>
<addaction name="actionNext"/>
<addaction name="separator"/>
<addaction name="actionup"/>
<addaction name="actionDown"/>
......@@ -226,15 +226,16 @@
<string>Переместить вниз</string>
</property>
</action>
<action name="actionNext">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Следующее задание</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QWebView</class>
<extends>QWidget</extends>
<header>QtWebKit/QWebView</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
......@@ -398,23 +398,13 @@ void MainWindowTask::showText(const QModelIndex & index )
if(index==curTaskIdx)return;
unLockEditFields();
// if(onTask)
// {
// QMessageBox::StandardButton ans;
// ans = QMessageBox::question(this, trUtf8("Задание"), trUtf8("Вы хотите сменить задание?"),
// QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::Yes);
// if ((ans == QMessageBox::Cancel)||(ans == QMessageBox::No))
// {
// qDebug()<<"Cancel";
// if(curTaskIdx.internalId()>0)ui->treeView->setCurrentIndex(curTaskIdx);
// return;};
// }
onTask=false;
ui->checkTask->setEnabled(false);
QString taskText=course->getTaskText(index);
//ui->textBrowser->setText(taskText);
......
......@@ -99,6 +99,9 @@ private:
void loadCourseData(const QString filename);
void loadMarks(const QString fileName);
void refreshIspsNEnv();
Ui::MainWindowTask *ui;
QString curDir;
courseModel* course;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment