UIVMPreviewWindow::UIVMPreviewWindow(QWidget *pParent)
  : QIWithRetranslateUI<QWidget>(pParent)
  , m_machineState(KMachineState_Null)
  , m_pUpdateTimer(new QTimer(this))
  , m_vMargin(10)
  , m_pbgImage(0)
  , m_pPreviewImg(0)
  , m_pGlossyImg(0)
{
    m_session.createInstance(CLSID_Session);

    setContentsMargins(0, 5, 0, 5);
    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    /* Connect the update timer */
    connect(m_pUpdateTimer, SIGNAL(timeout()),
            this, SLOT(sltRecreatePreview()));
    /* Connect the machine state event */
    connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)),
            this, SLOT(sltMachineStateChange(QString, KMachineState)));
    /* Create the context menu */
    setContextMenuPolicy(Qt::DefaultContextMenu);
    m_pUpdateTimerMenu = new QMenu(this);
    QActionGroup *pUpdateTimeG = new QActionGroup(this);
    pUpdateTimeG->setExclusive(true);
    for(int i = 0; i < UpdateEnd; ++i)
    {
        QAction *pUpdateTime = new QAction(pUpdateTimeG);
        pUpdateTime->setData(i);
        pUpdateTime->setCheckable(true);
        pUpdateTimeG->addAction(pUpdateTime);
        m_pUpdateTimerMenu->addAction(pUpdateTime);
        m_actions[static_cast<UpdateInterval>(i)] = pUpdateTime;
    }
    m_pUpdateTimerMenu->insertSeparator(m_actions[static_cast<UpdateInterval>(Update500ms)]);
    /* Default value */
    UpdateInterval interval = Update1000ms;
    QString strInterval = vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_PreviewUpdate);
    if (strInterval == "disabled")
        interval = UpdateDisabled;
    else if (strInterval == "500")
        interval = Update500ms;
    else if (strInterval == "1000")
        interval = Update1000ms;
    else if (strInterval == "2000")
        interval = Update2000ms;
    else if (strInterval == "5000")
        interval = Update5000ms;
    else if (strInterval == "10000")
        interval = Update10000ms;
    /* Initialize with the new update interval */
    setUpdateInterval(interval, false);

    /* Retranslate the UI */
    retranslateUi();
}
Exemplo n.º 2
0
/* Constructor: */
UIVMPreviewWindow::UIVMPreviewWindow(QWidget *pParent)
  : QIWithRetranslateUI<QWidget>(pParent)
  , m_machineState(KMachineState_Null)
  , m_pUpdateTimer(new QTimer(this))
  , m_vMargin(10)
  , m_pbgImage(0)
  , m_pPreviewImg(0)
  , m_pGlossyImg(0)
{
    /* Setup contents: */
    setContentsMargins(0, 5, 0, 5);
    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    /* Create session instance: */
    m_session.createInstance(CLSID_Session);

    /* Create the context menu: */
    setContextMenuPolicy(Qt::DefaultContextMenu);
    m_pUpdateTimerMenu = new QMenu(this);
    QActionGroup *pUpdateTimeG = new QActionGroup(this);
    pUpdateTimeG->setExclusive(true);
    for(int i = 0; i < UpdateInterval_Max; ++i)
    {
        QAction *pUpdateTime = new QAction(pUpdateTimeG);
        pUpdateTime->setData(i);
        pUpdateTime->setCheckable(true);
        pUpdateTimeG->addAction(pUpdateTime);
        m_pUpdateTimerMenu->addAction(pUpdateTime);
        m_actions[static_cast<UpdateInterval>(i)] = pUpdateTime;
    }
    m_pUpdateTimerMenu->insertSeparator(m_actions[static_cast<UpdateInterval>(UpdateInterval_500ms)]);

    /* Load preview update interval: */
    QString strInterval = vboxGlobal().virtualBox().GetExtraData(GUI_PreviewUpdate);
    /* Parse loaded value: */
    UpdateInterval interval = m_intervals.key(strInterval, UpdateInterval_1000ms);
    /* Initialize with the new update interval: */
    setUpdateInterval(interval, false);

    /* Setup connections: */
    connect(m_pUpdateTimer, SIGNAL(timeout()), this, SLOT(sltRecreatePreview()));
    connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)),
            this, SLOT(sltMachineStateChange(QString, KMachineState)));

    /* Retranslate the UI */
    retranslateUi();
}
Exemplo n.º 3
0
void UIGDetailsSet::prepareConnections()
{
    /* Global-events connections: */
    connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT(sltMachineStateChange(QString)));
    connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), this, SLOT(sltMachineAttributesChange(QString)));
    connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), this, SLOT(sltMachineAttributesChange(QString)));
    connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));

    /* Meidum-enumeration connections: */
    connect(&vboxGlobal(), SIGNAL(mediumEnumStarted()), this, SLOT(sltUpdateAppearance()));
    connect(&vboxGlobal(), SIGNAL(mediumEnumFinished(const VBoxMediaList &)), this, SLOT(sltUpdateAppearance()));
}
Exemplo n.º 4
0
UIGDetailsSet::UIGDetailsSet(UIGDetailsItem *pParent)
    : UIGDetailsItem(pParent)
    , m_iStep(-1)
    , m_iLastStep(-1)
{
    /* Setup size-policy: */
    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);

    /* Add item to the parent: */
    parentItem()->addItem(this);

    /* Prepare connections: */
    connect(this, SIGNAL(sigStartFirstStep(QString)), this, SLOT(sltFirstStep(QString)), Qt::QueuedConnection);
    connect(this, SIGNAL(sigElementPrepared(QString)), this, SLOT(sltNextStep(QString)), Qt::QueuedConnection);
    connect(this, SIGNAL(sigSetPrepared()), this, SLOT(sltSetPrepared()), Qt::QueuedConnection);
    connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT(sltMachineStateChange(QString)));
    connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), this, SLOT(sltMachineAttributesChange(QString)));
    connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), this, SLOT(sltMachineAttributesChange(QString)));
    connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
    connect(&vboxGlobal(), SIGNAL(mediumEnumStarted()), this, SLOT(sltUpdateAppearance()));
    connect(&vboxGlobal(), SIGNAL(mediumEnumFinished(const VBoxMediaList &)), this, SLOT(sltUpdateAppearance()));
}