コード例 #1
0
DialogTimeFollower::DialogTimeFollower(QWidget *parent, TimeTrackingModel * timeTrackingModel) :
    QDialog(parent, Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint),
    ui(new Ui::DialogTimeFollower), mWindowIsClicked(false), mTimeTrackingModel(timeTrackingModel)
{
    ui->setupUi(this);
    setAttribute(Qt::WA_TranslucentBackground);
    setWindowOpacity(1.0);
    connect(ui->horizontalSlider,   SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int)));
    connect(ui->pushButtonStart,    SIGNAL(clicked()), SIGNAL(start()));
    connect(ui->pushButtonStop,     SIGNAL(clicked()), SIGNAL(stop()));
    connect(ui->pushButtonPause,    SIGNAL(clicked()), SIGNAL(pause()));

    connect(ui->pushButtonStart,    SIGNAL(clicked()), this, SLOT(onTimeout()));
    connect(ui->pushButtonStop,     SIGNAL(clicked()), this, SLOT(onTimeout()));
    connect(ui->pushButtonPause,    SIGNAL(clicked()), this, SLOT(onTimeout()));

    connect(&mTimer, SIGNAL(timeout()), this, SLOT(onTimeout()));
    mTimer.setInterval(2000);
    mTimer.start();
    onTimeout();
    ui->horizontalSlider->setMinimum(10);
    ui->horizontalSlider->setMaximum(100);

/*    QDesktopWidget * desktopWidget = QApplication::desktop();
    move(desktopWidget->width()  - size().width(),
         desktopWidget->height() - size().height());*/

}
コード例 #2
0
ファイル: single_timer.cpp プロジェクト: Drru97/tdesktop
void SingleTimer::setTimeoutHandler(base::lambda<void()> &&handler) {
	if (_handler && !handler) {
		disconnect(this, SIGNAL(timeout()), this, SLOT(onTimeout()));
	} else if (handler && !_handler) {
		connect(this, SIGNAL(timeout()), this, SLOT(onTimeout()));
	}
	_handler = std_::move(handler);
}
コード例 #3
0
ファイル: main.cpp プロジェクト: KubaO/stackoverflown
int main(int argc, char ** argv) {
   QCoreApplication app{argc, argv};
   QObject context;
   QThread thread;
   context.moveToThread(&thread);
   thread.start();
   onTimeout(1000, []{ qDebug() << "T+1s"; });
   onTimeout(2000, &context, [&]{ qDebug() << "T+2s"; thread.quit(); });
   QObject::connect(&thread, &QThread::finished, &app, &QCoreApplication::quit);
   return app.exec();
}
コード例 #4
0
ファイル: firstscreen.cpp プロジェクト: 520hacker/berserkJS
void FirstScreen::setStartScanViewTime(qint64 firstPaintTimeout)
{
    QString url = myFrame->url().toString().trimmed();
    // 如果是空页面就不检查首屏了
    if (url.isEmpty() || url.toLower() == "about:blank") {
        // qDebug()<<"empty";
        return;
    }
    this->firstPaintTimeout = firstPaintTimeout;
    this->startScanViewTime = QDateTime::currentDateTime().toMSecsSinceEpoch();

    // 非自定义选择点监测时采用均匀分布监测
    if (!isCustomDetectoinPointMode) {
        initScreenSplit();
    }

    initDetectionRGBList();

    this->currentFinishedNumber = 0;

    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(onTimeout()));
    timer->start(detectionInterval);
    timerId = timer->timerId();
}
コード例 #5
0
AsyncRequestList::AsyncRequestList() :
	QObject(), QList<AsyncRequest*>()
{
	timer=new QTimer(this);
	connect(timer, SIGNAL(timeout()), SLOT(onTimeout()));
	timer->start(60000);
}
コード例 #6
0
void CThreadQueue::run()
{
	LOG(INFO) + "Starting main routine...";

	int nLastPollInterval = getLastPollInterval();
	while( !isStopping() )
	{
        unsigned int nWait = m_nPollInterval > 0 ? m_nPollInterval : QUEUE_POLL_INTERVAL_INFINITE;

        if ( m_nPollInterval > 0 && nLastPollInterval > 0 )
        {
            int nWait2 = m_nPollInterval - nLastPollInterval;
            if ( nWait2 <= 0 )
                nWait = QUEUE_STARTUP_INTERVAL_SECONDS;
            else
                nWait = nWait2;
        }

        if ( nWait >= 0 && !isStopping() && isNoCommands() )
		{
            LOG(INFO) + "ThreadQueue blocked for " + nWait + " seconds...";
            if ( wait(nWait) == 1 )
                onTimeout();
        }
        nLastPollInterval = 0;

        if ( !isStopping() )
    		processCommands();
	}

    LOG(INFO) + "Thread shutdown";
}
コード例 #7
0
MyDBusAdaptor::MyDBusAdaptor(QObject *parent):
    QDBusAbstractAdaptor(parent),
    timer(new QTimer(this))
{
    connect(timer, SIGNAL(timeout()), this, SLOT(onTimeout()));
    timer->start(1000);
}
コード例 #8
0
		foreach (PieceDownloader* pd,pdown)
		{
			pd->release();
			sendCancels(pd);
			disconnect(pd,SIGNAL(timedout(bt::Request)),this,SLOT(onTimeout(bt::Request)));
			disconnect(pd,SIGNAL(rejected(bt::Request)),this,SLOT(onRejected(bt::Request)));
		}
コード例 #9
0
ファイル: PlanSimSubpanel.cpp プロジェクト: quesnel/packages
void
PlanSimSubpanel::onSimulationFinished()
{
    bool oldBlockTree = right->ui->treeSimViews->blockSignals(true);
    right->ui->treeSimViews->clear();
    onTimeout();
    timer.stop();
    if (sim_process and not sim_process->error_simu.isEmpty()) {
        mLog->logExt(sim_process->error_simu, true);
    } else if (sim_process and sim_process->output_map) {
        const vle::value::Map& simu = *sim_process->output_map;
        QList<QTreeWidgetItem*> views_items;
        vle::value::Map::const_iterator itb = simu.begin();
        vle::value::Map::const_iterator ite = simu.end();
        for (; itb != ite; itb++) {
            QString viewName(itb->first.c_str());
            QStringList viewType = mvpz->getViewTypeFromDoc(viewName);
            if (viewType.contains("finish")) {

                QTreeWidgetItem* vItem = new QTreeWidgetItem();

                vItem->setText(
                    0, QString("%1 (%2)").arg(viewName).arg("finish"));
                vItem->setData(0, Qt::UserRole + 0, "view");
                vItem->setData(0, Qt::UserRole + 1, viewName);
                const vle::value::Matrix& res = itb->second->toMatrix();
                for (unsigned int i = 0; i < res.columns(); i++) {
                    if (res.get(i, 0) and res.get(i, 0)->isString()) {
                        QString portName = res.getString(i, 0).c_str();
                        if (portName.contains("AchievedPlan")) {
                            QTreeWidgetItem* pItem = new QTreeWidgetItem();
                            pItem->setText(0, portName);
                            pItem->setFlags(vItem->flags() |
                                            Qt::ItemIsUserCheckable);
                            pItem->setCheckState(0, Qt::Unchecked);
                            pItem->setData(0, Qt::UserRole + 0, "port");
                            pItem->setData(0, Qt::UserRole + 1, viewName);
                            pItem->setData(0, Qt::UserRole + 2, portName);
                            vItem->addChild(pItem);
                        }
                    }
                }
                views_items.append(vItem);
            }
        }
        right->ui->treeSimViews->addTopLevelItems(views_items);
    }

    updateCustomPlot();
    right->ui->treeSimViews->blockSignals(oldBlockTree);

    thread->quit();
    thread->wait();
    delete thread;
    thread = 0;

    left->ui->runButton->setEnabled(true);


}
コード例 #10
0
ファイル: qcameradevice.cpp プロジェクト: TLARP/research
QCameraDevice::QCameraDevice(QObject *parent) : QObject(parent)
{
    m_capture = new cv::VideoCapture;

    m_timer = new QTimer(this);
    connect(m_timer, SIGNAL(timeout()), this, SLOT(onTimeout()));
}
コード例 #11
0
LogWindow::LogWindow(QWidget *parent) :
    QDockWidget(parent),
    ui(new Ui::LogWindow)
{
    QMutexLocker lock(&sMutex);
    if(sInstance != 0)
    {
        qFatal("Log Window cannot be instantiated more than once");
    }
    ui->setupUi(this);

    mLogFile.setFileName(QCoreApplication::applicationDirPath() + "/logfile.log");
    mLogFile.open(QFile::Append | QFile::Text | QIODevice::Unbuffered);
    mLogStream.setDevice(&mLogFile);

    ui->plainTextEdit->setMaximumBlockCount(200);
    mHighlighter = new LogSyntaxHighlighter(ui->plainTextEdit->document());

    addLogType(QtDebugMsg, tr("Debug"), "DBG", Qt::blue);
    addLogType(QtWarningMsg, tr("Warning"), "WRN", Qt::darkYellow);
    addLogType(QtCriticalMsg, tr("Error"), "ERR", Qt::red);
    addLogType(QtInfoMsg, tr("Info"), "INF", QColor(64, 64, 64));

    sInstance = this;
    mPreviousHandler = qInstallMessageHandler(&LogWindow::logMessage);
    mTimer.setSingleShot(true);
    mTimer.start(300);
    connect(&mTimer,SIGNAL(timeout()), SLOT(onTimeout()));
}
コード例 #12
0
ファイル: BeanImpl.cpp プロジェクト: SiteView/Lenovo
DiscoverRouterSoapOp::DiscoverRouterSoapOp(BeanImpl *bean, int timeout, const QString& mac)
    : m_bean(bean), m_timeout(timeout), m_mac(mac), m_count(0)
{
    connect(&m_timer, SIGNAL(timeout()), SLOT(onTimeout()));
    m_timer.setSingleShot(true);
    m_timer.setInterval(timeout);
}
コード例 #13
0
BooksSaveTimer::BooksSaveTimer(QObject* aParent) :
    QObject(aParent),
    iInactivityTimer(new QTimer(this)),
    iMandatarySaveTimer(new QTimer(this)),
    iSaveRequested(false)
{
    connect(qApp, SIGNAL(aboutToQuit()), SLOT(onAboutToQuit()));

    iInactivityTimer->setInterval(BOOKS_DEFAULT_INACTIVITY_TIMEOUT);
    iInactivityTimer->setSingleShot(true);
    connect(iInactivityTimer, SIGNAL(timeout()), SLOT(onTimeout()));

    iMandatarySaveTimer->setInterval(BOOKS_DEFAULT_MANDATORY_SAVE_TIMEOUT);
    iMandatarySaveTimer->setSingleShot(true);
    connect(iMandatarySaveTimer, SIGNAL(timeout()), SLOT(onTimeout()));
}
コード例 #14
0
OftServer::OftServer(quint16 port) :
	m_port(port)
{
	m_timer.setInterval(FILETRANSFER_WAITING_TIMEOUT);
	m_timer.setSingleShot(true);
	connect(&m_timer, SIGNAL(timeout()), SLOT(onTimeout()));
}
コード例 #15
0
void AMMessageBoxWTimeout::onTimeout() {
    timeoutCountdownTimer_->stop();

    disconnect(timeoutCountdownTimer_, SIGNAL(timeout()), this, SLOT(onTimeoutCountdown()));
    disconnect(timeoutTimer_, SIGNAL(timeout()), this, SLOT(onTimeout()));
    QMessageBox::defaultButton()->click();
}
コード例 #16
0
QXmppIncomingClient::QXmppIncomingClient (QSslSocket *socket, const QString &domain, QObject *parent)
    : QXmppStream (parent)
{
    bool check;
    Q_UNUSED (check);

    d = new QXmppIncomingClientPrivate (this);
    d->domain = domain;

    if (socket)
    {
        check = connect (socket, SIGNAL (disconnected()),
                         this, SLOT (onSocketDisconnected()));
        Q_ASSERT (check);

        setSocket (socket);
    }

    info (QString ("Incoming client connection from %1").arg (d->origin()));

    // create inactivity timer
    d->idleTimer = new QTimer (this);
    d->idleTimer->setSingleShot (true);
    check = connect (d->idleTimer, SIGNAL (timeout()),
                     this, SLOT (onTimeout()));
    Q_ASSERT (check);
}
コード例 #17
0
ファイル: DialerWidget.cpp プロジェクト: ddksaku/sip-client
DialerWidget::DialerWidget(QWidget *parent) : QDialog(parent), layout(LAYOUT_123)
{
    setupUi(this);

    timer = new QTimer(this);
    timer->setSingleShot(true);
    timer->setInterval(1000);
    connect(timer, SIGNAL(timeout()), this, SLOT(onTimeout()));
    currentButton = 0;
    currentCharacter = 0;

    buttonsLayout[LAYOUT_123][0] = "0";
    buttonsLayout[LAYOUT_123][1] = "1";
    buttonsLayout[LAYOUT_123][2] = "2";
    buttonsLayout[LAYOUT_123][3] = "3";
    buttonsLayout[LAYOUT_123][4] = "4";
    buttonsLayout[LAYOUT_123][5] = "5";
    buttonsLayout[LAYOUT_123][6] = "6";
    buttonsLayout[LAYOUT_123][7] = "7";
    buttonsLayout[LAYOUT_123][8] = "8";
    buttonsLayout[LAYOUT_123][9] = "9";
    buttonsLayout[LAYOUT_123][10] = "ABC";

    buttonsLayout[LAYOUT_ABC][0] = "space";
    buttonsLayout[LAYOUT_ABC][1] = "*#@";
    buttonsLayout[LAYOUT_ABC][2] = "abc";
    buttonsLayout[LAYOUT_ABC][3] = "def";
    buttonsLayout[LAYOUT_ABC][4] = "ghi";
    buttonsLayout[LAYOUT_ABC][5] = "jkl";
    buttonsLayout[LAYOUT_ABC][6] = "mno";
    buttonsLayout[LAYOUT_ABC][7] = "pqrs";
    buttonsLayout[LAYOUT_ABC][8] = "tuv";
    buttonsLayout[LAYOUT_ABC][9] = "wxyz";
    buttonsLayout[LAYOUT_ABC][10] = "123";
}
コード例 #18
0
SmppClient::SmppClient(const QString &smppUserName, const QString &smppPassword, QObject *parent) :
    QObject(parent),
    m_transport(new QTcpSocket(this)),
    m_timer(new QTimer(this)),
    m_timerForEnquireLink(new QTimer(this)),
    m_smppUserName(smppUserName),
    m_smppPassword(smppPassword)
{
    static bool firstTime = true;
    if (firstTime) {
        firstTime = false;
        qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError");
        qRegisterMetaType<SmppClient::SmsStates>("SmppClient::SmsStates");
        qRegisterMetaType<SmppClient::DisconnectReason>("SmppClient::DisconnectReason");
    }
    m_timerForEnquireLink->setInterval(EnquireLinkInterval);
    connect(m_transport, SIGNAL(readyRead()),
            this, SLOT(onReadyRead()));
    connect(m_transport, SIGNAL(connected()),
            this, SLOT(onConnected()));
    connect(m_transport, SIGNAL(disconnected()),
            this, SLOT(onDisconnected()));
    connect(m_transport, SIGNAL(error(QAbstractSocket::SocketError)),
            this, SLOT(onError(QAbstractSocket::SocketError)));

    connect(m_timer, SIGNAL(timeout()),
            this, SLOT(onTimeout()));

    connect(m_timerForEnquireLink, SIGNAL(timeout()),
            this, SLOT(onEnquireLinkTimeout()));
}
コード例 #19
0
ファイル: ToyMetro.cpp プロジェクト: zoombapup/OSCWidgets
ToyMetroGrid::ToyMetroGrid(Client *pClient, QWidget *parent, Qt::WindowFlags flags)
	: ToyGrid(TOY_METRO_GRID, pClient, parent, flags)
{
	m_Timer = new QTimer(this);
	connect(m_Timer, SIGNAL(timeout()), this, SLOT(onTimeout()));

	m_Play = new FadeButton(this);
	m_Play->setText( tr("Play All") );
	m_Play->resize( m_Play->sizeHint() );
	connect(m_Play, SIGNAL(clicked(bool)), this, SLOT(onPlayClicked(bool)));

	m_Pause = new FadeButton(this);
	m_Pause->setText( tr("Pause All") );
	connect(m_Pause, SIGNAL(clicked(bool)), this, SLOT(onPauseClicked(bool)));

	m_ReCenter = new FadeButton(this);
	m_ReCenter->setText( tr("Reset All") );
	connect(m_ReCenter, SIGNAL(clicked(bool)), this, SLOT(onReCenterClicked(bool)));

	m_Fan = new FadeButton(this);
	m_Fan->setText( tr("Fan") );
	connect(m_Fan, SIGNAL(clicked(bool)), this, SLOT(onFanClicked(bool)));

	StartTimer();
}
コード例 #20
0
ファイル: lineedit.cpp プロジェクト: EQ4/airwave
LineEdit::LineEdit(QWidget* parent) :
	QLineEdit(parent),
	hasButton_(false),
	button_(new QToolButton(this)),
	buttonStyle_(kNormal),
	isAutoClearMode_(false),
	prefixColor_(qApp->palette().text().color()),
	suffixColor_(qApp->palette().text().color())
{
	button_->hide();
	button_->setCursor(Qt::ArrowCursor);
	button_->setToolButtonStyle(Qt::ToolButtonIconOnly);
	button_->setFocusPolicy(Qt::NoFocus);

	connect(button_,
			SIGNAL(clicked()),
			SLOT(onButtonClicked()));

	connect(this,
			SIGNAL(textChanged(QString)),
			SLOT(onTextChanged()));

	timer_.setInterval(200);
	timer_.setSingleShot(true);

	connect(&timer_,
			SIGNAL(timeout()),
			SLOT(onTimeout()));
}
コード例 #21
0
ファイル: ThreadQueue.cpp プロジェクト: CSanshulgandhi/rhodes
void CThreadQueue::run()
{
    if(__rhoCurrentCategory.getName() == "NO_LOGGING")
		m_logThreadId = getThreadID();

	LOG(INFO) + "Starting main routine...";

	int nLastPollInterval = getLastPollInterval();
	while( !isStopping() )
	{
        unsigned int nWait = m_nPollInterval > 0 ? m_nPollInterval : QUEUE_POLL_INTERVAL_INFINITE;

        if ( m_nPollInterval > 0 && nLastPollInterval > 0 )
        {
            int nWait2 = m_nPollInterval - nLastPollInterval;
            if ( nWait2 <= 0 )
                nWait = QUEUE_STARTUP_INTERVAL_SECONDS;
            else
                nWait = nWait2;
        }

        if ( !m_bNoThreaded && !isStopping() && isNoCommands() )
		{
            LOG(INFO) + "ThreadQueue blocked for " + nWait + " seconds...";
            if ( wait(nWait*1000) == 1 )
                onTimeout();
        }
        nLastPollInterval = 0;

        if ( !m_bNoThreaded && !isStopping() )
    		processCommands();
	}

    LOG(INFO) + "Thread shutdown";
}
コード例 #22
0
void TimeoutController::runTimeouts(TimePoint time) {
  auto now = Clock::now();
  // Make sure we don't skip some events if function was run before actual time.
  if (time < now) {
    time = now;
  }
  if (nextTimeout_ > time) {
    return;
  }

  nextTimeout_ = TimePoint::max();

  for (auto& bucket : timeoutHandleBuckets_) {
    auto& list = bucket.second;

    for (auto it = list.begin(); it != list.end();) {
      if (it->timeout_ > time) {
        nextTimeout_ = std::min(nextTimeout_, it->timeout_);
        break;
      }

      it->onTimeout();
      it = list.erase(it);
    }
  }

  if (nextTimeout_ != TimePoint::max()) {
    scheduleRun();
  }
}
コード例 #23
0
void
AsfStrategy::afterReceiveNack(const Face& inFace, const lp::Nack& nack,
                              const shared_ptr<pit::Entry>& pitEntry)
{
  NFD_LOG_DEBUG("Nack for " << nack.getInterest() << " from=" << inFace.getId() << ": " << nack.getReason());
  onTimeout(pitEntry->getName(), inFace.getId());
}
コード例 #24
0
ファイル: reporter.cpp プロジェクト: buf1024/x-coll
void Reporter::initReporter()
{
    timer = new QTimer(this);
    udpSocket = new QUdpSocket(this);
    
    Setting& setting = Setting::instance();
    
    hostDesc = setting.getHostDesc();
    timeInterval = setting.getBroadcastTimeValue();
    broadcastPort = setting.getBroadcastPort();
    listenPort = setting.getListenPort();
    
    getHostIp();

    timer->setInterval(timeInterval*1000);

    connect(&setting, SIGNAL(hostDescriptionChanged(const QString&)),
        this, SLOT(onHostDescChanged(const QString&)));
    connect(&setting, SIGNAL(broadcastTimaeValueChanged(int)),
        this, SLOT(onTimerChanged(int)));
    connect(&setting, SIGNAL(broadcastPortChanged(int)),
        this, SLOT(onBroadcastPortChanged(int)));

    connect(timer, SIGNAL(timeout()), this, SLOT(onTimeout()));

    stopThread = false;

    timer->start();

}
コード例 #25
0
ファイル: request-injection-data.cpp プロジェクト: bd808/hhvm
void RequestTimer::setTimeout(int seconds) {
  m_timeoutSeconds = seconds > 0 ? seconds : 0;

  cancelTimerSource();

  if (!m_timeoutSeconds) {
    return;
  }

  dispatch_queue_t q =
    dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
  m_timerSource = dispatch_source_create(
    DISPATCH_SOURCE_TYPE_TIMER, 0, DISPATCH_TIMER_STRICT, q);

  dispatch_time_t t =
    dispatch_time(DISPATCH_TIME_NOW, m_timeoutSeconds * NSEC_PER_SEC);
  dispatch_source_set_timer(m_timerSource, t, DISPATCH_TIME_FOREVER, 0);

  // Use the timer group as a semaphore. When the source is cancelled,
  // libdispatch will make sure all pending event handlers have finished before
  // invoking the cancel handler. This means that if we cancel the source and
  // then wait on the timer group, when we are done waiting, we know the source
  // is completely done and it's safe to free memory (e.g., in the destructor).
  // See cancelTimerSource() above.
  dispatch_group_enter(m_timerGroup);
  dispatch_source_set_event_handler(m_timerSource, ^{
    onTimeout();

    // Cancelling ourselves isn't needed for correctness, but we can go ahead
    // and do it now instead of waiting on it later, so why not. (Also,
    // getRemainingTime does use this opportunistically, but it's best effort.)
    dispatch_source_cancel(m_timerSource);
  });
コード例 #26
0
void tst_JsonRpcConnection::init()
{
    mIODevice = 0;
    mConnection = 0;
    
    QTimer::singleShot(10000, this, SLOT(onTimeout()));
}
コード例 #27
0
ファイル: autofindpath.cpp プロジェクト: Ji-Yuhang/maze
AutoFindPath::AutoFindPath(QObject *parent) : QObject(parent)
{
    pace_ = 5;
    radius_ = pace_ - 1;
    timer_.setInterval(40);
    connect(&timer_, SIGNAL(timeout()), this, SLOT(onTimeout()));

}
コード例 #28
0
DBusAsyncResponse::DBusAsyncResponse(QObject* parent)
    : QObject(parent)
    , m_autodelete(false)
{
    m_timeout.setSingleShot(true);
    m_timeout.setInterval(15000);
    connect(&m_timeout, SIGNAL(timeout()), this, SLOT(onTimeout()));
}
コード例 #29
0
ファイル: RegFinishDlg.cpp プロジェクト: bugou/test
void CRegFinishDlg::onHostFound(struct in_addr &addr)
{
	if (addr.s_addr != INADDR_NONE) {
		CRegWizard *wiz = (CRegWizard *) GetParent();
		getUdpSession()->connect(inet_ntoa(addr), wiz->networkDlg.m_port);
	} else
		onTimeout();
}
コード例 #30
0
ファイル: RegFinishDlg.cpp プロジェクト: bugou/test
void CRegFinishDlg::onSendError(uint32 seq)
{
	CRegWizard *wiz = (CRegWizard *) GetParent();

	if (!wiz->isFinished)
		onTimeout();
	else
		onSuccess();
}