Incorporated FieldButton into ColorPaletteDialog. Tweaked ColorPaletteDialog.
This commit is contained in:
@@ -13,7 +13,6 @@ set (glabels_sources
|
|||||||
ColorHistory.cpp
|
ColorHistory.cpp
|
||||||
ColorPaletteDialog.cpp
|
ColorPaletteDialog.cpp
|
||||||
ColorPaletteItem.cpp
|
ColorPaletteItem.cpp
|
||||||
ColorPaletteButtonItem.cpp
|
|
||||||
ColorSwatch.cpp
|
ColorSwatch.cpp
|
||||||
Cursors.cpp
|
Cursors.cpp
|
||||||
EditVariableDialog.cpp
|
EditVariableDialog.cpp
|
||||||
@@ -52,7 +51,6 @@ set (glabels_qobject_headers
|
|||||||
ColorHistory.h
|
ColorHistory.h
|
||||||
ColorPaletteDialog.h
|
ColorPaletteDialog.h
|
||||||
ColorPaletteItem.h
|
ColorPaletteItem.h
|
||||||
ColorPaletteButtonItem.h
|
|
||||||
EditVariableDialog.h
|
EditVariableDialog.h
|
||||||
FieldButton.h
|
FieldButton.h
|
||||||
File.h
|
File.h
|
||||||
|
|||||||
@@ -124,15 +124,10 @@ namespace glabels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorButton::setKeys( const QList<QString> keyList )
|
void ColorButton::setKeys( const merge::Merge* merge,
|
||||||
|
const model::Variables* variables )
|
||||||
{
|
{
|
||||||
mDialog->setKeys( keyList );
|
mDialog->setKeys( merge, variables );
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ColorButton::clearKeys()
|
|
||||||
{
|
|
||||||
mDialog->clearKeys();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -63,8 +63,9 @@ namespace glabels
|
|||||||
void setColor( QColor color );
|
void setColor( QColor color );
|
||||||
void setToDefault();
|
void setToDefault();
|
||||||
model::ColorNode colorNode();
|
model::ColorNode colorNode();
|
||||||
void setKeys( const QList<QString> keyList );
|
|
||||||
void clearKeys();
|
void setKeys( const merge::Merge* merge,
|
||||||
|
const model::Variables* variables );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
/* ColorPaletteButtonItem.h
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ColorPaletteButtonItem_h
|
|
||||||
#define ColorPaletteButtonItem_h
|
|
||||||
|
|
||||||
|
|
||||||
#include <QColor>
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
|
||||||
{
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Color Palette Item
|
|
||||||
///
|
|
||||||
class ColorPaletteButtonItem : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
/////////////////////////////////
|
|
||||||
// Life Cycle
|
|
||||||
/////////////////////////////////
|
|
||||||
public:
|
|
||||||
ColorPaletteButtonItem( const QString& text, QWidget* parent = nullptr );
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
|
||||||
// Signals
|
|
||||||
/////////////////////////////////
|
|
||||||
signals:
|
|
||||||
void activated();
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
|
||||||
// Event handlers
|
|
||||||
/////////////////////////////////
|
|
||||||
protected:
|
|
||||||
void paintEvent( QPaintEvent* event ) override;
|
|
||||||
void enterEvent( QEvent* event ) override;
|
|
||||||
void leaveEvent( QEvent* event ) override;
|
|
||||||
void mousePressEvent( QMouseEvent* event ) override;
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
|
||||||
// Private Data
|
|
||||||
/////////////////////////////////
|
|
||||||
private:
|
|
||||||
QString mText;
|
|
||||||
|
|
||||||
bool mHover;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // ColorPaletteButtonItem_h
|
|
||||||
+82
-107
@@ -18,14 +18,16 @@
|
|||||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "ColorPaletteDialog.h"
|
#include "ColorPaletteDialog.h"
|
||||||
|
|
||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QFrame>
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QPushButton>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
#include <QVBoxLayout>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
|
|
||||||
@@ -99,14 +101,12 @@ namespace glabels
|
|||||||
vLayout->setContentsMargins( 0, 0, 0, 0 );
|
vLayout->setContentsMargins( 0, 0, 0, 0 );
|
||||||
vLayout->setSpacing( 0 );
|
vLayout->setSpacing( 0 );
|
||||||
|
|
||||||
auto* defaultButton = new ColorPaletteButtonItem( defaultLabel );
|
//
|
||||||
connect( defaultButton, SIGNAL(activated()), this, SLOT(onDefaultItemActivated()) );
|
// Construct Standard Colors Grid
|
||||||
vLayout->addWidget( defaultButton );
|
//
|
||||||
|
auto* standardColorsGroup = new QGroupBox( tr("Standard Colors") );
|
||||||
QFrame* hline1 = new QFrame;
|
standardColorsGroup->setAlignment( Qt::AlignHCenter );
|
||||||
hline1->setFrameStyle( QFrame::HLine | QFrame::Plain );
|
vLayout->addWidget( standardColorsGroup );
|
||||||
hline1->setLineWidth( 1 );
|
|
||||||
vLayout->addWidget( hline1 );
|
|
||||||
|
|
||||||
auto* mainPaletteLayout = new QGridLayout();
|
auto* mainPaletteLayout = new QGridLayout();
|
||||||
mainPaletteLayout->setSpacing( 0 );
|
mainPaletteLayout->setSpacing( 0 );
|
||||||
@@ -119,17 +119,20 @@ namespace glabels
|
|||||||
ColorPaletteItem* item = new ColorPaletteItem( i,
|
ColorPaletteItem* item = new ColorPaletteItem( i,
|
||||||
QColor( mColorTable[i].colorSpec ),
|
QColor( mColorTable[i].colorSpec ),
|
||||||
tr(mColorTable[i].trname) );
|
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 );
|
mainPaletteLayout->addWidget( item, iRow, iCol );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vLayout->addLayout( mainPaletteLayout );
|
standardColorsGroup->setLayout( mainPaletteLayout );
|
||||||
|
|
||||||
QFrame* hline2 = new QFrame;
|
//
|
||||||
hline2->setFrameStyle( QFrame::HLine | QFrame::Plain );
|
// Construct Recent Colors Grid
|
||||||
hline2->setLineWidth( 1 );
|
//
|
||||||
vLayout->addWidget( hline2 );
|
auto* recentColorsGroup = new QGroupBox( tr("Recent Colors") );
|
||||||
|
recentColorsGroup->setAlignment( Qt::AlignHCenter );
|
||||||
|
vLayout->addWidget( recentColorsGroup );
|
||||||
|
|
||||||
auto* customPaletteLayout = new QHBoxLayout();
|
auto* customPaletteLayout = new QHBoxLayout();
|
||||||
customPaletteLayout->setSpacing( 0 );
|
customPaletteLayout->setSpacing( 0 );
|
||||||
@@ -137,40 +140,42 @@ namespace glabels
|
|||||||
{
|
{
|
||||||
mHistoryItem[iCol] = new ColorPaletteItem( iCol, QColor(0,0,0,0), "" );
|
mHistoryItem[iCol] = new ColorPaletteItem( iCol, QColor(0,0,0,0), "" );
|
||||||
mHistoryItem[iCol]->setEnabled( false );
|
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] );
|
customPaletteLayout->addWidget( mHistoryItem[iCol] );
|
||||||
}
|
}
|
||||||
vLayout->addLayout( customPaletteLayout );
|
recentColorsGroup->setLayout( customPaletteLayout );
|
||||||
|
|
||||||
|
|
||||||
QFrame* hline3 = new QFrame;
|
//
|
||||||
hline3->setFrameStyle( QFrame::HLine | QFrame::Plain );
|
// Construct Default (e.g. "No Fill") Button
|
||||||
hline3->setLineWidth( 1 );
|
//
|
||||||
vLayout->addWidget( hline3 );
|
auto* defaultColorButton = new QPushButton( defaultLabel );
|
||||||
|
defaultColorButton->setAutoDefault( false );
|
||||||
ColorPaletteButtonItem* customColorButton = new ColorPaletteButtonItem( tr("Custom color...") );
|
defaultColorButton->setDefault( false );
|
||||||
connect( customColorButton, SIGNAL(activated()), this, SLOT(onCustomColorItemActivated()) );
|
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 );
|
vLayout->addWidget( customColorButton );
|
||||||
|
|
||||||
QFrame* hline4 = new QFrame;
|
//
|
||||||
hline4->setFrameStyle( QFrame::HLine | QFrame::Plain );
|
// Construct "Use key" Button
|
||||||
hline4->setLineWidth( 1 );
|
//
|
||||||
vLayout->addWidget( hline4 );
|
mFieldButton = new FieldButton();
|
||||||
|
mFieldButton->setText( tr("Use key") );
|
||||||
|
mFieldButton->setAutoDefault( false );
|
||||||
|
mFieldButton->setDefault( false );
|
||||||
|
connect( mFieldButton, SIGNAL(keySelected(QString)), this, SLOT(onKeySelected(QString)) );
|
||||||
|
vLayout->addWidget( mFieldButton );
|
||||||
|
|
||||||
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 );
|
setLayout( vLayout );
|
||||||
|
|
||||||
loadCustomColorHistory();
|
loadCustomColorHistory();
|
||||||
@@ -183,59 +188,29 @@ namespace glabels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorPaletteDialog::setKeys( const QStringList& keyList )
|
void ColorPaletteDialog::setKeys( const merge::Merge* merge,
|
||||||
|
const model::Variables* variables )
|
||||||
{
|
{
|
||||||
mKeys = keyList;
|
mFieldButton->setKeys( merge, variables );
|
||||||
|
|
||||||
// Clear old keys, (all entries, except item 0)
|
|
||||||
for ( int index = mMergeFieldCombo->count()-1; index > 0; index-- )
|
|
||||||
{
|
|
||||||
mMergeFieldCombo->removeItem( index );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add new keys
|
|
||||||
if ( keyList.size() > 0 )
|
|
||||||
{
|
|
||||||
mMergeFieldCombo->addItems( keyList );
|
|
||||||
mMergeFieldCombo->setEnabled( true );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mMergeFieldCombo->setEnabled( false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ColorPaletteDialog::clearKeys()
|
|
||||||
{
|
|
||||||
|
|
||||||
for ( int index = mMergeFieldCombo->count()-1; index > 0; index-- )
|
|
||||||
{
|
|
||||||
mMergeFieldCombo->removeItem( index );
|
|
||||||
}
|
|
||||||
mMergeFieldCombo->setEnabled( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ColorPaletteDialog::onDefaultItemActivated()
|
|
||||||
{
|
|
||||||
mColorNode.setField( false );
|
|
||||||
mColorNode.setColor( mDefaultColor );
|
|
||||||
mColorNode.setKey( "" );
|
|
||||||
|
|
||||||
emit colorChanged( mColorNode, true );
|
|
||||||
accept();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorPaletteDialog::onPaletteItemActivated( int id )
|
void ColorPaletteDialog::onPaletteItemActivated( int id )
|
||||||
{
|
{
|
||||||
mColorNode.setField( false );
|
model::ColorNode newColorNode;
|
||||||
mColorNode.setColor( QColor( mColorTable[id].colorSpec ) );
|
newColorNode.setField( false );
|
||||||
mColorNode.setKey( "" );
|
newColorNode.setColor( QColor( mColorTable[id].colorSpec ) );
|
||||||
|
newColorNode.setKey( "" );
|
||||||
|
|
||||||
emit colorChanged( mColorNode, false );
|
if ( newColorNode != mColorNode )
|
||||||
accept();
|
{
|
||||||
|
mColorNode = newColorNode;
|
||||||
|
|
||||||
|
mColorHistory->addColor( mColorNode.color() );
|
||||||
|
|
||||||
|
emit colorChanged( mColorNode, false );
|
||||||
|
accept();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -250,7 +225,18 @@ namespace glabels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorPaletteDialog::onCustomColorItemActivated()
|
void ColorPaletteDialog::onDefaultButtonClicked()
|
||||||
|
{
|
||||||
|
mColorNode.setField( false );
|
||||||
|
mColorNode.setColor( mDefaultColor );
|
||||||
|
mColorNode.setKey( "" );
|
||||||
|
|
||||||
|
emit colorChanged( mColorNode, true );
|
||||||
|
accept();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ColorPaletteDialog::onCustomColorButtonClicked()
|
||||||
{
|
{
|
||||||
QColorDialog dlg( mColorNode.color(), this );
|
QColorDialog dlg( mColorNode.color(), this );
|
||||||
dlg.setWindowTitle( tr("Custom Color") );
|
dlg.setWindowTitle( tr("Custom Color") );
|
||||||
@@ -302,25 +288,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.setField( true );
|
mColorNode.setKey( key );
|
||||||
mColorNode.setColor( QColor( 0xee, 0xee, 0xec ) );
|
|
||||||
mColorNode.setKey( mKeys[index-1] );
|
|
||||||
|
|
||||||
emit colorChanged( mColorNode, false );
|
emit colorChanged( mColorNode, false );
|
||||||
accept();
|
accept();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ColorPaletteDialog::showEvent( QShowEvent* event )
|
|
||||||
{
|
|
||||||
mMergeFieldCombo->setCurrentIndex( 0 );
|
|
||||||
|
|
||||||
QDialog::showEvent( event );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace glabels
|
} // namespace glabels
|
||||||
|
|||||||
@@ -24,11 +24,10 @@
|
|||||||
|
|
||||||
#include "ColorHistory.h"
|
#include "ColorHistory.h"
|
||||||
#include "ColorPaletteItem.h"
|
#include "ColorPaletteItem.h"
|
||||||
#include "ColorPaletteButtonItem.h"
|
#include "FieldButton.h"
|
||||||
|
|
||||||
#include "model/ColorNode.h"
|
#include "model/ColorNode.h"
|
||||||
|
|
||||||
#include <QComboBox>
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
|
||||||
@@ -64,25 +63,23 @@ namespace glabels
|
|||||||
// Public Methods
|
// Public Methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
void setColorNode( const model::ColorNode& colorNode );
|
void setColorNode( const model::ColorNode& colorNode );
|
||||||
void setKeys( const QStringList& keyList );
|
|
||||||
void clearKeys();
|
void setKeys( const merge::Merge* merge,
|
||||||
|
const model::Variables* variables );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void onDefaultItemActivated();
|
|
||||||
void onPaletteItemActivated( int id );
|
void onPaletteItemActivated( int id );
|
||||||
void onHistoryItemActivated( int id );
|
void onHistoryItemActivated( int id );
|
||||||
void onCustomColorItemActivated();
|
void onDefaultButtonClicked();
|
||||||
|
void onCustomColorButtonClicked();
|
||||||
|
void onKeySelected( QString key );
|
||||||
void onColorHistoryChanged();
|
void onColorHistoryChanged();
|
||||||
void onComboIndexChanged( int index );
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void showEvent( QShowEvent* event ) override;
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private Methods
|
// Private Methods
|
||||||
@@ -111,8 +108,7 @@ namespace glabels
|
|||||||
ColorHistory* mColorHistory;
|
ColorHistory* mColorHistory;
|
||||||
ColorPaletteItem* mHistoryItem[PALETTE_COLS];
|
ColorPaletteItem* mHistoryItem[PALETTE_COLS];
|
||||||
|
|
||||||
QComboBox* mMergeFieldCombo;
|
FieldButton* mFieldButton;
|
||||||
QStringList mKeys;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -503,13 +503,12 @@ namespace glabels
|
|||||||
{
|
{
|
||||||
if ( !mBlocked )
|
if ( !mBlocked )
|
||||||
{
|
{
|
||||||
QStringList keys = mModel->merge()->keys();
|
lineColorButton->setKeys( mModel->merge(), mModel->variables() );
|
||||||
lineColorButton->setKeys( keys );
|
fillColorButton->setKeys( mModel->merge(), mModel->variables() );
|
||||||
fillColorButton->setKeys( keys );
|
|
||||||
textInsertFieldButton->setKeys( mModel->merge(), mModel->variables() );
|
textInsertFieldButton->setKeys( mModel->merge(), mModel->variables() );
|
||||||
barcodeInsertFieldButton->setKeys( mModel->merge(), mModel->variables() );
|
barcodeInsertFieldButton->setKeys( mModel->merge(), mModel->variables() );
|
||||||
imageFieldButton->setKeys( mModel->merge(), mModel->variables() );
|
imageFieldButton->setKeys( mModel->merge(), mModel->variables() );
|
||||||
shadowColorButton->setKeys( keys );
|
shadowColorButton->setKeys( mModel->merge(), mModel->variables() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1133,10 +1133,6 @@
|
|||||||
<source>Custom color...</source>
|
<source>Custom color...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Merge key...</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Custom Color</source>
|
<source>Custom Color</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
@@ -1145,6 +1141,18 @@
|
|||||||
<source>Custom color #%1</source>
|
<source>Custom color #%1</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Use key</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Standard Colors</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Recent Colors</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>glabels::FieldButton</name>
|
<name>glabels::FieldButton</name>
|
||||||
|
|||||||
Reference in New Issue
Block a user