Continued to flesh out merge subsystem.
This commit is contained in:
@@ -36,6 +36,8 @@ set (glabels_sources
|
|||||||
MergeField.cpp
|
MergeField.cpp
|
||||||
MergeView.cpp
|
MergeView.cpp
|
||||||
MergeRecord.cpp
|
MergeRecord.cpp
|
||||||
|
MergeNone.cpp
|
||||||
|
MergeText.cpp
|
||||||
ObjectEditor.cpp
|
ObjectEditor.cpp
|
||||||
Outline.cpp
|
Outline.cpp
|
||||||
PageRenderer.cpp
|
PageRenderer.cpp
|
||||||
|
|||||||
+45
-2
@@ -24,17 +24,51 @@
|
|||||||
///
|
///
|
||||||
/// Constructor
|
/// Constructor
|
||||||
///
|
///
|
||||||
Merge::Merge( QString id, QString name, SourceType type )
|
Merge::Merge( SourceType type ) : mType(type)
|
||||||
: mId(id), mName(name), mType(type)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
Merge::Merge( const Merge* merge ) : mType(merge->mType), mSource(merge->mSource)
|
||||||
|
{
|
||||||
|
foreach ( MergeRecord* record, merge->mRecordList )
|
||||||
|
{
|
||||||
|
mRecordList << record->clone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Destructor
|
/// Destructor
|
||||||
///
|
///
|
||||||
Merge::~Merge()
|
Merge::~Merge()
|
||||||
{
|
{
|
||||||
|
foreach ( MergeRecord* record, mRecordList )
|
||||||
|
{
|
||||||
|
delete record;
|
||||||
|
}
|
||||||
|
mRecordList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Get type
|
||||||
|
///
|
||||||
|
Merge::SourceType Merge::type() const
|
||||||
|
{
|
||||||
|
return mType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Get source
|
||||||
|
///
|
||||||
|
QString Merge::source() const
|
||||||
|
{
|
||||||
|
return mSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -63,6 +97,15 @@ void Merge::setSource( const QString& source )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Get record list
|
||||||
|
///
|
||||||
|
const QList<MergeRecord*>& Merge::recordList( void ) const
|
||||||
|
{
|
||||||
|
return mRecordList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Select matching record
|
/// Select matching record
|
||||||
///
|
///
|
||||||
|
|||||||
+13
-43
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Merge Record Structure
|
/// Merge Object
|
||||||
///
|
///
|
||||||
struct Merge : QObject
|
struct Merge : QObject
|
||||||
{
|
{
|
||||||
@@ -39,6 +39,7 @@ struct Merge : QObject
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Source Type
|
// Source Type
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
|
public:
|
||||||
enum SourceType { NONE, FIXED, FILE };
|
enum SourceType { NONE, FIXED, FILE };
|
||||||
|
|
||||||
|
|
||||||
@@ -46,21 +47,26 @@ struct Merge : QObject
|
|||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
protected:
|
protected:
|
||||||
Merge( QString id, QString name, SourceType type );
|
Merge( SourceType type );
|
||||||
|
Merge( const Merge* merge );
|
||||||
virtual ~Merge();
|
virtual ~Merge();
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// Object duplication
|
||||||
|
/////////////////////////////////
|
||||||
|
virtual Merge* clone() const = 0;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
inline QString id() const;
|
SourceType type() const;
|
||||||
inline QString name() const;
|
QString source() const;
|
||||||
inline SourceType type() const;
|
|
||||||
inline QString source() const;
|
|
||||||
void setSource( const QString& source );
|
void setSource( const QString& source );
|
||||||
|
|
||||||
inline const QList<MergeRecord*>& recordList( void ) const;
|
const QList<MergeRecord*>& recordList( void ) const;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
@@ -98,47 +104,11 @@ signals:
|
|||||||
// Private data
|
// Private data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
QString mId;
|
|
||||||
QString mName;
|
|
||||||
SourceType mType;
|
SourceType mType;
|
||||||
|
|
||||||
QString mSource;
|
QString mSource;
|
||||||
bool mSelected;
|
|
||||||
QList<MergeRecord*> mRecordList;
|
QList<MergeRecord*> mRecordList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
|
||||||
// INLINE METHODS
|
|
||||||
/////////////////////////////////
|
|
||||||
QString Merge::id() const
|
|
||||||
{
|
|
||||||
return mId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString Merge::name() const
|
|
||||||
{
|
|
||||||
return mId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Merge::SourceType Merge::type() const
|
|
||||||
{
|
|
||||||
return mType;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString Merge::source() const
|
|
||||||
{
|
|
||||||
return mSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const QList<MergeRecord*>& Merge::recordList( void ) const
|
|
||||||
{
|
|
||||||
return mRecordList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // Merge_h
|
#endif // Merge_h
|
||||||
|
|||||||
@@ -19,3 +19,57 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "MergeField.h"
|
#include "MergeField.h"
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Default constructor
|
||||||
|
///
|
||||||
|
MergeField::MergeField()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
MergeField::MergeField( const QString& key, const QString& value )
|
||||||
|
{
|
||||||
|
mKey = key;
|
||||||
|
mValue = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Get key
|
||||||
|
///
|
||||||
|
const QString MergeField::key( void ) const
|
||||||
|
{
|
||||||
|
return mKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Set key
|
||||||
|
///
|
||||||
|
void MergeField::setKey( const QString& value )
|
||||||
|
{
|
||||||
|
mKey = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Get value
|
||||||
|
///
|
||||||
|
const QString MergeField::value( void ) const
|
||||||
|
{
|
||||||
|
return mValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Set value
|
||||||
|
///
|
||||||
|
void MergeField::setValue( const QString& value )
|
||||||
|
{
|
||||||
|
mValue = value;
|
||||||
|
}
|
||||||
|
|||||||
+11
-31
@@ -29,6 +29,13 @@
|
|||||||
///
|
///
|
||||||
struct MergeField
|
struct MergeField
|
||||||
{
|
{
|
||||||
|
/////////////////////////////////
|
||||||
|
// Life Cycle
|
||||||
|
/////////////////////////////////
|
||||||
|
public:
|
||||||
|
MergeField();
|
||||||
|
MergeField( const QString& key, const QString& value );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
@@ -37,15 +44,15 @@ public:
|
|||||||
//
|
//
|
||||||
// Key Property
|
// Key Property
|
||||||
//
|
//
|
||||||
inline const QString key( void ) const;
|
const QString key( void ) const;
|
||||||
inline void setKey( const QString &value );
|
void setKey( const QString& value );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Value Property
|
// Value Property
|
||||||
//
|
//
|
||||||
inline const QString value( void ) const;
|
const QString value( void ) const;
|
||||||
inline void setValue( const QString &value );
|
void setValue( const QString& value );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
@@ -58,31 +65,4 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
|
||||||
// INLINE METHODS
|
|
||||||
/////////////////////////////////
|
|
||||||
const QString MergeField::key( void ) const
|
|
||||||
{
|
|
||||||
return mKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MergeField::setKey( const QString &value )
|
|
||||||
{
|
|
||||||
mKey = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const QString MergeField::value( void ) const
|
|
||||||
{
|
|
||||||
return mValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MergeField::setValue( const QString &value )
|
|
||||||
{
|
|
||||||
mValue = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // MergeField_h
|
#endif // MergeField_h
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
/* MergeNone.cpp
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 Jim 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 "MergeNone.h"
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
MergeNone::MergeNone() : Merge( Merge::NONE )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
MergeNone::MergeNone( const MergeNone* merge ) : Merge( merge )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Destructor
|
||||||
|
///
|
||||||
|
MergeNone::~MergeNone()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Clone
|
||||||
|
///
|
||||||
|
MergeNone* MergeNone::clone() const
|
||||||
|
{
|
||||||
|
return new MergeNone( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Get key list
|
||||||
|
///
|
||||||
|
QList<QString> MergeNone::keyList() const
|
||||||
|
{
|
||||||
|
QList<QString> emptyList;
|
||||||
|
return emptyList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Get primary key
|
||||||
|
///
|
||||||
|
QString MergeNone::primaryKey() const
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Open source
|
||||||
|
///
|
||||||
|
void MergeNone::open()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Close source
|
||||||
|
///
|
||||||
|
void MergeNone::close()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Read next record
|
||||||
|
///
|
||||||
|
MergeRecord* MergeNone::readNextRecord()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/* MergeNone.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 Jim 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MergeNone_h
|
||||||
|
#define MergeNone_h
|
||||||
|
|
||||||
|
#include "Merge.h"
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// MergeNone Backend
|
||||||
|
///
|
||||||
|
struct MergeNone : public Merge
|
||||||
|
{
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// Life Cycle
|
||||||
|
/////////////////////////////////
|
||||||
|
protected:
|
||||||
|
MergeNone();
|
||||||
|
MergeNone( const MergeNone* merge );
|
||||||
|
virtual ~MergeNone();
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// Object duplication
|
||||||
|
/////////////////////////////////
|
||||||
|
MergeNone* clone() const;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// Implementation of virtual methods
|
||||||
|
/////////////////////////////////
|
||||||
|
public:
|
||||||
|
QList<QString> keyList() const;
|
||||||
|
QString primaryKey() const;
|
||||||
|
protected:
|
||||||
|
void open();
|
||||||
|
void close();
|
||||||
|
MergeRecord* readNextRecord();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // MergeNone_h
|
||||||
@@ -27,3 +27,66 @@
|
|||||||
MergeRecord::MergeRecord() : mSelected( false )
|
MergeRecord::MergeRecord() : mSelected( false )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
MergeRecord::MergeRecord( const MergeRecord* record )
|
||||||
|
: mSelected(record->mSelected), mFieldList(record->mFieldList)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Clone
|
||||||
|
///
|
||||||
|
MergeRecord* MergeRecord::clone() const
|
||||||
|
{
|
||||||
|
return new MergeRecord( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Is record selected?
|
||||||
|
///
|
||||||
|
bool MergeRecord::isSelected() const
|
||||||
|
{
|
||||||
|
return mSelected;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Set selected on not selected
|
||||||
|
///
|
||||||
|
void MergeRecord::setSelected( bool value )
|
||||||
|
{
|
||||||
|
mSelected = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Is record empty?
|
||||||
|
///
|
||||||
|
bool MergeRecord::isEmpty() const
|
||||||
|
{
|
||||||
|
return mFieldList.size() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Get field list
|
||||||
|
///
|
||||||
|
const QList<MergeField>& MergeRecord::fieldList() const
|
||||||
|
{
|
||||||
|
return mFieldList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Set field list
|
||||||
|
///
|
||||||
|
void MergeRecord::setFieldList( QList<MergeField>& value )
|
||||||
|
{
|
||||||
|
mFieldList = value;
|
||||||
|
}
|
||||||
|
|||||||
+12
-38
@@ -37,18 +37,25 @@ struct MergeRecord
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
MergeRecord();
|
MergeRecord();
|
||||||
|
MergeRecord( const MergeRecord* record );
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// Object duplication
|
||||||
|
/////////////////////////////////
|
||||||
|
MergeRecord* clone() const;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
inline bool isSelected() const;
|
bool isSelected() const;
|
||||||
inline void setSelected( bool value );
|
void setSelected( bool value );
|
||||||
inline bool empty() const;
|
bool isEmpty() const;
|
||||||
|
|
||||||
inline const QList<MergeField>& fieldList() const;
|
const QList<MergeField>& fieldList() const;
|
||||||
inline void setFieldList( QList<MergeField>& value );
|
void setFieldList( QList<MergeField>& value );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
@@ -60,37 +67,4 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
|
||||||
// INLINE METHODS
|
|
||||||
/////////////////////////////////
|
|
||||||
bool MergeRecord::isSelected() const
|
|
||||||
{
|
|
||||||
return mSelected;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MergeRecord::setSelected( bool value )
|
|
||||||
{
|
|
||||||
mSelected = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool MergeRecord::empty() const
|
|
||||||
{
|
|
||||||
return mFieldList.size() == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const QList<MergeField>& MergeRecord::fieldList() const
|
|
||||||
{
|
|
||||||
return mFieldList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MergeRecord::setFieldList( QList<MergeField>& value )
|
|
||||||
{
|
|
||||||
mFieldList = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // MergeRecord_h
|
#endif // MergeRecord_h
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
/* MergeText.cpp
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 Jim 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 "MergeText.h"
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
MergeText::MergeText( QChar delimiter, bool line1HasKeys ) : Merge( Merge::FILE )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
MergeText::MergeText( const MergeText* merge )
|
||||||
|
: Merge( merge ), mDelimeter(merge->mDelimeter), mLine1HasKeys(merge->mLine1HasKeys)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Destructor
|
||||||
|
///
|
||||||
|
MergeText::~MergeText()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Get key list
|
||||||
|
///
|
||||||
|
QList<QString> MergeText::keyList() const
|
||||||
|
{
|
||||||
|
QList<QString> emptyList;
|
||||||
|
return emptyList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Get primary key
|
||||||
|
///
|
||||||
|
QString MergeText::primaryKey() const
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Open source
|
||||||
|
///
|
||||||
|
void MergeText::open()
|
||||||
|
{
|
||||||
|
mFile.setFileName( source() );
|
||||||
|
mFile.open( QIODevice::ReadOnly|QIODevice::Text );
|
||||||
|
|
||||||
|
if ( mLine1HasKeys && mFile.isOpen() )
|
||||||
|
{
|
||||||
|
// Todo parse line #1, create key list from string list
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Close source
|
||||||
|
///
|
||||||
|
void MergeText::close()
|
||||||
|
{
|
||||||
|
if ( mFile.isOpen() )
|
||||||
|
{
|
||||||
|
mFile.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Read next record
|
||||||
|
///
|
||||||
|
MergeRecord* MergeText::readNextRecord()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
/* MergeText.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 Jim 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MergeText_h
|
||||||
|
#define MergeText_h
|
||||||
|
|
||||||
|
#include "Merge.h"
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// MergeText Backend
|
||||||
|
///
|
||||||
|
struct MergeText : public Merge
|
||||||
|
{
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// Life Cycle
|
||||||
|
/////////////////////////////////
|
||||||
|
protected:
|
||||||
|
MergeText( QChar delimiter, bool line1HasKeys );
|
||||||
|
MergeText( const MergeText* merge );
|
||||||
|
virtual ~MergeText();
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// Implementation of virtual methods
|
||||||
|
/////////////////////////////////
|
||||||
|
public:
|
||||||
|
QList<QString> keyList() const;
|
||||||
|
QString primaryKey() const;
|
||||||
|
protected:
|
||||||
|
void open();
|
||||||
|
void close();
|
||||||
|
MergeRecord* readNextRecord();
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// Private data
|
||||||
|
/////////////////////////////////
|
||||||
|
private:
|
||||||
|
QChar mDelimeter;
|
||||||
|
bool mLine1HasKeys;
|
||||||
|
|
||||||
|
QFile mFile;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // MergeText_h
|
||||||
+86
-15
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>MergeView</class>
|
<class>MergeView</class>
|
||||||
<widget class="QWidget" name="MergePropertyEditor">
|
<widget class="QWidget" name="MergeView">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@@ -22,6 +22,13 @@
|
|||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QPushButton" name="locationButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Location</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -29,22 +36,15 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QComboBox" name="comboBox"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="locationLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Location:</string>
|
<string>Location:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QPushButton" name="pushButton">
|
<widget class="QComboBox" name="formatCombo"/>
|
||||||
<property name="text">
|
|
||||||
<string>Placeholder</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
@@ -71,19 +71,19 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTableWidget" name="tableWidget"/>
|
<widget class="QTableWidget" name="recordsTable"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_2">
|
<widget class="QPushButton" name="selectAllButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Select all</string>
|
<string>Select all</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_3">
|
<widget class="QPushButton" name="unselectAllButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Unselect all</string>
|
<string>Unselect all</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -110,5 +110,76 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>selectAllButton</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>MergeView</receiver>
|
||||||
|
<slot>onSelectAllButtonClicked()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>63</x>
|
||||||
|
<y>571</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>69</x>
|
||||||
|
<y>601</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>unselectAllButton</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>MergeView</receiver>
|
||||||
|
<slot>onUnselectAllButtonClicked()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>178</x>
|
||||||
|
<y>567</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>263</x>
|
||||||
|
<y>600</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>locationButton</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>MergeView</receiver>
|
||||||
|
<slot>onUnselectAllButtonClicked()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>175</x>
|
||||||
|
<y>85</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>570</x>
|
||||||
|
<y>75</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>formatCombo</sender>
|
||||||
|
<signal>activated(int)</signal>
|
||||||
|
<receiver>MergeView</receiver>
|
||||||
|
<slot>onFormatComboChanged()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>166</x>
|
||||||
|
<y>48</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>565</x>
|
||||||
|
<y>56</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
<slots>
|
||||||
|
<slot>onSelectAllButtonClicked()</slot>
|
||||||
|
<slot>onUnselectAllButtonClicked()</slot>
|
||||||
|
<slot>onLocationButtonClicked()</slot>
|
||||||
|
<slot>onFormatComboChanged()</slot>
|
||||||
|
</slots>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
Reference in New Issue
Block a user