//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimOilFieldEntry::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { if (changedField == &selected) { updateEnabledState(); } }
void InputWidget::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) { QItemSelectionRange changedArea(topLeft, bottomRight); if (changedArea.contains(selectionModel()->currentIndex())) { updateEnabledState(); } };
void InputWidget::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { BufferId currentBufferId = current.data(NetworkModel::BufferIdRole).value<BufferId>(); BufferId previousBufferId = previous.data(NetworkModel::BufferIdRole).value<BufferId>(); if (_perChatHistory) { //backup historyMap[previousBufferId].history = inputLine()->history(); historyMap[previousBufferId].tempHistory = inputLine()->tempHistory(); historyMap[previousBufferId].idx = inputLine()->idx(); historyMap[previousBufferId].inputLine = inputLine()->html(); //restore inputLine()->setHistory(historyMap[currentBufferId].history); inputLine()->setTempHistory(historyMap[currentBufferId].tempHistory); inputLine()->setIdx(historyMap[currentBufferId].idx); inputLine()->setHtml(historyMap[currentBufferId].inputLine); inputLine()->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); // FIXME this really should be in MultiLineEdit (and the const int on top removed) QTextBlockFormat format = inputLine()->textCursor().blockFormat(); format.setLeftMargin(leftMargin); // we want a little space between the frame and the contents inputLine()->textCursor().setBlockFormat(format); } NetworkId networkId = current.data(NetworkModel::NetworkIdRole).value<NetworkId>(); if (networkId == _networkId) return; setNetwork(networkId); updateNickSelector(); updateEnabledState(); }
void Arc::markUsed(bool used) { static auto arcEnabler = [](Arc* a){ a->updateEnabledState(); }; if(used) { used_++; } else { if(used_ == 0) throw std::runtime_error("Cannot reduce use count of arc that is not used!"); used_--; } int count = used ? 1 : -1; if(type_ == Division) { if(used_) { if(dependsOnCellInNode_->getCellCount() != 1) throw std::runtime_error("Using division arc where mother cell does not contain exactly one cell"); if(dependsOnCellInNode_->getNumActiveDivisions() != 0) throw std::runtime_error("Using division arc where mother cell already has active divisions"); } dependsOnCellInNode_->increaseNumActiveDivisions(count); targetNode_->increaseNumUsedInArcs(count); dependsOnCellInNode_->visitObserverArcs(arcEnabler); dependsOnCellInNode_->visitOutArcs(arcEnabler); targetNode_->visitInArcs(arcEnabler); } else if(type_ == Move) { sourceNode_->increaseNumUsedOutArcs(count); targetNode_->increaseNumUsedInArcs(count); sourceNode_->visitOutArcs(arcEnabler); sourceNode_->visitObserverArcs(arcEnabler); targetNode_->visitInArcs(arcEnabler); } else if(type_ == Appearance) { targetNode_->visitInArcs(arcEnabler); } else if(type_ == Disappearance) { sourceNode_->visitOutArcs(arcEnabler); sourceNode_->visitObserverArcs(arcEnabler); } updateEnabledState(); // update swap arcs if any! visitObserverArcs(arcEnabler); }
void SslClient::setHostName(const QString &hostName) { if (m_hostName == hostName) return; m_hostName = hostName; emit hostNameChanged(); updateEnabledState(); }
void QgsAuthSslImportDialog::socketStateChanged( QAbstractSocket::SocketState state ) { if ( mExecErrorsDialog ) { return; } updateEnabledState(); if ( state == QAbstractSocket::UnconnectedState ) { leServer->setFocus(); destroySocket(); } }
SslClient::SslClient(QWidget *parent) : QWidget(parent), socket(0), padLock(0), executingDialog(false) { form = new Ui_Form; form->setupUi(this); form->hostNameEdit->setSelection(0, form->hostNameEdit->text().size()); form->sessionOutput->setHtml(tr("<not connected>")); connect(form->hostNameEdit, SIGNAL(textChanged(QString)), this, SLOT(updateEnabledState())); connect(form->connectButton, SIGNAL(clicked()), this, SLOT(secureConnect())); connect(form->sendButton, SIGNAL(clicked()), this, SLOT(sendData())); }
void SslClient::socketStateChanged(QAbstractSocket::SocketState state) { if (executingDialog) return; updateEnabledState(); if (state == QAbstractSocket::UnconnectedState) { form->sessionInput->clear(); form->hostNameEdit->setPalette(QPalette()); form->hostNameEdit->setFocus(); form->cipherLabel->setText(tr("<none>")); padLock->hide(); } }
//! [2] void SslClient::socketStateChanged(QAbstractSocket::SocketState state) { if (m_sslErrorControl->visible()) return; // We won't react to state changes while the SSL error dialog is visible updateEnabledState(); if (state == QAbstractSocket::UnconnectedState) { // If the SSL socket has been disconnected, we delete the socket m_cipher = "<none>"; emit cipherChanged(); m_socket->deleteLater(); m_socket = 0; } }
void SslClient::secureConnect() { if (!socket) { socket = new QSslSocket(this); connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(socketStateChanged(QAbstractSocket::SocketState))); connect(socket, SIGNAL(encrypted()), this, SLOT(socketEncrypted())); connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrors(QList<QSslError>))); connect(socket, SIGNAL(readyRead()), this, SLOT(socketReadyRead())); } socket->connectToHostEncrypted(form->hostNameEdit->text(), form->portBox->value()); updateEnabledState(); }
//! [1] void SslClient::secureConnect() { if (!m_socket) { // Create a new SSL socket and connect against its signals to receive notifications about state changes m_socket = new QSslSocket(this); connect(m_socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(socketStateChanged(QAbstractSocket::SocketState))); connect(m_socket, SIGNAL(encrypted()), this, SLOT(socketEncrypted())); connect(m_socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrors(QList<QSslError>))); connect(m_socket, SIGNAL(readyRead()), this, SLOT(socketReadyRead())); } // Trigger the SSL-handshake m_socket->connectToHostEncrypted(m_hostName, m_port); updateEnabledState(); }
void QgsAuthSslImportDialog::secureConnect() { if ( leServer->text().isEmpty() ) { return; } leServer->setStyleSheet( QLatin1String( "" ) ); clearStatusCertificateConfig(); if ( !mSocket ) { mSocket = new QSslSocket( this ); connect( mSocket, SIGNAL( stateChanged( QAbstractSocket::SocketState ) ), this, SLOT( socketStateChanged( QAbstractSocket::SocketState ) ) ); connect( mSocket, SIGNAL( connected() ), this, SLOT( socketConnected() ) ); connect( mSocket, SIGNAL( disconnected() ), this, SLOT( socketDisconnected() ) ); connect( mSocket, SIGNAL( encrypted() ), this, SLOT( socketEncrypted() ) ); connect( mSocket, SIGNAL( error( QAbstractSocket::SocketError ) ), this, SLOT( socketError( QAbstractSocket::SocketError ) ) ); connect( mSocket, SIGNAL( sslErrors( QList<QSslError> ) ), this, SLOT( sslErrors( QList<QSslError> ) ) ); connect( mSocket, SIGNAL( readyRead() ), this, SLOT( socketReadyRead() ) ); } mSocket->setCaCertificates( mTrustedCAs ); if ( !mTimer ) { mTimer = new QTimer( this ); connect( mTimer, SIGNAL( timeout() ), this, SLOT( destroySocket() ) ); } mTimer->start( spinbxTimeout->value() * 1000 ); mSocket->connectToHost( leServer->text(), spinbxPort->value() ); updateEnabledState(); }
void InputWidget::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) { QItemSelectionRange changedArea(topLeft, bottomRight); if (changedArea.contains(selectionModel()->currentIndex())) { updateEnabledState(); bool encrypted = false; IrcChannel *chan = qobject_cast<IrcChannel *>(Client::bufferModel()->data(selectionModel()->currentIndex(), NetworkModel::IrcChannelRole).value<QObject *>()); if (chan) encrypted = chan->encrypted(); IrcUser *user = qobject_cast<IrcUser *>(Client::bufferModel()->data(selectionModel()->currentIndex(), NetworkModel::IrcUserRole).value<QObject *>()); if (user) encrypted = user->encrypted(); if (encrypted) ui.encryptionIconLabel->show(); else ui.encryptionIconLabel->hide(); } }
void SslClient::setupUi() { if (form) return; form = new Ui_Form; form->setupUi(this); form->hostNameEdit->setSelection(0, form->hostNameEdit->text().size()); form->sessionOutput->setHtml(tr("<not connected>")); connect(form->hostNameEdit, SIGNAL(textChanged(QString)), this, SLOT(updateEnabledState())); connect(form->connectButton, SIGNAL(clicked()), this, SLOT(secureConnect())); connect(form->sendButton, SIGNAL(clicked()), this, SLOT(sendData())); padLock = new QToolButton; padLock->setIcon(QIcon(":/encrypted.png")); connect(padLock, SIGNAL(clicked()), this, SLOT(displayCertificateInfo())); #if QT_CONFIG(cursor) padLock->setCursor(Qt::ArrowCursor); #endif padLock->setToolTip(tr("Display encryption details.")); const int extent = form->hostNameEdit->height() - 2; padLock->resize(extent, extent); padLock->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored); QHBoxLayout *layout = new QHBoxLayout(form->hostNameEdit); layout->setMargin(form->hostNameEdit->style()->pixelMetric(QStyle::PM_DefaultFrameWidth)); layout->setSpacing(0); layout->addStretch(); layout->addWidget(padLock); form->hostNameEdit->setLayout(layout); padLock->hide(); }
Arc::Arc(Node* source, Node* target, Type type, const std::vector<double>& scoreDeltas, Node* dependsOnCellInNode, UserDataPtr data): IUserDataHolder(data), sourceNode_(source), targetNode_(target), type_(type), scoreDeltas_(scoreDeltas), currentScore_(scoreDeltas[0]), enabled_(true), used_(0), dependsOnCellInNode_(dependsOnCellInNode) { assert(source != nullptr); assert(target != nullptr); if(type_ == Dummy) { for(size_t d : scoreDeltas_) assert(d == 0.0); } sourceNode_->registerOutArc(this); targetNode_->registerInArc(this); if(dependsOnCellInNode_ != nullptr) { dependsOnCellInNode_->registerObserverArc(this); } updateEnabledState(); update(); }
ADVSyncViewManager::ADVSyncViewManager(AnnotatedDNAView* v) : QObject(v), adv(v) { assert(v->getSequenceContexts().isEmpty()); recursion = false; selectionRecursion = false; lockByStartPosAction = new QAction(tr("Lock scales: visible range start"), this); lockByStartPosAction->setObjectName("Lock scales: visible range start"); connect(lockByStartPosAction, SIGNAL(triggered()), SLOT(sl_lock())); lockByStartPosAction->setCheckable(true); lockBySeqSelAction = new QAction(tr("Lock scales: selected sequence"), this); lockBySeqSelAction->setObjectName("Lock scales: selected sequence"); connect(lockBySeqSelAction, SIGNAL(triggered()), SLOT(sl_lock())); lockBySeqSelAction->setCheckable(true); lockByAnnSelAction = new QAction(tr("Lock scales: selected annotation"), this); lockByAnnSelAction->setObjectName("Lock scales: selected annotation"); connect(lockByAnnSelAction, SIGNAL(triggered()), SLOT(sl_lock())); lockByAnnSelAction->setCheckable(true); lockActionGroup = new QActionGroup(this); lockActionGroup->addAction(lockByStartPosAction); lockActionGroup->addAction(lockBySeqSelAction); lockActionGroup->addAction(lockByAnnSelAction); lockActionGroup->setExclusive(true); syncByStartPosAction = new QAction(tr("Adjust scales: visible range start"), this); syncByStartPosAction->setObjectName("Adjust scales: visible range start"); connect(syncByStartPosAction, SIGNAL(triggered()), SLOT(sl_sync())); syncBySeqSelAction = new QAction(tr("Adjust scales: selected sequence"), this); syncBySeqSelAction->setObjectName("Adjust scales: selected sequence"); connect(syncBySeqSelAction, SIGNAL(triggered()), SLOT(sl_sync())); syncByAnnSelAction = new QAction(tr("Adjust scales: selected annotation"), this); syncByAnnSelAction->setObjectName("Adjust scales: selected annotation"); connect(syncByAnnSelAction, SIGNAL(triggered()), SLOT(sl_sync())); lockMenu = new QMenu(tr("Lock scales")); lockMenu->setIcon(QIcon(":core/images/lock_scales.png")); lockMenu->addActions(lockActionGroup->actions()); syncMenu = new QMenu(tr("Adjust scales")); syncMenu->setIcon(QIcon(":core/images/sync_scales.png")); syncMenu->addAction(syncByStartPosAction); syncMenu->addAction(syncBySeqSelAction); syncMenu->addAction(syncByAnnSelAction); lockButton = new QToolButton(); lockButton->setObjectName("Lock scales"); lockButton->setCheckable(true); connect(lockButton, SIGNAL(clicked()), SLOT(sl_lock())); lockButton->setDefaultAction(lockMenu->menuAction()); lockButton->setCheckable(true); syncButton = new QToolButton(); syncButton->setObjectName("Adjust scales"); connect(syncButton, SIGNAL(clicked()), SLOT(sl_sync())); syncButton->setDefaultAction(syncMenu->menuAction()); lockButtonTBAction = NULL; syncButtonTBAction = NULL; // auto-annotations highlighting ops toggleAutoAnnotationsMenu = new QMenu("Global automatic annotation highlighting"); toggleAutoAnnotationsMenu->setIcon(QIcon(":core/images/predefined_annotation_groups.png")); connect( toggleAutoAnnotationsMenu, SIGNAL(aboutToShow()), SLOT(sl_updateAutoAnnotationsMenu()) ); toggleAutoAnnotationsButton = new QToolButton(); toggleAutoAnnotationsButton->setObjectName("toggleAutoAnnotationsButton"); toggleAutoAnnotationsButton->setDefaultAction(toggleAutoAnnotationsMenu->menuAction()); toggleAutoAnnotationsButton->setPopupMode(QToolButton::InstantPopup); toggleAutoAnnotationsAction = NULL; // visual mode ops toggleAllAction = new QAction("Toggle All sequence views", this); toggleAllAction->setObjectName("toggleAllSequenceViews"); connect(toggleAllAction, SIGNAL(triggered()), SLOT(sl_toggleVisualMode())); toggleOveAction = new QAction("Toggle Overview", this); toggleOveAction->setObjectName("toggleOverview"); connect(toggleOveAction, SIGNAL(triggered()), SLOT(sl_toggleVisualMode())); togglePanAction = new QAction("Toggle Zoom view", this); togglePanAction->setObjectName("toggleZoomView"); connect(togglePanAction, SIGNAL(triggered()), SLOT(sl_toggleVisualMode())); toggleDetAction = new QAction("Toggle Details view", this); toggleDetAction->setObjectName("toggleDetailsView"); connect(toggleDetAction, SIGNAL(triggered()), SLOT(sl_toggleVisualMode())); toggleViewButtonAction = NULL; toggleViewButtonMenu = new QMenu(tr("Toggle views")); toggleViewButtonMenu->setIcon(QIcon(":core/images/adv_widget_menu.png")); toggleViewButtonMenu->addAction(toggleAllAction); //-> behavior can be not clear to user toggleViewButtonMenu->addAction(toggleOveAction); toggleViewButtonMenu->addAction(togglePanAction); toggleViewButtonMenu->addAction(toggleDetAction); connect(toggleViewButtonMenu, SIGNAL(aboutToShow()), SLOT(sl_updateVisualMode())); toggleViewButton = new QToolButton(); toggleViewButton->setObjectName("toggleViewButton"); toggleViewButton->setDefaultAction(toggleViewButtonMenu->menuAction()); toggleViewButton->setPopupMode(QToolButton::InstantPopup); updateEnabledState(); connect(adv, SIGNAL(si_sequenceWidgetAdded(ADVSequenceWidget*)), SLOT(sl_sequenceWidgetAdded(ADVSequenceWidget*))); connect(adv, SIGNAL(si_sequenceWidgetRemoved(ADVSequenceWidget*)), SLOT(sl_sequenceWidgetRemoved(ADVSequenceWidget*))); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimOilFieldEntry::initAfterRead() { updateEnabledState(); }
void SslClient::secureConnect() { socket->connectToHostEncrypted(form->hostNameEdit->text(), form->portBox->value()); updateEnabledState(); }
QgsAuthSslImportDialog::QgsAuthSslImportDialog( QWidget *parent ) : QDialog( parent ) , mSocket( nullptr ) , mExecErrorsDialog( false ) , mTimer( nullptr ) , mSslErrors( QList<QSslError>() ) , mTrustedCAs( QList<QSslCertificate>() ) , mAuthNotifyLayout( nullptr ) , mAuthNotify( nullptr ) { if ( QgsAuthManager::instance()->isDisabled() ) { mAuthNotifyLayout = new QVBoxLayout; this->setLayout( mAuthNotifyLayout ); mAuthNotify = new QLabel( QgsAuthManager::instance()->disabledMessage(), this ); mAuthNotifyLayout->addWidget( mAuthNotify ); } else { setupUi( this ); QStyle *style = QApplication::style(); lblWarningIcon->setPixmap( style->standardIcon( QStyle::SP_MessageBoxWarning ).pixmap( 48, 48 ) ); lblWarningIcon->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); closeButton()->setDefault( false ); saveButton()->setEnabled( false ); leServer->setSelection( 0, leServer->text().size() ); pteSessionStatus->setReadOnly( true ); spinbxTimeout->setValue( 15 ); grpbxServer->setCollapsed( false ); radioServerImport->setChecked( true ); frameServerImport->setEnabled( true ); radioFileImport->setChecked( false ); frameFileImport->setEnabled( false ); connect( radioServerImport, SIGNAL( toggled( bool ) ), this, SLOT( radioServerImportToggled( bool ) ) ); connect( radioFileImport, SIGNAL( toggled( bool ) ), this, SLOT( radioFileImportToggled( bool ) ) ); connect( leServer, SIGNAL( textChanged( QString ) ), this, SLOT( updateEnabledState() ) ); connect( btnConnect, SIGNAL( clicked() ), this, SLOT( secureConnect() ) ); connect( leServer, SIGNAL( returnPressed() ), btnConnect, SLOT( click() ) ); connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) ); connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); connect( wdgtSslConfig, SIGNAL( readyToSaveChanged( bool ) ), this, SLOT( widgetReadyToSaveChanged( bool ) ) ); wdgtSslConfig->setEnabled( false ); mTrustedCAs = QgsAuthManager::instance()->getTrustedCaCertsCache(); } }
void Arc::reset() { used_ = 0; currentScore_ = scoreDeltas_[0]; updateEnabledState(); }