git-svn-id: svn://db.shs.com.ru/libs@387 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -3,7 +3,7 @@ find_qt(${QtVersions} Core Gui OpenGL)
|
||||
qt_sources(SRC)
|
||||
qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM)
|
||||
qt_add_executable(${PROJECT_NAME} WIN32 out_CPP)
|
||||
qt_target_link_libraries(${PROJECT_NAME} qad_utils qad_widgets qad_graphic qcd_utils qad_application)
|
||||
qt_target_link_libraries(${PROJECT_NAME} qad_utils qad_widgets qad_graphic qad_application qcd_utils piqt_utils)
|
||||
message(STATUS "Building ${PROJECT_NAME}")
|
||||
if(LIB)
|
||||
if(WIN32)
|
||||
|
||||
@@ -9,14 +9,20 @@
|
||||
#include "qcd_modedialog.h"
|
||||
#include "chunkstream.h"
|
||||
#include "qvariantedit.h"
|
||||
#include "piqt.h"
|
||||
#include "piqt_highlighter.h"
|
||||
#include "qcodeedit.h"
|
||||
#include <QFileDialog>
|
||||
#include <QScrollBar>
|
||||
|
||||
using namespace CDUtils;
|
||||
|
||||
|
||||
CDPultWindow::CDPultWindow(QWidget *parent) : EMainWindow(parent), Ui::CDPultWindow() {
|
||||
setupUi(this);
|
||||
centralWidget()->hide();
|
||||
CDUtils::CDCore::instance()->initPult();
|
||||
CDCore::instance()->initPult();
|
||||
new ConfigHighlighter(codeConfig->document());
|
||||
widgetK->setType(CDUtils::CDType::cdK);
|
||||
widgetX->setType(CDUtils::CDType::cdX);
|
||||
widgetC->setType(CDUtils::CDType::cdC);
|
||||
@@ -51,6 +57,34 @@ void CDPultWindow::loadFile(const QString & fp) {
|
||||
}
|
||||
|
||||
|
||||
void CDPultWindow::apply(bool sessions) {
|
||||
CDCore::instance()->stop();
|
||||
widgetK->setFile(editFileK->value().value<QAD::File>().file);
|
||||
widgetX->setFile(editFileX->value().value<QAD::File>().file);
|
||||
widgetC->setFile(editFileC->value().value<QAD::File>().file);
|
||||
if (checkDefaultConfig->isChecked())
|
||||
CDCore::instance()->initPult();
|
||||
else
|
||||
CDCore::instance()->init(Q2PIString(codeConfig->text()), true);
|
||||
widgetX->view->startX();
|
||||
if (sessions) {
|
||||
widgetGraphics->load(session_gr);
|
||||
if (!session_mw.isEmpty())
|
||||
restoreState(session_mw);
|
||||
X.lock();
|
||||
PIVector<PIDeque<int> > x_list = X.enabledList();
|
||||
X.unlock();
|
||||
piForeachC (PIDeque<int> & p, x_list)
|
||||
X.enable(X[p]);
|
||||
((CDItemModel*)widgetX->view->model())->updateModel();
|
||||
widgetX->view->expandAll();
|
||||
}
|
||||
dockCDKView->setVisible(checkHasK->isChecked());
|
||||
dockCDXView->setVisible(checkHasX->isChecked());
|
||||
dockCDCView->setVisible(checkHasC->isChecked());
|
||||
}
|
||||
|
||||
|
||||
void CDPultWindow::closeEvent(QCloseEvent *e) {
|
||||
EMainWindow::closeEvent(e);
|
||||
if (!e->isAccepted())
|
||||
@@ -80,15 +114,20 @@ bool CDPultWindow::load(const QString & path) {
|
||||
checkHasK->setChecked(conf.getValue("has_k"));
|
||||
checkHasX->setChecked(conf.getValue("has_x"));
|
||||
checkHasC->setChecked(conf.getValue("has_c"));
|
||||
checkDefaultConfig->setChecked(conf.getValue("default_config"));
|
||||
codeConfig->setText(QByteArray2QString(conf.getValue("config", QByteArray())));
|
||||
session_gr = conf.getValue("session_gr", QByteArray());
|
||||
session_mw = conf.getValue("session_mw", QByteArray());
|
||||
setChanged(false);
|
||||
file_name = path;
|
||||
apply(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CDPultWindow::save(const QString & path) {
|
||||
session_gr = widgetGraphics->save();
|
||||
session_mw = saveState();
|
||||
QPIConfig conf(path, QIODevice::ReadWrite);
|
||||
conf.clear();
|
||||
conf.setValue("file_k", editFileK->value().value<QAD::File>().file);
|
||||
@@ -99,7 +138,11 @@ bool CDPultWindow::save(const QString & path) {
|
||||
conf.setValue("has_k", checkHasK->isChecked());
|
||||
conf.setValue("has_x", checkHasX->isChecked());
|
||||
conf.setValue("has_c", checkHasC->isChecked());
|
||||
conf.setValue("has_c", checkHasC->isChecked());
|
||||
conf.setValue("default_config", checkDefaultConfig->isChecked());
|
||||
conf.setValue("config", QString2QByteArray(codeConfig->text()));
|
||||
conf.setValue("session_gr", session_gr);
|
||||
conf.setValue("session_mw", session_mw);
|
||||
file_name = path;
|
||||
return true;
|
||||
|
||||
@@ -160,22 +203,7 @@ void CDPultWindow::on_editFileK_valueChanged(const QVariant & p) {
|
||||
|
||||
|
||||
void CDPultWindow::on_buttonSessionApply_clicked() {
|
||||
// with session or not
|
||||
widgetK->setFile(editFileK->value().value<QAD::File>().file);
|
||||
widgetX->setFile(editFileX->value().value<QAD::File>().file);
|
||||
widgetC->setFile(editFileC->value().value<QAD::File>().file);
|
||||
dockCDKView->setVisible(checkHasK->isChecked());
|
||||
dockCDXView->setVisible(checkHasX->isChecked());
|
||||
dockCDCView->setVisible(checkHasC->isChecked());
|
||||
widgetX->view->startX();
|
||||
widgetGraphics->load(session_gr);
|
||||
X.lock();
|
||||
PIVector<PIDeque<int> > x_list = X.enabledList();
|
||||
X.unlock();
|
||||
piForeachC (PIDeque<int> & p, x_list)
|
||||
X.enable(X[p]);
|
||||
((CDItemModel*)widgetX->view->model())->updateModel();
|
||||
widgetX->view->expandAll();
|
||||
apply(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ public:
|
||||
explicit CDPultWindow(QWidget *parent = 0);
|
||||
~CDPultWindow();
|
||||
void loadFile(const QString & fp);
|
||||
void apply(bool sessions);
|
||||
|
||||
private:
|
||||
|
||||
@@ -31,7 +32,7 @@ private:
|
||||
|
||||
Ribbon * ribbon;
|
||||
QMap<CDViewWidget::LogIcon, QIcon> log_icons;
|
||||
QByteArray session_gr;
|
||||
QByteArray session_gr, session_mw;
|
||||
|
||||
private slots:
|
||||
void addToLog(CDViewWidget::LogIcon icon, const QString & msg);
|
||||
|
||||
@@ -278,20 +278,37 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkDefaultConfig">
|
||||
<property name="text">
|
||||
<string>Default config</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<widget class="QCodeEdit" name="codeConfig">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
<property name="text">
|
||||
<string>include = ip.conf
|
||||
[connection]
|
||||
device.cd = eth://udp:${ip.pult}:27002:${ip.app}:27001 #s
|
||||
[]
|
||||
</string>
|
||||
</property>
|
||||
</spacer>
|
||||
<property name="editorFont">
|
||||
<font>
|
||||
<family>DejaVu Sans Mono</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@@ -445,6 +462,8 @@
|
||||
<addaction name="separator"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="separator"/>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
@@ -458,6 +477,11 @@
|
||||
<extends>QLineEdit</extends>
|
||||
<header>clineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QCodeEdit</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qcodeedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QVariantEdit</class>
|
||||
<extends>QWidget</extends>
|
||||
@@ -618,5 +642,21 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>checkDefaultConfig</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>codeConfig</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>579</x>
|
||||
<y>280</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>581</x>
|
||||
<y>304</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user