git-svn-id: svn://db.shs.com.ru/libs@398 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -114,6 +114,11 @@ int Interface::count(bool recursive) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Interface::exists(PIDeque<int> path) const {
|
||||||
|
return s->exists(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Interface::setFileName(const PIString & _file) {
|
void Interface::setFileName(const PIString & _file) {
|
||||||
file_ = _file;
|
file_ = _file;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public:
|
|||||||
const PIString file() const {return file_;}
|
const PIString file() const {return file_;}
|
||||||
int fileSize() const {return file_size;}
|
int fileSize() const {return file_size;}
|
||||||
CDType::cdT cdType() const {return type;}
|
CDType::cdT cdType() const {return type;}
|
||||||
|
bool exists(PIDeque<int> path) const;
|
||||||
|
|
||||||
void setFileName(const PIString & _file);
|
void setFileName(const PIString & _file);
|
||||||
bool configure(const PIString & config);
|
bool configure(const PIString & config);
|
||||||
|
|||||||
@@ -328,6 +328,16 @@ const CDSection CDSection::section(int v) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CDSection::exists(PIDeque<int> path) const {
|
||||||
|
if (path.isEmpty()) return false;
|
||||||
|
if (path.size_s() == 1) return cd.contains(path[0]);
|
||||||
|
int si = path[0];
|
||||||
|
if (!s.contains(si)) return false;
|
||||||
|
path.remove(0, 1);
|
||||||
|
return s[si].exists(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int CDSection::count(bool recursive) const {
|
int CDSection::count(bool recursive) const {
|
||||||
int ret = cd.size_s();
|
int ret = cd.size_s();
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ public:
|
|||||||
const CDSection section(int v) const;
|
const CDSection section(int v) const;
|
||||||
|
|
||||||
bool isEmpty() const {return cd.isEmpty() && s.isEmpty();}
|
bool isEmpty() const {return cd.isEmpty() && s.isEmpty();}
|
||||||
|
bool exists(PIDeque<int> path) const;
|
||||||
int count(bool recursive = true) const;
|
int count(bool recursive = true) const;
|
||||||
int sectionsCount() const;
|
int sectionsCount() const;
|
||||||
PIVector<int> indexes() const {return cd.keys();}
|
PIVector<int> indexes() const {return cd.keys();}
|
||||||
|
|||||||
@@ -93,6 +93,21 @@ void KDockWidget::clear() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KDockWidget::changedGlobal() {
|
||||||
|
for (int i = 0; i < k_list.size_s(); ++i) {
|
||||||
|
if (!K.exists(k_list[i])) {
|
||||||
|
k_list.remove(i);
|
||||||
|
info_list.remove(i);
|
||||||
|
removeRow(i);
|
||||||
|
--i;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
QLabel * lbl = qobject_cast<QLabel*>(lay->itemAt(i, QFormLayout::LabelRole)->widget());
|
||||||
|
if (lbl) lbl->setText(PI2QString(K[k_list[i]].pathString().join(".")) + ":");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool KDockWidget::eventFilter(QObject * o, QEvent * e) {
|
bool KDockWidget::eventFilter(QObject * o, QEvent * e) {
|
||||||
//if (o == graphic->viewport()) {
|
//if (o == graphic->viewport()) {
|
||||||
switch (e->type()) {
|
switch (e->type()) {
|
||||||
@@ -244,6 +259,12 @@ void CDDirectK::addArea() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDDirectK::changedGlobal() {
|
||||||
|
foreach (KDockWidget * d, docks)
|
||||||
|
d->changedGlobal();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDDirectK::removeArea() {
|
void CDDirectK::removeArea() {
|
||||||
KDockWidget * d = qobject_cast<KDockWidget * >(sender());
|
KDockWidget * d = qobject_cast<KDockWidget * >(sender());
|
||||||
if (!d) return;
|
if (!d) return;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ public:
|
|||||||
QByteArray save() const;
|
QByteArray save() const;
|
||||||
void load(QByteArray ba);
|
void load(QByteArray ba);
|
||||||
void clear();
|
void clear();
|
||||||
|
void changedGlobal();
|
||||||
|
|
||||||
QFormLayout * lay;
|
QFormLayout * lay;
|
||||||
|
|
||||||
@@ -62,6 +63,7 @@ private:
|
|||||||
QMainWindow * da;
|
QMainWindow * da;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void changedGlobal();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void removeArea();
|
void removeArea();
|
||||||
|
|||||||
@@ -102,6 +102,19 @@ void GDockWidget::load(QByteArray ba) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GDockWidget::changedGlobal() {
|
||||||
|
for (int i = 0; i < x_list.size_s(); ++i) {
|
||||||
|
if (!X.exists(x_list[i])) {
|
||||||
|
x_list.remove(i);
|
||||||
|
graphic->graphic()->removeGraphic(i);
|
||||||
|
--i;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
graphic->graphic()->setGraphicName(PI2QString(X[x_list[i]].pathString().join(".")), i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GDockWidget::eventFilter(QObject * o, QEvent * e) {
|
bool GDockWidget::eventFilter(QObject * o, QEvent * e) {
|
||||||
//if (o == graphic->viewport()) {
|
//if (o == graphic->viewport()) {
|
||||||
switch (e->type()) {
|
switch (e->type()) {
|
||||||
@@ -297,6 +310,12 @@ void CDGraphics::receivedX() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDGraphics::changedGlobal() {
|
||||||
|
foreach (GDockWidget * d, docks)
|
||||||
|
d->changedGlobal();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDGraphics::removeGraphic() {
|
void CDGraphics::removeGraphic() {
|
||||||
GDockWidget * d = qobject_cast<GDockWidget * >(sender());
|
GDockWidget * d = qobject_cast<GDockWidget * >(sender());
|
||||||
if (!d) return;
|
if (!d) return;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public:
|
|||||||
void drawX(const PIMap<PIString, PIVector<double> > & data);
|
void drawX(const PIMap<PIString, PIVector<double> > & data);
|
||||||
QByteArray save() const;
|
QByteArray save() const;
|
||||||
void load(QByteArray ba);
|
void load(QByteArray ba);
|
||||||
|
void changedGlobal();
|
||||||
|
|
||||||
CDGraphicWidget * graphic;
|
CDGraphicWidget * graphic;
|
||||||
|
|
||||||
@@ -76,6 +77,7 @@ private:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void receivedX();
|
void receivedX();
|
||||||
|
void changedGlobal();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void removeGraphic();
|
void removeGraphic();
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ CDPultWindow::CDPultWindow(QWidget *parent) : EMainWindow(parent), Ui::CDPultWin
|
|||||||
connect(widgetK, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString)));
|
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(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(widgetC, 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(widgetX->view, SIGNAL(receivedX()), widgetGraphics, SLOT(receivedX()));
|
||||||
QCDCore::instance()->bindWidget(widgetK->view);
|
QCDCore::instance()->bindWidget(widgetK->view);
|
||||||
QCDCore::instance()->setDirectKEnabled(true);
|
QCDCore::instance()->setDirectKEnabled(true);
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ bool QCDCore::bindWidget(QWidget * w, const CDType & k) {
|
|||||||
connect(w, SIGNAL(destroyed(QObject*)), this, SLOT(slotDestroyed(QObject*)), Qt::UniqueConnection);
|
connect(w, SIGNAL(destroyed(QObject*)), this, SLOT(slotDestroyed(QObject*)), Qt::UniqueConnection);
|
||||||
setWidgetValue(w, k);
|
setWidgetValue(w, k);
|
||||||
if (!ok) return false;
|
if (!ok) return false;
|
||||||
piCout << k.name() << k.path();
|
//piCout << k.name() << k.path();
|
||||||
binded_widgets.insert(w, k.path());
|
binded_widgets.insert(w, k.path());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -187,11 +187,17 @@ bool QCDCore::bindWidget(QWidget * w, const CDType & k) {
|
|||||||
|
|
||||||
void QCDCore::updateBindedWidgets() {
|
void QCDCore::updateBindedWidgets() {
|
||||||
QMapIterator<QWidget * , PIDeque<int> > it(binded_widgets);
|
QMapIterator<QWidget * , PIDeque<int> > it(binded_widgets);
|
||||||
|
QWidgetList to_remove;
|
||||||
updating = true;
|
updating = true;
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
QWidget * w = it.next().key();
|
QWidget * w = it.next().key();
|
||||||
setWidgetValue(w, K[it.value()]);
|
if (!K.exists(it.value()))
|
||||||
|
to_remove << w;
|
||||||
|
else
|
||||||
|
setWidgetValue(w, K[it.value()]);
|
||||||
}
|
}
|
||||||
|
foreach (QWidget * w, to_remove)
|
||||||
|
unbindWidget(w);
|
||||||
updating = false;
|
updating = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ CDView::CDView(QWidget * parent) : QTreeView(parent) {
|
|||||||
connect(this, SIGNAL(_qcd_receiveFailed()), this, SLOT(cd_receiveFailed()), Qt::QueuedConnection);
|
connect(this, SIGNAL(_qcd_receiveFailed()), this, SLOT(cd_receiveFailed()), Qt::QueuedConnection);
|
||||||
connect(this, SIGNAL(_qcd_receiveSucceed()), this, SLOT(cd_receiveSucceed()), Qt::QueuedConnection);
|
connect(this, SIGNAL(_qcd_receiveSucceed()), this, SLOT(cd_receiveSucceed()), Qt::QueuedConnection);
|
||||||
connect(this, SIGNAL(_qcd_receivedX()), this, SLOT(cd_receivedX()), Qt::QueuedConnection);
|
connect(this, SIGNAL(_qcd_receivedX()), this, SLOT(cd_receivedX()), Qt::QueuedConnection);
|
||||||
|
connect(this, SIGNAL(_qcd_changedGlobal()), this, SLOT(cd_changedGlobal()), Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -40,6 +41,7 @@ void CDView::setType(int cdt) {
|
|||||||
CONNECTU(&K, sendFailed, this, pi_cd_sendFailed);
|
CONNECTU(&K, sendFailed, this, pi_cd_sendFailed);
|
||||||
CONNECTU(&K, received, this, pi_cd_receiveSucceed);
|
CONNECTU(&K, received, this, pi_cd_receiveSucceed);
|
||||||
CONNECTU(&K, receiveFailed, this, pi_cd_receiveFailed);
|
CONNECTU(&K, receiveFailed, this, pi_cd_receiveFailed);
|
||||||
|
CONNECTU(&K, changedGlobal, this, pi_cd_changedGlobal);
|
||||||
break;
|
break;
|
||||||
case CDType::cdX:
|
case CDType::cdX:
|
||||||
CONNECTU(&X, sended, this, pi_cd_sendSucceed);
|
CONNECTU(&X, sended, this, pi_cd_sendSucceed);
|
||||||
@@ -47,12 +49,14 @@ void CDView::setType(int cdt) {
|
|||||||
CONNECTU(&X, received, this, pi_cd_receiveSucceed);
|
CONNECTU(&X, received, this, pi_cd_receiveSucceed);
|
||||||
CONNECTU(&X, receiveFailed, this, pi_cd_receiveFailed);
|
CONNECTU(&X, receiveFailed, this, pi_cd_receiveFailed);
|
||||||
CONNECTU(&X, receivedX, this, pi_cd_receivedX);
|
CONNECTU(&X, receivedX, this, pi_cd_receivedX);
|
||||||
|
CONNECTU(&X, changedGlobal, this, pi_cd_changedGlobal);
|
||||||
break;
|
break;
|
||||||
case CDType::cdC:
|
case CDType::cdC:
|
||||||
CONNECTU(&C, sended, this, pi_cd_sendSucceed);
|
CONNECTU(&C, sended, this, pi_cd_sendSucceed);
|
||||||
CONNECTU(&C, sendFailed, this, pi_cd_sendFailed);
|
CONNECTU(&C, sendFailed, this, pi_cd_sendFailed);
|
||||||
CONNECTU(&C, received, this, pi_cd_receiveSucceed);
|
CONNECTU(&C, received, this, pi_cd_receiveSucceed);
|
||||||
CONNECTU(&C, receiveFailed, this, pi_cd_receiveFailed);
|
CONNECTU(&C, receiveFailed, this, pi_cd_receiveFailed);
|
||||||
|
CONNECTU(&C, changedGlobal, this, pi_cd_changedGlobal);
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
@@ -312,3 +316,8 @@ void CDView::cd_receivedX() {
|
|||||||
X.unlock();
|
X.unlock();
|
||||||
emit receivedX();
|
emit receivedX();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDView::cd_changedGlobal() {
|
||||||
|
emit changedGlobal();
|
||||||
|
}
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ private slots:
|
|||||||
void cd_receiveFailed();
|
void cd_receiveFailed();
|
||||||
void cd_receiveSucceed();
|
void cd_receiveSucceed();
|
||||||
void cd_receivedX();
|
void cd_receivedX();
|
||||||
|
void cd_changedGlobal();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EVENT_HANDLER(void, pi_cd_sendFailed) {emit _qcd_sendFailed();}
|
EVENT_HANDLER(void, pi_cd_sendFailed) {emit _qcd_sendFailed();}
|
||||||
@@ -58,6 +59,7 @@ private:
|
|||||||
EVENT_HANDLER(void, pi_cd_receiveFailed) {emit _qcd_receiveFailed();}
|
EVENT_HANDLER(void, pi_cd_receiveFailed) {emit _qcd_receiveFailed();}
|
||||||
EVENT_HANDLER(void, pi_cd_receiveSucceed) {emit _qcd_receiveSucceed();}
|
EVENT_HANDLER(void, pi_cd_receiveSucceed) {emit _qcd_receiveSucceed();}
|
||||||
EVENT_HANDLER(void, pi_cd_receivedX) {emit _qcd_receivedX();}
|
EVENT_HANDLER(void, pi_cd_receivedX) {emit _qcd_receivedX();}
|
||||||
|
EVENT_HANDLER(void, pi_cd_changedGlobal) {emit _qcd_changedGlobal();}
|
||||||
|
|
||||||
CDItemModel * model_;
|
CDItemModel * model_;
|
||||||
int type_;
|
int type_;
|
||||||
@@ -68,6 +70,7 @@ signals:
|
|||||||
void receiveFailed();
|
void receiveFailed();
|
||||||
void receiveSucceed();
|
void receiveSucceed();
|
||||||
void receivedX();
|
void receivedX();
|
||||||
|
void changedGlobal();
|
||||||
void messageStatus(QString msg);
|
void messageStatus(QString msg);
|
||||||
void commandSended(QString msg);
|
void commandSended(QString msg);
|
||||||
void busyStatusChanged(bool busy);
|
void busyStatusChanged(bool busy);
|
||||||
@@ -77,6 +80,7 @@ signals:
|
|||||||
void _qcd_receiveFailed(); // PRIVATE
|
void _qcd_receiveFailed(); // PRIVATE
|
||||||
void _qcd_receiveSucceed(); // PRIVATE
|
void _qcd_receiveSucceed(); // PRIVATE
|
||||||
void _qcd_receivedX(); // PRIVATE
|
void _qcd_receivedX(); // PRIVATE
|
||||||
|
void _qcd_changedGlobal(); // PRIVATE
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user