mainwindow.h 3.49 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
/****************************************************************************
**
** Copyright (C) 2004-2010 NIISI RAS. All rights reserved.
**
** This file is part of the KuMir.
**
** This file may be used under the terms of the GNU General Public
** License version 2.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of
** this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSettings>
#include "kumfiledialog.h"
#include "course_model.h"
#include "taskControlInterface.h"
#include "editdialog.h"
#include "newkursdialog.h"
class CSInterface;
namespace Ui {
    class MainWindowTask;
}

class MainWindowTask : public QMainWindow {
    Q_OBJECT
public:
    MainWindowTask(QWidget *parent = 0);
    ~MainWindowTask();
Denis Khachko's avatar
Denis Khachko committed
36
    void setInterface(CSInterface * csInterface){interface=csInterface;};
37 38 39 40
    void setCS(QString cs){CS=cs;};
    KumZadanie task;
    void setup();
     QString getFileName(QString fileName);
Denis Khachko's avatar
Denis Khachko committed
41

42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
public slots:
    void aboutToQuit ();
    void loadCourse();
    void returnTested();
    void saveCourse();
    void saveCourseFile();
    void saveBaseKurs();
    void showText(const QModelIndex & index );
    void startEdit(const QModelIndex & index );
    void loadHtml(QString fileName);
    void startTask();
    void checkTask();
    void Close();
    void customContextMenuRequested(QPoint  pos);
    void addTask();
    void addDeepTask();
    void deleteTask();

    void saveKursAs();//TEACHER
    void editTask();//Teacher
    void setEditTaskEnabled(bool flag);
    void moveUp();
    void moveDown();
    void unLockEditFields();
    void lockEditFields();
    void remSelIsp();
     void newKurs();
     void endRootEdit();
     void cancelRootEdit();
     void addIsp();
     void showFields();
     void fieldClick();
     void remField();
      void addField();
      void setPrg();
      void setType();
      void prgLineChange();
      void editFile();
      void makeSection();
      void openRecent();
      void createMoveMenu();
      void move();
protected:
    void changeEvent(QEvent *e);
    void closeEvent(QCloseEvent *event);
Denis Khachko's avatar
Denis Khachko committed
87

88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
private:
    bool checkInList(int id,QModelIndexList list);//Поиск id среди списка индексов
    void enableMkSect(bool flag);
    void markProgChange();
    void lockKursFile(const QString fileName);
    QString getFileTypes();
    void createRescentMenu();
    void save2Tree(); //Save to XML tree, but not to file
    void setUpDown(QModelIndex index);
    QString loadScript(QString file_name);
    QString loadTestAlg(QString file_name);
    void loadCourseData(const QString filename);
    void loadMarks(const QString fileName);
    void refreshIspsNEnv();
    Ui::MainWindowTask *ui;
    QString curDir;
    courseModel* course;
    QModelIndex curTaskIdx;
Denis Khachko's avatar
Denis Khachko committed
106
    CSInterface * interface;
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
    QString CS;
    bool onTask;
    courseChanges changes;
    QString cursFile;
    QList<int> progChange;
    QFile cursWorkFile; //.work.xml
    QMenu customMenu;
    bool isTeacher;
    EditDialog* editDialog;
    newKursDialog* newDialog;
    QSettings* settings;
     QLineEdit *editRoot;
     QFileInfo baseKursFile; //4 mode
     bool changed;
     QStringList lastFiles;
     QFile lockFile; //Lock main xml file

};

#endif // MAINWINDOW_H