Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt: Add missing gamelist contextmenu options #5353

Merged
merged 1 commit into from
May 4, 2017

Conversation

spycrab
Copy link
Contributor

@spycrab spycrab commented May 1, 2017

Adds a few missing gamelist menu options that are available in the Wx Version, but not in Qt.

  • Open containing folder
  • Delete File
  • Compress ISO
  • Open Wii save folder
  • Export Wii save folder
  • Install WADs
  • Uninstall WADs
  • Add the items listed above to the top menubar (only to those applicable) (optional, can (and maybe should) be done in a later PR)


if (deletion_successful)
{
// TODO Reload the game list

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@spycrab spycrab changed the title Qt: Add (a few) missing menu options Qt: Add missing gamelist contextmenu options May 1, 2017
@@ -65,6 +65,10 @@ class GameFile final
QString GetLongName(DiscIO::Language lang) const { return m_long_names[lang]; }
QString GetLongMaker(DiscIO::Language lang) const { return m_long_makers[lang]; }
QString GetDescription(DiscIO::Language lang) const { return m_descriptions[lang]; }
// Actions

This comment was marked as off-topic.

QMenu* menu = new QMenu(this);
DiscIO::Platform platform = GameFile(GetSelectedGame()).GetPlatformID();
menu->addAction(tr("Properties"), this, SLOT(OpenProperties()),

This comment was marked as off-topic.

void GameList::OpenContainingFolder()
{
std::cout << GameFile(GetSelectedGame()).GetInternalName().toStdString() << std::endl;
QString url = QStringLiteral("file://").append(QFileInfo(GetSelectedGame()).dir().absolutePath());

This comment was marked as off-topic.


const std::string path =
StringFromFormat("%s/title/%08x/%08x/data/", File::GetUserPath(D_WIIROOT_IDX).c_str(),
(u32)(title_id >> 32), (u32)title_id);

This comment was marked as off-topic.

@@ -52,6 +52,7 @@ class GameFile final
DiscIO::Country GetCountryID() const { return m_country; }
QString GetCountry() const;
DiscIO::BlobType GetBlobType() const { return m_blob_type; }
QString GetWiiFSPath();

This comment was marked as off-topic.


void GameList::OpenSaveFolder()
{
QString url = QStringLiteral("file://").append(GameFile(GetSelectedGame()).GetWiiFSPath());

This comment was marked as off-topic.


if (deletion_successful)
{
// TODO Reload the game list

This comment was marked as off-topic.

@@ -105,18 +112,36 @@ void GameList::MakeListView()

void GameList::ShowContextMenu(const QPoint&)
{
if (GetSelectedGame().isEmpty())

This comment was marked as off-topic.

@spycrab spycrab force-pushed the qt_contextmenu branch 3 times, most recently from 1578ccc to 4177a39 Compare May 1, 2017 22:03
@@ -21,6 +23,8 @@
static const int CACHE_VERSION = 13; // Last changed in PR #3261
static const int DATASTREAM_VERSION = QDataStream::Qt_5_5;

u64 GetTitleID(QString);

This comment was marked as off-topic.

QString file_types;
QString default_file = QFileInfo(GetSelectedGame()).dir().absoluteFilePath(file.GetGameID());

std::cout << default_file.toStdString() << std::endl;

This comment was marked as off-topic.

16384, &CompressCB, &progress_dialog);

if (good)
QMessageBox(QMessageBox::Information, tr("Success!"), tr("Successfully compressed image."),

This comment was marked as off-topic.

const auto original_path = GetSelectedGame();
auto file = GameFile(original_path);

bool compressed = file.GetBlobType() == DiscIO::BlobType::GCZ;

This comment was marked as off-topic.

{
if (ptr == nullptr)
return false;
auto* prg = reinterpret_cast<QProgressDialog*>(ptr);

This comment was marked as off-topic.

bool good;

if (compressed)
good = DiscIO::DecompressBlobToFile(original_path.toStdString(), dst_path.toStdString(),

This comment was marked as off-topic.


prg->setValue(percent * 100);
return !prg->wasCanceled();
}

This comment was marked as off-topic.

@spycrab spycrab force-pushed the qt_contextmenu branch 4 times, most recently from 740456e to f751b8f Compare May 2, 2017 14:45
@spycrab spycrab force-pushed the qt_contextmenu branch 2 times, most recently from c2581b2 to 730af06 Compare May 2, 2017 20:17
@@ -21,6 +23,8 @@
static const int CACHE_VERSION = 13; // Last changed in PR #3261
static const int DATASTREAM_VERSION = QDataStream::Qt_5_5;

static inline u64 GetTitleID(const QString&);

This comment was marked as off-topic.

@@ -291,6 +295,79 @@ QString GameFile::GetLanguage(DiscIO::Language lang) const
}
}

bool GameFile::IsInstalled()

This comment was marked as off-topic.


const bool compressed = (file.GetBlobType() == DiscIO::BlobType::GCZ);

QString label_text = tr("Select where you want to save the ");

This comment was marked as off-topic.

menu->addAction(tr("Default ISO"), this, SLOT(SetDefaultISO()),
QKeySequence(tr("D", "Set as Default ISO")));
menu->addAction(GameFile(game).GetBlobType() == DiscIO::BlobType::GCZ ? tr("Decompress ISO") :
tr("Compress ISO"),

This comment was marked as off-topic.

const auto volume = DiscIO::CreateVolumeFromFilename(path.toStdString());

u64 title_id;
volume->GetTitleID(&title_id);

This comment was marked as off-topic.

wii_warning.setIcon(QMessageBox::Warning);
wii_warning.setText(tr("Are you sure?"));
wii_warning.setInformativeText(tr("Compressing Wii ISOs is an irreversible process. Your "
"image will keep working as usual."));

This comment was marked as off-topic.

}

result_dialog.exec();
}

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@@ -21,6 +23,16 @@
static const int CACHE_VERSION = 13; // Last changed in PR #3261
static const int DATASTREAM_VERSION = QDataStream::Qt_5_5;

u64 GetTitleID(const QString& path)

This comment was marked as off-topic.

This comment was marked as off-topic.

@spycrab spycrab force-pushed the qt_contextmenu branch 3 times, most recently from 2519ac5 to 3aefbe5 Compare May 3, 2017 14:26
@@ -502,7 +502,7 @@ void CGameListCtrl::ReloadList()
}
else
{
errorString = _("Dolphin could not find any GameCube/Wii ISOs or WADs. Double-click here to "
errorString = _("Dolphin could not find any GameCube/WiiISOs or WADs. Double-click here to "

This comment was marked as off-topic.

This comment was marked as off-topic.

return false;

const std::string content_dir =
Common::GetTitleContentPath(m_title_id, Common::FromWhichRoot::FROM_CONFIGURED_ROOT);

This comment was marked as off-topic.

const auto entries = File::ScanDirectoryTree(content_dir, false);
return std::any_of(entries.children.begin(), entries.children.end(),
[](const auto& file) { return file.virtualName != "title.tmd"; });
}

This comment was marked as off-topic.


bool GameFile::Install()
{
if (m_platform != DiscIO::Platform::WII_WAD)

This comment was marked as off-topic.


bool GameFile::Uninstall()
{
if (m_platform != DiscIO::Platform::WII_WAD)

This comment was marked as off-topic.

Common::FROM_CONFIGURED_ROOT);
}

bool GameFile::ExportWiiSaves()

This comment was marked as off-topic.

const bool success = GameFile(GetSelectedGame()).Uninstall();

result_dialog.setIcon(success ? QMessageBox::Information : QMessageBox::Critical);
result_dialog.setText(success ? tr("Succesfully removed WAD from NAND") :

This comment was marked as off-topic.


result_dialog.setIcon(success ? QMessageBox::Information : QMessageBox::Critical);
result_dialog.setText(success ? tr("Succesfully removed WAD from NAND") :
tr("Failed to remove WAD from NAND"));

This comment was marked as off-topic.

if (GameFile(wad_file).Install())
{
result_dialog.setIcon(QMessageBox::Information);
result_dialog.setText(tr("Successfully installed the WAD to NAND"));

This comment was marked as off-topic.

else
{
result_dialog.setIcon(QMessageBox::Critical);
result_dialog.setText(tr("Failed to install the WAD to NAND!"));

This comment was marked as off-topic.

result_dialog.exec();
}

void GameList::UninstallWAD()

This comment was marked as off-topic.

@spycrab spycrab force-pushed the qt_contextmenu branch 3 times, most recently from 4d84e92 to 41fcaea Compare May 4, 2017 20:54

bool GameFile::Uninstall()
{
_assert_(m_platform == DiscIO::Platform::WII_WAD)

This comment was marked as off-topic.

This comment was marked as off-topic.

@leoetlino leoetlino merged commit e957110 into dolphin-emu:master May 4, 2017
@spycrab spycrab deleted the qt_contextmenu branch May 4, 2017 22:21
@leoetlino leoetlino modified the milestone: Qt Sep 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

7 participants