- enhancement: new file template
- fix: when an editor is created, its caret will be displayed even it doesn't have focus
This commit is contained in:
parent
25d83d0e8d
commit
ae2f3596aa
2
NEWS.md
2
NEWS.md
|
@ -2,6 +2,8 @@ Version 0.7.0
|
||||||
- fix: Backspace still works in readonly mode
|
- fix: Backspace still works in readonly mode
|
||||||
- fix: save as file dialog's operation mode is not correct
|
- fix: save as file dialog's operation mode is not correct
|
||||||
- enhancement: fill indents in the editor (Turned off by default)
|
- enhancement: fill indents in the editor (Turned off by default)
|
||||||
|
- enhancement: new file template
|
||||||
|
- fix: when an editor is created, its caret will be displayed even it doesn't have focus
|
||||||
|
|
||||||
Version 0.6.8
|
Version 0.6.8
|
||||||
- enhancement: add link to cppreference in the help menu
|
- enhancement: add link to cppreference in the help menu
|
||||||
|
|
|
@ -19,7 +19,6 @@ SOURCES += \
|
||||||
caretlist.cpp \
|
caretlist.cpp \
|
||||||
codeformatter.cpp \
|
codeformatter.cpp \
|
||||||
codesnippetsmanager.cpp \
|
codesnippetsmanager.cpp \
|
||||||
codetemplate.cpp \
|
|
||||||
colorscheme.cpp \
|
colorscheme.cpp \
|
||||||
compiler/projectcompiler.cpp \
|
compiler/projectcompiler.cpp \
|
||||||
platform.cpp \
|
platform.cpp \
|
||||||
|
@ -133,7 +132,6 @@ HEADERS += \
|
||||||
caretlist.h \
|
caretlist.h \
|
||||||
codeformatter.h \
|
codeformatter.h \
|
||||||
codesnippetsmanager.h \
|
codesnippetsmanager.h \
|
||||||
codetemplate.h \
|
|
||||||
colorscheme.h \
|
colorscheme.h \
|
||||||
compiler/compiler.h \
|
compiler/compiler.h \
|
||||||
compiler/compilermanager.h \
|
compiler/compilermanager.h \
|
||||||
|
|
|
@ -273,69 +273,89 @@
|
||||||
<context>
|
<context>
|
||||||
<name>CodeSnippetsManager</name>
|
<name>CodeSnippetsManager</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="codesnippetsmanager.cpp" line="25"/>
|
<location filename="codesnippetsmanager.cpp" line="37"/>
|
||||||
<location filename="codesnippetsmanager.cpp" line="35"/>
|
<location filename="codesnippetsmanager.cpp" line="47"/>
|
||||||
<source>Load default code snippets failed</source>
|
<source>Load default code snippets failed</source>
|
||||||
<translation>载入缺省代码模板失败</translation>
|
<translation>载入缺省代码模板失败</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="codesnippetsmanager.cpp" line="26"/>
|
<location filename="codesnippetsmanager.cpp" line="38"/>
|
||||||
<location filename="codesnippetsmanager.cpp" line="36"/>
|
<location filename="codesnippetsmanager.cpp" line="48"/>
|
||||||
<source>Can't copy default code snippets '%1' to '%2'.</source>
|
<source>Can't copy default code snippets '%1' to '%2'.</source>
|
||||||
<translation>无法将缺省代码模板'%1'复制到'%2'。</translation>
|
<translation>无法将缺省代码模板'%1'复制到'%2'。</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="codesnippetsmanager.cpp" line="47"/>
|
<location filename="codesnippetsmanager.cpp" line="59"/>
|
||||||
<location filename="codesnippetsmanager.cpp" line="58"/>
|
<location filename="codesnippetsmanager.cpp" line="70"/>
|
||||||
<source>Read code snippets failed</source>
|
<source>Read code snippets failed</source>
|
||||||
<translation>读取代码模板失败</translation>
|
<translation>读取代码模板失败</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="codesnippetsmanager.cpp" line="48"/>
|
<location filename="codesnippetsmanager.cpp" line="60"/>
|
||||||
<source>Can't open code snippet file '%1' for read.</source>
|
<source>Can't open code snippet file '%1' for read.</source>
|
||||||
<translation>无法读入代码模板文件'%1'</translation>
|
<translation>无法读入代码模板文件'%1'</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="codesnippetsmanager.cpp" line="59"/>
|
<location filename="codesnippetsmanager.cpp" line="71"/>
|
||||||
<source>Read code snippet file '%1' failed:%2</source>
|
<source>Read code snippet file '%1' failed:%2</source>
|
||||||
<translation>读取代码模板文件'%1'失败:%2</translation>
|
<translation>读取代码模板文件'%1'失败:%2</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="codesnippetsmanager.cpp" line="84"/>
|
<location filename="codesnippetsmanager.cpp" line="96"/>
|
||||||
<location filename="codesnippetsmanager.cpp" line="103"/>
|
<location filename="codesnippetsmanager.cpp" line="115"/>
|
||||||
<source>Save code snippets failed</source>
|
<source>Save code snippets failed</source>
|
||||||
<translation>保存代码模板失败</translation>
|
<translation>保存代码模板失败</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="codesnippetsmanager.cpp" line="85"/>
|
<location filename="codesnippetsmanager.cpp" line="97"/>
|
||||||
<source>Can't open code snippet file '%1' for write.</source>
|
<source>Can't open code snippet file '%1' for write.</source>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="codesnippetsmanager.cpp" line="104"/>
|
<location filename="codesnippetsmanager.cpp" line="116"/>
|
||||||
<source>Write to code snippet file '%1' failed.</source>
|
<source>Write to code snippet file '%1' failed.</source>
|
||||||
<translation>写入代码片段文件'%1'失败。</translation>
|
<translation>写入代码片段文件'%1'失败。</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="codesnippetsmanager.cpp" line="132"/>
|
||||||
|
<source>Load new file template failed</source>
|
||||||
|
<translation>载入新文件模板失败</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="codesnippetsmanager.cpp" line="133"/>
|
||||||
|
<source>Can't open new file template file '%1' for read.</source>
|
||||||
|
<translation>无法读取新文件模板文件'%1'。</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="codesnippetsmanager.cpp" line="146"/>
|
||||||
|
<source>Save new file template failed</source>
|
||||||
|
<translation>保存新文件模板失败</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="codesnippetsmanager.cpp" line="147"/>
|
||||||
|
<source>Can't open new file template file '%1' for write.</source>
|
||||||
|
<translation>无法写入新文件模板文件'%1'。</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CodeSnippetsModel</name>
|
<name>CodeSnippetsModel</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="codesnippetsmanager.cpp" line="218"/>
|
<location filename="codesnippetsmanager.cpp" line="272"/>
|
||||||
<source>Caption</source>
|
<source>Caption</source>
|
||||||
<translation>名称</translation>
|
<translation>名称</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="codesnippetsmanager.cpp" line="220"/>
|
<location filename="codesnippetsmanager.cpp" line="274"/>
|
||||||
<source>Completion Prefix</source>
|
<source>Completion Prefix</source>
|
||||||
<translation>代码补全前缀</translation>
|
<translation>代码补全前缀</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="codesnippetsmanager.cpp" line="222"/>
|
<location filename="codesnippetsmanager.cpp" line="276"/>
|
||||||
<source>Description</source>
|
<source>Description</source>
|
||||||
<translation>描述</translation>
|
<translation>描述</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="codesnippetsmanager.cpp" line="224"/>
|
<location filename="codesnippetsmanager.cpp" line="278"/>
|
||||||
<source>Menu Section</source>
|
<source>Menu Section</source>
|
||||||
<translation>菜单节</translation>
|
<translation>菜单节</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -931,76 +951,76 @@ Are you really want to continue?</source>
|
||||||
<translation type="vanished">失败</translation>
|
<translation type="vanished">失败</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="213"/>
|
<location filename="editor.cpp" line="216"/>
|
||||||
<location filename="editor.cpp" line="227"/>
|
<location filename="editor.cpp" line="230"/>
|
||||||
<location filename="editor.cpp" line="303"/>
|
<location filename="editor.cpp" line="306"/>
|
||||||
<location filename="editor.cpp" line="1130"/>
|
<location filename="editor.cpp" line="1133"/>
|
||||||
<location filename="editor.cpp" line="1135"/>
|
<location filename="editor.cpp" line="1138"/>
|
||||||
<location filename="editor.cpp" line="1153"/>
|
<location filename="editor.cpp" line="1156"/>
|
||||||
<location filename="editor.cpp" line="1158"/>
|
<location filename="editor.cpp" line="1161"/>
|
||||||
<source>Error</source>
|
<source>Error</source>
|
||||||
<translation>错误</translation>
|
<translation>错误</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="214"/>
|
<location filename="editor.cpp" line="217"/>
|
||||||
<source>File %1 is not writable!</source>
|
<source>File %1 is not writable!</source>
|
||||||
<translation>无法写入文件"%1"</translation>
|
<translation>无法写入文件"%1"</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="256"/>
|
<location filename="editor.cpp" line="259"/>
|
||||||
<source>Save As</source>
|
<source>Save As</source>
|
||||||
<translation>另存为</translation>
|
<translation>另存为</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="1131"/>
|
<location filename="editor.cpp" line="1134"/>
|
||||||
<source>The text to be copied exceeds count limit!</source>
|
<source>The text to be copied exceeds count limit!</source>
|
||||||
<translation>要复制的内容超过了行数限制!</translation>
|
<translation>要复制的内容超过了行数限制!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="1136"/>
|
<location filename="editor.cpp" line="1139"/>
|
||||||
<source>The text to be copied exceeds character limit!</source>
|
<source>The text to be copied exceeds character limit!</source>
|
||||||
<translation>要复制的内容超过了字符数限制!</translation>
|
<translation>要复制的内容超过了字符数限制!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="1154"/>
|
<location filename="editor.cpp" line="1157"/>
|
||||||
<source>The text to be cut exceeds count limit!</source>
|
<source>The text to be cut exceeds count limit!</source>
|
||||||
<translation>要剪切的内容超过了行数限制!</translation>
|
<translation>要剪切的内容超过了行数限制!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="1159"/>
|
<location filename="editor.cpp" line="1162"/>
|
||||||
<source>The text to be cut exceeds character limit!</source>
|
<source>The text to be cut exceeds character limit!</source>
|
||||||
<translation>要剪切的内容超过了字符数限制!</translation>
|
<translation>要剪切的内容超过了字符数限制!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="2127"/>
|
<location filename="editor.cpp" line="2130"/>
|
||||||
<source>Print Document</source>
|
<source>Print Document</source>
|
||||||
<translation>打印文档</translation>
|
<translation>打印文档</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="2674"/>
|
<location filename="editor.cpp" line="2677"/>
|
||||||
<location filename="editor.cpp" line="2711"/>
|
<location filename="editor.cpp" line="2714"/>
|
||||||
<location filename="editor.cpp" line="2762"/>
|
<location filename="editor.cpp" line="2765"/>
|
||||||
<source>Ctrl+click for more info</source>
|
<source>Ctrl+click for more info</source>
|
||||||
<translation>Ctrl+单击以获取更多信息</translation>
|
<translation>Ctrl+单击以获取更多信息</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="3107"/>
|
<location filename="editor.cpp" line="3110"/>
|
||||||
<location filename="editor.cpp" line="3137"/>
|
<location filename="editor.cpp" line="3140"/>
|
||||||
<source>Symbol '%1' not found!</source>
|
<source>Symbol '%1' not found!</source>
|
||||||
<translation>未找到符号'%1'!</translation>
|
<translation>未找到符号'%1'!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="3526"/>
|
<location filename="editor.cpp" line="3529"/>
|
||||||
<source>Break point condition</source>
|
<source>Break point condition</source>
|
||||||
<translation>断点条件</translation>
|
<translation>断点条件</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="3527"/>
|
<location filename="editor.cpp" line="3530"/>
|
||||||
<source>Enter the condition of the breakpoint:</source>
|
<source>Enter the condition of the breakpoint:</source>
|
||||||
<translation>输入当前断点的生效条件:</translation>
|
<translation>输入当前断点的生效条件:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="editor.cpp" line="3704"/>
|
<location filename="editor.cpp" line="3707"/>
|
||||||
<source>Readonly</source>
|
<source>Readonly</source>
|
||||||
<translation>只读</translation>
|
<translation>只读</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -1506,15 +1526,25 @@ Are you really want to continue?</source>
|
||||||
<translation>表单</translation>
|
<translation>表单</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="settingsdialog/editorsnippetwidget.ui" line="73"/>
|
<location filename="settingsdialog/editorsnippetwidget.ui" line="24"/>
|
||||||
|
<source>Code Snippets</source>
|
||||||
|
<translation>代码模板</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="settingsdialog/editorsnippetwidget.ui" line="83"/>
|
||||||
<source>Add</source>
|
<source>Add</source>
|
||||||
<translation>添加</translation>
|
<translation>添加</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="settingsdialog/editorsnippetwidget.ui" line="84"/>
|
<location filename="settingsdialog/editorsnippetwidget.ui" line="94"/>
|
||||||
<source>Remove</source>
|
<source>Remove</source>
|
||||||
<translation>删除</translation>
|
<translation>删除</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="settingsdialog/editorsnippetwidget.ui" line="134"/>
|
||||||
|
<source>New File Template</source>
|
||||||
|
<translation>新文件模板</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>EditorSymbolCompletionWidget</name>
|
<name>EditorSymbolCompletionWidget</name>
|
||||||
|
|
|
@ -14,6 +14,18 @@ CodeSnippetsManager::CodeSnippetsManager(QObject *parent) : QObject(parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeSnippetsManager::load()
|
void CodeSnippetsManager::load()
|
||||||
|
{
|
||||||
|
loadSnippets();
|
||||||
|
loadNewFileTemplate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CodeSnippetsManager::save()
|
||||||
|
{
|
||||||
|
saveSnippets();
|
||||||
|
saveNewFileTemplate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CodeSnippetsManager::loadSnippets()
|
||||||
{
|
{
|
||||||
//if config file not exists, copy it from data
|
//if config file not exists, copy it from data
|
||||||
QString filename = includeTrailingPathDelimiter(pSettings->dirs().config()) + DEV_CODESNIPPET_FILE;
|
QString filename = includeTrailingPathDelimiter(pSettings->dirs().config()) + DEV_CODESNIPPET_FILE;
|
||||||
|
@ -75,7 +87,7 @@ void CodeSnippetsManager::load()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeSnippetsManager::save()
|
void CodeSnippetsManager::saveSnippets()
|
||||||
{
|
{
|
||||||
QString filename = includeTrailingPathDelimiter(pSettings->dirs().config()) + DEV_CODESNIPPET_FILE;
|
QString filename = includeTrailingPathDelimiter(pSettings->dirs().config()) + DEV_CODESNIPPET_FILE;
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
|
@ -107,6 +119,38 @@ void CodeSnippetsManager::save()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CodeSnippetsManager::loadNewFileTemplate()
|
||||||
|
{
|
||||||
|
QString filename = includeTrailingPathDelimiter(pSettings->dirs().config()) + DEV_NEWFILETEMPLATES_FILE;
|
||||||
|
QFile file(filename);
|
||||||
|
if (!file.exists()) {
|
||||||
|
mNewFileTemplate = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!file.open(QFile::ReadOnly)) {
|
||||||
|
QMessageBox::critical(nullptr,
|
||||||
|
tr("Load new file template failed"),
|
||||||
|
tr("Can't open new file template file '%1' for read.")
|
||||||
|
.arg(filename));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mNewFileTemplate=QString::fromUtf8(file.readAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CodeSnippetsManager::saveNewFileTemplate()
|
||||||
|
{
|
||||||
|
QString filename = includeTrailingPathDelimiter(pSettings->dirs().config()) + DEV_NEWFILETEMPLATES_FILE;
|
||||||
|
QFile file(filename);
|
||||||
|
if (!file.open(QFile::WriteOnly | QFile::Truncate)) {
|
||||||
|
QMessageBox::critical(nullptr,
|
||||||
|
tr("Save new file template failed"),
|
||||||
|
tr("Can't open new file template file '%1' for write.")
|
||||||
|
.arg(filename));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
file.write(mNewFileTemplate.toUtf8());
|
||||||
|
}
|
||||||
|
|
||||||
const QList<PCodeSnippet> &CodeSnippetsManager::snippets() const
|
const QList<PCodeSnippet> &CodeSnippetsManager::snippets() const
|
||||||
{
|
{
|
||||||
return mSnippets;
|
return mSnippets;
|
||||||
|
@ -117,6 +161,16 @@ void CodeSnippetsManager::setSnippets(const QList<PCodeSnippet> &newSnippets)
|
||||||
mSnippets = newSnippets;
|
mSnippets = newSnippets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &CodeSnippetsManager::newFileTemplate() const
|
||||||
|
{
|
||||||
|
return mNewFileTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CodeSnippetsManager::setNewFileTemplate(const QString &newNewFileTemplate)
|
||||||
|
{
|
||||||
|
mNewFileTemplate = newNewFileTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
void CodeSnippetsModel::addSnippet(const QString &caption, const QString &prefix, const QString &code, const QString &description, int menuSection)
|
void CodeSnippetsModel::addSnippet(const QString &caption, const QString &prefix, const QString &code, const QString &description, int menuSection)
|
||||||
{
|
{
|
||||||
beginInsertRows(QModelIndex(),mSnippets.count(),mSnippets.count());
|
beginInsertRows(QModelIndex(),mSnippets.count(),mSnippets.count());
|
||||||
|
|
|
@ -41,14 +41,25 @@ public:
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
const QList<PCodeSnippet> &snippets() const;
|
const QList<PCodeSnippet> &snippets() const;
|
||||||
|
|
||||||
void setSnippets(const QList<PCodeSnippet> &newSnippets);
|
void setSnippets(const QList<PCodeSnippet> &newSnippets);
|
||||||
|
|
||||||
|
const QString &newFileTemplate() const;
|
||||||
|
void setNewFileTemplate(const QString &newNewFileTemplate);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
private:
|
||||||
|
void loadSnippets();
|
||||||
|
void saveSnippets();
|
||||||
|
void loadNewFileTemplate();
|
||||||
|
void saveNewFileTemplate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<PCodeSnippet> mSnippets;
|
QList<PCodeSnippet> mSnippets;
|
||||||
|
QString mNewFileTemplate;
|
||||||
};
|
};
|
||||||
|
|
||||||
using PCodeSnippetManager = std::shared_ptr<CodeSnippetsManager>;
|
using PCodeSnippetManager = std::shared_ptr<CodeSnippetsManager>;
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
#include "codetemplate.h"
|
|
||||||
|
|
||||||
CodeTemplate::CodeTemplate()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
#ifndef CODETEMPLATE_H
|
|
||||||
#define CODETEMPLATE_H
|
|
||||||
|
|
||||||
|
|
||||||
class CodeTemplate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CodeTemplate();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CODETEMPLATE_H
|
|
|
@ -97,6 +97,9 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
else
|
else
|
||||||
mFileEncoding = mEncodingOption;
|
mFileEncoding = mEncodingOption;
|
||||||
highlighter=highlighterManager.getCppHighlighter();
|
highlighter=highlighterManager.getCppHighlighter();
|
||||||
|
if (parentPageControl!=nullptr) {
|
||||||
|
insertCodeSnippet(pMainWindow->codeSnippetManager()->newFileTemplate());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (highlighter) {
|
if (highlighter) {
|
||||||
|
|
|
@ -129,7 +129,7 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
|
||||||
|
|
||||||
synFontChanged();
|
synFontChanged();
|
||||||
|
|
||||||
showCaret();
|
hideCaret();
|
||||||
|
|
||||||
connect(horizontalScrollBar(),&QScrollBar::valueChanged,
|
connect(horizontalScrollBar(),&QScrollBar::valueChanged,
|
||||||
this, &SynEdit::onScrolled);
|
this, &SynEdit::onScrolled);
|
||||||
|
|
|
@ -38,6 +38,8 @@ EditorSnippetWidget::EditorSnippetWidget(const QString& name, const QString& gro
|
||||||
mUpdatingCode = false;
|
mUpdatingCode = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
connect(ui->editFileTemplate,&Editor::changed,
|
||||||
|
this, &SettingsWidget::setSettingsChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorSnippetWidget::~EditorSnippetWidget()
|
EditorSnippetWidget::~EditorSnippetWidget()
|
||||||
|
@ -48,11 +50,13 @@ EditorSnippetWidget::~EditorSnippetWidget()
|
||||||
void EditorSnippetWidget::doLoad()
|
void EditorSnippetWidget::doLoad()
|
||||||
{
|
{
|
||||||
mModel.updateSnippets(pMainWindow->codeSnippetManager()->snippets());
|
mModel.updateSnippets(pMainWindow->codeSnippetManager()->snippets());
|
||||||
|
ui->editFileTemplate->lines()->setText(pMainWindow->codeSnippetManager()->newFileTemplate());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorSnippetWidget::doSave()
|
void EditorSnippetWidget::doSave()
|
||||||
{
|
{
|
||||||
pMainWindow->codeSnippetManager()->setSnippets(mModel.snippets());
|
pMainWindow->codeSnippetManager()->setSnippets(mModel.snippets());
|
||||||
|
pMainWindow->codeSnippetManager()->setNewFileTemplate(ui->editFileTemplate->text());
|
||||||
pMainWindow->codeSnippetManager()->save();
|
pMainWindow->codeSnippetManager()->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,105 +15,136 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSplitter" name="splitter">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="orientation">
|
<property name="currentIndex">
|
||||||
<enum>Qt::Vertical</enum>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="widget" native="true">
|
<widget class="QWidget" name="tabSnippet">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<attribute name="title">
|
||||||
<property name="leftMargin">
|
<string>Code Snippets</string>
|
||||||
<number>0</number>
|
</attribute>
|
||||||
</property>
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTableView" name="tblSnippets">
|
<widget class="QSplitter" name="splitter">
|
||||||
<property name="alternatingRowColors">
|
<property name="orientation">
|
||||||
<bool>true</bool>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="selectionMode">
|
<widget class="QWidget" name="widget" native="true">
|
||||||
<enum>QAbstractItemView::SingleSelection</enum>
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
</property>
|
<property name="leftMargin">
|
||||||
<property name="selectionBehavior">
|
<number>0</number>
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
</property>
|
||||||
</property>
|
<property name="topMargin">
|
||||||
<property name="textElideMode">
|
<number>0</number>
|
||||||
<enum>Qt::ElideNone</enum>
|
</property>
|
||||||
</property>
|
<property name="rightMargin">
|
||||||
<attribute name="horizontalHeaderStretchLastSection">
|
<number>0</number>
|
||||||
<bool>true</bool>
|
</property>
|
||||||
</attribute>
|
<property name="bottomMargin">
|
||||||
</widget>
|
<number>0</number>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget_2" native="true">
|
<widget class="QTableView" name="tblSnippets">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<property name="alternatingRowColors">
|
||||||
<property name="leftMargin">
|
<bool>true</bool>
|
||||||
<number>0</number>
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="selectionBehavior">
|
||||||
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</property>
|
||||||
|
<property name="textElideMode">
|
||||||
|
<enum>Qt::ElideNone</enum>
|
||||||
|
</property>
|
||||||
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="widget_2" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="btnAdd">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../icons.qrc">
|
||||||
|
<normaloff>:/icons/images/newlook24/002-add.png</normaloff>:/icons/images/newlook24/002-add.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="btnRemove">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../icons.qrc">
|
||||||
|
<normaloff>:/icons/images/newlook24/008-close.png</normaloff>:/icons/images/newlook24/008-close.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>159</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="Editor" name="editCode">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="frameShadow">
|
||||||
<number>0</number>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
</widget>
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="btnAdd">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../icons.qrc">
|
|
||||||
<normaloff>:/icons/images/newlook24/002-add.png</normaloff>:/icons/images/newlook24/002-add.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="btnRemove">
|
|
||||||
<property name="text">
|
|
||||||
<string>Remove</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../icons.qrc">
|
|
||||||
<normaloff>:/icons/images/newlook24/008-close.png</normaloff>:/icons/images/newlook24/008-close.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>159</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="Editor" name="editCode">
|
<widget class="QWidget" name="tabFileTemplate">
|
||||||
<property name="frameShape">
|
<attribute name="title">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<string>New File Template</string>
|
||||||
</property>
|
</attribute>
|
||||||
<property name="frameShadow">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
<enum>QFrame::Raised</enum>
|
<item>
|
||||||
</property>
|
<widget class="Editor" name="editFileTemplate">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#define DEV_LASTOPENS_FILE "lastopens.ini"
|
#define DEV_LASTOPENS_FILE "lastopens.ini"
|
||||||
#define DEV_SYMBOLUSAGE_FILE "symbolusage.json"
|
#define DEV_SYMBOLUSAGE_FILE "symbolusage.json"
|
||||||
#define DEV_CODESNIPPET_FILE "codesnippets.json"
|
#define DEV_CODESNIPPET_FILE "codesnippets.json"
|
||||||
|
#define DEV_NEWFILETEMPLATES_FILE "newfiletemplate.txt"
|
||||||
#define DEV_AUTOLINK_FILE "autolink.json"
|
#define DEV_AUTOLINK_FILE "autolink.json"
|
||||||
#define DEV_SHORTCUT_FILE "shortcuts.json"
|
#define DEV_SHORTCUT_FILE "shortcuts.json"
|
||||||
#define DEV_TOOLS_FILE "tools.json"
|
#define DEV_TOOLS_FILE "tools.json"
|
||||||
|
|
Loading…
Reference in New Issue