From 8c83c32b3d4d3877b2533b1ab83ec658c5ad06e8 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sat, 15 Feb 2025 11:22:46 +0000 Subject: [PATCH] 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 --- src/qt/memoserv_win.cpp | 20 ++++++++++++++++---- src/qt/memoserv_win.hpp | 5 +++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/qt/memoserv_win.cpp b/src/qt/memoserv_win.cpp index 7062f6e..351b9c2 100644 --- a/src/qt/memoserv_win.cpp +++ b/src/qt/memoserv_win.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -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(); + { + 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() { diff --git a/src/qt/memoserv_win.hpp b/src/qt/memoserv_win.hpp index 06e9173..3efe359 100644 --- a/src/qt/memoserv_win.hpp +++ b/src/qt/memoserv_win.hpp @@ -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 m_memcards; QGridLayout* m_main_lay; + widget::BlockGrid* m_lower_grid; unsigned int m_grid_count; };