- enhancement: file system view mode for project

This commit is contained in:
Roy Qu 2022-02-08 12:33:10 +08:00
parent 9e5ce0a8ba
commit c7a9698c4b
12 changed files with 370 additions and 239 deletions

View File

@ -1,3 +1,6 @@
Red Panda C++ Version 0.14.2
- enhancement: file system view mode for project
Red Panda C++ Version 0.14.1 Red Panda C++ Version 0.14.1
- enhancement: custom theme - enhancement: custom theme
- fix: failed to show function tip, when there are parameters having '[' and ']' - fix: failed to show function tip, when there are parameters having '[' and ']'

View File

@ -10,7 +10,7 @@ isEmpty(APP_NAME) {
} }
isEmpty(APP_VERSION) { isEmpty(APP_VERSION) {
APP_VERSION=0.14.1 APP_VERSION=0.14.2
} }
isEmpty(PREFIX) { isEmpty(PREFIX) {

View File

@ -3272,11 +3272,11 @@ Are you really want to continue?</oldsource>
<message> <message>
<location filename="mainwindow.ui" line="527"/> <location filename="mainwindow.ui" line="527"/>
<location filename="mainwindow.ui" line="2581"/> <location filename="mainwindow.ui" line="2581"/>
<location filename="mainwindow.cpp" line="3938"/> <location filename="mainwindow.cpp" line="3959"/>
<location filename="mainwindow.cpp" line="3941"/> <location filename="mainwindow.cpp" line="3962"/>
<location filename="mainwindow.cpp" line="3945"/> <location filename="mainwindow.cpp" line="3966"/>
<location filename="mainwindow.cpp" line="3948"/> <location filename="mainwindow.cpp" line="3969"/>
<location filename="mainwindow.cpp" line="5512"/> <location filename="mainwindow.cpp" line="5532"/>
<source>Issues</source> <source>Issues</source>
<translation></translation> <translation></translation>
</message> </message>
@ -3688,7 +3688,7 @@ Are you really want to continue?</oldsource>
<message> <message>
<location filename="mainwindow.ui" line="326"/> <location filename="mainwindow.ui" line="326"/>
<location filename="mainwindow.ui" line="329"/> <location filename="mainwindow.ui" line="329"/>
<location filename="mainwindow.cpp" line="5825"/> <location filename="mainwindow.cpp" line="5843"/>
<source>New Problem Set</source> <source>New Problem Set</source>
<translation></translation> <translation></translation>
</message> </message>
@ -3707,14 +3707,14 @@ Are you really want to continue?</oldsource>
<message> <message>
<location filename="mainwindow.ui" line="368"/> <location filename="mainwindow.ui" line="368"/>
<location filename="mainwindow.ui" line="371"/> <location filename="mainwindow.ui" line="371"/>
<location filename="mainwindow.cpp" line="5868"/> <location filename="mainwindow.cpp" line="5886"/>
<source>Save Problem Set</source> <source>Save Problem Set</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="382"/> <location filename="mainwindow.ui" line="382"/>
<location filename="mainwindow.ui" line="385"/> <location filename="mainwindow.ui" line="385"/>
<location filename="mainwindow.cpp" line="5888"/> <location filename="mainwindow.cpp" line="5910"/>
<source>Load Problem Set</source> <source>Load Problem Set</source>
<translation></translation> <translation></translation>
</message> </message>
@ -4053,7 +4053,7 @@ Are you really want to continue?</oldsource>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2259"/> <location filename="mainwindow.ui" line="2259"/>
<location filename="mainwindow.cpp" line="4806"/> <location filename="mainwindow.cpp" line="4826"/>
<source>Clear all breakpoints</source> <source>Clear all breakpoints</source>
<translation></translation> <translation></translation>
</message> </message>
@ -4154,7 +4154,7 @@ Are you really want to continue?</oldsource>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2413"/> <location filename="mainwindow.ui" line="2413"/>
<location filename="mainwindow.cpp" line="5463"/> <location filename="mainwindow.cpp" line="5483"/>
<source>Rename Symbol</source> <source>Rename Symbol</source>
<translation></translation> <translation></translation>
</message> </message>
@ -4175,13 +4175,13 @@ Are you really want to continue?</oldsource>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2433"/> <location filename="mainwindow.ui" line="2433"/>
<location filename="mainwindow.cpp" line="5643"/> <location filename="mainwindow.cpp" line="5661"/>
<source>Export As RTF</source> <source>Export As RTF</source>
<translation>RTF</translation> <translation>RTF</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2438"/> <location filename="mainwindow.ui" line="2438"/>
<location filename="mainwindow.cpp" line="5665"/> <location filename="mainwindow.cpp" line="5683"/>
<source>Export As HTML</source> <source>Export As HTML</source>
<translation>HTML</translation> <translation>HTML</translation>
</message> </message>
@ -4344,7 +4344,7 @@ Are you really want to continue?</oldsource>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2503"/> <location filename="mainwindow.ui" line="2503"/>
<location filename="mainwindow.cpp" line="5804"/> <location filename="mainwindow.cpp" line="5822"/>
<source>Open Folder</source> <source>Open Folder</source>
<translation></translation> <translation></translation>
</message> </message>
@ -4354,7 +4354,7 @@ Are you really want to continue?</oldsource>
<translation>...</translation> <translation>...</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="2758"/> <location filename="mainwindow.cpp" line="2772"/>
<source>File Encoding</source> <source>File Encoding</source>
<translation></translation> <translation></translation>
</message> </message>
@ -4584,7 +4584,7 @@ Are you really want to continue?</oldsource>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="268"/> <location filename="mainwindow.cpp" line="268"/>
<location filename="mainwindow.cpp" line="5834"/> <location filename="mainwindow.cpp" line="5852"/>
<source>Problem Set %1</source> <source>Problem Set %1</source>
<translation>%1</translation> <translation>%1</translation>
</message> </message>
@ -4658,15 +4658,15 @@ Are you really want to continue?</oldsource>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="2261"/> <location filename="mainwindow.cpp" line="2261"/>
<location filename="mainwindow.cpp" line="5723"/> <location filename="mainwindow.cpp" line="5741"/>
<location filename="mainwindow.cpp" line="5763"/> <location filename="mainwindow.cpp" line="5781"/>
<source>Bookmark Description</source> <source>Bookmark Description</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="2262"/> <location filename="mainwindow.cpp" line="2262"/>
<location filename="mainwindow.cpp" line="5724"/> <location filename="mainwindow.cpp" line="5742"/>
<location filename="mainwindow.cpp" line="5764"/> <location filename="mainwindow.cpp" line="5782"/>
<source>Description:</source> <source>Description:</source>
<translation></translation> <translation></translation>
</message> </message>
@ -4742,195 +4742,205 @@ Are you really want to continue?</oldsource>
<translation></translation> <translation></translation>
</message> </message>
<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> <source>Sort By Type</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="2534"/> <location filename="mainwindow.cpp" line="2548"/>
<source>Sort alphabetically</source> <source>Sort alphabetically</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="2539"/> <location filename="mainwindow.cpp" line="2553"/>
<source>Show inherited members</source> <source>Show inherited members</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="2544"/> <location filename="mainwindow.cpp" line="2558"/>
<source>Goto declaration</source> <source>Goto declaration</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="2547"/> <location filename="mainwindow.cpp" line="2561"/>
<source>Goto definition</source> <source>Goto definition</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="2639"/> <location filename="mainwindow.cpp" line="2653"/>
<source>Open in Editor</source> <source>Open in Editor</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="2651"/> <location filename="mainwindow.cpp" line="2665"/>
<source>Open in External Program</source> <source>Open in External Program</source>
<translation>使</translation> <translation>使</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="2661"/> <location filename="mainwindow.cpp" line="2675"/>
<source>Open in Terminal</source> <source>Open in Terminal</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="2677"/> <location filename="mainwindow.cpp" line="2691"/>
<source>Open in Windows Explorer</source> <source>Open in Windows Explorer</source>
<translation>Windows浏览器中打开</translation> <translation>Windows浏览器中打开</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="2724"/> <location filename="mainwindow.cpp" line="2738"/>
<source>Character sets</source> <source>Character sets</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="2850"/> <location filename="mainwindow.cpp" line="2864"/>
<source>%1 files autosaved</source> <source>%1 files autosaved</source>
<translation>%1</translation> <translation>%1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3027"/> <location filename="mainwindow.cpp" line="3046"/>
<source>Set answer to...</source> <source>Set answer to...</source>
<translation>...</translation> <translation>...</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3059"/> <location filename="mainwindow.cpp" line="3078"/>
<source>select other file...</source> <source>select other file...</source>
<translation>...</translation> <translation>...</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3065"/> <location filename="mainwindow.cpp" line="3084"/>
<source>Select Answer Source File</source> <source>Select Answer Source File</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3067"/> <location filename="mainwindow.cpp" line="3086"/>
<source>C/C++Source Files (*.c *.cpp *.cc *.cxx)</source> <source>C/C++Source Files (*.c *.cpp *.cc *.cxx)</source>
<oldsource>C/C++Source Files (*.c *.cpp *.cc *.cxx</oldsource> <oldsource>C/C++Source Files (*.c *.cpp *.cc *.cxx</oldsource>
<translation>C/C++ (*.c *.cpp *.cc *.cxx)</translation> <translation>C/C++ (*.c *.cpp *.cc *.cxx)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3471"/> <location filename="mainwindow.cpp" line="3492"/>
<source>Save project</source> <source>Save project</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3472"/> <location filename="mainwindow.cpp" line="3493"/>
<source>The project &apos;%1&apos; has modifications.</source> <source>The project &apos;%1&apos; has modifications.</source>
<translation>&apos;%1&apos;</translation> <translation>&apos;%1&apos;</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3474"/> <location filename="mainwindow.cpp" line="3495"/>
<location filename="mainwindow.cpp" line="5828"/> <location filename="mainwindow.cpp" line="5846"/>
<source>Do you want to save it?</source> <source>Do you want to save it?</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3561"/> <location filename="mainwindow.cpp" line="3582"/>
<location filename="mainwindow.cpp" line="3572"/> <location filename="mainwindow.cpp" line="3593"/>
<source>File Changed</source> <source>File Changed</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3631"/> <location filename="mainwindow.cpp" line="3652"/>
<source>New Project File?</source> <source>New Project File?</source>
<translation>?</translation> <translation>?</translation>
</message> </message>
<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> <source>Do you want to add the new file to the project?</source>
<translation>?</translation> <translation>?</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3708"/> <location filename="mainwindow.cpp" line="3729"/>
<location filename="mainwindow.cpp" line="3718"/> <location filename="mainwindow.cpp" line="3739"/>
<location filename="mainwindow.cpp" line="3730"/> <location filename="mainwindow.cpp" line="3751"/>
<location filename="mainwindow.cpp" line="5877"/> <location filename="mainwindow.cpp" line="5899"/>
<source>Save Error</source> <source>Save Error</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3871"/> <location filename="mainwindow.cpp" line="3892"/>
<source>Change Project Compiler Set</source> <source>Change Project Compiler Set</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3872"/> <location filename="mainwindow.cpp" line="3893"/>
<source>Change the project&apos;s compiler set will lose all custom compiler set options.</source> <source>Change the project&apos;s compiler set will lose all custom compiler set options.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3874"/> <location filename="mainwindow.cpp" line="3895"/>
<source>Do you really want to do that?</source> <source>Do you really want to do that?</source>
<translation></translation> <translation></translation>
</message> </message>
<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> <source>Do you really want to clear all breakpoints in this file?</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5005"/> <location filename="mainwindow.cpp" line="5025"/>
<source>New project</source> <source>New project</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5006"/> <location filename="mainwindow.cpp" line="5026"/>
<source>Close %1 and start new project?</source> <source>Close %1 and start new project?</source>
<translation>&apos;%1&apos;?</translation> <translation>&apos;%1&apos;?</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5019"/> <location filename="mainwindow.cpp" line="5039"/>
<source>Folder not exist</source> <source>Folder not exist</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5020"/> <location filename="mainwindow.cpp" line="5040"/>
<source>Folder &apos;%1&apos; doesn&apos;t exist. Create it now?</source> <source>Folder &apos;%1&apos; doesn&apos;t exist. Create it now?</source>
<translation>&apos;%1&apos;</translation> <translation>&apos;%1&apos;</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5027"/> <location filename="mainwindow.cpp" line="5047"/>
<source>Can&apos;t create folder</source> <source>Can&apos;t create folder</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5028"/> <location filename="mainwindow.cpp" line="5048"/>
<source>Failed to create folder &apos;%1&apos;.</source> <source>Failed to create folder &apos;%1&apos;.</source>
<translation>&apos;%1&apos;</translation> <translation>&apos;%1&apos;</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5043"/> <location filename="mainwindow.cpp" line="5063"/>
<source>Save new project as</source> <source>Save new project as</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="6170"/> <location filename="mainwindow.cpp" line="6192"/>
<location filename="mainwindow.cpp" line="6222"/> <location filename="mainwindow.cpp" line="6244"/>
<source>Header Exists</source> <source>Header Exists</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="6171"/> <location filename="mainwindow.cpp" line="6193"/>
<location filename="mainwindow.cpp" line="6223"/> <location filename="mainwindow.cpp" line="6245"/>
<source>Header file &quot;%1&quot; already exists!</source> <source>Header file &quot;%1&quot; already exists!</source>
<translation>&quot;%1&quot;</translation> <translation>&quot;%1&quot;</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="6228"/> <location filename="mainwindow.cpp" line="6250"/>
<source>Source Exists</source> <source>Source Exists</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="6229"/> <location filename="mainwindow.cpp" line="6251"/>
<source>Source file &quot;%1&quot; already exists!</source> <source>Source file &quot;%1&quot; already exists!</source>
<translation>&quot;%1&quot;</translation> <translation>&quot;%1&quot;</translation>
</message> </message>
@ -4939,125 +4949,125 @@ Are you really want to continue?</oldsource>
<translation type="vanished">Dev-C++ (*.dev)</translation> <translation type="vanished">Dev-C++ (*.dev)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5056"/> <location filename="mainwindow.cpp" line="5076"/>
<source>New project fail</source> <source>New project fail</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5057"/> <location filename="mainwindow.cpp" line="5077"/>
<source>Can&apos;t assign project template</source> <source>Can&apos;t assign project template</source>
<translation>使</translation> <translation>使</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5144"/> <location filename="mainwindow.cpp" line="5164"/>
<source>Remove file</source> <source>Remove file</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5145"/> <location filename="mainwindow.cpp" line="5165"/>
<source>Remove the file from disk?</source> <source>Remove the file from disk?</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5334"/> <location filename="mainwindow.cpp" line="5354"/>
<source>untitled</source> <source>untitled</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5344"/> <location filename="mainwindow.cpp" line="5364"/>
<source>New Project File Name</source> <source>New Project File Name</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5345"/> <location filename="mainwindow.cpp" line="5365"/>
<source>File Name:</source> <source>File Name:</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5351"/> <location filename="mainwindow.cpp" line="5371"/>
<source>File Already Exists!</source> <source>File Already Exists!</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5352"/> <location filename="mainwindow.cpp" line="5372"/>
<source>File &apos;%1&apos; already exists!</source> <source>File &apos;%1&apos; already exists!</source>
<translation>&apos;%1&apos;</translation> <translation>&apos;%1&apos;</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5101"/> <location filename="mainwindow.cpp" line="5121"/>
<source>Add to project</source> <source>Add to project</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5045"/> <location filename="mainwindow.cpp" line="5065"/>
<source>Red Panda C++ project file (*.dev)</source> <source>Red Panda C++ project file (*.dev)</source>
<translation>C++(*.dev)</translation> <translation>C++(*.dev)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5449"/> <location filename="mainwindow.cpp" line="5469"/>
<source>Rename Error</source> <source>Rename Error</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5450"/> <location filename="mainwindow.cpp" line="5470"/>
<source>Symbol &apos;%1&apos; is defined in system header.</source> <source>Symbol &apos;%1&apos; is defined in system header.</source>
<translation>&apos;%1&apos;</translation> <translation>&apos;%1&apos;</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5464"/> <location filename="mainwindow.cpp" line="5484"/>
<source>New Name</source> <source>New Name</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5588"/> <location filename="mainwindow.cpp" line="5606"/>
<location filename="mainwindow.cpp" line="5598"/> <location filename="mainwindow.cpp" line="5616"/>
<source>Replace Error</source> <source>Replace Error</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5589"/> <location filename="mainwindow.cpp" line="5607"/>
<source>Can&apos;t open file &apos;%1&apos; for replace!</source> <source>Can&apos;t open file &apos;%1&apos; for replace!</source>
<translation>&apos;%1&apos;</translation> <translation>&apos;%1&apos;</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5599"/> <location filename="mainwindow.cpp" line="5617"/>
<source>Contents has changed since last search!</source> <source>Contents has changed since last search!</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5645"/> <location filename="mainwindow.cpp" line="5663"/>
<source>Rich Text Format Files (*.rtf)</source> <source>Rich Text Format Files (*.rtf)</source>
<translation>RTF格式文件 (*.rtf)</translation> <translation>RTF格式文件 (*.rtf)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5667"/> <location filename="mainwindow.cpp" line="5685"/>
<source>HTML Files (*.html)</source> <source>HTML Files (*.html)</source>
<translation>HTML文件 (*.html)</translation> <translation>HTML文件 (*.html)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5826"/> <location filename="mainwindow.cpp" line="5844"/>
<source>The current problem set is not empty.</source> <source>The current problem set is not empty.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5844"/> <location filename="mainwindow.cpp" line="5862"/>
<source>Problem %1</source> <source>Problem %1</source>
<translation>%1</translation> <translation>%1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5870"/> <location filename="mainwindow.cpp" line="5888"/>
<location filename="mainwindow.cpp" line="5890"/> <location filename="mainwindow.cpp" line="5912"/>
<source>Problem Set Files (*.pbs)</source> <source>Problem Set Files (*.pbs)</source>
<translation> (*.pbs)</translation> <translation> (*.pbs)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5896"/> <location filename="mainwindow.cpp" line="5918"/>
<source>Load Error</source> <source>Load Error</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3207"/> <location filename="mainwindow.cpp" line="3228"/>
<location filename="mainwindow.cpp" line="5910"/> <location filename="mainwindow.cpp" line="5932"/>
<source>Problem Case %1</source> <source>Problem Case %1</source>
<translation>%1</translation> <translation>%1</translation>
</message> </message>
@ -5070,13 +5080,13 @@ Are you really want to continue?</oldsource>
<location filename="mainwindow.cpp" line="248"/> <location filename="mainwindow.cpp" line="248"/>
<location filename="mainwindow.cpp" line="1025"/> <location filename="mainwindow.cpp" line="1025"/>
<location filename="mainwindow.cpp" line="2142"/> <location filename="mainwindow.cpp" line="2142"/>
<location filename="mainwindow.cpp" line="2749"/> <location filename="mainwindow.cpp" line="2763"/>
<location filename="mainwindow.cpp" line="3568"/> <location filename="mainwindow.cpp" line="3589"/>
<location filename="mainwindow.cpp" line="3666"/> <location filename="mainwindow.cpp" line="3687"/>
<location filename="mainwindow.cpp" line="3840"/> <location filename="mainwindow.cpp" line="3861"/>
<location filename="mainwindow.cpp" line="3852"/> <location filename="mainwindow.cpp" line="3873"/>
<location filename="mainwindow.cpp" line="4254"/> <location filename="mainwindow.cpp" line="4274"/>
<location filename="mainwindow.cpp" line="4266"/> <location filename="mainwindow.cpp" line="4286"/>
<source>Error</source> <source>Error</source>
<translation></translation> <translation></translation>
</message> </message>
@ -5091,75 +5101,75 @@ Are you really want to continue?</oldsource>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3562"/> <location filename="mainwindow.cpp" line="3583"/>
<source>File &apos;%1&apos; was changed.</source> <source>File &apos;%1&apos; was changed.</source>
<translation>&apos;%1&apos;</translation> <translation>&apos;%1&apos;</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3562"/> <location filename="mainwindow.cpp" line="3583"/>
<source>Reload its content from disk?</source> <source>Reload its content from disk?</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3573"/> <location filename="mainwindow.cpp" line="3594"/>
<source>File &apos;%1&apos; was removed.</source> <source>File &apos;%1&apos; was removed.</source>
<translation>&apos;%1&apos;</translation> <translation>&apos;%1&apos;</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3573"/> <location filename="mainwindow.cpp" line="3594"/>
<source>Keep it open?</source> <source>Keep it open?</source>
<translation>C++</translation> <translation>C++</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="3659"/> <location filename="mainwindow.cpp" line="3680"/>
<source>Open</source> <source>Open</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="4031"/> <location filename="mainwindow.cpp" line="4052"/>
<source>Compile Failed</source> <source>Compile Failed</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="4037"/> <location filename="mainwindow.cpp" line="4058"/>
<source>Run Failed</source> <source>Run Failed</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="4283"/> <location filename="mainwindow.cpp" line="4303"/>
<location filename="mainwindow.cpp" line="4297"/> <location filename="mainwindow.cpp" line="4317"/>
<source>Confirm Convertion</source> <source>Confirm Convertion</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="4284"/> <location filename="mainwindow.cpp" line="4304"/>
<location filename="mainwindow.cpp" line="4298"/> <location filename="mainwindow.cpp" line="4318"/>
<source>The editing file will be saved using %1 encoding. &lt;br /&gt;This operation can&apos;t be reverted. &lt;br /&gt;Are you sure to continue?</source> <source>The editing file will be saved using %1 encoding. &lt;br /&gt;This operation can&apos;t be reverted. &lt;br /&gt;Are you sure to continue?</source>
<translation>使%1&lt;br /&gt;&lt;br /&gt;</translation> <translation>使%1&lt;br /&gt;&lt;br /&gt;</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="4448"/> <location filename="mainwindow.cpp" line="4468"/>
<source>New Watch Expression</source> <source>New Watch Expression</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="4449"/> <location filename="mainwindow.cpp" line="4469"/>
<source>Enter Watch Expression (it is recommended to use &apos;this-&gt;&apos; for class members):</source> <source>Enter Watch Expression (it is recommended to use &apos;this-&gt;&apos; for class members):</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="4502"/> <location filename="mainwindow.cpp" line="4522"/>
<source>Parsing file %1 of %2: &quot;%3&quot;</source> <source>Parsing file %1 of %2: &quot;%3&quot;</source>
<translation>%1/%2&quot;%3&quot;</translation> <translation>%1/%2&quot;%3&quot;</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="4524"/> <location filename="mainwindow.cpp" line="4544"/>
<location filename="mainwindow.cpp" line="4530"/> <location filename="mainwindow.cpp" line="4550"/>
<source>Done parsing %1 files in %2 seconds</source> <source>Done parsing %1 files in %2 seconds</source>
<translation>%1,%2</translation> <translation>%1,%2</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="4527"/> <location filename="mainwindow.cpp" line="4547"/>
<source>(%1 files per second)</source> <source>(%1 files per second)</source>
<translation>(%1</translation> <translation>(%1</translation>
</message> </message>
@ -5325,22 +5335,22 @@ Are you really want to continue?</oldsource>
<context> <context>
<name>OJProblemCasesRunner</name> <name>OJProblemCasesRunner</name>
<message> <message>
<location filename="compiler/ojproblemcasesrunner.cpp" line="125"/> <location filename="compiler/ojproblemcasesrunner.cpp" line="126"/>
<source>The runner process &apos;%1&apos; failed to start.</source> <source>The runner process &apos;%1&apos; failed to start.</source>
<translation>&apos;%1&apos;</translation> <translation>&apos;%1&apos;</translation>
</message> </message>
<message> <message>
<location filename="compiler/ojproblemcasesrunner.cpp" line="132"/> <location filename="compiler/ojproblemcasesrunner.cpp" line="133"/>
<source>The last waitFor...() function timed out.</source> <source>The last waitFor...() function timed out.</source>
<translation>waitFor()</translation> <translation>waitFor()</translation>
</message> </message>
<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> <source>An error occurred when attempting to write to the runner process.</source>
<translation></translation> <translation></translation>
</message> </message>
<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> <source>An error occurred when attempting to read from the runner process.</source>
<translation></translation> <translation></translation>
</message> </message>
@ -5391,83 +5401,98 @@ Are you really want to continue?</oldsource>
<translation>&apos;%1&apos;!</translation> <translation>&apos;%1&apos;!</translation>
</message> </message>
<message> <message>
<location filename="project.cpp" line="252"/> <location filename="project.cpp" line="254"/>
<source>untitled</source> <source>untitled</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="project.cpp" line="521"/> <location filename="project.cpp" line="548"/>
<source>Can&apos;t save file</source> <source>Can&apos;t save file</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="project.cpp" line="522"/> <location filename="project.cpp" line="549"/>
<source>Can&apos;t save file &apos;%1&apos;</source> <source>Can&apos;t save file &apos;%1&apos;</source>
<translation>&apos;%1&apos;.</translation> <translation>&apos;%1&apos;.</translation>
</message> </message>
<message> <message>
<location filename="project.cpp" line="714"/> <location filename="project.cpp" line="741"/>
<source>Error Load File</source> <source>Error Load File</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="project.cpp" line="824"/> <location filename="project.cpp" line="853"/>
<source>File Exists</source> <source>File Exists</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="project.cpp" line="825"/> <location filename="project.cpp" line="854"/>
<source>File &apos;%1&apos; is already in the project</source> <source>File &apos;%1&apos; is already in the project</source>
<translation>&apos;%1&apos;</translation> <translation>&apos;%1&apos;</translation>
</message> </message>
<message> <message>
<location filename="project.cpp" line="1203"/> <location filename="project.cpp" line="1232"/>
<source>Project Updated</source> <source>Project Updated</source>
<translation></translation> <translation></translation>
</message> </message>
<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> <source>Your project was succesfully updated to a newer file format!</source>
<translation></translation> <translation></translation>
</message> </message>
<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: &apos;%1&apos;...</source> <source>If something has gone wrong, we kept a backup-file: &apos;%1&apos;...</source>
<translation>&apos;%1&apos;</translation> <translation>&apos;%1&apos;</translation>
</message> </message>
<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> <source>Settings need update</source>
<translation></translation> <translation></translation>
</message> </message>
<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> <source>The compiler settings format of Red Panda C++ has changed.</source>
<oldsource>The compiler settings format of Dev-C++ has changed.</oldsource> <oldsource>The compiler settings format of Dev-C++ has changed.</oldsource>
<translation>C++</translation> <translation>C++</translation>
</message> </message>
<message> <message>
<location filename="project.cpp" line="1372"/> <location filename="project.cpp" line="1454"/>
<source>Please update your settings at Project &gt;&gt; Project Options &gt;&gt; Compiler and save your project.</source> <source>Please update your settings at Project &gt;&gt; Project Options &gt;&gt; Compiler and save your project.</source>
<translation> &gt;&gt; &gt;&gt; </translation> <translation> &gt;&gt; &gt;&gt; </translation>
</message> </message>
<message> <message>
<location filename="project.cpp" line="1408"/> <location filename="project.cpp" line="1491"/>
<source>Compiler not found</source> <source>Compiler not found</source>
<translation></translation> <translation></translation>
</message> </message>
<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> <source>The compiler set you have selected for this project, no longer exists.</source>
<translation></translation> <translation></translation>
</message> </message>
<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> <source>It will be substituted by the global compiler set.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="project.cpp" line="1450"/> <location filename="project.cpp" line="1533"/>
<source>Developed using the Red Panda C++ IDE</source> <source>Developed using the Red Panda C++ IDE</source>
<oldsource>Developed using the Red Panda Dev-C++ IDE</oldsource> <oldsource>Developed using the Red Panda Dev-C++ IDE</oldsource>
<translation>使C++</translation> <translation>使C++</translation>
@ -5696,12 +5721,12 @@ Are you really want to continue?</oldsource>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/projectfileswidget.cpp" line="251"/> <location filename="settingsdialog/projectfileswidget.cpp" line="250"/>
<source>Auto detect</source> <source>Auto detect</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/projectfileswidget.cpp" line="252"/> <location filename="settingsdialog/projectfileswidget.cpp" line="251"/>
<source>ANSI</source> <source>ANSI</source>
<translation>ANSI</translation> <translation>ANSI</translation>
</message> </message>
@ -5710,7 +5735,7 @@ Are you really want to continue?</oldsource>
<translation type="vanished">ANSI</translation> <translation type="vanished">ANSI</translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/projectfileswidget.cpp" line="253"/> <location filename="settingsdialog/projectfileswidget.cpp" line="252"/>
<source>UTF-8</source> <source>UTF-8</source>
<translation></translation> <translation></translation>
</message> </message>
@ -5874,24 +5899,24 @@ Are you really want to continue?</oldsource>
<context> <context>
<name>ProjectModel</name> <name>ProjectModel</name>
<message> <message>
<location filename="project.cpp" line="1967"/> <location filename="project.cpp" line="2050"/>
<source>File exists</source> <source>File exists</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="project.cpp" line="1968"/> <location filename="project.cpp" line="2051"/>
<source>File &apos;%1&apos; already exists. Delete it now?</source> <source>File &apos;%1&apos; already exists. Delete it now?</source>
<translation>&apos;%1&apos;</translation> <translation>&apos;%1&apos;</translation>
</message> </message>
<message> <message>
<location filename="project.cpp" line="1986"/> <location filename="project.cpp" line="2069"/>
<location filename="project.cpp" line="2006"/> <location filename="project.cpp" line="2089"/>
<source>Remove failed</source> <source>Remove failed</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="project.cpp" line="1987"/> <location filename="project.cpp" line="2070"/>
<location filename="project.cpp" line="2007"/> <location filename="project.cpp" line="2090"/>
<source>Failed to remove file &apos;%1&apos;</source> <source>Failed to remove file &apos;%1&apos;</source>
<translation>&apos;%1&apos;</translation> <translation>&apos;%1&apos;</translation>
</message> </message>
@ -7273,7 +7298,7 @@ Are you really want to continue?</oldsource>
<translation></translation> <translation></translation>
</message> </message>
<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="169"/>
<location filename="settingsdialog/settingsdialog.cpp" line="202"/> <location filename="settingsdialog/settingsdialog.cpp" line="202"/>
<location filename="settingsdialog/settingsdialog.cpp" line="208"/> <location filename="settingsdialog/settingsdialog.cpp" line="208"/>
@ -7349,15 +7374,15 @@ Are you really want to continue?</oldsource>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="5816"/> <location filename="mainwindow.cpp" line="5834"/>
<location filename="mainwindow.cpp" line="6125"/> <location filename="mainwindow.cpp" line="6147"/>
<location filename="settingsdialog/settingsdialog.cpp" line="202"/> <location filename="settingsdialog/settingsdialog.cpp" line="202"/>
<location filename="settingsdialog/settingsdialog.cpp" line="205"/> <location filename="settingsdialog/settingsdialog.cpp" line="205"/>
<source>Program Runner</source> <source>Program Runner</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="6124"/> <location filename="mainwindow.cpp" line="6146"/>
<location filename="settingsdialog/settingsdialog.cpp" line="205"/> <location filename="settingsdialog/settingsdialog.cpp" line="205"/>
<source>Problem Set</source> <source>Problem Set</source>
<translation></translation> <translation></translation>

View File

@ -314,7 +314,7 @@ QList<PIconSet> IconsManager::listIconSets()
while(dirIter.hasNext()) { while(dirIter.hasNext()) {
dirIter.next(); dirIter.next();
QFileInfo fileInfo = dirIter.fileInfo(); QFileInfo fileInfo = dirIter.fileInfo();
if (!fileInfo.isHidden() && fileInfo.isDir()) { if (!fileInfo.isHidden() && !fileInfo.fileName().startsWith('.') && fileInfo.isDir()) {
PIconSet pSet = std::make_shared<IconSet>(); PIconSet pSet = std::make_shared<IconSet>();
pSet->name = fileInfo.baseName(); pSet->name = fileInfo.baseName();
pSet->displayName = pSet->name; pSet->displayName = pSet->name;

View File

@ -2520,6 +2520,20 @@ void MainWindow::buildContextMenus()
mProject->removeFolder(folderNode); mProject->removeFolder(folderNode);
mProject->saveOptions(); 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 //context menu signal for class browser
ui->tabStructure->setContextMenuPolicy(Qt::CustomContextMenu); ui->tabStructure->setContextMenuPolicy(Qt::CustomContextMenu);
@ -2928,7 +2942,7 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos)
menu.addAction(mProject_Rename_Unit); menu.addAction(mProject_Rename_Unit);
} }
menu.addSeparator(); menu.addSeparator();
if (onFolder) { if (onFolder && mProject->modelType()==ProjectModelType::Custom) {
menu.addAction(mProject_Add_Folder); menu.addAction(mProject_Add_Folder);
if (!onRoot) { if (!onRoot) {
menu.addAction(mProject_Rename_Folder); menu.addAction(mProject_Rename_Folder);
@ -2941,6 +2955,11 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos)
menu.addAction(ui->actionProject_Open_Folder_In_Explorer); menu.addAction(ui->actionProject_Open_Folder_In_Explorer);
menu.addAction(ui->actionProject_Open_In_Terminal); menu.addAction(ui->actionProject_Open_In_Terminal);
menu.addSeparator(); menu.addSeparator();
if (mProject->modelType() == ProjectModelType::Custom) {
menu.addAction(mProject_SwitchFileSystemViewMode);
} else {
menu.addAction(mProject_SwitchCustomViewMode);
}
menu.addAction(ui->actionProject_options); menu.addAction(ui->actionProject_options);
menu.exec(ui->projectView->mapToGlobal(pos)); menu.exec(ui->projectView->mapToGlobal(pos));

View File

@ -650,6 +650,8 @@ private:
QAction * mProject_Rename_Unit; QAction * mProject_Rename_Unit;
QAction * mProject_Rename_Folder; QAction * mProject_Rename_Folder;
QAction * mProject_Remove_Folder; QAction * mProject_Remove_Folder;
QAction * mProject_SwitchFileSystemViewMode;
QAction * mProject_SwitchCustomViewMode;
//actions for class browser //actions for class browser
QAction * mClassBrowser_Sort_By_Type; QAction * mClassBrowser_Sort_By_Type;

View File

@ -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","filename", toByteArray(extractRelativePath(directory(),mFilename)));
ini.SetValue("Project","name", toByteArray(mName)); ini.SetValue("Project","name", toByteArray(mName));
ini.SaveFile(mFilename.toLocal8Bit()); ini.SaveFile(mFilename.toLocal8Bit());
mNode = makeProjectNode(); mRootNode = makeProjectNode();
} }
resetCppParser(mParser,mOptions.compilerSet); resetCppParser(mParser,mOptions.compilerSet);
} }
@ -141,7 +141,7 @@ void Project::open()
ini.LoadFile(mFilename.toLocal8Bit()); ini.LoadFile(mFilename.toLocal8Bit());
loadOptions(ini); loadOptions(ini);
mNode = makeProjectNode(); mRootNode = makeProjectNode();
checkProjectFileForUpdate(ini); checkProjectFileForUpdate(ini);
int uCount = ini.GetLongValue("Project","UnitCount",0); int uCount = ini.GetLongValue("Project","UnitCount",0);
@ -211,7 +211,7 @@ PProjectModelNode Project::makeNewFileNode(const QString &s, bool isFolder, PPro
{ {
PProjectModelNode node = std::make_shared<ProjectModelNode>(); PProjectModelNode node = std::make_shared<ProjectModelNode>();
if (!newParent) { if (!newParent) {
newParent = mNode; newParent = mRootNode;
} }
newParent->children.append(node); newParent->children.append(node);
node->parent = newParent; node->parent = newParent;
@ -219,8 +219,10 @@ PProjectModelNode Project::makeNewFileNode(const QString &s, bool isFolder, PPro
if (newParent) { if (newParent) {
node->level = newParent->level+1; node->level = newParent->level+1;
} }
if (isFolder) if (isFolder) {
node->unitIndex = -1; node->unitIndex = -1;
node->priority = 0;
}
return node; return node;
} }
@ -239,10 +241,10 @@ PProjectUnit Project::newUnit(PProjectModelNode parentNode, const QString& custo
// Select folder to add unit to // Select folder to add unit to
if (!parentNode) if (!parentNode)
parentNode = mNode; // project root node parentNode = mRootNode; // project root node
if (parentNode->unitIndex>=0) { //it's a file if (parentNode->unitIndex>=0) { //it's a file
parentNode = mNode; parentNode = mRootNode;
} }
QString s; QString s;
QDir dir(directory()); QDir dir(directory());
@ -309,10 +311,13 @@ Editor *Project::openUnit(int index)
void Project::rebuildNodes() void Project::rebuildNodes()
{ {
qDebug()<<(int)mOptions.modelType;
mModel.beginUpdate(); mModel.beginUpdate();
// Delete everything // Delete everything
mNode->children.clear(); mRootNode->children.clear();
mFolderNodes.clear();
mSpecialNodes.clear();
mFileSystemFolderNodes.clear();
// Recreate everything // Recreate everything
switch(mOptions.modelType) { switch(mOptions.modelType) {
@ -320,20 +325,36 @@ void Project::rebuildNodes()
createFolderNodes(); createFolderNodes();
for (int idx=0;idx<mUnits.count();idx++) { for (int idx=0;idx<mUnits.count();idx++) {
QFileInfo fileInfo(mUnits[idx]->fileName());
mUnits[idx]->setNode( mUnits[idx]->setNode(
makeNewFileNode( makeNewFileNode(
extractRelativePath(filename(),mUnits[idx]->fileName()), fileInfo.fileName(),
false, false,
folderNodeFromName(mUnits[idx]->folder()) folderNodeFromName(mUnits[idx]->folder())
) )
); );
mUnits[idx]->node()->unitIndex = idx; mUnits[idx]->node()->unitIndex = idx;
mUnits[idx]->node()->priority = mUnits[idx]->priority();
} }
break; break;
case ProjectModelType::FileSystem: case ProjectModelType::FileSystem:
createFileSystemFolderNodes(); 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(); mModel.endUpdate();
emit nodesChanged(); emit nodesChanged();
@ -617,7 +638,7 @@ void Project::setCompilerOption(const QString &optionString, char value)
void Project::updateFolders() void Project::updateFolders()
{ {
mFolders.clear(); mFolders.clear();
updateFolderNode(mNode); updateFolderNode(mRootNode);
for (int idx = 0; idx < mUnits.count();idx++) for (int idx = 0; idx < mUnits.count();idx++)
mUnits[idx]->setFolder( mUnits[idx]->setFolder(
getFolderPath( getFolderPath(
@ -636,10 +657,10 @@ void Project::updateNodeIndexes()
PProjectModelNode Project::pointerToNode(ProjectModelNode *p, PProjectModelNode parent) PProjectModelNode Project::pointerToNode(ProjectModelNode *p, PProjectModelNode parent)
{ {
if (!parent) { if (!parent) {
parent = mNode; parent = mRootNode;
} }
if (p==mNode.get()) if (p==mRootNode.get())
return mNode; return mRootNode;
foreach (const PProjectModelNode& node , parent->children) { foreach (const PProjectModelNode& node , parent->children) {
if (node.get()==p) if (node.get()==p)
return node; return node;
@ -693,16 +714,16 @@ bool Project::assignTemplate(const std::shared_ptr<ProjectTemplate> aTemplate, b
QFile::copy( QFile::copy(
QDir(pSettings->dirs().templateDir()).absoluteFilePath(templateUnit->Source), QDir(pSettings->dirs().templateDir()).absoluteFilePath(templateUnit->Source),
includeTrailingPathDelimiter(this->directory())+target); includeTrailingPathDelimiter(this->directory())+target);
unit = newUnit(mNode, target); unit = newUnit(mRootNode, target);
} else { } else {
QString s; QString s;
PProjectUnit unit; PProjectUnit unit;
if (mOptions.isCpp) { if (mOptions.isCpp) {
s = templateUnit->CppText; s = templateUnit->CppText;
unit = newUnit(mNode, templateUnit->CppName); unit = newUnit(mRootNode, templateUnit->CppName);
} else { } else {
s = templateUnit->CText; s = templateUnit->CText;
unit = newUnit(mNode,templateUnit->CName); unit = newUnit(mRootNode,templateUnit->CName);
} }
Editor * editor = pMainWindow->editorList()->newEditor( Editor * editor = pMainWindow->editorList()->newEditor(
@ -730,6 +751,7 @@ bool Project::assignTemplate(const std::shared_ptr<ProjectTemplate> aTemplate, b
} }
} }
} }
rebuildNodes();
return true; return true;
} }
@ -1228,9 +1250,8 @@ void Project::closeUnit(int index)
void Project::createFolderNodes() void Project::createFolderNodes()
{ {
mFolderNodes.clear();
for (int idx=0;idx<mFolders.count();idx++) { for (int idx=0;idx<mFolders.count();idx++) {
PProjectModelNode node = mNode; PProjectModelNode node = mRootNode;
QString s = mFolders[idx]; QString s = mFolders[idx];
int i = s.indexOf('/'); int i = s.indexOf('/');
while (i>=0) { while (i>=0) {
@ -1255,17 +1276,39 @@ void Project::createFolderNodes()
void Project::createFileSystemFolderNodes() void Project::createFileSystemFolderNodes()
{ {
mFolderNodes.clear(); PProjectModelNode node = makeNewFileNode(tr("Headers"),true,mRootNode);
PProjectModelNode node = makeNewFileNode(tr("Headers"),true,mNode); createFileSystemFolderNode(ProjectSpecialFolderNode::HEADERS,folder(),node);
createFileSystemFolderNode(folder(),node); node->priority = 1000;
mFolderNodes.append(node);
node = makeNewFileNode(tr("Sources"),true,mNode);
createFileSystemFolderNode(folder(),node);
mFolderNodes.append(node);
node = makeNewFileNode(tr("Sources"),true,mNode);
createFileSystemFolderNode(folder(),node);
mFolderNodes.append(node); 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() void Project::doAutoOpen()
@ -1282,13 +1325,25 @@ bool Project::fileAlreadyExists(const QString &s)
return false; return false;
} }
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) PProjectModelNode Project::folderNodeFromName(const QString &name)
{ {
int index = mFolders.indexOf(name); int index = mFolders.indexOf(name);
if (index>=0) { if (index>=0) {
return mFolderNodes[index]; return mFolderNodes[index];
} }
return mNode; return mRootNode;
} }
char Project::getCompilerOption(const QString &optionString) char Project::getCompilerOption(const QString &optionString)
@ -1314,7 +1369,7 @@ QString Project::getFolderPath(PProjectModelNode node)
return result; return result;
PProjectModelNode p = node; PProjectModelNode p = node;
while (p && p->unitIndex==-1 && p!=mNode) { while (p && p->unitIndex==-1 && p!=mRootNode) {
if (!result.isEmpty()) if (!result.isEmpty())
result = p->text + "/" + result; result = p->text + "/" + result;
else else
@ -1329,6 +1384,20 @@ int Project::getUnitFromString(const QString &s)
return indexInUnits(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() void Project::incrementBuildNumber()
{ {
mOptions.versionInfo.build++; mOptions.versionInfo.build++;
@ -1342,15 +1411,6 @@ void Project::incrementBuildNumber()
setModified(true); 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() void Project::loadLayout()
{ {
SimpleIni layIni; SimpleIni layIni;
@ -1525,30 +1585,6 @@ PCppParser Project::cppParser()
return mParser; 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 int Project::indexInUnits(const QString &fileName) const
{ {
QDir dir(directory()); QDir dir(directory());
@ -1621,6 +1657,19 @@ const QList<PProjectUnit> &Project::units() const
return mUnits; 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() ProjectOptions &Project::options()
{ {
return mOptions; return mOptions;
@ -1633,7 +1682,7 @@ ProjectModel *Project::model()
const PProjectModelNode &Project::rootNode() const const PProjectModelNode &Project::rootNode() const
{ {
return mNode; return mRootNode;
} }
const QString &Project::name() const const QString &Project::name() const
@ -1645,7 +1694,7 @@ void Project::setName(const QString &newName)
{ {
if (newName != mName) { if (newName != mName) {
mName = newName; mName = newName;
mNode->text = newName; mRootNode->text = newName;
setModified(true); setModified(true);
} }
} }
@ -1775,7 +1824,11 @@ int ProjectUnit::priority() const
void ProjectUnit::setPriority(int newPriority) void ProjectUnit::setPriority(int newPriority)
{ {
if (mPriority!=newPriority) {
mPriority = newPriority; mPriority = newPriority;
if (mNode)
mNode->priority = mPriority;
}
} }
const QByteArray &ProjectUnit::encoding() const const QByteArray &ProjectUnit::encoding() const
@ -1946,6 +1999,12 @@ Qt::ItemFlags ProjectModel::flags(const QModelIndex &index) const
return Qt::NoItemFlags; return Qt::NoItemFlags;
if (p==mProject->rootNode().get()) if (p==mProject->rootNode().get())
return Qt::ItemIsEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEditable; 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; Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
if (p->unitIndex<0) { if (p->unitIndex<0) {
flags.setFlag(Qt::ItemIsDropEnabled); flags.setFlag(Qt::ItemIsDropEnabled);
@ -1953,6 +2012,7 @@ Qt::ItemFlags ProjectModel::flags(const QModelIndex &index) const
} }
return flags; return flags;
} }
}
bool ProjectModel::setData(const QModelIndex &index, const QVariant &value, int role) bool ProjectModel::setData(const QModelIndex &index, const QVariant &value, int role)
{ {
@ -2036,6 +2096,11 @@ bool ProjectModel::setData(const QModelIndex &index, const QVariant &value, int
// Add new filename to file minitor // Add new filename to file minitor
pMainWindow->fileSystemWatcher()->addPath(newName); 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); emit dataChanged(index,index);
return true; return true;
} else { } else {
@ -2225,5 +2290,7 @@ bool ProjectModelSortFilterProxy::lessThan(const QModelIndex &source_left, const
return true; return true;
if (pLeft->unitIndex>=0 && pRight->unitIndex<0) if (pLeft->unitIndex>=0 && pRight->unitIndex<0)
return false; return false;
if (pLeft->priority!=pRight->priority)
return pLeft->priority>pRight->priority;
return QString::compare(pLeft->text, pRight->text)<0; return QString::compare(pLeft->text, pRight->text)<0;
} }

View File

@ -33,6 +33,7 @@ struct ProjectModelNode {
QString text; QString text;
std::weak_ptr<ProjectModelNode> parent; std::weak_ptr<ProjectModelNode> parent;
int unitIndex; int unitIndex;
int priority;
QList<PProjectModelNode> children; QList<PProjectModelNode> children;
int level; int level;
}; };
@ -132,6 +133,13 @@ protected:
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override; bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
}; };
enum ProjectSpecialFolderNode {
HEADERS,
SOURCES,
OTHERS,
NonSpecial
};
class ProjectTemplate; class ProjectTemplate;
class Project : public QObject class Project : public QObject
{ {
@ -152,27 +160,19 @@ public:
bool rebuild); bool rebuild);
QString folder(); QString folder();
void buildPrivateResource(bool forceSave=false); void buildPrivateResource(bool forceSave=false);
void checkProjectFileForUpdate(SimpleIni& ini);
void closeUnit(int index); void closeUnit(int index);
void createFolderNodes();
void doAutoOpen(); void doAutoOpen();
bool fileAlreadyExists(const QString& s); bool fileAlreadyExists(const QString& s);
PProjectModelNode folderNodeFromName(const QString& name);
char getCompilerOption(const QString& optionString); char getCompilerOption(const QString& optionString);
QString getFolderPath(PProjectModelNode node); QString getFolderPath(PProjectModelNode node);
int getUnitFromString(const QString& s); int getUnitFromString(const QString& s);
void incrementBuildNumber(); void incrementBuildNumber();
int indexInUnits(const QString& fileName) const; int indexInUnits(const QString& fileName) const;
int indexInUnits(const Editor* editor) 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
PProjectModelNode makeNewFileNode(const QString& s, bool isFolder, PProjectModelNode newParent);
PProjectModelNode makeProjectNode();
PProjectUnit newUnit(PProjectModelNode parentNode, PProjectUnit newUnit(PProjectModelNode parentNode,
const QString& customFileName=""); const QString& customFileName="");
Editor* openUnit(int index); Editor* openUnit(int index);
PProjectModelNode pointerToNode(ProjectModelNode * p, PProjectModelNode parent=PProjectModelNode());
void rebuildNodes(); void rebuildNodes();
bool removeUnit(int index, bool doClose, bool removeFile = false); bool removeUnit(int index, bool doClose, bool removeFile = false);
bool removeFolder(PProjectModelNode node); bool removeFolder(PProjectModelNode node);
@ -181,17 +181,13 @@ public:
void saveLayout(); // save all [UnitX] void saveLayout(); // save all [UnitX]
void saveOptions(); void saveOptions();
void saveUnitAs(int i, const QString& sFileName, bool syncEditor = true); // save single [UnitX] 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(); bool saveUnits();
PProjectUnit findUnitByFilename(const QString& filename); PProjectUnit findUnitByFilename(const QString& filename);
void associateEditor(Editor* editor); void associateEditor(Editor* editor);
void associateEditorToUnit(Editor* editor, PProjectUnit unit); void associateEditorToUnit(Editor* editor, PProjectUnit unit);
void setCompilerOption(const QString& optionString, char value); void setCompilerOption(const QString& optionString, char value);
void sortUnitsByPriority();
void sortUnitsByAlpha();
void updateFolders(); void updateFolders();
void updateNodeIndexes(); void updateNodeIndexes();
PProjectModelNode pointerToNode(ProjectModelNode * p, PProjectModelNode parent=PProjectModelNode());
void setCompilerSet(int compilerSetIndex); void setCompilerSet(int compilerSetIndex);
//void showOptions(); //void showOptions();
@ -212,12 +208,29 @@ public:
const QList<PProjectUnit> &units() const; const QList<PProjectUnit> &units() const;
ProjectModelType modelType() const;
void setModelType(ProjectModelType type);
signals: signals:
void nodesChanged(); void nodesChanged();
void modifyChanged(bool value); void modifyChanged(bool value);
private: 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 open();
void removeFolderRecurse(PProjectModelNode node); void removeFolderRecurse(PProjectModelNode node);
void saveUnitLayout(Editor* e, int index); // save single [UnitX] cursor positions
void updateFolderNode(PProjectModelNode node); void updateFolderNode(PProjectModelNode node);
void updateCompilerSetType(); void updateCompilerSetType();
@ -230,7 +243,9 @@ private:
QStringList mFolders; QStringList mFolders;
std::shared_ptr<CppParser> mParser; std::shared_ptr<CppParser> mParser;
QList<PProjectModelNode> mFolderNodes; QList<PProjectModelNode> mFolderNodes;
PProjectModelNode mNode; PProjectModelNode mRootNode;
QHash<ProjectSpecialFolderNode, PProjectModelNode> mSpecialNodes;
QHash<QString, PProjectModelNode> mFileSystemFolderNodes;
ProjectModel mModel; ProjectModel mModel;
}; };

View File

@ -148,6 +148,7 @@ void ProjectTemplate::readTemplateFile(const QString &fileName)
} else { } else {
mOptions.encoding = fromByteArray(mIni->GetValue("Project","Encoding", ENCODING_AUTO_DETECT)); mOptions.encoding = fromByteArray(mIni->GetValue("Project","Encoding", ENCODING_AUTO_DETECT));
} }
mOptions.modelType = (ProjectModelType)mIni->GetLongValue("Project", "ModelType", (int)ProjectModelType::FileSystem);
} }

View File

@ -56,7 +56,6 @@ void ProjectFilesWidget::doSave()
unit->setBuildCmd(unitCopy->buildCmd()); unit->setBuildCmd(unitCopy->buildCmd());
unit->setEncoding(unitCopy->encoding()); unit->setEncoding(unitCopy->encoding());
} }
pMainWindow->project()->sortUnitsByPriority();
pMainWindow->project()->saveUnits(); pMainWindow->project()->saveUnits();
copyUnits(); copyUnits();
ui->treeProject->expandAll(); ui->treeProject->expandAll();

View File

@ -1116,7 +1116,7 @@ void copyFolder(const QString &fromDir, const QString &toDir)
while (it.hasNext()){ while (it.hasNext()){
it.next(); it.next();
const auto fileInfo = it.fileInfo(); 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 subPathStructure = fileInfo.absoluteFilePath().mid(absSourcePathLength);
const QString constructedAbsolutePath = targetDir.absolutePath() + subPathStructure; const QString constructedAbsolutePath = targetDir.absolutePath() + subPathStructure;
if(fileInfo.isDir()){ if(fileInfo.isDir()){

View File

@ -7,7 +7,7 @@ SUBDIRS += \
APP_NAME = RedPandaCPP APP_NAME = RedPandaCPP
APP_VERSION = 0.14.1 APP_VERSION = 0.14.2
linux: { linux: {