Commit 000e8b21 authored by wenqing's avatar wenqing

[DataMemberRenaming: move underscore to end] cpp files in Application

parent ae9b2e82
Pipeline #938 passed with stages
in 66 minutes and 26 seconds
......@@ -158,7 +158,7 @@ TestDefinition::TestDefinition(BaseLib::ConfigTree const& config_tree,
// Construct command lines for each entry.
//! \ogs_file_param{prj__test_definition__vtkdiff}
auto const& vtkdiff_configs = config_tree.getConfigSubtreeList("vtkdiff");
_command_lines.reserve(vtkdiff_configs.size());
command_lines_.reserve(vtkdiff_configs.size());
for (auto const& vtkdiff_config : vtkdiff_configs)
{
std::string const& field_name =
......@@ -246,7 +246,7 @@ TestDefinition::TestDefinition(BaseLib::ConfigTree const& config_tree,
{
std::string const& output_filename =
BaseLib::joinPaths(output_directory, filename);
_output_files.push_back(output_filename);
output_files_.push_back(output_filename);
std::string const& reference_filename =
BaseLib::joinPaths(reference_path, filename);
......@@ -259,7 +259,7 @@ TestDefinition::TestDefinition(BaseLib::ConfigTree const& config_tree,
" " + safeString(output_filename) + " " +
absolute_tolerance_parameter + " " + relative_tolerance_parameter;
INFO("Will run '{:s}'", command_line);
_command_lines.emplace_back(std::move(command_line));
command_lines_.emplace_back(std::move(command_line));
}
}
}
......@@ -267,7 +267,7 @@ TestDefinition::TestDefinition(BaseLib::ConfigTree const& config_tree,
bool TestDefinition::runTests() const
{
std::vector<int> return_values;
transform(begin(_command_lines), end(_command_lines),
transform(begin(command_lines_), end(command_lines_),
back_inserter(return_values),
[](std::string const& command_line) {
int const return_value = std::system(command_line.c_str());
......@@ -285,11 +285,11 @@ bool TestDefinition::runTests() const
std::vector<std::string> const& TestDefinition::getOutputFiles() const
{
return _output_files;
return output_files_;
}
std::size_t TestDefinition::numberOfTests() const
{
return size(_command_lines);
return size(command_lines_);
}
} // namespace ApplicationsLib
......@@ -21,13 +21,13 @@ ColorPickerPushButton::ColorPickerPushButton( QWidget* parent /*= 0*/ )
: QPushButton(parent)
{
setAutoFillBackground(true);
_color = QColor("white");
color_ = QColor("white");
}
void ColorPickerPushButton::mouseReleaseEvent(QMouseEvent* e)
{
Q_UNUSED(e);
QColor newColor = QColorDialog::getColor(_color, nullptr, "Choose a color");
QColor newColor = QColorDialog::getColor(color_, nullptr, "Choose a color");
if (!newColor.isValid())
{
return;
......@@ -35,7 +35,7 @@ void ColorPickerPushButton::mouseReleaseEvent(QMouseEvent* e)
setColor(newColor);
emit colorPicked(_color);
emit colorPicked(color_);
}
QString ColorPickerPushButton::colorToCss( QColor color )
......@@ -61,10 +61,10 @@ QString ColorPickerPushButton::colorToString( QColor color )
void ColorPickerPushButton::setColor( QColor color )
{
_color = color;
color_ = color;
// Compute text color
QColor hsv = _color.toHsv();
QColor hsv = color_.toHsv();
QString textColorStr;
if (hsv.valueF() < 0.5f)
{
......@@ -76,12 +76,12 @@ void ColorPickerPushButton::setColor( QColor color )
}
QString stylesheetStr = "background-color: ";
stylesheetStr.append(colorToCss(_color));
stylesheetStr.append(colorToCss(color_));
stylesheetStr.append(";");
stylesheetStr.append(textColorStr);
this->setStyleSheet(stylesheetStr);
this->setText(colorToString(_color));
this->setText(colorToString(color_));
}
void ColorPickerPushButton::setColor( double* color )
......
......@@ -21,37 +21,37 @@
RecentFiles::RecentFiles(QObject* parent, const char* slot,
QString settingsName)
: QObject(parent), _settingsName(std::move(settingsName))
: QObject(parent), settingsName_(std::move(settingsName))
{
_filesMenu = new QMenu(tr("Recent files"));
for (auto& fileAction : _fileActions)
filesMenu_ = new QMenu(tr("Recent files"));
for (auto& fileAction : fileActions_)
{
fileAction = new QAction(this);
fileAction->setVisible(false);
connect(fileAction, SIGNAL(triggered()), parent, slot);
_filesMenu->addAction(fileAction);
filesMenu_->addAction(fileAction);
}
updateRecentFileActions();
}
RecentFiles::~RecentFiles()
{
delete _filesMenu;
delete filesMenu_;
}
QMenu* RecentFiles::menu()
{
return _filesMenu;
return filesMenu_;
}
void RecentFiles::setCurrentFile( const QString& filename )
{
_currentFile = filename;
currentFile_ = filename;
QSettings settings;
QStringList files = settings.value(_settingsName).toStringList();
QStringList files = settings.value(settingsName_).toStringList();
files.removeAll(filename);
files.prepend(filename);
while (files.size() > _maxFiles)
while (files.size() > maxFiles_)
{
files.removeLast();
}
......@@ -63,21 +63,21 @@ void RecentFiles::setCurrentFile( const QString& filename )
void RecentFiles::updateRecentFileActions()
{
QSettings settings;
QStringList files = settings.value(_settingsName).toStringList();
QStringList files = settings.value(settingsName_).toStringList();
int numFiles = qMin(files.size(), static_cast<int>(_maxFiles));
int numFiles = qMin(files.size(), static_cast<int>(maxFiles_));
for (int i = 0; i < numFiles; ++i)
{
QString text = tr("&%1 %2").arg(i + 1).arg(strippedName(files[i]));
_fileActions[i]->setText(text);
_fileActions[i]->setData(files[i]);
_fileActions[i]->setVisible(true);
fileActions_[i]->setText(text);
fileActions_[i]->setData(files[i]);
fileActions_[i]->setVisible(true);
}
for (int i = numFiles; i < _maxFiles; ++i)
for (int i = numFiles; i < maxFiles_; ++i)
{
_fileActions[i]->setVisible(false);
fileActions_[i]->setVisible(false);
}
}
......
......@@ -21,19 +21,19 @@
* and the data associated with each column.
*/
TreeItem::TreeItem(QList<QVariant> data, TreeItem* parent)
: _itemData(std::move(data)), _parentItem(parent)
: itemData_(std::move(data)), parentItem_(parent)
{
}
/**
* A pointer to each of the child items belonging to this item
* will be stored in the _childItems private member variable. When
* will be stored in the childItems_ private member variable. When
* the class's destructor is called, it must delete each of these
* to ensure that their memory is reused.
*/
TreeItem::~TreeItem()
{
qDeleteAll(_childItems);
qDeleteAll(childItems_);
}
/**
......@@ -41,7 +41,7 @@ TreeItem::~TreeItem()
*/
void TreeItem::appendChild(TreeItem* item)
{
_childItems.append(item);
childItems_.append(item);
}
/**
......@@ -51,20 +51,20 @@ void TreeItem::appendChild(TreeItem* item)
*/
TreeItem* TreeItem::child(int row) const
{
if (_childItems.count() > row)
if (childItems_.count() > row)
{
return _childItems.value(row);
return childItems_.value(row);
}
return nullptr;
}
/**
* Returns the number of _childItems
* Returns the number of childItems_
*/
int TreeItem::childCount() const
{
return _childItems.count();
return childItems_.count();
}
/**
......@@ -72,9 +72,9 @@ int TreeItem::childCount() const
*/
int TreeItem::row() const
{
if (_parentItem)
if (parentItem_)
{
return _parentItem->_childItems.indexOf(const_cast<TreeItem*>(this));
return parentItem_->childItems_.indexOf(const_cast<TreeItem*>(this));
}
return 0;
......@@ -85,7 +85,7 @@ int TreeItem::row() const
*/
int TreeItem::columnCount() const
{
return _itemData.count();
return itemData_.count();
}
/**
......@@ -93,7 +93,7 @@ int TreeItem::columnCount() const
*/
QVariant TreeItem::data(int column) const
{
return _itemData.value(column);
return itemData_.value(column);
}
/**
......@@ -101,12 +101,12 @@ QVariant TreeItem::data(int column) const
*/
bool TreeItem::setData( int column, const QVariant &value )
{
if (column < 0 || column >= _itemData.size())
if (column < 0 || column >= itemData_.size())
{
return false;
}
_itemData[column] = value;
itemData_[column] = value;
return true;
}
/**
......@@ -114,7 +114,7 @@ bool TreeItem::setData( int column, const QVariant &value )
*/
TreeItem* TreeItem::parentItem() const
{
return _parentItem;
return parentItem_;
}
/**
......@@ -122,14 +122,14 @@ TreeItem* TreeItem::parentItem() const
*/
bool TreeItem::removeChildren(int position, int count)
{
if (position < 0 || position + count > _childItems.size())
if (position < 0 || position + count > childItems_.size())
{
return false;
}
for (int row = 0; row < count; ++row)
{
delete _childItems.takeAt(position);
delete childItems_.takeAt(position);
}
return true;
......
......@@ -26,16 +26,16 @@
TreeModel::TreeModel( QObject* parent )
: QAbstractItemModel(parent)
{
//_modelType = TREE_MODEL;
//modelType_ = TREE_MODEL;
QList<QVariant> rootData;
rootData << "1" << "2" << "3";
_rootItem = new TreeItem(rootData, nullptr);
//setupModelData(data, _rootItem);
rootItem_ = new TreeItem(rootData, nullptr);
//setupModelData(data, rootItem_);
}
TreeModel::~TreeModel()
{
delete _rootItem;
delete rootItem_;
}
/**
......@@ -59,7 +59,7 @@ QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) con
if (!parent.isValid())
{
parentItem = _rootItem;
parentItem = rootItem_;
}
else
{
......@@ -88,7 +88,7 @@ QModelIndex TreeModel::parent(const QModelIndex &index) const
auto* childItem = static_cast<TreeItem*>(index.internalPointer());
TreeItem* parentItem = childItem->parentItem();
if (parentItem == _rootItem)
if (parentItem == rootItem_)
{
return QModelIndex();
}
......@@ -110,7 +110,7 @@ int TreeModel::rowCount(const QModelIndex &parent) const
if (!parent.isValid())
{
parentItem = _rootItem;
parentItem = rootItem_;
}
else
{
......@@ -130,7 +130,7 @@ int TreeModel::columnCount(const QModelIndex &parent) const
return static_cast<TreeItem*>(parent.internalPointer())->columnCount();
}
return _rootItem->columnCount();
return rootItem_->columnCount();
}
void TreeModel::updateData()
......@@ -195,14 +195,14 @@ TreeItem* TreeModel::getItem(const QModelIndex &index) const
return item;
}
}
return _rootItem;
return rootItem_;
}
QVariant TreeModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
{
return _rootItem->data(section);
return rootItem_->data(section);
}
return QVariant();
......@@ -290,5 +290,5 @@ void TreeModel::setupModelData(const QStringList &lines, TreeItem* parent)
TreeItem* TreeModel::rootItem() const
{
return _rootItem;
return rootItem_;
}
......@@ -19,24 +19,24 @@
#include "TreeModel.h"
TreeModelIterator::TreeModelIterator(TreeModel* model)
: _current(nullptr), _model(model)
: current_(nullptr), model_(model)
{
if (_model->rootItem()->childCount() > 0)
if (model_->rootItem()->childCount() > 0)
{
_current = _model->rootItem();
current_ = model_->rootItem();
}
}
TreeItem* TreeModelIterator::operator*() const
{
return _current;
return current_;
}
TreeModelIterator& TreeModelIterator::operator++()
{
if (_current)
if (current_)
{
_current = next(_current);
current_ = next(current_);
}
return *this;
......@@ -53,28 +53,28 @@ TreeItem* TreeModelIterator::next( const TreeItem* current )
if (current->childCount())
{
// walk the child
_parentIndex.push(_currentIndex);
_currentIndex = 0;
parentIndex_.push(currentIndex_);
currentIndex_ = 0;
next = current->child(0);
}
else
{
// walk the sibling
TreeItem* parent = current->parentItem();
next = parent ? parent->child(_currentIndex + 1)
: _model->rootItem()->child(_currentIndex + 1);
next = parent ? parent->child(currentIndex_ + 1)
: model_->rootItem()->child(currentIndex_ + 1);
while (!next && parent)
{
// if we had no sibling walk up the parent
// and try the sibling of that
parent = parent->parentItem();
_currentIndex = _parentIndex.pop();
next = parent ? parent->child(_currentIndex + 1)
: _model->rootItem()->child(_currentIndex + 1);
currentIndex_ = parentIndex_.pop();
next = parent ? parent->child(currentIndex_ + 1)
: model_->rootItem()->child(currentIndex_ + 1);
}
if (next)
{
++(_currentIndex);
++(currentIndex_);
}
}
return next;
......
......@@ -30,8 +30,8 @@ Q_DECLARE_METATYPE(QModelIndex)
/*!
Connect to all of the models signals. Whenever anything happens recheck everything.
*/
ModelTest::ModelTest(QAbstractItemModel* _model,
QObject* parent) : QObject(parent), model(_model), fetchingMore(false)
ModelTest::ModelTest(QAbstractItemModel* model_,
QObject* parent) : QObject(parent), model(model_), fetchingMore(false)
{
Q_ASSERT(model);
......
......@@ -61,14 +61,14 @@ QVariant ColorTableModel::data( const QModelIndex& index, int role ) const
return QVariant();
}
if (index.row() >= _listOfPairs.size() || index.row() < 0)
if (index.row() >= listOfPairs_.size() || index.row() < 0)
{
return QVariant();
}
if (role == Qt::DisplayRole)
{
QPair<QString, QColor> pair = _listOfPairs.at(index.row());
QPair<QString, QColor> pair = listOfPairs_.at(index.row());
switch (index.column())
{
......@@ -104,7 +104,7 @@ bool ColorTableModel::buildTable(const std::map<std::string, DataHolderLib::Colo
*/
QPair<QString, QColor> pair(name, color);
_listOfPairs.insert(count++, pair);
listOfPairs_.insert(count++, pair);
}
endInsertRows();
......
......@@ -25,16 +25,16 @@
CondFromRasterDialog::CondFromRasterDialog(std::vector<MeshLib::Mesh*> msh_vec,
QDialog* parent)
: QDialog(parent), _msh_vec(std::move(msh_vec))
: QDialog(parent), msh_vec_(std::move(msh_vec))
{
setupUi(this);
this->scalingEdit->setEnabled(false);
_scale_validator = new StrictDoubleValidator(-1e+10, 1e+20, 5);
scale_validator_ = new StrictDoubleValidator(-1e+10, 1e+20, 5);
this->scalingEdit->setText("1.0");
this->scalingEdit->setValidator (_scale_validator);
this->scalingEdit->setValidator (scale_validator_);
for (auto mesh : _msh_vec)
for (auto mesh : msh_vec_)
{
this->meshBox->addItem(QString::fromStdString(mesh->getName()));
}
......@@ -44,7 +44,7 @@ CondFromRasterDialog::CondFromRasterDialog(std::vector<MeshLib::Mesh*> msh_vec,
CondFromRasterDialog::~CondFromRasterDialog()
{
delete _scale_validator;
delete scale_validator_;
}
void CondFromRasterDialog::on_selectButton_pressed()
......@@ -88,7 +88,7 @@ void CondFromRasterDialog::accept()
}
MeshLib::Mesh* mesh(nullptr);
for (auto mesh_ : _msh_vec)
for (auto mesh_ : msh_vec_)
{
if (mesh_->getName() == mesh_name)
{
......
......@@ -24,16 +24,16 @@
#include <QTextStream>
#include <limits>
DiagramList::DiagramList() : _xLabel(""), _yLabel(""), _xUnit(""), _yUnit("") {}
DiagramList::DiagramList() : xLabel_(""), yLabel_(""), xUnit_(""), yUnit_("") {}
DiagramList::~DiagramList() = default;
float DiagramList::calcMinXValue()
{
auto min = std::min_element(
_coords.begin(), _coords.end(),
coords_.begin(), coords_.end(),
[](auto const& c0, auto const& c1) { return c0.first < c1.first; });
if (min != _coords.end())
if (min != coords_.end())
{
return min->first;
}
......@@ -43,12 +43,12 @@ float DiagramList::calcMinXValue()
float DiagramList::calcMaxXValue()
{
float max = std::numeric_limits<float>::lowest();
std::size_t nCoords = _coords.size();
std::size_t nCoords = coords_.size();
for (std::size_t i = 0; i < nCoords; i++)
{
if (_coords[i].first > max)
if (coords_[i].first > max)
{