void GenerateRMEDialog::OnClickBrowseButton(wxCommandEvent & event) { Settings & settings = Settings::getInstance(); const wxString & pathStr = settings.get("generateRMEPath"); wxDirDialog browseDialog(this, "Choose path for generated files", pathStr); if (browseDialog.ShowModal() == wxID_OK) { dataPath->Replace(0, dataPath->GetLastPosition(), browseDialog.GetPath()); } }
Settingsdialog::Settingsdialog(QWidget *parent, bool isCanvasVisible) : QDialog(parent), ui(new Ui::Settingsdialog) { ui->setupUi(this); mSettingsFile = QApplication::applicationDirPath() + "editorSettings"; mSettings = new QSettings(mSettingsFile, QSettings::NativeFormat); ui->resoursesPath->setText(mSettings->value("Editor/resourcesPath").toString()); ui->configPath->setText(mSettings->value("Editor/configurationPath").toString()); ui->pluginsPath->setText(mSettings->value("Editor/pluginsPath").toString()); ui->ogreLogPath->setText(mSettings->value("Editor/ogreLogPath").toString()); ui->morphLogPath->setText(mSettings->value("Editor/morphLogPath").toString()); connect(ui->browseBtn, SIGNAL(clicked()), this, SLOT(browseDialog())); connect(ui->confBtn, SIGNAL(clicked()), this, SLOT(confDialog())); connect(ui->pluginsBtn, SIGNAL(clicked()), this, SLOT(pluginsDialog())); connect(ui->ogreBtn, SIGNAL(clicked()), this, SLOT(ogreLogDialog())); connect(ui->morphBtn, SIGNAL(clicked()), this, SLOT(morphLogDialog())); connect(ui->resoursesPath, SIGNAL(textChanged(QString)), this, SLOT(setResourcesPath(QString))); connect(ui->configPath, SIGNAL(textChanged(QString)), this, SLOT(setConfigPath(QString))); connect(ui->pluginsPath, SIGNAL(textChanged(QString)), this, SLOT(setPluginsPath(QString))); connect(ui->ogreLogPath, SIGNAL(textChanged(QString)), this, SLOT(setOgreLogPath(QString))); connect(ui->morphLogPath, SIGNAL(textChanged(QString)), this, SLOT(setMorphLogPath(QString))); connect(ui->buttonsBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(clicked())); if(isCanvasVisible) { ui->renderLayer->addItem("Back"); ui->renderLayer->addItem("Front"); mSize = mSettings->value("Grid/gridPrespectiveSize").toInt(); ui->mPerspSize->setValue(mSize); mDivisions = mSettings->value("Grid/gridDivisions").toInt(); ui->mGridSpacingMenu->setValue(mDivisions); mIndex = mSettings->value("Grid/gridRenderLayer").toInt(); ui->renderLayer->setCurrentIndex(mIndex); mValue = mSettings->value("Grid/gridRenderScale").toBool(); ui->renderScale->setChecked(mValue); mColor = mSettings->value("Grid/gridColor").toString(); connect(ui->modify, SIGNAL(clicked()), this, SLOT(gridColorChanged())); connect(ui->mGridSpacingMenu, SIGNAL(valueChanged(int)), this, SLOT(gridDivisionsChanged(int))); connect(ui->mPerspSize, SIGNAL(valueChanged(int)), this, SLOT(gridPrespectiveSizeChanged(int))); connect(ui->renderLayer, SIGNAL(currentIndexChanged(int)), this, SLOT(gridRenderLayerChanged(int))); connect(ui->renderScale, SIGNAL(clicked(bool)), this, SLOT(gridRenderScaleChanged(bool))); } else {
void CGameListCtrl::CompressSelection(bool _compress) { wxString dirHome; wxGetHomeDir(&dirHome); wxDirDialog browseDialog(this, _("Browse for output directory"), dirHome, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST); if (browseDialog.ShowModal() != wxID_OK) return; bool all_good = true; { wxProgressDialog progressDialog( _compress ? _("Compressing ISO") : _("Decompressing ISO"), _("Working..."), 1000, this, wxPD_APP_MODAL | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME | wxPD_SMOOTH ); m_currentItem = 0; m_numberItem = GetSelectedItemCount(); for (u32 i=0; i < m_numberItem; i++) { const GameListItem *iso = GetSelectedISO(); if (!iso->IsCompressed() && _compress) { std::string FileName, FileExt; SplitPath(iso->GetFileName(), NULL, &FileName, &FileExt); m_currentFilename = FileName; FileName.append(".gcz"); std::string OutputFileName; BuildCompleteFilename(OutputFileName, (const char *)browseDialog.GetPath().mb_str(wxConvUTF8), FileName); if (wxFileExists(wxString::FromAscii(OutputFileName.c_str())) && wxMessageBox( wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"), wxString(OutputFileName.c_str(), *wxConvCurrent).c_str()), _("Confirm File Overwrite"), wxYES_NO) == wxNO) continue; all_good &= DiscIO::CompressFileToBlob(iso->GetFileName().c_str(), OutputFileName.c_str(), (iso->GetPlatform() == GameListItem::WII_DISC) ? 1 : 0, 16384, &MultiCompressCB, &progressDialog); } else if (iso->IsCompressed() && !_compress) { std::string FileName, FileExt; SplitPath(iso->GetFileName(), NULL, &FileName, &FileExt); m_currentFilename = FileName; if (iso->GetPlatform() == GameListItem::WII_DISC) FileName.append(".iso"); else FileName.append(".gcm"); std::string OutputFileName; BuildCompleteFilename(OutputFileName, (const char *)browseDialog.GetPath().mb_str(wxConvUTF8), FileName); if (wxFileExists(wxString::FromAscii(OutputFileName.c_str())) && wxMessageBox( wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"), wxString(OutputFileName.c_str(), *wxConvCurrent).c_str()), _("Confirm File Overwrite"), wxYES_NO) == wxNO) continue; all_good &= DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(), OutputFileName.c_str(), &MultiCompressCB, &progressDialog); } m_currentItem++; } } if (!all_good) wxMessageBox(_("Dolphin was unable to complete the requested action.")); Update(); }
void CGameListCtrl::CompressSelection(bool _compress) { std::vector<const GameListItem*> items_to_compress; bool wii_compression_warning_accepted = false; for (const GameListItem* iso : GetAllSelectedISOs()) { // Don't include items that we can't do anything with if (iso->GetPlatform() != DiscIO::IVolume::GAMECUBE_DISC && iso->GetPlatform() != DiscIO::IVolume::WII_DISC) continue; if (iso->GetBlobType() != DiscIO::BlobType::PLAIN && iso->GetBlobType() != DiscIO::BlobType::GCZ) continue; items_to_compress.push_back(iso); // Show the Wii compression warning if it's relevant and it hasn't been shown already if (!wii_compression_warning_accepted && _compress && !iso->IsCompressed() && iso->GetPlatform() == DiscIO::IVolume::WII_DISC) { if (WiiCompressWarning()) wii_compression_warning_accepted = true; else return; } } wxString dirHome; wxGetHomeDir(&dirHome); wxDirDialog browseDialog(this, _("Browse for output directory"), dirHome, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST); if (browseDialog.ShowModal() != wxID_OK) return; bool all_good = true; { wxProgressDialog progressDialog( _compress ? _("Compressing ISO") : _("Decompressing ISO"), _("Working..."), 1000, // Arbitrary number that's larger than the dialog's width in pixels this, wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME | wxPD_SMOOTH ); CompressionProgress progress(0, items_to_compress.size(), "", &progressDialog); for (const GameListItem* iso : items_to_compress) { if (!iso->IsCompressed() && _compress) { std::string FileName; SplitPath(iso->GetFileName(), nullptr, &FileName, nullptr); progress.current_filename = FileName; FileName.append(".gcz"); std::string OutputFileName; BuildCompleteFilename(OutputFileName, WxStrToStr(browseDialog.GetPath()), FileName); if (File::Exists(OutputFileName) && wxMessageBox( wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"), StrToWxStr(OutputFileName)), _("Confirm File Overwrite"), wxYES_NO) == wxNO) continue; all_good &= DiscIO::CompressFileToBlob(iso->GetFileName(), OutputFileName, (iso->GetPlatform() == DiscIO::IVolume::WII_DISC) ? 1 : 0, 16384, &MultiCompressCB, &progress); } else if (iso->IsCompressed() && !_compress) { std::string FileName; SplitPath(iso->GetFileName(), nullptr, &FileName, nullptr); progress.current_filename = FileName; if (iso->GetPlatform() == DiscIO::IVolume::WII_DISC) FileName.append(".iso"); else FileName.append(".gcm"); std::string OutputFileName; BuildCompleteFilename(OutputFileName, WxStrToStr(browseDialog.GetPath()), FileName); if (File::Exists(OutputFileName) && wxMessageBox( wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"), StrToWxStr(OutputFileName)), _("Confirm File Overwrite"), wxYES_NO) == wxNO) continue; all_good &= DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(), OutputFileName.c_str(), &MultiCompressCB, &progress); } progress.items_done++; } } if (!all_good) WxUtils::ShowErrorDialog(_("Dolphin was unable to complete the requested action.")); Update(); }