mirror of https://github.com/PCSX2/pcsx2.git
GSDump: implement dump preview
This commit is contained in:
parent
1f5c0639b9
commit
f1df1de64f
|
@ -35,6 +35,7 @@
|
|||
#include <wx/treectrl.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/dir.h>
|
||||
#include <wx/image.h>
|
||||
|
||||
using namespace pxSizerFlags;
|
||||
|
||||
|
@ -44,7 +45,8 @@ using namespace pxSizerFlags;
|
|||
|
||||
Dialogs::GSDumpDialog::GSDumpDialog(wxWindow* parent)
|
||||
: wxDialogWithHelpers(parent, _("GSDumpGov"), pxDialogFlags())
|
||||
, m_dump_list(new wxListView(this, wxID_ANY, wxDefaultPosition, wxSize(250, 200)))
|
||||
, m_dump_list(new wxListView(this, ID_DUMP_LIST, wxDefaultPosition, wxSize(250, 200)))
|
||||
, m_preview_image(new wxStaticBitmap(this, wxID_ANY, wxBitmap(EmbeddedImage<res_NoIcon>().Get())))
|
||||
{
|
||||
const float scale = MSW_GetDPIScale();
|
||||
SetMinWidth(scale * 460);
|
||||
|
@ -90,9 +92,7 @@ Dialogs::GSDumpDialog::GSDumpDialog(wxWindow* parent)
|
|||
dumps_list += m_dump_list;
|
||||
|
||||
dump_preview += new wxStaticText(this, wxID_ANY, _("Preview"));
|
||||
wxImage img = EmbeddedImage<res_NoIcon>().Get();
|
||||
img.Rescale(250 * scale, 200 * scale, wxIMAGE_QUALITY_HIGH);
|
||||
dump_preview += new wxStaticBitmap(this, wxID_ANY, wxBitmap(img));
|
||||
dump_preview += m_preview_image;
|
||||
|
||||
|
||||
dumps += dumps_list;
|
||||
|
@ -113,26 +113,30 @@ Dialogs::GSDumpDialog::GSDumpDialog(wxWindow* parent)
|
|||
|
||||
void Dialogs::GSDumpDialog::GetDumpsList()
|
||||
{
|
||||
wxDir snaps(g_Conf->Folders.Snapshots.GetFilename().GetName());
|
||||
wxDir snaps(g_Conf->Folders.Snapshots.ToAscii());
|
||||
wxString filename;
|
||||
bool cont = snaps.GetFirst(&filename, "*.gs", wxDIR_DEFAULT);
|
||||
int i = 0;
|
||||
m_dump_list->AppendColumn("Dumps");
|
||||
while (cont)
|
||||
{
|
||||
m_dump_list->InsertItem(i, filename.c_str());
|
||||
m_dump_list->InsertItem(i, filename.substr(0, filename.find_last_of(".")));
|
||||
i++;
|
||||
cont = snaps.GetNext(&filename);
|
||||
}
|
||||
}
|
||||
|
||||
Dialogs::GSDumpDialog::~GSDumpDialog()
|
||||
{
|
||||
// we can't use smart pointers because of wxWidgets operator overload so we
|
||||
// do the next best thing and handle the manual memory management ourselves
|
||||
delete m_dump_list;
|
||||
}
|
||||
|
||||
void Dialogs::GSDumpDialog::SelectedDump(wxListEvent& evt)
|
||||
{
|
||||
//evt->GetText();
|
||||
wxString filename = g_Conf->Folders.Snapshots.ToAscii() + ("/" + evt.GetText()) + ".png";
|
||||
if (wxFileExists(filename))
|
||||
{
|
||||
auto img = wxImage(filename);
|
||||
img.Rescale(250 * MSW_GetDPIScale(), 200 * MSW_GetDPIScale(), wxIMAGE_QUALITY_HIGH);
|
||||
m_preview_image->SetBitmap(wxBitmap(img));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_preview_image->SetBitmap(EmbeddedImage<res_NoIcon>().Get());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace Dialogs
|
|||
{
|
||||
public:
|
||||
GSDumpDialog(wxWindow* parent = NULL);
|
||||
virtual ~GSDumpDialog();
|
||||
virtual ~GSDumpDialog() = default;
|
||||
|
||||
static wxString GetNameStatic()
|
||||
{
|
||||
|
@ -85,6 +85,7 @@ namespace Dialogs
|
|||
|
||||
protected:
|
||||
wxListView* m_dump_list;
|
||||
wxStaticBitmap* m_preview_image;
|
||||
void GetDumpsList();
|
||||
void SelectedDump(wxListEvent& evt);
|
||||
enum
|
||||
|
|
Loading…
Reference in New Issue