void ExplorerTreeView::openPropertyServerDialog() { QModelIndex sel = selectedIndex(); if(!sel.isValid()){ return; } ExplorerServerItem *node = common::utils_qt::item<ExplorerServerItem*>(sel); if(!node){ return; } IServerSPtr server = node->server(); if(!server){ return; } PropertyServerDialog infDialog(QString("%1 properties").arg(server->name()), server->type(), this); VERIFY(connect(server.get(), &IServer::startedLoadServerProperty, &infDialog, &PropertyServerDialog::startServerProperty)); VERIFY(connect(server.get(), &IServer::finishedLoadServerProperty, &infDialog, &PropertyServerDialog::finishServerProperty)); VERIFY(connect(server.get(), &IServer::startedChangeServerProperty, &infDialog, &PropertyServerDialog::startServerChangeProperty)); VERIFY(connect(server.get(), &IServer::finishedChangeServerProperty, &infDialog, &PropertyServerDialog::finishServerChangeProperty)); VERIFY(connect(&infDialog, &PropertyServerDialog::changedProperty, server.get(), &IServer::changeProperty)); VERIFY(connect(&infDialog, &PropertyServerDialog::showed, server.get(), &IServer::serverProperty)); infDialog.exec(); }
void ExplorerTreeView::openHistoryServerDialog() { QModelIndex sel = selectedIndex(); if(!sel.isValid()){ return; } ExplorerServerItem *node = common::utils_qt::item<ExplorerServerItem*>(sel); if(!node){ return; } IServerSPtr server = node->server(); if(!server){ return; } ServerHistoryDialog histDialog(QString("%1 history").arg(server->name()), server->type(), this); VERIFY(connect(server.get(), &IServer::startedLoadServerHistoryInfo, &histDialog, &ServerHistoryDialog::startLoadServerHistoryInfo)); VERIFY(connect(server.get(), &IServer::finishedLoadServerHistoryInfo, &histDialog, &ServerHistoryDialog::finishLoadServerHistoryInfo)); VERIFY(connect(server.get(), &IServer::serverInfoSnapShoot, &histDialog, &ServerHistoryDialog::snapShotAdd)); VERIFY(connect(&histDialog, &ServerHistoryDialog::showed, server.get(), &IServer::requestHistoryInfo)); histDialog.exec(); }
void ExplorerTreeView::shutdownServer() { QModelIndex sel = selectedIndex(); if(!sel.isValid()){ return; } ExplorerServerItem *node = common::utils_qt::item<ExplorerServerItem*>(sel); if(!node){ return; } IServerSPtr server = node->server(); if(server && server->isConnected()){ // Ask user int answer = QMessageBox::question(this, "Shutdown", QString("Really shutdown \"%1\" server?").arg(server->name()), QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton); if (answer != QMessageBox::Yes){ return; } server->shutDown(); } }
void ExplorerTreeView::openMaxClientSetDialog() { QModelIndex sel = selectedIndex(); if(!sel.isValid()){ return; } ExplorerServerItem *node = common::utils_qt::item<ExplorerServerItem*>(sel); if(!node){ return; } IServerSPtr server = node->server(); if(!server){ return; } bool ok; int maxcl = QInputDialog::getInt(this, tr("Set max connection on %1 server").arg(server->name()), tr("Maximum connection:"), 10000, 1, INT32_MAX, 100, &ok); if(ok){ server->setMaxConnection(maxcl); } }