- fix: crash when project name is selected in the project view and try create new project file

This commit is contained in:
Roy Qu 2022-05-19 17:57:31 +08:00
parent 106bf4281a
commit c3db151c2c
5 changed files with 36 additions and 20 deletions

12
NEWS.md
View File

@ -1,3 +1,10 @@
Red Panda C++ Version 1.0.9
- fix: selection in column mode not correctly drawn when has wide chars in it
- fix: delete & insert in column mode not correctly handled
- fix: input with ime in column mode not correctly handled
- fix: copy & paste in column mode not correctly handled
- fix: crash when project name is selected in the project view and try create new project file
Red Panda C++ Version 1.0.8
- enhancement: auto complete '#undef'
- enhancement: redesign components for compiler commandline arguments processing
@ -9,11 +16,6 @@ Red Panda C++ Version 1.0.8
- enhancement: adjust scheme colors for "dark" and "high contrast" themes
- enhancement: can debug files that has non-ascii chars in its path and is compiled by clang
- fix: when debugging project, default compiler set is wrongly used
- fix: selection in column mode not correctly drawn when has wide chars in it
- fix: delete & insert in column mode not correctly handled
- fix: input with ime in column mode not correctly handled
- fix: copy & paste in column mode not correctly handled
Red Panda C++ Version 1.0.7
- change: use Shift+Enter to break line

View File

@ -10,7 +10,7 @@ isEmpty(APP_NAME) {
}
isEmpty(APP_VERSION) {
APP_VERSION=1.0.8
APP_VERSION=1.0.9
}

View File

@ -6029,22 +6029,32 @@ void MainWindow::newProjectUnitFile()
while (modelTypeNode && modelTypeNode->folderNodeType==ProjectSpecialFolderNode::NonSpecial) {
modelTypeNode=modelTypeNode->parent.lock();
}
if (!modelTypeNode) {
modelTypeNode = mProject->rootNode();
}
NewProjectUnitDialog newProjectUnitDialog;
switch (modelTypeNode->folderNodeType) {
case ProjectSpecialFolderNode::HEADERS:
newProjectUnitDialog.setSuffix("h");
break;
case ProjectSpecialFolderNode::SOURCES:
if (modelTypeNode == mProject->rootNode()) {
if (mProject->options().isCpp)
newProjectUnitDialog.setSuffix("cpp");
else
newProjectUnitDialog.setSuffix("c");
break;
default:
newProjectUnitDialog.setSuffix("");
} else {
switch (modelTypeNode->folderNodeType) {
case ProjectSpecialFolderNode::HEADERS:
newProjectUnitDialog.setSuffix("h");
break;
case ProjectSpecialFolderNode::SOURCES:
if (mProject->options().isCpp)
newProjectUnitDialog.setSuffix("cpp");
else
newProjectUnitDialog.setSuffix("c");
break;
default:
newProjectUnitDialog.setSuffix("");
}
}
QString folder = mProject->fileSystemNodeFolderPath(pNode);
qDebug()<<folder;
// qDebug()<<folder;
newProjectUnitDialog.setFolder(folder);
if (newProjectUnitDialog.exec()!=QDialog::Accepted) {
return;

View File

@ -752,6 +752,8 @@ void Project::updateNodeIndexes()
PProjectModelNode Project::pointerToNode(ProjectModelNode *p, PProjectModelNode parent)
{
if (!p)
return PProjectModelNode();
if (!parent) {
parent = mRootNode;
}
@ -1797,10 +1799,12 @@ QFileSystemWatcher *Project::fileSystemWatcher() const
QString Project::fileSystemNodeFolderPath(const PProjectModelNode &node)
{
QString result;
PProjectModelNode pNode = node;
while (pNode && pNode->folderNodeType == ProjectSpecialFolderNode::NonSpecial) {
result = node->text + "/" +result;
pNode = pNode->parent.lock();
if (node != mRootNode) {
PProjectModelNode pNode = node;
while (pNode && pNode->folderNodeType == ProjectSpecialFolderNode::NonSpecial) {
result = node->text + "/" +result;
pNode = pNode->parent.lock();
}
}
result = folder() + "/" + result;
return result;

View File

@ -17,7 +17,7 @@ SUBDIRS += \
APP_NAME = RedPandaCPP
APP_VERSION = 1.0.8
APP_VERSION = 1.0.9
linux: {