Merge branch 'projectview'
This commit is contained in:
commit
52e9a49b3a
4
NEWS.md
4
NEWS.md
|
@ -1,3 +1,7 @@
|
|||
Red Panda C++ Version 0.14.2
|
||||
- enhancement: file system view mode for project
|
||||
- enhancement: remove / rename / create new folder in the files view
|
||||
|
||||
Red Panda C++ Version 0.14.1
|
||||
- enhancement: custom theme
|
||||
- fix: failed to show function tip, when there are parameters having '[' and ']'
|
||||
|
|
|
@ -10,7 +10,7 @@ isEmpty(APP_NAME) {
|
|||
}
|
||||
|
||||
isEmpty(APP_VERSION) {
|
||||
APP_VERSION=0.14.1
|
||||
APP_VERSION=0.14.2
|
||||
}
|
||||
|
||||
isEmpty(PREFIX) {
|
||||
|
|
|
@ -3272,11 +3272,11 @@ Are you really want to continue?</oldsource>
|
|||
<message>
|
||||
<location filename="mainwindow.ui" line="527"/>
|
||||
<location filename="mainwindow.ui" line="2581"/>
|
||||
<location filename="mainwindow.cpp" line="3938"/>
|
||||
<location filename="mainwindow.cpp" line="3941"/>
|
||||
<location filename="mainwindow.cpp" line="3945"/>
|
||||
<location filename="mainwindow.cpp" line="3948"/>
|
||||
<location filename="mainwindow.cpp" line="5512"/>
|
||||
<location filename="mainwindow.cpp" line="3959"/>
|
||||
<location filename="mainwindow.cpp" line="3962"/>
|
||||
<location filename="mainwindow.cpp" line="3966"/>
|
||||
<location filename="mainwindow.cpp" line="3969"/>
|
||||
<location filename="mainwindow.cpp" line="5532"/>
|
||||
<source>Issues</source>
|
||||
<translation>编译器</translation>
|
||||
</message>
|
||||
|
@ -3688,7 +3688,7 @@ Are you really want to continue?</oldsource>
|
|||
<message>
|
||||
<location filename="mainwindow.ui" line="326"/>
|
||||
<location filename="mainwindow.ui" line="329"/>
|
||||
<location filename="mainwindow.cpp" line="5825"/>
|
||||
<location filename="mainwindow.cpp" line="5843"/>
|
||||
<source>New Problem Set</source>
|
||||
<translation>新建试题集</translation>
|
||||
</message>
|
||||
|
@ -3707,14 +3707,14 @@ Are you really want to continue?</oldsource>
|
|||
<message>
|
||||
<location filename="mainwindow.ui" line="368"/>
|
||||
<location filename="mainwindow.ui" line="371"/>
|
||||
<location filename="mainwindow.cpp" line="5868"/>
|
||||
<location filename="mainwindow.cpp" line="5886"/>
|
||||
<source>Save Problem Set</source>
|
||||
<translation>保存试题集</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.ui" line="382"/>
|
||||
<location filename="mainwindow.ui" line="385"/>
|
||||
<location filename="mainwindow.cpp" line="5888"/>
|
||||
<location filename="mainwindow.cpp" line="5910"/>
|
||||
<source>Load Problem Set</source>
|
||||
<translation>载入试题集</translation>
|
||||
</message>
|
||||
|
@ -4053,7 +4053,7 @@ Are you really want to continue?</oldsource>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.ui" line="2259"/>
|
||||
<location filename="mainwindow.cpp" line="4806"/>
|
||||
<location filename="mainwindow.cpp" line="4826"/>
|
||||
<source>Clear all breakpoints</source>
|
||||
<translation>删除所有断点</translation>
|
||||
</message>
|
||||
|
@ -4154,7 +4154,7 @@ Are you really want to continue?</oldsource>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.ui" line="2413"/>
|
||||
<location filename="mainwindow.cpp" line="5463"/>
|
||||
<location filename="mainwindow.cpp" line="5483"/>
|
||||
<source>Rename Symbol</source>
|
||||
<translation>重命名符号</translation>
|
||||
</message>
|
||||
|
@ -4175,13 +4175,13 @@ Are you really want to continue?</oldsource>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.ui" line="2433"/>
|
||||
<location filename="mainwindow.cpp" line="5643"/>
|
||||
<location filename="mainwindow.cpp" line="5661"/>
|
||||
<source>Export As RTF</source>
|
||||
<translation>导出为RTF</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.ui" line="2438"/>
|
||||
<location filename="mainwindow.cpp" line="5665"/>
|
||||
<location filename="mainwindow.cpp" line="5683"/>
|
||||
<source>Export As HTML</source>
|
||||
<translation>导出为HTML</translation>
|
||||
</message>
|
||||
|
@ -4344,7 +4344,7 @@ Are you really want to continue?</oldsource>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.ui" line="2503"/>
|
||||
<location filename="mainwindow.cpp" line="5804"/>
|
||||
<location filename="mainwindow.cpp" line="5822"/>
|
||||
<source>Open Folder</source>
|
||||
<translation>打开文件夹</translation>
|
||||
</message>
|
||||
|
@ -4354,7 +4354,7 @@ Are you really want to continue?</oldsource>
|
|||
<translation>运行参数...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="2758"/>
|
||||
<location filename="mainwindow.cpp" line="2772"/>
|
||||
<source>File Encoding</source>
|
||||
<translation>文件编码</translation>
|
||||
</message>
|
||||
|
@ -4584,7 +4584,7 @@ Are you really want to continue?</oldsource>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="268"/>
|
||||
<location filename="mainwindow.cpp" line="5834"/>
|
||||
<location filename="mainwindow.cpp" line="5852"/>
|
||||
<source>Problem Set %1</source>
|
||||
<translation>试题集%1</translation>
|
||||
</message>
|
||||
|
@ -4658,15 +4658,15 @@ Are you really want to continue?</oldsource>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="2261"/>
|
||||
<location filename="mainwindow.cpp" line="5723"/>
|
||||
<location filename="mainwindow.cpp" line="5763"/>
|
||||
<location filename="mainwindow.cpp" line="5741"/>
|
||||
<location filename="mainwindow.cpp" line="5781"/>
|
||||
<source>Bookmark Description</source>
|
||||
<translation>书签描述</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="2262"/>
|
||||
<location filename="mainwindow.cpp" line="5724"/>
|
||||
<location filename="mainwindow.cpp" line="5764"/>
|
||||
<location filename="mainwindow.cpp" line="5742"/>
|
||||
<location filename="mainwindow.cpp" line="5782"/>
|
||||
<source>Description:</source>
|
||||
<translation>描述:</translation>
|
||||
</message>
|
||||
|
@ -4742,195 +4742,205 @@ Are you really want to continue?</oldsource>
|
|||
<translation>删除文件夹</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="2529"/>
|
||||
<location filename="mainwindow.cpp" line="2524"/>
|
||||
<source>Switch to normal view</source>
|
||||
<translation>切换为普通视图</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="2531"/>
|
||||
<source>Switch to custom view</source>
|
||||
<translation>切换为自定义视图</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="2543"/>
|
||||
<source>Sort By Type</source>
|
||||
<translation>按类型排序</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="2534"/>
|
||||
<location filename="mainwindow.cpp" line="2548"/>
|
||||
<source>Sort alphabetically</source>
|
||||
<translation>按名称排序</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="2539"/>
|
||||
<location filename="mainwindow.cpp" line="2553"/>
|
||||
<source>Show inherited members</source>
|
||||
<translation>显示继承的成员</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="2544"/>
|
||||
<location filename="mainwindow.cpp" line="2558"/>
|
||||
<source>Goto declaration</source>
|
||||
<translation>跳转到声明处</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="2547"/>
|
||||
<location filename="mainwindow.cpp" line="2561"/>
|
||||
<source>Goto definition</source>
|
||||
<translation>跳转到定义处</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="2639"/>
|
||||
<location filename="mainwindow.cpp" line="2653"/>
|
||||
<source>Open in Editor</source>
|
||||
<translation>在编辑器中打开</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="2651"/>
|
||||
<location filename="mainwindow.cpp" line="2665"/>
|
||||
<source>Open in External Program</source>
|
||||
<translation>使用外部程序打开</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="2661"/>
|
||||
<location filename="mainwindow.cpp" line="2675"/>
|
||||
<source>Open in Terminal</source>
|
||||
<translation>在终端中打开</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="2677"/>
|
||||
<location filename="mainwindow.cpp" line="2691"/>
|
||||
<source>Open in Windows Explorer</source>
|
||||
<translation>在Windows浏览器中打开</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="2724"/>
|
||||
<location filename="mainwindow.cpp" line="2738"/>
|
||||
<source>Character sets</source>
|
||||
<translation>字符集</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="2850"/>
|
||||
<location filename="mainwindow.cpp" line="2864"/>
|
||||
<source>%1 files autosaved</source>
|
||||
<translation>已自动保存%1个文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3027"/>
|
||||
<location filename="mainwindow.cpp" line="3046"/>
|
||||
<source>Set answer to...</source>
|
||||
<translation>设置答案源代码...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3059"/>
|
||||
<location filename="mainwindow.cpp" line="3078"/>
|
||||
<source>select other file...</source>
|
||||
<translation>选择其他文件...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3065"/>
|
||||
<location filename="mainwindow.cpp" line="3084"/>
|
||||
<source>Select Answer Source File</source>
|
||||
<translation>选择答案源代码文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3067"/>
|
||||
<location filename="mainwindow.cpp" line="3086"/>
|
||||
<source>C/C++Source Files (*.c *.cpp *.cc *.cxx)</source>
|
||||
<oldsource>C/C++Source Files (*.c *.cpp *.cc *.cxx</oldsource>
|
||||
<translation>C/C++源代码文件 (*.c *.cpp *.cc *.cxx)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3471"/>
|
||||
<location filename="mainwindow.cpp" line="3492"/>
|
||||
<source>Save project</source>
|
||||
<translation>保存项目</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3472"/>
|
||||
<location filename="mainwindow.cpp" line="3493"/>
|
||||
<source>The project '%1' has modifications.</source>
|
||||
<translation>项目'%1'有改动。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3474"/>
|
||||
<location filename="mainwindow.cpp" line="5828"/>
|
||||
<location filename="mainwindow.cpp" line="3495"/>
|
||||
<location filename="mainwindow.cpp" line="5846"/>
|
||||
<source>Do you want to save it?</source>
|
||||
<translation>需要保存吗?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3561"/>
|
||||
<location filename="mainwindow.cpp" line="3572"/>
|
||||
<location filename="mainwindow.cpp" line="3582"/>
|
||||
<location filename="mainwindow.cpp" line="3593"/>
|
||||
<source>File Changed</source>
|
||||
<translation>文件已发生变化</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3631"/>
|
||||
<location filename="mainwindow.cpp" line="3652"/>
|
||||
<source>New Project File?</source>
|
||||
<translation>新建项目文件?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3632"/>
|
||||
<location filename="mainwindow.cpp" line="3653"/>
|
||||
<source>Do you want to add the new file to the project?</source>
|
||||
<translation>您是否要将新建的文件加入项目?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3708"/>
|
||||
<location filename="mainwindow.cpp" line="3718"/>
|
||||
<location filename="mainwindow.cpp" line="3730"/>
|
||||
<location filename="mainwindow.cpp" line="5877"/>
|
||||
<location filename="mainwindow.cpp" line="3729"/>
|
||||
<location filename="mainwindow.cpp" line="3739"/>
|
||||
<location filename="mainwindow.cpp" line="3751"/>
|
||||
<location filename="mainwindow.cpp" line="5899"/>
|
||||
<source>Save Error</source>
|
||||
<translation>保存失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3871"/>
|
||||
<location filename="mainwindow.cpp" line="3892"/>
|
||||
<source>Change Project Compiler Set</source>
|
||||
<translation>改变项目编译器配置集</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3872"/>
|
||||
<location filename="mainwindow.cpp" line="3893"/>
|
||||
<source>Change the project's compiler set will lose all custom compiler set options.</source>
|
||||
<translation>改变项目的编译器配置集会导致所有的自定义编译器选项被重置。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3874"/>
|
||||
<location filename="mainwindow.cpp" line="3895"/>
|
||||
<source>Do you really want to do that?</source>
|
||||
<translation>你真的想要做那些吗?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="4807"/>
|
||||
<location filename="mainwindow.cpp" line="4827"/>
|
||||
<source>Do you really want to clear all breakpoints in this file?</source>
|
||||
<translation>您真的要清除该文件的所有断点吗?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5005"/>
|
||||
<location filename="mainwindow.cpp" line="5025"/>
|
||||
<source>New project</source>
|
||||
<translation>新建项目</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5006"/>
|
||||
<location filename="mainwindow.cpp" line="5026"/>
|
||||
<source>Close %1 and start new project?</source>
|
||||
<translation>关闭'%1'以打开新项目?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5019"/>
|
||||
<location filename="mainwindow.cpp" line="5039"/>
|
||||
<source>Folder not exist</source>
|
||||
<translation>文件夹不存在</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5020"/>
|
||||
<location filename="mainwindow.cpp" line="5040"/>
|
||||
<source>Folder '%1' doesn't exist. Create it now?</source>
|
||||
<translation>文件夹'%1'不存在。是否创建?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5027"/>
|
||||
<location filename="mainwindow.cpp" line="5047"/>
|
||||
<source>Can't create folder</source>
|
||||
<translation>无法创建文件夹</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5028"/>
|
||||
<location filename="mainwindow.cpp" line="5048"/>
|
||||
<source>Failed to create folder '%1'.</source>
|
||||
<translation>创建文件夹'%1'失败。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5043"/>
|
||||
<location filename="mainwindow.cpp" line="5063"/>
|
||||
<source>Save new project as</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="6170"/>
|
||||
<location filename="mainwindow.cpp" line="6222"/>
|
||||
<location filename="mainwindow.cpp" line="6192"/>
|
||||
<location filename="mainwindow.cpp" line="6244"/>
|
||||
<source>Header Exists</source>
|
||||
<translation>头文件已存在</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="6171"/>
|
||||
<location filename="mainwindow.cpp" line="6223"/>
|
||||
<location filename="mainwindow.cpp" line="6193"/>
|
||||
<location filename="mainwindow.cpp" line="6245"/>
|
||||
<source>Header file "%1" already exists!</source>
|
||||
<translation>头文件"%1"已存在!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="6228"/>
|
||||
<location filename="mainwindow.cpp" line="6250"/>
|
||||
<source>Source Exists</source>
|
||||
<translation>源文件已存在!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="6229"/>
|
||||
<location filename="mainwindow.cpp" line="6251"/>
|
||||
<source>Source file "%1" already exists!</source>
|
||||
<translation>源文件"%1"已存在!</translation>
|
||||
</message>
|
||||
|
@ -4939,125 +4949,125 @@ Are you really want to continue?</oldsource>
|
|||
<translation type="vanished">小熊猫Dev-C++项目文件 (*.dev)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5056"/>
|
||||
<location filename="mainwindow.cpp" line="5076"/>
|
||||
<source>New project fail</source>
|
||||
<translation>新建项目失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5057"/>
|
||||
<location filename="mainwindow.cpp" line="5077"/>
|
||||
<source>Can't assign project template</source>
|
||||
<translation>无法使用模板创建项目</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5144"/>
|
||||
<location filename="mainwindow.cpp" line="5164"/>
|
||||
<source>Remove file</source>
|
||||
<translation>删除文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5145"/>
|
||||
<location filename="mainwindow.cpp" line="5165"/>
|
||||
<source>Remove the file from disk?</source>
|
||||
<translation>同时从硬盘上删除文件?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5334"/>
|
||||
<location filename="mainwindow.cpp" line="5354"/>
|
||||
<source>untitled</source>
|
||||
<translation>无标题</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5344"/>
|
||||
<location filename="mainwindow.cpp" line="5364"/>
|
||||
<source>New Project File Name</source>
|
||||
<translation>新的项目文件名</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5345"/>
|
||||
<location filename="mainwindow.cpp" line="5365"/>
|
||||
<source>File Name:</source>
|
||||
<translation>文件名:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5351"/>
|
||||
<location filename="mainwindow.cpp" line="5371"/>
|
||||
<source>File Already Exists!</source>
|
||||
<translation>文件已存在!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5352"/>
|
||||
<location filename="mainwindow.cpp" line="5372"/>
|
||||
<source>File '%1' already exists!</source>
|
||||
<translation>文件'%1'已经存在!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5101"/>
|
||||
<location filename="mainwindow.cpp" line="5121"/>
|
||||
<source>Add to project</source>
|
||||
<translation>添加到项目</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5045"/>
|
||||
<location filename="mainwindow.cpp" line="5065"/>
|
||||
<source>Red Panda C++ project file (*.dev)</source>
|
||||
<translation>小熊猫C++项目文件(*.dev)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5449"/>
|
||||
<location filename="mainwindow.cpp" line="5469"/>
|
||||
<source>Rename Error</source>
|
||||
<translation>重命名出错</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5450"/>
|
||||
<location filename="mainwindow.cpp" line="5470"/>
|
||||
<source>Symbol '%1' is defined in system header.</source>
|
||||
<translation>符号'%1'在系统头文件中定义,无法修改。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5464"/>
|
||||
<location filename="mainwindow.cpp" line="5484"/>
|
||||
<source>New Name</source>
|
||||
<translation>新名称</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5588"/>
|
||||
<location filename="mainwindow.cpp" line="5598"/>
|
||||
<location filename="mainwindow.cpp" line="5606"/>
|
||||
<location filename="mainwindow.cpp" line="5616"/>
|
||||
<source>Replace Error</source>
|
||||
<translation>替换出错</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5589"/>
|
||||
<location filename="mainwindow.cpp" line="5607"/>
|
||||
<source>Can't open file '%1' for replace!</source>
|
||||
<translation>无法打开文件'%1'进行替换!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5599"/>
|
||||
<location filename="mainwindow.cpp" line="5617"/>
|
||||
<source>Contents has changed since last search!</source>
|
||||
<translation>内容和上次查找时不一致。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5645"/>
|
||||
<location filename="mainwindow.cpp" line="5663"/>
|
||||
<source>Rich Text Format Files (*.rtf)</source>
|
||||
<translation>RTF格式文件 (*.rtf)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5667"/>
|
||||
<location filename="mainwindow.cpp" line="5685"/>
|
||||
<source>HTML Files (*.html)</source>
|
||||
<translation>HTML文件 (*.html)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5826"/>
|
||||
<location filename="mainwindow.cpp" line="5844"/>
|
||||
<source>The current problem set is not empty.</source>
|
||||
<translation>当前的试题集不是空的。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5844"/>
|
||||
<location filename="mainwindow.cpp" line="5862"/>
|
||||
<source>Problem %1</source>
|
||||
<translation>试题%1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5870"/>
|
||||
<location filename="mainwindow.cpp" line="5890"/>
|
||||
<location filename="mainwindow.cpp" line="5888"/>
|
||||
<location filename="mainwindow.cpp" line="5912"/>
|
||||
<source>Problem Set Files (*.pbs)</source>
|
||||
<translation>试题集文件 (*.pbs)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5896"/>
|
||||
<location filename="mainwindow.cpp" line="5918"/>
|
||||
<source>Load Error</source>
|
||||
<translation>载入失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3207"/>
|
||||
<location filename="mainwindow.cpp" line="5910"/>
|
||||
<location filename="mainwindow.cpp" line="3228"/>
|
||||
<location filename="mainwindow.cpp" line="5932"/>
|
||||
<source>Problem Case %1</source>
|
||||
<translation>试题案例%1</translation>
|
||||
</message>
|
||||
|
@ -5070,13 +5080,13 @@ Are you really want to continue?</oldsource>
|
|||
<location filename="mainwindow.cpp" line="248"/>
|
||||
<location filename="mainwindow.cpp" line="1025"/>
|
||||
<location filename="mainwindow.cpp" line="2142"/>
|
||||
<location filename="mainwindow.cpp" line="2749"/>
|
||||
<location filename="mainwindow.cpp" line="3568"/>
|
||||
<location filename="mainwindow.cpp" line="3666"/>
|
||||
<location filename="mainwindow.cpp" line="3840"/>
|
||||
<location filename="mainwindow.cpp" line="3852"/>
|
||||
<location filename="mainwindow.cpp" line="4254"/>
|
||||
<location filename="mainwindow.cpp" line="4266"/>
|
||||
<location filename="mainwindow.cpp" line="2763"/>
|
||||
<location filename="mainwindow.cpp" line="3589"/>
|
||||
<location filename="mainwindow.cpp" line="3687"/>
|
||||
<location filename="mainwindow.cpp" line="3861"/>
|
||||
<location filename="mainwindow.cpp" line="3873"/>
|
||||
<location filename="mainwindow.cpp" line="4274"/>
|
||||
<location filename="mainwindow.cpp" line="4286"/>
|
||||
<source>Error</source>
|
||||
<translation>错误</translation>
|
||||
</message>
|
||||
|
@ -5091,75 +5101,75 @@ Are you really want to continue?</oldsource>
|
|||
<translation>载入主题失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3562"/>
|
||||
<location filename="mainwindow.cpp" line="3583"/>
|
||||
<source>File '%1' was changed.</source>
|
||||
<translation>磁盘文件'%1'已被修改。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3562"/>
|
||||
<location filename="mainwindow.cpp" line="3583"/>
|
||||
<source>Reload its content from disk?</source>
|
||||
<translation>是否重新读取它的内容?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3573"/>
|
||||
<location filename="mainwindow.cpp" line="3594"/>
|
||||
<source>File '%1' was removed.</source>
|
||||
<translation>磁盘文件'%1'已被删除。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3573"/>
|
||||
<location filename="mainwindow.cpp" line="3594"/>
|
||||
<source>Keep it open?</source>
|
||||
<translation>是否保持它在小熊猫C++中打开的编辑窗口?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="3659"/>
|
||||
<location filename="mainwindow.cpp" line="3680"/>
|
||||
<source>Open</source>
|
||||
<translation>打开</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="4031"/>
|
||||
<location filename="mainwindow.cpp" line="4052"/>
|
||||
<source>Compile Failed</source>
|
||||
<translation>编译失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="4037"/>
|
||||
<location filename="mainwindow.cpp" line="4058"/>
|
||||
<source>Run Failed</source>
|
||||
<translation>运行失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="4283"/>
|
||||
<location filename="mainwindow.cpp" line="4297"/>
|
||||
<location filename="mainwindow.cpp" line="4303"/>
|
||||
<location filename="mainwindow.cpp" line="4317"/>
|
||||
<source>Confirm Convertion</source>
|
||||
<translation>确认转换</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="4284"/>
|
||||
<location filename="mainwindow.cpp" line="4298"/>
|
||||
<location filename="mainwindow.cpp" line="4304"/>
|
||||
<location filename="mainwindow.cpp" line="4318"/>
|
||||
<source>The editing file will be saved using %1 encoding. <br />This operation can't be reverted. <br />Are you sure to continue?</source>
|
||||
<translation>当前编辑器中的文件将会使用%1编码保存。<br />这项操作无法被撤回。<br />你确定要继续吗?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="4448"/>
|
||||
<location filename="mainwindow.cpp" line="4468"/>
|
||||
<source>New Watch Expression</source>
|
||||
<translation>新监视表达式</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="4449"/>
|
||||
<location filename="mainwindow.cpp" line="4469"/>
|
||||
<source>Enter Watch Expression (it is recommended to use 'this->' for class members):</source>
|
||||
<translation>输入监视表达式</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="4502"/>
|
||||
<location filename="mainwindow.cpp" line="4522"/>
|
||||
<source>Parsing file %1 of %2: "%3"</source>
|
||||
<translation>(%1/%2)正在解析文件"%3"</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="4524"/>
|
||||
<location filename="mainwindow.cpp" line="4530"/>
|
||||
<location filename="mainwindow.cpp" line="4544"/>
|
||||
<location filename="mainwindow.cpp" line="4550"/>
|
||||
<source>Done parsing %1 files in %2 seconds</source>
|
||||
<translation>完成%1个文件的解析,用时%2秒</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="4527"/>
|
||||
<location filename="mainwindow.cpp" line="4547"/>
|
||||
<source>(%1 files per second)</source>
|
||||
<translation>(每秒%1个文件)</translation>
|
||||
</message>
|
||||
|
@ -5325,22 +5335,22 @@ Are you really want to continue?</oldsource>
|
|||
<context>
|
||||
<name>OJProblemCasesRunner</name>
|
||||
<message>
|
||||
<location filename="compiler/ojproblemcasesrunner.cpp" line="125"/>
|
||||
<location filename="compiler/ojproblemcasesrunner.cpp" line="126"/>
|
||||
<source>The runner process '%1' failed to start.</source>
|
||||
<translation>无法启动程序运行进程'%1'。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="compiler/ojproblemcasesrunner.cpp" line="132"/>
|
||||
<location filename="compiler/ojproblemcasesrunner.cpp" line="133"/>
|
||||
<source>The last waitFor...() function timed out.</source>
|
||||
<translation>waitFor()函数等待超时。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="compiler/ojproblemcasesrunner.cpp" line="135"/>
|
||||
<location filename="compiler/ojproblemcasesrunner.cpp" line="136"/>
|
||||
<source>An error occurred when attempting to write to the runner process.</source>
|
||||
<translation>在向程序运行进程写入内容时出错。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="compiler/ojproblemcasesrunner.cpp" line="138"/>
|
||||
<location filename="compiler/ojproblemcasesrunner.cpp" line="139"/>
|
||||
<source>An error occurred when attempting to read from the runner process.</source>
|
||||
<translation>在从程序运行进程读取内容时出错。</translation>
|
||||
</message>
|
||||
|
@ -5391,83 +5401,98 @@ Are you really want to continue?</oldsource>
|
|||
<translation>找不到项目文件'%1'!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="252"/>
|
||||
<location filename="project.cpp" line="254"/>
|
||||
<source>untitled</source>
|
||||
<translation>无标题</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="521"/>
|
||||
<location filename="project.cpp" line="548"/>
|
||||
<source>Can't save file</source>
|
||||
<translation>无法保存文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="522"/>
|
||||
<location filename="project.cpp" line="549"/>
|
||||
<source>Can't save file '%1'</source>
|
||||
<translation>无法保存文件'%1'.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="714"/>
|
||||
<location filename="project.cpp" line="741"/>
|
||||
<source>Error Load File</source>
|
||||
<translation>载入文件错误</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="824"/>
|
||||
<location filename="project.cpp" line="853"/>
|
||||
<source>File Exists</source>
|
||||
<translation>文件已存在</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="825"/>
|
||||
<location filename="project.cpp" line="854"/>
|
||||
<source>File '%1' is already in the project</source>
|
||||
<translation>文件'%1'已在项目中</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1203"/>
|
||||
<location filename="project.cpp" line="1232"/>
|
||||
<source>Project Updated</source>
|
||||
<translation>项目已升级</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1204"/>
|
||||
<location filename="project.cpp" line="1233"/>
|
||||
<source>Your project was succesfully updated to a newer file format!</source>
|
||||
<translation>已成功将项目升级到新的格式</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1206"/>
|
||||
<location filename="project.cpp" line="1235"/>
|
||||
<source>If something has gone wrong, we kept a backup-file: '%1'...</source>
|
||||
<translation>旧项目文件备份在'%1'。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1369"/>
|
||||
<location filename="project.cpp" line="1279"/>
|
||||
<source>Headers</source>
|
||||
<translation>头文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1285"/>
|
||||
<source>Sources</source>
|
||||
<translation>源文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1291"/>
|
||||
<source>Others</source>
|
||||
<translation>其他文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1451"/>
|
||||
<source>Settings need update</source>
|
||||
<translation>设置需要更新</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1370"/>
|
||||
<location filename="project.cpp" line="1452"/>
|
||||
<source>The compiler settings format of Red Panda C++ has changed.</source>
|
||||
<oldsource>The compiler settings format of Dev-C++ has changed.</oldsource>
|
||||
<translation>小熊猫C++的编译器设置格式已发生改变。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1372"/>
|
||||
<location filename="project.cpp" line="1454"/>
|
||||
<source>Please update your settings at Project >> Project Options >> Compiler and save your project.</source>
|
||||
<translation>请在项目 >> 项目属性 >> 编译器设置中修改您的设置并保存您的项目</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1408"/>
|
||||
<location filename="project.cpp" line="1491"/>
|
||||
<source>Compiler not found</source>
|
||||
<translation>未找到编译器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1409"/>
|
||||
<location filename="project.cpp" line="1492"/>
|
||||
<source>The compiler set you have selected for this project, no longer exists.</source>
|
||||
<translation>您为该项目设置的编译器不存在。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1411"/>
|
||||
<location filename="project.cpp" line="1494"/>
|
||||
<source>It will be substituted by the global compiler set.</source>
|
||||
<translation>它将会被全局编译器设置代替。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1450"/>
|
||||
<location filename="project.cpp" line="1533"/>
|
||||
<source>Developed using the Red Panda C++ IDE</source>
|
||||
<oldsource>Developed using the Red Panda Dev-C++ IDE</oldsource>
|
||||
<translation>使用小熊猫C++编辑器开发</translation>
|
||||
|
@ -5696,12 +5721,12 @@ Are you really want to continue?</oldsource>
|
|||
<translation>自定义构建命令</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/projectfileswidget.cpp" line="251"/>
|
||||
<location filename="settingsdialog/projectfileswidget.cpp" line="250"/>
|
||||
<source>Auto detect</source>
|
||||
<translation>自动检测</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/projectfileswidget.cpp" line="252"/>
|
||||
<location filename="settingsdialog/projectfileswidget.cpp" line="251"/>
|
||||
<source>ANSI</source>
|
||||
<translation>ANSI</translation>
|
||||
</message>
|
||||
|
@ -5710,7 +5735,7 @@ Are you really want to continue?</oldsource>
|
|||
<translation type="vanished">ANSI</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/projectfileswidget.cpp" line="253"/>
|
||||
<location filename="settingsdialog/projectfileswidget.cpp" line="252"/>
|
||||
<source>UTF-8</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
|
@ -5874,24 +5899,24 @@ Are you really want to continue?</oldsource>
|
|||
<context>
|
||||
<name>ProjectModel</name>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1967"/>
|
||||
<location filename="project.cpp" line="2050"/>
|
||||
<source>File exists</source>
|
||||
<translation>文件已存在</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1968"/>
|
||||
<location filename="project.cpp" line="2051"/>
|
||||
<source>File '%1' already exists. Delete it now?</source>
|
||||
<translation>文件'%1'已存在。是否删除?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1986"/>
|
||||
<location filename="project.cpp" line="2006"/>
|
||||
<location filename="project.cpp" line="2069"/>
|
||||
<location filename="project.cpp" line="2089"/>
|
||||
<source>Remove failed</source>
|
||||
<translation>删除失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="project.cpp" line="1987"/>
|
||||
<location filename="project.cpp" line="2007"/>
|
||||
<location filename="project.cpp" line="2070"/>
|
||||
<location filename="project.cpp" line="2090"/>
|
||||
<source>Failed to remove file '%1'</source>
|
||||
<translation>无法删除文件'%1'</translation>
|
||||
</message>
|
||||
|
@ -7273,7 +7298,7 @@ Are you really want to continue?</oldsource>
|
|||
<translation>自动链接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5815"/>
|
||||
<location filename="mainwindow.cpp" line="5833"/>
|
||||
<location filename="settingsdialog/settingsdialog.cpp" line="169"/>
|
||||
<location filename="settingsdialog/settingsdialog.cpp" line="202"/>
|
||||
<location filename="settingsdialog/settingsdialog.cpp" line="208"/>
|
||||
|
@ -7349,15 +7374,15 @@ Are you really want to continue?</oldsource>
|
|||
<translation>杂项</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="5816"/>
|
||||
<location filename="mainwindow.cpp" line="6125"/>
|
||||
<location filename="mainwindow.cpp" line="5834"/>
|
||||
<location filename="mainwindow.cpp" line="6147"/>
|
||||
<location filename="settingsdialog/settingsdialog.cpp" line="202"/>
|
||||
<location filename="settingsdialog/settingsdialog.cpp" line="205"/>
|
||||
<source>Program Runner</source>
|
||||
<translation>程序运行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="6124"/>
|
||||
<location filename="mainwindow.cpp" line="6146"/>
|
||||
<location filename="settingsdialog/settingsdialog.cpp" line="205"/>
|
||||
<source>Problem Set</source>
|
||||
<translation>试题集</translation>
|
||||
|
|
|
@ -314,7 +314,7 @@ QList<PIconSet> IconsManager::listIconSets()
|
|||
while(dirIter.hasNext()) {
|
||||
dirIter.next();
|
||||
QFileInfo fileInfo = dirIter.fileInfo();
|
||||
if (!fileInfo.isHidden() && fileInfo.isDir()) {
|
||||
if (!fileInfo.isHidden() && !fileInfo.fileName().startsWith('.') && fileInfo.isDir()) {
|
||||
PIconSet pSet = std::make_shared<IconSet>();
|
||||
pSet->name = fileInfo.baseName();
|
||||
pSet->displayName = pSet->name;
|
||||
|
|
|
@ -285,7 +285,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
//files view
|
||||
ui->treeFiles->setModel(&mFileSystemModel);
|
||||
mFileSystemModel.setReadOnly(true);
|
||||
mFileSystemModel.setReadOnly(false);
|
||||
setFilesViewRoot(pSettings->environment().currentFolder());
|
||||
for (int i=1;i<mFileSystemModel.columnCount();i++) {
|
||||
ui->treeFiles->hideColumn(i);
|
||||
|
@ -2468,8 +2468,8 @@ void MainWindow::buildContextMenus()
|
|||
if (!current.isValid()) {
|
||||
return;
|
||||
}
|
||||
FolderNode * node = static_cast<FolderNode*>(current.internalPointer());
|
||||
PFolderNode folderNode = mProject->pointerToNode(node);
|
||||
ProjectModelNode * node = static_cast<ProjectModelNode*>(current.internalPointer());
|
||||
PProjectModelNode folderNode = mProject->pointerToNode(node);
|
||||
if (!folderNode)
|
||||
folderNode = mProject->rootNode();
|
||||
if (folderNode->unitIndex>=0)
|
||||
|
@ -2511,8 +2511,8 @@ void MainWindow::buildContextMenus()
|
|||
if (!current.isValid()) {
|
||||
return;
|
||||
}
|
||||
FolderNode * node = static_cast<FolderNode*>(current.internalPointer());
|
||||
PFolderNode folderNode = mProject->pointerToNode(node);
|
||||
ProjectModelNode * node = static_cast<ProjectModelNode*>(current.internalPointer());
|
||||
PProjectModelNode folderNode = mProject->pointerToNode(node);
|
||||
if (!folderNode)
|
||||
return;
|
||||
if (folderNode->unitIndex>=0)
|
||||
|
@ -2520,6 +2520,20 @@ void MainWindow::buildContextMenus()
|
|||
mProject->removeFolder(folderNode);
|
||||
mProject->saveOptions();
|
||||
});
|
||||
mProject_SwitchFileSystemViewMode = createActionFor(
|
||||
tr("Switch to normal view"),
|
||||
ui->projectView);
|
||||
connect(mProject_SwitchFileSystemViewMode, &QAction::triggered,
|
||||
[this](){
|
||||
mProject->setModelType(ProjectModelType::FileSystem);
|
||||
});
|
||||
mProject_SwitchCustomViewMode = createActionFor(
|
||||
tr("Switch to custom view"),
|
||||
ui->projectView);
|
||||
connect(mProject_SwitchCustomViewMode, &QAction::triggered,
|
||||
[this](){
|
||||
mProject->setModelType(ProjectModelType::Custom);
|
||||
});
|
||||
|
||||
//context menu signal for class browser
|
||||
ui->tabStructure->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
@ -2635,6 +2649,18 @@ void MainWindow::buildContextMenus()
|
|||
ui->treeFiles->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(ui->treeFiles,&QWidget::customContextMenuRequested,
|
||||
this, &MainWindow::onFilesViewContextMenu);
|
||||
|
||||
mFilesView_CreateFolder = createActionFor(
|
||||
tr("New Folder"),
|
||||
ui->treeFiles);
|
||||
connect(mFilesView_CreateFolder, &QAction::triggered,
|
||||
this, &MainWindow::onFilesViewCreateFolder);
|
||||
mFilesView_RemoveFile = createActionFor(
|
||||
tr("Delete"),
|
||||
ui->treeFiles);
|
||||
mFilesView_RemoveFile->setShortcut(Qt::Key_Delete);
|
||||
connect(mFilesView_RemoveFile, &QAction::triggered,
|
||||
this, &MainWindow::onFilesViewRemoveFiles);
|
||||
mFilesView_Open = createActionFor(
|
||||
tr("Open in Editor"),
|
||||
ui->treeFiles);
|
||||
|
@ -2900,8 +2926,8 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos)
|
|||
int unitIndex = -1;
|
||||
QModelIndex current = mProjectProxyModel->mapToSource(ui->projectView->selectionModel()->currentIndex());
|
||||
if (current.isValid() && mProject) {
|
||||
FolderNode * node = static_cast<FolderNode*>(current.internalPointer());
|
||||
PFolderNode pNode = mProject->pointerToNode(node);
|
||||
ProjectModelNode * node = static_cast<ProjectModelNode*>(current.internalPointer());
|
||||
PProjectModelNode pNode = mProject->pointerToNode(node);
|
||||
if (pNode) {
|
||||
unitIndex = pNode->unitIndex;
|
||||
onFolder = (unitIndex<0);
|
||||
|
@ -2928,7 +2954,7 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos)
|
|||
menu.addAction(mProject_Rename_Unit);
|
||||
}
|
||||
menu.addSeparator();
|
||||
if (onFolder) {
|
||||
if (onFolder && mProject->modelType()==ProjectModelType::Custom) {
|
||||
menu.addAction(mProject_Add_Folder);
|
||||
if (!onRoot) {
|
||||
menu.addAction(mProject_Rename_Folder);
|
||||
|
@ -2941,6 +2967,11 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos)
|
|||
menu.addAction(ui->actionProject_Open_Folder_In_Explorer);
|
||||
menu.addAction(ui->actionProject_Open_In_Terminal);
|
||||
menu.addSeparator();
|
||||
if (mProject->modelType() == ProjectModelType::Custom) {
|
||||
menu.addAction(mProject_SwitchFileSystemViewMode);
|
||||
} else {
|
||||
menu.addAction(mProject_SwitchCustomViewMode);
|
||||
}
|
||||
menu.addAction(ui->actionProject_options);
|
||||
|
||||
menu.exec(ui->projectView->mapToGlobal(pos));
|
||||
|
@ -3000,6 +3031,8 @@ void MainWindow::onFilesViewContextMenu(const QPoint &pos)
|
|||
QMenu menu(this);
|
||||
menu.addAction(ui->actionOpen_Folder);
|
||||
menu.addSeparator();
|
||||
menu.addAction(mFilesView_CreateFolder);
|
||||
menu.addSeparator();
|
||||
menu.addAction(mFilesView_Open);
|
||||
menu.addAction(mFilesView_OpenWithExternal);
|
||||
menu.addSeparator();
|
||||
|
@ -3276,6 +3309,48 @@ void MainWindow::onShowInsertCodeSnippetMenu()
|
|||
|
||||
}
|
||||
|
||||
void MainWindow::onFilesViewCreateFolder()
|
||||
{
|
||||
QModelIndex index = ui->treeFiles->currentIndex();
|
||||
QDir dir;
|
||||
if (index.isValid()) {
|
||||
if (mFileSystemModel.isDir(index))
|
||||
dir = QDir(mFileSystemModel.fileInfo(index).absoluteFilePath());
|
||||
else
|
||||
dir = mFileSystemModel.fileInfo(index).absoluteDir();
|
||||
} else {
|
||||
dir = mFileSystemModel.rootDirectory();
|
||||
}
|
||||
QString folderName = tr("New Folder");
|
||||
int count = 0;
|
||||
while (dir.exists(folderName)) {
|
||||
count++;
|
||||
folderName = tr("New Folder").arg(count);
|
||||
}
|
||||
mFileSystemModel.mkdir(index,folderName);
|
||||
}
|
||||
|
||||
void MainWindow::onFilesViewRemoveFiles()
|
||||
{
|
||||
QModelIndexList indexList = ui->treeFiles->selectionModel()->selectedRows();
|
||||
if (indexList.isEmpty()) {
|
||||
QModelIndex index = ui->treeFiles->currentIndex();
|
||||
if (QMessageBox::question(ui->treeFiles,tr("Delete")
|
||||
,tr("Do you really want to delete %1?").arg(mFileSystemModel.fileName(index)),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No)!=QMessageBox::Yes)
|
||||
return;
|
||||
doFilesViewRemoveFile(index);
|
||||
} else {
|
||||
if (QMessageBox::question(ui->treeFiles,tr("Delete")
|
||||
,tr("Do you really want to delete %1 files?").arg(indexList.count()),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No)!=QMessageBox::Yes)
|
||||
return;
|
||||
foreach (const QModelIndex& index, indexList) {
|
||||
doFilesViewRemoveFile(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onEditorContextMenu(const QPoint& pos)
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
|
@ -4096,7 +4171,7 @@ void MainWindow::onOJProblemCaseFinished(const QString& id, int current, int tot
|
|||
updateProblemTitle();
|
||||
}
|
||||
|
||||
void MainWindow::onOJProblemCaseNewOutputGetted(const QString &id, const QString &line)
|
||||
void MainWindow::onOJProblemCaseNewOutputGetted(const QString &/* id */, const QString &line)
|
||||
{
|
||||
ui->txtProblemCaseOutput->appendPlainText(line);
|
||||
}
|
||||
|
@ -4953,7 +5028,7 @@ void MainWindow::on_projectView_doubleClicked(const QModelIndex &index)
|
|||
QModelIndex sourceIndex = mProjectProxyModel->mapToSource(index);
|
||||
if (!sourceIndex.isValid())
|
||||
return;
|
||||
FolderNode * node = static_cast<FolderNode*>(sourceIndex.internalPointer());
|
||||
ProjectModelNode * node = static_cast<ProjectModelNode*>(sourceIndex.internalPointer());
|
||||
if (!node)
|
||||
return;
|
||||
if (node->unitIndex>=0) {
|
||||
|
@ -5106,11 +5181,11 @@ void MainWindow::on_actionAdd_to_project_triggered()
|
|||
dialog.setAcceptMode(QFileDialog::AcceptOpen);
|
||||
if (dialog.exec()) {
|
||||
QModelIndex current = mProjectProxyModel->mapToSource(ui->projectView->currentIndex());
|
||||
FolderNode * node = nullptr;
|
||||
ProjectModelNode * node = nullptr;
|
||||
if (current.isValid()) {
|
||||
node = static_cast<FolderNode*>(current.internalPointer());
|
||||
node = static_cast<ProjectModelNode*>(current.internalPointer());
|
||||
}
|
||||
PFolderNode folderNode = mProject->pointerToNode(node);
|
||||
PProjectModelNode folderNode = mProject->pointerToNode(node);
|
||||
foreach (const QString& filename, dialog.selectedFiles()) {
|
||||
mProject->addUnit(filename,folderNode,false);
|
||||
mProject->cppParser()->addFileToScan(filename);
|
||||
|
@ -5135,8 +5210,8 @@ void MainWindow::on_actionRemove_from_project_triggered()
|
|||
if (!index.isValid())
|
||||
continue;
|
||||
QModelIndex realIndex = mProjectProxyModel->mapToSource(index);
|
||||
FolderNode * node = static_cast<FolderNode*>(realIndex.internalPointer());
|
||||
PFolderNode folderNode = mProject->pointerToNode(node);
|
||||
ProjectModelNode * node = static_cast<ProjectModelNode*>(realIndex.internalPointer());
|
||||
PProjectModelNode folderNode = mProject->pointerToNode(node);
|
||||
if (!folderNode)
|
||||
continue;
|
||||
selected.insert(folderNode->unitIndex);
|
||||
|
@ -5326,9 +5401,9 @@ void MainWindow::newProjectUnitFile()
|
|||
return;
|
||||
int idx = -1;
|
||||
QModelIndex current = mProjectProxyModel->mapToSource(ui->projectView->currentIndex());
|
||||
FolderNode * node = nullptr;
|
||||
ProjectModelNode * node = nullptr;
|
||||
if (current.isValid()) {
|
||||
node = static_cast<FolderNode*>(current.internalPointer());
|
||||
node = static_cast<ProjectModelNode*>(current.internalPointer());
|
||||
}
|
||||
QString newFileName;
|
||||
do {
|
||||
|
@ -5364,6 +5439,25 @@ void MainWindow::newProjectUnitFile()
|
|||
editor->activate();
|
||||
}
|
||||
|
||||
void MainWindow::doFilesViewRemoveFile(const QModelIndex &index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
if (mFileSystemModel.isDir(index)) {
|
||||
QDir dir(mFileSystemModel.fileInfo(index).absoluteFilePath());
|
||||
if (!dir.isEmpty() &&
|
||||
QMessageBox::question(ui->treeFiles
|
||||
,tr("Delete")
|
||||
,tr("Folder %1 is not empty.").arg(mFileSystemModel.fileName(index))
|
||||
+ tr("Do you really want to delete it?"),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No)!=QMessageBox::Yes)
|
||||
return;
|
||||
dir.removeRecursively();
|
||||
} else {
|
||||
QFile::remove(mFileSystemModel.filePath(index));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::invalidateProjectProxyModel()
|
||||
{
|
||||
mProjectProxyModel->invalidate();
|
||||
|
|
|
@ -248,6 +248,8 @@ private:
|
|||
void prepareTabMessagesData();
|
||||
void newProjectUnitFile();
|
||||
|
||||
void doFilesViewRemoveFile(const QModelIndex& index);
|
||||
|
||||
private slots:
|
||||
void invalidateProjectProxyModel();
|
||||
void onEditorRenamed(const QString& oldFilename, const QString& newFilename, bool firstSave);
|
||||
|
@ -274,6 +276,9 @@ private slots:
|
|||
|
||||
void onShowInsertCodeSnippetMenu();
|
||||
|
||||
void onFilesViewCreateFolder();
|
||||
void onFilesViewRemoveFiles();
|
||||
|
||||
void on_actionNew_triggered();
|
||||
|
||||
void on_EditorTabsLeft_tabCloseRequested(int index);
|
||||
|
@ -650,6 +655,8 @@ private:
|
|||
QAction * mProject_Rename_Unit;
|
||||
QAction * mProject_Rename_Folder;
|
||||
QAction * mProject_Remove_Folder;
|
||||
QAction * mProject_SwitchFileSystemViewMode;
|
||||
QAction * mProject_SwitchCustomViewMode;
|
||||
|
||||
//actions for class browser
|
||||
QAction * mClassBrowser_Sort_By_Type;
|
||||
|
@ -665,6 +672,8 @@ private:
|
|||
QAction * mFilesView_OpenInTerminal;
|
||||
QAction * mFilesView_OpenInExplorer;
|
||||
QWidget * mFilesViewToolbar;
|
||||
QAction * mFilesView_CreateFolder;
|
||||
QAction * mFilesView_RemoveFile;
|
||||
|
||||
//action for debug console
|
||||
QAction * mDebugConsole_ShowDetailLog;
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
<enum>QTabWidget::West</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="usesScrollButtons">
|
||||
<bool>true</bool>
|
||||
|
@ -258,8 +258,17 @@
|
|||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
|
||||
</property>
|
||||
<property name="dragEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::DragOnly</enum>
|
||||
<enum>QAbstractItemView::DragDrop</enum>
|
||||
</property>
|
||||
<property name="defaultDropAction">
|
||||
<enum>Qt::CopyAction</enum>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -56,7 +56,7 @@ Project::Project(const QString &filename, const QString &name, QObject *parent)
|
|||
ini.SetValue("Project","filename", toByteArray(extractRelativePath(directory(),mFilename)));
|
||||
ini.SetValue("Project","name", toByteArray(mName));
|
||||
ini.SaveFile(mFilename.toLocal8Bit());
|
||||
mNode = makeProjectNode();
|
||||
mRootNode = makeProjectNode();
|
||||
}
|
||||
resetCppParser(mParser,mOptions.compilerSet);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ void Project::open()
|
|||
ini.LoadFile(mFilename.toLocal8Bit());
|
||||
loadOptions(ini);
|
||||
|
||||
mNode = makeProjectNode();
|
||||
mRootNode = makeProjectNode();
|
||||
|
||||
checkProjectFileForUpdate(ini);
|
||||
int uCount = ini.GetLongValue("Project","UnitCount",0);
|
||||
|
@ -207,11 +207,11 @@ void Project::setModified(bool value)
|
|||
}
|
||||
}
|
||||
|
||||
PFolderNode Project::makeNewFileNode(const QString &s, bool isFolder, PFolderNode newParent)
|
||||
PProjectModelNode Project::makeNewFileNode(const QString &s, bool isFolder, PProjectModelNode newParent)
|
||||
{
|
||||
PFolderNode node = std::make_shared<FolderNode>();
|
||||
PProjectModelNode node = std::make_shared<ProjectModelNode>();
|
||||
if (!newParent) {
|
||||
newParent = mNode;
|
||||
newParent = mRootNode;
|
||||
}
|
||||
newParent->children.append(node);
|
||||
node->parent = newParent;
|
||||
|
@ -219,30 +219,32 @@ PFolderNode Project::makeNewFileNode(const QString &s, bool isFolder, PFolderNod
|
|||
if (newParent) {
|
||||
node->level = newParent->level+1;
|
||||
}
|
||||
if (isFolder)
|
||||
if (isFolder) {
|
||||
node->unitIndex = -1;
|
||||
node->priority = 0;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
PFolderNode Project::makeProjectNode()
|
||||
PProjectModelNode Project::makeProjectNode()
|
||||
{
|
||||
PFolderNode node = std::make_shared<FolderNode>();
|
||||
PProjectModelNode node = std::make_shared<ProjectModelNode>();
|
||||
node->text = mName;
|
||||
node->level = 0;
|
||||
node->unitIndex = -1;
|
||||
return node;
|
||||
}
|
||||
|
||||
PProjectUnit Project::newUnit(PFolderNode parentNode, const QString& customFileName)
|
||||
PProjectUnit Project::newUnit(PProjectModelNode parentNode, const QString& customFileName)
|
||||
{
|
||||
PProjectUnit newUnit = std::make_shared<ProjectUnit>(this);
|
||||
|
||||
// Select folder to add unit to
|
||||
if (!parentNode)
|
||||
parentNode = mNode; // project root node
|
||||
parentNode = mRootNode; // project root node
|
||||
|
||||
if (parentNode->unitIndex>=0) { //it's a file
|
||||
parentNode = mNode;
|
||||
parentNode = mRootNode;
|
||||
}
|
||||
QString s;
|
||||
QDir dir(directory());
|
||||
|
@ -309,25 +311,49 @@ Editor *Project::openUnit(int index)
|
|||
|
||||
void Project::rebuildNodes()
|
||||
{
|
||||
|
||||
mModel.beginUpdate();
|
||||
// Delete everything
|
||||
mNode->children.clear();
|
||||
mRootNode->children.clear();
|
||||
mFolderNodes.clear();
|
||||
mSpecialNodes.clear();
|
||||
mFileSystemFolderNodes.clear();
|
||||
|
||||
// Recreate everything
|
||||
switch(mOptions.modelType) {
|
||||
case ProjectModelType::Custom:
|
||||
createFolderNodes();
|
||||
|
||||
for (int idx=0;idx<mUnits.count();idx++) {
|
||||
QFileInfo fileInfo(mUnits[idx]->fileName());
|
||||
mUnits[idx]->setNode(
|
||||
makeNewFileNode(
|
||||
extractRelativePath(filename(),mUnits[idx]->fileName()),
|
||||
fileInfo.fileName(),
|
||||
false,
|
||||
folderNodeFromName(mUnits[idx]->folder())
|
||||
)
|
||||
);
|
||||
mUnits[idx]->node()->unitIndex = idx;
|
||||
mUnits[idx]->node()->priority = mUnits[idx]->priority();
|
||||
}
|
||||
break;
|
||||
case ProjectModelType::FileSystem:
|
||||
createFileSystemFolderNodes();
|
||||
|
||||
for (int idx=0;idx<mUnits.count();idx++) {
|
||||
QFileInfo fileInfo(mUnits[idx]->fileName());
|
||||
mUnits[idx]->setNode(
|
||||
makeNewFileNode(
|
||||
fileInfo.fileName(),
|
||||
false,
|
||||
getParentFolderNode(
|
||||
mUnits[idx]->fileName())
|
||||
)
|
||||
);
|
||||
mUnits[idx]->node()->unitIndex = idx;
|
||||
mUnits[idx]->node()->priority = mUnits[idx]->priority();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
mModel.endUpdate();
|
||||
emit nodesChanged();
|
||||
|
@ -358,8 +384,8 @@ bool Project::removeUnit(int index, bool doClose , bool removeFile)
|
|||
}
|
||||
|
||||
//if not fUnits.GetItem(index).fNew then
|
||||
PFolderNode node = unit->node();
|
||||
PFolderNode parent = node->parent.lock();
|
||||
PProjectModelNode node = unit->node();
|
||||
PProjectModelNode parent = node->parent.lock();
|
||||
if (parent) {
|
||||
parent->children.removeAll(node);
|
||||
}
|
||||
|
@ -369,7 +395,7 @@ bool Project::removeUnit(int index, bool doClose , bool removeFile)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Project::removeFolder(PFolderNode node)
|
||||
bool Project::removeFolder(PProjectModelNode node)
|
||||
{
|
||||
mModel.beginUpdate();
|
||||
auto action = finally([this]{
|
||||
|
@ -611,7 +637,7 @@ void Project::setCompilerOption(const QString &optionString, char value)
|
|||
void Project::updateFolders()
|
||||
{
|
||||
mFolders.clear();
|
||||
updateFolderNode(mNode);
|
||||
updateFolderNode(mRootNode);
|
||||
for (int idx = 0; idx < mUnits.count();idx++)
|
||||
mUnits[idx]->setFolder(
|
||||
getFolderPath(
|
||||
|
@ -627,21 +653,21 @@ void Project::updateNodeIndexes()
|
|||
mUnits[idx]->node()->unitIndex = idx;
|
||||
}
|
||||
|
||||
PFolderNode Project::pointerToNode(FolderNode *p, PFolderNode parent)
|
||||
PProjectModelNode Project::pointerToNode(ProjectModelNode *p, PProjectModelNode parent)
|
||||
{
|
||||
if (!parent) {
|
||||
parent = mNode;
|
||||
parent = mRootNode;
|
||||
}
|
||||
if (p==mNode.get())
|
||||
return mNode;
|
||||
foreach (const PFolderNode& node , parent->children) {
|
||||
if (p==mRootNode.get())
|
||||
return mRootNode;
|
||||
foreach (const PProjectModelNode& node , parent->children) {
|
||||
if (node.get()==p)
|
||||
return node;
|
||||
PFolderNode result = pointerToNode(p,node);
|
||||
PProjectModelNode result = pointerToNode(p,node);
|
||||
if (result)
|
||||
return result;
|
||||
}
|
||||
return PFolderNode();
|
||||
return PProjectModelNode();
|
||||
}
|
||||
|
||||
void Project::setCompilerSet(int compilerSetIndex)
|
||||
|
@ -687,16 +713,16 @@ bool Project::assignTemplate(const std::shared_ptr<ProjectTemplate> aTemplate, b
|
|||
QFile::copy(
|
||||
QDir(pSettings->dirs().templateDir()).absoluteFilePath(templateUnit->Source),
|
||||
includeTrailingPathDelimiter(this->directory())+target);
|
||||
unit = newUnit(mNode, target);
|
||||
unit = newUnit(mRootNode, target);
|
||||
} else {
|
||||
QString s;
|
||||
PProjectUnit unit;
|
||||
if (mOptions.isCpp) {
|
||||
s = templateUnit->CppText;
|
||||
unit = newUnit(mNode, templateUnit->CppName);
|
||||
unit = newUnit(mRootNode, templateUnit->CppName);
|
||||
} else {
|
||||
s = templateUnit->CText;
|
||||
unit = newUnit(mNode,templateUnit->CName);
|
||||
unit = newUnit(mRootNode,templateUnit->CName);
|
||||
}
|
||||
|
||||
Editor * editor = pMainWindow->editorList()->newEditor(
|
||||
|
@ -724,6 +750,7 @@ bool Project::assignTemplate(const std::shared_ptr<ProjectTemplate> aTemplate, b
|
|||
}
|
||||
}
|
||||
}
|
||||
rebuildNodes();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -767,6 +794,7 @@ void Project::saveOptions()
|
|||
ini.SetLongValue("Project","StaticLink", mOptions.staticLink);
|
||||
ini.SetLongValue("Project","AddCharset", mOptions.addCharset);
|
||||
ini.SetValue("Project","Encoding",toByteArray(mOptions.encoding));
|
||||
ini.SetLongValue("Project","ModelType", (int)mOptions.modelType);
|
||||
//for Red Panda Dev C++ 6 compatibility
|
||||
ini.SetLongValue("Project","UseUTF8",mOptions.encoding == ENCODING_UTF8);
|
||||
|
||||
|
@ -815,7 +843,7 @@ void Project::addFolder(const QString &s)
|
|||
}
|
||||
}
|
||||
|
||||
PProjectUnit Project::addUnit(const QString &inFileName, PFolderNode parentNode, bool rebuild)
|
||||
PProjectUnit Project::addUnit(const QString &inFileName, PProjectModelNode parentNode, bool rebuild)
|
||||
{
|
||||
PProjectUnit newUnit;
|
||||
// Don't add if it already exists
|
||||
|
@ -1221,13 +1249,12 @@ void Project::closeUnit(int index)
|
|||
|
||||
void Project::createFolderNodes()
|
||||
{
|
||||
mFolderNodes.clear();
|
||||
for (int idx=0;idx<mFolders.count();idx++) {
|
||||
PFolderNode node = mNode;
|
||||
PProjectModelNode node = mRootNode;
|
||||
QString s = mFolders[idx];
|
||||
int i = s.indexOf('/');
|
||||
while (i>=0) {
|
||||
PFolderNode findnode;
|
||||
PProjectModelNode findnode;
|
||||
for (int c=0;c<node->children.count();c++) {
|
||||
if (node->children[c]->text == s.mid(0,i))
|
||||
findnode = node->children[c];
|
||||
|
@ -1246,6 +1273,43 @@ void Project::createFolderNodes()
|
|||
}
|
||||
}
|
||||
|
||||
void Project::createFileSystemFolderNodes()
|
||||
{
|
||||
PProjectModelNode node = makeNewFileNode(tr("Headers"),true,mRootNode);
|
||||
createFileSystemFolderNode(ProjectSpecialFolderNode::HEADERS,folder(),node);
|
||||
node->priority = 1000;
|
||||
mFolderNodes.append(node);
|
||||
mSpecialNodes.insert(ProjectSpecialFolderNode::HEADERS,node);
|
||||
|
||||
node = makeNewFileNode(tr("Sources"),true,mRootNode);
|
||||
createFileSystemFolderNode(ProjectSpecialFolderNode::SOURCES,folder(),node);
|
||||
node->priority = 900;
|
||||
mFolderNodes.append(node);
|
||||
mSpecialNodes.insert(ProjectSpecialFolderNode::SOURCES,node);
|
||||
|
||||
node = makeNewFileNode(tr("Others"),true,mRootNode);
|
||||
createFileSystemFolderNode(ProjectSpecialFolderNode::OTHERS,folder(),node);
|
||||
node->priority = 800;
|
||||
mFolderNodes.append(node);
|
||||
mSpecialNodes.insert(ProjectSpecialFolderNode::OTHERS,node);
|
||||
}
|
||||
|
||||
void Project::createFileSystemFolderNode(ProjectSpecialFolderNode folderType, const QString &folderName, PProjectModelNode parent)
|
||||
{
|
||||
QDirIterator iter(folderName);
|
||||
while (iter.hasNext()) {
|
||||
iter.next();
|
||||
QFileInfo fileInfo = iter.fileInfo();
|
||||
if (fileInfo.isHidden() || fileInfo.fileName().startsWith('.'))
|
||||
continue;
|
||||
if (fileInfo.isDir()) {
|
||||
PProjectModelNode node = makeNewFileNode(fileInfo.fileName(),true,parent);
|
||||
mFileSystemFolderNodes.insert(QString("%1/%2").arg((int)folderType).arg(fileInfo.absolutePath()),node);
|
||||
createFileSystemFolderNode(folderType,fileInfo.path(), node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Project::doAutoOpen()
|
||||
{
|
||||
loadLayout();
|
||||
|
@ -1260,13 +1324,25 @@ bool Project::fileAlreadyExists(const QString &s)
|
|||
return false;
|
||||
}
|
||||
|
||||
PFolderNode Project::folderNodeFromName(const QString &name)
|
||||
PProjectModelNode Project::findFolderNode(const QString &folderPath, ProjectSpecialFolderNode nodeType)
|
||||
{
|
||||
PProjectModelNode node = mFileSystemFolderNodes.value(QString("%1/%2").arg((int)nodeType).arg(folderPath),
|
||||
PProjectModelNode());
|
||||
if (node)
|
||||
return node;
|
||||
PProjectModelNode parentNode = mSpecialNodes.value(nodeType,PProjectModelNode());
|
||||
if (parentNode)
|
||||
return parentNode;
|
||||
return mRootNode;
|
||||
}
|
||||
|
||||
PProjectModelNode Project::folderNodeFromName(const QString &name)
|
||||
{
|
||||
int index = mFolders.indexOf(name);
|
||||
if (index>=0) {
|
||||
return mFolderNodes[index];
|
||||
}
|
||||
return mNode;
|
||||
return mRootNode;
|
||||
}
|
||||
|
||||
char Project::getCompilerOption(const QString &optionString)
|
||||
|
@ -1282,7 +1358,7 @@ char Project::getCompilerOption(const QString &optionString)
|
|||
return '0';
|
||||
}
|
||||
|
||||
QString Project::getFolderPath(PFolderNode node)
|
||||
QString Project::getFolderPath(PProjectModelNode node)
|
||||
{
|
||||
QString result;
|
||||
if (!node)
|
||||
|
@ -1291,8 +1367,8 @@ QString Project::getFolderPath(PFolderNode node)
|
|||
if (node->unitIndex>=0) // not a folder
|
||||
return result;
|
||||
|
||||
PFolderNode p = node;
|
||||
while (p && p->unitIndex==-1 && p!=mNode) {
|
||||
PProjectModelNode p = node;
|
||||
while (p && p->unitIndex==-1 && p!=mRootNode) {
|
||||
if (!result.isEmpty())
|
||||
result = p->text + "/" + result;
|
||||
else
|
||||
|
@ -1307,6 +1383,20 @@ int Project::getUnitFromString(const QString &s)
|
|||
return indexInUnits(s);
|
||||
}
|
||||
|
||||
PProjectModelNode Project::getParentFolderNode(const QString &filename)
|
||||
{
|
||||
QFileInfo fileInfo(filename);
|
||||
ProjectSpecialFolderNode folderNodeType;
|
||||
if (isHfile(fileInfo.fileName())) {
|
||||
folderNodeType = ProjectSpecialFolderNode::HEADERS;
|
||||
} else if (isCfile(fileInfo.fileName())) {
|
||||
folderNodeType = ProjectSpecialFolderNode::SOURCES;
|
||||
} else {
|
||||
folderNodeType = ProjectSpecialFolderNode::OTHERS;
|
||||
}
|
||||
return findFolderNode(fileInfo.absolutePath(),folderNodeType);
|
||||
}
|
||||
|
||||
void Project::incrementBuildNumber()
|
||||
{
|
||||
mOptions.versionInfo.build++;
|
||||
|
@ -1320,15 +1410,6 @@ void Project::incrementBuildNumber()
|
|||
setModified(true);
|
||||
}
|
||||
|
||||
QString Project::listUnitStr(const QChar &separator)
|
||||
{
|
||||
QStringList units;
|
||||
foreach (const PProjectUnit& unit, mUnits) {
|
||||
units.append('"'+unit->fileName()+'"');
|
||||
}
|
||||
return units.join(separator);
|
||||
}
|
||||
|
||||
void Project::loadLayout()
|
||||
{
|
||||
SimpleIni layIni;
|
||||
|
@ -1400,6 +1481,7 @@ void Project::loadOptions(SimpleIni& ini)
|
|||
mOptions.includeVersionInfo = ini.GetBoolValue("Project", "IncludeVersionInfo", false);
|
||||
mOptions.supportXPThemes = ini.GetBoolValue("Project", "SupportXPThemes", false);
|
||||
mOptions.compilerSet = ini.GetLongValue("Project", "CompilerSet", pSettings->compilerSets().defaultIndex());
|
||||
mOptions.modelType = (ProjectModelType)ini.GetLongValue("Project", "ModelType", (int)ProjectModelType::Custom);
|
||||
|
||||
if (mOptions.compilerSet >= pSettings->compilerSets().size()
|
||||
|| mOptions.compilerSet < 0) { // TODO: change from indices to names
|
||||
|
@ -1502,30 +1584,6 @@ PCppParser Project::cppParser()
|
|||
return mParser;
|
||||
}
|
||||
|
||||
void Project::sortUnitsByPriority()
|
||||
{
|
||||
mModel.beginUpdate();
|
||||
auto action = finally([this]{
|
||||
mModel.endUpdate();
|
||||
});
|
||||
std::sort(mUnits.begin(),mUnits.end(),[](const PProjectUnit& u1, const PProjectUnit& u2)->bool{
|
||||
return (u1->priority()>u2->priority());
|
||||
});
|
||||
rebuildNodes();
|
||||
}
|
||||
|
||||
void Project::sortUnitsByAlpha()
|
||||
{
|
||||
mModel.beginUpdate();
|
||||
auto action = finally([this]{
|
||||
mModel.endUpdate();
|
||||
});
|
||||
std::sort(mUnits.begin(),mUnits.end(),[](const PProjectUnit& u1, const PProjectUnit& u2)->bool{
|
||||
return (extractFileName(u1->fileName())<extractFileName(u2->fileName()));
|
||||
});
|
||||
rebuildNodes();
|
||||
}
|
||||
|
||||
int Project::indexInUnits(const QString &fileName) const
|
||||
{
|
||||
QDir dir(directory());
|
||||
|
@ -1544,13 +1602,13 @@ int Project::indexInUnits(const Editor *editor) const
|
|||
return indexInUnits(editor->filename());
|
||||
}
|
||||
|
||||
void Project::removeFolderRecurse(PFolderNode node)
|
||||
void Project::removeFolderRecurse(PProjectModelNode node)
|
||||
{
|
||||
if (!node)
|
||||
return ;
|
||||
// Recursively remove folders
|
||||
for (int i=node->children.count()-1;i>=0;i++) {
|
||||
PFolderNode childNode = node->children[i];
|
||||
PProjectModelNode childNode = node->children[i];
|
||||
// Remove folder inside folder
|
||||
if (childNode->unitIndex<0 && childNode->level>0) {
|
||||
removeFolderRecurse(childNode);
|
||||
|
@ -1563,16 +1621,16 @@ void Project::removeFolderRecurse(PFolderNode node)
|
|||
}
|
||||
}
|
||||
|
||||
PFolderNode parent = node->parent.lock();
|
||||
PProjectModelNode parent = node->parent.lock();
|
||||
if (parent) {
|
||||
parent->children.removeAll(node);
|
||||
}
|
||||
}
|
||||
|
||||
void Project::updateFolderNode(PFolderNode node)
|
||||
void Project::updateFolderNode(PProjectModelNode node)
|
||||
{
|
||||
for (int i=0;i<node->children.count();i++){
|
||||
PFolderNode child = node->children[i];
|
||||
PProjectModelNode child = node->children[i];
|
||||
if (child->unitIndex<0) {
|
||||
mFolders.append(getFolderPath(child));
|
||||
updateFolderNode(child);
|
||||
|
@ -1598,6 +1656,19 @@ const QList<PProjectUnit> &Project::units() const
|
|||
return mUnits;
|
||||
}
|
||||
|
||||
ProjectModelType Project::modelType() const
|
||||
{
|
||||
return mOptions.modelType;
|
||||
}
|
||||
|
||||
void Project::setModelType(ProjectModelType type)
|
||||
{
|
||||
if (type!=mOptions.modelType) {
|
||||
mOptions.modelType = type;
|
||||
rebuildNodes();
|
||||
}
|
||||
}
|
||||
|
||||
ProjectOptions &Project::options()
|
||||
{
|
||||
return mOptions;
|
||||
|
@ -1608,9 +1679,9 @@ ProjectModel *Project::model()
|
|||
return &mModel;
|
||||
}
|
||||
|
||||
const PFolderNode &Project::rootNode() const
|
||||
const PProjectModelNode &Project::rootNode() const
|
||||
{
|
||||
return mNode;
|
||||
return mRootNode;
|
||||
}
|
||||
|
||||
const QString &Project::name() const
|
||||
|
@ -1622,7 +1693,7 @@ void Project::setName(const QString &newName)
|
|||
{
|
||||
if (newName != mName) {
|
||||
mName = newName;
|
||||
mNode->text = newName;
|
||||
mRootNode->text = newName;
|
||||
setModified(true);
|
||||
}
|
||||
}
|
||||
|
@ -1752,7 +1823,11 @@ int ProjectUnit::priority() const
|
|||
|
||||
void ProjectUnit::setPriority(int newPriority)
|
||||
{
|
||||
if (mPriority!=newPriority) {
|
||||
mPriority = newPriority;
|
||||
if (mNode)
|
||||
mNode->priority = mPriority;
|
||||
}
|
||||
}
|
||||
|
||||
const QByteArray &ProjectUnit::encoding() const
|
||||
|
@ -1812,12 +1887,12 @@ bool ProjectUnit::save()
|
|||
return result;
|
||||
}
|
||||
|
||||
PFolderNode &ProjectUnit::node()
|
||||
PProjectModelNode &ProjectUnit::node()
|
||||
{
|
||||
return mNode;
|
||||
}
|
||||
|
||||
void ProjectUnit::setNode(const PFolderNode &newNode)
|
||||
void ProjectUnit::setNode(const PProjectModelNode &newNode)
|
||||
{
|
||||
mNode = newNode;
|
||||
}
|
||||
|
@ -1855,7 +1930,7 @@ QModelIndex ProjectModel::index(int row, int column, const QModelIndex &parent)
|
|||
if (!parent.isValid()) {
|
||||
return createIndex(row,column,mProject->rootNode().get());
|
||||
}
|
||||
FolderNode* parentNode = static_cast<FolderNode*>(parent.internalPointer());
|
||||
ProjectModelNode* parentNode = static_cast<ProjectModelNode*>(parent.internalPointer());
|
||||
if (!parentNode) {
|
||||
return QModelIndex();
|
||||
}
|
||||
|
@ -1868,7 +1943,7 @@ QModelIndex ProjectModel::parent(const QModelIndex &child) const
|
|||
{
|
||||
if (!child.isValid())
|
||||
return QModelIndex();
|
||||
FolderNode * node = static_cast<FolderNode*>(child.internalPointer());
|
||||
ProjectModelNode * node = static_cast<ProjectModelNode*>(child.internalPointer());
|
||||
if (!node)
|
||||
return QModelIndex();
|
||||
return getParentIndex(node);
|
||||
|
@ -1878,7 +1953,7 @@ int ProjectModel::rowCount(const QModelIndex &parent) const
|
|||
{
|
||||
if (!parent.isValid())
|
||||
return 1;
|
||||
FolderNode* p = static_cast<FolderNode*>(parent.internalPointer());
|
||||
ProjectModelNode* p = static_cast<ProjectModelNode*>(parent.internalPointer());
|
||||
if (p) {
|
||||
return p->children.count();
|
||||
} else {
|
||||
|
@ -1895,7 +1970,7 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const
|
|||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
FolderNode* p = static_cast<FolderNode*>(index.internalPointer());
|
||||
ProjectModelNode* p = static_cast<ProjectModelNode*>(index.internalPointer());
|
||||
if (!p)
|
||||
return QVariant();
|
||||
if (role == Qt::DisplayRole || role==Qt::EditRole) {
|
||||
|
@ -1918,25 +1993,32 @@ Qt::ItemFlags ProjectModel::flags(const QModelIndex &index) const
|
|||
{
|
||||
if (!index.isValid())
|
||||
return Qt::NoItemFlags;
|
||||
FolderNode* p = static_cast<FolderNode*>(index.internalPointer());
|
||||
ProjectModelNode* p = static_cast<ProjectModelNode*>(index.internalPointer());
|
||||
if (!p)
|
||||
return Qt::NoItemFlags;
|
||||
if (p==mProject->rootNode().get())
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEditable;
|
||||
if (mProject && mProject->modelType() == ProjectModelType::FileSystem) {
|
||||
Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
if (p->unitIndex>=0)
|
||||
flags.setFlag(Qt::ItemIsEditable);
|
||||
return flags;
|
||||
} else {
|
||||
Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
|
||||
if (p->unitIndex<0) {
|
||||
flags.setFlag(Qt::ItemIsDropEnabled);
|
||||
flags.setFlag(Qt::ItemIsDragEnabled,false);
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
|
||||
bool ProjectModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return false;
|
||||
FolderNode* p = static_cast<FolderNode*>(index.internalPointer());
|
||||
PFolderNode node = mProject->pointerToNode(p);
|
||||
ProjectModelNode* p = static_cast<ProjectModelNode*>(index.internalPointer());
|
||||
PProjectModelNode node = mProject->pointerToNode(p);
|
||||
if (!node)
|
||||
return false;
|
||||
if (role == Qt::EditRole) {
|
||||
|
@ -2013,6 +2095,11 @@ bool ProjectModel::setData(const QModelIndex &index, const QVariant &value, int
|
|||
|
||||
// Add new filename to file minitor
|
||||
pMainWindow->fileSystemWatcher()->addPath(newName);
|
||||
//suffix changed
|
||||
if (mProject && mProject->modelType() == ProjectModelType::FileSystem
|
||||
&& QFileInfo(oldName).suffix()!=QFileInfo(newName).suffix()) {
|
||||
mProject->rebuildNodes();
|
||||
} else
|
||||
emit dataChanged(index,index);
|
||||
return true;
|
||||
} else {
|
||||
|
@ -2033,12 +2120,12 @@ bool ProjectModel::setData(const QModelIndex &index, const QVariant &value, int
|
|||
return false;
|
||||
}
|
||||
|
||||
QModelIndex ProjectModel::getParentIndex(FolderNode * node) const
|
||||
QModelIndex ProjectModel::getParentIndex(ProjectModelNode * node) const
|
||||
{
|
||||
PFolderNode parent = node->parent.lock();
|
||||
PProjectModelNode parent = node->parent.lock();
|
||||
if (!parent) // root node
|
||||
return QModelIndex();
|
||||
PFolderNode grand = parent->parent.lock();
|
||||
PProjectModelNode grand = parent->parent.lock();
|
||||
if (!grand) {
|
||||
return createIndex(0,0,parent.get());
|
||||
}
|
||||
|
@ -2070,8 +2157,8 @@ bool ProjectModel::canDropMimeData(const QMimeData * data, Qt::DropAction action
|
|||
// } else {
|
||||
// idx= index(row,column,parent);
|
||||
// }
|
||||
FolderNode* p= static_cast<FolderNode*>(idx.internalPointer());
|
||||
PFolderNode node = mProject->pointerToNode(p);
|
||||
ProjectModelNode* p= static_cast<ProjectModelNode*>(idx.internalPointer());
|
||||
PProjectModelNode node = mProject->pointerToNode(p);
|
||||
if (node->unitIndex>=0)
|
||||
return false;
|
||||
QByteArray encoded = data->data(format);
|
||||
|
@ -2080,9 +2167,9 @@ bool ProjectModel::canDropMimeData(const QMimeData * data, Qt::DropAction action
|
|||
qint32 r, c;
|
||||
quintptr v;
|
||||
stream >> r >> c >> v;
|
||||
FolderNode* droppedPointer= (FolderNode*)(v);
|
||||
PFolderNode droppedNode = mProject->pointerToNode(droppedPointer);
|
||||
PFolderNode oldParent = droppedNode->parent.lock();
|
||||
ProjectModelNode* droppedPointer= (ProjectModelNode*)(v);
|
||||
PProjectModelNode droppedNode = mProject->pointerToNode(droppedPointer);
|
||||
PProjectModelNode oldParent = droppedNode->parent.lock();
|
||||
if (oldParent == node)
|
||||
return false;
|
||||
}
|
||||
|
@ -2109,8 +2196,8 @@ bool ProjectModel::dropMimeData(const QMimeData *data, Qt::DropAction action, in
|
|||
|
||||
if (!parent.isValid())
|
||||
return false;
|
||||
FolderNode* p= static_cast<FolderNode*>(parent.internalPointer());
|
||||
PFolderNode node = mProject->pointerToNode(p);
|
||||
ProjectModelNode* p= static_cast<ProjectModelNode*>(parent.internalPointer());
|
||||
PProjectModelNode node = mProject->pointerToNode(p);
|
||||
|
||||
QByteArray encoded = data->data(format);
|
||||
QDataStream stream(&encoded, QIODevice::ReadOnly);
|
||||
|
@ -2127,9 +2214,9 @@ bool ProjectModel::dropMimeData(const QMimeData *data, Qt::DropAction action, in
|
|||
for (int i=pointers.count()-1;i>=0;i--) {
|
||||
int r = rows[i];
|
||||
intptr_t v = pointers[i];
|
||||
FolderNode* droppedPointer= (FolderNode*)(v);
|
||||
PFolderNode droppedNode = mProject->pointerToNode(droppedPointer);
|
||||
PFolderNode oldParent = droppedNode->parent.lock();
|
||||
ProjectModelNode* droppedPointer= (ProjectModelNode*)(v);
|
||||
PProjectModelNode droppedNode = mProject->pointerToNode(droppedPointer);
|
||||
PProjectModelNode oldParent = droppedNode->parent.lock();
|
||||
QModelIndex oldParentIndex = getParentIndex(droppedPointer);
|
||||
beginRemoveRows(oldParentIndex,r,r);
|
||||
if (oldParent)
|
||||
|
@ -2166,7 +2253,7 @@ QMimeData *ProjectModel::mimeData(const QModelIndexList &indexes) const
|
|||
QList<QUrl> urls;
|
||||
for (; it != indexes.end(); ++it) {
|
||||
stream << (qint32)((*it).row()) << (qint32)((*it).column()) << (quintptr)((*it).internalPointer());
|
||||
FolderNode* p = static_cast<FolderNode*>((*it).internalPointer());
|
||||
ProjectModelNode* p = static_cast<ProjectModelNode*>((*it).internalPointer());
|
||||
if (p && p->unitIndex>=0) {
|
||||
urls.append(QUrl::fromLocalFile(mProject->units()[p->unitIndex]->fileName()));
|
||||
}
|
||||
|
@ -2188,12 +2275,12 @@ bool ProjectModelSortFilterProxy::lessThan(const QModelIndex &source_left, const
|
|||
if (!sourceModel())
|
||||
return false;
|
||||
ProjectModel* projectModel = dynamic_cast<ProjectModel*>(sourceModel());
|
||||
FolderNode* pLeft=nullptr;
|
||||
ProjectModelNode* pLeft=nullptr;
|
||||
if (source_left.isValid())
|
||||
pLeft = static_cast<FolderNode*>(source_left.internalPointer());
|
||||
FolderNode* pRight=nullptr;
|
||||
pLeft = static_cast<ProjectModelNode*>(source_left.internalPointer());
|
||||
ProjectModelNode* pRight=nullptr;
|
||||
if (source_right.isValid())
|
||||
pRight = static_cast<FolderNode*>(source_right.internalPointer());
|
||||
pRight = static_cast<ProjectModelNode*>(source_right.internalPointer());
|
||||
if (!pLeft)
|
||||
return true;
|
||||
if (!pRight)
|
||||
|
@ -2202,5 +2289,7 @@ bool ProjectModelSortFilterProxy::lessThan(const QModelIndex &source_left, const
|
|||
return true;
|
||||
if (pLeft->unitIndex>=0 && pRight->unitIndex<0)
|
||||
return false;
|
||||
if (pLeft->priority!=pRight->priority)
|
||||
return pLeft->priority>pRight->priority;
|
||||
return QString::compare(pLeft->text, pRight->text)<0;
|
||||
}
|
||||
|
|
|
@ -27,13 +27,14 @@ class Project;
|
|||
class Editor;
|
||||
class CppParser;
|
||||
|
||||
struct FolderNode;
|
||||
using PFolderNode = std::shared_ptr<FolderNode>;
|
||||
struct FolderNode {
|
||||
struct ProjectModelNode;
|
||||
using PProjectModelNode = std::shared_ptr<ProjectModelNode>;
|
||||
struct ProjectModelNode {
|
||||
QString text;
|
||||
std::weak_ptr<FolderNode> parent;
|
||||
std::weak_ptr<ProjectModelNode> parent;
|
||||
int unitIndex;
|
||||
QList<PFolderNode> children;
|
||||
int priority;
|
||||
QList<PProjectModelNode> children;
|
||||
int level;
|
||||
};
|
||||
|
||||
|
@ -69,8 +70,8 @@ public:
|
|||
void setModified(bool value);
|
||||
bool save();
|
||||
|
||||
PFolderNode &node();
|
||||
void setNode(const PFolderNode &newNode);
|
||||
PProjectModelNode &node();
|
||||
void setNode(const PProjectModelNode &newNode);
|
||||
|
||||
private:
|
||||
Project* mParent;
|
||||
|
@ -85,13 +86,11 @@ private:
|
|||
bool mLink;
|
||||
int mPriority;
|
||||
QByteArray mEncoding;
|
||||
PFolderNode mNode;
|
||||
PProjectModelNode mNode;
|
||||
};
|
||||
|
||||
using PProjectUnit = std::shared_ptr<ProjectUnit>;
|
||||
|
||||
|
||||
|
||||
class ProjectModel : public QAbstractItemModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -113,7 +112,7 @@ public:
|
|||
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
||||
|
||||
private:
|
||||
QModelIndex getParentIndex(FolderNode * node) const;
|
||||
QModelIndex getParentIndex(ProjectModelNode * node) const;
|
||||
// QAbstractItemModel interface
|
||||
public:
|
||||
bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override;
|
||||
|
@ -134,6 +133,13 @@ protected:
|
|||
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
|
||||
};
|
||||
|
||||
enum ProjectSpecialFolderNode {
|
||||
HEADERS,
|
||||
SOURCES,
|
||||
OTHERS,
|
||||
NonSpecial
|
||||
};
|
||||
|
||||
class ProjectTemplate;
|
||||
class Project : public QObject
|
||||
{
|
||||
|
@ -150,50 +156,38 @@ public:
|
|||
|
||||
void addFolder(const QString& s);
|
||||
PProjectUnit addUnit(const QString& inFileName,
|
||||
PFolderNode parentNode,
|
||||
PProjectModelNode parentNode,
|
||||
bool rebuild);
|
||||
QString folder();
|
||||
void buildPrivateResource(bool forceSave=false);
|
||||
void checkProjectFileForUpdate(SimpleIni& ini);
|
||||
void closeUnit(int index);
|
||||
void createFolderNodes();
|
||||
void doAutoOpen();
|
||||
bool fileAlreadyExists(const QString& s);
|
||||
PFolderNode folderNodeFromName(const QString& name);
|
||||
char getCompilerOption(const QString& optionString);
|
||||
QString getFolderPath(PFolderNode node);
|
||||
QString getFolderPath(PProjectModelNode node);
|
||||
int getUnitFromString(const QString& s);
|
||||
void incrementBuildNumber();
|
||||
int indexInUnits(const QString& fileName) const;
|
||||
int indexInUnits(const Editor* editor) const;
|
||||
QString listUnitStr(const QChar& separator);
|
||||
void loadLayout(); // load all [UnitX]
|
||||
void loadOptions(SimpleIni& ini);
|
||||
void loadUnitLayout(Editor *e, int index); // load single [UnitX] cursor positions
|
||||
PFolderNode makeNewFileNode(const QString& s, bool isFolder, PFolderNode newParent);
|
||||
PFolderNode makeProjectNode();
|
||||
PProjectUnit newUnit(PFolderNode parentNode,
|
||||
PProjectUnit newUnit(PProjectModelNode parentNode,
|
||||
const QString& customFileName="");
|
||||
Editor* openUnit(int index);
|
||||
PProjectModelNode pointerToNode(ProjectModelNode * p, PProjectModelNode parent=PProjectModelNode());
|
||||
void rebuildNodes();
|
||||
bool removeUnit(int index, bool doClose, bool removeFile = false);
|
||||
bool removeFolder(PFolderNode node);
|
||||
bool removeFolder(PProjectModelNode node);
|
||||
void resetParserProjectFiles();
|
||||
void saveAll(); // save [Project] and all [UnitX]
|
||||
void saveLayout(); // save all [UnitX]
|
||||
void saveOptions();
|
||||
void saveUnitAs(int i, const QString& sFileName, bool syncEditor = true); // save single [UnitX]
|
||||
void saveUnitLayout(Editor* e, int index); // save single [UnitX] cursor positions
|
||||
bool saveUnits();
|
||||
PProjectUnit findUnitByFilename(const QString& filename);
|
||||
void associateEditor(Editor* editor);
|
||||
void associateEditorToUnit(Editor* editor, PProjectUnit unit);
|
||||
void setCompilerOption(const QString& optionString, char value);
|
||||
void sortUnitsByPriority();
|
||||
void sortUnitsByAlpha();
|
||||
void updateFolders();
|
||||
void updateNodeIndexes();
|
||||
PFolderNode pointerToNode(FolderNode * p, PFolderNode parent=PFolderNode());
|
||||
void setCompilerSet(int compilerSetIndex);
|
||||
|
||||
//void showOptions();
|
||||
|
@ -206,7 +200,7 @@ public:
|
|||
const QString &name() const;
|
||||
void setName(const QString &newName);
|
||||
|
||||
const PFolderNode &rootNode() const;
|
||||
const PProjectModelNode &rootNode() const;
|
||||
|
||||
ProjectOptions &options();
|
||||
|
||||
|
@ -214,13 +208,30 @@ public:
|
|||
|
||||
const QList<PProjectUnit> &units() const;
|
||||
|
||||
ProjectModelType modelType() const;
|
||||
void setModelType(ProjectModelType type);
|
||||
|
||||
signals:
|
||||
void nodesChanged();
|
||||
void modifyChanged(bool value);
|
||||
private:
|
||||
void checkProjectFileForUpdate(SimpleIni& ini);
|
||||
void createFolderNodes();
|
||||
void createFileSystemFolderNodes();
|
||||
void createFileSystemFolderNode(ProjectSpecialFolderNode folderType, const QString& folderName, PProjectModelNode parent);
|
||||
PProjectModelNode getParentFolderNode(const QString& filename);
|
||||
PProjectModelNode findFolderNode(const QString& folderPath, ProjectSpecialFolderNode nodeType);
|
||||
PProjectModelNode folderNodeFromName(const QString& name);
|
||||
void loadOptions(SimpleIni& ini);
|
||||
void loadLayout(); // load all [UnitX]
|
||||
void loadUnitLayout(Editor *e, int index); // load single [UnitX] cursor positions
|
||||
|
||||
PProjectModelNode makeNewFileNode(const QString& s, bool isFolder, PProjectModelNode newParent);
|
||||
PProjectModelNode makeProjectNode();
|
||||
void open();
|
||||
void removeFolderRecurse(PFolderNode node);
|
||||
void updateFolderNode(PFolderNode node);
|
||||
void removeFolderRecurse(PProjectModelNode node);
|
||||
void saveUnitLayout(Editor* e, int index); // save single [UnitX] cursor positions
|
||||
void updateFolderNode(PProjectModelNode node);
|
||||
void updateCompilerSetType();
|
||||
|
||||
private:
|
||||
|
@ -231,8 +242,10 @@ private:
|
|||
bool mModified;
|
||||
QStringList mFolders;
|
||||
std::shared_ptr<CppParser> mParser;
|
||||
QList<PFolderNode> mFolderNodes;
|
||||
PFolderNode mNode;
|
||||
QList<PProjectModelNode> mFolderNodes;
|
||||
PProjectModelNode mRootNode;
|
||||
QHash<ProjectSpecialFolderNode, PProjectModelNode> mSpecialNodes;
|
||||
QHash<QString, PProjectModelNode> mFileSystemFolderNodes;
|
||||
ProjectModel mModel;
|
||||
};
|
||||
|
||||
|
|
|
@ -52,4 +52,5 @@ ProjectOptions::ProjectOptions()
|
|||
compilerSetType = 0;
|
||||
staticLink = true;
|
||||
addCharset = true;
|
||||
modelType = ProjectModelType::FileSystem;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,11 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
enum class ProjectModelType {
|
||||
FileSystem,
|
||||
Custom
|
||||
};
|
||||
|
||||
enum class ProjectType {
|
||||
GUI=0,
|
||||
Console=1,
|
||||
|
@ -83,5 +88,6 @@ struct ProjectOptions{
|
|||
bool staticLink;
|
||||
bool addCharset;
|
||||
QString encoding;
|
||||
ProjectModelType modelType;
|
||||
};
|
||||
#endif // PROJECTOPTIONS_H
|
||||
|
|
|
@ -148,6 +148,7 @@ void ProjectTemplate::readTemplateFile(const QString &fileName)
|
|||
} else {
|
||||
mOptions.encoding = fromByteArray(mIni->GetValue("Project","Encoding", ENCODING_AUTO_DETECT));
|
||||
}
|
||||
mOptions.modelType = (ProjectModelType)mIni->GetLongValue("Project", "ModelType", (int)ProjectModelType::FileSystem);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ void ProjectFilesWidget::doSave()
|
|||
unit->setBuildCmd(unitCopy->buildCmd());
|
||||
unit->setEncoding(unitCopy->encoding());
|
||||
}
|
||||
pMainWindow->project()->sortUnitsByPriority();
|
||||
pMainWindow->project()->saveUnits();
|
||||
copyUnits();
|
||||
ui->treeProject->expandAll();
|
||||
|
@ -68,7 +67,7 @@ PProjectUnit ProjectFilesWidget::currentUnit()
|
|||
QModelIndex index = ui->treeProject->currentIndex();
|
||||
if (!index.isValid())
|
||||
return PProjectUnit();
|
||||
FolderNode* node = static_cast<FolderNode*>(index.internalPointer());
|
||||
ProjectModelNode* node = static_cast<ProjectModelNode*>(index.internalPointer());
|
||||
if (!node)
|
||||
return PProjectUnit();
|
||||
int i = node->unitIndex;
|
||||
|
@ -136,7 +135,7 @@ void ProjectFilesWidget::on_treeProject_doubleClicked(const QModelIndex &index)
|
|||
disableFileOptions();
|
||||
return ;
|
||||
}
|
||||
FolderNode* node = static_cast<FolderNode*>(index.internalPointer());
|
||||
ProjectModelNode* node = static_cast<ProjectModelNode*>(index.internalPointer());
|
||||
if (!node) {
|
||||
disableFileOptions();
|
||||
return;
|
||||
|
|
|
@ -1116,7 +1116,7 @@ void copyFolder(const QString &fromDir, const QString &toDir)
|
|||
while (it.hasNext()){
|
||||
it.next();
|
||||
const auto fileInfo = it.fileInfo();
|
||||
if(!fileInfo.isHidden()) { //filters dot and dotdot
|
||||
if(!fileInfo.isHidden() && !fileInfo.fileName().startsWith('.')) { //filters dot and dotdot
|
||||
const QString subPathStructure = fileInfo.absoluteFilePath().mid(absSourcePathLength);
|
||||
const QString constructedAbsolutePath = targetDir.absolutePath() + subPathStructure;
|
||||
if(fileInfo.isDir()){
|
||||
|
|
|
@ -7,7 +7,7 @@ SUBDIRS += \
|
|||
|
||||
APP_NAME = RedPandaCPP
|
||||
|
||||
APP_VERSION = 0.14.1
|
||||
APP_VERSION = 0.14.2
|
||||
|
||||
linux: {
|
||||
|
||||
|
|
Loading…
Reference in New Issue