/// \brief call this function when connection button is clicked void MainWindow::on_pushButtonConnect_clicked() { if(isConnected) { Disconnect(); updateConnectButton(); } else { Connect(); updateConnectButton(); } }
ConnectionEditor::ConnectionEditor(QWidget* parent, QObject* sndr, QObject* rcvr, FormWindow* fw) : ConnectionEditorBase(parent, 0, true), m_formWindow(fw) { if (!rcvr || rcvr == m_formWindow) rcvr = m_formWindow->mainContainer(); if (!sndr || sndr == m_formWindow) sndr = m_formWindow->mainContainer(); m_sender = sndr; m_receiver = rcvr; /* Create widget list */ QStringList lst; lst << m_formWindow->name(); for (QPtrDictIterator<QWidget> it(*m_formWindow->widgets()); it.current(); ++it) { if (it.current()->isVisibleTo(this) && !it.current()->inherits("QLayoutWidget") && !it.current()->inherits("Spacer") && qstrcmp(it.current()->name(), "central widget") && !m_formWindow->isMainContainer(it.current()) && !lst.contains(it.current()->name())) lst << it.current()->name(); } // Fill receiver combos with widget list // fillWidgetList(comboReceiver, lst, m_receiver->name()); // Fill receiver combos with widget and action list for (QPtrListIterator<QAction> it(m_formWindow->actionList()); it.current(); ++it) lst << it.current()->name(); lst.sort(); fillWidgetList(comboReceiver, lst, m_receiver->name()); fillWidgetList(comboSender, lst, m_sender->name()); senderChanged(m_sender->name()); fillConnectionsList(); updateConnectButton(); updateDisconnectButton(); // Connections connect(comboSender, SIGNAL(activated(const QString&)), SLOT(senderChanged(const QString&))); connect(comboReceiver, SIGNAL(activated(const QString&)), SLOT(receiverChanged(const QString&))); connect(signalBox, SIGNAL(selectionChanged()), SLOT(updateConnectButton())); connect(slotBox, SIGNAL(selectionChanged()), SLOT(updateConnectButton())); connect(connectButton, SIGNAL(clicked()), SLOT(connectClicked())); connect(disconnectButton, SIGNAL(clicked()), SLOT(disconnectClicked())); connect(okButton, SIGNAL(clicked()), SLOT(okClicked())); connect(cancelButton, SIGNAL(clicked()), SLOT(cancelClicked())); connect(signalBox, SIGNAL(doubleClicked(QListBoxItem*)), SLOT(connectClicked())); connect(slotBox, SIGNAL(doubleClicked(QListBoxItem*)), SLOT(connectClicked())); }
void ConnectionEditor::disconnectClicked() { QListViewItem *p_item = connectionView->currentItem(); if (!p_item) return; QMap <QListViewItem*, MetaDataBase::Connection>::Iterator it = m_connections.find(p_item); if (it != m_connections.end()) m_connections.remove(it); delete p_item; if (connectionView->currentItem()) connectionView->setSelected(connectionView->currentItem(), true); updateConnectButton(); updateDisconnectButton(); }
void ConnectionEditor::receiverChanged(const QString& s) { QObject* p_object = objectByName(s); if (!p_object) return; m_receiver = p_object; int n = m_receiver->metaObject()->numSlots(true); slotBox->clear(); for (int i = 0; i < n; ++i) { const QMetaData* md = m_receiver->metaObject()->slot(i, true); if (!isSlotIgnored(md) && !slotBox->findItem(md->name, Qt::ExactMatch)) slotBox->insertItem(md->name); } slotBox->sort(); slotBox->setCurrentItem(slotBox->firstItem()); updateConnectButton(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); updateConnectButton(); updateSendButton(); m_connectionTimeout.setInterval(5000); m_connectionTimeout.setSingleShot(true); connect(&m_connectionTimeout, SIGNAL(timeout()), this, SLOT(onConnectTimeout())); ChatInputSendFilter * sendFilter = new ChatInputSendFilter(this); connect(sendFilter, SIGNAL(sendPressed()), this, SLOT(on_sendButton_clicked())); ui->sayLineEdit->installEventFilter(sendFilter); connect(ui->actionSave_chat_as_HTML_page, SIGNAL(triggered(bool)), this, SLOT(onSaveChat())); }
void RemoteManager::on_hosts_itemSelectionChanged() { ui->addUpdateHost->setText(tr("Add")); ui->addUpdateHost->setEnabled(true); ui->deleteHost->setEnabled(false); ui->refreshOne->setEnabled(false); ui->hostname->setEnabled(true); ui->runCommand->setEnabled(true); RDTreeWidgetItem *item = ui->hosts->selectedItem(); RemoteHost *host = item ? getRemoteHost(item) : NULL; ui->runCommand->setText(QString()); if(host) { if(ui->refreshAll->isEnabled()) ui->refreshOne->setEnabled(true); ui->runCommand->setText(host->runCommand); ui->hostname->setText(host->Name()); ui->addUpdateHost->setText(tr("Update")); if(host->IsLocalhost() || host->IsADB()) { // localhost and android hosts cannot be updated or have their run command changed ui->addUpdateHost->setEnabled(false); ui->runCommand->setEnabled(false); } else { // any other host can be deleted ui->deleteHost->setEnabled(true); } } updateConnectButton(); }
// don't allow the user to refresh until all pending connections have been checked // (to stop flooding) void RemoteManager::updateStatus() { if(m_Lookups.available() == 0) { ui->refreshOne->setEnabled(true); ui->refreshAll->setEnabled(true); for(RDTreeWidgetItem *item : m_QueuedDeletes) deleteItemAndHost(item); m_QueuedDeletes.clear(); // if the external ref is gone now, we can delete ourselves if(m_ExternalRef.available() == 0) { deleteLater(); return; } } updateConnectButton(); updateLookupsStatus(); }
void MainWindow::changeConnectionState(ConnectionState newState) { if(m_connectionState != newState) { m_connectionState = newState; updateConnectButton(); updateSendButton(); if(newState == ConnectionState::Connecting) { m_connectionTimeout.start(); } else { m_connectionTimeout.stop(); if(newState == ConnectionState::Disconnected) { cleanup(); } } } }
void RemoteManager::on_connect_clicked() { RDTreeWidgetItem *node = ui->hosts->selectedItem(); if(!node) return; RemoteConnect connect = getRemoteConnect(node); RemoteHost *host = getRemoteHost(node); if(connect.ident > 0) { connectToApp(node); } else if(host) { if(host->serverRunning) { QMessageBox::StandardButton res = RDDialog::question( this, tr("Remote server shutdown"), tr("Are you sure you wish to shut down running remote server on %1?").arg(host->Name()), RDDialog::YesNoCancel); if(res == QMessageBox::Cancel || res == QMessageBox::No) return; // shut down if(host->connected) { m_Ctx.Replay().ShutdownServer(); setRemoteServerLive(node, false, false); } else { IRemoteServer *server = NULL; ReplayStatus status = RENDERDOC_CreateRemoteServerConnection(host->hostname.c_str(), 0, &server); if(server) server->ShutdownServerAndConnection(); setRemoteServerLive(node, false, false); if(status != ReplayStatus::Succeeded) RDDialog::critical(this, tr("Shutdown error"), tr("Error shutting down remote server: %1").arg(ToQStr(status))); } updateConnectButton(); } else { // try to run ui->refreshOne->setEnabled(false); ui->refreshAll->setEnabled(false); m_Lookups.release(); LambdaThread *th = new LambdaThread([this, node]() { runRemoteServer(node); }); th->selfDelete(true); th->start(); updateLookupsStatus(); } } }
void MainWindow::on_nameLineEdit_textChanged(const QString & text) { Q_UNUSED(text); updateConnectButton(); }