Пример #1
0
void GCF::Components::ClipboardComponent::addData(const ClipboardData& data)
{
    if(d->activeContext.isEmpty())
        activateDefaultContext();

    ClipboardDataList& dataList = d->contextStore[d->activeContext];
    dataList.prepend(data);
    d->clipboardModel->setClipboardDataList(dataList);

    emit dataAdded(data);
}
Пример #2
0
DrawingPad::DrawingPad(QWidget *parent)
    : QWidget(parent)
    , m_canvas( 0 )
    , m_listenButton( 0 )
    , m_listenPortEdit( 0 )
    , m_connectButton( 0 )
    , m_connectAddressEdit( 0 )
    , m_connectPortEdit( 0 )
    , m_connected( false )
{
    m_canvas = new Canvas;

    QLayout *colorLayout = setupColorSelector();
    QLayout *widthLayout = setupWidthSelector();

    QVBoxLayout *settingLayout = new QVBoxLayout;
    settingLayout->addLayout( colorLayout );
    settingLayout->addLayout( widthLayout );
    settingLayout->addStretch();

    QHBoxLayout *hlayout = new QHBoxLayout;
    hlayout->addLayout( settingLayout );
    hlayout->addWidget( m_canvas );

    QLayout *fileLayout = setupFileButtons();
    QLayout *networkLayout1 = setupListenButtons();
    QLayout *networkLayout2 = setupConnectButtons();

    QVBoxLayout *buttonLayout = new QVBoxLayout;
    buttonLayout->setSpacing( 0 );
    buttonLayout->addLayout( fileLayout );
    buttonLayout->addLayout( networkLayout1 );
    buttonLayout->addLayout( networkLayout2 );

    QVBoxLayout *topLayout = new QVBoxLayout;
    topLayout->addLayout( hlayout );
    topLayout->addLayout( buttonLayout );
    setLayout( topLayout );

    resize( 600, 500 );

    m_canvas->setLineColor( Qt::black );
    widthSelected( 2 );

    connect( &m_listener, SIGNAL(newConnection(ServerSocket *)), this, SLOT(newConnection(ServerSocket *)) );

    connect( &m_clientSocket, SIGNAL(connected()), this, SLOT(connectedToServer()) );
    connect( &m_clientSocket, SIGNAL(received(QByteArray)), m_canvas, SLOT(addData(QByteArray)) );
    connect( &m_clientSocket, SIGNAL(disconnected()), this, SLOT(disconnectedFromServer()) );

    connect( m_canvas, SIGNAL(dataAdded(QByteArray)), &m_clientSocket, SLOT(send(QByteArray)) );
}
Пример #3
0
void FileDownloader::downloadProgress(qint64 recv, qint64 total)
{
    float progress = (float)recv/total;
    emit dataAdded(progress);
}