From 423613c1c12b4b8849e62a630e3000f412341aac Mon Sep 17 00:00:00 2001 From: Aruki Date: Fri, 17 Feb 2017 18:04:06 -0700 Subject: [PATCH] Added 16x16 World icon, remove recent projects that no longer exist --- src/Editor/Icons.qrc | 1 + src/Editor/WorldEditor/CWorldEditor.cpp | 31 +++++++++++++-------- src/Editor/WorldEditor/CWorldTreeModel.cpp | 2 +- src/Editor/icons/World_16px.png | Bin 0 -> 349 bytes src/Editor/main.cpp | 2 ++ 5 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 src/Editor/icons/World_16px.png diff --git a/src/Editor/Icons.qrc b/src/Editor/Icons.qrc index ab4b1714..40893644 100644 --- a/src/Editor/Icons.qrc +++ b/src/Editor/Icons.qrc @@ -70,5 +70,6 @@ icons/Open_16px.png icons/New_16px.png icons/Disc_16px.png + icons/World_16px.png diff --git a/src/Editor/WorldEditor/CWorldEditor.cpp b/src/Editor/WorldEditor/CWorldEditor.cpp index cd029e63..786fc851 100644 --- a/src/Editor/WorldEditor/CWorldEditor.cpp +++ b/src/Editor/WorldEditor/CWorldEditor.cpp @@ -252,10 +252,6 @@ bool CWorldEditor::CloseWorld() if (mpPoiDialog) mpPoiDialog->close(); - // Clear old area - hack until better world/area loader is implemented - if (mpArea) - mpArea->ClearScriptLayers(); - mpArea = nullptr; mpWorld = nullptr; @@ -575,13 +571,6 @@ void CWorldEditor::OnActiveProjectChanged(CGameProject *pProj) if (!pProj) return; // Update recent projects list - QSettings Settings; - QStringList RecentProjectsList = Settings.value("WorldEditor/RecentProjectsList").toStringList(); - QString ProjPath = TO_QSTRING(pProj->ProjectPath()); - - RecentProjectsList.removeAll(ProjPath); - RecentProjectsList.prepend(ProjPath); - Settings.setValue("WorldEditor/RecentProjectsList", RecentProjectsList); UpdateOpenRecentActions(); ChangeEditMode(eWEM_EditWorldInfo); @@ -717,6 +706,26 @@ void CWorldEditor::UpdateOpenRecentActions() QSettings Settings; QStringList RecentProjectsList = Settings.value("WorldEditor/RecentProjectsList").toStringList(); + // Bump the current project to the front + CGameProject *pProj = gpEdApp->ActiveProject(); + + if (pProj) + { + QString ProjPath = TO_QSTRING(pProj->ProjectPath()); + RecentProjectsList.removeAll(ProjPath); + RecentProjectsList.prepend(ProjPath); + } + + // Remove projects that don't exist anymore + foreach (const QString& rkProj, RecentProjectsList) + { + if (!FileUtil::Exists( TO_TWIDESTRING(rkProj) )) + RecentProjectsList.removeAll(rkProj); + } + + Settings.setValue("WorldEditor/RecentProjectsList", RecentProjectsList); + + // Set up the menu actions for (int iProj = 0; iProj < mskMaxRecentProjects; iProj++) { QAction *pAction = mRecentProjectsActions[iProj]; diff --git a/src/Editor/WorldEditor/CWorldTreeModel.cpp b/src/Editor/WorldEditor/CWorldTreeModel.cpp index d72b02cb..7f5177cb 100644 --- a/src/Editor/WorldEditor/CWorldTreeModel.cpp +++ b/src/Editor/WorldEditor/CWorldTreeModel.cpp @@ -97,7 +97,7 @@ QVariant CWorldTreeModel::data(const QModelIndex& rkIndex, int Role) const else if (Role == Qt::DecorationRole) { - static QIcon sWorldIcon = QIcon(":/icons/World.png"); + static QIcon sWorldIcon = QIcon(":/icons/World_16px.png"); static QIcon sAreaIcon = QIcon(":/icons/New_16px.png"); if (rkIndex.column() == 1) diff --git a/src/Editor/icons/World_16px.png b/src/Editor/icons/World_16px.png new file mode 100644 index 0000000000000000000000000000000000000000..0e4176873612182cef356ddd6d1740c028af0197 GIT binary patch literal 349 zcmV-j0iyniP)2rTJIm&cvvb=KJ^$hH*2{jYo&J00000NkvXXu0mjf@3^29 literal 0 HcmV?d00001 diff --git a/src/Editor/main.cpp b/src/Editor/main.cpp index 777ff369..71f7e437 100644 --- a/src/Editor/main.cpp +++ b/src/Editor/main.cpp @@ -1,8 +1,10 @@ #include "CEditorApplication.h" +#include "UICommon.h" #include #include #include +#include #include #include #include