- enhancement: when create a new folder in the files view, auto select that folder and rename it

- enhancement: when new header in the project view, auto select basename in the filename dialog
  - enhancement: when add file in the project view, auto select basename in the filename dialog
  - change: Don't generate localized filename when new header/add file in the project view
This commit is contained in:
Roy Qu 2022-10-25 21:49:35 +08:00
parent 5edcad104e
commit 4380470cef
4 changed files with 19 additions and 3 deletions

View File

@ -26,6 +26,11 @@ Red Panda C++ Version 2.0
- enhancement: use "todo" and "fixme" as the keyword for TODO comments
- fix: rules for obj missing in the makefile generated for project
- enhancement: before run a project'executable, check if there's project file newer than the executable
- enhancement: when create a new folder in the files view, auto select that folder and rename it
- enhancement: when new header in the project view, auto select basename in the filename dialog
- enhancement: when add file in the project view, auto select basename in the filename dialog
- change: Don't generate localized filename when new header/add file in the project view
Red Panda C++ Version 1.5

View File

@ -3865,6 +3865,7 @@ void MainWindow::onFilesViewCreateFolder()
}
QModelIndex newIndex = mFileSystemModel.mkdir(parentIndex,folderName);
ui->treeFiles->setCurrentIndex(newIndex);
ui->treeFiles->edit(newIndex);
}
void MainWindow::onFilesViewCreateFile()
@ -7830,7 +7831,7 @@ void MainWindow::on_actionNew_Header_triggered()
QString newFileName;
int i=1;
do {
newFileName = tr("untitled")+QString("%1").arg(i);
newFileName = QString("untitled%1").arg(i);
newFileName += ".h";
i++;
} while (QDir(mProject->directory()).exists(newFileName));

View File

@ -52,6 +52,10 @@ QString NewHeaderDialog::path() const
void NewHeaderDialog::setHeaderName(const QString &name)
{
ui->txtHeader->setText(name);
int pos = name.lastIndexOf('.');
if (pos>=0)
ui->txtHeader->setSelection(0,pos);
else
ui->txtHeader->selectAll();
}

View File

@ -57,7 +57,7 @@ void NewProjectUnitDialog::setFolder(const QString &folderName)
ext = QFileInfo(filename()).suffix();
}
do {
newFileName = tr("untitled")+QString("%1").arg(getNewFileNumber());
newFileName = QString("untitled%1").arg(getNewFileNumber());
if (!ext.isEmpty())
newFileName += "." + ext;
} while (dir.exists(newFileName));
@ -74,6 +74,12 @@ QString NewProjectUnitDialog::filename() const
void NewProjectUnitDialog::setFilename(const QString &filename)
{
ui->txtFilename->setText(filename);
ui->txtFilename->setFocus();
int pos = filename.lastIndexOf('.');
if (pos>=0)
ui->txtFilename->setSelection(0,pos);
else
ui->txtFilename->selectAll();
}
void NewProjectUnitDialog::onUpdateIcons()