- feature: autosave

This commit is contained in:
royqh1979@gmail.com 2021-08-30 22:05:45 +08:00
parent 1684f9a71d
commit 08805cfb7e
14 changed files with 745 additions and 184 deletions

View File

@ -29,6 +29,7 @@ SOURCES += \
qsynedit/SearchBase.cpp \ qsynedit/SearchBase.cpp \
qsynedit/SearchRegex.cpp \ qsynedit/SearchRegex.cpp \
settingsdialog/debuggeneralwidget.cpp \ settingsdialog/debuggeneralwidget.cpp \
settingsdialog/editorautosavewidget.cpp \
settingsdialog/editorcodecompletionwidget.cpp \ settingsdialog/editorcodecompletionwidget.cpp \
settingsdialog/editormiscwidget.cpp \ settingsdialog/editormiscwidget.cpp \
widgets/classbrowser.cpp \ widgets/classbrowser.cpp \
@ -97,6 +98,7 @@ HEADERS += \
qsynedit/SearchBase.h \ qsynedit/SearchBase.h \
qsynedit/SearchRegex.h \ qsynedit/SearchRegex.h \
settingsdialog/debuggeneralwidget.h \ settingsdialog/debuggeneralwidget.h \
settingsdialog/editorautosavewidget.h \
settingsdialog/editorcodecompletionwidget.h \ settingsdialog/editorcodecompletionwidget.h \
settingsdialog/editormiscwidget.h \ settingsdialog/editormiscwidget.h \
widgets/classbrowser.h \ widgets/classbrowser.h \
@ -151,6 +153,7 @@ HEADERS += \
FORMS += \ FORMS += \
settingsdialog/debuggeneralwidget.ui \ settingsdialog/debuggeneralwidget.ui \
settingsdialog/editorautosavewidget.ui \
settingsdialog/editorcodecompletionwidget.ui \ settingsdialog/editorcodecompletionwidget.ui \
settingsdialog/editormiscwidget.ui \ settingsdialog/editormiscwidget.ui \
widgets/cpudialog.ui \ widgets/cpudialog.ui \

Binary file not shown.

View File

@ -532,59 +532,140 @@ Are you really want to continue?</source>
<translation type="vanished"></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="editor.cpp" line="170"/> <location filename="editor.cpp" line="180"/>
<location filename="editor.cpp" line="182"/> <location filename="editor.cpp" line="192"/>
<location filename="editor.cpp" line="210"/> <location filename="editor.cpp" line="224"/>
<location filename="editor.cpp" line="767"/> <location filename="editor.cpp" line="792"/>
<location filename="editor.cpp" line="772"/> <location filename="editor.cpp" line="797"/>
<location filename="editor.cpp" line="790"/> <location filename="editor.cpp" line="815"/>
<location filename="editor.cpp" line="795"/> <location filename="editor.cpp" line="820"/>
<source>Error</source> <source>Error</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="editor.cpp" line="171"/> <location filename="editor.cpp" line="181"/>
<source>File %1 is not writable!</source> <source>File %1 is not writable!</source>
<translation>&quot;%1&quot;</translation> <translation>&quot;%1&quot;</translation>
</message> </message>
<message> <message>
<location filename="editor.cpp" line="198"/> <location filename="editor.cpp" line="212"/>
<source>Save As</source> <source>Save As</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="editor.cpp" line="768"/> <location filename="editor.cpp" line="793"/>
<source>The text to be copied exceeds count limit!</source> <source>The text to be copied exceeds count limit!</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="editor.cpp" line="773"/> <location filename="editor.cpp" line="798"/>
<source>The text to be copied exceeds character limit!</source> <source>The text to be copied exceeds character limit!</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="editor.cpp" line="791"/> <location filename="editor.cpp" line="816"/>
<source>The text to be cut exceeds count limit!</source> <source>The text to be cut exceeds count limit!</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="editor.cpp" line="796"/> <location filename="editor.cpp" line="821"/>
<source>The text to be cut exceeds character limit!</source> <source>The text to be cut exceeds character limit!</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="editor.cpp" line="1965"/> <location filename="editor.cpp" line="1990"/>
<location filename="editor.cpp" line="2002"/> <location filename="editor.cpp" line="2027"/>
<location filename="editor.cpp" line="2053"/> <location filename="editor.cpp" line="2078"/>
<source>Ctrl+click for more info</source> <source>Ctrl+click for more info</source>
<translation>Ctrl+</translation> <translation>Ctrl+</translation>
</message> </message>
<message> <message>
<location filename="editor.cpp" line="2556"/> <location filename="editor.cpp" line="2096"/>
<location filename="editor.cpp" line="2126"/>
<source>Symbol &apos;%1&apos; not found!</source>
<translation>&apos;%1&apos;!</translation>
</message>
<message>
<location filename="editor.cpp" line="2636"/>
<source>Readonly</source> <source>Readonly</source>
<translation></translation> <translation></translation>
</message> </message>
</context> </context>
<context>
<name>EditorAutoSaveWidget</name>
<message>
<location filename="settingsdialog/editorautosavewidget.ui" line="14"/>
<source>Form</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/editorautosavewidget.ui" line="20"/>
<source>Enable auto save</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/editorautosavewidget.ui" line="44"/>
<source>Time interval:</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/editorautosavewidget.ui" line="51"/>
<source>minutes</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/editorautosavewidget.ui" line="80"/>
<source>Objects to save</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/editorautosavewidget.ui" line="86"/>
<source>Current File</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/editorautosavewidget.ui" line="93"/>
<source>All files openned</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/editorautosavewidget.ui" line="100"/>
<source>Project files</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/editorautosavewidget.ui" line="110"/>
<source>Save strategy</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/editorautosavewidget.ui" line="116"/>
<source>Overwrite</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/editorautosavewidget.ui" line="123"/>
<source>Append UNIX timestamp</source>
<translation>Unix时间戳</translation>
</message>
<message>
<location filename="settingsdialog/editorautosavewidget.ui" line="130"/>
<source>Append formatted timestamp</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/editorautosavewidget.ui" line="140"/>
<source>Demo file name:</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/editorautosavewidget.cpp" line="22"/>
<location filename="settingsdialog/editorautosavewidget.cpp" line="24"/>
<location filename="settingsdialog/editorautosavewidget.cpp" line="28"/>
<source>Demo file name: </source>
<translation></translation>
</message>
</context>
<context> <context>
<name>EditorClipboardWidget</name> <name>EditorClipboardWidget</name>
<message> <message>
@ -1256,7 +1337,7 @@ Are you really want to continue?</source>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="267"/> <location filename="mainwindow.ui" line="267"/>
<location filename="mainwindow.cpp" line="1100"/> <location filename="mainwindow.cpp" line="1178"/>
<source>Issues</source> <source>Issues</source>
<translation></translation> <translation></translation>
</message> </message>
@ -1449,8 +1530,8 @@ Are you really want to continue?</source>
<message> <message>
<location filename="mainwindow.ui" line="994"/> <location filename="mainwindow.ui" line="994"/>
<location filename="mainwindow.ui" line="997"/> <location filename="mainwindow.ui" line="997"/>
<location filename="mainwindow.cpp" line="776"/> <location filename="mainwindow.cpp" line="790"/>
<location filename="mainwindow.cpp" line="787"/> <location filename="mainwindow.cpp" line="801"/>
<source>Compile</source> <source>Compile</source>
<translation></translation> <translation></translation>
</message> </message>
@ -1742,20 +1823,20 @@ Are you really want to continue?</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="311"/> <location filename="mainwindow.cpp" line="315"/>
<location filename="mainwindow.cpp" line="313"/> <location filename="mainwindow.cpp" line="317"/>
<source>Debugging</source> <source>Debugging</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="316"/> <location filename="mainwindow.cpp" line="320"/>
<location filename="mainwindow.cpp" line="318"/> <location filename="mainwindow.cpp" line="322"/>
<source>Running</source> <source>Running</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="321"/> <location filename="mainwindow.cpp" line="325"/>
<location filename="mainwindow.cpp" line="323"/> <location filename="mainwindow.cpp" line="327"/>
<source>Compiling</source> <source>Compiling</source>
<translation></translation> <translation></translation>
</message> </message>
@ -1764,145 +1845,150 @@ Are you really want to continue?</source>
<translation type="vanished">:%1 :%2 :%3 :%4 :%5</translation> <translation type="vanished">:%1 :%2 :%3 :%4 :%5</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="439"/> <location filename="mainwindow.cpp" line="453"/>
<source>Line:%1 Col:%2 Selected:%3 Lines:%4 Length:%5</source> <source>Line:%1 Col:%2 Selected:%3 Lines:%4 Length:%5</source>
<translation>:%1 :%2 :%3 :%4 :%5</translation> <translation>:%1 :%2 :%3 :%4 :%5</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="457"/> <location filename="mainwindow.cpp" line="471"/>
<source>Read Only</source> <source>Read Only</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="459"/> <location filename="mainwindow.cpp" line="473"/>
<source>Insert</source> <source>Insert</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="461"/> <location filename="mainwindow.cpp" line="475"/>
<source>Overwrite</source> <source>Overwrite</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="586"/> <location filename="mainwindow.cpp" line="600"/>
<location filename="mainwindow.cpp" line="601"/> <location filename="mainwindow.cpp" line="615"/>
<source>Confirm</source> <source>Confirm</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="587"/> <location filename="mainwindow.cpp" line="601"/>
<location filename="mainwindow.cpp" line="595"/> <location filename="mainwindow.cpp" line="609"/>
<location filename="mainwindow.cpp" line="777"/> <location filename="mainwindow.cpp" line="791"/>
<source>Source file is not compiled.</source> <source>Source file is not compiled.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="588"/> <location filename="mainwindow.cpp" line="602"/>
<location filename="mainwindow.cpp" line="777"/> <location filename="mainwindow.cpp" line="791"/>
<source>Compile now?</source> <source>Compile now?</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="602"/> <location filename="mainwindow.cpp" line="616"/>
<location filename="mainwindow.cpp" line="788"/> <location filename="mainwindow.cpp" line="802"/>
<source>Source file is more recent than executable.</source> <source>Source file is more recent than executable.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="603"/> <location filename="mainwindow.cpp" line="617"/>
<source>Recompile now?</source> <source>Recompile now?</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="655"/> <location filename="mainwindow.cpp" line="669"/>
<source>No compiler set</source> <source>No compiler set</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="656"/> <location filename="mainwindow.cpp" line="670"/>
<source>No compiler set is configured.</source> <source>No compiler set is configured.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="656"/> <location filename="mainwindow.cpp" line="670"/>
<source>Can&apos;t start debugging.</source> <source>Can&apos;t start debugging.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="745"/> <location filename="mainwindow.cpp" line="759"/>
<source>Enable debugging</source> <source>Enable debugging</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="746"/> <location filename="mainwindow.cpp" line="760"/>
<source>You have not enabled debugging info (-g3) and/or stripped it from the executable (-s) in Compiler Options.&lt;BR /&gt;&lt;BR /&gt;Do you want to correct this now?</source> <source>You have not enabled debugging info (-g3) and/or stripped it from the executable (-s) in Compiler Options.&lt;BR /&gt;&lt;BR /&gt;Do you want to correct this now?</source>
<translation>(-g3)(-s)&lt;br /&gt;&lt;br/&gt;</translation> <translation>(-g3)(-s)&lt;br /&gt;&lt;br/&gt;</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="788"/> <location filename="mainwindow.cpp" line="802"/>
<source>Recompile?</source> <source>Recompile?</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="994"/> <location filename="mainwindow.cpp" line="1021"/>
<location filename="mainwindow.cpp" line="1013"/> <source>%1 files autosaved</source>
<location filename="mainwindow.cpp" line="1035"/> <translation>%1</translation>
<location filename="mainwindow.cpp" line="1047"/> </message>
<location filename="mainwindow.cpp" line="1343"/> <message>
<location filename="mainwindow.cpp" line="1355"/> <location filename="mainwindow.cpp" line="1067"/>
<location filename="mainwindow.cpp" line="1091"/>
<location filename="mainwindow.cpp" line="1113"/>
<location filename="mainwindow.cpp" line="1125"/>
<location filename="mainwindow.cpp" line="1421"/>
<location filename="mainwindow.cpp" line="1433"/>
<source>Error</source> <source>Error</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="1009"/> <location filename="mainwindow.cpp" line="1087"/>
<source>Open</source> <source>Open</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="1191"/> <location filename="mainwindow.cpp" line="1269"/>
<source>Compile Failed</source> <source>Compile Failed</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="1196"/> <location filename="mainwindow.cpp" line="1274"/>
<source>Run Failed</source> <source>Run Failed</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="1372"/> <location filename="mainwindow.cpp" line="1450"/>
<location filename="mainwindow.cpp" line="1386"/> <location filename="mainwindow.cpp" line="1464"/>
<source>Confirm Convertion</source> <source>Confirm Convertion</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="1373"/> <location filename="mainwindow.cpp" line="1451"/>
<location filename="mainwindow.cpp" line="1387"/> <location filename="mainwindow.cpp" line="1465"/>
<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="1562"/> <location filename="mainwindow.cpp" line="1640"/>
<source>New Watch Expression</source> <source>New Watch Expression</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="1563"/> <location filename="mainwindow.cpp" line="1641"/>
<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="1609"/> <location filename="mainwindow.cpp" line="1687"/>
<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="1631"/> <location filename="mainwindow.cpp" line="1709"/>
<location filename="mainwindow.cpp" line="1637"/> <location filename="mainwindow.cpp" line="1715"/>
<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="1634"/> <location filename="mainwindow.cpp" line="1712"/>
<source>(%1 files per second)</source> <source>(%1 files per second)</source>
<translation>(%1</translation> <translation>(%1</translation>
</message> </message>
@ -1974,216 +2060,216 @@ Are you really want to continue?</source>
<translation>&quot;%1&quot;</translation> <translation>&quot;%1&quot;</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1113"/> <location filename="settings.cpp" line="1197"/>
<location filename="settings.cpp" line="1132"/> <location filename="settings.cpp" line="1216"/>
<location filename="settings.cpp" line="1144"/> <location filename="settings.cpp" line="1228"/>
<location filename="settings.cpp" line="1156"/> <location filename="settings.cpp" line="1240"/>
<source>The following %1 directories don&apos;t exist:</source> <source>The following %1 directories don&apos;t exist:</source>
<translation>%1</translation> <translation>%1</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1114"/> <location filename="settings.cpp" line="1198"/>
<location filename="settings.cpp" line="1124"/> <location filename="settings.cpp" line="1208"/>
<source>binary</source> <source>binary</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1123"/> <location filename="settings.cpp" line="1207"/>
<source>No %1 directories have been specified.</source> <source>No %1 directories have been specified.</source>
<translation>%1</translation> <translation>%1</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1133"/> <location filename="settings.cpp" line="1217"/>
<source>C include</source> <source>C include</source>
<translation>C包含</translation> <translation>C包含</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1145"/> <location filename="settings.cpp" line="1229"/>
<location filename="settings.cpp" line="1157"/> <location filename="settings.cpp" line="1241"/>
<source>C++ include</source> <source>C++ include</source>
<translation>C++</translation> <translation>C++</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1176"/> <location filename="settings.cpp" line="1260"/>
<location filename="settings.cpp" line="1181"/> <location filename="settings.cpp" line="1265"/>
<location filename="settings.cpp" line="1186"/> <location filename="settings.cpp" line="1270"/>
<location filename="settings.cpp" line="1191"/> <location filename="settings.cpp" line="1275"/>
<source>Cannot find the %1 &quot;%2&quot;</source> <source>Cannot find the %1 &quot;%2&quot;</source>
<translation>%1&quot;%2&quot;</translation> <translation>%1&quot;%2&quot;</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1662"/> <location filename="settings.cpp" line="1746"/>
<source>C options</source> <source>C options</source>
<translation>C语言选项</translation> <translation>C语言选项</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1663"/> <location filename="settings.cpp" line="1747"/>
<source>Support all ANSI standard C programs (-ansi)</source> <source>Support all ANSI standard C programs (-ansi)</source>
<translation>ANSI标准C程序(-ansi)</translation> <translation>ANSI标准C程序(-ansi)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1664"/> <location filename="settings.cpp" line="1748"/>
<source>Do not recognize asm,inline or typeof as a keyword (-fno-asm)</source> <source>Do not recognize asm,inline or typeof as a keyword (-fno-asm)</source>
<translation>asminline和typeof作为关键字(-fno-asm)</translation> <translation>asminline和typeof作为关键字(-fno-asm)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1665"/> <location filename="settings.cpp" line="1749"/>
<source>Imitate traditional C preprocessors (-traditional-cpp)</source> <source>Imitate traditional C preprocessors (-traditional-cpp)</source>
<translation>仿C预处理器行为(-traditional-cpp)</translation> <translation>仿C预处理器行为(-traditional-cpp)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1668"/> <location filename="settings.cpp" line="1752"/>
<source>Code Generation</source> <source>Code Generation</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1697"/> <location filename="settings.cpp" line="1781"/>
<source>Optimize for the following machine (-march)</source> <source>Optimize for the following machine (-march)</source>
<translation>(-march)</translation> <translation>(-march)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1698"/> <location filename="settings.cpp" line="1782"/>
<source>Optimize less, while maintaining full compatibility (-tune)</source> <source>Optimize less, while maintaining full compatibility (-tune)</source>
<translation>(-tune)</translation> <translation>(-tune)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1718"/> <location filename="settings.cpp" line="1802"/>
<source>Enable use of specific instructions (-mx)</source> <source>Enable use of specific instructions (-mx)</source>
<translation>(-mx)</translation> <translation>(-mx)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1729"/> <location filename="settings.cpp" line="1813"/>
<source>Optimization level (-Ox)</source> <source>Optimization level (-Ox)</source>
<translation>(-Ox)</translation> <translation>(-Ox)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1736"/> <location filename="settings.cpp" line="1820"/>
<source>Compile with the following pointer size (-mx)</source> <source>Compile with the following pointer size (-mx)</source>
<translation>使(-mx)</translation> <translation>使(-mx)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1759"/> <location filename="settings.cpp" line="1843"/>
<source>Language standard (-std)</source> <source>Language standard (-std)</source>
<translation>(-std)</translation> <translation>(-std)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1760"/> <location filename="settings.cpp" line="1844"/>
<source>Generate debugging information (-g3)</source> <source>Generate debugging information (-g3)</source>
<translation>(-g3)</translation> <translation>(-g3)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1761"/> <location filename="settings.cpp" line="1845"/>
<source>Generate profiling info for analysis (-pg)</source> <source>Generate profiling info for analysis (-pg)</source>
<translation>(-pg)</translation> <translation>(-pg)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1764"/> <location filename="settings.cpp" line="1848"/>
<source>Warnings</source> <source>Warnings</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1765"/> <location filename="settings.cpp" line="1849"/>
<source>Inhibit all warning messages (-w)</source> <source>Inhibit all warning messages (-w)</source>
<translation>(-w)</translation> <translation>(-w)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1766"/> <location filename="settings.cpp" line="1850"/>
<source>Show most warnings (-Wall)</source> <source>Show most warnings (-Wall)</source>
<translation>(-Wall)</translation> <translation>(-Wall)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1767"/> <location filename="settings.cpp" line="1851"/>
<source>Show some more warnings (-Wextra)</source> <source>Show some more warnings (-Wextra)</source>
<translation>(-Wextra)</translation> <translation>(-Wextra)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1768"/> <location filename="settings.cpp" line="1852"/>
<source>Check ISO C/C++/C++0x conformance (-pedantic)</source> <source>Check ISO C/C++/C++0x conformance (-pedantic)</source>
<translation>ISO C/C++/C++0x(-pedantic)</translation> <translation>ISO C/C++/C++0x(-pedantic)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1769"/> <location filename="settings.cpp" line="1853"/>
<source>Only check the code for syntax errors (-fsyntax-only)</source> <source>Only check the code for syntax errors (-fsyntax-only)</source>
<translation>(-fsyntax-only)</translation> <translation>(-fsyntax-only)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1770"/> <location filename="settings.cpp" line="1854"/>
<source>Make all warnings into errors (-Werror)</source> <source>Make all warnings into errors (-Werror)</source>
<translation>(-Werror)</translation> <translation>(-Werror)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1771"/> <location filename="settings.cpp" line="1855"/>
<source>Abort compilation on first error (-Wfatal-errors)</source> <source>Abort compilation on first error (-Wfatal-errors)</source>
<translation>(-Wfatal-errors)</translation> <translation>(-Wfatal-errors)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1774"/> <location filename="settings.cpp" line="1858"/>
<source>Linker</source> <source>Linker</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1775"/> <location filename="settings.cpp" line="1859"/>
<source>Link an Objective C program (-lobjc)</source> <source>Link an Objective C program (-lobjc)</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1776"/> <location filename="settings.cpp" line="1860"/>
<source>Do not use standard system libraries (-nostdlib)</source> <source>Do not use standard system libraries (-nostdlib)</source>
<translation>使(-nostdlib)</translation> <translation>使(-nostdlib)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1777"/> <location filename="settings.cpp" line="1861"/>
<source>Do not create a console window (-mwindows)</source> <source>Do not create a console window (-mwindows)</source>
<translation>(-mwindows)</translation> <translation>(-mwindows)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1778"/> <location filename="settings.cpp" line="1862"/>
<source>Strip executable (-s)</source> <source>Strip executable (-s)</source>
<translation>(-s)</translation> <translation>(-s)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1779"/> <location filename="settings.cpp" line="1863"/>
<source>Link libraries statically (-static)</source> <source>Link libraries statically (-static)</source>
<translation>Ojbective C程序(-lobjc)</translation> <translation>Ojbective C程序(-lobjc)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1782"/> <location filename="settings.cpp" line="1866"/>
<source>Output</source> <source>Output</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1783"/> <location filename="settings.cpp" line="1867"/>
<source>Put comments in generated assembly code (-fverbose-asm)</source> <source>Put comments in generated assembly code (-fverbose-asm)</source>
<translation>(-fverbose-asm)</translation> <translation>(-fverbose-asm)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1784"/> <location filename="settings.cpp" line="1868"/>
<source>Use pipes instead of temporary files during compilation (-pipe)</source> <source>Use pipes instead of temporary files during compilation (-pipe)</source>
<translation>使(-pipe)</translation> <translation>使(-pipe)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1785"/> <location filename="settings.cpp" line="1869"/>
<source>Do not assemble, compile and generate the assemble code (-S)</source> <source>Do not assemble, compile and generate the assemble code (-S)</source>
<translation>(-S)</translation> <translation>(-S)</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1978"/> <location filename="settings.cpp" line="2062"/>
<location filename="settings.cpp" line="2003"/> <location filename="settings.cpp" line="2087"/>
<source>Confirm</source> <source>Confirm</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="1979"/> <location filename="settings.cpp" line="2063"/>
<source>The following problems were found during validation of compiler set &quot;%1&quot;:</source> <source>The following problems were found during validation of compiler set &quot;%1&quot;:</source>
<translation>&quot;%1&quot;</translation> <translation>&quot;%1&quot;</translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="2004"/> <location filename="settings.cpp" line="2088"/>
<source>Compiler set not configuared.</source> <source>Compiler set not configuared.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settings.cpp" line="2006"/> <location filename="settings.cpp" line="2090"/>
<source>Would you like Red Panda C++ to search for compilers in the following locations: &lt;BR /&gt;&apos;%1&apos;&lt;BR /&gt;&apos;%2&apos;? </source> <source>Would you like Red Panda C++ to search for compilers in the following locations: &lt;BR /&gt;&apos;%1&apos;&lt;BR /&gt;&apos;%2&apos;? </source>
<translation>C++&lt;br /&gt;%1&lt;br /&gt;%2</translation> <translation>C++&lt;br /&gt;%1&lt;br /&gt;%2</translation>
</message> </message>
@ -2836,90 +2922,102 @@ Are you really want to continue?</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/settingsdialog.cpp" line="31"/> <location filename="settingsdialog/settingsdialog.cpp" line="33"/>
<source>Appearence</source> <source>Appearence</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/settingsdialog.cpp" line="31"/> <location filename="settingsdialog/settingsdialog.cpp" line="33"/>
<source>Environment</source> <source>Environment</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/settingsdialog.cpp" line="35"/> <location filename="settingsdialog/settingsdialog.cpp" line="37"/>
<source>Compiler Set</source> <source>Compiler Set</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/settingsdialog.cpp" line="35"/> <location filename="settingsdialog/settingsdialog.cpp" line="37"/>
<source>Compiler</source> <source>Compiler</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/settingsdialog.cpp" line="39"/> <location filename="settingsdialog/settingsdialog.cpp" line="41"/>
<location filename="settingsdialog/settingsdialog.cpp" line="68"/> <location filename="settingsdialog/settingsdialog.cpp" line="78"/>
<location filename="settingsdialog/settingsdialog.cpp" line="72"/> <location filename="settingsdialog/settingsdialog.cpp" line="82"/>
<source>General</source> <source>General</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/settingsdialog.cpp" line="39"/> <location filename="settingsdialog/settingsdialog.cpp" line="41"/>
<location filename="settingsdialog/settingsdialog.cpp" line="43"/> <location filename="settingsdialog/settingsdialog.cpp" line="45"/>
<location filename="settingsdialog/settingsdialog.cpp" line="47"/> <location filename="settingsdialog/settingsdialog.cpp" line="49"/>
<location filename="settingsdialog/settingsdialog.cpp" line="51"/> <location filename="settingsdialog/settingsdialog.cpp" line="53"/>
<location filename="settingsdialog/settingsdialog.cpp" line="55"/> <location filename="settingsdialog/settingsdialog.cpp" line="57"/>
<location filename="settingsdialog/settingsdialog.cpp" line="59"/> <location filename="settingsdialog/settingsdialog.cpp" line="61"/>
<location filename="settingsdialog/settingsdialog.cpp" line="63"/> <location filename="settingsdialog/settingsdialog.cpp" line="65"/>
<location filename="settingsdialog/settingsdialog.cpp" line="69"/>
<location filename="settingsdialog/settingsdialog.cpp" line="73"/>
<source>Editor</source> <source>Editor</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/settingsdialog.cpp" line="43"/> <location filename="settingsdialog/settingsdialog.cpp" line="45"/>
<source>Font</source> <source>Font</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/settingsdialog.cpp" line="47"/> <location filename="settingsdialog/settingsdialog.cpp" line="49"/>
<source>Copy &amp; Export</source> <source>Copy &amp; Export</source>
<translation>/</translation> <translation>/</translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/settingsdialog.cpp" line="51"/> <location filename="settingsdialog/settingsdialog.cpp" line="53"/>
<source>Color</source> <source>Color</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/settingsdialog.cpp" line="55"/> <location filename="settingsdialog/settingsdialog.cpp" line="57"/>
<source>Code Completion</source> <source>Code Completion</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/settingsdialog.cpp" line="59"/> <location filename="settingsdialog/settingsdialog.cpp" line="61"/>
<source>Symbol Completion</source> <source>Symbol Completion</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/settingsdialog.cpp" line="63"/> <location filename="settingsdialog/settingsdialog.cpp" line="65"/>
<source>Auto Syntax Checking</source> <source>Auto Syntax Checking</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/settingsdialog.cpp" line="68"/> <location filename="settingsdialog/settingsdialog.cpp" line="69"/>
<source>Auto save</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/settingsdialog.cpp" line="73"/>
<source>Misc</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/settingsdialog.cpp" line="78"/>
<source>Program Runner</source> <source>Program Runner</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/settingsdialog.cpp" line="72"/> <location filename="settingsdialog/settingsdialog.cpp" line="82"/>
<source>Debugger</source> <source>Debugger</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/settingsdialog.cpp" line="164"/> <location filename="settingsdialog/settingsdialog.cpp" line="174"/>
<source>Save Changes</source> <source>Save Changes</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="settingsdialog/settingsdialog.cpp" line="165"/> <location filename="settingsdialog/settingsdialog.cpp" line="175"/>
<source>There are changes in the settings, do you want to save them before swtich to other page?</source> <source>There are changes in the settings, do you want to save them before swtich to other page?</source>
<translation></translation> <translation></translation>
</message> </message>

View File

@ -161,16 +161,6 @@ void Editor::saveFile(const QString &filename) {
pMainWindow->updateForEncodingInfo(); pMainWindow->updateForEncodingInfo();
if (pSettings->editor().syntaxCheck() && pSettings->editor().syntaxCheckWhenSave()) if (pSettings->editor().syntaxCheck() && pSettings->editor().syntaxCheckWhenSave())
pMainWindow->checkSyntaxInBack(this); pMainWindow->checkSyntaxInBack(this);
switch(getFileType(mFilename)) {
case FileType::CppSource:
mUseCppSyntax = true;
break;
case FileType::CSource:
mUseCppSyntax = false;
break;
default:
mUseCppSyntax = pSettings->editor().defaultFileCpp();
}
} }
void Editor::convertToEncoding(const QByteArray &encoding) void Editor::convertToEncoding(const QByteArray &encoding)
@ -235,6 +225,16 @@ bool Editor::saveAs(){
exception.reason()); exception.reason());
return false; return false;
} }
switch(getFileType(mFilename)) {
case FileType::CppSource:
mUseCppSyntax = true;
break;
case FileType::CSource:
mUseCppSyntax = false;
break;
default:
mUseCppSyntax = pSettings->editor().defaultFileCpp();
}
//todo: update (reassign highlighter) //todo: update (reassign highlighter)
//todo: remove old file from parser and reparse file //todo: remove old file from parser and reparse file
@ -2093,7 +2093,7 @@ void Editor::gotoDeclaration(const BufferCoord &pos)
mFilename,phrase,pos.Line); mFilename,phrase,pos.Line);
if (!statement) { if (!statement) {
pMainWindow->updateStatusBarMessage(tr("Symbol '%1' not found!").arg(phrase)); pMainWindow->updateStatusbarMessage(tr("Symbol '%1' not found!").arg(phrase));
return; return;
} }
QString filename; QString filename;
@ -2123,7 +2123,7 @@ void Editor::gotoDefinition(const BufferCoord &pos)
mFilename,phrase,pos.Line); mFilename,phrase,pos.Line);
if (!statement) { if (!statement) {
pMainWindow->updateStatusBarMessage(tr("Symbol '%1' not found!").arg(phrase)); pMainWindow->updateStatusbarMessage(tr("Symbol '%1' not found!").arg(phrase));
return; return;
} }
QString filename; QString filename;

View File

@ -126,6 +126,10 @@ MainWindow::MainWindow(QWidget *parent)
mHeaderCompletionPopup = std::make_shared<HeaderCompletionPopup>(); mHeaderCompletionPopup = std::make_shared<HeaderCompletionPopup>();
updateAppTitle(); updateAppTitle();
connect(&mAutoSaveTimer, &QTimer::timeout,
this, &MainWindow::onAutoSaveTimeout);
resetAutoSaveTimer();
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -426,6 +430,16 @@ void MainWindow::updateClassBrowserForEditor(Editor *editor)
} }
} }
void MainWindow::resetAutoSaveTimer()
{
if (pSettings->editor().enableAutoSave()) {
//minute to milliseconds
mAutoSaveTimer.start(pSettings->editor().autoSaveInterval()*60*1000);
} else {
mAutoSaveTimer.stop();
}
}
QPlainTextEdit *MainWindow::txtLocals() QPlainTextEdit *MainWindow::txtLocals()
{ {
return ui->txtLocals; return ui->txtLocals;
@ -466,7 +480,7 @@ void MainWindow::updateForStatusbarModeInfo()
} }
} }
void MainWindow::updateStatusBarMessage(const QString &s) void MainWindow::updateStatusbarMessage(const QString &s)
{ {
ui->statusbar->showMessage(s); ui->statusbar->showMessage(s);
} }
@ -948,6 +962,65 @@ void MainWindow::prepareDebugger()
// mDebugger->deleteWatchVars(false); // mDebugger->deleteWatchVars(false);
} }
void MainWindow::doAutoSave(Editor *e)
{
if (!e)
return;
if (!e->modified())
return;
QString filename = e->filename();
QFileInfo fileInfo(filename);
QDir parent = fileInfo.absoluteDir();
QString baseName = fileInfo.completeBaseName();
QString suffix = fileInfo.suffix();
switch(pSettings->editor().autoSaveStrategy()) {
case assOverwrite:
break;
case assAppendUnixTimestamp:
filename = parent.filePath(
QString("%1.%2.%3")
.arg(baseName)
.arg(QDateTime::currentSecsSinceEpoch())
.arg(suffix));
break;
case assAppendFormatedTimeStamp: {
QDateTime time = QDateTime::currentDateTime();
filename = parent.filePath(
QString("%1.%2.%3")
.arg(baseName)
.arg(time.toString("yyyy.MM.dd.hh.mm.ss"))
.arg(suffix));
}
}
e->saveFile(filename);
}
void MainWindow::onAutoSaveTimeout()
{
if (!pSettings->editor().enableAutoSave())
return;
int updateCount = 0;
switch (pSettings->editor().autoSaveTarget()) {
case astCurrentFile: {
Editor *e = mEditorList->getEditor();
doAutoSave(e);
updateCount++;
}
break;
case astAllOpennedFiles:
for (int i=0;i<mEditorList->pageCount();i++) {
Editor *e = (*mEditorList)[i];
doAutoSave(e);
updateCount++;
}
break;
case astAllProjectFiles:
//todo: auto save project files
break;
}
updateStatusbarMessage(tr("%1 files autosaved").arg(updateCount));
}
const std::shared_ptr<HeaderCompletionPopup> &MainWindow::headerCompletionPopup() const const std::shared_ptr<HeaderCompletionPopup> &MainWindow::headerCompletionPopup() const
{ {
return mHeaderCompletionPopup; return mHeaderCompletionPopup;
@ -1611,7 +1684,7 @@ void MainWindow::onParserProgress(const QString &fileName, int total, int curren
// Only show if needed (it's a very slow operation) // Only show if needed (it's a very slow operation)
if (current ==1 || current % showStep==0) { if (current ==1 || current % showStep==0) {
updateStatusBarMessage(tr("Parsing file %1 of %2: \"%3\"") updateStatusbarMessage(tr("Parsing file %1 of %2: \"%3\"")
.arg(current).arg(total).arg(fileName)); .arg(current).arg(total).arg(fileName));
} }
} }
@ -1633,13 +1706,13 @@ void MainWindow::onEndParsing(int total, int)
} else { } else {
parsingFrequency = 999; parsingFrequency = 999;
} }
updateStatusBarMessage(tr("Done parsing %1 files in %2 seconds") updateStatusbarMessage(tr("Done parsing %1 files in %2 seconds")
.arg(total).arg(parseTime) .arg(total).arg(parseTime)
+ " " + " "
+ tr("(%1 files per second)") + tr("(%1 files per second)")
.arg(parsingFrequency)); .arg(parsingFrequency));
} else { } else {
updateStatusBarMessage(tr("Done parsing %1 files in %2 seconds") updateStatusbarMessage(tr("Done parsing %1 files in %2 seconds")
.arg(total).arg(parseTime)); .arg(total).arg(parseTime));
} }
} }

View File

@ -2,6 +2,7 @@
#define MAINWINDOW_H #define MAINWINDOW_H
#include <QMainWindow> #include <QMainWindow>
#include <QTimer>
#include "common.h" #include "common.h"
#include "widgets/searchresultview.h" #include "widgets/searchresultview.h"
#include "widgets/classbrowser.h" #include "widgets/classbrowser.h"
@ -52,7 +53,7 @@ public:
void updateForEncodingInfo(); void updateForEncodingInfo();
void updateStatusbarForLineCol(); void updateStatusbarForLineCol();
void updateForStatusbarModeInfo(); void updateForStatusbarModeInfo();
void updateStatusBarMessage(const QString& s); void updateStatusbarMessage(const QString& s);
void updateEditorSettings(); void updateEditorSettings();
void updateEditorActions(); void updateEditorActions();
void updateCompileActions(); void updateCompileActions();
@ -79,6 +80,8 @@ public:
void updateClassBrowserForEditor(Editor* editor); void updateClassBrowserForEditor(Editor* editor);
void resetAutoSaveTimer();
QPlainTextEdit* txtLocals(); QPlainTextEdit* txtLocals();
CPUDialog *cpuDialog() const; CPUDialog *cpuDialog() const;
@ -91,16 +94,39 @@ public:
SearchResultModel* searchResultModel(); SearchResultModel* searchResultModel();
const std::shared_ptr<CodeCompletionPopup> &completionPopup() const; const std::shared_ptr<CodeCompletionPopup> &completionPopup() const;
const std::shared_ptr<HeaderCompletionPopup> &headerCompletionPopup() const; const std::shared_ptr<HeaderCompletionPopup> &headerCompletionPopup() const;
public slots:
void onCompileLog(const QString& msg);
void onCompileIssue(PCompileIssue issue);
void onCompileFinished();
void onCompileErrorOccured(const QString& reason);
void onRunErrorOccured(const QString& reason);
void onRunFinished();
void cleanUpCPUDialog();
void onDebugCommandInput(const QString& command);
void onDebugEvaluateInput();
void onParserProgress(const QString& fileName, int total, int current);
void onStartParsing();
void onEndParsing(int total, int updateView);
void onEvalValueReady(const QString& value);
protected: protected:
void openFiles(const QStringList& files); void openFiles(const QStringList& files);
void openFile(const QString& filename); void openFile(const QString& filename);
private:
CompileTarget getCompileTarget();
bool debugInferiorhasBreakpoint();
void setupActions();
void openCloseMessageSheet(bool open);
void prepareDebugger();
void doAutoSave(Editor *e);
private slots: private slots:
void onAutoSaveTimeout();
void on_actionNew_triggered(); void on_actionNew_triggered();
void on_EditorTabsLeft_tabCloseRequested(int index); void on_EditorTabsLeft_tabCloseRequested(int index);
@ -168,9 +194,6 @@ private slots:
void on_actionDebug_triggered(); void on_actionDebug_triggered();
CompileTarget getCompileTarget();
bool debugInferiorhasBreakpoint();
void on_actionStep_Over_triggered(); void on_actionStep_Over_triggered();
void on_actionStep_Into_triggered(); void on_actionStep_Into_triggered();
@ -200,27 +223,6 @@ private slots:
void on_cbSearchHistory_currentIndexChanged(int index); void on_cbSearchHistory_currentIndexChanged(int index);
void on_btnSearchAgin_clicked(); void on_btnSearchAgin_clicked();
public slots:
void onCompileLog(const QString& msg);
void onCompileIssue(PCompileIssue issue);
void onCompileFinished();
void onCompileErrorOccured(const QString& reason);
void onRunErrorOccured(const QString& reason);
void onRunFinished();
void cleanUpCPUDialog();
void onDebugCommandInput(const QString& command);
void onDebugEvaluateInput();
void onParserProgress(const QString& fileName, int total, int current);
void onStartParsing();
void onEndParsing(int total, int updateView);
void onEvalValueReady(const QString& value);
private:
void setupActions();
void openCloseMessageSheet(bool open);
void prepareDebugger();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
EditorList *mEditorList; EditorList *mEditorList;
@ -254,6 +256,8 @@ private:
int mPreviousHeight; int mPreviousHeight;
PCompileSuccessionTask mCompileSuccessionTask; PCompileSuccessionTask mCompileSuccessionTask;
QTimer mAutoSaveTimer;
// QWidget interface // QWidget interface
protected: protected:

View File

@ -376,6 +376,46 @@ void Settings::Editor::setDefaultFileCpp(bool newDefaultFileCpp)
mDefaultFileCpp = newDefaultFileCpp; mDefaultFileCpp = newDefaultFileCpp;
} }
bool Settings::Editor::enableAutoSave() const
{
return mEnableAutoSave;
}
void Settings::Editor::setEnableAutoSave(bool newEnableAutoSave)
{
mEnableAutoSave = newEnableAutoSave;
}
int Settings::Editor::autoSaveInterval() const
{
return mAutoSaveInterval;
}
void Settings::Editor::setAutoSaveInterval(int newInterval)
{
mAutoSaveInterval = newInterval;
}
AutoSaveStrategy Settings::Editor::autoSaveStrategy() const
{
return mAutoSaveStrategy;
}
void Settings::Editor::setAutoSaveStrategy(AutoSaveStrategy newAutoSaveStrategy)
{
mAutoSaveStrategy = newAutoSaveStrategy;
}
AutoSaveTarget Settings::Editor::autoSaveTarget() const
{
return mAutoSaveTarget;
}
void Settings::Editor::setAutoSaveTarget(AutoSaveTarget newAutoSaveTarget)
{
mAutoSaveTarget = newAutoSaveTarget;
}
bool Settings::Editor::autoLoadLastFiles() const bool Settings::Editor::autoLoadLastFiles() const
{ {
return mAutoLoadLastFiles; return mAutoLoadLastFiles;
@ -831,6 +871,12 @@ void Settings::Editor::doSave()
saveValue("check_syntax_when_save",mSyntaxCheckWhenSave); saveValue("check_syntax_when_save",mSyntaxCheckWhenSave);
saveValue("check_syntax_when_line_changed",mSyntaxCheckWhenLineChanged); saveValue("check_syntax_when_line_changed",mSyntaxCheckWhenLineChanged);
//auto save
saveValue("enable_auto_save",mEnableAutoSave);
saveValue("auto_save_interal",mAutoSaveInterval);
saveValue("auto_save_target",mAutoSaveTarget);
saveValue("auto_save_strategy",mAutoSaveStrategy);
//misc //misc
saveValue("default_encoding",mDefaultEncoding); saveValue("default_encoding",mDefaultEncoding);
saveValue("readonly_system_header",mReadOnlySytemHeader); saveValue("readonly_system_header",mReadOnlySytemHeader);
@ -915,6 +961,14 @@ void Settings::Editor::doLoad()
mSyntaxCheckWhenSave = boolValue("check_syntax_when_save",true); mSyntaxCheckWhenSave = boolValue("check_syntax_when_save",true);
mSyntaxCheckWhenLineChanged = boolValue("check_syntax_when_line_changed",true); mSyntaxCheckWhenLineChanged = boolValue("check_syntax_when_line_changed",true);
//auto save
mEnableAutoSave = boolValue("enable_auto_save",false);
mAutoSaveInterval = intValue("auto_save_interal",10);
mAutoSaveTarget = static_cast<enum AutoSaveTarget>(
intValue("auto_save_target",AutoSaveTarget::astCurrentFile));
mAutoSaveStrategy = static_cast<enum AutoSaveStrategy>(
intValue("auto_save_strategy",AutoSaveStrategy::assOverwrite));
//misc //misc
mDefaultEncoding = value("default_encoding", ENCODING_SYSTEM_DEFAULT).toByteArray(); mDefaultEncoding = value("default_encoding", ENCODING_SYSTEM_DEFAULT).toByteArray();
mReadOnlySytemHeader = boolValue("readonly_system_header",true); mReadOnlySytemHeader = boolValue("readonly_system_header",true);
@ -1602,7 +1656,7 @@ void Settings::CompilerSet::setDefines() {
arguments.append("-std=c++17"); arguments.append("-std=c++17");
arguments.append(NULL_FILE); arguments.append(NULL_FILE);
QFileInfo ccompiler(mCCompiler); QFileInfo ccompiler(mCCompiler);
QByteArray output = getCompilerOutput(ccompiler.absolutePath(),ccompiler.baseName(),arguments); QByteArray output = getCompilerOutput(ccompiler.absolutePath(),ccompiler.fileName(),arguments);
// 'cpp.exe -dM -E -x c++ -std=c++17 NUL' // 'cpp.exe -dM -E -x c++ -std=c++17 NUL'
mDefines.clear(); mDefines.clear();

View File

@ -271,6 +271,18 @@ public:
bool defaultFileCpp() const; bool defaultFileCpp() const;
void setDefaultFileCpp(bool newDefaultFileCpp); void setDefaultFileCpp(bool newDefaultFileCpp);
bool enableAutoSave() const;
void setEnableAutoSave(bool newEnableAutoSave);
int autoSaveInterval() const;
void setAutoSaveInterval(int newInterval);
AutoSaveTarget autoSaveTarget() const;
void setAutoSaveTarget(AutoSaveTarget newAutoSaveTarget);
AutoSaveStrategy autoSaveStrategy() const;
void setAutoSaveStrategy(AutoSaveStrategy newAutoSaveStrategy);
private: private:
//General //General
// indents // indents
@ -346,6 +358,12 @@ public:
bool mSyntaxCheckWhenSave; bool mSyntaxCheckWhenSave;
bool mSyntaxCheckWhenLineChanged; bool mSyntaxCheckWhenLineChanged;
//auto save
bool mEnableAutoSave;
int mAutoSaveInterval;
enum AutoSaveTarget mAutoSaveTarget;
enum AutoSaveStrategy mAutoSaveStrategy;
//Misc //Misc
QByteArray mDefaultEncoding; QByteArray mDefaultEncoding;
bool mReadOnlySytemHeader; bool mReadOnlySytemHeader;

View File

@ -0,0 +1,94 @@
#include "editorautosavewidget.h"
#include "ui_editorautosavewidget.h"
#include "../settings.h"
#include "../mainwindow.h"
EditorAutoSaveWidget::EditorAutoSaveWidget(const QString& name, const QString& group,
QWidget *parent) :
SettingsWidget(name,group,parent),
ui(new Ui::EditorAutoSaveWidget)
{
ui->setupUi(this);
}
EditorAutoSaveWidget::~EditorAutoSaveWidget()
{
delete ui;
}
void EditorAutoSaveWidget::onAutoSaveStrategyChanged()
{
if (ui->rbOverwrite->isChecked()) {
ui->lblFilename->setText(tr("Demo file name: ") + "main.cpp");
} else if (ui->rbAppendUNIXTimestamp->isChecked()) {
ui->lblFilename->setText(tr("Demo file name: ") +
QString("main.%1.cpp").arg(QDateTime::currentSecsSinceEpoch()));
} else if (ui->rbAppendFormattedTimestamp->isChecked()) {
QDateTime time = QDateTime::currentDateTime();
ui->lblFilename->setText(tr("Demo file name: ") +
QString("main.%1.cpp").arg(time.toString("yyyy.MM.dd.hh.mm.ss")));
}
}
void EditorAutoSaveWidget::doLoad()
{
//pSettings->editor().load();
//font
ui->chkEnableAutoSave->setChecked(pSettings->editor().enableAutoSave());
ui->spinInterval->setValue(pSettings->editor().autoSaveInterval());
switch(pSettings->editor().autoSaveTarget()) {
case astCurrentFile:
ui->rbCurrentFile->setChecked(true);
break;
case astAllOpennedFiles:
ui->rbAllOpennedFiles->setChecked(true);
default:
ui->rbProjectFiles->setChecked(true);
}
switch(pSettings->editor().autoSaveStrategy()) {
case assOverwrite:
ui->rbOverwrite->setChecked(true);
break;
case assAppendUnixTimestamp:
ui->rbAppendUNIXTimestamp->setChecked(true);
break;
default:
ui->rbAppendFormattedTimestamp->setChecked(true);
}
}
void EditorAutoSaveWidget::doSave()
{
pSettings->editor().setEnableAutoSave(ui->chkEnableAutoSave->isChecked());
pSettings->editor().setAutoSaveInterval(ui->spinInterval->value());
if (ui->rbCurrentFile->isChecked())
pSettings->editor().setAutoSaveTarget(astCurrentFile);
else if (ui->rbAllOpennedFiles->isChecked())
pSettings->editor().setAutoSaveTarget(astAllOpennedFiles);
else
pSettings->editor().setAutoSaveTarget(astAllProjectFiles);
if (ui->rbOverwrite->isChecked())
pSettings->editor().setAutoSaveStrategy(assOverwrite);
else if (ui->rbAppendUNIXTimestamp->isChecked())
pSettings->editor().setAutoSaveStrategy(assAppendUnixTimestamp);
else
pSettings->editor().setAutoSaveStrategy(assAppendFormatedTimeStamp);
}
void EditorAutoSaveWidget::on_rbOverwrite_toggled(bool)
{
onAutoSaveStrategyChanged();
}
void EditorAutoSaveWidget::on_rbAppendUNIXTimestamp_toggled(bool)
{
onAutoSaveStrategyChanged();
}
void EditorAutoSaveWidget::on_rbAppendFormattedTimestamp_toggled(bool)
{
onAutoSaveStrategyChanged();
}

View File

@ -0,0 +1,34 @@
#ifndef EDITORAUTOSAVEWIDGET_H
#define EDITORAUTOSAVEWIDGET_H
#include <QWidget>
#include "settingswidget.h"
namespace Ui {
class EditorAutoSaveWidget;
}
class EditorAutoSaveWidget : public SettingsWidget
{
Q_OBJECT
public:
explicit EditorAutoSaveWidget(const QString& name, const QString& group, QWidget *parent = nullptr);
~EditorAutoSaveWidget();
private:
void onAutoSaveStrategyChanged();
private:
Ui::EditorAutoSaveWidget *ui;
// SettingsWidget interface
protected:
void doLoad() override;
void doSave() override;
private slots:
void on_rbOverwrite_toggled(bool checked);
void on_rbAppendUNIXTimestamp_toggled(bool checked);
void on_rbAppendFormattedTimestamp_toggled(bool checked);
};
#endif // EDITORAUTOSAVEWIDGET_H

View File

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditorAutoSaveWidget</class>
<widget class="QWidget" name="EditorAutoSaveWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>469</width>
<height>459</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="chkEnableAutoSave">
<property name="title">
<string>Enable auto save</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Time interval:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinInterval">
<property name="suffix">
<string>minutes</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>60</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Objects to save</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QRadioButton" name="rbCurrentFile">
<property name="text">
<string>Current File</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbAllOpennedFiles">
<property name="text">
<string>All files openned</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbProjectFiles">
<property name="text">
<string>Project files</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Save strategy</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QRadioButton" name="rbOverwrite">
<property name="text">
<string>Overwrite</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbAppendUNIXTimestamp">
<property name="text">
<string>Append UNIX timestamp</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbAppendFormattedTimestamp">
<property name="text">
<string>Append formatted timestamp</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="lblFilename">
<property name="text">
<string>Demo file name:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -9,6 +9,7 @@
#include "editorcodecompletionwidget.h" #include "editorcodecompletionwidget.h"
#include "editorsyntaxcheckwidget.h" #include "editorsyntaxcheckwidget.h"
#include "editorsymbolcompletionwidget.h" #include "editorsymbolcompletionwidget.h"
#include "editorautosavewidget.h"
#include "editormiscwidget.h" #include "editormiscwidget.h"
#include "environmentappearencewidget.h" #include "environmentappearencewidget.h"
#include "executorgeneralwidget.h" #include "executorgeneralwidget.h"
@ -65,6 +66,10 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
pEditorSyntaxCheckWidget->init(); pEditorSyntaxCheckWidget->init();
addWidget(pEditorSyntaxCheckWidget); addWidget(pEditorSyntaxCheckWidget);
pEditorAutoSaveWidget = new EditorAutoSaveWidget(tr("Auto save"),tr("Editor"));
pEditorAutoSaveWidget->init();
addWidget(pEditorAutoSaveWidget);
pEditorMiscWidget = new EditorMiscWidget(tr("Misc"),tr("Editor")); pEditorMiscWidget = new EditorMiscWidget(tr("Misc"),tr("Editor"));
pEditorMiscWidget->init(); pEditorMiscWidget->init();
addWidget(pEditorMiscWidget); addWidget(pEditorMiscWidget);

View File

@ -18,6 +18,7 @@ class EditorSymbolCompletionWidget;
class EditorColorSchemeWidget; class EditorColorSchemeWidget;
class EditorSyntaxCheckWidget; class EditorSyntaxCheckWidget;
class EditorCodeCompletionWidget; class EditorCodeCompletionWidget;
class EditorAutoSaveWidget;
class EditorMiscWidget; class EditorMiscWidget;
class EnvironmentAppearenceWidget; class EnvironmentAppearenceWidget;
class ExecutorGeneralWidget; class ExecutorGeneralWidget;
@ -60,6 +61,7 @@ private:
EditorSymbolCompletionWidget *pEditorSymbolCompletionWidget; EditorSymbolCompletionWidget *pEditorSymbolCompletionWidget;
EditorCodeCompletionWidget *pEditorCodeCompletionWidget; EditorCodeCompletionWidget *pEditorCodeCompletionWidget;
EditorSyntaxCheckWidget *pEditorSyntaxCheckWidget; EditorSyntaxCheckWidget *pEditorSyntaxCheckWidget;
EditorAutoSaveWidget *pEditorAutoSaveWidget;
EditorMiscWidget *pEditorMiscWidget; EditorMiscWidget *pEditorMiscWidget;
ExecutorGeneralWidget *pExecutorGeneralWidget; ExecutorGeneralWidget *pExecutorGeneralWidget;
DebugGeneralWidget *pDebugGeneralWidget; DebugGeneralWidget *pDebugGeneralWidget;

View File

@ -40,6 +40,18 @@ enum class SearchFileScope {
openedFiles openedFiles
}; };
enum AutoSaveTarget {
astCurrentFile,
astAllOpennedFiles,
astAllProjectFiles
};
enum AutoSaveStrategy {
assOverwrite,
assAppendUnixTimestamp,
assAppendFormatedTimeStamp
};
class BaseError{ class BaseError{
public: public:
explicit BaseError(const QString& reason); explicit BaseError(const QString& reason);