Commit 444c49d2 authored by Denis Khachko's avatar Denis Khachko

Last courses.

parent faacac9d
......@@ -16,7 +16,7 @@ Plugin::Plugin()
courseMenu=new QMenu(trUtf8("Практикум"));
MenuList.append(courseMenu);
MW=new MainWindowTask();
MW->setup();
MW->setup(mySettings());
mainWindow_=MW;
field_no=0;
prevFld=new QAction(trUtf8("Предыдущая обстановка"),this);
......@@ -278,6 +278,7 @@ void Plugin::updateSettings(const QStringList & keys)
if (settingsEditorPage_) {
settingsEditorPage_->setSettingsObject(mySettings());
}
MW->updateSettings(keys, mySettings());
}
......
......@@ -40,6 +40,9 @@ public:
mainWindow()->showNormal();
}
inline void activateCourseFromList(QString file) { Q_UNUSED(file); }
inline QStringList getListOfCourses() const {
return mySettings()->value("Courses/LastFiles","").toString().split(";");
}
public slots:
void setEnabled(bool value);
void setTestingResult(ProgramRunStatus status, int value);
......
......@@ -15,7 +15,7 @@ cursFile="";
connect(qApp,SIGNAL(aboutToQuit()),this,SLOT(aboutToQuit()));
}
void MainWindowTask::setup()
void MainWindowTask::setup(ExtensionSystem::SettingsPtr sett)
{
course=NULL;
ui->setupUi(this);
......@@ -23,8 +23,7 @@ cursFile="";
ui->treeView->setIconSize(QSize(25,25));
ui->menu->hide();
ui->treeView->setStyleSheet("icon-size: 25px;font-size: 14px;");
settings = new QSettings("NIISI RAS","Kumir");
settings->setIniCodec("UTF-8");
settings = sett;
customMenu.hide();
connect(ui->loadCurs,SIGNAL(activated()),this,SLOT(loadCourse()));
connect(ui->actionSave,SIGNAL(activated()),this,SLOT(saveCourse()));
......@@ -99,7 +98,19 @@ void MainWindowTask::changeEvent(QEvent *e)
break;
}
}
void MainWindowTask::updateLastFiles(const QString newFile )
{
QStringList lastFiles= settings->value("Courses/LastFiles","").toString().split(";");
qDebug()<<lastFiles;
if(lastFiles.indexOf(newFile)<0)lastFiles.prepend(newFile);
int max_fid=std::min(lastFiles.count(),10);
QString sett="";
for(int i=0;i<max_fid;i++)
{
sett+= lastFiles.at(i)+";";
}
settings->setValue("Courses/LastFiles",sett);
};
void MainWindowTask::loadCourseData(const QString fileName)
{
......@@ -257,6 +268,7 @@ void MainWindowTask::loadCourse()
}else ui->webView->setHtml(cText);
// if(isTeacher)ui->actionEdit->setEnabled(true);
setWindowTitle(course->name()+trUtf8(" - Практикум"));
updateLastFiles(fileName);
interface->lockContrls();
ui->checkTask->setEnabled(false);
this->show();
......
......@@ -77,11 +77,13 @@ class MainWindowTask : public QMainWindow {
Q_OBJECT
public:
MainWindowTask(QWidget *parent = 0);
~MainWindowTask();
void setInterface(CourseManager::Plugin * csInterface){interface=csInterface;};
void setCS(QString cs){CS=cs;};
KumZadanie task;
void setup();
void setup( ExtensionSystem::SettingsPtr sett);
void updateSettings(const QStringList & keys,ExtensionSystem::SettingsPtr sett){settings=sett;};
QString getFileName(QString fileName);
void setTeacher(bool mode);
QList<QAction*> getActions();
......@@ -117,6 +119,7 @@ public slots:
void cancelRootEdit();
void lockControls();
void unlockControls();
void updateLastFiles(const QString newFile );
......@@ -148,7 +151,7 @@ private:
bool isTeacher;
//EditDialog* editDialog;
//newKursDialog* newDialog;
QSettings* settings;
ExtensionSystem::SettingsPtr settings;
QLineEdit *editRoot;
QFileInfo baseKursFile; //4 mode
Ui::MainWindowTask *ui;
......
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