Skip to content

Commit

Permalink
fine tune previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mhogomchungu committed Oct 29, 2022
1 parent d028f31 commit a3f2775
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
17 changes: 11 additions & 6 deletions src/logwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#include "settings.h"

#include <QDateTime>

logWindow::logWindow( settings& s ) :
QWidget( nullptr ),
m_ui( new Ui::logWindow ),
Expand Down Expand Up @@ -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() ;

Expand Down
6 changes: 3 additions & 3 deletions src/qcheckgmail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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 ){

Expand Down Expand Up @@ -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 ) ;
}
Expand Down

0 comments on commit a3f2775

Please sign in to comment.