- change: Don't confirm rebuild/recompile when run/debug.

This commit is contained in:
Roy Qu 2023-02-14 23:42:11 +08:00
parent 364aaf9704
commit 926802a8f5
19 changed files with 54 additions and 74 deletions

View File

@ -18,6 +18,8 @@ Red Panda C++ Version 2.12
- change: The default disassemble style of CPU Dialog is "AT&T" now.
- fix: Can't compile files with chinese characters in filenames using winlibs mingw gcc
- fix: If current editor is empty, parser will parse the file's content on the disk instead from the editor.
- fix: Can't show completion when cursor is after "char["
- change: Don't confirm rebuild/recompile when run/debug.
Red Panda C++ Version 2.11

View File

@ -367,7 +367,6 @@ bool Editor::saveAs(const QString &name, bool fromProject){
QString selectedFileFilter;
QString defaultExt;
defaultExt=QFileInfo(oldName).suffix();
qDebug()<<defaultExt;
if (defaultExt.isEmpty()) {
if (pSettings->editor().defaultFileCpp()) {
selectedFileFilter = pSystemConsts->defaultCPPFileFilter();
@ -4654,7 +4653,7 @@ QString Editor::getPreviousWordAtPositionForSuggestion(const QSynedit::BufferCoo
QString s = document()->getLine(p.line - 1);
int wordBegin;
int wordEnd = p.ch-1;
int wordEnd = p.ch-2;
if (wordEnd >= s.length())
wordEnd = s.length()-1;
while (true) {

View File

@ -1974,12 +1974,7 @@ void MainWindow::runExecutable(
// Check if it exists
if (!fileExists(exeName)) {
if (ui->actionCompile_Run->isEnabled()) {
if (QMessageBox::question(this,tr("Confirm"),
tr("Source file is not compiled.")
+"<br /><br />"+tr("Compile now?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
doCompileRun(runType);
}
return;
} else {
QMessageBox::critical(this,"Error",
@ -1988,19 +1983,9 @@ void MainWindow::runExecutable(
}
} else {
if (!filename.isEmpty() && compareFileModifiedTime(filename,exeName)>=0) {
// if (ui->actionCompile_Run->isEnabled()) {
if (QMessageBox::warning(this,tr("Confirm"),
tr("Source file is more recent than executable.")
+"<br /><br />"+tr("Recompile now?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
doCompileRun(runType);
return;
}
// } else {
// QMessageBox::warning(this,"Error",
// tr("Source file is more recent than executable."));
// }
}
}
QString params;
@ -2044,12 +2029,7 @@ void MainWindow::runExecutable(RunType runType)
QStringList binDirs = mProject->binDirs();
QFileInfo execInfo(mProject->executable());
QDateTime execModTime = execInfo.lastModified();
if (execInfo.exists() && mProject->modifiedSince(execModTime) &&
QMessageBox::question(
this,
tr("Rebuild Project"),
tr("Project has been modified, do you want to rebuild it?")
) == QMessageBox::Yes) {
if (execInfo.exists() && mProject->modifiedSince(execModTime)) {
//mProject->saveAll();
mCompileSuccessionTask=std::make_shared<CompileSuccessionTask>();
mCompileSuccessionTask->type = CompileSuccessionTaskType::RunNormal;
@ -2138,30 +2118,18 @@ void MainWindow::debug()
// Did we compile?
if (!fileExists(mProject->executable())) {
if (QMessageBox::question(
this,
tr("Project not built"),
tr("Project hasn't been built. Build it now?"),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes) == QMessageBox::Yes) {
mCompileSuccessionTask=std::make_shared<CompileSuccessionTask>();
mCompileSuccessionTask->type = CompileSuccessionTaskType::Debug;
mCompileSuccessionTask->execName = mProject->executable();
mCompileSuccessionTask->isExecutable = true;
mCompileSuccessionTask->binDirs = binDirs;
compile();
}
return;
}
{
QFileInfo execInfo(mProject->executable());
QDateTime execModTime = execInfo.lastModified();
if (execInfo.exists() && mProject->modifiedSince(execModTime) &&
QMessageBox::question(
this,
tr("Rebuild Project"),
tr("Project has been modified, do you want to rebuild it?")
) == QMessageBox::Yes) {
if (execInfo.exists() && mProject->modifiedSince(execModTime)) {
//mProject->saveAll();
mCompileSuccessionTask=std::make_shared<CompileSuccessionTask>();
mCompileSuccessionTask->type = CompileSuccessionTaskType::Debug;
@ -5592,11 +5560,18 @@ void MainWindow::onCompileFinished(QString filename, bool isCheckSyntax)
if (!isCheckSyntax) {
//run succession task if there aren't any errors
if (mCompileSuccessionTask && mCompilerManager->compileErrorCount()==0) {
if (!fileExists(mCompileSuccessionTask->execName)) {
QMessageBox::critical(this,tr("Compile Failed"),
tr("Failed to generate the executable.")+"<BR/><BR/>"
+tr("Please check detail info in \"Tools Output\" panel."));
return;
}
if (!mCompileSuccessionTask->isExecutable) {
Editor * editor;
switch (mCompileSuccessionTask->type) {
case MainWindow::CompileSuccessionTaskType::RunNormal:
if (fileExists(mCompileSuccessionTask->execName)) {
Editor * editor = openFile(mCompileSuccessionTask->execName);
editor = openFile(mCompileSuccessionTask->execName);
if (e && editor) {
int line = e->caretY();
int startLine = 1;
@ -5621,7 +5596,6 @@ void MainWindow::onCompileFinished(QString filename, bool isCheckSyntax)
}
editor->setCaretPositionAndActivate(startLine,1);
}
}
break;
case MainWindow::CompileSuccessionTaskType::RunProblemCases:
case MainWindow::CompileSuccessionTaskType::RunCurrentProblemCase:

View File

@ -80,6 +80,7 @@ win32: {
QMAKE_SUBSTITUTES += platform/windows/installer-scripts/config-clang.nsh.in
resources.path = $${PREFIX}
resources.files += platform/windows/templates
resources.files += platform/windows/installer-scripts/config.nsh
resources.files += platform/windows/installer-scripts/config32.nsh
@ -90,5 +91,11 @@ win32: {
resources.files += RedPandaIDE/images/devcpp.ico
INSTALLS += resources
equals(X86_64, "ON") {
extra_templates.path = $${PREFIX}/templates
extra_templates.files += platform/windows/templates-win64/*
INSTALLS += extra_templates
}
}
}

View File

@ -20,7 +20,7 @@ echo "Building..."
pushd .
cd "${BUILD_DIR}"
make distclean
"$QMAKE" PREFIX="${PACKAGE_DIR}" -o Makefile "${SOURCE_DIR}\Red_Panda_Cpp.pro" -r -spec win32-g++
"$QMAKE" PREFIX="${PACKAGE_DIR}" X86_64=ON -o Makefile "${SOURCE_DIR}\Red_Panda_Cpp.pro" -r -spec win32-g++
make -j16
make install
popd

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -5,10 +5,8 @@ main:
# the x64 calling convention requires you to allocate 32 bytes of shadow space before each call
# https://stackoverflow.com/questions/30190132/what-is-the-shadow-space-in-x64-assembly/
sub $32, %rsp # allocate shadow space
leaq fmt(%rip), %rax # first parameter
movq %rax, %rcx
leaq msg(%rip), %rax # second parameter
movq %rax, %rdx
leaq fmt(%rip), %rcx # first parameter
leaq msg(%rip), %rdx # second parameter
call printf
add $32, %rsp # remove shadow space

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -11,8 +11,8 @@ main:
; the x64 calling convention requires you to allocate 32 bytes of shadow space before each call
; https://stackoverflow.com/questions/30190132/what-is-the-shadow-space-in-x64-assembly/
sub rsp, 32 ; allocate shadow space
mov rcx, fmt ; first parameter
mov rdx, msg ; secodng parameter
lea rcx, [rel fmt] ; first parameter
lea rdx, [rel msg] ; secodng parameter
call printf
add rsp,32 ; remove shadow space

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB