git-svn-id: svn://db.shs.com.ru/libs@415 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "cdutils_core.h"
|
||||
#include "cdutils_k.h"
|
||||
#include "cdutils_x.h"
|
||||
#include "cdutils_m.h"
|
||||
#include "qcd_core.h"
|
||||
#include "qcd_view.h"
|
||||
#include "qcd_model.h"
|
||||
@@ -15,6 +16,7 @@
|
||||
#include <QFileDialog>
|
||||
#include <QScrollBar>
|
||||
#include <QImageReader>
|
||||
#include <QMessageBox>
|
||||
|
||||
using namespace CDUtils;
|
||||
|
||||
@@ -30,9 +32,11 @@ CDPultWindow::CDPultWindow(QWidget *parent) : EMainWindow(parent), Ui::CDPultWin
|
||||
widgetK->setType(CDUtils::CDType::cdK);
|
||||
widgetX->setType(CDUtils::CDType::cdX);
|
||||
widgetC->setType(CDUtils::CDType::cdC);
|
||||
widgetM->setType(CDUtils::CDType::cdM);
|
||||
editFileK->setValue(QVariant::fromValue(QAD::File("", "*.dat")));
|
||||
editFileX->setValue(QVariant::fromValue(QAD::File("", "*.dat")));
|
||||
editFileC->setValue(QVariant::fromValue(QAD::File("", "*.dat")));
|
||||
editFileM->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");
|
||||
@@ -46,9 +50,11 @@ CDPultWindow::CDPultWindow(QWidget *parent) : EMainWindow(parent), Ui::CDPultWin
|
||||
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)));
|
||||
connect(widgetC, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString)));
|
||||
connect(widgetM, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString)));
|
||||
connect(widgetK->view, SIGNAL(changedGlobal()), widgetDirectK, SLOT(changedGlobal()));
|
||||
connect(widgetX->view, SIGNAL(changedGlobal()), widgetGraphics, SLOT(changedGlobal()));
|
||||
connect(widgetX->view, SIGNAL(receivedX()), widgetGraphics, SLOT(receivedX()));
|
||||
connect(widgetM->view, SIGNAL(messageReceived(QString,int,QString)), this, SLOT(messageReceived(QString,int,QString)));
|
||||
QCDCore::instance()->bindWidget(widgetK->view);
|
||||
QCDCore::instance()->setDirectKEnabled(true);
|
||||
X.start();
|
||||
@@ -71,6 +77,7 @@ void CDPultWindow::apply(bool sessions) {
|
||||
widgetK->setFile(editFileK->value().value<QAD::File>().file);
|
||||
widgetX->setFile(editFileX->value().value<QAD::File>().file);
|
||||
widgetC->setFile(editFileC->value().value<QAD::File>().file);
|
||||
widgetM->setFile(editFileM->value().value<QAD::File>().file);
|
||||
if (checkDefaultConfig->isChecked())
|
||||
CDCore::instance()->initPult();
|
||||
else
|
||||
@@ -92,6 +99,7 @@ void CDPultWindow::apply(bool sessions) {
|
||||
dockCDKView->setVisible(checkHasK->isChecked());
|
||||
dockCDXView->setVisible(checkHasX->isChecked());
|
||||
dockCDCView->setVisible(checkHasC->isChecked());
|
||||
dockCDMView->setVisible(checkHasM->isChecked());
|
||||
QMetaObject::invokeMethod(this, "changedDock", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
@@ -121,6 +129,7 @@ bool CDPultWindow::load(const QString & path) {
|
||||
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)));
|
||||
editFileM->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_m").value(), f.filter)));
|
||||
checkSyncFiles->setChecked(conf.getValue("sync_files"));
|
||||
lineSessionName->setText(conf.getValue("session_name"));
|
||||
last_icon = conf.getValue("icon_path", "").value();
|
||||
@@ -128,6 +137,7 @@ bool CDPultWindow::load(const QString & path) {
|
||||
checkHasK->setChecked(conf.getValue("has_k"));
|
||||
checkHasX->setChecked(conf.getValue("has_x"));
|
||||
checkHasC->setChecked(conf.getValue("has_c"));
|
||||
checkHasM->setChecked(conf.getValue("has_m"));
|
||||
checkDefaultConfig->setChecked(conf.getValue("default_config"));
|
||||
codeConfig->setText(QByteArray2QString(conf.getValue("config", QByteArray())));
|
||||
if (codeConfig->text().isEmpty())
|
||||
@@ -152,6 +162,7 @@ bool CDPultWindow::save(const QString & path) {
|
||||
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("file_m", editFileM->value().value<QAD::File>().file);
|
||||
conf.setValue("sync_files", checkSyncFiles->isChecked());
|
||||
conf.setValue("session_name", lineSessionName->text());
|
||||
conf.setValue("icon_path", last_icon);
|
||||
@@ -159,7 +170,7 @@ 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("has_m", checkHasM->isChecked());
|
||||
conf.setValue("default_config", checkDefaultConfig->isChecked());
|
||||
conf.setValue("config", QString2QByteArray(codeConfig->text()));
|
||||
conf.setValue("session_gr", session_gr);
|
||||
@@ -215,18 +226,29 @@ void CDPultWindow::addToLog(CDViewWidget::LogIcon icon, const QString & msg) {
|
||||
}
|
||||
|
||||
|
||||
void CDPultWindow::messageReceived(QString path, int type, QString msg) {
|
||||
MessageType mt = (MessageType)type;
|
||||
const CDType & t(M.root()[CDCore::stringToPath(Q2PIString(path))]);
|
||||
if (t.cd_type() != CDType::cdM) return;
|
||||
if (mt == MessageBox)
|
||||
QMessageBox::information(this, windowTitle(), QString("[%1]\n%2").arg(PI2QString(t.name()), msg));
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
QString xn(n), cn(n), mn(n);
|
||||
if (n.contains("k")) {
|
||||
xn.replace(n.indexOf("k"), 1, "x");
|
||||
cn.replace(n.indexOf("k"), 1, "c");
|
||||
mn.replace(n.indexOf("k"), 1, "m");
|
||||
} else {
|
||||
xn += "_x";
|
||||
cn += "_c";
|
||||
mn += "_m";
|
||||
}
|
||||
QString ext = fi.suffix(), dot, dir;
|
||||
QString kfn(fi.filePath());
|
||||
@@ -245,6 +267,7 @@ void CDPultWindow::on_editFileK_valueChanged(const QVariant & p) {
|
||||
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));
|
||||
f.file = dir + mn + dot + ext; editFileM->setValue(QVariant::fromValue(f));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user