git-svn-id: svn://db.shs.com.ru/libs@162 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -11,7 +11,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall")
|
||||
if (DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
|
||||
endif ()
|
||||
set(LIBS ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
|
||||
set(LIBS ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} qad_utils)
|
||||
file(GLOB MOCS "./*.h")
|
||||
file(GLOB CPPS "./*.cpp")
|
||||
file(GLOB UIS "./*.ui")
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "iconedlabelplugin.h"
|
||||
#include "qcodeeditplugin.h"
|
||||
#include "qvarianteditplugin.h"
|
||||
#include "qpiconfigplugin.h"
|
||||
#include "qad_widgets.h"
|
||||
|
||||
QADWidgets::QADWidgets(QObject * parent): QObject(parent)
|
||||
@@ -28,6 +29,7 @@ QADWidgets::QADWidgets(QObject * parent): QObject(parent)
|
||||
m_widgets.append(new IconedLabelPlugin(this));
|
||||
m_widgets.append(new QCodeEditPlugin(this));
|
||||
m_widgets.append(new QVariantEditPlugin(this));
|
||||
m_widgets.append(new QPIConfigPlugin(this));
|
||||
}
|
||||
|
||||
|
||||
|
||||
69
qad_widgets/plugin/qpiconfigplugin.cpp
Normal file
69
qad_widgets/plugin/qpiconfigplugin.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "qpiconfigwidget.h"
|
||||
#include "qpiconfigplugin.h"
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
QPIConfigPlugin::QPIConfigPlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool QPIConfigPlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget * QPIConfigPlugin::createWidget(QWidget * parent) {
|
||||
return new QPIConfigWidget(parent, 0, false);
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigPlugin::name() const {
|
||||
return QLatin1String("QPIConfigWidget");
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigPlugin::group() const {
|
||||
return QLatin1String("Editor Widgets");
|
||||
}
|
||||
|
||||
|
||||
QIcon QPIConfigPlugin::icon() const {
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigPlugin::toolTip() const {
|
||||
return QLatin1String("");
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigPlugin::whatsThis() const {
|
||||
return QLatin1String("");
|
||||
}
|
||||
|
||||
|
||||
bool QPIConfigPlugin::isContainer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigPlugin::domXml() const {
|
||||
return QLatin1String("<widget class=\"QPIConfigWidget\" name=\"piConfigWidget\">\n</widget>\n");
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigPlugin::includeFile() const {
|
||||
return QLatin1String("qpiconfigwidget.h");
|
||||
}
|
||||
|
||||
31
qad_widgets/plugin/qpiconfigplugin.h
Normal file
31
qad_widgets/plugin/qpiconfigplugin.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef QPICONFIGPLUGIN_H
|
||||
#define QPICONFIGPLUGIN_H
|
||||
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
class QPIConfigPlugin: public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
QPIConfigPlugin(QObject * parent = 0);
|
||||
|
||||
bool isContainer() const;
|
||||
bool isInitialized() const;
|
||||
QIcon icon() const;
|
||||
QString domXml() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QString name() const;
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QWidget * createWidget(QWidget * parent);
|
||||
void initialize(QDesignerFormEditorInterface * core);
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
|
||||
};
|
||||
|
||||
#endif // QPICONFIGPLUGIN_H
|
||||
77
qad_widgets/qpiconfignewdialog.cpp
Normal file
77
qad_widgets/qpiconfignewdialog.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
#include "qpiconfignewdialog.h"
|
||||
#include "ui_qpiconfignewdialog.h"
|
||||
|
||||
|
||||
QPIConfigNewDialog::QPIConfigNewDialog(QWidget * parent): QDialog(parent) {
|
||||
ui = new Ui::QPIConfigNewDialog();
|
||||
ui->setupUi(this);
|
||||
radios = findChildren<QRadioButton * >();
|
||||
ui->widgetValue->hideAll();
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigNewDialog::changeEvent(QEvent * e) {
|
||||
QDialog::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigNewDialog::typeChanged() {
|
||||
foreach (QRadioButton * i, radios) {
|
||||
if (i->isChecked()) {
|
||||
ui->widgetValue->setType(i->property("type").toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigNewDialog::type() {
|
||||
foreach (QRadioButton * i, radios)
|
||||
if (i->isChecked())
|
||||
return i->property("type").toString();
|
||||
return " ";
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigNewDialog::reset(bool node) {
|
||||
ui->lineName->clear();
|
||||
ui->lineComment->clear();
|
||||
ui->radioType_0->setChecked(true);
|
||||
ui->lineName->setFocus();
|
||||
ui->widgetValue->setType("s");
|
||||
ui->widgetValue->value.clear();
|
||||
ui->widgetValue->setVisible(!node);
|
||||
ui->groupType->setVisible(!node);
|
||||
ui->labelValue->setVisible(!node);
|
||||
ui->labelComment->setVisible(!node);
|
||||
ui->lineComment->setVisible(!node);
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigNewDialog::name() {
|
||||
return ui->lineName->text();
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigNewDialog::value() {
|
||||
return ui->widgetValue->value;
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigNewDialog::comment() {
|
||||
return ui->lineComment->text();
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigNewDialog::on_lineName_textChanged(const QString & text) {
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!text.isEmpty());
|
||||
}
|
||||
40
qad_widgets/qpiconfignewdialog.h
Normal file
40
qad_widgets/qpiconfignewdialog.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef QPICONFIGNEWDIALOG_H
|
||||
#define QPICONFIGNEWDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QRadioButton>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class QPIConfigNewDialog;
|
||||
}
|
||||
|
||||
|
||||
class QPIConfigNewDialog: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QPIConfigNewDialog(QWidget * parent = 0);
|
||||
|
||||
QString type();
|
||||
QString name();
|
||||
QString value();
|
||||
QString comment();
|
||||
void reset(bool node = false);
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent * e);
|
||||
|
||||
Ui::QPIConfigNewDialog * ui;
|
||||
|
||||
private slots:
|
||||
void on_lineName_textChanged(const QString & text);
|
||||
void typeChanged();
|
||||
|
||||
private:
|
||||
QList<QRadioButton * > radios;
|
||||
|
||||
};
|
||||
|
||||
#endif // QPICONFIGNEWDIALOG_H
|
||||
432
qad_widgets/qpiconfignewdialog.ui
Normal file
432
qad_widgets/qpiconfignewdialog.ui
Normal file
@@ -0,0 +1,432 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QPIConfigNewDialog</class>
|
||||
<widget class="QDialog" name="QPIConfigNewDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>316</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupType">
|
||||
<property name="title">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="radioType_0">
|
||||
<property name="text">
|
||||
<string>string</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="type" stdset="0">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="radioType_1">
|
||||
<property name="text">
|
||||
<string>integer</string>
|
||||
</property>
|
||||
<property name="type" stdset="0">
|
||||
<string>n</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="radioType_2">
|
||||
<property name="text">
|
||||
<string>float</string>
|
||||
</property>
|
||||
<property name="type" stdset="0">
|
||||
<string>f</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QRadioButton" name="radioType_3">
|
||||
<property name="text">
|
||||
<string>string list</string>
|
||||
</property>
|
||||
<property name="type" stdset="0">
|
||||
<string>l</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QRadioButton" name="radioType_4">
|
||||
<property name="text">
|
||||
<string>boolean</string>
|
||||
</property>
|
||||
<property name="type" stdset="0">
|
||||
<string>b</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QRadioButton" name="radioType_5">
|
||||
<property name="text">
|
||||
<string>color</string>
|
||||
</property>
|
||||
<property name="type" stdset="0">
|
||||
<string>c</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="radioType_6">
|
||||
<property name="text">
|
||||
<string>rectangle</string>
|
||||
</property>
|
||||
<property name="type" stdset="0">
|
||||
<string>r</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="radioType_7">
|
||||
<property name="text">
|
||||
<string>area</string>
|
||||
</property>
|
||||
<property name="type" stdset="0">
|
||||
<string>a</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QRadioButton" name="radioType_8">
|
||||
<property name="text">
|
||||
<string>point</string>
|
||||
</property>
|
||||
<property name="type" stdset="0">
|
||||
<string>p</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QRadioButton" name="radioType_9">
|
||||
<property name="text">
|
||||
<string>vector</string>
|
||||
</property>
|
||||
<property name="type" stdset="0">
|
||||
<string>v</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QRadioButton" name="radioType_10">
|
||||
<property name="text">
|
||||
<string>ip</string>
|
||||
</property>
|
||||
<property name="type" stdset="0">
|
||||
<string>i</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineName"/>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="labelComment">
|
||||
<property name="text">
|
||||
<string>Comment:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelValue">
|
||||
<property name="text">
|
||||
<string>Value:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineComment"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="ConfigValueWidget" name="widgetValue" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ConfigValueWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qpiconfigvaluewidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>lineName</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>QPIConfigNewDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>126</x>
|
||||
<y>326</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>110</x>
|
||||
<y>231</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>QPIConfigNewDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>169</x>
|
||||
<y>326</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>149</x>
|
||||
<y>232</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioType_0</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QPIConfigNewDialog</receiver>
|
||||
<slot>typeChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>33</x>
|
||||
<y>70</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>1</x>
|
||||
<y>61</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioType_1</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QPIConfigNewDialog</receiver>
|
||||
<slot>typeChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>25</x>
|
||||
<y>88</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>-1</x>
|
||||
<y>99</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioType_2</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QPIConfigNewDialog</receiver>
|
||||
<slot>typeChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>17</x>
|
||||
<y>119</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>2</x>
|
||||
<y>130</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioType_3</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QPIConfigNewDialog</receiver>
|
||||
<slot>typeChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>26</x>
|
||||
<y>143</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>0</x>
|
||||
<y>165</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioType_4</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QPIConfigNewDialog</receiver>
|
||||
<slot>typeChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>50</x>
|
||||
<y>170</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>2</x>
|
||||
<y>195</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioType_5</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QPIConfigNewDialog</receiver>
|
||||
<slot>typeChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>243</x>
|
||||
<y>37</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>312</x>
|
||||
<y>10</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioType_6</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QPIConfigNewDialog</receiver>
|
||||
<slot>typeChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>275</x>
|
||||
<y>67</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>315</x>
|
||||
<y>40</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioType_7</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QPIConfigNewDialog</receiver>
|
||||
<slot>typeChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>262</x>
|
||||
<y>95</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>311</x>
|
||||
<y>72</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioType_8</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QPIConfigNewDialog</receiver>
|
||||
<slot>typeChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>250</x>
|
||||
<y>113</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>313</x>
|
||||
<y>104</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioType_9</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QPIConfigNewDialog</receiver>
|
||||
<slot>typeChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>286</x>
|
||||
<y>145</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>311</x>
|
||||
<y>138</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioType_10</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QPIConfigNewDialog</receiver>
|
||||
<slot>typeChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>273</x>
|
||||
<y>168</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>312</x>
|
||||
<y>167</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>typeChanged()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
98
qad_widgets/qpiconfigvaluewidget.cpp
Normal file
98
qad_widgets/qpiconfigvaluewidget.cpp
Normal file
@@ -0,0 +1,98 @@
|
||||
#include "qpiconfigvaluewidget.h"
|
||||
#include "qpievaluator.h"
|
||||
|
||||
|
||||
ConfigValueWidget::ConfigValueWidget(QWidget * parent): QWidget(parent), lay(QBoxLayout::Down, this) {
|
||||
lay.setContentsMargins(0, 0, 0, 0);
|
||||
w_integer.setRange(INT_MIN, INT_MAX);
|
||||
w_float.setRange(-DBL_MAX, DBL_MAX);
|
||||
w_float.setDecimals(5);
|
||||
active = true;
|
||||
lay.addWidget(&w_string);
|
||||
lay.addWidget(&w_list);
|
||||
lay.addWidget(&w_bool);
|
||||
lay.addWidget(&w_integer);
|
||||
lay.addWidget(&w_float);
|
||||
lay.addWidget(&w_color);
|
||||
lay.addWidget(&w_rect);
|
||||
lay.addWidget(&w_point);
|
||||
lay.addWidget(&w_ip);
|
||||
lay.addWidget(&w_enum);
|
||||
lay.addWidget(&w_path);
|
||||
connect(&w_string, SIGNAL(textChanged(QString)), this, SLOT(valueChanged()));
|
||||
connect(&w_list, SIGNAL(valueChanged()), this, SLOT(valueChanged()));
|
||||
connect(&w_bool, SIGNAL(toggled(bool)), this, SLOT(valueChanged()));
|
||||
connect(&w_integer, SIGNAL(valueChanged(int)), this, SLOT(valueChanged()));
|
||||
connect(&w_float, SIGNAL(valueChanged(double)), this, SLOT(valueChanged()));
|
||||
connect(&w_color, SIGNAL(colorChanged(QColor)), this, SLOT(valueChanged()));
|
||||
connect(&w_rect, SIGNAL(valueChanged(QRectF)), this, SLOT(valueChanged()));
|
||||
connect(&w_point, SIGNAL(valueChanged(QPointF)), this, SLOT(valueChanged()));
|
||||
connect(&w_ip, SIGNAL(valueChanged(QString)), this, SLOT(valueChanged()));
|
||||
connect(&w_enum, SIGNAL(currentIndexChanged(int)), this, SLOT(valueChanged()));
|
||||
connect(&w_path, SIGNAL(valueChanged()), this, SLOT(valueChanged()));
|
||||
}
|
||||
|
||||
|
||||
void ConfigValueWidget::setType(const QString & t) {
|
||||
hideAll();
|
||||
type = t.left(1);
|
||||
active = false;
|
||||
if (type == "e") {QStringList en_sl = QPIEvaluator::inBrackets(comment).split(';');
|
||||
if (en_sl.size()>1) {
|
||||
w_enum.show(); w_enum.addItems(en_sl); setValue(value); active = true; return;
|
||||
} else {type = "s";}}
|
||||
if (type == "s") {w_string.show(); setValue(value); active = true; return;}
|
||||
if (type == "l") {w_list.show(); setValue(value); active = true; return;}
|
||||
if (type == "b") {w_bool.show(); setValue(value); active = true; return;}
|
||||
if (type == "n") {w_integer.show(); setValue(value); active = true; return;}
|
||||
if (type == "f") {w_float.show(); setValue(value); active = true; return;}
|
||||
if (type == "c") {w_color.show(); setValue(value); active = true; return;}
|
||||
if (type == "r") {w_rect.show(); w_rect.setDecimals(0); setValue(value); active = true; return;}
|
||||
if (type == "a") {w_rect.show(); w_rect.setDecimals(3); setValue(value); active = true; return;}
|
||||
if (type == "p") {w_point.show(); w_point.setDecimals(0); setValue(value); active = true; return;}
|
||||
if (type == "v") {w_point.show(); w_point.setDecimals(3); setValue(value); active = true; return;}
|
||||
if (type == "i") {w_ip.show(); setValue(value); active = true; return;}
|
||||
if (type == "F") {w_path.show(); setValue(value); active = true; return;}
|
||||
if (type == "D") {w_path.show(); setValue(value); active = true; return;}
|
||||
}
|
||||
|
||||
|
||||
void ConfigValueWidget::setValue(const QString & v) {
|
||||
value = v;
|
||||
active = false;
|
||||
if (type == "l") {w_list.setValue(v.split("%|%")); active = true; return;}
|
||||
if (type == "b") {w_bool.setChecked(v.toInt() > 0 || v.toLower().trimmed() == "true"); active = true; return;}
|
||||
if (type == "n") {w_integer.setValue(QString2int(v)); active = true; return;}
|
||||
if (type == "f") {w_float.setValue(v.toDouble()); active = true; return;}
|
||||
if (type == "c") {w_color.setColor(QString2QColor(v)); active = true; return;}
|
||||
if (type == "r") {w_rect.setValue(QString2QRectF(v)); active = true; return;}
|
||||
if (type == "a") {w_rect.setValue(QString2QRectF(v)); active = true; return;}
|
||||
if (type == "p") {w_point.setValue(QString2QPointF(v)); active = true; return;}
|
||||
if (type == "v") {w_point.setValue(QString2QPointF(v)); active = true; return;}
|
||||
if (type == "i") {w_ip.setIP(v); active = true; return;}
|
||||
if (type == "e") {w_enum.setCurrentIndex(w_enum.findText(v)); active = true; return;}
|
||||
if (type == "F") {w_path.is_dir = false; w_path.setValue(v); active = true; return;}
|
||||
if (type == "D") {w_path.is_dir = true; w_path.setValue(v); active = true; return;}
|
||||
w_string.setText(v);
|
||||
active = true;
|
||||
}
|
||||
|
||||
|
||||
void ConfigValueWidget::valueChanged() {
|
||||
if (!active) return;
|
||||
if (type == "l") {value = w_list.value().join("%|%"); emit changed(this, value); return;}
|
||||
if (type == "b") {value = w_bool.isChecked() ? "true" : "false"; emit changed(this, value); return;}
|
||||
if (type == "n") {value = QString::number(w_integer.value()); emit changed(this, value); return;}
|
||||
if (type == "f") {value = QString::number(w_float.value()); emit changed(this, value); return;}
|
||||
if (type == "c") {value = QColor2QString(w_color.color()); emit changed(this, value); return;}
|
||||
if (type == "r") {value = QRectF2QString(w_rect.value()); emit changed(this, value); return;}
|
||||
if (type == "a") {value = QRectF2QString(w_rect.value()); emit changed(this, value); return;}
|
||||
if (type == "p") {value = QPointF2QString(w_point.value()); emit changed(this, value); return;}
|
||||
if (type == "v") {value = QPointF2QString(w_point.value()); emit changed(this, value); return;}
|
||||
if (type == "i") {value = w_ip.IP(); emit changed(this, value); return;}
|
||||
if (type == "e") {value = w_enum.currentText(); emit changed(this, value); return;}
|
||||
if (type == "F") {value = w_path.value(); emit changed(this, value); return;}
|
||||
if (type == "D") {value = w_path.value(); emit changed(this, value); return;}
|
||||
value = w_string.text();
|
||||
emit changed(this, value);
|
||||
}
|
||||
58
qad_widgets/qpiconfigvaluewidget.h
Normal file
58
qad_widgets/qpiconfigvaluewidget.h
Normal file
@@ -0,0 +1,58 @@
|
||||
#ifndef QPICONFIGVALUEWIDGET_H
|
||||
#define QPICONFIGVALUEWIDGET_H
|
||||
|
||||
#include "qpiconfig.h"
|
||||
#include "qvariantedit.h"
|
||||
#include "qrectedit.h"
|
||||
#include "qpointedit.h"
|
||||
#include "colorbutton.h"
|
||||
#include "ecombobox.h"
|
||||
#include "qipedit.h"
|
||||
#include "limits.h"
|
||||
#include "float.h"
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include <QSpinBox>
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
|
||||
class ConfigValueWidget: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class QPIConfigWidget;
|
||||
friend class QPIConfigNewDialog;
|
||||
public:
|
||||
ConfigValueWidget(QWidget * parent = 0);
|
||||
~ConfigValueWidget() {hide();}
|
||||
|
||||
void setType(const QString & t);
|
||||
void setValue(const QString & v);
|
||||
void setEntry(QPIConfig::Entry * e) {value = e->value(); full_name = e->_full_name; comment = e->comment(); setType(e->type());}
|
||||
|
||||
private:
|
||||
void hideAll() {w_string.hide(); w_list.hide(); w_bool.hide(); w_integer.hide(); w_float.hide(); w_color.hide(); w_rect.hide(); w_point.hide(); w_ip.hide(); w_enum.hide(); w_path.hide();}
|
||||
|
||||
QString type, value, full_name, comment;
|
||||
bool active;
|
||||
QBoxLayout lay;
|
||||
CLineEdit w_string;
|
||||
StringListEdit w_list;
|
||||
ColorButton w_color;
|
||||
QCheckBox w_bool;
|
||||
QSpinBox w_integer;
|
||||
QDoubleSpinBox w_float;
|
||||
QRectEdit w_rect;
|
||||
QPointEdit w_point;
|
||||
QIPEdit w_ip;
|
||||
QComboBox w_enum;
|
||||
PathEdit w_path;
|
||||
|
||||
private slots:
|
||||
void valueChanged();
|
||||
|
||||
signals:
|
||||
void changed(ConfigValueWidget * , QString );
|
||||
|
||||
};
|
||||
|
||||
#endif // QPICONFIGVALUEWIDGET_H
|
||||
380
qad_widgets/qpiconfigwidget.cpp
Normal file
380
qad_widgets/qpiconfigwidget.cpp
Normal file
@@ -0,0 +1,380 @@
|
||||
#include "qpiconfigwidget.h"
|
||||
|
||||
|
||||
QPIConfigWidget::QPIConfigWidget(QWidget * parent, QPIConfig * c, bool on): QTreeWidget(parent), actionAddItem(this), actionAddNode(this),
|
||||
actionToItem(this), actionToNode(this), actionRemove(this),
|
||||
actionExpandAll(this), actionCollapseAll(this) {
|
||||
active = on;
|
||||
if (active) {
|
||||
setColumnCount(4);
|
||||
setColumnWidth(0, 150);
|
||||
setColumnWidth(1, 200);
|
||||
} else setColumnCount(0);
|
||||
setSelectionMode(ExtendedSelection);
|
||||
setVerticalScrollMode(ScrollPerPixel);
|
||||
actionAddItem.setIcon(QIcon(":/icons/item-add.png"));
|
||||
actionAddNode.setIcon(QIcon(":/icons/node-add.png"));
|
||||
actionToItem.setIcon(QIcon(":/icons/item.png"));
|
||||
actionToNode.setIcon(QIcon(":/icons/node.png"));
|
||||
actionRemove.setIcon(QIcon(":/icons/edit-delete.png"));
|
||||
popupMenu.addAction(&actionAddItem);
|
||||
popupMenu.addAction(&actionAddNode);
|
||||
popupMenu.addSeparator();
|
||||
/*popupMenu.addAction(&actionToItem);
|
||||
popupMenu.addAction(&actionToNode);
|
||||
popupMenu.addSeparator();*/
|
||||
popupMenu.addAction(&actionRemove);
|
||||
popupMenu.addSeparator();
|
||||
popupMenu.addAction(&actionExpandAll);
|
||||
popupMenu.addAction(&actionCollapseAll);
|
||||
viewport()->installEventFilter(this);
|
||||
connect(this, SIGNAL(itemClicked(QTreeWidgetItem * , int)), this, SLOT(itemClicked(QTreeWidgetItem * , int)));
|
||||
connect(this, SIGNAL(itemChanged(QTreeWidgetItem * , int)), this, SLOT(itemChanged(QTreeWidgetItem * , int)));
|
||||
connect(&actionAddItem, SIGNAL(triggered()), this, SLOT(on_actionAddItem_triggered()));
|
||||
connect(&actionAddNode, SIGNAL(triggered()), this, SLOT(on_actionAddNode_triggered()));
|
||||
connect(&actionRemove, SIGNAL(triggered()), this, SLOT(on_actionRemove_triggered()));
|
||||
connect(&actionExpandAll, SIGNAL(triggered()), this, SLOT(expandAll()));
|
||||
connect(&actionCollapseAll, SIGNAL(triggered()), this, SLOT(collapseAll()));
|
||||
read_only_name = read_only_value = read_only_type = read_only_comment = false;
|
||||
c_hidden << false << false << false << false;
|
||||
pi = c_pi = 0;
|
||||
translate();
|
||||
setQPIConfig(c);
|
||||
//resize(600, 400);
|
||||
//show();
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::changeEvent(QEvent * e) {
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
translate();
|
||||
return;
|
||||
}
|
||||
//for (int i = 0; i < 4; ++i)
|
||||
// setColumnHidden(i, c_hidden[i]);
|
||||
QTreeWidget::changeEvent(e);
|
||||
}
|
||||
|
||||
|
||||
bool QPIConfigWidget::eventFilter(QObject * o, QEvent * e) {
|
||||
if (e->type() == QEvent::MouseButtonPress) {
|
||||
if (viewport() == qobject_cast<QWidget * >(o)) {
|
||||
pi = itemAt(((QMouseEvent * )e)->pos());
|
||||
if (((QMouseEvent * )e)->buttons() == Qt::RightButton) {
|
||||
qApp->processEvents();
|
||||
itemClicked(pi, 1);
|
||||
popupMenu.popup(((QMouseEvent * )e)->globalPos());
|
||||
}
|
||||
}
|
||||
}
|
||||
return QTreeWidget::eventFilter(o, e);
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::itemClicked(QTreeWidgetItem * item, int column) {
|
||||
if (item != 0) {
|
||||
if ((column == 0 && !read_only_name) || (column == 3 && !read_only_comment)) item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
||||
else item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
}
|
||||
bool node = true, ro = read_only_name || read_only_type || read_only_value;
|
||||
if (item != 0)
|
||||
if (itemTWidget(item) != 0)
|
||||
if (itemTWidget(item)->isEnabled())
|
||||
node = false;
|
||||
actionAddItem.setVisible(node && !ro);
|
||||
actionAddNode.setVisible(node && !ro);
|
||||
actionRemove.setVisible(!ro && !selectedItems().isEmpty());
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::itemChanged(QTreeWidgetItem * item, int column) {
|
||||
if (item != c_pi) {
|
||||
c_pi = item;
|
||||
if (item != 0) {
|
||||
c_name = item->text(0);
|
||||
c_comment = item->text(3);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (item == 0) return;
|
||||
if (c_name == item->text(0) && c_comment == item->text(3)) return;
|
||||
//qDebug() << "change" << item->text(0);
|
||||
QPIConfig::Entry * e = itemEntry(item);
|
||||
if (e == 0) return;
|
||||
if (column == 0) {
|
||||
buildFullNames(item);
|
||||
e->setName(item->text(column));
|
||||
conf->buildFullNames(e->parent());
|
||||
//qDebug() << itemCWidget(item)->full_name;
|
||||
}
|
||||
if (column == 3) e->setComment(item->text(column));
|
||||
c_name = item->text(0);
|
||||
c_comment = item->text(3);
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::typeChange(int t, UComboBox * c) {
|
||||
ConfigValueWidget * cw = (ConfigValueWidget * )c->property("qpic_widget").toLongLong();
|
||||
cw->setType(types.key(s_types[t]));
|
||||
conf->getValue(cw->full_name).setType(types.key(s_types[t]));
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::valueChange(ConfigValueWidget * w, QString v) {
|
||||
conf->getValue(w->full_name).setValue(v);
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::on_actionAddItem_triggered() {
|
||||
if (conf == 0 || !active) return;
|
||||
QString fp;
|
||||
if (pi == 0) pi = invisibleRootItem();
|
||||
else fp = itemCWidget(pi)->full_name + conf->delim;
|
||||
new_dialog.reset();
|
||||
if (new_dialog.exec() == QDialog::Rejected) return;
|
||||
QPIConfig::Entry * e;
|
||||
if (pi->childCount() == 0) {
|
||||
//qDebug() << "pi empty, remove " << itemCWidget(pi)->full_name;
|
||||
conf->removeEntry(itemCWidget(pi)->full_name, false);
|
||||
}
|
||||
//qDebug() << "add " << fp + new_dialog.name();
|
||||
e = &(conf->addEntry(fp + new_dialog.name(), new_dialog.value().isEmpty() ? "0" : new_dialog.value(), new_dialog.type(), false));
|
||||
expandItem(pi);
|
||||
pi = addEntry(pi, e);
|
||||
pi->setText(0, new_dialog.name());
|
||||
pi->setText(3, new_dialog.comment());
|
||||
int ind = s_types.indexOf(types[new_dialog.type()]);
|
||||
if (ind < 0) w_types.back()->setCurrentIndex(0);
|
||||
else w_types.back()->setCurrentIndex(ind);
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::on_actionAddNode_triggered() {
|
||||
if (conf == 0 || !active) return;
|
||||
QString fp;
|
||||
if (pi == 0) pi = invisibleRootItem();
|
||||
else fp = itemCWidget(pi)->full_name + conf->delim;
|
||||
new_dialog.reset(true);
|
||||
if (new_dialog.exec() == QDialog::Rejected) return;
|
||||
QPIConfig::Entry e;
|
||||
//e = &(conf->addEntry(fp + new_dialog.name(), "", "", false));
|
||||
e._full_name = fp + new_dialog.name();
|
||||
expandItem(pi);
|
||||
pi = addEntry(pi, &e, true);
|
||||
pi->setText(0, new_dialog.name());
|
||||
pi->setText(3, new_dialog.comment());
|
||||
setItemWidget(pi, 2, 0);
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::on_actionRemove_triggered() {
|
||||
//hide();
|
||||
if (conf == 0 || !active) return;
|
||||
QList<QTreeWidgetItem * > si = selectedItems();
|
||||
conf->buildFullNames(&(conf->root));
|
||||
QPIConfig::Entry * e;
|
||||
foreach (QTreeWidgetItem * i, si) {
|
||||
e = itemEntry(i);
|
||||
if (e == 0) continue;
|
||||
//qDebug() << "remove " + e->_full_name;
|
||||
conf->removeEntry(e->_full_name, false);
|
||||
deleteEntry(i);
|
||||
}
|
||||
emit changed();
|
||||
//show();
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::clear() {
|
||||
if (!active) return;
|
||||
bool hidden = isHidden();
|
||||
hide();
|
||||
QTreeWidget::clear();
|
||||
foreach (ConfigValueWidget * i, w_values)
|
||||
delete i;
|
||||
foreach (QComboBox * i, w_types)
|
||||
delete i;
|
||||
w_values.clear();
|
||||
w_types.clear();
|
||||
if (!hidden) show();
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::buildTree() {
|
||||
if (!active) return;
|
||||
if (conf == 0) return;
|
||||
bool hidden = isHidden();
|
||||
hide();
|
||||
clear();
|
||||
conf->buildFullNames(&(conf->root));
|
||||
buildEntry(invisibleRootItem(), &conf->rootEntry());
|
||||
if (!hidden) show();
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::setReadOnlyValue(bool yes) {
|
||||
read_only_value = yes;
|
||||
foreach (ConfigValueWidget * i, w_values)
|
||||
i->setEnabled(!yes);
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::setReadOnlyType(bool yes) {
|
||||
read_only_type = yes;
|
||||
foreach (QComboBox * i, w_types) {
|
||||
i->setEnabled(!yes);
|
||||
i->setFrame(!yes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::buildEntry(QTreeWidgetItem * i, QPIConfig::Entry * e) {
|
||||
foreach (QPIConfig::Entry * j, e->children())
|
||||
buildEntry(addEntry(i, j, !j->isLeaf()), j);
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::buildFullNames(QTreeWidgetItem * i) {
|
||||
ConfigValueWidget * cw, * pw;
|
||||
cw = itemCWidget(i);
|
||||
if (i->parent() != 0) {
|
||||
pw = itemCWidget(i->parent());
|
||||
cw->full_name = pw->full_name + conf->delim + i->text(0);
|
||||
} else cw->full_name = i->text(0);
|
||||
for (int j = 0; j < i->childCount(); ++j)
|
||||
buildFullNames(i->child(j));
|
||||
}
|
||||
|
||||
|
||||
QPIConfig::Entry * QPIConfigWidget::itemEntry(QTreeWidgetItem * i) {
|
||||
ConfigValueWidget * cfw = itemCWidget(i);
|
||||
if (cfw == 0) return 0;
|
||||
return &(conf->getValue(cfw->full_name));
|
||||
}
|
||||
|
||||
|
||||
QTreeWidgetItem * QPIConfigWidget::addEntry(QTreeWidgetItem * i, QPIConfig::Entry * e, bool node) {
|
||||
if (conf == 0) return 0;
|
||||
ti = new QTreeWidgetItem();
|
||||
ti->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
ti->setSizeHint(0, QSize(26, 26));
|
||||
ti->setText(0, e->name());
|
||||
ti->setText(3, e->comment());
|
||||
w_values.push_back(new ConfigValueWidget);
|
||||
w_values.back()->setEntry(e);
|
||||
w_values.back()->setEnabled(!read_only_value);
|
||||
if (!node) {
|
||||
w_types.push_back(new UComboBox());
|
||||
w_types.back()->addItems(s_types);
|
||||
w_types.back()->setCurrentIndex(s_types.indexOf(types[e->type().leftJustified(1).left(1)]));
|
||||
w_types.back()->setProperty("qpic_widget", QVariant((qlonglong)w_values.back()));
|
||||
w_types.back()->setEnabled(!read_only_type);
|
||||
w_types.back()->setFrame(!read_only_type);
|
||||
connect(w_types.back(), SIGNAL(currentIndexChanged(int, UComboBox * )), this, SLOT(typeChange(int,UComboBox * )));
|
||||
}
|
||||
connect(w_values.back(), SIGNAL(changed(ConfigValueWidget * , QString)), this, SLOT(valueChange(ConfigValueWidget * , QString)));
|
||||
i->addChild(ti);
|
||||
setItemWidget(ti, 1, w_values.back());
|
||||
if (!node) {
|
||||
setItemWidget(ti, 2, w_types.back());
|
||||
if (itemTWidget(i) != 0) { //itemTWidget(i)->setEnabled(false);
|
||||
w_types.remove(w_types.indexOf(itemTWidget(i)));
|
||||
setItemWidget(i, 2, 0);
|
||||
}
|
||||
}
|
||||
return ti;
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::deleteEntry(QTreeWidgetItem * i) {
|
||||
ConfigValueWidget * vw;
|
||||
UComboBox * cb;
|
||||
int cc = i->childCount();
|
||||
for (int j = 0; j < cc; ++j)
|
||||
deleteEntry(i->child(0));
|
||||
vw = qobject_cast<ConfigValueWidget * >(itemWidget(i, 1));
|
||||
cb = qobject_cast<UComboBox * >(itemWidget(i, 2));
|
||||
if (vw != 0) {
|
||||
w_values.remove(w_values.indexOf(vw));
|
||||
delete vw;
|
||||
}
|
||||
if (cb != 0) {
|
||||
w_types.remove(w_types.indexOf(cb));
|
||||
delete cb;
|
||||
}
|
||||
delete i;
|
||||
}
|
||||
|
||||
|
||||
bool QPIConfigWidget::filter(const QString & f, QTreeWidgetItem * i) {
|
||||
if (i->childCount() == 0) return filterItem(f, i);
|
||||
bool found = false;
|
||||
for (int j = 0; j < i->childCount(); ++j)
|
||||
if (filter(f, i->child(j))) found = true;
|
||||
i->setHidden(!found);
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
bool QPIConfigWidget::filterItem(const QString & f, QTreeWidgetItem * i) {
|
||||
if (f.isEmpty()) {
|
||||
i->setHidden(false);
|
||||
return true;
|
||||
}
|
||||
bool ret = (!isColumnHidden(0) && i->text(0).indexOf(f, 0, Qt::CaseInsensitive) >= 0) ||
|
||||
(!isColumnHidden(1) && itemCWidget(i)->value.indexOf(f, 0, Qt::CaseInsensitive) >= 0) ||
|
||||
(!isColumnHidden(3) && i->text(3).indexOf(f, 0, Qt::CaseInsensitive) >= 0);
|
||||
if (itemTWidget(i) != 0)
|
||||
ret = ret || (!isColumnHidden(2) && itemTWidget(i)->currentText().indexOf(f, 0, Qt::CaseInsensitive) >= 0);
|
||||
i->setHidden(!ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::translate() {
|
||||
QStringList l;
|
||||
l << tr("Name") << tr("Value") << tr("Type") << tr("Comment");
|
||||
if (active) setHeaderLabels(l);
|
||||
types.clear();
|
||||
s_types.clear();
|
||||
addTrEntry("s", tr("string"));
|
||||
addTrEntry("l", tr("string list"));
|
||||
addTrEntry("n", tr("integer"));
|
||||
addTrEntry("f", tr("float"));
|
||||
addTrEntry("b", tr("boolean"));
|
||||
addTrEntry("c", tr("color"));
|
||||
addTrEntry("r", tr("rectangle"));
|
||||
addTrEntry("a", tr("area"));
|
||||
addTrEntry("p", tr("point"));
|
||||
addTrEntry("v", tr("vector"));
|
||||
addTrEntry("i", tr("ip"));
|
||||
actionAddItem.setText(tr("Add item ..."));
|
||||
actionAddNode.setText(tr("Add node ..."));
|
||||
actionToItem.setText(tr("Convert to item"));
|
||||
actionToNode.setText(tr("Convert to node"));
|
||||
actionRemove.setText(tr("Remove"));
|
||||
actionExpandAll.setText(tr("Expand all"));
|
||||
actionCollapseAll.setText(tr("Collapse all"));
|
||||
if (!active) return;
|
||||
for (int i = 0; i < 4; ++i)
|
||||
setColumnHidden(i, c_hidden[i]);
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigWidget::writeToString() {
|
||||
if (conf == 0) return QString();
|
||||
conf->buildFullNames(&(conf->root));
|
||||
return conf->writeAllToString();
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigWidget::readFromString(QString str) {
|
||||
if (conf == 0) return;
|
||||
conf->readAllFromString(str);
|
||||
buildTree();
|
||||
}
|
||||
111
qad_widgets/qpiconfigwidget.h
Normal file
111
qad_widgets/qpiconfigwidget.h
Normal file
@@ -0,0 +1,111 @@
|
||||
#ifndef QPICONFIGWIDGET_H
|
||||
#define QPICONFIGWIDGET_H
|
||||
|
||||
#include "qpiconfig.h"
|
||||
#include "qpiconfignewdialog.h"
|
||||
#include "qpiconfigvaluewidget.h"
|
||||
#include <QTreeWidget>
|
||||
#include <QComboBox>
|
||||
#include <QEvent>
|
||||
#include <QBoxLayout>
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
|
||||
|
||||
class UComboBox: public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
UComboBox(QWidget * parent = 0): QComboBox(parent) {connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(indexChange(int)));}
|
||||
private slots:
|
||||
void indexChange(int i) {emit currentIndexChanged(i, this);}
|
||||
signals:
|
||||
void currentIndexChanged(int, UComboBox * );
|
||||
};
|
||||
|
||||
|
||||
class QPIConfigWidget: public QTreeWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool readOnlyName READ readOnlyName WRITE setReadOnlyName)
|
||||
Q_PROPERTY(bool readOnlyValue READ readOnlyValue WRITE setReadOnlyValue)
|
||||
Q_PROPERTY(bool readOnlyType READ readOnlyType WRITE setReadOnlyType)
|
||||
Q_PROPERTY(bool readOnlyComment READ readOnlyComment WRITE setReadOnlyComment)
|
||||
Q_PROPERTY(bool columnNameVisible READ columnNameVisible WRITE setColumnNameVisible)
|
||||
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 = 0, QPIConfig * c = 0, bool on = true);
|
||||
~QPIConfigWidget() {clear();}
|
||||
|
||||
void setQPIConfig(QPIConfig * c) {conf = c; buildTree();}
|
||||
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);
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent * e);
|
||||
bool eventFilter(QObject * o, QEvent * e);
|
||||
void buildEntry(QTreeWidgetItem * i, QPIConfig::Entry * e);
|
||||
void buildFullNames(QTreeWidgetItem * i);
|
||||
QPIConfig::Entry * itemEntry(QTreeWidgetItem * i);
|
||||
ConfigValueWidget * itemCWidget(QTreeWidgetItem * i) {return qobject_cast<ConfigValueWidget * >(itemWidget(i, 1));}
|
||||
UComboBox * itemTWidget(QTreeWidgetItem * i) {return qobject_cast<UComboBox * >(itemWidget(i, 2));}
|
||||
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) {types.insert(s, f); s_types << 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;
|
||||
QHash<QString, QString> types;
|
||||
QStringList s_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;
|
||||
|
||||
public slots:
|
||||
void parse() {if (conf == 0) clear(); else conf->readAll();}
|
||||
void write() {if (conf == 0) return; conf->buildFullNames(&(conf->root)); conf->writeAll();}
|
||||
void clear();
|
||||
void buildTree();
|
||||
void filter(const QString & f) {if (!active) return; filter(f, invisibleRootItem());}
|
||||
void setReadOnlyName(bool yes) {read_only_name = yes;}
|
||||
void setReadOnlyValue(bool yes);
|
||||
void setReadOnlyType(bool yes);
|
||||
void setReadOnlyComment(bool yes) {read_only_comment = yes;}
|
||||
void setColumnNameVisible(bool yes) {setColumnHidden(0, !yes); c_hidden[0] = !yes;}
|
||||
void setColumnValueVisible(bool yes) {setColumnHidden(1, !yes); c_hidden[1] = !yes;}
|
||||
void setColumnTypeVisible(bool yes) {setColumnHidden(2, !yes); c_hidden[2] = !yes;}
|
||||
void setColumnCommentVisible(bool yes) {setColumnHidden(3, !yes); c_hidden[3] = !yes;}
|
||||
|
||||
private slots:
|
||||
void itemClicked(QTreeWidgetItem * item, int column);
|
||||
void itemChanged(QTreeWidgetItem * item, int column);
|
||||
void typeChange(int t, UComboBox * c);
|
||||
void valueChange(ConfigValueWidget * w, QString v);
|
||||
void on_actionAddItem_triggered();
|
||||
void on_actionAddNode_triggered();
|
||||
void on_actionRemove_triggered();
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
|
||||
};
|
||||
|
||||
#endif // QPICONFIGWIDGET_H
|
||||
115
qad_widgets/session_manager.cpp
Normal file
115
qad_widgets/session_manager.cpp
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
Peri4 Paint
|
||||
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program 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.
|
||||
|
||||
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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "session_manager.h"
|
||||
|
||||
|
||||
void SessionManager::save() {
|
||||
if (file_.isEmpty()) return;
|
||||
QPIConfig sr(file_);
|
||||
for (int i = 0; i < mwindows.size(); ++i) {
|
||||
sr.setValue(mwindows[i].first + " state", mwindows[i].second->saveState(), false);
|
||||
sr.setValue(mwindows[i].first + " window state", (int)mwindows[i].second->windowState(), false);
|
||||
sr.setValue(mwindows[i].first + " geometry " + QString::number((int)mwindows[i].second->windowState()), mwindows[i].second->saveGeometry(), false);
|
||||
QList<QSplitter * > sp = mwindows[i].second->findChildren<QSplitter * >();
|
||||
foreach (QSplitter * s, sp)
|
||||
sr.setValue(mwindows[i].first + " splitter " + s->objectName(), s->saveState(), false);
|
||||
}
|
||||
for (int i = 0; i < widgets.size(); ++i) {
|
||||
sr.setValue(widgets[i].first + " geometry " + QString::number((int)widgets[i].second->windowState()), widgets[i].second->saveGeometry(), false);
|
||||
sr.setValue(widgets[i].first + " window state", (int)widgets[i].second->windowState(), false);
|
||||
}
|
||||
for (int i = 0; i < checks.size(); ++i)
|
||||
sr.setValue(checks[i].first, checks[i].second->isChecked(), false);
|
||||
for (int i = 0; i < lines.size(); ++i)
|
||||
sr.setValue(lines[i].first, lines[i].second->text(), "s", false);
|
||||
for (int i = 0; i < combos.size(); ++i)
|
||||
sr.setValue(combos[i].first, combos[i].second->currentIndex(), false);
|
||||
for (int i = 0; i < dspins.size(); ++i)
|
||||
sr.setValue(dspins[i].first, dspins[i].second->value(), false);
|
||||
for (int i = 0; i < spins.size(); ++i)
|
||||
sr.setValue(spins[i].first, spins[i].second->value(), false);
|
||||
for (int i = 0; i < spinsliders.size(); ++i)
|
||||
sr.setValue(spinsliders[i].first, spinsliders[i].second->value(), false);
|
||||
for (int i = 0; i < tabs.size(); ++i)
|
||||
sr.setValue(tabs[i].first, tabs[i].second->currentIndex(), false);
|
||||
for (int i = 0; i < actions.size(); ++i)
|
||||
sr.setValue(actions[i].first, actions[i].second->isChecked(), false);
|
||||
for (int i = 0; i < stringlists.size(); ++i)
|
||||
sr.setValue(stringlists[i].first, *stringlists[i].second, false);
|
||||
for (int i = 0; i < strings.size(); ++i)
|
||||
sr.setValue(strings[i].first, *strings[i].second, "s", false);
|
||||
for (int i = 0; i < colors.size(); ++i)
|
||||
sr.setValue(colors[i].first, *colors[i].second, false);
|
||||
for (int i = 0; i < bools.size(); ++i)
|
||||
sr.setValue(bools[i].first, *bools[i].second, false);
|
||||
for (int i = 0; i < ints.size(); ++i)
|
||||
sr.setValue(ints[i].first, *ints[i].second, false);
|
||||
for (int i = 0; i < floats.size(); ++i)
|
||||
sr.setValue(floats[i].first, *floats[i].second, false);
|
||||
sr.writeAll();
|
||||
emit saving(sr);
|
||||
}
|
||||
|
||||
|
||||
void SessionManager::load(bool onlyMainwindow) {
|
||||
if (file_.isEmpty()) return;
|
||||
QPIConfig sr(file_);
|
||||
for (int i = 0; i < mwindows.size(); ++i) {
|
||||
mwindows[i].second->restoreState(sr.getValue(mwindows[i].first + " state", QByteArray()));
|
||||
mwindows[i].second->restoreGeometry(sr.getValue(mwindows[i].first + " geometry " + QString::number((int)mwindows[i].second->windowState()), QByteArray()));
|
||||
mwindows[i].second->setWindowState((Qt::WindowState)(int)sr.getValue(mwindows[i].first + " window state", 0));
|
||||
QList<QSplitter * > sp = mwindows[i].second->findChildren<QSplitter * >();
|
||||
foreach (QSplitter * s, sp)
|
||||
s->restoreState(sr.getValue(mwindows[i].first + " splitter " + s->objectName(), QByteArray()));
|
||||
}
|
||||
for (int i = 0; i < widgets.size(); ++i) {
|
||||
widgets[i].second->restoreGeometry(sr.getValue(widgets[i].first + " geometry " + QString::number((int)widgets[i].second->windowState()), QByteArray()));
|
||||
widgets[i].second->setWindowState((Qt::WindowState)(int)sr.getValue(widgets[i].first + " window state", 0));
|
||||
}
|
||||
if (onlyMainwindow) return;
|
||||
for (int i = 0; i < checks.size(); ++i)
|
||||
checks[i].second->setChecked(sr.getValue(checks[i].first, checks[i].second->isChecked()));
|
||||
for (int i = 0; i < lines.size(); ++i)
|
||||
lines[i].second->setText(sr.getValue(lines[i].first, lines[i].second->text()));
|
||||
for (int i = 0; i < combos.size(); ++i)
|
||||
combos[i].second->setCurrentIndex(sr.getValue(combos[i].first, combos[i].second->currentIndex()));
|
||||
for (int i = 0; i < dspins.size(); ++i)
|
||||
dspins[i].second->setValue(sr.getValue(dspins[i].first, dspins[i].second->value()));
|
||||
for (int i = 0; i < spins.size(); ++i)
|
||||
spins[i].second->setValue(sr.getValue(spins[i].first, spins[i].second->value()));
|
||||
for (int i = 0; i < spinsliders.size(); ++i)
|
||||
spinsliders[i].second->setValue(sr.getValue(spinsliders[i].first, spinsliders[i].second->value()));
|
||||
for (int i = 0; i < tabs.size(); ++i)
|
||||
tabs[i].second->setCurrentIndex(sr.getValue(tabs[i].first, tabs[i].second->currentIndex()));
|
||||
for (int i = 0; i < actions.size(); ++i)
|
||||
actions[i].second->setChecked(sr.getValue(actions[i].first, actions[i].second->isChecked()));
|
||||
for (int i = 0; i < stringlists.size(); ++i)
|
||||
*stringlists[i].second = sr.getValue(stringlists[i].first, *stringlists[i].second);
|
||||
for (int i = 0; i < strings.size(); ++i)
|
||||
*strings[i].second = sr.getValue(strings[i].first, *strings[i].second).stringValue();
|
||||
for (int i = 0; i < colors.size(); ++i)
|
||||
*colors[i].second = sr.getValue(colors[i].first, *colors[i].second);
|
||||
for (int i = 0; i < bools.size(); ++i)
|
||||
*bools[i].second = sr.getValue(bools[i].first, *bools[i].second);
|
||||
for (int i = 0; i < ints.size(); ++i)
|
||||
*ints[i].second = sr.getValue(ints[i].first, *ints[i].second);
|
||||
for (int i = 0; i < floats.size(); ++i)
|
||||
*floats[i].second = sr.getValue(floats[i].first, *floats[i].second);
|
||||
emit loading(sr);
|
||||
}
|
||||
99
qad_widgets/session_manager.h
Normal file
99
qad_widgets/session_manager.h
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
Peri4 Paint
|
||||
Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program 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.
|
||||
|
||||
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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SESSION_MANAGER_H
|
||||
#define SESSION_MANAGER_H
|
||||
|
||||
#include <QPair>
|
||||
#include <QMainWindow>
|
||||
#include <QCheckBox>
|
||||
#include <QLineEdit>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QAction>
|
||||
#include <QComboBox>
|
||||
#include <QTabWidget>
|
||||
#include <QSplitter>
|
||||
#include "spinslider.h"
|
||||
#include "qpiconfig.h"
|
||||
|
||||
class SessionManager: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SessionManager(const QString & file = QString()) {setFile(file);}
|
||||
~SessionManager() {;}
|
||||
|
||||
inline void setFile(const QString & file) {file_ = file;}
|
||||
|
||||
inline void addEntry(QMainWindow * e) {mwindows.push_back(QPair<QString, QMainWindow * >(e->objectName(), e));}
|
||||
inline void addEntry(QCheckBox * e) {checks.push_back(QPair<QString, QCheckBox * >(e->objectName(), e));}
|
||||
inline void addEntry(QLineEdit * e) {lines.push_back(QPair<QString, QLineEdit * >(e->objectName(), e));}
|
||||
inline void addEntry(QComboBox * e) {combos.push_back(QPair<QString, QComboBox * >(e->objectName(), e));}
|
||||
inline void addEntry(QDoubleSpinBox * e) {dspins.push_back(QPair<QString, QDoubleSpinBox * >(e->objectName(), e));}
|
||||
inline void addEntry(QSpinBox * e) {spins.push_back(QPair<QString, QSpinBox * >(e->objectName(), e));}
|
||||
inline void addEntry(SpinSlider * e) {spinsliders.push_back(QPair<QString, SpinSlider * >(e->objectName(), e));}
|
||||
inline void addEntry(QTabWidget * e) {tabs.push_back(QPair<QString, QTabWidget * >(e->objectName(), e));}
|
||||
inline void addEntry(QAction * e) {actions.push_back(QPair<QString, QAction * >(e->objectName(), e));}
|
||||
inline void addMainWidget(QWidget * e) {widgets.push_back(QPair<QString, QWidget * >(e->objectName(), e));}
|
||||
|
||||
inline void addEntry(const QString & name, QMainWindow * e) {mwindows.push_back(QPair<QString, QMainWindow * >(name, e));}
|
||||
inline void addEntry(const QString & name, QCheckBox * e) {checks.push_back(QPair<QString, QCheckBox * >(name, e));}
|
||||
inline void addEntry(const QString & name, QLineEdit * e) {lines.push_back(QPair<QString, QLineEdit * >(name, e));}
|
||||
inline void addEntry(const QString & name, QComboBox * e) {combos.push_back(QPair<QString, QComboBox * >(name, e));}
|
||||
inline void addEntry(const QString & name, QDoubleSpinBox * e) {dspins.push_back(QPair<QString, QDoubleSpinBox * >(name, e));}
|
||||
inline void addEntry(const QString & name, QSpinBox * e) {spins.push_back(QPair<QString, QSpinBox * >(name, e));}
|
||||
inline void addEntry(const QString & name, SpinSlider * e) {spinsliders.push_back(QPair<QString, SpinSlider * >(name, e));}
|
||||
inline void addEntry(const QString & name, QTabWidget * e) {tabs.push_back(QPair<QString, QTabWidget * >(name, e));}
|
||||
inline void addEntry(const QString & name, QAction * e) {actions.push_back(QPair<QString, QAction * >(name, e));}
|
||||
inline void addEntry(const QString & name, QStringList * e) {stringlists.push_back(QPair<QString, QStringList * >(name, e));}
|
||||
inline void addEntry(const QString & name, QString * e) {strings.push_back(QPair<QString, QString * >(name, e));}
|
||||
inline void addEntry(const QString & name, QColor * e) {colors.push_back(QPair<QString, QColor * >(name, e));}
|
||||
inline void addEntry(const QString & name, bool * e) {bools.push_back(QPair<QString, bool * >(name, e));}
|
||||
inline void addEntry(const QString & name, int * e) {ints.push_back(QPair<QString, int * >(name, e));}
|
||||
inline void addEntry(const QString & name, float * e) {floats.push_back(QPair<QString, float * >(name, e));}
|
||||
inline void addMainWidget(const QString & name, QWidget * e) {widgets.push_back(QPair<QString, QWidget * >(name, e));}
|
||||
|
||||
void save();
|
||||
void load(bool onlyMainwindow = false);
|
||||
|
||||
private:
|
||||
QVector<QPair<QString, QMainWindow * > > mwindows;
|
||||
QVector<QPair<QString, QWidget * > > widgets;
|
||||
QVector<QPair<QString, QCheckBox * > > checks;
|
||||
QVector<QPair<QString, QLineEdit * > > lines;
|
||||
QVector<QPair<QString, QComboBox * > > combos;
|
||||
QVector<QPair<QString, QDoubleSpinBox * > > dspins;
|
||||
QVector<QPair<QString, QSpinBox * > > spins;
|
||||
QVector<QPair<QString, SpinSlider * > > spinsliders;
|
||||
QVector<QPair<QString, QTabWidget * > > tabs;
|
||||
QVector<QPair<QString, QAction * > > actions;
|
||||
QVector<QPair<QString, QStringList * > > stringlists;
|
||||
QVector<QPair<QString, QString * > > strings;
|
||||
QVector<QPair<QString, QColor * > > colors;
|
||||
QVector<QPair<QString, bool * > > bools;
|
||||
QVector<QPair<QString, int * > > ints;
|
||||
QVector<QPair<QString, float * > > floats;
|
||||
QString file_;
|
||||
|
||||
signals:
|
||||
void loading(QPIConfig & );
|
||||
void saving(QPIConfig & );
|
||||
|
||||
};
|
||||
|
||||
#endif // SESSION_MANAGER_H
|
||||
Reference in New Issue
Block a user