void UINetworkManagerDialog::addNetworkRequestWidget(UINetworkRequest *pNetworkRequest)
{
    /* Make sure network-request is really exists: */
    AssertMsg(pNetworkRequest, ("Network-request doesn't exists!\n"));

    /* Create new network-request widget: */
    UINetworkRequestWidget *pNetworkRequestWidget = new UINetworkRequestWidget(this, pNetworkRequest);
    m_pWidgetsLayout->addWidget(pNetworkRequestWidget);
    m_widgets.insert(pNetworkRequest->uuid(), pNetworkRequestWidget);

    /* Hide label: */
    m_pLabel->hide();
    /* Show button-box: */
    m_pButtonBox->show();
    /* If customer made a force-call: */
    if (pNetworkRequest->customer()->isItForceCall())
    {
        /* Show dialog: */
        showNormal();
    }

    /* Prepare network-request widget's notifications for network-request: */
    connect(pNetworkRequestWidget, SIGNAL(sigRetry()), pNetworkRequest, SLOT(sltRetry()), Qt::QueuedConnection);
    connect(pNetworkRequestWidget, SIGNAL(sigCancel()), pNetworkRequest, SLOT(sltCancel()), Qt::QueuedConnection);
}
void CModuleIndexDialog::indexAllModules( const QList<CSwordModuleInfo*>& modules ) {
    static bool indexing = false;
    if (!indexing) {
        indexing = true;
        if (modules.count() < 1) return;

        m_currentModuleIndex = 0;
        m_progress = new QProgressDialog(QString(""), tr("Cancel"), 0, modules.count()*100);
        m_progress->setWindowModality(Qt::WindowModal); // not useful actually, should have parent for this
        m_progress->setWindowTitle(tr("Creating indices"));
        m_progress->show();
        m_progress->raise();

        foreach (CSwordModuleInfo* info, modules) {
            //TODO: how to cancel
            //QObject::connect(CPointers::backend(), SIGNAL(sigSwordSetupChanged()), this, SLOT(swordSetupChanged()));
            connect(this, SIGNAL(sigCancel()), info, SLOT(cancelIndexing()) );
            connect(m_progress, SIGNAL(canceled()), info, SLOT(cancelIndexing()));
            connect(info, SIGNAL(indexingFinished()), this, SLOT(slotFinished()));
            connect(info, SIGNAL(indexingProgress(int)), this, SLOT(slotModuleProgress(int)) );
            QString modname(info->name());
            const QString labelText = tr("Creating index for work: %1").arg(modname);
            m_progress->setLabelText(labelText);
            //todo: if we want to cancel indexing from
            info->buildIndex(); //waits until this module is finished

            m_currentModuleIndex++;
            disconnect(m_progress, SIGNAL(canceled()), info, SLOT(cancelIndexing()));
            disconnect(info, SIGNAL(indexingFinished()), this, SLOT(slotFinished()));
            disconnect(info, SIGNAL(indexingProgress(int)), this, SLOT(slotModuleProgress(int)) );
            if (m_progress->wasCanceled()) break;
        }
Ejemplo n.º 3
0
/* UIDownloader stuff: */
UIMiniProgressWidget* UIDownloader::progressWidget(QWidget *pParent) const
{
    /* Create progress widget: */
    UIMiniProgressWidget *pWidget = createProgressWidgetFor(pParent);

    /* Connect the signal to notify about progress canceled: */
    connect(pWidget, SIGNAL(sigCancel()), this, SLOT(sltCancel()));
    /* Connect the signal to notify about source changed: */
    connect(this, SIGNAL(sigSourceChanged(const QString&)), pWidget, SLOT(sltSetSource(const QString&)));
    /* Connect the signal to notify about downloading progress: */
    connect(this, SIGNAL(sigDownloadProgress(qint64, qint64)), pWidget, SLOT(sltSetProgress(qint64, qint64)));
    /* Make sure the widget is destroyed when this class is deleted: */
    connect(this, SIGNAL(destroyed(QObject*)), pWidget, SLOT(deleteLater()));

    /* Return widget: */
    return pWidget;
}
Ejemplo n.º 4
0
CDlgScreenShot::CDlgScreenShot(QWidget *parent)
    :QDialog(parent,
             Qt::FramelessWindowHint
             | Qt::X11BypassWindowManagerHint  //这个标志是在x11下有用,查看帮助QWidget::showFullScreen()  
             | Qt::Tool
             | Qt::WindowStaysOnTopHint
             | Qt::CustomizeWindowHint
             ),
    m_x(0),
    m_y(0),
    m_width(0),
    m_height(0),
    m_Editor(this)
{
    this->setFixedSize(qApp->desktop()->size());
    resize(qApp->desktop()->size());
    setAttribute(Qt::WA_TranslucentBackground,true);
    setCursor(Qt::CrossCursor);

#ifdef ANDROID
    QDesktopWidget *pScreen = qApp->desktop();
    QPixmap pix(pScreen->geometry().size());
    pScreen->render(&pix);
    m_imgDesktop = pix.toImage();
#else
    WId id = qApp->desktop()->winId();
    QScreen *pScreen = QGuiApplication::primaryScreen();
    m_imgDesktop = pScreen->grabWindow(id,
                                       0,
                                       0, 
                                       pScreen->geometry().width(),//pScreen->availableGeometry().width(),
                                       pScreen->geometry().height()//pScreen->availableGeometry().height()
                                       ).toImage();
#endif
    initSelectParam();

    m_Editor.hide();
    connect(&m_Editor,SIGNAL(sigReset()),this,SLOT(onSigReset()));
    connect(&m_Editor,SIGNAL(sigSelectImg(QPixmap)),this,SLOT(onSigSelectedImg(QPixmap)));
    connect(&m_Editor,SIGNAL(sigCancel()),this,SLOT(onSigCancel()));
}
Ejemplo n.º 5
0
/* UIMiniProgressWidget stuff: */
UIMiniProgressWidget::UIMiniProgressWidget(QWidget *pParent /* = 0 */)
    : QWidget(pParent)
    , m_pProgressBar(new QProgressBar(this))
    , m_pCancelButton(new UIMiniCancelButton(this))
{
    /* Progress-bar setup: */
    m_pProgressBar->setFixedWidth(100);
    m_pProgressBar->setFormat("%p%");
    m_pProgressBar->setValue(0);

    /* Cancel-button setup: */
    m_pCancelButton->setFocusPolicy(Qt::NoFocus);
    m_pCancelButton->removeBorder();
    connect(m_pCancelButton, SIGNAL(clicked()), this, SIGNAL(sigCancel()));

    setContentsMargins(0, 0, 0, 0);
    setFixedHeight(16);

    /* Layout setup: */
    QHBoxLayout *pMainLayout = new QHBoxLayout(this);
    VBoxGlobal::setLayoutMargin(pMainLayout, 0);

#ifdef Q_WS_MAC
    pMainLayout->setSpacing(2);
    m_pProgressBar->setFixedHeight(14);
    m_pCancelButton->setFixedHeight(11);
    pMainLayout->addWidget(m_pProgressBar, 0, Qt::AlignTop);
    pMainLayout->addWidget(m_pCancelButton, 0, Qt::AlignBottom);
#else /* Q_WS_MAC */
    pMainLayout->setSpacing(0);
    pMainLayout->addWidget(m_pProgressBar, 0, Qt::AlignCenter);
    pMainLayout->addWidget(m_pCancelButton, 0, Qt::AlignCenter);
#endif /* !Q_WS_MAC */

    pMainLayout->addStretch(1);
}