bool CLogger::OpenLogfile(const wxString & name) { applog = new wxFFileOutputStream(name); bool ret = applog->Ok(); if (ret) { FlushApplog(); m_LogfileName = name; } else { CloseLogfile(); } return ret; }
bool MainWindow::PromptCloseLog() { if(!m_Ctx->LogLoaded()) return true; QString deletepath = ""; bool loglocal = false; if(m_OwnTempLog) { QString temppath = m_Ctx->LogFilename(); loglocal = m_Ctx->IsLogLocal(); QMessageBox::StandardButton res = QMessageBox::No; // unless we've saved the log, prompt to save if(!m_SavedTempLog) res = RDDialog::question(NULL, tr("Unsaved log"), tr("Save this logfile?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); if(res == QMessageBox::Cancel) { return false; } if(res == QMessageBox::Yes) { bool success = PromptSaveLog(); if(!success) { return false; } } if(temppath != m_Ctx->LogFilename() || res == QMessageBox::No) deletepath = temppath; m_OwnTempLog = false; m_SavedTempLog = false; } CloseLogfile(); if(!deletepath.isEmpty()) m_Ctx->Renderer()->DeleteCapture(deletepath, loglocal); return true; }
int __stdcall WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, char* lpCmdLine, int nCmdShow) { QCoreApplication::setOrganizationName( "jesperhansen" ); QCoreApplication::setOrganizationDomain( "jesperhansen.net" ); QCoreApplication::setApplicationName( "syncclient" ); CreateLogfile(); #ifdef WINDOWS ExceptionHandler::registerExceptionHandler(); #endif ClientApp app( 1, &lpCmdLine ); int nRet = 0; app.exec(); #ifdef WINDOWS ExceptionHandler::unRegisterExceptionHandler(); #endif CloseLogfile(); return nRet; }
int main( int argc, char **argv ) { QCoreApplication::setOrganizationName( "jesperhansen" ); QCoreApplication::setOrganizationDomain( "jesperhansen.net" ); QCoreApplication::setApplicationName( "syncclient" ); CreateLogfile(); #ifdef WINDOWS ExceptionHandler::registerExceptionHandler(); #endif ClientApp app( argc, argv ); int nRet = app.exec(); #ifdef WINDOWS ExceptionHandler::unRegisterExceptionHandler(); #endif CloseLogfile(); return nRet; }