GlobalChildMainWindow::GlobalChildMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::GlobalChildMainWindow) { ui->setupUi(this); m_thread = new CZmqThread(); //m_thread->set_host("tcp://localhost:5556"); //m_thread->init_socket(); //m_thread->start(); QObject::connect(m_thread, SIGNAL(have_data(QString)), this, SLOT(update_new_json(QString))); m_stats.clear(); // rx_stats.clear(); // read template QFile file(":/resource/b.html"); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){ qDebug()<<"error"; return; } QTextStream in(&file); m_global_html_tp = in.readAll(); file.close(); ui->pbCpu->setValue(0.0); }
void CZmqThread::do_pool() { QString s; int rc=0; //init_socket(); rc=block_rcv_socket(s); if (rc==0) { emit have_data(s); } }
void MySocket::idle() { if (have_data()) return; if (pauseTime == 0) return; time_t now; time(&now); if (now > pauseTime) return; pauseTime = 0; if (notify) notify->write_ready(); }