2011-10-11 21:14:15 +02:00
|
|
|
/*
|
|
|
|
* Cppcheck - A tool for static C/C++ code analysis
|
2016-01-01 14:34:45 +01:00
|
|
|
* Copyright (C) 2007-2016 Cppcheck team.
|
2011-10-11 21:14:15 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SHOWTYPES_H
|
|
|
|
#define SHOWTYPES_H
|
|
|
|
|
2020-05-23 07:16:49 +02:00
|
|
|
#include "errortypes.h"
|
|
|
|
|
2011-10-11 21:14:15 +02:00
|
|
|
#include <QVariant>
|
|
|
|
|
|
|
|
/// @addtogroup GUI
|
|
|
|
/// @{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief A class for different show types we have.
|
|
|
|
* This class contains enum type for the different show types we have. Each
|
|
|
|
* show type presents one severity selectable in the GUI. In addition there
|
|
|
|
* are several supporting functions.
|
|
|
|
*
|
|
|
|
* Notice that the "visibility" settings are automatically loaded when the
|
|
|
|
* class is constructed and saved when the class is destroyed.
|
|
|
|
*/
|
2011-10-13 20:53:06 +02:00
|
|
|
class ShowTypes {
|
2011-10-11 21:14:15 +02:00
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Show types we have (i.e. severities in the GUI).
|
|
|
|
*/
|
2011-10-13 20:53:06 +02:00
|
|
|
enum ShowType {
|
2011-10-11 21:14:15 +02:00
|
|
|
ShowStyle = 0,
|
|
|
|
ShowWarnings,
|
|
|
|
ShowPerformance,
|
|
|
|
ShowPortability,
|
|
|
|
ShowInformation,
|
|
|
|
ShowErrors, // Keep this as last real item
|
|
|
|
ShowNone
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Constructor.
|
|
|
|
* @note Loads visibility settings.
|
|
|
|
*/
|
|
|
|
ShowTypes();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Destructor.
|
|
|
|
* @note Saves visibility settings.
|
|
|
|
*/
|
|
|
|
~ShowTypes();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Load visibility settings from the platform's settings storage.
|
|
|
|
*/
|
|
|
|
void load();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Save visibility settings to the platform's settings storage.
|
|
|
|
*/
|
2012-10-27 12:10:32 +02:00
|
|
|
void save() const;
|
2011-10-11 21:14:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Is the showtype visible in the GUI?
|
|
|
|
* @param category Showtype to check.
|
|
|
|
* @return true if the showtype is visible.
|
|
|
|
*/
|
|
|
|
bool isShown(ShowTypes::ShowType category) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Is the severity visible in the GUI?
|
|
|
|
* @param severity severity to check.
|
|
|
|
* @return true if the severity is visible.
|
|
|
|
*/
|
|
|
|
bool isShown(Severity::SeverityType severity) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Show/hide the showtype.
|
|
|
|
* @param category Showtype whose visibility to set.
|
2012-10-24 01:20:14 +02:00
|
|
|
* @param showing true if the severity is set visible.
|
2011-10-11 21:14:15 +02:00
|
|
|
*/
|
2012-10-24 01:20:14 +02:00
|
|
|
void show(ShowTypes::ShowType category, bool showing);
|
2011-10-11 21:14:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Convert severity string to ShowTypes value
|
|
|
|
* @param severity Error severity
|
|
|
|
* @return Severity converted to ShowTypes value
|
|
|
|
*/
|
|
|
|
static ShowTypes::ShowType SeverityToShowType(Severity::SeverityType severity);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Convert ShowType to severity string
|
|
|
|
* @param type ShowType to convert
|
|
|
|
* @return ShowType converted to severity
|
|
|
|
*/
|
|
|
|
static Severity::SeverityType ShowTypeToSeverity(ShowTypes::ShowType type);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Convert QVariant (that contains an int) to Showtypes value
|
|
|
|
*
|
|
|
|
* @param data QVariant (that contains an int) to be converted
|
|
|
|
* @return data converted to ShowTypes
|
|
|
|
*/
|
|
|
|
static ShowTypes::ShowType VariantToShowType(const QVariant &data);
|
|
|
|
|
|
|
|
bool mVisible[ShowNone];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// @}
|
|
|
|
|
|
|
|
#endif // SHOWTYPES_H
|