2009-03-01 08:38:21 +01:00
|
|
|
/*
|
|
|
|
* Cppcheck - A tool for static C/C++ code analysis
|
2009-05-30 07:48:12 +02:00
|
|
|
* Copyright (C) 2007-2009 Daniel Marjamäki and Cppcheck team.
|
2009-03-01 08:38:21 +01: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 SETTINGSDIALOG_H
|
|
|
|
#define SETTINGSDIALOG_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
2009-03-22 13:32:07 +01:00
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QComboBox>
|
|
|
|
#include <QSettings>
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QPushButton>
|
2009-05-23 12:37:30 +02:00
|
|
|
#include "applicationlist.h"
|
2009-03-22 13:32:07 +01:00
|
|
|
|
2009-05-23 12:37:30 +02:00
|
|
|
#include <QListWidget>
|
|
|
|
#include <QKeyEvent>
|
2009-03-22 13:32:07 +01:00
|
|
|
|
2009-03-01 08:38:21 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Settings dialog
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class SettingsDialog : public QDialog
|
|
|
|
{
|
2009-05-23 12:37:30 +02:00
|
|
|
Q_OBJECT
|
2009-03-01 08:38:21 +01:00
|
|
|
public:
|
2009-05-23 12:37:30 +02:00
|
|
|
SettingsDialog(QSettings &programSettings, ApplicationList &list);
|
2009-03-01 08:38:21 +01:00
|
|
|
virtual ~SettingsDialog();
|
2009-05-23 18:29:24 +02:00
|
|
|
|
2009-06-02 22:32:58 +02:00
|
|
|
/**
|
|
|
|
* @brief Save all values to QSettings
|
|
|
|
*
|
2009-05-23 18:29:24 +02:00
|
|
|
*/
|
2009-03-22 13:32:07 +01:00
|
|
|
void SaveCheckboxValues();
|
2009-05-23 12:37:30 +02:00
|
|
|
|
2009-06-03 20:18:22 +02:00
|
|
|
/**
|
|
|
|
* @brief Get checkbox value for mShowFullPath
|
|
|
|
*
|
|
|
|
* @return should full path of errors be shown in the tree
|
|
|
|
*/
|
|
|
|
bool ShowFullPath();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Get checkbox value for mSaveFullPath
|
|
|
|
*
|
|
|
|
* @return should full path of files be saved when creating a report
|
|
|
|
*/
|
|
|
|
bool SaveFullPath();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Get checkbox value for mSaveAllErrors
|
|
|
|
*
|
|
|
|
* @return should all errors be saved to report
|
|
|
|
*/
|
|
|
|
bool SaveAllErrors();
|
|
|
|
|
2009-05-23 12:37:30 +02:00
|
|
|
protected slots:
|
2009-06-02 22:32:58 +02:00
|
|
|
/**
|
|
|
|
* @brief Slot for clicking OK.
|
|
|
|
*
|
2009-05-24 11:08:51 +02:00
|
|
|
*/
|
|
|
|
void Ok();
|
2009-05-23 18:29:24 +02:00
|
|
|
|
2009-06-02 22:32:58 +02:00
|
|
|
/**
|
|
|
|
* @brief Slot for adding a new application to the list
|
|
|
|
*
|
2009-05-23 18:29:24 +02:00
|
|
|
*/
|
2009-05-23 12:37:30 +02:00
|
|
|
void AddApplication();
|
2009-05-23 18:29:24 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Slot for deleting an application from the list
|
|
|
|
*
|
|
|
|
*/
|
2009-05-23 12:37:30 +02:00
|
|
|
void DeleteApplication();
|
2009-05-23 18:29:24 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Slot for modifying an application in the list
|
|
|
|
*
|
|
|
|
*/
|
2009-05-23 12:37:30 +02:00
|
|
|
void ModifyApplication();
|
2009-05-23 18:29:24 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Slot for making the selected application as the default (first)
|
|
|
|
*
|
|
|
|
*/
|
2009-05-23 17:45:05 +02:00
|
|
|
void DefaultApplication();
|
2009-03-01 08:38:21 +01:00
|
|
|
protected:
|
2009-05-24 11:08:51 +02:00
|
|
|
|
2009-06-02 22:32:58 +02:00
|
|
|
/**
|
|
|
|
* @brief Clear all applications from the list and re insert them from mTempApplications
|
|
|
|
*
|
2009-05-24 11:08:51 +02:00
|
|
|
*/
|
2009-05-23 12:37:30 +02:00
|
|
|
void PopulateListWidget();
|
2009-05-24 11:08:51 +02:00
|
|
|
|
2009-03-22 14:15:16 +01:00
|
|
|
/**
|
|
|
|
* @brief Load saved values
|
|
|
|
* Loads dialog size and column widths.
|
|
|
|
*
|
|
|
|
*/
|
2009-03-22 13:32:07 +01:00
|
|
|
void SaveSettings();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Save settings
|
|
|
|
* Save dialog size and column widths.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void LoadSettings();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Save a single checkboxes value
|
|
|
|
*
|
|
|
|
* @param box checkbox to save
|
|
|
|
* @param name name for QSettings to store the value
|
|
|
|
*/
|
|
|
|
void SaveCheckboxValue(QCheckBox *box, const QString &name);
|
|
|
|
|
2009-03-22 14:15:16 +01:00
|
|
|
/**
|
|
|
|
* @brief Add a new checkbox to layout
|
|
|
|
*
|
|
|
|
* @param layout layout to add to
|
|
|
|
* @param label label for the checkbox
|
|
|
|
* @param settings QSettings name for default value
|
|
|
|
* @return newly created QCheckBox
|
|
|
|
*/
|
2009-03-22 13:32:07 +01:00
|
|
|
QCheckBox* AddCheckbox(QVBoxLayout *layout,
|
|
|
|
const QString &label,
|
|
|
|
const QString &settings,
|
|
|
|
bool value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Convert bool to Qt::CheckState
|
|
|
|
*
|
|
|
|
* @param yes value to convert
|
|
|
|
* @return value converted to Qt::CheckState
|
|
|
|
*/
|
|
|
|
Qt::CheckState BoolToCheckState(bool yes);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Converts Qt::CheckState to bool
|
|
|
|
*
|
|
|
|
* @param state Qt::CheckState to convert
|
|
|
|
* @return converted value
|
|
|
|
*/
|
|
|
|
bool CheckStateToBool(Qt::CheckState state);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief How many threads should cppcheck have
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
QLineEdit *mJobs;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Cppcheck setting
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
QCheckBox *mForce;
|
|
|
|
|
2009-06-03 20:18:22 +02:00
|
|
|
/**
|
|
|
|
* @brief Save all errors
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
QCheckBox *mSaveAllErrors;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Save full path of the file in error reports
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
QCheckBox *mSaveFullPath;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Show full path of file in results view
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
QCheckBox *mShowFullPath;
|
|
|
|
|
2009-06-02 22:32:58 +02:00
|
|
|
/**
|
|
|
|
* @brief List of all applications that can be started when right clicking
|
|
|
|
* an error
|
2009-05-23 12:37:30 +02:00
|
|
|
*/
|
|
|
|
QListWidget *mListWidget;
|
|
|
|
|
2009-03-22 13:32:07 +01:00
|
|
|
|
2009-03-22 14:15:16 +01:00
|
|
|
/**
|
2009-03-22 13:32:07 +01:00
|
|
|
* @brief Settings
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
QSettings &mSettings;
|
2009-05-23 18:29:24 +02:00
|
|
|
|
2009-06-02 22:32:58 +02:00
|
|
|
/**
|
|
|
|
* @brief List of applications user has specified
|
|
|
|
*
|
2009-05-23 18:29:24 +02:00
|
|
|
*/
|
2009-05-23 12:37:30 +02:00
|
|
|
ApplicationList &mApplications;
|
2009-05-24 11:08:51 +02:00
|
|
|
|
2009-06-02 22:32:58 +02:00
|
|
|
/**
|
|
|
|
* @brief Temporary list of applications
|
2009-05-24 11:08:51 +02:00
|
|
|
* This will be copied to actual list of applications (mApplications)
|
2009-06-02 22:32:58 +02:00
|
|
|
* when user clicks ok.
|
2009-05-24 11:08:51 +02:00
|
|
|
*/
|
|
|
|
ApplicationList mTempApplications;
|
2009-03-01 08:38:21 +01:00
|
|
|
private:
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SETTINGSDIALOG_H
|