Minor improvements

This commit is contained in:
Valentino Orlandi 2024-02-04 11:34:30 +01:00
parent c3ae02cd6c
commit 469a4d812d
Signed by: elB4RTO
GPG Key ID: 1719E976DB2D4E71
11 changed files with 39 additions and 43 deletions

View File

@ -1999,7 +1999,7 @@ void MainWindow::makeInitialChecks()
// get a fresh list of log files
this->on_button_LogFiles_RefreshList_clicked();
// set the default WS as the current one
switch ( this->craplog.getCurrentWSID() ) {
switch ( this->craplog.getCurrentWebServer() ) {
case WS_APACHE:
this->ui->box_StatsWarn_WebServer->setCurrentIndex( 0 );
this->ui->box_StatsCount_WebServer->setCurrentIndex( 0 );
@ -2615,7 +2615,7 @@ void MainWindow::checkMakeStats_Makable()
// switch to apache web server
void MainWindow::on_button_LogFiles_Apache_clicked()
{
if ( this->craplog.getCurrentWSID() != WS_APACHE ) {
if ( this->craplog.getCurrentWebServer() != WS_APACHE ) {
// flat/unflat
this->ui->button_LogFiles_Apache->setFlat( false );
this->ui->button_LogFiles_Nginx->setFlat( true );
@ -2636,7 +2636,7 @@ void MainWindow::on_button_LogFiles_Apache_clicked()
// switch to nginx web server
void MainWindow::on_button_LogFiles_Nginx_clicked()
{
if ( this->craplog.getCurrentWSID() != WS_NGINX ) {
if ( this->craplog.getCurrentWebServer() != WS_NGINX ) {
// flat/unflat
this->ui->button_LogFiles_Nginx->setFlat( false );
this->ui->button_LogFiles_Apache->setFlat( true );
@ -2657,7 +2657,7 @@ void MainWindow::on_button_LogFiles_Nginx_clicked()
// switch to iis web server
void MainWindow::on_button_LogFiles_Iis_clicked()
{
if ( this->craplog.getCurrentWSID() != WS_IIS ) {
if ( this->craplog.getCurrentWebServer() != WS_IIS ) {
// flat/unflat
this->ui->button_LogFiles_Iis->setFlat( false );
this->ui->button_LogFiles_Apache->setFlat( true );
@ -4866,7 +4866,7 @@ void MainWindow::on_button_ConfApache_Format_Save_clicked()
this->ui->inLine_ConfApache_Format_String->text().trimmed().toStdString() ) };
if ( success ) {
this->ui->button_ConfApache_Format_Save->setEnabled( false );
if ( this->craplog.getCurrentWSID() == WS_APACHE ) {
if ( this->craplog.getCurrentWebServer() == WS_APACHE ) {
this->craplog.setCurrentLogFormat();
}
}
@ -5237,7 +5237,7 @@ void MainWindow::on_button_ConfNginx_Format_Save_clicked()
this->ui->inLine_ConfNginx_Format_String->text().trimmed().toStdString() ) };
if ( success ) {
this->ui->button_ConfNginx_Format_Save->setEnabled( false );
if ( this->craplog.getCurrentWSID() == WS_NGINX ) {
if ( this->craplog.getCurrentWebServer() == WS_NGINX ) {
this->craplog.setCurrentLogFormat();
}
}
@ -5605,7 +5605,7 @@ void MainWindow::on_radio_ConfIis_Format_W3C_toggled(bool checked)
this->ui->inLine_ConfIis_Format_String->clear();
this->ui->inLine_ConfIis_Format_String->setEnabled( true );
this->ui->inLine_ConfIis_Format_String->setFocus();
if ( this->craplog.getCurrentWSID() == WS_IIS ) {
if ( this->craplog.getCurrentWebServer() == WS_IIS ) {
this->craplog.setCurrentLogFormat();
this->on_button_LogFiles_RefreshList_clicked();
}
@ -5623,7 +5623,7 @@ void MainWindow::on_radio_ConfIis_Format_NCSA_toggled(bool checked)
this->ui->inLine_ConfIis_Format_String->setText( QString::fromStdString( this->craplog.getLogsFormatString( WS_IIS ) ) );
this->ui->inLine_ConfIis_Format_String->setEnabled( false );
this->ui->button_ConfIis_Format_Save->setEnabled( false );
if ( this->craplog.getCurrentWSID() == WS_IIS ) {
if ( this->craplog.getCurrentWebServer() == WS_IIS ) {
this->craplog.setCurrentLogFormat();
this->on_button_LogFiles_RefreshList_clicked();
}
@ -5641,7 +5641,7 @@ void MainWindow::on_radio_ConfIis_Format_IIS_toggled(bool checked)
this->ui->inLine_ConfIis_Format_String->setText( QString::fromStdString( this->craplog.getLogsFormatString( WS_IIS ) ) );
this->ui->inLine_ConfIis_Format_String->setEnabled( false );
this->ui->button_ConfIis_Format_Save->setEnabled( false );
if ( this->craplog.getCurrentWSID() == WS_IIS ) {
if ( this->craplog.getCurrentWebServer() == WS_IIS ) {
this->craplog.setCurrentLogFormat();
this->on_button_LogFiles_RefreshList_clicked();
}
@ -5671,7 +5671,7 @@ void MainWindow::on_button_ConfIis_Format_Save_clicked()
this->getIisLogsModule() ) };
if ( success ) {
this->ui->button_ConfIis_Format_Save->setEnabled( false );
if ( this->craplog.getCurrentWSID() == WS_IIS ) {
if ( this->craplog.getCurrentWebServer() == WS_IIS ) {
this->craplog.setCurrentLogFormat();
}
}

View File

@ -217,7 +217,7 @@ void Craplog::setCurrentWebServer( const WebServer web_server ) noexcept
this->setCurrentLogFormat();
}
WebServer Craplog::getCurrentWSID() const noexcept
WebServer Craplog::getCurrentWebServer() const noexcept
{
return this->current_web_server;
}

View File

@ -70,7 +70,7 @@ public:
/*!
\return The Web Server ID
*/
WebServer getCurrentWSID() const noexcept;
WebServer getCurrentWebServer() const noexcept;
//! Uses the current Web Server to set the relative logs format
/*!

View File

@ -1,5 +1,5 @@
#ifndef LOGDOCTOR__CRAPLOG__DATETIME_H
#define LOGDOCTOR__CRAPLOG__DATETIME_H
#ifndef LOGDOCTOR__CRAPLOG__MODULES__DATETIME_H
#define LOGDOCTOR__CRAPLOG__MODULES__DATETIME_H
#include <string>
@ -25,4 +25,4 @@ std::vector<std::string> processDateTime( std::string_view datetime, std::string
} // namespace DateTimeOps
#endif // LOGDOCTOR__CRAPLOG__DATETIME_H
#endif // LOGDOCTOR__CRAPLOG__MODULES__DATETIME_H

View File

@ -1,5 +1,5 @@
#ifndef LOGDOCTOR__CRAPLOG__DONUTS_H
#define LOGDOCTOR__CRAPLOG__DONUTS_H
#ifndef LOGDOCTOR__CRAPLOG__MODULES__DONUTS_H
#define LOGDOCTOR__CRAPLOG__MODULES__DONUTS_H
#include <QGraphicsView>
@ -84,4 +84,4 @@ private:
};
#endif // LOGDOCTOR__CRAPLOG__DONUTS_H
#endif // LOGDOCTOR__CRAPLOG__MODULES__DONUTS_H

View File

@ -1,5 +1,5 @@
#ifndef LOGDOCTOR__CRAPLOG__FORMATS_H
#define LOGDOCTOR__CRAPLOG__FORMATS_H
#ifndef LOGDOCTOR__CRAPLOG__MODULES__FORMATS_H
#define LOGDOCTOR__CRAPLOG__MODULES__FORMATS_H
#include <QString>
@ -439,4 +439,4 @@ private:
};
#endif // LOGDOCTOR__CRAPLOG__FORMATS_H
#endif // LOGDOCTOR__CRAPLOG__MODULES__FORMATS_H

View File

@ -1,5 +1,5 @@
#ifndef LOGDOCTOR__CRAPLOG__HASH_H
#define LOGDOCTOR__CRAPLOG__HASH_H
#ifndef LOGDOCTOR__CRAPLOG__MODULES__HASH_H
#define LOGDOCTOR__CRAPLOG__MODULES__HASH_H
#include "main_lib.h"
@ -83,4 +83,4 @@ private:
};
#endif // LOGDOCTOR__CRAPLOG__HASH_H
#endif // LOGDOCTOR__CRAPLOG__MODULES__HASH_H

View File

@ -1,5 +1,5 @@
#ifndef LOGDOCTOR__CRAPLOG__LIB_H
#define LOGDOCTOR__CRAPLOG__LIB_H
#ifndef LOGDOCTOR__CRAPLOG__MODULES__LIB_H
#define LOGDOCTOR__CRAPLOG__MODULES__LIB_H
#include <QString>
@ -15,10 +15,11 @@
*/
enum class LogType
#ifdef _MSC_VER
: __int8 {
: __int8
#else
: __INT8_TYPE__ {
: __INT8_TYPE__
#endif
{
Failed = -1, //!< Failed to determine the type
Discarded = 0, //!< Not a valid file, will be discarded
Access = 1 //!< Valid access logs file type
@ -26,7 +27,8 @@ enum class LogType
//! Holds informations about a log file
struct LogFile final {
struct LogFile final
{
explicit LogFile() noexcept = default;
explicit LogFile(const bool sel,const bool used,const size_t sz,const QString& nm,const std::string& hs,const std::string& pt) noexcept
:selected{sel},used_already{used},size_{sz},name_{nm},hash_{hs},path_{pt}{}
@ -70,7 +72,8 @@ Q_DECLARE_METATYPE( LogFile )
//! Holds informations about a log format
struct LogsFormat final {
struct LogsFormat final
{
explicit LogsFormat() noexcept = default;
explicit LogsFormat
(const std::string& str,std::string&& itl,std::string&& fnl,std::vector<std::string>&& seps,std::vector<std::string>&& flds,const unsigned nl) noexcept
@ -84,11 +87,4 @@ struct LogsFormat final {
};
//! Hold the items of a blacklist/warnlist
struct BWlist final {
bool used; //!< Whether the list is set to be used or not
std::vector<std::string> list; //!< The list of items
};
#endif // LOGDOCTOR__CRAPLOG__LIB_H
#endif // LOGDOCTOR__CRAPLOG__MODULES__LIB_H

View File

@ -1,5 +1,5 @@
#ifndef LOGDOCTOR__CRAPLOG__LOGS_H
#define LOGDOCTOR__CRAPLOG__LOGS_H
#ifndef LOGDOCTOR__CRAPLOG__MODULES__LOGS_H
#define LOGDOCTOR__CRAPLOG__MODULES__LOGS_H
#include "lib.h"
@ -27,4 +27,4 @@ LogType defineFileType(
} // namespace LogOps
#endif // LOGDOCTOR__CRAPLOG__LOGS_H
#endif // LOGDOCTOR__CRAPLOG__MODULES__LOGS_H

View File

@ -6,7 +6,7 @@
#include <QString>
DoNotCatchException::DoNotCatchException( const char* msg )
DoNotCatchException::DoNotCatchException( const std::string& msg )
{
std::cerr << "LogDoctor: Exception: " << msg << std::endl;
}

View File

@ -19,7 +19,7 @@ class LogDoctorException {};
struct DoNotCatchException final
{
explicit DoNotCatchException( const char* msg );
explicit DoNotCatchException( const std::string& msg );
};