Big-Ugly Style Update (#278)

* Bulk replaced tabs with spaces
* Bulk removed trailing whitespace from lines
* Replaced c-style comments with c++-style comments in file banners
* Replace nested namespace definitions with single concise definitions (C++17), this keeps the indentation more manageable
* Cleanup ordering and spacing of include directives
* Bulk renaming of header file extensions from '.h' to '.hpp'.
* Update CODING-STYLE.md
* Update target_compile_features from cxx_std_11 to cxx_std_20.
* Refresh .clang-format file.  Still needs a lot of tweaking.
This commit is contained in:
Jaye Evins
2026-01-07 19:43:34 -05:00
committed by GitHub
parent 3cd173a37f
commit 1c902230fe
454 changed files with 51827 additions and 52031 deletions
+167 -170
View File
@@ -1,201 +1,198 @@
/* Merge/Merge.cpp
*
* Copyright (C) 2015-2016 Jaye Evins <evins@snaught.com>
*
* This file is part of gLabels-qt.
*
* gLabels-qt 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.
*
* gLabels-qt 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 gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
*/
// Merge/Merge.cpp
//
// Copyright (C) 2015-2016 Jaye Evins <evins@snaught.com>
//
// This file is part of gLabels-qt.
//
// gLabels-qt 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.
//
// gLabels-qt 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 gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
//
#include "Merge.h"
#include "Merge.hpp"
namespace glabels
namespace glabels::merge
{
namespace merge
{
///
/// Constructor
///
Merge::Merge( const Merge* merge )
: mId(merge->mId),
mSource(merge->mSource),
mRecordList(merge->mRecordList)
{
}
///
/// Constructor
///
Merge::Merge( const Merge* merge )
: mId(merge->mId),
mSource(merge->mSource),
mRecordList(merge->mRecordList)
{
}
///
/// Get id
///
QString Merge::id() const
{
return mId;
}
///
/// Get id
///
QString Merge::id() const
{
return mId;
}
///
/// Get source
///
QString Merge::source() const
{
return mSource;
}
///
/// Get source
///
QString Merge::source() const
{
return mSource;
}
///
/// Set source
///
void Merge::setSource( const QString& source )
{
mSource = source;
///
/// Set source
///
void Merge::setSource( const QString& source )
{
mSource = source;
// Clear out any old records
mRecordList.clear();
// Clear out any old records
mRecordList.clear();
open();
for ( Record record = readNextRecord(); !record.isEmpty(); record = readNextRecord() )
{
mRecordList.push_back( record );
}
close();
emit sourceChanged();
}
open();
for ( Record record = readNextRecord(); !record.isEmpty(); record = readNextRecord() )
{
mRecordList.push_back( record );
}
close();
emit sourceChanged();
}
///
/// Reload source
///
void Merge::reloadSource()
{
// temporary map of original selections
QMap<QString,bool> origSelectionMap;
///
/// Reload source
///
void Merge::reloadSource()
{
// temporary map of original selections
QMap<QString,bool> origSelectionMap;
for ( auto& record : mRecordList )
{
origSelectionMap[ record[ primaryKey() ] ] = record.isSelected();
}
for ( auto& record : mRecordList )
{
origSelectionMap[ record[ primaryKey() ] ] = record.isSelected();
}
// Clear the original records
mRecordList.clear();
// Clear the original records
mRecordList.clear();
// Read the new records, preserve any original selections
open();
for ( Record record = readNextRecord(); !record.isEmpty(); record = readNextRecord() )
{
auto key = record[ primaryKey() ];
auto it = origSelectionMap.find( key );
if ( it != origSelectionMap.end() )
{
record.setSelected( it.value() );
}
// Read the new records, preserve any original selections
open();
for ( Record record = readNextRecord(); !record.isEmpty(); record = readNextRecord() )
{
auto key = record[ primaryKey() ];
auto it = origSelectionMap.find( key );
if ( it != origSelectionMap.end() )
{
record.setSelected( it.value() );
}
mRecordList.push_back( record );
}
close();
mRecordList.push_back( record );
}
close();
emit sourceChanged();
}
emit sourceChanged();
}
///
/// Get record list
///
const QList<Record>& Merge::recordList( ) const
{
return mRecordList;
}
///
/// Get record list
///
const QList<Record>& Merge::recordList( ) const
{
return mRecordList;
}
///
/// Select/unselect i'th record
///
void Merge::setSelected( int i, bool state )
{
if ( (i >= 0) && (i < mRecordList.size()) )
{
mRecordList[i].setSelected( state );
emit selectionChanged();
}
}
///
/// Select/unselect i'th record
///
void Merge::setSelected( int i, bool state )
{
if ( (i >= 0) && (i < mRecordList.size()) )
{
mRecordList[i].setSelected( state );
emit selectionChanged();
}
}
///
/// Select all records
///
void Merge::selectAll()
{
for ( auto& record : mRecordList )
{
record.setSelected( true );
}
emit selectionChanged();
}
///
/// Unselect all records
///
void Merge::unselectAll()
{
for ( auto& record : mRecordList )
{
record.setSelected( false );
}
emit selectionChanged();
}
///
/// Return count of selected records
///
int Merge::nSelectedRecords() const
{
int count = 0;
for ( const auto& record : mRecordList )
{
if ( record.isSelected() )
{
count++;
}
}
return count;
}
///
/// Select all records
///
void Merge::selectAll()
{
for ( auto& record : mRecordList )
{
record.setSelected( true );
}
emit selectionChanged();
}
///
/// Return list of selected records
///
const QList<Record> Merge::selectedRecords() const
{
QList<Record> list;
///
/// Unselect all records
///
void Merge::unselectAll()
{
for ( auto& record : mRecordList )
{
record.setSelected( false );
}
emit selectionChanged();
}
for ( const auto& record : mRecordList )
{
if ( record.isSelected() )
{
list.append( record );
}
}
return list;
}
///
/// Return count of selected records
///
int Merge::nSelectedRecords() const
{
int count = 0;
} // namespace merge
} // namespace glabels
for ( const auto& record : mRecordList )
{
if ( record.isSelected() )
{
count++;
}
}
return count;
}
///
/// Return list of selected records
///
const QList<Record> Merge::selectedRecords() const
{
QList<Record> list;
for ( const auto& record : mRecordList )
{
if ( record.isSelected() )
{
list.append( record );
}
}
return list;
}
}