void SjViewSettingsPage::SkinInfo() { wxWindow* parent = SjDialog::FindTopLevel(this); SjMessageBox(g_mainFrame->GetSkinName() + wxT("\n(") + g_mainFrame->GetSkinUrl() + wxT(")\n\n") + g_mainFrame->GetSkinAbout(), g_mainFrame->GetSkinName(), wxOK, parent); }
void SjBusyInfo::AskToClose() { if( m_canCancel ) { if( m_questionOnCancel.IsEmpty() || SjMessageBox(m_questionOnCancel, GetTitle(), wxYES_NO|wxNO_DEFAULT|wxICON_QUESTION, this) == wxYES ) { m_cancelPressed = TRUE; } } }
void SjLogDialog::OnClear(wxCommandEvent& event) { if( !m_logGui->m_aPacked.IsEmpty() ) { if( SjMessageBox(_("Clear all messages?"), SJ_PROGRAM_NAME, wxICON_QUESTION|wxYES_NO, this) == wxYES ) { m_logGui->m_aPacked.Clear(); MessagesChanged(-1); } } }
// pass an uninitialized file object, the function will ask the user for the // filename and try to open it, returns true on success (file was opened), // false if file couldn't be opened/created and -1 if the file selection // dialog was cancelled int SjLogDialog::OpenLogFile(wxFile& file, wxString& retFilename) { SJ_WINDOW_DISABLER(this); // get the file name // ----------------- SjExtList extList; extList.AddExt(wxT("txt")); wxFileDialog dlg(this, _("Save"), wxT(""), wxT("log.txt"), extList.GetFileDlgStr(wxFD_SAVE), wxFD_SAVE|wxFD_CHANGE_DIR); if( dlg.ShowModal() != wxID_OK ) { return -1; } wxString filename = dlg.GetPath(); // open file // --------- bool bOk wxDUMMY_INITIALIZE(false); if ( wxFile::Exists(filename) ) { wxASSERT( wxYES != wxCANCEL ); wxASSERT( wxNO != wxCANCEL ); bool bAppend = false; switch( SjMessageBox(wxString::Format(_("Overwrite \"%s\"?"), filename.c_str()), SJ_PROGRAM_NAME, wxICON_QUESTION | wxYES_NO | wxCANCEL, this, NULL, NULL, _("Yes"), _("Append")) ) { case wxYES: bAppend = false; break; case wxNO: bAppend = true; break; default: return -1; } if ( bAppend ) { bOk = file.Open(filename, wxFile::write_append); } else { bOk = file.Create(filename, true /* overwrite */); } } else { bOk = file.Create(filename); } retFilename = filename; return bOk; }
bool SjServerScannerModule::DeleteSource(long index, wxWindow* parent) { if( index >= 0 && index < GetSourceCount() ) { if( SjMessageBox(wxString::Format(_("Remove \"%s\" from the music library?"), m_sources[index].m_serverName.c_str()), SJ_PROGRAM_NAME, wxYES_NO|wxNO_DEFAULT|wxICON_QUESTION, parent) == wxYES ) { m_sources.RemoveAt(index); SaveSettings(); return TRUE; } } return FALSE; }
void SjDialog::PleaseRestartMsg(wxWindow* parent) { SjMessageBox(wxString::Format(_("Please restart %s so that the changes can take effect."), SJ_PROGRAM_NAME), SJ_PROGRAM_NAME, wxOK|wxICON_INFORMATION, FindTopLevel(parent)); }