コード例 #1
0
ファイル: sessionserver.cpp プロジェクト: Rambo2015/Drawpile
SessionServer::SessionServer(QObject *parent)
	: QObject(parent),
	_store(nullptr),
	_identman(nullptr),
	_sessionLimit(1),
	_connectionTimeout(0),
	_historyLimit(0),
	_expirationTime(0),
	_allowPersistentSessions(false),
	_mustSecure(false)
{
	QTimer *cleanupTimer = new QTimer(this);
	connect(cleanupTimer, &QTimer::timeout, this, &SessionServer::cleanupSessions);
	cleanupTimer->setInterval(15 * 1000);
	cleanupTimer->start(cleanupTimer->interval());

	_publicListingApi = new sessionlisting::AnnouncementApi(this);

	connect(_publicListingApi, &sessionlisting::AnnouncementApi::sessionAnnounced, this, &SessionServer::sessionAnnounced);
	connect(_publicListingApi, &sessionlisting::AnnouncementApi::messageReceived, [this](const QString &msg) {
		wall("Session announced: " + msg);
	});

	QTimer *announcementRefreshTimer = new QTimer(this);
	connect(announcementRefreshTimer, &QTimer::timeout, this, &SessionServer::refreshSessionAnnouncements);
	announcementRefreshTimer->setInterval(1000 * 60 * 5);
	announcementRefreshTimer->start(announcementRefreshTimer->interval());

#ifndef NDEBUG
	_randomlag = 0;
#endif
}
コード例 #2
0
ファイル: qtimerproto.cpp プロジェクト: AlFoX/qt-client
int QTimerProto::interval() const
{
  QTimer *item = qscriptvalue_cast<QTimer*>(thisObject());
  if (item)
    return item->interval();
  return -1;
}
コード例 #3
0
ファイル: TimerClass.cpp プロジェクト: alex-games/a1
QScriptValue TimerClass::property(const QScriptValue &object,
				  const QScriptString &name, uint /*id*/) {
  QTimer *timer = qscriptvalue_cast<QTimer*>(object.data()); 
  if (!timer)
    return QScriptValue();
  if (name == _interval) {
    return timer->interval();
  } else if (name == _singleShot) {
    return timer->isSingleShot();
  }
  return QScriptValue();
}
コード例 #4
0
ファイル: sessionserver.cpp プロジェクト: sendomin/Drawpile
SessionServer::SessionServer(QObject *parent)
	: QObject(parent),
	_store(nullptr),
	_identman(nullptr),
	_sessionLimit(1),
	_connectionTimeout(0),
	_historyLimit(0),
	_expirationTime(0),
	_allowPersistentSessions(false),
	_mustSecure(false)
{
	QTimer *cleanupTimer = new QTimer(this);
	connect(cleanupTimer, SIGNAL(timeout()), this, SLOT(cleanupSessions()));
	cleanupTimer->setInterval(15 * 1000);
	cleanupTimer->start(cleanupTimer->interval());
}