diff --git a/NEWS.md b/NEWS.md
index 57cf32f6..605cdb47 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -11,6 +11,7 @@ Version 0.7.0
- enhancement: autosave/load bookmarks
- enhancement: autosave/load breakpoints
- enhancement: autosave/load watches
+ - implement: files view
Version 0.6.8
- enhancement: add link to cppreference in the help menu
diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.qm b/RedPandaIDE/RedPandaIDE_zh_CN.qm
index 2c684e08..688a619c 100644
Binary files a/RedPandaIDE/RedPandaIDE_zh_CN.qm and b/RedPandaIDE/RedPandaIDE_zh_CN.qm differ
diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts
index b6f68db0..af623a65 100644
--- a/RedPandaIDE/RedPandaIDE_zh_CN.ts
+++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts
@@ -2801,40 +2801,40 @@ Are you really want to continue?
小熊猫C++
-
-
+
+
编译器
-
+
编译日志
-
+
文件
-
+
工具
-
-
+
+
运行
-
+
编辑
-
+
项目
@@ -2849,90 +2849,91 @@ Are you really want to continue?
结构
+
- 文件
+ 文件
资源
-
-
-
-
+
+
+
+
调试
-
+
求值
-
+
调试主控台
-
+
调用栈
-
+
断点
-
+
本地变量
-
-
+
+
查找
-
+
历史:
-
+
重新查找
-
+
替换为:
-
+
替换
-
+
关闭
-
+
运行
-
-
+
+
代码
-
+
窗口
@@ -2945,721 +2946,732 @@ Are you really want to continue?
工具栏2
-
+
新建
-
+
Ctrl+N
-
+
打开...
-
+
Ctrl+O
-
+
保存
-
+
Ctrl+S
-
+
另存为...
-
+
另存为
-
+
全部保存
-
+
Ctrl+Shift+S
-
+
选项
-
-
-
-
-
-
-
+
+
+
+
+
+
+
编译
-
+
F9
-
+
F10
-
+
恢复
-
+
Ctrl+Z
-
+
重做
-
+
Ctrl+Y
-
+
剪切
-
+
Ctrl+X
-
-
+
+
复制
-
+
Ctrl+C
-
-
+
+
粘贴
-
+
Ctrl+V
-
-
+
+
选择全部
-
+
Ctrl+A
-
+
缩进
-
+
取消缩进
-
+
切换注释
-
+
Ctrl+/
-
+
全部收起
-
+
全部展开
-
+
使用ANSI编码
-
+
使用UTF-8编码
-
+
自动检测
-
+
转换为ANSI编码
-
+
转换为UTF-8编码
-
-
+
+
编译运行
-
+
F11
-
-
+
+
全部重编译
-
+
F12
-
+
停止执行
-
+
F6
-
+
F5
-
+
单步跳过
-
+
F7
-
+
单步进入
-
+
内存
-
+
Address:
地址表达式:
-
+
取消
-
+
TODO
-
+
书签
-
+
帮助
-
+
重构
-
+
主工具栏
-
+
编译器配置集
-
-
+
+
新建源代码文件
-
+
Tab
-
+
Shift+Tab
-
+
F8
-
+
单步跳出
-
+
Ctrl+F8
-
+
执行到光标处
-
+
Ctrl+F5
-
+
继续执行
-
+
F4
-
+
添加监视
-
+
打开CPU信息窗口...
-
+
退出
-
+
查找...
-
+
Ctrl+F
-
+
在文件中查找...
-
+
Ctrl+Shift+F
-
+
替换
-
+
Ctrl+R
-
+
查找下一个
-
+
F3
-
+
查找前一个
-
+
Shift+F3
-
+
删除监视
-
-
+
+
清除全部监视
-
+
修改监视值
-
+
对代码重新排版
-
+
Ctrl+Shift+A
-
+
前一次编辑位置
-
+
Ctrl+Alt+Left
-
+
后一次编辑位置
-
+
Ctrl+Alt+Right
-
+
Ctrl+W
-
+
全部关闭
-
+
Ctrl+Shift+W
-
+
最大化编辑器
-
+
Ctrl+F11
-
+
下一窗口
-
+
Ctrl+Tab
-
+
前一窗口
-
+
Ctrl+Shift+Tab
-
+
切换断点
-
+
Ctrl+F4
-
-
+
+
删除所有断点
-
+
设置断点条件...
-
+
跳转到声明处
-
+
跳转到定义处
-
+
查找符号的引用
-
+
打开所在的文件夹
-
+
Ctrl+B
-
+
打开命令行窗口
-
+
文件属性...
-
+
关闭项目
-
+
项目属性
-
+
新建项目...
-
+
新建项目文件
-
+
添加到项目...
-
+
从项目删除
-
+
查看Makefile
-
+
清理构建文件
-
+
在浏览器中打开
-
+
在终端中打开
-
+
关于
-
-
+
+
重命名符号
-
+
Shift+F6
-
+
打印...
-
+
Ctrl+P
-
-
+
+
导出为RTF
-
-
+
+
导出为HTML
-
+
移动到其他视图
-
+
Ctrl+M
-
+
C/C++参考
-
+
EGE图形库手册
-
+
添加书签
-
+
删除书签
-
+
修改书签说明
-
+
+
+ 在文件视图中定位
+
+
+
+
+
+ 打开文件夹
+
+
+
文件编码
-
+
文件历史
-
-
-
-
-
-
+
+
+
+
+
+
正在调试
-
-
-
-
-
-
+
+
+
+
+
+
正在运行
-
-
-
-
-
-
+
+
+
+
+
+
正在编译
@@ -3668,510 +3680,543 @@ Are you really want to continue?
行:%1 列:%2 已选择:%3 总行数:%4 总长度:%5
-
+
Line: %1 Col: %2 Selected: %3 Lines: %4 Length: %5
行: %1 列: %2 已选择 :%3 总行数: %4 总长度: %5
-
+
只读
-
+
插入
-
+
覆写
-
+
关闭项目
-
+
你确定要关闭'%1'吗?
-
-
+
+
确认
-
-
-
+
+
+
源文件尚未编译。
-
-
+
+
现在编译?
-
-
-
+
+
+
源文件比可执行程序新。
-
+
重新编译?
-
+
无编译器设置
-
+
没有配置编译器设置。
-
+
无法启动调试器
-
-
+
+
启用调试参数
-
-
+
+
当前编译设置中未启用调试选项(-g3),或启用了信息剥除选项(-s)<br /><br/>是否纠正这一问题?
-
+
项目尚未构建
-
+
项目尚未构建。是否构建?
-
+
宿主程序不存在
-
+
动态链接库(DLL)需要一个宿主程序来运行。
-
+
但它不存在。
-
+
宿主程序不存在
-
+
宿主程序'%1'不存在。
-
+
重新编译?
-
-
+
+
保存上次打开信息失败
-
+
无法删除旧上次打开信息文件'%1'
-
+
无法保存上次打开信息文件'%1'
-
+
载入上次打开信息失败
-
+
无法载入上次打开信息文件'%1'
-
+
全部复制
-
-
+
+
清除
-
+
导出
-
+
插入代码段
-
+
删除
-
+
修改描述
-
-
-
+
+
+
书签描述
-
-
-
+
+
+
描述:
-
+
在调试主控台中显示调试器输出
-
+
清除这次搜索
-
+
删除所有搜索
-
+
断点条件...
-
+
断点条件
-
+
输入当前断点的生效条件:
-
+
清除所有断点
-
+
重命名文件
-
-
+
+
添加文件夹
-
+
新文件夹
-
+
文件夹:
-
+
重命名
-
+
删除文件夹
-
+
按类型排序
-
+
按名称排序
-
+
显示继承的成员
-
+
跳转到声明处
-
+
跳转到定义处
-
+
+
+ 在编辑器中打开
+
+
+
+
+ 使用外部程序打开
+
+
+
+
+ 在终端中打开
+
+
+
+
+ 在Windows浏览器中打开
+
+
+
字符集
-
+
已自动保存%1个文件
-
+
保存项目
-
+
项目'%1'有改动。
-
+
需要保存吗?
-
+
+
+
+
+ 保存失败
+
+
+
您真的要清除该文件的所有断点吗?
-
+
新建项目
-
+
关闭'%1'以打开新项目?
-
+
文件夹不存在
-
+
文件夹'%1'不存在。是否创建?
-
+
无法创建文件夹
-
+
创建文件夹'%1'失败。
-
+
-
+
小熊猫Dev-C++项目文件 (*.dev)
-
+
新建项目失败
-
+
无法使用模板创建项目
-
+
添加到项目
-
+
重命名出错
-
+
符号'%1'在系统头文件中定义,无法修改。
-
+
新名称
-
-
+
+
替换出错
-
+
无法打开文件'%1'进行替换!
-
+
内容和上次查找时不一致。
-
+
RTF格式文件 (*.rtf)
-
+
HTML文件 (*.html)
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
错误
-
+
项目历史
-
+
磁盘文件'%1'已被修改。
-
+
是否重新读取它的内容?
-
+
磁盘文件'%1'已被删除。
-
+
是否保持它在小熊猫C++中打开的编辑窗口?
-
+
打开
-
+
编译失败
-
+
运行失败
-
-
+
+
确认转换
-
-
+
+
当前编辑器中的文件将会使用%1编码保存。<br />这项操作无法被撤回。<br />你确定要继续吗?
-
+
新监视表达式
-
+
输入监视表达式
-
+
(%1/%2)正在解析文件"%3"
-
-
+
+
完成%1个文件的解析,用时%2秒
-
+
(每秒%1个文件)
@@ -6129,6 +6174,19 @@ Are you really want to continue?
本页中有尚未保存的设置修改,是否保存后再切换到其他页?
+
+ SettingsWidget
+
+
+
+ 载入失败
+
+
+
+
+ 保存失败
+
+
ShortcutManager
diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp
index c9b50505..16840631 100644
--- a/RedPandaIDE/editor.cpp
+++ b/RedPandaIDE/editor.cpp
@@ -495,6 +495,7 @@ void Editor::focusInEvent(QFocusEvent *event)
this,
&SynEdit::invalidate);
}
+ pMainWindow->updateAppTitle();
pMainWindow->updateEditorActions();
pMainWindow->updateStatusbarForLineCol();
pMainWindow->updateForStatusbarModeInfo();
@@ -511,7 +512,6 @@ void Editor::focusOutEvent(QFocusEvent *event)
&SynEdit::invalidate);
}
//pMainWindow->updateClassBrowserForEditor(nullptr);
- pMainWindow->updateEditorActions();
pMainWindow->updateStatusbarForLineCol();
pMainWindow->updateForStatusbarModeInfo();
pMainWindow->functionTip()->hide();
diff --git a/RedPandaIDE/editorlist.cpp b/RedPandaIDE/editorlist.cpp
index abccd915..f3bdb504 100644
--- a/RedPandaIDE/editorlist.cpp
+++ b/RedPandaIDE/editorlist.cpp
@@ -153,6 +153,9 @@ bool EditorList::closeEditor(Editor* editor, bool transferFocus, bool force) {
editor = getEditor();
pMainWindow->updateClassBrowserForEditor(editor);
}
+ if (pageCount()==0) {
+ pMainWindow->updateAppTitle();
+ }
return true;
}
@@ -283,6 +286,7 @@ bool EditorList::closeAll(bool force) {
return false;
}
}
+ pMainWindow->updateAppTitle();
return true;
}
diff --git a/RedPandaIDE/images/newlook24/046-Locate.png b/RedPandaIDE/images/newlook24/046-Locate.png
index 06f161b4..f09ed6a1 100644
Binary files a/RedPandaIDE/images/newlook24/046-Locate.png and b/RedPandaIDE/images/newlook24/046-Locate.png differ
diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp
index e575fe78..ec9ab757 100644
--- a/RedPandaIDE/mainwindow.cpp
+++ b/RedPandaIDE/mainwindow.cpp
@@ -207,10 +207,14 @@ MainWindow::MainWindow(QWidget *parent)
ui->searchView,&QTreeView::expandAll);
ui->replacePanel->setVisible(false);
-
+ //files view
ui->treeFiles->setModel(&mFileSystemModel);
- mFileSystemModel.setRootPath(pSettings->environment().currentFolder());
- ui->treeFiles->setRootIndex(mFileSystemModel.index(pSettings->environment().currentFolder()));
+ mFileSystemModel.setReadOnly(true);
+ setFilesViewRoot(pSettings->environment().currentFolder());
+ for (int i=1;itreeFiles->hideColumn(i);
+ }
+
//class browser
ui->classBrowser->setModel(&mClassBrowserModel);
@@ -322,6 +326,8 @@ void MainWindow::updateEditorActions()
ui->actionAdd_bookmark->setEnabled(false);
ui->actionRemove_Bookmark->setEnabled(false);
ui->actionModify_Bookmark_Description->setEnabled(false);
+
+ ui->actionLocate_in_Files_View->setEnabled(false);
} else {
ui->actionAuto_Detect->setEnabled(true);
ui->actionEncode_in_ANSI->setEnabled(true);
@@ -362,6 +368,8 @@ void MainWindow::updateEditorActions()
ui->actionAdd_bookmark->setEnabled(e->lines()->count()>0 && !e->hasBookmark(line));
ui->actionRemove_Bookmark->setEnabled(e->hasBookmark(line));
ui->actionModify_Bookmark_Description->setEnabled(e->hasBookmark(line));
+
+ ui->actionLocate_in_Files_View->setEnabled(!e->isNew());
}
updateCompileActions();
@@ -2047,33 +2055,113 @@ void MainWindow::buildContextMenus()
//toolbar for class browser
mClassBrowserToolbar = new QWidget();
- QVBoxLayout* layout = dynamic_cast( ui->tabStructure->layout());
- layout->insertWidget(0,mClassBrowserToolbar);
- QHBoxLayout* hlayout = new QHBoxLayout();
- hlayout->setContentsMargins(2,2,2,2);
- mClassBrowserToolbar->setLayout(hlayout);
- QToolButton * toolButton;
- toolButton = new QToolButton;
- toolButton->setDefaultAction(mClassBrowser_Sort_By_Type);
- hlayout->addWidget(toolButton);
- toolButton = new QToolButton;
- toolButton->setDefaultAction(mClassBrowser_Sort_By_Name);
- hlayout->addWidget(toolButton);
- QFrame * vLine = new QFrame();
- vLine->setFrameShape(QFrame::VLine);
- vLine->setFrameShadow(QFrame::Sunken);
- hlayout->addWidget(vLine);
- toolButton = new QToolButton;
- toolButton->setDefaultAction(mClassBrowser_Show_Inherited);
- hlayout->addWidget(toolButton);
- hlayout->addStretch();
+ {
+ QVBoxLayout* layout = dynamic_cast( ui->tabStructure->layout());
+ layout->insertWidget(0,mClassBrowserToolbar);
+ QHBoxLayout* hlayout = new QHBoxLayout();
+ hlayout->setContentsMargins(2,2,2,2);
+ mClassBrowserToolbar->setLayout(hlayout);
+ QToolButton * toolButton;
+ toolButton = new QToolButton;
+ toolButton->setDefaultAction(mClassBrowser_Sort_By_Type);
+ hlayout->addWidget(toolButton);
+ toolButton = new QToolButton;
+ toolButton->setDefaultAction(mClassBrowser_Sort_By_Name);
+ hlayout->addWidget(toolButton);
+ QFrame * vLine = new QFrame();
+ vLine->setFrameShape(QFrame::VLine);
+ vLine->setFrameShadow(QFrame::Sunken);
+ hlayout->addWidget(vLine);
+ toolButton = new QToolButton;
+ toolButton->setDefaultAction(mClassBrowser_Show_Inherited);
+ hlayout->addWidget(toolButton);
+ hlayout->addStretch();
+ }
//menu for statusbar
mFileEncodingStatus->setContextMenuPolicy(Qt::CustomContextMenu);
connect(mFileEncodingStatus,&QWidget::customContextMenuRequested,
this, &MainWindow::onFileEncodingContextMenu);
- //
+ //menu for files view
+ ui->treeFiles->setContextMenuPolicy(Qt::CustomContextMenu);
+ connect(ui->treeFiles,&QWidget::customContextMenuRequested,
+ this, &MainWindow::onFilesViewContextMenu);
+ mFilesView_Open = createActionFor(
+ tr("Open in Editor"),
+ ui->treeFiles);
+ connect(mFilesView_Open, &QAction::triggered,
+ [this]() {
+ QString path = mFileSystemModel.filePath(ui->treeFiles->currentIndex());
+ if (!path.isEmpty() && QFileInfo(path).isFile()) {
+ Editor *editor=mEditorList->getEditorByFilename(path);
+ if (editor)
+ editor->activate();
+ }
+ });
+ mFilesView_OpenWithExternal = createActionFor(
+ tr("Open in External Program"),
+ ui->treeFiles);
+ connect(mFilesView_OpenWithExternal, &QAction::triggered,
+ [this]() {
+ QString path = mFileSystemModel.filePath(ui->treeFiles->currentIndex());
+ if (!path.isEmpty() && QFileInfo(path).isFile()) {
+ QDesktopServices::openUrl(QUrl::fromLocalFile(path));
+ }
+ });
+ mFilesView_OpenInTerminal = createActionFor(
+ tr("Open in Terminal"),
+ ui->treeFiles);
+ mFilesView_OpenInTerminal->setIcon(ui->actionOpen_Terminal->icon());
+ connect(mFilesView_OpenInTerminal, &QAction::triggered,
+ [this]() {
+ QString path = mFileSystemModel.filePath(ui->treeFiles->currentIndex());
+ if (!path.isEmpty()) {
+ QFileInfo fileInfo(path);
+ openShell(fileInfo.path(),"cmd.exe");
+ }
+ });
+ mFilesView_OpenInExplorer = createActionFor(
+ tr("Open in Windows Explorer"),
+ ui->treeFiles);
+ mFilesView_OpenInExplorer->setIcon(ui->actionOpen_Containing_Folder->icon());
+ connect(mFilesView_OpenInExplorer, &QAction::triggered,
+ [this]() {
+ QString path = mFileSystemModel.filePath(ui->treeFiles->currentIndex());
+ if (!path.isEmpty()) {
+ QFileInfo info(path);
+ if (info.isFile()){
+ QDesktopServices::openUrl(
+ QUrl("file:///"+
+ includeTrailingPathDelimiter(info.path()),QUrl::TolerantMode));
+ } else if (info.isDir()){
+ QDesktopServices::openUrl(
+ QUrl("file:///"+
+ includeTrailingPathDelimiter(path),QUrl::TolerantMode));
+ }
+ }
+ });
+
+ //toolbar for files view
+ mFilesViewToolbar = new QWidget();
+ {
+ QVBoxLayout* layout = dynamic_cast( ui->tabFiles->layout());
+ layout->insertWidget(0,mFilesViewToolbar);
+ QHBoxLayout* hlayout = new QHBoxLayout();
+ hlayout->setContentsMargins(2,2,2,2);
+ mFilesViewToolbar->setLayout(hlayout);
+ QToolButton * toolButton;
+ toolButton = new QToolButton;
+ toolButton->setDefaultAction(ui->actionOpen_Folder);
+ toolButton->setFixedSize(32,32);
+ hlayout->addWidget(toolButton);
+ toolButton = new QToolButton;
+ toolButton->setDefaultAction(ui->actionLocate_in_Files_View);
+ toolButton->setFixedSize(32,32);
+ hlayout->addWidget(toolButton);
+ hlayout->addStretch();
+ }
+
}
void MainWindow::buildEncodingMenu()
@@ -2345,6 +2433,26 @@ void MainWindow::onFileEncodingContextMenu(const QPoint &pos)
mMenuEncoding->exec(mFileEncodingStatus->mapToGlobal(pos));
}
+void MainWindow::onFilesViewContextMenu(const QPoint &pos)
+{
+
+ QMenu menu(this);
+ menu.addAction(ui->actionOpen_Folder);
+ menu.addSeparator();
+ menu.addAction(mFilesView_Open);
+ menu.addAction(mFilesView_OpenWithExternal);
+ menu.addSeparator();
+ menu.addAction(mFilesView_OpenInTerminal);
+ menu.addAction(mFilesView_OpenInExplorer);
+ QString path = mFileSystemModel.filePath(ui->treeFiles->currentIndex());
+ QFileInfo info(path);
+ mFilesView_Open->setEnabled(info.isFile());
+ mFilesView_OpenWithExternal->setEnabled(info.isFile());
+ mFilesView_OpenInTerminal->setEnabled(!path.isEmpty());
+ mFilesView_OpenInExplorer->setEnabled(!path.isEmpty());
+ menu.exec(ui->treeFiles->mapToGlobal(pos));
+}
+
void MainWindow::onShowInsertCodeSnippetMenu()
{
mMenuInsertCodeSnippet->clear();
@@ -2407,7 +2515,7 @@ void MainWindow::onEditorContextMenu(const QPoint &pos)
menu.addSeparator();
menu.addAction(ui->actionOpen_Containing_Folder);
menu.addAction(ui->actionOpen_Terminal);
-
+ menu.addAction(ui->actionLocate_in_Files_View);
menu.addSeparator();
menu.addAction(ui->actionReformat_Code);
menu.addSeparator();
@@ -2443,6 +2551,7 @@ void MainWindow::onEditorContextMenu(const QPoint &pos)
menu.addAction(ui->actionRemove_Bookmark);
menu.addAction(ui->actionModify_Bookmark_Description);
}
+ ui->actionLocate_in_Files_View->setEnabled(!editor->isNew());
ui->actionBreakpoint_property->setEnabled(editor->hasBreakpoint(line));
ui->actionAdd_bookmark->setEnabled(
line>=0 && editor->lines()->count()>0
@@ -2477,6 +2586,7 @@ void MainWindow::onEditorTabContextMenu(QTabWidget* tabWidget, const QPoint &pos
menu.addSeparator();
menu.addAction(ui->actionOpen_Containing_Folder);
menu.addAction(ui->actionOpen_Terminal);
+ menu.addAction(ui->actionLocate_in_Files_View);
menu.addSeparator();
menu.addAction(ui->actionMove_To_Other_View);
menu.addSeparator();
@@ -2485,7 +2595,10 @@ void MainWindow::onEditorTabContextMenu(QTabWidget* tabWidget, const QPoint &pos
tabWidget==ui->EditorTabsRight
|| tabWidget->count()>1
);
-
+ Editor * editor = dynamic_cast(tabWidget->widget(index));
+ if (editor ) {
+ ui->actionLocate_in_Files_View->setEnabled(!editor->isNew());
+ }
menu.exec(tabBar->mapToGlobal(pos));
}
@@ -2754,6 +2867,9 @@ void MainWindow::closeEvent(QCloseEvent *event) {
settings.setLeftPanelIndex(ui->tabInfos->currentIndex());
settings.setLeftPanelOpenned(mLeftPanelOpenned);
settings.save();
+
+ //save current folder ( for files view )
+ pSettings->environment().save();
try {
mBookmarkModel->save(includeTrailingPathDelimiter(pSettings->dirs().config())
+DEV_BOOKMARK_FILE);
@@ -4343,6 +4459,15 @@ void MainWindow::showSearchReplacePanel(bool show)
mSearchResultTreeModel->setSelectable(show);
}
+void MainWindow::setFilesViewRoot(const QString &path)
+{
+ mFileSystemModel.setRootPath(path);
+ ui->treeFiles->setRootIndex(mFileSystemModel.index(path));
+ pSettings->environment().setCurrentFolder(path);
+ ui->txtFilesPath->setText(path);
+ ui->txtFilesPath->setCursorPosition(1);
+}
+
Ui::MainWindow *MainWindow::mainWidget() const
{
return ui;
@@ -4546,3 +4671,39 @@ void MainWindow::on_actionModify_Bookmark_Description_triggered()
}
}
+
+void MainWindow::on_actionLocate_in_Files_View_triggered()
+{
+ Editor * editor = mEditorList->getEditor();
+ if (editor) {
+ QString fileDir = extractFileDir(editor->filename());
+ if (!fileDir.isEmpty()) {
+ setFilesViewRoot(fileDir);
+ ui->treeFiles->setCurrentIndex(mFileSystemModel.index(editor->filename()));
+ }
+ }
+}
+
+
+void MainWindow::on_treeFiles_doubleClicked(const QModelIndex &index)
+{
+ QString filepath = mFileSystemModel.filePath(index);
+ QFileInfo file(filepath);
+ if (file.isFile()) {
+ Editor * editor = mEditorList->getEditorByFilename(filepath);
+ if (editor) {
+ editor->activate();
+ }
+ }
+}
+
+
+void MainWindow::on_actionOpen_Folder_triggered()
+{
+ QString folder = QFileDialog::getExistingDirectory(this,tr("Open Folder"),
+ pSettings->environment().currentFolder());
+ if (!folder.isEmpty()) {
+ setFilesViewRoot(folder);
+ }
+}
+
diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h
index 44eb95ce..b34e34e3 100644
--- a/RedPandaIDE/mainwindow.h
+++ b/RedPandaIDE/mainwindow.h
@@ -192,6 +192,7 @@ private:
void scanActiveProject(bool parse=false);
void includeOrSkipDirs(const QStringList& dirs, bool skip);
void showSearchReplacePanel(bool show);
+ void setFilesViewRoot(const QString& path);
private slots:
void onAutoSaveTimeout();
@@ -206,6 +207,7 @@ private slots:
void onClassBrowserContextMenu(const QPoint& pos);
void onDebugConsoleContextMenu(const QPoint& pos);
void onFileEncodingContextMenu(const QPoint& pos);
+ void onFilesViewContextMenu(const QPoint& pos);
void onShowInsertCodeSnippetMenu();
@@ -420,6 +422,12 @@ private slots:
void on_actionModify_Bookmark_Description_triggered();
+ void on_actionLocate_in_Files_View_triggered();
+
+ void on_treeFiles_doubleClicked(const QModelIndex &index);
+
+ void on_actionOpen_Folder_triggered();
+
private:
Ui::MainWindow *ui;
EditorList *mEditorList;
@@ -511,9 +519,6 @@ private:
QAction * mFilesView_OpenWithExternal;
QAction * mFilesView_OpenInTerminal;
QAction * mFilesView_OpenInExplorer;
- QAction * mFilesView_OnlyShowDevFiles;
- QAction * mFilesView_LocateCurrent;
-
QWidget * mFilesViewToolbar;
//action for debug console
diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui
index 1666e1fa..5474c461 100644
--- a/RedPandaIDE/mainwindow.ui
+++ b/RedPandaIDE/mainwindow.ui
@@ -85,7 +85,7 @@
QTabWidget::West
- 2
+ 3
true
@@ -213,6 +213,9 @@
Files
+
+ 0
+
0
@@ -226,7 +229,24 @@
0
-
-
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked
+
+
+ QAbstractItemView::DragOnly
+
+
@@ -931,6 +951,7 @@
File
+
@@ -1965,6 +1986,24 @@
Modify Bookmark Description
+
+
+
+ :/icons/images/newlook24/046-Locate.png:/icons/images/newlook24/046-Locate.png
+
+
+ Locate in Files View
+
+
+
+
+
+ :/icons/images/newlook24/053-open.png:/icons/images/newlook24/053-open.png
+
+
+ Open Folder
+
+
diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp
index a43075e0..a9741e88 100644
--- a/RedPandaIDE/settings.cpp
+++ b/RedPandaIDE/settings.cpp
@@ -2619,6 +2619,9 @@ void Settings::Environment::doLoad()
mInterfaceFontSize = intValue("interface font size",10);
mLanguage = stringValue("language", QLocale::system().name());
mCurrentFolder = stringValue("current_folder",QDir::currentPath());
+ if (!fileExists(mCurrentFolder)) {
+ mCurrentFolder = QDir::currentPath();
+ }
}
int Settings::Environment::interfaceFontSize() const
diff --git a/RedPandaIDE/utils.cpp b/RedPandaIDE/utils.cpp
index 7c0b4238..5518f23c 100644
--- a/RedPandaIDE/utils.cpp
+++ b/RedPandaIDE/utils.cpp
@@ -748,7 +748,7 @@ QString parseMacros(const QString &s)
QString result = s;
Editor *e = pMainWindow->editorList()->getEditor();
- result.replace("", QDir().absolutePath());
+ result.replace("", QDir::currentPath());
result.replace("", pSettings->dirs().executable());
result.replace("", DEVCPP_VERSION);
result.replace("", pSettings->dirs().app());