Example #1
0
SslConnector::SslConnector(const SslSocket& s,
                                 Poller::shared_ptr poller,
                                 std::string hostname,
                                 std::string port,
                                 ConnectedCallback connCb,
                                 FailedCallback failCb) :
    DispatchHandle(s,
                   0,
                   boost::bind(&SslConnector::connComplete, this, _1),
                   boost::bind(&SslConnector::connComplete, this, _1)),
    connCallback(connCb),
    failCallback(failCb),
    socket(s)
{
    //TODO: would be better for connect to be performed on a
    //non-blocking socket, but that doesn't work at present so connect
    //blocks until complete
    try {
        socket.connect(hostname, port);
        socket.setNonblocking();
        startWatch(poller);
    } catch(std::exception& e) {
        failure(-1, std::string(e.what()));
    }
}
Example #2
0
int main()
{
    DigitalStopWatchPtr watch =  createWatch();
    startWatch(watch);
    stopWatch(watch);
    destroyWatch(watch);
    return 0;
}
Example #3
0
void MainWindow::on_autoSyn_stateChanged(int arg1)
{
    // 选中自动同步
    autoSyn = (arg1 == 0) ? false : true;
    enableInput(!autoSyn);
    // 停止监听
    if(arg1 == 0)
    {
        stopWatch();
    }
    else
    {
        startWatch();
    }
}
KLinPopup::KLinPopup()
	: KMainWindow( 0, "KLinPopup" ),
	  m_view(new KLinPopupView(this)), watcher(0),
	  unreadMessages(0), hasInotify(true)
{
	setFocusPolicy(QWidget::StrongFocus);

	// tell the KMainWindow that this is indeed the main widget
	setCentralWidget(m_view);

	// then, setup our actions
	setupActions();

	// apply the saved mainwindow settings, if any, and ask the mainwindow
	// to automatically save settings if changed: window size, toolbar
	// position, icon size, etc.
	setAutoSaveSettings();

	cfg = KGlobal::config();
	readConfig();

	initSystemTray();

	// allow the view to change the statusbar and caption
	connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)),
			this,   SLOT(changeStatusbar(const QString&)));
	connect(m_view, SIGNAL(signalChangeCaption(const QString&)),
			this,   SLOT(changeCaption(const QString&)));


	updateStats();
	checkSmbclientBin();

	messageList.setAutoDelete(true);

	// use a timer to finish the constructor ASAP
	QTimer *watchTimer = new QTimer(this);
	connect(watchTimer, SIGNAL(timeout()), this, SLOT(startWatch()));
	watchTimer->start(1, true);
}
Example #5
0
void AsynchConnector::start(Poller::shared_ptr poller)
{
    startWatch(poller);
}