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