Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show project path in title #181

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ MainWindow::MainWindow(QWidget *parent)
m_documentPalette->hide();

ui->setupUi(this);
setWindowTitle(QApplication::applicationName() + ' ' + QApplication::applicationVersion());
setWindowTitle(generateWindowTitle());
ui->tabWidget->setCornerWidget(m_toolBar);

setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
Expand Down Expand Up @@ -276,6 +276,15 @@ MainWindow::MainWindow(QWidget *parent)
updateScriptActions();
}

QString MainWindow::generateWindowTitle(const QString &projectName) const
{
QString title = QApplication::applicationName() + ' ' + QApplication::applicationVersion();
if (!projectName.isEmpty()) {
title += " (" + projectName + ")";
}
return title;
}

QList<QAction *> MainWindow::menuActions() const
{
QList<QAction *> actions;
Expand Down Expand Up @@ -362,6 +371,7 @@ void MainWindow::openProject()

void MainWindow::initProject(const QString &path)
{
setWindowTitle(generateWindowTitle(path));
// Update recent list
QSettings settings;
QStringList projects = settings.value(RecentProjectKey).toStringList();
Expand Down
1 change: 1 addition & 0 deletions src/gui/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class MainWindow : public QMainWindow
void changeCurrentDocument();
QDockWidget *createDock(QWidget *widget, Qt::DockWidgetArea area, QWidget *toolbar = nullptr);
void reloadDocuments();
QString generateWindowTitle(const QString &projectName = {}) const;

std::unique_ptr<Ui::MainWindow> ui;
QMenu *m_recentProjects = nullptr;
Expand Down
Loading