- enhancement: auto locate current open file in the project view panel
This commit is contained in:
parent
2417998ca0
commit
2e7391d870
1
NEWS.md
1
NEWS.md
|
@ -20,6 +20,7 @@ Red Panda C++ Version 2.0
|
|||
- enhancement: auto locate the last opened file in the project view after project creation
|
||||
- enhancement: separate compiler's language standard option for C / C++
|
||||
- fix: compiler settings not correctly handled when create makefile
|
||||
- enhancement: auto locate current open file in the project view panel
|
||||
|
||||
Red Panda C++ Version 1.5
|
||||
|
||||
|
|
|
@ -113,7 +113,8 @@ QString Compiler::getFileNameFromOutputLine(QString &line) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
return temp;
|
||||
QFileInfo info(temp);
|
||||
return info.isRelative()?absolutePath(mDirectory,temp):cleanPath(temp);
|
||||
}
|
||||
|
||||
int Compiler::getLineNumberFromOutputLine(QString &line)
|
||||
|
|
|
@ -512,12 +512,6 @@ bool ProjectCompiler::prepareForRebuild()
|
|||
return true;
|
||||
}
|
||||
|
||||
QString ProjectCompiler::getFileNameFromOutputLine(QString &line)
|
||||
{
|
||||
QString temp=Compiler::getFileNameFromOutputLine(line);
|
||||
return absolutePath(mDirectory,temp);
|
||||
}
|
||||
|
||||
bool ProjectCompiler::prepareForCompile()
|
||||
{
|
||||
if (!mProject)
|
||||
|
|
|
@ -50,10 +50,6 @@ private:
|
|||
protected:
|
||||
bool prepareForCompile() override;
|
||||
bool prepareForRebuild() override;
|
||||
|
||||
// Compiler interface
|
||||
protected:
|
||||
QString getFileNameFromOutputLine(QString &line) override;
|
||||
};
|
||||
|
||||
#endif // PROJECTCOMPILER_H
|
||||
|
|
|
@ -1298,6 +1298,9 @@ void Editor::showEvent(QShowEvent */*event*/)
|
|||
pMainWindow->updateForEncodingInfo(this);
|
||||
pMainWindow->updateStatusbarForLineCol(this);
|
||||
pMainWindow->updateForStatusbarModeInfo(this);
|
||||
if (inProject()) {
|
||||
pMainWindow->setProjectCurrentFile(mFilename);
|
||||
}
|
||||
|
||||
setHideTime(QDateTime::currentDateTime());
|
||||
}
|
||||
|
|
|
@ -1271,6 +1271,21 @@ void MainWindow::updateStatusbarMessage(const QString &s)
|
|||
ui->statusbar->showMessage(s);
|
||||
}
|
||||
|
||||
void MainWindow::setProjectCurrentFile(const QString &filename)
|
||||
{
|
||||
if (!mProject)
|
||||
return;
|
||||
PProjectUnit unit = mProject->findUnit(filename);
|
||||
if (!unit)
|
||||
return;
|
||||
QModelIndex index = mProject->model()->getNodeIndex(unit->node().get());
|
||||
index = mProjectProxyModel->mapFromSource(index);
|
||||
if (index.isValid()) {
|
||||
ui->projectView->expand(index);
|
||||
ui->projectView->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::openFiles(const QStringList &files)
|
||||
{
|
||||
mEditorList->beginUpdate();
|
||||
|
@ -6304,12 +6319,8 @@ void MainWindow::on_actionAdd_to_project_triggered()
|
|||
if (newUnit) {
|
||||
QModelIndex index = mProject->model()->getNodeIndex(newUnit->node().get());
|
||||
index = mProjectProxyModel->mapFromSource(index);
|
||||
QModelIndex parentIndex = mProject->model()->getParentIndex(newUnit->node().get());
|
||||
parentIndex = mProjectProxyModel->mapFromSource(parentIndex);
|
||||
if (parentIndex.isValid()) {
|
||||
ui->projectView->expand(parentIndex);
|
||||
}
|
||||
if (index.isValid()) {
|
||||
ui->projectView->expand(index);
|
||||
ui->projectView->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
@ -6740,14 +6751,10 @@ void MainWindow::onProjectViewNodeRenamed()
|
|||
void MainWindow::setProjectViewCurrentNode(PProjectModelNode node)
|
||||
{
|
||||
if (node) {
|
||||
QModelIndex parentIndex = mProject->model()->getParentIndex(node.get());
|
||||
parentIndex = mProjectProxyModel->mapFromSource(parentIndex);
|
||||
if (parentIndex.isValid()) {
|
||||
ui->projectView->expand(parentIndex);
|
||||
}
|
||||
QModelIndex index = mProject->model()->getNodeIndex(node.get());
|
||||
index = mProjectProxyModel->mapFromSource(index);
|
||||
if (index.isValid()) {
|
||||
ui->projectView->expand(index);
|
||||
ui->projectView->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,6 +114,7 @@ public:
|
|||
void updateForStatusbarModeInfo(bool clear=false);
|
||||
void updateForStatusbarModeInfo(const Editor* editor, bool clear=false);
|
||||
void updateStatusbarMessage(const QString& s);
|
||||
void setProjectCurrentFile(const QString& filename);
|
||||
void updateEditorSettings();
|
||||
void updateEditorBookmarks();
|
||||
void updateEditorBreakpoints();
|
||||
|
|
Loading…
Reference in New Issue