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