2016-07-08 07:10:07 +00:00
|
|
|
#include "CProjectOverviewDialog.h"
|
|
|
|
#include "ui_CProjectOverviewDialog.h"
|
2017-02-01 15:43:42 +00:00
|
|
|
#include "CEditorApplication.h"
|
2017-02-06 16:20:18 +00:00
|
|
|
#include "CExportGameDialog.h"
|
2016-07-08 07:10:07 +00:00
|
|
|
#include "UICommon.h"
|
2016-07-10 12:58:23 +00:00
|
|
|
#include "Editor/ResourceBrowser/CResourceBrowser.h"
|
2016-07-08 07:10:07 +00:00
|
|
|
#include <Common/AssertMacro.h>
|
|
|
|
#include <Core/GameProject/CGameExporter.h>
|
|
|
|
#include <QFileDialog>
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
|
|
|
CProjectOverviewDialog::CProjectOverviewDialog(QWidget *pParent)
|
|
|
|
: QDialog(pParent)
|
|
|
|
, mpUI(new Ui::CProjectOverviewDialog)
|
|
|
|
, mpProject(nullptr)
|
|
|
|
{
|
|
|
|
mpUI->setupUi(this);
|
|
|
|
|
2016-08-12 10:27:19 +00:00
|
|
|
connect(mpUI->CookPackageButton, SIGNAL(clicked()), this, SLOT(CookPackage()));
|
2017-02-09 17:54:38 +00:00
|
|
|
connect(mpUI->CookAllDirtyPackagesButton, SIGNAL(clicked(bool)), this, SLOT(CookAllDirtyPackages()));
|
2017-02-08 18:20:33 +00:00
|
|
|
|
2017-02-12 21:19:51 +00:00
|
|
|
connect(gpEdApp, SIGNAL(ActiveProjectChanged(CGameProject*)), this, SLOT(ActiveProjectChanged(CGameProject*)));
|
2017-02-08 18:20:33 +00:00
|
|
|
connect(gpEdApp, SIGNAL(AssetsModified()), this, SLOT(SetupPackagesList()));
|
2016-07-08 07:10:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CProjectOverviewDialog::~CProjectOverviewDialog()
|
|
|
|
{
|
|
|
|
delete mpUI;
|
|
|
|
}
|
|
|
|
|
2017-02-12 21:19:51 +00:00
|
|
|
void CProjectOverviewDialog::ActiveProjectChanged(CGameProject *pProj)
|
|
|
|
{
|
|
|
|
mpProject = pProj;
|
|
|
|
SetupPackagesList();
|
|
|
|
}
|
|
|
|
|
2016-08-12 10:27:19 +00:00
|
|
|
void CProjectOverviewDialog::SetupPackagesList()
|
|
|
|
{
|
|
|
|
mpUI->PackagesList->clear();
|
2017-02-13 20:44:02 +00:00
|
|
|
if (!mpProject) return;
|
2016-08-12 10:27:19 +00:00
|
|
|
|
|
|
|
for (u32 iPkg = 0; iPkg < mpProject->NumPackages(); iPkg++)
|
|
|
|
{
|
|
|
|
CPackage *pPackage = mpProject->PackageByIndex(iPkg);
|
|
|
|
ASSERT(pPackage != nullptr);
|
2017-02-08 18:20:33 +00:00
|
|
|
|
|
|
|
QString PackageName = TO_QSTRING(pPackage->Name());
|
|
|
|
if (pPackage->NeedsRecook()) PackageName += '*';
|
|
|
|
mpUI->PackagesList->addItem(PackageName);
|
2016-08-12 10:27:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CProjectOverviewDialog::CookPackage()
|
|
|
|
{
|
|
|
|
u32 PackageIdx = mpUI->PackagesList->currentRow();
|
|
|
|
CPackage *pPackage = mpProject->PackageByIndex(PackageIdx);
|
|
|
|
pPackage->Cook();
|
2017-02-09 17:54:38 +00:00
|
|
|
SetupPackagesList();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CProjectOverviewDialog::CookAllDirtyPackages()
|
|
|
|
{
|
|
|
|
gpEdApp->CookAllDirtyPackages();
|
|
|
|
SetupPackagesList();
|
2016-08-12 10:27:19 +00:00
|
|
|
}
|