已经打开文件视图切换
This commit is contained in:
parent
1166dc52ae
commit
c1f17f4be2
|
@ -31,6 +31,18 @@ bool SensitiveCore::contains(const QFileInfo &target) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VariedTextView *SensitiveCore::queryComponent(const QFileInfo &target) const
|
||||||
|
{
|
||||||
|
for(auto &it : sourcecode_map.keys())
|
||||||
|
if(it == target.absoluteFilePath())
|
||||||
|
return sourcecode_map[it];
|
||||||
|
for(auto &it : plaintext_map.keys())
|
||||||
|
if(it == target.absoluteFilePath())
|
||||||
|
return plaintext_map[it];
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void SensitiveCore::addPerceptionList(VariedTextView *ins, SensitiveType type)
|
void SensitiveCore::addPerceptionList(VariedTextView *ins, SensitiveType type)
|
||||||
{
|
{
|
||||||
if(type == SensitiveType::CompileAtChanged){
|
if(type == SensitiveType::CompileAtChanged){
|
||||||
|
|
|
@ -51,6 +51,8 @@ namespace MakeTools {
|
||||||
void saveAll() const;
|
void saveAll() const;
|
||||||
|
|
||||||
bool contains(const QFileInfo &target) const;
|
bool contains(const QFileInfo &target) const;
|
||||||
|
VariedTextView * queryComponent(const QFileInfo &target) const;
|
||||||
|
|
||||||
void addPerceptionList(VariedTextView *ins, SensitiveType type = SensitiveType::CompileAtChanged);
|
void addPerceptionList(VariedTextView *ins, SensitiveType type = SensitiveType::CompileAtChanged);
|
||||||
void addProcTrigger(std::function<void()> exc);
|
void addProcTrigger(std::function<void()> exc);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ void ChainHightlighter::highlightBlock(const QString &text)
|
||||||
unknowns.setForeground(QBrush(Qt::gray));
|
unknowns.setForeground(QBrush(Qt::gray));
|
||||||
|
|
||||||
QTextCharFormat generate;
|
QTextCharFormat generate;
|
||||||
generate.setForeground(QBrush(Qt::black));
|
generate.setForeground(QBrush(Qt::blue));
|
||||||
|
|
||||||
QTextCharFormat error;
|
QTextCharFormat error;
|
||||||
error.setForeground(QBrush(Qt::red));
|
error.setForeground(QBrush(Qt::red));
|
||||||
|
|
|
@ -196,8 +196,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
center_funcs->addTab(new QTextEdit(this), "编辑区域");
|
center_funcs->addTab(new QTextEdit(this), "编辑区域");
|
||||||
left_funcs->addTab(project_view, "项目管理");
|
left_funcs->addTab(project_view, "项目管理");
|
||||||
connect(project_view, &ProjectView::activeDocument, [this](const QString &file_path, const QString &name){
|
connect(project_view, &ProjectView::activeDocument, [this](const QString &file_path, const QString &name){
|
||||||
if(framework->contains(file_path))
|
if(framework->contains(file_path)){
|
||||||
|
auto ins = framework->queryComponent(QFileInfo(file_path));
|
||||||
|
center_funcs->setCurrentWidget(ins->textView());
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
VariedTextView *tview = nullptr;
|
VariedTextView *tview = nullptr;
|
||||||
if(file_path.endsWith("storychain")){
|
if(file_path.endsWith("storychain")){
|
||||||
|
|
Loading…
Reference in New Issue