qavrg 0.0.28
Public Slots | Signals | Public Member Functions | Private Attributes
QavrgTestInteger Class Reference

#include <qavrgtestwindow.h>

List of all members.

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

Detailed Description

Definition at line 39 of file qavrgtestwindow.h.


Constructor & Destructor Documentation

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)
{
}

Member Function Documentation

void QavrgTestInteger::chg_Integer ( int  value,
qint64  id = 0 
) [signal]

Referenced by linkTo(), and set_Integer().

int QavrgTestInteger::get_Integer ( ) const [slot]

Definition at line 108 of file qavrgtestwindow.cpp.

References m_Mutex, and m_Value.

Referenced by linkTo().

{
  QMutexLocker lock(&m_Mutex);

  return m_Value;
}
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);
}

Member Data Documentation

QMutex QavrgTestInteger::m_Mutex [mutable, private]

Definition at line 57 of file qavrgtestwindow.h.

Referenced by get_Integer(), and set_Integer().

Definition at line 62 of file qavrgtestwindow.h.

Referenced by set_Integer(), and setValue().

Definition at line 61 of file qavrgtestwindow.h.

Referenced by set_Integer().

Definition at line 58 of file qavrgtestwindow.h.

Referenced by linkTo().

Definition at line 59 of file qavrgtestwindow.h.

Referenced by linkTo().

Definition at line 60 of file qavrgtestwindow.h.

Referenced by get_Integer(), and set_Integer().


The documentation for this class was generated from the following files: