Some namespace cleanup.
This commit is contained in:
+37
-44
@@ -21,26 +21,23 @@
|
|||||||
#include "BarcodeBackends.h"
|
#include "BarcodeBackends.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
const std::string default_id = "code39";
|
const std::string default_id = "code39";
|
||||||
}
|
}
|
||||||
|
|
||||||
BarcodeBackends::BackendMap BarcodeBackends::mBackendIdMap;
|
BarcodeBackends::BackendMap BarcodeBackends::mBackendIdMap;
|
||||||
BarcodeBackends::BackendMap BarcodeBackends::mBackendNameMap;
|
BarcodeBackends::BackendMap BarcodeBackends::mBackendNameMap;
|
||||||
|
|
||||||
BarcodeBackends::StyleMap BarcodeBackends::mStyleIdMap;
|
BarcodeBackends::StyleMap BarcodeBackends::mStyleIdMap;
|
||||||
BarcodeBackends::StyleMap BarcodeBackends::mStyleNameMap;
|
BarcodeBackends::StyleMap BarcodeBackends::mStyleNameMap;
|
||||||
|
|
||||||
QList<QString> BarcodeBackends::mBackendNameList;
|
QList<QString> BarcodeBackends::mBackendNameList;
|
||||||
QList<QString> BarcodeBackends::mNameList;
|
QList<QString> BarcodeBackends::mNameList;
|
||||||
|
|
||||||
|
|
||||||
BarcodeBackends::BarcodeBackends()
|
BarcodeBackends::BarcodeBackends()
|
||||||
{
|
{
|
||||||
registerStyle( "postnet", "", tr("POSTNET (any)"),
|
registerStyle( "postnet", "", tr("POSTNET (any)"),
|
||||||
false, false, true, false, "12345-6789-12", false, 11 );
|
false, false, true, false, "12345-6789-12", false, 11 );
|
||||||
|
|
||||||
@@ -76,22 +73,22 @@ namespace glabels
|
|||||||
|
|
||||||
registerStyle( "qrcode", "", tr("QRCode"),
|
registerStyle( "qrcode", "", tr("QRCode"),
|
||||||
false, false, true, false, "1234567890AB", false, 12 );
|
false, false, true, false, "1234567890AB", false, 12 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BarcodeBackends::init( void )
|
void BarcodeBackends::init( void )
|
||||||
{
|
{
|
||||||
static BarcodeBackends* singletonInstance = NULL;
|
static BarcodeBackends* singletonInstance = NULL;
|
||||||
|
|
||||||
if ( singletonInstance == NULL )
|
if ( singletonInstance == NULL )
|
||||||
{
|
{
|
||||||
singletonInstance = new BarcodeBackends();
|
singletonInstance = new BarcodeBackends();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString BarcodeBackends::BackendIdToName( const QString& backendId )
|
QString BarcodeBackends::BackendIdToName( const QString& backendId )
|
||||||
{
|
{
|
||||||
BackendMap::iterator i = mBackendIdMap.find( backendId );
|
BackendMap::iterator i = mBackendIdMap.find( backendId );
|
||||||
if ( i != mBackendIdMap.end() )
|
if ( i != mBackendIdMap.end() )
|
||||||
{
|
{
|
||||||
@@ -99,11 +96,11 @@ namespace glabels
|
|||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString BarcodeBackends::BackendNameToId( const QString& backendName )
|
QString BarcodeBackends::BackendNameToId( const QString& backendName )
|
||||||
{
|
{
|
||||||
BackendMap::iterator i = mBackendNameMap.find( backendName );
|
BackendMap::iterator i = mBackendNameMap.find( backendName );
|
||||||
if ( i != mBackendNameMap.end() )
|
if ( i != mBackendNameMap.end() )
|
||||||
{
|
{
|
||||||
@@ -111,23 +108,23 @@ namespace glabels
|
|||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const QList<QString>& BarcodeBackends::getBackendNameList()
|
const QList<QString>& BarcodeBackends::getBackendNameList()
|
||||||
{
|
{
|
||||||
return mBackendNameList;
|
return mBackendNameList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const QList<QString>& BarcodeBackends::getNameList()
|
const QList<QString>& BarcodeBackends::getNameList()
|
||||||
{
|
{
|
||||||
return mNameList;
|
return mNameList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const BarcodeStyle* BarcodeBackends::lookupStyleFromId( const QString& id )
|
const BarcodeStyle* BarcodeBackends::lookupStyleFromId( const QString& id )
|
||||||
{
|
{
|
||||||
StyleMap::iterator i = mStyleIdMap.find( id );
|
StyleMap::iterator i = mStyleIdMap.find( id );
|
||||||
if ( i != mStyleIdMap.end() )
|
if ( i != mStyleIdMap.end() )
|
||||||
{
|
{
|
||||||
@@ -135,11 +132,11 @@ namespace glabels
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const BarcodeStyle* BarcodeBackends::lookupStyleFromName( const QString& name )
|
const BarcodeStyle* BarcodeBackends::lookupStyleFromName( const QString& name )
|
||||||
{
|
{
|
||||||
StyleMap::iterator i = mStyleNameMap.find( name );
|
StyleMap::iterator i = mStyleNameMap.find( name );
|
||||||
if ( i != mStyleNameMap.end() )
|
if ( i != mStyleNameMap.end() )
|
||||||
{
|
{
|
||||||
@@ -147,18 +144,18 @@ namespace glabels
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BarcodeBackends::registerBackend( QString& id, QString& name)
|
void BarcodeBackends::registerBackend( QString& id, QString& name)
|
||||||
{
|
{
|
||||||
mBackendNameList.append( name );
|
mBackendNameList.append( name );
|
||||||
mBackendIdMap.insert( id, name );
|
mBackendIdMap.insert( id, name );
|
||||||
mBackendNameMap.insert( name, id );
|
mBackendNameMap.insert( name, id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BarcodeBackends::registerStyle( const char* id,
|
void BarcodeBackends::registerStyle( const char* id,
|
||||||
const char* backendId,
|
const char* backendId,
|
||||||
const QString& name,
|
const QString& name,
|
||||||
bool canText,
|
bool canText,
|
||||||
@@ -168,7 +165,7 @@ namespace glabels
|
|||||||
const char* defaultDigits,
|
const char* defaultDigits,
|
||||||
bool canFreeForm,
|
bool canFreeForm,
|
||||||
int preferedN )
|
int preferedN )
|
||||||
{
|
{
|
||||||
BarcodeStyle* style = new BarcodeStyle( QString(id), QString(backendId), name,
|
BarcodeStyle* style = new BarcodeStyle( QString(id), QString(backendId), name,
|
||||||
canText, textOptional,
|
canText, textOptional,
|
||||||
canChecksum, checksumOptional,
|
canChecksum, checksumOptional,
|
||||||
@@ -179,8 +176,4 @@ namespace glabels
|
|||||||
mNameList.append( name );
|
mNameList.append( name );
|
||||||
mStyleIdMap.insert( id, style );
|
mStyleIdMap.insert( id, style );
|
||||||
mStyleNameMap.insert( fqName, style );
|
mStyleNameMap.insert( fqName, style );
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-17
@@ -18,8 +18,8 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_BarcodeBackends_h
|
#ifndef BarcodeBackends_h
|
||||||
#define glabels_BarcodeBackends_h
|
#define BarcodeBackends_h
|
||||||
|
|
||||||
#include "BarcodeStyle.h"
|
#include "BarcodeStyle.h"
|
||||||
|
|
||||||
@@ -29,28 +29,25 @@
|
|||||||
#include <QList>
|
#include <QList>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Barcode Backends Database
|
||||||
|
///
|
||||||
|
class BarcodeBackends : public QObject
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Barcode Backends Database
|
|
||||||
///
|
|
||||||
class BarcodeBackends : public QObject
|
|
||||||
{
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
BarcodeBackends();
|
BarcodeBackends();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void init( void );
|
static void init( void );
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Public Methods
|
// Public Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
static QString BackendIdToName( const QString& backendId );
|
static QString BackendIdToName( const QString& backendId );
|
||||||
static QString BackendNameToId( const QString& backendName );
|
static QString BackendNameToId( const QString& backendName );
|
||||||
|
|
||||||
@@ -64,7 +61,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Methods
|
// Private Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
static void registerBackend( QString &id, QString &name);
|
static void registerBackend( QString &id, QString &name);
|
||||||
|
|
||||||
static void registerStyle( const char* id,
|
static void registerStyle( const char* id,
|
||||||
@@ -93,9 +90,7 @@ namespace glabels
|
|||||||
static QList<QString> mBackendNameList;
|
static QList<QString> mBackendNameList;
|
||||||
static QList<QString> mNameList;
|
static QList<QString> mNameList;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // glabels_BarcodeBackends_h
|
#endif // BarcodeBackends_h
|
||||||
|
|||||||
+16
-23
@@ -24,14 +24,11 @@
|
|||||||
#include "BarcodeMenuItem.h"
|
#include "BarcodeMenuItem.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
BarcodeMenu::BarcodeMenu()
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
BarcodeMenu::BarcodeMenu()
|
|
||||||
{
|
|
||||||
foreach ( QString name, BarcodeBackends::getNameList() )
|
foreach ( QString name, BarcodeBackends::getNameList() )
|
||||||
{
|
{
|
||||||
const BarcodeStyle* bcStyle = BarcodeBackends::lookupStyleFromName( name );
|
const BarcodeStyle* bcStyle = BarcodeBackends::lookupStyleFromName( name );
|
||||||
@@ -41,28 +38,24 @@ namespace glabels
|
|||||||
|
|
||||||
addAction( bcMenuItem );
|
addAction( bcMenuItem );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// bcStyle getter
|
/// bcStyle getter
|
||||||
///
|
///
|
||||||
const BarcodeStyle* BarcodeMenu::bcStyle() const
|
const BarcodeStyle* BarcodeMenu::bcStyle() const
|
||||||
{
|
{
|
||||||
return mBcStyle;
|
return mBcStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// onMenuItemActivated slot
|
/// onMenuItemActivated slot
|
||||||
///
|
///
|
||||||
void BarcodeMenu::onMenuItemActivated( BarcodeStyle *bcStyle )
|
void BarcodeMenu::onMenuItemActivated( BarcodeStyle *bcStyle )
|
||||||
{
|
{
|
||||||
mBcStyle = bcStyle;
|
mBcStyle = bcStyle;
|
||||||
|
|
||||||
emit styleChanged();
|
emit styleChanged();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-18
@@ -18,60 +18,55 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_BarcodeMenu_h
|
#ifndef BarcodeMenu_h
|
||||||
#define glabels_BarcodeMenu_h
|
#define BarcodeMenu_h
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include "BarcodeStyle.h"
|
#include "BarcodeStyle.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Barcode Menu
|
||||||
|
///
|
||||||
|
class BarcodeMenu : public QMenu
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Barcode Menu
|
|
||||||
///
|
|
||||||
class BarcodeMenu : public QMenu
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
BarcodeMenu();
|
BarcodeMenu();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Signals
|
// Signals
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
signals:
|
signals:
|
||||||
void styleChanged();
|
void styleChanged();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
const BarcodeStyle* bcStyle() const;
|
const BarcodeStyle* bcStyle() const;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void onMenuItemActivated( BarcodeStyle *bcStyle );
|
void onMenuItemActivated( BarcodeStyle *bcStyle );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
BarcodeStyle* mBcStyle;
|
BarcodeStyle* mBcStyle;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
#endif // BarcodeMenu_h
|
||||||
|
|
||||||
#endif // glabels_BarcodeMenu_h
|
|
||||||
|
|||||||
@@ -24,15 +24,12 @@
|
|||||||
#include "BarcodeMenuItem.h"
|
#include "BarcodeMenuItem.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Constructor
|
||||||
|
///
|
||||||
///
|
BarcodeMenuButton::BarcodeMenuButton( QWidget* parent )
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
BarcodeMenuButton::BarcodeMenuButton( QWidget* parent )
|
|
||||||
: QPushButton(parent)
|
: QPushButton(parent)
|
||||||
{
|
{
|
||||||
mMenu = new BarcodeMenu();
|
mMenu = new BarcodeMenu();
|
||||||
setMenu( mMenu );
|
setMenu( mMenu );
|
||||||
|
|
||||||
@@ -40,29 +37,25 @@ namespace glabels
|
|||||||
setText( mBcStyle->name() );
|
setText( mBcStyle->name() );
|
||||||
|
|
||||||
connect( mMenu, SIGNAL(styleChanged()), this, SLOT(onMenuStyleChanged()) );
|
connect( mMenu, SIGNAL(styleChanged()), this, SLOT(onMenuStyleChanged()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// bcStyle getter
|
/// bcStyle getter
|
||||||
///
|
///
|
||||||
const BarcodeStyle* BarcodeMenuButton::bcStyle() const
|
const BarcodeStyle* BarcodeMenuButton::bcStyle() const
|
||||||
{
|
{
|
||||||
return mBcStyle;
|
return mBcStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// onMenuStyleChanged slot
|
/// onMenuStyleChanged slot
|
||||||
///
|
///
|
||||||
void BarcodeMenuButton::onMenuStyleChanged()
|
void BarcodeMenuButton::onMenuStyleChanged()
|
||||||
{
|
{
|
||||||
mBcStyle = mMenu->bcStyle();
|
mBcStyle = mMenu->bcStyle();
|
||||||
setText( mBcStyle->name() );
|
setText( mBcStyle->name() );
|
||||||
|
|
||||||
emit styleChanged();
|
emit styleChanged();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-18
@@ -18,62 +18,57 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_BarcodeMenuButton_h
|
#ifndef BarcodeMenuButton_h
|
||||||
#define glabels_BarcodeMenuButton_h
|
#define BarcodeMenuButton_h
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include "BarcodeMenu.h"
|
#include "BarcodeMenu.h"
|
||||||
#include "BarcodeStyle.h"
|
#include "BarcodeStyle.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Barcode Menu Button
|
||||||
|
///
|
||||||
|
class BarcodeMenuButton : public QPushButton
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Barcode Menu Button
|
|
||||||
///
|
|
||||||
class BarcodeMenuButton : public QPushButton
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
BarcodeMenuButton( QWidget* parent = 0 );
|
BarcodeMenuButton( QWidget* parent = 0 );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Signals
|
// Signals
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
signals:
|
signals:
|
||||||
void styleChanged();
|
void styleChanged();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
const BarcodeStyle* bcStyle() const;
|
const BarcodeStyle* bcStyle() const;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void onMenuStyleChanged();
|
void onMenuStyleChanged();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
BarcodeMenu* mMenu;
|
BarcodeMenu* mMenu;
|
||||||
const BarcodeStyle* mBcStyle;
|
const BarcodeStyle* mBcStyle;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
#endif // BarcodeMenuButton_h
|
||||||
|
|
||||||
#endif // glabels_BarcodeMenuButton_h
|
|
||||||
|
|||||||
+22
-28
@@ -21,37 +21,31 @@
|
|||||||
#include "BarcodeMenuItem.h"
|
#include "BarcodeMenuItem.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Constructor From Data
|
||||||
|
///
|
||||||
///
|
BarcodeMenuItem::BarcodeMenuItem( const BarcodeStyle* bcStyle, QObject* parent )
|
||||||
/// Constructor From Data
|
|
||||||
///
|
|
||||||
BarcodeMenuItem::BarcodeMenuItem( const BarcodeStyle* bcStyle, QObject* parent )
|
|
||||||
: QAction(parent), mBcStyle(bcStyle)
|
: QAction(parent), mBcStyle(bcStyle)
|
||||||
{
|
{
|
||||||
setText( bcStyle->name() );
|
setText( bcStyle->name() );
|
||||||
|
|
||||||
connect( this, SIGNAL(triggered()), this, SLOT(onTriggered()) );
|
connect( this, SIGNAL(triggered()), this, SLOT(onTriggered()) );
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// bcStyle Property Getter
|
|
||||||
///
|
|
||||||
const BarcodeStyle* BarcodeMenuItem::bcStyle() const
|
|
||||||
{
|
|
||||||
return mBcStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// onTriggered slot
|
|
||||||
///
|
|
||||||
void BarcodeMenuItem::onTriggered()
|
|
||||||
{
|
|
||||||
emit activated( mBcStyle );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// bcStyle Property Getter
|
||||||
|
///
|
||||||
|
const BarcodeStyle* BarcodeMenuItem::bcStyle() const
|
||||||
|
{
|
||||||
|
return mBcStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// onTriggered slot
|
||||||
|
///
|
||||||
|
void BarcodeMenuItem::onTriggered()
|
||||||
|
{
|
||||||
|
emit activated( mBcStyle );
|
||||||
|
}
|
||||||
|
|||||||
+13
-18
@@ -18,60 +18,55 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_BarcodeMenuItem_h
|
#ifndef BarcodeMenuItem_h
|
||||||
#define glabels_BarcodeMenuItem_h
|
#define BarcodeMenuItem_h
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include "BarcodeStyle.h"
|
#include "BarcodeStyle.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Barcode Menu Item
|
||||||
|
///
|
||||||
|
class BarcodeMenuItem : public QAction
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Barcode Menu Item
|
|
||||||
///
|
|
||||||
class BarcodeMenuItem : public QAction
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
BarcodeMenuItem( const BarcodeStyle* bcStyle, QObject* parent = 0 );
|
BarcodeMenuItem( const BarcodeStyle* bcStyle, QObject* parent = 0 );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Signals
|
// Signals
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
signals:
|
signals:
|
||||||
void activated( const BarcodeStyle* bcStyle );
|
void activated( const BarcodeStyle* bcStyle );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
const BarcodeStyle* bcStyle() const;
|
const BarcodeStyle* bcStyle() const;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void onTriggered();
|
void onTriggered();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
const BarcodeStyle* mBcStyle;
|
const BarcodeStyle* mBcStyle;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
#endif // BarcodeMenuItem_h
|
||||||
|
|
||||||
#endif // glabels_BarcodeMenuItem_h
|
|
||||||
|
|||||||
+77
-83
@@ -23,13 +23,10 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Default Constructor
|
||||||
|
///
|
||||||
///
|
BarcodeStyle::BarcodeStyle ()
|
||||||
/// Default Constructor
|
|
||||||
///
|
|
||||||
BarcodeStyle::BarcodeStyle ()
|
|
||||||
: mId( "" ),
|
: mId( "" ),
|
||||||
mBackendId( "" ),
|
mBackendId( "" ),
|
||||||
mName( "" ),
|
mName( "" ),
|
||||||
@@ -40,14 +37,14 @@ namespace glabels
|
|||||||
mDefaultDigits( "" ),
|
mDefaultDigits( "" ),
|
||||||
mCanFreeform( false ),
|
mCanFreeform( false ),
|
||||||
mPreferedN( 0 )
|
mPreferedN( 0 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Constructor From Data
|
/// Constructor From Data
|
||||||
///
|
///
|
||||||
BarcodeStyle::BarcodeStyle ( const QString& id,
|
BarcodeStyle::BarcodeStyle ( const QString& id,
|
||||||
const QString& backendId,
|
const QString& backendId,
|
||||||
const QString& name,
|
const QString& name,
|
||||||
bool canText,
|
bool canText,
|
||||||
@@ -67,105 +64,105 @@ namespace glabels
|
|||||||
mDefaultDigits( defaultDigits ),
|
mDefaultDigits( defaultDigits ),
|
||||||
mCanFreeform( canFreeform ),
|
mCanFreeform( canFreeform ),
|
||||||
mPreferedN( preferedN )
|
mPreferedN( preferedN )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// ID Property Getter
|
/// ID Property Getter
|
||||||
///
|
///
|
||||||
const QString& BarcodeStyle::id() const
|
const QString& BarcodeStyle::id() const
|
||||||
{
|
{
|
||||||
return mId;
|
return mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Backend ID Property Getter
|
/// Backend ID Property Getter
|
||||||
///
|
///
|
||||||
const QString& BarcodeStyle::backendId() const
|
const QString& BarcodeStyle::backendId() const
|
||||||
{
|
{
|
||||||
return mBackendId;
|
return mBackendId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Name Property Getter
|
/// Name Property Getter
|
||||||
///
|
///
|
||||||
const QString& BarcodeStyle::name() const
|
const QString& BarcodeStyle::name() const
|
||||||
{
|
{
|
||||||
return mName;
|
return mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Can Text Property Getter
|
/// Can Text Property Getter
|
||||||
///
|
///
|
||||||
bool BarcodeStyle::canText() const
|
bool BarcodeStyle::canText() const
|
||||||
{
|
{
|
||||||
return mCanText;
|
return mCanText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Text Optional Property Getter
|
/// Text Optional Property Getter
|
||||||
///
|
///
|
||||||
bool BarcodeStyle::textOptional() const
|
bool BarcodeStyle::textOptional() const
|
||||||
{
|
{
|
||||||
return mTextOptional;
|
return mTextOptional;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Can Checksum Property Getter
|
/// Can Checksum Property Getter
|
||||||
///
|
///
|
||||||
bool BarcodeStyle::canChecksum() const
|
bool BarcodeStyle::canChecksum() const
|
||||||
{
|
{
|
||||||
return mCanChecksum;
|
return mCanChecksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Checksum Optional Property Getter
|
/// Checksum Optional Property Getter
|
||||||
///
|
///
|
||||||
bool BarcodeStyle::checksumOptional() const
|
bool BarcodeStyle::checksumOptional() const
|
||||||
{
|
{
|
||||||
return mChecksumOptional;
|
return mChecksumOptional;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Default Digits Property Getter
|
/// Default Digits Property Getter
|
||||||
///
|
///
|
||||||
const QString& BarcodeStyle::defaultDigits() const
|
const QString& BarcodeStyle::defaultDigits() const
|
||||||
{
|
{
|
||||||
return mDefaultDigits;
|
return mDefaultDigits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Can Freeform Property Getter
|
/// Can Freeform Property Getter
|
||||||
///
|
///
|
||||||
bool BarcodeStyle::canFreeform() const
|
bool BarcodeStyle::canFreeform() const
|
||||||
{
|
{
|
||||||
return mCanFreeform;
|
return mCanFreeform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Prefered N Property Getter
|
/// Prefered N Property Getter
|
||||||
///
|
///
|
||||||
int BarcodeStyle::preferedN() const
|
int BarcodeStyle::preferedN() const
|
||||||
{
|
{
|
||||||
return mPreferedN;
|
return mPreferedN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Generate Example Digits
|
/// Generate Example Digits
|
||||||
///
|
///
|
||||||
QString BarcodeStyle::exampleDigits( int n ) const
|
QString BarcodeStyle::exampleDigits( int n ) const
|
||||||
{
|
{
|
||||||
using std::max;
|
using std::max;
|
||||||
|
|
||||||
if ( mCanFreeform )
|
if ( mCanFreeform )
|
||||||
@@ -176,7 +173,4 @@ namespace glabels
|
|||||||
{
|
{
|
||||||
return mDefaultDigits;
|
return mDefaultDigits;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-16
@@ -18,25 +18,22 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_BarcodeStyle_h
|
#ifndef BarcodeStyle_h
|
||||||
#define glabels_BarcodeStyle_h
|
#define BarcodeStyle_h
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Barcode Style Type
|
||||||
|
///
|
||||||
|
struct BarcodeStyle
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Barcode Style Type
|
|
||||||
///
|
|
||||||
struct BarcodeStyle
|
|
||||||
{
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
BarcodeStyle ();
|
BarcodeStyle ();
|
||||||
|
|
||||||
BarcodeStyle ( const QString& id,
|
BarcodeStyle ( const QString& id,
|
||||||
@@ -78,14 +75,14 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Methods
|
// Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
QString exampleDigits( int n ) const;
|
QString exampleDigits( int n ) const;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
QString mId;
|
QString mId;
|
||||||
QString mBackendId;
|
QString mBackendId;
|
||||||
QString mName;
|
QString mName;
|
||||||
@@ -97,9 +94,7 @@ namespace glabels
|
|||||||
bool mCanFreeform;
|
bool mCanFreeform;
|
||||||
int mPreferedN;
|
int mPreferedN;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
#endif // BarcodeStyle_h
|
||||||
|
|
||||||
#endif // glabels_BarcodeStyle_h
|
|
||||||
|
|||||||
+35
-41
@@ -33,17 +33,14 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
ColorButton::ColorButton( QWidget* parent )
|
||||||
{
|
|
||||||
|
|
||||||
ColorButton::ColorButton( QWidget* parent )
|
|
||||||
: QPushButton( parent )
|
: QPushButton( parent )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorButton::init( const QString& defaultLabel, const QColor& defaultColor, const QColor& color )
|
void ColorButton::init( const QString& defaultLabel, const QColor& defaultColor, const QColor& color )
|
||||||
{
|
{
|
||||||
mDefaultColor = defaultColor;
|
mDefaultColor = defaultColor;
|
||||||
mColorNode = ColorNode( color );
|
mColorNode = ColorNode( color );
|
||||||
|
|
||||||
@@ -58,11 +55,11 @@ namespace glabels
|
|||||||
this, SLOT(onPaletteDialogChanged(ColorNode,bool)) );
|
this, SLOT(onPaletteDialogChanged(ColorNode,bool)) );
|
||||||
connect( mDialog, SIGNAL(accepted()), this, SLOT(onPaletteDialogAccepted()) );
|
connect( mDialog, SIGNAL(accepted()), this, SLOT(onPaletteDialogAccepted()) );
|
||||||
connect( mDialog, SIGNAL(rejected()), this, SLOT(onPaletteDialogRejected()) );
|
connect( mDialog, SIGNAL(rejected()), this, SLOT(onPaletteDialogRejected()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorButton::setColorNode( ColorNode colorNode )
|
void ColorButton::setColorNode( ColorNode colorNode )
|
||||||
{
|
{
|
||||||
mIsDefault = false;
|
mIsDefault = false;
|
||||||
|
|
||||||
mColorNode = colorNode;
|
mColorNode = colorNode;
|
||||||
@@ -77,11 +74,11 @@ namespace glabels
|
|||||||
setIcon( QIcon( ColorSwatch( SWATCH_W, SWATCH_H, colorNode.color() ) ) );
|
setIcon( QIcon( ColorSwatch( SWATCH_W, SWATCH_H, colorNode.color() ) ) );
|
||||||
setText( "" );
|
setText( "" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorButton::setColor( QColor color )
|
void ColorButton::setColor( QColor color )
|
||||||
{
|
{
|
||||||
mIsDefault = false;
|
mIsDefault = false;
|
||||||
|
|
||||||
mColorNode.setFieldFlag( false );
|
mColorNode.setFieldFlag( false );
|
||||||
@@ -90,11 +87,11 @@ namespace glabels
|
|||||||
|
|
||||||
setIcon( QIcon( ColorSwatch( SWATCH_W, SWATCH_H, color ) ) );
|
setIcon( QIcon( ColorSwatch( SWATCH_W, SWATCH_H, color ) ) );
|
||||||
setText( "" );
|
setText( "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorButton::setToDefault()
|
void ColorButton::setToDefault()
|
||||||
{
|
{
|
||||||
mIsDefault = true;
|
mIsDefault = true;
|
||||||
|
|
||||||
mColorNode.setFieldFlag( false );
|
mColorNode.setFieldFlag( false );
|
||||||
@@ -103,29 +100,29 @@ namespace glabels
|
|||||||
|
|
||||||
setIcon( QIcon(ColorSwatch( SWATCH_W, SWATCH_H, mDefaultColor ) ) );
|
setIcon( QIcon(ColorSwatch( SWATCH_W, SWATCH_H, mDefaultColor ) ) );
|
||||||
setText( "" );
|
setText( "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ColorNode ColorButton::colorNode()
|
ColorNode ColorButton::colorNode()
|
||||||
{
|
{
|
||||||
return mColorNode;
|
return mColorNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorButton::setKeys( const QList<QString> keyList )
|
void ColorButton::setKeys( const QList<QString> keyList )
|
||||||
{
|
{
|
||||||
mDialog->setKeys( keyList );
|
mDialog->setKeys( keyList );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorButton::clearKeys()
|
void ColorButton::clearKeys()
|
||||||
{
|
{
|
||||||
mDialog->clearKeys();
|
mDialog->clearKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorButton::onButtonToggled( bool checked )
|
void ColorButton::onButtonToggled( bool checked )
|
||||||
{
|
{
|
||||||
if ( checked )
|
if ( checked )
|
||||||
{
|
{
|
||||||
///
|
///
|
||||||
@@ -136,23 +133,23 @@ namespace glabels
|
|||||||
|
|
||||||
mDialog->show();
|
mDialog->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorButton::onPaletteDialogAccepted()
|
void ColorButton::onPaletteDialogAccepted()
|
||||||
{
|
{
|
||||||
setChecked( false );
|
setChecked( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorButton::onPaletteDialogRejected()
|
void ColorButton::onPaletteDialogRejected()
|
||||||
{
|
{
|
||||||
setChecked( false );
|
setChecked( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorButton::onPaletteDialogChanged( ColorNode colorNode, bool isDefault )
|
void ColorButton::onPaletteDialogChanged( ColorNode colorNode, bool isDefault )
|
||||||
{
|
{
|
||||||
mColorNode = colorNode;
|
mColorNode = colorNode;
|
||||||
mIsDefault = isDefault;
|
mIsDefault = isDefault;
|
||||||
|
|
||||||
@@ -160,7 +157,4 @@ namespace glabels
|
|||||||
setText( "" );
|
setText( "" );
|
||||||
|
|
||||||
emit colorChanged();
|
emit colorChanged();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-19
@@ -18,8 +18,8 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_ColorButton_h
|
#ifndef ColorButton_h
|
||||||
#define glabels_ColorButton_h
|
#define ColorButton_h
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
@@ -27,35 +27,32 @@
|
|||||||
#include "ColorPaletteDialog.h"
|
#include "ColorPaletteDialog.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Color Button
|
||||||
|
///
|
||||||
|
class ColorButton : public QPushButton
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Color Button
|
|
||||||
///
|
|
||||||
class ColorButton : public QPushButton
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
ColorButton( QWidget* parent = 0 );
|
ColorButton( QWidget* parent = 0 );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Signals
|
// Signals
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
signals:
|
signals:
|
||||||
void colorChanged();
|
void colorChanged();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Public Methods
|
// Public Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void init( const QString& defaultLabel, const QColor& defaultColor, const QColor& color );
|
void init( const QString& defaultLabel, const QColor& defaultColor, const QColor& color );
|
||||||
void setColorNode( ColorNode colorNode );
|
void setColorNode( ColorNode colorNode );
|
||||||
void setColor( QColor color );
|
void setColor( QColor color );
|
||||||
@@ -68,7 +65,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void onButtonToggled( bool checked );
|
void onButtonToggled( bool checked );
|
||||||
void onPaletteDialogAccepted();
|
void onPaletteDialogAccepted();
|
||||||
void onPaletteDialogRejected();
|
void onPaletteDialogRejected();
|
||||||
@@ -78,21 +75,19 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Methods
|
// Private Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Members
|
// Private Members
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
QColor mDefaultColor;
|
QColor mDefaultColor;
|
||||||
bool mIsDefault;
|
bool mIsDefault;
|
||||||
ColorNode mColorNode;
|
ColorNode mColorNode;
|
||||||
|
|
||||||
ColorPaletteDialog* mDialog;
|
ColorPaletteDialog* mDialog;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // glabels_ColorButton_h
|
#endif // ColorButton_h
|
||||||
|
|||||||
+16
-21
@@ -23,16 +23,13 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
ColorHistory::ColorHistory()
|
||||||
{
|
{
|
||||||
|
}
|
||||||
ColorHistory::ColorHistory()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ColorHistory* ColorHistory::instance()
|
ColorHistory* ColorHistory::instance()
|
||||||
{
|
{
|
||||||
static ColorHistory* singletonInstance = 0;
|
static ColorHistory* singletonInstance = 0;
|
||||||
|
|
||||||
if ( singletonInstance == 0 )
|
if ( singletonInstance == 0 )
|
||||||
@@ -41,11 +38,11 @@ namespace glabels
|
|||||||
}
|
}
|
||||||
|
|
||||||
return singletonInstance;
|
return singletonInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorHistory::addColor( const QColor &color )
|
void ColorHistory::addColor( const QColor &color )
|
||||||
{
|
{
|
||||||
QColor oldColors[MAX_COLORS];
|
QColor oldColors[MAX_COLORS];
|
||||||
QColor newColors[MAX_COLORS];
|
QColor newColors[MAX_COLORS];
|
||||||
int n;
|
int n;
|
||||||
@@ -61,11 +58,11 @@ namespace glabels
|
|||||||
|
|
||||||
writeColorArray( newColors, i+1 );
|
writeColorArray( newColors, i+1 );
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QColor ColorHistory::getColor( int i )
|
QColor ColorHistory::getColor( int i )
|
||||||
{
|
{
|
||||||
QColor colors[MAX_COLORS];
|
QColor colors[MAX_COLORS];
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
@@ -79,11 +76,11 @@ namespace glabels
|
|||||||
{
|
{
|
||||||
return QColor( 0, 0, 0, 0 );
|
return QColor( 0, 0, 0, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorHistory::readColorArray( QColor array[MAX_COLORS], int* n )
|
void ColorHistory::readColorArray( QColor array[MAX_COLORS], int* n )
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
settings.beginGroup( "ColorHistory" );
|
settings.beginGroup( "ColorHistory" );
|
||||||
@@ -98,11 +95,11 @@ namespace glabels
|
|||||||
settings.endArray();
|
settings.endArray();
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorHistory::writeColorArray( const QColor array[MAX_COLORS], int n )
|
void ColorHistory::writeColorArray( const QColor array[MAX_COLORS], int n )
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
settings.beginGroup( "ColorHistory" );
|
settings.beginGroup( "ColorHistory" );
|
||||||
@@ -116,6 +113,4 @@ namespace glabels
|
|||||||
settings.endArray();
|
settings.endArray();
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-20
@@ -18,47 +18,44 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_ColorHistory_h
|
#ifndef ColorHistory_h
|
||||||
#define glabels_ColorHistory_h
|
#define ColorHistory_h
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Barcode Backends Database
|
||||||
|
///
|
||||||
|
class ColorHistory : public QObject
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Barcode Backends Database
|
|
||||||
///
|
|
||||||
class ColorHistory : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const int MAX_COLORS = 10;
|
static const int MAX_COLORS = 10;
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
ColorHistory();
|
ColorHistory();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static ColorHistory* instance();
|
static ColorHistory* instance();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Signals
|
// Signals
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
signals:
|
signals:
|
||||||
void changed();
|
void changed();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Public Methods
|
// Public Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void addColor( const QColor &color );
|
void addColor( const QColor &color );
|
||||||
QColor getColor( int i );
|
QColor getColor( int i );
|
||||||
|
|
||||||
@@ -66,7 +63,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Methods
|
// Private Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
void readColorArray( QColor array[MAX_COLORS], int* n );
|
void readColorArray( QColor array[MAX_COLORS], int* n );
|
||||||
void writeColorArray( const QColor array[MAX_COLORS], int n );
|
void writeColorArray( const QColor array[MAX_COLORS], int n );
|
||||||
|
|
||||||
@@ -74,11 +71,9 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Members
|
// Private Members
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // glabels_ColorHistory_h
|
#endif // ColorHistory_h
|
||||||
|
|||||||
+84
-90
@@ -21,136 +21,133 @@
|
|||||||
#include "ColorNode.h"
|
#include "ColorNode.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Default Constructor
|
||||||
|
///
|
||||||
///
|
ColorNode::ColorNode()
|
||||||
/// Default Constructor
|
|
||||||
///
|
|
||||||
ColorNode::ColorNode()
|
|
||||||
: mFieldFlag(false), mColor(QColor::fromRgba(0x00000000)), mKey("")
|
: mFieldFlag(false), mColor(QColor::fromRgba(0x00000000)), mKey("")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Constructor From Data
|
/// Constructor From Data
|
||||||
///
|
///
|
||||||
ColorNode::ColorNode( bool fieldFlag, const QColor& color, const QString& key )
|
ColorNode::ColorNode( bool fieldFlag, const QColor& color, const QString& key )
|
||||||
: mFieldFlag(fieldFlag), mColor(color), mKey(key)
|
: mFieldFlag(fieldFlag), mColor(color), mKey(key)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Constructor From Data
|
/// Constructor From Data
|
||||||
///
|
///
|
||||||
ColorNode::ColorNode( bool fieldFlag, uint32_t rgba, const QString& key )
|
ColorNode::ColorNode( bool fieldFlag, uint32_t rgba, const QString& key )
|
||||||
: mFieldFlag(fieldFlag), mKey(key)
|
: mFieldFlag(fieldFlag), mKey(key)
|
||||||
{
|
{
|
||||||
mColor = QColor( (rgba >> 24) & 0xFF,
|
mColor = QColor( (rgba >> 24) & 0xFF,
|
||||||
(rgba >> 16) & 0xFF,
|
(rgba >> 16) & 0xFF,
|
||||||
(rgba >> 8) & 0xFF,
|
(rgba >> 8) & 0xFF,
|
||||||
(rgba ) & 0xFF );
|
(rgba ) & 0xFF );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Constructor From Color
|
/// Constructor From Color
|
||||||
///
|
///
|
||||||
ColorNode::ColorNode( const QColor& color )
|
ColorNode::ColorNode( const QColor& color )
|
||||||
: mFieldFlag(false), mColor(color), mKey("")
|
: mFieldFlag(false), mColor(color), mKey("")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Constructor From Key
|
/// Constructor From Key
|
||||||
///
|
///
|
||||||
ColorNode::ColorNode( const QString& key )
|
ColorNode::ColorNode( const QString& key )
|
||||||
: mFieldFlag(true), mColor(QColor::fromRgba(0x00000000)), mKey(key)
|
: mFieldFlag(true), mColor(QColor::fromRgba(0x00000000)), mKey(key)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// == Operator
|
/// == Operator
|
||||||
///
|
///
|
||||||
bool ColorNode::operator==( const ColorNode& cn )
|
bool ColorNode::operator==( const ColorNode& cn )
|
||||||
{
|
{
|
||||||
return ( (mFieldFlag == cn.mFieldFlag) &&
|
return ( (mFieldFlag == cn.mFieldFlag) &&
|
||||||
(mColor == cn.mColor) &&
|
(mColor == cn.mColor) &&
|
||||||
(mKey == cn.mKey) );
|
(mKey == cn.mKey) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// != Operator
|
/// != Operator
|
||||||
///
|
///
|
||||||
bool ColorNode::operator!=( const ColorNode& cn )
|
bool ColorNode::operator!=( const ColorNode& cn )
|
||||||
{
|
{
|
||||||
return ( (mFieldFlag != cn.mFieldFlag) ||
|
return ( (mFieldFlag != cn.mFieldFlag) ||
|
||||||
(mColor != cn.mColor) ||
|
(mColor != cn.mColor) ||
|
||||||
(mKey != cn.mKey) );
|
(mKey != cn.mKey) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Field Flag Property Getter
|
/// Field Flag Property Getter
|
||||||
///
|
///
|
||||||
bool ColorNode::fieldFlag( void ) const
|
bool ColorNode::fieldFlag( void ) const
|
||||||
{
|
{
|
||||||
return mFieldFlag;
|
return mFieldFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Field Flag Property Setter
|
/// Field Flag Property Setter
|
||||||
///
|
///
|
||||||
void ColorNode::setFieldFlag( bool fieldFlag )
|
void ColorNode::setFieldFlag( bool fieldFlag )
|
||||||
{
|
{
|
||||||
mFieldFlag = fieldFlag;
|
mFieldFlag = fieldFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Color Property Getter
|
/// Color Property Getter
|
||||||
///
|
///
|
||||||
const QColor& ColorNode::color( void ) const
|
const QColor& ColorNode::color( void ) const
|
||||||
{
|
{
|
||||||
return mColor;
|
return mColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Color Property Setter
|
/// Color Property Setter
|
||||||
///
|
///
|
||||||
void ColorNode::setColor( const QColor& color )
|
void ColorNode::setColor( const QColor& color )
|
||||||
{
|
{
|
||||||
mColor = color;
|
mColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Key Property Getter
|
/// Key Property Getter
|
||||||
///
|
///
|
||||||
const QString& ColorNode::key( void ) const
|
const QString& ColorNode::key( void ) const
|
||||||
{
|
{
|
||||||
return mKey;
|
return mKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Key Property Setter
|
/// Key Property Setter
|
||||||
///
|
///
|
||||||
void ColorNode::setKey( const QString& key )
|
void ColorNode::setKey( const QString& key )
|
||||||
{
|
{
|
||||||
mKey = key;
|
mKey = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t ColorNode::rgba( void ) const
|
uint32_t ColorNode::rgba( void ) const
|
||||||
{
|
{
|
||||||
uint32_t c =
|
uint32_t c =
|
||||||
mColor.red() << 24 |
|
mColor.red() << 24 |
|
||||||
mColor.green() << 16 |
|
mColor.green() << 16 |
|
||||||
@@ -158,12 +155,12 @@ namespace glabels
|
|||||||
mColor.alpha();
|
mColor.alpha();
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if TODO
|
#if TODO
|
||||||
QColor ColorNode::expand( MergeRecord? record )
|
QColor ColorNode::expand( MergeRecord? record )
|
||||||
{
|
{
|
||||||
if ( fieldFlag )
|
if ( fieldFlag )
|
||||||
{
|
{
|
||||||
if ( record == null )
|
if ( record == null )
|
||||||
@@ -196,8 +193,5 @@ namespace glabels
|
|||||||
{
|
{
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
+13
-17
@@ -18,27 +18,24 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_ColorNode_h
|
#ifndef ColorNode_h
|
||||||
#define glabels_ColorNode_h
|
#define ColorNode_h
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Color Node Type
|
||||||
|
///
|
||||||
|
struct ColorNode
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Color Node Type
|
|
||||||
///
|
|
||||||
struct ColorNode
|
|
||||||
{
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
ColorNode();
|
ColorNode();
|
||||||
|
|
||||||
ColorNode( bool fieldFlag, const QColor& color, const QString& key );
|
ColorNode( bool fieldFlag, const QColor& color, const QString& key );
|
||||||
@@ -53,7 +50,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Operators
|
// Operators
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
bool operator==( const ColorNode& cn );
|
bool operator==( const ColorNode& cn );
|
||||||
|
|
||||||
bool operator!=( const ColorNode& cn );
|
bool operator!=( const ColorNode& cn );
|
||||||
@@ -62,7 +59,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// Field Flag Property
|
// Field Flag Property
|
||||||
//
|
//
|
||||||
@@ -88,7 +85,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Methods
|
// Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
uint32_t rgba( void ) const;
|
uint32_t rgba( void ) const;
|
||||||
|
|
||||||
#if TODO
|
#if TODO
|
||||||
@@ -99,13 +96,12 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
bool mFieldFlag;
|
bool mFieldFlag;
|
||||||
QColor mColor;
|
QColor mColor;
|
||||||
QString mKey;
|
QString mKey;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_ColorNode_h
|
#endif // ColorNode_h
|
||||||
|
|||||||
@@ -36,25 +36,22 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Constructor From Data
|
||||||
|
///
|
||||||
///
|
ColorPaletteButtonItem::ColorPaletteButtonItem( const QString& text, QWidget* parent )
|
||||||
/// Constructor From Data
|
|
||||||
///
|
|
||||||
ColorPaletteButtonItem::ColorPaletteButtonItem( const QString& text, QWidget* parent )
|
|
||||||
: QWidget(parent), mText(text), mHover(false)
|
: QWidget(parent), mText(text), mHover(false)
|
||||||
{
|
{
|
||||||
setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) );
|
setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) );
|
||||||
setMinimumSize( hBox+2*border+1, hBox+2*border+1 );
|
setMinimumSize( hBox+2*border+1, hBox+2*border+1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Paint Event
|
/// Paint Event
|
||||||
///
|
///
|
||||||
void ColorPaletteButtonItem::paintEvent( QPaintEvent* event )
|
void ColorPaletteButtonItem::paintEvent( QPaintEvent* event )
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -91,36 +88,33 @@ namespace glabels
|
|||||||
QRect textRect( border, border, width()-2*border, hBox );
|
QRect textRect( border, border, width()-2*border, hBox );
|
||||||
|
|
||||||
painter.drawText( textRect, Qt::AlignLeft|Qt::AlignVCenter, mText );
|
painter.drawText( textRect, Qt::AlignLeft|Qt::AlignVCenter, mText );
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Enter Event
|
|
||||||
///
|
|
||||||
void ColorPaletteButtonItem::enterEvent( QEvent* event )
|
|
||||||
{
|
|
||||||
mHover = true;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Leave Event
|
|
||||||
///
|
|
||||||
void ColorPaletteButtonItem::leaveEvent( QEvent* event )
|
|
||||||
{
|
|
||||||
mHover = false;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Mouse Press Event
|
|
||||||
///
|
|
||||||
void ColorPaletteButtonItem::mousePressEvent( QMouseEvent* event )
|
|
||||||
{
|
|
||||||
emit activated();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Enter Event
|
||||||
|
///
|
||||||
|
void ColorPaletteButtonItem::enterEvent( QEvent* event )
|
||||||
|
{
|
||||||
|
mHover = true;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Leave Event
|
||||||
|
///
|
||||||
|
void ColorPaletteButtonItem::leaveEvent( QEvent* event )
|
||||||
|
{
|
||||||
|
mHover = false;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Mouse Press Event
|
||||||
|
///
|
||||||
|
void ColorPaletteButtonItem::mousePressEvent( QMouseEvent* event )
|
||||||
|
{
|
||||||
|
emit activated();
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,41 +18,38 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_ColorPaletteButtonItem_h
|
#ifndef ColorPaletteButtonItem_h
|
||||||
#define glabels_ColorPaletteButtonItem_h
|
#define ColorPaletteButtonItem_h
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Color Palette Item
|
||||||
|
///
|
||||||
|
class ColorPaletteButtonItem : public QWidget
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Color Palette Item
|
|
||||||
///
|
|
||||||
class ColorPaletteButtonItem : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
ColorPaletteButtonItem( const QString& text, QWidget* parent = 0 );
|
ColorPaletteButtonItem( const QString& text, QWidget* parent = 0 );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Signals
|
// Signals
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
signals:
|
signals:
|
||||||
void activated();
|
void activated();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Event handlers
|
// Event handlers
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
protected:
|
protected:
|
||||||
void paintEvent( QPaintEvent* event );
|
void paintEvent( QPaintEvent* event );
|
||||||
void enterEvent( QEvent* event );
|
void enterEvent( QEvent* event );
|
||||||
void leaveEvent( QEvent* event );
|
void leaveEvent( QEvent* event );
|
||||||
@@ -62,13 +59,11 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
QString mText;
|
QString mText;
|
||||||
|
|
||||||
bool mHover;
|
bool mHover;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
#endif // ColorPaletteButtonItem_h
|
||||||
|
|
||||||
#endif // glabels_ColorPaletteButtonItem_h
|
|
||||||
|
|||||||
@@ -29,10 +29,7 @@
|
|||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
ColorPaletteDialog::ColorTableEntry ColorPaletteDialog::mColorTable[] = {
|
||||||
{
|
|
||||||
|
|
||||||
ColorPaletteDialog::ColorTableEntry ColorPaletteDialog::mColorTable[] = {
|
|
||||||
|
|
||||||
{ "#ef2929", tr("Light Scarlet Red", "Color name") },
|
{ "#ef2929", tr("Light Scarlet Red", "Color name") },
|
||||||
{ "#fcaf3e", tr("Light Orange", "Color name") },
|
{ "#fcaf3e", tr("Light Orange", "Color name") },
|
||||||
@@ -73,15 +70,15 @@ namespace glabels
|
|||||||
{ "#eeeeec", tr("Lighter Gray", "Color name") },
|
{ "#eeeeec", tr("Lighter Gray", "Color name") },
|
||||||
{ "#f3f3f3", tr("Very Light Gray", "Color name") },
|
{ "#f3f3f3", tr("Very Light Gray", "Color name") },
|
||||||
{ "#ffffff", tr("White", "Color name") }
|
{ "#ffffff", tr("White", "Color name") }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ColorPaletteDialog::ColorPaletteDialog( const QString& defaultLabel,
|
ColorPaletteDialog::ColorPaletteDialog( const QString& defaultLabel,
|
||||||
const QColor& defaultColor,
|
const QColor& defaultColor,
|
||||||
const QColor& color,
|
const QColor& color,
|
||||||
QWidget* parent )
|
QWidget* parent )
|
||||||
: QDialog( parent )
|
: QDialog( parent )
|
||||||
{
|
{
|
||||||
mColorHistory = ColorHistory::instance();
|
mColorHistory = ColorHistory::instance();
|
||||||
connect( mColorHistory, SIGNAL(changed()), this, SLOT(onColorHistoryChanged()) );
|
connect( mColorHistory, SIGNAL(changed()), this, SLOT(onColorHistoryChanged()) );
|
||||||
|
|
||||||
@@ -160,69 +157,69 @@ namespace glabels
|
|||||||
setLayout( vLayout );
|
setLayout( vLayout );
|
||||||
|
|
||||||
loadCustomColorHistory();
|
loadCustomColorHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorPaletteDialog::setKeys( const QList<QString> keyList )
|
void ColorPaletteDialog::setKeys( const QList<QString> keyList )
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorPaletteDialog::clearKeys()
|
void ColorPaletteDialog::clearKeys()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorPaletteDialog::onDefaultItemActivated()
|
void ColorPaletteDialog::onDefaultItemActivated()
|
||||||
{
|
{
|
||||||
mColorNode.setFieldFlag( false );
|
mColorNode.setFieldFlag( false );
|
||||||
mColorNode.setColor( mDefaultColor );
|
mColorNode.setColor( mDefaultColor );
|
||||||
mColorNode.setKey( "" );
|
mColorNode.setKey( "" );
|
||||||
|
|
||||||
emit colorChanged( mColorNode, true );
|
emit colorChanged( mColorNode, true );
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorPaletteDialog::onPaletteItemActivated( int id )
|
void ColorPaletteDialog::onPaletteItemActivated( int id )
|
||||||
{
|
{
|
||||||
mColorNode.setFieldFlag( false );
|
mColorNode.setFieldFlag( false );
|
||||||
mColorNode.setColor( QColor( mColorTable[id].colorSpec ) );
|
mColorNode.setColor( QColor( mColorTable[id].colorSpec ) );
|
||||||
mColorNode.setKey( "" );
|
mColorNode.setKey( "" );
|
||||||
|
|
||||||
emit colorChanged( mColorNode, false );
|
emit colorChanged( mColorNode, false );
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorPaletteDialog::onHistoryItemActivated( int id )
|
void ColorPaletteDialog::onHistoryItemActivated( int id )
|
||||||
{
|
{
|
||||||
mColorNode.setFieldFlag( false );
|
mColorNode.setFieldFlag( false );
|
||||||
mColorNode.setColor( mColorHistory->getColor( id ) );
|
mColorNode.setColor( mColorHistory->getColor( id ) );
|
||||||
mColorNode.setKey( "" );
|
mColorNode.setKey( "" );
|
||||||
|
|
||||||
emit colorChanged( mColorNode, false );
|
emit colorChanged( mColorNode, false );
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorPaletteDialog::onCustomColorItemActivated()
|
void ColorPaletteDialog::onCustomColorItemActivated()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorPaletteDialog::onColorHistoryChanged()
|
void ColorPaletteDialog::onColorHistoryChanged()
|
||||||
{
|
{
|
||||||
loadCustomColorHistory();
|
loadCustomColorHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorPaletteDialog::loadCustomColorHistory()
|
void ColorPaletteDialog::loadCustomColorHistory()
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < PALETTE_COLS; i++ )
|
for ( int i = 0; i < PALETTE_COLS; i++ )
|
||||||
{
|
{
|
||||||
QColor color = mColorHistory->getColor( i );
|
QColor color = mColorHistory->getColor( i );
|
||||||
@@ -233,6 +230,4 @@ namespace glabels
|
|||||||
mHistoryItem[i]->setEnabled( true );
|
mHistoryItem[i]->setEnabled( true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_ColorPaletteDialog_h
|
#ifndef ColorPaletteDialog_h
|
||||||
#define glabels_ColorPaletteDialog_h
|
#define ColorPaletteDialog_h
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
@@ -29,21 +29,18 @@
|
|||||||
#include "ColorPaletteItem.h"
|
#include "ColorPaletteItem.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Color Palette Dialog
|
||||||
|
///
|
||||||
|
class ColorPaletteDialog : public QDialog
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Color Palette Dialog
|
|
||||||
///
|
|
||||||
class ColorPaletteDialog : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
ColorPaletteDialog( const QString& defaultLabel,
|
ColorPaletteDialog( const QString& defaultLabel,
|
||||||
const QColor& defaultColor,
|
const QColor& defaultColor,
|
||||||
const QColor& color,
|
const QColor& color,
|
||||||
@@ -53,14 +50,14 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Signals
|
// Signals
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
signals:
|
signals:
|
||||||
void colorChanged( ColorNode colorNode, bool isDefault );
|
void colorChanged( ColorNode colorNode, bool isDefault );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Public Methods
|
// Public Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void setKeys( const QList<QString> keyList );
|
void setKeys( const QList<QString> keyList );
|
||||||
void clearKeys();
|
void clearKeys();
|
||||||
|
|
||||||
@@ -68,7 +65,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void onDefaultItemActivated();
|
void onDefaultItemActivated();
|
||||||
void onPaletteItemActivated( int id );
|
void onPaletteItemActivated( int id );
|
||||||
void onHistoryItemActivated( int id );
|
void onHistoryItemActivated( int id );
|
||||||
@@ -79,14 +76,14 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Methods
|
// Private Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
void loadCustomColorHistory();
|
void loadCustomColorHistory();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Members
|
// Private Members
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
QColor mDefaultColor;
|
QColor mDefaultColor;
|
||||||
ColorNode mColorNode;
|
ColorNode mColorNode;
|
||||||
|
|
||||||
@@ -103,9 +100,7 @@ namespace glabels
|
|||||||
ColorHistory* mColorHistory;
|
ColorHistory* mColorHistory;
|
||||||
ColorPaletteItem* mHistoryItem[PALETTE_COLS];
|
ColorPaletteItem* mHistoryItem[PALETTE_COLS];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // glabels_ColorPaletteDialog_h
|
#endif // ColorPaletteDialog_h
|
||||||
|
|||||||
@@ -40,45 +40,42 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Constructor From Data
|
||||||
|
///
|
||||||
///
|
ColorPaletteItem::ColorPaletteItem( int id,
|
||||||
/// Constructor From Data
|
|
||||||
///
|
|
||||||
ColorPaletteItem::ColorPaletteItem( int id,
|
|
||||||
const QColor& color,
|
const QColor& color,
|
||||||
const QString& tip,
|
const QString& tip,
|
||||||
QWidget* parent )
|
QWidget* parent )
|
||||||
: QWidget(parent), mId(id), mColor(color), mTip(tip), mHover(false)
|
: QWidget(parent), mId(id), mColor(color), mTip(tip), mHover(false)
|
||||||
{
|
{
|
||||||
setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
|
setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
|
||||||
setMinimumSize( wSwatch+2*border+1, hSwatch+2*border+1 );
|
setMinimumSize( wSwatch+2*border+1, hSwatch+2*border+1 );
|
||||||
setToolTip( tip );
|
setToolTip( tip );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Color Property Setter
|
/// Color Property Setter
|
||||||
///
|
///
|
||||||
void ColorPaletteItem::setColor( int id,
|
void ColorPaletteItem::setColor( int id,
|
||||||
const QColor& color,
|
const QColor& color,
|
||||||
const QString& tip )
|
const QString& tip )
|
||||||
{
|
{
|
||||||
mId = id;
|
mId = id;
|
||||||
mColor = color;
|
mColor = color;
|
||||||
mTip = tip;
|
mTip = tip;
|
||||||
|
|
||||||
setToolTip( tip );
|
setToolTip( tip );
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Paint Event
|
/// Paint Event
|
||||||
///
|
///
|
||||||
void ColorPaletteItem::paintEvent( QPaintEvent* event )
|
void ColorPaletteItem::paintEvent( QPaintEvent* event )
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -115,36 +112,33 @@ namespace glabels
|
|||||||
painter.drawRect( border, border, wSwatch, hSwatch );
|
painter.drawRect( border, border, wSwatch, hSwatch );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Enter Event
|
|
||||||
///
|
|
||||||
void ColorPaletteItem::enterEvent( QEvent* event )
|
|
||||||
{
|
|
||||||
mHover = true;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Leave Event
|
|
||||||
///
|
|
||||||
void ColorPaletteItem::leaveEvent( QEvent* event )
|
|
||||||
{
|
|
||||||
mHover = false;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Mouse Press Event
|
|
||||||
///
|
|
||||||
void ColorPaletteItem::mousePressEvent( QMouseEvent* event )
|
|
||||||
{
|
|
||||||
emit activated( mId );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Enter Event
|
||||||
|
///
|
||||||
|
void ColorPaletteItem::enterEvent( QEvent* event )
|
||||||
|
{
|
||||||
|
mHover = true;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Leave Event
|
||||||
|
///
|
||||||
|
void ColorPaletteItem::leaveEvent( QEvent* event )
|
||||||
|
{
|
||||||
|
mHover = false;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Mouse Press Event
|
||||||
|
///
|
||||||
|
void ColorPaletteItem::mousePressEvent( QMouseEvent* event )
|
||||||
|
{
|
||||||
|
emit activated( mId );
|
||||||
|
}
|
||||||
|
|||||||
+13
-18
@@ -18,27 +18,24 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_ColorPaletteItem_h
|
#ifndef ColorPaletteItem_h
|
||||||
#define glabels_ColorPaletteItem_h
|
#define ColorPaletteItem_h
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Color Palette Item
|
||||||
|
///
|
||||||
|
class ColorPaletteItem : public QWidget
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Color Palette Item
|
|
||||||
///
|
|
||||||
class ColorPaletteItem : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
ColorPaletteItem( int id,
|
ColorPaletteItem( int id,
|
||||||
const QColor& color,
|
const QColor& color,
|
||||||
const QString& tip,
|
const QString& tip,
|
||||||
@@ -48,14 +45,14 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Signals
|
// Signals
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
signals:
|
signals:
|
||||||
void activated( int id );
|
void activated( int id );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Public Methods
|
// Public Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void setColor( int id,
|
void setColor( int id,
|
||||||
const QColor& color,
|
const QColor& color,
|
||||||
const QString& tip );
|
const QString& tip );
|
||||||
@@ -64,7 +61,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Event handlers
|
// Event handlers
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
protected:
|
protected:
|
||||||
void paintEvent( QPaintEvent* event );
|
void paintEvent( QPaintEvent* event );
|
||||||
void enterEvent( QEvent* event );
|
void enterEvent( QEvent* event );
|
||||||
void leaveEvent( QEvent* event );
|
void leaveEvent( QEvent* event );
|
||||||
@@ -74,15 +71,13 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
int mId;
|
int mId;
|
||||||
QColor mColor;
|
QColor mColor;
|
||||||
QString mTip;
|
QString mTip;
|
||||||
|
|
||||||
bool mHover;
|
bool mHover;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
#endif // ColorPaletteItem_h
|
||||||
|
|
||||||
#endif // glabels_ColorPaletteItem_h
|
|
||||||
|
|||||||
+5
-10
@@ -33,15 +33,12 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Constructor
|
||||||
|
///
|
||||||
///
|
ColorSwatch::ColorSwatch( int w, int h, const QColor& color )
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
ColorSwatch::ColorSwatch( int w, int h, const QColor& color )
|
|
||||||
: QPixmap( w, h )
|
: QPixmap( w, h )
|
||||||
{
|
{
|
||||||
fill( Qt::transparent );
|
fill( Qt::transparent );
|
||||||
|
|
||||||
QPainter painter(this );
|
QPainter painter(this );
|
||||||
@@ -55,6 +52,4 @@ namespace glabels
|
|||||||
painter.setBrush( brush );
|
painter.setBrush( brush );
|
||||||
painter.setPen( pen );
|
painter.setPen( pen );
|
||||||
painter.drawRect( 1, 1, w-2, h-2 );
|
painter.drawRect( 1, 1, w-2, h-2 );
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-13
@@ -18,29 +18,25 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_ColorSwatch_h
|
#ifndef ColorSwatch_h
|
||||||
#define glabels_ColorSwatch_h
|
#define ColorSwatch_h
|
||||||
|
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Simple Preview Widget
|
||||||
|
///
|
||||||
|
class ColorSwatch : public QPixmap
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Simple Preview Widget
|
|
||||||
///
|
|
||||||
class ColorSwatch : public QPixmap
|
|
||||||
{
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
ColorSwatch( int w, int h, const QColor& color );
|
ColorSwatch( int w, int h, const QColor& color );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_ColorSwatch_h
|
#endif // ColorSwatch_h
|
||||||
|
|||||||
+6
-6
@@ -24,37 +24,37 @@
|
|||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
|
||||||
|
|
||||||
glabels::Cursors::Barcode::Barcode()
|
Cursors::Barcode::Barcode()
|
||||||
: QCursor( QPixmap(":cursors/32x32/cursor_barcode.png"), 7, 7 )
|
: QCursor( QPixmap(":cursors/32x32/cursor_barcode.png"), 7, 7 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
glabels::Cursors::Box::Box()
|
Cursors::Box::Box()
|
||||||
: QCursor( QPixmap(":cursors/32x32/cursor_box.png"), 7, 7 )
|
: QCursor( QPixmap(":cursors/32x32/cursor_box.png"), 7, 7 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
glabels::Cursors::Ellipse::Ellipse()
|
Cursors::Ellipse::Ellipse()
|
||||||
: QCursor( QPixmap(":cursors/32x32/cursor_ellipse.png"), 7, 7 )
|
: QCursor( QPixmap(":cursors/32x32/cursor_ellipse.png"), 7, 7 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
glabels::Cursors::Image::Image()
|
Cursors::Image::Image()
|
||||||
: QCursor( QPixmap(":cursors/32x32/cursor_image.png"), 7, 7 )
|
: QCursor( QPixmap(":cursors/32x32/cursor_image.png"), 7, 7 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
glabels::Cursors::Line::Line()
|
Cursors::Line::Line()
|
||||||
: QCursor( QPixmap(":cursors/32x32/cursor_line.png"), 7, 7 )
|
: QCursor( QPixmap(":cursors/32x32/cursor_line.png"), 7, 7 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
glabels::Cursors::Text::Text()
|
Cursors::Text::Text()
|
||||||
: QCursor( QPixmap(":cursors/32x32/cursor_text.png"), 7, 7 )
|
: QCursor( QPixmap(":cursors/32x32/cursor_text.png"), 7, 7 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-12
@@ -18,22 +18,19 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_Cursors_h
|
#ifndef Cursors_h
|
||||||
#define glabels_Cursors_h
|
#define Cursors_h
|
||||||
|
|
||||||
|
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Glabels Cursors
|
||||||
|
///
|
||||||
|
namespace Cursors
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Glabels Cursors
|
|
||||||
///
|
|
||||||
namespace Cursors
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class Barcode : public QCursor
|
class Barcode : public QCursor
|
||||||
{
|
{
|
||||||
@@ -76,8 +73,7 @@ namespace glabels
|
|||||||
Text();
|
Text();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // glabels_Cursors_h
|
|
||||||
|
#endif // Cursors_h
|
||||||
|
|||||||
+26
-33
@@ -21,26 +21,23 @@
|
|||||||
#include "FieldButton.h"
|
#include "FieldButton.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Constructor
|
||||||
|
///
|
||||||
///
|
FieldButton::FieldButton( QWidget* parent )
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
FieldButton::FieldButton( QWidget* parent )
|
|
||||||
: QPushButton(parent)
|
: QPushButton(parent)
|
||||||
{
|
{
|
||||||
setEnabled( false );
|
setEnabled( false );
|
||||||
|
|
||||||
mMenu = new FieldMenu();
|
mMenu = new FieldMenu();
|
||||||
setMenu( mMenu );
|
setMenu( mMenu );
|
||||||
|
|
||||||
connect( mMenu, SIGNAL(keySelected(const QString&)), this, SLOT(onMenuKeySelected(const QString&)) );
|
connect( mMenu, SIGNAL(keySelected(const QString&)), this, SLOT(onMenuKeySelected(const QString&)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FieldButton::setName( const QString& name )
|
void FieldButton::setName( const QString& name )
|
||||||
{
|
{
|
||||||
if ( name.isNull() || name.isEmpty() )
|
if ( name.isNull() || name.isEmpty() )
|
||||||
{
|
{
|
||||||
setText( tr("(None)") );
|
setText( tr("(None)") );
|
||||||
@@ -51,11 +48,11 @@ namespace glabels
|
|||||||
setText( name );
|
setText( name );
|
||||||
mLabelIsKey = true;
|
mLabelIsKey = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FieldButton::setKeys( const QList<QString>& keyList )
|
void FieldButton::setKeys( const QList<QString>& keyList )
|
||||||
{
|
{
|
||||||
mMenu->setKeys( keyList );
|
mMenu->setKeys( keyList );
|
||||||
|
|
||||||
if ( keyList.length() > 0 )
|
if ( keyList.length() > 0 )
|
||||||
@@ -77,35 +74,35 @@ namespace glabels
|
|||||||
{
|
{
|
||||||
setEnabled( false );
|
setEnabled( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FieldButton::clearKeys()
|
void FieldButton::clearKeys()
|
||||||
{
|
{
|
||||||
if ( !mLabelIsKey )
|
if ( !mLabelIsKey )
|
||||||
{
|
{
|
||||||
setText( tr("(None)") );
|
setText( tr("(None)") );
|
||||||
}
|
}
|
||||||
|
|
||||||
setEnabled( false );
|
setEnabled( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// key getter
|
/// key getter
|
||||||
///
|
///
|
||||||
QString FieldButton::key() const
|
QString FieldButton::key() const
|
||||||
{
|
{
|
||||||
return mKey;
|
return mKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// onMenuKeySelected slot
|
/// onMenuKeySelected slot
|
||||||
///
|
///
|
||||||
void FieldButton::onMenuKeySelected( const QString& key )
|
void FieldButton::onMenuKeySelected( const QString& key )
|
||||||
{
|
{
|
||||||
mKey = key;
|
mKey = key;
|
||||||
|
|
||||||
if ( mLabelIsKey )
|
if ( mLabelIsKey )
|
||||||
@@ -114,8 +111,4 @@ namespace glabels
|
|||||||
}
|
}
|
||||||
|
|
||||||
emit keySelected( key );
|
emit keySelected( key );
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+14
-19
@@ -18,49 +18,46 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_FieldButton_h
|
#ifndef FieldButton_h
|
||||||
#define glabels_FieldButton_h
|
#define FieldButton_h
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include "FieldMenu.h"
|
#include "FieldMenu.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Field Button
|
||||||
|
///
|
||||||
|
class FieldButton : public QPushButton
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Field Button
|
|
||||||
///
|
|
||||||
class FieldButton : public QPushButton
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
FieldButton( QWidget* parent = 0 );
|
FieldButton( QWidget* parent = 0 );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Signals
|
// Signals
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
signals:
|
signals:
|
||||||
void keySelected( const QString& key );
|
void keySelected( const QString& key );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
QString key() const;
|
QString key() const;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Public Methods
|
// Public Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void setName( const QString& name = "" );
|
void setName( const QString& name = "" );
|
||||||
void setKeys( const QList<QString>& keyList );
|
void setKeys( const QList<QString>& keyList );
|
||||||
void clearKeys();
|
void clearKeys();
|
||||||
@@ -69,21 +66,19 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void onMenuKeySelected( const QString& key );
|
void onMenuKeySelected( const QString& key );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
FieldMenu* mMenu;
|
FieldMenu* mMenu;
|
||||||
QString mKey;
|
QString mKey;
|
||||||
bool mLabelIsKey;
|
bool mLabelIsKey;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
#endif // FieldButton_h
|
||||||
|
|
||||||
#endif // glabels_FieldButton_h
|
|
||||||
|
|||||||
+18
-25
@@ -23,22 +23,19 @@
|
|||||||
#include "FieldMenuItem.h"
|
#include "FieldMenuItem.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
FieldMenu::FieldMenu()
|
||||||
{
|
{
|
||||||
|
}
|
||||||
///
|
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
FieldMenu::FieldMenu()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// set keys
|
/// set keys
|
||||||
///
|
///
|
||||||
void FieldMenu::setKeys( const QList<QString>& keyList )
|
void FieldMenu::setKeys( const QList<QString>& keyList )
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
foreach ( QString key, keyList )
|
foreach ( QString key, keyList )
|
||||||
@@ -48,17 +45,13 @@ namespace glabels
|
|||||||
|
|
||||||
addAction( menuItem );
|
addAction( menuItem );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// onMenuItemActivated slot
|
|
||||||
///
|
|
||||||
void FieldMenu::onMenuItemActivated( const QString& key )
|
|
||||||
{
|
|
||||||
emit keySelected( key );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// onMenuItemActivated slot
|
||||||
|
///
|
||||||
|
void FieldMenu::onMenuItemActivated( const QString& key )
|
||||||
|
{
|
||||||
|
emit keySelected( key );
|
||||||
|
}
|
||||||
|
|||||||
+13
-18
@@ -18,59 +18,54 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_FieldMenu_h
|
#ifndef FieldMenu_h
|
||||||
#define glabels_FieldMenu_h
|
#define FieldMenu_h
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Field Menu
|
||||||
|
///
|
||||||
|
class FieldMenu : public QMenu
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Field Menu
|
|
||||||
///
|
|
||||||
class FieldMenu : public QMenu
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
FieldMenu();
|
FieldMenu();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Signals
|
// Signals
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
signals:
|
signals:
|
||||||
void keySelected( const QString& key );
|
void keySelected( const QString& key );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Public Methods
|
// Public Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void setKeys( const QList<QString>& keyList );
|
void setKeys( const QList<QString>& keyList );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void onMenuItemActivated( const QString& key );
|
void onMenuItemActivated( const QString& key );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
#endif // FieldMenu_h
|
||||||
|
|
||||||
#endif // glabels_FieldMenu_h
|
|
||||||
|
|||||||
+22
-28
@@ -21,37 +21,31 @@
|
|||||||
#include "FieldMenuItem.h"
|
#include "FieldMenuItem.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Constructor From Data
|
||||||
|
///
|
||||||
///
|
FieldMenuItem::FieldMenuItem( const QString& key, QObject* parent )
|
||||||
/// Constructor From Data
|
|
||||||
///
|
|
||||||
FieldMenuItem::FieldMenuItem( const QString& key, QObject* parent )
|
|
||||||
: QAction(parent), mKey(key)
|
: QAction(parent), mKey(key)
|
||||||
{
|
{
|
||||||
setText( key );
|
setText( key );
|
||||||
|
|
||||||
connect( this, SIGNAL(triggered()), this, SLOT(onTriggered()) );
|
connect( this, SIGNAL(triggered()), this, SLOT(onTriggered()) );
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// key Property Getter
|
|
||||||
///
|
|
||||||
QString FieldMenuItem::key() const
|
|
||||||
{
|
|
||||||
return mKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// onTriggered slot
|
|
||||||
///
|
|
||||||
void FieldMenuItem::onTriggered()
|
|
||||||
{
|
|
||||||
emit activated( mKey );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// key Property Getter
|
||||||
|
///
|
||||||
|
QString FieldMenuItem::key() const
|
||||||
|
{
|
||||||
|
return mKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// onTriggered slot
|
||||||
|
///
|
||||||
|
void FieldMenuItem::onTriggered()
|
||||||
|
{
|
||||||
|
emit activated( mKey );
|
||||||
|
}
|
||||||
|
|||||||
+13
-18
@@ -18,60 +18,55 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_FieldMenuItem_h
|
#ifndef FieldMenuItem_h
|
||||||
#define glabels_FieldMenuItem_h
|
#define FieldMenuItem_h
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Field Menu Item
|
||||||
|
///
|
||||||
|
class FieldMenuItem : public QAction
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Field Menu Item
|
|
||||||
///
|
|
||||||
class FieldMenuItem : public QAction
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
FieldMenuItem( const QString& key, QObject* parent = 0 );
|
FieldMenuItem( const QString& key, QObject* parent = 0 );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Signals
|
// Signals
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
signals:
|
signals:
|
||||||
void activated( const QString& key );
|
void activated( const QString& key );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
QString key() const;
|
QString key() const;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void onTriggered();
|
void onTriggered();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
const QString mKey;
|
const QString mKey;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
#endif // FieldMenuItem_h
|
||||||
|
|
||||||
#endif // glabels_FieldMenuItem_h
|
|
||||||
|
|||||||
+43
-49
@@ -31,17 +31,15 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
/// @TODO keep track of cwd between open/save dialogs
|
||||||
{
|
|
||||||
/// @TODO keep track of cwd between open/save dialogs
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// New Label Dialog
|
/// New Label Dialog
|
||||||
///
|
///
|
||||||
void File::newLabel( MainWindow *window )
|
void File::newLabel( MainWindow *window )
|
||||||
{
|
{
|
||||||
// @TODO lookup latest template, if none default based on locale
|
// @TODO lookup latest template, if none default based on locale
|
||||||
const libglabels::Template* tmplate = libglabels::Db::lookupTemplateFromBrandPart( "Avery", "5159" );
|
const glabels::Template* tmplate = glabels::Db::lookupTemplateFromBrandPart( "Avery", "5159" );
|
||||||
LabelModel* label = new LabelModel();
|
LabelModel* label = new LabelModel();
|
||||||
label->setTmplate( tmplate );
|
label->setTmplate( tmplate );
|
||||||
label->setRotate( false );
|
label->setRotate( false );
|
||||||
@@ -49,14 +47,14 @@ namespace glabels
|
|||||||
MainWindow *newWindow = new MainWindow();
|
MainWindow *newWindow = new MainWindow();
|
||||||
newWindow->setModel( label );
|
newWindow->setModel( label );
|
||||||
newWindow->show();
|
newWindow->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Open File Dialog
|
/// Open File Dialog
|
||||||
///
|
///
|
||||||
void File::open( MainWindow *window )
|
void File::open( MainWindow *window )
|
||||||
{
|
{
|
||||||
QString fileName =
|
QString fileName =
|
||||||
QFileDialog::getOpenFileName( window,
|
QFileDialog::getOpenFileName( window,
|
||||||
tr("Open label"),
|
tr("Open label"),
|
||||||
@@ -90,14 +88,14 @@ namespace glabels
|
|||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Save file
|
/// Save file
|
||||||
///
|
///
|
||||||
bool File::save( MainWindow *window )
|
bool File::save( MainWindow *window )
|
||||||
{
|
{
|
||||||
if ( window->model()->fileName().isEmpty() )
|
if ( window->model()->fileName().isEmpty() )
|
||||||
{
|
{
|
||||||
return saveAs( window );
|
return saveAs( window );
|
||||||
@@ -110,14 +108,14 @@ namespace glabels
|
|||||||
|
|
||||||
XmlLabelCreator::writeFile( window->model(), window->model()->fileName() );
|
XmlLabelCreator::writeFile( window->model(), window->model()->fileName() );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Save file as
|
/// Save file as
|
||||||
///
|
///
|
||||||
bool File::saveAs( MainWindow *window )
|
bool File::saveAs( MainWindow *window )
|
||||||
{
|
{
|
||||||
QString rawFileName =
|
QString rawFileName =
|
||||||
QFileDialog::getSaveFileName( window,
|
QFileDialog::getSaveFileName( window,
|
||||||
tr("Save Label As"),
|
tr("Save Label As"),
|
||||||
@@ -153,23 +151,23 @@ namespace glabels
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Print file
|
/// Print file
|
||||||
///
|
///
|
||||||
void File::print( MainWindow *window )
|
void File::print( MainWindow *window )
|
||||||
{
|
{
|
||||||
qDebug() << "ACTION: file->print";
|
qDebug() << "ACTION: file->print";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Close file
|
/// Close file
|
||||||
///
|
///
|
||||||
void File::close( MainWindow *window )
|
void File::close( MainWindow *window )
|
||||||
{
|
{
|
||||||
bool closeFlag = true;
|
bool closeFlag = true;
|
||||||
|
|
||||||
if ( !window->isEmpty() )
|
if ( !window->isEmpty() )
|
||||||
@@ -206,20 +204,16 @@ namespace glabels
|
|||||||
{
|
{
|
||||||
window->close();
|
window->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Exit, closing all windows
|
/// Exit, closing all windows
|
||||||
///
|
///
|
||||||
void File::exit()
|
void File::exit()
|
||||||
{
|
{
|
||||||
foreach ( MainWindow* window, MainWindow::windowList() )
|
foreach ( MainWindow* window, MainWindow::windowList() )
|
||||||
{
|
{
|
||||||
close( window );
|
close( window );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-14
@@ -18,25 +18,24 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_File_h
|
#ifndef File_h
|
||||||
#define glabels_File_h
|
#define File_h
|
||||||
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
class MainWindow;
|
||||||
{
|
|
||||||
class MainWindow;
|
|
||||||
|
|
||||||
///
|
|
||||||
/// File Actions
|
///
|
||||||
///
|
/// File Actions
|
||||||
class File : public QObject
|
///
|
||||||
{
|
class File : public QObject
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void newLabel( MainWindow *window = 0 );
|
static void newLabel( MainWindow *window = 0 );
|
||||||
static void open( MainWindow *window );
|
static void open( MainWindow *window );
|
||||||
static bool save( MainWindow *window );
|
static bool save( MainWindow *window );
|
||||||
@@ -44,8 +43,7 @@ namespace glabels
|
|||||||
static void print( MainWindow *window );
|
static void print( MainWindow *window );
|
||||||
static void close( MainWindow *window );
|
static void close( MainWindow *window );
|
||||||
static void exit();
|
static void exit();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_File_h
|
#endif // File_h
|
||||||
|
|||||||
@@ -21,12 +21,9 @@
|
|||||||
#include "FileUtil.h"
|
#include "FileUtil.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
namespace FileUtil
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace FileUtil
|
|
||||||
{
|
|
||||||
|
|
||||||
QString addExtension( const QString& rawFilename, const QString& extension )
|
QString addExtension( const QString& rawFilename, const QString& extension )
|
||||||
{
|
{
|
||||||
if ( rawFilename.endsWith( extension ) )
|
if ( rawFilename.endsWith( extension ) )
|
||||||
@@ -37,8 +34,4 @@ namespace glabels
|
|||||||
return rawFilename + extension;
|
return rawFilename + extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-8
@@ -18,21 +18,18 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_FileUtil_h
|
#ifndef FileUtil_h
|
||||||
#define glabels_FileUtil_h
|
#define FileUtil_h
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
namespace FileUtil
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace FileUtil
|
|
||||||
{
|
|
||||||
|
|
||||||
QString addExtension( const QString& rawFilename, const QString& extension );
|
QString addExtension( const QString& rawFilename, const QString& extension );
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // glabels_FileUtil_h
|
|
||||||
|
#endif // FileUtil_h
|
||||||
|
|||||||
+50
-50
@@ -41,7 +41,7 @@ namespace
|
|||||||
///
|
///
|
||||||
/// Handle Constructor
|
/// Handle Constructor
|
||||||
///
|
///
|
||||||
glabels::Handle::Handle( LabelModelObject* owner, Location location )
|
Handle::Handle( LabelModelObject* owner, Location location )
|
||||||
: mOwner(owner), mLocation(location)
|
: mOwner(owner), mLocation(location)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ glabels::Handle::Handle( LabelModelObject* owner, Location location )
|
|||||||
///
|
///
|
||||||
/// Handle Destructor
|
/// Handle Destructor
|
||||||
///
|
///
|
||||||
glabels::Handle::~Handle()
|
Handle::~Handle()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ glabels::Handle::~Handle()
|
|||||||
///
|
///
|
||||||
/// Handle owner
|
/// Handle owner
|
||||||
///
|
///
|
||||||
glabels::LabelModelObject* glabels::Handle::owner() const
|
LabelModelObject* Handle::owner() const
|
||||||
{
|
{
|
||||||
return mOwner;
|
return mOwner;
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ glabels::LabelModelObject* glabels::Handle::owner() const
|
|||||||
///
|
///
|
||||||
/// Handle location
|
/// Handle location
|
||||||
///
|
///
|
||||||
glabels::Handle::Location glabels::Handle::location() const
|
Handle::Location Handle::location() const
|
||||||
{
|
{
|
||||||
return mLocation;
|
return mLocation;
|
||||||
}
|
}
|
||||||
@@ -76,10 +76,10 @@ glabels::Handle::Location glabels::Handle::location() const
|
|||||||
///
|
///
|
||||||
/// Draw Handle at x,y
|
/// Draw Handle at x,y
|
||||||
///
|
///
|
||||||
void glabels::Handle::drawAt( QPainter* painter,
|
void Handle::drawAt( QPainter* painter,
|
||||||
double scale,
|
double scale,
|
||||||
const libglabels::Distance& x,
|
const glabels::Distance& x,
|
||||||
const libglabels::Distance& y,
|
const glabels::Distance& y,
|
||||||
QColor color ) const
|
QColor color ) const
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
@@ -104,9 +104,9 @@ void glabels::Handle::drawAt( QPainter* painter,
|
|||||||
///
|
///
|
||||||
/// Create Handle path at x,y
|
/// Create Handle path at x,y
|
||||||
///
|
///
|
||||||
QPainterPath glabels::Handle::pathAt( double scale,
|
QPainterPath Handle::pathAt( double scale,
|
||||||
const libglabels::Distance& x,
|
const glabels::Distance& x,
|
||||||
const libglabels::Distance& y ) const
|
const glabels::Distance& y ) const
|
||||||
{
|
{
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ QPainterPath glabels::Handle::pathAt( double scale,
|
|||||||
///
|
///
|
||||||
/// HandleNorthWest Constructor
|
/// HandleNorthWest Constructor
|
||||||
///
|
///
|
||||||
glabels::HandleNorthWest::HandleNorthWest( LabelModelObject* owner )
|
HandleNorthWest::HandleNorthWest( LabelModelObject* owner )
|
||||||
: Handle( owner, NW )
|
: Handle( owner, NW )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@ glabels::HandleNorthWest::HandleNorthWest( LabelModelObject* owner )
|
|||||||
///
|
///
|
||||||
/// HandleNorthWest Destructor
|
/// HandleNorthWest Destructor
|
||||||
///
|
///
|
||||||
glabels::HandleNorthWest::~HandleNorthWest()
|
HandleNorthWest::~HandleNorthWest()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ glabels::HandleNorthWest::~HandleNorthWest()
|
|||||||
///
|
///
|
||||||
/// Draw HandleNorthWest
|
/// Draw HandleNorthWest
|
||||||
///
|
///
|
||||||
void glabels::HandleNorthWest::draw( QPainter* painter, double scale ) const
|
void HandleNorthWest::draw( QPainter* painter, double scale ) const
|
||||||
{
|
{
|
||||||
drawAt( painter, scale, 0, 0, originHandleFillColor );
|
drawAt( painter, scale, 0, 0, originHandleFillColor );
|
||||||
}
|
}
|
||||||
@@ -148,7 +148,7 @@ void glabels::HandleNorthWest::draw( QPainter* painter, double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleNorthWest Path
|
/// HandleNorthWest Path
|
||||||
///
|
///
|
||||||
QPainterPath glabels::HandleNorthWest::path( double scale ) const
|
QPainterPath HandleNorthWest::path( double scale ) const
|
||||||
{
|
{
|
||||||
return pathAt( scale, 0, 0 );
|
return pathAt( scale, 0, 0 );
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ QPainterPath glabels::HandleNorthWest::path( double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleNorth Constructor
|
/// HandleNorth Constructor
|
||||||
///
|
///
|
||||||
glabels::HandleNorth::HandleNorth( LabelModelObject* owner )
|
HandleNorth::HandleNorth( LabelModelObject* owner )
|
||||||
: Handle( owner, N )
|
: Handle( owner, N )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ glabels::HandleNorth::HandleNorth( LabelModelObject* owner )
|
|||||||
///
|
///
|
||||||
/// HandleNorth Destructor
|
/// HandleNorth Destructor
|
||||||
///
|
///
|
||||||
glabels::HandleNorth::~HandleNorth()
|
HandleNorth::~HandleNorth()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ glabels::HandleNorth::~HandleNorth()
|
|||||||
///
|
///
|
||||||
/// Draw HandleNorth
|
/// Draw HandleNorth
|
||||||
///
|
///
|
||||||
void glabels::HandleNorth::draw( QPainter* painter, double scale ) const
|
void HandleNorth::draw( QPainter* painter, double scale ) const
|
||||||
{
|
{
|
||||||
drawAt( painter, scale, mOwner->w()/2, 0, handleFillColor );
|
drawAt( painter, scale, mOwner->w()/2, 0, handleFillColor );
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,7 @@ void glabels::HandleNorth::draw( QPainter* painter, double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleNorth Path
|
/// HandleNorth Path
|
||||||
///
|
///
|
||||||
QPainterPath glabels::HandleNorth::path( double scale ) const
|
QPainterPath HandleNorth::path( double scale ) const
|
||||||
{
|
{
|
||||||
return pathAt( scale, mOwner->w()/2, 0 );
|
return pathAt( scale, mOwner->w()/2, 0 );
|
||||||
}
|
}
|
||||||
@@ -192,7 +192,7 @@ QPainterPath glabels::HandleNorth::path( double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleNorthEast Constructor
|
/// HandleNorthEast Constructor
|
||||||
///
|
///
|
||||||
glabels::HandleNorthEast::HandleNorthEast( LabelModelObject* owner )
|
HandleNorthEast::HandleNorthEast( LabelModelObject* owner )
|
||||||
: Handle( owner, NE )
|
: Handle( owner, NE )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -201,7 +201,7 @@ glabels::HandleNorthEast::HandleNorthEast( LabelModelObject* owner )
|
|||||||
///
|
///
|
||||||
/// HandleNorthEast Destructor
|
/// HandleNorthEast Destructor
|
||||||
///
|
///
|
||||||
glabels::HandleNorthEast::~HandleNorthEast()
|
HandleNorthEast::~HandleNorthEast()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ glabels::HandleNorthEast::~HandleNorthEast()
|
|||||||
///
|
///
|
||||||
/// Draw HandleNorthEast
|
/// Draw HandleNorthEast
|
||||||
///
|
///
|
||||||
void glabels::HandleNorthEast::draw( QPainter* painter, double scale ) const
|
void HandleNorthEast::draw( QPainter* painter, double scale ) const
|
||||||
{
|
{
|
||||||
drawAt( painter, scale, mOwner->w(), 0, handleFillColor );
|
drawAt( painter, scale, mOwner->w(), 0, handleFillColor );
|
||||||
}
|
}
|
||||||
@@ -218,7 +218,7 @@ void glabels::HandleNorthEast::draw( QPainter* painter, double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleNorthEast Path
|
/// HandleNorthEast Path
|
||||||
///
|
///
|
||||||
QPainterPath glabels::HandleNorthEast::path( double scale ) const
|
QPainterPath HandleNorthEast::path( double scale ) const
|
||||||
{
|
{
|
||||||
return pathAt( scale, mOwner->w(), 0 );
|
return pathAt( scale, mOwner->w(), 0 );
|
||||||
}
|
}
|
||||||
@@ -227,7 +227,7 @@ QPainterPath glabels::HandleNorthEast::path( double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleEast Constructor
|
/// HandleEast Constructor
|
||||||
///
|
///
|
||||||
glabels::HandleEast::HandleEast( LabelModelObject* owner )
|
HandleEast::HandleEast( LabelModelObject* owner )
|
||||||
: Handle( owner, E )
|
: Handle( owner, E )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -236,7 +236,7 @@ glabels::HandleEast::HandleEast( LabelModelObject* owner )
|
|||||||
///
|
///
|
||||||
/// HandleEast Destructor
|
/// HandleEast Destructor
|
||||||
///
|
///
|
||||||
glabels::HandleEast::~HandleEast()
|
HandleEast::~HandleEast()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ glabels::HandleEast::~HandleEast()
|
|||||||
///
|
///
|
||||||
/// Draw HandleEast
|
/// Draw HandleEast
|
||||||
///
|
///
|
||||||
void glabels::HandleEast::draw( QPainter* painter, double scale ) const
|
void HandleEast::draw( QPainter* painter, double scale ) const
|
||||||
{
|
{
|
||||||
drawAt( painter, scale, mOwner->w(), mOwner->h()/2, handleFillColor );
|
drawAt( painter, scale, mOwner->w(), mOwner->h()/2, handleFillColor );
|
||||||
}
|
}
|
||||||
@@ -253,7 +253,7 @@ void glabels::HandleEast::draw( QPainter* painter, double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleEast Path
|
/// HandleEast Path
|
||||||
///
|
///
|
||||||
QPainterPath glabels::HandleEast::path( double scale ) const
|
QPainterPath HandleEast::path( double scale ) const
|
||||||
{
|
{
|
||||||
return pathAt( scale, mOwner->w(), mOwner->h()/2 );
|
return pathAt( scale, mOwner->w(), mOwner->h()/2 );
|
||||||
}
|
}
|
||||||
@@ -262,7 +262,7 @@ QPainterPath glabels::HandleEast::path( double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleSouthEast Constructor
|
/// HandleSouthEast Constructor
|
||||||
///
|
///
|
||||||
glabels::HandleSouthEast::HandleSouthEast( LabelModelObject* owner )
|
HandleSouthEast::HandleSouthEast( LabelModelObject* owner )
|
||||||
: Handle( owner, SE )
|
: Handle( owner, SE )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -271,7 +271,7 @@ glabels::HandleSouthEast::HandleSouthEast( LabelModelObject* owner )
|
|||||||
///
|
///
|
||||||
/// HandleSouthEast Destructor
|
/// HandleSouthEast Destructor
|
||||||
///
|
///
|
||||||
glabels::HandleSouthEast::~HandleSouthEast()
|
HandleSouthEast::~HandleSouthEast()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,7 +279,7 @@ glabels::HandleSouthEast::~HandleSouthEast()
|
|||||||
///
|
///
|
||||||
/// Draw HandleSouthEast
|
/// Draw HandleSouthEast
|
||||||
///
|
///
|
||||||
void glabels::HandleSouthEast::draw( QPainter* painter, double scale ) const
|
void HandleSouthEast::draw( QPainter* painter, double scale ) const
|
||||||
{
|
{
|
||||||
drawAt( painter, scale, mOwner->w(), mOwner->h(), handleFillColor );
|
drawAt( painter, scale, mOwner->w(), mOwner->h(), handleFillColor );
|
||||||
}
|
}
|
||||||
@@ -288,7 +288,7 @@ void glabels::HandleSouthEast::draw( QPainter* painter, double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleSouthEast Path
|
/// HandleSouthEast Path
|
||||||
///
|
///
|
||||||
QPainterPath glabels::HandleSouthEast::path( double scale ) const
|
QPainterPath HandleSouthEast::path( double scale ) const
|
||||||
{
|
{
|
||||||
return pathAt( scale, mOwner->w(), mOwner->h() );
|
return pathAt( scale, mOwner->w(), mOwner->h() );
|
||||||
}
|
}
|
||||||
@@ -297,7 +297,7 @@ QPainterPath glabels::HandleSouthEast::path( double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleSouth Constructor
|
/// HandleSouth Constructor
|
||||||
///
|
///
|
||||||
glabels::HandleSouth::HandleSouth( LabelModelObject* owner )
|
HandleSouth::HandleSouth( LabelModelObject* owner )
|
||||||
: Handle( owner, S )
|
: Handle( owner, S )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -306,7 +306,7 @@ glabels::HandleSouth::HandleSouth( LabelModelObject* owner )
|
|||||||
///
|
///
|
||||||
/// HandleSouth Destructor
|
/// HandleSouth Destructor
|
||||||
///
|
///
|
||||||
glabels::HandleSouth::~HandleSouth()
|
HandleSouth::~HandleSouth()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,7 +314,7 @@ glabels::HandleSouth::~HandleSouth()
|
|||||||
///
|
///
|
||||||
/// Draw HandleSouth
|
/// Draw HandleSouth
|
||||||
///
|
///
|
||||||
void glabels::HandleSouth::draw( QPainter* painter, double scale ) const
|
void HandleSouth::draw( QPainter* painter, double scale ) const
|
||||||
{
|
{
|
||||||
drawAt( painter, scale, mOwner->w()/2, mOwner->h(), handleFillColor );
|
drawAt( painter, scale, mOwner->w()/2, mOwner->h(), handleFillColor );
|
||||||
}
|
}
|
||||||
@@ -323,7 +323,7 @@ void glabels::HandleSouth::draw( QPainter* painter, double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleSouth Path
|
/// HandleSouth Path
|
||||||
///
|
///
|
||||||
QPainterPath glabels::HandleSouth::path( double scale ) const
|
QPainterPath HandleSouth::path( double scale ) const
|
||||||
{
|
{
|
||||||
return pathAt( scale, mOwner->w()/2, mOwner->h() );
|
return pathAt( scale, mOwner->w()/2, mOwner->h() );
|
||||||
}
|
}
|
||||||
@@ -332,7 +332,7 @@ QPainterPath glabels::HandleSouth::path( double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleSouthWest Constructor
|
/// HandleSouthWest Constructor
|
||||||
///
|
///
|
||||||
glabels::HandleSouthWest::HandleSouthWest( LabelModelObject* owner )
|
HandleSouthWest::HandleSouthWest( LabelModelObject* owner )
|
||||||
: Handle( owner, SW )
|
: Handle( owner, SW )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -341,7 +341,7 @@ glabels::HandleSouthWest::HandleSouthWest( LabelModelObject* owner )
|
|||||||
///
|
///
|
||||||
/// HandleSouthWest Destructor
|
/// HandleSouthWest Destructor
|
||||||
///
|
///
|
||||||
glabels::HandleSouthWest::~HandleSouthWest()
|
HandleSouthWest::~HandleSouthWest()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,7 +349,7 @@ glabels::HandleSouthWest::~HandleSouthWest()
|
|||||||
///
|
///
|
||||||
/// Draw HandleSouthWest
|
/// Draw HandleSouthWest
|
||||||
///
|
///
|
||||||
void glabels::HandleSouthWest::draw( QPainter* painter, double scale ) const
|
void HandleSouthWest::draw( QPainter* painter, double scale ) const
|
||||||
{
|
{
|
||||||
drawAt( painter, scale, 0, mOwner->h(), handleFillColor );
|
drawAt( painter, scale, 0, mOwner->h(), handleFillColor );
|
||||||
}
|
}
|
||||||
@@ -358,7 +358,7 @@ void glabels::HandleSouthWest::draw( QPainter* painter, double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleSouthWest Path
|
/// HandleSouthWest Path
|
||||||
///
|
///
|
||||||
QPainterPath glabels::HandleSouthWest::path( double scale ) const
|
QPainterPath HandleSouthWest::path( double scale ) const
|
||||||
{
|
{
|
||||||
return pathAt( scale, 0, mOwner->h() );
|
return pathAt( scale, 0, mOwner->h() );
|
||||||
}
|
}
|
||||||
@@ -367,7 +367,7 @@ QPainterPath glabels::HandleSouthWest::path( double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleWest Constructor
|
/// HandleWest Constructor
|
||||||
///
|
///
|
||||||
glabels::HandleWest::HandleWest( LabelModelObject* owner )
|
HandleWest::HandleWest( LabelModelObject* owner )
|
||||||
: Handle( owner, W )
|
: Handle( owner, W )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -376,7 +376,7 @@ glabels::HandleWest::HandleWest( LabelModelObject* owner )
|
|||||||
///
|
///
|
||||||
/// HandleWest Destructor
|
/// HandleWest Destructor
|
||||||
///
|
///
|
||||||
glabels::HandleWest::~HandleWest()
|
HandleWest::~HandleWest()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,7 +384,7 @@ glabels::HandleWest::~HandleWest()
|
|||||||
///
|
///
|
||||||
/// Draw HandleWest
|
/// Draw HandleWest
|
||||||
///
|
///
|
||||||
void glabels::HandleWest::draw( QPainter* painter, double scale ) const
|
void HandleWest::draw( QPainter* painter, double scale ) const
|
||||||
{
|
{
|
||||||
drawAt( painter, scale, 0, mOwner->h()/2, handleFillColor );
|
drawAt( painter, scale, 0, mOwner->h()/2, handleFillColor );
|
||||||
}
|
}
|
||||||
@@ -393,7 +393,7 @@ void glabels::HandleWest::draw( QPainter* painter, double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleWest Path
|
/// HandleWest Path
|
||||||
///
|
///
|
||||||
QPainterPath glabels::HandleWest::path( double scale ) const
|
QPainterPath HandleWest::path( double scale ) const
|
||||||
{
|
{
|
||||||
return pathAt( scale, 0, mOwner->h()/2 );
|
return pathAt( scale, 0, mOwner->h()/2 );
|
||||||
}
|
}
|
||||||
@@ -402,7 +402,7 @@ QPainterPath glabels::HandleWest::path( double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleP1 Constructor
|
/// HandleP1 Constructor
|
||||||
///
|
///
|
||||||
glabels::HandleP1::HandleP1( LabelModelObject* owner )
|
HandleP1::HandleP1( LabelModelObject* owner )
|
||||||
: Handle( owner, P1 )
|
: Handle( owner, P1 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -411,7 +411,7 @@ glabels::HandleP1::HandleP1( LabelModelObject* owner )
|
|||||||
///
|
///
|
||||||
/// HandleP1 Destructor
|
/// HandleP1 Destructor
|
||||||
///
|
///
|
||||||
glabels::HandleP1::~HandleP1()
|
HandleP1::~HandleP1()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ glabels::HandleP1::~HandleP1()
|
|||||||
///
|
///
|
||||||
/// Draw HandleP1
|
/// Draw HandleP1
|
||||||
///
|
///
|
||||||
void glabels::HandleP1::draw( QPainter* painter, double scale ) const
|
void HandleP1::draw( QPainter* painter, double scale ) const
|
||||||
{
|
{
|
||||||
drawAt( painter, scale, 0, 0, originHandleFillColor );
|
drawAt( painter, scale, 0, 0, originHandleFillColor );
|
||||||
}
|
}
|
||||||
@@ -428,7 +428,7 @@ void glabels::HandleP1::draw( QPainter* painter, double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleP1 Path
|
/// HandleP1 Path
|
||||||
///
|
///
|
||||||
QPainterPath glabels::HandleP1::path( double scale ) const
|
QPainterPath HandleP1::path( double scale ) const
|
||||||
{
|
{
|
||||||
return pathAt( scale, 0, 0 );
|
return pathAt( scale, 0, 0 );
|
||||||
}
|
}
|
||||||
@@ -437,7 +437,7 @@ QPainterPath glabels::HandleP1::path( double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleP2 Constructor
|
/// HandleP2 Constructor
|
||||||
///
|
///
|
||||||
glabels::HandleP2::HandleP2( LabelModelObject* owner )
|
HandleP2::HandleP2( LabelModelObject* owner )
|
||||||
: Handle( owner, P2 )
|
: Handle( owner, P2 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -446,7 +446,7 @@ glabels::HandleP2::HandleP2( LabelModelObject* owner )
|
|||||||
///
|
///
|
||||||
/// HandleP2 Destructor
|
/// HandleP2 Destructor
|
||||||
///
|
///
|
||||||
glabels::HandleP2::~HandleP2()
|
HandleP2::~HandleP2()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,7 +454,7 @@ glabels::HandleP2::~HandleP2()
|
|||||||
///
|
///
|
||||||
/// Draw HandleP2
|
/// Draw HandleP2
|
||||||
///
|
///
|
||||||
void glabels::HandleP2::draw( QPainter* painter, double scale ) const
|
void HandleP2::draw( QPainter* painter, double scale ) const
|
||||||
{
|
{
|
||||||
drawAt( painter, scale, mOwner->w(), mOwner->h(), handleFillColor );
|
drawAt( painter, scale, mOwner->w(), mOwner->h(), handleFillColor );
|
||||||
}
|
}
|
||||||
@@ -463,7 +463,7 @@ void glabels::HandleP2::draw( QPainter* painter, double scale ) const
|
|||||||
///
|
///
|
||||||
/// HandleP2 Path
|
/// HandleP2 Path
|
||||||
///
|
///
|
||||||
QPainterPath glabels::HandleP2::path( double scale ) const
|
QPainterPath HandleP2::path( double scale ) const
|
||||||
{
|
{
|
||||||
return pathAt( scale, mOwner->w(), mOwner->h() );
|
return pathAt( scale, mOwner->w(), mOwner->h() );
|
||||||
}
|
}
|
||||||
|
|||||||
+101
-106
@@ -18,8 +18,8 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_Handles_h
|
#ifndef Handles_h
|
||||||
#define glabels_Handles_h
|
#define Handles_h
|
||||||
|
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
@@ -27,30 +27,27 @@
|
|||||||
#include "libglabels/Distance.h"
|
#include "libglabels/Distance.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
class LabelModelObject;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Handle Base Class
|
||||||
|
///
|
||||||
|
class Handle
|
||||||
{
|
{
|
||||||
|
|
||||||
class LabelModelObject;
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Handle Base Class
|
|
||||||
///
|
|
||||||
class Handle
|
|
||||||
{
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Location enumeration
|
// Location enumeration
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
enum Location { NW, N, NE, E, SE, S, SW, W, P1, P2 };
|
enum Location { NW, N, NE, E, SE, S, SW, W, P1, P2 };
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Lifecycle Methods
|
// Lifecycle Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
protected:
|
protected:
|
||||||
Handle( LabelModelObject* owner, Location location );
|
Handle( LabelModelObject* owner, Location location );
|
||||||
public:
|
public:
|
||||||
virtual ~Handle();
|
virtual ~Handle();
|
||||||
|
|
||||||
|
|
||||||
@@ -64,40 +61,40 @@ namespace glabels
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Drawing Methods
|
// Drawing Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
virtual void draw( QPainter* painter, double scale ) const = 0;
|
virtual void draw( QPainter* painter, double scale ) const = 0;
|
||||||
virtual QPainterPath path( double scale ) const = 0;
|
virtual QPainterPath path( double scale ) const = 0;
|
||||||
protected:
|
protected:
|
||||||
void drawAt( QPainter* painter,
|
void drawAt( QPainter* painter,
|
||||||
double scale,
|
double scale,
|
||||||
const libglabels::Distance& x,
|
const glabels::Distance& x,
|
||||||
const libglabels::Distance& y,
|
const glabels::Distance& y,
|
||||||
QColor color ) const;
|
QColor color ) const;
|
||||||
|
|
||||||
QPainterPath pathAt( double scale,
|
QPainterPath pathAt( double scale,
|
||||||
const libglabels::Distance& x,
|
const glabels::Distance& x,
|
||||||
const libglabels::Distance& y ) const;
|
const glabels::Distance& y ) const;
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Protected Data
|
// Protected Data
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
protected:
|
protected:
|
||||||
LabelModelObject* mOwner;
|
LabelModelObject* mOwner;
|
||||||
Location mLocation;
|
Location mLocation;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// HandleNorth Class
|
/// HandleNorth Class
|
||||||
///
|
///
|
||||||
class HandleNorth : public Handle
|
class HandleNorth : public Handle
|
||||||
{
|
{
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Lifecycle Methods
|
// Lifecycle Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
HandleNorth( LabelModelObject* owner );
|
HandleNorth( LabelModelObject* owner );
|
||||||
virtual ~HandleNorth();
|
virtual ~HandleNorth();
|
||||||
|
|
||||||
@@ -105,21 +102,21 @@ namespace glabels
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Drawing Methods
|
// Drawing Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
virtual void draw( QPainter* painter, double scale ) const;
|
virtual void draw( QPainter* painter, double scale ) const;
|
||||||
virtual QPainterPath path( double scale ) const;
|
virtual QPainterPath path( double scale ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// HandleNorthEast Class
|
/// HandleNorthEast Class
|
||||||
///
|
///
|
||||||
class HandleNorthEast : public Handle
|
class HandleNorthEast : public Handle
|
||||||
{
|
{
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Lifecycle Methods
|
// Lifecycle Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
HandleNorthEast( LabelModelObject* owner );
|
HandleNorthEast( LabelModelObject* owner );
|
||||||
virtual ~HandleNorthEast();
|
virtual ~HandleNorthEast();
|
||||||
|
|
||||||
@@ -127,21 +124,21 @@ namespace glabels
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Drawing Methods
|
// Drawing Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
virtual void draw( QPainter* painter, double scale ) const;
|
virtual void draw( QPainter* painter, double scale ) const;
|
||||||
virtual QPainterPath path( double scale ) const;
|
virtual QPainterPath path( double scale ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// HandleEast Class
|
/// HandleEast Class
|
||||||
///
|
///
|
||||||
class HandleEast : public Handle
|
class HandleEast : public Handle
|
||||||
{
|
{
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Lifecycle Methods
|
// Lifecycle Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
HandleEast( LabelModelObject* owner );
|
HandleEast( LabelModelObject* owner );
|
||||||
virtual ~HandleEast();
|
virtual ~HandleEast();
|
||||||
|
|
||||||
@@ -149,21 +146,21 @@ namespace glabels
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Drawing Methods
|
// Drawing Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
virtual void draw( QPainter* painter, double scale ) const;
|
virtual void draw( QPainter* painter, double scale ) const;
|
||||||
virtual QPainterPath path( double scale ) const;
|
virtual QPainterPath path( double scale ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// HandleSouthEast Class
|
/// HandleSouthEast Class
|
||||||
///
|
///
|
||||||
class HandleSouthEast : public Handle
|
class HandleSouthEast : public Handle
|
||||||
{
|
{
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Lifecycle Methods
|
// Lifecycle Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
HandleSouthEast( LabelModelObject* owner );
|
HandleSouthEast( LabelModelObject* owner );
|
||||||
virtual ~HandleSouthEast();
|
virtual ~HandleSouthEast();
|
||||||
|
|
||||||
@@ -171,21 +168,21 @@ namespace glabels
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Drawing Methods
|
// Drawing Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
virtual void draw( QPainter* painter, double scale ) const;
|
virtual void draw( QPainter* painter, double scale ) const;
|
||||||
virtual QPainterPath path( double scale ) const;
|
virtual QPainterPath path( double scale ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// HandleSouth Class
|
/// HandleSouth Class
|
||||||
///
|
///
|
||||||
class HandleSouth : public Handle
|
class HandleSouth : public Handle
|
||||||
{
|
{
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Lifecycle Methods
|
// Lifecycle Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
HandleSouth( LabelModelObject* owner );
|
HandleSouth( LabelModelObject* owner );
|
||||||
virtual ~HandleSouth();
|
virtual ~HandleSouth();
|
||||||
|
|
||||||
@@ -193,21 +190,21 @@ namespace glabels
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Drawing Methods
|
// Drawing Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
virtual void draw( QPainter* painter, double scale ) const;
|
virtual void draw( QPainter* painter, double scale ) const;
|
||||||
virtual QPainterPath path( double scale ) const;
|
virtual QPainterPath path( double scale ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// HandleSouthWest Class
|
/// HandleSouthWest Class
|
||||||
///
|
///
|
||||||
class HandleSouthWest : public Handle
|
class HandleSouthWest : public Handle
|
||||||
{
|
{
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Lifecycle Methods
|
// Lifecycle Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
HandleSouthWest( LabelModelObject* owner );
|
HandleSouthWest( LabelModelObject* owner );
|
||||||
virtual ~HandleSouthWest();
|
virtual ~HandleSouthWest();
|
||||||
|
|
||||||
@@ -215,21 +212,21 @@ namespace glabels
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Drawing Methods
|
// Drawing Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
virtual void draw( QPainter* painter, double scale ) const;
|
virtual void draw( QPainter* painter, double scale ) const;
|
||||||
virtual QPainterPath path( double scale ) const;
|
virtual QPainterPath path( double scale ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// HandleWest Class
|
/// HandleWest Class
|
||||||
///
|
///
|
||||||
class HandleWest : public Handle
|
class HandleWest : public Handle
|
||||||
{
|
{
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Lifecycle Methods
|
// Lifecycle Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
HandleWest( LabelModelObject* owner );
|
HandleWest( LabelModelObject* owner );
|
||||||
virtual ~HandleWest();
|
virtual ~HandleWest();
|
||||||
|
|
||||||
@@ -237,21 +234,21 @@ namespace glabels
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Drawing Methods
|
// Drawing Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
virtual void draw( QPainter* painter, double scale ) const;
|
virtual void draw( QPainter* painter, double scale ) const;
|
||||||
virtual QPainterPath path( double scale ) const;
|
virtual QPainterPath path( double scale ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// HandleNorthWest Class
|
/// HandleNorthWest Class
|
||||||
///
|
///
|
||||||
class HandleNorthWest : public Handle
|
class HandleNorthWest : public Handle
|
||||||
{
|
{
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Lifecycle Methods
|
// Lifecycle Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
HandleNorthWest( LabelModelObject* owner );
|
HandleNorthWest( LabelModelObject* owner );
|
||||||
virtual ~HandleNorthWest();
|
virtual ~HandleNorthWest();
|
||||||
|
|
||||||
@@ -259,21 +256,21 @@ namespace glabels
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Drawing Methods
|
// Drawing Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
virtual void draw( QPainter* painter, double scale ) const;
|
virtual void draw( QPainter* painter, double scale ) const;
|
||||||
virtual QPainterPath path( double scale ) const;
|
virtual QPainterPath path( double scale ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// HandleP1 Class
|
/// HandleP1 Class
|
||||||
///
|
///
|
||||||
class HandleP1 : public Handle
|
class HandleP1 : public Handle
|
||||||
{
|
{
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Lifecycle Methods
|
// Lifecycle Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
HandleP1( LabelModelObject* owner );
|
HandleP1( LabelModelObject* owner );
|
||||||
virtual ~HandleP1();
|
virtual ~HandleP1();
|
||||||
|
|
||||||
@@ -281,21 +278,21 @@ namespace glabels
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Drawing Methods
|
// Drawing Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
virtual void draw( QPainter* painter, double scale ) const;
|
virtual void draw( QPainter* painter, double scale ) const;
|
||||||
virtual QPainterPath path( double scale ) const;
|
virtual QPainterPath path( double scale ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// HandleP2 Class
|
/// HandleP2 Class
|
||||||
///
|
///
|
||||||
class HandleP2 : public Handle
|
class HandleP2 : public Handle
|
||||||
{
|
{
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Lifecycle Methods
|
// Lifecycle Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
HandleP2( LabelModelObject* owner );
|
HandleP2( LabelModelObject* owner );
|
||||||
virtual ~HandleP2();
|
virtual ~HandleP2();
|
||||||
|
|
||||||
@@ -303,12 +300,10 @@ namespace glabels
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Drawing Methods
|
// Drawing Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
virtual void draw( QPainter* painter, double scale ) const;
|
virtual void draw( QPainter* painter, double scale ) const;
|
||||||
virtual QPainterPath path( double scale ) const;
|
virtual QPainterPath path( double scale ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
#endif // Handles_h
|
||||||
|
|
||||||
#endif // glabels_Handles_h
|
|
||||||
|
|||||||
+10
-16
@@ -25,23 +25,20 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Display Help Contents
|
||||||
|
///
|
||||||
|
void Help::displayContents( QWidget *parent )
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Display Help Contents
|
|
||||||
///
|
|
||||||
void Help::displayContents( QWidget *parent )
|
|
||||||
{
|
|
||||||
std::cout << "TODO: Help::displayContents" << std::endl;
|
std::cout << "TODO: Help::displayContents" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Display Help->About Dialog
|
/// Display Help->About Dialog
|
||||||
///
|
///
|
||||||
void Help::displayAbout( QWidget *parent )
|
void Help::displayAbout( QWidget *parent )
|
||||||
{
|
{
|
||||||
QMessageBox aboutBox( QMessageBox::NoIcon,
|
QMessageBox aboutBox( QMessageBox::NoIcon,
|
||||||
QMessageBox::tr("About gLabels"),
|
QMessageBox::tr("About gLabels"),
|
||||||
QMessageBox::tr("<h2>gLabels-qt</h2>"
|
QMessageBox::tr("<h2>gLabels-qt</h2>"
|
||||||
@@ -56,7 +53,4 @@ namespace glabels
|
|||||||
aboutBox.setIconPixmap( QPixmap( ":/images/glabels-logo.png" ) );
|
aboutBox.setIconPixmap( QPixmap( ":/images/glabels-logo.png" ) );
|
||||||
|
|
||||||
aboutBox.exec();
|
aboutBox.exec();
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-10
@@ -18,25 +18,23 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_Help_h
|
#ifndef Help_h
|
||||||
#define glabels_Help_h
|
#define Help_h
|
||||||
|
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Help Actions
|
||||||
|
///
|
||||||
|
namespace Help
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Help Actions
|
|
||||||
///
|
|
||||||
namespace Help
|
|
||||||
{
|
|
||||||
void displayContents( QWidget *parent );
|
void displayContents( QWidget *parent );
|
||||||
void displayAbout( QWidget *parent );
|
void displayAbout( QWidget *parent );
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // glabels_Help_h
|
|
||||||
|
#endif // Help_h
|
||||||
|
|||||||
+8
-11
@@ -18,21 +18,18 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_Icons_h
|
#ifndef Icons_h
|
||||||
#define glabels_Icons_h
|
#define Icons_h
|
||||||
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Glabels Icons
|
||||||
|
///
|
||||||
|
namespace Icons
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Glabels Icons
|
|
||||||
///
|
|
||||||
namespace Icons
|
|
||||||
{
|
|
||||||
|
|
||||||
class Arrow : public QIcon
|
class Arrow : public QIcon
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -467,7 +464,7 @@ namespace glabels
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // glabels_Icons_h
|
|
||||||
|
#endif // Icons_h
|
||||||
|
|||||||
+338
-344
File diff suppressed because it is too large
Load Diff
+92
-96
@@ -18,8 +18,8 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_LabelModel_h
|
#ifndef LabelModel_h
|
||||||
#define glabels_LabelModel_h
|
#define LabelModel_h
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
@@ -29,29 +29,27 @@
|
|||||||
#include "libglabels/Template.h"
|
#include "libglabels/Template.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
// Forward References
|
||||||
|
class LabelModelObject;
|
||||||
|
class Handle;
|
||||||
|
class LabelRegion;
|
||||||
|
class ColorNode;
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////
|
||||||
|
//////////////////////////////////////////////
|
||||||
|
// LabelModel
|
||||||
|
//////////////////////////////////////////////
|
||||||
|
//////////////////////////////////////////////
|
||||||
|
class LabelModel : public QObject
|
||||||
{
|
{
|
||||||
// Forward References
|
|
||||||
class LabelModelObject;
|
|
||||||
class Handle;
|
|
||||||
class LabelRegion;
|
|
||||||
class ColorNode;
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////
|
|
||||||
//////////////////////////////////////////////
|
|
||||||
// LabelModel
|
|
||||||
//////////////////////////////////////////////
|
|
||||||
//////////////////////////////////////////////
|
|
||||||
class LabelModel : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Lifecycle
|
// Lifecycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
LabelModel();
|
LabelModel();
|
||||||
virtual ~LabelModel() {}
|
virtual ~LabelModel() {}
|
||||||
|
|
||||||
@@ -59,7 +57,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Signals
|
// Signals
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
signals:
|
signals:
|
||||||
void changed();
|
void changed();
|
||||||
void nameChanged();
|
void nameChanged();
|
||||||
void sizeChanged();
|
void sizeChanged();
|
||||||
@@ -70,7 +68,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
inline bool isModified() const;
|
inline bool isModified() const;
|
||||||
void clearModified();
|
void clearModified();
|
||||||
|
|
||||||
@@ -81,15 +79,15 @@ namespace glabels
|
|||||||
inline int compressionLevel() const;
|
inline int compressionLevel() const;
|
||||||
inline void setCompressionLevel( int compressionLevel );
|
inline void setCompressionLevel( int compressionLevel );
|
||||||
|
|
||||||
inline const libglabels::Template* tmplate() const;
|
inline const glabels::Template* tmplate() const;
|
||||||
inline const libglabels::Frame* frame() const;
|
inline const glabels::Frame* frame() const;
|
||||||
inline void setTmplate( const libglabels::Template* tmplate );
|
inline void setTmplate( const glabels::Template* tmplate );
|
||||||
|
|
||||||
inline bool rotate() const;
|
inline bool rotate() const;
|
||||||
inline void setRotate( bool rotate );
|
inline void setRotate( bool rotate );
|
||||||
|
|
||||||
inline libglabels::Distance w() const;
|
inline glabels::Distance w() const;
|
||||||
inline libglabels::Distance h() const;
|
inline glabels::Distance h() const;
|
||||||
|
|
||||||
inline const QList<LabelModelObject*>& objectList() const;
|
inline const QList<LabelModelObject*>& objectList() const;
|
||||||
|
|
||||||
@@ -97,23 +95,23 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Manage objects
|
// Manage objects
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void addObject( LabelModelObject* object );
|
void addObject( LabelModelObject* object );
|
||||||
void deleteObject( LabelModelObject* object );
|
void deleteObject( LabelModelObject* object );
|
||||||
|
|
||||||
LabelModelObject* objectAt( double scale,
|
LabelModelObject* objectAt( double scale,
|
||||||
const libglabels::Distance& x,
|
const glabels::Distance& x,
|
||||||
const libglabels::Distance& y ) const;
|
const glabels::Distance& y ) const;
|
||||||
|
|
||||||
Handle* handleAt( double scale,
|
Handle* handleAt( double scale,
|
||||||
const libglabels::Distance& x,
|
const glabels::Distance& x,
|
||||||
const libglabels::Distance& y ) const;
|
const glabels::Distance& y ) const;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Manipulate selection
|
// Manipulate selection
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void selectObject( LabelModelObject* object );
|
void selectObject( LabelModelObject* object );
|
||||||
void unselectObject( LabelModelObject* object );
|
void unselectObject( LabelModelObject* object );
|
||||||
void selectAll();
|
void selectAll();
|
||||||
@@ -126,7 +124,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Get selected objects
|
// Get selected objects
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
QList<LabelModelObject*> getSelection();
|
QList<LabelModelObject*> getSelection();
|
||||||
LabelModelObject* getFirstSelectedObject();
|
LabelModelObject* getFirstSelectedObject();
|
||||||
|
|
||||||
@@ -134,7 +132,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Query selection capabilities
|
// Query selection capabilities
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
bool canSelectionText();
|
bool canSelectionText();
|
||||||
bool canSelectionFill();
|
bool canSelectionFill();
|
||||||
bool canSelectionLineColor();
|
bool canSelectionLineColor();
|
||||||
@@ -144,7 +142,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Operations on selections
|
// Operations on selections
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void deleteSelection();
|
void deleteSelection();
|
||||||
void raiseSelectionToTop();
|
void raiseSelectionToTop();
|
||||||
void lowerSelectionToBottom();
|
void lowerSelectionToBottom();
|
||||||
@@ -161,7 +159,7 @@ namespace glabels
|
|||||||
void alignSelectionVCenter();
|
void alignSelectionVCenter();
|
||||||
void centerSelectionHoriz();
|
void centerSelectionHoriz();
|
||||||
void centerSelectionVert();
|
void centerSelectionVert();
|
||||||
void moveSelection( const libglabels::Distance& dx, const libglabels::Distance& dy );
|
void moveSelection( const glabels::Distance& dx, const glabels::Distance& dy );
|
||||||
void setSelectionFontFamily( const QString& fontFamily );
|
void setSelectionFontFamily( const QString& fontFamily );
|
||||||
void setSelectionFontSize( double fontSize );
|
void setSelectionFontSize( double fontSize );
|
||||||
void setSelectionFontWeight( QFont::Weight fontWeight );
|
void setSelectionFontWeight( QFont::Weight fontWeight );
|
||||||
@@ -170,7 +168,7 @@ namespace glabels
|
|||||||
void setSelectionTextVAlign( Qt::Alignment textVAlign );
|
void setSelectionTextVAlign( Qt::Alignment textVAlign );
|
||||||
void setSelectionTextLineSpacing( double textLineSpacing );
|
void setSelectionTextLineSpacing( double textLineSpacing );
|
||||||
void setSelectionTextColorNode( ColorNode textColorNode );
|
void setSelectionTextColorNode( ColorNode textColorNode );
|
||||||
void setSelectionLineWidth( const libglabels::Distance& lineWidth );
|
void setSelectionLineWidth( const glabels::Distance& lineWidth );
|
||||||
void setSelectionLineColorNode( ColorNode lineColorNode );
|
void setSelectionLineColorNode( ColorNode lineColorNode );
|
||||||
void setSelectionFillColorNode( ColorNode fillColorNode );
|
void setSelectionFillColorNode( ColorNode fillColorNode );
|
||||||
|
|
||||||
@@ -178,14 +176,14 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Drawing operations
|
// Drawing operations
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void draw( QPainter* painter, bool inEditor = true, MergeRecord* record = 0 ) const;
|
void draw( QPainter* painter, bool inEditor = true, MergeRecord* record = 0 ) const;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void onObjectChanged();
|
void onObjectChanged();
|
||||||
void onObjectMoved();
|
void onObjectMoved();
|
||||||
|
|
||||||
@@ -193,73 +191,73 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private data
|
// Private data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
int mUntitledInstance;
|
int mUntitledInstance;
|
||||||
bool mModified;
|
bool mModified;
|
||||||
QString mFileName;
|
QString mFileName;
|
||||||
int mCompressionLevel;
|
int mCompressionLevel;
|
||||||
const libglabels::Template* mTmplate;
|
const glabels::Template* mTmplate;
|
||||||
const libglabels::Frame* mFrame;
|
const glabels::Frame* mFrame;
|
||||||
bool mRotate;
|
bool mRotate;
|
||||||
|
|
||||||
QList<LabelModelObject*> mObjectList;
|
QList<LabelModelObject*> mObjectList;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// INLINE METHODS
|
// INLINE METHODS
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
|
|
||||||
inline bool LabelModel::isModified() const
|
inline bool LabelModel::isModified() const
|
||||||
{
|
{
|
||||||
return mModified;
|
return mModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const QString& LabelModel::fileName() const
|
inline const QString& LabelModel::fileName() const
|
||||||
{
|
{
|
||||||
return mFileName;
|
return mFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void LabelModel::setFileName( const QString &fileName )
|
inline void LabelModel::setFileName( const QString &fileName )
|
||||||
{
|
{
|
||||||
if ( mFileName != fileName )
|
if ( mFileName != fileName )
|
||||||
{
|
{
|
||||||
mFileName = fileName;
|
mFileName = fileName;
|
||||||
emit nameChanged();
|
emit nameChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline int LabelModel::compressionLevel() const
|
inline int LabelModel::compressionLevel() const
|
||||||
{
|
{
|
||||||
return mCompressionLevel;
|
return mCompressionLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void LabelModel::setCompressionLevel( int compressionLevel )
|
inline void LabelModel::setCompressionLevel( int compressionLevel )
|
||||||
{
|
{
|
||||||
mCompressionLevel = compressionLevel;
|
mCompressionLevel = compressionLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const libglabels::Template* LabelModel::tmplate() const
|
inline const glabels::Template* LabelModel::tmplate() const
|
||||||
{
|
{
|
||||||
return mTmplate;
|
return mTmplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const libglabels::Frame* LabelModel::frame() const
|
inline const glabels::Frame* LabelModel::frame() const
|
||||||
{
|
{
|
||||||
return mFrame;
|
return mFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void LabelModel::setTmplate( const libglabels::Template* tmplate )
|
inline void LabelModel::setTmplate( const glabels::Template* tmplate )
|
||||||
{
|
{
|
||||||
if (mTmplate != tmplate)
|
if (mTmplate != tmplate)
|
||||||
{
|
{
|
||||||
mTmplate = tmplate;
|
mTmplate = tmplate;
|
||||||
@@ -268,17 +266,17 @@ namespace glabels
|
|||||||
emit changed();
|
emit changed();
|
||||||
emit sizeChanged();
|
emit sizeChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool LabelModel::rotate() const
|
inline bool LabelModel::rotate() const
|
||||||
{
|
{
|
||||||
return mRotate;
|
return mRotate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void LabelModel::setRotate( bool rotate )
|
inline void LabelModel::setRotate( bool rotate )
|
||||||
{
|
{
|
||||||
if (mRotate != rotate)
|
if (mRotate != rotate)
|
||||||
{
|
{
|
||||||
mRotate = rotate;
|
mRotate = rotate;
|
||||||
@@ -286,27 +284,25 @@ namespace glabels
|
|||||||
emit changed();
|
emit changed();
|
||||||
emit sizeChanged();
|
emit sizeChanged();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline libglabels::Distance LabelModel::w() const
|
|
||||||
{
|
|
||||||
return mRotate ? mFrame->h() : mFrame->w();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline libglabels::Distance LabelModel::h() const
|
|
||||||
{
|
|
||||||
return mRotate ? mFrame->w() : mFrame->h();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline const QList<LabelModelObject*>& LabelModel::objectList() const
|
|
||||||
{
|
|
||||||
return mObjectList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // glabels_LabelModel_h
|
|
||||||
|
inline glabels::Distance LabelModel::w() const
|
||||||
|
{
|
||||||
|
return mRotate ? mFrame->h() : mFrame->w();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline glabels::Distance LabelModel::h() const
|
||||||
|
{
|
||||||
|
return mRotate ? mFrame->w() : mFrame->h();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const QList<LabelModelObject*>& LabelModel::objectList() const
|
||||||
|
{
|
||||||
|
return mObjectList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // LabelModel_h
|
||||||
|
|||||||
@@ -30,30 +30,27 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
LabelModelBoxObject::LabelModelBoxObject( QObject* parent ) : LabelModelShapeObject(parent)
|
||||||
{
|
{
|
||||||
|
}
|
||||||
///
|
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
LabelModelBoxObject::LabelModelBoxObject( QObject* parent ) : LabelModelShapeObject(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Destructor
|
/// Destructor
|
||||||
///
|
///
|
||||||
LabelModelBoxObject::~LabelModelBoxObject()
|
LabelModelBoxObject::~LabelModelBoxObject()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Draw shadow of object
|
/// Draw shadow of object
|
||||||
///
|
///
|
||||||
void LabelModelBoxObject::drawShadow( QPainter* painter, bool inEditor, MergeRecord* record ) const
|
void LabelModelBoxObject::drawShadow( QPainter* painter, bool inEditor, MergeRecord* record ) const
|
||||||
{
|
{
|
||||||
/// TODO expand colors based on record
|
/// TODO expand colors based on record
|
||||||
|
|
||||||
QColor lineColor = mLineColorNode.color();
|
QColor lineColor = mLineColorNode.color();
|
||||||
@@ -93,14 +90,14 @@ namespace glabels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Draw object itself
|
/// Draw object itself
|
||||||
///
|
///
|
||||||
void LabelModelBoxObject::drawObject( QPainter* painter, bool inEditor, MergeRecord* record ) const
|
void LabelModelBoxObject::drawObject( QPainter* painter, bool inEditor, MergeRecord* record ) const
|
||||||
{
|
{
|
||||||
/// TODO expand colors based on record
|
/// TODO expand colors based on record
|
||||||
|
|
||||||
QColor lineColor = mLineColorNode.color();
|
QColor lineColor = mLineColorNode.color();
|
||||||
@@ -110,14 +107,14 @@ namespace glabels
|
|||||||
painter->setBrush( fillColor );
|
painter->setBrush( fillColor );
|
||||||
|
|
||||||
painter->drawRect( QRectF( 0, 0, mW.pt(), mH.pt() ) );
|
painter->drawRect( QRectF( 0, 0, mW.pt(), mH.pt() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Path to test for hover condition
|
/// Path to test for hover condition
|
||||||
///
|
///
|
||||||
QPainterPath LabelModelBoxObject::hoverPath( double scale ) const
|
QPainterPath LabelModelBoxObject::hoverPath( double scale ) const
|
||||||
{
|
{
|
||||||
double s = 1 / scale;
|
double s = 1 / scale;
|
||||||
|
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
@@ -144,6 +141,4 @@ namespace glabels
|
|||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,27 +18,24 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_LabelModelBoxObject_h
|
#ifndef LabelModelBoxObject_h
|
||||||
#define glabels_LabelModelBoxObject_h
|
#define LabelModelBoxObject_h
|
||||||
|
|
||||||
|
|
||||||
#include "LabelModelShapeObject.h"
|
#include "LabelModelShapeObject.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Label Model Box Object
|
||||||
|
///
|
||||||
|
class LabelModelBoxObject : public LabelModelShapeObject
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Label Model Box Object
|
|
||||||
///
|
|
||||||
class LabelModelBoxObject : public LabelModelShapeObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Lifecycle Methods
|
// Lifecycle Methods
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
LabelModelBoxObject( QObject* parent = 0 );
|
LabelModelBoxObject( QObject* parent = 0 );
|
||||||
virtual ~LabelModelBoxObject();
|
virtual ~LabelModelBoxObject();
|
||||||
|
|
||||||
@@ -46,13 +43,12 @@ namespace glabels
|
|||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Drawing operations
|
// Drawing operations
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
protected:
|
protected:
|
||||||
virtual void drawShadow( QPainter* painter, bool inEditor, MergeRecord* record ) const;
|
virtual void drawShadow( QPainter* painter, bool inEditor, MergeRecord* record ) const;
|
||||||
virtual void drawObject( QPainter* painter, bool inEditor, MergeRecord* record ) const;
|
virtual void drawObject( QPainter* painter, bool inEditor, MergeRecord* record ) const;
|
||||||
virtual QPainterPath hoverPath( double scale ) const;
|
virtual QPainterPath hoverPath( double scale ) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_LabelModelBoxObject_h
|
#endif // LabelModelBoxObject_h
|
||||||
|
|||||||
+554
-561
File diff suppressed because it is too large
Load Diff
+54
-57
@@ -18,8 +18,8 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_LabelModelObject_h
|
#ifndef LabelModelObject_h
|
||||||
#define glabels_LabelModelObject_h
|
#define LabelModelObject_h
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
@@ -34,24 +34,22 @@
|
|||||||
#include "Outline.h"
|
#include "Outline.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
// Forward References
|
||||||
|
class LabelRegion;
|
||||||
|
class MergeRecord;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Label Model Object Base Class
|
||||||
|
///
|
||||||
|
class LabelModelObject : public QObject
|
||||||
{
|
{
|
||||||
// Forward References
|
|
||||||
class LabelRegion;
|
|
||||||
class MergeRecord;
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Label Model Object Base Class
|
|
||||||
///
|
|
||||||
class LabelModelObject : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Lifecycle Methods
|
// Lifecycle Methods
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
LabelModelObject( QObject *parent );
|
LabelModelObject( QObject *parent );
|
||||||
virtual ~LabelModelObject();
|
virtual ~LabelModelObject();
|
||||||
|
|
||||||
@@ -59,7 +57,7 @@ namespace glabels
|
|||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Signals
|
// Signals
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
signals:
|
signals:
|
||||||
void moved();
|
void moved();
|
||||||
void changed();
|
void changed();
|
||||||
|
|
||||||
@@ -67,7 +65,7 @@ namespace glabels
|
|||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Common Properties
|
// Common Properties
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// ID Property.
|
// ID Property.
|
||||||
//
|
//
|
||||||
@@ -84,29 +82,29 @@ namespace glabels
|
|||||||
//
|
//
|
||||||
// x0 Property ( x coordinate of origin )
|
// x0 Property ( x coordinate of origin )
|
||||||
//
|
//
|
||||||
libglabels::Distance x0() const;
|
glabels::Distance x0() const;
|
||||||
void setX0( const libglabels::Distance& value );
|
void setX0( const glabels::Distance& value );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// y0 Property ( y coordinate of origin )
|
// y0 Property ( y coordinate of origin )
|
||||||
//
|
//
|
||||||
libglabels::Distance y0() const;
|
glabels::Distance y0() const;
|
||||||
void setY0( const libglabels::Distance& value );
|
void setY0( const glabels::Distance& value );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// w Property ( width of bounding box )
|
// w Property ( width of bounding box )
|
||||||
//
|
//
|
||||||
libglabels::Distance w() const;
|
glabels::Distance w() const;
|
||||||
void setW( const libglabels::Distance& value );
|
void setW( const glabels::Distance& value );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// h Property ( height of bounding box )
|
// h Property ( height of bounding box )
|
||||||
//
|
//
|
||||||
libglabels::Distance h() const;
|
glabels::Distance h() const;
|
||||||
void setH( const libglabels::Distance& value );
|
void setH( const glabels::Distance& value );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -126,15 +124,15 @@ namespace glabels
|
|||||||
//
|
//
|
||||||
// Shadow x Offset Property
|
// Shadow x Offset Property
|
||||||
//
|
//
|
||||||
libglabels::Distance shadowX() const;
|
glabels::Distance shadowX() const;
|
||||||
void setShadowX( const libglabels::Distance& value );
|
void setShadowX( const glabels::Distance& value );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Shadow y Offset Property
|
// Shadow y Offset Property
|
||||||
//
|
//
|
||||||
libglabels::Distance shadowY() const;
|
glabels::Distance shadowY() const;
|
||||||
void setShadowY( const libglabels::Distance& value );
|
void setShadowY( const glabels::Distance& value );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -154,7 +152,7 @@ namespace glabels
|
|||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Text Properties Virtual Interface
|
// Text Properties Virtual Interface
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// Virtual Text Property: fontFamily
|
// Virtual Text Property: fontFamily
|
||||||
//
|
//
|
||||||
@@ -221,7 +219,7 @@ namespace glabels
|
|||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Image Properties Virtual Interface
|
// Image Properties Virtual Interface
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// Virtual Image Property: filenameNode
|
// Virtual Image Property: filenameNode
|
||||||
//
|
//
|
||||||
@@ -232,12 +230,12 @@ namespace glabels
|
|||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Shape Properties Virtual Interface
|
// Shape Properties Virtual Interface
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// Virtual Shape Property: lineWidth
|
// Virtual Shape Property: lineWidth
|
||||||
//
|
//
|
||||||
virtual libglabels::Distance lineWidth() const;
|
virtual glabels::Distance lineWidth() const;
|
||||||
virtual void setLineWidth( const libglabels::Distance& value );
|
virtual void setLineWidth( const glabels::Distance& value );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -257,7 +255,7 @@ namespace glabels
|
|||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Barcode Properties Virtual Interface
|
// Barcode Properties Virtual Interface
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// Virtual Barcode Property: bcDataNode
|
// Virtual Barcode Property: bcDataNode
|
||||||
//
|
//
|
||||||
@@ -303,7 +301,7 @@ namespace glabels
|
|||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Capabilities (Overridden by concrete classes.)
|
// Capabilities (Overridden by concrete classes.)
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
virtual bool canText() const;
|
virtual bool canText() const;
|
||||||
virtual bool canFill() const;
|
virtual bool canFill() const;
|
||||||
virtual bool canLineColor() const;
|
virtual bool canLineColor() const;
|
||||||
@@ -313,29 +311,29 @@ namespace glabels
|
|||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Position and Size methods
|
// Position and Size methods
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void setPosition( const libglabels::Distance& x0, const libglabels::Distance& y0 );
|
void setPosition( const glabels::Distance& x0, const glabels::Distance& y0 );
|
||||||
void setPositionRelative( const libglabels::Distance& dx, const libglabels::Distance& dy );
|
void setPositionRelative( const glabels::Distance& dx, const glabels::Distance& dy );
|
||||||
void setSize( const libglabels::Distance& w, const libglabels::Distance& h );
|
void setSize( const glabels::Distance& w, const glabels::Distance& h );
|
||||||
void setSizeHonorAspect( const libglabels::Distance& w, const libglabels::Distance& h );
|
void setSizeHonorAspect( const glabels::Distance& w, const glabels::Distance& h );
|
||||||
void setWHonorAspect( const libglabels::Distance& w );
|
void setWHonorAspect( const glabels::Distance& w );
|
||||||
void setHHonorAspect( const libglabels::Distance& h );
|
void setHHonorAspect( const glabels::Distance& h );
|
||||||
LabelRegion getExtent();
|
LabelRegion getExtent();
|
||||||
void rotate( double thetaDegs );
|
void rotate( double thetaDegs );
|
||||||
void flipHoriz();
|
void flipHoriz();
|
||||||
void flipVert();
|
void flipVert();
|
||||||
bool isLocatedAt( double scale, const libglabels::Distance& x, const libglabels::Distance& y ) const;
|
bool isLocatedAt( double scale, const glabels::Distance& x, const glabels::Distance& y ) const;
|
||||||
Handle* handleAt( double scale, const libglabels::Distance& x, const libglabels::Distance& y ) const;
|
Handle* handleAt( double scale, const glabels::Distance& x, const glabels::Distance& y ) const;
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Drawing operations
|
// Drawing operations
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void draw( QPainter* painter, bool inEditor, MergeRecord* record ) const;
|
void draw( QPainter* painter, bool inEditor, MergeRecord* record ) const;
|
||||||
void drawSelectionHighlight( QPainter* painter, double scale ) const;
|
void drawSelectionHighlight( QPainter* painter, double scale ) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void drawShadow( QPainter* painter, bool inEditor, MergeRecord* record ) const = 0;
|
virtual void drawShadow( QPainter* painter, bool inEditor, MergeRecord* record ) const = 0;
|
||||||
virtual void drawObject( QPainter* painter, bool inEditor, MergeRecord* record ) const = 0;
|
virtual void drawObject( QPainter* painter, bool inEditor, MergeRecord* record ) const = 0;
|
||||||
virtual QPainterPath hoverPath( double scale ) const = 0;
|
virtual QPainterPath hoverPath( double scale ) const = 0;
|
||||||
@@ -344,17 +342,17 @@ namespace glabels
|
|||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Protected Members
|
// Protected Members
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
protected:
|
protected:
|
||||||
bool mSelectedFlag;
|
bool mSelectedFlag;
|
||||||
|
|
||||||
libglabels::Distance mX0;
|
glabels::Distance mX0;
|
||||||
libglabels::Distance mY0;
|
glabels::Distance mY0;
|
||||||
libglabels::Distance mW;
|
glabels::Distance mW;
|
||||||
libglabels::Distance mH;
|
glabels::Distance mH;
|
||||||
|
|
||||||
bool mShadowState;
|
bool mShadowState;
|
||||||
libglabels::Distance mShadowX;
|
glabels::Distance mShadowX;
|
||||||
libglabels::Distance mShadowY;
|
glabels::Distance mShadowY;
|
||||||
double mShadowOpacity;
|
double mShadowOpacity;
|
||||||
ColorNode mShadowColorNode;
|
ColorNode mShadowColorNode;
|
||||||
|
|
||||||
@@ -365,14 +363,13 @@ namespace glabels
|
|||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Private Members
|
// Private Members
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
private:
|
private:
|
||||||
static int msNextId;
|
static int msNextId;
|
||||||
int mId;
|
int mId;
|
||||||
|
|
||||||
QMatrix mMatrix;
|
QMatrix mMatrix;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_LabelModelObject_h
|
#endif // LabelModelObject_h
|
||||||
|
|||||||
@@ -24,14 +24,11 @@
|
|||||||
#include <QPen>
|
#include <QPen>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
LabelModelShapeObject::LabelModelShapeObject( QObject* parent ) : LabelModelObject(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
LabelModelShapeObject::LabelModelShapeObject( QObject* parent ) : LabelModelObject(parent)
|
|
||||||
{
|
|
||||||
mOutline = new Outline( this );
|
mOutline = new Outline( this );
|
||||||
|
|
||||||
mHandles << new HandleNorthWest( this );
|
mHandles << new HandleNorthWest( this );
|
||||||
@@ -46,14 +43,14 @@ namespace glabels
|
|||||||
mLineWidth = 1.0;
|
mLineWidth = 1.0;
|
||||||
mLineColorNode = ColorNode( QColor( 0, 0, 0 ) );
|
mLineColorNode = ColorNode( QColor( 0, 0, 0 ) );
|
||||||
mFillColorNode = ColorNode( QColor( 0, 255, 0 ) );
|
mFillColorNode = ColorNode( QColor( 0, 255, 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Destructor
|
/// Destructor
|
||||||
///
|
///
|
||||||
LabelModelShapeObject::~LabelModelShapeObject()
|
LabelModelShapeObject::~LabelModelShapeObject()
|
||||||
{
|
{
|
||||||
delete mOutline;
|
delete mOutline;
|
||||||
|
|
||||||
foreach( Handle* handle, mHandles )
|
foreach( Handle* handle, mHandles )
|
||||||
@@ -61,100 +58,97 @@ namespace glabels
|
|||||||
delete handle;
|
delete handle;
|
||||||
}
|
}
|
||||||
mHandles.clear();
|
mHandles.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Line Width Property Getter
|
/// Line Width Property Getter
|
||||||
///
|
///
|
||||||
libglabels::Distance LabelModelShapeObject::lineWidth( void ) const
|
glabels::Distance LabelModelShapeObject::lineWidth( void ) const
|
||||||
{
|
{
|
||||||
return mLineWidth;
|
return mLineWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Line Width Property Setter
|
/// Line Width Property Setter
|
||||||
///
|
///
|
||||||
void LabelModelShapeObject::setLineWidth( const libglabels::Distance& value )
|
void LabelModelShapeObject::setLineWidth( const glabels::Distance& value )
|
||||||
{
|
{
|
||||||
if ( mLineWidth != value )
|
if ( mLineWidth != value )
|
||||||
{
|
{
|
||||||
mLineWidth = value;
|
mLineWidth = value;
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Line Color Node Property Getter
|
/// Line Color Node Property Getter
|
||||||
///
|
///
|
||||||
ColorNode LabelModelShapeObject::lineColorNode( void ) const
|
ColorNode LabelModelShapeObject::lineColorNode( void ) const
|
||||||
{
|
{
|
||||||
return mLineColorNode;
|
return mLineColorNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Line Color Node Property Setter
|
/// Line Color Node Property Setter
|
||||||
///
|
///
|
||||||
void LabelModelShapeObject::setLineColorNode( const ColorNode& value )
|
void LabelModelShapeObject::setLineColorNode( const ColorNode& value )
|
||||||
{
|
{
|
||||||
if ( mLineColorNode != value )
|
if ( mLineColorNode != value )
|
||||||
{
|
{
|
||||||
mLineColorNode = value;
|
mLineColorNode = value;
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Fill Color Node Property Getter
|
/// Fill Color Node Property Getter
|
||||||
///
|
///
|
||||||
ColorNode LabelModelShapeObject::fillColorNode( void ) const
|
ColorNode LabelModelShapeObject::fillColorNode( void ) const
|
||||||
{
|
{
|
||||||
return mFillColorNode;
|
return mFillColorNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Fill Color Node Property Setter
|
/// Fill Color Node Property Setter
|
||||||
///
|
///
|
||||||
void LabelModelShapeObject::setFillColorNode( const ColorNode& value )
|
void LabelModelShapeObject::setFillColorNode( const ColorNode& value )
|
||||||
{
|
{
|
||||||
if ( mFillColorNode != value )
|
if ( mFillColorNode != value )
|
||||||
{
|
{
|
||||||
mFillColorNode = value;
|
mFillColorNode = value;
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Can Fill Capability Implementation
|
/// Can Fill Capability Implementation
|
||||||
///
|
///
|
||||||
bool LabelModelShapeObject::canFill()
|
bool LabelModelShapeObject::canFill()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Can Line Color Capability Implementation
|
/// Can Line Color Capability Implementation
|
||||||
///
|
///
|
||||||
bool LabelModelShapeObject::canLineColor()
|
bool LabelModelShapeObject::canLineColor()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Can Line Width Capability Implementation
|
/// Can Line Width Capability Implementation
|
||||||
///
|
///
|
||||||
bool LabelModelShapeObject::canLineWidth()
|
bool LabelModelShapeObject::canLineWidth()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,40 +18,37 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_LabelModelShapeObject_h
|
#ifndef LabelModelShapeObject_h
|
||||||
#define glabels_LabelModelShapeObject_h
|
#define LabelModelShapeObject_h
|
||||||
|
|
||||||
#include "LabelModelObject.h"
|
#include "LabelModelObject.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Label Model Shape Object (Box or Ellipse)
|
||||||
|
///
|
||||||
|
class LabelModelShapeObject : public LabelModelObject
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Label Model Shape Object (Box or Ellipse)
|
|
||||||
///
|
|
||||||
class LabelModelShapeObject : public LabelModelObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Lifecycle Methods
|
// Lifecycle Methods
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
protected:
|
protected:
|
||||||
LabelModelShapeObject( QObject* parent = 0 );
|
LabelModelShapeObject( QObject* parent = 0 );
|
||||||
public:
|
public:
|
||||||
virtual ~LabelModelShapeObject();
|
virtual ~LabelModelShapeObject();
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Property Implementations
|
// Property Implementations
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// Shape Property: lineWidth
|
// Shape Property: lineWidth
|
||||||
//
|
//
|
||||||
virtual libglabels::Distance lineWidth( void ) const;
|
virtual glabels::Distance lineWidth( void ) const;
|
||||||
virtual void setLineWidth( const libglabels::Distance& value );
|
virtual void setLineWidth( const glabels::Distance& value );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -71,7 +68,7 @@ namespace glabels
|
|||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Capability Implementations
|
// Capability Implementations
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
virtual bool canFill();
|
virtual bool canFill();
|
||||||
virtual bool canLineColor();
|
virtual bool canLineColor();
|
||||||
virtual bool canLineWidth();
|
virtual bool canLineWidth();
|
||||||
@@ -80,13 +77,12 @@ namespace glabels
|
|||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Private Members
|
// Private Members
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
protected:
|
protected:
|
||||||
libglabels::Distance mLineWidth;
|
glabels::Distance mLineWidth;
|
||||||
ColorNode mLineColorNode;
|
ColorNode mLineColorNode;
|
||||||
ColorNode mFillColorNode;
|
ColorNode mFillColorNode;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_LabelModelShapeObject_h
|
#endif // LabelModelShapeObject_h
|
||||||
|
|||||||
@@ -24,11 +24,8 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
QRectF LabelRegion::rect() const
|
||||||
{
|
{
|
||||||
|
|
||||||
QRectF LabelRegion::rect() const
|
|
||||||
{
|
|
||||||
using std::min;
|
using std::min;
|
||||||
using std::fabs;
|
using std::fabs;
|
||||||
|
|
||||||
@@ -40,6 +37,4 @@ namespace glabels
|
|||||||
r.setHeight( fabs( mY2 - mY1 ).pt() );
|
r.setHeight( fabs( mY2 - mY1 ).pt() );
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+71
-75
@@ -18,123 +18,119 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_LabelRegion_h
|
#ifndef LabelRegion_h
|
||||||
#define glabels_LabelRegion_h
|
#define LabelRegion_h
|
||||||
|
|
||||||
#include <QRectF>
|
#include <QRectF>
|
||||||
#include "libglabels/Distance.h"
|
#include "libglabels/Distance.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Label Region Type
|
||||||
|
///
|
||||||
|
struct LabelRegion
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Label Region Type
|
|
||||||
///
|
|
||||||
struct LabelRegion
|
|
||||||
{
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// X1 Property
|
// X1 Property
|
||||||
//
|
//
|
||||||
libglabels::Distance x1( void ) const;
|
glabels::Distance x1( void ) const;
|
||||||
void setX1( const libglabels::Distance& value );
|
void setX1( const glabels::Distance& value );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Y1 Property
|
// Y1 Property
|
||||||
//
|
//
|
||||||
libglabels::Distance y1( void ) const;
|
glabels::Distance y1( void ) const;
|
||||||
void setY1( const libglabels::Distance& value );
|
void setY1( const glabels::Distance& value );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// X2 Property
|
// X2 Property
|
||||||
//
|
//
|
||||||
libglabels::Distance x2( void ) const;
|
glabels::Distance x2( void ) const;
|
||||||
void setX2( const libglabels::Distance& value );
|
void setX2( const glabels::Distance& value );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Y2 Property
|
// Y2 Property
|
||||||
//
|
//
|
||||||
libglabels::Distance y2( void ) const;
|
glabels::Distance y2( void ) const;
|
||||||
void setY2( const libglabels::Distance& value );
|
void setY2( const glabels::Distance& value );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Methods
|
// Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
QRectF rect() const;
|
QRectF rect() const;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
libglabels::Distance mX1;
|
glabels::Distance mX1;
|
||||||
libglabels::Distance mY1;
|
glabels::Distance mY1;
|
||||||
libglabels::Distance mX2;
|
glabels::Distance mX2;
|
||||||
libglabels::Distance mY2;
|
glabels::Distance mY2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// INLINE METHODS
|
// INLINE METHODS
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
inline libglabels::Distance LabelRegion::x1( void ) const
|
inline glabels::Distance LabelRegion::x1( void ) const
|
||||||
{
|
{
|
||||||
return mX1;
|
return mX1;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void LabelRegion::setX1( const libglabels::Distance& value )
|
|
||||||
{
|
|
||||||
mX1 = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline libglabels::Distance LabelRegion::y1( void ) const
|
|
||||||
{
|
|
||||||
return mY1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void LabelRegion::setY1( const libglabels::Distance& value )
|
|
||||||
{
|
|
||||||
mY1 = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline libglabels::Distance LabelRegion::x2( void ) const
|
|
||||||
{
|
|
||||||
return mX2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void LabelRegion::setX2( const libglabels::Distance& value )
|
|
||||||
{
|
|
||||||
mX2 = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline libglabels::Distance LabelRegion::y2( void ) const
|
|
||||||
{
|
|
||||||
return mY2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void LabelRegion::setY2( const libglabels::Distance& value )
|
|
||||||
{
|
|
||||||
mY2 = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // glabels_LabelRegion_h
|
|
||||||
|
inline void LabelRegion::setX1( const glabels::Distance& value )
|
||||||
|
{
|
||||||
|
mX1 = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline glabels::Distance LabelRegion::y1( void ) const
|
||||||
|
{
|
||||||
|
return mY1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void LabelRegion::setY1( const glabels::Distance& value )
|
||||||
|
{
|
||||||
|
mY1 = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline glabels::Distance LabelRegion::x2( void ) const
|
||||||
|
{
|
||||||
|
return mX2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void LabelRegion::setX2( const glabels::Distance& value )
|
||||||
|
{
|
||||||
|
mX2 = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline glabels::Distance LabelRegion::y2( void ) const
|
||||||
|
{
|
||||||
|
return mY2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void LabelRegion::setY2( const glabels::Distance& value )
|
||||||
|
{
|
||||||
|
mY2 = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // LabelRegion_h
|
||||||
|
|||||||
+497
-504
File diff suppressed because it is too large
Load Diff
+23
-26
@@ -18,8 +18,8 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_MainWindow_h
|
#ifndef MainWindow_h
|
||||||
#define glabels_MainWindow_h
|
#define MainWindow_h
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
|
||||||
@@ -32,29 +32,27 @@ class QLabel;
|
|||||||
class QScrollArea;
|
class QScrollArea;
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
// Forward References
|
||||||
|
class LabelModel;
|
||||||
|
class PropertiesView;
|
||||||
|
class View;
|
||||||
|
class ObjectEditor;
|
||||||
|
class MergePropertyEditor;
|
||||||
|
class PrintView;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// MainWindow Widget
|
||||||
|
///
|
||||||
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
// Forward References
|
|
||||||
class LabelModel;
|
|
||||||
class PropertiesView;
|
|
||||||
class View;
|
|
||||||
class ObjectEditor;
|
|
||||||
class MergePropertyEditor;
|
|
||||||
class PrintView;
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// MainWindow Widget
|
|
||||||
///
|
|
||||||
class MainWindow : public QMainWindow
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Lifecycle
|
// Lifecycle
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
MainWindow();
|
MainWindow();
|
||||||
virtual ~MainWindow();
|
virtual ~MainWindow();
|
||||||
|
|
||||||
@@ -62,7 +60,7 @@ namespace glabels
|
|||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Public Methods
|
// Public Methods
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
LabelModel* model() const;
|
LabelModel* model() const;
|
||||||
void setModel( LabelModel* label );
|
void setModel( LabelModel* label );
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
@@ -73,14 +71,14 @@ namespace glabels
|
|||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Events
|
// Events
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
protected:
|
protected:
|
||||||
void closeEvent( QCloseEvent *event );
|
void closeEvent( QCloseEvent *event );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void fileNew();
|
void fileNew();
|
||||||
void fileOpen();
|
void fileOpen();
|
||||||
void fileSave();
|
void fileSave();
|
||||||
@@ -149,7 +147,7 @@ namespace glabels
|
|||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Internal Private Methods
|
// Internal Private Methods
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
private:
|
private:
|
||||||
void createActions();
|
void createActions();
|
||||||
void createMenus();
|
void createMenus();
|
||||||
void createToolBars();
|
void createToolBars();
|
||||||
@@ -175,7 +173,7 @@ namespace glabels
|
|||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
private:
|
private:
|
||||||
static QList<MainWindow*> smWindowList;
|
static QList<MainWindow*> smWindowList;
|
||||||
|
|
||||||
QMenu* fileMenu;
|
QMenu* fileMenu;
|
||||||
@@ -269,8 +267,7 @@ namespace glabels
|
|||||||
QAction* contextCopyAction;
|
QAction* contextCopyAction;
|
||||||
QAction* contextPasteAction;
|
QAction* contextPasteAction;
|
||||||
QAction* contextDeleteAction;
|
QAction* contextDeleteAction;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_MainWindow_h
|
#endif // MainWindow_h
|
||||||
|
|||||||
+47
-54
@@ -21,31 +21,28 @@
|
|||||||
#include "Merge.h"
|
#include "Merge.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Constructor
|
||||||
|
///
|
||||||
///
|
Merge::Merge( QString id, QString name, SourceType type )
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
Merge::Merge( QString id, QString name, SourceType type )
|
|
||||||
: mId(id), mName(name), mType(type)
|
: mId(id), mName(name), mType(type)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Destructor
|
/// Destructor
|
||||||
///
|
///
|
||||||
Merge::~Merge()
|
Merge::~Merge()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Set source
|
/// Set source
|
||||||
///
|
///
|
||||||
void Merge::setSource( const QString& source )
|
void Merge::setSource( const QString& source )
|
||||||
{
|
{
|
||||||
mSource = source;
|
mSource = source;
|
||||||
|
|
||||||
// Clear out any old records
|
// Clear out any old records
|
||||||
@@ -63,60 +60,60 @@ namespace glabels
|
|||||||
close();
|
close();
|
||||||
|
|
||||||
emit sourceChanged();
|
emit sourceChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Select matching record
|
/// Select matching record
|
||||||
///
|
///
|
||||||
void Merge::select( MergeRecord* record )
|
void Merge::select( MergeRecord* record )
|
||||||
{
|
{
|
||||||
record->setSelected( true );
|
record->setSelected( true );
|
||||||
emit selectionChanged();
|
emit selectionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Unselect matching record
|
/// Unselect matching record
|
||||||
///
|
///
|
||||||
void Merge::unselect( MergeRecord* record )
|
void Merge::unselect( MergeRecord* record )
|
||||||
{
|
{
|
||||||
record->setSelected( false );
|
record->setSelected( false );
|
||||||
emit selectionChanged();
|
emit selectionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Select all records
|
/// Select all records
|
||||||
///
|
///
|
||||||
void Merge::selectAll()
|
void Merge::selectAll()
|
||||||
{
|
{
|
||||||
foreach ( MergeRecord* record, mRecordList )
|
foreach ( MergeRecord* record, mRecordList )
|
||||||
{
|
{
|
||||||
record->setSelected( true );
|
record->setSelected( true );
|
||||||
}
|
}
|
||||||
emit selectionChanged();
|
emit selectionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Unselect all records
|
/// Unselect all records
|
||||||
///
|
///
|
||||||
void Merge::unselectAll()
|
void Merge::unselectAll()
|
||||||
{
|
{
|
||||||
foreach ( MergeRecord* record, mRecordList )
|
foreach ( MergeRecord* record, mRecordList )
|
||||||
{
|
{
|
||||||
record->setSelected( false );
|
record->setSelected( false );
|
||||||
}
|
}
|
||||||
emit selectionChanged();
|
emit selectionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Return list of selected records
|
/// Return list of selected records
|
||||||
///
|
///
|
||||||
const QList<MergeRecord*> Merge::selectedRecords() const
|
const QList<MergeRecord*> Merge::selectedRecords() const
|
||||||
{
|
{
|
||||||
QList<MergeRecord*> list;
|
QList<MergeRecord*> list;
|
||||||
|
|
||||||
foreach ( MergeRecord* record, mRecordList )
|
foreach ( MergeRecord* record, mRecordList )
|
||||||
@@ -128,8 +125,4 @@ namespace glabels
|
|||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+45
-49
@@ -18,8 +18,8 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_Merge_h
|
#ifndef Merge_h
|
||||||
#define glabels_Merge_h
|
#define Merge_h
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@@ -28,14 +28,11 @@
|
|||||||
#include "MergeRecord.h"
|
#include "MergeRecord.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Merge Record Structure
|
||||||
|
///
|
||||||
|
struct Merge : QObject
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Merge Record Structure
|
|
||||||
///
|
|
||||||
struct Merge : QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +45,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
protected:
|
protected:
|
||||||
Merge( QString id, QString name, SourceType type );
|
Merge( QString id, QString name, SourceType type );
|
||||||
virtual ~Merge();
|
virtual ~Merge();
|
||||||
|
|
||||||
@@ -56,7 +53,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
inline QString id() const;
|
inline QString id() const;
|
||||||
inline QString name() const;
|
inline QString name() const;
|
||||||
inline SourceType type() const;
|
inline SourceType type() const;
|
||||||
@@ -69,7 +66,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Selection methods
|
// Selection methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void select( MergeRecord* record );
|
void select( MergeRecord* record );
|
||||||
void unselect( MergeRecord* record );
|
void unselect( MergeRecord* record );
|
||||||
void selectAll();
|
void selectAll();
|
||||||
@@ -80,10 +77,10 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Virtual methods
|
// Virtual methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
virtual QList<QString> keyList() const = 0;
|
virtual QList<QString> keyList() const = 0;
|
||||||
virtual QString primaryKey() const = 0;
|
virtual QString primaryKey() const = 0;
|
||||||
protected:
|
protected:
|
||||||
virtual void open() = 0;
|
virtual void open() = 0;
|
||||||
virtual void close() = 0;
|
virtual void close() = 0;
|
||||||
virtual MergeRecord* readNextRecord() = 0;
|
virtual MergeRecord* readNextRecord() = 0;
|
||||||
@@ -92,7 +89,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Signals
|
// Signals
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
signals:
|
signals:
|
||||||
void sourceChanged();
|
void sourceChanged();
|
||||||
void selectionChanged();
|
void selectionChanged();
|
||||||
|
|
||||||
@@ -100,7 +97,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private data
|
// Private data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
QString mId;
|
QString mId;
|
||||||
QString mName;
|
QString mName;
|
||||||
SourceType mType;
|
SourceType mType;
|
||||||
@@ -108,41 +105,40 @@ namespace glabels
|
|||||||
QString mSource;
|
QString mSource;
|
||||||
bool mSelected;
|
bool mSelected;
|
||||||
QList<MergeRecord*> mRecordList;
|
QList<MergeRecord*> mRecordList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// INLINE METHODS
|
// INLINE METHODS
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
QString Merge::id() const
|
QString Merge::id() const
|
||||||
{
|
{
|
||||||
return mId;
|
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 // glabels_Merge_h
|
|
||||||
|
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
|
||||||
|
|||||||
+34
-38
@@ -18,25 +18,22 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_MergeField_h
|
#ifndef MergeField_h
|
||||||
#define glabels_MergeField_h
|
#define MergeField_h
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Merge Field Structure
|
||||||
|
///
|
||||||
|
struct MergeField
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Merge Field Structure
|
|
||||||
///
|
|
||||||
struct MergeField
|
|
||||||
{
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// Key Property
|
// Key Property
|
||||||
//
|
//
|
||||||
@@ -54,39 +51,38 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private data
|
// Private data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
QString mKey;
|
QString mKey;
|
||||||
QString mValue;
|
QString mValue;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// INLINE METHODS
|
// INLINE METHODS
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
const QString MergeField::key( void ) const
|
const QString MergeField::key( void ) const
|
||||||
{
|
{
|
||||||
return mKey;
|
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 // glabels_MergeField_h
|
|
||||||
|
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
|
||||||
|
|||||||
@@ -24,43 +24,38 @@
|
|||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Constructor
|
||||||
|
///
|
||||||
///
|
MergePropertyEditor::MergePropertyEditor( QWidget *parent )
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
MergePropertyEditor::MergePropertyEditor( QWidget *parent )
|
|
||||||
: QWidget(parent), mModel(0)
|
: QWidget(parent), mModel(0)
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Destructor
|
/// Destructor
|
||||||
///
|
///
|
||||||
MergePropertyEditor::~MergePropertyEditor()
|
MergePropertyEditor::~MergePropertyEditor()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Set Model
|
/// Set Model
|
||||||
///
|
///
|
||||||
void MergePropertyEditor::setModel( LabelModel* model )
|
void MergePropertyEditor::setModel( LabelModel* model )
|
||||||
{
|
{
|
||||||
mModel = model;
|
mModel = model;
|
||||||
|
|
||||||
connect( mModel, SIGNAL(changed()), this, SLOT(onLabelChanged()) );
|
connect( mModel, SIGNAL(changed()), this, SLOT(onLabelChanged()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Label changed handler
|
/// Label changed handler
|
||||||
///
|
///
|
||||||
void MergePropertyEditor::onLabelChanged()
|
void MergePropertyEditor::onLabelChanged()
|
||||||
{
|
{
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,29 +18,27 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_MergePropertyEditor_h
|
#ifndef MergePropertyEditor_h
|
||||||
#define glabels_MergePropertyEditor_h
|
#define MergePropertyEditor_h
|
||||||
|
|
||||||
#include "ui_MergePropertyEditor.h"
|
#include "ui_MergePropertyEditor.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
class LabelModel; // Forward reference
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Merge Property Editor Widget
|
||||||
|
///
|
||||||
|
class MergePropertyEditor : public QWidget, public Ui_MergePropertyEditor
|
||||||
{
|
{
|
||||||
class LabelModel; // Forward reference
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Merge Property Editor Widget
|
|
||||||
///
|
|
||||||
class MergePropertyEditor : public QWidget, public Ui_MergePropertyEditor
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
MergePropertyEditor( QWidget *parent = 0 );
|
MergePropertyEditor( QWidget *parent = 0 );
|
||||||
~MergePropertyEditor();
|
~MergePropertyEditor();
|
||||||
|
|
||||||
@@ -54,18 +52,17 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void onLabelChanged();
|
void onLabelChanged();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
LabelModel* mModel;
|
LabelModel* mModel;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_MergePropertyEditor_h
|
#endif // MergePropertyEditor_h
|
||||||
|
|||||||
+4
-11
@@ -21,16 +21,9 @@
|
|||||||
#include "MergeRecord.h"
|
#include "MergeRecord.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
MergeRecord::MergeRecord() : mSelected( false )
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
MergeRecord::MergeRecord() : mSelected( false )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+41
-45
@@ -18,8 +18,8 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_MergeRecord_h
|
#ifndef MergeRecord_h
|
||||||
#define glabels_MergeRecord_h
|
#define MergeRecord_h
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
@@ -27,25 +27,22 @@
|
|||||||
#include "MergeField.h"
|
#include "MergeField.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Merge Record Structure
|
||||||
|
///
|
||||||
|
struct MergeRecord
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Merge Record Structure
|
|
||||||
///
|
|
||||||
struct MergeRecord
|
|
||||||
{
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
MergeRecord();
|
MergeRecord();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
inline bool isSelected() const;
|
inline bool isSelected() const;
|
||||||
inline void setSelected( bool value );
|
inline void setSelected( bool value );
|
||||||
inline bool empty() const;
|
inline bool empty() const;
|
||||||
@@ -57,44 +54,43 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private data
|
// Private data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
bool mSelected;
|
bool mSelected;
|
||||||
QList<MergeField> mFieldList;
|
QList<MergeField> mFieldList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// INLINE METHODS
|
// INLINE METHODS
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
bool MergeRecord::isSelected() const
|
bool MergeRecord::isSelected() const
|
||||||
{
|
{
|
||||||
return mSelected;
|
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 // glabels_MergeRecord_h
|
|
||||||
|
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
|
||||||
|
|||||||
+62
-67
@@ -29,15 +29,12 @@
|
|||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Constructor
|
||||||
|
///
|
||||||
///
|
ObjectEditor::ObjectEditor( QWidget *parent )
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
ObjectEditor::ObjectEditor( QWidget *parent )
|
|
||||||
: mModel(0), mObject(0), mBlocked(false)
|
: mModel(0), mObject(0), mBlocked(false)
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
|
||||||
lineColorButton->init( "No line", QColor(0,0,0,0), QColor(0,0,0,255) );
|
lineColorButton->init( "No line", QColor(0,0,0,0), QColor(0,0,0,255) );
|
||||||
@@ -46,11 +43,11 @@ namespace glabels
|
|||||||
|
|
||||||
setEnabled( false );
|
setEnabled( false );
|
||||||
hidePages();
|
hidePages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::setModel( LabelModel* model )
|
void ObjectEditor::setModel( LabelModel* model )
|
||||||
{
|
{
|
||||||
mModel = model;
|
mModel = model;
|
||||||
|
|
||||||
connect( mModel, SIGNAL(sizeChanged()), this, SLOT(onLabelSizeChanged()) );
|
connect( mModel, SIGNAL(sizeChanged()), this, SLOT(onLabelSizeChanged()) );
|
||||||
@@ -58,22 +55,22 @@ namespace glabels
|
|||||||
|
|
||||||
onLabelSizeChanged();
|
onLabelSizeChanged();
|
||||||
onSelectionChanged();
|
onSelectionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::hidePages()
|
void ObjectEditor::hidePages()
|
||||||
{
|
{
|
||||||
notebook->removeTab( notebook->indexOf(textPage) );
|
notebook->removeTab( notebook->indexOf(textPage) );
|
||||||
notebook->removeTab( notebook->indexOf(barcodePage) );
|
notebook->removeTab( notebook->indexOf(barcodePage) );
|
||||||
notebook->removeTab( notebook->indexOf(imagePage) );
|
notebook->removeTab( notebook->indexOf(imagePage) );
|
||||||
notebook->removeTab( notebook->indexOf(lineFillPage) );
|
notebook->removeTab( notebook->indexOf(lineFillPage) );
|
||||||
notebook->removeTab( notebook->indexOf(posSizePage) );
|
notebook->removeTab( notebook->indexOf(posSizePage) );
|
||||||
notebook->removeTab( notebook->indexOf(shadowPage) );
|
notebook->removeTab( notebook->indexOf(shadowPage) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::loadLineFillPage()
|
void ObjectEditor::loadLineFillPage()
|
||||||
{
|
{
|
||||||
if ( mObject )
|
if ( mObject )
|
||||||
{
|
{
|
||||||
mBlocked = true;
|
mBlocked = true;
|
||||||
@@ -84,11 +81,11 @@ namespace glabels
|
|||||||
|
|
||||||
mBlocked = false;
|
mBlocked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::loadPositionPage()
|
void ObjectEditor::loadPositionPage()
|
||||||
{
|
{
|
||||||
if ( mObject )
|
if ( mObject )
|
||||||
{
|
{
|
||||||
mBlocked = true;
|
mBlocked = true;
|
||||||
@@ -98,11 +95,11 @@ namespace glabels
|
|||||||
|
|
||||||
mBlocked = false;
|
mBlocked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::loadRectSizePage()
|
void ObjectEditor::loadRectSizePage()
|
||||||
{
|
{
|
||||||
if ( mObject )
|
if ( mObject )
|
||||||
{
|
{
|
||||||
mBlocked = true;
|
mBlocked = true;
|
||||||
@@ -112,11 +109,11 @@ namespace glabels
|
|||||||
|
|
||||||
mBlocked = false;
|
mBlocked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::loadShadowPage()
|
void ObjectEditor::loadShadowPage()
|
||||||
{
|
{
|
||||||
if ( mObject )
|
if ( mObject )
|
||||||
{
|
{
|
||||||
mBlocked = true;
|
mBlocked = true;
|
||||||
@@ -129,16 +126,16 @@ namespace glabels
|
|||||||
|
|
||||||
mBlocked = false;
|
mBlocked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::onLabelSizeChanged()
|
void ObjectEditor::onLabelSizeChanged()
|
||||||
{
|
{
|
||||||
if ( mModel )
|
if ( mModel )
|
||||||
{
|
{
|
||||||
mBlocked = true;
|
mBlocked = true;
|
||||||
|
|
||||||
libglabels::Distance whMax = std::max( mModel->w(), mModel->h() );
|
glabels::Distance whMax = std::max( mModel->w(), mModel->h() );
|
||||||
|
|
||||||
posXSpin->setRange( -whMax.in(), 2*whMax.in() );
|
posXSpin->setRange( -whMax.in(), 2*whMax.in() );
|
||||||
posYSpin->setRange( -whMax.in(), 2*whMax.in() );
|
posYSpin->setRange( -whMax.in(), 2*whMax.in() );
|
||||||
@@ -147,11 +144,11 @@ namespace glabels
|
|||||||
|
|
||||||
mBlocked = false;
|
mBlocked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::onSelectionChanged()
|
void ObjectEditor::onSelectionChanged()
|
||||||
{
|
{
|
||||||
if ( mObject )
|
if ( mObject )
|
||||||
{
|
{
|
||||||
disconnect( mObject, 0, this, 0 );
|
disconnect( mObject, 0, this, 0 );
|
||||||
@@ -200,52 +197,52 @@ namespace glabels
|
|||||||
titleLabel->setText( "Object properties" );
|
titleLabel->setText( "Object properties" );
|
||||||
setEnabled( false );
|
setEnabled( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::onObjectChanged()
|
void ObjectEditor::onObjectChanged()
|
||||||
{
|
{
|
||||||
if ( !mBlocked )
|
if ( !mBlocked )
|
||||||
{
|
{
|
||||||
loadLineFillPage();
|
loadLineFillPage();
|
||||||
loadRectSizePage();
|
loadRectSizePage();
|
||||||
loadShadowPage();
|
loadShadowPage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::onObjectMoved()
|
void ObjectEditor::onObjectMoved()
|
||||||
{
|
{
|
||||||
if ( !mBlocked )
|
if ( !mBlocked )
|
||||||
{
|
{
|
||||||
loadPositionPage();
|
loadPositionPage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::onObjectDestroyed()
|
void ObjectEditor::onObjectDestroyed()
|
||||||
{
|
{
|
||||||
disconnect( mObject, 0, this, 0 );
|
disconnect( mObject, 0, this, 0 );
|
||||||
mObject = 0;
|
mObject = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::onLineControlsChanged()
|
void ObjectEditor::onLineControlsChanged()
|
||||||
{
|
{
|
||||||
if ( !mBlocked )
|
if ( !mBlocked )
|
||||||
{
|
{
|
||||||
mBlocked = true;
|
mBlocked = true;
|
||||||
|
|
||||||
mObject->setLineWidth( libglabels::Distance::pt(lineWidthSpin->value()) );
|
mObject->setLineWidth( glabels::Distance::pt(lineWidthSpin->value()) );
|
||||||
mObject->setLineColorNode( lineColorButton->colorNode() );
|
mObject->setLineColorNode( lineColorButton->colorNode() );
|
||||||
|
|
||||||
mBlocked = false;
|
mBlocked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::onFillControlsChanged()
|
void ObjectEditor::onFillControlsChanged()
|
||||||
{
|
{
|
||||||
if ( !mBlocked )
|
if ( !mBlocked )
|
||||||
{
|
{
|
||||||
mBlocked = true;
|
mBlocked = true;
|
||||||
@@ -254,11 +251,11 @@ namespace glabels
|
|||||||
|
|
||||||
mBlocked = false;
|
mBlocked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::onPositionControlsChanged()
|
void ObjectEditor::onPositionControlsChanged()
|
||||||
{
|
{
|
||||||
if ( !mBlocked )
|
if ( !mBlocked )
|
||||||
{
|
{
|
||||||
mBlocked = true;
|
mBlocked = true;
|
||||||
@@ -267,17 +264,17 @@ namespace glabels
|
|||||||
|
|
||||||
mBlocked = false;
|
mBlocked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::onRectSizeControlsChanged()
|
void ObjectEditor::onRectSizeControlsChanged()
|
||||||
{
|
{
|
||||||
if ( !mBlocked )
|
if ( !mBlocked )
|
||||||
{
|
{
|
||||||
mBlocked = true;
|
mBlocked = true;
|
||||||
|
|
||||||
libglabels::Distance spinW = libglabels::Distance::in(sizeWSpin->value());
|
glabels::Distance spinW = glabels::Distance::in(sizeWSpin->value());
|
||||||
libglabels::Distance spinH = libglabels::Distance::in(sizeHSpin->value());
|
glabels::Distance spinH = glabels::Distance::in(sizeHSpin->value());
|
||||||
|
|
||||||
if ( sizeAspectCheck->isChecked() )
|
if ( sizeAspectCheck->isChecked() )
|
||||||
{
|
{
|
||||||
@@ -299,28 +296,28 @@ namespace glabels
|
|||||||
|
|
||||||
mBlocked = false;
|
mBlocked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::onShadowControlsChanged()
|
void ObjectEditor::onShadowControlsChanged()
|
||||||
{
|
{
|
||||||
if ( !mBlocked )
|
if ( !mBlocked )
|
||||||
{
|
{
|
||||||
mBlocked = true;
|
mBlocked = true;
|
||||||
|
|
||||||
mObject->setShadow( shadowEnableCheck->isChecked() );
|
mObject->setShadow( shadowEnableCheck->isChecked() );
|
||||||
mObject->setShadowX( libglabels::Distance::in(shadowXSpin->value()) );
|
mObject->setShadowX( glabels::Distance::in(shadowXSpin->value()) );
|
||||||
mObject->setShadowY( libglabels::Distance::in(shadowYSpin->value()) );
|
mObject->setShadowY( glabels::Distance::in(shadowYSpin->value()) );
|
||||||
mObject->setShadowColorNode( shadowColorButton->colorNode() );
|
mObject->setShadowColorNode( shadowColorButton->colorNode() );
|
||||||
mObject->setShadowOpacity( shadowOpacitySpin->value()/100.0 );
|
mObject->setShadowOpacity( shadowOpacitySpin->value()/100.0 );
|
||||||
|
|
||||||
mBlocked = false;
|
mBlocked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectEditor::onChanged()
|
void ObjectEditor::onChanged()
|
||||||
{
|
{
|
||||||
if ( !mBlocked )
|
if ( !mBlocked )
|
||||||
{
|
{
|
||||||
mBlocked = true;
|
mBlocked = true;
|
||||||
@@ -329,6 +326,4 @@ namespace glabels
|
|||||||
|
|
||||||
mBlocked = false;
|
mBlocked = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-19
@@ -18,30 +18,28 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_ObjectEditor_h
|
#ifndef ObjectEditor_h
|
||||||
#define glabels_ObjectEditor_h
|
#define ObjectEditor_h
|
||||||
|
|
||||||
#include "ui_ObjectEditor.h"
|
#include "ui_ObjectEditor.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
class LabelModel; // Forward reference
|
||||||
|
class LabelModelObject; // Forward reference
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Object Editor Widget
|
||||||
|
///
|
||||||
|
class ObjectEditor : public QWidget, public Ui_ObjectEditor
|
||||||
{
|
{
|
||||||
class LabelModel; // Forward reference
|
|
||||||
class LabelModelObject; // Forward reference
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Object Editor Widget
|
|
||||||
///
|
|
||||||
class ObjectEditor : public QWidget, public Ui_ObjectEditor
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
ObjectEditor( QWidget *parent = 0 );
|
ObjectEditor( QWidget *parent = 0 );
|
||||||
|
|
||||||
|
|
||||||
@@ -54,7 +52,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private methods
|
// Private methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
void hidePages();
|
void hidePages();
|
||||||
void loadLineFillPage();
|
void loadLineFillPage();
|
||||||
void loadPositionPage();
|
void loadPositionPage();
|
||||||
@@ -65,7 +63,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void onLabelSizeChanged();
|
void onLabelSizeChanged();
|
||||||
void onSelectionChanged();
|
void onSelectionChanged();
|
||||||
void onObjectChanged();
|
void onObjectChanged();
|
||||||
@@ -82,13 +80,12 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private data
|
// Private data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
LabelModel* mModel;
|
LabelModel* mModel;
|
||||||
LabelModelObject* mObject;
|
LabelModelObject* mObject;
|
||||||
bool mBlocked;
|
bool mBlocked;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_ObjectEditor_h
|
#endif // ObjectEditor_h
|
||||||
|
|||||||
+4
-4
@@ -40,7 +40,7 @@ namespace
|
|||||||
///
|
///
|
||||||
/// Outline Constructor
|
/// Outline Constructor
|
||||||
///
|
///
|
||||||
glabels::Outline::Outline( LabelModelObject* owner )
|
Outline::Outline( LabelModelObject* owner )
|
||||||
: mOwner(owner)
|
: mOwner(owner)
|
||||||
{
|
{
|
||||||
mDashes << dashSize << dashSize;
|
mDashes << dashSize << dashSize;
|
||||||
@@ -63,7 +63,7 @@ glabels::Outline::Outline( LabelModelObject* owner )
|
|||||||
///
|
///
|
||||||
/// Outline Destructor
|
/// Outline Destructor
|
||||||
///
|
///
|
||||||
glabels::Outline::~Outline()
|
Outline::~Outline()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ glabels::Outline::~Outline()
|
|||||||
///
|
///
|
||||||
/// Draw Outline
|
/// Draw Outline
|
||||||
///
|
///
|
||||||
void glabels::Outline::draw( QPainter* painter ) const
|
void Outline::draw( QPainter* painter ) const
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ void glabels::Outline::draw( QPainter* painter ) const
|
|||||||
///
|
///
|
||||||
/// Create path for testing for hover condition
|
/// Create path for testing for hover condition
|
||||||
///
|
///
|
||||||
QPainterPath glabels::Outline::hoverPath( double scale ) const
|
QPainterPath Outline::hoverPath( double scale ) const
|
||||||
{
|
{
|
||||||
double s = 1 / scale;
|
double s = 1 / scale;
|
||||||
|
|
||||||
|
|||||||
+14
-18
@@ -18,29 +18,26 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_Outline_h
|
#ifndef Outline_h
|
||||||
#define glabels_Outline_h
|
#define Outline_h
|
||||||
|
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPainterPath>
|
#include <QPainterPath>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
class LabelModelObject;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Outline Base Class
|
||||||
|
///
|
||||||
|
class Outline
|
||||||
{
|
{
|
||||||
|
|
||||||
class LabelModelObject;
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Outline Base Class
|
|
||||||
///
|
|
||||||
class Outline
|
|
||||||
{
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Lifecycle Methods
|
// Lifecycle Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
Outline( LabelModelObject* owner );
|
Outline( LabelModelObject* owner );
|
||||||
virtual ~Outline();
|
virtual ~Outline();
|
||||||
|
|
||||||
@@ -48,7 +45,7 @@ namespace glabels
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Drawing Methods
|
// Drawing Methods
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public:
|
public:
|
||||||
void draw( QPainter* painter ) const;
|
void draw( QPainter* painter ) const;
|
||||||
QPainterPath hoverPath( double scale ) const;
|
QPainterPath hoverPath( double scale ) const;
|
||||||
|
|
||||||
@@ -56,15 +53,14 @@ namespace glabels
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
private:
|
private:
|
||||||
LabelModelObject* mOwner;
|
LabelModelObject* mOwner;
|
||||||
|
|
||||||
QVector<qreal> mDashes;
|
QVector<qreal> mDashes;
|
||||||
QPen mPen1;
|
QPen mPen1;
|
||||||
QPen mPen2;
|
QPen mPen2;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_Outline_h
|
#endif // Outline_h
|
||||||
|
|||||||
+62
-67
@@ -36,72 +36,69 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
PageRenderer::PageRenderer()
|
||||||
{
|
|
||||||
|
|
||||||
PageRenderer::PageRenderer()
|
|
||||||
: mModel(0), mNLabels(0), mStartLabel(0),
|
: mModel(0), mNLabels(0), mStartLabel(0),
|
||||||
mPrintOutlines(false), mPrintCropMarks(false), mPrintReverse(false),
|
mPrintOutlines(false), mPrintCropMarks(false), mPrintReverse(false),
|
||||||
mIPage(0), mNPages(0)
|
mIPage(0), mNPages(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PageRenderer::setModel( const LabelModel* model )
|
void PageRenderer::setModel( const LabelModel* model )
|
||||||
{
|
{
|
||||||
mModel = model;
|
mModel = model;
|
||||||
mOrigins = mModel->frame()->getOrigins();
|
mOrigins = mModel->frame()->getOrigins();
|
||||||
mNLabelsPerPage = mModel->frame()->nLabels();
|
mNLabelsPerPage = mModel->frame()->nLabels();
|
||||||
updateNPages();
|
updateNPages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PageRenderer::setNLabels( int nLabels )
|
void PageRenderer::setNLabels( int nLabels )
|
||||||
{
|
{
|
||||||
mNLabels = nLabels;
|
mNLabels = nLabels;
|
||||||
updateNPages();
|
updateNPages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PageRenderer::setStartLabel( int startLabel )
|
void PageRenderer::setStartLabel( int startLabel )
|
||||||
{
|
{
|
||||||
mStartLabel = startLabel;
|
mStartLabel = startLabel;
|
||||||
updateNPages();
|
updateNPages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PageRenderer::setPrintOutlines( bool printOutlinesFlag )
|
void PageRenderer::setPrintOutlines( bool printOutlinesFlag )
|
||||||
{
|
{
|
||||||
mPrintOutlines = printOutlinesFlag;
|
mPrintOutlines = printOutlinesFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PageRenderer::setPrintCropMarks( bool printCropMarksFlag )
|
void PageRenderer::setPrintCropMarks( bool printCropMarksFlag )
|
||||||
{
|
{
|
||||||
mPrintCropMarks = printCropMarksFlag;
|
mPrintCropMarks = printCropMarksFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PageRenderer::setPrintReverse( bool printReverseFlag )
|
void PageRenderer::setPrintReverse( bool printReverseFlag )
|
||||||
{
|
{
|
||||||
mPrintReverse = printReverseFlag;
|
mPrintReverse = printReverseFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PageRenderer::setIPage( int iPage )
|
void PageRenderer::setIPage( int iPage )
|
||||||
{
|
{
|
||||||
mIPage = iPage;
|
mIPage = iPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PageRenderer::nPages() const
|
int PageRenderer::nPages() const
|
||||||
{
|
{
|
||||||
return mNPages;
|
return mNPages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QRectF PageRenderer::pageRect() const
|
QRectF PageRenderer::pageRect() const
|
||||||
{
|
{
|
||||||
if ( mModel )
|
if ( mModel )
|
||||||
{
|
{
|
||||||
return QRectF( 0, 0, mModel->tmplate()->pageWidth().pt(), mModel->tmplate()->pageHeight().pt() );
|
return QRectF( 0, 0, mModel->tmplate()->pageWidth().pt(), mModel->tmplate()->pageHeight().pt() );
|
||||||
@@ -110,11 +107,11 @@ namespace glabels
|
|||||||
{
|
{
|
||||||
return QRectF( 0, 0, 0, 0 );
|
return QRectF( 0, 0, 0, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PageRenderer::updateNPages()
|
void PageRenderer::updateNPages()
|
||||||
{
|
{
|
||||||
if ( mModel )
|
if ( mModel )
|
||||||
{
|
{
|
||||||
/// @TODO merge case
|
/// @TODO merge case
|
||||||
@@ -131,34 +128,34 @@ namespace glabels
|
|||||||
{
|
{
|
||||||
mNPages = 0;
|
mNPages = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Print page using persistent page number
|
/// Print page using persistent page number
|
||||||
///
|
///
|
||||||
void PageRenderer::printPage( QPainter* painter ) const
|
void PageRenderer::printPage( QPainter* painter ) const
|
||||||
{
|
{
|
||||||
printPage( painter, mIPage );
|
printPage( painter, mIPage );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Print page
|
/// Print page
|
||||||
///
|
///
|
||||||
void PageRenderer::printPage( QPainter* painter, int iPage ) const
|
void PageRenderer::printPage( QPainter* painter, int iPage ) const
|
||||||
{
|
{
|
||||||
if ( mModel )
|
if ( mModel )
|
||||||
{
|
{
|
||||||
/// @TODO merge case
|
/// @TODO merge case
|
||||||
|
|
||||||
printSimplePage( painter, iPage );
|
printSimplePage( painter, iPage );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PageRenderer::printSimplePage( QPainter* painter, int iPage ) const
|
void PageRenderer::printSimplePage( QPainter* painter, int iPage ) const
|
||||||
{
|
{
|
||||||
int iStart = 0;
|
int iStart = 0;
|
||||||
int iEnd = mNLabelsPerPage;
|
int iEnd = mNLabelsPerPage;
|
||||||
|
|
||||||
@@ -191,26 +188,26 @@ namespace glabels
|
|||||||
|
|
||||||
painter->restore(); // From before translation
|
painter->restore(); // From before translation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PageRenderer::printMergePage( QPainter* painter, int iPage ) const
|
void PageRenderer::printMergePage( QPainter* painter, int iPage ) const
|
||||||
{
|
{
|
||||||
/// @TODO merge case
|
/// @TODO merge case
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PageRenderer::printCropMarks( QPainter* painter ) const
|
void PageRenderer::printCropMarks( QPainter* painter ) const
|
||||||
{
|
{
|
||||||
if ( mPrintCropMarks )
|
if ( mPrintCropMarks )
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PageRenderer::printOutline( QPainter* painter ) const
|
void PageRenderer::printOutline( QPainter* painter ) const
|
||||||
{
|
{
|
||||||
if ( mPrintOutlines )
|
if ( mPrintOutlines )
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
@@ -222,17 +219,17 @@ namespace glabels
|
|||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PageRenderer::clipLabel( QPainter* painter ) const
|
void PageRenderer::clipLabel( QPainter* painter ) const
|
||||||
{
|
{
|
||||||
// TODO: add clipPath() method to frame
|
// TODO: add clipPath() method to frame
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PageRenderer::printLabel( QPainter* painter, MergeRecord* record ) const
|
void PageRenderer::printLabel( QPainter* painter, MergeRecord* record ) const
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
if ( mModel->rotate() )
|
if ( mModel->rotate() )
|
||||||
@@ -250,6 +247,4 @@ namespace glabels
|
|||||||
mModel->draw( painter, false, record );
|
mModel->draw( painter, false, record );
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-20
@@ -18,8 +18,8 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_PageRenderer_h
|
#ifndef PageRenderer_h
|
||||||
#define glabels_PageRenderer_h
|
#define PageRenderer_h
|
||||||
|
|
||||||
|
|
||||||
#include "libglabels/Point.h"
|
#include "libglabels/Point.h"
|
||||||
@@ -31,28 +31,26 @@
|
|||||||
class QPainter; // Forward reference
|
class QPainter; // Forward reference
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
class LabelModel; // Forward reference
|
||||||
|
class MergeRecord; // Forward reference
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// PageRenderer Widget
|
||||||
|
///
|
||||||
|
class PageRenderer
|
||||||
{
|
{
|
||||||
class LabelModel; // Forward reference
|
|
||||||
class MergeRecord; // Forward reference
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// PageRenderer Widget
|
|
||||||
///
|
|
||||||
class PageRenderer
|
|
||||||
{
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
PageRenderer();
|
PageRenderer();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Public Methods
|
// Public Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void setModel( const LabelModel* model );
|
void setModel( const LabelModel* model );
|
||||||
void setNLabels( int nLabels );
|
void setNLabels( int nLabels );
|
||||||
void setStartLabel( int startLabel );
|
void setStartLabel( int startLabel );
|
||||||
@@ -69,7 +67,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Internal Methods
|
// Internal Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
void updateNPages();
|
void updateNPages();
|
||||||
void printSimplePage( QPainter* painter, int iPage ) const;
|
void printSimplePage( QPainter* painter, int iPage ) const;
|
||||||
void printMergePage( QPainter* painter, int iPage ) const;
|
void printMergePage( QPainter* painter, int iPage ) const;
|
||||||
@@ -82,7 +80,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
const LabelModel* mModel;
|
const LabelModel* mModel;
|
||||||
int mNLabels;
|
int mNLabels;
|
||||||
int mStartLabel;
|
int mStartLabel;
|
||||||
@@ -94,9 +92,8 @@ namespace glabels
|
|||||||
int mNPages;
|
int mNPages;
|
||||||
int mNLabelsPerPage;
|
int mNLabelsPerPage;
|
||||||
|
|
||||||
QVector<libglabels::Point> mOrigins;
|
QVector<glabels::Point> mOrigins;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_PageRenderer_h
|
#endif // PageRenderer_h
|
||||||
|
|||||||
+60
-66
@@ -47,15 +47,12 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Constructor
|
||||||
|
///
|
||||||
///
|
Preview::Preview( QWidget *parent )
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
Preview::Preview( QWidget *parent )
|
|
||||||
: mModel(0), mRenderer(0), QGraphicsView(parent)
|
: mModel(0), mRenderer(0), QGraphicsView(parent)
|
||||||
{
|
{
|
||||||
mScene = new QGraphicsScene();
|
mScene = new QGraphicsScene();
|
||||||
setScene( mScene );
|
setScene( mScene );
|
||||||
|
|
||||||
@@ -64,14 +61,14 @@ namespace glabels
|
|||||||
|
|
||||||
setFrameStyle( QFrame::NoFrame );
|
setFrameStyle( QFrame::NoFrame );
|
||||||
setRenderHints( QPainter::Antialiasing );
|
setRenderHints( QPainter::Antialiasing );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Set model
|
/// Set model
|
||||||
///
|
///
|
||||||
void Preview::setModel( const LabelModel* model )
|
void Preview::setModel( const LabelModel* model )
|
||||||
{
|
{
|
||||||
mModel = model;
|
mModel = model;
|
||||||
|
|
||||||
clearScene();
|
clearScene();
|
||||||
@@ -79,10 +76,10 @@ namespace glabels
|
|||||||
if ( mModel != NULL )
|
if ( mModel != NULL )
|
||||||
{
|
{
|
||||||
// Set scene up with a 5% margin around paper
|
// Set scene up with a 5% margin around paper
|
||||||
libglabels::Distance x = -0.05 * mModel->tmplate()->pageWidth();
|
glabels::Distance x = -0.05 * mModel->tmplate()->pageWidth();
|
||||||
libglabels::Distance y = -0.05 * mModel->tmplate()->pageHeight();
|
glabels::Distance y = -0.05 * mModel->tmplate()->pageHeight();
|
||||||
libglabels::Distance w = 1.10 * mModel->tmplate()->pageWidth();
|
glabels::Distance w = 1.10 * mModel->tmplate()->pageWidth();
|
||||||
libglabels::Distance h = 1.10 * mModel->tmplate()->pageHeight();
|
glabels::Distance h = 1.10 * mModel->tmplate()->pageHeight();
|
||||||
|
|
||||||
mScene->setSceneRect( x.pt(), y.pt(), w.pt(), h.pt() );
|
mScene->setSceneRect( x.pt(), y.pt(), w.pt(), h.pt() );
|
||||||
fitInView( mScene->sceneRect(), Qt::KeepAspectRatio );
|
fitInView( mScene->sceneRect(), Qt::KeepAspectRatio );
|
||||||
@@ -91,45 +88,45 @@ namespace glabels
|
|||||||
drawLabels();
|
drawLabels();
|
||||||
drawPreviewOverlay();
|
drawPreviewOverlay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Set renderer
|
/// Set renderer
|
||||||
///
|
///
|
||||||
void Preview::setRenderer( const PageRenderer* renderer )
|
void Preview::setRenderer( const PageRenderer* renderer )
|
||||||
{
|
{
|
||||||
mRenderer = renderer;
|
mRenderer = renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Resize Event Handler
|
/// Resize Event Handler
|
||||||
///
|
///
|
||||||
void Preview::resizeEvent( QResizeEvent* event )
|
void Preview::resizeEvent( QResizeEvent* event )
|
||||||
{
|
{
|
||||||
fitInView( mScene->sceneRect(), Qt::KeepAspectRatio );
|
fitInView( mScene->sceneRect(), Qt::KeepAspectRatio );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Clear View
|
/// Clear View
|
||||||
///
|
///
|
||||||
void Preview::clearScene()
|
void Preview::clearScene()
|
||||||
{
|
{
|
||||||
foreach ( QGraphicsItem *item, mScene->items() )
|
foreach ( QGraphicsItem *item, mScene->items() )
|
||||||
{
|
{
|
||||||
mScene->removeItem( item );
|
mScene->removeItem( item );
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Draw Paper
|
/// Draw Paper
|
||||||
///
|
///
|
||||||
void Preview::drawPaper( const libglabels::Distance& pw, const libglabels::Distance& ph )
|
void Preview::drawPaper( const glabels::Distance& pw, const glabels::Distance& ph )
|
||||||
{
|
{
|
||||||
QGraphicsDropShadowEffect *shadowEffect = new QGraphicsDropShadowEffect();
|
QGraphicsDropShadowEffect *shadowEffect = new QGraphicsDropShadowEffect();
|
||||||
shadowEffect->setColor( shadowColor );
|
shadowEffect->setColor( shadowColor );
|
||||||
shadowEffect->setOffset( shadowOffsetPixels );
|
shadowEffect->setOffset( shadowOffsetPixels );
|
||||||
@@ -146,30 +143,30 @@ namespace glabels
|
|||||||
pageItem->setGraphicsEffect( shadowEffect );
|
pageItem->setGraphicsEffect( shadowEffect );
|
||||||
|
|
||||||
mScene->addItem( pageItem );
|
mScene->addItem( pageItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Draw Labels on Paper
|
/// Draw Labels on Paper
|
||||||
///
|
///
|
||||||
void Preview::drawLabels()
|
void Preview::drawLabels()
|
||||||
{
|
{
|
||||||
libglabels::Frame *frame = mModel->tmplate()->frames().first();
|
glabels::Frame *frame = mModel->tmplate()->frames().first();
|
||||||
|
|
||||||
foreach (libglabels::Point origin, frame->getOrigins() )
|
foreach (glabels::Point origin, frame->getOrigins() )
|
||||||
{
|
{
|
||||||
drawLabel( origin.x(), origin.y(), frame->path() );
|
drawLabel( origin.x(), origin.y(), frame->path() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Draw a Single Label at x,y
|
/// Draw a Single Label at x,y
|
||||||
///
|
///
|
||||||
void Preview::drawLabel( const libglabels::Distance& x,
|
void Preview::drawLabel( const glabels::Distance& x,
|
||||||
const libglabels::Distance& y,
|
const glabels::Distance& y,
|
||||||
const QPainterPath& path )
|
const QPainterPath& path )
|
||||||
{
|
{
|
||||||
QBrush brush( Qt::NoBrush );
|
QBrush brush( Qt::NoBrush );
|
||||||
QPen pen( labelOutlineColor );
|
QPen pen( labelOutlineColor );
|
||||||
pen.setStyle( Qt::DotLine );
|
pen.setStyle( Qt::DotLine );
|
||||||
@@ -182,20 +179,17 @@ namespace glabels
|
|||||||
labelOutlineItem->setPos( x.pt(), y.pt() );
|
labelOutlineItem->setPos( x.pt(), y.pt() );
|
||||||
|
|
||||||
mScene->addItem( labelOutlineItem );
|
mScene->addItem( labelOutlineItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Draw Preview Overlay
|
/// Draw Preview Overlay
|
||||||
///
|
///
|
||||||
void Preview::drawPreviewOverlay()
|
void Preview::drawPreviewOverlay()
|
||||||
{
|
{
|
||||||
if ( mRenderer )
|
if ( mRenderer )
|
||||||
{
|
{
|
||||||
PreviewOverlayItem* overlayItem = new PreviewOverlayItem( mRenderer );
|
PreviewOverlayItem* overlayItem = new PreviewOverlayItem( mRenderer );
|
||||||
mScene->addItem( overlayItem );
|
mScene->addItem( overlayItem );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-22
@@ -18,8 +18,8 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_Preview_h
|
#ifndef Preview_h
|
||||||
#define glabels_Preview_h
|
#define Preview_h
|
||||||
|
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
@@ -27,30 +27,28 @@
|
|||||||
#include "PageRenderer.h"
|
#include "PageRenderer.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
class LabelModel; // Forward reference
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Preview Widget
|
||||||
|
///
|
||||||
|
class Preview : public QGraphicsView
|
||||||
{
|
{
|
||||||
class LabelModel; // Forward reference
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Preview Widget
|
|
||||||
///
|
|
||||||
class Preview : public QGraphicsView
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
Preview( QWidget *parent = 0 );
|
Preview( QWidget *parent = 0 );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void setModel( const LabelModel* model );
|
void setModel( const LabelModel* model );
|
||||||
void setRenderer( const PageRenderer* renderer );
|
void setRenderer( const PageRenderer* renderer );
|
||||||
|
|
||||||
@@ -58,19 +56,19 @@ namespace glabels
|
|||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Event handlers
|
// Event handlers
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent( QResizeEvent* event );
|
void resizeEvent( QResizeEvent* event );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Internal Methods
|
// Internal Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
void clearScene();
|
void clearScene();
|
||||||
void drawPaper( const libglabels::Distance& pw, const libglabels::Distance& ph );
|
void drawPaper( const glabels::Distance& pw, const glabels::Distance& ph );
|
||||||
void drawLabels();
|
void drawLabels();
|
||||||
void drawLabel( const libglabels::Distance& x,
|
void drawLabel( const glabels::Distance& x,
|
||||||
const libglabels::Distance& y,
|
const glabels::Distance& y,
|
||||||
const QPainterPath& path );
|
const QPainterPath& path );
|
||||||
|
|
||||||
void drawPreviewOverlay();
|
void drawPreviewOverlay();
|
||||||
@@ -79,13 +77,12 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
const LabelModel* mModel;
|
const LabelModel* mModel;
|
||||||
const PageRenderer* mRenderer;
|
const PageRenderer* mRenderer;
|
||||||
QGraphicsScene* mScene;
|
QGraphicsScene* mScene;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_Preview_h
|
#endif // Preview_h
|
||||||
|
|||||||
@@ -23,24 +23,19 @@
|
|||||||
#include "PageRenderer.h"
|
#include "PageRenderer.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
PreviewOverlayItem::PreviewOverlayItem( const PageRenderer* renderer, QGraphicsItem* parent )
|
||||||
{
|
|
||||||
|
|
||||||
PreviewOverlayItem::PreviewOverlayItem( const PageRenderer* renderer, QGraphicsItem* parent )
|
|
||||||
: QGraphicsItem(parent), mRenderer(renderer)
|
: QGraphicsItem(parent), mRenderer(renderer)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QRectF PreviewOverlayItem::boundingRect() const
|
QRectF PreviewOverlayItem::boundingRect() const
|
||||||
{
|
{
|
||||||
return mRenderer->pageRect();
|
return mRenderer->pageRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PreviewOverlayItem::paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget )
|
void PreviewOverlayItem::paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget )
|
||||||
{
|
{
|
||||||
mRenderer->printPage( painter );
|
mRenderer->printPage( painter );
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,34 +18,32 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_PreviewOverlayItem_h
|
#ifndef PreviewOverlayItem_h
|
||||||
#define glabels_PreviewOverlayItem_h
|
#define PreviewOverlayItem_h
|
||||||
|
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
class PageRenderer; // Forward reference
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// PreviewOverlayItem Widget
|
||||||
|
///
|
||||||
|
class PreviewOverlayItem : public QGraphicsItem
|
||||||
{
|
{
|
||||||
class PageRenderer; // Forward reference
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// PreviewOverlayItem Widget
|
|
||||||
///
|
|
||||||
class PreviewOverlayItem : public QGraphicsItem
|
|
||||||
{
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
PreviewOverlayItem( const PageRenderer* renderer, QGraphicsItem* parent = 0 );
|
PreviewOverlayItem( const PageRenderer* renderer, QGraphicsItem* parent = 0 );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Virtual method implementations
|
// Virtual method implementations
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
QRectF boundingRect() const;
|
QRectF boundingRect() const;
|
||||||
void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget );
|
void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget );
|
||||||
|
|
||||||
@@ -53,11 +51,10 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
const PageRenderer* mRenderer;
|
const PageRenderer* mRenderer;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_PreviewOverlayItem_h
|
#endif // PreviewOverlayItem_h
|
||||||
|
|||||||
+41
-46
@@ -26,36 +26,33 @@
|
|||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Constructor
|
||||||
|
///
|
||||||
///
|
PrintView::PrintView( QWidget *parent )
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
PrintView::PrintView( QWidget *parent )
|
|
||||||
: QWidget(parent), mModel(0), mBlocked(false)
|
: QWidget(parent), mModel(0), mBlocked(false)
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
preview->setRenderer( &mRenderer );
|
preview->setRenderer( &mRenderer );
|
||||||
|
|
||||||
mPrinter = new QPrinter( QPrinter::HighResolution );
|
mPrinter = new QPrinter( QPrinter::HighResolution );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Destructor
|
/// Destructor
|
||||||
///
|
///
|
||||||
PrintView::~PrintView()
|
PrintView::~PrintView()
|
||||||
{
|
{
|
||||||
delete mPrinter;
|
delete mPrinter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Set Model
|
/// Set Model
|
||||||
///
|
///
|
||||||
void PrintView::setModel( LabelModel* model )
|
void PrintView::setModel( LabelModel* model )
|
||||||
{
|
{
|
||||||
mModel = model;
|
mModel = model;
|
||||||
|
|
||||||
// TODO set visibility based on merge selection
|
// TODO set visibility based on merge selection
|
||||||
@@ -67,33 +64,33 @@ namespace glabels
|
|||||||
|
|
||||||
onLabelSizeChanged();
|
onLabelSizeChanged();
|
||||||
onFormChanged();
|
onFormChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Label size changed handler
|
/// Label size changed handler
|
||||||
///
|
///
|
||||||
void PrintView::onLabelSizeChanged()
|
void PrintView::onLabelSizeChanged()
|
||||||
{
|
{
|
||||||
preview->setModel( mModel );
|
preview->setModel( mModel );
|
||||||
mRenderer.setModel( mModel );
|
mRenderer.setModel( mModel );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Label changed handler
|
/// Label changed handler
|
||||||
///
|
///
|
||||||
void PrintView::onLabelChanged()
|
void PrintView::onLabelChanged()
|
||||||
{
|
{
|
||||||
preview->update();
|
preview->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Form changed handler
|
/// Form changed handler
|
||||||
///
|
///
|
||||||
void PrintView::onFormChanged()
|
void PrintView::onFormChanged()
|
||||||
{
|
{
|
||||||
if ( !mBlocked )
|
if ( !mBlocked )
|
||||||
{
|
{
|
||||||
mBlocked = true;
|
mBlocked = true;
|
||||||
@@ -130,14 +127,14 @@ namespace glabels
|
|||||||
|
|
||||||
mBlocked = false;
|
mBlocked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Print Button Clicked handler
|
/// Print Button Clicked handler
|
||||||
///
|
///
|
||||||
void PrintView::onPrintButtonClicked()
|
void PrintView::onPrintButtonClicked()
|
||||||
{
|
{
|
||||||
QSizeF pageSize( mModel->tmplate()->pageWidth().pt(), mModel->tmplate()->pageHeight().pt() );
|
QSizeF pageSize( mModel->tmplate()->pageWidth().pt(), mModel->tmplate()->pageHeight().pt() );
|
||||||
mPrinter->setPaperSize( pageSize, QPrinter::Point );
|
mPrinter->setPaperSize( pageSize, QPrinter::Point );
|
||||||
mPrinter->setFullPage( true );
|
mPrinter->setFullPage( true );
|
||||||
@@ -170,6 +167,4 @@ namespace glabels
|
|||||||
mRenderer.printPage( &painter, iPage );
|
mRenderer.printPage( &painter, iPage );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-17
@@ -18,8 +18,8 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_PrintView_h
|
#ifndef PrintView_h
|
||||||
#define glabels_PrintView_h
|
#define PrintView_h
|
||||||
|
|
||||||
#include "ui_PrintView.h"
|
#include "ui_PrintView.h"
|
||||||
#include "PageRenderer.h"
|
#include "PageRenderer.h"
|
||||||
@@ -27,23 +27,21 @@
|
|||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
class LabelModel; // Forward reference
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Print View Widget
|
||||||
|
///
|
||||||
|
class PrintView : public QWidget, public Ui_PrintView
|
||||||
{
|
{
|
||||||
class LabelModel; // Forward reference
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Print View Widget
|
|
||||||
///
|
|
||||||
class PrintView : public QWidget, public Ui_PrintView
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
PrintView( QWidget *parent = 0 );
|
PrintView( QWidget *parent = 0 );
|
||||||
~PrintView();
|
~PrintView();
|
||||||
|
|
||||||
@@ -57,7 +55,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void onLabelChanged();
|
void onLabelChanged();
|
||||||
void onLabelSizeChanged();
|
void onLabelSizeChanged();
|
||||||
void onFormChanged();
|
void onFormChanged();
|
||||||
@@ -67,15 +65,14 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
LabelModel* mModel;
|
LabelModel* mModel;
|
||||||
QPrinter* mPrinter;
|
QPrinter* mPrinter;
|
||||||
PageRenderer mRenderer;
|
PageRenderer mRenderer;
|
||||||
|
|
||||||
bool mBlocked;
|
bool mBlocked;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_PrintView_h
|
#endif // PrintView_h
|
||||||
|
|||||||
+45
-50
@@ -27,56 +27,53 @@
|
|||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Constructor
|
||||||
|
///
|
||||||
///
|
PropertiesView::PropertiesView( QWidget *parent )
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
PropertiesView::PropertiesView( QWidget *parent )
|
|
||||||
: QWidget(parent), mModel(0)
|
: QWidget(parent), mModel(0)
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
|
||||||
similarBrowser->setAttribute(Qt::WA_TranslucentBackground);
|
similarBrowser->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
similarBrowser->viewport()->setAutoFillBackground(false);
|
similarBrowser->viewport()->setAutoFillBackground(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Destructor
|
/// Destructor
|
||||||
///
|
///
|
||||||
PropertiesView::~PropertiesView()
|
PropertiesView::~PropertiesView()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Set Model
|
/// Set Model
|
||||||
///
|
///
|
||||||
void PropertiesView::setModel( LabelModel* model )
|
void PropertiesView::setModel( LabelModel* model )
|
||||||
{
|
{
|
||||||
mModel = model;
|
mModel = model;
|
||||||
|
|
||||||
connect( mModel, SIGNAL(sizeChanged()), this, SLOT(onLabelSizeChanged()) );
|
connect( mModel, SIGNAL(sizeChanged()), this, SLOT(onLabelSizeChanged()) );
|
||||||
|
|
||||||
onLabelSizeChanged();
|
onLabelSizeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Label size changed handler
|
/// Label size changed handler
|
||||||
///
|
///
|
||||||
void PropertiesView::onLabelSizeChanged()
|
void PropertiesView::onLabelSizeChanged()
|
||||||
{
|
{
|
||||||
const libglabels::Template *tmplate = mModel->tmplate();
|
const glabels::Template *tmplate = mModel->tmplate();
|
||||||
const libglabels::Frame *frame = tmplate->frames().first();
|
const glabels::Frame *frame = tmplate->frames().first();
|
||||||
bool isRotated = mModel->rotate();
|
bool isRotated = mModel->rotate();
|
||||||
|
|
||||||
preview->setTemplate( tmplate );
|
preview->setTemplate( tmplate );
|
||||||
preview->setRotate( isRotated );
|
preview->setRotate( isRotated );
|
||||||
|
|
||||||
const libglabels::Vendor *vendor = libglabels::Db::lookupVendorFromName( tmplate->brand() );
|
const glabels::Vendor *vendor = glabels::Db::lookupVendorFromName( tmplate->brand() );
|
||||||
if ( (vendor != NULL) && (vendor->url() != NULL) )
|
if ( (vendor != NULL) && (vendor->url() != NULL) )
|
||||||
{
|
{
|
||||||
QString markup = "<a href='" + vendor->url() + "'>" + vendor->name() + "</a>";
|
QString markup = "<a href='" + vendor->url() + "'>" + vendor->name() + "</a>";
|
||||||
@@ -99,16 +96,16 @@ namespace glabels
|
|||||||
|
|
||||||
descriptionLabel->setText( tmplate->description() );
|
descriptionLabel->setText( tmplate->description() );
|
||||||
|
|
||||||
QString pgSizeString = libglabels::Db::lookupPaperNameFromId( tmplate->paperId() );
|
QString pgSizeString = glabels::Db::lookupPaperNameFromId( tmplate->paperId() );
|
||||||
pageSizeLabel->setText( pgSizeString );
|
pageSizeLabel->setText( pgSizeString );
|
||||||
|
|
||||||
QString labelSizeString = frame->sizeDescription( libglabels::Distance::Units::IN );
|
QString labelSizeString = frame->sizeDescription( glabels::Distance::Units::IN );
|
||||||
labelSizeLabel->setText( labelSizeString );
|
labelSizeLabel->setText( labelSizeString );
|
||||||
|
|
||||||
QString layoutString = frame->layoutDescription();
|
QString layoutString = frame->layoutDescription();
|
||||||
layoutLabel->setText( layoutString );
|
layoutLabel->setText( layoutString );
|
||||||
|
|
||||||
QStringList list = libglabels::Db::getNameListOfSimilarTemplates( tmplate->name() );
|
QStringList list = glabels::Db::getNameListOfSimilarTemplates( tmplate->name() );
|
||||||
if ( list.isEmpty() )
|
if ( list.isEmpty() )
|
||||||
{
|
{
|
||||||
similarProductsGroupBox->hide();
|
similarProductsGroupBox->hide();
|
||||||
@@ -140,16 +137,16 @@ namespace glabels
|
|||||||
{
|
{
|
||||||
orientationCombo->setCurrentIndex( isRotated ? 0 : 1 );
|
orientationCombo->setCurrentIndex( isRotated ? 0 : 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Form changed handler
|
/// Form changed handler
|
||||||
///
|
///
|
||||||
void PropertiesView::onFormChanged()
|
void PropertiesView::onFormChanged()
|
||||||
{
|
{
|
||||||
const libglabels::Template *tmplate = mModel->tmplate();
|
const glabels::Template *tmplate = mModel->tmplate();
|
||||||
const libglabels::Frame *frame = tmplate->frames().first();
|
const glabels::Frame *frame = tmplate->frames().first();
|
||||||
|
|
||||||
if ( frame->w() == frame->h() )
|
if ( frame->w() == frame->h() )
|
||||||
{
|
{
|
||||||
@@ -165,29 +162,27 @@ namespace glabels
|
|||||||
int index = orientationCombo->currentIndex();
|
int index = orientationCombo->currentIndex();
|
||||||
mModel->setRotate( index == 0 );
|
mModel->setRotate( index == 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Change Product Button Clicked handler
|
/// Change Product Button Clicked handler
|
||||||
///
|
///
|
||||||
void PropertiesView::onChangeProductButtonClicked()
|
void PropertiesView::onChangeProductButtonClicked()
|
||||||
{
|
{
|
||||||
SelectProductDialog selectProductDialog( this );
|
SelectProductDialog selectProductDialog( this );
|
||||||
selectProductDialog.exec();
|
selectProductDialog.exec();
|
||||||
|
|
||||||
const libglabels::Template* tmplate = selectProductDialog.tmplate();
|
const glabels::Template* tmplate = selectProductDialog.tmplate();
|
||||||
if ( tmplate )
|
if ( tmplate )
|
||||||
{
|
{
|
||||||
mModel->setTmplate( tmplate );
|
mModel->setTmplate( tmplate );
|
||||||
|
|
||||||
// Don't rotate circular or round labels
|
// Don't rotate circular or round labels
|
||||||
const libglabels::Frame *frame = tmplate->frames().first();
|
const glabels::Frame *frame = tmplate->frames().first();
|
||||||
if ( frame->w() == frame->h() )
|
if ( frame->w() == frame->h() )
|
||||||
{
|
{
|
||||||
mModel->setRotate( false );
|
mModel->setRotate( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-17
@@ -18,29 +18,27 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_PropertiesView_h
|
#ifndef PropertiesView_h
|
||||||
#define glabels_PropertiesView_h
|
#define PropertiesView_h
|
||||||
|
|
||||||
#include "ui_PropertiesView.h"
|
#include "ui_PropertiesView.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
class LabelModel; // Forward reference
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Properties View Widget
|
||||||
|
///
|
||||||
|
class PropertiesView : public QWidget, public Ui_PropertiesView
|
||||||
{
|
{
|
||||||
class LabelModel; // Forward reference
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Properties View Widget
|
|
||||||
///
|
|
||||||
class PropertiesView : public QWidget, public Ui_PropertiesView
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
PropertiesView( QWidget *parent = 0 );
|
PropertiesView( QWidget *parent = 0 );
|
||||||
~PropertiesView();
|
~PropertiesView();
|
||||||
|
|
||||||
@@ -54,7 +52,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void onLabelSizeChanged();
|
void onLabelSizeChanged();
|
||||||
void onFormChanged();
|
void onFormChanged();
|
||||||
void onChangeProductButtonClicked();
|
void onChangeProductButtonClicked();
|
||||||
@@ -63,11 +61,10 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
LabelModel* mModel;
|
LabelModel* mModel;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_PropertiesView_h
|
#endif // PropertiesView_h
|
||||||
|
|||||||
@@ -26,15 +26,12 @@
|
|||||||
#include "TemplatePickerItem.h"
|
#include "TemplatePickerItem.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Constructor
|
||||||
|
///
|
||||||
///
|
SelectProductDialog::SelectProductDialog( QWidget *parent )
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
SelectProductDialog::SelectProductDialog( QWidget *parent )
|
|
||||||
: QDialog(parent), mCanceled(false)
|
: QDialog(parent), mCanceled(false)
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
|
||||||
// TODO: Set default based on locale and/or saved preferences
|
// TODO: Set default based on locale and/or saved preferences
|
||||||
@@ -43,20 +40,20 @@ namespace glabels
|
|||||||
pageSizeUsCheck->setChecked( true );
|
pageSizeUsCheck->setChecked( true );
|
||||||
pageSizeOtherCheck->setChecked( true );
|
pageSizeOtherCheck->setChecked( true );
|
||||||
|
|
||||||
QList<libglabels::Template*> tmplates = libglabels::Db::templates();
|
QList<glabels::Template*> tmplates = glabels::Db::templates();
|
||||||
templatePicker->setTemplates( tmplates );
|
templatePicker->setTemplates( tmplates );
|
||||||
|
|
||||||
templatePicker->applyFilter( searchEntry->text(),
|
templatePicker->applyFilter( searchEntry->text(),
|
||||||
pageSizeIsoCheck->isChecked(),
|
pageSizeIsoCheck->isChecked(),
|
||||||
pageSizeUsCheck->isChecked(),
|
pageSizeUsCheck->isChecked(),
|
||||||
pageSizeOtherCheck->isChecked() );
|
pageSizeOtherCheck->isChecked() );
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Get selected template
|
/// Get selected template
|
||||||
///
|
///
|
||||||
const libglabels::Template* SelectProductDialog::tmplate() const
|
const glabels::Template* SelectProductDialog::tmplate() const
|
||||||
{
|
{
|
||||||
if ( !mCanceled )
|
if ( !mCanceled )
|
||||||
{
|
{
|
||||||
return templatePicker->selectedTemplate();
|
return templatePicker->selectedTemplate();
|
||||||
@@ -65,69 +62,67 @@ namespace glabels
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Search Entry Text Changed Slot
|
/// Search Entry Text Changed Slot
|
||||||
///
|
///
|
||||||
void SelectProductDialog::onSearchEntryTextChanged()
|
void SelectProductDialog::onSearchEntryTextChanged()
|
||||||
{
|
{
|
||||||
templatePicker->applyFilter( searchEntry->text(),
|
templatePicker->applyFilter( searchEntry->text(),
|
||||||
pageSizeIsoCheck->isChecked(),
|
pageSizeIsoCheck->isChecked(),
|
||||||
pageSizeUsCheck->isChecked(),
|
pageSizeUsCheck->isChecked(),
|
||||||
pageSizeOtherCheck->isChecked() );
|
pageSizeOtherCheck->isChecked() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Search Entry Text Changed Slot
|
/// Search Entry Text Changed Slot
|
||||||
///
|
///
|
||||||
void SelectProductDialog::onSearchClearButtonClicked()
|
void SelectProductDialog::onSearchClearButtonClicked()
|
||||||
{
|
{
|
||||||
searchEntry->setText( "" );
|
searchEntry->setText( "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Page Size Check Toggled Slot
|
/// Page Size Check Toggled Slot
|
||||||
///
|
///
|
||||||
void SelectProductDialog::onPageSizeCheckToggled()
|
void SelectProductDialog::onPageSizeCheckToggled()
|
||||||
{
|
{
|
||||||
templatePicker->applyFilter( searchEntry->text(),
|
templatePicker->applyFilter( searchEntry->text(),
|
||||||
pageSizeIsoCheck->isChecked(),
|
pageSizeIsoCheck->isChecked(),
|
||||||
pageSizeUsCheck->isChecked(),
|
pageSizeUsCheck->isChecked(),
|
||||||
pageSizeOtherCheck->isChecked() );
|
pageSizeOtherCheck->isChecked() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Template Picker Selection Changed Slot
|
/// Template Picker Selection Changed Slot
|
||||||
///
|
///
|
||||||
void SelectProductDialog::onTemplatePickerSelectionChanged()
|
void SelectProductDialog::onTemplatePickerSelectionChanged()
|
||||||
{
|
{
|
||||||
const libglabels::Template *tmplate = templatePicker->selectedTemplate();
|
const glabels::Template *tmplate = templatePicker->selectedTemplate();
|
||||||
|
|
||||||
selectButton->setEnabled( tmplate != NULL );
|
selectButton->setEnabled( tmplate != NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Select Button Clicked Slot
|
/// Select Button Clicked Slot
|
||||||
///
|
///
|
||||||
void SelectProductDialog::onSelectButtonClicked()
|
void SelectProductDialog::onSelectButtonClicked()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Cancel Button Clicked Slot
|
/// Cancel Button Clicked Slot
|
||||||
///
|
///
|
||||||
void SelectProductDialog::onCancelButtonClicked()
|
void SelectProductDialog::onCancelButtonClicked()
|
||||||
{
|
{
|
||||||
mCanceled = true;
|
mCanceled = true;
|
||||||
close();
|
close();
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,40 +18,37 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_SelectProductDialog_h
|
#ifndef SelectProductDialog_h
|
||||||
#define glabels_SelectProductDialog_h
|
#define SelectProductDialog_h
|
||||||
|
|
||||||
#include "ui_SelectProductDialog.h"
|
#include "ui_SelectProductDialog.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// New Label Dialog Widget
|
||||||
|
///
|
||||||
|
class SelectProductDialog : public QDialog, public Ui_SelectProductDialog
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// New Label Dialog Widget
|
|
||||||
///
|
|
||||||
class SelectProductDialog : public QDialog, public Ui_SelectProductDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
SelectProductDialog( QWidget *parent = 0 );
|
SelectProductDialog( QWidget *parent = 0 );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Accessors
|
// Accessors
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
const libglabels::Template* tmplate() const;
|
const glabels::Template* tmplate() const;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void onSearchEntryTextChanged();
|
void onSearchEntryTextChanged();
|
||||||
void onSearchClearButtonClicked();
|
void onSearchClearButtonClicked();
|
||||||
void onPageSizeCheckToggled();
|
void onPageSizeCheckToggled();
|
||||||
@@ -63,11 +60,10 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private data
|
// Private data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
bool mCanceled;
|
bool mCanceled;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_SelectProductDialog_h
|
#endif // SelectProductDialog_h
|
||||||
|
|||||||
+73
-78
@@ -51,15 +51,12 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Constructor
|
||||||
|
///
|
||||||
///
|
SimplePreview::SimplePreview( QWidget *parent )
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
SimplePreview::SimplePreview( QWidget *parent )
|
|
||||||
: mTmplate(NULL), mRotateFlag(false), QGraphicsView(parent)
|
: mTmplate(NULL), mRotateFlag(false), QGraphicsView(parent)
|
||||||
{
|
{
|
||||||
mScene = new QGraphicsScene();
|
mScene = new QGraphicsScene();
|
||||||
setScene( mScene );
|
setScene( mScene );
|
||||||
|
|
||||||
@@ -68,52 +65,52 @@ namespace glabels
|
|||||||
|
|
||||||
setFrameStyle( QFrame::NoFrame );
|
setFrameStyle( QFrame::NoFrame );
|
||||||
setRenderHints( QPainter::Antialiasing );
|
setRenderHints( QPainter::Antialiasing );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Template Property Setter
|
/// Template Property Setter
|
||||||
///
|
///
|
||||||
void SimplePreview::setTemplate( const libglabels::Template *tmplate )
|
void SimplePreview::setTemplate( const glabels::Template *tmplate )
|
||||||
{
|
{
|
||||||
mTmplate = tmplate;
|
mTmplate = tmplate;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Rotate Property Setter
|
/// Rotate Property Setter
|
||||||
///
|
///
|
||||||
void SimplePreview::setRotate( bool rotateFlag )
|
void SimplePreview::setRotate( bool rotateFlag )
|
||||||
{
|
{
|
||||||
mRotateFlag = rotateFlag;
|
mRotateFlag = rotateFlag;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Resize Event Handler
|
/// Resize Event Handler
|
||||||
///
|
///
|
||||||
void SimplePreview::resizeEvent( QResizeEvent* event )
|
void SimplePreview::resizeEvent( QResizeEvent* event )
|
||||||
{
|
{
|
||||||
fitInView( mScene->sceneRect(), Qt::KeepAspectRatio );
|
fitInView( mScene->sceneRect(), Qt::KeepAspectRatio );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Update View
|
/// Update View
|
||||||
///
|
///
|
||||||
void SimplePreview::update()
|
void SimplePreview::update()
|
||||||
{
|
{
|
||||||
clearScene();
|
clearScene();
|
||||||
|
|
||||||
if ( mTmplate != NULL )
|
if ( mTmplate != NULL )
|
||||||
{
|
{
|
||||||
// Set scene up with a 5% margin around paper
|
// Set scene up with a 5% margin around paper
|
||||||
libglabels::Distance x = -0.05 * mTmplate->pageWidth();
|
glabels::Distance x = -0.05 * mTmplate->pageWidth();
|
||||||
libglabels::Distance y = -0.05 * mTmplate->pageHeight();
|
glabels::Distance y = -0.05 * mTmplate->pageHeight();
|
||||||
libglabels::Distance w = 1.10 * mTmplate->pageWidth();
|
glabels::Distance w = 1.10 * mTmplate->pageWidth();
|
||||||
libglabels::Distance h = 1.10 * mTmplate->pageHeight();
|
glabels::Distance h = 1.10 * mTmplate->pageHeight();
|
||||||
|
|
||||||
mScene->setSceneRect( x.pt(), y.pt(), w.pt(), h.pt() );
|
mScene->setSceneRect( x.pt(), y.pt(), w.pt(), h.pt() );
|
||||||
fitInView( mScene->sceneRect(), Qt::KeepAspectRatio );
|
fitInView( mScene->sceneRect(), Qt::KeepAspectRatio );
|
||||||
@@ -122,27 +119,27 @@ namespace glabels
|
|||||||
drawLabels();
|
drawLabels();
|
||||||
drawArrow();
|
drawArrow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Clear View
|
/// Clear View
|
||||||
///
|
///
|
||||||
void SimplePreview::clearScene()
|
void SimplePreview::clearScene()
|
||||||
{
|
{
|
||||||
foreach ( QGraphicsItem *item, mScene->items() )
|
foreach ( QGraphicsItem *item, mScene->items() )
|
||||||
{
|
{
|
||||||
mScene->removeItem( item );
|
mScene->removeItem( item );
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Draw Paper
|
/// Draw Paper
|
||||||
///
|
///
|
||||||
void SimplePreview::drawPaper( const libglabels::Distance& pw, const libglabels::Distance& ph )
|
void SimplePreview::drawPaper( const glabels::Distance& pw, const glabels::Distance& ph )
|
||||||
{
|
{
|
||||||
QGraphicsDropShadowEffect *shadowEffect = new QGraphicsDropShadowEffect();
|
QGraphicsDropShadowEffect *shadowEffect = new QGraphicsDropShadowEffect();
|
||||||
shadowEffect->setColor( shadowColor );
|
shadowEffect->setColor( shadowColor );
|
||||||
shadowEffect->setOffset( shadowOffsetPixels );
|
shadowEffect->setOffset( shadowOffsetPixels );
|
||||||
@@ -159,30 +156,30 @@ namespace glabels
|
|||||||
pageItem->setGraphicsEffect( shadowEffect );
|
pageItem->setGraphicsEffect( shadowEffect );
|
||||||
|
|
||||||
mScene->addItem( pageItem );
|
mScene->addItem( pageItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Draw Labels on Paper
|
/// Draw Labels on Paper
|
||||||
///
|
///
|
||||||
void SimplePreview::drawLabels()
|
void SimplePreview::drawLabels()
|
||||||
{
|
{
|
||||||
libglabels::Frame *frame = mTmplate->frames().first();
|
glabels::Frame *frame = mTmplate->frames().first();
|
||||||
|
|
||||||
foreach (libglabels::Point origin, frame->getOrigins() )
|
foreach (glabels::Point origin, frame->getOrigins() )
|
||||||
{
|
{
|
||||||
drawLabel( origin.x(), origin.y(), frame->path() );
|
drawLabel( origin.x(), origin.y(), frame->path() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Draw a Single Label at x,y
|
/// Draw a Single Label at x,y
|
||||||
///
|
///
|
||||||
void SimplePreview::drawLabel( const libglabels::Distance& x,
|
void SimplePreview::drawLabel( const glabels::Distance& x,
|
||||||
const libglabels::Distance& y,
|
const glabels::Distance& y,
|
||||||
const QPainterPath& path )
|
const QPainterPath& path )
|
||||||
{
|
{
|
||||||
QBrush brush( labelColor );
|
QBrush brush( labelColor );
|
||||||
QPen pen( labelOutlineColor );
|
QPen pen( labelOutlineColor );
|
||||||
pen.setCosmetic( true );
|
pen.setCosmetic( true );
|
||||||
@@ -194,20 +191,20 @@ namespace glabels
|
|||||||
labelItem->setPos( x.pt(), y.pt() );
|
labelItem->setPos( x.pt(), y.pt() );
|
||||||
|
|
||||||
mScene->addItem( labelItem );
|
mScene->addItem( labelItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Draw Arrow Indicating Top of First Label
|
/// Draw Arrow Indicating Top of First Label
|
||||||
///
|
///
|
||||||
void SimplePreview::drawArrow()
|
void SimplePreview::drawArrow()
|
||||||
{
|
{
|
||||||
libglabels::Frame *frame = mTmplate->frames().first();
|
glabels::Frame *frame = mTmplate->frames().first();
|
||||||
|
|
||||||
libglabels::Distance w = frame->w();
|
glabels::Distance w = frame->w();
|
||||||
libglabels::Distance h = frame->h();
|
glabels::Distance h = frame->h();
|
||||||
|
|
||||||
libglabels::Distance min = libglabels::min( w, h );
|
glabels::Distance min = glabels::min( w, h );
|
||||||
|
|
||||||
QPen pen( arrowColor );
|
QPen pen( arrowColor );
|
||||||
pen.setWidthF( 0.25*min.pt()*arrowScale );
|
pen.setWidthF( 0.25*min.pt()*arrowScale );
|
||||||
@@ -216,9 +213,9 @@ namespace glabels
|
|||||||
|
|
||||||
QBrush brush( upColor );
|
QBrush brush( upColor );
|
||||||
|
|
||||||
libglabels::Point origin = frame->getOrigins().first();
|
glabels::Point origin = frame->getOrigins().first();
|
||||||
libglabels::Distance x0 = origin.x();
|
glabels::Distance x0 = origin.x();
|
||||||
libglabels::Distance y0 = origin.y();
|
glabels::Distance y0 = origin.y();
|
||||||
|
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
path.moveTo( 0, min.pt()*arrowScale/3 );
|
path.moveTo( 0, min.pt()*arrowScale/3 );
|
||||||
@@ -252,6 +249,4 @@ namespace glabels
|
|||||||
|
|
||||||
mScene->addItem( arrowItem );
|
mScene->addItem( arrowItem );
|
||||||
mScene->addItem( upItem );
|
mScene->addItem( upItem );
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-22
@@ -18,8 +18,8 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_SimplePreview_h
|
#ifndef SimplePreview_h
|
||||||
#define glabels_SimplePreview_h
|
#define SimplePreview_h
|
||||||
|
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
@@ -29,49 +29,46 @@
|
|||||||
#include "libglabels/Template.h"
|
#include "libglabels/Template.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Simple Preview Widget
|
||||||
|
///
|
||||||
|
class SimplePreview : public QGraphicsView
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Simple Preview Widget
|
|
||||||
///
|
|
||||||
class SimplePreview : public QGraphicsView
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
SimplePreview( QWidget *parent = 0 );
|
SimplePreview( QWidget *parent = 0 );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void setTemplate( const libglabels::Template *tmplate );
|
void setTemplate( const glabels::Template *tmplate );
|
||||||
void setRotate( bool rotateFlag );
|
void setRotate( bool rotateFlag );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Event handlers
|
// Event handlers
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent( QResizeEvent* event );
|
void resizeEvent( QResizeEvent* event );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Internal Methods
|
// Internal Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
void update();
|
void update();
|
||||||
void clearScene();
|
void clearScene();
|
||||||
void drawPaper( const libglabels::Distance& pw, const libglabels::Distance& ph );
|
void drawPaper( const glabels::Distance& pw, const glabels::Distance& ph );
|
||||||
void drawLabels();
|
void drawLabels();
|
||||||
void drawLabel( const libglabels::Distance& x,
|
void drawLabel( const glabels::Distance& x,
|
||||||
const libglabels::Distance& y,
|
const glabels::Distance& y,
|
||||||
const QPainterPath& path );
|
const QPainterPath& path );
|
||||||
void drawArrow();
|
void drawArrow();
|
||||||
|
|
||||||
@@ -79,14 +76,13 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
const libglabels::Template *mTmplate;
|
const glabels::Template *mTmplate;
|
||||||
bool mRotateFlag;
|
bool mRotateFlag;
|
||||||
|
|
||||||
QGraphicsScene *mScene;
|
QGraphicsScene *mScene;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_SimplePreview_h
|
#endif // SimplePreview_h
|
||||||
|
|||||||
+24
-30
@@ -25,41 +25,38 @@
|
|||||||
#include "TemplatePickerItem.h"
|
#include "TemplatePickerItem.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
TemplatePicker::TemplatePicker( QWidget *parent ) : QListWidget(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
TemplatePicker::TemplatePicker( QWidget *parent ) : QListWidget(parent)
|
|
||||||
{
|
|
||||||
setViewMode( QListView::IconMode );
|
setViewMode( QListView::IconMode );
|
||||||
setResizeMode( QListView::Adjust );
|
setResizeMode( QListView::Adjust );
|
||||||
setSpacing( 24 );
|
setSpacing( 24 );
|
||||||
setWordWrap( true );
|
setWordWrap( true );
|
||||||
setUniformItemSizes( true );
|
setUniformItemSizes( true );
|
||||||
setIconSize( QSize(libglabels::TEMPLATE_PREVIEW_SIZE, libglabels::TEMPLATE_PREVIEW_SIZE) );
|
setIconSize( QSize(glabels::TEMPLATE_PREVIEW_SIZE, glabels::TEMPLATE_PREVIEW_SIZE) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Set List of Templates to Pick From
|
/// Set List of Templates to Pick From
|
||||||
///
|
///
|
||||||
void TemplatePicker::setTemplates( const QList <libglabels::Template*> &tmplates )
|
void TemplatePicker::setTemplates( const QList <glabels::Template*> &tmplates )
|
||||||
{
|
{
|
||||||
foreach (libglabels::Template *tmplate, tmplates)
|
foreach (glabels::Template *tmplate, tmplates)
|
||||||
{
|
{
|
||||||
TemplatePickerItem *item = new TemplatePickerItem( tmplate, this );
|
TemplatePickerItem *item = new TemplatePickerItem( tmplate, this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Apply Filter to Narrow Template Choices
|
/// Apply Filter to Narrow Template Choices
|
||||||
///
|
///
|
||||||
void TemplatePicker::applyFilter( const QString &searchString,
|
void TemplatePicker::applyFilter( const QString &searchString,
|
||||||
bool isoMask, bool usMask, bool otherMask )
|
bool isoMask, bool usMask, bool otherMask )
|
||||||
{
|
{
|
||||||
foreach ( QListWidgetItem *item, findItems( "*", Qt::MatchWildcard ) )
|
foreach ( QListWidgetItem *item, findItems( "*", Qt::MatchWildcard ) )
|
||||||
{
|
{
|
||||||
TemplatePickerItem *tItem = dynamic_cast<TemplatePickerItem *>(item);
|
TemplatePickerItem *tItem = dynamic_cast<TemplatePickerItem *>(item);
|
||||||
@@ -79,14 +76,14 @@ namespace glabels
|
|||||||
item->setSelected( false );
|
item->setSelected( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Get Currently Selected Template
|
/// Get Currently Selected Template
|
||||||
///
|
///
|
||||||
const libglabels::Template *TemplatePicker::selectedTemplate()
|
const glabels::Template *TemplatePicker::selectedTemplate()
|
||||||
{
|
{
|
||||||
QList<QListWidgetItem *> items = selectedItems();
|
QList<QListWidgetItem *> items = selectedItems();
|
||||||
if ( items.isEmpty() )
|
if ( items.isEmpty() )
|
||||||
{
|
{
|
||||||
@@ -97,7 +94,4 @@ namespace glabels
|
|||||||
TemplatePickerItem *tItem = dynamic_cast<TemplatePickerItem*>(items.first());
|
TemplatePickerItem *tItem = dynamic_cast<TemplatePickerItem*>(items.first());
|
||||||
return tItem->tmplate();
|
return tItem->tmplate();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-16
@@ -18,8 +18,8 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_TemplatePicker_h
|
#ifndef TemplatePicker_h
|
||||||
#define glabels_TemplatePicker_h
|
#define TemplatePicker_h
|
||||||
|
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
|
|
||||||
@@ -28,29 +28,26 @@
|
|||||||
#include "libglabels/Template.h"
|
#include "libglabels/Template.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Template Picker Widget
|
||||||
|
///
|
||||||
|
class TemplatePicker : public QListWidget
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Template Picker Widget
|
|
||||||
///
|
|
||||||
class TemplatePicker : public QListWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
TemplatePicker( QWidget *parent = 0 );
|
TemplatePicker( QWidget *parent = 0 );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void setTemplates( const QList <libglabels::Template*> &tmplates );
|
void setTemplates( const QList <glabels::Template*> &tmplates );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
@@ -58,10 +55,9 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
void applyFilter( const QString &searchString, bool isoMask, bool usMask, bool otherMask );
|
void applyFilter( const QString &searchString, bool isoMask, bool usMask, bool otherMask );
|
||||||
|
|
||||||
const libglabels::Template *selectedTemplate();
|
const glabels::Template *selectedTemplate();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_TemplatePicker_h
|
#endif // TemplatePicker_h
|
||||||
|
|||||||
@@ -25,32 +25,27 @@
|
|||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Constructor
|
||||||
|
///
|
||||||
///
|
TemplatePickerItem::TemplatePickerItem( glabels::Template *tmplate,
|
||||||
/// Constructor
|
|
||||||
///
|
|
||||||
TemplatePickerItem::TemplatePickerItem( libglabels::Template *tmplate,
|
|
||||||
QListWidget *parent )
|
QListWidget *parent )
|
||||||
: QListWidgetItem(parent)
|
: QListWidgetItem(parent)
|
||||||
{
|
{
|
||||||
mTmplate = tmplate;
|
mTmplate = tmplate;
|
||||||
|
|
||||||
setIcon( QIcon(tmplate->preview()) );
|
setIcon( QIcon(tmplate->preview()) );
|
||||||
setText( tmplate->name() );
|
setText( tmplate->name() );
|
||||||
|
|
||||||
setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
|
setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Template Property Getter
|
/// Template Property Getter
|
||||||
///
|
///
|
||||||
const libglabels::Template *TemplatePickerItem::tmplate() const
|
const glabels::Template *TemplatePickerItem::tmplate() const
|
||||||
{
|
{
|
||||||
return mTmplate;
|
return mTmplate;
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_TemplatePickerItem_h
|
#ifndef TemplatePickerItem_h
|
||||||
#define glabels_TemplatePickerItem_h
|
#define TemplatePickerItem_h
|
||||||
|
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
|
|
||||||
@@ -28,37 +28,33 @@
|
|||||||
#include "libglabels/Template.h"
|
#include "libglabels/Template.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Template Picker Item Widget
|
||||||
|
///
|
||||||
|
class TemplatePickerItem : public QListWidgetItem
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Template Picker Item Widget
|
|
||||||
///
|
|
||||||
class TemplatePickerItem : public QListWidgetItem
|
|
||||||
{
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
TemplatePickerItem( libglabels::Template *tmplate, QListWidget *parent = 0 );
|
TemplatePickerItem( glabels::Template *tmplate, QListWidget *parent = 0 );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
const libglabels::Template *tmplate() const;
|
const glabels::Template *tmplate() const;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
libglabels::Template *mTmplate;
|
glabels::Template *mTmplate;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_TemplatePickerItem_h
|
#endif // TemplatePickerItem_h
|
||||||
|
|||||||
+42
-48
@@ -33,32 +33,29 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
{
|
/// Default Constructor
|
||||||
|
///
|
||||||
///
|
TextNode::TextNode()
|
||||||
/// Default Constructor
|
|
||||||
///
|
|
||||||
TextNode::TextNode()
|
|
||||||
: mFieldFlag(false), mData("")
|
: mFieldFlag(false), mData("")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Constructor from Data
|
/// Constructor from Data
|
||||||
///
|
///
|
||||||
TextNode::TextNode( bool field_flag, const QString &data )
|
TextNode::TextNode( bool field_flag, const QString &data )
|
||||||
: mFieldFlag(field_flag), mData(data)
|
: mFieldFlag(field_flag), mData(data)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Constructor from Parsing Next Token in Text
|
/// Constructor from Parsing Next Token in Text
|
||||||
///
|
///
|
||||||
TextNode::TextNode( const QString &text, int i_start, int &i_next )
|
TextNode::TextNode( const QString &text, int i_start, int &i_next )
|
||||||
{
|
{
|
||||||
State state = START;
|
State state = START;
|
||||||
QString literal_text;
|
QString literal_text;
|
||||||
QString field_name;
|
QString field_name;
|
||||||
@@ -200,45 +197,45 @@ namespace glabels
|
|||||||
mData = field_flag ? field_name : literal_text;
|
mData = field_flag ? field_name : literal_text;
|
||||||
|
|
||||||
i_next = i;
|
i_next = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// == Operator
|
/// == Operator
|
||||||
///
|
///
|
||||||
bool TextNode::operator==( const TextNode& other )
|
bool TextNode::operator==( const TextNode& other )
|
||||||
{
|
{
|
||||||
return ( (mFieldFlag == other.mFieldFlag) &&
|
return ( (mFieldFlag == other.mFieldFlag) &&
|
||||||
(mData == other.mData) );
|
(mData == other.mData) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// != Operator
|
/// != Operator
|
||||||
///
|
///
|
||||||
bool TextNode::operator!=( const TextNode& other )
|
bool TextNode::operator!=( const TextNode& other )
|
||||||
{
|
{
|
||||||
return ( (mFieldFlag != other.mFieldFlag) ||
|
return ( (mFieldFlag != other.mFieldFlag) ||
|
||||||
(mData != other.mData) );
|
(mData != other.mData) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Field Flag Property Getter
|
/// Field Flag Property Getter
|
||||||
///
|
///
|
||||||
bool TextNode::fieldFlag( void ) const
|
bool TextNode::fieldFlag( void ) const
|
||||||
{
|
{
|
||||||
return mFieldFlag;
|
return mFieldFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Data Property Getter
|
/// Data Property Getter
|
||||||
///
|
///
|
||||||
const QString& TextNode::data( void ) const
|
const QString& TextNode::data( void ) const
|
||||||
{
|
{
|
||||||
return mData;
|
return mData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if TODO
|
#if TODO
|
||||||
@@ -285,6 +282,3 @@ namespace glabels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
+12
-16
@@ -18,25 +18,22 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_TextNode_h
|
#ifndef TextNode_h
|
||||||
#define glabels_TextNode_h
|
#define TextNode_h
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
///
|
||||||
|
/// Text Node Type
|
||||||
|
///
|
||||||
|
struct TextNode
|
||||||
{
|
{
|
||||||
|
|
||||||
///
|
|
||||||
/// Text Node Type
|
|
||||||
///
|
|
||||||
struct TextNode
|
|
||||||
{
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Life Cycle
|
// Life Cycle
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
TextNode();
|
TextNode();
|
||||||
|
|
||||||
TextNode( bool field_flag, const QString &data );
|
TextNode( bool field_flag, const QString &data );
|
||||||
@@ -47,7 +44,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Operators
|
// Operators
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
bool operator==( const TextNode& other );
|
bool operator==( const TextNode& other );
|
||||||
|
|
||||||
bool operator!=( const TextNode& other );
|
bool operator!=( const TextNode& other );
|
||||||
@@ -56,7 +53,7 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Properties
|
// Properties
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// Field Flag Property
|
// Field Flag Property
|
||||||
//
|
//
|
||||||
@@ -81,13 +78,12 @@ namespace glabels
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Data
|
// Private Data
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool mFieldFlag;
|
bool mFieldFlag;
|
||||||
QString mData;
|
QString mData;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_TextNode_h
|
#endif // TextNode_h
|
||||||
|
|||||||
+71
-55
@@ -59,7 +59,7 @@ namespace
|
|||||||
|
|
||||||
const QColor gridLineColor( 192, 192, 192 );
|
const QColor gridLineColor( 192, 192, 192 );
|
||||||
const double gridLineWidthPixels = 1;
|
const double gridLineWidthPixels = 1;
|
||||||
const libglabels::Distance gridSpacing = libglabels::Distance::pt(9); // TODO: determine from locale.
|
const glabels::Distance gridSpacing = glabels::Distance::pt(9); // TODO: determine from locale.
|
||||||
|
|
||||||
const QColor markupLineColor( 240, 99, 99 );
|
const QColor markupLineColor( 240, 99, 99 );
|
||||||
const double markupLineWidthPixels = 1;
|
const double markupLineWidthPixels = 1;
|
||||||
@@ -74,7 +74,7 @@ namespace
|
|||||||
///
|
///
|
||||||
/// Constructor
|
/// Constructor
|
||||||
///
|
///
|
||||||
glabels::View::View( QScrollArea* scrollArea, QWidget* parent )
|
View::View( QScrollArea* scrollArea, QWidget* parent )
|
||||||
: QWidget(parent), mScrollArea(scrollArea)
|
: QWidget(parent), mScrollArea(scrollArea)
|
||||||
{
|
{
|
||||||
mState = IdleState;
|
mState = IdleState;
|
||||||
@@ -92,7 +92,7 @@ glabels::View::View( QScrollArea* scrollArea, QWidget* parent )
|
|||||||
/// Zoom property
|
/// Zoom property
|
||||||
///
|
///
|
||||||
double
|
double
|
||||||
glabels::View::zoom() const
|
View::zoom() const
|
||||||
{
|
{
|
||||||
return mZoom;
|
return mZoom;
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@ glabels::View::zoom() const
|
|||||||
/// Markup visible? property
|
/// Markup visible? property
|
||||||
///
|
///
|
||||||
bool
|
bool
|
||||||
glabels::View::markupVisible() const
|
View::markupVisible() const
|
||||||
{
|
{
|
||||||
return mMarkupVisible;
|
return mMarkupVisible;
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ glabels::View::markupVisible() const
|
|||||||
/// Grid visible? property
|
/// Grid visible? property
|
||||||
///
|
///
|
||||||
bool
|
bool
|
||||||
glabels::View::qridVisible() const
|
View::qridVisible() const
|
||||||
{
|
{
|
||||||
return mGridVisible;
|
return mGridVisible;
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ glabels::View::qridVisible() const
|
|||||||
/// Model Parameter Setter
|
/// Model Parameter Setter
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::setModel( LabelModel* model )
|
View::setModel( LabelModel* model )
|
||||||
{
|
{
|
||||||
mModel = model;
|
mModel = model;
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ glabels::View::setModel( LabelModel* model )
|
|||||||
/// Grid Visibility Parameter Setter
|
/// Grid Visibility Parameter Setter
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::setGridVisible( bool visibleFlag )
|
View::setGridVisible( bool visibleFlag )
|
||||||
{
|
{
|
||||||
mGridVisible = visibleFlag;
|
mGridVisible = visibleFlag;
|
||||||
update();
|
update();
|
||||||
@@ -154,7 +154,7 @@ glabels::View::setGridVisible( bool visibleFlag )
|
|||||||
/// Markup Visibility Parameter Setter
|
/// Markup Visibility Parameter Setter
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::setMarkupVisible( bool visibleFlag )
|
View::setMarkupVisible( bool visibleFlag )
|
||||||
{
|
{
|
||||||
mMarkupVisible = visibleFlag;
|
mMarkupVisible = visibleFlag;
|
||||||
update();
|
update();
|
||||||
@@ -165,7 +165,7 @@ glabels::View::setMarkupVisible( bool visibleFlag )
|
|||||||
/// Zoom In "One Notch"
|
/// Zoom In "One Notch"
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::zoomIn()
|
View::zoomIn()
|
||||||
{
|
{
|
||||||
// Find closest standard zoom level to our current zoom
|
// Find closest standard zoom level to our current zoom
|
||||||
// Start with 2nd largest scale
|
// Start with 2nd largest scale
|
||||||
@@ -191,7 +191,7 @@ glabels::View::zoomIn()
|
|||||||
/// Zoom Out "One Notch"
|
/// Zoom Out "One Notch"
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::zoomOut()
|
View::zoomOut()
|
||||||
{
|
{
|
||||||
// Find closest standard zoom level to our current zoom
|
// Find closest standard zoom level to our current zoom
|
||||||
// Start with largest scale, end on 2nd smallest
|
// Start with largest scale, end on 2nd smallest
|
||||||
@@ -217,7 +217,7 @@ glabels::View::zoomOut()
|
|||||||
/// Zoom To 1:1 Scale
|
/// Zoom To 1:1 Scale
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::zoom1To1()
|
View::zoom1To1()
|
||||||
{
|
{
|
||||||
setZoomReal( 1.0, false );
|
setZoomReal( 1.0, false );
|
||||||
}
|
}
|
||||||
@@ -227,7 +227,7 @@ glabels::View::zoom1To1()
|
|||||||
/// Zoom To Fit
|
/// Zoom To Fit
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::zoomToFit()
|
View::zoomToFit()
|
||||||
{
|
{
|
||||||
using std::min;
|
using std::min;
|
||||||
using std::max;
|
using std::max;
|
||||||
@@ -251,7 +251,7 @@ glabels::View::zoomToFit()
|
|||||||
/// Is Zoom at Maximum?
|
/// Is Zoom at Maximum?
|
||||||
///
|
///
|
||||||
bool
|
bool
|
||||||
glabels::View::isZoomMax() const
|
View::isZoomMax() const
|
||||||
{
|
{
|
||||||
return ( mZoom >= zoomLevels[0] );
|
return ( mZoom >= zoomLevels[0] );
|
||||||
}
|
}
|
||||||
@@ -261,7 +261,7 @@ glabels::View::isZoomMax() const
|
|||||||
/// Is Zoom at Minimum?
|
/// Is Zoom at Minimum?
|
||||||
///
|
///
|
||||||
bool
|
bool
|
||||||
glabels::View::isZoomMin() const
|
View::isZoomMin() const
|
||||||
{
|
{
|
||||||
return ( mZoom <= zoomLevels[nZoomLevels-1] );
|
return ( mZoom <= zoomLevels[nZoomLevels-1] );
|
||||||
}
|
}
|
||||||
@@ -271,7 +271,7 @@ glabels::View::isZoomMin() const
|
|||||||
/// Set Zoom to Value
|
/// Set Zoom to Value
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::setZoomReal( double zoom, bool zoomToFitFlag )
|
View::setZoomReal( double zoom, bool zoomToFitFlag )
|
||||||
{
|
{
|
||||||
mZoom = zoom;
|
mZoom = zoom;
|
||||||
mZoomToFitFlag = zoomToFitFlag;
|
mZoomToFitFlag = zoomToFitFlag;
|
||||||
@@ -296,7 +296,7 @@ glabels::View::setZoomReal( double zoom, bool zoomToFitFlag )
|
|||||||
/// Arrow mode (normal mode)
|
/// Arrow mode (normal mode)
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::arrowMode()
|
View::arrowMode()
|
||||||
{
|
{
|
||||||
setCursor( Qt::ArrowCursor );
|
setCursor( Qt::ArrowCursor );
|
||||||
|
|
||||||
@@ -308,7 +308,7 @@ glabels::View::arrowMode()
|
|||||||
/// Create box mode
|
/// Create box mode
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::createBoxMode()
|
View::createBoxMode()
|
||||||
{
|
{
|
||||||
setCursor( Cursors::Box() );
|
setCursor( Cursors::Box() );
|
||||||
|
|
||||||
@@ -321,7 +321,7 @@ glabels::View::createBoxMode()
|
|||||||
/// Resize Event Handler
|
/// Resize Event Handler
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::resizeEvent( QResizeEvent *event )
|
View::resizeEvent( QResizeEvent *event )
|
||||||
{
|
{
|
||||||
if ( mModel )
|
if ( mModel )
|
||||||
{
|
{
|
||||||
@@ -345,7 +345,7 @@ glabels::View::resizeEvent( QResizeEvent *event )
|
|||||||
/// Mouse Button Press Event Handler
|
/// Mouse Button Press Event Handler
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::mousePressEvent( QMouseEvent* event )
|
View::mousePressEvent( QMouseEvent* event )
|
||||||
{
|
{
|
||||||
if ( mModel )
|
if ( mModel )
|
||||||
{
|
{
|
||||||
@@ -358,8 +358,8 @@ glabels::View::mousePressEvent( QMouseEvent* event )
|
|||||||
transform.translate( mX0.pt(), mY0.pt() );
|
transform.translate( mX0.pt(), mY0.pt() );
|
||||||
|
|
||||||
QPointF pWorld = transform.inverted().map( event->posF() );
|
QPointF pWorld = transform.inverted().map( event->posF() );
|
||||||
libglabels::Distance xWorld = libglabels::Distance::pt( pWorld.x() );
|
glabels::Distance xWorld = glabels::Distance::pt( pWorld.x() );
|
||||||
libglabels::Distance yWorld = libglabels::Distance::pt( pWorld.y() );
|
glabels::Distance yWorld = glabels::Distance::pt( pWorld.y() );
|
||||||
|
|
||||||
|
|
||||||
if ( event->button() & Qt::LeftButton )
|
if ( event->button() & Qt::LeftButton )
|
||||||
@@ -511,7 +511,7 @@ glabels::View::mousePressEvent( QMouseEvent* event )
|
|||||||
/// Mouse Movement Event Handler
|
/// Mouse Movement Event Handler
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::mouseMoveEvent( QMouseEvent* event )
|
View::mouseMoveEvent( QMouseEvent* event )
|
||||||
{
|
{
|
||||||
using std::min;
|
using std::min;
|
||||||
using std::max;
|
using std::max;
|
||||||
@@ -527,8 +527,8 @@ glabels::View::mouseMoveEvent( QMouseEvent* event )
|
|||||||
transform.translate( mX0.pt(), mY0.pt() );
|
transform.translate( mX0.pt(), mY0.pt() );
|
||||||
|
|
||||||
QPointF pWorld = transform.inverted().map( event->posF() );
|
QPointF pWorld = transform.inverted().map( event->posF() );
|
||||||
libglabels::Distance xWorld = libglabels::Distance::pt( pWorld.x() );
|
glabels::Distance xWorld = glabels::Distance::pt( pWorld.x() );
|
||||||
libglabels::Distance yWorld = libglabels::Distance::pt( pWorld.y() );
|
glabels::Distance yWorld = glabels::Distance::pt( pWorld.y() );
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -615,7 +615,7 @@ glabels::View::mouseMoveEvent( QMouseEvent* event )
|
|||||||
/// Mouse Button Release Event Handler
|
/// Mouse Button Release Event Handler
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::mouseReleaseEvent( QMouseEvent* event )
|
View::mouseReleaseEvent( QMouseEvent* event )
|
||||||
{
|
{
|
||||||
if ( mModel )
|
if ( mModel )
|
||||||
{
|
{
|
||||||
@@ -628,8 +628,8 @@ glabels::View::mouseReleaseEvent( QMouseEvent* event )
|
|||||||
transform.translate( mX0.pt(), mY0.pt() );
|
transform.translate( mX0.pt(), mY0.pt() );
|
||||||
|
|
||||||
QPointF pWorld = transform.inverted().map( event->posF() );
|
QPointF pWorld = transform.inverted().map( event->posF() );
|
||||||
libglabels::Distance xWorld = libglabels::Distance::pt( pWorld.x() );
|
glabels::Distance xWorld = glabels::Distance::pt( pWorld.x() );
|
||||||
libglabels::Distance yWorld = libglabels::Distance::pt( pWorld.y() );
|
glabels::Distance yWorld = glabels::Distance::pt( pWorld.y() );
|
||||||
|
|
||||||
|
|
||||||
if ( event->button() & Qt::LeftButton )
|
if ( event->button() & Qt::LeftButton )
|
||||||
@@ -691,7 +691,7 @@ glabels::View::mouseReleaseEvent( QMouseEvent* event )
|
|||||||
/// Leave Event Handler
|
/// Leave Event Handler
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::leaveEvent( QEvent* event )
|
View::leaveEvent( QEvent* event )
|
||||||
{
|
{
|
||||||
if ( mModel )
|
if ( mModel )
|
||||||
{
|
{
|
||||||
@@ -704,8 +704,8 @@ glabels::View::leaveEvent( QEvent* event )
|
|||||||
/// Handle resize motion
|
/// Handle resize motion
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::handleResizeMotion( const libglabels::Distance& xWorld,
|
View::handleResizeMotion( const glabels::Distance& xWorld,
|
||||||
const libglabels::Distance& yWorld )
|
const glabels::Distance& yWorld )
|
||||||
{
|
{
|
||||||
QPointF p( xWorld.pt(), yWorld.pt() );
|
QPointF p( xWorld.pt(), yWorld.pt() );
|
||||||
Handle::Location location = mResizeHandle->location();
|
Handle::Location location = mResizeHandle->location();
|
||||||
@@ -795,22 +795,22 @@ glabels::View::handleResizeMotion( const libglabels::Distance& xWorld,
|
|||||||
{
|
{
|
||||||
case Handle::E:
|
case Handle::E:
|
||||||
case Handle::W:
|
case Handle::W:
|
||||||
mResizeObject->setWHonorAspect( libglabels::Distance::pt(w) );
|
mResizeObject->setWHonorAspect( glabels::Distance::pt(w) );
|
||||||
break;
|
break;
|
||||||
case Handle::N:
|
case Handle::N:
|
||||||
case Handle::S:
|
case Handle::S:
|
||||||
mResizeObject->setHHonorAspect( libglabels::Distance::pt(h) );
|
mResizeObject->setHHonorAspect( glabels::Distance::pt(h) );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mResizeObject->setSizeHonorAspect( libglabels::Distance::pt(w),
|
mResizeObject->setSizeHonorAspect( glabels::Distance::pt(w),
|
||||||
libglabels::Distance::pt(h) );
|
glabels::Distance::pt(h) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mResizeObject->setSize( libglabels::Distance::pt(w),
|
mResizeObject->setSize( glabels::Distance::pt(w),
|
||||||
libglabels::Distance::pt(h) );
|
glabels::Distance::pt(h) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -836,8 +836,8 @@ glabels::View::handleResizeMotion( const libglabels::Distance& xWorld,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mResizeObject->setSize( libglabels::Distance::pt(w),
|
mResizeObject->setSize( glabels::Distance::pt(w),
|
||||||
libglabels::Distance::pt(h) );
|
glabels::Distance::pt(h) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -846,8 +846,8 @@ glabels::View::handleResizeMotion( const libglabels::Distance& xWorld,
|
|||||||
QPointF p0( x0, y0 );
|
QPointF p0( x0, y0 );
|
||||||
p0 = mResizeObject->matrix().map( p0 );
|
p0 = mResizeObject->matrix().map( p0 );
|
||||||
p0 += QPointF( mResizeObject->x0().pt(), mResizeObject->y0().pt() );
|
p0 += QPointF( mResizeObject->x0().pt(), mResizeObject->y0().pt() );
|
||||||
mResizeObject->setPosition( libglabels::Distance::pt(p0.x()),
|
mResizeObject->setPosition( glabels::Distance::pt(p0.x()),
|
||||||
libglabels::Distance::pt(p0.y()) );
|
glabels::Distance::pt(p0.y()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -855,7 +855,7 @@ glabels::View::handleResizeMotion( const libglabels::Distance& xWorld,
|
|||||||
/// Paint Event Handler
|
/// Paint Event Handler
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::paintEvent( QPaintEvent* event )
|
View::paintEvent( QPaintEvent* event )
|
||||||
{
|
{
|
||||||
if ( mModel )
|
if ( mModel )
|
||||||
{
|
{
|
||||||
@@ -890,7 +890,7 @@ glabels::View::paintEvent( QPaintEvent* event )
|
|||||||
/// Draw Background Layer
|
/// Draw Background Layer
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::drawBgLayer( QPainter* painter )
|
View::drawBgLayer( QPainter* painter )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Draw shadow
|
* Draw shadow
|
||||||
@@ -935,15 +935,15 @@ glabels::View::drawBgLayer( QPainter* painter )
|
|||||||
/// Draw Grid Layer
|
/// Draw Grid Layer
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::drawGridLayer( QPainter* painter )
|
View::drawGridLayer( QPainter* painter )
|
||||||
{
|
{
|
||||||
if ( mGridVisible )
|
if ( mGridVisible )
|
||||||
{
|
{
|
||||||
libglabels::Distance w = mModel->frame()->w();
|
glabels::Distance w = mModel->frame()->w();
|
||||||
libglabels::Distance h = mModel->frame()->h();
|
glabels::Distance h = mModel->frame()->h();
|
||||||
|
|
||||||
libglabels::Distance x0, y0;
|
glabels::Distance x0, y0;
|
||||||
if ( dynamic_cast<const libglabels::FrameRect*>( mModel->frame() ) )
|
if ( dynamic_cast<const glabels::FrameRect*>( mModel->frame() ) )
|
||||||
{
|
{
|
||||||
x0 = gridSpacing;
|
x0 = gridSpacing;
|
||||||
y0 = gridSpacing;
|
y0 = gridSpacing;
|
||||||
@@ -968,12 +968,12 @@ glabels::View::drawGridLayer( QPainter* painter )
|
|||||||
pen.setCosmetic( true );
|
pen.setCosmetic( true );
|
||||||
painter->setPen( pen );
|
painter->setPen( pen );
|
||||||
|
|
||||||
for ( libglabels::Distance x = x0; x < w; x += gridSpacing )
|
for ( glabels::Distance x = x0; x < w; x += gridSpacing )
|
||||||
{
|
{
|
||||||
painter->drawLine( x.pt(), 0, x.pt(), h.pt() );
|
painter->drawLine( x.pt(), 0, x.pt(), h.pt() );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( libglabels::Distance y = y0; y < h; y += gridSpacing )
|
for ( glabels::Distance y = y0; y < h; y += gridSpacing )
|
||||||
{
|
{
|
||||||
painter->drawLine( 0, y.pt(), w.pt(), y.pt() );
|
painter->drawLine( 0, y.pt(), w.pt(), y.pt() );
|
||||||
}
|
}
|
||||||
@@ -987,7 +987,7 @@ glabels::View::drawGridLayer( QPainter* painter )
|
|||||||
/// Draw Markup Layer
|
/// Draw Markup Layer
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::drawMarkupLayer( QPainter* painter )
|
View::drawMarkupLayer( QPainter* painter )
|
||||||
{
|
{
|
||||||
if ( mMarkupVisible )
|
if ( mMarkupVisible )
|
||||||
{
|
{
|
||||||
@@ -1002,7 +1002,7 @@ glabels::View::drawMarkupLayer( QPainter* painter )
|
|||||||
painter->translate( -mModel->frame()->w().pt(), 0 );
|
painter->translate( -mModel->frame()->w().pt(), 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach( libglabels::Markup* markup, mModel->frame()->markups() )
|
foreach( glabels::Markup* markup, mModel->frame()->markups() )
|
||||||
{
|
{
|
||||||
painter->drawPath( markup->path() );
|
painter->drawPath( markup->path() );
|
||||||
}
|
}
|
||||||
@@ -1016,7 +1016,7 @@ glabels::View::drawMarkupLayer( QPainter* painter )
|
|||||||
/// Draw Objects Layer
|
/// Draw Objects Layer
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::drawObjectsLayer( QPainter* painter )
|
View::drawObjectsLayer( QPainter* painter )
|
||||||
{
|
{
|
||||||
mModel->draw( painter );
|
mModel->draw( painter );
|
||||||
}
|
}
|
||||||
@@ -1026,7 +1026,7 @@ glabels::View::drawObjectsLayer( QPainter* painter )
|
|||||||
/// Draw Foreground Layer
|
/// Draw Foreground Layer
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::drawFgLayer( QPainter* painter )
|
View::drawFgLayer( QPainter* painter )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Draw label outline
|
* Draw label outline
|
||||||
@@ -1053,7 +1053,7 @@ glabels::View::drawFgLayer( QPainter* painter )
|
|||||||
/// Draw Highlight Layer
|
/// Draw Highlight Layer
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::drawHighlightLayer( QPainter* painter )
|
View::drawHighlightLayer( QPainter* painter )
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
@@ -1073,7 +1073,7 @@ glabels::View::drawHighlightLayer( QPainter* painter )
|
|||||||
/// Draw Select Region Layer
|
/// Draw Select Region Layer
|
||||||
///
|
///
|
||||||
void
|
void
|
||||||
glabels::View::drawSelectRegionLayer( QPainter* painter )
|
View::drawSelectRegionLayer( QPainter* painter )
|
||||||
{
|
{
|
||||||
if ( mSelectRegionVisible )
|
if ( mSelectRegionVisible )
|
||||||
{
|
{
|
||||||
@@ -1090,3 +1090,19 @@ glabels::View::drawSelectRegionLayer( QPainter* painter )
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Model changed handler
|
||||||
|
///
|
||||||
|
void View::onModelChanged()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Model size changed handler
|
||||||
|
///
|
||||||
|
void View::onModelSizeChanged()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|||||||
+35
-41
@@ -18,8 +18,8 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_View_h
|
#ifndef View_h
|
||||||
#define glabels_View_h
|
#define View_h
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
@@ -28,35 +28,33 @@
|
|||||||
#include "LabelRegion.h"
|
#include "LabelRegion.h"
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
// Forward References
|
||||||
|
class LabelModel;
|
||||||
|
class LabelModelObject;
|
||||||
|
class Handle;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// View Widget
|
||||||
|
///
|
||||||
|
class View : public QWidget
|
||||||
{
|
{
|
||||||
// Forward References
|
|
||||||
class LabelModel;
|
|
||||||
class LabelModelObject;
|
|
||||||
class Handle;
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// View Widget
|
|
||||||
///
|
|
||||||
class View : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Lifecycle
|
// Lifecycle
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
View( QScrollArea* scrollArea, QWidget* parent = 0 );
|
View( QScrollArea* scrollArea, QWidget* parent = 0 );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Signals
|
// Signals
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
signals:
|
signals:
|
||||||
void contextMenuActivate();
|
void contextMenuActivate();
|
||||||
void zoomChanged();
|
void zoomChanged();
|
||||||
void pointerMoved( const libglabels::Distance& x, const libglabels::Distance& y );
|
void pointerMoved( const glabels::Distance& x, const glabels::Distance& y );
|
||||||
void pointerExited();
|
void pointerExited();
|
||||||
void modeChanged();
|
void modeChanged();
|
||||||
|
|
||||||
@@ -64,7 +62,7 @@ namespace glabels
|
|||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Parameters
|
// Parameters
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
double zoom() const;
|
double zoom() const;
|
||||||
bool markupVisible() const;
|
bool markupVisible() const;
|
||||||
bool qridVisible() const;
|
bool qridVisible() const;
|
||||||
@@ -73,14 +71,14 @@ namespace glabels
|
|||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Model
|
// Model
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void setModel( LabelModel* model );
|
void setModel( LabelModel* model );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Visibility operations
|
// Visibility operations
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void setGridVisible( bool visibleFlag );
|
void setGridVisible( bool visibleFlag );
|
||||||
void setMarkupVisible( bool visibleFlag );
|
void setMarkupVisible( bool visibleFlag );
|
||||||
|
|
||||||
@@ -88,21 +86,21 @@ namespace glabels
|
|||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Zoom operations
|
// Zoom operations
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void zoomIn();
|
void zoomIn();
|
||||||
void zoomOut();
|
void zoomOut();
|
||||||
void zoom1To1();
|
void zoom1To1();
|
||||||
void zoomToFit();
|
void zoomToFit();
|
||||||
bool isZoomMax() const;
|
bool isZoomMax() const;
|
||||||
bool isZoomMin() const;
|
bool isZoomMin() const;
|
||||||
private:
|
private:
|
||||||
void setZoomReal( double zoom, bool zoomToFitFlag );
|
void setZoomReal( double zoom, bool zoomToFitFlag );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Mode operations
|
// Mode operations
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void arrowMode();
|
void arrowMode();
|
||||||
void createBoxMode();
|
void createBoxMode();
|
||||||
void createEllipseMode();
|
void createEllipseMode();
|
||||||
@@ -115,7 +113,7 @@ namespace glabels
|
|||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Event handlers
|
// Event handlers
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent( QResizeEvent* event );
|
void resizeEvent( QResizeEvent* event );
|
||||||
void mousePressEvent( QMouseEvent* event );
|
void mousePressEvent( QMouseEvent* event );
|
||||||
void mouseMoveEvent( QMouseEvent* event );
|
void mouseMoveEvent( QMouseEvent* event );
|
||||||
@@ -127,9 +125,9 @@ namespace glabels
|
|||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Private methods
|
// Private methods
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
private:
|
private:
|
||||||
void handleResizeMotion( const libglabels::Distance& xWorld,
|
void handleResizeMotion( const glabels::Distance& xWorld,
|
||||||
const libglabels::Distance& yWorld );
|
const glabels::Distance& yWorld );
|
||||||
|
|
||||||
void drawBgLayer( QPainter* painter );
|
void drawBgLayer( QPainter* painter );
|
||||||
void drawGridLayer( QPainter* painter );
|
void drawGridLayer( QPainter* painter );
|
||||||
@@ -143,7 +141,7 @@ namespace glabels
|
|||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Private slots
|
// Private slots
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
private:
|
private slots:
|
||||||
void onModelChanged();
|
void onModelChanged();
|
||||||
void onModelSizeChanged();
|
void onModelSizeChanged();
|
||||||
|
|
||||||
@@ -151,7 +149,7 @@ namespace glabels
|
|||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Private data
|
// Private data
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
private:
|
private:
|
||||||
enum State {
|
enum State {
|
||||||
IdleState,
|
IdleState,
|
||||||
ArrowSelectRegion,
|
ArrowSelectRegion,
|
||||||
@@ -175,8 +173,8 @@ namespace glabels
|
|||||||
double mZoom;
|
double mZoom;
|
||||||
bool mZoomToFitFlag;
|
bool mZoomToFitFlag;
|
||||||
double mScale;
|
double mScale;
|
||||||
libglabels::Distance mX0;
|
glabels::Distance mX0;
|
||||||
libglabels::Distance mY0;
|
glabels::Distance mY0;
|
||||||
|
|
||||||
bool mMarkupVisible;
|
bool mMarkupVisible;
|
||||||
bool mGridVisible;
|
bool mGridVisible;
|
||||||
@@ -192,8 +190,8 @@ namespace glabels
|
|||||||
LabelRegion mSelectRegion;
|
LabelRegion mSelectRegion;
|
||||||
|
|
||||||
/* ArrowMove state */
|
/* ArrowMove state */
|
||||||
libglabels::Distance mMoveLastX;
|
glabels::Distance mMoveLastX;
|
||||||
libglabels::Distance mMoveLastY;
|
glabels::Distance mMoveLastY;
|
||||||
|
|
||||||
/* ArrowResize state */
|
/* ArrowResize state */
|
||||||
LabelModelObject* mResizeObject;
|
LabelModelObject* mResizeObject;
|
||||||
@@ -203,15 +201,11 @@ namespace glabels
|
|||||||
/* CreateDrag state */
|
/* CreateDrag state */
|
||||||
CreateType mCreateObjectType;
|
CreateType mCreateObjectType;
|
||||||
LabelModelObject* mCreateObject;
|
LabelModelObject* mCreateObject;
|
||||||
libglabels::Distance mCreateX0;
|
glabels::Distance mCreateX0;
|
||||||
libglabels::Distance mCreateY0;
|
glabels::Distance mCreateY0;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
#endif // View_h
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // glabels_View_h
|
|
||||||
|
|||||||
+41
-41
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::writeFile( const LabelModel* label, const QString& fileName )
|
XmlLabelCreator::writeFile( const LabelModel* label, const QString& fileName )
|
||||||
{
|
{
|
||||||
QDomDocument doc;
|
QDomDocument doc;
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ glabels::XmlLabelCreator::writeFile( const LabelModel* label, const QString& fil
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::writeBuffer( const LabelModel* label, QString& buffer )
|
XmlLabelCreator::writeBuffer( const LabelModel* label, QString& buffer )
|
||||||
{
|
{
|
||||||
QDomDocument doc;
|
QDomDocument doc;
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ glabels::XmlLabelCreator::writeBuffer( const LabelModel* label, QString& buffer
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::createDoc( QDomDocument& doc, const LabelModel* label )
|
XmlLabelCreator::createDoc( QDomDocument& doc, const LabelModel* label )
|
||||||
{
|
{
|
||||||
QDomNode xmlNode( doc.createProcessingInstruction( "xml", "version=\"1.0\"" ) );
|
QDomNode xmlNode( doc.createProcessingInstruction( "xml", "version=\"1.0\"" ) );
|
||||||
doc.appendChild( xmlNode );
|
doc.appendChild( xmlNode );
|
||||||
@@ -74,7 +74,7 @@ glabels::XmlLabelCreator::createDoc( QDomDocument& doc, const LabelModel* label
|
|||||||
QDomElement root = doc.createElement( "Glabels-document" );
|
QDomElement root = doc.createElement( "Glabels-document" );
|
||||||
doc.appendChild( root );
|
doc.appendChild( root );
|
||||||
|
|
||||||
libglabels::XmlTemplateCreator().createTemplateNode( root, label->tmplate() );
|
glabels::XmlTemplateCreator().createTemplateNode( root, label->tmplate() );
|
||||||
|
|
||||||
createObjectsNode( root, label );
|
createObjectsNode( root, label );
|
||||||
|
|
||||||
@@ -85,14 +85,14 @@ glabels::XmlLabelCreator::createDoc( QDomDocument& doc, const LabelModel* label
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::createObjectsNode( QDomElement &parent, const LabelModel* label )
|
XmlLabelCreator::createObjectsNode( QDomElement &parent, const LabelModel* label )
|
||||||
{
|
{
|
||||||
QDomDocument doc = parent.ownerDocument();
|
QDomDocument doc = parent.ownerDocument();
|
||||||
QDomElement node = doc.createElement( "Objects" );
|
QDomElement node = doc.createElement( "Objects" );
|
||||||
parent.appendChild( node );
|
parent.appendChild( node );
|
||||||
|
|
||||||
libglabels::XmlUtil::setStringAttr( node, "id", "0" );
|
glabels::XmlUtil::setStringAttr( node, "id", "0" );
|
||||||
libglabels::XmlUtil::setBoolAttr( node, "rotate", label->rotate() );
|
glabels::XmlUtil::setBoolAttr( node, "rotate", label->rotate() );
|
||||||
|
|
||||||
foreach ( LabelModelObject* object, label->objectList() )
|
foreach ( LabelModelObject* object, label->objectList() )
|
||||||
{
|
{
|
||||||
@@ -110,39 +110,39 @@ glabels::XmlLabelCreator::createObjectsNode( QDomElement &parent, const LabelMod
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::createObjectBoxNode( QDomElement &parent, const LabelModelBoxObject* object )
|
XmlLabelCreator::createObjectBoxNode( QDomElement &parent, const LabelModelBoxObject* object )
|
||||||
{
|
{
|
||||||
QDomDocument doc = parent.ownerDocument();
|
QDomDocument doc = parent.ownerDocument();
|
||||||
QDomElement node = doc.createElement( "Object-box" );
|
QDomElement node = doc.createElement( "Object-box" );
|
||||||
parent.appendChild( node );
|
parent.appendChild( node );
|
||||||
|
|
||||||
/* position attrs */
|
/* position attrs */
|
||||||
libglabels::XmlUtil::setLengthAttr( node, "x", object->x0() );
|
glabels::XmlUtil::setLengthAttr( node, "x", object->x0() );
|
||||||
libglabels::XmlUtil::setLengthAttr( node, "y", object->y0() );
|
glabels::XmlUtil::setLengthAttr( node, "y", object->y0() );
|
||||||
|
|
||||||
/* size attrs */
|
/* size attrs */
|
||||||
libglabels::XmlUtil::setLengthAttr( node, "w", object->w() );
|
glabels::XmlUtil::setLengthAttr( node, "w", object->w() );
|
||||||
libglabels::XmlUtil::setLengthAttr( node, "h", object->h() );
|
glabels::XmlUtil::setLengthAttr( node, "h", object->h() );
|
||||||
|
|
||||||
/* line attrs */
|
/* line attrs */
|
||||||
libglabels::XmlUtil::setLengthAttr( node, "line_width", object->lineWidth() );
|
glabels::XmlUtil::setLengthAttr( node, "line_width", object->lineWidth() );
|
||||||
if ( object->lineColorNode().fieldFlag() )
|
if ( object->lineColorNode().fieldFlag() )
|
||||||
{
|
{
|
||||||
libglabels::XmlUtil::setStringAttr( node, "line_color_field", object->lineColorNode().key() );
|
glabels::XmlUtil::setStringAttr( node, "line_color_field", object->lineColorNode().key() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
libglabels::XmlUtil::setUIntAttr( node, "line_color", object->lineColorNode().rgba() );
|
glabels::XmlUtil::setUIntAttr( node, "line_color", object->lineColorNode().rgba() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fill attrs */
|
/* fill attrs */
|
||||||
if ( object->fillColorNode().fieldFlag() )
|
if ( object->fillColorNode().fieldFlag() )
|
||||||
{
|
{
|
||||||
libglabels::XmlUtil::setStringAttr( node, "fill_color_field", object->fillColorNode().key() );
|
glabels::XmlUtil::setStringAttr( node, "fill_color_field", object->fillColorNode().key() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
libglabels::XmlUtil::setUIntAttr( node, "fill_color", object->fillColorNode().rgba() );
|
glabels::XmlUtil::setUIntAttr( node, "fill_color", object->fillColorNode().rgba() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* affine attrs */
|
/* affine attrs */
|
||||||
@@ -154,108 +154,108 @@ glabels::XmlLabelCreator::createObjectBoxNode( QDomElement &parent, const LabelM
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::createObjectEllipseNode( QDomElement &parent, const LabelModelEllipseObject* object )
|
XmlLabelCreator::createObjectEllipseNode( QDomElement &parent, const LabelModelEllipseObject* object )
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::createObjectLineNode( QDomElement &parent, const LabelModelLineObject* object )
|
XmlLabelCreator::createObjectLineNode( QDomElement &parent, const LabelModelLineObject* object )
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::createObjectImageNode( QDomElement &parent, const LabelModelImageObject* object )
|
XmlLabelCreator::createObjectImageNode( QDomElement &parent, const LabelModelImageObject* object )
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::createObjectBarcodeNode( QDomElement &parent, const LabelModelBarcodeObject* object )
|
XmlLabelCreator::createObjectBarcodeNode( QDomElement &parent, const LabelModelBarcodeObject* object )
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::createObjectTextNode( QDomElement &parent, const LabelModelTextObject* object )
|
XmlLabelCreator::createObjectTextNode( QDomElement &parent, const LabelModelTextObject* object )
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::createObjectTopLevelSpanNode( QDomElement &parent, const LabelModelTextObject* object )
|
XmlLabelCreator::createObjectTopLevelSpanNode( QDomElement &parent, const LabelModelTextObject* object )
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::createAffineAttrs( QDomElement &node, const LabelModelObject* object )
|
XmlLabelCreator::createAffineAttrs( QDomElement &node, const LabelModelObject* object )
|
||||||
{
|
{
|
||||||
QMatrix a = object->matrix();
|
QMatrix a = object->matrix();
|
||||||
|
|
||||||
libglabels::XmlUtil::setDoubleAttr( node, "a0", a.m11() );
|
glabels::XmlUtil::setDoubleAttr( node, "a0", a.m11() );
|
||||||
libglabels::XmlUtil::setDoubleAttr( node, "a1", a.m12() );
|
glabels::XmlUtil::setDoubleAttr( node, "a1", a.m12() );
|
||||||
libglabels::XmlUtil::setDoubleAttr( node, "a2", a.m21() );
|
glabels::XmlUtil::setDoubleAttr( node, "a2", a.m21() );
|
||||||
libglabels::XmlUtil::setDoubleAttr( node, "a3", a.m22() );
|
glabels::XmlUtil::setDoubleAttr( node, "a3", a.m22() );
|
||||||
libglabels::XmlUtil::setDoubleAttr( node, "a4", a.dx() );
|
glabels::XmlUtil::setDoubleAttr( node, "a4", a.dx() );
|
||||||
libglabels::XmlUtil::setDoubleAttr( node, "a5", a.dy() );
|
glabels::XmlUtil::setDoubleAttr( node, "a5", a.dy() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::createShadowAttrs( QDomElement &node, const LabelModelObject* object )
|
XmlLabelCreator::createShadowAttrs( QDomElement &node, const LabelModelObject* object )
|
||||||
{
|
{
|
||||||
if ( object->shadow() )
|
if ( object->shadow() )
|
||||||
{
|
{
|
||||||
libglabels::XmlUtil::setBoolAttr( node, "shadow", object->shadow() );
|
glabels::XmlUtil::setBoolAttr( node, "shadow", object->shadow() );
|
||||||
|
|
||||||
libglabels::XmlUtil::setLengthAttr( node, "shadow_x", object->shadowX() );
|
glabels::XmlUtil::setLengthAttr( node, "shadow_x", object->shadowX() );
|
||||||
libglabels::XmlUtil::setLengthAttr( node, "shadow_y", object->shadowY() );
|
glabels::XmlUtil::setLengthAttr( node, "shadow_y", object->shadowY() );
|
||||||
|
|
||||||
if ( object->fillColorNode().fieldFlag() )
|
if ( object->fillColorNode().fieldFlag() )
|
||||||
{
|
{
|
||||||
libglabels::XmlUtil::setStringAttr( node, "shadow_color_field", object->shadowColorNode().key() );
|
glabels::XmlUtil::setStringAttr( node, "shadow_color_field", object->shadowColorNode().key() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
libglabels::XmlUtil::setUIntAttr( node, "shadow_color", object->shadowColorNode().rgba() );
|
glabels::XmlUtil::setUIntAttr( node, "shadow_color", object->shadowColorNode().rgba() );
|
||||||
}
|
}
|
||||||
|
|
||||||
libglabels::XmlUtil::setDoubleAttr( node, "shadow_opacity", object->shadowOpacity() );
|
glabels::XmlUtil::setDoubleAttr( node, "shadow_opacity", object->shadowOpacity() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::createMergeNode( QDomElement &parent, const LabelModel* label )
|
XmlLabelCreator::createMergeNode( QDomElement &parent, const LabelModel* label )
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::createDataNode( QDomElement &parent, const LabelModel* label )
|
XmlLabelCreator::createDataNode( QDomElement &parent, const LabelModel* label )
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::createPixdataNode( QDomElement &parent, const LabelModel* label, const QString& name )
|
XmlLabelCreator::createPixdataNode( QDomElement &parent, const LabelModel* label, const QString& name )
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelCreator::createSvgFileNode( QDomElement &parent, const LabelModel* label, const QString& name )
|
XmlLabelCreator::createSvgFileNode( QDomElement &parent, const LabelModel* label, const QString& name )
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-23
@@ -18,38 +18,36 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_XmlLabelCreator_h
|
#ifndef XmlLabelCreator_h
|
||||||
#define glabels_XmlLabelCreator_h
|
#define XmlLabelCreator_h
|
||||||
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDomElement>
|
#include <QDomElement>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
class LabelModel;
|
||||||
|
class LabelModelObject;
|
||||||
|
class LabelModelBoxObject;
|
||||||
|
class LabelModelEllipseObject;
|
||||||
|
class LabelModelLineObject;
|
||||||
|
class LabelModelImageObject;
|
||||||
|
class LabelModelBarcodeObject;
|
||||||
|
class LabelModelTextObject;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// XmlLabelCreator
|
||||||
|
///
|
||||||
|
class XmlLabelCreator : public QObject
|
||||||
{
|
{
|
||||||
class LabelModel;
|
|
||||||
class LabelModelObject;
|
|
||||||
class LabelModelBoxObject;
|
|
||||||
class LabelModelEllipseObject;
|
|
||||||
class LabelModelLineObject;
|
|
||||||
class LabelModelImageObject;
|
|
||||||
class LabelModelBarcodeObject;
|
|
||||||
class LabelModelTextObject;
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// XmlLabelCreator
|
|
||||||
///
|
|
||||||
class XmlLabelCreator : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void writeFile( const LabelModel* label, const QString& fileName );
|
static void writeFile( const LabelModel* label, const QString& fileName );
|
||||||
static void writeBuffer( const LabelModel* label, QString& buffer );
|
static void writeBuffer( const LabelModel* label, QString& buffer );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void createDoc( QDomDocument& doc, const LabelModel* label );
|
static void createDoc( QDomDocument& doc, const LabelModel* label );
|
||||||
static void createRootNode( const LabelModel* label );
|
static void createRootNode( const LabelModel* label );
|
||||||
static void createObjectsNode( QDomElement &parent, const LabelModel* label );
|
static void createObjectsNode( QDomElement &parent, const LabelModel* label );
|
||||||
@@ -67,8 +65,7 @@ namespace glabels
|
|||||||
static void createPixdataNode( QDomElement &parent, const LabelModel* label, const QString& name );
|
static void createPixdataNode( QDomElement &parent, const LabelModel* label, const QString& name );
|
||||||
static void createSvgFileNode( QDomElement &parent, const LabelModel* label, const QString& name );
|
static void createSvgFileNode( QDomElement &parent, const LabelModel* label, const QString& name );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_XmlLabelCreator_h
|
#endif // XmlLabelCreator_h
|
||||||
|
|||||||
+25
-25
@@ -36,8 +36,8 @@
|
|||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
|
|
||||||
glabels::LabelModel*
|
LabelModel*
|
||||||
glabels::XmlLabelParser::readFile( const QString& fileName )
|
XmlLabelParser::readFile( const QString& fileName )
|
||||||
{
|
{
|
||||||
QFile file( fileName );
|
QFile file( fileName );
|
||||||
|
|
||||||
@@ -88,8 +88,8 @@ glabels::XmlLabelParser::readFile( const QString& fileName )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
glabels::LabelModel*
|
LabelModel*
|
||||||
glabels::XmlLabelParser::readBuffer( const QString& buffer )
|
XmlLabelParser::readBuffer( const QString& buffer )
|
||||||
{
|
{
|
||||||
QDomDocument doc;
|
QDomDocument doc;
|
||||||
QString errorString;
|
QString errorString;
|
||||||
@@ -116,7 +116,7 @@ glabels::XmlLabelParser::readBuffer( const QString& buffer )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelParser::gunzip( const QByteArray& data, QByteArray& result )
|
XmlLabelParser::gunzip( const QByteArray& data, QByteArray& result )
|
||||||
{
|
{
|
||||||
result.clear();
|
result.clear();
|
||||||
|
|
||||||
@@ -165,10 +165,10 @@ glabels::XmlLabelParser::gunzip( const QByteArray& data, QByteArray& result )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
glabels::LabelModel*
|
LabelModel*
|
||||||
glabels::XmlLabelParser::parseRootNode( const QDomElement &node )
|
XmlLabelParser::parseRootNode( const QDomElement &node )
|
||||||
{
|
{
|
||||||
using namespace libglabels;
|
using namespace glabels;
|
||||||
|
|
||||||
LabelModel* label = new LabelModel();
|
LabelModel* label = new LabelModel();
|
||||||
|
|
||||||
@@ -220,7 +220,7 @@ glabels::XmlLabelParser::parseRootNode( const QDomElement &node )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelParser::parseObjectsNode( const QDomElement &node, LabelModel* label )
|
XmlLabelParser::parseObjectsNode( const QDomElement &node, LabelModel* label )
|
||||||
{
|
{
|
||||||
for ( QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling() )
|
for ( QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling() )
|
||||||
{
|
{
|
||||||
@@ -259,9 +259,9 @@ glabels::XmlLabelParser::parseObjectsNode( const QDomElement &node, LabelModel*
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelParser::parseObjectBoxNode( const QDomElement &node, LabelModel* label )
|
XmlLabelParser::parseObjectBoxNode( const QDomElement &node, LabelModel* label )
|
||||||
{
|
{
|
||||||
using namespace libglabels;
|
using namespace glabels;
|
||||||
|
|
||||||
LabelModelBoxObject* object = new LabelModelBoxObject();
|
LabelModelBoxObject* object = new LabelModelBoxObject();
|
||||||
label->addObject( object );
|
label->addObject( object );
|
||||||
@@ -303,45 +303,45 @@ glabels::XmlLabelParser::parseObjectBoxNode( const QDomElement &node, LabelModel
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelParser::parseObjectEllipseNode( const QDomElement &node, LabelModel* label )
|
XmlLabelParser::parseObjectEllipseNode( const QDomElement &node, LabelModel* label )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelParser::parseObjectLineNode( const QDomElement &node, LabelModel* label )
|
XmlLabelParser::parseObjectLineNode( const QDomElement &node, LabelModel* label )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelParser::parseObjectImageNode( const QDomElement &node, LabelModel* label )
|
XmlLabelParser::parseObjectImageNode( const QDomElement &node, LabelModel* label )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelParser::parseObjectBarcodeNode( const QDomElement &node, LabelModel* label )
|
XmlLabelParser::parseObjectBarcodeNode( const QDomElement &node, LabelModel* label )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelParser::parseObjectTextNode( const QDomElement &node, LabelModel* label )
|
XmlLabelParser::parseObjectTextNode( const QDomElement &node, LabelModel* label )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelParser::parseTopLevelSpanNode( const QDomElement &node, LabelModelTextObject* object )
|
XmlLabelParser::parseTopLevelSpanNode( const QDomElement &node, LabelModelTextObject* object )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelParser::parseAffineAttrs( const QDomElement &node, LabelModelObject* object )
|
XmlLabelParser::parseAffineAttrs( const QDomElement &node, LabelModelObject* object )
|
||||||
{
|
{
|
||||||
using namespace libglabels;
|
using namespace glabels;
|
||||||
|
|
||||||
double a[6];
|
double a[6];
|
||||||
|
|
||||||
@@ -357,9 +357,9 @@ glabels::XmlLabelParser::parseAffineAttrs( const QDomElement &node, LabelModelOb
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelParser::parseShadowAttrs( const QDomElement &node, LabelModelObject* object )
|
XmlLabelParser::parseShadowAttrs( const QDomElement &node, LabelModelObject* object )
|
||||||
{
|
{
|
||||||
using namespace libglabels;
|
using namespace glabels;
|
||||||
|
|
||||||
object->setShadow( XmlUtil::getBoolAttr( node, "shadow", false ) );
|
object->setShadow( XmlUtil::getBoolAttr( node, "shadow", false ) );
|
||||||
|
|
||||||
@@ -380,25 +380,25 @@ glabels::XmlLabelParser::parseShadowAttrs( const QDomElement &node, LabelModelOb
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelParser::parseMergeNode( const QDomElement &node, LabelModel* label )
|
XmlLabelParser::parseMergeNode( const QDomElement &node, LabelModel* label )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelParser::parseDataNode( const QDomElement &node, LabelModel* label )
|
XmlLabelParser::parseDataNode( const QDomElement &node, LabelModel* label )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelParser::parsePixdataNode( const QDomElement &node, LabelModel* label )
|
XmlLabelParser::parsePixdataNode( const QDomElement &node, LabelModel* label )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glabels::XmlLabelParser::parseFileNode( const QDomElement &node, LabelModel* label )
|
XmlLabelParser::parseFileNode( const QDomElement &node, LabelModel* label )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+20
-23
@@ -18,38 +18,36 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glabels_XmlLabelParser_h
|
#ifndef XmlLabelParser_h
|
||||||
#define glabels_XmlLabelParser_h
|
#define XmlLabelParser_h
|
||||||
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDomElement>
|
#include <QDomElement>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
class LabelModel;
|
||||||
|
class LabelModelObject;
|
||||||
|
class LabelModelBoxObject;
|
||||||
|
class LabelModelEllipseObject;
|
||||||
|
class LabelModelLineObject;
|
||||||
|
class LabelModelImageObject;
|
||||||
|
class LabelModelBarcodeObject;
|
||||||
|
class LabelModelTextObject;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// XmlLabelParser
|
||||||
|
///
|
||||||
|
class XmlLabelParser : public QObject
|
||||||
{
|
{
|
||||||
class LabelModel;
|
|
||||||
class LabelModelObject;
|
|
||||||
class LabelModelBoxObject;
|
|
||||||
class LabelModelEllipseObject;
|
|
||||||
class LabelModelLineObject;
|
|
||||||
class LabelModelImageObject;
|
|
||||||
class LabelModelBarcodeObject;
|
|
||||||
class LabelModelTextObject;
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// XmlLabelParser
|
|
||||||
///
|
|
||||||
class XmlLabelParser : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static LabelModel* readFile( const QString& fileName );
|
static LabelModel* readFile( const QString& fileName );
|
||||||
static LabelModel* readBuffer( const QString& buffer );
|
static LabelModel* readBuffer( const QString& buffer );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void gunzip( const QByteArray& gzippedData, QByteArray& data );
|
static void gunzip( const QByteArray& gzippedData, QByteArray& data );
|
||||||
static LabelModel* parseRootNode( const QDomElement &node );
|
static LabelModel* parseRootNode( const QDomElement &node );
|
||||||
static void parseObjectsNode( const QDomElement &node, LabelModel* label );
|
static void parseObjectsNode( const QDomElement &node, LabelModel* label );
|
||||||
@@ -67,8 +65,7 @@ namespace glabels
|
|||||||
static void parsePixdataNode( const QDomElement &node, LabelModel* label );
|
static void parsePixdataNode( const QDomElement &node, LabelModel* label );
|
||||||
static void parseFileNode( const QDomElement &node, LabelModel* label );
|
static void parseFileNode( const QDomElement &node, LabelModel* label );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // glabels_XmlLabelParser_h
|
#endif // XmlLabelParser_h
|
||||||
|
|||||||
@@ -24,9 +24,6 @@
|
|||||||
#include "File.h"
|
#include "File.h"
|
||||||
#include "libglabels/Db.h"
|
#include "libglabels/Db.h"
|
||||||
|
|
||||||
using namespace glabels;
|
|
||||||
using namespace libglabels;
|
|
||||||
|
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
int main( int argc, char **argv )
|
||||||
{
|
{
|
||||||
@@ -36,13 +33,13 @@ int main( int argc, char **argv )
|
|||||||
QCoreApplication::setOrganizationDomain( "glabels.org" );
|
QCoreApplication::setOrganizationDomain( "glabels.org" );
|
||||||
QCoreApplication::setApplicationName( "glabels-qt" );
|
QCoreApplication::setApplicationName( "glabels-qt" );
|
||||||
|
|
||||||
Db::init();
|
glabels::Db::init();
|
||||||
////// TEMPORARY TESTING ////////
|
////// TEMPORARY TESTING ////////
|
||||||
#if 0
|
#if 0
|
||||||
Db::printKnownPapers();
|
glabels::Db::printKnownPapers();
|
||||||
Db::printKnownCategories();
|
glabels::Db::printKnownCategories();
|
||||||
Db::printKnownVendors();
|
glabels::Db::printKnownVendors();
|
||||||
Db::printKnownTemplates();
|
glabels::Db::printKnownTemplates();
|
||||||
#endif
|
#endif
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -372,7 +372,7 @@
|
|||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_23">
|
<layout class="QHBoxLayout" name="horizontalLayout_23">
|
||||||
<item>
|
<item>
|
||||||
<widget class="glabels::ColorButton" name="textColorButton">
|
<widget class="ColorButton" name="textColorButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@@ -451,7 +451,7 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="glabels::FieldButton" name="textInsertFieldButton">
|
<widget class="FieldButton" name="textInsertFieldButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@@ -539,7 +539,7 @@
|
|||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_22">
|
<layout class="QHBoxLayout" name="horizontalLayout_22">
|
||||||
<item>
|
<item>
|
||||||
<widget class="glabels::ColorButton" name="barcodeColorButton">
|
<widget class="ColorButton" name="barcodeColorButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@@ -679,7 +679,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
||||||
<item>
|
<item>
|
||||||
<widget class="glabels::FieldButton" name="barcodeFieldButton">
|
<widget class="FieldButton" name="barcodeFieldButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@@ -802,7 +802,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="glabels::FieldButton" name="imageFieldButton">
|
<widget class="FieldButton" name="imageFieldButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@@ -889,7 +889,7 @@
|
|||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_21">
|
<layout class="QHBoxLayout" name="horizontalLayout_21">
|
||||||
<item>
|
<item>
|
||||||
<widget class="glabels::ColorButton" name="lineColorButton">
|
<widget class="ColorButton" name="lineColorButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@@ -950,7 +950,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="glabels::ColorButton" name="fillColorButton">
|
<widget class="ColorButton" name="fillColorButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@@ -1373,7 +1373,7 @@
|
|||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_24">
|
<layout class="QHBoxLayout" name="horizontalLayout_24">
|
||||||
<item>
|
<item>
|
||||||
<widget class="glabels::ColorButton" name="shadowColorButton">
|
<widget class="ColorButton" name="shadowColorButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@@ -1433,7 +1433,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>glabels::ColorButton</class>
|
<class>ColorButton</class>
|
||||||
<extends>QPushButton</extends>
|
<extends>QPushButton</extends>
|
||||||
<header>ColorButton.h</header>
|
<header>ColorButton.h</header>
|
||||||
<slots>
|
<slots>
|
||||||
@@ -1441,7 +1441,7 @@
|
|||||||
</slots>
|
</slots>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>glabels::FieldButton</class>
|
<class>FieldButton</class>
|
||||||
<extends>QPushButton</extends>
|
<extends>QPushButton</extends>
|
||||||
<header>FieldButton.h</header>
|
<header>FieldButton.h</header>
|
||||||
<slots>
|
<slots>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="glabels::Preview" name="preview" native="true">
|
<widget class="Preview" name="preview" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@@ -453,7 +453,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>glabels::Preview</class>
|
<class>Preview</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header>Preview.h</header>
|
<header>Preview.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
<item row="0" column="4">
|
<item row="0" column="4">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="glabels::SimplePreview" name="preview">
|
<widget class="SimplePreview" name="preview">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@@ -356,7 +356,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>glabels::SimplePreview</class>
|
<class>SimplePreview</class>
|
||||||
<extends>QGraphicsView</extends>
|
<extends>QGraphicsView</extends>
|
||||||
<header>SimplePreview.h</header>
|
<header>SimplePreview.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
|
|||||||
@@ -134,7 +134,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="glabels::TemplatePicker" name="templatePicker">
|
<widget class="TemplatePicker" name="templatePicker">
|
||||||
<property name="showDropIndicator" stdset="0">
|
<property name="showDropIndicator" stdset="0">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
@@ -182,7 +182,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>glabels::TemplatePicker</class>
|
<class>TemplatePicker</class>
|
||||||
<extends>QListWidget</extends>
|
<extends>QListWidget</extends>
|
||||||
<header>TemplatePicker.h</header>
|
<header>TemplatePicker.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Category.cpp
|
/* Category.cpp
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Jim Evins <evins@snaught.com>
|
* Copyright (C) 2013-2016 Jim Evins <evins@snaught.com>
|
||||||
*
|
*
|
||||||
* This file is part of gLabels-qt.
|
* This file is part of gLabels-qt.
|
||||||
*
|
*
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "Category.h"
|
#include "Category.h"
|
||||||
|
|
||||||
|
|
||||||
namespace libglabels
|
namespace glabels
|
||||||
{
|
{
|
||||||
|
|
||||||
Category::Category( const QString &id, const QString &name )
|
Category::Category( const QString &id, const QString &name )
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Category.h
|
/* Category.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Jim Evins <evins@snaught.com>
|
* Copyright (C) 2013-2016 Jim Evins <evins@snaught.com>
|
||||||
*
|
*
|
||||||
* This file is part of gLabels-qt.
|
* This file is part of gLabels-qt.
|
||||||
*
|
*
|
||||||
@@ -18,14 +18,14 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef libglabels_Category_h
|
#ifndef glabels_Category_h
|
||||||
#define libglabels_Category_h
|
#define glabels_Category_h
|
||||||
|
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
namespace libglabels
|
namespace glabels
|
||||||
{
|
{
|
||||||
|
|
||||||
class Category
|
class Category
|
||||||
@@ -50,4 +50,4 @@ namespace libglabels
|
|||||||
#include "Category.inl"
|
#include "Category.inl"
|
||||||
|
|
||||||
|
|
||||||
#endif // libglabels_Category_h
|
#endif // glabels_Category_h
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Category.inl
|
/* Category.inl
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Jim Evins <evins@snaught.com>
|
* Copyright (C) 2013-2016 Jim Evins <evins@snaught.com>
|
||||||
*
|
*
|
||||||
* This file is part of gLabels-qt.
|
* This file is part of gLabels-qt.
|
||||||
*
|
*
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
namespace libglabels
|
namespace glabels
|
||||||
{
|
{
|
||||||
|
|
||||||
inline const QString& Category::id() const
|
inline const QString& Category::id() const
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Config.h
|
/* Config.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Jim Evins <evins@snaught.com>
|
* Copyright (C) 2013-2016 Jim Evins <evins@snaught.com>
|
||||||
*
|
*
|
||||||
* This file is part of gLabels-qt.
|
* This file is part of gLabels-qt.
|
||||||
*
|
*
|
||||||
@@ -18,11 +18,11 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef libglabels_Config_h
|
#ifndef glabels_Config_h
|
||||||
#define libglabels_Config_h
|
#define glabels_Config_h
|
||||||
|
|
||||||
|
|
||||||
namespace libglabels
|
namespace glabels
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace Config
|
namespace Config
|
||||||
@@ -33,4 +33,4 @@ namespace libglabels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // libglabels_Config_h
|
#endif // glabels_Config_h
|
||||||
|
|||||||
@@ -18,11 +18,11 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef libglabels_Constants_h
|
#ifndef glabels_Constants_h
|
||||||
#define libglabels_Constants_h
|
#define glabels_Constants_h
|
||||||
|
|
||||||
|
|
||||||
namespace libglabels
|
namespace glabels
|
||||||
{
|
{
|
||||||
|
|
||||||
const double PTS_PER_PT = 1.0;
|
const double PTS_PER_PT = 1.0;
|
||||||
@@ -33,4 +33,4 @@ namespace libglabels
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // libglabels_Constants_h
|
#endif // glabels_Constants_h
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user