Exemplo n.º 1
0
int CPluginCANGine::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = CPluginAbstractSerialPort::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: signalDisconnect((*reinterpret_cast< CPluginAbstract*(*)>(_a[1]))); break;
        case 1: signalUpdateServices(); break;
        case 2: slotReceiveData((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 3: slotSendData(); break;
        case 4: slotDisconnect(); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
Exemplo n.º 2
0
bool K3Process::writeStdin(const char *buffer, int buflen)
{
  // if there is still data pending, writing new data
  // to stdout is not allowed (since it could also confuse
  // kprocess ...)
  if (input_data != 0)
    return false;

  if (communication & Stdin) {
    input_data = buffer;
    input_sent = 0;
    input_total = buflen;
    innot->setEnabled(true);
    if (input_total)
       slotSendData(0);
    return true;
  } else
    return false;
}
Exemplo n.º 3
0
// Constructor
LikeBackDialog::LikeBackDialog( QNetworkAccessManager * nam, LikeBack::Button reason,
                                const QString &initialComment, const QString &windowPath,
                                const QString &context, LikeBack *likeBack )
  : QDialog( QApplication::activeWindow() )
  , m_nam( nam )
  , m_context( context )
  , m_likeBack( likeBack )
  , m_windowPath( windowPath )
{
    // Customize UI
    setupUi( this );
    QFont font = informationLabel->font();
    font.setPointSize(font.pointSize() - 1);
    informationLabel->setFont(font);
    emailLabel->setFont(font);
    setAttribute(Qt::WA_DeleteOnClose);
#if 1
    restoreGeometry(QSettings().value("LikeBack/geometry").toByteArray());
#else
    restoreDialogSize( KGlobal::config()->group( "LikeBackDialog" ) );
#endif

    // Connect the 2 bottom buttons
    connect( buttonBox, SIGNAL( accepted() ), this, SLOT( slotSendData() ) );
    connect( buttonBox, SIGNAL( rejected() ), this, SLOT( close() ) );

    // Group the buttons together to retrieve the checked one quickly
    m_typeGroup = new QButtonGroup( this );
    m_typeGroup->addButton( likeRadio_,     LikeBack::Like    );
    m_typeGroup->addButton( dislikeRadio_,  LikeBack::Dislike );
    m_typeGroup->addButton( bugRadio_,      LikeBack::Bug     );
    m_typeGroup->addButton( featureRadio_,  LikeBack::Feature );

    // Hide unneeded buttons
    LikeBack::Button buttons = m_likeBack->buttons();
    likeRadio_   ->setVisible( buttons & LikeBack::Like    );
    dislikeRadio_->setVisible( buttons & LikeBack::Dislike );
    bugRadio_    ->setVisible( buttons & LikeBack::Bug     );
    featureRadio_->setVisible( buttons & LikeBack::Feature );

    // If no specific "reason" is provided, choose the first one:
    if ( reason == LikeBack::AllButtons || reason == LikeBack::DefaultButtons ) {
         if( buttons & LikeBack::Dislike ) reason = LikeBack::Dislike;
    else if( buttons & LikeBack::Bug     ) reason = LikeBack::Bug;
    else if( buttons & LikeBack::Feature ) reason = LikeBack::Feature;
    else                                   reason = LikeBack::Like;
    }

    // Choose which button to check
    switch( reason ) {
        case LikeBack::Like:    likeRadio_   ->setChecked( true ); break;
        case LikeBack::Dislike: dislikeRadio_->setChecked( true ); break;
        case LikeBack::Bug:     bugRadio_    ->setChecked( true ); break;
        case LikeBack::Feature: featureRadio_->setChecked( true ); break;
        default: break; // Will never arrive here
    }

    // Disable the Ok button if no comment is present
    connect( m_comment, SIGNAL( textChanged() ), this, SLOT( verifyOk() ) );

    // If no window path is provided, get the current active window path
    if ( m_windowPath.isEmpty() )
        m_windowPath = LikeBack::activeWindowPath();

    // Specify the initial comment
    m_comment->setPlainText( initialComment );
    m_comment->setFocus();

    // Provide the initial status for email address widgets if available
    emailAddressEdit_->setText( m_likeBack->emailAddress() );
    specifyEmailCheck->setChecked( true );

    // The introduction message is long and will require a new minimum dialog size
    informationLabel->setText( introductionText() );
    setMinimumSize( minimumSizeHint() );

    // Initially verify the widgets status
    verifyOk();
}