void ResetWidget::createContent () { MLayout *layout; MLinearLayoutPolicy *policy; MButton *restoreButton; MButton *clearButton; MSeparator *spacer; /* * */ layout = new MLayout; policy = new MLinearLayoutPolicy (layout, Qt::Vertical); policy->setContentsMargins (0., 0., 0., 0.); policy->setSpacing (0.); /* * */ spacer = new MSeparator; // Using this one instead of "CommonSpacer", margins look even. spacer->setStyleName ("CommonLargeSpacer"); policy->addItem (spacer); /* * The first button. */ //% "Restore original settings" restoreButton = new MButton (qtTrId("qtn_rset_restore")); restoreButton->setStyleName ("CommonSingleButtonInverted"); restoreButton->setObjectName ("ResetAppletRFSButton"); connect (restoreButton, SIGNAL(clicked()), this, SLOT(restoreActivated())); /* * The second button. */ //% "Clear device" clearButton = new MButton (qtTrId("qtn_rset_clear")); clearButton->setStyleName ("CommonSingleButtonInverted"); clearButton->setObjectName ("ResetAppletCUDButton"); connect (clearButton, SIGNAL(clicked()), this, SLOT(clearActivated())); addButtonContainer (policy, restoreButton, clearButton); policy->addStretch(); /* * */ layout->setPolicy (policy); setLayout (layout); }
// ---------------------------------------------------------------------------- // CReporterPrivacySettingsWidget::initWidget // ---------------------------------------------------------------------------- void CReporterPrivacySettingsWidget::initWidget() { //% "Crash Reporter" MLabel *titleLabel = new MLabel(qtTrId("qtn_dcp_crash_reporter").arg(QString(CREPORTERVERSION))); titleLabel->setStyleName("CommonApplicationHeaderInverted"); //% "Version %1" MLabel *versionLabel = new MLabel(qtTrId("qtn_dcp_version_%1").arg(QString(CREPORTERVERSION))); versionLabel->setStyleName("CommonSubTitleInverted"); // Create containers. CReporterMonitorSettingsContainer *monitorSettings = new CReporterMonitorSettingsContainer(this); CReporterIncludeSettingsContainer *includeSettings = new CReporterIncludeSettingsContainer(this); // Button for showing privacy statement. MButton *showPrivacyButton = new MButton(this); showPrivacyButton->setObjectName("ShowPrivacyButton"); showPrivacyButton->setStyleName("CommonSingleButtonInverted"); //% "Privacy Disclaimer" showPrivacyButton->setText(qtTrId("qtn_dcp_privacy_statement_button")); connect(showPrivacyButton, SIGNAL(clicked()), this, SLOT(openPrivacyDisclaimerDialog())); // Button for sending cores via selection MButton *sendSelectButton = new MButton(this); sendSelectButton->setObjectName("SendSelectButton"); sendSelectButton->setStyleName("CommonSingleButtonInverted"); //% "Send/Delete Reports" sendSelectButton->setText(qtTrId("qtn_dcp_send_delete_button_text")); connect(sendSelectButton, SIGNAL(clicked()), this, SLOT (handleSendSelectButtonClicked()), Qt::DirectConnection); connect(sendSelectButton, SIGNAL(clicked()), monitorSettings, SLOT(updateButtons()), Qt::QueuedConnection); // Create main layout and policy. MLayout *mainLayout = new MLayout(this); MLinearLayoutPolicy *mainLayoutPolicy = new MLinearLayoutPolicy(mainLayout, Qt::Vertical); mainLayoutPolicy->setObjectName("PageMainLayout"); mainLayout->setPolicy(mainLayoutPolicy); mainLayout->setContentsMargins(0,0,0,0); mainLayoutPolicy->addItem(titleLabel, Qt::AlignLeft); mainLayoutPolicy->addItem(versionLabel, Qt::AlignLeft); mainLayoutPolicy->addItem(monitorSettings, Qt::AlignCenter); mainLayoutPolicy->addItem(includeSettings, Qt::AlignCenter); // mainLayoutPolicy->addItem(bottomLayout, Qt::AlignCenter); mainLayoutPolicy->addStretch(); mainLayoutPolicy->addItem(showPrivacyButton, Qt::AlignCenter); mainLayoutPolicy->addItem(sendSelectButton, Qt::AlignCenter); }
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())); }
MyNavBarContent::MyNavBarContent(QGraphicsItem *parent) : QGraphicsWidget(parent), d(new MyNavBarContentPrivate(this)) { QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); setLayout(layout); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); MSlider *slider = new MSlider; slider->setRange(0, 100); slider->setMinLabelVisible(true); slider->setMaxLabelVisible(true); slider->setHandleLabelVisible(true); layout->addItem(slider); MButton *okButton = new MButton("OK"); okButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); okButton->setStyleName("ToolBarLabelOnlyCommonButton"); connect(okButton, SIGNAL(clicked()), SIGNAL(okClicked())); layout->addItem(okButton); }
// ---------------------------------------------------------------------------- // CReporterSendSelectedDialog::createcontent // ---------------------------------------------------------------------------- void CReporterSendSelectedDialog::createcontent() { Q_D(CReporterSendSelectedDialog); setObjectName("CrashReporterSendSelectedDialog"); int nbrOfFiles = d_ptr->files.count(); QString message; if (nbrOfFiles == 1) { //% "<p>This system has 1 stored crash report. Select reports to send to %1 for analysis or to delete.</p>" message = qtTrId("qtn_system_has_1_crash_report_send_to_%s").arg(d->server); } else { //% "<p>This system has %1 stored crash reports. Select reports to send to %2 for analysis or to delete.</p>" message = qtTrId("qtn_system_has_%1_crash_reports_send_to_%2").arg(nbrOfFiles).arg(d->server); } // Create content to be placed on central widget. QGraphicsWidget *panel = centralWidget(); // Create layout and policy. MLayout *layout = new MLayout(panel); layout->setContentsMargins(0,0,0,0); panel->setLayout(layout); MLinearLayoutPolicy *policy = new MLinearLayoutPolicy(layout, Qt::Vertical); policy->setObjectName("DialogMainLayout"); // Create message label and hack it to support wordwrapping MLabel *messagelabel = new MLabel(message, panel); messagelabel->setWordWrap(true); messagelabel->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); messagelabel->setObjectName("DialogMessageLabel"); messagelabel->setStyleName("CommonFieldLabelInverted"); d->list = new MList(panel); d->cellCreator = new MContentItemCreator; d->list->setCellCreator(d->cellCreator); d->model = new CReporterSendFileListModel(d->files); d->list->setItemModel(d->model); d->list->setSelectionMode(MList::MultiSelection); // Add widgets to the layout policy->addItem(messagelabel, Qt::AlignLeft | Qt::AlignTop); policy->addItem(d->list, Qt::AlignLeft | Qt::AlignTop); // Add buttons to button area. QSignalMapper *mapper = new QSignalMapper(this); //% "Send Selected" MButton* dialogButton = new MButton(qtTrId("qtn_send_selected_button")); dialogButton->setStyleName("CommonSingleButtonInverted"); policy->addItem(dialogButton, Qt::AlignCenter); // MButtonModel *dialogButton = addButton(qtTrId("qtn_send_selected_button"), M::ActionRole); connect(dialogButton, SIGNAL(clicked()), mapper, SLOT(map())); mapper->setMapping(dialogButton, static_cast<int>(CReporter::SendSelectedButton)); //% "Send All" dialogButton = new MButton(qtTrId("qtn_send_all_button")); dialogButton->setStyleName("CommonSingleButtonInverted"); policy->addItem(dialogButton, Qt::AlignCenter); // dialogButton = addButton(qtTrId("qtn_send_all_button"), M::ActionRole); connect(dialogButton, SIGNAL(clicked()), mapper, SLOT(map())); mapper->setMapping(dialogButton, static_cast<int>(CReporter::SendAllButton)); //% "Delete Selected" dialogButton = new MButton(qtTrId("qtn_delete_selected_button")); dialogButton->setStyleName("CommonSingleButtonInverted"); policy->addItem(dialogButton, Qt::AlignCenter); // dialogButton = addButton(qtTrId("qtn_delete_selected_button"), M::DestructiveRole); connect(dialogButton, SIGNAL(clicked()), mapper, SLOT(map())); mapper->setMapping(dialogButton, static_cast<int>(CReporter::DeleteSelectedButton)); connect(mapper, SIGNAL(mapped(int)), SIGNAL(actionPerformed(int))); connect(mapper, SIGNAL(mapped(int)), SLOT(accept())); }