fixed indentations of the remaining *.cpp/*.h files

This commit is contained in:
plc-user
2024-05-02 08:39:27 +02:00
parent e9448be986
commit b3ac3c82af
41 changed files with 1007 additions and 1007 deletions

View File

@@ -1,19 +1,19 @@
/*
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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.
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "terminalstripprojectconfigpage.h"
#include "../../../qeticons.h"
@@ -23,26 +23,26 @@
#include <QVBoxLayout>
TerminalStripProjectConfigPage::TerminalStripProjectConfigPage(QETProject *project,
QWidget *parent) :
ProjectConfigPage { project, parent }
QWidget *parent) :
ProjectConfigPage { project, parent }
{
initWidgets();
initWidgets();
}
QString TerminalStripProjectConfigPage::title() const {
return tr("Plan de bornes");
return tr("Plan de bornes");
}
QIcon TerminalStripProjectConfigPage::icon() const {
return QET::Icons::TerminalStrip;
return QET::Icons::TerminalStrip;
}
void TerminalStripProjectConfigPage::initWidgets()
{
m_layout_editor = new TerminalStripLayoutEditor{ project()->projectPropertiesHandler().terminalStripLayoutHandler().defaultLayout(),
this };
m_layout_editor = new TerminalStripLayoutEditor{ project()->projectPropertiesHandler().terminalStripLayoutHandler().defaultLayout(),
this };
auto v_layout = new QVBoxLayout { this };
v_layout->addWidget(m_layout_editor);
setLayout(v_layout);
auto v_layout = new QVBoxLayout { this };
v_layout->addWidget(m_layout_editor);
setLayout(v_layout);
}

View File

@@ -1,19 +1,19 @@
/*
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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.
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TERMINALSTRIPPROJECTCONFIGPAGE_H
#define TERMINALSTRIPPROJECTCONFIGPAGE_H
@@ -24,23 +24,23 @@ class TerminalStripLayoutEditor;
class TerminalStripProjectConfigPage : public ProjectConfigPage
{
Q_OBJECT
public:
TerminalStripProjectConfigPage(QETProject *project, QWidget *parent = nullptr);
Q_OBJECT
public:
TerminalStripProjectConfigPage(QETProject *project, QWidget *parent = nullptr);
QString title() const override;
QIcon icon() const override;
QString title() const override;
QIcon icon() const override;
void applyProjectConf() override {}
void applyProjectConf() override {}
protected:
void initWidgets() override;
void initLayout() override{}
void readValuesFromProject() override {}
void adjustReadOnly() override {}
protected:
void initWidgets() override;
void initLayout() override{}
void readValuesFromProject() override {}
void adjustReadOnly() override {}
private:
TerminalStripLayoutEditor *m_layout_editor { nullptr };
private:
TerminalStripLayoutEditor *m_layout_editor { nullptr };
};
#endif // TERMINALSTRIPPROJECTCONFIGPAGE_H

View File

@@ -1,19 +1,19 @@
/*
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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.
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "freeterminaleditor.h"
#include "ui_freeterminaleditor.h"

View File

@@ -1,19 +1,19 @@
/*
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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.
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FREETERMINALEDITOR_H
#define FREETERMINALEDITOR_H

View File

@@ -1,19 +1,19 @@
/*
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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.
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QComboBox>
@@ -333,7 +333,7 @@ QWidget *FreeTerminalModelDelegate::createEditor(QWidget *parent, const QStyleOp
{
if (index.column() == TYPE_CELL) {
auto qcb = new QComboBox(parent);
qcb->setObjectName(QStringLiteral("terminal_type"));
qcb->setObjectName(QStringLiteral("terminal_type"));
qcb->addItem(ElementData::translatedTerminalType(ElementData::TTGeneric), ElementData::TTGeneric);
qcb->addItem(ElementData::translatedTerminalType(ElementData::TTFuse), ElementData::TTFuse);
qcb->addItem(ElementData::translatedTerminalType(ElementData::TTSectional), ElementData::TTSectional);
@@ -344,7 +344,7 @@ QWidget *FreeTerminalModelDelegate::createEditor(QWidget *parent, const QStyleOp
}
if (index.column() == FUNCTION_CELL) {
auto qcb = new QComboBox(parent);
qcb->setObjectName(QStringLiteral("terminal_function"));
qcb->setObjectName(QStringLiteral("terminal_function"));
qcb->addItem(ElementData::translatedTerminalFunction(ElementData::TFGeneric), ElementData::TFGeneric);
qcb->addItem(ElementData::translatedTerminalFunction(ElementData::TFPhase), ElementData::TFPhase);
qcb->addItem(ElementData::translatedTerminalFunction(ElementData::TFNeutral), ElementData::TFNeutral);

View File

@@ -1,19 +1,19 @@
/*
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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.
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FREETERMINALMODEL_H
#define FREETERMINALMODEL_H

View File

@@ -1,19 +1,19 @@
/*
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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.
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MODELTERMINALDATA_H
#define MODELTERMINALDATA_H

View File

@@ -1,19 +1,19 @@
/*
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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.
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "terminalstripcreatordialog.h"
#include "ui_terminalstripcreatordialog.h"

View File

@@ -1,19 +1,19 @@
/*
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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.
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TERMINALSTRIPCREATORDIALOG_H
#define TERMINALSTRIPCREATORDIALOG_H
@@ -33,9 +33,9 @@ namespace Ui {
*/
class TerminalStripCreatorDialog : public QDialog
{
Q_OBJECT
Q_OBJECT
public:
public:
explicit TerminalStripCreatorDialog(QETProject *project, QWidget *parent = nullptr);
~TerminalStripCreatorDialog() override;
@@ -46,8 +46,8 @@ class TerminalStripCreatorDialog : public QDialog
private:
void setCursorToEmptyLine();
private:
Ui::TerminalStripCreatorDialog *ui;
private:
Ui::TerminalStripCreatorDialog *ui;
QETProject *m_project = nullptr;
};

View File

@@ -180,7 +180,7 @@ void TerminalStripEditor::reload()
if (m_model)
{
m_model->reload();
spanMultiLevelTerminals();
spanMultiLevelTerminals();
}
}

View File

@@ -41,12 +41,12 @@ static const int TERMINAL_STRIP_PAGE = 2;
*/
void TerminalStripEditorWindow::edit(TerminalStrip *strip)
{
if (const auto project_ = strip->project())
{
auto editor_ = TerminalStripEditorWindow::instance(project_, QETApp::diagramEditor(project_));
editor_->setCurrentStrip(strip);
editor_->show();
}
if (const auto project_ = strip->project())
{
auto editor_ = TerminalStripEditorWindow::instance(project_, QETApp::diagramEditor(project_));
editor_->setCurrentStrip(strip);
editor_->show();
}
}
TerminalStripEditorWindow::TerminalStripEditorWindow(QETProject *project, QWidget *parent) :
@@ -73,11 +73,11 @@ TerminalStripEditorWindow::TerminalStripEditorWindow(QETProject *project, QWidge
*/
TerminalStripEditorWindow::~TerminalStripEditorWindow()
{
delete ui;
delete ui;
}
void TerminalStripEditorWindow::setCurrentStrip(TerminalStrip *strip) {
m_tree_dock->setSelectedStrip(strip);
m_tree_dock->setSelectedStrip(strip);
}
/**

View File

@@ -37,41 +37,41 @@ class TerminalStripEditorWindow : public QMainWindow
{
Q_OBJECT
private:
//We need to use a QPointer instead of a raw pointer because when window_
//have got a parent widget, the parent widget can delete the window_
//instance in her destrucor and then window_ become a dangling pointer.
static QPointer<TerminalStripEditorWindow> window_;
private:
//We need to use a QPointer instead of a raw pointer because when window_
//have got a parent widget, the parent widget can delete the window_
//instance in her destrucor and then window_ become a dangling pointer.
static QPointer<TerminalStripEditorWindow> window_;
public:
static TerminalStripEditorWindow* instance(QETProject *project, QWidget *parent = nullptr) {
static QMutex mutex_;
if (!window_) {
mutex_.lock();
if (!window_)
window_ = new TerminalStripEditorWindow{project, parent};
mutex_.unlock();
}
return window_;
}
public:
static TerminalStripEditorWindow* instance(QETProject *project, QWidget *parent = nullptr) {
static QMutex mutex_;
if (!window_) {
mutex_.lock();
if (!window_)
window_ = new TerminalStripEditorWindow{project, parent};
mutex_.unlock();
}
return window_;
}
static void dropInstance () {
static QMutex mutex;
if (window_) {
mutex.lock();
window_->deleteLater();
window_.clear();
mutex.unlock();
}
}
static void dropInstance () {
static QMutex mutex;
if (window_) {
mutex.lock();
window_->deleteLater();
window_.clear();
mutex.unlock();
}
}
static void edit(TerminalStrip *strip);
static void edit(TerminalStrip *strip);
public:
public:
explicit TerminalStripEditorWindow(QETProject *project, QWidget *parent = nullptr);
~TerminalStripEditorWindow();
void setCurrentStrip(TerminalStrip *strip);
void setCurrentStrip(TerminalStrip *strip);
private slots:
void on_m_add_terminal_strip_triggered();

View File

@@ -1,34 +1,34 @@
/*
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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.
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "terminalstriplayouteditor.h"
#include "ui_terminalstriplayouteditor.h"
#include "../GraphicsItem/properties/terminalstriplayoutpattern.h"
TerminalStripLayoutEditor::TerminalStripLayoutEditor(QSharedPointer<TerminalStripLayoutPattern> layout,
QWidget *parent) :
QWidget{ parent },
ui{ new Ui::TerminalStripLayoutEditor },
QWidget *parent) :
QWidget{ parent },
ui{ new Ui::TerminalStripLayoutEditor },
m_layout{ layout }
{
ui->setupUi(this);
ui->setupUi(this);
ui->m_graphics_view->setScene(new QGraphicsScene{ this });
ui->m_graphics_view->scene()->addItem(&m_preview_strip_item);
updateUi();
updateUi();
}
TerminalStripLayoutEditor::~TerminalStripLayoutEditor()
@@ -50,87 +50,87 @@ void TerminalStripLayoutEditor::showEvent(QShowEvent *event)
void TerminalStripLayoutEditor::valueEdited()
{
if (!m_layout || m_ui_updating) {
return;
}
if (!m_layout || m_ui_updating) {
return;
}
//auto *data_ = m_layout.data();
//auto *data_ = m_layout.data();
m_layout.data()->m_header_rect.setRect(0,
ui->m_y_header_sb->value(),
ui->m_width_header_sb->value(),
ui->m_height_header_sb->value());
m_layout.data()->m_header_rect.setRect(0,
ui->m_y_header_sb->value(),
ui->m_width_header_sb->value(),
ui->m_height_header_sb->value());
m_layout.data()->m_spacer_rect.setRect(0,
ui->m_y_spacer_sb->value(),
ui->m_width_spacer_sb->value(),
ui->m_height_spacer_sb->value());
m_layout.data()->m_spacer_rect.setRect(0,
ui->m_y_spacer_sb->value(),
ui->m_width_spacer_sb->value(),
ui->m_height_spacer_sb->value());
m_layout.data()->m_terminal_rect[0].setRect(0,
ui->m_y_terminal_0_sb->value(),
ui->m_width_terminal_0_sb->value(),
ui->m_height_terminal_0_sb->value());
m_layout.data()->m_terminal_rect[0].setRect(0,
ui->m_y_terminal_0_sb->value(),
ui->m_width_terminal_0_sb->value(),
ui->m_height_terminal_0_sb->value());
m_layout.data()->m_terminal_rect[1].setRect(0,
ui->m_y_terminal_1_sb->value(),
ui->m_width_terminal_1_sb->value(),
ui->m_height_terminal_1_sb->value());
m_layout.data()->m_terminal_rect[1].setRect(0,
ui->m_y_terminal_1_sb->value(),
ui->m_width_terminal_1_sb->value(),
ui->m_height_terminal_1_sb->value());
m_layout.data()->m_terminal_rect[2].setRect(0,
ui->m_y_terminal_2_sb->value(),
ui->m_width_terminal_2_sb->value(),
ui->m_height_terminal_2_sb->value());
m_layout.data()->m_terminal_rect[2].setRect(0,
ui->m_y_terminal_2_sb->value(),
ui->m_width_terminal_2_sb->value(),
ui->m_height_terminal_2_sb->value());
m_layout.data()->m_terminal_rect[3].setRect(0,
ui->m_y_terminal_3_sb->value(),
ui->m_width_terminal_3_sb->value(),
ui->m_height_terminal_3_sb->value());
m_layout.data()->m_terminal_rect[3].setRect(0,
ui->m_y_terminal_3_sb->value(),
ui->m_width_terminal_3_sb->value(),
ui->m_height_terminal_3_sb->value());
m_layout.data()->m_bridge_point_y_offset[0] = ui->m_bridge_point_0_sb->value();
m_layout.data()->m_bridge_point_y_offset[1] = ui->m_bridge_point_1_sb->value();
m_layout.data()->m_bridge_point_y_offset[2] = ui->m_bridge_point_2_sb->value();
m_layout.data()->m_bridge_point_y_offset[3] = ui->m_bridge_point_3_sb->value();
m_layout.data()->m_bridge_point_y_offset[0] = ui->m_bridge_point_0_sb->value();
m_layout.data()->m_bridge_point_y_offset[1] = ui->m_bridge_point_1_sb->value();
m_layout.data()->m_bridge_point_y_offset[2] = ui->m_bridge_point_2_sb->value();
m_layout.data()->m_bridge_point_y_offset[3] = ui->m_bridge_point_3_sb->value();
m_layout.data()->m_header_text_orientation = ui->m_header_text_orientation_cb->currentIndex() == 0 ?
Qt::Horizontal :
Qt::Vertical;
m_layout.data()->m_header_text_orientation = ui->m_header_text_orientation_cb->currentIndex() == 0 ?
Qt::Horizontal :
Qt::Vertical;
switch (ui->m_header_text_alignment_cb->currentIndex()) {
case 0:
m_layout.data()->setHeaderTextAlignment(Qt::AlignLeft | Qt::AlignVCenter); break;
case 1:
m_layout.data()->setHeaderTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); break;
default:
m_layout.data()->setHeaderTextAlignment(Qt::AlignRight | Qt::AlignVCenter); break;
}
switch (ui->m_header_text_alignment_cb->currentIndex()) {
case 0:
m_layout.data()->setHeaderTextAlignment(Qt::AlignLeft | Qt::AlignVCenter); break;
case 1:
m_layout.data()->setHeaderTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); break;
default:
m_layout.data()->setHeaderTextAlignment(Qt::AlignRight | Qt::AlignVCenter); break;
}
m_layout.data()->m_terminals_text_orientation[0] = ui->m_terminal_text_orientation_cb->currentIndex() == 0 ?
Qt::Horizontal :
Qt::Vertical;
m_layout.data()->m_terminals_text_orientation[0] = ui->m_terminal_text_orientation_cb->currentIndex() == 0 ?
Qt::Horizontal :
Qt::Vertical;
switch (ui->m_terminal_text_alignment_cb->currentIndex()) {
case 0:
m_layout.data()->setTerminalsTextAlignment(
QVector<Qt::Alignment> { Qt::AlignLeft | Qt::AlignVCenter,
Qt::AlignLeft | Qt::AlignVCenter,
Qt::AlignLeft | Qt::AlignVCenter,
Qt::AlignLeft | Qt::AlignVCenter });
break;
case 1:
m_layout.data()->setTerminalsTextAlignment(
QVector<Qt::Alignment> { Qt::AlignHCenter | Qt::AlignVCenter,
Qt::AlignHCenter | Qt::AlignVCenter,
Qt::AlignHCenter | Qt::AlignVCenter,
Qt::AlignHCenter | Qt::AlignVCenter });
break;
default:
m_layout.data()->setTerminalsTextAlignment(
QVector<Qt::Alignment> { Qt::AlignRight | Qt::AlignVCenter,
Qt::AlignRight | Qt::AlignVCenter,
Qt::AlignRight | Qt::AlignVCenter,
Qt::AlignRight | Qt::AlignVCenter });
break;
}
switch (ui->m_terminal_text_alignment_cb->currentIndex()) {
case 0:
m_layout.data()->setTerminalsTextAlignment(
QVector<Qt::Alignment> { Qt::AlignLeft | Qt::AlignVCenter,
Qt::AlignLeft | Qt::AlignVCenter,
Qt::AlignLeft | Qt::AlignVCenter,
Qt::AlignLeft | Qt::AlignVCenter });
break;
case 1:
m_layout.data()->setTerminalsTextAlignment(
QVector<Qt::Alignment> { Qt::AlignHCenter | Qt::AlignVCenter,
Qt::AlignHCenter | Qt::AlignVCenter,
Qt::AlignHCenter | Qt::AlignVCenter,
Qt::AlignHCenter | Qt::AlignVCenter });
break;
default:
m_layout.data()->setTerminalsTextAlignment(
QVector<Qt::Alignment> { Qt::AlignRight | Qt::AlignVCenter,
Qt::AlignRight | Qt::AlignVCenter,
Qt::AlignRight | Qt::AlignVCenter,
Qt::AlignRight | Qt::AlignVCenter });
break;
}
updateUi();
m_preview_strip_item.update();
@@ -138,76 +138,76 @@ void TerminalStripLayoutEditor::valueEdited()
void TerminalStripLayoutEditor::updateUi()
{
if (!m_layout) {
return;
}
if (!m_layout) {
return;
}
const auto data = m_layout.data();
const auto data = m_layout.data();
m_ui_updating = true;
m_ui_updating = true;
ui->m_y_header_sb->setValue(data->m_header_rect.y());
ui->m_width_header_sb->setValue(data->m_header_rect.width());
ui->m_height_header_sb->setValue(data->m_header_rect.height());
ui->m_y_header_sb->setValue(data->m_header_rect.y());
ui->m_width_header_sb->setValue(data->m_header_rect.width());
ui->m_height_header_sb->setValue(data->m_header_rect.height());
ui->m_y_spacer_sb->setValue(data->m_spacer_rect.y());
ui->m_width_spacer_sb->setValue(data->m_spacer_rect.width());
ui->m_height_spacer_sb->setValue(data->m_spacer_rect.height());
ui->m_y_spacer_sb->setValue(data->m_spacer_rect.y());
ui->m_width_spacer_sb->setValue(data->m_spacer_rect.width());
ui->m_height_spacer_sb->setValue(data->m_spacer_rect.height());
const auto terminal_0 = data->m_terminal_rect[0];
ui->m_y_terminal_0_sb->setValue(terminal_0.y());
ui->m_height_terminal_0_sb->setValue(terminal_0.height());
ui->m_width_terminal_0_sb->setValue(terminal_0.width());
const auto terminal_0 = data->m_terminal_rect[0];
ui->m_y_terminal_0_sb->setValue(terminal_0.y());
ui->m_height_terminal_0_sb->setValue(terminal_0.height());
ui->m_width_terminal_0_sb->setValue(terminal_0.width());
const auto terminal_1 = data->m_terminal_rect[1];
ui->m_y_terminal_1_sb->setValue(terminal_1.y());
ui->m_height_terminal_1_sb->setValue(terminal_1.height());
ui->m_width_terminal_1_sb->setValue(terminal_1.width());
const auto terminal_1 = data->m_terminal_rect[1];
ui->m_y_terminal_1_sb->setValue(terminal_1.y());
ui->m_height_terminal_1_sb->setValue(terminal_1.height());
ui->m_width_terminal_1_sb->setValue(terminal_1.width());
const auto terminal_2 = data->m_terminal_rect[2];
ui->m_y_terminal_2_sb->setValue(terminal_2.y());
ui->m_height_terminal_2_sb->setValue(terminal_2.height());
ui->m_width_terminal_2_sb->setValue(terminal_2.width());
const auto terminal_2 = data->m_terminal_rect[2];
ui->m_y_terminal_2_sb->setValue(terminal_2.y());
ui->m_height_terminal_2_sb->setValue(terminal_2.height());
ui->m_width_terminal_2_sb->setValue(terminal_2.width());
const auto terminal_3 = data->m_terminal_rect[3];
ui->m_y_terminal_3_sb->setValue(terminal_3.y());
ui->m_height_terminal_3_sb->setValue(terminal_3.height());
ui->m_width_terminal_3_sb->setValue(terminal_3.width());
const auto terminal_3 = data->m_terminal_rect[3];
ui->m_y_terminal_3_sb->setValue(terminal_3.y());
ui->m_height_terminal_3_sb->setValue(terminal_3.height());
ui->m_width_terminal_3_sb->setValue(terminal_3.width());
const auto bridge_point = data->m_bridge_point_y_offset;
ui->m_bridge_point_0_sb->setValue(bridge_point[0]);
ui->m_bridge_point_1_sb->setValue(bridge_point[1]);
ui->m_bridge_point_2_sb->setValue(bridge_point[2]);
ui->m_bridge_point_3_sb->setValue(bridge_point[3]);
const auto bridge_point = data->m_bridge_point_y_offset;
ui->m_bridge_point_0_sb->setValue(bridge_point[0]);
ui->m_bridge_point_1_sb->setValue(bridge_point[1]);
ui->m_bridge_point_2_sb->setValue(bridge_point[2]);
ui->m_bridge_point_3_sb->setValue(bridge_point[3]);
if (data->m_header_text_orientation == Qt::Horizontal) {
ui->m_header_text_orientation_cb->setCurrentIndex(0);
} else {
ui->m_header_text_orientation_cb->setCurrentIndex(1);
}
if (data->m_header_text_orientation == Qt::Horizontal) {
ui->m_header_text_orientation_cb->setCurrentIndex(0);
} else {
ui->m_header_text_orientation_cb->setCurrentIndex(1);
}
if (data->m_terminals_text_orientation[0] == Qt::Horizontal) {
ui->m_terminal_text_orientation_cb->setCurrentIndex(0);
} else {
ui->m_terminal_text_orientation_cb->setCurrentIndex(1);
}
if (data->m_terminals_text_orientation[0] == Qt::Horizontal) {
ui->m_terminal_text_orientation_cb->setCurrentIndex(0);
} else {
ui->m_terminal_text_orientation_cb->setCurrentIndex(1);
}
const auto header_alignment = data->headerTextAlignment();
if (header_alignment &Qt::AlignLeft) {
ui->m_header_text_alignment_cb->setCurrentIndex(0);
} else if (header_alignment &Qt::AlignHCenter) {
ui->m_header_text_alignment_cb->setCurrentIndex(1);
} else if (header_alignment &Qt::AlignRight) {
ui->m_header_text_alignment_cb->setCurrentIndex(2);
}
const auto header_alignment = data->headerTextAlignment();
if (header_alignment &Qt::AlignLeft) {
ui->m_header_text_alignment_cb->setCurrentIndex(0);
} else if (header_alignment &Qt::AlignHCenter) {
ui->m_header_text_alignment_cb->setCurrentIndex(1);
} else if (header_alignment &Qt::AlignRight) {
ui->m_header_text_alignment_cb->setCurrentIndex(2);
}
const auto terminal_alignment = data->terminalsTextAlignment().at(0);
if (terminal_alignment &Qt::AlignLeft) {
ui->m_terminal_text_alignment_cb->setCurrentIndex(0);
} else if (terminal_alignment &Qt::AlignHCenter) {
ui->m_terminal_text_alignment_cb->setCurrentIndex(1);
} else if (terminal_alignment &Qt::AlignRight) {
ui->m_terminal_text_alignment_cb->setCurrentIndex(2);
const auto terminal_alignment = data->terminalsTextAlignment().at(0);
if (terminal_alignment &Qt::AlignLeft) {
ui->m_terminal_text_alignment_cb->setCurrentIndex(0);
} else if (terminal_alignment &Qt::AlignHCenter) {
ui->m_terminal_text_alignment_cb->setCurrentIndex(1);
} else if (terminal_alignment &Qt::AlignRight) {
ui->m_terminal_text_alignment_cb->setCurrentIndex(2);
}
m_ui_updating = false;
@@ -222,7 +222,7 @@ void TerminalStripLayoutEditor::updatePreview()
void TerminalStripLayoutEditor::on_m_display_preview_help_clicked(bool checked)
{
m_preview_strip_item.m_drawer.setPreviewDraw(checked);
m_preview_strip_item.update();
m_preview_strip_item.m_drawer.setPreviewDraw(checked);
m_preview_strip_item.update();
}

View File

@@ -1,19 +1,19 @@
/*
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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.
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TERMINALSTRIPLAYOUTEDITOR_H
#define TERMINALSTRIPLAYOUTEDITOR_H
@@ -27,35 +27,35 @@
class TerminalStripLayoutPattern;
namespace Ui {
class TerminalStripLayoutEditor;
class TerminalStripLayoutEditor;
}
class PreviewStripItem : public QGraphicsItem
{
friend class TerminalStripLayoutEditor;
friend class TerminalStripLayoutEditor;
public:
PreviewStripItem (QSharedPointer<TerminalStripLayoutPattern> layout) :
m_drawer {QSharedPointer<TerminalStripDrawer::DemoTerminalStrip>{new TerminalStripDrawer::DemoTerminalStrip},
layout}
{}
public:
PreviewStripItem (QSharedPointer<TerminalStripLayoutPattern> layout) :
m_drawer {QSharedPointer<TerminalStripDrawer::DemoTerminalStrip>{new TerminalStripDrawer::DemoTerminalStrip},
layout}
{}
QRectF boundingRect() const override {
return m_drawer.boundingRect();
}
QRectF boundingRect() const override {
return m_drawer.boundingRect();
}
protected:
void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option,
QWidget *widget = nullptr) override
{
Q_UNUSED (option); Q_UNUSED (widget);
m_drawer.paint(painter);
}
protected:
void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option,
QWidget *widget = nullptr) override
{
Q_UNUSED (option); Q_UNUSED (widget);
m_drawer.paint(painter);
}
private:
TerminalStripDrawer::TerminalStripDrawer m_drawer;
};
private:
TerminalStripDrawer::TerminalStripDrawer m_drawer;
};
/**
* @brief The TerminalStripLayoutEditor class
@@ -63,30 +63,30 @@ class PreviewStripItem : public QGraphicsItem
*/
class TerminalStripLayoutEditor : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
explicit TerminalStripLayoutEditor(QSharedPointer<TerminalStripLayoutPattern> layout,
QWidget *parent = nullptr);
~TerminalStripLayoutEditor();
public:
explicit TerminalStripLayoutEditor(QSharedPointer<TerminalStripLayoutPattern> layout,
QWidget *parent = nullptr);
~TerminalStripLayoutEditor();
protected:
void resizeEvent(QResizeEvent *event) override;
void showEvent(QShowEvent *event) override;
private slots:
void valueEdited();
private slots:
void valueEdited();
void on_m_display_preview_help_clicked(bool checked);
void on_m_display_preview_help_clicked(bool checked);
private:
private:
void updateUi();
void updatePreview();
private:
Ui::TerminalStripLayoutEditor *ui;
QSharedPointer<TerminalStripLayoutPattern> m_layout;
bool m_ui_updating { false } ;
private:
Ui::TerminalStripLayoutEditor *ui;
QSharedPointer<TerminalStripLayoutPattern> m_layout;
bool m_ui_updating { false } ;
PreviewStripItem m_preview_strip_item {m_layout};
};

View File

@@ -1,19 +1,19 @@
/*
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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.
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "terminalstripmodel.h"
#include "../terminalstrip.h"
@@ -105,8 +105,8 @@ TerminalStripModel::Column TerminalStripModel::columnTypeForIndex(const QModelIn
* @param parent
*/
TerminalStripModel::TerminalStripModel(TerminalStrip *terminal_strip, QObject *parent) :
QAbstractTableModel(parent),
m_terminal_strip(terminal_strip)
QAbstractTableModel(parent),
m_terminal_strip(terminal_strip)
{
fillPhysicalTerminalData();
@@ -129,11 +129,11 @@ void TerminalStripModel::setTerminalStrip(TerminalStrip *terminal_strip)
int TerminalStripModel::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
Q_UNUSED(parent)
if (!m_terminal_strip) {
return 0;
}
if (!m_terminal_strip) {
return 0;
}
auto count = 0;
for (const auto &mptd : m_physical_data) {
@@ -145,7 +145,7 @@ int TerminalStripModel::rowCount(const QModelIndex &parent) const
int TerminalStripModel::columnCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
Q_UNUSED(parent)
return COLUMN_COUNT;
}
@@ -186,7 +186,7 @@ QVariant TerminalStripModel::data(const QModelIndex &index, int role) const
{
return mrtd.led_ ? Qt::Checked : Qt::Unchecked;
}
else if (role == Qt::BackgroundRole && index.column() < COLUMN_COUNT )
else if (role == Qt::BackgroundRole && index.column() < COLUMN_COUNT )
{
if (m_modified_cell.contains(mrtd.element_) &&
m_modified_cell.value(mrtd.element_).at(index.column()))
@@ -794,7 +794,7 @@ QWidget *TerminalStripModelDelegate::createEditor(QWidget *parent, const QStyleO
{
if (index.column() == TYPE_CELL) {
auto qcb = new QComboBox(parent);
qcb->setObjectName(QStringLiteral("terminal_type"));
qcb->setObjectName(QStringLiteral("terminal_type"));
qcb->addItem(ElementData::translatedTerminalType(ElementData::TTGeneric), ElementData::TTGeneric);
qcb->addItem(ElementData::translatedTerminalType(ElementData::TTFuse), ElementData::TTFuse);
qcb->addItem(ElementData::translatedTerminalType(ElementData::TTSectional), ElementData::TTSectional);
@@ -805,7 +805,7 @@ QWidget *TerminalStripModelDelegate::createEditor(QWidget *parent, const QStyleO
}
if (index.column() == FUNCTION_CELL) {
auto qcb = new QComboBox(parent);
qcb->setObjectName(QStringLiteral("terminal_function"));
qcb->setObjectName(QStringLiteral("terminal_function"));
qcb->addItem(ElementData::translatedTerminalFunction(ElementData::TFGeneric), ElementData::TFGeneric);
qcb->addItem(ElementData::translatedTerminalFunction(ElementData::TFPhase), ElementData::TFPhase);
qcb->addItem(ElementData::translatedTerminalFunction(ElementData::TFNeutral), ElementData::TFNeutral);

View File

@@ -1,19 +1,19 @@
/*
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
Copyright 2006-2024 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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.
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TERMINALSTRIPMODEL_H
#define TERMINALSTRIPMODEL_H
@@ -67,14 +67,14 @@ class TerminalStripModel : public QAbstractTableModel
static int levelForColumn(TerminalStripModel::Column column);
static TerminalStripModel::Column columnTypeForIndex(const QModelIndex &index);
Q_OBJECT
public:
TerminalStripModel(TerminalStrip *terminal_strip, QObject *parent = nullptr);
Q_OBJECT
public:
TerminalStripModel(TerminalStrip *terminal_strip, QObject *parent = nullptr);
void setTerminalStrip(TerminalStrip *terminal_strip);
virtual int rowCount (const QModelIndex &parent = QModelIndex()) const override;
virtual int columnCount (const QModelIndex &parent = QModelIndex()) const override;
virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override;
virtual int rowCount (const QModelIndex &parent = QModelIndex()) const override;
virtual int columnCount (const QModelIndex &parent = QModelIndex()) const override;
virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override;
virtual bool setData (const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
virtual QVariant headerData (int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
virtual Qt::ItemFlags flags (const QModelIndex &index) const override;
@@ -96,8 +96,8 @@ class TerminalStripModel : public QAbstractTableModel
modelRealTerminalData realDataAtIndex(int index) const;
QPixmap bridgePixmapFor(const QModelIndex &index) const;
private:
QPointer<TerminalStrip> m_terminal_strip;
private:
QPointer<TerminalStrip> m_terminal_strip;
QHash<QPointer<Element>, QVector<bool>> m_modified_cell;
QVector<modelPhysicalTerminalData> m_physical_data;
struct BridgePixmap