Prototype of VariableView and EditVariableDialog user interface.
This commit is contained in:
@@ -16,6 +16,7 @@ set (glabels_sources
|
|||||||
ColorPaletteButtonItem.cpp
|
ColorPaletteButtonItem.cpp
|
||||||
ColorSwatch.cpp
|
ColorSwatch.cpp
|
||||||
Cursors.cpp
|
Cursors.cpp
|
||||||
|
EditVariableDialog.cpp
|
||||||
FieldButton.cpp
|
FieldButton.cpp
|
||||||
File.cpp
|
File.cpp
|
||||||
Help.cpp
|
Help.cpp
|
||||||
@@ -52,6 +53,7 @@ set (glabels_qobject_headers
|
|||||||
ColorPaletteDialog.h
|
ColorPaletteDialog.h
|
||||||
ColorPaletteItem.h
|
ColorPaletteItem.h
|
||||||
ColorPaletteButtonItem.h
|
ColorPaletteButtonItem.h
|
||||||
|
EditVariableDialog.h
|
||||||
FieldButton.h
|
FieldButton.h
|
||||||
File.h
|
File.h
|
||||||
LabelEditor.h
|
LabelEditor.h
|
||||||
@@ -73,6 +75,7 @@ set (glabels_qobject_headers
|
|||||||
|
|
||||||
set (glabels_forms
|
set (glabels_forms
|
||||||
ui/AboutDialog.ui
|
ui/AboutDialog.ui
|
||||||
|
ui/EditVariableDialog.ui
|
||||||
ui/MergeView.ui
|
ui/MergeView.ui
|
||||||
ui/ObjectEditor.ui
|
ui/ObjectEditor.ui
|
||||||
ui/PreferencesDialog.ui
|
ui/PreferencesDialog.ui
|
||||||
|
|||||||
@@ -0,0 +1,128 @@
|
|||||||
|
/* 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"
|
||||||
|
|
||||||
|
|
||||||
|
namespace glabels
|
||||||
|
{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
EditVariableDialog::EditVariableDialog( QWidget *parent )
|
||||||
|
: QDialog(parent)
|
||||||
|
{
|
||||||
|
setupUi( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Set variable
|
||||||
|
///
|
||||||
|
void EditVariableDialog::setVariable( const model::Variable& variable )
|
||||||
|
{
|
||||||
|
typeCombo->setCurrentIndex( variable.type() );
|
||||||
|
nameEdit->setText( variable.name() );
|
||||||
|
valueEdit->setText( variable.value() );
|
||||||
|
incrementCombo->setCurrentIndex( variable.incrementPolicy() );
|
||||||
|
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::IncrementPolicy>(incrementCombo->currentIndex()),
|
||||||
|
stepSizeEdit->text() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// typeCombo Changed
|
||||||
|
///
|
||||||
|
void EditVariableDialog::onTypeComboChanged()
|
||||||
|
{
|
||||||
|
updateControls();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// valueEdit Changed
|
||||||
|
///
|
||||||
|
void EditVariableDialog::onValueEditChanged()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// incrementCombo Changed
|
||||||
|
///
|
||||||
|
void EditVariableDialog::onIncrementComboChanged()
|
||||||
|
{
|
||||||
|
updateControls();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// stepSizeEdit Changed
|
||||||
|
///
|
||||||
|
void EditVariableDialog::onStepSizeEditChanged()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// update controls
|
||||||
|
///
|
||||||
|
void EditVariableDialog::updateControls()
|
||||||
|
{
|
||||||
|
model::Variable::Type type = static_cast<model::Variable::Type>(typeCombo->currentIndex());
|
||||||
|
model::Variable::IncrementPolicy incrementPolicy = static_cast<model::Variable::IncrementPolicy>(incrementCombo->currentIndex());
|
||||||
|
|
||||||
|
if ( type != model::Variable::TYPE_NUMERIC )
|
||||||
|
{
|
||||||
|
incrementCombo->setCurrentIndex( model::Variable::INCREMENT_NEVER );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( incrementPolicy == model::Variable::INCREMENT_NEVER )
|
||||||
|
{
|
||||||
|
stepSizeEdit->setText( "0" );
|
||||||
|
}
|
||||||
|
|
||||||
|
incrementLabel->setEnabled( type == model::Variable::TYPE_NUMERIC );
|
||||||
|
incrementCombo->setEnabled( type == model::Variable::TYPE_NUMERIC );
|
||||||
|
stepSizeLabel->setEnabled( (type == model::Variable::TYPE_NUMERIC) &&
|
||||||
|
(incrementPolicy != model::Variable::INCREMENT_NEVER) );
|
||||||
|
stepSizeEdit->setEnabled( (type == model::Variable::TYPE_NUMERIC) &&
|
||||||
|
(incrementPolicy != model::Variable::INCREMENT_NEVER) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace glabels
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
/* EditVariableDialog.h
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef EditVariableDialog_h
|
||||||
|
#define EditVariableDialog_h
|
||||||
|
|
||||||
|
|
||||||
|
#include "ui_EditVariableDialog.h"
|
||||||
|
#include "model/Variable.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace glabels
|
||||||
|
{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// New Label Dialog Widget
|
||||||
|
///
|
||||||
|
class EditVariableDialog : public QDialog, public Ui_EditVariableDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// Life Cycle
|
||||||
|
/////////////////////////////////
|
||||||
|
public:
|
||||||
|
EditVariableDialog( QWidget *parent = nullptr );
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// Public methods
|
||||||
|
/////////////////////////////////
|
||||||
|
void setVariable( const model::Variable& variable );
|
||||||
|
model::Variable variable() const;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// Slots
|
||||||
|
/////////////////////////////////
|
||||||
|
private slots:
|
||||||
|
void onTypeComboChanged();
|
||||||
|
void onValueEditChanged();
|
||||||
|
void onIncrementComboChanged();
|
||||||
|
void onStepSizeEditChanged();
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// Private methods
|
||||||
|
/////////////////////////////////
|
||||||
|
void updateControls();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // EditVariableDialog_h
|
||||||
@@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include "VariablesView.h"
|
#include "VariablesView.h"
|
||||||
|
|
||||||
|
#include "EditVariableDialog.h"
|
||||||
|
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
|
|
||||||
@@ -55,8 +57,68 @@ namespace glabels
|
|||||||
mModel = model;
|
mModel = model;
|
||||||
mUndoRedoModel = undoRedoModel;
|
mUndoRedoModel = undoRedoModel;
|
||||||
|
|
||||||
|
updateControls();
|
||||||
|
|
||||||
//connect( mModel, SIGNAL(variablesChanged()), this, SLOT(onVariablesChanged()) );
|
//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_NUMERIC,
|
||||||
|
"x",
|
||||||
|
"0",
|
||||||
|
model::Variable::INCREMENT_NEVER,
|
||||||
|
"0" );
|
||||||
|
dialog.setVariable( v );
|
||||||
|
|
||||||
|
if ( dialog.exec() == QDialog::Accepted )
|
||||||
|
{
|
||||||
|
qDebug() << "Add OK.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// editButton Clicked
|
||||||
|
///
|
||||||
|
void VariablesView::onEditButtonClicked()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// deleteButton Clicked
|
||||||
|
///
|
||||||
|
void VariablesView::onDeleteButtonClicked()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// update controls
|
||||||
|
///
|
||||||
|
void VariablesView::updateControls()
|
||||||
|
{
|
||||||
|
bool hasSelection = !table->selectedItems().isEmpty();
|
||||||
|
|
||||||
|
editButton->setEnabled( hasSelection );
|
||||||
|
deleteButton->setEnabled( hasSelection );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace glabels
|
} // namespace glabels
|
||||||
|
|||||||
@@ -60,12 +60,17 @@ namespace glabels
|
|||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
|
void onTableSelectionChanged();
|
||||||
|
void onAddButtonClicked();
|
||||||
|
void onEditButtonClicked();
|
||||||
|
void onDeleteButtonClicked();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Private methods
|
// Private methods
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private:
|
private:
|
||||||
|
void updateControls();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
|
|||||||
@@ -0,0 +1,237 @@
|
|||||||
|
<?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>471</width>
|
||||||
|
<height>237</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Variable Type:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="typeCombo">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Numeric</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>String</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Name:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<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="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="valueEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="incrementLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Increment:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="incrementCombo">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Never</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Per Copy</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Per Merge Record</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Per Page</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</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>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<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="2" 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>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>EditVariableDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>227</x>
|
||||||
|
<y>214</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>295</x>
|
||||||
|
<y>220</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>179</x>
|
||||||
|
<y>30</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>33</x>
|
||||||
|
<y>161</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>valueEdit</sender>
|
||||||
|
<signal>textChanged(QString)</signal>
|
||||||
|
<receiver>EditVariableDialog</receiver>
|
||||||
|
<slot>onValueEditChanged()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>212</x>
|
||||||
|
<y>86</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>63</x>
|
||||||
|
<y>166</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>incrementCombo</sender>
|
||||||
|
<signal>currentIndexChanged(int)</signal>
|
||||||
|
<receiver>EditVariableDialog</receiver>
|
||||||
|
<slot>onIncrementComboChanged()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>170</x>
|
||||||
|
<y>123</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>344</x>
|
||||||
|
<y>125</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>333</x>
|
||||||
|
<y>166</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
<slots>
|
||||||
|
<slot>onTypeComboChanged()</slot>
|
||||||
|
<slot>onValueEditChanged()</slot>
|
||||||
|
<slot>onIncrementComboChanged()</slot>
|
||||||
|
<slot>onStepSizeEditChanged()</slot>
|
||||||
|
</slots>
|
||||||
|
</ui>
|
||||||
+148
-23
@@ -6,50 +6,106 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>570</width>
|
<width>1105</width>
|
||||||
<height>605</height>
|
<height>605</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string notr="true">Form</string>
|
<string notr="true">Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<widget class="QLabel" name="titleLabel">
|
||||||
<property name="leftMargin">
|
<property name="sizePolicy">
|
||||||
<number>12</number>
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="text">
|
||||||
<number>12</number>
|
<string notr="true"><html><head/><body><p><span style=" font-size:18pt;">Variables</span></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
</widget>
|
||||||
<number>12</number>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QTableWidget" name="table">
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="selectionBehavior">
|
||||||
<number>12</number>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="columnCount">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Name</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Type</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Value</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Increment</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Step Size</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="titleLabel">
|
<widget class="QPushButton" name="addButton">
|
||||||
<property name="sizePolicy">
|
<property name="toolTip">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<string><html><head/><body><p>Add variable</p></body></html></string>
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true"><html><head/><body><p><span style=" font-size:18pt;">Variables</span></p></body></html></string>
|
<string>Add</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<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">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>40</width>
|
||||||
<height>40</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
@@ -59,11 +115,80 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<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>
|
<slots>
|
||||||
<slot>onSelectAllButtonClicked()</slot>
|
<slot>onSelectAllButtonClicked()</slot>
|
||||||
<slot>onUnselectAllButtonClicked()</slot>
|
<slot>onUnselectAllButtonClicked()</slot>
|
||||||
<slot>onLocationButtonClicked()</slot>
|
<slot>onLocationButtonClicked()</slot>
|
||||||
<slot>onFormatComboActivated()</slot>
|
<slot>onFormatComboActivated()</slot>
|
||||||
|
<slot>onAddButtonClicked()</slot>
|
||||||
|
<slot>onEditButtonClicked()</slot>
|
||||||
|
<slot>onDeleteButtonClicked()</slot>
|
||||||
|
<slot>onTableSelectionChanged()</slot>
|
||||||
</slots>
|
</slots>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ set (Model_sources
|
|||||||
Template.cpp
|
Template.cpp
|
||||||
TextNode.cpp
|
TextNode.cpp
|
||||||
Units.cpp
|
Units.cpp
|
||||||
|
Variable.cpp
|
||||||
Vendor.cpp
|
Vendor.cpp
|
||||||
XmlCategoryParser.cpp
|
XmlCategoryParser.cpp
|
||||||
XmlLabelCreator.cpp
|
XmlLabelCreator.cpp
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/* Variable.cpp
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013-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 "Variable.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace glabels
|
||||||
|
{
|
||||||
|
namespace model
|
||||||
|
{
|
||||||
|
|
||||||
|
Variable::Variable( Variable::Type type,
|
||||||
|
const QString& name,
|
||||||
|
const QString& value,
|
||||||
|
Variable::IncrementPolicy incrementPolicy,
|
||||||
|
const QString& stepSize )
|
||||||
|
: mType(type),
|
||||||
|
mName(name),
|
||||||
|
mValue(value),
|
||||||
|
mIncrementPolicy(incrementPolicy),
|
||||||
|
mStepSize(stepSize)
|
||||||
|
{
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Variable::Type Variable::type() const
|
||||||
|
{
|
||||||
|
return mType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString Variable::name() const
|
||||||
|
{
|
||||||
|
return mName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString Variable::value() const
|
||||||
|
{
|
||||||
|
return mValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Variable::IncrementPolicy Variable::incrementPolicy() const
|
||||||
|
{
|
||||||
|
return mIncrementPolicy;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString Variable::stepSize() const
|
||||||
|
{
|
||||||
|
return mStepSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
/* Variable.h
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef model_Variable_h
|
||||||
|
#define model_Variable_h
|
||||||
|
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
|
namespace glabels
|
||||||
|
{
|
||||||
|
namespace model
|
||||||
|
{
|
||||||
|
|
||||||
|
class Variable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Type
|
||||||
|
{
|
||||||
|
TYPE_NUMERIC,
|
||||||
|
TYPE_STRING
|
||||||
|
};
|
||||||
|
|
||||||
|
enum IncrementPolicy
|
||||||
|
{
|
||||||
|
INCREMENT_NEVER,
|
||||||
|
INCREMENT_PER_COPY,
|
||||||
|
INCREMENT_PER_MERGE_RECORD,
|
||||||
|
INCREMENT_PER_PAGE
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
Variable() = default;
|
||||||
|
|
||||||
|
Variable( Type type,
|
||||||
|
const QString& name,
|
||||||
|
const QString& value,
|
||||||
|
IncrementPolicy incrementPolicy = INCREMENT_NEVER,
|
||||||
|
const QString& stepSize = "0" );
|
||||||
|
|
||||||
|
virtual ~Variable() = default;
|
||||||
|
|
||||||
|
|
||||||
|
Type type() const;
|
||||||
|
QString name() const;
|
||||||
|
QString value() const;
|
||||||
|
IncrementPolicy incrementPolicy() const;
|
||||||
|
QString stepSize() const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
Type mType;
|
||||||
|
QString mName;
|
||||||
|
QString mValue;
|
||||||
|
IncrementPolicy mIncrementPolicy;
|
||||||
|
QString mStepSize;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // model_Variable_h
|
||||||
@@ -178,6 +178,57 @@
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>EditVariableDialog</name>
|
||||||
|
<message>
|
||||||
|
<source>Dialog</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Variable Type:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Numeric</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>String</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Name:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Value:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Increment:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Never</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Per Copy</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Per Merge Record</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Per Page</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Step Size:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>Factory</name>
|
<name>Factory</name>
|
||||||
<message>
|
<message>
|
||||||
@@ -1031,6 +1082,53 @@
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>VariablesView</name>
|
||||||
|
<message>
|
||||||
|
<source>Name</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Type</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Value</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Increment</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Step Size</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source><html><head/><body><p>Add variable</p></body></html></source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Add</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source><html><head/><body><p>Edit selected variable</p></body></html></source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Edit</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source><html><head/><body><p>Delete selected variable</p></body></html></source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Delete</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>glabels::AboutDialog</name>
|
<name>glabels::AboutDialog</name>
|
||||||
<message>
|
<message>
|
||||||
|
|||||||
Reference in New Issue
Block a user