- enhancement: rename in files view's context menu

- enhancement: delete in files view's context menu
  - change: drag&drop in files view default to move
This commit is contained in:
Roy Qu 2022-06-12 15:48:19 +08:00
parent ef715b2c34
commit 73fda980bc
5 changed files with 34 additions and 5 deletions

View File

@ -4,6 +4,9 @@ Red Panda C++ Version 1.1.0
- enhancement: When the editing files is changed by other applications, only show one notification dialog for each file.
- fix: c files added to a project will be compiled as c++ file.
- enhancement: restore caret position after batch replace
- enhancement: rename in files view's context menu
- enhancement: delete in files view's context menu
- change: drag&drop in files view default to move
Red Panda C++ Version 1.0.10
- fix: modify watch doesn't work

View File

@ -2533,6 +2533,12 @@ void MainWindow::buildContextMenus()
connect(mFilesView_CreateFile, &QAction::triggered,
this, &MainWindow::onFilesViewCreateFile);
mFilesView_Rename = createActionFor(
tr("Rename"),
ui->treeFiles);
connect(mFilesView_Rename, &QAction::triggered,
this, &MainWindow::onFilesViewRename);
mFilesView_RemoveFile = createActionFor(
tr("Delete"),
ui->treeFiles);
@ -2994,6 +3000,8 @@ void MainWindow::onFilesViewContextMenu(const QPoint &pos)
menu.addSeparator();
menu.addAction(mFilesView_CreateFolder);
menu.addAction(mFilesView_CreateFile);
menu.addAction(mFilesView_RemoveFile);
menu.addAction(mFilesView_Rename);
menu.addSeparator();
if (pSettings->vcs().gitOk()) {
if (hasRepository) {
@ -3017,6 +3025,8 @@ void MainWindow::onFilesViewContextMenu(const QPoint &pos)
mFilesView_OpenWithExternal->setEnabled(info.isFile());
mFilesView_OpenInTerminal->setEnabled(!path.isEmpty());
mFilesView_OpenInExplorer->setEnabled(!path.isEmpty());
mFilesView_Rename->setEnabled(!path.isEmpty());
mFilesView_RemoveFile->setEnabled(!path.isEmpty() || !ui->treeFiles->selectionModel()->selectedRows().isEmpty());
if (pSettings->vcs().gitOk() && hasRepository) {
mFileSystemModelIconProvider.update();
@ -3497,6 +3507,13 @@ void MainWindow::onFilesViewRemoveFiles()
}
}
void MainWindow::onFilesViewRename() {
QModelIndex index = ui->treeFiles->currentIndex();
if (!index.isValid())
return ;
ui->treeFiles->edit(index);
}
void MainWindow::onProblemProperties()
{
QModelIndex idx = ui->lstProblemSet->currentIndex();
@ -3657,9 +3674,11 @@ void MainWindow::onFilesViewOpen()
{
QString path = mFileSystemModel.filePath(ui->treeFiles->currentIndex());
if (!path.isEmpty() && QFileInfo(path).isFile()) {
Editor *editor=mEditorList->getEditorByFilename(path);
if (editor)
editor->activate();
if (getFileType(path)==FileType::Project) {
openProject(path);
} else {
openFile(path);
}
}
}
@ -6703,6 +6722,8 @@ void MainWindow::on_actionLocate_in_Files_View_triggered()
void MainWindow::on_treeFiles_doubleClicked(const QModelIndex &index)
{
if (index!=ui->treeFiles->currentIndex())
return;
QString filepath = mFileSystemModel.filePath(index);
QFileInfo file(filepath);
if (file.isFile()) {

View File

@ -299,6 +299,7 @@ private slots:
void onFilesViewCreateFolder();
void onFilesViewCreateFile();
void onFilesViewRemoveFiles();
void onFilesViewRename();
void onProblemProperties();
void onProblemOpenSource();
void onLableProblemSetContextMenuRequested();
@ -780,6 +781,7 @@ private:
QAction * mFilesView_CreateFolder;
QAction * mFilesView_CreateFile;
QAction * mFilesView_RemoveFile;
QAction * mFilesView_Rename;
//action for debug console
QAction * mDebugConsole_ShowDetailLog;

View File

@ -463,7 +463,7 @@
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<property name="usesScrollButtons">
<bool>true</bool>
@ -535,7 +535,7 @@
<enum>QAbstractItemView::DragDrop</enum>
</property>
<property name="defaultDropAction">
<enum>Qt::CopyAction</enum>
<enum>Qt::MoveAction</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>

View File

@ -74,6 +74,9 @@ SystemConsts::SystemConsts(): mDefaultFileFilters()
mDefaultFileNameFilters.append("*.vs");
mDefaultFileNameFilters.append("*.fs");
mDefaultFileNameFilters.append("*.txt");
mDefaultFileNameFilters.append("*.in");
mDefaultFileNameFilters.append("*.out");
mDefaultFileNameFilters.append("*.dat");
mDefaultFileNameFilters.append("*.md");
mDefaultFileNameFilters.append("*.dev");
}