forked from nerososft/Nider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
editor.cpp
53 lines (39 loc) · 1.46 KB
/
editor.cpp
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "editor.h"
#include <QDebug>
EditorManager::EditorManager()
{
}
//编辑器关闭文件
void EditorManager::closeFile(QString filename,QString filePath){
}
//文件是否在编辑器打开
bool EditorManager::isFileOpened(QString filename,QString filePath){
std::map<QString,QString>::iterator fileIterator=this->openedFIle.find(filename);
std::pair<QString, QString> newPair(filename,filePath );
if (fileIterator == this->openedFIle.end()){
return false;
}
return true;
}
//编辑器切换已经打开的文件
void EditorManager::switchFile(QString filename,QString filePath){
}
//编辑器打开新文件
void EditorManager::openFile(QString filename,QString filePath){
std::map<QString,QString>::iterator fileIterator=this->openedFIle.find(filename);
std::pair<QString, QString> newPair(filename,filePath);
if (fileIterator == this->openedFIle.end()){
this->openedFIle.insert(this->openedFIle.begin(),newPair);
qDebug()<< "编辑器打开新文件:"+filePath+filename;
}
qDebug()<<"编辑器已经打开了该文件"+filePath+filename;
this->fileIndex = newPair;
}
std::vector<QString> EditorManager::getOpenedFile(){
std::map<QString,QString>::iterator fileIterator;
std::vector<QString> opened;
for(fileIterator = this->openedFIle.begin();fileIterator!=this->openedFIle.end();fileIterator++){
opened.insert(opened.begin(),fileIterator->first);
}
return opened;
}