Add an unlimited grid at the bottom of the window

This change's been unstaged since 2020 I think, it was
probably just to test the idea of having a bottom grid
acting as the general "database". It's working though it
needs changing, I'm committing it and will modify it
as needed in the future
This commit is contained in:
King_DuckZ 2025-02-15 11:22:46 +00:00
parent acf84afa4e
commit 8c83c32b3d
2 changed files with 21 additions and 4 deletions

View file

@ -28,6 +28,7 @@
#include <QFileDialog>
#include <QGridLayout>
#include <QLabel>
#include <QVBoxLayout>
#include <memory>
#include <filesystem>
#include <cassert>
@ -43,11 +44,20 @@ namespace {
MemoservWin::MemoservWin(QApplication* app, QWidget *parent) :
QMainWindow(parent),
m_main_lay(nullptr),
m_lower_grid(nullptr),
m_grid_count(0)
{
m_main_lay = new QGridLayout;
auto vert_lay = std::make_unique<QVBoxLayout>();
{
m_main_lay = new QGridLayout;
vert_lay->addLayout(m_main_lay);
}
vert_lay->addWidget(m_lower_grid = new widget::BlockGrid(this, 0, 0, g_icon_fps));
m_lower_grid->set_icon_size(g_icon_size);
this->setCentralWidget(new QWidget);
this->centralWidget()->setLayout(m_main_lay);
this->centralWidget()->setLayout(vert_lay.release());
create_menu(app);
}
@ -97,6 +107,9 @@ void MemoservWin::open_file_from_dialog() {
);
load_memory_cards(files);
m_main_lay->setColumnStretch(m_grid_count, 1);
}
void MemoservWin::load_memory_cards (const QStringList& paths) {
using std::filesystem::path;
@ -123,14 +136,13 @@ void MemoservWin::load_memory_cards (const QStringList& paths) {
for (std::size_t n = 0; block.has_magic() and n < block.block_count(); ++n) {
grid->push_back(make_qt_animation(block, g_icon_size, g_icon_size));
m_lower_grid->push_back(make_qt_animation(block, g_icon_size, g_icon_size));
}
}
m_main_lay->addWidget(grid.release(), 1, m_grid_count);
++m_grid_count;
}
m_main_lay->setColumnStretch(m_grid_count, 1);
}
void MemoservWin::show_version_info() {

View file

@ -31,6 +31,10 @@ class MemoryCard;
namespace duck {
namespace widget {
class BlockGrid;
} //namespace widget
class MemoservWin : public QMainWindow
{
Q_OBJECT
@ -49,6 +53,7 @@ private:
duck::BlockDb m_block_db;
std::list<mc::psx::MemoryCard> m_memcards;
QGridLayout* m_main_lay;
widget::BlockGrid* m_lower_grid;
unsigned int m_grid_count;
};