Code improvements
This commit is contained in:
parent
357c0f0264
commit
73f4512a45
|
@ -244,7 +244,7 @@ void CrissCross::victory()
|
|||
}
|
||||
|
||||
|
||||
const bool CrissCross::gameDraw()
|
||||
const bool CrissCross::gameDraw() const
|
||||
{
|
||||
bool result = false;
|
||||
unsigned int empty_tiles = 9;
|
||||
|
@ -319,7 +319,7 @@ void CrissCross::AI_updateWeights()
|
|||
|
||||
}
|
||||
|
||||
const unsigned int CrissCross::AI_makeChoice()
|
||||
const unsigned int CrissCross::AI_makeChoice() const
|
||||
{
|
||||
// get a list of the heaviest tiles
|
||||
std::vector<unsigned int> moves;
|
||||
|
|
|
@ -19,7 +19,7 @@ class CrissCross : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CrissCross( const int& theme_id, QWidget* parent=nullptr );
|
||||
explicit CrissCross( const int& theme_id, QWidget* parent=nullptr );
|
||||
~CrissCross();
|
||||
|
||||
|
||||
|
@ -101,7 +101,7 @@ private:
|
|||
const bool checkVictory();
|
||||
|
||||
//! Checks whether the game is draw or not
|
||||
const bool gameDraw();
|
||||
const bool gameDraw() const;
|
||||
|
||||
//! Someone won, process the victory
|
||||
void victory();
|
||||
|
@ -127,7 +127,7 @@ private:
|
|||
\return The tile to select
|
||||
\see AI_playTurn();
|
||||
*/
|
||||
const unsigned int AI_makeChoice();
|
||||
const unsigned int AI_makeChoice() const;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -11,23 +11,23 @@ Food::Food( const bool& can_move )
|
|||
}
|
||||
|
||||
|
||||
const unsigned int& Food::X()
|
||||
const unsigned int& Food::X() const
|
||||
{
|
||||
return this->x;
|
||||
}
|
||||
const unsigned int& Food::Y()
|
||||
const unsigned int& Food::Y() const
|
||||
{
|
||||
return this->y;
|
||||
}
|
||||
|
||||
|
||||
QGraphicsPixmapItem* Food::getImageItem()
|
||||
QGraphicsPixmapItem* Food::getImageItem() const
|
||||
{
|
||||
return this->image;
|
||||
}
|
||||
|
||||
|
||||
const bool Food::inTile( const unsigned int& x, const unsigned int& y )
|
||||
const bool Food::inTile( const unsigned int x, const unsigned int y ) const
|
||||
{
|
||||
if ( this->x == x && this->y == y ) {
|
||||
return true;
|
||||
|
@ -37,14 +37,14 @@ const bool Food::inTile( const unsigned int& x, const unsigned int& y )
|
|||
}
|
||||
|
||||
|
||||
void Food::update( const unsigned int& new_x, const unsigned int& new_y ) {
|
||||
void Food::update( const unsigned int new_x, const unsigned int new_y ) {
|
||||
this->x = new_x;
|
||||
this->y = new_y;
|
||||
this->image->setOffset( 16+(new_x*32), 16+(new_y*32) );
|
||||
}
|
||||
|
||||
|
||||
void Food::spawn( Snake& snake, Snake& snake_ )
|
||||
void Food::spawn( const Snake& snake, const Snake& snake_ )
|
||||
{
|
||||
// pick a new random position
|
||||
unsigned int x, y;
|
||||
|
@ -90,7 +90,7 @@ void Food::spawn( Snake& snake, Snake& snake_ )
|
|||
}
|
||||
|
||||
|
||||
void Food::move( Snake& snake )
|
||||
void Food::move( const Snake& snake )
|
||||
{
|
||||
int move_up = 0,
|
||||
move_down = 0,
|
||||
|
|
|
@ -8,27 +8,27 @@
|
|||
class Food
|
||||
{
|
||||
public:
|
||||
Food( const bool& can_move=false );
|
||||
explicit Food( const bool& can_move=false );
|
||||
|
||||
//! Returns the position on the X-axis
|
||||
const unsigned int& X();
|
||||
const unsigned int& X() const;
|
||||
//! Returns the position on the Y-axis
|
||||
const unsigned int& Y();
|
||||
const unsigned int& Y() const;
|
||||
|
||||
//!< Returns the image
|
||||
QGraphicsPixmapItem* getImageItem();
|
||||
QGraphicsPixmapItem* getImageItem() const;
|
||||
|
||||
//! Checks whether is there a part of the snake in the given position
|
||||
const bool inTile( const unsigned int& x, const unsigned int& y );
|
||||
const bool inTile( const unsigned int x, const unsigned int y ) const;
|
||||
|
||||
//! Spawns the egg/rat in a new position
|
||||
void spawn( Snake& snake, Snake& snake_ );
|
||||
void spawn( const Snake& snake, const Snake& snake_ );
|
||||
|
||||
//! Moves the rat
|
||||
void move( Snake& snake );
|
||||
void move( const Snake& snake );
|
||||
|
||||
//! Updates the position and direction of the entity
|
||||
void update( const unsigned int& new_x, const unsigned int& new_y );
|
||||
void update( const unsigned int new_x, const unsigned int new_y );
|
||||
|
||||
|
||||
private:
|
||||
|
|
|
@ -319,7 +319,7 @@ void SnakeGame::updateGameScore()
|
|||
}
|
||||
|
||||
|
||||
void SnakeGame::checkCollision( Snake& snake, Snake& adv_snake, const bool& is_adv )
|
||||
void SnakeGame::checkCollision( Snake& snake, Snake& adv_snake, const bool is_adv )
|
||||
{
|
||||
unsigned int x, y, x_, y_;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class SnakeGame : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SnakeGame( const int& theme_id, const QFont& term_font, QWidget* parent=nullptr );
|
||||
explicit SnakeGame( const int& theme_id, const QFont& term_font, QWidget* parent=nullptr );
|
||||
~SnakeGame();
|
||||
|
||||
|
||||
|
@ -110,7 +110,7 @@ private:
|
|||
void newSnake_();
|
||||
|
||||
//! Checks if a snake will collide with another entity
|
||||
void checkCollision( Snake& snake, Snake& adv_snake, const bool& is_adv );
|
||||
void checkCollision( Snake& snake, Snake& adv_snake, const bool is_adv );
|
||||
|
||||
|
||||
//////////////
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "snake.h"
|
||||
|
||||
|
||||
Snake::Snake( const bool& is_adversary )
|
||||
Snake::Snake( const bool is_adversary )
|
||||
{
|
||||
this->will_grow = false;
|
||||
this->adversary = is_adversary;
|
||||
|
@ -18,7 +18,7 @@ Snake::Snake( const bool& is_adversary )
|
|||
}
|
||||
|
||||
|
||||
QPixmap& Snake::getHeadImage()
|
||||
const QPixmap& Snake::getHeadImage() const
|
||||
{
|
||||
if ( this->adversary ) {
|
||||
return this->img_snakeHead_;
|
||||
|
@ -28,7 +28,7 @@ QPixmap& Snake::getHeadImage()
|
|||
}
|
||||
|
||||
|
||||
const bool Snake::inTile( const unsigned int& x, const unsigned int& y , const bool& avoid_tail )
|
||||
const bool Snake::inTile( const unsigned int x, const unsigned int y , const bool avoid_tail ) const
|
||||
{
|
||||
bool result = false;
|
||||
if ( this->size() > 0 ) {
|
||||
|
@ -56,7 +56,7 @@ void Snake::setDirection( const Direction new_direction )
|
|||
{
|
||||
this->head_direction = new_direction;
|
||||
}
|
||||
const Direction& Snake::direction()
|
||||
const Direction& Snake::direction() const
|
||||
{
|
||||
return this->head_direction;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ void Snake::willGrow()
|
|||
{
|
||||
this->will_grow = true;
|
||||
}
|
||||
void Snake::grow( const bool& is_borning )
|
||||
void Snake::grow( const bool is_borning )
|
||||
{
|
||||
// build from the tail
|
||||
const BodyPart& tail = this->back();
|
||||
|
@ -103,7 +103,7 @@ void Snake::grow( const bool& is_borning )
|
|||
}
|
||||
|
||||
|
||||
void Snake::update( QGraphicsScene* field_scene, const bool& dry , const bool& is_borning )
|
||||
void Snake::update( QGraphicsScene* field_scene, const bool dry , const bool is_borning )
|
||||
{
|
||||
// grow if planned
|
||||
if ( this->will_grow ) {
|
||||
|
@ -367,7 +367,7 @@ void Snake::update( QGraphicsScene* field_scene, const bool& dry , const bool& i
|
|||
}
|
||||
|
||||
|
||||
void Snake::move( Snake& adv_snake, const unsigned int& food_x, const unsigned int& food_y )
|
||||
void Snake::move( const Snake& adv_snake, const unsigned int& food_x, const unsigned int& food_y )
|
||||
{
|
||||
std::vector<Direction> classes = {
|
||||
Direction::UP,
|
||||
|
@ -404,7 +404,7 @@ void Snake::move( Snake& adv_snake, const unsigned int& food_x, const unsigned i
|
|||
}
|
||||
|
||||
|
||||
const Direction Snake::predictDirection( std::vector<std::vector<float>>& data, std::vector<float> weights , std::vector<Direction> classes )
|
||||
const Direction Snake::predictDirection( const std::vector<std::vector<float>>& data, const std::vector<float>& weights, const std::vector<Direction>& classes ) const
|
||||
{
|
||||
float results[] = { 1.0, 1.0, 1.0, 1.0 };
|
||||
bool keep_current = false;
|
||||
|
@ -412,7 +412,7 @@ const Direction Snake::predictDirection( std::vector<std::vector<float>>& data,
|
|||
|
||||
// process data
|
||||
for ( int i=0; i<4; i++ ) {
|
||||
std::vector<float>& d = data.at(i);
|
||||
const std::vector<float>& d = data.at(i);
|
||||
float& r = results[i];
|
||||
for ( int j=0; j<7; j++ ) {
|
||||
r += d.at(j) * weights.at(j);
|
||||
|
@ -461,7 +461,7 @@ const Direction Snake::predictDirection( std::vector<std::vector<float>>& data,
|
|||
}
|
||||
|
||||
|
||||
void Snake::collectData( std::vector<float>& data, Direction& direction, Snake& adv_snake, const unsigned int& food_x, const unsigned int& food_y )
|
||||
void Snake::collectData( std::vector<float>& data, Direction& direction, const Snake& adv_snake, const unsigned int& food_x, const unsigned int& food_y ) const
|
||||
{
|
||||
unsigned int
|
||||
blocked_way = 0,
|
||||
|
@ -722,7 +722,7 @@ void Snake::collectData( std::vector<float>& data, Direction& direction, Snake&
|
|||
}
|
||||
|
||||
|
||||
void Snake::updateFieldMap( Snake& adv_snake, const unsigned int& food_x, const unsigned int& food_y )
|
||||
void Snake::updateFieldMap( const Snake& adv_snake, const unsigned int& food_x, const unsigned int& food_y )
|
||||
{
|
||||
// reset to default state
|
||||
for ( size_t x=0; x<16; x++ ) {
|
||||
|
@ -753,7 +753,7 @@ void Snake::updateFieldMap( Snake& adv_snake, const unsigned int& food_x, const
|
|||
}
|
||||
|
||||
|
||||
const bool Snake::inTileAdv(const unsigned int& x, const unsigned int& y )
|
||||
const bool Snake::inTileAdv(const unsigned int x, const unsigned int y ) const
|
||||
{
|
||||
bool result = false;
|
||||
if ( x < 16 && y < 16 ) {
|
||||
|
@ -766,7 +766,7 @@ const bool Snake::inTileAdv(const unsigned int& x, const unsigned int& y )
|
|||
return result;
|
||||
}
|
||||
|
||||
const bool Snake::inTileMinusSteps(const unsigned int& x, const unsigned int& y, const unsigned int& steps )
|
||||
const bool Snake::inTileMinusSteps(const unsigned int x, const unsigned int y, const unsigned int steps ) const
|
||||
{
|
||||
bool result = false;
|
||||
switch ( this->field_map.at(x).at(y).entity ) {
|
||||
|
@ -781,7 +781,7 @@ const bool Snake::inTileMinusSteps(const unsigned int& x, const unsigned int& y,
|
|||
}
|
||||
|
||||
|
||||
const std::vector<unsigned int> Snake::checkAround( const Direction& direction, const unsigned int& x, const unsigned int& y )
|
||||
const std::vector<unsigned int> Snake::checkAround( const Direction& direction, const unsigned int& x, const unsigned int& y ) const
|
||||
{
|
||||
std::vector<unsigned int> around = {
|
||||
0, 0, 0,
|
||||
|
@ -851,7 +851,7 @@ const std::vector<unsigned int> Snake::checkAround( const Direction& direction,
|
|||
}
|
||||
|
||||
|
||||
const unsigned int Snake::isDeadHole( const unsigned int& start_x, const unsigned int& start_y, Direction start_direction )
|
||||
const unsigned int Snake::isDeadHole( const unsigned int& start_x, const unsigned int& start_y, Direction start_direction ) const
|
||||
{
|
||||
bool result=false, check=false, check_clockwise=false;
|
||||
int front_step, front_check, side_check;
|
||||
|
|
|
@ -25,7 +25,7 @@ struct BodyPart {
|
|||
Direction prev_direction; //!< The previous direction of the part
|
||||
QGraphicsPixmapItem* image; //!< The image which graphically represents the part
|
||||
//! Updates the position and direction of the part
|
||||
void update( const unsigned int& new_x, const unsigned int& new_y, const Direction& new_direction ) {
|
||||
void update( const unsigned int new_x, const unsigned int new_y, const Direction& new_direction ) {
|
||||
this->x = new_x;
|
||||
this->y = new_y;
|
||||
this->image->setOffset( 16+(new_x*32), 16+(new_y*32) );
|
||||
|
@ -38,27 +38,27 @@ struct BodyPart {
|
|||
class Snake : public std::vector<BodyPart>
|
||||
{
|
||||
public:
|
||||
Snake( const bool& is_adversary=false );
|
||||
explicit Snake( const bool is_adversary=false );
|
||||
|
||||
QPixmap& getHeadImage();
|
||||
const QPixmap& getHeadImage() const;
|
||||
|
||||
//! Checks whether is there a part of the snake in the given position
|
||||
const bool inTile( const unsigned int& x, const unsigned int& y, const bool& avoid_tail=true );
|
||||
const bool inTile( const unsigned int x, const unsigned int y, const bool avoid_tail=true ) const;
|
||||
|
||||
//! Sets the new direction (of the head)
|
||||
void setDirection( const Direction new_direction );
|
||||
|
||||
//! Returns the current direction (of the head)
|
||||
const Direction& direction();
|
||||
const Direction& direction() const;
|
||||
|
||||
//! Updates the position and direction of the entire snake
|
||||
void update( QGraphicsScene* field_scene=nullptr, const bool& dry=false, const bool& is_borning=false );
|
||||
void update( QGraphicsScene* field_scene=nullptr, const bool dry=false, const bool is_borning=false );
|
||||
|
||||
// Schedules to grow the snake on the next update
|
||||
void willGrow();
|
||||
|
||||
// [AI] Chooses a new direction for the snake
|
||||
void move( Snake& adv_snake, const unsigned int& food_x, const unsigned int& food_y );
|
||||
void move( const Snake& adv_snake, const unsigned int& food_x, const unsigned int& food_y );
|
||||
|
||||
|
||||
private:
|
||||
|
@ -78,7 +78,7 @@ private:
|
|||
bool will_grow;
|
||||
|
||||
//! Increases the length of the body of the snake of 1 part
|
||||
void grow( const bool& is_borning );
|
||||
void grow( const bool is_borning );
|
||||
|
||||
bool adversary;
|
||||
|
||||
|
@ -101,25 +101,25 @@ private:
|
|||
std::vector<std::vector<Tile>> field_map;
|
||||
|
||||
// [AI] Updates the map of the field
|
||||
void updateFieldMap( Snake& adv_snake, const unsigned int& food_x, const unsigned int& food_y );
|
||||
void updateFieldMap( const Snake& adv_snake, const unsigned int& food_x, const unsigned int& food_y );
|
||||
|
||||
// [AI] As inTile(), but works on the field_map and only checks the adersary
|
||||
const bool inTileAdv( const unsigned int& x, const unsigned int& y );
|
||||
const bool inTileAdv( const unsigned int x, const unsigned int y ) const;
|
||||
|
||||
// [AI] Checks whether is there a snake in the tile, without counting as much trailing BodyParts as the number of steps
|
||||
const bool inTileMinusSteps( const unsigned int& x, const unsigned int& y, const unsigned int& steps );
|
||||
const bool inTileMinusSteps( const unsigned int x, const unsigned int y, const unsigned int steps ) const;
|
||||
|
||||
// [AI] Checks which of the surrounding positions are blocked
|
||||
const std::vector<unsigned int> checkAround( const Direction& direction, const unsigned int& x, const unsigned int& y );
|
||||
const std::vector<unsigned int> checkAround( const Direction& direction, const unsigned int& x, const unsigned int& y ) const;
|
||||
|
||||
// [AI] Checks if a direction is a closed path and should be avoided
|
||||
const unsigned int isDeadHole( const unsigned int& start_x, const unsigned int& start_y, Direction start_direction );
|
||||
const unsigned int isDeadHole( const unsigned int& start_x, const unsigned int& start_y, Direction start_direction ) const;
|
||||
|
||||
// [AI] Collects data about the possible movements
|
||||
void collectData( std::vector<float>& data, Direction& direction, Snake& adv_snake, const unsigned int& food_x, const unsigned int& food_y );
|
||||
void collectData( std::vector<float>& data, Direction& direction, const Snake& adv_snake, const unsigned int& food_x, const unsigned int& food_y ) const;
|
||||
|
||||
// [AI] Processes the collected data to predict the best movement
|
||||
const Direction predictDirection( std::vector<std::vector<float>>& data, std::vector<float> weights, std::vector<Direction> classes );
|
||||
const Direction predictDirection( const std::vector<std::vector<float>>& data, const std::vector<float>& weights, const std::vector<Direction>& classes ) const;
|
||||
};
|
||||
|
||||
#endif // SNAKE_H
|
||||
|
|
|
@ -407,7 +407,7 @@ void MainWindow::readConfigs()
|
|||
this->remember_window = this->s2b.at( val );
|
||||
|
||||
} else if ( var == "Geometry" ) {
|
||||
this->geometryFromString( val );
|
||||
this->setGeometryFromString( val );
|
||||
|
||||
} else if ( var == "WindowTheme" ) {
|
||||
this->window_theme_id = std::stoi( val );
|
||||
|
@ -687,7 +687,7 @@ void MainWindow::writeConfigs()
|
|||
}
|
||||
} else {
|
||||
// file does not exists, check if at least the folder exists
|
||||
const std::string base_path = this->basePath( this->configs_path );
|
||||
const std::string base_path = this->parentPath( this->configs_path );
|
||||
if ( IOutils::exists( base_path ) ) {
|
||||
if ( IOutils::isDir( base_path ) ) {
|
||||
if ( ! IOutils::checkDir( base_path, false, true ) ) {
|
||||
|
@ -843,7 +843,7 @@ void MainWindow::writeConfigs()
|
|||
}
|
||||
|
||||
|
||||
void MainWindow::backupDatabase()
|
||||
void MainWindow::backupDatabase() const
|
||||
{
|
||||
bool proceed = true;
|
||||
std::error_code err;
|
||||
|
@ -956,7 +956,7 @@ void MainWindow::backupDatabase()
|
|||
}
|
||||
|
||||
|
||||
const std::string MainWindow::geometryToString()
|
||||
const std::string MainWindow::geometryToString() const
|
||||
{
|
||||
QRect geometry = this->geometry();
|
||||
std::string string = "";
|
||||
|
@ -971,7 +971,7 @@ const std::string MainWindow::geometryToString()
|
|||
string += this->b2s.at( this->isMaximized() );
|
||||
return string;
|
||||
}
|
||||
void MainWindow::geometryFromString( const std::string& geometry )
|
||||
void MainWindow::setGeometryFromString( const std::string& geometry )
|
||||
{
|
||||
std::vector<std::string> aux;
|
||||
StringOps::splitrip( aux, geometry, "," );
|
||||
|
@ -984,7 +984,7 @@ void MainWindow::geometryFromString( const std::string& geometry )
|
|||
}
|
||||
|
||||
|
||||
const std::string MainWindow::list2string( const std::vector<std::string>& list, const bool& user_agent )
|
||||
const std::string MainWindow::list2string( const std::vector<std::string>& list, const bool user_agent ) const
|
||||
{
|
||||
std::string string;
|
||||
if ( user_agent ) {
|
||||
|
@ -998,7 +998,7 @@ const std::string MainWindow::list2string( const std::vector<std::string>& list,
|
|||
}
|
||||
return string;
|
||||
}
|
||||
const std::vector<std::string> MainWindow::string2list( const std::string& string, const bool& user_agent )
|
||||
const std::vector<std::string> MainWindow::string2list( const std::string& string, const bool user_agent ) const
|
||||
{
|
||||
std::vector<std::string> list, aux;
|
||||
StringOps::splitrip( aux, string, " " );
|
||||
|
@ -1582,7 +1582,7 @@ void MainWindow::makeInitialChecks()
|
|||
|
||||
if ( ok ) {
|
||||
// check LogDoctor's folders paths
|
||||
for ( const std::string& path : std::vector<std::string>({this->basePath(this->configs_path), this->logdoc_path, this->db_data_path, this->db_hashes_path}) ) {
|
||||
for ( const std::string& path : std::vector<std::string>({this->parentPath(this->configs_path), this->logdoc_path, this->db_data_path, this->db_hashes_path}) ) {
|
||||
if ( IOutils::exists( path ) ) {
|
||||
if ( IOutils::isDir( path ) ) {
|
||||
if ( ! IOutils::checkDir( path, true ) ) {
|
||||
|
@ -1723,7 +1723,7 @@ void MainWindow::makeInitialChecks()
|
|||
}
|
||||
|
||||
|
||||
const bool& MainWindow::checkDataDB()
|
||||
const bool MainWindow::checkDataDB()
|
||||
{
|
||||
if ( ! this->initiating ) { // avoid recursions
|
||||
// check the db
|
||||
|
@ -1762,7 +1762,7 @@ const bool& MainWindow::checkDataDB()
|
|||
/////////////////////
|
||||
//// GENERAL USE ////
|
||||
/////////////////////
|
||||
const QString MainWindow::wsFromIndex( const int& index )
|
||||
const QString MainWindow::wsFromIndex(const int index ) const
|
||||
{
|
||||
switch (index) {
|
||||
case 0:
|
||||
|
@ -1776,7 +1776,7 @@ const QString MainWindow::wsFromIndex( const int& index )
|
|||
}
|
||||
}
|
||||
|
||||
const std::string MainWindow::resolvePath( const std::string& path )
|
||||
const std::string MainWindow::resolvePath( const std::string& path ) const
|
||||
{
|
||||
std::string p;
|
||||
try {
|
||||
|
@ -1786,14 +1786,14 @@ const std::string MainWindow::resolvePath( const std::string& path )
|
|||
}
|
||||
return p;
|
||||
}
|
||||
const std::string MainWindow::basePath( const std::string& path )
|
||||
const std::string MainWindow::parentPath( const std::string& path ) const
|
||||
{
|
||||
const int stop = path.rfind( '/' );
|
||||
return path.substr( 0, stop );
|
||||
}
|
||||
|
||||
// printable size with suffix and limited decimals
|
||||
const QString MainWindow::printableSize( const int& bytes )
|
||||
const QString MainWindow::printableSize( const int bytes ) const
|
||||
{
|
||||
std::string size_str, size_sfx=" B";
|
||||
float size = (float)bytes;
|
||||
|
@ -1832,7 +1832,7 @@ const QString MainWindow::printableSize( const int& bytes )
|
|||
}
|
||||
|
||||
// printable speed with suffix and limited decimals
|
||||
const QString MainWindow::printableSpeed( const int& bytes, const int& secs_ )
|
||||
const QString MainWindow::printableSpeed( const int bytes, const int secs_ ) const
|
||||
{
|
||||
std::string speed_str, speed_sfx=" B/s";
|
||||
int secs = secs_;
|
||||
|
@ -1874,7 +1874,7 @@ const QString MainWindow::printableSpeed( const int& bytes, const int& secs_ )
|
|||
return QString::fromStdString( speed_str.substr(0, cut_index ) + speed_sfx );
|
||||
}
|
||||
|
||||
const QString MainWindow::printableTime( const int& secs_ )
|
||||
const QString MainWindow::printableTime( const int secs_ ) const
|
||||
{
|
||||
int secs = secs_;
|
||||
int mins = secs / 60;
|
||||
|
@ -2046,7 +2046,7 @@ void MainWindow::menu_actionCheckUpdates_triggered()
|
|||
this->window_theme_id,
|
||||
this->icons_theme );
|
||||
this->crapup->show();
|
||||
this->crapup->versionCheck( 1.0 );
|
||||
this->crapup->versionCheck( this->version );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2080,7 +2080,7 @@ void MainWindow::menu_actionSnake_triggered()
|
|||
//////////////
|
||||
//// TABS ////
|
||||
//////////////
|
||||
void MainWindow::switchMainTab( const int& new_index )
|
||||
void MainWindow::switchMainTab( const int new_index )
|
||||
{
|
||||
const int old_index = this->ui->stacked_Tabs_Pages->currentIndex();
|
||||
// turn off the old icon
|
||||
|
@ -2152,7 +2152,7 @@ void MainWindow::on_button_Tab_Conf_clicked()
|
|||
|
||||
|
||||
//// STATS ////
|
||||
void MainWindow::switchStatsTab( const int& new_index )
|
||||
void MainWindow::switchStatsTab( const int new_index )
|
||||
{
|
||||
const int old_index = this->ui->stacked_Stats_Pages->currentIndex();
|
||||
// turn off the old icon
|
||||
|
@ -2278,7 +2278,7 @@ void MainWindow::on_button_Tab_StatsGlob_clicked()
|
|||
////////////
|
||||
//// DB ////
|
||||
////////////
|
||||
void MainWindow::setDbWorkingState( const bool& state )
|
||||
void MainWindow::setDbWorkingState( const bool state )
|
||||
{
|
||||
this->db_working = state;
|
||||
if ( ! state ) {
|
||||
|
@ -3180,7 +3180,7 @@ void MainWindow::resetStatsCountButtons()
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::startCountDrawing()
|
||||
void MainWindow::makeStatsCount()
|
||||
{
|
||||
this->setDbWorkingState( true );
|
||||
delete this->crapview_timer;
|
||||
|
@ -3196,7 +3196,7 @@ void MainWindow::on_button_StatsCount_Protocol_clicked()
|
|||
this->resetStatsCountButtons();
|
||||
this->ui->button_StatsCount_Protocol->setFlat( false );
|
||||
this->count_fld = this->ui->button_StatsCount_Protocol->text();
|
||||
startCountDrawing();
|
||||
makeStatsCount();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3206,7 +3206,7 @@ void MainWindow::on_button_StatsCount_Method_clicked()
|
|||
this->resetStatsCountButtons();
|
||||
this->count_fld = this->ui->button_StatsCount_Method->text();
|
||||
this->ui->button_StatsCount_Method->setFlat( false );
|
||||
startCountDrawing();
|
||||
makeStatsCount();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3216,7 +3216,7 @@ void MainWindow::on_button_StatsCount_Uri_clicked()
|
|||
this->resetStatsCountButtons();
|
||||
this->count_fld = this->ui->button_StatsCount_Uri->text();
|
||||
this->ui->button_StatsCount_Uri->setFlat( false );
|
||||
startCountDrawing();
|
||||
makeStatsCount();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3226,7 +3226,7 @@ void MainWindow::on_button_StatsCount_Query_clicked()
|
|||
this->resetStatsCountButtons();
|
||||
this->count_fld = this->ui->button_StatsCount_Query->text();
|
||||
this->ui->button_StatsCount_Query->setFlat( false );
|
||||
startCountDrawing();
|
||||
makeStatsCount();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3236,7 +3236,7 @@ void MainWindow::on_button_StatsCount_Response_clicked()
|
|||
this->resetStatsCountButtons();
|
||||
this->count_fld = this->ui->button_StatsCount_Response->text();
|
||||
this->ui->button_StatsCount_Response->setFlat( false );
|
||||
startCountDrawing();
|
||||
makeStatsCount();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3246,7 +3246,7 @@ void MainWindow::on_button_StatsCount_Referrer_clicked()
|
|||
this->resetStatsCountButtons();
|
||||
this->count_fld = this->ui->button_StatsCount_Referrer->text();
|
||||
this->ui->button_StatsCount_Referrer->setFlat( false );
|
||||
startCountDrawing();
|
||||
makeStatsCount();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3256,7 +3256,7 @@ void MainWindow::on_button_StatsCount_Cookie_clicked()
|
|||
this->resetStatsCountButtons();
|
||||
this->count_fld = this->ui->button_StatsCount_Cookie->text();
|
||||
this->ui->button_StatsCount_Cookie->setFlat( false );
|
||||
startCountDrawing();
|
||||
makeStatsCount();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3266,7 +3266,7 @@ void MainWindow::on_button_StatsCount_UserAgent_clicked()
|
|||
this->resetStatsCountButtons();
|
||||
this->count_fld = this->ui->button_StatsCount_UserAgent->text();
|
||||
this->ui->button_StatsCount_UserAgent->setFlat( false );
|
||||
startCountDrawing();
|
||||
makeStatsCount();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3276,7 +3276,7 @@ void MainWindow::on_button_StatsCount_Client_clicked()
|
|||
this->resetStatsCountButtons();
|
||||
this->count_fld = this->ui->button_StatsCount_Client->text();
|
||||
this->ui->button_StatsCount_Client->setFlat( false );
|
||||
startCountDrawing();
|
||||
makeStatsCount();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3776,19 +3776,19 @@ void MainWindow::makeStatsGlobals()
|
|||
}
|
||||
|
||||
} else {
|
||||
this->resetStatsGlobals();
|
||||
this->resetStatsGlob();
|
||||
}
|
||||
recur_list.clear(); traffic_list.clear();
|
||||
perf_list.clear(); work_list.clear();
|
||||
|
||||
} else {
|
||||
this->resetStatsGlobals();
|
||||
this->resetStatsGlob();
|
||||
}
|
||||
// restore
|
||||
this->setDbWorkingState( false );
|
||||
}
|
||||
|
||||
void MainWindow::resetStatsGlobals()
|
||||
void MainWindow::resetStatsGlob()
|
||||
{
|
||||
this->ui->label_StatsGlob_Recur_Protocol_String->setText( "-" );
|
||||
this->ui->label_StatsGlob_Recur_Protocol_Count->setText( "0" );
|
||||
|
@ -3828,7 +3828,7 @@ void MainWindow::resetStatsGlobals()
|
|||
|
||||
|
||||
|
||||
void MainWindow::globalsButtonClicked()
|
||||
void MainWindow::makeStatsGlob()
|
||||
{
|
||||
this->setDbWorkingState( true );
|
||||
delete this->crapview_timer;
|
||||
|
@ -3842,7 +3842,7 @@ void MainWindow::on_button_StatsGlob_Apache_clicked()
|
|||
{
|
||||
if ( this->checkDataDB() ) {
|
||||
this->glob_ws = "apache";
|
||||
this->globalsButtonClicked();
|
||||
this->makeStatsGlob();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3851,7 +3851,7 @@ void MainWindow::on_button_StatsGlob_Nginx_clicked()
|
|||
{
|
||||
if ( this->checkDataDB() ) {
|
||||
this->glob_ws = "nginx";
|
||||
this->globalsButtonClicked();
|
||||
this->makeStatsGlob();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3860,7 +3860,7 @@ void MainWindow::on_button_StatsGlob_Iis_clicked()
|
|||
{
|
||||
if ( this->checkDataDB() ) {
|
||||
this->glob_ws = "iis";
|
||||
this->globalsButtonClicked();
|
||||
this->makeStatsGlob();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4931,7 +4931,7 @@ void MainWindow::on_button_ConfIis_Path_Save_clicked()
|
|||
}
|
||||
|
||||
// formats
|
||||
const int MainWindow::getIisLogsModule()
|
||||
const int MainWindow::getIisLogsModule() const
|
||||
{
|
||||
int module = 0;
|
||||
if ( this->ui->radio_ConfIis_Format_NCSA->isChecked() ) {
|
||||
|
|
|
@ -43,7 +43,7 @@ class MainWindow : public QMainWindow
|
|||
|
||||
public:
|
||||
|
||||
MainWindow( QWidget* parent=nullptr );
|
||||
explicit MainWindow( QWidget* parent=nullptr );
|
||||
~MainWindow();
|
||||
|
||||
|
||||
|
@ -512,11 +512,11 @@ private:
|
|||
Ui::MainWindow *ui;
|
||||
|
||||
// current version of LogDoctor
|
||||
const float version = 2.01;
|
||||
const float version = 2.02;
|
||||
|
||||
// web servers ID constants
|
||||
const unsigned int APACHE_ID=11, NGINX_ID=12, IIS_ID=13;
|
||||
const QString wsFromIndex( const int& index );
|
||||
const QString wsFromIndex( const int index ) const;
|
||||
|
||||
|
||||
//////////////////////////
|
||||
|
@ -566,7 +566,7 @@ private:
|
|||
\return The resulting string
|
||||
\see writeConfigs()
|
||||
*/
|
||||
const std::string list2string( const std::vector<std::string>& list, const bool& user_agent=false );
|
||||
const std::string list2string( const std::vector<std::string>& list, const bool user_agent=false ) const;
|
||||
|
||||
//! Retrieves a list of items from the given string
|
||||
/*!
|
||||
|
@ -575,7 +575,7 @@ private:
|
|||
\return The resulting list
|
||||
\see readConfigs()
|
||||
*/
|
||||
const std::vector<std::string> string2list( const std::string& string, const bool& user_agent=false );
|
||||
const std::vector<std::string> string2list( const std::string& string, const bool user_agent=false ) const;
|
||||
|
||||
// string to bool and vice versa
|
||||
const std::unordered_map<std::string, bool> s2b = { {"true",true}, {"false",false} };
|
||||
|
@ -600,13 +600,13 @@ private:
|
|||
/*!
|
||||
\see writeConfigs()
|
||||
*/
|
||||
const std::string geometryToString();
|
||||
const std::string geometryToString() const;
|
||||
|
||||
//! Retrieves the window geometry from the given string
|
||||
/*!
|
||||
\see readConfigs()
|
||||
*/
|
||||
void geometryFromString( const std::string& geometry );
|
||||
void setGeometryFromString( const std::string& geometry );
|
||||
|
||||
|
||||
/////////////////
|
||||
|
@ -676,20 +676,20 @@ private:
|
|||
/////////////////////
|
||||
|
||||
//! Printable size, including suffix
|
||||
const QString printableSize( const int& bytes );
|
||||
const QString printableSize( const int bytes ) const;
|
||||
|
||||
//! Printable time, including suffix(es)
|
||||
const QString printableTime( const int& seconds );
|
||||
const QString printableTime( const int seconds ) const;
|
||||
|
||||
//! Printable speed, namely printable size over printable time
|
||||
const QString printableSpeed( const int& bytes, const int& secs );
|
||||
const QString printableSpeed( const int bytes, const int secs ) const;
|
||||
|
||||
|
||||
//! Resolves the given path and returns the canonical path
|
||||
const std::string resolvePath( const std::string& path );
|
||||
const std::string resolvePath( const std::string& path ) const;
|
||||
|
||||
//! Returns the parent folder of the given path
|
||||
const std::string basePath( const std::string& path );
|
||||
const std::string parentPath( const std::string& path ) const;
|
||||
|
||||
|
||||
////////////////
|
||||
|
@ -704,7 +704,7 @@ private:
|
|||
void makeInitialChecks();
|
||||
|
||||
//! Checks the integrity of the logs data collection database
|
||||
const bool& checkDataDB();
|
||||
const bool checkDataDB();
|
||||
|
||||
|
||||
///////////////////
|
||||
|
@ -718,7 +718,7 @@ private:
|
|||
unsigned db_backups_number = 3;
|
||||
|
||||
//! Backs-up the logs data collection database
|
||||
void backupDatabase();
|
||||
void backupDatabase() const;
|
||||
|
||||
std::string db_data_path;
|
||||
std::string db_hashes_path;
|
||||
|
@ -727,14 +727,14 @@ private:
|
|||
bool db_working = false;
|
||||
|
||||
//! Called when a member begins/ends performing operations on the database
|
||||
void setDbWorkingState( const bool& state );
|
||||
void setDbWorkingState( const bool state );
|
||||
|
||||
|
||||
//////////////////
|
||||
//// CRAPTABS ////
|
||||
//////////////////
|
||||
|
||||
void switchMainTab( const int& new_index );
|
||||
void switchMainTab( const int new_index );
|
||||
|
||||
|
||||
/////////////////
|
||||
|
@ -795,7 +795,7 @@ private:
|
|||
QTimer *crapview_timer = new QTimer();
|
||||
|
||||
// change tab
|
||||
void switchStatsTab( const int& new_index );
|
||||
void switchStatsTab( const int new_index );
|
||||
|
||||
//! Queries the available dates from the db and apply to the tabs
|
||||
/*!
|
||||
|
@ -812,13 +812,13 @@ private:
|
|||
|
||||
// count
|
||||
QString count_fld;
|
||||
void startCountDrawing();
|
||||
void makeStatsCount();
|
||||
void resetStatsCountButtons();
|
||||
|
||||
// globals
|
||||
QString glob_ws;
|
||||
void globalsButtonClicked();
|
||||
void resetStatsGlobals();
|
||||
void makeStatsGlob();
|
||||
void resetStatsGlob();
|
||||
|
||||
|
||||
/////////////////
|
||||
|
@ -829,7 +829,7 @@ private:
|
|||
|
||||
void refreshChartsPreview();
|
||||
|
||||
const int getIisLogsModule();
|
||||
const int getIisLogsModule() const;
|
||||
|
||||
|
||||
//////////////////
|
||||
|
|
|
@ -20,7 +20,7 @@ Craphelp::~Craphelp()
|
|||
}
|
||||
|
||||
|
||||
const std::unordered_map<std::string, QString> Craphelp::getColorScheme( const int& scheme_id )
|
||||
const std::unordered_map<std::string, QString> Craphelp::getColorScheme( const int& scheme_id ) const
|
||||
{
|
||||
switch ( scheme_id ) {
|
||||
case 0:
|
||||
|
@ -72,7 +72,7 @@ const std::unordered_map<std::string, QString> Craphelp::getColorScheme( const i
|
|||
}
|
||||
|
||||
|
||||
void Craphelp::helpLogsFormat( const std::string& path, const QFont& font, const int &color_scheme_id )
|
||||
void Craphelp::helpLogsFormat( const std::string& path, const QFont& font, const int &color_scheme_id ) const
|
||||
{
|
||||
std::unordered_map<std::string, QString> color_scheme = this->getColorScheme( color_scheme_id );
|
||||
std::string aux;
|
||||
|
|
|
@ -28,12 +28,12 @@ public:
|
|||
\param font The font to be used
|
||||
\param color_scheme_id The ID of the color-scheme to be used
|
||||
*/
|
||||
void helpLogsFormat( const std::string& path, const QFont& font, const int& color_scheme_id );
|
||||
void helpLogsFormat( const std::string& path, const QFont& font, const int& color_scheme_id ) const;
|
||||
|
||||
private:
|
||||
Ui::Craphelp *ui;
|
||||
|
||||
const std::unordered_map<std::string, QString> getColorScheme( const int& scheme_id );
|
||||
const std::unordered_map<std::string, QString> getColorScheme( const int& scheme_id ) const;
|
||||
};
|
||||
|
||||
#endif // CRAPHELP_H
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "modules/exceptions.h"
|
||||
|
||||
#include <unordered_map> // leave this for OSX
|
||||
#include <unordered_map> // leave this here for OSX
|
||||
|
||||
#include <QFontDatabase>
|
||||
|
||||
|
@ -47,7 +47,7 @@ Crapinfo::~Crapinfo()
|
|||
}
|
||||
|
||||
|
||||
void Crapinfo::getStyleSheet( QString& stylesheet, const int& theme_id )
|
||||
void Crapinfo::getStyleSheet( QString& stylesheet, const int& theme_id ) const
|
||||
{
|
||||
std::unordered_map<std::string, QString> style;
|
||||
switch ( theme_id ) {
|
||||
|
|
|
@ -27,13 +27,13 @@ public:
|
|||
\param logdoc_path The path of the additional resources folder
|
||||
\param parent The parent Widget
|
||||
*/
|
||||
Crapinfo( const int& window_theme_id, const QString& version, const QString& exec_path, const QString& conf_path, const QString& logdoc_path, QWidget* parent=nullptr );
|
||||
explicit Crapinfo( const int& window_theme_id, const QString& version, const QString& exec_path, const QString& conf_path, const QString& logdoc_path, QWidget* parent=nullptr );
|
||||
~Crapinfo();
|
||||
|
||||
private:
|
||||
Ui::Crapinfo *ui;
|
||||
|
||||
void getStyleSheet( QString& stylesheet, const int& theme_id );
|
||||
void getStyleSheet( QString& stylesheet, const int& theme_id ) const;
|
||||
};
|
||||
|
||||
#endif // CRAPINFO_H
|
||||
|
|
|
@ -82,7 +82,7 @@ Craplog::Craplog()
|
|||
|
||||
//////////////////
|
||||
//// SETTINGS ////
|
||||
const int& Craplog::getDialogsLevel()
|
||||
const int& Craplog::getDialogsLevel() const
|
||||
{
|
||||
return this->dialogs_level;
|
||||
}
|
||||
|
@ -92,11 +92,11 @@ void Craplog::setDialogsLevel( const int& new_level )
|
|||
this->hashOps.setDialogLevel( new_level );
|
||||
}
|
||||
|
||||
const std::string& Craplog::getStatsDatabasePath()
|
||||
const std::string& Craplog::getStatsDatabasePath() const
|
||||
{
|
||||
return this->db_stats_path;
|
||||
}
|
||||
const std::string& Craplog::getHashesDatabasePath()
|
||||
const std::string& Craplog::getHashesDatabasePath() const
|
||||
{
|
||||
return this->db_hashes_path;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ void Craplog::setHashesDatabasePath( const std::string& path )
|
|||
this->db_hashes_path = path + "/hashes.db";
|
||||
}
|
||||
|
||||
const long& Craplog::getWarningSize()
|
||||
const long& Craplog::getWarningSize() const
|
||||
{
|
||||
return this->warning_size;
|
||||
}
|
||||
|
@ -123,11 +123,11 @@ void Craplog::setWarningSize(const long& new_size )
|
|||
|
||||
////////////////////
|
||||
//// WARN/BLACK ////
|
||||
const bool& Craplog::isBlacklistUsed( const int& web_server_id, const int& log_field_id )
|
||||
const bool& Craplog::isBlacklistUsed( const int& web_server_id, const int& log_field_id ) const
|
||||
{
|
||||
return this->blacklists.at( web_server_id ).at( log_field_id ).used;
|
||||
}
|
||||
const bool& Craplog::isWarnlistUsed( const int& web_server_id, const int& log_field_id )
|
||||
const bool& Craplog::isWarnlistUsed( const int& web_server_id, const int& log_field_id ) const
|
||||
{
|
||||
return this->warnlists.at( web_server_id ).at( log_field_id ).used;
|
||||
}
|
||||
|
@ -141,11 +141,11 @@ void Craplog::setWarnlistUsed( const int& web_server_id, const int& log_field_id
|
|||
this->warnlists.at( web_server_id ).at( log_field_id ).used = used;
|
||||
}
|
||||
|
||||
const std::vector<std::string>& Craplog::getBlacklist( const int& web_server_id, const int& log_field_id )
|
||||
const std::vector<std::string>& Craplog::getBlacklist( const int& web_server_id, const int& log_field_id ) const
|
||||
{
|
||||
return this->blacklists.at( web_server_id ).at( log_field_id ).list;
|
||||
}
|
||||
const std::vector<std::string>& Craplog::getWarnlist( const int& web_server_id, const int& log_field_id )
|
||||
const std::vector<std::string>& Craplog::getWarnlist( const int& web_server_id, const int& log_field_id ) const
|
||||
{
|
||||
return this->warnlists.at( web_server_id ).at( log_field_id ).list;
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ const int Craplog::warnlistMoveDown( const int& web_server_id, const int& log_fi
|
|||
return i;
|
||||
}
|
||||
|
||||
const std::string Craplog::sanitizeBWitem( const int& log_field_id, const std::string& new_item )
|
||||
const std::string Craplog::sanitizeBWitem( const int& log_field_id, const std::string& new_item ) const
|
||||
{
|
||||
std::string sanitized_item;
|
||||
switch ( log_field_id ) {
|
||||
|
@ -298,13 +298,13 @@ const std::string Craplog::sanitizeBWitem( const int& log_field_id, const std::s
|
|||
/////////////////
|
||||
//// FORMATS ////
|
||||
// get the logs format string
|
||||
const std::string& Craplog::getLogsFormatString( const int& web_server_id )
|
||||
const std::string& Craplog::getLogsFormatString( const int& web_server_id ) const
|
||||
{
|
||||
return this->logs_format_strings.at( web_server_id );
|
||||
}
|
||||
|
||||
// get the logs format
|
||||
const FormatOps::LogsFormat& Craplog::getLogsFormat(const int& web_server_id )
|
||||
const FormatOps::LogsFormat& Craplog::getLogsFormat(const int& web_server_id ) const
|
||||
{
|
||||
return this->logs_formats.at( web_server_id );
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ const bool Craplog::setIisLogFormat( const std::string& format_string, const int
|
|||
return success;
|
||||
}
|
||||
|
||||
const QString Craplog::getLogsFormatSample( const int& web_server_id )
|
||||
const QString Craplog::getLogsFormatSample( const int& web_server_id ) const
|
||||
{
|
||||
QString sample;
|
||||
if ( web_server_id == this->APACHE_ID ) {
|
||||
|
@ -387,7 +387,7 @@ void Craplog::setCurrentWSID( const int& web_server_id )
|
|||
this->setCurrentLogFormat();
|
||||
}
|
||||
|
||||
const int& Craplog::getCurrentWSID()
|
||||
const int& Craplog::getCurrentWSID() const
|
||||
{
|
||||
return this->current_WS;
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ void Craplog::setCurrentLogFormat()
|
|||
}
|
||||
|
||||
// get the current access logs format
|
||||
const FormatOps::LogsFormat& Craplog::getCurrentLogFormat()
|
||||
const FormatOps::LogsFormat& Craplog::getCurrentLogFormat() const
|
||||
{
|
||||
return this->current_LF;
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ const FormatOps::LogsFormat& Craplog::getCurrentLogFormat()
|
|||
|
||||
///////////////////
|
||||
//// LOGS PATH ////
|
||||
const std::string& Craplog::getLogsPath( const int& web_server )
|
||||
const std::string& Craplog::getLogsPath( const int& web_server ) const
|
||||
{
|
||||
return this->logs_paths.at( web_server );
|
||||
}
|
||||
|
@ -420,12 +420,12 @@ void Craplog::setLogsPath( const int& web_server, const std::string& new_path )
|
|||
///////////////////
|
||||
//// LOGS LIST ////
|
||||
// return the size of the list
|
||||
const int Craplog::getLogsListSize() {
|
||||
const int Craplog::getLogsListSize() const {
|
||||
return this->logs_list.size();
|
||||
}
|
||||
|
||||
// return the list. rescan if fresh is true
|
||||
const std::vector<Craplog::LogFile>& Craplog::getLogsList( const bool& fresh )
|
||||
const std::vector<Craplog::LogFile>& Craplog::getLogsList( const bool fresh )
|
||||
{
|
||||
if ( fresh ) {
|
||||
this->scanLogsDir();
|
||||
|
@ -435,7 +435,7 @@ const std::vector<Craplog::LogFile>& Craplog::getLogsList( const bool& fresh )
|
|||
|
||||
|
||||
// return the path of the file matching the given name
|
||||
const Craplog::LogFile& Craplog::getLogFileItem( const QString& file_name )
|
||||
const Craplog::LogFile& Craplog::getLogFileItem( const QString& file_name ) const
|
||||
{
|
||||
for ( const Craplog::LogFile& item : this->logs_list ) {
|
||||
if ( item.name == file_name ) {
|
||||
|
@ -518,7 +518,7 @@ void Craplog::scanLogsDir()
|
|||
continue;
|
||||
}
|
||||
|
||||
LogOps::LogType log_type = this->logOps.defineFileType(
|
||||
const LogOps::LogType log_type = this->logOps.defineFileType(
|
||||
content, this->logs_formats.at( this->current_WS ) );
|
||||
content.clear();
|
||||
if ( log_type == LogOps::LogType::Failed ) {
|
||||
|
@ -537,7 +537,7 @@ void Craplog::scanLogsDir()
|
|||
|
||||
std::string hash;
|
||||
try {
|
||||
hash = this->hashOps.digestFile( path );
|
||||
this->hashOps.digestFile( path, hash );
|
||||
} catch ( GenericException& e ) {
|
||||
// failed to digest
|
||||
DialogSec::errGeneric( e.what() );
|
||||
|
@ -573,7 +573,7 @@ void Craplog::changeIisLogsBaseNames( const int& module_id )
|
|||
throw GenericException( "Unexpected LogFormatModule ID: "+std::to_string( module_id ), true ); // leave un-catched
|
||||
}
|
||||
}
|
||||
const bool Craplog::isFileNameValid( const std::string& name )
|
||||
const bool Craplog::isFileNameValid( const std::string& name ) const
|
||||
{
|
||||
bool valid = true;
|
||||
if ( this->logs_base_names.at( this->current_WS ).starts != "" ) {
|
||||
|
@ -686,21 +686,21 @@ void Craplog::stopWorking()
|
|||
this->working = false;
|
||||
this->parsing = false;
|
||||
}
|
||||
const bool& Craplog::isWorking()
|
||||
const bool& Craplog::isWorking() const
|
||||
{
|
||||
return this->working;
|
||||
}
|
||||
const bool& Craplog::isParsing()
|
||||
const bool& Craplog::isParsing() const
|
||||
{
|
||||
return this->parsing;
|
||||
}
|
||||
const bool& Craplog::editedDatabase()
|
||||
const bool& Craplog::editedDatabase() const
|
||||
{
|
||||
return this->db_edited;
|
||||
}
|
||||
|
||||
// performances
|
||||
const unsigned int &Craplog::getPerfSize()
|
||||
const unsigned int &Craplog::getPerfSize() const
|
||||
{
|
||||
return this->perf_size;
|
||||
}
|
||||
|
@ -709,7 +709,7 @@ const unsigned int &Craplog::getPerfSize()
|
|||
this->perf_size += size;
|
||||
this->parsed_size += size;
|
||||
}*/
|
||||
const unsigned int &Craplog::getTotalSize()
|
||||
const unsigned int &Craplog::getTotalSize() const
|
||||
{
|
||||
return this->total_size;
|
||||
}
|
||||
|
@ -717,7 +717,7 @@ const unsigned int &Craplog::getTotalSize()
|
|||
{
|
||||
return this->parsed_size;
|
||||
}*/
|
||||
const unsigned int &Craplog::getParsedLines()
|
||||
const unsigned int &Craplog::getParsedLines() const
|
||||
{
|
||||
return this->parsed_lines;
|
||||
}
|
||||
|
@ -965,7 +965,7 @@ void Craplog::joinLogLines()
|
|||
|
||||
void Craplog::parseLogLines()
|
||||
{
|
||||
if ( this-> proceed && this->logs_lines.size() > 0 ) {
|
||||
if ( this->proceed && this->logs_lines.size() > 0 ) {
|
||||
this->logOps.parseLines(
|
||||
this->data_collection,
|
||||
this->logs_lines,
|
||||
|
@ -1071,7 +1071,7 @@ void Craplog::storeLogLines()
|
|||
}
|
||||
|
||||
|
||||
const QString Craplog::printableSize( const unsigned int& bytes )
|
||||
const QString Craplog::printableSize( const unsigned int& bytes ) const
|
||||
{
|
||||
std::string size_str, size_sfx=" B";
|
||||
float size = (float)bytes;
|
||||
|
@ -1116,7 +1116,7 @@ const QString Craplog::printableSize( const unsigned int& bytes )
|
|||
}
|
||||
|
||||
|
||||
void Craplog::makeChart( const QChart::ChartTheme& theme, const std::unordered_map<std::string, QFont>& fonts, QChartView* size_chart )
|
||||
void Craplog::makeChart( const QChart::ChartTheme& theme, const std::unordered_map<std::string, QFont>& fonts, QChartView* size_chart ) const
|
||||
{
|
||||
const QString
|
||||
size_chart_name = TR::tr("Logs Size Breakdown"),
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
class Craplog
|
||||
{
|
||||
public:
|
||||
Craplog();
|
||||
explicit Craplog();
|
||||
|
||||
//! Main work method
|
||||
/*!
|
||||
|
@ -33,7 +33,7 @@ public:
|
|||
//// DIALOGS ////
|
||||
|
||||
//! Returns the Dialogs level
|
||||
const int& getDialogsLevel();
|
||||
const int& getDialogsLevel() const;
|
||||
|
||||
//! Sets the new Dialogs level
|
||||
void setDialogsLevel( const int& new_level );
|
||||
|
@ -42,10 +42,10 @@ public:
|
|||
//// DATABASES ////
|
||||
|
||||
//! Returns the path of the logs Collection database
|
||||
const std::string& getStatsDatabasePath();
|
||||
const std::string& getStatsDatabasePath() const;
|
||||
|
||||
//! Returns the path of the log files' Hashes database
|
||||
const std::string& getHashesDatabasePath();
|
||||
const std::string& getHashesDatabasePath() const;
|
||||
|
||||
//! Sets the new path for the logs Collection database
|
||||
/*!
|
||||
|
@ -73,14 +73,14 @@ public:
|
|||
/*!
|
||||
\return The Web Server ID
|
||||
*/
|
||||
const int& getCurrentWSID();
|
||||
const int& getCurrentWSID() const;
|
||||
|
||||
//! Returns the currently used LogsFormat
|
||||
/*!
|
||||
\return The LogsFormat
|
||||
\see FormatOps::LogsFormat
|
||||
*/
|
||||
const FormatOps::LogsFormat& getCurrentLogFormat();
|
||||
const FormatOps::LogsFormat& getCurrentLogFormat() const;
|
||||
|
||||
|
||||
////////////////////
|
||||
|
@ -91,14 +91,17 @@ public:
|
|||
\param web_server The ID of the Web Server
|
||||
\return The path of the logs' folder
|
||||
*/
|
||||
const std::string& getLogsPath( const int& web_server );
|
||||
const std::string& getLogsPath( const int& web_server ) const;
|
||||
|
||||
//! Sets a new path for the given Web Server to search the logs in
|
||||
/*!
|
||||
\param web_server The ID of the Web Server
|
||||
\param new_path The new path
|
||||
*/
|
||||
void setLogsPath( const int& web_server, const std::string& new_path );
|
||||
void setLogsPath(
|
||||
const int& web_server,
|
||||
const std::string& new_path
|
||||
);
|
||||
|
||||
|
||||
///////////////////
|
||||
|
@ -120,7 +123,7 @@ public:
|
|||
\return Wheter it does respect the criterions or not
|
||||
\see LogName
|
||||
*/
|
||||
const bool isFileNameValid( const std::string& name );
|
||||
const bool isFileNameValid( const std::string& name ) const;
|
||||
|
||||
|
||||
///////////////////
|
||||
|
@ -132,14 +135,14 @@ public:
|
|||
\return The list of log files
|
||||
\see LogFile, logs_list, scanLogsDir()
|
||||
*/
|
||||
const std::vector<LogFile>& getLogsList( const bool& fresh=false );
|
||||
const std::vector<LogFile>& getLogsList( const bool fresh=false );
|
||||
|
||||
//! Returns the amount of log files in the list
|
||||
/*!
|
||||
\return The number of files actually in the list
|
||||
\see logs_list
|
||||
*/
|
||||
const int getLogsListSize();
|
||||
const int getLogsListSize() const;
|
||||
|
||||
//! Returns the LogFile instance of the given file
|
||||
/*!
|
||||
|
@ -148,7 +151,7 @@ public:
|
|||
\throw GenericException
|
||||
\see LogFile, logs_list
|
||||
*/
|
||||
const LogFile& getLogFileItem( const QString& file_name );
|
||||
const LogFile& getLogFileItem( const QString& file_name ) const;
|
||||
|
||||
/*const std::string& getLogFilePath( const QString& file_name );*/
|
||||
|
||||
|
@ -195,7 +198,7 @@ public:
|
|||
\return The format string
|
||||
\see FormatOps::LogsFormat
|
||||
*/
|
||||
const std::string& getLogsFormatString( const int& web_server_id );
|
||||
const std::string& getLogsFormatString( const int& web_server_id ) const;
|
||||
|
||||
//! Returns the LogsFormat currently set for the given Web Server
|
||||
/*!
|
||||
|
@ -203,7 +206,7 @@ public:
|
|||
\return The LogsFormat instance
|
||||
\see FormatOps::LogsFormat
|
||||
*/
|
||||
const FormatOps::LogsFormat& getLogsFormat( const int& web_server_id );
|
||||
const FormatOps::LogsFormat& getLogsFormat( const int& web_server_id ) const;
|
||||
|
||||
//! Returns a sample log line for the given Web Server using the relative LogsFormat
|
||||
/*!
|
||||
|
@ -212,7 +215,7 @@ public:
|
|||
\throw WebServerException
|
||||
\see FormatOps::getApacheLogSample(), FormatOps::getNginxLogSample(), FormatOps::getIisLogSample()
|
||||
*/
|
||||
const QString getLogsFormatSample( const int& web_server_id );
|
||||
const QString getLogsFormatSample( const int& web_server_id ) const;
|
||||
|
||||
|
||||
|
||||
|
@ -220,7 +223,7 @@ public:
|
|||
//// WARNING SIZE ////
|
||||
|
||||
//! Returns the currently set warning size for the log files
|
||||
const long& getWarningSize();
|
||||
const long& getWarningSize() const;
|
||||
|
||||
//! Sets the new warning size for the log files
|
||||
void setWarningSize( const long& new_size );
|
||||
|
@ -251,7 +254,7 @@ public:
|
|||
\return Whether the list is used or not
|
||||
\see BWlist
|
||||
*/
|
||||
const bool& isBlacklistUsed( const int& web_server_id, const int& log_field_id );
|
||||
const bool& isBlacklistUsed( const int& web_server_id, const int& log_field_id ) const;
|
||||
|
||||
//! Returns whether the relative warnlist is set to be used or not
|
||||
/*!
|
||||
|
@ -260,7 +263,7 @@ public:
|
|||
\return Whether the list is used or not
|
||||
\see BWlist
|
||||
*/
|
||||
const bool& isWarnlistUsed( const int& web_server_id, const int& log_field_id );
|
||||
const bool& isWarnlistUsed( const int& web_server_id, const int& log_field_id ) const;
|
||||
|
||||
//! Sets the relative blacklist to be used or not
|
||||
/*!
|
||||
|
@ -287,7 +290,7 @@ public:
|
|||
\return The list of items in the given blacklist
|
||||
\see BWlist
|
||||
*/
|
||||
const std::vector<std::string>& getBlacklist( const int& web_server_id, const int& log_field_id );
|
||||
const std::vector<std::string>& getBlacklist( const int& web_server_id, const int& log_field_id ) const;
|
||||
|
||||
//! Returns the relative items list
|
||||
/*!
|
||||
|
@ -296,7 +299,7 @@ public:
|
|||
\return The list of items in the givenwarnlist
|
||||
\see BWlist
|
||||
*/
|
||||
const std::vector<std::string>& getWarnlist( const int& web_server_id, const int& log_field_id );
|
||||
const std::vector<std::string>& getWarnlist( const int& web_server_id, const int& log_field_id ) const;
|
||||
|
||||
//! Sets the relative items list
|
||||
/*!
|
||||
|
@ -393,7 +396,7 @@ public:
|
|||
//// WORK ////
|
||||
|
||||
//! Returns whether the database has been edited or not during the process
|
||||
const bool& editedDatabase();
|
||||
const bool& editedDatabase() const;
|
||||
|
||||
//! Various checks to be made before starting a new process
|
||||
/*!
|
||||
|
@ -407,10 +410,10 @@ public:
|
|||
void clearDataCollection();
|
||||
|
||||
//! Returns whether the process is still running or not
|
||||
const bool& isWorking();
|
||||
const bool& isWorking() const;
|
||||
|
||||
//! Returns whether the process is still parsing or not
|
||||
const bool& isParsing();
|
||||
const bool& isParsing() const;
|
||||
|
||||
|
||||
//////////////////////
|
||||
|
@ -431,13 +434,13 @@ public:
|
|||
/*void sumPerfSize( const unsigned& size );*/
|
||||
|
||||
//! Returns the size to be displayed in the main window
|
||||
const unsigned int& getPerfSize();
|
||||
const unsigned int& getPerfSize() const;
|
||||
|
||||
//! Returns the total logs size
|
||||
const unsigned int& getTotalSize();
|
||||
const unsigned int& getTotalSize() const;
|
||||
|
||||
//! Returns the parsed logs lines
|
||||
const unsigned int& getParsedLines();
|
||||
const unsigned int& getParsedLines() const;
|
||||
|
||||
/*const unsigned int& getParsedSize();*/
|
||||
|
||||
|
@ -448,7 +451,7 @@ public:
|
|||
\param size_chart The widget which will display the chart
|
||||
\see DonutBreakdown
|
||||
*/
|
||||
void makeChart( const QChart::ChartTheme& theme, const std::unordered_map<std::string, QFont>& fonts, QChartView* size_chart );
|
||||
void makeChart( const QChart::ChartTheme& theme, const std::unordered_map<std::string, QFont>& fonts, QChartView* size_chart ) const;
|
||||
|
||||
|
||||
|
||||
|
@ -513,7 +516,7 @@ private:
|
|||
\return The string to be displayed
|
||||
\see makeChart()
|
||||
*/
|
||||
const QString printableSize( const unsigned int& bytes );
|
||||
const QString printableSize( const unsigned int& bytes ) const;
|
||||
|
||||
////////////////////
|
||||
//// LOGS ITEMS ////
|
||||
|
@ -582,7 +585,7 @@ private:
|
|||
\throw BWlistException, GenericException
|
||||
\see BWlist
|
||||
*/
|
||||
const std::string sanitizeBWitem( const int& log_field_id, const std::string& new_item );
|
||||
const std::string sanitizeBWitem( const int& log_field_id, const std::string& new_item ) const;
|
||||
|
||||
|
||||
////////////////////
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
class DateTimeOps
|
||||
{
|
||||
public:
|
||||
DateTimeOps();
|
||||
explicit DateTimeOps();
|
||||
|
||||
//! Returns a standardized list of items representing the given date and time
|
||||
/*!
|
||||
|
|
|
@ -16,7 +16,7 @@ class DonutBreakdown : public QChart
|
|||
{
|
||||
public:
|
||||
|
||||
DonutBreakdown( QGraphicsItem* parent=nullptr, Qt::WindowFlags wFlags={} );
|
||||
explicit DonutBreakdown( QGraphicsItem* parent=nullptr, Qt::WindowFlags wFlags={} );
|
||||
|
||||
//! Adds a slice to the donut
|
||||
/*!
|
||||
|
@ -52,7 +52,7 @@ class MainSlice : public QPieSlice
|
|||
|
||||
public:
|
||||
|
||||
MainSlice( QPieSeries *breakdownSeries, QObject *parent=0 );
|
||||
explicit MainSlice( QPieSeries *breakdownSeries, QObject *parent=0 );
|
||||
|
||||
//! Returns the series
|
||||
QPieSeries *breakdownSeries() const;
|
||||
|
|
|
@ -12,7 +12,7 @@ FormatOps::FormatOps()
|
|||
|
||||
|
||||
// count the new lines
|
||||
const int FormatOps::countNewLines( const std::string& initial, const std::string& final, const std::vector<std::string>& separators )
|
||||
const int FormatOps::countNewLines( const std::string& initial, const std::string& final, const std::vector<std::string>& separators ) const
|
||||
{
|
||||
int nl = 0;
|
||||
nl += StringOps::count( initial, "\n" );
|
||||
|
@ -25,7 +25,7 @@ const int FormatOps::countNewLines( const std::string& initial, const std::strin
|
|||
|
||||
|
||||
// process escapes like apache
|
||||
const std::string FormatOps::parseApacheEscapes( const std::string& string , const bool& strftime )
|
||||
const std::string FormatOps::parseApacheEscapes( const std::string& string , const bool strftime ) const
|
||||
{
|
||||
int i = 0,
|
||||
max = string.size()-1;
|
||||
|
@ -122,7 +122,7 @@ const std::string FormatOps::parseApacheEscapes( const std::string& string , con
|
|||
}
|
||||
|
||||
// process escapes like nginx
|
||||
const std::string FormatOps::parseNginxEscapes( const std::string& string )
|
||||
const std::string FormatOps::parseNginxEscapes( const std::string& string ) const
|
||||
{
|
||||
int i = 0,
|
||||
max = string.size()-1;
|
||||
|
@ -169,7 +169,7 @@ const std::string FormatOps::parseNginxEscapes( const std::string& string )
|
|||
}
|
||||
|
||||
// find where the field ends
|
||||
const size_t FormatOps::findNginxFieldEnd( const std::string& string, const int& start )
|
||||
const size_t FormatOps::findNginxFieldEnd( const std::string& string, const int start ) const
|
||||
{
|
||||
size_t stop=start;
|
||||
const int max=string.size()-1;
|
||||
|
@ -187,7 +187,7 @@ const size_t FormatOps::findNginxFieldEnd( const std::string& string, const int&
|
|||
}
|
||||
|
||||
// check the given format string for unwanted characters
|
||||
void FormatOps::checkIisString( const std::string& string )
|
||||
void FormatOps::checkIisString( const std::string& string ) const
|
||||
{
|
||||
for ( const char& chr : string ) {
|
||||
if ( !(StringOps::isAlnum( chr ) || chr == ' ' || chr == '-' || chr == ',' || chr == ':' || chr == '(' || chr == ')' || chr == '[' || chr == ']') ) {
|
||||
|
@ -200,7 +200,7 @@ void FormatOps::checkIisString( const std::string& string )
|
|||
|
||||
|
||||
|
||||
const FormatOps::LogsFormat FormatOps::processApacheFormatString( const std::string& f_str )
|
||||
const FormatOps::LogsFormat FormatOps::processApacheFormatString( const std::string& f_str ) const
|
||||
{
|
||||
const auto &f_map = this->APACHE_ALF;
|
||||
const auto &f_map_v = this->APACHE_ALF_V;
|
||||
|
@ -482,7 +482,7 @@ const FormatOps::LogsFormat FormatOps::processApacheFormatString( const std::str
|
|||
|
||||
}
|
||||
// sample
|
||||
const QString FormatOps::getApacheLogSample( const LogsFormat& log_format )
|
||||
const QString FormatOps::getApacheLogSample( const LogsFormat& log_format ) const
|
||||
{
|
||||
QString sample = "";
|
||||
const std::unordered_map<std::string, QString>& map = this->APACHE_ALF_SAMPLES;
|
||||
|
@ -505,7 +505,7 @@ const QString FormatOps::getApacheLogSample( const LogsFormat& log_format )
|
|||
|
||||
|
||||
|
||||
const FormatOps::LogsFormat FormatOps::processNginxFormatString( const std::string& f_str )
|
||||
const FormatOps::LogsFormat FormatOps::processNginxFormatString( const std::string& f_str ) const
|
||||
{
|
||||
const auto& f_map = this->NGINX_ALF;
|
||||
|
||||
|
@ -583,7 +583,7 @@ const FormatOps::LogsFormat FormatOps::processNginxFormatString( const std::stri
|
|||
};
|
||||
}
|
||||
// sample
|
||||
const QString FormatOps::getNginxLogSample( const LogsFormat& log_format )
|
||||
const QString FormatOps::getNginxLogSample( const LogsFormat& log_format ) const
|
||||
{
|
||||
QString sample = "";
|
||||
const std::unordered_map<std::string, QString>& map = this->NGINX_ALF_SAMPLES;
|
||||
|
@ -606,7 +606,7 @@ const QString FormatOps::getNginxLogSample( const LogsFormat& log_format )
|
|||
|
||||
|
||||
|
||||
const FormatOps::LogsFormat FormatOps::processIisFormatString( const std::string& f_str, const int& l_mod )
|
||||
const FormatOps::LogsFormat FormatOps::processIisFormatString( const std::string& f_str, const int& l_mod ) const
|
||||
{
|
||||
this->checkIisString( f_str );
|
||||
std::string initial="", final="";
|
||||
|
@ -683,7 +683,7 @@ const FormatOps::LogsFormat FormatOps::processIisFormatString( const std::string
|
|||
};
|
||||
}
|
||||
// sample
|
||||
const QString FormatOps::getIisLogSample( const LogsFormat& log_format )
|
||||
const QString FormatOps::getIisLogSample( const LogsFormat& log_format ) const
|
||||
{
|
||||
QString sample = "";
|
||||
const std::unordered_map<std::string, QString>& map = this->IIS_ALF_SAMPLES;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
class FormatOps
|
||||
{
|
||||
public:
|
||||
FormatOps();
|
||||
explicit FormatOps();
|
||||
|
||||
//! Structure which holds informations about a log format
|
||||
struct LogsFormat {
|
||||
|
@ -35,7 +35,7 @@ public:
|
|||
\throw LogFormatException
|
||||
\see LogsFormat
|
||||
*/
|
||||
const LogsFormat processApacheFormatString( const std::string& format_string );
|
||||
const LogsFormat processApacheFormatString( const std::string& format_string ) const;
|
||||
|
||||
//! Processes the given string to extrapolate the format for Nginx
|
||||
/*!
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
\throw LogFormatException
|
||||
\see LogsFormat
|
||||
*/
|
||||
const LogsFormat processNginxFormatString( const std::string& format_string );
|
||||
const LogsFormat processNginxFormatString( const std::string& format_string ) const;
|
||||
|
||||
//! Processes the given string to extrapolate the format for the IIS
|
||||
/*!
|
||||
|
@ -54,7 +54,7 @@ public:
|
|||
\throw LogFormatException
|
||||
\see LogsFormat
|
||||
*/
|
||||
const LogsFormat processIisFormatString( const std::string& format_string, const int& log_module );
|
||||
const LogsFormat processIisFormatString( const std::string& format_string, const int& log_module ) const;
|
||||
|
||||
|
||||
/////////////////
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
\return The sample line
|
||||
\see LogsFormat, Craplog::getLogsFormatSample()
|
||||
*/
|
||||
const QString getApacheLogSample( const LogsFormat& log_format );
|
||||
const QString getApacheLogSample( const LogsFormat& log_format ) const;
|
||||
|
||||
//! Returns a log line sample based on the given format
|
||||
/*!
|
||||
|
@ -74,7 +74,7 @@ public:
|
|||
\return The sample line
|
||||
\see LogsFormat, Craplog::getLogsFormatSample()
|
||||
*/
|
||||
const QString getNginxLogSample( const LogsFormat& log_format );
|
||||
const QString getNginxLogSample( const LogsFormat& log_format ) const;
|
||||
|
||||
//! Returns a log line sample based on the given format
|
||||
/*!
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
\return The sample line
|
||||
\see LogsFormat, Craplog::getLogsFormatSample()
|
||||
*/
|
||||
const QString getIisLogSample( const LogsFormat& log_format );
|
||||
const QString getIisLogSample( const LogsFormat& log_format ) const;
|
||||
|
||||
|
||||
private:
|
||||
|
@ -96,7 +96,7 @@ private:
|
|||
\throw LogFormatException
|
||||
\see processApacheFormatString()
|
||||
*/
|
||||
const std::string parseApacheEscapes( const std::string& string, const bool& strftime=false );
|
||||
const std::string parseApacheEscapes( const std::string& string, const bool strftime=false ) const;
|
||||
|
||||
//! Parses the escapes (backslashes) and returns the resulting string
|
||||
/*!
|
||||
|
@ -106,7 +106,7 @@ private:
|
|||
\throw LogFormatException
|
||||
\see processNginxFormatString()
|
||||
*/
|
||||
const std::string parseNginxEscapes( const std::string& string );
|
||||
const std::string parseNginxEscapes( const std::string& string ) const;
|
||||
|
||||
//! Conuts how many new lines are there in the format
|
||||
/*!
|
||||
|
@ -117,7 +117,7 @@ private:
|
|||
\return The number of new lines in a single log line
|
||||
\see LogsFormat, processApacheFormatString(), processNginxFormatString()
|
||||
*/
|
||||
const int countNewLines( const std::string& initial, const std::string& final, const std::vector<std::string>& separators );
|
||||
const int countNewLines( const std::string& initial, const std::string& final, const std::vector<std::string>& separators ) const;
|
||||
|
||||
//! Finds the end of a Nginx log field
|
||||
/*!
|
||||
|
@ -126,7 +126,7 @@ private:
|
|||
\return The ending poin of the field in the string
|
||||
\see processNginxFormatString()
|
||||
*/
|
||||
const size_t findNginxFieldEnd( const std::string& string, const int& start );
|
||||
const size_t findNginxFieldEnd( const std::string& string, const int start ) const;
|
||||
|
||||
//! Checks whether the format string contains invalid characters or not
|
||||
/*!
|
||||
|
@ -134,7 +134,7 @@ private:
|
|||
\throw LogFormatException
|
||||
\see processIisFormatString
|
||||
*/
|
||||
void checkIisString( const std::string& string );
|
||||
void checkIisString( const std::string& string ) const;
|
||||
|
||||
|
||||
/////////////////
|
||||
|
|
|
@ -24,7 +24,7 @@ void HashOps::setDialogLevel( const int& new_level )
|
|||
|
||||
|
||||
// reads the database holding the already used hashes
|
||||
bool HashOps::loadUsedHashesLists( const std::string& db_path )
|
||||
const bool HashOps::loadUsedHashesLists( const std::string& db_path )
|
||||
{
|
||||
bool successful = true;
|
||||
const QString db_name = QString::fromStdString( db_path.substr( db_path.find_last_of( '/' ) + 1 ) );
|
||||
|
@ -74,7 +74,7 @@ bool HashOps::loadUsedHashesLists( const std::string& db_path )
|
|||
|
||||
|
||||
// returns the hash
|
||||
std::string HashOps::digestFile( const std::string& file_path )
|
||||
void HashOps::digestFile( const std::string& file_path, std::string& hash ) const
|
||||
{
|
||||
std::string content;
|
||||
try {
|
||||
|
@ -122,12 +122,12 @@ std::string HashOps::digestFile( const std::string& file_path )
|
|||
content.clear();
|
||||
uint8_t * digest = sha.digest();
|
||||
// return the hex digest
|
||||
return SHA256::toString(digest);
|
||||
hash.append( SHA256::toString(digest) );
|
||||
}
|
||||
|
||||
|
||||
// check if the given hash is from a file which has been used already
|
||||
bool HashOps::hasBeenUsed( const std::string &file_hash, const int& web_server_id)
|
||||
const bool HashOps::hasBeenUsed( const std::string &file_hash, const int& web_server_id) const
|
||||
{
|
||||
bool found = false;
|
||||
for ( const std::string &hash : this->hashes.at( web_server_id ) ) {
|
||||
|
@ -141,7 +141,7 @@ bool HashOps::hasBeenUsed( const std::string &file_hash, const int& web_server_i
|
|||
|
||||
|
||||
// insert the given hash/es in the relative list
|
||||
bool HashOps::insertUsedHash( QSqlQuery& query, const QString& db_name, const std::string& hash, const int& web_server_id )
|
||||
const bool HashOps::insertUsedHash( QSqlQuery& query, const QString& db_name, const std::string& hash, const int& web_server_id )
|
||||
{
|
||||
bool successful = true;
|
||||
try {
|
||||
|
@ -174,7 +174,7 @@ bool HashOps::insertUsedHash( QSqlQuery& query, const QString& db_name, const st
|
|||
}
|
||||
|
||||
|
||||
bool HashOps::insertUsedHashes( const std::string& db_path, const std::vector<std::string> &hashes, const int& web_server_id )
|
||||
const bool HashOps::insertUsedHashes( const std::string& db_path, const std::vector<std::string> &hashes, const int& web_server_id )
|
||||
{
|
||||
bool proceed = true;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
class HashOps
|
||||
{
|
||||
public:
|
||||
HashOps();
|
||||
explicit HashOps();
|
||||
|
||||
|
||||
//! Sets the new Dialogs level
|
||||
|
@ -30,7 +30,7 @@ public:
|
|||
\return Whether the operation has been successful or not
|
||||
\see hashes
|
||||
*/
|
||||
bool loadUsedHashesLists( const std::string& db_path );
|
||||
const bool loadUsedHashesLists( const std::string& db_path );
|
||||
|
||||
//! Returns the hash resulting from the content of the given file
|
||||
/*!
|
||||
|
@ -39,7 +39,7 @@ public:
|
|||
\throw GenericException
|
||||
\see SHA256
|
||||
*/
|
||||
std::string digestFile( const std::string& file_path );
|
||||
void digestFile( const std::string& file_path, std::string& hash ) const;
|
||||
|
||||
//! Checks if the given hash equals one which is already in the list
|
||||
/*!
|
||||
|
@ -48,18 +48,7 @@ public:
|
|||
\return Whether the hash is already in the list or not
|
||||
\see hashes
|
||||
*/
|
||||
bool hasBeenUsed( const std::string& file_hash, const int& web_server_id );
|
||||
|
||||
//! Inserts a hashe in the corresponding database table
|
||||
/*!
|
||||
\param db_query Query instance, already initialized
|
||||
\param db_name The name of the database, eventually used by dialogs
|
||||
\param hash The hash to insert
|
||||
\param web_server_id The ID of the Web Server which generated the file
|
||||
\return Whether the operation has been successful or not
|
||||
\see insertUsedHashes()
|
||||
*/
|
||||
bool insertUsedHash( QSqlQuery& query, const QString& db_name, const std::string& hash, const int& web_server_id );
|
||||
const bool hasBeenUsed( const std::string& file_hash, const int& web_server_id ) const;
|
||||
|
||||
//! Inserts multiple hashes in the corresponding database table
|
||||
/*!
|
||||
|
@ -69,7 +58,7 @@ public:
|
|||
\return Whether the operation has been successful or not
|
||||
\see insertUsedHash()
|
||||
*/
|
||||
bool insertUsedHashes( const std::string& db_path, const std::vector<std::string>& hashes, const int& web_server_id );
|
||||
const bool insertUsedHashes( const std::string& db_path, const std::vector<std::string>& hashes, const int& web_server_id );
|
||||
|
||||
private:
|
||||
|
||||
|
@ -81,12 +70,12 @@ private:
|
|||
const int NGINX_ID = 12;
|
||||
const int IIS_ID = 13;
|
||||
|
||||
// List of Web Servers names
|
||||
// List of Web Servers names for database tables
|
||||
const std::unordered_map<int, QString> ws_names = {
|
||||
{this->APACHE_ID, "apache"},
|
||||
{this->NGINX_ID, "nginx"},
|
||||
{this->IIS_ID, "iis"} };
|
||||
|
||||
{this->IIS_ID, "iis"}
|
||||
};
|
||||
|
||||
// Lists of used files' hashes
|
||||
// { web_server_id : { hashes } }
|
||||
|
@ -96,6 +85,11 @@ private:
|
|||
{this->IIS_ID, {}}
|
||||
};
|
||||
|
||||
|
||||
// Called by insertUsedHashes()
|
||||
// Inserts a hash in the corresponding database table
|
||||
const bool insertUsedHash( QSqlQuery& query, const QString& db_name, const std::string& hash, const int& web_server_id );
|
||||
|
||||
};
|
||||
|
||||
#endif // HASH_H
|
||||
|
|
|
@ -13,7 +13,7 @@ LogOps::LogOps()
|
|||
}
|
||||
|
||||
|
||||
LogOps::LogType LogOps::defineFileType( const std::vector<std::string>& lines, const FormatOps::LogsFormat& format )
|
||||
const LogOps::LogType LogOps::defineFileType( const std::vector<std::string>& lines, const FormatOps::LogsFormat& format ) const
|
||||
{
|
||||
if ( lines.size() == 0 ) {
|
||||
// empty content
|
||||
|
@ -24,7 +24,7 @@ LogOps::LogType LogOps::defineFileType( const std::vector<std::string>& lines, c
|
|||
LogOps::LogType log_type;
|
||||
|
||||
// real type assignment
|
||||
log_type = this->LogType::Failed;
|
||||
log_type = LogOps::LogType::Failed;
|
||||
for ( const std::string& line : lines ) {
|
||||
// scan
|
||||
if ( this->deepTypeCheck( line, format ) ) {
|
||||
|
@ -48,7 +48,7 @@ LogOps::LogType LogOps::defineFileType( const std::vector<std::string>& lines, c
|
|||
}
|
||||
|
||||
|
||||
bool LogOps::deepTypeCheck( const std::string& line, const FormatOps::LogsFormat& format )
|
||||
const bool LogOps::deepTypeCheck( const std::string& line, const FormatOps::LogsFormat& format ) const
|
||||
{
|
||||
int n_sep_found=0, n_blank_sep=0,
|
||||
n_sep = format.separators.size();
|
||||
|
@ -138,7 +138,7 @@ bool LogOps::deepTypeCheck( const std::string& line, const FormatOps::LogsFormat
|
|||
}
|
||||
|
||||
|
||||
void LogOps::cleanLines( std::vector<std::string> &lines )
|
||||
void LogOps::cleanLines( std::vector<std::string>& lines ) const
|
||||
{
|
||||
std::vector<std::string> aux;
|
||||
for ( const std::string& line : lines ) {
|
||||
|
@ -147,7 +147,7 @@ void LogOps::cleanLines( std::vector<std::string> &lines )
|
|||
aux.push_back( line );
|
||||
}
|
||||
}
|
||||
lines = aux;
|
||||
lines = std::move( aux );
|
||||
}
|
||||
|
||||
|
||||
|
@ -451,15 +451,15 @@ void LogOps::resetPerfData()
|
|||
this->parsed_size = 0;
|
||||
this->parsed_lines = 0;
|
||||
}
|
||||
const unsigned LogOps::getTotalSize()
|
||||
const unsigned LogOps::getTotalSize() const
|
||||
{
|
||||
return this->total_size;
|
||||
}
|
||||
const unsigned LogOps::getParsedSize()
|
||||
const unsigned LogOps::getParsedSize() const
|
||||
{
|
||||
return this->parsed_size;
|
||||
}
|
||||
const unsigned LogOps::getParsedLines()
|
||||
const unsigned LogOps::getParsedLines() const
|
||||
{
|
||||
return this->parsed_lines;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
class LogOps
|
||||
{
|
||||
public:
|
||||
LogOps();
|
||||
explicit LogOps();
|
||||
|
||||
//! Enumerates log file types
|
||||
/*!
|
||||
|
@ -35,16 +35,18 @@ public:
|
|||
\return The resulting file type
|
||||
\see LogType, deepTypeCheck(), FormatOps::LogsFormat
|
||||
*/
|
||||
LogType defineFileType(
|
||||
const LogType defineFileType(
|
||||
const std::vector<std::string>& lines,
|
||||
const FormatOps::LogsFormat& format );
|
||||
const FormatOps::LogsFormat& format
|
||||
) const;
|
||||
|
||||
//! Removes commented lines from the given list
|
||||
/*!
|
||||
\param lines The lines to clean
|
||||
*/
|
||||
void cleanLines(
|
||||
std::vector<std::string>& lines );
|
||||
std::vector<std::string>& lines
|
||||
) const;
|
||||
|
||||
//! Parses log lines to extract data
|
||||
/*!
|
||||
|
@ -57,15 +59,16 @@ public:
|
|||
void parseLines(
|
||||
std::vector<std::unordered_map<int, std::string>>& data,
|
||||
const std::vector<std::string>& lines,
|
||||
const FormatOps::LogsFormat& format );
|
||||
const FormatOps::LogsFormat& format
|
||||
);
|
||||
|
||||
//! Resets the performances data
|
||||
void resetPerfData();
|
||||
|
||||
// share perf data with craplog
|
||||
const unsigned getTotalSize(); //!< Returns the total size of the logs lines. \see total_size
|
||||
const unsigned getParsedSize(); //!< Returns the parsed logs size. \see parsed_size
|
||||
const unsigned getParsedLines(); //!< Returns the number of parsed log lines. \see parsed_lines
|
||||
const unsigned getTotalSize() const; //!< Returns the total size of the logs lines. \see total_size
|
||||
const unsigned getParsedSize() const; //!< Returns the parsed logs size. \see parsed_size
|
||||
const unsigned getParsedLines() const; //!< Returns the number of parsed log lines. \see parsed_lines
|
||||
|
||||
private:
|
||||
|
||||
|
@ -125,9 +128,10 @@ private:
|
|||
\return Whether the line respects the format or not
|
||||
\see defineFileType(), FormatOps::LogsFormat
|
||||
*/
|
||||
bool deepTypeCheck(
|
||||
const bool deepTypeCheck(
|
||||
const std::string& line,
|
||||
const FormatOps::LogsFormat& format );
|
||||
const FormatOps::LogsFormat& format
|
||||
) const;
|
||||
|
||||
//! Parses a line to extract data
|
||||
/*!
|
||||
|
@ -139,7 +143,8 @@ private:
|
|||
*/
|
||||
const std::unordered_map<int, std::string> parseLine(
|
||||
const std::string& line,
|
||||
const FormatOps::LogsFormat& format );
|
||||
const FormatOps::LogsFormat& format
|
||||
);
|
||||
|
||||
// temporary vars
|
||||
unsigned total_size=0; //!< Total size of the parsed logs. \see getTotalSize()
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
class StoreOps
|
||||
{
|
||||
public:
|
||||
StoreOps();
|
||||
explicit StoreOps();
|
||||
|
||||
//! Stores the data collection in the logs Collection database
|
||||
/*!
|
||||
|
|
|
@ -59,7 +59,7 @@ void Crapup::closeEvent( QCloseEvent* event )
|
|||
}
|
||||
|
||||
|
||||
void Crapup::versionCheck( const float& v )
|
||||
void Crapup::versionCheck( const float v )
|
||||
{
|
||||
bool successful = false;
|
||||
float version = -1;
|
||||
|
@ -278,7 +278,7 @@ void Crapup::rotateImg()
|
|||
}
|
||||
|
||||
|
||||
void Crapup::getStyleSheet( QString& stylesheet, const int& theme_id )
|
||||
void Crapup::getStyleSheet( QString& stylesheet, const int& theme_id ) const
|
||||
{
|
||||
std::unordered_map<std::string, QString> style;
|
||||
switch ( theme_id ) {
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace Ui {
|
|||
class Crapup : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
//! Class constructor
|
||||
|
@ -27,7 +28,7 @@ public:
|
|||
\param icons theme The theme of the icons
|
||||
\param parent The parent Widget
|
||||
*/
|
||||
Crapup( const int& window_theme_id, const QString& icons_theme, QWidget* parent=nullptr );
|
||||
explicit Crapup( const int& window_theme_id, const QString& icons_theme, QWidget* parent=nullptr );
|
||||
~Crapup();
|
||||
|
||||
|
||||
|
@ -36,7 +37,7 @@ public:
|
|||
\param current_version The running version of LogDoctor
|
||||
\throw GenericException
|
||||
*/
|
||||
void versionCheck( const float& current_version );
|
||||
void versionCheck( const float current_version );
|
||||
|
||||
|
||||
signals:
|
||||
|
@ -69,7 +70,7 @@ private:
|
|||
|
||||
QTimer* img_timer = nullptr;
|
||||
|
||||
void getStyleSheet( QString& stylesheet, const int& theme_id );
|
||||
void getStyleSheet( QString& stylesheet, const int& theme_id ) const;
|
||||
|
||||
bool request_aborted;
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ Crapview::Crapview()
|
|||
}
|
||||
|
||||
|
||||
const int& Crapview::getDialogsLevel()
|
||||
const int& Crapview::getDialogsLevel() const
|
||||
{
|
||||
return this->dialogs_level;
|
||||
}
|
||||
void Crapview::setDialogsLevel( const int& new_level )
|
||||
void Crapview::setDialogsLevel( const int new_level )
|
||||
{
|
||||
this->dialogs_level = new_level;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ void Crapview::setDbPath( const std::string& path )
|
|||
}
|
||||
|
||||
|
||||
const QString Crapview::printableDate( const QString& year, const int& month, const QString& day )
|
||||
const QString Crapview::printableDate( const QString& year, const int month, const QString& day ) const
|
||||
{
|
||||
QString date = QString("%1-").arg( year );
|
||||
if ( month < 10 ) {
|
||||
|
@ -45,7 +45,7 @@ const QString Crapview::printableDate( const QString& year, const int& month, co
|
|||
}
|
||||
|
||||
|
||||
const QString Crapview::printableDate( const int& year, const int& month, const int& day )
|
||||
const QString Crapview::printableDate( const int year, const int month, const int day ) const
|
||||
{
|
||||
QString date;
|
||||
if ( year < 10 ) {
|
||||
|
@ -67,7 +67,7 @@ const QString Crapview::printableDate( const int& year, const int& month, const
|
|||
}
|
||||
|
||||
|
||||
const QString Crapview::printableTime( const int& hour, const int& minute, const int& second )
|
||||
const QString Crapview::printableTime( const int hour, const int minute, const int second ) const
|
||||
{
|
||||
QString time;
|
||||
if ( hour < 10 ) {
|
||||
|
@ -89,7 +89,7 @@ const QString Crapview::printableTime( const int& hour, const int& minute, const
|
|||
}
|
||||
|
||||
|
||||
const QString Crapview::printableWarn( const int& value )
|
||||
const QString Crapview::printableWarn( const int value ) const
|
||||
{
|
||||
if ( value == 0 ) {
|
||||
return TR::tr( BOOLS__FALSE.c_str() );
|
||||
|
@ -99,16 +99,18 @@ const QString Crapview::printableWarn( const int& value )
|
|||
}
|
||||
|
||||
|
||||
const QString Crapview::parseBooleanFilter( const QString& filter_str )
|
||||
const QString Crapview::parseBooleanFilter( const QString& filter_str ) const
|
||||
{
|
||||
QString aux = filter_str;
|
||||
aux = aux.replace( TR::tr(BOOLS__TRUE.c_str()), "1", Qt::CaseSensitivity::CaseInsensitive );
|
||||
aux = aux.replace( TR::tr(BOOLS__FALSE.c_str()),"0", Qt::CaseSensitivity::CaseInsensitive );
|
||||
aux = aux.replace( "NOT TRUE", "!= 1", Qt::CaseSensitivity::CaseInsensitive );
|
||||
aux = aux.replace( "NOT FALSE", "!= 0", Qt::CaseSensitivity::CaseInsensitive );
|
||||
aux = aux.replace( "TRUE", "1", Qt::CaseSensitivity::CaseInsensitive );
|
||||
aux = aux.replace( "FALSE", "0", Qt::CaseSensitivity::CaseInsensitive );
|
||||
return this->parseNumericFilter( aux );
|
||||
}
|
||||
|
||||
|
||||
const QString Crapview::parseNumericFilter( const QString& filter_str )
|
||||
const QString Crapview::parseNumericFilter( const QString& filter_str ) const
|
||||
{
|
||||
QString final_str = "";
|
||||
if ( filter_str.size() > 0 ) {
|
||||
|
@ -157,7 +159,7 @@ const QString Crapview::parseNumericFilter( const QString& filter_str )
|
|||
}
|
||||
|
||||
|
||||
const QString Crapview::parseTextualFilter( const QString& filter_str )
|
||||
const QString Crapview::parseTextualFilter( const QString& filter_str ) const
|
||||
{
|
||||
QString aux = filter_str;
|
||||
if ( filter_str.size() > 0 ) {
|
||||
|
@ -188,12 +190,12 @@ void Crapview::clearDates()
|
|||
this->dates.clear();
|
||||
}
|
||||
|
||||
const QString Crapview::getLogFieldString ( const int& field_id )
|
||||
const QString Crapview::getLogFieldString ( const int field_id ) const
|
||||
{
|
||||
return TR::tr( this->dbQuery.FIELDS.at( field_id ).c_str() );
|
||||
}
|
||||
|
||||
const int Crapview::getLogFieldID ( const QString& field_str )
|
||||
const int Crapview::getLogFieldID ( const QString& field_str ) const
|
||||
{
|
||||
int f=0;
|
||||
for ( const auto& [id,str] : this->dbQuery.FIELDS ) {
|
||||
|
@ -206,7 +208,7 @@ const int Crapview::getLogFieldID ( const QString& field_str )
|
|||
}
|
||||
|
||||
|
||||
const int Crapview::getMonthNumber( const QString& month_str )
|
||||
const int Crapview::getMonthNumber( const QString& month_str ) const
|
||||
{
|
||||
int m=0;
|
||||
for ( const auto& [num,str] : this->dbQuery.MONTHS ) {
|
||||
|
@ -220,7 +222,7 @@ const int Crapview::getMonthNumber( const QString& month_str )
|
|||
|
||||
|
||||
|
||||
const QStringList Crapview::getYears( const QString& web_server )
|
||||
const QStringList Crapview::getYears( const QString& web_server ) const
|
||||
{
|
||||
QStringList years;
|
||||
if ( this->dates.size() > 0 ) {
|
||||
|
@ -233,7 +235,7 @@ const QStringList Crapview::getYears( const QString& web_server )
|
|||
}
|
||||
return years;
|
||||
}
|
||||
const QStringList Crapview::getMonths( const QString& web_server, const QString& year )
|
||||
const QStringList Crapview::getMonths( const QString& web_server, const QString& year ) const
|
||||
{
|
||||
QStringList months;
|
||||
if ( this->dates.size() > 0 ) {
|
||||
|
@ -249,7 +251,7 @@ const QStringList Crapview::getMonths( const QString& web_server, const QString&
|
|||
}
|
||||
return months;
|
||||
}
|
||||
const QStringList Crapview::getDays( const QString& web_server, const QString& year, const QString& month )
|
||||
const QStringList Crapview::getDays( const QString& web_server, const QString& year, const QString& month ) const
|
||||
{
|
||||
QStringList days;
|
||||
if ( this->dates.size() > 0 ) {
|
||||
|
@ -268,12 +270,12 @@ const QStringList Crapview::getDays( const QString& web_server, const QString& y
|
|||
}
|
||||
return days;
|
||||
}
|
||||
const QStringList Crapview::getHours()
|
||||
const QStringList Crapview::getHours() const
|
||||
{
|
||||
return QStringList({"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"});
|
||||
}
|
||||
|
||||
const QStringList Crapview::getFields( const std::string& tab )
|
||||
const QStringList Crapview::getFields( const std::string& tab ) const
|
||||
{
|
||||
QStringList list;
|
||||
for ( const auto& field : this->fields.at( tab ) ) {
|
||||
|
@ -286,7 +288,7 @@ const QStringList Crapview::getFields( const std::string& tab )
|
|||
////////////////
|
||||
//// CHARTS ////
|
||||
////////////////
|
||||
void Crapview::updateWarn( QTableWidget* table , const QString& web_server )
|
||||
void Crapview::updateWarn( QTableWidget* table , const QString& web_server ) const
|
||||
{
|
||||
std::vector<std::tuple<int, int>> updates; // { (rowid, warn) }
|
||||
for ( int i=0; i<table->rowCount(); i++ ) {
|
||||
|
@ -300,10 +302,9 @@ void Crapview::updateWarn( QTableWidget* table , const QString& web_server )
|
|||
}
|
||||
}
|
||||
this->dbQuery.updateWarnings( web_server, updates );
|
||||
updates.clear();
|
||||
}
|
||||
|
||||
void Crapview::drawWarn( QTableWidget* table, QtCharts::QChartView* chart, const QChart::ChartTheme& theme, const std::unordered_map<std::string, QFont>& fonts, const QString& web_server, const QString& year, const QString& month, const QString& day, const QString& hour )
|
||||
void Crapview::drawWarn( QTableWidget* table, QtCharts::QChartView* chart, const QChart::ChartTheme& theme, const std::unordered_map<std::string, QFont>& fonts, const QString& web_server, const QString& year, const QString& month, const QString& day, const QString& hour ) const
|
||||
{
|
||||
Result<stats_warn_items_t> result;
|
||||
this->dbQuery.getWarnCounts(
|
||||
|
@ -488,7 +489,7 @@ void Crapview::drawWarn( QTableWidget* table, QtCharts::QChartView* chart, const
|
|||
|
||||
|
||||
|
||||
void Crapview::drawSpeed( QTableWidget* table, QtCharts::QChartView* chart, const QChart::ChartTheme& theme, const std::unordered_map<std::string, QFont>& fonts, const QString& web_server, const QString& year, const QString& month, const QString& day, const QString& protocol, const QString& method, const QString& uri, const QString& query, const QString& response )
|
||||
void Crapview::drawSpeed( QTableWidget* table, QtCharts::QChartView* chart, const QChart::ChartTheme& theme, const std::unordered_map<std::string, QFont>& fonts, const QString& web_server, const QString& year, const QString& month, const QString& day, const QString& protocol, const QString& method, const QString& uri, const QString& query, const QString& response ) const
|
||||
{
|
||||
Result<stats_speed_items_t> result;
|
||||
this->dbQuery.getSpeedData(
|
||||
|
@ -637,7 +638,7 @@ void Crapview::drawSpeed( QTableWidget* table, QtCharts::QChartView* chart, cons
|
|||
|
||||
|
||||
|
||||
void Crapview::drawCount( QTableWidget* table, QtCharts::QChartView* chart, const QChart::ChartTheme& theme, const std::unordered_map<std::string, QFont>& fonts, const QString& web_server, const QString& year, const QString& month, const QString& day, const QString& field )
|
||||
void Crapview::drawCount( QTableWidget* table, QtCharts::QChartView* chart, const QChart::ChartTheme& theme, const std::unordered_map<std::string, QFont>& fonts, const QString& web_server, const QString& year, const QString& month, const QString& day, const QString& field ) const
|
||||
{
|
||||
Result<stats_count_items_t> result;
|
||||
this->dbQuery.getItemsCount(
|
||||
|
@ -694,7 +695,7 @@ void Crapview::drawCount( QTableWidget* table, QtCharts::QChartView* chart, cons
|
|||
|
||||
|
||||
|
||||
void Crapview::drawDay( QtCharts::QChartView* chart, const QChart::ChartTheme& theme, const std::unordered_map<std::string, QFont>& fonts, const QString& web_server, const QString& from_year, const QString& from_month, const QString& from_day, const QString& to_year, const QString& to_month, const QString& to_day, const QString& field , const QString& filter )
|
||||
void Crapview::drawDay( QtCharts::QChartView* chart, const QChart::ChartTheme& theme, const std::unordered_map<std::string, QFont>& fonts, const QString& web_server, const QString& from_year, const QString& from_month, const QString& from_day, const QString& to_year, const QString& to_month, const QString& to_day, const QString& field , const QString& filter ) const
|
||||
{
|
||||
Result<stats_day_items_t> result;
|
||||
this->dbQuery.getDaytimeCounts(
|
||||
|
@ -817,7 +818,7 @@ void Crapview::drawDay( QtCharts::QChartView* chart, const QChart::ChartTheme& t
|
|||
|
||||
|
||||
|
||||
void Crapview::drawRelat( QtCharts::QChartView* chart, const QChart::ChartTheme& theme, const std::unordered_map<std::string, QFont>& fonts, const QString& web_server, const QString& from_year, const QString& from_month, const QString& from_day, const QString& to_year, const QString& to_month, const QString& to_day, const QString& field_1, const QString& filter_1, const QString& field_2, const QString& filter_2 )
|
||||
void Crapview::drawRelat( QtCharts::QChartView* chart, const QChart::ChartTheme& theme, const std::unordered_map<std::string, QFont>& fonts, const QString& web_server, const QString& from_year, const QString& from_month, const QString& from_day, const QString& to_year, const QString& to_month, const QString& to_day, const QString& field_1, const QString& filter_1, const QString& field_2, const QString& filter_2 ) const
|
||||
{
|
||||
bool period = true;
|
||||
Result<stats_relat_items_t> result;
|
||||
|
@ -940,7 +941,7 @@ void Crapview::drawRelat( QtCharts::QChartView* chart, const QChart::ChartTheme&
|
|||
|
||||
|
||||
// calculate global informations
|
||||
const bool Crapview::calcGlobals( std::vector<std::tuple<QString,QString>>& recur_list, std::vector<std::tuple<QString,QString>>& traffic_list, std::vector<std::tuple<QString,QString>>& perf_list, std::vector<QString>& work_list, const QString& web_server )
|
||||
const bool Crapview::calcGlobals( std::vector<std::tuple<QString,QString>>& recur_list, std::vector<std::tuple<QString,QString>>& traffic_list, std::vector<std::tuple<QString,QString>>& perf_list, std::vector<QString>& work_list, const QString& web_server ) const
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
|
|
|
@ -17,17 +17,17 @@
|
|||
class Crapview
|
||||
{
|
||||
public:
|
||||
Crapview();
|
||||
explicit Crapview();
|
||||
|
||||
//! Returns the Dialogs level
|
||||
const int& getDialogsLevel();
|
||||
const int& getDialogsLevel() const;
|
||||
|
||||
//! Sets the new Dialogs level
|
||||
void setDialogsLevel( const int& new_level );
|
||||
void setDialogsLevel( const int new_level );
|
||||
|
||||
|
||||
//! Sets the new charts theme to use
|
||||
void setChartsTheme( const int& new_theme_id );
|
||||
/*//! Sets the new charts theme to use
|
||||
void setChartsTheme( const int& new_theme_id );*/
|
||||
|
||||
|
||||
//! Sets the new path for the logs Collection database
|
||||
|
@ -39,24 +39,26 @@ public:
|
|||
|
||||
//! Parses a filter for a database field with boolean type
|
||||
/*!
|
||||
Boolean filters are not locale-dependant,
|
||||
meaning that English syntax must be used (TRUE,FALSE)
|
||||
\param field_str The given filter
|
||||
\return The resulting filter to apply to the query
|
||||
*/
|
||||
const QString parseBooleanFilter( const QString& filter_str );
|
||||
const QString parseBooleanFilter( const QString& filter_str ) const;
|
||||
|
||||
//! Parses a filter for a log field with integer type
|
||||
/*!
|
||||
\param field_str The given filter
|
||||
\return The resulting filter to apply to the query
|
||||
*/
|
||||
const QString parseNumericFilter( const QString& filter_str );
|
||||
const QString parseNumericFilter( const QString& filter_str ) const;
|
||||
|
||||
//! Parses a filter for a log field with text type
|
||||
/*!
|
||||
\param field_str The given filter
|
||||
\return The resulting filter to apply to the query
|
||||
*/
|
||||
const QString parseTextualFilter( const QString& filter_str );
|
||||
const QString parseTextualFilter( const QString& filter_str ) const;
|
||||
|
||||
|
||||
//! Returns the printable log field corresponding to the given ID
|
||||
|
@ -65,14 +67,14 @@ public:
|
|||
\param field_id The ID of the log fiels
|
||||
\return The printable field
|
||||
*/
|
||||
const QString getLogFieldString ( const int& field_id );
|
||||
const QString getLogFieldString ( const int field_id ) const;
|
||||
|
||||
//! Returns the log field ID corresponding to the given printable field
|
||||
/*!
|
||||
\param field_str The log field
|
||||
\return The ID of the log field
|
||||
*/
|
||||
const int getLogFieldID ( const QString& field_str );
|
||||
const int getLogFieldID ( const QString& field_str ) const;
|
||||
|
||||
|
||||
//! Returns the month number corresponding to the given printable month
|
||||
|
@ -80,7 +82,7 @@ public:
|
|||
\param month_Str The printable month name
|
||||
\return The month number
|
||||
*/
|
||||
const int getMonthNumber( const QString& month_str );
|
||||
const int getMonthNumber( const QString& month_str ) const;
|
||||
|
||||
|
||||
//! Refreshes the list of the dates which are available in the database
|
||||
|
@ -95,7 +97,7 @@ public:
|
|||
\param web_server The printable Web Server name
|
||||
\return The list of yearss which are avaliable
|
||||
*/
|
||||
const QStringList getYears( const QString& web_server );
|
||||
const QStringList getYears( const QString& web_server ) const;
|
||||
|
||||
//! Returns le list of available months in the given year, for the given web server
|
||||
/*!
|
||||
|
@ -103,7 +105,7 @@ public:
|
|||
\param year The year
|
||||
\return The list of printable month names which are avaliable
|
||||
*/
|
||||
const QStringList getMonths( const QString& web_server, const QString& year );
|
||||
const QStringList getMonths( const QString& web_server, const QString& year ) const;
|
||||
|
||||
//! Returns le list of available days in the given month and year, for the given web server
|
||||
/*!
|
||||
|
@ -112,13 +114,13 @@ public:
|
|||
\param month The printable month name
|
||||
\return The list of days which are avaliable
|
||||
*/
|
||||
const QStringList getDays( const QString& web_server, const QString& year, const QString& month );
|
||||
const QStringList getDays( const QString& web_server, const QString& year, const QString& month ) const;
|
||||
|
||||
//! Returns all the hours of the day
|
||||
/*!
|
||||
\return The list of all the hours
|
||||
*/
|
||||
const QStringList getHours();
|
||||
const QStringList getHours() const;
|
||||
|
||||
|
||||
//! Returns a list of the fields for the given tab
|
||||
|
@ -126,7 +128,7 @@ public:
|
|||
\param tab The stats tab
|
||||
\return The list of fields
|
||||
*/
|
||||
const QStringList getFields( const std::string& tab );
|
||||
const QStringList getFields( const std::string& tab ) const;
|
||||
|
||||
|
||||
//! Updates the database applying the changes which have been made to the table
|
||||
|
@ -136,7 +138,8 @@ public:
|
|||
*/
|
||||
void updateWarn(
|
||||
QTableWidget* table,
|
||||
const QString& web_server );
|
||||
const QString& web_server
|
||||
) const;
|
||||
|
||||
|
||||
//! Draws the chart and fills the table for the Warnings stats
|
||||
|
@ -156,7 +159,8 @@ public:
|
|||
const QChart::ChartTheme& theme,
|
||||
const std::unordered_map<std::string, QFont>& fonts,
|
||||
const QString& web_server,
|
||||
const QString& year, const QString& month, const QString& day, const QString& hour );
|
||||
const QString& year, const QString& month, const QString& day, const QString& hour
|
||||
) const;
|
||||
|
||||
|
||||
//! Draws the chart and fills the table for the Speed stats
|
||||
|
@ -181,7 +185,8 @@ public:
|
|||
const std::unordered_map<std::string, QFont>& fonts,
|
||||
const QString& web_server,
|
||||
const QString& year, const QString& month, const QString& day,
|
||||
const QString& protocol, const QString& method, const QString& uri, const QString& query, const QString& response );
|
||||
const QString& protocol, const QString& method, const QString& uri, const QString& query, const QString& response
|
||||
) const;
|
||||
|
||||
|
||||
//! Draws the chart and fills the table for the Counts stats
|
||||
|
@ -202,7 +207,8 @@ public:
|
|||
const std::unordered_map<std::string, QFont>& fonts,
|
||||
const QString& web_server,
|
||||
const QString& year, const QString& month, const QString& day,
|
||||
const QString& field );
|
||||
const QString& field
|
||||
) const;
|
||||
|
||||
|
||||
//! Draws the chart for the Daytime stats
|
||||
|
@ -227,7 +233,8 @@ public:
|
|||
const QString& web_server,
|
||||
const QString& from_year, const QString& from_month, const QString& from_day,
|
||||
const QString& to_year, const QString& to_month, const QString& to_day,
|
||||
const QString& field, const QString& filter );
|
||||
const QString& field, const QString& filter
|
||||
) const;
|
||||
|
||||
|
||||
//! Draws the chart for the Relational stats
|
||||
|
@ -253,9 +260,10 @@ public:
|
|||
const std::unordered_map<std::string, QFont>& fonts,
|
||||
const QString& web_server,
|
||||
const QString& from_year, const QString& from_month, const QString& from_day,
|
||||
const QString& to_year, const QString& to_month, const QString& to_day,
|
||||
const QString& to_year, const QString& to_month, const QString& to_day,
|
||||
const QString& field_1, const QString& filter_1,
|
||||
const QString& field_2, const QString& filter_2 );
|
||||
const QString& field_2, const QString& filter_2
|
||||
) const;
|
||||
|
||||
|
||||
//! Retrieves the data to fill the Globals stats
|
||||
|
@ -272,7 +280,8 @@ public:
|
|||
std::vector<std::tuple<QString,QString>>& traffic_list,
|
||||
std::vector<std::tuple<QString,QString>>& perf_list,
|
||||
std::vector<QString>& work_list,
|
||||
const QString& web_server );
|
||||
const QString& web_server
|
||||
) const;
|
||||
|
||||
|
||||
private:
|
||||
|
@ -300,7 +309,7 @@ private:
|
|||
};
|
||||
|
||||
|
||||
//! Returns a string of the given date in the format YYY-MM-DD
|
||||
//! Returns a string of the given date in the format YYYY-MM-DD
|
||||
/*!
|
||||
\overload const QString printableDate(const int& year, const int& month, const int& day)
|
||||
\param year The year
|
||||
|
@ -308,16 +317,20 @@ private:
|
|||
\param day The day
|
||||
\return The printable date
|
||||
*/
|
||||
const QString printableDate( const QString& year, const int& month, const QString& day );
|
||||
const QString printableDate(
|
||||
const QString& year, const int month, const QString& day
|
||||
) const;
|
||||
|
||||
//! Returns a string of the given date in the format YYY-MM-DD
|
||||
//! Returns a string of the given date in the format YYYY-MM-DD
|
||||
/*!
|
||||
\param year The year
|
||||
\param month The month
|
||||
\param day The day
|
||||
\return The printable date
|
||||
*/
|
||||
const QString printableDate( const int& year, const int& month, const int& day );
|
||||
const QString printableDate(
|
||||
const int year, const int month, const int day
|
||||
) const;
|
||||
|
||||
//! Returns a string of the given time in the format HH:MM:SS
|
||||
/*!
|
||||
|
@ -326,7 +339,9 @@ private:
|
|||
\param second The second
|
||||
\return The printable time
|
||||
*/
|
||||
const QString printableTime( const int& hour, const int& minute, const int& second );
|
||||
const QString printableTime(
|
||||
const int hour, const int minute, const int second
|
||||
) const;
|
||||
|
||||
//! Returns a string corresponding to the given value
|
||||
/*!
|
||||
|
@ -334,7 +349,7 @@ private:
|
|||
\param value The value to convert
|
||||
\return The corresponding printable string
|
||||
*/
|
||||
const QString printableWarn( const int& value );
|
||||
const QString printableWarn( const int value ) const;
|
||||
|
||||
|
||||
// converr Web Servers names to Web Server IDs
|
||||
|
|
|
@ -18,7 +18,7 @@ DbQuery::DbQuery()
|
|||
|
||||
}
|
||||
|
||||
void DbQuery::setDialogLevel(const int& new_level )
|
||||
void DbQuery::setDialogLevel(const int new_level )
|
||||
{
|
||||
this->dialog_level = new_level;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ void DbQuery::setDbPath( const std::string& path )
|
|||
}
|
||||
|
||||
|
||||
const int DbQuery::getMinuteGap( const int& minute , const int& gap )
|
||||
const int DbQuery::getMinuteGap( const int minute, const int gap ) const
|
||||
{
|
||||
int m = -1;
|
||||
if ( minute < 0 || minute >= 60 ) {
|
||||
|
@ -48,7 +48,7 @@ const int DbQuery::getMinuteGap( const int& minute , const int& gap )
|
|||
return m;
|
||||
}
|
||||
|
||||
const int DbQuery::getMonthDays( const int& year, const int& month )
|
||||
const int DbQuery::getMonthDays( const int year, const int month ) const
|
||||
{
|
||||
int n_days;
|
||||
switch (month) {
|
||||
|
@ -71,7 +71,7 @@ const int DbQuery::getMonthDays( const int& year, const int& month )
|
|||
return n_days;
|
||||
}
|
||||
|
||||
const int DbQuery::getMonthsCount( const QString& from_year, const QString& from_month, const QString& to_year, const QString& to_month )
|
||||
const int DbQuery::getMonthsCount( const QString& from_year, const QString& from_month, const QString& to_year, const QString& to_month ) const
|
||||
{
|
||||
int from_year_, from_month_, to_year_, to_month_;
|
||||
try {
|
||||
|
@ -86,7 +86,7 @@ const int DbQuery::getMonthsCount( const QString& from_year, const QString& from
|
|||
return this->getMonthsCount( from_year_, from_month_, to_year_, to_month_ );
|
||||
}
|
||||
|
||||
const int DbQuery::getMonthsCount( const int& from_year, const int& from_month, const int& to_year, const int& to_month )
|
||||
const int DbQuery::getMonthsCount( const int& from_year, const int& from_month, const int& to_year, const int& to_month ) const
|
||||
{
|
||||
int n_months = 0;
|
||||
if ( from_year == to_year ) {
|
||||
|
@ -108,7 +108,7 @@ const int DbQuery::getMonthsCount( const int& from_year, const int& from_month,
|
|||
}
|
||||
|
||||
|
||||
const int DbQuery::getMonthNumber( const QString& month_str )
|
||||
const int DbQuery::getMonthNumber( const QString& month_str ) const
|
||||
{
|
||||
int m=0;
|
||||
for ( const auto& [num,str] : this->MONTHS ) {
|
||||
|
@ -133,7 +133,7 @@ const int DbQuery::getMonthNumber( const QString& month_str )
|
|||
return f;
|
||||
}*/
|
||||
|
||||
const QString DbQuery::getDbField( const QString& tr_fld )
|
||||
const QString DbQuery::getDbField( const QString& tr_fld ) const
|
||||
{
|
||||
QString f;
|
||||
for ( const auto& [id,str] : this->FIELDS ) {
|
||||
|
@ -296,7 +296,7 @@ void DbQuery::refreshDates( Result<stats_dates_t>& result )
|
|||
|
||||
|
||||
// update the values for the warnings
|
||||
void DbQuery::updateWarnings( const QString& web_server, const std::vector<std::tuple<int, int>>& updates )
|
||||
void DbQuery::updateWarnings( const QString& web_server, const std::vector<std::tuple<int, int>>& updates ) const
|
||||
{
|
||||
bool successful = true;
|
||||
|
||||
|
@ -349,7 +349,7 @@ void DbQuery::updateWarnings( const QString& web_server, const std::vector<std::
|
|||
|
||||
|
||||
// get daytime values for the warnings
|
||||
void DbQuery::getWarnCounts( Result<stats_warn_items_t>& result, const QString& web_server, const QString& year_, const QString& month_, const QString& day_, const QString& hour_ )
|
||||
void DbQuery::getWarnCounts( Result<stats_warn_items_t>& result, const QString& web_server, const QString& year_, const QString& month_, const QString& day_, const QString& hour_ ) const
|
||||
{
|
||||
bool successful = true;
|
||||
stats_warn_items_t items; // std::vector<std::vector<std::vector<std::vector<QString>>>>
|
||||
|
@ -493,7 +493,7 @@ void DbQuery::getWarnCounts( Result<stats_warn_items_t>& result, const QString&
|
|||
|
||||
|
||||
// get day-time values for the time-taken field
|
||||
void DbQuery::getSpeedData( Result<stats_speed_items_t>& result, const QString& web_server, const QString& year_, const QString& month_, const QString& day_, const QString& protocol_f, const QString& method_f, const QString& uri_f, const QString& query_f, const QString& response_f )
|
||||
void DbQuery::getSpeedData( Result<stats_speed_items_t>& result, const QString& web_server, const QString& year_, const QString& month_, const QString& day_, const QString& protocol_f, const QString& method_f, const QString& uri_f, const QString& query_f, const QString& response_f ) const
|
||||
{
|
||||
bool successful = true;
|
||||
stats_speed_items_t data; // std::vector<std::tuple<long long, std::vector<QString>>>
|
||||
|
@ -848,7 +848,7 @@ void DbQuery::getSpeedData( Result<stats_speed_items_t>& result, const QString&
|
|||
|
||||
|
||||
// get, group and count identical items of a specific field in a date
|
||||
void DbQuery::getItemsCount( Result<stats_count_items_t>& result, const QString& web_server, const QString& year, const QString& month, const QString& day, const QString& log_field )
|
||||
void DbQuery::getItemsCount( Result<stats_count_items_t>& result, const QString& web_server, const QString& year, const QString& month, const QString& day, const QString& log_field ) const
|
||||
{
|
||||
bool successful = true;
|
||||
QHash<QString, int> aux_items;
|
||||
|
@ -950,7 +950,7 @@ void DbQuery::getItemsCount( Result<stats_count_items_t>& result, const QString&
|
|||
|
||||
|
||||
// get and count items with a 10 minutes gap for every hour of the day
|
||||
void DbQuery::getDaytimeCounts( Result<stats_day_items_t>& result, const QString& web_server, const QString& from_year_, const QString& from_month_, const QString& from_day_, const QString& to_year_, const QString& to_month_, const QString& to_day_, const QString& log_field_, const QString& field_filter )
|
||||
void DbQuery::getDaytimeCounts( Result<stats_day_items_t>& result, const QString& web_server, const QString& from_year_, const QString& from_month_, const QString& from_day_, const QString& to_year_, const QString& to_month_, const QString& to_day_, const QString& log_field_, const QString& field_filter ) const
|
||||
{
|
||||
bool successful = true;
|
||||
stats_day_items_t data = { // std::unordered_map<int, std::unordered_map<int, int>>
|
||||
|
@ -1206,7 +1206,7 @@ void DbQuery::getDaytimeCounts( Result<stats_day_items_t>& result, const QString
|
|||
|
||||
|
||||
// get and count how many times a specific item value brought to another
|
||||
void DbQuery::getRelationalCountsDay( Result<stats_relat_items_t>& result, const QString& web_server, const QString& year_, const QString& month_, const QString& day_, const QString& log_field_1_, const QString& field_filter_1, const QString& log_field_2_, const QString& field_filter_2 )
|
||||
void DbQuery::getRelationalCountsDay( Result<stats_relat_items_t>& result, const QString& web_server, const QString& year_, const QString& month_, const QString& day_, const QString& log_field_1_, const QString& field_filter_1, const QString& log_field_2_, const QString& field_filter_2 ) const
|
||||
{
|
||||
bool successful = true;
|
||||
stats_relat_items_t data; // std::vector<std::tuple<long long, int>>
|
||||
|
@ -1454,7 +1454,7 @@ void DbQuery::getRelationalCountsDay( Result<stats_relat_items_t>& result, const
|
|||
|
||||
|
||||
|
||||
void DbQuery::getRelationalCountsPeriod( Result<stats_relat_items_t>& result, const QString& web_server, const QString& from_year_, const QString& from_month_, const QString& from_day_, const QString& to_year_, const QString& to_month_, const QString& to_day_, const QString& log_field_1_, const QString& field_filter_1, const QString& log_field_2_, const QString& field_filter_2 )
|
||||
void DbQuery::getRelationalCountsPeriod( Result<stats_relat_items_t>& result, const QString& web_server, const QString& from_year_, const QString& from_month_, const QString& from_day_, const QString& to_year_, const QString& to_month_, const QString& to_day_, const QString& log_field_1_, const QString& field_filter_1, const QString& log_field_2_, const QString& field_filter_2 ) const
|
||||
{
|
||||
bool successful = true;
|
||||
stats_relat_items_t data; // std::vector<std::tuple<long long, int>>
|
||||
|
@ -1845,7 +1845,7 @@ void DbQuery::getRelationalCountsPeriod( Result<stats_relat_items_t>& result, co
|
|||
|
||||
|
||||
|
||||
const bool DbQuery::getGlobalCounts( const QString& web_server, const std::unordered_map<int, std::unordered_map<int, std::vector<int>>>& dates, std::vector<std::unordered_map<QString, int>>& recurs, std::tuple<QString, int>& traf_date, std::unordered_map<int, double>& traf_day, std::unordered_map<int, double>& traf_hour, std::vector<long long>& perf_time, std::vector<long long>& perf_sent, std::vector<long long>& perf_receiv, long& req_count )
|
||||
const bool DbQuery::getGlobalCounts( const QString& web_server, const std::unordered_map<int, std::unordered_map<int, std::vector<int>>>& dates, std::vector<std::unordered_map<QString, int>>& recurs, std::tuple<QString, int>& traf_date, std::unordered_map<int, double>& traf_day, std::unordered_map<int, double>& traf_hour, std::vector<long long>& perf_time, std::vector<long long>& perf_sent, std::vector<long long>& perf_receiv, long& req_count ) const
|
||||
{
|
||||
bool successful = true;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
class DbQuery
|
||||
{
|
||||
public:
|
||||
DbQuery();
|
||||
explicit DbQuery();
|
||||
|
||||
// convert log fields IDs to log fields
|
||||
const std::unordered_map<int, std::string> FIELDS = {
|
||||
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
|
||||
//! Returns the Dialogs level
|
||||
void setDialogLevel( const int& new_level );
|
||||
void setDialogLevel( const int new_level );
|
||||
|
||||
|
||||
//! Sets the path for the logs Collection database
|
||||
|
@ -64,7 +64,8 @@ public:
|
|||
const QString& from_year,
|
||||
const QString& from_month,
|
||||
const QString& to_year,
|
||||
const QString& to_month );
|
||||
const QString& to_month
|
||||
) const;
|
||||
|
||||
|
||||
//! Refreshes the dates which are available in the database
|
||||
|
@ -81,7 +82,8 @@ public:
|
|||
*/
|
||||
void updateWarnings(
|
||||
const QString& web_server,
|
||||
const std::vector<std::tuple<int, int>>& updates );
|
||||
const std::vector<std::tuple<int, int>>& updates
|
||||
) const;
|
||||
|
||||
//! Retrieves the data needed for the Warnings statistics
|
||||
/*!
|
||||
|
@ -98,7 +100,8 @@ public:
|
|||
const QString& year_,
|
||||
const QString& month_,
|
||||
const QString& day_,
|
||||
const QString& hour_ );
|
||||
const QString& hour_
|
||||
) const;
|
||||
|
||||
|
||||
//! Retrieves the data needed for the Speed statistics
|
||||
|
@ -115,16 +118,17 @@ public:
|
|||
\param response_f The filter for the Response field
|
||||
*/
|
||||
void getSpeedData(
|
||||
Result<stats_speed_items_t>& result,
|
||||
const QString& web_server,
|
||||
const QString& year_,
|
||||
const QString& month_,
|
||||
const QString& day_,
|
||||
const QString& protocol_f,
|
||||
const QString& method_f,
|
||||
const QString& uri_f,
|
||||
const QString& query_f,
|
||||
const QString& response_f );
|
||||
Result<stats_speed_items_t>& result,
|
||||
const QString& web_server,
|
||||
const QString& year_,
|
||||
const QString& month_,
|
||||
const QString& day_,
|
||||
const QString& protocol_f,
|
||||
const QString& method_f,
|
||||
const QString& uri_f,
|
||||
const QString& query_f,
|
||||
const QString& response_f
|
||||
) const;
|
||||
|
||||
|
||||
//! Retrieves the data needed for the Counts statistics
|
||||
|
@ -142,7 +146,8 @@ public:
|
|||
const QString& year,
|
||||
const QString& month,
|
||||
const QString& day,
|
||||
const QString& log_field );
|
||||
const QString& log_field
|
||||
) const;
|
||||
|
||||
|
||||
//! Retrieves the data needed for the Daytime statistics
|
||||
|
@ -163,7 +168,8 @@ public:
|
|||
const QString& web_server,
|
||||
const QString& from_year_, const QString& from_month_, const QString& from_day_,
|
||||
const QString& to_year_, const QString& to_month_, const QString& to_day_,
|
||||
const QString& log_field_, const QString& field_filter );
|
||||
const QString& log_field_, const QString& field_filter
|
||||
) const;
|
||||
|
||||
|
||||
//! Retrieves the data needed for the Relationsl statistics
|
||||
|
@ -185,7 +191,8 @@ public:
|
|||
const QString& web_server,
|
||||
const QString& year_, const QString& month_, const QString& day_,
|
||||
const QString& log_field_1_, const QString& field_filter_1,
|
||||
const QString& log_field_2_, const QString& field_filter_2 );
|
||||
const QString& log_field_2_, const QString& field_filter_2
|
||||
) const;
|
||||
|
||||
//! Retrieves the data needed for the Relational statistics
|
||||
/*!
|
||||
|
@ -210,7 +217,8 @@ public:
|
|||
const QString& from_year_, const QString& from_month_, const QString& from_day_,
|
||||
const QString& to_year_, const QString& to_month_, const QString& to_day_,
|
||||
const QString& log_field_1_, const QString& field_filter_1,
|
||||
const QString& log_field_2_, const QString& field_filter_2 );
|
||||
const QString& log_field_2_, const QString& field_filter_2
|
||||
) const;
|
||||
|
||||
|
||||
//! Retrieves the data needed for the Global statistics
|
||||
|
@ -237,7 +245,8 @@ public:
|
|||
std::vector<long long>& perf_time,
|
||||
std::vector<long long>& perf_sent,
|
||||
std::vector<long long>& perf_receiv,
|
||||
long& req_count );
|
||||
long& req_count
|
||||
) const;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -259,27 +268,27 @@ private:
|
|||
|
||||
// convert log fields to database fields
|
||||
const std::unordered_map<std::string, QString> LogFields_to_DbFields = {
|
||||
{this->FIELDS.at( 0), "warning"},
|
||||
{this->FIELDS.at(10), "protocol"},
|
||||
{this->FIELDS.at(11), "method"},
|
||||
{this->FIELDS.at(12), "uri"},
|
||||
{this->FIELDS.at(13), "query"},
|
||||
{this->FIELDS.at(14), "response"},
|
||||
{this->FIELDS.at(15), "time_taken"},
|
||||
{this->FIELDS.at(16), "bytes_sent"},
|
||||
{this->FIELDS.at(17), "bytes_received"},
|
||||
{this->FIELDS.at(18), "referrer"},
|
||||
{this->FIELDS.at(20), "client"},
|
||||
{this->FIELDS.at(21), "user_agent"},
|
||||
{this->FIELDS.at(22), "cookie"}
|
||||
};
|
||||
{this->FIELDS.at( 0), "warning"},
|
||||
{this->FIELDS.at(10), "protocol"},
|
||||
{this->FIELDS.at(11), "method"},
|
||||
{this->FIELDS.at(12), "uri"},
|
||||
{this->FIELDS.at(13), "query"},
|
||||
{this->FIELDS.at(14), "response"},
|
||||
{this->FIELDS.at(15), "time_taken"},
|
||||
{this->FIELDS.at(16), "bytes_sent"},
|
||||
{this->FIELDS.at(17), "bytes_received"},
|
||||
{this->FIELDS.at(18), "referrer"},
|
||||
{this->FIELDS.at(20), "client"},
|
||||
{this->FIELDS.at(21), "user_agent"},
|
||||
{this->FIELDS.at(22), "cookie"}
|
||||
};
|
||||
|
||||
//! Returns the database field corresponding to the relative log field
|
||||
/*!
|
||||
\param tr_fld The log field, hendles translated text
|
||||
\return The database field
|
||||
*/
|
||||
const QString getDbField( const QString& tr_fld );
|
||||
const QString getDbField( const QString& tr_fld ) const;
|
||||
|
||||
/*const int getLogFieldID ( const QString& field_str );*/
|
||||
|
||||
|
@ -291,7 +300,7 @@ private:
|
|||
\return The gap index
|
||||
\throw DateTimeException
|
||||
*/
|
||||
const int getMinuteGap( const int& minute, const int& gap=10 );
|
||||
const int getMinuteGap( const int minute, const int gap=10 ) const;
|
||||
|
||||
|
||||
//! Returns the number of days for a given month
|
||||
|
@ -301,14 +310,14 @@ private:
|
|||
\return The number of days
|
||||
\throw DateTimeException
|
||||
*/
|
||||
const int getMonthDays( const int& year, const int& month );
|
||||
const int getMonthDays( const int year, const int month ) const;
|
||||
|
||||
//! Returns the month number in the year
|
||||
/*!
|
||||
\param month_str The month
|
||||
\return The month number
|
||||
*/
|
||||
const int getMonthNumber( const QString& month_str );
|
||||
const int getMonthNumber( const QString& month_str ) const;
|
||||
|
||||
|
||||
//! Returns the number of months in a given period
|
||||
|
@ -321,7 +330,8 @@ private:
|
|||
*/
|
||||
const int getMonthsCount(
|
||||
const int& from_year, const int& from_month,
|
||||
const int& to_year, const int& to_month );
|
||||
const int& to_year, const int& to_month
|
||||
) const;
|
||||
};
|
||||
|
||||
#endif // QUERY_H
|
||||
|
|
|
@ -15,7 +15,7 @@ class DialogSec : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DialogSec();
|
||||
explicit DialogSec();
|
||||
|
||||
/////////////////
|
||||
//// GENERIC ////
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
\param text The message
|
||||
\param parent The parent Widget
|
||||
*/
|
||||
DialogBool( const QString& title, const QString& text, QWidget *parent=nullptr );
|
||||
explicit DialogBool( const QString& title, const QString& text, QWidget *parent=nullptr );
|
||||
~DialogBool();
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
\param abort Whether to show the ABORT button or not
|
||||
\param parent The parent Widget
|
||||
*/
|
||||
DialogDia( const QString& title, const QString& text, const bool& ignore=true, const bool& discard=true, const bool& abort=true, QWidget *parent=nullptr );
|
||||
explicit DialogDia( const QString& title, const QString& text, const bool& ignore=true, const bool& discard=true, const bool& abort=true, QWidget *parent=nullptr );
|
||||
~DialogDia();
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
\param additional Additional informations, usually an error message
|
||||
\param parent The parent Widget
|
||||
*/
|
||||
DialogMsg( const QString& title, const QString& text, const QString& additional, const int& type, QWidget *parent=nullptr );
|
||||
explicit DialogMsg( const QString& title, const QString& text, const QString& additional, const int& type, QWidget *parent=nullptr );
|
||||
~DialogMsg();
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
/////////////////
|
||||
//// GENERIC ////
|
||||
GenericException::GenericException( const std::string& msg, const bool& to_sys )
|
||||
GenericException::GenericException( const std::string& msg, const bool to_sys )
|
||||
{
|
||||
if ( to_sys ) { // when sys, leave un-catched
|
||||
std::cout << "LogDoctor: Exception: " << msg << std::endl;
|
||||
|
@ -23,7 +23,7 @@ const QString& GenericException::what()
|
|||
|
||||
////////////////////
|
||||
//// WEB SERVER ////
|
||||
WebServerException::WebServerException(const std::string& msg ) // leave un-catched
|
||||
WebServerException::WebServerException( const std::string& msg ) // leave un-catched
|
||||
{
|
||||
std::cout << "LogDoctor: WebServerException: " << msg << std::endl;
|
||||
std::cerr << "LogDoctor: WebServerException: " << msg << std::endl;
|
||||
|
@ -37,7 +37,7 @@ WebServerException::WebServerException(const std::string& msg ) // leave un-catc
|
|||
|
||||
////////////////////
|
||||
//// LOG FORMAT ////
|
||||
LogFormatException::LogFormatException(const std::string& msg )
|
||||
LogFormatException::LogFormatException( const std::string& msg )
|
||||
{
|
||||
std::cout << "LogDoctor: LogFormatException: " << msg << std::endl;
|
||||
std::cerr << "LogDoctor: LogFormatException: " << msg << std::endl;
|
||||
|
@ -67,7 +67,7 @@ const QString& LogParserException::what()
|
|||
|
||||
///////////////////
|
||||
//// DATE-TIME ////
|
||||
DateTimeException::DateTimeException(const std::string& msg ) // leave un-catched
|
||||
DateTimeException::DateTimeException( const std::string& msg ) // leave un-catched
|
||||
{
|
||||
std::cout << "LogDoctor: DateTimeException: " << msg << std::endl;
|
||||
std::cerr << "LogDoctor: DateTimeException: " << msg << std::endl;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
*/
|
||||
class GenericException : public std::exception {
|
||||
public:
|
||||
GenericException( const std::string& msg , const bool& to_sys=false );
|
||||
explicit GenericException( const std::string& msg, const bool to_sys=false );
|
||||
const QString& what();
|
||||
|
||||
private:
|
||||
|
@ -26,7 +26,7 @@ private:
|
|||
*/
|
||||
class WebServerException : public std::exception {
|
||||
public:
|
||||
WebServerException( const std::string& msg );
|
||||
explicit WebServerException( const std::string& msg );
|
||||
/*const QString& what();
|
||||
|
||||
private:
|
||||
|
@ -40,7 +40,7 @@ private:
|
|||
*/
|
||||
class LogFormatException : public std::exception {
|
||||
public:
|
||||
LogFormatException( const std::string& msg );
|
||||
explicit LogFormatException( const std::string& msg );
|
||||
const QString& what();
|
||||
|
||||
private:
|
||||
|
@ -54,7 +54,7 @@ private:
|
|||
*/
|
||||
class LogParserException : public std::exception {
|
||||
public:
|
||||
LogParserException( const std::string& txt, const std::string& val );
|
||||
explicit LogParserException( const std::string& txt, const std::string& val );
|
||||
const QString& what();
|
||||
|
||||
private:
|
||||
|
@ -68,7 +68,7 @@ private:
|
|||
*/
|
||||
class DateTimeException : public std::exception {
|
||||
public:
|
||||
DateTimeException( const std::string& msg );
|
||||
explicit DateTimeException( const std::string& msg );
|
||||
/*const QString& what();
|
||||
|
||||
private:
|
||||
|
@ -82,7 +82,7 @@ private:
|
|||
*/
|
||||
class BWlistException : public std::exception {
|
||||
public:
|
||||
BWlistException( const std::string& msg );
|
||||
explicit BWlistException( const std::string& msg );
|
||||
/*const QString& what();
|
||||
|
||||
private:
|
||||
|
|
|
@ -9,17 +9,17 @@ TextBrowser::TextBrowser()
|
|||
|
||||
|
||||
// getters
|
||||
const bool& TextBrowser::getWideLinesUsage()
|
||||
const bool& TextBrowser::getWideLinesUsage() const
|
||||
{
|
||||
return this->wide_lines;
|
||||
}
|
||||
|
||||
const int& TextBrowser::getColorSchemeID()
|
||||
const int& TextBrowser::getColorSchemeID() const
|
||||
{
|
||||
return this->color_scheme_id;
|
||||
}
|
||||
|
||||
const std::unordered_map<std::string, QString>& TextBrowser::getColorScheme()
|
||||
const std::unordered_map<std::string, QString>& TextBrowser::getColorScheme() const
|
||||
{
|
||||
return this->color_scheme;
|
||||
}
|
||||
|
@ -29,12 +29,12 @@ const std::unordered_map<std::string, QString>& TextBrowser::getColorScheme()
|
|||
return this->font_size;
|
||||
}*/
|
||||
|
||||
const QString& TextBrowser::getFontFamily()
|
||||
const QString& TextBrowser::getFontFamily() const
|
||||
{
|
||||
return this->font_family;
|
||||
}
|
||||
|
||||
const QFont& TextBrowser::getFont()
|
||||
const QFont& TextBrowser::getFont() const
|
||||
{
|
||||
return this->font;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ void TextBrowser::setFont( const QFont& font )
|
|||
|
||||
|
||||
// preview
|
||||
void TextBrowser::makePreview( QString& content )
|
||||
void TextBrowser::makePreview( QString& content ) const
|
||||
{
|
||||
content += QString("<!DOCTYPE html><html><head></head><body");
|
||||
if ( this->color_scheme_id > 0 ) {
|
||||
|
@ -79,7 +79,7 @@ void TextBrowser::makePreview( QString& content )
|
|||
this->color_scheme.at("text") );
|
||||
}
|
||||
content += ">";
|
||||
if ( wide_lines ) {
|
||||
if ( this->wide_lines ) {
|
||||
content += "<br/>";
|
||||
}
|
||||
for ( int i=0; i<32; i++ ) {
|
||||
|
|
|
@ -14,28 +14,28 @@
|
|||
class TextBrowser
|
||||
{
|
||||
public:
|
||||
TextBrowser();
|
||||
explicit TextBrowser();
|
||||
|
||||
|
||||
/////////////////
|
||||
//// GETTERS ////
|
||||
|
||||
//! Returns whether the wide lines option is set to be used or not
|
||||
const bool& getWideLinesUsage();
|
||||
const bool& getWideLinesUsage() const;
|
||||
|
||||
//! Returns the ID of the color scheme in use
|
||||
const int& getColorSchemeID();
|
||||
const int& getColorSchemeID() const;
|
||||
|
||||
//! Returns the color scheme in use
|
||||
const std::unordered_map<std::string, QString>& getColorScheme();
|
||||
const std::unordered_map<std::string, QString>& getColorScheme() const;
|
||||
|
||||
/*const int& getFontSize();*/
|
||||
|
||||
//! Returns the family of the font in use
|
||||
const QString& getFontFamily();
|
||||
const QString& getFontFamily() const;
|
||||
|
||||
//! Returns the font in use
|
||||
const QFont& getFont();
|
||||
const QFont& getFont() const;
|
||||
|
||||
|
||||
/////////////////
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
/*!
|
||||
\param content Will hold the preview string
|
||||
*/
|
||||
void makePreview( QString& content );
|
||||
void makePreview( QString& content ) const;
|
||||
|
||||
|
||||
private:
|
||||
|
|
|
@ -1997,12 +1997,12 @@ Los campos marcados como 'DISCARDED' se analizaron correctamente, pero
|
|||
<translation type="unfinished">blacklist</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="4138"/>
|
||||
<location filename="../mainwindow.cpp" line="4141"/>
|
||||
<source>copy</source>
|
||||
<translation type="unfinished">copia</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="4140"/>
|
||||
<location filename="../mainwindow.cpp" line="4143"/>
|
||||
<source>copies</source>
|
||||
<translation type="unfinished">copias</translation>
|
||||
</message>
|
||||
|
@ -2010,17 +2010,17 @@ Los campos marcados como 'DISCARDED' se analizaron correctamente, pero
|
|||
<context>
|
||||
<name>RichText</name>
|
||||
<message>
|
||||
<location filename="../utilities/rtf.cpp" line="218"/>
|
||||
<location filename="../utilities/rtf.cpp" line="219"/>
|
||||
<source>Select a file from the list</source>
|
||||
<translation type="unfinished">Seleccione un archivo de la lista</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../utilities/rtf.cpp" line="219"/>
|
||||
<location filename="../utilities/rtf.cpp" line="220"/>
|
||||
<source>to inspect its content</source>
|
||||
<translation type="unfinished">para inspeccionar su contenido</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../utilities/rtf.cpp" line="227"/>
|
||||
<location filename="../utilities/rtf.cpp" line="228"/>
|
||||
<source>Failed to read</source>
|
||||
<translation type="unfinished">Fracaso en la lectura</translation>
|
||||
</message>
|
||||
|
@ -2145,80 +2145,80 @@ Los campos marcados como 'DISCARDED' se analizaron correctamente, pero
|
|||
<translation type="unfinished">VERDADERO</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="432"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="446"/>
|
||||
<source>Log Lines Marked as Warning</source>
|
||||
<translation type="unfinished">Líneas Marcadas como Advertencia</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="591"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="605"/>
|
||||
<source>Time Taken to Serve Requests</source>
|
||||
<translation type="unfinished">Tiempo Necesario para Atender las Solicitudes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="664"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="678"/>
|
||||
<source>Others</source>
|
||||
<translation type="unfinished">Otros</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="769"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="888"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="783"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="900"/>
|
||||
<source>Time of Day Count</source>
|
||||
<translation type="unfinished">Recuento de la Hora del Día</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="710"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="859"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="724"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="871"/>
|
||||
<source>from</source>
|
||||
<translation type="unfinished">de</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="712"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="861"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="726"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="873"/>
|
||||
<source>to</source>
|
||||
<translation type="unfinished">a</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="243"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="253"/>
|
||||
<source>Unexpected WebServer</source>
|
||||
<translation type="unfinished">WebServer inesperdado</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="244"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="254"/>
|
||||
<source>An error occured while processing</source>
|
||||
<translation type="unfinished">Ocurrió un error durante el procesamiento</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="245"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="255"/>
|
||||
<source>An error occured while processing dates</source>
|
||||
<translation type="unfinished">Ocurrió un error al procesar las fechas</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="246"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="256"/>
|
||||
<source>An error occured while parsing %1 from the database</source>
|
||||
<translation type="unfinished">Ocurrió un error al procesar los %1 en la base de datos</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="247"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="257"/>
|
||||
<source>Years</source>
|
||||
<translation>Años</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="248"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="258"/>
|
||||
<source>Months</source>
|
||||
<translation>Meses</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="249"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="259"/>
|
||||
<source>Days</source>
|
||||
<translation>Días</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="250"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="260"/>
|
||||
<source>Value responsible for the error</source>
|
||||
<translation type="unfinished">Valor responsable del error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="251"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="261"/>
|
||||
<source>Database table name</source>
|
||||
<translation type="unfinished">Nombre de la tabla de la base de datos</translation>
|
||||
</message>
|
||||
|
|
|
@ -1997,12 +1997,12 @@ Les champs marqués comme 'DISCARDED' ont été analysés correctement
|
|||
<translation type="unfinished">blacklist</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="4138"/>
|
||||
<location filename="../mainwindow.cpp" line="4141"/>
|
||||
<source>copy</source>
|
||||
<translation type="unfinished">copie</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="4140"/>
|
||||
<location filename="../mainwindow.cpp" line="4143"/>
|
||||
<source>copies</source>
|
||||
<translation type="unfinished">copies</translation>
|
||||
</message>
|
||||
|
@ -2010,17 +2010,17 @@ Les champs marqués comme 'DISCARDED' ont été analysés correctement
|
|||
<context>
|
||||
<name>RichText</name>
|
||||
<message>
|
||||
<location filename="../utilities/rtf.cpp" line="218"/>
|
||||
<location filename="../utilities/rtf.cpp" line="219"/>
|
||||
<source>Select a file from the list</source>
|
||||
<translation type="unfinished">Sélectionnez un fichier dans la liste</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../utilities/rtf.cpp" line="219"/>
|
||||
<location filename="../utilities/rtf.cpp" line="220"/>
|
||||
<source>to inspect its content</source>
|
||||
<translation type="unfinished">pour inspecter son contenu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../utilities/rtf.cpp" line="227"/>
|
||||
<location filename="../utilities/rtf.cpp" line="228"/>
|
||||
<source>Failed to read</source>
|
||||
<translation type="unfinished">Echec en lecture</translation>
|
||||
</message>
|
||||
|
@ -2145,80 +2145,80 @@ Les champs marqués comme 'DISCARDED' ont été analysés correctement
|
|||
<translation type="unfinished">VRAI</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="432"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="446"/>
|
||||
<source>Log Lines Marked as Warning</source>
|
||||
<translation type="unfinished">Lignes Marquées comme Avertissement</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="591"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="605"/>
|
||||
<source>Time Taken to Serve Requests</source>
|
||||
<translation type="unfinished">Temps Pris pour Traiter les Demandes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="664"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="678"/>
|
||||
<source>Others</source>
|
||||
<translation type="unfinished">Autres</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="769"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="888"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="783"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="900"/>
|
||||
<source>Time of Day Count</source>
|
||||
<translation type="unfinished">Compter les Heures de la Journée</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="710"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="859"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="724"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="871"/>
|
||||
<source>from</source>
|
||||
<translation type="unfinished">de</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="712"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="861"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="726"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="873"/>
|
||||
<source>to</source>
|
||||
<translation type="unfinished">à</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="243"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="253"/>
|
||||
<source>Unexpected WebServer</source>
|
||||
<translation type="unfinished">WebServer inattendu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="244"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="254"/>
|
||||
<source>An error occured while processing</source>
|
||||
<translation type="unfinished">Une erreur s'est produite lors du traitement</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="245"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="255"/>
|
||||
<source>An error occured while processing dates</source>
|
||||
<translation type="unfinished">Une erreur s'est produite lors du traitement des dates</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="246"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="256"/>
|
||||
<source>An error occured while parsing %1 from the database</source>
|
||||
<translation type="unfinished">Erreur lors du traitement de '%1' dans la database</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="247"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="257"/>
|
||||
<source>Years</source>
|
||||
<translation>Ans</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="248"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="258"/>
|
||||
<source>Months</source>
|
||||
<translation>Mois</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="249"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="259"/>
|
||||
<source>Days</source>
|
||||
<translation>Journées</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="250"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="260"/>
|
||||
<source>Value responsible for the error</source>
|
||||
<translation type="unfinished">Valeur responsable de l'erreur</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="251"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="261"/>
|
||||
<source>Database table name</source>
|
||||
<translation type="unfinished">Nom de la table de la base de données</translation>
|
||||
</message>
|
||||
|
|
|
@ -1996,12 +1996,12 @@ Campos marcados como 'DISCARDED' analisados corretamente, mas o
|
|||
<translation type="unfinished">lista negra</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="4138"/>
|
||||
<location filename="../mainwindow.cpp" line="4141"/>
|
||||
<source>copy</source>
|
||||
<translation type="unfinished">copia</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="4140"/>
|
||||
<location filename="../mainwindow.cpp" line="4143"/>
|
||||
<source>copies</source>
|
||||
<translation type="unfinished">copias</translation>
|
||||
</message>
|
||||
|
@ -2009,17 +2009,17 @@ Campos marcados como 'DISCARDED' analisados corretamente, mas o
|
|||
<context>
|
||||
<name>RichText</name>
|
||||
<message>
|
||||
<location filename="../utilities/rtf.cpp" line="218"/>
|
||||
<location filename="../utilities/rtf.cpp" line="219"/>
|
||||
<source>Select a file from the list</source>
|
||||
<translation type="unfinished">Selecione um arquivo da lista</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../utilities/rtf.cpp" line="219"/>
|
||||
<location filename="../utilities/rtf.cpp" line="220"/>
|
||||
<source>to inspect its content</source>
|
||||
<translation type="unfinished">para inspecionar seu conteúdo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../utilities/rtf.cpp" line="227"/>
|
||||
<location filename="../utilities/rtf.cpp" line="228"/>
|
||||
<source>Failed to read</source>
|
||||
<translation type="unfinished">Falha em ler</translation>
|
||||
</message>
|
||||
|
@ -2144,80 +2144,80 @@ Campos marcados como 'DISCARDED' analisados corretamente, mas o
|
|||
<translation type="unfinished">VERDADEIRO</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="432"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="446"/>
|
||||
<source>Log Lines Marked as Warning</source>
|
||||
<translation type="unfinished">Linhas Marcadas como Aviso</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="591"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="605"/>
|
||||
<source>Time Taken to Serve Requests</source>
|
||||
<translation type="unfinished">Tempo Necessário para Atender às Solicitações</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="664"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="678"/>
|
||||
<source>Others</source>
|
||||
<translation type="unfinished">Outros</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="769"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="888"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="783"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="900"/>
|
||||
<source>Time of Day Count</source>
|
||||
<translation type="unfinished">Contagem de Horas do Dia</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="710"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="859"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="724"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="871"/>
|
||||
<source>from</source>
|
||||
<translation type="unfinished">de</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="712"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="861"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="726"/>
|
||||
<location filename="../modules/crapview/crapview.cpp" line="873"/>
|
||||
<source>to</source>
|
||||
<translation type="unfinished">a</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="243"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="253"/>
|
||||
<source>Unexpected WebServer</source>
|
||||
<translation type="unfinished">Servidor Web inesperado</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="244"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="254"/>
|
||||
<source>An error occured while processing</source>
|
||||
<translation type="unfinished">Ocorreu um erro durante o processamento</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="245"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="255"/>
|
||||
<source>An error occured while processing dates</source>
|
||||
<translation type="unfinished">Ocorreu um erro ao processar as datas</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="246"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="256"/>
|
||||
<source>An error occured while parsing %1 from the database</source>
|
||||
<translation type="unfinished">Ocorreu um erro ao processar %1 na base de dados</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="247"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="257"/>
|
||||
<source>Years</source>
|
||||
<translation>Anos</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="248"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="258"/>
|
||||
<source>Months</source>
|
||||
<translation>Meses</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="249"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="259"/>
|
||||
<source>Days</source>
|
||||
<translation>Dias</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="250"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="260"/>
|
||||
<source>Value responsible for the error</source>
|
||||
<translation type="unfinished">Valor responsável pelo erro</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../modules/crapview/modules/query.h" line="251"/>
|
||||
<location filename="../modules/crapview/modules/query.h" line="261"/>
|
||||
<source>Database table name</source>
|
||||
<translation type="unfinished">Nome da tabela do banco de dados</translation>
|
||||
</message>
|
||||
|
|
|
@ -16,7 +16,7 @@ class CheckSec
|
|||
{
|
||||
|
||||
public:
|
||||
CheckSec();
|
||||
explicit CheckSec();
|
||||
|
||||
//! Checks the structure's integrity of the Collection database
|
||||
/*!
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
class ColorSec
|
||||
{
|
||||
public:
|
||||
ColorSec();
|
||||
explicit ColorSec();
|
||||
|
||||
//! Provides a map with pre-made colors
|
||||
static const std::unordered_map<std::string, QColor> getColors();
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
class GZutils
|
||||
{
|
||||
public:
|
||||
GZutils();
|
||||
explicit GZutils();
|
||||
|
||||
//! Reads a GZipped file
|
||||
/*!
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
class IOutils
|
||||
{
|
||||
public:
|
||||
IOutils();
|
||||
explicit IOutils();
|
||||
|
||||
//! Checks the existence of a file/folder
|
||||
/*!
|
||||
|
|
|
@ -17,7 +17,7 @@ Result<T>::Result( const bool ok, const T& data )
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
Result<T>::operator bool()
|
||||
Result<T>::operator bool() const
|
||||
{
|
||||
return this->result;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ const bool Result<T>::isErr()
|
|||
*/
|
||||
|
||||
template <typename T>
|
||||
const T& Result<T>::getData()
|
||||
const T& Result<T>::getData() const
|
||||
{
|
||||
if ( this->result ) {
|
||||
return this->data;
|
||||
|
|
|
@ -16,10 +16,10 @@ template <typename T>
|
|||
class Result
|
||||
{
|
||||
public:
|
||||
Result();
|
||||
Result( const bool ok, const T& data );
|
||||
explicit Result();
|
||||
explicit Result( const bool ok, const T& data );
|
||||
|
||||
explicit operator bool();
|
||||
explicit operator bool() const;
|
||||
|
||||
/*
|
||||
//! Checks if the operation was successful
|
||||
|
@ -30,7 +30,7 @@ public:
|
|||
*/
|
||||
|
||||
//! Returns the data
|
||||
const T& getData();
|
||||
const T& getData() const;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -18,9 +18,10 @@ void RichText::enrichLogs( QString &rich_content, const std::string& content, co
|
|||
// enrich the text
|
||||
rich_content.clear();
|
||||
rich_content.reserve( content.size() );
|
||||
rich_content += QString("<!DOCTYPE html><html><head></head><body");
|
||||
rich_content += "<!DOCTYPE html><html><head></head><body";
|
||||
if ( color_scheme > 0 ) {
|
||||
rich_content += " style=\"background:" + colors.at("background") + "; color:" + colors.at("text") + "\"";
|
||||
rich_content += QString(" style=\"background:%1; color:%2\"")
|
||||
.arg( colors.at("background"), colors.at("text") );
|
||||
}
|
||||
rich_content += ">";
|
||||
if ( wide_lines == true ) {
|
||||
|
@ -41,7 +42,7 @@ void RichText::enrichLogs( QString &rich_content, const std::string& content, co
|
|||
if ( wide_lines == true ) {
|
||||
rich_line += "<br/>";
|
||||
}
|
||||
rich_content.push_back( rich_line );
|
||||
rich_content.append( rich_line );
|
||||
continue;
|
||||
}
|
||||
i = 0;
|
||||
|
@ -203,10 +204,10 @@ void RichText::enrichLogs( QString &rich_content, const std::string& content, co
|
|||
if ( wide_lines == true ) {
|
||||
rich_line += "<br/>";
|
||||
}
|
||||
rich_content.push_back( rich_line );
|
||||
rich_content+= rich_line;
|
||||
}
|
||||
lines.clear();
|
||||
rich_content.push_back("</body></html>");
|
||||
rich_content += "</body></html>";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class RichText : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RichText();
|
||||
explicit RichText();
|
||||
|
||||
//! Enriches the content of a log file with HTML/CSS code
|
||||
/*!
|
||||
|
@ -31,7 +31,8 @@ public:
|
|||
QString& rich_content,
|
||||
const std::string& content,
|
||||
const FormatOps::LogsFormat& logs_format,
|
||||
TextBrowser& TB );
|
||||
TextBrowser& TB
|
||||
);
|
||||
|
||||
//! Provides the default string
|
||||
/*!
|
||||
|
|
|
@ -8,7 +8,7 @@ StringOps::StringOps()
|
|||
}
|
||||
|
||||
|
||||
const int StringOps::count(const std::string& str, const std::string& flag, const bool& consecutives )
|
||||
const int StringOps::count( const std::string& str, const std::string& flag, const bool consecutives )
|
||||
{
|
||||
size_t start=0, aux_start=0, count=0;
|
||||
while (true) {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
class StringOps
|
||||
{
|
||||
public:
|
||||
StringOps();
|
||||
explicit StringOps();
|
||||
|
||||
|
||||
//! Count the occurrences of the given sequence in the given string
|
||||
|
@ -20,7 +20,7 @@ public:
|
|||
\param str The target string
|
||||
\return The number of occurrences
|
||||
*/
|
||||
static const int count( const std::string& str, const std::string& flag, const bool& consecutives=true );
|
||||
static const int count( const std::string& str, const std::string& flag, const bool consecutives=true );
|
||||
|
||||
//! Checks whether a string only contains numeric characters
|
||||
/*!
|
||||
|
|
|
@ -10,7 +10,7 @@ StyleSec::StyleSec()
|
|||
}
|
||||
|
||||
|
||||
void StyleSec::getStyleSheet( QString& stylesheet, const QString& icons_theme, const int& theme_id )
|
||||
void StyleSec::getStyleSheet( QString& stylesheet, const QString& icons_theme, const int theme_id )
|
||||
{
|
||||
std::unordered_map<std::string, QString> style_map;
|
||||
switch ( theme_id ) {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
class StyleSec
|
||||
{
|
||||
public:
|
||||
StyleSec();
|
||||
explicit StyleSec();
|
||||
|
||||
//! Provides the requested stylesheet
|
||||
/*!
|
||||
|
@ -21,7 +21,7 @@ public:
|
|||
\param icons_theme The theme selected for the Icons
|
||||
\param theme_id The theme selected for the Window
|
||||
*/
|
||||
static void getStyleSheet( QString& stylesheet, const QString& icons_theme, const int& theme_id );
|
||||
static void getStyleSheet( QString& stylesheet, const QString& icons_theme, const int theme_id );
|
||||
|
||||
private:
|
||||
|
||||
|
|
Loading…
Reference in New Issue