Permalink
Browse files

Revert "Qt/GameList: Add option to show covers in grid mode"

  • Loading branch information...
delroth committed Jul 28, 2018
1 parent 64b19b7 commit 9b94c76f8171c3b520e69cde827f4221907c654b
@@ -39,7 +39,6 @@
#define GAMESETTINGS_DIR "GameSettings"
#define MAPS_DIR "Maps"
#define CACHE_DIR "Cache"
#define COVERCACHE_DIR "GameCovers"
#define SHADERCACHE_DIR "Shaders"
#define STATESAVES_DIR "StateSaves"
#define SCREENSHOTS_DIR "ScreenShots"
@@ -759,7 +759,6 @@ static void RebuildUserDirectories(unsigned int dir_index)
s_user_paths[D_GAMESETTINGS_IDX] = s_user_paths[D_USER_IDX] + GAMESETTINGS_DIR DIR_SEP;
s_user_paths[D_MAPS_IDX] = s_user_paths[D_USER_IDX] + MAPS_DIR DIR_SEP;
s_user_paths[D_CACHE_IDX] = s_user_paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
s_user_paths[D_COVERCACHE_IDX] = s_user_paths[D_CACHE_IDX] + COVERCACHE_DIR DIR_SEP;
s_user_paths[D_SHADERCACHE_IDX] = s_user_paths[D_CACHE_IDX] + SHADERCACHE_DIR DIR_SEP;
s_user_paths[D_SHADERS_IDX] = s_user_paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
s_user_paths[D_STATESAVES_IDX] = s_user_paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
@@ -815,7 +814,6 @@ static void RebuildUserDirectories(unsigned int dir_index)
break;
case D_CACHE_IDX:
s_user_paths[D_COVERCACHE_IDX] = s_user_paths[D_CACHE_IDX] + COVERCACHE_DIR DIR_SEP;
s_user_paths[D_SHADERCACHE_IDX] = s_user_paths[D_CACHE_IDX] + SHADERCACHE_DIR DIR_SEP;
break;
@@ -29,7 +29,6 @@ enum
// settings (per game)
D_MAPS_IDX,
D_CACHE_IDX,
D_COVERCACHE_IDX,
D_SHADERCACHE_IDX,
D_SHADERS_IDX,
D_STATESAVES_IDX,
@@ -10,6 +10,5 @@ namespace Config
const ConfigInfo<bool> MAIN_USE_DISCORD_PRESENCE{{System::Main, "General", "UseDiscordPresence"},
true};
const ConfigInfo<bool> MAIN_USE_GAME_COVERS{{System::Main, "General", "UseGameCovers"}, false};
} // namespace Config
@@ -17,6 +17,5 @@ namespace Config
// UI.General
extern const ConfigInfo<bool> MAIN_USE_DISCORD_PRESENCE;
extern const ConfigInfo<bool> MAIN_USE_GAME_COVERS;
} // namespace Config
@@ -21,7 +21,6 @@
#include <QMenu>
#include <QMessageBox>
#include <QProgressDialog>
#include <QShortcut>
#include <QSortFilterProxyModel>
#include <QTableView>
#include <QUrl>
@@ -74,15 +73,6 @@ GameList::GameList(QWidget* parent) : QStackedWidget(parent)
addWidget(m_empty);
m_prefer_list = Settings::Instance().GetPreferredView();
ConsiderViewChange();
auto* zoom_in = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Plus), this);
auto* zoom_out = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Minus), this);
connect(zoom_in, &QShortcut::activated, this, &GameList::ZoomIn);
connect(zoom_out, &QShortcut::activated, this, &GameList::ZoomOut);
connect(&Settings::Instance(), &Settings::MetadataRefreshCompleted, this,
[this] { m_grid_proxy->invalidate(); });
}
void GameList::MakeListView()
@@ -864,35 +854,3 @@ void GameList::SetSearchTerm(const QString& term)
UpdateColumnVisibility();
}
void GameList::ZoomIn()
{
m_model->SetScale(m_model->GetScale() + 0.1);
m_list_proxy->invalidate();
m_grid_proxy->invalidate();
UpdateFont();
}
void GameList::ZoomOut()
{
if (m_model->GetScale() <= 0.1)
return;
m_model->SetScale(m_model->GetScale() - 0.1);
m_list_proxy->invalidate();
m_grid_proxy->invalidate();
UpdateFont();
}
void GameList::UpdateFont()
{
QFont f;
f.setPointSizeF(m_model->GetScale() * f.pointSize());
m_grid->setFont(f);
}
@@ -62,9 +62,6 @@ class GameList final : public QStackedWidget
void ChangeDisc();
void UpdateColumnVisibility();
void ZoomIn();
void ZoomOut();
void OnHeaderViewChanged();
void OnSectionResized(int index, int, int);
@@ -74,7 +71,6 @@ class GameList final : public QStackedWidget
// We only have two views, just use a bool to distinguish.
void SetPreferredView(bool list);
void ConsiderViewChange();
void UpdateFont();
GameListModel* m_model;
QSortFilterProxyModel* m_list_proxy;
@@ -283,13 +283,3 @@ void GameListModel::SetSearchTerm(const QString& term)
{
m_term = term;
}
void GameListModel::SetScale(float scale)
{
m_scale = scale;
}
float GameListModel::GetScale() const
{
return m_scale;
}
@@ -59,9 +59,6 @@ class GameListModel final : public QAbstractTableModel
void UpdateGame(const std::shared_ptr<const UICommon::GameFile>& game);
void RemoveGame(const std::string& path);
void SetScale(float scale);
float GetScale() const;
private:
// Index in m_games, or -1 if it isn't found
int FindGame(const std::string& path) const;
@@ -70,5 +67,4 @@ class GameListModel final : public QAbstractTableModel
QList<std::shared_ptr<const UICommon::GameFile>> m_games;
Core::TitleDatabase m_title_database;
QString m_term;
float m_scale = 1.0;
};
@@ -44,10 +44,6 @@ GameTracker::GameTracker(QObject* parent) : QFileSystemWatcher(parent)
}
});
connect(&Settings::Instance(), &Settings::MetadataRefreshRequested, this, [this] {
m_load_thread.EmplaceItem(Command{CommandType::UpdateMetadata, {}});
});
m_load_thread.Reset([this](Command command) {
switch (command.type)
{
@@ -68,13 +64,6 @@ GameTracker::GameTracker(QObject* parent) : QFileSystemWatcher(parent)
case CommandType::UpdateFile:
UpdateFileInternal(command.path);
break;
case CommandType::UpdateMetadata:
m_cache.UpdateAdditionalMetadata(
[this](const std::shared_ptr<const UICommon::GameFile>& game) {
emit GameUpdated(game);
});
QueueOnObject(this, [this] { Settings::Instance().NotifyMetadataRefreshComplete(); });
break;
}
});
@@ -132,8 +121,6 @@ void GameTracker::StartInternal()
cache_updated |= m_cache.UpdateAdditionalMetadata(emit_game_updated);
if (cache_updated)
m_cache.Save();
QueueOnObject(this, [this] { Settings::Instance().NotifyMetadataRefreshComplete(); });
}
bool GameTracker::AddPath(const QString& dir)
@@ -70,7 +70,6 @@ class GameTracker final : public QFileSystemWatcher
RemoveDirectory,
UpdateDirectory,
UpdateFile,
UpdateMetadata
};
struct Command
@@ -4,16 +4,11 @@
#include "DolphinQt/GameList/GridProxyModel.h"
#include <QImage>
#include <QPixmap>
#include <QSize>
#include "DolphinQt/GameList/GameListModel.h"
#include "Core/Config/UISettings.h"
#include "UICommon/GameFile.h"
const QSize LARGE_BANNER_SIZE(144, 48);
GridProxyModel::GridProxyModel(QObject* parent) : QSortFilterProxyModel(parent)
@@ -32,30 +27,12 @@ QVariant GridProxyModel::data(const QModelIndex& i, int role) const
}
else if (role == Qt::DecorationRole)
{
auto* model = static_cast<GameListModel*>(sourceModel());
const auto& buffer = model->GetGameFile(source_index.row())->GetCoverImage().buffer;
QPixmap pixmap;
if (buffer.empty() || !Config::Get(Config::MAIN_USE_GAME_COVERS))
{
pixmap = model
->data(model->index(source_index.row(), GameListModel::COL_BANNER),
Qt::DecorationRole)
.value<QPixmap>();
return pixmap.scaled(LARGE_BANNER_SIZE * model->GetScale() * pixmap.devicePixelRatio(),
Qt::KeepAspectRatio, Qt::SmoothTransformation);
}
else
{
pixmap = QPixmap::fromImage(QImage::fromData(
reinterpret_cast<const unsigned char*>(&buffer[0]), static_cast<int>(buffer.size())));
return pixmap.scaled(QSize(160, 224) * model->GetScale() * pixmap.devicePixelRatio(),
Qt::KeepAspectRatio, Qt::SmoothTransformation);
}
auto pixmap = sourceModel()
->data(sourceModel()->index(source_index.row(), GameListModel::COL_BANNER),
Qt::DecorationRole)
.value<QPixmap>();
return pixmap.scaled(LARGE_BANNER_SIZE * pixmap.devicePixelRatio(), Qt::KeepAspectRatio,
Qt::SmoothTransformation);
}
return QVariant();
}
@@ -137,16 +137,6 @@ void Settings::RefreshGameList()
emit GameListRefreshRequested();
}
void Settings::RefreshMetadata()
{
emit MetadataRefreshRequested();
}
void Settings::NotifyMetadataRefreshComplete()
{
emit MetadataRefreshCompleted();
}
void Settings::ReloadTitleDB()
{
emit TitleDBReloadRequested();
@@ -75,8 +75,6 @@ class Settings final : public QObject
QString GetDefaultGame() const;
void SetDefaultGame(QString path);
void RefreshGameList();
void RefreshMetadata();
void NotifyMetadataRefreshComplete();
void ReloadTitleDB();
bool IsAutoRefreshEnabled() const;
void SetAutoRefreshEnabled(bool enabled);
@@ -146,8 +144,6 @@ class Settings final : public QObject
void DefaultGameChanged(const QString&);
void GameListRefreshRequested();
void TitleDBReloadRequested();
void MetadataRefreshRequested();
void MetadataRefreshCompleted();
void AutoRefreshToggled(bool enabled);
void HideCursorChanged();
void KeepWindowOnTopChanged(bool top);
@@ -19,14 +19,10 @@
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
#include "Core/Config/UISettings.h"
#include "Core/ConfigManager.h"
#include "DolphinQt/GameList/GameListModel.h"
#include "DolphinQt/Settings.h"
#include "UICommon/GameFile.h"
static QComboBox* MakeLanguageComboBox()
{
static const struct
@@ -148,14 +144,11 @@ void InterfacePane::CreateUI()
m_checkbox_top_window = new QCheckBox(tr("Keep Window on Top"));
m_checkbox_use_builtin_title_database = new QCheckBox(tr("Use Built-In Database of Game Names"));
m_checkbox_use_userstyle = new QCheckBox(tr("Use Custom User Style"));
m_checkbox_use_covers =
new QCheckBox(tr("Download Game Covers from GameTDB.com for Use in Grid Mode"));
m_checkbox_show_debugging_ui = new QCheckBox(tr("Show Debugging UI"));
groupbox_layout->addWidget(m_checkbox_top_window);
groupbox_layout->addWidget(m_checkbox_use_builtin_title_database);
groupbox_layout->addWidget(m_checkbox_use_userstyle);
groupbox_layout->addWidget(m_checkbox_use_covers);
groupbox_layout->addWidget(m_checkbox_show_debugging_ui);
}
@@ -186,7 +179,6 @@ void InterfacePane::ConnectLayout()
connect(m_checkbox_top_window, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_checkbox_use_builtin_title_database, &QCheckBox::toggled, this,
&InterfacePane::OnSaveConfig);
connect(m_checkbox_use_covers, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_checkbox_show_debugging_ui, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_combobox_theme,
static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged),
@@ -237,7 +229,6 @@ void InterfacePane::LoadConfig()
m_checkbox_enable_osd->setChecked(startup_params.bOnScreenDisplayMessages);
m_checkbox_show_active_title->setChecked(startup_params.m_show_active_title);
m_checkbox_pause_on_focus_lost->setChecked(startup_params.m_PauseOnFocusLost);
m_checkbox_use_covers->setChecked(Config::Get(Config::MAIN_USE_GAME_COVERS));
m_checkbox_hide_mouse->setChecked(Settings::Instance().GetHideCursor());
}
@@ -273,13 +264,5 @@ void InterfacePane::OnSaveConfig()
tr("You must restart Dolphin in order for the change to take effect."));
}
const bool use_covers = m_checkbox_use_covers->isChecked();
if (use_covers != Config::Get(Config::MAIN_USE_GAME_COVERS))
{
Config::SetBase(Config::MAIN_USE_GAME_COVERS, use_covers);
Settings::Instance().RefreshMetadata();
}
settings.SaveSettings();
}
@@ -35,7 +35,6 @@ class InterfacePane final : public QWidget
QCheckBox* m_checkbox_use_builtin_title_database;
QCheckBox* m_checkbox_use_userstyle;
QCheckBox* m_checkbox_show_debugging_ui;
QCheckBox* m_checkbox_use_covers;
QCheckBox* m_checkbox_confirm_on_stop;
QCheckBox* m_checkbox_use_panic_handlers;
Oops, something went wrong.

0 comments on commit 9b94c76

Please sign in to comment.