예제 #1
0
파일: cell.cpp 프로젝트: arcean/text-editor
Cell::Cell(MWidget *parent) :
    MListItem(parent)
{
    MLayout *layout = new MLayout(this);
    MLinearLayoutPolicy *policy = new MLinearLayoutPolicy(layout, Qt::Vertical);
    policy->setContentsMargins(0, 0, 0, 0);
    policy->setSpacing(0);
    policy->setNotifyWidgetsOfLayoutPositionEnabled(true);

    line1 = new MLabel();
    line2 = new MLabel();
    line3 = new MLabel();
    date = new MLabel();

    line1->setWordWrap(false);
    line2->setWordWrap(false);
    line3->setWordWrap(false);
    date->setWordWrap(false);

    line1->setTextElide(true);
    line2->setTextElide(true);
    line3->setTextElide(true);
    date->setTextElide(true);

    policy->addItem(line1);
    policy->addItem(line2);
    policy->addItem(line3);
    policy->addItem(date);

    this->setStyleName("NotesPopupListItem");
}
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);
}
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);
}
예제 #4
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();
}