VBoxTakeSnapshotDlg::VBoxTakeSnapshotDlg(QWidget *pParent, const CMachine &machine) : QIWithRetranslateUI<QIDialog>(pParent) { /* Apply UI decorations */ Ui::VBoxTakeSnapshotDlg::setupUi(this); /* Alt key filter */ QIAltKeyFilter *altKeyFilter = new QIAltKeyFilter(this); altKeyFilter->watchOn(mLeName); /* Setup connections */ connect (mButtonBox, SIGNAL(helpRequested()), &msgCenter(), SLOT(sltShowHelpHelpDialog())); connect (mLeName, SIGNAL(textChanged(const QString &)), this, SLOT(nameChanged(const QString &))); /* Check if machine have immutable attachments */ int immutableMediums = 0; if (machine.GetState() == KMachineState_Paused) { foreach (const CMediumAttachment &attachment, machine.GetMediumAttachments()) { CMedium medium = attachment.GetMedium(); if (!medium.isNull() && !medium.GetParent().isNull() && medium.GetBase().GetType() == KMediumType_Immutable) ++ immutableMediums; } }
UIVMCloseDialog::UIVMCloseDialog(QWidget *pParent) : QIWithRetranslateUI<QIDialog>(pParent) { #ifdef Q_WS_MAC /* Check if Mac Sheet is allowed: */ if (vboxGlobal().isSheetWindowAllowed(pParent)) { vboxGlobal().setSheetWindowUsed(pParent, true); setWindowFlags(Qt::Sheet); } #endif /* Q_WS_MAC */ /* Apply UI decorations */ Ui::UIVMCloseDialog::setupUi(this); #ifdef Q_WS_MAC /* Make some more space around the content */ hboxLayout->setContentsMargins(40, 0, 40, 0); vboxLayout2->insertSpacing(1, 20); /* and more space between the radio buttons */ gridLayout->setSpacing(15); #endif /* Q_WS_MAC */ /* Set fixed size */ setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); connect(mButtonBox, SIGNAL(helpRequested()), &msgCenter(), SLOT(sltShowHelpHelpDialog())); }
void UIActionPool::prepareConnections() { /* 'Application' menu connections: */ #ifdef RT_OS_DARWIN connect(action(UIActionIndex_M_Application_S_About), SIGNAL(triggered()), &msgCenter(), SLOT(sltShowHelpAboutDialog()), Qt::UniqueConnection); #endif /* RT_OS_DARWIN */ #ifdef VBOX_GUI_WITH_NETWORK_MANAGER connect(action(UIActionIndex_M_Application_S_NetworkAccessManager), SIGNAL(triggered()), gNetworkManager, SLOT(show()), Qt::UniqueConnection); connect(action(UIActionIndex_M_Application_S_CheckForUpdates), SIGNAL(triggered()), gUpdateManager, SLOT(sltForceCheck()), Qt::UniqueConnection); #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */ connect(action(UIActionIndex_M_Application_S_ResetWarnings), SIGNAL(triggered()), &msgCenter(), SLOT(sltResetSuppressedMessages()), Qt::UniqueConnection); /* 'Help' menu connections: */ connect(action(UIActionIndex_Simple_Contents), SIGNAL(triggered()), &msgCenter(), SLOT(sltShowHelpHelpDialog()), Qt::UniqueConnection); connect(action(UIActionIndex_Simple_WebSite), SIGNAL(triggered()), &msgCenter(), SLOT(sltShowHelpWebDialog()), Qt::UniqueConnection); #ifndef RT_OS_DARWIN connect(action(UIActionIndex_Simple_About), SIGNAL(triggered()), &msgCenter(), SLOT(sltShowHelpAboutDialog()), Qt::UniqueConnection); #endif /* !RT_OS_DARWIN */ }
VBoxTakeSnapshotDlg::VBoxTakeSnapshotDlg(QWidget *pParent, const CMachine &machine) : QIWithRetranslateUI<QIDialog>(pParent) { #ifdef Q_WS_MAC /* No sheets in another mode than normal for now. Firstly it looks ugly and * secondly in some cases it is broken. */ if ( vboxGlobal().isSheetWindowsAllowed(pParent) || qobject_cast<VBoxSnapshotsWgt*>(pParent)) setWindowFlags(Qt::Sheet); #endif /* Q_WS_MAC */ /* Apply UI decorations */ Ui::VBoxTakeSnapshotDlg::setupUi(this); /* Alt key filter */ QIAltKeyFilter *altKeyFilter = new QIAltKeyFilter(this); altKeyFilter->watchOn(mLeName); /* Setup connections */ connect (mButtonBox, SIGNAL(helpRequested()), &msgCenter(), SLOT(sltShowHelpHelpDialog())); connect (mLeName, SIGNAL(textChanged(const QString &)), this, SLOT(nameChanged(const QString &))); /* Check if machine have immutable attachments */ int immutableMediums = 0; if (machine.GetState() == KMachineState_Paused) { foreach (const CMediumAttachment &attachment, machine.GetMediumAttachments()) { CMedium medium = attachment.GetMedium(); if (!medium.isNull() && !medium.GetParent().isNull() && medium.GetBase().GetType() == KMediumType_Immutable) ++ immutableMediums; } }
VBoxSnapshotDetailsDlg::VBoxSnapshotDetailsDlg (QWidget *aParent) : QIWithRetranslateUI <QDialog> (aParent) { /* Apply UI decorations */ Ui::VBoxSnapshotDetailsDlg::setupUi (this); /* Setup mLbThumbnail label */ mLbThumbnail->setCursor (Qt::PointingHandCursor); mLbThumbnail->installEventFilter (this); /* Setup mTeDetails browser */ mTeDetails->viewport()->setAutoFillBackground (false); mTeDetails->setFocus(); /* Setup connections */ connect (mLeName, SIGNAL (textChanged (const QString&)), this, SLOT (onNameChanged (const QString&))); connect (mButtonBox, SIGNAL (helpRequested()), &msgCenter(), SLOT (sltShowHelpHelpDialog())); }
void UIVMCloseDialog::prepare() { /* Prepare 'main' layout: */ QVBoxLayout *pMainLayout = new QVBoxLayout(this); { /* Prepare 'top' layout: */ QHBoxLayout *pTopLayout = new QHBoxLayout; { /* Prepare 'top-left' layout: */ QVBoxLayout *pTopLeftLayout = new QVBoxLayout; { /* Prepare 'icon': */ m_pIcon = new QLabel(this); { /* Configure icon: */ m_pIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_pIcon->setPixmap(QPixmap(":/os_unknown.png")); } /* Configure layout: */ pTopLeftLayout->setSpacing(0); pTopLeftLayout->setContentsMargins(0, 0, 0, 0); pTopLeftLayout->addWidget(m_pIcon); pTopLeftLayout->addStretch(); } /* Prepare 'top-right' layout: */ QVBoxLayout *pTopRightLayout = new QVBoxLayout; { /* Prepare 'text' label: */ m_pLabel = new QLabel(this); /* Prepare 'choice' layout: */ QGridLayout *pChoiceLayout = new QGridLayout; { /* Prepare 'detach' icon: */ m_pDetachIcon = new QLabel(this); { /* Configure icon: */ m_pDetachIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_pDetachIcon->setPixmap(QPixmap(":/vm_create_shortcut_16px.png")); } /* Prepare 'detach' radio-button: */ m_pDetachRadio = new QRadioButton(this); { /* Configure button: */ m_pDetachRadio->installEventFilter(this); connect(m_pDetachRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability())); } /* Prepare 'save' icon: */ m_pSaveIcon = new QLabel(this); { /* Configure icon: */ m_pSaveIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_pSaveIcon->setPixmap(QPixmap(":/vm_save_state_16px.png")); } /* Prepare 'save' radio-button: */ m_pSaveRadio = new QRadioButton(this); { /* Configure button: */ m_pSaveRadio->installEventFilter(this); connect(m_pSaveRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability())); } /* Prepare 'shutdown' icon: */ m_pShutdownIcon = new QLabel(this); { /* Configure icon: */ m_pShutdownIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_pShutdownIcon->setPixmap(QPixmap(":/vm_shutdown_16px.png")); } /* Prepare 'shutdown' radio-button: */ m_pShutdownRadio = new QRadioButton(this); { /* Configure button: */ m_pShutdownRadio->installEventFilter(this); connect(m_pShutdownRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability())); } /* Prepare 'power-off' icon: */ m_pPowerOffIcon = new QLabel(this); { /* Configure icon: */ m_pPowerOffIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_pPowerOffIcon->setPixmap(QPixmap(":/vm_poweroff_16px.png")); } /* Prepare 'shutdown' radio-button: */ m_pPowerOffRadio = new QRadioButton(this); { /* Configure button: */ m_pPowerOffRadio->installEventFilter(this); connect(m_pPowerOffRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability())); } /* Prepare 'discard' check-box: */ m_pDiscardCheckBox = new QCheckBox(this); /* Configure layout: */ #ifdef Q_WS_MAC pChoiceLayout->setSpacing(15); #else /* Q_WS_MAC */ pChoiceLayout->setSpacing(6); #endif /* !Q_WS_MAC */ pChoiceLayout->setContentsMargins(0, 0, 0, 0); pChoiceLayout->addWidget(m_pDetachIcon, 0, 0); pChoiceLayout->addWidget(m_pDetachRadio, 0, 1); pChoiceLayout->addWidget(m_pSaveIcon, 1, 0); pChoiceLayout->addWidget(m_pSaveRadio, 1, 1); pChoiceLayout->addWidget(m_pShutdownIcon, 2, 0); pChoiceLayout->addWidget(m_pShutdownRadio, 2, 1); pChoiceLayout->addWidget(m_pPowerOffIcon, 3, 0); pChoiceLayout->addWidget(m_pPowerOffRadio, 3, 1); pChoiceLayout->addWidget(m_pDiscardCheckBox, 4, 1); } /* Configure layout: */ #ifdef Q_WS_MAC pTopRightLayout->setSpacing(15); #else /* Q_WS_MAC */ pTopRightLayout->setSpacing(6); #endif /* !Q_WS_MAC */ pTopRightLayout->setContentsMargins(0, 0, 0, 0); pTopRightLayout->addWidget(m_pLabel); pTopRightLayout->addItem(pChoiceLayout); } /* Configure layout: */ pTopLayout->setSpacing(20); pTopLayout->setContentsMargins(0, 0, 0, 0); pTopLayout->addItem(pTopLeftLayout); pTopLayout->addItem(pTopRightLayout); } /* Prepare button-box: */ QIDialogButtonBox *pButtonBox = new QIDialogButtonBox(this); { /* Configure button-box: */ pButtonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::NoButton | QDialogButtonBox::Ok); connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(pButtonBox, SIGNAL(helpRequested()), &msgCenter(), SLOT(sltShowHelpHelpDialog())); } /* Configure layout: */ pMainLayout->setSpacing(20); #ifdef Q_WS_MAC pMainLayout->setContentsMargins(40, 20, 40, 20); #endif /* Q_WS_MAC */ pMainLayout->addItem(pTopLayout); pMainLayout->addWidget(pButtonBox); } /* Prepare size-grip token: */ setSizeGripEnabled(false); }
VBoxVMLogViewer::VBoxVMLogViewer (QWidget *aParent, Qt::WindowFlags aFlags, const CMachine &aMachine) : QIWithRetranslateUI2<QIMainDialog> (aParent, aFlags) , mIsPolished (false) , mFirstRun (true) , mMachine (aMachine) { /* Apply UI decorations */ Ui::VBoxVMLogViewer::setupUi (this); /* Apply window icons */ setWindowIcon(UIIconPool::iconSetFull(QSize (32, 32), QSize (16, 16), ":/vm_show_logs_32px.png", ":/show_logs_16px.png")); /* Enable size grip without using a status bar. */ setSizeGripEnabled (true); /* Logs list creation */ mLogList = new QITabWidget (mLogsFrame); QVBoxLayout *logsFrameLayout = new QVBoxLayout (mLogsFrame); logsFrameLayout->setContentsMargins (0, 0, 0, 0); logsFrameLayout->addWidget (mLogList); connect (mLogList, SIGNAL (currentChanged (int)), this, SLOT (currentLogPageChanged (int))); /* Search panel creation */ mSearchPanel = new VBoxLogSearchPanel (mLogsFrame, this); logsFrameLayout->addWidget (mSearchPanel); mSearchPanel->hide(); /* Add missing buttons & retrieve standard buttons */ mBtnHelp = mButtonBox->button (QDialogButtonBox::Help); mBtnFind = mButtonBox->addButton (QString::null, QDialogButtonBox::ActionRole); mBtnSave = mButtonBox->button (QDialogButtonBox::Save); mBtnRefresh = mButtonBox->addButton (QString::null, QDialogButtonBox::ActionRole); mBtnClose = mButtonBox->button (QDialogButtonBox::Close); /* Setup connections */ connect (mButtonBox, SIGNAL (helpRequested()), &msgCenter(), SLOT (sltShowHelpHelpDialog())); connect (mBtnFind, SIGNAL (clicked()), this, SLOT (search())); connect (mBtnSave, SIGNAL (clicked()), this, SLOT (save())); connect (mBtnRefresh, SIGNAL (clicked()), this, SLOT (refresh())); /* Reading log files */ refresh(); /* Set the focus to the initial default button */ defaultButton()->setDefault (true); defaultButton()->setFocus(); #ifdef Q_WS_MAC /* We have to force this to get the default button L&F on the mac. */ defaultButton()->setEnabled (true); # ifdef VBOX_DARWIN_USE_NATIVE_CONTROLS logsFrameLayout->setSpacing (4); # endif /* VBOX_DARWIN_USE_NATIVE_CONTROLS */ #endif /* Q_WS_MAC */ /* Loading language constants */ retranslateUi(); }
/* Settings Dialog Constructor: */ UISettingsDialog::UISettingsDialog(QWidget *pParent) /* Parent class: */ : QIWithRetranslateUI<QIMainDialog>(pParent) /* Protected variables: */ , m_pSelector(0) , m_pStack(0) /* Common variables: */ , m_dialogType(SettingsDialogType_Wrong) , m_fPolished(false) /* Loading/saving stuff: */ , m_fLoaded(false) , m_fSaved(false) /* Status bar stuff: */ , m_pStatusBar(new QStackedWidget(this)) /* Process bar stuff: */ , m_pProcessBar(new QProgressBar(this)) /* Error/Warning stuff: */ , m_fValid(true) , m_fSilent(true) , m_pWarningPane(new VBoxWarningPane(this)) /* Whats-this stuff: */ , m_pWhatsThisTimer(new QTimer(this)) , m_pWhatsThisCandidate(0) { /* Apply UI decorations: */ Ui::UISettingsDialog::setupUi(this); #ifdef Q_WS_MAC /* No status bar on the mac: */ setSizeGripEnabled(false); setStatusBar(0); #endif /* Q_WS_MAC */ /* Page-title font is derived from the system font: */ QFont pageTitleFont = font(); pageTitleFont.setBold(true); pageTitleFont.setPointSize(pageTitleFont.pointSize() + 2); m_pLbTitle->setFont(pageTitleFont); /* Get main grid layout: */ QGridLayout *pMainLayout = static_cast<QGridLayout*>(centralWidget()->layout()); #ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS /* No page-title with tool-bar: */ m_pLbTitle->hide(); /* No whats-this with tool-bar: */ m_pLbWhatsThis->hide(); /* Create modern tool-bar selector: */ m_pSelector = new VBoxSettingsToolBarSelector(this); static_cast<UIToolBar*>(m_pSelector->widget())->setMacToolbar(); addToolBar(qobject_cast<QToolBar*>(m_pSelector->widget())); /* No title in this mode, we change the title of the window: */ pMainLayout->setColumnMinimumWidth(0, 0); pMainLayout->setHorizontalSpacing(0); #else /* Create classical tree-view selector: */ m_pSelector = new VBoxSettingsTreeViewSelector(this); pMainLayout->addWidget(m_pSelector->widget(), 0, 0, 3, 1); m_pSelector->widget()->setFocus(); pMainLayout->setSpacing(10); #endif /* VBOX_GUI_WITH_TOOLBAR_SETTINGS */ /* Creating stack of pages: */ m_pStack = new QStackedWidget(m_pWtStackHandler); QVBoxLayout *pStackLayout = new QVBoxLayout(m_pWtStackHandler); pStackLayout->setContentsMargins(0, 0, 0, 0); pStackLayout->addWidget(m_pStack); /* Status bar: */ m_pStatusBar->addWidget(new QWidget); m_pButtonBox->addExtraWidget(m_pStatusBar); /* Setup process bar stuff: */ m_pStatusBar->addWidget(m_pProcessBar); /* Setup error & warning stuff: */ m_pStatusBar->addWidget(m_pWarningPane); m_errorIcon = UIIconPool::defaultIcon(UIIconPool::MessageBoxCriticalIcon, this).pixmap(16, 16); m_warningIcon = UIIconPool::defaultIcon(UIIconPool::MessageBoxWarningIcon, this).pixmap(16, 16); /* Setup whatsthis stuff: */ qApp->installEventFilter(this); m_pWhatsThisTimer->setSingleShot(true); connect(m_pWhatsThisTimer, SIGNAL(timeout()), this, SLOT(sltUpdateWhatsThis())); m_pLbWhatsThis->setAutoFillBackground(true); QPalette whatsThisPalette = m_pLbWhatsThis->palette(); whatsThisPalette.setBrush(QPalette::Window, whatsThisPalette.brush(QPalette::Midlight)); m_pLbWhatsThis->setPalette(whatsThisPalette); m_pLbWhatsThis->setFixedHeight(m_pLbWhatsThis->frameWidth() * 2 + m_pLbWhatsThis->margin() * 2 + m_pLbWhatsThis->fontMetrics().lineSpacing() * 4); /* Set the default button: */ m_pButtonBox->button(QDialogButtonBox::Ok)->setDefault(true); /* Setup connections: */ connect(m_pSelector, SIGNAL(categoryChanged(int)), this, SLOT(sltCategoryChanged(int))); connect(m_pButtonBox, SIGNAL(helpRequested()), &msgCenter(), SLOT(sltShowHelpHelpDialog())); /* Translate UI: */ retranslateUi(); }
/* Settings Dialog Constructor: */ UISettingsDialog::UISettingsDialog(QWidget *pParent) /* Parent class: */ : QIWithRetranslateUI<QIMainDialog>(pParent) /* Protected variables: */ , m_pSelector(0) , m_pStack(0) /* Common variables: */ , m_configurationAccessLevel(ConfigurationAccessLevel_Null) , m_fPolished(false) /* Serialization stuff: */ , m_pSerializeProcess(0) , m_fSerializationIsInProgress(false) /* Status-bar stuff: */ , m_pStatusBar(0) /* Process-bar stuff: */ , m_pProcessBar(0) /* Warning-pane stuff: */ , m_pWarningPane(0) , m_fValid(true) , m_fSilent(true) /* Whats-this stuff: */ , m_pWhatsThisTimer(new QTimer(this)) , m_pWhatsThisCandidate(0) { /* Apply UI decorations: */ Ui::UISettingsDialog::setupUi(this); /* Page-title font is derived from the system font: */ QFont pageTitleFont = font(); pageTitleFont.setBold(true); pageTitleFont.setPointSize(pageTitleFont.pointSize() + 2); m_pLbTitle->setFont(pageTitleFont); /* Prepare selector: */ QGridLayout *pMainLayout = static_cast<QGridLayout*>(centralWidget()->layout()); #ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS /* No page-title with tool-bar: */ m_pLbTitle->hide(); /* Create modern tool-bar selector: */ m_pSelector = new UISettingsSelectorToolBar(this); static_cast<UIToolBar*>(m_pSelector->widget())->enableMacToolbar(); addToolBar(qobject_cast<QToolBar*>(m_pSelector->widget())); /* No title in this mode, we change the title of the window: */ pMainLayout->setColumnMinimumWidth(0, 0); pMainLayout->setHorizontalSpacing(0); #else /* Create classical tree-view selector: */ m_pSelector = new UISettingsSelectorTreeView(this); pMainLayout->addWidget(m_pSelector->widget(), 0, 0, 2, 1); m_pSelector->widget()->setFocus(); pMainLayout->setSpacing(10); #endif /* VBOX_GUI_WITH_TOOLBAR_SETTINGS */ connect(m_pSelector, SIGNAL(sigCategoryChanged(int)), this, SLOT(sltCategoryChanged(int))); /* Prepare page-stack: */ m_pStack = new QStackedWidget(m_pWtStackHandler); popupCenter().setPopupStackOrientation(m_pStack, UIPopupStackOrientation_Bottom); QVBoxLayout *pStackLayout = new QVBoxLayout(m_pWtStackHandler); pStackLayout->setContentsMargins(0, 0, 0, 0); pStackLayout->addWidget(m_pStack); /* Prepare button-box: */ m_pButtonBox->button(QDialogButtonBox::Ok)->setDefault(true); connect(m_pButtonBox, SIGNAL(helpRequested()), &msgCenter(), SLOT(sltShowHelpHelpDialog())); /* Prepare process-bar: */ m_pProcessBar = new QProgressBar; m_pProcessBar->setMaximum(100); m_pProcessBar->setMinimum(0); /* Prepare warning-pane: */ m_pWarningPane = new UIWarningPane; connect(m_pWarningPane, SIGNAL(sigHoverEnter(UIPageValidator*)), this, SLOT(sltHandleWarningPaneHovered(UIPageValidator*))); connect(m_pWarningPane, SIGNAL(sigHoverLeave(UIPageValidator*)), this, SLOT(sltHandleWarningPaneUnhovered(UIPageValidator*))); /* Prepare status-bar: */ m_pStatusBar = new QStackedWidget; /* Add empty widget: */ m_pStatusBar->addWidget(new QWidget); /* Add process-bar widget: */ m_pStatusBar->addWidget(m_pProcessBar); /* Add warning-pane: */ m_pStatusBar->addWidget(m_pWarningPane); /* Add status-bar to button-box: */ m_pButtonBox->addExtraWidget(m_pStatusBar); /* Setup whatsthis stuff: */ qApp->installEventFilter(this); m_pWhatsThisTimer->setSingleShot(true); connect(m_pWhatsThisTimer, SIGNAL(timeout()), this, SLOT(sltUpdateWhatsThis())); /* Translate UI: */ retranslateUi(); }