shadPS4/src/qt_gui/game_list_grid.h

63 lines
1.6 KiB
C
Raw Normal View History

file formats and qt (#88) * added psf file format * clang format fix * crypto functions for pkg decryption * pkg decryption * initial add of qt gui , not yet usable * renamed ini for qt gui settings into shadps4qt.ini * file detection and loader support * option to build QT qui * clang format fix * fixed reuse * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/loader.h Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/loader.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * uppercase fix * clang format fix * small fixes * let's try windows qt build ci * some more fixes for ci * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update .github/workflows/windows-qt.yml Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/loader.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/psf.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * loader namespace * Update src/core/loader.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * constexpr magic * linux qt ci by qurious * fix for linux qt * Make script executable * ci fix? --------- Co-authored-by: raziel1000 <ckraziel@gmail.com> Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> Co-authored-by: GPUCode <geoster3d@gmail.com>
2024-02-29 23:00:35 +01:00
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QCoreApplication>
#include "custom_dock_widget.h"
#include "game_list_table.h"
#include "game_list_utils.h"
#include "gui_settings.h"
class GameListGridDelegate;
class GameListGrid : public GameListTable {
Q_OBJECT
QSize m_icon_size;
QColor m_icon_color;
qreal m_margin_factor;
qreal m_text_factor;
bool m_text_enabled = true;
Q_SIGNALS:
void ResizedWindowGrid(QTableWidgetItem* item);
protected:
void resizeEvent(QResizeEvent* event) override;
public:
explicit GameListGrid(const QSize& icon_size, QColor icon_color, const qreal& margin_factor,
const qreal& text_factor, const bool& showText);
void enableText(const bool& enabled);
void setIconSize(const QSize& size) const;
GameListItem* addItem(const game_info& app, const QString& name, const int& row,
const int& col);
[[nodiscard]] qreal getMarginFactor() const;
game_info GetGameInfoFromItem(const QTableWidgetItem* item) {
if (!item) {
return nullptr;
}
const QVariant var = item->data(gui::game_role);
if (!var.canConvert<game_info>()) {
return nullptr;
}
return var.value<game_info>();
}
private:
void SetGridBackgroundImage(QTableWidgetItem* item);
void RefreshBackgroundImage();
GameListGridDelegate* grid_item_delegate;
GameListUtils m_game_list_utils;
// Background Image
QImage backgroundImage;
};