Improve code style, Wrap code for better readability

This commit is contained in:
Simon De Backer
2020-08-16 14:24:12 +02:00
parent 928b56f2bf
commit 3b3ce2cb7c
3 changed files with 70 additions and 64 deletions

View File

@@ -59,7 +59,7 @@ void TitleBlockTemplateCellWidget::initWidgets() {
name_input_ = new QLineEdit();
// widgets specific to empty cells
empty_label_ = new QLabel(tr("Attention : les bordures des cellules vides n'apparaissent pas lors du rendu final sur le folio."));
empty_label_ = new QLabel(tr("Attention : les bordures des cellules vides n'apparaissent pas lors du rendu final sur le folio."));
// widgets specific to logo cells
logo_label_ = new QLabel(tr("Logo"));

View File

@@ -25,6 +25,7 @@ class TitleBlockCell;
class NamesList;
/**
@brief The TitleBlockTemplateCellWidget class
This class implements an edition widget for cells that compose a title
block template.
*/
@@ -33,86 +34,91 @@ class TitleBlockTemplateCellWidget : public QWidget {
// constructor, destructor
public:
TitleBlockTemplateCellWidget(TitleBlockTemplate * = nullptr, QWidget * = nullptr);
~TitleBlockTemplateCellWidget() override;
TitleBlockTemplateCellWidget(TitleBlockTemplate * = nullptr,
QWidget * = nullptr);
~TitleBlockTemplateCellWidget() override;
private:
TitleBlockTemplateCellWidget(const TitleBlockTemplateCellWidget &);
TitleBlockTemplateCellWidget(
const TitleBlockTemplateCellWidget &);
// attributes
private:
/// is the template read-only?
bool read_only_;
QLabel *cell_type_label_;
QComboBox *cell_type_input_;
/// is the template read-only?
bool read_only_;
QLabel *cell_type_label_;
QComboBox *cell_type_input_;
QLabel *empty_label_;
QLabel *empty_label_;
QLabel *logo_label_;
QComboBox *logo_input_;
QPushButton *add_logo_input_;
QLabel *logo_label_;
QComboBox *logo_input_;
QPushButton *add_logo_input_;
QLabel *name_label_;
QLineEdit *name_input_;
QCheckBox *label_checkbox_;
QLineEdit *label_input_;
QPushButton *label_edit_;
QLabel *value_label_;
QLineEdit *value_input_;
QPushButton *value_edit_;
QLabel *align_label_;
QLabel *horiz_align_label_;
QComboBox *horiz_align_input_;
QHash<int, int> horiz_align_indexes_;
QLabel *vert_align_label_;
QComboBox *vert_align_input_;
QHash<int, int> vert_align_indexes_;
QLabel *font_size_label_;
QSpinBox *font_size_input_;
QCheckBox *font_adjust_input_;
QVBoxLayout *cell_editor_layout_;
QHBoxLayout *cell_editor_type_and_name_layout_;
QGridLayout *cell_editor_text_layout_;
QHBoxLayout *cell_editor_image_layout_;
QLabel *name_label_;
QLineEdit *name_input_;
QCheckBox *label_checkbox_;
QLineEdit *label_input_;
QPushButton *label_edit_;
QLabel *value_label_;
QLineEdit *value_input_;
QPushButton *value_edit_;
QLabel *align_label_;
QLabel *horiz_align_label_;
QComboBox *horiz_align_input_;
QHash<int, int> horiz_align_indexes_;
QLabel *vert_align_label_;
QComboBox *vert_align_input_;
QHash<int, int> vert_align_indexes_;
QLabel *font_size_label_;
QSpinBox *font_size_input_;
QCheckBox *font_adjust_input_;
QVBoxLayout *cell_editor_layout_;
QHBoxLayout *cell_editor_type_and_name_layout_;
QGridLayout *cell_editor_text_layout_;
QHBoxLayout *cell_editor_image_layout_;
TitleBlockCell *edited_cell_;
TitleBlockCell *edited_cell_;
// methods
public:
int horizontalAlignment() const;
int verticalAlignment() const;
int alignment() const;
bool isReadOnly() const;
int horizontalAlignment() const;
int verticalAlignment() const;
int alignment() const;
bool isReadOnly() const;
protected:
void editTranslatableValue(NamesList &, const QString &, const QString &) const;
void emitModification(const QString &, const QVariant &) const;
QString defaultVariablesString() const;
QString labelValueInformationString() const;
void editTranslatableValue(NamesList &,
const QString &,
const QString &) const;
void emitModification(const QString &,
const QVariant &) const;
QString defaultVariablesString() const;
QString labelValueInformationString() const;
private:
void initWidgets();
void initWidgets();
public slots:
void updateFormType(int);
void edit(TitleBlockCell *);
void editType();
void editName();
void editLabelDisplayed();
void editLabel();
void editValue();
void editAlignment();
void editFontSize();
void editAdjust();
void editLogo();
void updateLogosComboBox(const TitleBlockTemplate *);
void setReadOnly(bool);
void updateFormType(int);
void edit(TitleBlockCell *);
void editType();
void editName();
void editLabelDisplayed();
void editLabel();
void editValue();
void editAlignment();
void editFontSize();
void editAdjust();
void editLogo();
void updateLogosComboBox(const TitleBlockTemplate *);
void setReadOnly(bool);
private slots:
signals:
void logoEditionRequested();
void cellModified(ModifyTitleBlockCellCommand *) const;
void logoEditionRequested();
void cellModified(ModifyTitleBlockCellCommand *) const;
};
#endif

View File

@@ -422,7 +422,7 @@ void TitleBlockTemplateView::drawBackground(QPainter *painter, const QRectF &rec
@return the selected logical cells, not including the spanned ones.
*/
QList<TitleBlockCell *> TitleBlockTemplateView::selectedCells() const {
return(selectedCellsSet().cells(false).values());
return(selectedCellsSet().cells(false).values());
}
/**