Added project settings dialog; added build name lookup functionality

This commit is contained in:
Aruki 2017-02-15 01:00:48 -07:00
parent 3697401ebb
commit bdb753dca2
23 changed files with 479 additions and 141 deletions

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<GameInfo ArchiveVer="0" FileVer="0" Game="DKCR">
<GameBuilds>
<Build>
<Version>74887</Version>
<Region>PAL</Region>
<Name>Wii PAL</Name>
</Build>
<Build>
<Version>75001</Version>
<Region>NTSC</Region>
<Name>Wii NTSC 0A-1</Name>
</Build>
</GameBuilds>
</GameInfo>

View File

@ -1,5 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<GameInfo ArchiveVer="0" FileVer="0" Game="MPRM">
<GameBuilds>
<Build>
<Version>0.0</Version>
<Region>NTSC</Region>
<Name>Multi-Game Demo Disc v7-9</Name>
</Build>
<Build>
<Version>1.088</Version>
<Region>NTSC</Region>
<Name>GameCube 0-00 NTSC</Name>
</Build>
<Build>
<Version>1.093</Version>
<Region>NTSC</Region>
<Name>GameCube 0-01 NTSC</Name>
</Build>
<Build>
<Version>1.097</Version>
<Region>NTSC</Region>
<Name>GameCube 0-30 NTSC-K</Name>
</Build>
<Build>
<Version>1.101</Version>
<Region>PAL</Region>
<Name>EUR Interactive Multi-Game Demo Disc: February 2003</Name>
</Build>
<Build>
<Version>1.111</Version>
<Region>JPN</Region>
<Name>GameCube 0-00 NTSC-J</Name>
</Build>
<Build>
<Version>1.111</Version>
<Region>JPN</Region>
<Name>GameCube 0-02 NTSC (Player's Choice)</Name>
</Build>
<Build>
<Version>3.570</Version>
<Region>JPN</Region>
<Name>Wii de Asobu</Name>
</Build>
<Build>
<Version>3.593</Version>
<Region>NTSC</Region>
<Name>Metroid Prime: Trilogy NTSC</Name>
</Build>
<Build>
<Version>3.629</Version>
<Region>PAL</Region>
<Name>Metroid Prime: Trilogy PAL</Name>
</Build>
</GameBuilds>
<AreaNameMap>
<AreaName>
<Key>0035FDAD</Key>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<GameInfo ArchiveVer="0" FileVer="0" Game="MPRM">
<GameBuilds>
<Build>
<Version>0.160</Version>
<Region>NTSC</Region>
<Name>Metroid Prime 2: Echoes Bonus Disc</Name>
</Build>
<Build>
<Version>0.227</Version>
<Region>NTSC</Region>
<Name>Multi-Game Demo Disc v20, v23-26</Name>
</Build>
<Build>
<Version>0.237</Version>
<Region>PAL</Region>
<Name>EUR Interactive Multi-Game Demo Disc: November 2004</Name>
</Build>
<Build>
<Version>1.028</Version>
<Region>NTSC</Region>
<Name>GameCube 0-00 NTSC</Name>
</Build>
<Build>
<Version>1.035</Version>
<Region>PAL</Region>
<Name>GameCube 0-00 PAL</Name>
</Build>
<Build>
<Version>1.036</Version>
<Region>JPN</Region>
<Name>GameCube 0-00 NTSC-J</Name>
</Build>
<Build>
<Version>3.561</Version>
<Region>JPN</Region>
<Name>Wii de Asobu</Name>
</Build>
<Build>
<Version>3.593</Version>
<Region>NTSC</Region>
<Name>Metroid Prime: Trilogy NTSC</Name>
</Build>
<Build>
<Version>3.629</Version>
<Region>PAL</Region>
<Name>Metroid Prime: Trilogy PAL</Name>
</Build>
</GameBuilds>
</GameInfo>

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<GameInfo ArchiveVer="0" FileVer="0" Game="MP3C">
<GameBuilds>
<Build>
<Version>3.068</Version>
<Region>NTSC</Region>
<Name>E3 2006 Prototype</Name>
</Build>
<Build>
<Version>3.436</Version>
<Region>NTSC</Region>
<Name>Wii NTSC</Name>
</Build>
<Build>
<Version>3.453</Version>
<Region>PAL</Region>
<Name>Wii PAL</Name>
</Build>
<Build>
<Version>3.495</Version>
<Region>JPN</Region>
<Name>Wii NTSC-J</Name>
</Build>
<Build>
<Version>3.593</Version>
<Region>NTSC</Region>
<Name>Metroid Prime: Trilogy NTSC</Name>
</Build>
<Build>
<Version>3.629</Version>
<Region>PAL</Region>
<Name>Metroid Prime: Trilogy PAL</Name>
</Build>
</GameBuilds>
</GameInfo>

View File

@ -67,25 +67,32 @@ void Serialize(IArchive& rArc, EGame& rGame)
}
// ERegion
static const TString gskRegionNames[] = { "NTSC", "PAL", "JPN", "UnknownRegion" };
static const u32 gskNumRegions = sizeof(gskRegionNames) / sizeof(gskRegionNames[0]);
TString GetRegionName(ERegion Region)
{
return gskRegionNames[(int) Region];
}
ERegion GetRegionForName(const TString& rkName)
{
for (u32 iReg = 0; iReg < gskNumRegions; iReg++)
if (gskRegionNames[iReg] == rkName)
return (ERegion) iReg;
return eRegion_Unknown;
}
void Serialize(IArchive& rArc, ERegion& rRegion)
{
static const TString skRegionNames[] = { "NTSC", "PAL", "JPN" };
TString Name;
if (rArc.IsWriter())
Name = skRegionNames[rRegion];
Name = GetRegionName(rRegion);
rArc.SerializePrimitive(Name);
if (rArc.IsReader())
{
for (u32 iReg = 0; iReg < 3; iReg++)
{
if (skRegionNames[iReg] == Name)
{
rRegion = (ERegion) iReg;
break;
}
}
}
rRegion = GetRegionForName(Name);
}

View File

@ -36,6 +36,8 @@ enum ERegion
eRegion_JPN,
eRegion_Unknown = -1
};
TString GetRegionName(ERegion Region);
ERegion GetRegionForName(const TString& rkName);
void Serialize(IArchive& rArc, ERegion& rRegion);
#endif // EGAME_H

View File

@ -41,10 +41,25 @@ void CGameInfo::Serialize(IArchive& rArc)
}
// Serialize data
rArc << SERIAL_CONTAINER("GameBuilds", mBuilds, "Build");
if (mGame <= ePrime)
rArc << SERIAL_CONTAINER("AreaNameMap", mAreaNameMap, "AreaName");
}
TString CGameInfo::GetBuildName(float BuildVer, ERegion Region) const
{
for (u32 iBuild = 0; iBuild < mBuilds.size(); iBuild++)
{
const SBuildInfo& rkBuildInfo = mBuilds[iBuild];
if (rkBuildInfo.Version == BuildVer && rkBuildInfo.Region == Region)
return rkBuildInfo.Name;
}
return "Unknown Build";
}
TString CGameInfo::GetAreaName(const CAssetID &rkID) const
{
auto Iter = mAreaNameMap.find(rkID);

View File

@ -14,6 +14,22 @@ const TString gkGameInfoExt = "xml";
class CGameInfo
{
EGame mGame;
// List of known builds of each game
struct SBuildInfo
{
float Version;
ERegion Region;
TString Name;
void Serialize(IArchive& rArc)
{
rArc << SERIAL_AUTO(Version) << SERIAL_AUTO(Region) << SERIAL_AUTO(Name);
}
};
std::vector<SBuildInfo> mBuilds;
// List of internal area names; used for MP1 which doesn't store area names in the MLVL
std::map<CAssetID, TString> mAreaNameMap;
public:
@ -26,6 +42,7 @@ public:
bool SaveGameInfo(TString Path = "");
void Serialize(IArchive& rArc);
TString GetBuildName(float BuildVer, ERegion Region) const;
TString GetAreaName(const CAssetID& rkID) const;
// Accessors

View File

@ -104,6 +104,8 @@ public:
inline CGameInfo* GameInfo() const { return mpGameInfo; }
inline CAudioManager* AudioManager() const { return mpAudioManager; }
inline EGame Game() const { return mGame; }
inline ERegion Region() const { return mRegion; }
inline TString GameID() const { return mGameID; }
inline float BuildVersion() const { return mBuildVersion; }
inline bool IsWiiBuild() const { return mBuildVersion >= 3.f; }
};

View File

@ -1,7 +1,7 @@
#include "CEditorApplication.h"
#include "IEditor.h"
#include "CBasicViewport.h"
#include "CProjectOverviewDialog.h"
#include "CProjectSettingsDialog.h"
#include "Editor/CharacterEditor/CCharacterEditor.h"
#include "Editor/ModelEditor/CModelEditorWindow.h"
#include "Editor/ResourceBrowser/CResourceBrowser.h"
@ -34,7 +34,7 @@ void CEditorApplication::InitEditor()
{
mpWorldEditor = new CWorldEditor();
mpResourceBrowser = new CResourceBrowser(mpWorldEditor);
mpProjectDialog = new CProjectOverviewDialog();
mpProjectDialog = new CProjectSettingsDialog(mpWorldEditor);
mpWorldEditor->showMaximized();
}

View File

@ -7,7 +7,7 @@
#include <QVector>
class CBasicViewport;
class CProjectOverviewDialog;
class CProjectSettingsDialog;
class CResourceBrowser;
class CResourceEntry;
class CWorldEditor;
@ -22,7 +22,7 @@ class CEditorApplication : public QApplication
CGameProject *mpActiveProject;
CWorldEditor *mpWorldEditor;
CResourceBrowser *mpResourceBrowser;
CProjectOverviewDialog *mpProjectDialog;
CProjectSettingsDialog *mpProjectDialog;
QVector<IEditor*> mEditorWindows;
QMap<CResourceEntry*,IEditor*> mEditingMap;
@ -43,7 +43,7 @@ public:
inline CGameProject* ActiveProject() const { return mpActiveProject; }
inline CWorldEditor* WorldEditor() const { return mpWorldEditor; }
inline CResourceBrowser* ResourceBrowser() const { return mpResourceBrowser; }
inline CProjectOverviewDialog* ProjectDialog() const { return mpProjectDialog; }
inline CProjectSettingsDialog* ProjectDialog() const { return mpProjectDialog; }
inline void SetEditorTicksEnabled(bool Enabled) { Enabled ? mRefreshTimer.start(gkTickFrequencyMS) : mRefreshTimer.stop(); }
inline bool AreEditorTicksEnabled() const { return mRefreshTimer.isActive(); }

View File

@ -61,6 +61,9 @@ void CExportGameDialog::InitUI(QString ExportDir)
ASSERT(mpDisc != nullptr);
// Export settings
CGameInfo GameInfo;
GameInfo.LoadGameInfo(mGame);
ExportDir.replace('/', '\\');
TWideString DefaultNameMapPath = CAssetNameMap::DefaultNameMapPath();
@ -76,7 +79,7 @@ void CExportGameDialog::InitUI(QString ExportDir)
// Info boxes
mpUI->GameTitleLineEdit->setText( TO_QSTRING(mGameTitle) );
mpUI->GameIdLineEdit->setText( TO_QSTRING(mGameID) );
mpUI->BuildVersionLineEdit->setText( QString::number(mBuildVer) );
mpUI->BuildVersionLineEdit->setText( QString("%1 (%2)").arg(mBuildVer).arg( TO_QSTRING(GameInfo.GetBuildName(mBuildVer, mRegion)) ));
mpUI->RegionLineEdit->setText( mRegion == eRegion_NTSC ? "NTSC" :
mRegion == eRegion_PAL ? "PAL" : "JPN" );

View File

@ -1,66 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CProjectOverviewDialog</class>
<widget class="QDialog" name="CProjectOverviewDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>492</width>
<height>445</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QGroupBox" name="PackagesGroupBox">
<property name="geometry">
<rect>
<x>100</x>
<y>130</y>
<width>280</width>
<height>287</height>
</rect>
</property>
<property name="title">
<string>Packages</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QListWidget" name="PackagesList">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="CookPackageButton">
<property name="text">
<string>Cook Package</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="CookAllDirtyPackagesButton">
<property name="text">
<string>Cook All Dirty Packages</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -1,5 +1,5 @@
#include "CProjectOverviewDialog.h"
#include "ui_CProjectOverviewDialog.h"
#include "CProjectSettingsDialog.h"
#include "ui_CProjectSettingsDialog.h"
#include "CEditorApplication.h"
#include "CExportGameDialog.h"
#include "UICommon.h"
@ -9,9 +9,9 @@
#include <QFileDialog>
#include <QMessageBox>
CProjectOverviewDialog::CProjectOverviewDialog(QWidget *pParent)
CProjectSettingsDialog::CProjectSettingsDialog(QWidget *pParent)
: QDialog(pParent)
, mpUI(new Ui::CProjectOverviewDialog)
, mpUI(new Ui::CProjectSettingsDialog)
, mpProject(nullptr)
{
mpUI->setupUi(this);
@ -23,18 +23,43 @@ CProjectOverviewDialog::CProjectOverviewDialog(QWidget *pParent)
connect(gpEdApp, SIGNAL(AssetsModified()), this, SLOT(SetupPackagesList()));
}
CProjectOverviewDialog::~CProjectOverviewDialog()
CProjectSettingsDialog::~CProjectSettingsDialog()
{
delete mpUI;
}
void CProjectOverviewDialog::ActiveProjectChanged(CGameProject *pProj)
void CProjectSettingsDialog::ActiveProjectChanged(CGameProject *pProj)
{
mpProject = pProj;
if (mpProject)
{
// Set up project info
mpUI->ProjectNameLineEdit->setText( TO_QSTRING(pProj->Name()) );
mpUI->GameLineEdit->setText( TO_QSTRING(GetGameName(pProj->Game())) );
mpUI->GameIdLineEdit->setText( TO_QSTRING(pProj->GameID()) );
float BuildVer = pProj->BuildVersion();
ERegion Region = pProj->Region();
TString BuildName = pProj->GameInfo()->GetBuildName(BuildVer, Region);
mpUI->BuildLineEdit->setText( QString("%1 (%2)").arg(BuildVer).arg( TO_QSTRING(BuildName) ) );
mpUI->RegionLineEdit->setText( TO_QSTRING(GetRegionName(Region)) );
}
else
{
// Clear project info
mpUI->ProjectNameLineEdit->clear();
mpUI->GameLineEdit->clear();
mpUI->GameIdLineEdit->clear();
mpUI->BuildLineEdit->clear();
mpUI->RegionLineEdit->clear();
close();
}
SetupPackagesList();
}
void CProjectOverviewDialog::SetupPackagesList()
void CProjectSettingsDialog::SetupPackagesList()
{
mpUI->PackagesList->clear();
if (!mpProject) return;
@ -50,7 +75,7 @@ void CProjectOverviewDialog::SetupPackagesList()
}
}
void CProjectOverviewDialog::CookPackage()
void CProjectSettingsDialog::CookPackage()
{
u32 PackageIdx = mpUI->PackagesList->currentRow();
CPackage *pPackage = mpProject->PackageByIndex(PackageIdx);
@ -58,7 +83,7 @@ void CProjectOverviewDialog::CookPackage()
SetupPackagesList();
}
void CProjectOverviewDialog::CookAllDirtyPackages()
void CProjectSettingsDialog::CookAllDirtyPackages()
{
gpEdApp->CookAllDirtyPackages();
SetupPackagesList();

View File

@ -1,5 +1,5 @@
#ifndef CPROJECTOVERVIEWDIALOG_H
#define CPROJECTOVERVIEWDIALOG_H
#ifndef CPROJECTSETTINGSDIALOG_H
#define CPROJECTSETTINGSDIALOG_H
#include "Editor/WorldEditor/CWorldEditor.h"
#include <Core/GameProject/CGameProject.h>
@ -7,13 +7,13 @@
#include <QDialog>
namespace Ui {
class CProjectOverviewDialog;
class CProjectSettingsDialog;
}
class CProjectOverviewDialog : public QDialog
class CProjectSettingsDialog : public QDialog
{
Q_OBJECT
Ui::CProjectOverviewDialog *mpUI;
Ui::CProjectSettingsDialog *mpUI;
CGameProject *mpProject;
QVector<CResourceEntry*> mWorldEntries;
@ -21,8 +21,8 @@ class CProjectOverviewDialog : public QDialog
TResPtr<CWorld> mpWorld;
public:
explicit CProjectOverviewDialog(QWidget *pParent = 0);
~CProjectOverviewDialog();
explicit CProjectSettingsDialog(QWidget *pParent = 0);
~CProjectSettingsDialog();
public slots:
void ActiveProjectChanged(CGameProject *pProj);
@ -31,4 +31,4 @@ public slots:
void CookAllDirtyPackages();
};
#endif // CPROJECTOVERVIEWDIALOG_H
#endif // CPROJECTSETTINGSDIALOG_H

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CProjectSettingsDialog</class>
<widget class="QDialog" name="CProjectSettingsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>290</width>
<height>558</height>
</rect>
</property>
<property name="windowTitle">
<string>Project Settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="ProjectSettingsLabel">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Project Settings</string>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="ProjectNameLabel">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="ProjectNameLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="GameLabel">
<property name="text">
<string>Game:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="GameLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="GameIdLabel">
<property name="text">
<string>Game ID:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="GameIdLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="BuildLabel">
<property name="text">
<string>Build:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="BuildLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="RegionLabel">
<property name="text">
<string>Region:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="RegionLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="PackagesGroupBox">
<property name="title">
<string>Packages</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QListWidget" name="PackagesList">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="CookPackageButton">
<property name="text">
<string>Cook Package</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="CookAllDirtyPackagesButton">
<property name="text">
<string>Cook All Dirty Packages</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -172,7 +172,6 @@ HEADERS += \
CharacterEditor/CSkeletonHierarchyModel.h \
CLineRenderable.h \
WorldEditor/CCollisionRenderSettingsDialog.h \
CProjectOverviewDialog.h \
ResourceBrowser/CResourceBrowser.h \
ResourceBrowser/CResourceTableModel.h \
ResourceBrowser/CResourceProxyModel.h \
@ -184,7 +183,8 @@ HEADERS += \
WorldEditor/CScriptEditSidebar.h \
WorldEditor/CWorldInfoSidebar.h \
WorldEditor/CWorldTreeModel.h \
Widgets/CTimedLineEdit.h
Widgets/CTimedLineEdit.h \
CProjectSettingsDialog.h
# Source Files
SOURCES += \
@ -244,14 +244,14 @@ SOURCES += \
CharacterEditor/CCharacterEditorViewport.cpp \
CharacterEditor/CSkeletonHierarchyModel.cpp \
WorldEditor/CCollisionRenderSettingsDialog.cpp \
CProjectOverviewDialog.cpp \
ResourceBrowser/CResourceBrowser.cpp \
CEditorApplication.cpp \
Widgets/CResourceSelector.cpp \
CExportGameDialog.cpp \
WorldEditor/CScriptEditSidebar.cpp \
WorldEditor/CWorldInfoSidebar.cpp \
WorldEditor/CWorldTreeModel.cpp
WorldEditor/CWorldTreeModel.cpp \
CProjectSettingsDialog.cpp
# UI Files
FORMS += \
@ -274,7 +274,7 @@ FORMS += \
CAboutDialog.ui \
CharacterEditor/CCharacterEditor.ui \
WorldEditor/CCollisionRenderSettingsDialog.ui \
CProjectOverviewDialog.ui \
ResourceBrowser/CResourceBrowser.ui \
CExportGameDialog.ui \
WorldEditor/CWorldInfoSidebar.ui
WorldEditor/CWorldInfoSidebar.ui \
CProjectSettingsDialog.ui

View File

@ -12,6 +12,7 @@
#include "Editor/CExportGameDialog.h"
#include "Editor/CNodeCopyMimeData.h"
#include "Editor/CPakToolDialog.h"
#include "Editor/CProjectSettingsDialog.h"
#include "Editor/CSelectionIterator.h"
#include "Editor/UICommon.h"
#include "Editor/PropertyEdit/CPropertyView.h"
@ -171,6 +172,7 @@ CWorldEditor::CWorldEditor(QWidget *parent)
connect(ui->ActionSave, SIGNAL(triggered()) , this, SLOT(Save()));
connect(ui->ActionSaveAndRepack, SIGNAL(triggered()), this, SLOT(SaveAndRepack()));
connect(ui->ActionExportGame, SIGNAL(triggered()), this, SLOT(ExportGame()));
connect(ui->ActionProjectSettings, SIGNAL(triggered()), this, SLOT(OpenProjectSettings()));
connect(ui->ActionCloseProject, SIGNAL(triggered()), this, SLOT(CloseProject()));
connect(ui->ActionExit, SIGNAL(triggered()), this, SLOT(close()));
@ -317,29 +319,20 @@ bool CWorldEditor::SetArea(CWorld *pWorld, int AreaIndex)
mpLinkDialog->SetMaster(pMaster);
// Set window title
CStringTable *pWorldNameTable = mpWorld->WorldName();
TWideString WorldName = pWorldNameTable ? pWorldNameTable->String("ENGL", 0) : "[Untitled World]";
QString ProjectName = TO_QSTRING(gpEdApp->ActiveProject()->Name());
QString WorldName = TO_QSTRING(mpWorld->InGameName());
QString AreaName = TO_QSTRING(mpWorld->AreaInGameName(AreaIndex));
if (CurrentGame() < eReturns)
{
CStringTable *pAreaNameTable = mpWorld->AreaName(AreaIndex);
TWideString AreaName = pAreaNameTable ? pAreaNameTable->String("ENGL", 0) : (TWideString("!") + mpWorld->AreaInternalName(AreaIndex).ToUTF16());
if (AreaName.IsEmpty())
AreaName = "[Untitled Area]";
SET_WINDOWTITLE_APPVARS( QString("%APP_FULL_NAME% - %1 - %2[*]").arg(TO_QSTRING(WorldName)).arg(TO_QSTRING(AreaName)) );
Log::Write("Loaded area: " + mpArea->Source() + " (" + TO_TSTRING(TO_QSTRING(AreaName)) + ")");
SET_WINDOWTITLE_APPVARS( QString("%APP_FULL_NAME% - %1 - %2 - %3[*]").arg(ProjectName, WorldName, AreaName) );
Log::Write("Loaded area: " + mpArea->Entry()->Name().ToUTF8() + " (" + TO_TSTRING(AreaName) + ")");
}
else
{
QString LevelName;
if (pWorldNameTable) LevelName = TO_QSTRING(WorldName);
else LevelName = "!" + TO_QSTRING(mpWorld->AreaInternalName(AreaIndex));
SET_WINDOWTITLE_APPVARS( QString("%APP_FULL_NAME% - %1[*]").arg(LevelName) );
Log::Write("Loaded level: World " + mpWorld->Source() + " / Area " + mpArea->Source() + " (" + TO_TSTRING(LevelName) + ")");
SET_WINDOWTITLE_APPVARS( QString("%APP_FULL_NAME% - %1 - %2[*]").arg(AreaName) );
Log::Write("Loaded level: World " + mpWorld->Entry()->Name().ToUTF8() + " / Area " + mpArea->Entry()->Name().ToUTF8() + " (" + TO_TSTRING(AreaName) + ")");
}
// Update paste action
@ -560,6 +553,13 @@ void CWorldEditor::ChangeEditMode(EWorldEditorMode Mode)
}
}
void CWorldEditor::OpenProjectSettings()
{
CProjectSettingsDialog *pDialog = gpEdApp->ProjectDialog();
pDialog->show();
pDialog->raise();
}
void CWorldEditor::OpenResourceBrowser()
{
CResourceBrowser *pBrowser = gpEdApp->ResourceBrowser();
@ -569,6 +569,7 @@ void CWorldEditor::OpenResourceBrowser()
void CWorldEditor::OnActiveProjectChanged(CGameProject *pProj)
{
ui->ActionProjectSettings->setEnabled( pProj != nullptr );
ui->ActionCloseProject->setEnabled( pProj != nullptr );
ResetCamera();
if (!pProj) return;

View File

@ -109,6 +109,7 @@ public slots:
void ChangeEditMode(int Mode);
void ChangeEditMode(EWorldEditorMode Mode);
void OpenProjectSettings();
void OpenResourceBrowser();
void OnActiveProjectChanged(CGameProject *pProj);

View File

@ -283,8 +283,9 @@
<addaction name="ActionSaveAndRepack"/>
<addaction name="separator"/>
<addaction name="ActionExportGame"/>
<addaction name="separator"/>
<addaction name="ActionProjectSettings"/>
<addaction name="ActionCloseProject"/>
<addaction name="separator"/>
<addaction name="ActionExit"/>
</widget>
<widget class="QMenu" name="menuEdit">
@ -350,7 +351,7 @@
</widget>
<widget class="QToolBar" name="EditModeToolBar">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -362,7 +363,7 @@
<enum>RightToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>true</bool>
<bool>false</bool>
</attribute>
</widget>
<action name="ActionSave">
@ -762,6 +763,14 @@
<string>Edit Script</string>
</property>
</action>
<action name="ActionProjectSettings">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Project Settings</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -17,6 +17,7 @@ CWorldInfoSidebar::CWorldInfoSidebar(CWorldEditor *pEditor)
pHeader->resizeSection(0, pHeader->width() * 2); // I really have no idea how this works, I just got this from trial & error
connect(gpEdApp, SIGNAL(ActiveProjectChanged(CGameProject*)), this, SLOT(OnActiveProjectChanged(CGameProject*)));
connect(mpUI->ProjectSettingsButton, SIGNAL(pressed()), pEditor, SLOT(OpenProjectSettings()));
connect(mpUI->AreaSearchLineEdit, SIGNAL(StoppedTyping(QString)), this, SLOT(OnAreaFilterStringChanged(QString)));
connect(mpUI->WorldTreeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(OnWorldTreeClicked(QModelIndex)));
connect(mpUI->WorldTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(OnWorldTreeDoubleClicked(QModelIndex)));

View File

@ -17,6 +17,9 @@
<item>
<widget class="QWidget" name="ProjectInfoWidget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
@ -29,8 +32,16 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="GameNameLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
@ -41,6 +52,20 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ProjectSettingsButton">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Project Settings</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="CTimedLineEdit" name="AreaSearchLineEdit">
<property name="font">
@ -252,10 +277,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="CResourceSelector" name="AreaSelector" native="true">
<zorder>AreaNameLineEdit</zorder>
<zorder>AreaInternalNameLabel</zorder>
</widget>
<widget class="CResourceSelector" name="AreaSelector" native="true"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="AreaNameStringLabel">

View File

@ -1,5 +1,4 @@
#include "CEditorApplication.h"
#include "CProjectOverviewDialog.h"
#include <Common/Log.h>
#include <Core/Resource/Factory/CTemplateLoader.h>