code format

This commit is contained in:
2022-12-14 14:14:33 +03:00
parent 09e5342956
commit cdb02fc9be
278 changed files with 15371 additions and 12176 deletions

View File

@@ -1,20 +1,20 @@
/*
QAD - Qt ADvanced
QAD - Qt ADvanced
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 Lesser General Public License for more details.
This program 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QPICONFIGWIDGET_H
@@ -23,31 +23,31 @@
#include "qad_widgets_export.h"
#include "qpiconfig.h"
#include "qpiconfignewdialog.h"
#include <QComboBox>
#include <QTreeWidget>
#include <QAction>
#include <QComboBox>
#include <QMenu>
#include <QTreeWidget>
class ConfigValueWidget;
class QAD_WIDGETS_EXPORT UComboBox: public QComboBox
{
class QAD_WIDGETS_EXPORT UComboBox: public QComboBox {
Q_OBJECT
public:
UComboBox(QWidget *parent = nullptr);
UComboBox(QWidget * parent = nullptr);
private slots:
void indexChange(int i);
signals:
void currentIndexChanged(int, UComboBox * );
void currentIndexChanged(int, UComboBox *);
};
class QAD_WIDGETS_EXPORT QPIConfigWidget: public QTreeWidget
{
class QAD_WIDGETS_EXPORT QPIConfigWidget: public QTreeWidget {
Q_OBJECT
Q_PROPERTY(bool readOnlyName READ readOnlyName WRITE setReadOnlyName)
Q_PROPERTY(bool readOnlyValue READ readOnlyValue WRITE setReadOnlyValue)
@@ -57,28 +57,29 @@ class QAD_WIDGETS_EXPORT QPIConfigWidget: public QTreeWidget
Q_PROPERTY(bool columnValueVisible READ columnValueVisible WRITE setColumnValueVisible)
Q_PROPERTY(bool columnTypeVisible READ columnTypeVisible WRITE setColumnTypeVisible)
Q_PROPERTY(bool columnCommentVisible READ columnCommentVisible WRITE setColumnCommentVisible)
public:
QPIConfigWidget(QWidget * parent = nullptr, QPIConfig * c = nullptr, bool on = true);
~QPIConfigWidget() override {clear();}
~QPIConfigWidget() override { clear(); }
void setQPIConfig(QPIConfig *c);
bool readOnlyName() {return read_only_name;}
bool readOnlyValue() {return read_only_value;}
bool readOnlyType() {return read_only_type;}
bool readOnlyComment() {return read_only_comment;}
bool columnNameVisible() {return !c_hidden[0];}
bool columnValueVisible() {return !c_hidden[1];}
bool columnTypeVisible() {return !c_hidden[2];}
bool columnCommentVisible() {return !c_hidden[3];}
void setQPIConfig(QPIConfig * c);
bool readOnlyName() { return read_only_name; }
bool readOnlyValue() { return read_only_value; }
bool readOnlyType() { return read_only_type; }
bool readOnlyComment() { return read_only_comment; }
bool columnNameVisible() { return !c_hidden[0]; }
bool columnValueVisible() { return !c_hidden[1]; }
bool columnTypeVisible() { return !c_hidden[2]; }
bool columnCommentVisible() { return !c_hidden[3]; }
QString writeToString();
void readFromString(QString str);
public slots:
void parse();
void write();
void clear();
void buildTree();
void filter(const QString &f);
void filter(const QString & f);
void setReadOnlyName(bool yes);
void setReadOnlyValue(bool yes);
void setReadOnlyType(bool yes);
@@ -96,7 +97,7 @@ private slots:
void on_actionAddItem_triggered();
void on_actionAddNode_triggered();
void on_actionRemove_triggered();
signals:
void changed();
@@ -106,25 +107,25 @@ private:
void buildEntry(QTreeWidgetItem * i, QPIConfig::Entry * e);
void buildFullNames(QTreeWidgetItem * i);
QPIConfig::Entry * itemEntry(QTreeWidgetItem * i);
ConfigValueWidget *itemCWidget(QTreeWidgetItem *i);
UComboBox *itemTWidget(QTreeWidgetItem *i);
ConfigValueWidget * itemCWidget(QTreeWidgetItem * i);
UComboBox * itemTWidget(QTreeWidgetItem * i);
QTreeWidgetItem * addEntry(QTreeWidgetItem * i, QPIConfig::Entry * e, bool node = false);
void deleteEntry(QTreeWidgetItem * i);
bool filter(const QString & f, QTreeWidgetItem * i);
bool filterItem(const QString & f, QTreeWidgetItem * i);
void translate();
void addTrEntry(const QString &s, const QString &f);
void addTrEntry(const QString & s, const QString & f);
QPIConfig * conf;
QPIConfigNewDialog new_dialog;
QAction actionAddItem, actionAddNode, actionToItem, actionToNode, actionRemove, actionExpandAll, actionCollapseAll;
QMenu popupMenu;
QString c_name, c_comment;
QTreeWidgetItem * pi, * ti, * c_pi;
QTreeWidgetItem *pi, *ti, *c_pi;
QHash<QString, QString> types;
QStringList s_types;
QVector<ConfigValueWidget * > w_values;
QVector<UComboBox * > w_types;
QVector<ConfigValueWidget *> w_values;
QVector<UComboBox *> w_types;
QVector<bool> c_hidden;
bool active, read_only_name, read_only_value, read_only_type, read_only_comment;
};