void AccountSetupPage::createContent()
{
    MApplicationPage::createContent();
    setContentsMargins(0, 0, 0, 0);
    setPannable(true);
    //% "Mail"
    setTitle(qtTrId("xx_page_title"));

    MLayout *layout = new MLayout(centralWidget());

    MLinearLayoutPolicy *policy = new MLinearLayoutPolicy(layout, Qt::Vertical);

    //% "New mail account"
    creatLabel (policy, ("<b>" + qtTrId("xx_new_mail_account") + "<b>"), true);

    //% "We need to take some details to setup your account."
    creatLabel (policy, qtTrId("xx_need_account_detail"), true);
     
    // Prompt the user for name
    //% "What's your name?"
    creatLabel(policy, qtTrId("xx_enter_your_name"));
    m_username = new MTextEdit(MTextEditModel::SingleLine, "", this);
    m_username->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    policy->addItem(m_username);
    policy->setItemSpacing(policy->indexOf(m_username), 5);

    // Prompt the user for email address
    //% "Email address"
    creatLabel (policy, qtTrId("xx_email_address"));
    m_emailAddress = new MTextEdit(MTextEditModel::SingleLine, "", this);
    m_emailAddress->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    policy->addItem(m_emailAddress);
    policy->setItemSpacing(policy->indexOf(m_emailAddress), 5);

    // Prompt the user for password
    //% "Password"
    creatLabel(policy, qtTrId("xx_password"));
    m_password = new MTextEdit(MTextEditModel::SingleLine, "", this);
    m_password->setEchoMode(MTextEditModel::Password);
    m_password->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    policy->addItem(m_password);
    policy->setItemSpacing(policy->indexOf(m_password), 5);

    // Setup button
    //% "Setup account"
    MButton *button = new MButton(qtTrId("xx_setup_account_button_label"), this);
    button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    connect(button, SIGNAL(clicked(bool)), this, SLOT(setupAccount()));
    policy->addItem(button);
    policy->addStretch();

    // Settings menu
    //% "Settings"
    MAction *action = new MAction(qtTrId("xx_settings_actions"), this);
    action->setLocation(MAction::ApplicationMenuLocation);
    connect(action, SIGNAL(triggered(bool)), this, SIGNAL(emailSettingsTriggered()));
    addAction(action);
}
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);
}
Пример #5
0
void SettingsPage::createContent()
{
    Q_D(SettingsPage);

    setStyleName("AccountsUiPage");

    //% "%1 settings"
    setTitle(qtTrId("qtn_acc_ser_prof_set_title").arg(d->context->service().name()));

    MWidget *upperWidget = new MWidget(this);
    MLayout *upperLayout = new MLayout(upperWidget);
    MLinearLayoutPolicy *upperLayoutPolicy = new MLinearLayoutPolicy(upperLayout, Qt::Vertical);
    upperLayoutPolicy->setSpacing(0);

    MLayout *horizontalLayout = new MLayout();
    MLinearLayoutPolicy *horizontalLayoutPolicy = new MLinearLayoutPolicy(horizontalLayout, Qt::Horizontal);

    QString providerName(d->context->account()->providerName());
    QString providerIconId;
    // xml file that describes the ui elements for the provider
    Accounts::Provider provider = AccountsManager::instance()->provider(providerName);
    if (provider.isValid()) {
        QDomElement root = provider.domDocument().documentElement();
        QDomElement providerIcon = root.firstChildElement("icon");
        providerIconId = providerIcon.text();
    }

    ServiceHelper *serviceHepler =
        new ServiceHelper(d->context->service(), this);
    BasicHeaderWidget *usernameAndStatus = 0;

    if (d->context->account()->id() == 0) {
        usernameAndStatus = new BasicHeaderWidget(BasicHeaderWidget::IconWithTitle, this);
        usernameAndStatus->createLayout();
    } else {
        usernameAndStatus = new BasicHeaderWidget(BasicHeaderWidget::IconWithTitleAndSubTitle, this);
        usernameAndStatus->createLayout();
        usernameAndStatus->setSubtitle(qtTrId(d->context->account()->displayName().toLatin1()));
    }

    usernameAndStatus->setImage(providerIconId);
    usernameAndStatus->setTitle(serviceHepler->prettyName());

    MSeparator *separatorTop = new MSeparator(this);
    separatorTop->setStyleName("CommonHeaderDividerInverted");
    separatorTop->setOrientation(Qt::Horizontal);

    d->context->account()->selectService(d->context->service());

    horizontalLayoutPolicy->addItem(usernameAndStatus, Qt::AlignLeft | Qt::AlignVCenter);
    upperLayoutPolicy->addItem(horizontalLayout);
    upperLayoutPolicy->addItem(separatorTop);

    MWidget *widget = d->context->widget(this);

    MWidget *centralWidget = new MWidget(this);
    MLayout *layout = new MLayout(centralWidget);
    MLinearLayoutPolicy *layoutPolicy = new MLinearLayoutPolicy(layout, Qt::Vertical);
    layoutPolicy->addItem(upperWidget);

    layoutPolicy->addItem(widget);
    layoutPolicy->addStretch();

    setCentralWidget(centralWidget);
}
void ScreenShotPage::createContent()
{
    TemplatePage::createContent();

    QGraphicsWidget *panel = centralWidget();
    panel->setContentsMargins(0,0,0,0);

    setContentsMargins(0,0,0,0);

    layout = new MLayout(panel);

    layoutPolicy = new MLinearLayoutPolicy(layout, Qt::Vertical);
    layoutPolicy->setSpacing(0);
    layoutPolicy->setContentsMargins(0,0,0,0);

    layout->setPortraitPolicy(layoutPolicy);
    layout->setLandscapePolicy(layoutPolicy);

    MLayout * elementsLayout = new MLayout;

    MLinearLayoutPolicy* elementsPolicyL = new MLinearLayoutPolicy(elementsLayout,Qt::Vertical);
    elementsLayout->setLandscapePolicy(elementsPolicyL);
    elementsPolicyL->setSpacing(0);
    elementsPolicyL->setContentsMargins(0, 0, 0, 0);

    MLinearLayoutPolicy* elementsPolicyP = new MLinearLayoutPolicy(elementsLayout,Qt::Vertical);
    elementsLayout->setLandscapePolicy(elementsPolicyP);
    elementsPolicyP->setSpacing(0);
    elementsPolicyP->setContentsMargins(0, 0, 0, 0);

    label1 = new MLabel ("Take a screenshot");
    label1->setObjectName("label1");
    label1->setStyleName(inv("CommonApplicationHeader"));

    elementsPolicyL->addItem(label1);
    elementsPolicyP->addItem(label1);

    labelDescription = new MLabel ();
    labelDescription->setObjectName("descriptionLabel");
    labelDescription->setWordWrap(true);
    labelDescription->setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
    labelDescription->setStyleName(inv("CommonBodyText"));

    elementsPolicyL->addItem(labelDescription);
    elementsPolicyP->addItem(labelDescription);

    QGraphicsGridLayout * gridSecs = new QGraphicsGridLayout();

    entrySeconds = new MTextEdit(MTextEditModel::SingleLine,"");
    entrySeconds->setObjectName("secondsTextEntry");
    entrySeconds->setMaxLength(2);
    entrySeconds->setStyleName(inv("CommonSingleInputField"));
    entrySeconds->setContentType(M::NumberContentType);
    entrySeconds->setText("8");
    entrySeconds->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    MLabel * secsLabel = new MLabel();
    secsLabel->setObjectName("secsLabel");
    secsLabel->setText("seconds");
    secsLabel->setStyleName(inv("CommonSingleTitle"));

    gridSecs->addItem(entrySeconds, 0 , 0 , Qt::AlignVCenter);
    gridSecs->addItem(secsLabel, 0 , 1, Qt::AlignVCenter);

    elementsPolicyL->addItem(gridSecs);
    elementsPolicyP->addItem(gridSecs);

    buttonScreenshot = new MButton("Take it!");
    buttonScreenshot->setObjectName("screenshotButton");
    buttonScreenshot->setStyleName(inv("CommonSingleButton"));

    elementsPolicyL->addItem(buttonScreenshot);
    elementsPolicyP->addItem(buttonScreenshot);

    connect(buttonScreenshot, SIGNAL(clicked()), this, SLOT(screenshotDelay()));
    elementsPolicyL->addStretch();
    elementsPolicyP->addStretch();

    layoutPolicy->addItem(elementsLayout);

    retranslateUi();
}