void mainWindow::buildGUI() { QPushButton *button; QVBoxLayout *layout = new QVBoxLayout; button = new QPushButton(tr(" Enable Publish ")); button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); layout->addWidget(button); layout->setAlignment(button, Qt::AlignHCenter); connect(button, SIGNAL(clicked()), this, SLOT(startPublish())); button = new QPushButton(tr(" Disable Publish ")); button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); layout->addWidget(button); layout->setAlignment(button, Qt::AlignHCenter); connect(button, SIGNAL(clicked()), this, SLOT(stopPublish())); table.verticalHeader()->hide(); table.horizontalHeader()->hide(); table.setColumnCount(2); layout->addWidget(&table); //table.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); QWidget *widget = new QWidget; widget->setLayout(layout); setCentralWidget(widget); show(); }
void PeerDiscovery::DomainPeerDiscovery::stop() { { std::unique_lock<std::mutex> lck(dmtx_); stopDiscovery(); } { std::unique_lock<std::mutex> lck(mtx_); stopPublish(); } }
bool PeerDiscovery::DomainPeerDiscovery::stopPublish(const std::string &type) { std::lock_guard<std::mutex> lck(mtx_); if (messages_.erase(type) > 0) { if (messages_.empty()) stopPublish(); else messages_reload(); return true; } return false; }