diff --git a/glabels/CMakeLists.txt b/glabels/CMakeLists.txt index 871d8ec..84efee2 100644 --- a/glabels/CMakeLists.txt +++ b/glabels/CMakeLists.txt @@ -31,6 +31,7 @@ set (glabels_sources MergeField.cpp MergeRecord.cpp NewLabelDialog.cpp + ObjectEditor.cpp Outline.cpp TemplatePicker.cpp TemplatePickerItem.cpp @@ -56,8 +57,9 @@ set (glabels_qobject_headers LabelModelObject.h LabelModelBoxObject.h LabelModelShapeObject.h - NewLabelDialog.h MainWindow.h + NewLabelDialog.h + ObjectEditor.h SimplePreview.h TemplatePicker.h View.h @@ -65,6 +67,7 @@ set (glabels_qobject_headers set (glabels_forms ui/NewLabelDialog.ui + ui/ObjectEditor.ui ) set (glabels_resource_files diff --git a/glabels/ColorButton.cpp b/glabels/ColorButton.cpp index 1dd6df0..ff9e71b 100644 --- a/glabels/ColorButton.cpp +++ b/glabels/ColorButton.cpp @@ -34,11 +34,13 @@ namespace namespace glabels { - ColorButton::ColorButton( const QString& defaultLabel, - const QColor& defaultColor, - const QColor& color, - QWidget* parent ) + ColorButton::ColorButton( QWidget* parent ) : QPushButton( parent ) + { + } + + + void ColorButton::init( const QString& defaultLabel, const QColor& defaultColor, const QColor& color ) { mDefaultColor = defaultColor; mColorNode = ColorNode( color ); diff --git a/glabels/ColorButton.h b/glabels/ColorButton.h index 92cd3e8..4a54906 100644 --- a/glabels/ColorButton.h +++ b/glabels/ColorButton.h @@ -42,10 +42,7 @@ namespace glabels // Life Cycle ///////////////////////////////// public: - ColorButton( const QString& defaultLabel, - const QColor& defaultColor, - const QColor& color, - QWidget* parent = 0 ); + ColorButton( QWidget* parent = 0 ); ///////////////////////////////// @@ -59,6 +56,7 @@ namespace glabels // Public Methods ///////////////////////////////// public: + void init( const QString& defaultLabel, const QColor& defaultColor, const QColor& color ); void setColorNode( ColorNode colorNode ); void setColor( QColor color ); void setToDefault(); diff --git a/glabels/FieldButton.cpp b/glabels/FieldButton.cpp index 630f285..c2361ff 100644 --- a/glabels/FieldButton.cpp +++ b/glabels/FieldButton.cpp @@ -27,8 +27,19 @@ namespace glabels /// /// Constructor /// - FieldButton::FieldButton( const QString& name, QWidget* parent ) + FieldButton::FieldButton( QWidget* parent ) : QPushButton(parent) + { + setEnabled( false ); + + mMenu = new FieldMenu(); + setMenu( mMenu ); + + connect( mMenu, SIGNAL(keySelected(const QString&)), this, SLOT(onMenuKeySelected(const QString&)) ); + } + + + void FieldButton::setName( const QString& name ) { if ( name.isNull() || name.isEmpty() ) { @@ -40,14 +51,6 @@ namespace glabels setText( name ); mLabelIsKey = true; } - - - setEnabled( false ); - - mMenu = new FieldMenu(); - setMenu( mMenu ); - - connect( mMenu, SIGNAL(keySelected(const QString&)), this, SLOT(onMenuKeySelected(const QString&)) ); } diff --git a/glabels/FieldButton.h b/glabels/FieldButton.h index f4bd56a..4e792ae 100644 --- a/glabels/FieldButton.h +++ b/glabels/FieldButton.h @@ -40,7 +40,7 @@ namespace glabels // Life Cycle ///////////////////////////////// public: - FieldButton( const QString& name, QWidget* parent = 0 ); + FieldButton( QWidget* parent = 0 ); ///////////////////////////////// @@ -61,6 +61,7 @@ namespace glabels // Public Methods ///////////////////////////////// public: + void setName( const QString& name = "" ); void setKeys( const QList& keyList ); void clearKeys(); diff --git a/glabels/MainWindow.cpp b/glabels/MainWindow.cpp index 34a01bf..fbae525 100644 --- a/glabels/MainWindow.cpp +++ b/glabels/MainWindow.cpp @@ -33,6 +33,7 @@ #include "libglabels/Db.h" #include "View.h" +#include "ObjectEditor.h" #include "LabelModel.h" #include "LabelModelBoxObject.h" #include "Icons.h" @@ -54,8 +55,17 @@ namespace glabels /// MainWindow::MainWindow() { + QWidget* editorPage = new QWidget; + mView = new View(); - setCentralWidget( mView ); + mObjectEditor = new ObjectEditor(); + + QHBoxLayout* editorLayout = new QHBoxLayout; + editorLayout->addWidget( mView ); + editorLayout->addWidget( mObjectEditor ); + editorPage->setLayout( editorLayout ); + + setCentralWidget( editorPage ); mModel = 0; createActions(); diff --git a/glabels/MainWindow.h b/glabels/MainWindow.h index 024de2e..e1f785b 100644 --- a/glabels/MainWindow.h +++ b/glabels/MainWindow.h @@ -36,6 +36,7 @@ namespace glabels // Forward References class LabelModel; class View; + class ObjectEditor; /// @@ -187,8 +188,9 @@ namespace glabels QToolBar* editToolBar; QToolBar* viewToolBar; - LabelModel* mModel; - View* mView; + LabelModel* mModel; + View* mView; + ObjectEditor* mObjectEditor; QLabel* zoomInfoLabel; QLabel* cursorInfoLabel; diff --git a/glabels/ObjectEditor.cpp b/glabels/ObjectEditor.cpp new file mode 100644 index 0000000..52f125b --- /dev/null +++ b/glabels/ObjectEditor.cpp @@ -0,0 +1,48 @@ +/* ObjectEditor.cpp + * + * Copyright (C) 2013 Jim Evins + * + * 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 . + */ + +#include "ObjectEditor.h" + + +namespace glabels +{ + + /// + /// Constructor + /// + ObjectEditor::ObjectEditor( QWidget *parent ) + { + setupUi( this ); + + setEnabled( false ); + hidePages(); + } + + + void ObjectEditor::hidePages() + { + notebook->removeTab( notebook->indexOf(textPage) ); + notebook->removeTab( notebook->indexOf(barcodePage) ); + notebook->removeTab( notebook->indexOf(imagePage) ); + notebook->removeTab( notebook->indexOf(lineFillPage) ); + notebook->removeTab( notebook->indexOf(posSizePage) ); + notebook->removeTab( notebook->indexOf(shadowPage) ); + } +} diff --git a/glabels/ObjectEditor.h b/glabels/ObjectEditor.h new file mode 100644 index 0000000..bbdd938 --- /dev/null +++ b/glabels/ObjectEditor.h @@ -0,0 +1,67 @@ +/* ObjectEditor.h + * + * Copyright (C) 2013 Jim Evins + * + * 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 . + */ + +#ifndef glabels_ObjectEditor_h +#define glabels_ObjectEditor_h + +#include "ui_ObjectEditor.h" + + +namespace glabels +{ + + /// + /// Object Editor Widget + /// + class ObjectEditor : public QWidget, public Ui_ObjectEditor + { + Q_OBJECT + + + ///////////////////////////////// + // Life Cycle + ///////////////////////////////// + public: + ObjectEditor( QWidget *parent = 0 ); + + + ///////////////////////////////// + // Accessors + ///////////////////////////////// + + + ///////////////////////////////// + // Private methods + ///////////////////////////////// + private: + void hidePages(); + + + ///////////////////////////////// + // Slots + ///////////////////////////////// + private slots: + + + }; + +} + +#endif // glabels_ObjectEditor_h diff --git a/glabels/View.cpp b/glabels/View.cpp index fa9b077..e764019 100644 --- a/glabels/View.cpp +++ b/glabels/View.cpp @@ -86,7 +86,7 @@ glabels::View::View( QWidget *parent ) : QWidget(parent) setMouseTracking( true ); - setMinimumSize( 640, 400 ); + setMinimumSize( 640, 450 ); } diff --git a/glabels/ui/ObjectEditor.ui b/glabels/ui/ObjectEditor.ui new file mode 100644 index 0000000..f78a8cd --- /dev/null +++ b/glabels/ui/ObjectEditor.ui @@ -0,0 +1,1255 @@ + + + ObjectEditor + + + + 0 + 0 + 400 + 861 + + + + + 0 + 0 + + + + + 400 + 0 + + + + + 400 + 16777215 + + + + Form + + + + + + + + + 0 + 0 + + + + + + + :/icons/24x24/actions/glabels-object-properties.png + + + + + + + + Sans Serif + 10 + 75 + true + + + + Object properties + + + + + + + + + 0 + + + + Text + + + + + + Font + + + false + + + + + + + + Family: + + + + + + + Size: + + + + + + + + + + Style: + + + + + + + + + + + + + :/icons/24x24/actions/glabels-text.png:/icons/24x24/actions/glabels-text.png + + + true + + + false + + + + + + + + + + + :/icons/24x24/actions/glabels-text.png:/icons/24x24/actions/glabels-text.png + + + true + + + + + + + + + + + :/icons/24x24/actions/glabels-text.png:/icons/24x24/actions/glabels-text.png + + + true + + + + + + + + + Color: + + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Layout + + + + + + + + Alignment: + + + + + + + + + + + + + :/icons/24x24/actions/glabels-text.png:/icons/24x24/actions/glabels-text.png + + + true + + + false + + + + + + + + + + + :/icons/24x24/actions/glabels-text.png:/icons/24x24/actions/glabels-text.png + + + true + + + + + + + + + + + :/icons/24x24/actions/glabels-text.png:/icons/24x24/actions/glabels-text.png + + + true + + + + + + + + + + + + + + + + + + + + + + :/icons/24x24/actions/glabels-align-text-bottom.png:/icons/24x24/actions/glabels-align-text-bottom.png + + + true + + + false + + + + + + + + + + + :/icons/24x24/actions/glabels-align-text-middle.png:/icons/24x24/actions/glabels-align-text-middle.png + + + true + + + + + + + + + + + :/icons/24x24/actions/glabels-align-text-top.png:/icons/24x24/actions/glabels-align-text-top.png + + + true + + + + + + + + + Line spacing: + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Editor + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 156 + + + + + + + + + Barcode + + + + + + Style + + + + + + + + Type: + + + + + + + + + + Show text + + + + + + + Checksum + + + + + + + Color: + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Data + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + Literal: + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 0 + 0 + + + + + 240 + 100 + + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + Key: + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + format: + + + + + + + TextLabel + + + + + + + digits: + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 356 + + + + + + + + + Image + + + + + + Qt::Vertical + + + + 20 + 654 + + + + + + + + File + + + + + + + + File: + + + + + + + Placeholder + + + + + + + Key: + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Line/Fill + + + + + + + + Line + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + Width: + + + + + + + + + + Color: + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Fill + + + + + + + + Color: + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 582 + + + + + + + + + Position/Size + + + + + + Position + + + + + + + + X: + + + + + + + + + + + + inches + + + + + + + + + Y: + + + + + + + + + + + + inches + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Size + + + + + + + + Width: + + + + + + + + + + + + inches + + + + + + + + + Height: + + + + + + + + + + + + inches + + + + + + + + + + + Lock aspect ratio + + + + + + + Reset image size + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Size + + + + + + + + Length: + + + + + + + + + + + + inches + + + + + + + + + Angle: + + + + + + + + + + + + degrees + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 368 + + + + + + + + + Shadow + + + + + + Shadow + + + true + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + X offset: + + + + + + + + + + + + inches + + + + + + + + + Y offset: + + + + + + + + + + + + inches + + + + + + + + + Color: + + + + + + + + + + + + + + Opacity: + + + + + + + + + + + + % + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 585 + + + + + + + + + + + + + glabels::ColorButton + QPushButton +
ColorButton.h
+
+ + glabels::FieldButton + QPushButton +
FieldButton.h
+
+
+ + + + +