void FvUpdater::decideWhatToDoWithCurrentUpdateProposal() { QString policy = settings->value(FV_NEW_VERSION_POLICY_KEY).toString(); if(policy == "install") InstallUpdate(); else if(policy == "skip") SkipUpdate(); else RemindMeLater(); }
void CStructure::DownloadComplete(size_t x, size_t y) { CUpdateItem* pItem = &DigitanksGame()->GetUpdateGrid()->m_aUpdates[x][y]; if (pItem->m_eStructure != GetUnitType()) return; if (pItem->m_eUpdateClass != UPDATECLASS_STRUCTUREUPDATE) return; InstallUpdate(x, y); }
void CStructure::InstallUpdate(size_t x, size_t y) { CNetworkParameters p; p.ui1 = GetHandle(); p.ui2 = x; p.ui3 = y; if (GameNetwork()->IsHost()) InstallUpdate(&p); else GameNetwork()->CallFunctionParameters(NETWORK_TOSERVER, "InstallUpdate", &p); }
void FullIntegrationDownloader::Run() { // no initialization to do, so signal readiness immediately SignalReady(); try { const std::string tmpdir = CreateUniqueTempDirectory(); Settings::WriteConfigValue("UpdateTempDir", tmpdir); FullIntegrationDownloadSink sink(*this, tmpdir); DownloadFile(m_appcast.DownloadURL, &sink); sink.Close(); InstallUpdate(sink.GetFilePath()); } CATCH_ALL_EXCEPTIONS }
void Updater::OnDownloadSuccess() { UpdateInstallDialog dialog; bool shouldInstall = dialog.Show(); if (shouldInstall) { if (!InstallUpdate(tempFile)) { DebugLastError("Failed to install update"); Dictionary* dictionary = Dictionary::GetInstance(); MessageBoxW( 0, dictionary->Lookup("updater", "install-error-text").c_str(), dictionary->Lookup("updater", "install-error-title").c_str(), MB_OK | MB_ICONEXCLAMATION); } } }
FvUpdateWindow::FvUpdateWindow (QWidget *parent) : QWidget (parent), m_ui (new Ui::FvUpdateWindow) { m_ui->setupUi (this); m_appIconScene = 0; // Delete on close setAttribute (Qt::WA_DeleteOnClose, true); // Set the "new version is available" string QString newVersString = m_ui->newVersionIsAvailableLabel->text().arg (QString::fromUtf8 (FV_APP_NAME)); m_ui->newVersionIsAvailableLabel->setText (newVersString); // Connect buttons connect (m_ui->installUpdateButton, SIGNAL (clicked()), FvUpdater::sharedUpdater(), SLOT (InstallUpdate())); connect (m_ui->skipThisVersionButton, SIGNAL (clicked()), FvUpdater::sharedUpdater(), SLOT (SkipUpdate())); connect (m_ui->remindMeLaterButton, SIGNAL (clicked()), FvUpdater::sharedUpdater(), SLOT (RemindMeLater())); }
void QtTestApp::initUpdater() { createUpdaterWindow(); FvUpdater::sharedUpdater()->SetFeedURL("https://raw.github.com/ershovdz/WebMounter_Builds/master/Appcast.xml"); // signals from WINDOW connect(m_updaterWindow, SIGNAL(installRequested()), FvUpdater::sharedUpdater(), SLOT(InstallUpdate())); connect(m_updaterWindow, SIGNAL(skipInstallRequested()), FvUpdater::sharedUpdater(), SLOT(SkipUpdate())); connect(m_updaterWindow, SIGNAL(remindLaterRequested()), FvUpdater::sharedUpdater(), SLOT(RemindMeLater())); connect(m_updaterWindow, SIGNAL(cancelRequested()), FvUpdater::sharedUpdater(), SLOT(CancelUpdate())); // signals from UPDATER connect(FvUpdater::sharedUpdater(), SIGNAL(finished()), m_updaterWindow, SLOT(onFinished())); connect(FvUpdater::sharedUpdater(), SIGNAL(failed(QString)), m_updaterWindow, SLOT(onFailed(QString))); connect(FvUpdater::sharedUpdater(), SIGNAL(progress(uint)), m_updaterWindow, SLOT(onProgress(uint))); connect(FvUpdater::sharedUpdater(), SIGNAL(updateAvailable(FvAvailableUpdate*)), this, SLOT(onUpdates(FvAvailableUpdate*))); connect(FvUpdater::sharedUpdater(), SIGNAL(noUpdates()), this, SLOT(onNoUpdates())); connect(FvUpdater::sharedUpdater(), SIGNAL(closeAppToRunInstaller()), this, SLOT(onCloseApp())); }
// App bool MultiMC::OnInit() { #if __WXGTK__ || defined MSVC // Only works with Linux GCC or MSVC wxHandleFatalExceptions(); #endif exitAction = EXIT_NORMAL; startMode = START_NORMAL; updateQuiet = false; useProvidedDir = false; // This is necessary for the update system since it calls OnInitCmdLine // to set up the command line arguments that the update system uses. if (!wxApp::OnInit()) return false; #if OSX { wxFileName mmcDir = wxFileName::DirName(wxStandardPaths::Get().GetResourcesDir()); mmcDir.Normalize(); if (!mmcDir.DirExists()) mmcDir.Mkdir(0777, wxPATH_MKDIR_FULL); wxSetWorkingDirectory(mmcDir.GetFullPath()); } #else if (!useProvidedDir) { wxFileName mmcDir (wxStandardPaths::Get().GetExecutablePath()); wxSetWorkingDirectory(mmcDir.GetPath()); } else { // do use provided directory wxSetWorkingDirectory(providedDir.GetFullPath()); } #endif if (!InitAppSettings()) { wxLogError(_("Failed to initialize settings.")); return false; } SetAppName(_("MultiMC")); InstallLangFiles(); localeHelper.UpdateLangList(); // Load language. long langID = wxLANGUAGE_UNKNOWN; if (settings->GetUseSystemLang()) langID = wxLocale::GetSystemLanguage(); else langID = settings->GetLanguageID(); langID = localeHelper.FindClosestMatch(langID); // If no matching language is found, use English. if (langID == wxLANGUAGE_UNKNOWN) { langID = wxLANGUAGE_ENGLISH_US; } if (!localeHelper.SetLanguage((wxLanguage)langID)) { localeHelper.SetLanguage(wxLANGUAGE_ENGLISH_US); wxLogError(_("Failed to set language. Language set to English.")); } wxString cwd = wxGetCwd(); if(cwd.Contains("!")) { wxLogError(_("MultiMC has been started from a path that contains '!':\n%s\nThis would break Minecraft. Please move it to a different place."), cwd.c_str()); return false; } wxInitAllImageHandlers(); wxSocketBase::Initialize(); wxMemoryInputStream iconInput16(multimc16, sizeof(multimc16)); wxMemoryInputStream iconInput32(multimc32, sizeof(multimc32)); wxMemoryInputStream iconInput64(multimc64, sizeof(multimc64)); wxMemoryInputStream iconInput128(multimc128, sizeof(multimc128)); wxIcon icon16,icon32,icon64,icon128; icon16.CopyFromBitmap(wxBitmap(wxImage(iconInput16))); icon32.CopyFromBitmap(wxBitmap(wxImage(iconInput32))); icon64.CopyFromBitmap(wxBitmap(wxImage(iconInput64))); icon128.CopyFromBitmap(wxBitmap(wxImage(iconInput128))); AppIcons.AddIcon(icon16); AppIcons.AddIcon(icon32); AppIcons.AddIcon(icon64); AppIcons.AddIcon(icon128); wxFileSystem::AddHandler(new wxArchiveFSHandler); // wxFileSystem::AddHandler(new wxMemoryFSHandler); if (!settings->GetInstDir().DirExists()) settings->GetInstDir().Mkdir(); if (!settings->GetModsDir().DirExists()) settings->GetModsDir().Mkdir(); if (!settings->GetLwjglDir().DirExists()) settings->GetLwjglDir().Mkdir(); switch (startMode) { case START_NORMAL: { MainWindow *mainWin = new MainWindow(); mainWin->SetName(wxT("MainWindow")); if (!wxPersistenceManager::Get().RegisterAndRestore(mainWin)) { mainWin->CenterOnScreen(); } SetTopWindow(mainWin); mainWin->Show(); mainWin->OnStartup(); return true; } case START_LAUNCH_INSTANCE: { MainWindow *mainWin = new MainWindow(); mainWin->SetName(wxT("MainWindow")); if (!wxPersistenceManager::Get().RegisterAndRestore(mainWin)) { mainWin->CenterOnScreen(); } SetTopWindow(mainWin); mainWin->launchInstance = launchInstance; mainWin->OnStartup(); mainWin->Hide(); return true; } case START_INSTALL_UPDATE: InstallUpdate(); return false; } return false; }