diff --git a/Source/Core/DolphinQt2/CMakeLists.txt b/Source/Core/DolphinQt2/CMakeLists.txt index 7907501666..faf8b468f5 100644 --- a/Source/Core/DolphinQt2/CMakeLists.txt +++ b/Source/Core/DolphinQt2/CMakeLists.txt @@ -39,7 +39,6 @@ set(SRCS GameList/GameListModel.cpp GameList/GameTracker.cpp GameList/ListProxyModel.cpp - GameList/TableDelegate.cpp Settings/GeneralPane.cpp Settings/InterfacePane.cpp ) diff --git a/Source/Core/DolphinQt2/DolphinQt2.vcxproj b/Source/Core/DolphinQt2/DolphinQt2.vcxproj index e3afaee470..3f349a7996 100644 --- a/Source/Core/DolphinQt2/DolphinQt2.vcxproj +++ b/Source/Core/DolphinQt2/DolphinQt2.vcxproj @@ -94,7 +94,6 @@ - @@ -129,7 +128,6 @@ - @@ -154,7 +152,6 @@ - diff --git a/Source/Core/DolphinQt2/DolphinQt2.vcxproj.filters b/Source/Core/DolphinQt2/DolphinQt2.vcxproj.filters index ba0d04a1ac..0a4627d729 100644 --- a/Source/Core/DolphinQt2/DolphinQt2.vcxproj.filters +++ b/Source/Core/DolphinQt2/DolphinQt2.vcxproj.filters @@ -63,14 +63,10 @@ Config - Generated Files - - Generated Files - Generated Files @@ -146,7 +142,6 @@ Config - diff --git a/Source/Core/DolphinQt2/GameList/TableDelegate.cpp b/Source/Core/DolphinQt2/GameList/TableDelegate.cpp deleted file mode 100644 index f0f2fcaadf..0000000000 --- a/Source/Core/DolphinQt2/GameList/TableDelegate.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2016 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include - -#include "DolphinQt2/GameList/GameFile.h" -#include "DolphinQt2/GameList/GameListModel.h" -#include "DolphinQt2/GameList/TableDelegate.h" -#include "DolphinQt2/Resources.h" - -static QSize NORMAL_BANNER_SIZE(96, 32); - -TableDelegate::TableDelegate(QWidget* parent) : QStyledItemDelegate(parent) -{ -} - -void TableDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, - const QModelIndex& index) const -{ - QVariant data = index.data(Qt::DisplayRole); - switch (index.column()) - { - case GameListModel::COL_PLATFORM: - DrawPixmap(painter, option.rect, Resources::GetPlatform(data.toInt())); - break; - case GameListModel::COL_COUNTRY: - DrawPixmap(painter, option.rect, Resources::GetCountry(data.toInt())); - break; - case GameListModel::COL_RATING: - DrawPixmap(painter, option.rect, Resources::GetRating(data.toInt())); - break; - case GameListModel::COL_BANNER: - DrawPixmap(painter, option.rect, - data.value().scaled(NORMAL_BANNER_SIZE, Qt::KeepAspectRatio, - Qt::SmoothTransformation)); - break; - case GameListModel::COL_SIZE: - painter->drawText(option.rect, Qt::AlignCenter, FormatSize(data.toULongLong())); - break; - // Fall through. - case GameListModel::COL_ID: - case GameListModel::COL_TITLE: - case GameListModel::COL_DESCRIPTION: - case GameListModel::COL_MAKER: - painter->drawText(option.rect, Qt::AlignVCenter, data.toString()); - break; - default: - break; - } -} - -QSize TableDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const -{ - switch (index.column()) - { - case GameListModel::COL_PLATFORM: - return Resources::GetPlatform(0).size(); - case GameListModel::COL_COUNTRY: - return Resources::GetCountry(0).size(); - case GameListModel::COL_RATING: - return Resources::GetRating(0).size(); - case GameListModel::COL_BANNER: - return NORMAL_BANNER_SIZE; - default: - return QSize(0, 0); - } -} - -void TableDelegate::DrawPixmap(QPainter* painter, const QRect& rect, const QPixmap& pixmap) const -{ - // We don't want to stretch the pixmap out, so center it in the rect. - painter->drawPixmap(rect.left() + (rect.width() - pixmap.width()) / 2, - rect.top() + (rect.height() - pixmap.height()) / 2, pixmap); -} diff --git a/Source/Core/DolphinQt2/GameList/TableDelegate.h b/Source/Core/DolphinQt2/GameList/TableDelegate.h deleted file mode 100644 index f44c13fe10..0000000000 --- a/Source/Core/DolphinQt2/GameList/TableDelegate.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -#include - -class TableDelegate final : public QStyledItemDelegate -{ - Q_OBJECT - -public: - explicit TableDelegate(QWidget* parent = nullptr); - void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; - QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const; - -private: - void DrawPixmap(QPainter* painter, const QRect& rect, const QPixmap& pixmap) const; -};