git-svn-id: svn://db.shs.com.ru/libs@379 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
17
qcd_utils/pult/cdgraphics.cpp
Normal file
17
qcd_utils/pult/cdgraphics.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "cdgraphics.h"
|
||||
#include "cdutils_core.h"
|
||||
#include "qcd_core.h"
|
||||
#include "qcd_model.h"
|
||||
|
||||
|
||||
CDGraphics::CDGraphics(QWidget * parent) : QWidget(parent), Ui::CDGraphics() {
|
||||
setupUi(this);
|
||||
}
|
||||
|
||||
|
||||
CDGraphics::~CDGraphics() {
|
||||
}
|
||||
|
||||
|
||||
void CDGraphics::reset() {
|
||||
}
|
||||
25
qcd_utils/pult/cdgraphics.h
Normal file
25
qcd_utils/pult/cdgraphics.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef CDGRAPHICS_H
|
||||
#define CDGRAPHICS_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_cdgraphics.h"
|
||||
|
||||
|
||||
class CDGraphics : public QWidget, public Ui::CDGraphics
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CDGraphics(QWidget *parent = 0);
|
||||
~CDGraphics();
|
||||
|
||||
void reset();
|
||||
|
||||
private:
|
||||
|
||||
private slots:
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // CDGRAPHICS_H
|
||||
19
qcd_utils/pult/cdgraphics.ui
Normal file
19
qcd_utils/pult/cdgraphics.ui
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CDGraphics</class>
|
||||
<widget class="QWidget" name="CDGraphics">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>689</width>
|
||||
<height>459</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>CD Pult</string>
|
||||
</property>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -7,5 +7,8 @@
|
||||
<file>icons/dialog-cancel.png</file>
|
||||
<file>icons/dialog-ok-apply.png</file>
|
||||
<file>icons/timer.png</file>
|
||||
</qresource>
|
||||
<file>icons/document-revert.png</file>
|
||||
<file>icons/flame.png</file>
|
||||
<file>icons/view-refresh.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -1,41 +1,43 @@
|
||||
#include <QCloseEvent>
|
||||
#include "edockwidget.h"
|
||||
#include "cdpultwindow.h"
|
||||
#include "ui_cdpultwindow.h"
|
||||
#include "cdutils_k.h"
|
||||
#include "cdutils_core.h"
|
||||
#include "qcd_core.h"
|
||||
#include "qcd_kmodel.h"
|
||||
#include "qcd_model.h"
|
||||
#include "qcd_modedialog.h"
|
||||
#include "chunkstream.h"
|
||||
#include "qvariantedit.h"
|
||||
#include <QFileDialog>
|
||||
#include <QScrollBar>
|
||||
|
||||
|
||||
CDPultWindow::CDPultWindow(QWidget *parent) : EMainWindow(parent), ui(new Ui::CDPultWindow) {
|
||||
CDUtils::CDCore::instance()->initPult();
|
||||
qRegisterMetaType<LogIcon>("LogIcon");
|
||||
log_icons[OKIcon] = QIcon(":/icons/dialog-ok-apply.png");
|
||||
log_icons[FailIcon] = QIcon(":/icons/dialog-cancel.png");
|
||||
log_icons[WaitIcon] = QIcon(":/icons/timer.png");
|
||||
ui->setupUi(this);
|
||||
CDPultWindow::CDPultWindow(QWidget *parent) : EMainWindow(parent), Ui::CDPultWindow() {
|
||||
setupUi(this);
|
||||
centralWidget()->hide();
|
||||
setRecentMenu(ui->menuOpen_recent);
|
||||
CDUtils::CDCore::instance()->initPult();
|
||||
widgetK->setType(CDUtils::CDType::cdK);
|
||||
widgetX->setType(CDUtils::CDType::cdX);
|
||||
editFileK->setValue(QVariant::fromValue(QAD::File("", "*.dat")));
|
||||
editFileX->setValue(QVariant::fromValue(QAD::File("", "*.dat")));
|
||||
editFileC->setValue(QVariant::fromValue(QAD::File("", "*.dat")));
|
||||
log_icons[CDViewWidget::OKIcon] = QIcon(":/icons/dialog-ok-apply.png");
|
||||
log_icons[CDViewWidget::FailIcon] = QIcon(":/icons/dialog-cancel.png");
|
||||
log_icons[CDViewWidget::WaitIcon] = QIcon(":/icons/timer.png");
|
||||
setRecentMenu(menuOpen_recent);
|
||||
ribbon = new Ribbon(this);
|
||||
session.setFile("session_cdpult.conf");
|
||||
session.addEntry(this);
|
||||
session.addEntry(ribbon->tabWidget());
|
||||
session.load();
|
||||
reset();
|
||||
connect(ui->viewK, SIGNAL(KSendSucceed()), this, SLOT(KSended()));
|
||||
connect(ui->viewK, SIGNAL(KReceiveSucceed()), this, SLOT(KReceived()));
|
||||
connect(ui->viewK, SIGNAL(KSendFailed()), this, SLOT(KSendFailed()));
|
||||
connect(ui->viewK, SIGNAL(KReceiveFailed()), this, SLOT(KReceiveFailed()));
|
||||
connect(widgetK, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString)));
|
||||
connect(widgetX, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString)));
|
||||
if (windowState() == Qt::WindowMinimized)
|
||||
setWindowState(Qt::WindowNoState);
|
||||
}
|
||||
|
||||
|
||||
CDPultWindow::~CDPultWindow() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,26 +46,6 @@ void CDPultWindow::loadFile(const QString & fp) {
|
||||
}
|
||||
|
||||
|
||||
void CDPultWindow::KReceived() {
|
||||
addToLog(OKIcon, "K received succesfull");
|
||||
}
|
||||
|
||||
|
||||
void CDPultWindow::KSended() {
|
||||
addToLog(OKIcon, "K sended succesfull");
|
||||
}
|
||||
|
||||
|
||||
void CDPultWindow::KSendFailed() {
|
||||
addToLog(FailIcon, "K NOT sended");
|
||||
}
|
||||
|
||||
|
||||
void CDPultWindow::KReceiveFailed() {
|
||||
addToLog(FailIcon, "K NOT received");
|
||||
}
|
||||
|
||||
|
||||
void CDPultWindow::closeEvent(QCloseEvent *e) {
|
||||
EMainWindow::closeEvent(e);
|
||||
if (!e->isAccepted())
|
||||
@@ -76,29 +58,45 @@ void CDPultWindow::closeEvent(QCloseEvent *e) {
|
||||
|
||||
void CDPultWindow::reset(bool full) {
|
||||
setWindowTitle(QString("CD Pult"));
|
||||
ui->viewK->setKFile("");
|
||||
// ui->viewK->clearK();
|
||||
file_name.clear();
|
||||
ui->viewK->refresh();
|
||||
widgetK->reset();
|
||||
setChanged(false);
|
||||
}
|
||||
|
||||
|
||||
bool CDPultWindow::load(const QString & path) {
|
||||
ui->viewK->setKFile(path);
|
||||
ui->viewK->loadK();
|
||||
QFileInfo fi(path);
|
||||
setWindowTitle(QString("CD Pult - %1").arg(fi.baseName()));
|
||||
QPIConfig conf(path, QIODevice::ReadOnly);
|
||||
QAD::File f = editFileK->value().value<QAD::File>();
|
||||
checkSyncFiles->setChecked(false);
|
||||
editFileK->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_k").value(), f.filter)));
|
||||
editFileX->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_x").value(), f.filter)));
|
||||
editFileC->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_c").value(), f.filter)));
|
||||
checkSyncFiles->setChecked(conf.getValue("sync_files"));
|
||||
lineSessionName->setText(conf.getValue("session_name"));
|
||||
checkHasK->setChecked(conf.getValue("has_k"));
|
||||
checkHasX->setChecked(conf.getValue("has_x"));
|
||||
checkHasC->setChecked(conf.getValue("has_c"));
|
||||
setChanged(false);
|
||||
file_name = path;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CDPultWindow::save(const QString & path) {
|
||||
ui->viewK->setKFile(path);
|
||||
ui->viewK->saveK();
|
||||
QFileInfo fi(path);
|
||||
setWindowTitle(QString("CD Pult - %1").arg(fi.baseName()));
|
||||
QPIConfig conf(path, QIODevice::ReadWrite);
|
||||
conf.clear();
|
||||
conf.setValue("file_k", editFileK->value().value<QAD::File>().file);
|
||||
conf.setValue("file_x", editFileX->value().value<QAD::File>().file);
|
||||
conf.setValue("file_c", editFileC->value().value<QAD::File>().file);
|
||||
conf.setValue("sync_files", checkSyncFiles->isChecked());
|
||||
conf.setValue("session_name", lineSessionName->text());
|
||||
conf.setValue("has_k", checkHasK->isChecked());
|
||||
conf.setValue("has_x", checkHasX->isChecked());
|
||||
conf.setValue("has_c", checkHasC->isChecked());
|
||||
file_name = path;
|
||||
return true;
|
||||
|
||||
//widgetK->setFile(path);
|
||||
//widgetK->save();
|
||||
}
|
||||
|
||||
|
||||
@@ -112,42 +110,56 @@ void CDPultWindow::savingSession(QPIConfig & conf) {
|
||||
}
|
||||
|
||||
|
||||
void CDPultWindow::addToLog(LogIcon icon, const QString & msg) {
|
||||
void CDPultWindow::addToLog(CDViewWidget::LogIcon icon, const QString & msg) {
|
||||
QListWidgetItem * ni = new QListWidgetItem(log_icons[icon], "(" + QTime::currentTime().toString() + ") " + msg);
|
||||
bool s = ui->listLog->verticalScrollBar()->value() == ui->listLog->verticalScrollBar()->maximum();
|
||||
ui->listLog->addItem(ni);
|
||||
if (s) ui->listLog->scrollToBottom();
|
||||
bool s = listLog->verticalScrollBar()->value() == listLog->verticalScrollBar()->maximum();
|
||||
listLog->addItem(ni);
|
||||
if (s) listLog->scrollToBottom();
|
||||
}
|
||||
|
||||
|
||||
void CDPultWindow::on_actionSend_K_triggered() {
|
||||
if (K.inProgress()) {addToLog(WaitIcon, "processing..."); return;}
|
||||
addToLog(WaitIcon, "Sending K...");
|
||||
ui->viewK->sendK();
|
||||
}
|
||||
|
||||
|
||||
void CDPultWindow::on_actionReceive_K_triggered() {
|
||||
if (K.inProgress()) {addToLog(WaitIcon, "processing..."); return;}
|
||||
addToLog(WaitIcon, "Receiving K...");
|
||||
ui->viewK->receiveK();
|
||||
}
|
||||
|
||||
|
||||
void CDPultWindow::on_actionParse_triggered() {
|
||||
QString path = QFileDialog::getOpenFileName(this, "Select header file", "", "K Description(k_description.h);;Headers(*.h)");
|
||||
if (path.isEmpty()) return;
|
||||
CDUtils::UpdateModeFlags mode = CDUtils::SaveByName;
|
||||
if (!K.root().isEmpty()) {
|
||||
QCDModeDialog cdm;
|
||||
if (cdm.exec() != QDialog::Accepted) return;
|
||||
mode = cdm.mode();
|
||||
void CDPultWindow::on_editFileK_valueChanged(const QVariant & p) {
|
||||
if (!checkSyncFiles->isChecked()) return;
|
||||
QFileInfo fi(p.value<QAD::File>().file);
|
||||
if (fi.path().isEmpty()) return;
|
||||
QString n = fi.baseName();
|
||||
QString xn(n), cn(n);
|
||||
if (n.contains("k")) {
|
||||
xn.replace(n.indexOf("k"), 1, "x");
|
||||
cn.replace(n.indexOf("k"), 1, "c");
|
||||
} else {
|
||||
xn += "_x";
|
||||
cn += "_c";
|
||||
}
|
||||
ui->viewK->buildFromHeader(path, mode);
|
||||
QString ext = fi.suffix(), dot, dir;
|
||||
QString kfn(fi.filePath());
|
||||
if (!ext.isEmpty()) {
|
||||
kfn.chop(ext.size());
|
||||
if (kfn.endsWith(".")) {
|
||||
kfn.chop(1);
|
||||
dot = ".";
|
||||
}
|
||||
}
|
||||
if (!fi.path().isEmpty() && fi.path() != ".") {
|
||||
dir = fi.path();
|
||||
if (!dir.endsWith("/"))
|
||||
dir += "/";
|
||||
}
|
||||
QAD::File f = editFileK->value().value<QAD::File>();
|
||||
f.file = dir + xn + dot + ext; editFileX->setValue(QVariant::fromValue(f));
|
||||
f.file = dir + cn + dot + ext; editFileC->setValue(QVariant::fromValue(f));
|
||||
}
|
||||
|
||||
|
||||
void CDPultWindow::on_actionCalculate_K_triggered() {
|
||||
ui->viewK->calculateK();
|
||||
ui->viewK->refresh();
|
||||
void CDPultWindow::on_buttonSessionApply_clicked() {
|
||||
widgetK->setFile(editFileK->value().value<QAD::File>().file);
|
||||
widgetX->setFile(editFileX->value().value<QAD::File>().file);
|
||||
dockCDKView->setVisible(checkHasK->isChecked());
|
||||
dockCDXView->setVisible(checkHasX->isChecked());
|
||||
//dockCDCView->setVisible(checkHasC->isChecked());
|
||||
}
|
||||
|
||||
|
||||
void CDPultWindow::on_lineSessionName_textChanged(const QString & t) {
|
||||
setWindowTitle(QString("CD Pult - %1").arg(t));
|
||||
}
|
||||
|
||||
@@ -2,20 +2,17 @@
|
||||
#define CDPULTWINDOW_H
|
||||
|
||||
#include "emainwindow.h"
|
||||
#include "ui_cdpultwindow.h"
|
||||
#include "cdviewwidget.h"
|
||||
#include "ribbon.h"
|
||||
#include "piobject.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class CDPultWindow;
|
||||
}
|
||||
|
||||
class CDPultWindow : public EMainWindow
|
||||
class CDPultWindow : public EMainWindow, public Ui::CDPultWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_ENUMS(LogIcon)
|
||||
public:
|
||||
enum LogIcon {NoIcon, OKIcon, FailIcon, WaitIcon};
|
||||
|
||||
explicit CDPultWindow(QWidget *parent = 0);
|
||||
~CDPultWindow();
|
||||
@@ -27,26 +24,20 @@ private:
|
||||
void reset(bool full = false);
|
||||
bool load(const QString & path);
|
||||
bool save(const QString & path);
|
||||
QString loadFilter() {return "CD file(*.dat)";}
|
||||
QString saveFilter() {return "CD file(*.dat)";}
|
||||
QString loadFilter() {return "Pult session(*.conf)";}
|
||||
QString saveFilter() {return loadFilter();}
|
||||
void loadingSession(QPIConfig & conf);
|
||||
void savingSession(QPIConfig & conf);
|
||||
|
||||
Ui::CDPultWindow *ui;
|
||||
Ribbon * ribbon;
|
||||
QMap<LogIcon, QIcon> log_icons;
|
||||
QMap<CDViewWidget::LogIcon, QIcon> log_icons;
|
||||
|
||||
private slots:
|
||||
void KSended();
|
||||
void KReceived();
|
||||
void KSendFailed();
|
||||
void KReceiveFailed();
|
||||
void addToLog(LogIcon icon, const QString & msg);
|
||||
void on_actionSend_K_triggered();
|
||||
void on_actionReceive_K_triggered();
|
||||
void on_actionParse_triggered();
|
||||
void on_actionCalculate_K_triggered();
|
||||
void addToLog(CDViewWidget::LogIcon icon, const QString & msg);
|
||||
void on_editFileK_valueChanged(const QVariant & p);
|
||||
void on_buttonSessionApply_clicked();
|
||||
|
||||
void on_lineSessionName_textChanged(const QString & t);
|
||||
};
|
||||
|
||||
#endif // CDPULTWINDOW_H
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
<width>798</width>
|
||||
<height>593</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -19,22 +19,14 @@
|
||||
<property name="dockOptions">
|
||||
<set>QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks|QMainWindow::VerticalTabs</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="central">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3"/>
|
||||
</widget>
|
||||
<widget class="QWidget" name="central"/>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>21</height>
|
||||
<width>798</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuMain">
|
||||
@@ -79,20 +71,8 @@
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="CDKView" name="viewK"/>
|
||||
<widget class="CDViewWidget" name="widgetK" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@@ -106,7 +86,7 @@
|
||||
<string>Log</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>4</number>
|
||||
<number>8</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContents_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@@ -153,6 +133,184 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="EDockWidget" name="dockCDXView">
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../../qad/widgets/qad_widgets.qrc">
|
||||
<normaloff>:/icons/qvariantedit.png</normaloff>:/icons/qvariantedit.png</iconset>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>X</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>1</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContents_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="CDViewWidget" name="widgetX" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="EDockWidget" name="dockSession">
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../../qad/application/qad_application.qrc">
|
||||
<normaloff>:/icons/configure.png</normaloff>:/icons/configure.png</iconset>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Session</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>2</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContents_4">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonSessionLoad">
|
||||
<property name="text">
|
||||
<string>Load ...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qad/application/qad_application.qrc">
|
||||
<normaloff>:/icons/document-open-recent.png</normaloff>:/icons/document-open-recent.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonSessionSave">
|
||||
<property name="text">
|
||||
<string>Save ...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qad/application/qad_application.qrc">
|
||||
<normaloff>:/icons/document-save.png</normaloff>:/icons/document-save.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonSessionSaveAs">
|
||||
<property name="text">
|
||||
<string>Save as ...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qad/application/qad_application.qrc">
|
||||
<normaloff>:/icons/document-save-as.png</normaloff>:/icons/document-save-as.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonSessionApply">
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qad/widgets/qad_widgets.qrc">
|
||||
<normaloff>:/icons/dialog-ok-apply.png</normaloff>:/icons/dialog-ok-apply.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="CLineEdit" name="lineSessionName"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>K file:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QVariantEdit" name="editFileK"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>X file:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QVariantEdit" name="editFileX"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>C file:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QVariantEdit" name="editFileC"/>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkSyncFiles">
|
||||
<property name="text">
|
||||
<string>Sync files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkHasK">
|
||||
<property name="text">
|
||||
<string>K</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkHasX">
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkHasC">
|
||||
<property name="text">
|
||||
<string>C</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<action name="actionOpen">
|
||||
<property name="icon">
|
||||
<iconset resource="../../qad/application/qad_application.qrc">
|
||||
@@ -167,7 +325,7 @@
|
||||
</action>
|
||||
<action name="actionSave">
|
||||
<property name="icon">
|
||||
<iconset resource="../../qad/utils/qad_utils.qrc">
|
||||
<iconset resource="../../qad/application/qad_application.qrc">
|
||||
<normaloff>:/icons/document-save.png</normaloff>:/icons/document-save.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -245,10 +403,7 @@
|
||||
<addaction name="actionParse"/>
|
||||
<addaction name="actionCalculate_K"/>
|
||||
<addaction name="menuMain"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="menuOpen_recent"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="separator"/>
|
||||
@@ -271,6 +426,16 @@
|
||||
<header>emainwindow.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>CLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>clineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QVariantEdit</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qvariantedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>EDockWidget</class>
|
||||
<extends>QDockWidget</extends>
|
||||
@@ -278,16 +443,16 @@
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>CDKView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>qcd_kview.h</header>
|
||||
<class>CDViewWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>cdviewwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../qad/utils/qad_utils.qrc"/>
|
||||
<include location="../../qad/widgets/qad_widgets.qrc"/>
|
||||
<include location="../../qad/application/qad_application.qrc"/>
|
||||
<include location="../../qad/graphic/qpicalculator/qpicalculator.qrc"/>
|
||||
<include location="../../qad/widgets/qad_widgets.qrc"/>
|
||||
<include location="cdpult.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
@@ -339,5 +504,85 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>checkSyncFiles</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>editFileX</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>786</x>
|
||||
<y>227</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>786</x>
|
||||
<y>179</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>checkSyncFiles</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>editFileC</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>786</x>
|
||||
<y>227</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>786</x>
|
||||
<y>200</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonSessionLoad</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>CDPultWindow</receiver>
|
||||
<slot>openFile()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>589</x>
|
||||
<y>68</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>803</x>
|
||||
<y>62</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonSessionSave</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>CDPultWindow</receiver>
|
||||
<slot>saveFile()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>671</x>
|
||||
<y>70</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>806</x>
|
||||
<y>48</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonSessionSaveAs</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>CDPultWindow</receiver>
|
||||
<slot>saveAsFile()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>754</x>
|
||||
<y>66</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>805</x>
|
||||
<y>106</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
||||
78
qcd_utils/pult/cdviewwidget.cpp
Normal file
78
qcd_utils/pult/cdviewwidget.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
#include "cdviewwidget.h"
|
||||
#include "cdutils_core.h"
|
||||
#include "qcd_core.h"
|
||||
#include "qcd_model.h"
|
||||
#include "qcd_modedialog.h"
|
||||
#include "qvariantedit.h"
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
CDViewWidget::CDViewWidget(QWidget * parent) : QWidget(parent), Ui::CDViewWidget() {
|
||||
qRegisterMetaType<CDViewWidget::LogIcon>("CDViewWidget::LogIcon");
|
||||
setupUi(this);
|
||||
connect(view, SIGNAL(sendSucceed()), this, SLOT(sended()));
|
||||
connect(view, SIGNAL(receiveSucceed()), this, SLOT(received()));
|
||||
connect(view, SIGNAL(sendFailed()), this, SLOT(sendFailed()));
|
||||
connect(view, SIGNAL(receiveFailed()), this, SLOT(receiveFailed()));
|
||||
}
|
||||
|
||||
|
||||
CDViewWidget::~CDViewWidget() {
|
||||
}
|
||||
|
||||
|
||||
void CDViewWidget::reset() {
|
||||
setFile("");
|
||||
}
|
||||
|
||||
|
||||
void CDViewWidget::setType(int t) {
|
||||
view->setType((CDUtils::CDType::cdT)t);
|
||||
tl_u = view->typeLetter().toUpper();
|
||||
tl_l = view->typeLetter().toLower();
|
||||
view->refresh();
|
||||
}
|
||||
|
||||
|
||||
void CDViewWidget::setFile(const QString & f) {
|
||||
view->setFile(f);
|
||||
view->load();
|
||||
}
|
||||
|
||||
|
||||
void CDViewWidget::on_buttonSend_clicked() {
|
||||
if (view->inProgress()) {addToLog(WaitIcon, "processing..."); return;}
|
||||
addToLog(WaitIcon, "Sending " + tl_u + "...");
|
||||
view->send();
|
||||
}
|
||||
|
||||
|
||||
void CDViewWidget::on_buttonReceive_clicked() {
|
||||
if (view->inProgress()) {addToLog(WaitIcon, "processing..."); return;}
|
||||
addToLog(WaitIcon, "Receiving " + tl_u + "...");
|
||||
view->receive();
|
||||
}
|
||||
|
||||
|
||||
void CDViewWidget::on_buttonLoad_clicked() {
|
||||
view->load();
|
||||
}
|
||||
|
||||
|
||||
void CDViewWidget::on_buttonSave_clicked() {
|
||||
view->save();
|
||||
}
|
||||
|
||||
|
||||
void CDViewWidget::on_buttonParse_clicked() {
|
||||
QString path = QFileDialog::getOpenFileName(this, "Select header file", "",
|
||||
QString("%1 Description(%2_description.h);;Headers(*.h)").arg(tl_u, tl_l));
|
||||
if (path.isEmpty()) return;
|
||||
CDUtils::UpdateModeFlags mode = CDUtils::SaveByName;
|
||||
if (!view->root()->isEmpty()) {
|
||||
QCDModeDialog cdm;
|
||||
if (cdm.exec() != QDialog::Accepted) return;
|
||||
mode = cdm.mode();
|
||||
}
|
||||
view->buildFromHeader(path, mode);
|
||||
}
|
||||
41
qcd_utils/pult/cdviewwidget.h
Normal file
41
qcd_utils/pult/cdviewwidget.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef CDVIEWWIDGET_H
|
||||
#define CDVIEWWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_cdviewwidget.h"
|
||||
|
||||
|
||||
class CDViewWidget : public QWidget, public Ui::CDViewWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CDViewWidget(QWidget *parent = 0);
|
||||
~CDViewWidget();
|
||||
|
||||
enum LogIcon {NoIcon, OKIcon, FailIcon, WaitIcon};
|
||||
|
||||
void reset();
|
||||
void setType(int t);
|
||||
void setFile(const QString & f);
|
||||
|
||||
private:
|
||||
QString tl_u, tl_l;
|
||||
|
||||
private slots:
|
||||
void sended() {addToLog(OKIcon, tl_u + " " + tr("sended succesfull"));}
|
||||
void received() {addToLog(OKIcon, tl_u + " " + tr("received succesfull"));}
|
||||
void sendFailed() {addToLog(FailIcon, tl_u + " " + tr("NOT sended"));}
|
||||
void receiveFailed() {addToLog(FailIcon, tl_u + " " + tr("NOT received"));}
|
||||
void on_buttonSend_clicked();
|
||||
void on_buttonReceive_clicked();
|
||||
void on_buttonLoad_clicked();
|
||||
void on_buttonSave_clicked();
|
||||
void on_buttonParse_clicked();
|
||||
//void on_buttonCalculate_clicked();
|
||||
|
||||
signals:
|
||||
void addToLog(CDViewWidget::LogIcon icon, const QString & msg);
|
||||
|
||||
};
|
||||
|
||||
#endif // CDVIEWWIDGET_H
|
||||
121
qcd_utils/pult/cdviewwidget.ui
Normal file
121
qcd_utils/pult/cdviewwidget.ui
Normal file
@@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CDViewWidget</class>
|
||||
<widget class="QWidget" name="CDViewWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>689</width>
|
||||
<height>459</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>CD Pult</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="buttonSave">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qad/application/qad_application.qrc">
|
||||
<normaloff>:/icons/document-save.png</normaloff>:/icons/document-save.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="buttonLoad">
|
||||
<property name="text">
|
||||
<string>Load</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qad/application/qad_application.qrc">
|
||||
<normaloff>:/icons/document-open.png</normaloff>:/icons/document-open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="buttonReceive">
|
||||
<property name="text">
|
||||
<string>Receive</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/icons/document-revert.png</normaloff>:/icons/document-revert.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="buttonParse">
|
||||
<property name="text">
|
||||
<string>Update description ...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/icons/view-refresh.png</normaloff>:/icons/view-refresh.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="buttonSend">
|
||||
<property name="text">
|
||||
<string>Send</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/icons/flame.png</normaloff>:/icons/flame.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="CDView" name="view">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
|
||||
</property>
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CDView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>qcd_view.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../qad/application/qad_application.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
BIN
qcd_utils/pult/icons/document-revert.png
Normal file
BIN
qcd_utils/pult/icons/document-revert.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
BIN
qcd_utils/pult/icons/flame.png
Normal file
BIN
qcd_utils/pult/icons/flame.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
BIN
qcd_utils/pult/icons/view-refresh.png
Normal file
BIN
qcd_utils/pult/icons/view-refresh.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
Reference in New Issue
Block a user