void MessageWidget::SendFile(QList<QUrl> *tFileUrls) { QStringList tSelectedFiles; if ((tFileUrls == NULL) || (tFileUrls->size() == 0)) { tSelectedFiles = QFileDialog::getOpenFileNames(this, Homer::Gui::MessageWidget::tr("Select files for transfer to") + " " + mParticipant, CONF.GetDataDirectory(), "All files (*)", NULL, CONF_NATIVE_DIALOGS); if (tSelectedFiles.isEmpty()) return; QString tFirstFileName = *tSelectedFiles.constBegin(); CONF.SetDataDirectory(tFirstFileName.left(tFirstFileName.lastIndexOf('/'))); }else { QUrl tUrl; foreach(tUrl, *tFileUrls) tSelectedFiles.push_back(QString(tUrl.toLocalFile().toLocal8Bit())); FileTransferAckDialog tDialog(this, mParticipant, tSelectedFiles); if (tDialog.exec() != QDialog::Accepted) return; } QString tFile; foreach (tFile, tSelectedFiles) printf("TODO: send file %s\n", tFile.toStdString().c_str()); }
void MainWindow::updateInstance(InstancePtr instance, AuthSessionPtr session, BaseProfilerFactory *profiler) { auto updateTask = instance->doUpdate(); if (!updateTask) { launchInstance(instance, session, profiler); return; } ProgressDialog tDialog(this); connect(updateTask.get(), &Task::succeeded, [this, instance, session, profiler] { launchInstance(instance, session, profiler); }); connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString))); tDialog.exec(updateTask.get()); }
void MainWindow::updateInstance(BaseInstance *instance, MojangAccountPtr account) { bool only_prepare = account->accountStatus() != Online; auto updateTask = instance->doUpdate(only_prepare); if (!updateTask) { launchInstance(instance, account); return; } ProgressDialog tDialog(this); connect(updateTask.get(), &Task::succeeded, [this, instance, account] { launchInstance(instance, account); }); connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString))); tDialog.exec(updateTask.get()); }
void MainWindow::on_actionChangeInstMCVersion_triggered() { if (view->selectionModel()->selectedIndexes().count() < 1) return; VersionSelectDialog vselect(m_selectedInstance->versionList().get(), tr("Change Minecraft version"), this); vselect.setFuzzyFilter(1, "*OneSix*"); if (!vselect.exec() || !vselect.selectedVersion()) return; if (!MMC->accounts()->anyAccountIsValid()) { CustomMessageBox::selectable( this, tr("Error"), tr("MultiMC cannot download Minecraft or update instances unless you have at least " "one account added.\nPlease add your Mojang or Minecraft account."), QMessageBox::Warning)->show(); return; } if (m_selectedInstance->versionIsCustom()) { auto result = CustomMessageBox::selectable( this, tr("Are you sure?"), tr("This will remove any library/version customization you did previously. " "This includes things like Forge install and similar."), QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Abort, QMessageBox::Abort)->exec(); if (result != QMessageBox::Ok) return; } m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor()); auto updateTask = m_selectedInstance->doUpdate(); if (!updateTask) { return; } ProgressDialog tDialog(this); connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString))); tDialog.exec(updateTask.get()); }