|
qavrg 0.0.28
|
#include <qavrgtestwindow.h>
Public Slots | |
| void | set_Integer (int value) |
| int | get_Integer () const |
| void | setValue (int value, qint64 id=0) |
Signals | |
| void | chg_Integer (int value, qint64 id=0) |
Public Member Functions | |
| QavrgTestInteger (int useProxy, int useTransaction, QObject *parent=0) | |
| void | linkTo (QSpinBox *spinBox) |
Private Attributes | |
| QMutex | m_Mutex |
| int | m_UseProxy |
| int | m_UseTransaction |
| int | m_Value |
| qint64 | m_TransactionId |
| int | m_NQueuedUpdates |
Definition at line 39 of file qavrgtestwindow.h.
| QavrgTestInteger::QavrgTestInteger | ( | int | useProxy, |
| int | useTransaction, | ||
| QObject * | parent = 0 |
||
| ) |
Definition at line 53 of file qavrgtestwindow.cpp.
: QObject(parent),
m_Mutex(QMutex::Recursive),
m_UseProxy(useProxy),
m_UseTransaction(useTransaction),
m_Value(0),
m_TransactionId(0),
m_NQueuedUpdates(0)
{
}
| void QavrgTestInteger::chg_Integer | ( | int | value, |
| qint64 | id = 0 |
||
| ) | [signal] |
Referenced by linkTo(), and set_Integer().
| int QavrgTestInteger::get_Integer | ( | ) | const [slot] |
| void QavrgTestInteger::linkTo | ( | QSpinBox * | spinBox | ) |
Definition at line 64 of file qavrgtestwindow.cpp.
References chg_Integer(), get_Integer(), m_UseProxy, m_UseTransaction, setValue(), and valueChanged().
{
if (m_UseProxy) {
QavrgTestProxy *proxy = new QavrgTestProxy(m_UseProxy, m_UseTransaction, this, spinBox, NULL);
proxy -> moveToThread(spinBox -> thread());
connect(this, SIGNAL(chg_Integer(int,qint64)), proxy, SLOT(valueChanged(int,qint64)), Qt::QueuedConnection);
connect(proxy, SIGNAL(changeInteger(int,qint64)), this, SLOT(setValue(int,qint64)), Qt::QueuedConnection);
connect(spinBox, SIGNAL(valueChanged(int)), proxy, SLOT(spinBoxChanged(int)), Qt::DirectConnection);
connect(proxy, SIGNAL(changeSpinBox(int)), spinBox, SLOT(setValue(int)), Qt::DirectConnection);
spinBox -> setValue(get_Integer());
} else {
connect(this, SIGNAL(chg_Integer(int,qint64)), spinBox, SLOT(setValue(int)), Qt::DirectConnection);
connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)), Qt::DirectConnection);
}
}
| void QavrgTestInteger::set_Integer | ( | int | value | ) | [slot] |
Definition at line 93 of file qavrgtestwindow.cpp.
References chg_Integer(), m_Mutex, m_NQueuedUpdates, m_TransactionId, and m_Value.
Referenced by setValue().
{
QMutexLocker lock(&m_Mutex);
printf("%ld: QavrgTestInteger::set_Integer(%d)\n", (long int) m_TransactionId, value);
if (value != m_Value) {
m_Value = value;
m_NQueuedUpdates++;
emit chg_Integer(m_Value, m_TransactionId++);
}
}
| void QavrgTestInteger::setValue | ( | int | value, |
| qint64 | id = 0 |
||
| ) | [slot] |
Definition at line 84 of file qavrgtestwindow.cpp.
References m_NQueuedUpdates, and set_Integer().
Referenced by linkTo().
{
printf("QavrgTestInteger::setValue(%d,%ld,%d)\n", value, (long int) id, m_NQueuedUpdates);
m_NQueuedUpdates--;
set_Integer(value);
}
QMutex QavrgTestInteger::m_Mutex [mutable, private] |
Definition at line 57 of file qavrgtestwindow.h.
Referenced by get_Integer(), and set_Integer().
int QavrgTestInteger::m_NQueuedUpdates [private] |
Definition at line 62 of file qavrgtestwindow.h.
Referenced by set_Integer(), and setValue().
qint64 QavrgTestInteger::m_TransactionId [private] |
Definition at line 61 of file qavrgtestwindow.h.
Referenced by set_Integer().
int QavrgTestInteger::m_UseProxy [private] |
Definition at line 58 of file qavrgtestwindow.h.
Referenced by linkTo().
int QavrgTestInteger::m_UseTransaction [private] |
Definition at line 59 of file qavrgtestwindow.h.
Referenced by linkTo().
int QavrgTestInteger::m_Value [private] |
Definition at line 60 of file qavrgtestwindow.h.
Referenced by get_Integer(), and set_Integer().
1.7.4