Merge pull request #3376 from spxtr/DQt2
Use const reference, explicit, final, and override consistently in DQt2
This commit is contained in:
commit
98c0c79895
|
@ -29,7 +29,7 @@ static QMap<DiscIO::IVolume::ELanguage, QString> ConvertLanguageMap(
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameFile::GameFile(QString path) : m_path(path)
|
GameFile::GameFile(const QString& path) : m_path(path)
|
||||||
{
|
{
|
||||||
m_valid = false;
|
m_valid = false;
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ void GameFile::ReadBanner(const DiscIO::IVolume& volume)
|
||||||
m_banner = Resources::GetMisc(Resources::BANNER_MISSING);
|
m_banner = Resources::GetMisc(Resources::BANNER_MISSING);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameFile::LoadFileInfo(QString path)
|
bool GameFile::LoadFileInfo(const QString& path)
|
||||||
{
|
{
|
||||||
QFileInfo info(path);
|
QFileInfo info(path);
|
||||||
if (!info.exists() || !info.isReadable())
|
if (!info.exists() || !info.isReadable())
|
||||||
|
@ -184,7 +184,7 @@ void GameFile::SaveCache()
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GameFile::GetLanguageString(QMap<DiscIO::IVolume::ELanguage, QString> m) const
|
QString GameFile::GetLanguageString(const QMap<DiscIO::IVolume::ELanguage, QString>& m) const
|
||||||
{
|
{
|
||||||
// Try the settings language, then English, then just pick one.
|
// Try the settings language, then English, then just pick one.
|
||||||
if (m.isEmpty())
|
if (m.isEmpty())
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
class GameFile final
|
class GameFile final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit GameFile(QString path);
|
explicit GameFile(const QString& path);
|
||||||
|
|
||||||
bool IsValid() const { return m_valid; }
|
bool IsValid() const { return m_valid; }
|
||||||
|
|
||||||
|
@ -62,11 +62,11 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DiscIO::IVolume::ELanguage GetDefaultLanguage() const;
|
DiscIO::IVolume::ELanguage GetDefaultLanguage() const;
|
||||||
QString GetLanguageString(QMap<DiscIO::IVolume::ELanguage, QString> m) const;
|
QString GetLanguageString(const QMap<DiscIO::IVolume::ELanguage, QString>& m) const;
|
||||||
|
|
||||||
QString GetCacheFileName() const;
|
QString GetCacheFileName() const;
|
||||||
void ReadBanner(const DiscIO::IVolume& volume);
|
void ReadBanner(const DiscIO::IVolume& volume);
|
||||||
bool LoadFileInfo(QString path);
|
bool LoadFileInfo(const QString& path);
|
||||||
void LoadState();
|
void LoadState();
|
||||||
bool IsElfOrDol();
|
bool IsElfOrDol();
|
||||||
bool TryLoadElfDol();
|
bool TryLoadElfDol();
|
||||||
|
|
|
@ -18,10 +18,10 @@ public:
|
||||||
explicit GameListModel(QObject* parent = nullptr);
|
explicit GameListModel(QObject* parent = nullptr);
|
||||||
|
|
||||||
// Qt's Model/View stuff uses these overrides.
|
// Qt's Model/View stuff uses these overrides.
|
||||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||||
int rowCount(const QModelIndex& parent) const;
|
int rowCount(const QModelIndex& parent) const override;
|
||||||
int columnCount(const QModelIndex& parent) const;
|
int columnCount(const QModelIndex& parent) const override;
|
||||||
|
|
||||||
// Path of the Game at the specified index.
|
// Path of the Game at the specified index.
|
||||||
QString GetPath(int index) const { return m_games[index]->GetPath(); }
|
QString GetPath(int index) const { return m_games[index]->GetPath(); }
|
||||||
|
|
|
@ -51,7 +51,7 @@ void GameTracker::AddDirectory(QString dir)
|
||||||
UpdateDirectory(dir);
|
UpdateDirectory(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameTracker::UpdateDirectory(QString dir)
|
void GameTracker::UpdateDirectory(const QString& dir)
|
||||||
{
|
{
|
||||||
QDirIterator it(dir, game_filters);
|
QDirIterator it(dir, game_filters);
|
||||||
while (it.hasNext())
|
while (it.hasNext())
|
||||||
|
@ -66,7 +66,7 @@ void GameTracker::UpdateDirectory(QString dir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameTracker::UpdateFile(QString file)
|
void GameTracker::UpdateFile(const QString& file)
|
||||||
{
|
{
|
||||||
if (QFileInfo(file).exists())
|
if (QFileInfo(file).exists())
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,9 @@ class GameLoader;
|
||||||
|
|
||||||
// Watches directories and loads GameFiles in a separate thread.
|
// Watches directories and loads GameFiles in a separate thread.
|
||||||
// To use this, just add directories using AddDirectory, and listen for the
|
// To use this, just add directories using AddDirectory, and listen for the
|
||||||
// GameLoaded and GameRemoved signals.
|
// GameLoaded and GameRemoved signals. Ignore the PathChanged signal, it's
|
||||||
|
// only there because the Qt people made fileChanged and directoryChanged
|
||||||
|
// private.
|
||||||
class GameTracker final : public QFileSystemWatcher
|
class GameTracker final : public QFileSystemWatcher
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -37,15 +39,15 @@ signals:
|
||||||
void PathChanged(QString path);
|
void PathChanged(QString path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void UpdateDirectory(QString dir);
|
void UpdateDirectory(const QString& dir);
|
||||||
void UpdateFile(QString path);
|
void UpdateFile(const QString& path);
|
||||||
|
|
||||||
QSet<QString> m_tracked_files;
|
QSet<QString> m_tracked_files;
|
||||||
QThread m_loader_thread;
|
QThread m_loader_thread;
|
||||||
GameLoader* m_loader;
|
GameLoader* m_loader;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GameLoader : public QObject
|
class GameLoader final : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,13 @@
|
||||||
|
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
|
// This subclass of QSortFilterProxyModel transforms the raw data into a
|
||||||
|
// single-column large icon + name to be displayed in a QListView.
|
||||||
class ListProxyModel final : public QSortFilterProxyModel
|
class ListProxyModel final : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ListProxyModel(QObject* parent = nullptr);
|
explicit ListProxyModel(QObject* parent = nullptr);
|
||||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,6 +14,6 @@ class TableProxyModel final : public QSortFilterProxyModel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TableProxyModel(QObject* parent = nullptr);
|
explicit TableProxyModel(QObject* parent = nullptr);
|
||||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,13 +2,10 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <QAction>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QLineEdit>
|
|
||||||
#include <QMenu>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "Core/BootManager.h"
|
#include "Core/BootManager.h"
|
||||||
|
@ -194,7 +191,7 @@ void MainWindow::ScreenShot()
|
||||||
Core::SaveScreenShot();
|
Core::SaveScreenShot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::StartGame(QString path)
|
void MainWindow::StartGame(const QString& path)
|
||||||
{
|
{
|
||||||
// If we're running, only start a new game once we've stopped the last.
|
// If we're running, only start a new game once we've stopped the last.
|
||||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||||
|
|
|
@ -32,8 +32,11 @@ private slots:
|
||||||
void Browse();
|
void Browse();
|
||||||
void Play();
|
void Play();
|
||||||
void Pause();
|
void Pause();
|
||||||
|
|
||||||
|
// May ask for confirmation. Returns whether or not it actually stopped.
|
||||||
bool Stop();
|
bool Stop();
|
||||||
void ForceStop();
|
void ForceStop();
|
||||||
|
|
||||||
void FullScreen();
|
void FullScreen();
|
||||||
void ScreenShot();
|
void ScreenShot();
|
||||||
|
|
||||||
|
@ -44,7 +47,7 @@ private:
|
||||||
void MakeStack();
|
void MakeStack();
|
||||||
void MakeToolBar();
|
void MakeToolBar();
|
||||||
|
|
||||||
void StartGame(QString path);
|
void StartGame(const QString& path);
|
||||||
void ShowRenderWidget();
|
void ShowRenderWidget();
|
||||||
void HideRenderWidget();
|
void HideRenderWidget();
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ class MenuBar final : public QMenuBar
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MenuBar(QWidget* parent = nullptr);
|
explicit MenuBar(QWidget* parent = nullptr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Open();
|
void Open();
|
||||||
|
|
|
@ -12,7 +12,7 @@ class RenderWidget final : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RenderWidget(QWidget* parent = nullptr);
|
explicit RenderWidget(QWidget* parent = nullptr);
|
||||||
|
|
||||||
bool event(QEvent* event);
|
bool event(QEvent* event);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ QString Settings::GetLastGame() const
|
||||||
return value(QStringLiteral("GameList/LastGame")).toString();
|
return value(QStringLiteral("GameList/LastGame")).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::SetLastGame(QString path)
|
void Settings::SetLastGame(const QString& path)
|
||||||
{
|
{
|
||||||
setValue(QStringLiteral("GameList/LastGame"), path);
|
setValue(QStringLiteral("GameList/LastGame"), path);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ QStringList Settings::GetPaths() const
|
||||||
return value(QStringLiteral("GameList/Paths")).toStringList();
|
return value(QStringLiteral("GameList/Paths")).toStringList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::SetPaths(QStringList paths)
|
void Settings::SetPaths(const QStringList& paths)
|
||||||
{
|
{
|
||||||
setValue(QStringLiteral("GameList/Paths"), paths);
|
setValue(QStringLiteral("GameList/Paths"), paths);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,21 +8,22 @@
|
||||||
|
|
||||||
#include "DiscIO/Volume.h"
|
#include "DiscIO/Volume.h"
|
||||||
|
|
||||||
|
// UI settings to be stored in the config directory.
|
||||||
class Settings final : public QSettings
|
class Settings final : public QSettings
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Settings(QObject* parent = nullptr);
|
explicit Settings(QObject* parent = nullptr);
|
||||||
|
|
||||||
// UI
|
// UI
|
||||||
QString GetThemeDir() const;
|
QString GetThemeDir() const;
|
||||||
|
|
||||||
// GameList
|
// GameList
|
||||||
QString GetLastGame() const;
|
QString GetLastGame() const;
|
||||||
void SetLastGame(QString path);
|
void SetLastGame(const QString& path);
|
||||||
QStringList GetPaths() const;
|
QStringList GetPaths() const;
|
||||||
void SetPaths(QStringList paths);
|
void SetPaths(const QStringList& paths);
|
||||||
DiscIO::IVolume::ELanguage GetWiiSystemLanguage() const;
|
DiscIO::IVolume::ELanguage GetWiiSystemLanguage() const;
|
||||||
DiscIO::IVolume::ELanguage GetGCSystemLanguage() const;
|
DiscIO::IVolume::ELanguage GetGCSystemLanguage() const;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class ToolBar final : public QToolBar
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ToolBar(QWidget* parent = nullptr);
|
explicit ToolBar(QWidget* parent = nullptr);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void EmulationStarted();
|
void EmulationStarted();
|
||||||
|
|
Loading…
Reference in New Issue