QGraphicsWidget* StatusIndicatorMenuDropDownView::createTopRow() { // Create an extension area for the top row plugins settingsPluginsExtensionArea = new MApplicationExtensionArea("com.meego.core.MStatusIndicatorMenuExtensionInterface/1.0"); connect(settingsPluginsExtensionArea, SIGNAL(extensionInstantiated(MApplicationExtensionInterface*)), controller, SLOT(setStatusIndicatorMenuInterface(MApplicationExtensionInterface*))); settingsPluginsExtensionArea->setObjectName("StatusIndicatorMenuTopRowExtensionArea"); settingsPluginsExtensionArea->setInProcessFilter(QRegExp("/statusindicatormenu-(volume|alarms|internetconnection|presence|profile).desktop$")); settingsPluginsExtensionArea->setOutOfProcessFilter(QRegExp("$^")); settingsPluginsExtensionArea->setOrder((QStringList() << "statusindicatormenu-volume.desktop" << "statusindicatormenu-alarms.desktop" << "statusindicatormenu-internetconnection.desktop" << "statusindicatormenu-presence.desktop" << "statusindicatormenu-profile.desktop")); // Create a button for accessing the full settings //% "Settings" MButton *settingsButton = new MButton(qtTrId("qtn_stat_menu_settings")); settingsButton->setObjectName("StatusIndicatorMenuTopRowExtensionButton"); settingsButton->setViewType(MButton::iconType); settingsButton->setIconID("icon-m-status-menu-settings"); connect(settingsButton, SIGNAL(clicked()), controller, SLOT(launchControlPanelAndHide())); // Put the extension area and the settings button to a horizontal layout QGraphicsLinearLayout *topRowLayout = new QGraphicsLinearLayout(Qt::Horizontal); topRowLayout->setContentsMargins(0, 0, 0, 0); topRowLayout->setSpacing(0); topRowLayout->addStretch(); topRowLayout->addItem(settingsPluginsExtensionArea); topRowLayout->addItem(settingsButton); topRowLayout->addStretch(); // Create a container widget for extension area and settings button layout MWidgetController *topRowWidget = new MStylableWidget; topRowWidget->setStyleName("StatusIndicatorMenuExtensionAreaWidget"); topRowWidget->setLayout(topRowLayout); return topRowWidget; }
ViewHeaderWithIcon::ViewHeaderWithIcon(QGraphicsItem *parent) : MWidgetController(parent), linearLayout(0), titleWidget(0) { setStyleName("CommonHeaderPanel"); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); MLayout *layout = new MLayout(this); MLinearLayoutPolicy *layoutPolicy = new MLinearLayoutPolicy(layout, Qt::Horizontal); titleWidget = new MLabel(); titleWidget->setTextElide(true); titleWidget->setStyleName("CommonHeaderInverted"); layoutPolicy->addItem(titleWidget); MButton *refreshButton = new MButton(this); refreshButton->setIconID ("icon-m-common-refresh"); refreshButton->setViewType (MButton::iconType); refreshButton->setStyleName("CommonRightIcon"); layoutPolicy->addItem(refreshButton); layoutPolicy->setAlignment(refreshButton, Qt::AlignLeft | Qt::AlignVCenter); connect(refreshButton, SIGNAL(clicked()), this, SLOT(onButtonClicked())); }
MOverlay *StatusIndicatorMenuDropDownView::createCloseButtonOverlay() { // Create a close button MButton *closeButton = new MButton; closeButton->setViewType("icon"); closeButton->setObjectName("StatusIndicatorMenuCloseButton"); closeButton->setIconID("icon-m-framework-close"); connect(closeButton, SIGNAL(clicked()), controller, SIGNAL(hideRequested())); // Add two overlay widgets that will not allow mouse events to pass through them next to the close button QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); layout->addItem(new EventEaterWidget); layout->addItem(closeButton); layout->addItem(new EventEaterWidget); // Create the overlay itself MOverlay *closeButtonOverlay = new MOverlay; closeButtonOverlay->setLayout(layout); closeButtonOverlay->setObjectName("CloseButtonOverlay"); return closeButtonOverlay; }