From 57b9648220999bebd9c023f589d8a33f4cea2227 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Tue, 25 Dec 2018 23:49:15 -0500 Subject: [PATCH] Trim material paths --- tools/materialeditor/src/mainwindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/materialeditor/src/mainwindow.cpp b/tools/materialeditor/src/mainwindow.cpp index c49f35a..7389b3e 100644 --- a/tools/materialeditor/src/mainwindow.cpp +++ b/tools/materialeditor/src/mainwindow.cpp @@ -165,8 +165,12 @@ void MainWindow::saveMaterial(QString path) { } void MainWindow::updateControls() { + const auto trimPath = [](QString path) { + return path.mid(path.lastIndexOf('/') + 1); + }; + if(!currentlyOpenMaterial.isEmpty()) - setWindowTitle("Material Editor - " + currentlyOpenMaterial); + setWindowTitle("Material Editor - " + trimPath(currentlyOpenMaterial)); else setWindowTitle("Material Editor"); @@ -176,7 +180,7 @@ void MainWindow::updateControls() { if(!openedFiles.empty()) { QMenu* recentlyOpenedMenu = new QMenu(); for(auto file : openedFiles) { - QAction* fileAction = new QAction(file); + QAction* fileAction = new QAction(trimPath(file)); connect(fileAction, &QAction::triggered, [this, file] { openMaterial(file); });