From db39094d8d37e9ebb3ecc9af90101c6f240ff2dc Mon Sep 17 00:00:00 2001 From: "royqh1979@gmail.com" Date: Wed, 21 Apr 2021 23:06:55 +0800 Subject: [PATCH] * show name and size of the compiled file --- RedPandaIDE/RedPandaIDE_zh_CN.ts | 683 +++++++++++++++++++++++++- RedPandaIDE/compiler/compiler.cpp | 7 +- RedPandaIDE/compiler/compiler.h | 1 + RedPandaIDE/compiler/filecompiler.cpp | 8 +- RedPandaIDE/editor.cpp | 3 + RedPandaIDE/mainwindow.cpp | 64 +++ RedPandaIDE/mainwindow.h | 16 + RedPandaIDE/mainwindow.ui | 109 ++++ 8 files changed, 859 insertions(+), 32 deletions(-) diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts index 277c4b50..ef3c0aa0 100644 --- a/RedPandaIDE/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts @@ -1,6 +1,222 @@ + + Compiler + + + Compile Result: + 编译结果: + + + + - Errors: %1 + - 错误数: %1 + + + + - Warnings: %1 + - 警告数: %1 + + + + - Time Elasped: %1 secs + - 编译时间: %1 秒 + + + + CompilerSetDirectoriesWidget + + + Form + + + + + + Add + + + + + + Delete + + + + + + Remove Invalid + + + + + Choose Folder + + + + + CompilerSetOptionWidget + + + Form + + + + + Compiler set to config + + + + + + + + + + + + + + + ... + + + + + General + + + + + Add the following arguments when calling the compiler + + + + + Add the following arguments when calling the linker + + + + + Add Charset arguments when calling the compiler + + + + + Settings + + + + + Directories + + + + + Programs + + + + + TextLabel + + + + + Resource Compiler(windres) + + + + + C++ Compiler(g++) + + + + + Choose C++ Compiler + + + + + Choose C Compiler + + + + + C Compiler(gcc) + + + + + Debugger(gdb) + + + + + Profiler(gprof) + + + + + make + + + + + Choose make + + + + + Choose Debugger + + + + + Choose Resource Compiler + + + + + Choose Profiler + + + + + Confirm + + + + + Red Panda C++ will clear current compiler list and search for compilers in the following locations: + '%1' +'%2' +Are you really want to continue? + + + + + + Compiler Set Name + + + + + Name + + + + + Compiler Set Folder + + + + + New name + + + Editor @@ -9,38 +225,82 @@ 无标题 - + Error - + Can't Open File %1:%2 - + Failed to Save file %1: %2 - + Failed to Open file %1: %2 - - - + + + Fail - + Save As 另存为 + + FileCompiler + + + Compiling single file... + + + + + - Filename: %1 + + + + + - Compiler Set Name: %1 + + + + + Can't delete the old executable file "%1". + + + + + + Can't the compiler for file %1 + + + + + Processing %1 source file: + + + + + %1 Compiler: %2 + + + + + Command: %1 %2 + + + MainWindow @@ -50,83 +310,200 @@ - Tab 1 - Tab 2 - + + Compiler Output + + + + File 文件 - + + Tools + + + + + + + Run + + + + + Edit + + + + + toolBar - + + toolBar_2 + + + + New 新建 - + Ctrl+N - + Open... 打开... - + Ctrl+O - + Save 保存 - + Ctrl+S - + Save As... 另存为... - + Save As 另存为 - + Save All 全部保存 - + Ctrl+Shift+S - + + Options + + + + + + Compile + + + + + F9 + + + + + F10 + + + + + Undo + + + + + Ctrl+Z + + + + + Redo + + + + + Ctrl+Y + + + + + Cut + + + + + Ctrl+X + + + + + Copy + + + + + Ctrl+C + + + + + Paste + + + + + Ctrl+V + + + + + Select All + + + + + Ctrl+A + + + + + Indent + + + + + UnIndent + + + + Line: %1 Col: %2 Lines: %3 Chars: %4 - + Open @@ -134,12 +511,12 @@ QObject - + Save 保存 - + Save changes to %1? @@ -148,7 +525,7 @@ 保存修改后的内容到"%s"? - + File %s is not writable! @@ -177,5 +554,257 @@ All files + + + + Error + + + + + Can't create configuration folder %1 + + + + + Can't write to configuration file %1 + + + + + C options + + + + + Code Generation + + + + + Binaries + + + + + Libraries + + + + + C Includes + + + + + C++ Includes + + + + + No + + + + + Yes + + + + + Settings::CompilerSet + + + Support all ANSI standard C programs (-ansi) + + + + + Do not recognize asm,inline or typeof as a keyword (-fno-asm) + + + + + Imitate traditional C preprocessors (-traditional-cpp) + + + + + Optimize for the following machine (-march) + + + + + Optimize less, while maintaining full compatibility (-tune) + + + + + Enable use of specific instructions (-mx) + + + + + Optimization level (-Ox) + + + + + Compile with the following pointer size (-mx) + + + + + Language standard (-std) + + + + + Generate debugging information (-g3) + + + + + Generate profiling info for analysis (-pg) + + + + + Warnings + + + + + Inhibit all warning messages (-w) + + + + + Show most warnings (-Wall) + + + + + Show some more warnings (-Wextra) + + + + + Check ISO C/C++/C++0x conformance (-pedantic) + + + + + Only check the code for syntax errors (-fsyntax-only) + + + + + Make all warnings into errors (-Werror) + + + + + Abort compilation on first error (-Wfatal-errors) + + + + + Linker + + + + + Link an Objective C program (-lobjc) + + + + + Do not use standard system libraries (-nostdlib) + + + + + Do not create a console window (-mwindows) + + + + + Strip executable (-s) + + + + + Link libraries statically (-static) + + + + + Output + + + + + -fverbose-asm + + + + + Use pipes instead of temporary files during compilation (-pipe) + + + + + Do not assemble, compile and generate the assemble code (-S) + + + + + SettingsDialog + + + Options + + + + + TextLabel + + + + + OK + + + + + Apply + + + + + Cancle + + + + + Compiler Set + + + + + Compiler + + + + + Save Changes + + + + + There are changes in the settings, do you want to save them before swtich to other page? + + diff --git a/RedPandaIDE/compiler/compiler.cpp b/RedPandaIDE/compiler/compiler.cpp index ae21c58c..312bd6bf 100644 --- a/RedPandaIDE/compiler/compiler.cpp +++ b/RedPandaIDE/compiler/compiler.cpp @@ -29,7 +29,12 @@ void Compiler::run() log("------------------"); log(tr("- Errors: %1").arg(0)); log(tr("- Warnings: %1").arg(0)); - log(tr("- Time Elasped: %1 secs").arg(timer.elapsed() / 1000.0)); + if (!mOutputFile.isEmpty()) { + log(tr("- Output Filename: %1").arg(mOutputFile)); + QLocale locale = QLocale::system(); + log(tr("- Output Size: %1").arg(locale.formattedDataSize(QFileInfo(mOutputFile).size()))); + } + log(tr("- Compilation Time: %1 secs").arg(timer.elapsed() / 1000.0)); } this->deleteLater(); emit compileFinished(); diff --git a/RedPandaIDE/compiler/compiler.h b/RedPandaIDE/compiler/compiler.h index c2fd33cf..81a42e58 100644 --- a/RedPandaIDE/compiler/compiler.h +++ b/RedPandaIDE/compiler/compiler.h @@ -46,6 +46,7 @@ protected: bool mOnlyCheckSyntax; QString mCompiler; QString mArguments; + QString mOutputFile; private: bool mStop; diff --git a/RedPandaIDE/compiler/filecompiler.cpp b/RedPandaIDE/compiler/filecompiler.cpp index 4f27b1b0..48111a8b 100644 --- a/RedPandaIDE/compiler/filecompiler.cpp +++ b/RedPandaIDE/compiler/filecompiler.cpp @@ -30,14 +30,14 @@ bool FileCompiler::prepareForCompile() FileType fileType = getFileType(mFileName); mArguments= QString(" \"%1\"").arg(mFileName); if (!mOnlyCheckSyntax) { - QString outputFilename = getCompiledExecutableName(mFileName); - mArguments+=QString(" -o \"%1\"").arg(outputFilename); + mOutputFile = getCompiledExecutableName(mFileName); + mArguments+=QString(" -o \"%1\"").arg(mOutputFile); //remove the old file it exists - QFile outputFile(outputFilename); + QFile outputFile(mOutputFile); if (outputFile.exists()) { if (!outputFile.remove()) { - error(tr("Can't delete the old executable file \"%1\".\n").arg(outputFilename)); + error(tr("Can't delete the old executable file \"%1\".\n").arg(mOutputFile)); return false; } } diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index bb7134c7..39fc53fd 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -62,14 +62,17 @@ Editor::Editor(QWidget *parent, const QString& filename, QsciLexerCPP *lexer = new QsciLexerCPP(); lexer->setHighlightEscapeSequences(true); lexer->setFoldComments(true); + lexer->setDefaultFont(QFont("Consolas",12)); this->setLexer(lexer); this->setAutoIndent(pSettings->editor().autoIndent()); this->setFolding(FoldStyle::BoxedTreeFoldStyle,3); + this->setTabWidth(4); //行号显示区域 setMarginType(0, QsciScintilla::NumberMargin); setMarginLineNumbers(0, true); setMarginWidth(0,"10"); + this->onLinesChanged(); //断点设置区域 setMarginType(1, QsciScintilla::SymbolMargin); setMarginLineNumbers(1, false); diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index c5afbed8..810c722f 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -198,3 +198,67 @@ void MainWindow::on_actionRun_triggered() mCompilerManager->run(exeName,"",QFileInfo(exeName).absolutePath()); } } + +void MainWindow::on_actionUndo_triggered() +{ + Editor * editor = mEditorList->getEditor(); + if (editor != NULL ) { + editor->undo(); + } +} + +void MainWindow::on_actionRedo_triggered() +{ + Editor * editor = mEditorList->getEditor(); + if (editor != NULL ) { + editor->redo(); + } +} + +void MainWindow::on_actionCut_triggered() +{ + Editor * editor = mEditorList->getEditor(); + if (editor != NULL ) { + editor->cut(); + } +} + +void MainWindow::on_actionSelectAll_triggered() +{ + Editor * editor = mEditorList->getEditor(); + if (editor != NULL ) { + editor->selectAll(); + } +} + +void MainWindow::on_actionCopy_triggered() +{ + Editor * editor = mEditorList->getEditor(); + if (editor != NULL ) { + editor->copy(); + } +} + +void MainWindow::on_actionPaste_triggered() +{ + Editor * editor = mEditorList->getEditor(); + if (editor != NULL ) { + editor->paste(); + } +} + +void MainWindow::on_actionIndent_triggered() +{ + Editor * editor = mEditorList->getEditor(); + if (editor != NULL ) { + editor->indent(); + } +} + +void MainWindow::on_actionUnIndent_triggered() +{ + Editor * editor = mEditorList->getEditor(); + if (editor != NULL ) { + editor->unindent(); + } +} diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index 56bc72cf..ead51c93 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -47,6 +47,22 @@ private slots: void on_actionRun_triggered(); + void on_actionUndo_triggered(); + + void on_actionRedo_triggered(); + + void on_actionCut_triggered(); + + void on_actionSelectAll_triggered(); + + void on_actionCopy_triggered(); + + void on_actionPaste_triggered(); + + void on_actionIndent_triggered(); + + void on_actionUnIndent_triggered(); + public slots: void onCompileLog(const QString& msg); diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index e82996ed..765bd9fd 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -233,7 +233,23 @@ + + + Edit + + + + + + + + + + + + + @@ -379,6 +395,99 @@ F10 + + + + :/icons/images/newlook24/086-undo.png + + + + Undo + + + Ctrl+Z + + + + + + :/icons/images/newlook24/062-redo.png + + + + Redo + + + Ctrl+Y + + + + + + :/icons/images/newlook24/019-cut.png + + + + Cut + + + Ctrl+X + + + + + + :/icons/images/newlook24/018-copy.png + + + + Copy + + + Ctrl+C + + + + + + :/icons/images/newlook24/057-paste.png + + + + Paste + + + Ctrl+V + + + + + Select All + + + Ctrl+A + + + + + + :/icons/images/newlook24/031-Edit-Indent.png + + + + Indent + + + + + + :/icons/images/newlook24/032-Edit-Unindent.png + + + + UnIndent + +