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); }
void WarrantyWidget::createContent () { MLayout *layout; MLinearLayoutPolicy *policy; layout = new MLayout; layout->setContentsMargins (0,0,0,0); policy = new MLinearLayoutPolicy (layout, Qt::Vertical); policy->setContentsMargins (0., 0., 0., 0.); policy->setSpacing (0.); /* * Add the title-bar */ addHeaderContainer (policy); #ifdef APP_TITLE_USES_SPACER addStretcher (policy, APP_TITLE_DIVIDER_STYLE_NAME); #endif if (m_warrantyTimer) { // The label that shows the expiration date m_labelExpiration = new MLabel; m_labelExpiration->setObjectName ("WarrantyAppletExpirationLabel"); m_labelExpiration->setStyleName ("CommonTitleInverted"); m_labelExpiration->setWordWrap (true); } // The label that shows the terms of the warranty m_labelTerms = new MLabel; m_labelTerms->setObjectName ("WarrantyAppletTermsLabel"); m_labelTerms->setStyleName ("CommonBodyTextInverted"); m_labelTerms->setWordWrap (true); /* * Adding the two labels with a new container */ addLabelContainer (policy, m_labelExpiration, m_labelTerms); policy->addStretch (); retranslateUi (); layout->setPolicy (policy); setLayout (layout); }
SwAcctEditPage::SwAcctEditPage(SwClientService *swService, QGraphicsItem *parent) : MApplicationPage(parent), mService(swService), mServiceConfig(mService->getServiceConfig()), mFlickrClicked(false) { int adj = 0; setEscapeMode(MApplicationPageModel::EscapeManualBack); connect(this, SIGNAL(backButtonClicked()), this, SLOT(dismiss())); connect(mService, SIGNAL(CredsStateChanged(SwClientService*,SwClientService::CredsState)), this, SLOT(onCredsStateChanged(SwClientService *, SwClientService::CredsState))); if (!mServiceConfig->isValid()) dismiss(); mParams = mServiceConfig->getConfigParams(); MLayout *layout = new MLayout; MGridLayoutPolicy *policy = new MGridLayoutPolicy(layout); QString link = mServiceConfig->getLink(); MLabel *lblServiceName = new MLabel(); if (!link.isEmpty()) lblServiceName->setText(QString("<a href=\"%1\">%2</a>").arg(link, mServiceConfig->getDisplayName())); else lblServiceName->setText(mServiceConfig->getDisplayName()); lblServiceName->setObjectName("SwAcctEditPageServiceNameLabel"); policy->addItem(lblServiceName, 0, 0, 1, 2, Qt::AlignHCenter); connect(lblServiceName, SIGNAL(linkActivated(QString)), this, SLOT(onLinkClicked(QString))); QString desc = mServiceConfig->getDescription(); if (!desc.isEmpty()) { MLabel *lblServiceDesc = new MLabel(); lblServiceDesc->setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); lblServiceDesc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); //Have to insert a random HTML tag to make word wrap actually work... //Should be able to remove at some point once MTF word wrap works properly lblServiceDesc->setText(QString("<b></b>").append(desc)); lblServiceDesc->setObjectName("SwAcctEditPageServiceDescLabel"); policy->addItem(lblServiceDesc, 1, 0, 1, 2, Qt::AlignLeft); } else { adj -= 1; } //This is *ugly* if (mServiceConfig->getAuthtype() == SwClientServiceConfig::AuthTypeFlickr) { if (!mParams.value(USER_KEY).isEmpty()) { //% "User %1" MLabel *lblUsername = new MLabel(qtTrId("label_flickr_username").arg(mParams.value(USER_KEY))); lblUsername->setObjectName("SwAcctEditPageFlickrUserLabel"); policy->addItem(lblUsername, 2+adj, 0, 1, 2, Qt::AlignHCenter); adj += 1; } mFlickrButton = new MButton(); mFlickrButton->setObjectName("SwAcctEditPageFlickrButton"); policy->addItem(mFlickrButton, 2+adj, 0, 1, 2, Qt::AlignHCenter); connect(mFlickrButton, SIGNAL(clicked()), this, SLOT(onFlickrClicked())); adj += 1; } else { MLabel *lblUsername = new MLabel(); lblUsername->setObjectName("SwAcctEditPageUsernameLabel"); lblUsername->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); //% "Username:"******"label_username")); policy->addItem(lblUsername, 2+adj, 0); mEdtUsername = new MTextEdit(MTextEditModel::SingleLine); mEdtUsername->setObjectName("SwAcctEditPageUsernameButton"); mEdtUsername->setText(mParams.value(USER_KEY)); //qDebug() << QString("Set username to %1").arg(mParams.value(USER_KEY)); policy->addItem(mEdtUsername, 2+adj, 1); if (mServiceConfig->getAuthtype() == SwClientServiceConfig::AuthTypePassword) { MLabel *lblPassword = new MLabel(); lblPassword->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); //% "Password:"******"label_password")); lblPassword->setObjectName("SwAcctEditPagePasswordLabel"); policy->addItem(lblPassword, 3+adj, 0); mEdtPassword = new MTextEdit(MTextEditModel::SingleLine); mEdtPassword->setText(mParams.value(PASS_KEY)); mEdtPassword->setEchoMode(MTextEditModel::Password); mEdtPassword->setObjectName("SwAcctEditPagePasswordButton"); // qDebug() << QString("Set password to %1").arg(mParams.value(PASS_KEY)); policy->addItem(mEdtPassword, 3+adj, 1); connect(mEdtPassword, SIGNAL(textChanged()), this, SLOT(onLoginChanged())); adj += 1; } } mLblStatus = new MLabel(STATUS_TEXT_UNCONFIGURED); mLblStatus->setObjectName("SwAcctEditPageStatusLabel"); policy->addItem(mLblStatus, 3+adj, 0, 1, 2, Qt::AlignHCenter); onCredsStateChanged(mService, mService->credsState()); MLabel *lblServiceHint = new MLabel(); lblServiceHint->setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); lblServiceHint->setObjectName("SwAcctEditPageServiceHintLabel"); lblServiceHint->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); lblServiceHint->setText(SERVICE_HINT_TEXT.arg(mService->getDisplayName())); policy->addItem(lblServiceHint, 4+adj, 0, 1, 2); //This, also, is *ugly* if (mServiceConfig->getAuthtype() != SwClientServiceConfig::AuthTypeFlickr) { //% "Apply" mBtnApply = new MButton(qtTrId("button_apply")); mBtnApply->setObjectName("SwAcctEditPageApplyButton"); policy->addItem(mBtnApply, 5+adj, 0, 1, 2, Qt::AlignHCenter); //% "Cancel" mBtnCancel = new MButton(qtTrId("button_cancel")); mBtnCancel->setObjectName("SwAcctEditPageCancelButton"); policy->addItem(mBtnCancel, 6+adj, 0, 1, 2, Qt::AlignHCenter); connect(mEdtUsername, SIGNAL(textChanged()), this, SLOT(onLoginChanged())); connect(mBtnApply, SIGNAL(clicked()), this, SLOT(onApplyClicked())); connect(mBtnCancel, SIGNAL(clicked()), this, SLOT(dismiss())); } layout->setPolicy(policy); centralWidget()->setLayout(layout); }