From a3f277568fa983eb357becd03ca5fb4a593133b6 Mon Sep 17 00:00:00 2001 From: mhogomchungu Date: Sat, 29 Oct 2022 12:19:32 +0300 Subject: [PATCH] fine tune previous commit --- src/logwindow.cpp | 17 +++++++++++------ src/qcheckgmail.cpp | 6 +++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/logwindow.cpp b/src/logwindow.cpp index 2c6ca39..e7e4b26 100644 --- a/src/logwindow.cpp +++ b/src/logwindow.cpp @@ -22,6 +22,8 @@ #include "settings.h" +#include + logWindow::logWindow( settings& s ) : QWidget( nullptr ), m_ui( new Ui::logWindow ), @@ -51,23 +53,26 @@ void logWindow::update( logWindow::TYPE type,const QString& msg ) { if( this->isVisible() ){ - auto title = [ & ](){ + const auto bars = "*************************************************************************" ; + + auto title = [ & ]()->QString{ if( type == logWindow::TYPE::REQUEST ){ - return "\n*********** NETWORK REQUEST *********************\n" ; + return "\n%1\nNETWORK REQUEST At %2\n\n" ; }else if( type == logWindow::TYPE::RESPONCE ){ - return "\n*********** NETWORK RESPONCE *********************\n" ; + return "\n%1\nNETWORK RESPONCE At %2\n\n" ; }else if( type == logWindow::TYPE::INFO ){ - return "\n*********** INFO *********************\n" ; + return "\n%1\nINFO At %2\n\n" ; }else{ - return "\n*********** ERROR *********************\n" ; + return "\n%1\nERROR At %2\n\n" ; } - }() ; + + }().arg( bars,QDateTime::currentDateTime().toString() ) ; auto m = m_ui->plainTextEdit->toPlainText() ; diff --git a/src/qcheckgmail.cpp b/src/qcheckgmail.cpp index aeb613b..d19b147 100644 --- a/src/qcheckgmail.cpp +++ b/src/qcheckgmail.cpp @@ -791,7 +791,7 @@ void qCheckGMail::getAccessToken( int counter, request.setRawHeader( "Authorization","Bearer " + e.toUtf8() ) ; - m_logWindow.update( logWindow::TYPE::REQUEST,"GET\n" + url + "\nAuthorization:Bearer $ACCESS_TOKEN" ) ; + m_logWindow.update( logWindow::TYPE::REQUEST,"GET\n" + url + "\nAuthorization:Bearer $ACCESS_TOKEN\n" ) ; this->networkAccess( counter,request ) ; }else{ @@ -1053,7 +1053,7 @@ void qCheckGMail::getLabels( const QString& accessToken,addaccount::GmailAccount QNetworkRequest r( QUrl( "https://gmail.googleapis.com/gmail/v1/users/me/labels" ) ) ; r.setRawHeader( "Authorization","Bearer " + accessToken.toUtf8() ) ; - m_logWindow.update( logWindow::TYPE::REQUEST,"GET\nhttps://gmail.googleapis.com/gmail/v1/users/me/labels\nAuthorization:Bearer $ACCESS_TOKEN" ) ; + m_logWindow.update( logWindow::TYPE::REQUEST,"GET\nhttps://gmail.googleapis.com/gmail/v1/users/me/labels\nAuthorization:Bearer $ACCESS_TOKEN\n" ) ; this->m_manager.get( r,[ this,ginfo = std::move( ginfo ) ]( const utils::network::reply& reply ){ @@ -1109,7 +1109,7 @@ void qCheckGMail::checkMail( int counter,const accounts& acc,const QString& UrlL s.setRawHeader( "Authorization","Bearer " + accessToken.toUtf8() ) ; - m_logWindow.update( logWindow::TYPE::REQUEST,"GET\n" + url + "\nAuthorization:Bearer $ACCESS_TOKEN" ) ; + m_logWindow.update( logWindow::TYPE::REQUEST,"GET\n" + url + "\nAuthorization:Bearer $ACCESS_TOKEN\n" ) ; this->networkAccess( counter,s ) ; }