UserVariables branch merge
This commit is contained in:
@@ -13,9 +13,9 @@ set (glabels_sources
|
||||
ColorHistory.cpp
|
||||
ColorPaletteDialog.cpp
|
||||
ColorPaletteItem.cpp
|
||||
ColorPaletteButtonItem.cpp
|
||||
ColorSwatch.cpp
|
||||
Cursors.cpp
|
||||
EditVariableDialog.cpp
|
||||
FieldButton.cpp
|
||||
File.cpp
|
||||
Help.cpp
|
||||
@@ -40,6 +40,7 @@ set (glabels_sources
|
||||
TemplatePicker.cpp
|
||||
TemplatePickerItem.cpp
|
||||
UndoRedoModel.cpp
|
||||
VariablesView.cpp
|
||||
)
|
||||
|
||||
set (glabels_qobject_headers
|
||||
@@ -51,7 +52,7 @@ set (glabels_qobject_headers
|
||||
ColorHistory.h
|
||||
ColorPaletteDialog.h
|
||||
ColorPaletteItem.h
|
||||
ColorPaletteButtonItem.h
|
||||
EditVariableDialog.h
|
||||
FieldButton.h
|
||||
File.h
|
||||
LabelEditor.h
|
||||
@@ -69,10 +70,12 @@ set (glabels_qobject_headers
|
||||
TemplateDesigner.h
|
||||
TemplatePicker.h
|
||||
UndoRedoModel.h
|
||||
VariablesView.h
|
||||
)
|
||||
|
||||
set (glabels_forms
|
||||
ui/AboutDialog.ui
|
||||
ui/EditVariableDialog.ui
|
||||
ui/MergeView.ui
|
||||
ui/ObjectEditor.ui
|
||||
ui/PreferencesDialog.ui
|
||||
@@ -95,6 +98,7 @@ set (glabels_forms
|
||||
ui/TemplateDesignerOneLayoutPage.ui
|
||||
ui/TemplateDesignerTwoLayoutPage.ui
|
||||
ui/TemplateDesignerApplyPage.ui
|
||||
ui/VariablesView.ui
|
||||
)
|
||||
|
||||
set (glabels_resource_files
|
||||
|
||||
+10
-11
@@ -48,8 +48,9 @@ namespace glabels
|
||||
|
||||
|
||||
void ColorButton::init( const QString& defaultLabel,
|
||||
const QColor& defaultColor,
|
||||
const QColor& color )
|
||||
const QColor& defaultColor,
|
||||
const QColor& color,
|
||||
bool showUseFieldButton )
|
||||
{
|
||||
mDefaultColor = defaultColor;
|
||||
mColorNode = model::ColorNode( color );
|
||||
@@ -61,7 +62,10 @@ namespace glabels
|
||||
setText( "" );
|
||||
setCheckable( true );
|
||||
|
||||
mDialog = new ColorPaletteDialog( defaultLabel, defaultColor, color );
|
||||
mDialog = new ColorPaletteDialog( defaultLabel,
|
||||
defaultColor,
|
||||
color,
|
||||
showUseFieldButton );
|
||||
|
||||
connect( this, SIGNAL(toggled(bool)), this, SLOT(onButtonToggled(bool)) );
|
||||
connect( mDialog, SIGNAL(colorChanged(model::ColorNode,bool)),
|
||||
@@ -124,15 +128,10 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::setKeys( const QList<QString> keyList )
|
||||
void ColorButton::setKeys( const merge::Merge* merge,
|
||||
const model::Variables* variables )
|
||||
{
|
||||
mDialog->setKeys( keyList );
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::clearKeys()
|
||||
{
|
||||
mDialog->clearKeys();
|
||||
mDialog->setKeys( merge, variables );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -58,13 +58,18 @@ namespace glabels
|
||||
// Public Methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
void init( const QString& defaultLabel, const QColor& defaultColor, const QColor& color );
|
||||
void init( const QString& defaultLabel,
|
||||
const QColor& defaultColor,
|
||||
const QColor& color,
|
||||
bool showUseFieldButton = true );
|
||||
|
||||
void setColorNode( model::ColorNode colorNode );
|
||||
void setColor( QColor color );
|
||||
void setToDefault();
|
||||
model::ColorNode colorNode();
|
||||
void setKeys( const QList<QString> keyList );
|
||||
void clearKeys();
|
||||
|
||||
void setKeys( const merge::Merge* merge,
|
||||
const model::Variables* variables );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
|
||||
+71
-41
@@ -46,23 +46,25 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
void ColorHistory::addColor( const QColor &color )
|
||||
void ColorHistory::addColor( const QColor &color, const QString& name )
|
||||
{
|
||||
QList<QColor> colorList = readColorList();
|
||||
QString nameColor = name + ":" + color.name();
|
||||
|
||||
QStringList nameColorList = readNameColorList();
|
||||
|
||||
// Remove any occurrences of this color already in list
|
||||
colorList.removeAll( color );
|
||||
nameColorList.removeAll( nameColor );
|
||||
|
||||
// Now add to list
|
||||
colorList.append( color );
|
||||
nameColorList.append( nameColor );
|
||||
|
||||
// Remove oldest colors, if size exceeds current max
|
||||
while ( colorList.size() > MAX_COLORS )
|
||||
while ( nameColorList.size() > MAX_COLORS )
|
||||
{
|
||||
colorList.removeFirst();
|
||||
nameColorList.removeFirst();
|
||||
}
|
||||
|
||||
writeColorList( colorList );
|
||||
writeNameColorList( nameColorList );
|
||||
|
||||
emit changed();
|
||||
}
|
||||
@@ -70,55 +72,83 @@ namespace glabels
|
||||
|
||||
QList<QColor> ColorHistory::getColors()
|
||||
{
|
||||
return readColorList();
|
||||
}
|
||||
|
||||
|
||||
QColor ColorHistory::getColor( int id )
|
||||
{
|
||||
QList<QColor> colors = readColorList();
|
||||
return colors[id];
|
||||
}
|
||||
|
||||
|
||||
QList<QColor> ColorHistory::readColorList()
|
||||
{
|
||||
QStringList defaultList;
|
||||
QSettings settings;
|
||||
|
||||
settings.beginGroup( "ColorHistory" );
|
||||
QStringList colorNameList = settings.value( "colors", defaultList ).toStringList();
|
||||
settings.endGroup();
|
||||
|
||||
QList<QColor> colorList;
|
||||
foreach ( QString colorName, colorNameList )
|
||||
|
||||
for ( QString& nameColor : readNameColorList() )
|
||||
{
|
||||
colorList << QColor( colorName );
|
||||
}
|
||||
|
||||
// Remove oldest colors, if size exceeds current max
|
||||
while ( colorList.size() > MAX_COLORS )
|
||||
{
|
||||
colorList.removeFirst();
|
||||
QStringList v = nameColor.split( ':' );
|
||||
if ( v.size() == 2 )
|
||||
{
|
||||
colorList << QColor( v[1] );
|
||||
}
|
||||
else if ( v.size() == 1 )
|
||||
{
|
||||
// Old-style, no name
|
||||
colorList << QColor( v[0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Should not happen
|
||||
qWarning() << "Invalid color history.";
|
||||
}
|
||||
}
|
||||
|
||||
return colorList;
|
||||
}
|
||||
|
||||
|
||||
void ColorHistory::writeColorList( const QList<QColor>& colorList )
|
||||
QStringList ColorHistory::getNames()
|
||||
{
|
||||
// Build name list
|
||||
QStringList colorNameList;
|
||||
foreach ( QColor color, colorList )
|
||||
QStringList nameList;
|
||||
|
||||
for ( QString& nameColor : readNameColorList() )
|
||||
{
|
||||
colorNameList << color.name();
|
||||
QStringList v = nameColor.split( ':' );
|
||||
if ( v.size() == 2 )
|
||||
{
|
||||
nameList << v[0];
|
||||
}
|
||||
else if ( v.size() == 1 )
|
||||
{
|
||||
// Old-style, no name
|
||||
nameList << QString(tr("color %1")).arg( v[0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Should not happen
|
||||
qWarning() << "Invalid color history.";
|
||||
}
|
||||
}
|
||||
|
||||
return nameList;
|
||||
}
|
||||
|
||||
|
||||
QStringList ColorHistory::readNameColorList()
|
||||
{
|
||||
QStringList defaultList;
|
||||
QSettings settings;
|
||||
|
||||
settings.beginGroup( "ColorHistory" );
|
||||
QStringList nameColorList = settings.value( "colors", defaultList ).toStringList();
|
||||
settings.endGroup();
|
||||
|
||||
// Remove oldest colors, if size exceeds current max
|
||||
while ( nameColorList.size() > MAX_COLORS )
|
||||
{
|
||||
nameColorList.removeFirst();
|
||||
}
|
||||
|
||||
return nameColorList;
|
||||
}
|
||||
|
||||
|
||||
void ColorHistory::writeNameColorList( const QStringList& nameColorList )
|
||||
{
|
||||
// Save
|
||||
QSettings settings;
|
||||
settings.beginGroup( "ColorHistory" );
|
||||
settings.setValue( "colors", colorNameList );
|
||||
settings.setValue( "colors", nameColorList );
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
|
||||
@@ -60,17 +60,17 @@ namespace glabels
|
||||
// Public Methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
void addColor( const QColor &color );
|
||||
void addColor( const QColor& color, const QString& name );
|
||||
QList<QColor> getColors();
|
||||
QColor getColor( int id );
|
||||
QStringList getNames();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Methods
|
||||
/////////////////////////////////
|
||||
private:
|
||||
QList<QColor> readColorList();
|
||||
void writeColorList( const QList<QColor>& colorList );
|
||||
QStringList readNameColorList();
|
||||
void writeNameColorList( const QStringList& nameColorList );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
/* ColorPaletteButtonItem.cpp
|
||||
*
|
||||
* Copyright (C) 2014 Jim Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ColorPaletteButtonItem.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
//
|
||||
// Private
|
||||
//
|
||||
namespace
|
||||
{
|
||||
const int border = 4;
|
||||
const int hBox = 25;
|
||||
const int outlineWidthPixels = 1;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor From Data
|
||||
///
|
||||
ColorPaletteButtonItem::ColorPaletteButtonItem( const QString& text, QWidget* parent )
|
||||
: QWidget(parent), mText(text), mHover(false)
|
||||
{
|
||||
setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) );
|
||||
setMinimumSize( hBox+2*border+1, hBox+2*border+1 );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Paint Event
|
||||
///
|
||||
void ColorPaletteButtonItem::paintEvent( QPaintEvent* event )
|
||||
{
|
||||
QPainter painter(this);
|
||||
|
||||
//
|
||||
// Draw background
|
||||
//
|
||||
if ( isEnabled() && mHover )
|
||||
{
|
||||
QLinearGradient gradient( 0, 0, 0, height() );
|
||||
gradient.setColorAt( 0, palette().color( QPalette::Highlight ).lighter() );
|
||||
gradient.setColorAt( 1, palette().color( QPalette::Highlight ) );
|
||||
painter.setBrush( QBrush( gradient ) );
|
||||
|
||||
QPen pen( palette().color( QPalette::Text ) );
|
||||
pen.setWidth( outlineWidthPixels );
|
||||
painter.setPen( pen );
|
||||
|
||||
painter.drawRect( 0, 0, width()-1, height()-1 );
|
||||
}
|
||||
|
||||
//
|
||||
// Draw text
|
||||
//
|
||||
painter.setBrush( QBrush( Qt::NoBrush ) );
|
||||
|
||||
if ( isEnabled() && mHover )
|
||||
{
|
||||
painter.setPen( QPen( palette().color( QPalette::HighlightedText ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
painter.setPen( QPen( palette().color( QPalette::Text ) ) );
|
||||
}
|
||||
|
||||
QRect textRect( border, border, width()-2*border, hBox );
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
} // namespace glabels
|
||||
+98
-108
@@ -18,14 +18,16 @@
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "ColorPaletteDialog.h"
|
||||
|
||||
#include <QColorDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QFrame>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QStandardItemModel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QtDebug>
|
||||
|
||||
|
||||
@@ -83,6 +85,7 @@ namespace glabels
|
||||
ColorPaletteDialog::ColorPaletteDialog( const QString& defaultLabel,
|
||||
const QColor& defaultColor,
|
||||
const QColor& color,
|
||||
bool showUseFieldButton,
|
||||
QWidget* parent )
|
||||
: QDialog( parent )
|
||||
{
|
||||
@@ -99,14 +102,12 @@ namespace glabels
|
||||
vLayout->setContentsMargins( 0, 0, 0, 0 );
|
||||
vLayout->setSpacing( 0 );
|
||||
|
||||
auto* defaultButton = new ColorPaletteButtonItem( defaultLabel );
|
||||
connect( defaultButton, SIGNAL(activated()), this, SLOT(onDefaultItemActivated()) );
|
||||
vLayout->addWidget( defaultButton );
|
||||
|
||||
QFrame* hline1 = new QFrame;
|
||||
hline1->setFrameStyle( QFrame::HLine | QFrame::Plain );
|
||||
hline1->setLineWidth( 1 );
|
||||
vLayout->addWidget( hline1 );
|
||||
//
|
||||
// Construct Standard Colors Grid
|
||||
//
|
||||
auto* standardColorsGroup = new QGroupBox( tr("Standard Colors") );
|
||||
standardColorsGroup->setAlignment( Qt::AlignHCenter );
|
||||
vLayout->addWidget( standardColorsGroup );
|
||||
|
||||
auto* mainPaletteLayout = new QGridLayout();
|
||||
mainPaletteLayout->setSpacing( 0 );
|
||||
@@ -119,17 +120,20 @@ namespace glabels
|
||||
ColorPaletteItem* item = new ColorPaletteItem( i,
|
||||
QColor( mColorTable[i].colorSpec ),
|
||||
tr(mColorTable[i].trname) );
|
||||
connect( item, SIGNAL(activated(int)), this, SLOT(onPaletteItemActivated(int)) );
|
||||
connect( item, SIGNAL(activated(int)),
|
||||
this, SLOT(onPaletteItemActivated(int)) );
|
||||
|
||||
mainPaletteLayout->addWidget( item, iRow, iCol );
|
||||
}
|
||||
}
|
||||
vLayout->addLayout( mainPaletteLayout );
|
||||
standardColorsGroup->setLayout( mainPaletteLayout );
|
||||
|
||||
QFrame* hline2 = new QFrame;
|
||||
hline2->setFrameStyle( QFrame::HLine | QFrame::Plain );
|
||||
hline2->setLineWidth( 1 );
|
||||
vLayout->addWidget( hline2 );
|
||||
//
|
||||
// Construct Recent Colors Grid
|
||||
//
|
||||
auto* recentColorsGroup = new QGroupBox( tr("Recent Colors") );
|
||||
recentColorsGroup->setAlignment( Qt::AlignHCenter );
|
||||
vLayout->addWidget( recentColorsGroup );
|
||||
|
||||
auto* customPaletteLayout = new QHBoxLayout();
|
||||
customPaletteLayout->setSpacing( 0 );
|
||||
@@ -137,40 +141,49 @@ namespace glabels
|
||||
{
|
||||
mHistoryItem[iCol] = new ColorPaletteItem( iCol, QColor(0,0,0,0), "" );
|
||||
mHistoryItem[iCol]->setEnabled( false );
|
||||
connect( mHistoryItem[iCol], SIGNAL(activated(int)), this, SLOT(onHistoryItemActivated(int)) );
|
||||
connect( mHistoryItem[iCol], SIGNAL(activated(int)),
|
||||
this, SLOT(onHistoryItemActivated(int)) );
|
||||
|
||||
customPaletteLayout->addWidget( mHistoryItem[iCol] );
|
||||
}
|
||||
vLayout->addLayout( customPaletteLayout );
|
||||
recentColorsGroup->setLayout( customPaletteLayout );
|
||||
|
||||
|
||||
QFrame* hline3 = new QFrame;
|
||||
hline3->setFrameStyle( QFrame::HLine | QFrame::Plain );
|
||||
hline3->setLineWidth( 1 );
|
||||
vLayout->addWidget( hline3 );
|
||||
|
||||
ColorPaletteButtonItem* customColorButton = new ColorPaletteButtonItem( tr("Custom color...") );
|
||||
connect( customColorButton, SIGNAL(activated()), this, SLOT(onCustomColorItemActivated()) );
|
||||
//
|
||||
// Construct Default (e.g. "No Fill") Button
|
||||
//
|
||||
auto* defaultColorButton = new QPushButton( defaultLabel );
|
||||
defaultColorButton->setAutoDefault( false );
|
||||
defaultColorButton->setDefault( false );
|
||||
connect( defaultColorButton, SIGNAL(clicked()), this, SLOT(onDefaultButtonClicked()) );
|
||||
vLayout->addWidget( defaultColorButton );
|
||||
|
||||
//
|
||||
// Construct Custom Color Button
|
||||
//
|
||||
auto* customColorButton = new QPushButton( tr("Custom color...") );
|
||||
customColorButton->setAutoDefault( false );
|
||||
customColorButton->setDefault( false );
|
||||
connect( customColorButton, SIGNAL(clicked()), this, SLOT(onCustomColorButtonClicked()) );
|
||||
vLayout->addWidget( customColorButton );
|
||||
|
||||
QFrame* hline4 = new QFrame;
|
||||
hline4->setFrameStyle( QFrame::HLine | QFrame::Plain );
|
||||
hline4->setLineWidth( 1 );
|
||||
vLayout->addWidget( hline4 );
|
||||
//
|
||||
// Construct "Use field" Button
|
||||
//
|
||||
if ( showUseFieldButton )
|
||||
{
|
||||
mFieldButton = new FieldButton();
|
||||
mFieldButton->setText( tr("Use substitution field") );
|
||||
mFieldButton->setAutoDefault( false );
|
||||
mFieldButton->setDefault( false );
|
||||
connect( mFieldButton, SIGNAL(keySelected(QString)), this, SLOT(onKeySelected(QString)) );
|
||||
vLayout->addWidget( mFieldButton );
|
||||
}
|
||||
else
|
||||
{
|
||||
mFieldButton = nullptr;
|
||||
}
|
||||
|
||||
mMergeFieldCombo = new QComboBox();
|
||||
mMergeFieldCombo->addItem( tr("Merge key...") );
|
||||
mMergeFieldCombo->setMinimumSize( 34, 34 );
|
||||
mMergeFieldCombo->setFrame( false );
|
||||
mMergeFieldCombo->setEnabled( false );
|
||||
connect( mMergeFieldCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onComboIndexChanged(int)) );
|
||||
vLayout->addWidget( mMergeFieldCombo );
|
||||
|
||||
// Item 0 is the ComboBox title, not an item intended for selection. So disable it.
|
||||
const auto* model = qobject_cast<const QStandardItemModel*>(mMergeFieldCombo->model());
|
||||
QStandardItem* item = model->item(0);
|
||||
item->setFlags( item->flags() & ~(Qt::ItemIsSelectable|Qt::ItemIsEnabled) );
|
||||
|
||||
setLayout( vLayout );
|
||||
|
||||
loadCustomColorHistory();
|
||||
@@ -183,41 +196,47 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
void ColorPaletteDialog::setKeys( const QStringList& keyList )
|
||||
void ColorPaletteDialog::setKeys( const merge::Merge* merge,
|
||||
const model::Variables* variables )
|
||||
{
|
||||
mKeys = keyList;
|
||||
|
||||
// Clear old keys, (all entries, except item 0)
|
||||
for ( int index = mMergeFieldCombo->count()-1; index > 0; index-- )
|
||||
if (mFieldButton)
|
||||
{
|
||||
mMergeFieldCombo->removeItem( index );
|
||||
}
|
||||
|
||||
// Add new keys
|
||||
if ( keyList.size() > 0 )
|
||||
{
|
||||
mMergeFieldCombo->addItems( keyList );
|
||||
mMergeFieldCombo->setEnabled( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
mMergeFieldCombo->setEnabled( false );
|
||||
mFieldButton->setKeys( merge, variables );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ColorPaletteDialog::clearKeys()
|
||||
void ColorPaletteDialog::onPaletteItemActivated( int id )
|
||||
{
|
||||
|
||||
for ( int index = mMergeFieldCombo->count()-1; index > 0; index-- )
|
||||
model::ColorNode newColorNode;
|
||||
newColorNode.setField( false );
|
||||
newColorNode.setColor( QColor( mColorTable[id].colorSpec ) );
|
||||
newColorNode.setKey( "" );
|
||||
|
||||
if ( newColorNode != mColorNode )
|
||||
{
|
||||
mMergeFieldCombo->removeItem( index );
|
||||
mColorNode = newColorNode;
|
||||
|
||||
mColorHistory->addColor( mColorNode.color(), mColorTable[id].trname );
|
||||
|
||||
emit colorChanged( mColorNode, false );
|
||||
accept();
|
||||
}
|
||||
mMergeFieldCombo->setEnabled( false );
|
||||
}
|
||||
|
||||
|
||||
void ColorPaletteDialog::onDefaultItemActivated()
|
||||
void ColorPaletteDialog::onHistoryItemActivated( int id )
|
||||
{
|
||||
mColorNode.setField( false );
|
||||
mColorNode.setColor( mColorHistory->getColors()[id] );
|
||||
mColorNode.setKey( "" );
|
||||
|
||||
emit colorChanged( mColorNode, false );
|
||||
accept();
|
||||
}
|
||||
|
||||
|
||||
void ColorPaletteDialog::onDefaultButtonClicked()
|
||||
{
|
||||
mColorNode.setField( false );
|
||||
mColorNode.setColor( mDefaultColor );
|
||||
@@ -228,29 +247,7 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
void ColorPaletteDialog::onPaletteItemActivated( int id )
|
||||
{
|
||||
mColorNode.setField( false );
|
||||
mColorNode.setColor( QColor( mColorTable[id].colorSpec ) );
|
||||
mColorNode.setKey( "" );
|
||||
|
||||
emit colorChanged( mColorNode, false );
|
||||
accept();
|
||||
}
|
||||
|
||||
|
||||
void ColorPaletteDialog::onHistoryItemActivated( int id )
|
||||
{
|
||||
mColorNode.setField( false );
|
||||
mColorNode.setColor( mColorHistory->getColor(id) );
|
||||
mColorNode.setKey( "" );
|
||||
|
||||
emit colorChanged( mColorNode, false );
|
||||
accept();
|
||||
}
|
||||
|
||||
|
||||
void ColorPaletteDialog::onCustomColorItemActivated()
|
||||
void ColorPaletteDialog::onCustomColorButtonClicked()
|
||||
{
|
||||
QColorDialog dlg( mColorNode.color(), this );
|
||||
dlg.setWindowTitle( tr("Custom Color") );
|
||||
@@ -267,7 +264,10 @@ namespace glabels
|
||||
{
|
||||
mColorNode = newColorNode;
|
||||
|
||||
mColorHistory->addColor( mColorNode.color() );
|
||||
// TRANSLATORS
|
||||
//: %1 = color specification in hex. String must not contain a colon (:).
|
||||
mColorHistory->addColor( mColorNode.color(),
|
||||
QString(tr("Custom Color %1")).arg(mColorNode.color().name()) );
|
||||
|
||||
emit colorChanged( mColorNode, false );
|
||||
accept();
|
||||
@@ -284,12 +284,13 @@ namespace glabels
|
||||
|
||||
void ColorPaletteDialog::loadCustomColorHistory()
|
||||
{
|
||||
QStringList nameList = mColorHistory->getNames();
|
||||
QList<QColor> colorList = mColorHistory->getColors();
|
||||
|
||||
int id = 0;
|
||||
foreach ( QColor color, colorList )
|
||||
{
|
||||
mHistoryItem[id]->setColor( id, color, QString(tr("Custom color #%1").arg(id+1) ) );
|
||||
mHistoryItem[id]->setColor( id, color, nameList[id] );
|
||||
mHistoryItem[id]->setEnabled( true );
|
||||
id++;
|
||||
}
|
||||
@@ -302,25 +303,14 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
void ColorPaletteDialog::onComboIndexChanged( int index )
|
||||
void ColorPaletteDialog::onKeySelected( QString key )
|
||||
{
|
||||
if ( index != 0 )
|
||||
{
|
||||
mColorNode.setField( true );
|
||||
mColorNode.setColor( QColor( 0xee, 0xee, 0xec ) );
|
||||
mColorNode.setKey( mKeys[index-1] );
|
||||
mColorNode.setField( true );
|
||||
mColorNode.setColor( QColor( 0xee, 0xee, 0xec ) );
|
||||
mColorNode.setKey( key );
|
||||
|
||||
emit colorChanged( mColorNode, false );
|
||||
accept();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ColorPaletteDialog::showEvent( QShowEvent* event )
|
||||
{
|
||||
mMergeFieldCombo->setCurrentIndex( 0 );
|
||||
|
||||
QDialog::showEvent( event );
|
||||
emit colorChanged( mColorNode, false );
|
||||
accept();
|
||||
}
|
||||
|
||||
} // namespace glabels
|
||||
|
||||
@@ -24,11 +24,10 @@
|
||||
|
||||
#include "ColorHistory.h"
|
||||
#include "ColorPaletteItem.h"
|
||||
#include "ColorPaletteButtonItem.h"
|
||||
#include "FieldButton.h"
|
||||
|
||||
#include "model/ColorNode.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QDialog>
|
||||
|
||||
|
||||
@@ -50,6 +49,7 @@ namespace glabels
|
||||
ColorPaletteDialog( const QString& defaultLabel,
|
||||
const QColor& defaultColor,
|
||||
const QColor& color,
|
||||
bool showUseFieldButton = true,
|
||||
QWidget* parent = nullptr );
|
||||
|
||||
|
||||
@@ -64,25 +64,23 @@ namespace glabels
|
||||
// Public Methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
void setColorNode( const model::ColorNode& colorNode );
|
||||
void setKeys( const QStringList& keyList );
|
||||
void clearKeys();
|
||||
void setColorNode( const model::ColorNode& colorNode );
|
||||
|
||||
void setKeys( const merge::Merge* merge,
|
||||
const model::Variables* variables );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
private slots:
|
||||
void onDefaultItemActivated();
|
||||
void onPaletteItemActivated( int id );
|
||||
void onHistoryItemActivated( int id );
|
||||
void onCustomColorItemActivated();
|
||||
void onDefaultButtonClicked();
|
||||
void onCustomColorButtonClicked();
|
||||
void onKeySelected( QString key );
|
||||
void onColorHistoryChanged();
|
||||
void onComboIndexChanged( int index );
|
||||
|
||||
protected:
|
||||
void showEvent( QShowEvent* event ) override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Methods
|
||||
@@ -111,8 +109,7 @@ namespace glabels
|
||||
ColorHistory* mColorHistory;
|
||||
ColorPaletteItem* mHistoryItem[PALETTE_COLS];
|
||||
|
||||
QComboBox* mMergeFieldCombo;
|
||||
QStringList mKeys;
|
||||
FieldButton* mFieldButton;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,220 @@
|
||||
/* EditVariableDialog.cpp
|
||||
*
|
||||
* Copyright (C) 2019 Jim Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "EditVariableDialog.h"
|
||||
|
||||
#include "model/Settings.h"
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
// All variable types. (must be in sorted order)
|
||||
const QVector<glabels::model::Variable::Type> allTypes = {
|
||||
glabels::model::Variable::Type::STRING,
|
||||
glabels::model::Variable::Type::INTEGER,
|
||||
glabels::model::Variable::Type::FLOATING_POINT,
|
||||
glabels::model::Variable::Type::COLOR
|
||||
};
|
||||
|
||||
// All variable increments. (must be in sorted order)
|
||||
const QVector<glabels::model::Variable::Increment> allIncrements = {
|
||||
glabels::model::Variable::Increment::NEVER,
|
||||
glabels::model::Variable::Increment::PER_ITEM,
|
||||
glabels::model::Variable::Increment::PER_COPY,
|
||||
glabels::model::Variable::Increment::PER_PAGE
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
EditVariableDialog::EditVariableDialog( QWidget *parent )
|
||||
: QDialog(parent)
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
QRegularExpression reIdentifier( "[a-zA-Z_][a-zA-Z_0-9]*" );
|
||||
nameEdit->setValidator( new QRegularExpressionValidator( reIdentifier ) );
|
||||
|
||||
colorValueButton->init( tr("Default"),
|
||||
QColor(0,0,0,255),
|
||||
QColor(0,0,0,255),
|
||||
false );
|
||||
|
||||
for ( auto type : allTypes )
|
||||
{
|
||||
typeCombo->addItem( model::Variable::typeToI18nString( type ) );
|
||||
}
|
||||
|
||||
for ( auto type : allIncrements )
|
||||
{
|
||||
incrementCombo->addItem( model::Variable::incrementToI18nString( type ) );
|
||||
}
|
||||
|
||||
stepSizeEdit->setText( "1" );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Set variable
|
||||
///
|
||||
void EditVariableDialog::setVariable( const model::Variable& variable )
|
||||
{
|
||||
typeCombo->setCurrentIndex( static_cast<int>(variable.type()) );
|
||||
nameEdit->setText( variable.name() );
|
||||
valueEdit->setText( variable.initialValue() );
|
||||
colorValueButton->setColor( QColor( variable.initialValue() ) );
|
||||
incrementCombo->setCurrentIndex( static_cast<int>(variable.increment()) );
|
||||
stepSizeEdit->setText( variable.stepSize() );
|
||||
|
||||
updateControls();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get variable
|
||||
///
|
||||
model::Variable EditVariableDialog::variable() const
|
||||
{
|
||||
return model::Variable( static_cast<model::Variable::Type>(typeCombo->currentIndex()),
|
||||
nameEdit->text(),
|
||||
valueEdit->text(),
|
||||
static_cast<model::Variable::Increment>(incrementCombo->currentIndex()),
|
||||
stepSizeEdit->text() );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// nameEdit Changed
|
||||
///
|
||||
void EditVariableDialog::onNameEditChanged()
|
||||
{
|
||||
validateCurrentInputs();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// typeCombo Changed
|
||||
///
|
||||
void EditVariableDialog::onTypeComboChanged()
|
||||
{
|
||||
updateControls();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// valueEdit Changed
|
||||
///
|
||||
void EditVariableDialog::onValueEditChanged()
|
||||
{
|
||||
validateCurrentInputs();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// colorValueButton Changed
|
||||
///
|
||||
void EditVariableDialog::onColorValueButtonChanged()
|
||||
{
|
||||
valueEdit->setText( colorValueButton->colorNode().color().name() );
|
||||
validateCurrentInputs();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// incrementCombo Changed
|
||||
///
|
||||
void EditVariableDialog::onIncrementComboChanged()
|
||||
{
|
||||
updateControls();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// stepSizeEdit Changed
|
||||
///
|
||||
void EditVariableDialog::onStepSizeEditChanged()
|
||||
{
|
||||
validateCurrentInputs();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// update controls
|
||||
///
|
||||
void EditVariableDialog::updateControls()
|
||||
{
|
||||
auto type = static_cast<model::Variable::Type>(typeCombo->currentIndex());
|
||||
auto increment = static_cast<model::Variable::Increment>(incrementCombo->currentIndex());
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
||||
case model::Variable::Type::INTEGER:
|
||||
valueEdit->setValidator( new QIntValidator() );
|
||||
stepSizeEdit->setValidator( new QIntValidator() );
|
||||
break;
|
||||
|
||||
case model::Variable::Type::FLOATING_POINT:
|
||||
valueEdit->setValidator( new QDoubleValidator() );
|
||||
stepSizeEdit->setValidator( new QDoubleValidator() );
|
||||
break;
|
||||
|
||||
default:
|
||||
valueEdit->setValidator( nullptr );
|
||||
stepSizeEdit->setValidator( nullptr );
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
colorValueButton->setVisible( type == model::Variable::Type::COLOR );
|
||||
|
||||
bool isNumeric = ( type == model::Variable::Type::INTEGER ) ||
|
||||
( type == model::Variable::Type::FLOATING_POINT );
|
||||
|
||||
incrementGroup->setVisible( isNumeric );
|
||||
stepSizeLabel->setEnabled( isNumeric && (increment != model::Variable::Increment::NEVER) );
|
||||
stepSizeEdit->setEnabled( isNumeric && (increment != model::Variable::Increment::NEVER) );
|
||||
|
||||
validateCurrentInputs();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// validate current inputs
|
||||
///
|
||||
void EditVariableDialog::validateCurrentInputs()
|
||||
{
|
||||
bool hasValidIdentifier = nameEdit->hasAcceptableInput();
|
||||
bool hasValidValue = valueEdit->hasAcceptableInput();
|
||||
bool hasValidStepSize = stepSizeEdit->hasAcceptableInput();
|
||||
|
||||
bool isValid = hasValidIdentifier && hasValidValue && hasValidStepSize;
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setEnabled( isValid );
|
||||
}
|
||||
|
||||
|
||||
} // namespace glabels
|
||||
@@ -1,6 +1,6 @@
|
||||
/* ColorPaletteButtonItem.h
|
||||
/* EditVariableDialog.h
|
||||
*
|
||||
* Copyright (C) 2014 Jim Evins <evins@snaught.com>
|
||||
* Copyright (C) 2019 Jim Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
@@ -18,21 +18,21 @@
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ColorPaletteButtonItem_h
|
||||
#define ColorPaletteButtonItem_h
|
||||
#ifndef EditVariableDialog_h
|
||||
#define EditVariableDialog_h
|
||||
|
||||
|
||||
#include <QColor>
|
||||
#include <QWidget>
|
||||
#include "ui_EditVariableDialog.h"
|
||||
#include "model/Variable.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Color Palette Item
|
||||
/// New Label Dialog Widget
|
||||
///
|
||||
class ColorPaletteButtonItem : public QWidget
|
||||
class EditVariableDialog : public QDialog, public Ui_EditVariableDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -40,36 +40,37 @@ namespace glabels
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
ColorPaletteButtonItem( const QString& text, QWidget* parent = nullptr );
|
||||
EditVariableDialog( QWidget *parent = nullptr );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Signals
|
||||
// Public methods
|
||||
/////////////////////////////////
|
||||
signals:
|
||||
void activated();
|
||||
|
||||
void setVariable( const model::Variable& variable );
|
||||
model::Variable variable() const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Event handlers
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
void paintEvent( QPaintEvent* event ) override;
|
||||
void enterEvent( QEvent* event ) override;
|
||||
void leaveEvent( QEvent* event ) override;
|
||||
void mousePressEvent( QMouseEvent* event ) override;
|
||||
|
||||
private slots:
|
||||
void onNameEditChanged();
|
||||
void onTypeComboChanged();
|
||||
void onValueEditChanged();
|
||||
void onColorValueButtonChanged();
|
||||
void onIncrementComboChanged();
|
||||
void onStepSizeEditChanged();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Data
|
||||
// Private methods
|
||||
/////////////////////////////////
|
||||
private:
|
||||
QString mText;
|
||||
void updateControls();
|
||||
void validateCurrentInputs();
|
||||
|
||||
bool mHover;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // ColorPaletteButtonItem_h
|
||||
#endif // EditVariableDialog_h
|
||||
+38
-56
@@ -1,6 +1,6 @@
|
||||
/* FieldButton.cpp
|
||||
*
|
||||
* Copyright (C) 2014-2016 Jim Evins <evins@snaught.com>
|
||||
* Copyright (C) 2019 Jim Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
@@ -30,79 +30,61 @@ namespace glabels
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
FieldButton::FieldButton( QWidget* parent )
|
||||
: QComboBox(parent)
|
||||
FieldButton::FieldButton( QWidget* parent ) : QPushButton(parent)
|
||||
{
|
||||
setEnabled( false );
|
||||
|
||||
connect( this, SIGNAL(currentIndexChanged(int)), this, SLOT(onIndexChanged(int)) );
|
||||
setMenu( &mMenu );
|
||||
|
||||
connect( &mMenu, SIGNAL(triggered(QAction*)),
|
||||
this, SLOT(onMenuActionTriggered(QAction*)) );
|
||||
}
|
||||
|
||||
|
||||
void FieldButton::setName( const QString& name )
|
||||
{
|
||||
mName = name;
|
||||
if ( count() == 0 )
|
||||
{
|
||||
addItem( mName );
|
||||
}
|
||||
else
|
||||
{
|
||||
setItemText( 0, mName );
|
||||
}
|
||||
|
||||
// Item 0 is the ComboBox title, not an item intended for selection. So disable it.
|
||||
const auto* itemModel = qobject_cast<const QStandardItemModel*>(model());
|
||||
QStandardItem* item = itemModel->item(0);
|
||||
item->setFlags( item->flags() & ~(Qt::ItemIsSelectable|Qt::ItemIsEnabled) );
|
||||
}
|
||||
|
||||
|
||||
void FieldButton::setKeys( const QStringList& keyList )
|
||||
///
|
||||
/// Set Keys
|
||||
///
|
||||
void FieldButton::setKeys( const merge::Merge* merge,
|
||||
const model::Variables* variables )
|
||||
{
|
||||
// Clear old keys
|
||||
clear();
|
||||
addItem( mName );
|
||||
mMenu.clear();
|
||||
|
||||
// Add merge keys, if any
|
||||
mMenu.addSection( tr("Merge fields") );
|
||||
for ( auto& key : merge->keys() )
|
||||
{
|
||||
auto* action = mMenu.addAction( QString( "${%1}" ).arg( key ) );
|
||||
action->setData( key );
|
||||
}
|
||||
if ( merge->keys().empty() )
|
||||
{
|
||||
auto* action = mMenu.addAction( "None" );
|
||||
action->setEnabled( false );
|
||||
}
|
||||
|
||||
// Item 0 is the ComboBox title, not an item intended for selection. So disable it.
|
||||
const auto* itemModel = qobject_cast<const QStandardItemModel*>(model());
|
||||
QStandardItem* item = itemModel->item(0);
|
||||
item->setFlags( item->flags() & ~(Qt::ItemIsSelectable|Qt::ItemIsEnabled) );
|
||||
|
||||
// Add new keys
|
||||
if ( keyList.size() > 0 )
|
||||
// Add variable keys, if any
|
||||
mMenu.addSection( tr("Variables") );
|
||||
for ( auto& key : variables->keys() )
|
||||
{
|
||||
addItems( keyList );
|
||||
setEnabled( true );
|
||||
auto* action = mMenu.addAction( QString( "${%1}" ).arg( key ) );
|
||||
action->setData( key );
|
||||
}
|
||||
else
|
||||
if ( variables->keys().empty() )
|
||||
{
|
||||
setEnabled( false );
|
||||
auto* action = mMenu.addAction( "None" );
|
||||
action->setEnabled( false );
|
||||
}
|
||||
|
||||
setEnabled( !merge->keys().empty() || !variables->keys().empty() );
|
||||
}
|
||||
|
||||
|
||||
void FieldButton::clearKeys()
|
||||
{
|
||||
clear();
|
||||
addItem( mName );
|
||||
|
||||
setEnabled( false );
|
||||
}
|
||||
|
||||
|
||||
|
||||
///
|
||||
/// onMenuKeySelected slot
|
||||
/// onMenuActionTriggered slot
|
||||
///
|
||||
void FieldButton::onIndexChanged( int index )
|
||||
void FieldButton::onMenuActionTriggered( QAction* action )
|
||||
{
|
||||
if ( index > 0 )
|
||||
{
|
||||
emit keySelected( itemText(index) );
|
||||
|
||||
setCurrentIndex( 0 );
|
||||
}
|
||||
emit keySelected( action->data().toString() );
|
||||
}
|
||||
|
||||
} // namespace glabels
|
||||
|
||||
+13
-9
@@ -1,6 +1,6 @@
|
||||
/* FieldButton.h
|
||||
*
|
||||
* Copyright (C) 2014-2016 Jim Evins <evins@snaught.com>
|
||||
* Copyright (C) 2019 Jim Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
@@ -22,8 +22,13 @@
|
||||
#define FieldButton_h
|
||||
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QString>
|
||||
#include "model/Variables.h"
|
||||
#include "merge/Merge.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QPushButton>
|
||||
#include <QMenu>
|
||||
#include <QStringList>
|
||||
|
||||
|
||||
namespace glabels
|
||||
@@ -32,7 +37,7 @@ namespace glabels
|
||||
///
|
||||
/// Field Button
|
||||
///
|
||||
class FieldButton : public QComboBox
|
||||
class FieldButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -54,23 +59,22 @@ namespace glabels
|
||||
// Public Methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
void setName( const QString& name = "" );
|
||||
void setKeys( const QStringList& keyList );
|
||||
void clearKeys();
|
||||
void setKeys( const merge::Merge* merge,
|
||||
const model::Variables* variables );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
private slots:
|
||||
void onIndexChanged( int index );
|
||||
void onMenuActionTriggered( QAction* action );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
QString mName;
|
||||
QMenu mMenu;
|
||||
|
||||
};
|
||||
|
||||
|
||||
+2
-5
@@ -112,8 +112,6 @@ namespace glabels
|
||||
model::Model *model = model::XmlLabelParser::readFile( fileName );
|
||||
if ( model )
|
||||
{
|
||||
model->setFileName( fileName );
|
||||
|
||||
// Either apply to current window or open a new one
|
||||
if ( window->isEmpty() )
|
||||
{
|
||||
@@ -152,8 +150,6 @@ namespace glabels
|
||||
model::Model *model = model::XmlLabelParser::readFile( fileName );
|
||||
if ( model )
|
||||
{
|
||||
model->setFileName( fileName );
|
||||
|
||||
// Either apply to current window or open a new one
|
||||
if ( window->isEmpty() )
|
||||
{
|
||||
@@ -213,7 +209,8 @@ namespace glabels
|
||||
///
|
||||
bool File::saveAs( MainWindow *window )
|
||||
{
|
||||
// Either use the saved CWD from a previous open/save or grab it from the path of the current file
|
||||
// Either use the saved CWD from a previous open/save or grab it from the path
|
||||
// of the current file.
|
||||
QString cwd = mCwd;
|
||||
if ( window->model() && !window->model()->fileName().isEmpty() )
|
||||
{
|
||||
|
||||
@@ -473,6 +473,16 @@ namespace glabels
|
||||
};
|
||||
|
||||
|
||||
class Variables : public QIcon
|
||||
{
|
||||
public:
|
||||
Variables()
|
||||
{
|
||||
addPixmap( QPixmap( ":icons/flat/48x48/glabels-variables.svg" ) );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class ZoomBestFit : public QIcon
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -1162,7 +1162,7 @@ namespace glabels
|
||||
void
|
||||
LabelEditor::drawObjectsLayer( QPainter* painter )
|
||||
{
|
||||
mModel->draw( painter );
|
||||
mModel->draw( painter, true, nullptr, nullptr );
|
||||
}
|
||||
|
||||
|
||||
|
||||
+53
-2
@@ -31,6 +31,7 @@
|
||||
#include "PropertiesView.h"
|
||||
#include "StartupView.h"
|
||||
#include "UndoRedoModel.h"
|
||||
#include "VariablesView.h"
|
||||
|
||||
#include "model/Db.h"
|
||||
#include "model/Model.h"
|
||||
@@ -51,7 +52,8 @@ namespace
|
||||
EDITOR_PAGE_INDEX = 1,
|
||||
PROPERTIES_PAGE_INDEX = 2,
|
||||
MERGE_PAGE_INDEX = 3,
|
||||
PRINT_PAGE_INDEX = 4,
|
||||
VARIABLES_PAGE_INDEX = 4,
|
||||
PRINT_PAGE_INDEX = 5,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -76,6 +78,7 @@ namespace glabels
|
||||
QWidget* editorPage = createEditorPage();
|
||||
QWidget* propertiesPage = createPropertiesPage();
|
||||
QWidget* mergePage = createMergePage();
|
||||
QWidget* variablesPage = createVariablesPage();
|
||||
QWidget* printPage = createPrintPage();
|
||||
|
||||
// Table of contents widget
|
||||
@@ -141,6 +144,18 @@ namespace glabels
|
||||
mMergeAction = mContents->addWidget( mMergeButton );
|
||||
group->addButton( mMergeButton );
|
||||
|
||||
// Add "Variables" page
|
||||
mPages->addWidget( variablesPage );
|
||||
mVariablesButton = new QToolButton( this );
|
||||
mVariablesButton->setIcon( Icons::Variables() );
|
||||
mVariablesButton->setText( tr("Variables") );
|
||||
mVariablesButton->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
|
||||
mVariablesButton->setCheckable( true );
|
||||
mVariablesButton->setSizePolicy( QSizePolicy::MinimumExpanding,
|
||||
QSizePolicy::Preferred );
|
||||
mVariablesAction = mContents->addWidget( mVariablesButton );
|
||||
group->addButton( mVariablesButton );
|
||||
|
||||
// Add "Print" page
|
||||
mPages->addWidget( printPage );
|
||||
mPrintButton = new QToolButton( this );
|
||||
@@ -175,6 +190,7 @@ namespace glabels
|
||||
connect( mEditorButton, SIGNAL(toggled(bool)), this, SLOT(changePage(bool)));
|
||||
connect( mPropertiesButton, SIGNAL(toggled(bool)), this, SLOT(changePage(bool)));
|
||||
connect( mMergeButton, SIGNAL(toggled(bool)), this, SLOT(changePage(bool)));
|
||||
connect( mVariablesButton, SIGNAL(toggled(bool)), this, SLOT(changePage(bool)));
|
||||
connect( mPrintButton, SIGNAL(toggled(bool)), this, SLOT(changePage(bool)));
|
||||
connect( mLabelEditor, SIGNAL(zoomChanged()), this, SLOT(onZoomChanged()) );
|
||||
connect( model::Settings::instance(), SIGNAL(changed()), this, SLOT(onSettingsChanged()) );
|
||||
@@ -201,6 +217,7 @@ namespace glabels
|
||||
if ( mModel )
|
||||
{
|
||||
delete mModel->merge(); // Ownership of final Merge instance is ours
|
||||
delete mModel->variables(); // Ownership of final Variables instance is ours
|
||||
delete mModel;
|
||||
}
|
||||
}
|
||||
@@ -226,7 +243,8 @@ namespace glabels
|
||||
mPropertiesView->setModel( mModel, mUndoRedoModel );
|
||||
mLabelEditor->setModel( mModel, mUndoRedoModel );
|
||||
mObjectEditor->setModel( mModel, mUndoRedoModel );
|
||||
mMergeView->setModel( mModel , mUndoRedoModel );
|
||||
mMergeView->setModel( mModel, mUndoRedoModel );
|
||||
mVariablesView->setModel( mModel, mUndoRedoModel );
|
||||
mPrintView->setModel( mModel );
|
||||
|
||||
mEditorButton->setChecked( true );
|
||||
@@ -323,6 +341,11 @@ namespace glabels
|
||||
fileShowMergePageAction->setStatusTip( tr("Select project Merge mode") );
|
||||
connect( fileShowMergePageAction, SIGNAL(triggered()), this, SLOT(fileShowMergePage()) );
|
||||
|
||||
fileShowVariablesPageAction = new QAction( tr("&Variables") , this );
|
||||
fileShowVariablesPageAction->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_4 ) );
|
||||
fileShowVariablesPageAction->setStatusTip( tr("Select project Variables mode") );
|
||||
connect( fileShowVariablesPageAction, SIGNAL(triggered()), this, SLOT(fileShowVariablesPage()) );
|
||||
|
||||
fileShowPrintPageAction = new QAction( tr("&Print") , this );
|
||||
fileShowPrintPageAction->setShortcut( QKeySequence::Print );
|
||||
fileShowPrintPageAction->setStatusTip( tr("Select project Print mode") );
|
||||
@@ -611,6 +634,7 @@ namespace glabels
|
||||
fileMenu->addAction( fileShowEditorPageAction );
|
||||
fileMenu->addAction( fileShowPropertiesPageAction );
|
||||
fileMenu->addAction( fileShowMergePageAction );
|
||||
fileMenu->addAction( fileShowVariablesPageAction );
|
||||
fileMenu->addAction( fileShowPrintPageAction );
|
||||
fileMenu->addSeparator();
|
||||
fileMenu->addAction( fileTemplateDesignerAction );
|
||||
@@ -823,6 +847,17 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create Variables Page
|
||||
///
|
||||
QWidget* MainWindow::createVariablesPage()
|
||||
{
|
||||
mVariablesView = new VariablesView();
|
||||
|
||||
return mVariablesView;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create Print Page
|
||||
///
|
||||
@@ -847,6 +882,7 @@ namespace glabels
|
||||
bool isEditorPage = mEditorButton->isChecked();
|
||||
bool isPropertiesPage = mPropertiesButton->isChecked();
|
||||
bool isMergePage = mMergeButton->isChecked();
|
||||
bool isVariablesPage = mVariablesButton->isChecked();
|
||||
bool isPrintPage = mPrintButton->isChecked();
|
||||
|
||||
// What is the current selection state?
|
||||
@@ -859,6 +895,7 @@ namespace glabels
|
||||
mEditorAction->setVisible( !isWelcomePage );
|
||||
mPropertiesAction->setVisible( !isWelcomePage );
|
||||
mMergeAction->setVisible( !isWelcomePage );
|
||||
mVariablesAction->setVisible( !isWelcomePage );
|
||||
mPrintAction->setVisible( !isWelcomePage );
|
||||
|
||||
// Recent file actions
|
||||
@@ -884,6 +921,7 @@ namespace glabels
|
||||
fileShowEditorPageAction->setEnabled( !isWelcomePage && !isEditorPage );
|
||||
fileShowPropertiesPageAction->setEnabled( !isWelcomePage && !isPropertiesPage );
|
||||
fileShowMergePageAction->setEnabled( !isWelcomePage && !isMergePage );
|
||||
fileShowVariablesPageAction->setEnabled( !isWelcomePage && !isVariablesPage );
|
||||
fileShowPrintPageAction->setEnabled( !isWelcomePage && !isPrintPage );
|
||||
fileTemplateDesignerAction->setEnabled( true );
|
||||
fileCloseAction->setEnabled( true );
|
||||
@@ -1110,6 +1148,10 @@ namespace glabels
|
||||
{
|
||||
mPages->setCurrentIndex( MERGE_PAGE_INDEX );
|
||||
}
|
||||
else if ( mVariablesButton->isChecked() )
|
||||
{
|
||||
mPages->setCurrentIndex( VARIABLES_PAGE_INDEX );
|
||||
}
|
||||
else if ( mPrintButton->isChecked() )
|
||||
{
|
||||
mPages->setCurrentIndex( PRINT_PAGE_INDEX );
|
||||
@@ -1206,6 +1248,15 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// File->Show Variables Page
|
||||
///
|
||||
void MainWindow::fileShowVariablesPage()
|
||||
{
|
||||
mVariablesButton->setChecked( true );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// File->Show Print Page
|
||||
///
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace glabels
|
||||
class PropertiesView;
|
||||
class StartupView;
|
||||
class UndoRedoModel;
|
||||
class VariablesView;
|
||||
|
||||
|
||||
///
|
||||
@@ -97,6 +98,7 @@ namespace glabels
|
||||
void fileShowEditorPage();
|
||||
void fileShowPropertiesPage();
|
||||
void fileShowMergePage();
|
||||
void fileShowVariablesPage();
|
||||
void fileShowPrintPage();
|
||||
void fileTemplateDesigner();
|
||||
void fileClose();
|
||||
@@ -175,6 +177,7 @@ namespace glabels
|
||||
QWidget* createEditorPage();
|
||||
QWidget* createPropertiesPage();
|
||||
QWidget* createMergePage();
|
||||
QWidget* createVariablesPage();
|
||||
QWidget* createPrintPage();
|
||||
|
||||
void manageActions();
|
||||
@@ -222,12 +225,14 @@ namespace glabels
|
||||
QToolButton* mEditorButton;
|
||||
QToolButton* mPropertiesButton;
|
||||
QToolButton* mMergeButton;
|
||||
QToolButton* mVariablesButton;
|
||||
QToolButton* mPrintButton;
|
||||
|
||||
QAction* mWelcomeAction;
|
||||
QAction* mEditorAction;
|
||||
QAction* mPropertiesAction;
|
||||
QAction* mMergeAction;
|
||||
QAction* mVariablesAction;
|
||||
QAction* mPrintAction;
|
||||
|
||||
QStackedWidget* mPages;
|
||||
@@ -237,6 +242,7 @@ namespace glabels
|
||||
ObjectEditor* mObjectEditor;
|
||||
PropertiesView* mPropertiesView;
|
||||
MergeView* mMergeView;
|
||||
VariablesView* mVariablesView;
|
||||
PrintView* mPrintView;
|
||||
|
||||
QLabel* zoomInfoLabel;
|
||||
@@ -249,6 +255,7 @@ namespace glabels
|
||||
QAction* fileShowEditorPageAction;
|
||||
QAction* fileShowPropertiesPageAction;
|
||||
QAction* fileShowMergePageAction;
|
||||
QAction* fileShowVariablesPageAction;
|
||||
QAction* fileShowPrintPageAction;
|
||||
QAction* fileTemplateDesignerAction;
|
||||
QAction* fileCloseAction;
|
||||
|
||||
+11
-21
@@ -63,14 +63,7 @@ namespace glabels
|
||||
mUndoRedoModel = undoRedoModel;
|
||||
|
||||
// Initialize CWD
|
||||
if ( model->fileName().isEmpty() )
|
||||
{
|
||||
mCwd = ".";
|
||||
}
|
||||
else
|
||||
{
|
||||
mCwd = QFileInfo( model->fileName() ).absolutePath();
|
||||
}
|
||||
mCwd = mModel->dirPath();
|
||||
|
||||
onMergeChanged();
|
||||
connect( mModel, SIGNAL(mergeChanged()), this, SLOT(onMergeChanged()) );
|
||||
@@ -87,26 +80,22 @@ namespace glabels
|
||||
mOldFormatComboIndex = index;
|
||||
formatCombo->setCurrentIndex( index );
|
||||
|
||||
QString fn;
|
||||
|
||||
switch ( merge::Factory::idToType( mModel->merge()->id() ) )
|
||||
{
|
||||
case merge::Factory::NONE:
|
||||
case merge::Factory::FIXED:
|
||||
locationLabel->setEnabled( false );
|
||||
locationButton->setEnabled( false );
|
||||
locationButton->setText( "" );
|
||||
locationLineEdit->setText( "" );
|
||||
locationBrowseButton->setVisible( false );
|
||||
break;
|
||||
|
||||
case merge::Factory::FILE:
|
||||
locationLabel->setEnabled( true );
|
||||
locationButton->setEnabled( true );
|
||||
if ( mModel->merge()->source().isEmpty() )
|
||||
{
|
||||
locationButton->setText( "Select file..." );
|
||||
}
|
||||
else
|
||||
{
|
||||
locationButton->setText( mModel->merge()->source() );
|
||||
}
|
||||
fn = mModel->dir().relativeFilePath( mModel->merge()->source() );
|
||||
locationLineEdit->setText( fn );
|
||||
locationBrowseButton->setVisible( true );
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -135,7 +124,8 @@ namespace glabels
|
||||
///
|
||||
void MergeView::onMergeSourceChanged()
|
||||
{
|
||||
locationButton->setText( mModel->merge()->source() );
|
||||
QString fn = mModel->dir().relativeFilePath( mModel->merge()->source() );
|
||||
locationLineEdit->setText( fn );
|
||||
|
||||
recordsTable->clear();
|
||||
recordsTable->setColumnCount( 0 );
|
||||
@@ -185,7 +175,7 @@ namespace glabels
|
||||
///
|
||||
/// Location button clicked handler
|
||||
///
|
||||
void MergeView::onLocationButtonClicked()
|
||||
void MergeView::onLocationBrowseButtonClicked()
|
||||
{
|
||||
QString fileName =
|
||||
QFileDialog::getOpenFileName( this,
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ namespace glabels
|
||||
void onMergeSelectionChanged();
|
||||
|
||||
void onFormatComboActivated();
|
||||
void onLocationButtonClicked();
|
||||
void onLocationBrowseButtonClicked();
|
||||
void onSelectAllButtonClicked();
|
||||
void onUnselectAllButtonClicked();
|
||||
void onCellChanged( int iRow, int iCol );
|
||||
|
||||
+27
-18
@@ -36,6 +36,7 @@
|
||||
#include "merge/Merge.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QDir>
|
||||
#include <QtMath>
|
||||
#include <QtDebug>
|
||||
|
||||
@@ -67,9 +68,9 @@ namespace glabels
|
||||
barcodeColorButton->init( tr("Default"), QColor(0,0,0,255), QColor(0,0,0,255) );
|
||||
shadowColorButton->init( tr("Default"), QColor(0,0,0,255), QColor(0,0,0,255) );
|
||||
|
||||
textInsertFieldCombo->setName( tr("Insert Field") );
|
||||
barcodeInsertFieldCombo->setName( tr("Insert Field") );
|
||||
imageFieldCombo->setName( tr("Key") );
|
||||
textInsertFieldButton->setText( tr("Insert substitution field") );
|
||||
barcodeInsertFieldButton->setText( tr("Insert substitution field") );
|
||||
imageFieldButton->setText( tr("Use substitution field") );
|
||||
|
||||
setEnabled( false );
|
||||
hidePages();
|
||||
@@ -93,11 +94,14 @@ namespace glabels
|
||||
this, SLOT(onSelectionChanged()) );
|
||||
|
||||
connect( mModel, SIGNAL(mergeSourceChanged()),
|
||||
this, SLOT(onMergeSourceChanged()) );
|
||||
this, SLOT(onFieldsAvailableChanged()) );
|
||||
|
||||
connect( mModel, SIGNAL(variablesChanged()),
|
||||
this, SLOT(onFieldsAvailableChanged()) );
|
||||
|
||||
onLabelSizeChanged();
|
||||
onSelectionChanged();
|
||||
onMergeSourceChanged();
|
||||
onFieldsAvailableChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -122,12 +126,12 @@ namespace glabels
|
||||
|
||||
if ( filenameNode.isField() )
|
||||
{
|
||||
QString field = QString("${%1}").arg( filenameNode.data() );
|
||||
imageFilenameLineEdit->setText( field );
|
||||
imageFilenameLineEdit->setText( QString("${%1}").arg(filenameNode.data()) );
|
||||
}
|
||||
else
|
||||
{
|
||||
imageFilenameLineEdit->setText( filenameNode.data() );
|
||||
QString fn = mModel->dir().relativeFilePath( filenameNode.data() );
|
||||
imageFilenameLineEdit->setText( fn );
|
||||
}
|
||||
|
||||
mBlocked = false;
|
||||
@@ -499,17 +503,19 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
void ObjectEditor::onMergeSourceChanged()
|
||||
void ObjectEditor::onFieldsAvailableChanged()
|
||||
{
|
||||
if ( !mBlocked )
|
||||
{
|
||||
QStringList keys = mModel->merge()->keys();
|
||||
lineColorButton->setKeys( keys );
|
||||
fillColorButton->setKeys( keys );
|
||||
textInsertFieldCombo->setKeys( keys );
|
||||
barcodeInsertFieldCombo->setKeys( keys );
|
||||
imageFieldCombo->setKeys( keys );
|
||||
shadowColorButton->setKeys( keys );
|
||||
lineColorButton->setKeys( mModel->merge(), mModel->variables() );
|
||||
fillColorButton->setKeys( mModel->merge(), mModel->variables() );
|
||||
textColorButton->setKeys( mModel->merge(), mModel->variables() );
|
||||
barcodeColorButton->setKeys( mModel->merge(), mModel->variables() );
|
||||
shadowColorButton->setKeys( mModel->merge(), mModel->variables() );
|
||||
|
||||
textInsertFieldButton->setKeys( mModel->merge(), mModel->variables() );
|
||||
barcodeInsertFieldButton->setKeys( mModel->merge(), mModel->variables() );
|
||||
imageFieldButton->setKeys( mModel->merge(), mModel->variables() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -620,8 +626,11 @@ namespace glabels
|
||||
|
||||
void ObjectEditor::onImageKeySelected( QString key )
|
||||
{
|
||||
mUndoRedoModel->checkpoint( tr("Set image") );
|
||||
mObject->setFilenameNode( model::TextNode( true, key ) );
|
||||
if ( mObject )
|
||||
{
|
||||
mUndoRedoModel->checkpoint( tr("Set image") );
|
||||
mObject->setFilenameNode( model::TextNode( true, key ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace glabels
|
||||
void onSettingsChanged();
|
||||
void onLabelSizeChanged();
|
||||
void onSelectionChanged();
|
||||
void onMergeSourceChanged();
|
||||
void onFieldsAvailableChanged();
|
||||
void onObjectChanged();
|
||||
void onObjectMoved();
|
||||
void onObjectDestroyed();
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
/* VariablesView.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jim Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "VariablesView.h"
|
||||
|
||||
#include "EditVariableDialog.h"
|
||||
|
||||
#include <QTableWidgetItem>
|
||||
#include <QtDebug>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
enum ICol {
|
||||
I_COL_NAME,
|
||||
I_COL_TYPE,
|
||||
I_COL_VALUE,
|
||||
I_COL_INCREMENT,
|
||||
I_COL_STEP_SIZE,
|
||||
I_COL_DUMMY,
|
||||
N_COLS
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
VariablesView::VariablesView( QWidget *parent )
|
||||
: QWidget(parent), mModel(nullptr), mUndoRedoModel(nullptr)
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
titleLabel->setText( QString( "<span style='font-size:18pt;'>%1</span>" ).arg( tr("Variables") ) );
|
||||
|
||||
table->setColumnCount( N_COLS );
|
||||
|
||||
auto* nameHeaderItem = new QTableWidgetItem( tr("Name") );
|
||||
nameHeaderItem->setFlags( nameHeaderItem->flags() ^ Qt::ItemIsEditable );
|
||||
table->setHorizontalHeaderItem( I_COL_NAME, nameHeaderItem );
|
||||
|
||||
auto* typeHeaderItem = new QTableWidgetItem( tr("Type") );
|
||||
typeHeaderItem->setFlags( typeHeaderItem->flags() ^ Qt::ItemIsEditable );
|
||||
table->setHorizontalHeaderItem( I_COL_TYPE, typeHeaderItem );
|
||||
|
||||
auto* valueHeaderItem = new QTableWidgetItem( tr("Value") );
|
||||
valueHeaderItem->setFlags( valueHeaderItem->flags() ^ Qt::ItemIsEditable );
|
||||
table->setHorizontalHeaderItem( I_COL_VALUE, valueHeaderItem );
|
||||
|
||||
auto* incrementHeaderItem = new QTableWidgetItem( tr("Increment") );
|
||||
incrementHeaderItem->setFlags( incrementHeaderItem->flags() ^ Qt::ItemIsEditable );
|
||||
table->setHorizontalHeaderItem( I_COL_INCREMENT, incrementHeaderItem );
|
||||
|
||||
auto* stepSizeHeaderItem = new QTableWidgetItem( tr("Step Size") );
|
||||
stepSizeHeaderItem->setFlags( stepSizeHeaderItem->flags() ^ Qt::ItemIsEditable );
|
||||
table->setHorizontalHeaderItem( I_COL_STEP_SIZE, stepSizeHeaderItem );
|
||||
|
||||
auto* dummyHeaderItem = new QTableWidgetItem();
|
||||
dummyHeaderItem->setFlags( Qt::NoItemFlags );
|
||||
table->setHorizontalHeaderItem( I_COL_DUMMY, dummyHeaderItem );
|
||||
table->horizontalHeader()->setStretchLastSection( true );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Destructor
|
||||
///
|
||||
VariablesView::~VariablesView()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Set Model
|
||||
///
|
||||
void VariablesView::setModel( model::Model* model, UndoRedoModel* undoRedoModel )
|
||||
{
|
||||
mModel = model;
|
||||
mUndoRedoModel = undoRedoModel;
|
||||
|
||||
updateControls();
|
||||
loadTable();
|
||||
|
||||
connect( mModel, SIGNAL(variablesChanged()), this, SLOT(onVariablesChanged()) );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// table Selection Changed
|
||||
///
|
||||
void VariablesView::onTableSelectionChanged()
|
||||
{
|
||||
updateControls();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// addButton Clicked
|
||||
///
|
||||
void VariablesView::onAddButtonClicked()
|
||||
{
|
||||
EditVariableDialog dialog( this );
|
||||
|
||||
model::Variable v( model::Variable::Type::INTEGER,
|
||||
"x",
|
||||
"0",
|
||||
model::Variable::Increment::NEVER,
|
||||
"1" );
|
||||
dialog.setVariable( v );
|
||||
dialog.setWindowTitle( tr("Add Variable") );
|
||||
|
||||
if ( dialog.exec() == QDialog::Accepted )
|
||||
{
|
||||
mModel->variables()->addVariable( dialog.variable() );
|
||||
selectVariable( dialog.variable().name() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// editButton Clicked
|
||||
///
|
||||
void VariablesView::onEditButtonClicked()
|
||||
{
|
||||
int iRow = table->selectedItems()[0]->row();
|
||||
QString name = table->item( iRow, I_COL_NAME )->text();
|
||||
|
||||
if ( mModel->variables()->hasVariable( name ) )
|
||||
{
|
||||
model::Variable v = mModel->variables()->value( name );
|
||||
|
||||
EditVariableDialog dialog( this );
|
||||
dialog.setVariable( v );
|
||||
dialog.setWindowTitle( tr("Edit Variable") );
|
||||
|
||||
if ( dialog.exec() == QDialog::Accepted )
|
||||
{
|
||||
mModel->variables()->replaceVariable( name, dialog.variable() );
|
||||
selectVariable( dialog.variable().name() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// deleteButton Clicked
|
||||
///
|
||||
void VariablesView::onDeleteButtonClicked()
|
||||
{
|
||||
int iRow = table->selectedItems()[0]->row();
|
||||
|
||||
QString name = table->item( iRow, I_COL_NAME )->text();
|
||||
mModel->variables()->deleteVariable( name );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Variables Changed
|
||||
///
|
||||
void VariablesView::onVariablesChanged()
|
||||
{
|
||||
// Reload table from variables
|
||||
loadTable();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// update controls
|
||||
///
|
||||
void VariablesView::updateControls()
|
||||
{
|
||||
bool hasSelection = !table->selectedItems().isEmpty();
|
||||
|
||||
editButton->setEnabled( hasSelection );
|
||||
deleteButton->setEnabled( hasSelection );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// load table from variables
|
||||
///
|
||||
void VariablesView::loadTable()
|
||||
{
|
||||
table->clearContents();
|
||||
table->setRowCount( mModel->variables()->size() );
|
||||
|
||||
int iRow = 0;
|
||||
for( const auto& v : *mModel->variables() )
|
||||
{
|
||||
auto* typeItem = new QTableWidgetItem( model::Variable::typeToI18nString(v.type()) );
|
||||
typeItem->setFlags( typeItem->flags() ^ Qt::ItemIsEditable );
|
||||
table->setItem( iRow, I_COL_TYPE, typeItem );
|
||||
|
||||
auto* nameItem = new QTableWidgetItem( v.name() );
|
||||
nameItem->setFlags( nameItem->flags() ^ Qt::ItemIsEditable );
|
||||
table->setItem( iRow, I_COL_NAME, nameItem );
|
||||
|
||||
auto* valueItem = new QTableWidgetItem( v.initialValue() );
|
||||
valueItem->setFlags( valueItem->flags() ^ Qt::ItemIsEditable );
|
||||
table->setItem( iRow, I_COL_VALUE, valueItem );
|
||||
|
||||
auto* incrementItem = new QTableWidgetItem( model::Variable::incrementToI18nString(v.increment()) );
|
||||
incrementItem->setFlags( incrementItem->flags() ^ Qt::ItemIsEditable );
|
||||
table->setItem( iRow, I_COL_INCREMENT, incrementItem );
|
||||
|
||||
auto* stepSizeItem = new QTableWidgetItem( v.stepSize() );
|
||||
stepSizeItem->setFlags( stepSizeItem->flags() ^ Qt::ItemIsEditable );
|
||||
table->setItem( iRow, I_COL_STEP_SIZE, stepSizeItem );
|
||||
|
||||
table->showRow( iRow );
|
||||
iRow++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void VariablesView::selectVariable( const QString& name )
|
||||
{
|
||||
int iRow = 0;
|
||||
for( const auto& v : *mModel->variables() )
|
||||
{
|
||||
if ( v.name() == name )
|
||||
{
|
||||
table->setCurrentCell( iRow, 0,
|
||||
(QItemSelectionModel::Select|QItemSelectionModel::Rows) );
|
||||
break;
|
||||
}
|
||||
|
||||
iRow++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace glabels
|
||||
@@ -0,0 +1,91 @@
|
||||
/* VariablesView.h
|
||||
*
|
||||
* Copyright (C) 2016 Jim Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef VariablesView_h
|
||||
#define VariablesView_h
|
||||
|
||||
|
||||
#include "ui_VariablesView.h"
|
||||
|
||||
#include "model/Model.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
// Forward references
|
||||
class UndoRedoModel;
|
||||
|
||||
|
||||
///
|
||||
/// Variables Property Editor Widget
|
||||
///
|
||||
class VariablesView : public QWidget, public Ui_VariablesView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
VariablesView( QWidget *parent = nullptr );
|
||||
~VariablesView() override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Public methods
|
||||
/////////////////////////////////
|
||||
void setModel( model::Model* model, UndoRedoModel* undoRedoModel );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
private slots:
|
||||
void onTableSelectionChanged();
|
||||
void onAddButtonClicked();
|
||||
void onEditButtonClicked();
|
||||
void onDeleteButtonClicked();
|
||||
void onVariablesChanged();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private methods
|
||||
/////////////////////////////////
|
||||
private:
|
||||
void updateControls();
|
||||
void loadTable();
|
||||
void selectVariable( const QString& name );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
model::Model* mModel;
|
||||
UndoRedoModel* mUndoRedoModel;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // VariablesView_h
|
||||
@@ -102,6 +102,7 @@
|
||||
<file>icons/flat/48x48/glabels-merge.svg</file>
|
||||
<file>icons/flat/48x48/glabels-print.svg</file>
|
||||
<file>icons/flat/48x48/glabels-properties.svg</file>
|
||||
<file>icons/flat/48x48/glabels-variables.svg</file>
|
||||
<file>icons/apps/48x48/glabels.svg</file>
|
||||
|
||||
<file>icons/apps/128x128/glabels.svg</file>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="48" height="48" >
|
||||
|
||||
<g transform="translate(0,-282.3)" >
|
||||
<g style="fill:#333333;fill-opacity:1;stroke:none" transform="scale(0.87836138,1.1384836)" >
|
||||
<path
|
||||
d="M 7.9978635,276.23327 Q 6.4616456,276.08696 5.5106536,275.74558 4.584046,275.4042 4.1207422,275.13597 l 0.9266076,-2.38967 q 0.7803012,0.36576 1.8288308,0.68276 1.0485297,0.29261 2.2189814,0.29261 1.365527,0 1.901984,-0.34138 0.536457,-0.36576 0.536457,-1.12168 0,-0.43892 -0.21946,-0.75592 -0.195075,-0.31699 -0.60961,-0.56084 -0.39015,-0.26823 -0.9753763,-0.4633 -0.5852259,-0.21946 -1.3167582,-0.48769 -0.7071479,-0.24384 -1.3899114,-0.56084 -0.6827635,-0.317 -1.2192206,-0.75592 -0.536457,-0.4633 -0.8778387,-1.0973 -0.3169974,-0.65838 -0.3169974,-1.60937 0,-0.68276 0.1706909,-1.31676 0.1950753,-0.63399 0.5852259,-1.17045 0.4145349,-0.53646 1.072914,-0.92661 0.6583791,-0.41453 1.6093711,-0.63399 v -2.36529 h 2.7798227 v 2.24337 q 1.121683,0.0975 1.975137,0.34138 0.877839,0.24384 1.365527,0.43892 l -0.682763,2.51159 q -0.707148,-0.29261 -1.682524,-0.51207 -0.950992,-0.24384 -1.9751377,-0.24384 -1.1704517,0 -1.6337555,0.41453 -0.4389194,0.41454 -0.4389194,0.97538 0,0.39015 0.1463065,0.65838 0.1706909,0.24384 0.4876882,0.43892 0.3413818,0.19507 0.8046856,0.39015 0.4633038,0.17069 1.0972983,0.39015 0.950992,0.36576 1.755678,0.7803 0.804685,0.39015 1.389911,0.92661 0.585226,0.51207 0.902223,1.21922 0.341382,0.70714 0.341382,1.65814 0,0.65838 -0.195075,1.31675 -0.195075,0.634 -0.658379,1.19484 -0.43892,0.53646 -1.194836,0.95099 -0.731533,0.39015 -1.853216,0.56084 v 2.60914 H 7.9978635 Z" />
|
||||
<path
|
||||
d="m 20.043762,269.96647 q 1.316759,0.24385 1.8776,1.07292 0.585226,0.82907 0.585226,2.38967 v 2.75544 q 0,1.02415 0.292613,1.48745 0.292613,0.4633 1.072914,0.4633 h 2.26775 v 2.34091 h -2.535979 q -2.194597,0 -3.048051,-0.951 -0.82907,-0.95099 -0.82907,-2.75543 v -3.58451 q 0,-1.02415 -0.316997,-1.53622 -0.316998,-0.53646 -1.072914,-0.53646 h -1.316758 v -2.3409 h 1.316758 q 0.755916,0 1.072914,-0.51207 0.316997,-0.53646 0.316997,-1.53622 v -3.60889 q 0,-1.80445 0.82907,-2.75544 0.853454,-0.95099 3.048051,-0.95099 h 2.535979 v 2.3409 h -2.26775 q -0.780301,0 -1.072914,0.4633 -0.292613,0.43892 -0.292613,1.48745 v 2.75544 q 0,1.5606 -0.585226,2.38967 -0.560841,0.82907 -1.8776,1.12168 z" />
|
||||
<path
|
||||
d="m 33.869723,268.57656 2.340904,-3.5845 h 3.048051 l -3.70643,5.51087 q 0.585226,0.70715 1.146067,1.51184 0.560842,0.7803 1.072914,1.58498 0.512073,0.80469 0.926608,1.53622 0.414535,0.73153 0.707148,1.31676 H 36.28378 q -0.658379,-1.24361 -1.316758,-2.21898 -0.658379,-0.97538 -1.243605,-1.75568 -0.731532,0.97538 -1.316758,1.90198 -0.585226,0.92661 -1.194836,2.07268 h -3.048052 q 0.365766,-0.68277 0.82907,-1.4143 0.487688,-0.75591 0.999761,-1.51183 0.536457,-0.7803 1.097299,-1.53622 0.585225,-0.75592 1.121683,-1.43868 l -4.023428,-5.55964 h 3.145589 z" />
|
||||
<path
|
||||
d="m 47.500607,269.91771 q -1.316758,-0.24385 -1.901984,-1.07292 -0.585226,-0.82907 -0.585226,-2.38967 v -2.75544 q 0,-1.02414 -0.292613,-1.48745 -0.292613,-0.4633 -1.072914,-0.4633 h -2.243366 v -2.3409 h 2.511595 q 1.097298,0 1.828831,0.24384 0.755916,0.24384 1.194836,0.70715 0.463304,0.4633 0.658379,1.17045 0.195075,0.68276 0.195075,1.58499 v 3.5845 q 0,1.02415 0.316997,1.56061 0.316998,0.51207 1.072915,0.51207 h 1.341142 v 2.3409 h -1.341142 q -0.755917,0 -1.072915,0.53646 -0.316997,0.51207 -0.316997,1.51183 v 3.6089 q 0,0.90222 -0.195075,1.58498 -0.195075,0.70715 -0.658379,1.17045 -0.43892,0.46331 -1.194836,0.70715 -0.731533,0.24385 -1.828831,0.24385 h -2.511595 v -2.34091 h 2.243366 q 0.780301,0 1.072914,-0.4633 0.292613,-0.43892 0.292613,-1.48745 v -2.75544 q 0,-1.5606 0.585226,-2.38967 0.585226,-0.82907 1.901984,-1.12168 z" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 177 B After Width: | Height: | Size: 2.8 KiB |
@@ -0,0 +1,274 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EditVariableDialog</class>
|
||||
<widget class="QDialog" name="EditVariableDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>469</width>
|
||||
<height>297</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="verticalSpacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="incrementGroup">
|
||||
<property name="title">
|
||||
<string>Increment</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QComboBox" name="incrementCombo"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="stepSizeLabel">
|
||||
<property name="text">
|
||||
<string>Step size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="stepSizeEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Variable</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="nameEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="typeCombo"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="valueEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="glabels::ColorButton" name="colorValueButton">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>glabels::ColorButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>ColorButton.h</header>
|
||||
<slots>
|
||||
<signal>colorChanged()</signal>
|
||||
</slots>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>EditVariableDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>236</x>
|
||||
<y>287</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>236</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>EditVariableDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>304</x>
|
||||
<y>287</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>236</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>typeCombo</sender>
|
||||
<signal>currentIndexChanged(int)</signal>
|
||||
<receiver>EditVariableDialog</receiver>
|
||||
<slot>onTypeComboChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>252</x>
|
||||
<y>70</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>33</x>
|
||||
<y>161</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>incrementCombo</sender>
|
||||
<signal>currentIndexChanged(int)</signal>
|
||||
<receiver>EditVariableDialog</receiver>
|
||||
<slot>onIncrementComboChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>100</x>
|
||||
<y>223</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>97</x>
|
||||
<y>176</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>stepSizeEdit</sender>
|
||||
<signal>textChanged(QString)</signal>
|
||||
<receiver>EditVariableDialog</receiver>
|
||||
<slot>onStepSizeEditChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>440</x>
|
||||
<y>223</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>333</x>
|
||||
<y>166</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>nameEdit</sender>
|
||||
<signal>textChanged(QString)</signal>
|
||||
<receiver>EditVariableDialog</receiver>
|
||||
<slot>onNameEditChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>440</x>
|
||||
<y>103</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>393</x>
|
||||
<y>165</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>valueEdit</sender>
|
||||
<signal>textChanged(QString)</signal>
|
||||
<receiver>EditVariableDialog</receiver>
|
||||
<slot>onValueEditChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>318</x>
|
||||
<y>129</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>459</x>
|
||||
<y>157</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>colorValueButton</sender>
|
||||
<signal>colorChanged()</signal>
|
||||
<receiver>EditVariableDialog</receiver>
|
||||
<slot>onColorValueButtonChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>406</x>
|
||||
<y>114</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>458</x>
|
||||
<y>122</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>onTypeComboChanged()</slot>
|
||||
<slot>onValueEditChanged()</slot>
|
||||
<slot>onIncrementComboChanged()</slot>
|
||||
<slot>onStepSizeEditChanged()</slot>
|
||||
<slot>onNameEditChanged()</slot>
|
||||
<slot>onColorValueButtonChanged()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
+60
-49
@@ -11,12 +11,21 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item>
|
||||
@@ -37,16 +46,9 @@
|
||||
<property name="title">
|
||||
<string>Source</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="locationButton">
|
||||
<property name="text">
|
||||
<string>Location</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
@@ -54,6 +56,27 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="formatCombo"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="locationLineEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="locationBrowseButton">
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="locationLabel">
|
||||
<property name="text">
|
||||
@@ -61,24 +84,8 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="formatCombo"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>360</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -89,7 +96,11 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="recordsTable"/>
|
||||
<widget class="QTableWidget" name="recordsTable">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
@@ -138,8 +149,8 @@
|
||||
<slot>onSelectAllButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>63</x>
|
||||
<y>571</y>
|
||||
<x>97</x>
|
||||
<y>570</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>69</x>
|
||||
@@ -163,22 +174,6 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>locationButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>MergeView</receiver>
|
||||
<slot>onLocationButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>174</x>
|
||||
<y>93</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>570</x>
|
||||
<y>75</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>formatCombo</sender>
|
||||
<signal>activated(int)</signal>
|
||||
@@ -186,8 +181,8 @@
|
||||
<slot>onFormatComboActivated()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>162</x>
|
||||
<y>48</y>
|
||||
<x>257</x>
|
||||
<y>109</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>563</x>
|
||||
@@ -195,11 +190,27 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>locationBrowseButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>MergeView</receiver>
|
||||
<slot>onLocationBrowseButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>296</x>
|
||||
<y>130</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>565</x>
|
||||
<y>149</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>onSelectAllButtonClicked()</slot>
|
||||
<slot>onUnselectAllButtonClicked()</slot>
|
||||
<slot>onLocationButtonClicked()</slot>
|
||||
<slot>onFormatComboActivated()</slot>
|
||||
<slot>onLocationBrowseButtonClicked()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
+171
-170
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>640</height>
|
||||
<height>648</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -29,9 +29,9 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
@@ -579,7 +579,11 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="glabels::FieldButton" name="textInsertFieldCombo"/>
|
||||
<widget class="glabels::FieldButton" name="textInsertFieldButton">
|
||||
<property name="text">
|
||||
<string notr="true">Insert field</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
@@ -729,7 +733,11 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="glabels::FieldButton" name="barcodeInsertFieldCombo"/>
|
||||
<widget class="glabels::FieldButton" name="barcodeInsertFieldButton">
|
||||
<property name="text">
|
||||
<string notr="true">Insert field</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_12">
|
||||
@@ -758,14 +766,27 @@
|
||||
<string>Image</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_13">
|
||||
<item row="0" column="0">
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>646</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_9">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_12">
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_17">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="imageFilenameLineEdit">
|
||||
<property name="sizePolicy">
|
||||
@@ -789,68 +810,47 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_17" stretch="1,0,1">
|
||||
<item>
|
||||
<widget class="QPushButton" name="imageFileButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select File...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>or</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="glabels::FieldButton" name="imageFieldCombo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Select Merge Field...</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QPushButton" name="imageBrowseButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_27">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="glabels::FieldButton" name="imageFieldButton">
|
||||
<property name="text">
|
||||
<string notr="true">Use field</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>646</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="lineFillPage">
|
||||
@@ -1520,14 +1520,6 @@
|
||||
<signal>colorChanged()</signal>
|
||||
</slots>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>glabels::FieldButton</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>FieldButton.h</header>
|
||||
<slots>
|
||||
<signal>keySelected(QString)</signal>
|
||||
</slots>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>glabels::BarcodeMenuButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
@@ -1536,6 +1528,14 @@
|
||||
<signal>selectionChanged()</signal>
|
||||
</slots>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>glabels::FieldButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>FieldButton.h</header>
|
||||
<slots>
|
||||
<signal>keySelected(QString)</signal>
|
||||
</slots>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../icons.qrc"/>
|
||||
@@ -1644,8 +1644,8 @@
|
||||
<slot>onTextControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>157</x>
|
||||
<y>333</y>
|
||||
<x>160</x>
|
||||
<y>332</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>396</x>
|
||||
@@ -1660,8 +1660,8 @@
|
||||
<slot>onTextControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>198</x>
|
||||
<y>333</y>
|
||||
<x>200</x>
|
||||
<y>332</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>398</x>
|
||||
@@ -1676,8 +1676,8 @@
|
||||
<slot>onTextControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>238</x>
|
||||
<y>333</y>
|
||||
<x>240</x>
|
||||
<y>332</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>395</x>
|
||||
@@ -1692,8 +1692,8 @@
|
||||
<slot>onTextControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>284</x>
|
||||
<y>333</y>
|
||||
<x>286</x>
|
||||
<y>332</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>393</x>
|
||||
@@ -1708,8 +1708,8 @@
|
||||
<slot>onTextControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>325</x>
|
||||
<y>333</y>
|
||||
<x>326</x>
|
||||
<y>332</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>396</x>
|
||||
@@ -1725,7 +1725,7 @@
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>365</x>
|
||||
<y>333</y>
|
||||
<y>332</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>397</x>
|
||||
@@ -1740,8 +1740,8 @@
|
||||
<slot>onTextControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>184</x>
|
||||
<y>407</y>
|
||||
<x>189</x>
|
||||
<y>404</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>394</x>
|
||||
@@ -1757,7 +1757,7 @@
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>178</x>
|
||||
<y>143</y>
|
||||
<y>139</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>392</x>
|
||||
@@ -1772,8 +1772,8 @@
|
||||
<slot>onLineControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>137</x>
|
||||
<y>179</y>
|
||||
<x>136</x>
|
||||
<y>174</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>1</x>
|
||||
@@ -1788,8 +1788,8 @@
|
||||
<slot>onFillControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>136</x>
|
||||
<y>263</y>
|
||||
<x>135</x>
|
||||
<y>256</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>6</x>
|
||||
@@ -1804,8 +1804,8 @@
|
||||
<slot>onPositionControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>159</x>
|
||||
<y>142</y>
|
||||
<x>160</x>
|
||||
<y>138</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>399</x>
|
||||
@@ -1820,8 +1820,8 @@
|
||||
<slot>onPositionControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>159</x>
|
||||
<y>179</y>
|
||||
<x>160</x>
|
||||
<y>174</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>325</x>
|
||||
@@ -1836,8 +1836,8 @@
|
||||
<slot>onRectSizeControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>159</x>
|
||||
<y>265</y>
|
||||
<x>160</x>
|
||||
<y>258</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>3</x>
|
||||
@@ -1852,8 +1852,8 @@
|
||||
<slot>onRectSizeControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>159</x>
|
||||
<y>302</y>
|
||||
<x>160</x>
|
||||
<y>294</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>0</x>
|
||||
@@ -1868,8 +1868,8 @@
|
||||
<slot>onResetImageSize()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>210</x>
|
||||
<y>372</y>
|
||||
<x>213</x>
|
||||
<y>362</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>4</x>
|
||||
@@ -1900,8 +1900,8 @@
|
||||
<slot>onShadowControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>165</x>
|
||||
<y>142</y>
|
||||
<x>166</x>
|
||||
<y>138</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>398</x>
|
||||
@@ -1916,8 +1916,8 @@
|
||||
<slot>onShadowControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>165</x>
|
||||
<y>179</y>
|
||||
<x>166</x>
|
||||
<y>174</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>294</x>
|
||||
@@ -1932,8 +1932,8 @@
|
||||
<slot>onShadowControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>142</x>
|
||||
<y>215</y>
|
||||
<x>141</x>
|
||||
<y>209</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>399</x>
|
||||
@@ -1948,8 +1948,8 @@
|
||||
<slot>onShadowControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>159</x>
|
||||
<y>252</y>
|
||||
<x>162</x>
|
||||
<y>245</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>399</x>
|
||||
@@ -1964,8 +1964,8 @@
|
||||
<slot>onLineSizeControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>174</x>
|
||||
<y>456</y>
|
||||
<x>177</x>
|
||||
<y>444</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>5</x>
|
||||
@@ -1980,8 +1980,8 @@
|
||||
<slot>onLineSizeControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>174</x>
|
||||
<y>493</y>
|
||||
<x>177</x>
|
||||
<y>480</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>1</x>
|
||||
@@ -1990,14 +1990,14 @@
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>imageFileButton</sender>
|
||||
<sender>imageBrowseButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>ObjectEditor</receiver>
|
||||
<slot>onImageFileButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>133</x>
|
||||
<y>175</y>
|
||||
<x>367</x>
|
||||
<y>135</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>394</x>
|
||||
@@ -2005,22 +2005,6 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>imageFieldCombo</sender>
|
||||
<signal>keySelected(QString)</signal>
|
||||
<receiver>ObjectEditor</receiver>
|
||||
<slot>onImageKeySelected(QString)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>302</x>
|
||||
<y>175</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>397</x>
|
||||
<y>32</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>textEdit</sender>
|
||||
<signal>textChanged()</signal>
|
||||
@@ -2037,22 +2021,6 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>textInsertFieldCombo</sender>
|
||||
<signal>keySelected(QString)</signal>
|
||||
<receiver>ObjectEditor</receiver>
|
||||
<slot>onTextInsertFieldKeySelected(QString)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>239</x>
|
||||
<y>599</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>395</x>
|
||||
<y>645</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>barcodeShowTextCheck</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
@@ -2060,8 +2028,8 @@
|
||||
<slot>onBarcodeControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>178</x>
|
||||
<y>172</y>
|
||||
<x>195</x>
|
||||
<y>167</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>4</x>
|
||||
@@ -2076,8 +2044,8 @@
|
||||
<slot>onBarcodeControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>164</x>
|
||||
<y>204</y>
|
||||
<x>195</x>
|
||||
<y>198</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>1</x>
|
||||
@@ -2093,7 +2061,7 @@
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>126</x>
|
||||
<y>239</y>
|
||||
<y>232</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>1</x>
|
||||
@@ -2117,22 +2085,6 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>barcodeInsertFieldCombo</sender>
|
||||
<signal>keySelected(QString)</signal>
|
||||
<receiver>ObjectEditor</receiver>
|
||||
<slot>onBarcodeInsertFieldKeySelected(QString)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>239</x>
|
||||
<y>400</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>403</x>
|
||||
<y>625</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>barcodeStyleButton</sender>
|
||||
<signal>selectionChanged()</signal>
|
||||
@@ -2140,8 +2092,8 @@
|
||||
<slot>onBarcodeControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>178</x>
|
||||
<y>140</y>
|
||||
<x>195</x>
|
||||
<y>136</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>5</x>
|
||||
@@ -2197,6 +2149,54 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>textInsertFieldButton</sender>
|
||||
<signal>keySelected(QString)</signal>
|
||||
<receiver>ObjectEditor</receiver>
|
||||
<slot>onTextInsertFieldKeySelected(QString)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>191</x>
|
||||
<y>589</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>227</x>
|
||||
<y>642</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>barcodeInsertFieldButton</sender>
|
||||
<signal>keySelected(QString)</signal>
|
||||
<receiver>ObjectEditor</receiver>
|
||||
<slot>onBarcodeInsertFieldKeySelected(QString)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>208</x>
|
||||
<y>379</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>205</x>
|
||||
<y>649</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>imageFieldButton</sender>
|
||||
<signal>keySelected(QString)</signal>
|
||||
<receiver>ObjectEditor</receiver>
|
||||
<slot>onImageKeySelected(QString)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>317</x>
|
||||
<y>160</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>331</x>
|
||||
<y>-12</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>onChanged()</slot>
|
||||
@@ -2213,5 +2213,6 @@
|
||||
<slot>onTextInsertFieldKeySelected(QString)</slot>
|
||||
<slot>onBarcodeControlsChanged()</slot>
|
||||
<slot>onBarcodeInsertFieldKeySelected(QString)</slot>
|
||||
<slot>onImageComboChanged()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,1">
|
||||
<item>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5" columnstretch="0,0,0,0,1">
|
||||
<item row="0" column="4">
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="verticalSpacing">
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="sizeConstraint">
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="verticalSpacing">
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="0">
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>VariablesView</class>
|
||||
<widget class="QWidget" name="VariablesView">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1105</width>
|
||||
<height>605</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>21</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>21</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>21</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>21</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"><html><head/><body><p><span style=" font-size:18pt;">Variables</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTableWidget" name="table">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderHighlightSections">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="addButton">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Add variable</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="editButton">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Edit selected variable</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="deleteButton">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Delete selected variable</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>addButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>VariablesView</receiver>
|
||||
<slot>onAddButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>63</x>
|
||||
<y>586</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>98</x>
|
||||
<y>598</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>editButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>VariablesView</receiver>
|
||||
<slot>onEditButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>167</x>
|
||||
<y>576</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>317</x>
|
||||
<y>608</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>deleteButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>VariablesView</receiver>
|
||||
<slot>onDeleteButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>245</x>
|
||||
<y>575</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>508</x>
|
||||
<y>613</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>table</sender>
|
||||
<signal>itemSelectionChanged()</signal>
|
||||
<receiver>VariablesView</receiver>
|
||||
<slot>onTableSelectionChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>380</x>
|
||||
<y>258</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>787</x>
|
||||
<y>610</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>onSelectAllButtonClicked()</slot>
|
||||
<slot>onUnselectAllButtonClicked()</slot>
|
||||
<slot>onLocationButtonClicked()</slot>
|
||||
<slot>onFormatComboActivated()</slot>
|
||||
<slot>onAddButtonClicked()</slot>
|
||||
<slot>onEditButtonClicked()</slot>
|
||||
<slot>onDeleteButtonClicked()</slot>
|
||||
<slot>onTableSelectionChanged()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user