Commit 05f5ae1e authored by Denis Khachko's avatar Denis Khachko

Course cosmetic fixes.

parent 1236be55
......@@ -262,6 +262,7 @@ void Plugin::setEnabled(bool value)
{
}
bool Plugin::isSafeToQuit(){return MW->safeToQuit();};
void Plugin::setTestingResult(ProgramRunStatus status, int value)
{
......
......@@ -47,7 +47,7 @@ public:
return mySettings()->value("Courses/LastFiles","").toString().split(";",QString::SkipEmptyParts);
}
void rebuildRescentMenu();
bool isSafeToQuit();
public slots:
void setEnabled(bool value);
void setTestingResult(ProgramRunStatus status, int value);
......
......@@ -830,29 +830,48 @@ void MainWindowTask::closeEvent(QCloseEvent *event)
qDebug()<<"CLOSE TASK WINDOW";
if(!course)return;
qDebug()<<"START CLOSE TASK WINDOW";
if(!cursWorkFile.exists())
{
QMessageBox::StandardButton ans;
ans = QMessageBox::question(this, trUtf8("Курсы"), trUtf8("Вы хотите сохранить работу?"),
QMessageBox::Yes | QMessageBox::No , QMessageBox::Yes);
if (ans == QMessageBox::No)
{
event->accept();
if(course)delete course;
course=NULL;
return;
};
if(ans == QMessageBox::Cancel){event->ignore();
return;};
saveCourse();
}
markProgChange();
qDebug()<<"CLOSE TASK WINDOW";
event->accept();
close();
};
bool MainWindowTask::safeToQuit()
{
if(!course)return true;
if(!cursWorkFile.exists())
{
QMessageBox msgBoxCreateWorkbook(
QMessageBox::Question,
trUtf8("Практикум"),
trUtf8("Вы хотите сохранить работу?"),
QMessageBox::Yes | QMessageBox::No|QMessageBox::Cancel,
this
);
msgBoxCreateWorkbook.button(QMessageBox::Yes)->setText(trUtf8("Да"));
msgBoxCreateWorkbook.button(QMessageBox::No)->setText(trUtf8("Нет"));
msgBoxCreateWorkbook.button(QMessageBox::Cancel)->setText(trUtf8("Отмена"));
int ans = msgBoxCreateWorkbook.exec();
// ans = QMessageBox::question(this, trUtf8("Практикум"), trUtf8("Вы хотите создать тетрадь?"),
// QMessageBox::Yes | QMessageBox::No , QMessageBox::Yes);
if (ans == QMessageBox::Yes)
{
saveCourse();
return true;
};
if (ans == QMessageBox::No)
{
return true;
}
if(ans == QMessageBox::Cancel)
{
return false;
}
}
return true;
};
void MainWindowTask::returnTested()
{
interface->setPreProgram(QVariant(course->getUserTestedText(curTaskIdx.internalId())));
......
......@@ -100,6 +100,7 @@ Q_SIGNALS:
void activateRequest();
public slots:
bool safeToQuit();
void aboutToQuit ();
void openRescent();
void loadCourse();
......
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