CustomListItem::CustomListItem ( ItemStyle itemStyle, QGraphicsItem *parent) : MAdvancedListItem (itemStyle, parent) { setStyleName ("CommonPanelInverted"); titleLabelWidget ()->setStyleName ("CommonTitleInverted"); }
DcpMostUsed::DcpMostUsed (QGraphicsWidget* parent): MContainer (parent), m_ItemsAvailable (false) { setStyleName ("CommonContainerInverted"); Category* mostUsedCat = DcpCategories::instance()->categoryById (MostUsed); m_AppletButtons = new DcpAppletButtons (mostUsedCat); setCentralWidget (m_AppletButtons); checkItemsAvailable(); }
void ApplicationMenuPage::createContent() { MApplicationPage::createContent(); pannableViewport()->setAcceptGesturesFromAnyDirection(true); setStyleName(inv("CommonApplicationPage")); QGraphicsWidget *panel = centralWidget(); infoLabel = new MLabel(panel); infoLabel->setObjectName("infoLabel"); infoLabel->setStyleName(inv("CommonBodyText")); infoLabel->setWordWrap(true); infoLabel->setAlignment(Qt::AlignTop); actionItalic = new MAction(panel); actionItalic->setObjectName("actionItalic"); actionItalic->setLocation(MAction::ApplicationMenuLocation); addAction(actionItalic); connect(actionItalic, SIGNAL(triggered()), this, SLOT(makeTextItalic())); actionNormal = new MAction(panel); actionNormal->setObjectName("actionNormal"); actionNormal->setLocation(MAction::ApplicationMenuLocation); addAction(actionNormal); connect(actionNormal, SIGNAL(triggered()), this, SLOT(makeTextNormal())); MWidgetAction *widgetAction = new MWidgetAction(panel); widgetAction->setLocation(MAction::ApplicationMenuLocation); QStringList list; for (int i = 0; i < 5; ++i) { list << QString::number(100 + i); } comboBox = new MComboBox; comboBox->setObjectName("comboBox"); comboBox->addItems(list); comboBox->setIconVisible(false); comboBox->setTitle("ComboBox"); comboBox->setCurrentIndex(0); widgetAction->setWidget(comboBox); addAction(widgetAction); MLayout *layout = new MLayout(panel); layout->setContentsMargins(0, 0, 0, 0); panel->setLayout(layout); policy = new MLinearLayoutPolicy(layout, Qt::Vertical); policy->setContentsMargins(0, 0, 0, 0); policy->setSpacing(0); policy->addItem(infoLabel); retranslateUi(); }
PhoneBookCell::PhoneBookCell(QGraphicsItem *parent) : MListItem(parent), layout(NULL), landscapePolicy(NULL), portraitPolicy(NULL), landscapeTitleLabel(NULL), portraitTitleLabel(NULL), subtitleLabel(NULL), icon(NULL) { setStyleName(inv("CommonPanel")); }
ProfileContainer::ProfileContainer ( int id, const QString &title, bool vibra, MWidget *parent) : MWidgetController (parent), m_ProfileId (id), m_Button(0), m_Label(0) { QGraphicsLinearLayout *layout; /* * The layout. */ layout = new QGraphicsLinearLayout (Qt::Horizontal, this); layout->setContentsMargins (0., 0., 0., 0.); SYS_DEBUG ("Creating container for %s", SYS_STR(title)); /* * The switch button. */ m_Button = new MButton; m_Button->setCheckable (true); m_Button->setViewType (MButton::switchType); m_Button->setStyleName ("CommonRightSwitchInverted"); m_Button->setChecked (vibra); connect (m_Button, SIGNAL (toggled (bool)), this, SIGNAL (toggled (bool))); /* * The label. */ m_Label = new MLabel (title); m_Label->setStyleName ("CommonSingleTitleInverted"); /* * Adding these things together. */ layout->addItem (m_Label); layout->addItem (m_Button); layout->setAlignment (m_Label, Qt::AlignVCenter | Qt::AlignLeft); layout->setAlignment (m_Button, Qt::AlignVCenter | Qt::AlignLeft); setLayout (layout); setContentsMargins (0., 0., 0., 0.); setStyleName ("CommonPanelInverted"); setActive (false); }
void FoursquareAuthPage::createContent(void) { MApplicationPage::createContent(); setStyleName("CommonApplicationPage"); setPannable(false); MAction *cancelAction = new MAction(tr("Cancel"), this); cancelAction->setLocation(MAction::ToolBarLocation); connect(cancelAction, SIGNAL(triggered()), this, SLOT(dismiss())); addAction(cancelAction); QGraphicsAnchorLayout *layout = new QGraphicsAnchorLayout(); layout->setContentsMargins(0, 0, 0, 0); m_header = new ViewHeader(tr("Foursquare authentication")); layout->addCornerAnchors(m_header, Qt::TopLeftCorner, layout, Qt::TopLeftCorner); layout->addCornerAnchors(m_header, Qt::TopRightCorner, layout, Qt::TopRightCorner); QGraphicsGridLayout *subLayout = new QGraphicsGridLayout(); layout->addCornerAnchors(subLayout, Qt::TopLeftCorner, m_header, Qt::BottomLeftCorner); layout->addCornerAnchors(subLayout, Qt::BottomRightCorner, layout, Qt::BottomRightCorner); m_view = new QGraphicsWebView(); m_view->setResizesToContents(false); m_view->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); connect(m_view, SIGNAL(loadStarted()), this, SLOT(pageLoadStarted())); connect(m_view, SIGNAL(loadFinished(bool)), this, SLOT(pageLoadFinished(bool))); subLayout->addItem(m_view, 0, 0); m_nam = new FoursquareAuthNetworkAccessManager(m_view->page()->networkAccessManager(), REDIRECT_URL, this); connect(m_nam, SIGNAL(tokenReceived(QString)), this, SLOT(tokenReceived(QString))); m_view->page()->setNetworkAccessManager(m_nam); centralWidget()->setLayout(layout); Q_EMIT(created()); }
M_LIBRARY CredentialWidget::CredentialWidget(CredentialWidgetModel *model, QGraphicsItem *parent) : MWidgetController(model == 0 ? new CredentialWidgetModel : model, parent) { MWidgetView *defaultWidgetView = MTheme::view(this); // looks at the .conf file and constructs the view there. Q_ASSERT_X(defaultWidgetView, "no CredentialWidgetView", "There is no available WidgetView class for this widget - is there an existing and correct conf file?"); setView(defaultWidgetView); setStyleName("CredentialWidget"); }
QGraphicsLayout *DrillDownListItem::createLayout() { QGraphicsGridLayout *layout = new QGraphicsGridLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); layout->addItem(titleLabelWidget(), 0, 0, Qt::AlignLeft | Qt::AlignVCenter); imageWidget()->setStyleName("CommonDrillDownIcon"); layout->addItem(imageWidget(), 0, 1, Qt::AlignCenter); if (MApplication::instance()->objectName() == "widgetsgallery") { setStyleName("CommonBasicListItem"); titleLabelWidget()->setStyleName("CommonSingleTitle"); imageWidget()->setImage("icon-m-common-drilldown-arrow"); } else { setStyleName("CommonBasicListItemInverted"); titleLabelWidget()->setStyleName("CommonSingleTitleInverted"); imageWidget()->setImage("icon-m-common-drilldown-arrow-inverse"); } return layout; }
void MainPage::createContent(void) { m_bluez->start(); MApplicationPage::createContent(); setStyleName("CommonApplicationPage"); setPannable(false); createObjectMenuActions(); createActions(); QGraphicsAnchorLayout *layout = new QGraphicsAnchorLayout(); layout->setContentsMargins(0, 0, 0, 0); ViewHeader *header = new ViewHeader(tr("Stored tags")); layout->addCornerAnchors(header, Qt::TopLeftCorner, layout, Qt::TopLeftCorner); LabelOrList *list = new LabelOrList(TagStorage::storage(), _getTagListCellCreator, tr("You don't have any " "stored tags currently. " "Create some or harvest " "existing ones by touching " "them."), false, false); list->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); layout->addCornerAnchors(list, Qt::TopLeftCorner, header, Qt::BottomLeftCorner); layout->addCornerAnchors(list, Qt::BottomRightCorner, layout, Qt::BottomRightCorner); connect(list, SIGNAL(itemClicked(const QModelIndex &)), this, SLOT(tagSelected(const QModelIndex &))); connect(list, SIGNAL(itemLongTapped(const QModelIndex &, const QPointF &)), this, SLOT(tagLongSelected(const QModelIndex &, const QPointF &))); centralWidget()->setLayout(layout); }
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())); }
void LanguagePage::createContent() { MApplicationPage::createContent(); pannableViewport()->setAcceptGesturesFromAnyDirection(true); setStyleName(inv("CommonApplicationPage")); QGraphicsWidget *panel = centralWidget(); panel->setObjectName("panel"); MLayout *layout = new MLayout(panel); MGridLayoutPolicy *policy = new MGridLayoutPolicy(layout); policy->setContentsMargins(0, 0, 0, 0); policy->setSpacing(0); comboBoxLanguage = new MComboBox; comboBoxLanguage->setObjectName("comboBoxLanguage"); comboBoxLanguage->setStyleName(inv("CommonComboBox")); policy->addItem(comboBoxLanguage, 1, 1); comboBoxLcTime = new MComboBox; comboBoxLcTime->setObjectName("comboBoxLcTime"); comboBoxLcTime->setStyleName(inv("CommonComboBox")); comboBoxLcTimeFormat24h = new MComboBox; comboBoxLcTimeFormat24h->setObjectName("comboBoxLcTimeFormat24h"); comboBoxLcTimeFormat24h->setStyleName(inv("CommonComboBox")); comboBoxLcCollate = new MComboBox; comboBoxLcCollate->setObjectName("comboBoxLcCollate"); comboBoxLcCollate->setStyleName(inv("CommonComboBox")); comboBoxLcNumeric = new MComboBox; comboBoxLcNumeric->setObjectName("comboBoxLcNumeric"); comboBoxLcNumeric->setStyleName(inv("CommonComboBox")); comboBoxLcMonetary = new MComboBox; comboBoxLcMonetary->setObjectName("comboBoxLcMonetary"); comboBoxLcMonetary->setStyleName(inv("CommonComboBox")); labelHaveGconf = new MLabel; labelHaveGconf->setObjectName("labelHaveGconf"); labelHaveGconf->setStyleName(inv("CommonBodyText")); labelHaveGconf->setWordWrap(true); labelHaveIcu = new MLabel; labelHaveIcu->setObjectName("labelHaveIcu"); labelHaveIcu->setStyleName(inv("CommonBodyText")); labelHaveIcu->setWordWrap(true); labelExampleNumber = new MLabel; labelExampleNumber->setObjectName("labelExampleNumber"); labelExampleNumber->setStyleName(inv("CommonBodyText")); labelExampleNumber->setWordWrap(true); labelExampleDateTime = new MLabel; labelExampleDateTime->setObjectName("labelExampleDateTime"); labelExampleDateTime->setStyleName(inv("CommonBodyText")); labelExampleDateTime->setWordWrap(true); labelExampleWeekNumber = new MLabel; labelExampleWeekNumber->setObjectName("labelExampleWeekNumber"); labelExampleWeekNumber->setStyleName(inv("CommonBodyText")); labelExampleWeekNumber->setWordWrap(true); labelExampleCurrency = new MLabel; labelExampleCurrency->setObjectName("labelExampleCurrency"); labelExampleCurrency->setStyleName(inv("CommonBodyText")); labelExampleCurrency->setWordWrap(true); labelExampleTranslation1 = new MLabel; labelExampleTranslation1->setObjectName("labelExampleTranslation1"); labelExampleTranslation1->setStyleName(inv("CommonBodyText")); labelExampleTranslation1->setWordWrap(true); labelExampleTranslation2 = new MLabel; labelExampleTranslation2->setObjectName("labelExampleTranslation2"); labelExampleTranslation2->setStyleName(inv("CommonBodyText")); labelExampleTranslation2->setWordWrap(true); labelExampleTranslation3 = new MLabel; labelExampleTranslation3->setObjectName("labelExampleTranslation3"); labelExampleTranslation3->setStyleName(inv("CommonBodyText")); labelExampleTranslation3->setWordWrap(true); labelLtrTest = new MLabel; labelLtrTest->setObjectName("labelLtrTest"); labelLtrTest->setStyleName(inv("CommonBodyText")); labelLtrTest->setWordWrap(true); labelRtlTest = new MLabel; labelRtlTest->setObjectName("labelRtlTest"); labelRtlTest->setStyleName(inv("CommonBodyText")); labelRtlTest->setWordWrap(true); labelLtrTestRich = new MLabel; labelLtrTestRich->setObjectName("labelLtrTestRich"); labelLtrTestRich->setStyleName(inv("CommonBodyText")); labelLtrTestRich->setWordWrap(true); labelRtlTestRich = new MLabel; labelRtlTestRich->setObjectName("labelRtlTestRich"); labelRtlTestRich->setStyleName(inv("CommonBodyText")); labelRtlTestRich->setWordWrap(true); labelFontTest = new MLabel; labelFontTest->setObjectName("labelFontTest"); labelFontTest->setStyleName(inv("CommonBodyText")); labelFontTest->setWordWrap(true); labelFontTest->setWordWrap(true); policy->addItem(comboBoxLcTime, 2, 1); policy->addItem(comboBoxLcTimeFormat24h, 3, 1); policy->addItem(comboBoxLcCollate, 4, 1); policy->addItem(comboBoxLcNumeric, 5, 1); policy->addItem(comboBoxLcMonetary, 6, 1); policy->addItem(labelHaveGconf, 7, 1); policy->addItem(labelHaveIcu, 8, 1); policy->addItem(labelExampleNumber, 9, 1); policy->addItem(labelExampleDateTime, 10, 1); policy->addItem(labelExampleWeekNumber, 11, 1); policy->addItem(labelExampleCurrency, 12, 1); policy->addItem(labelExampleTranslation1, 13, 1); policy->addItem(labelExampleTranslation2, 14, 1); policy->addItem(labelExampleTranslation3, 15, 1); policy->addItem(labelLtrTest, 16, 1); policy->addItem(labelRtlTest, 17, 1); policy->addItem(labelLtrTestRich, 18, 1); policy->addItem(labelRtlTestRich, 19, 1); policy->addItem(labelFontTest, 20, 1); retranslateUi(); }
void CreateEditPage::createContent(void) { MApplicationPage::createContent(); setStyleName("CommonApplicationPage"); setPannable(false); createActions(); QGraphicsAnchorLayout *anchor = new QGraphicsAnchorLayout(); anchor->setContentsMargins(0, 0, 0, 0); anchor->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); ViewHeader *header = new ViewHeader(m_tag == TagStorage::NULL_TAG ? tr("Create tag contents") : tr("Edit tag contents")); anchor->addCornerAnchors(header, Qt::TopLeftCorner, anchor, Qt::TopLeftCorner); #ifdef LABEL_SIZE m_size = new MLabel(); m_size->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); m_size->setAlignment(Qt::AlignRight); anchor->addAnchor(m_size, Qt::AnchorBottom, anchor, Qt::AnchorBottom); anchor->addAnchor(m_size, Qt::AnchorRight, anchor, Qt::AnchorRight); #endif MWidget *layoutContainer = new MWidget(); layoutContainer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); m_layout = new QGraphicsLinearLayout(Qt::Vertical, layoutContainer); m_layout->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); m_name = new LabeledTextEdit(tr("Ok"), LabeledTextEdit::SingleLineEditAndLabel); m_name->setLabel(tr("Tag name")); m_name->setPrompt(tr("Enter tag name")); m_name->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); m_layout->addItem(m_name); m_layout->setAlignment(m_name, Qt::AlignLeft); connect(m_name, SIGNAL(contentsChanged(void)), this, SLOT(nameChanged(void))); MSeparator *sep = new MSeparator; sep->setStyleName("CommonHorizontalSeparator"); sep->setOrientation(Qt::Horizontal); layout()->addItem(sep); createPageSpecificContent(); MPannableViewport *view = new MPannableViewport(); view->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); view->setPanDirection(Qt::Vertical); view->setMinimumSize(100, 100); view->setWidget(layoutContainer); anchor->addAnchor(view, Qt::AnchorTop, header, Qt::AnchorBottom); #ifdef LABEL_SIZE anchor->addAnchor(view, Qt::AnchorBottom, m_size, Qt::AnchorTop); #else anchor->addAnchor(view, Qt::AnchorBottom, anchor, Qt::AnchorBottom); #endif anchor->addAnchor(view, Qt::AnchorLeft, anchor, Qt::AnchorLeft); anchor->addAnchor(view, Qt::AnchorRight, anchor, Qt::AnchorRight); centralWidget()->setLayout(anchor); if (m_tag == TagStorage::NULL_TAG) { setContentValidity(false); setNameValidity(false); setupNewData(); } else { load(); } }
void TextEntryPage::createContent() { MApplicationPage::createContent(); pannableViewport()->setAcceptGesturesFromAnyDirection(true); setStyleName(inv("CommonApplicationPage")); QGraphicsWidget *panel = centralWidget(); MLinearLayoutPolicy *layoutPolicy = TextEntryPage::createAndSetupLinearPolicy(panel); pageTitleLabel = new MLabel(centralWidget()); pageTitleLabel->setObjectName("pageTitleLabel"); pageTitleLabel->setStyleName(inv("CommonApplicationHeader")); layoutPolicy->addItem(pageTitleLabel); int row = 0; // free text line Entries << new MTextEdit(MTextEditModel::SingleLine, "", centralWidget()); Entries.at(row)->setStyleName(inv("CommonSingleInputFieldLabeled")); Entries.at(row)->setObjectName("freeTextTextEdit"); label0 = new MLabel(centralWidget()); label0->setObjectName("label0"); label0->setStyleName(inv("CommonFieldLabel")); label0->setWordWrap(true); label0->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); layoutPolicy->addItem(label0); layoutPolicy->addItem(Entries.at(row)); row++; // password line Entries << new MTextEdit(MTextEditModel::SingleLine, "", centralWidget()); Entries.at(row)->setObjectName("passwordTextEdit"); Entries.at(row)->setStyleName(inv("CommonSingleInputFieldLabeled")); label1 = new MLabel(centralWidget()); label1->setObjectName("label1"); label1->setStyleName(inv("CommonFieldLabel")); label1->setWordWrap(true); label1->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); Entries.at(row)->setEchoMode(MTextEditModel::Password); layoutPolicy->addItem(label1); layoutPolicy->addItem(Entries.at(row)); row++; // no echo line Entries << new MTextEdit(MTextEditModel::SingleLine, "", centralWidget()); Entries.at(row)->setObjectName("noEchoTextEdit"); Entries.at(row)->setStyleName(inv("CommonSingleInputFieldLabeled")); labelNoEcho = new MLabel(centralWidget()); labelNoEcho->setObjectName("labelNoEcho"); labelNoEcho->setStyleName(inv("CommonFieldLabel")); labelNoEcho->setWordWrap(true); labelNoEcho->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); Entries.at(row)->setEchoMode(MTextEditModel::NoEcho); layoutPolicy->addItem(labelNoEcho); layoutPolicy->addItem(Entries.at(row)); row++; // passwordEchoOnEdit Entries << new MTextEdit(MTextEditModel::SingleLine, "", centralWidget()); Entries.at(row)->setObjectName("passwordEchoOnEditTextEdit"); Entries.at(row)->setStyleName(inv("CommonSingleInputFieldLabeled")); labelEchoOnEdit = new MLabel(centralWidget()); labelEchoOnEdit->setObjectName("labelEchoOnEdit"); labelEchoOnEdit->setStyleName(inv("CommonFieldLabel")); labelEchoOnEdit->setWordWrap(true); labelEchoOnEdit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); Entries.at(row)->setEchoMode(MTextEditModel::PasswordEchoOnEdit); layoutPolicy->addItem(labelEchoOnEdit); layoutPolicy->addItem(Entries.at(row)); row++; // number content type Entries << new MTextEdit(MTextEditModel::SingleLine, "", centralWidget()); Entries.at(row)->setObjectName("numberTextEdit"); Entries.at(row)->setStyleName(inv("CommonSingleInputFieldLabeled")); label2 = new MLabel(centralWidget()); label2->setObjectName("label2"); label2->setStyleName(inv("CommonFieldLabel")); label2->setWordWrap(true); label2->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); Entries.at(row)->setContentType(M::NumberContentType); layoutPolicy->addItem(label2); layoutPolicy->addItem(Entries.at(row)); row++; // phone number content type Entries << new MTextEdit(MTextEditModel::SingleLine, "", centralWidget()); Entries.at(row)->setObjectName("phoneTextEdit"); Entries.at(row)->setStyleName(inv("CommonSingleInputFieldLabeled")); label3 = new MLabel(centralWidget()); label3->setObjectName("label3"); label3->setStyleName(inv("CommonFieldLabel")); label3->setWordWrap(true); label3->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); Entries.at(row)->setContentType(M::PhoneNumberContentType); layoutPolicy->addItem(label3); layoutPolicy->addItem(Entries.at(row)); row++; // email content type Entries << new MTextEdit(MTextEditModel::SingleLine, "", centralWidget()); Entries.at(row)->setObjectName("emailTextEdit"); Entries.at(row)->setStyleName(inv("CommonSingleInputFieldLabeled")); label4 = new MLabel(centralWidget()); label4->setObjectName("label4"); label4->setStyleName(inv("CommonFieldLabel")); label4->setWordWrap(true); label4->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); Entries.at(row)->setContentType(M::EmailContentType); layoutPolicy->addItem(label4); layoutPolicy->addItem(Entries.at(row)); row++; // url content type Entries << new MTextEdit(MTextEditModel::SingleLine, "", centralWidget()); Entries.at(row)->setObjectName("urlTextEdit"); Entries.at(row)->setStyleName(inv("CommonSingleInputFieldLabeled")); label5 = new MLabel(centralWidget()); label5->setObjectName("label5"); label5->setStyleName(inv("CommonFieldLabel")); label5->setWordWrap(true); label5->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); Entries.at(row)->setContentType(M::UrlContentType); layoutPolicy->addItem(label5); layoutPolicy->addItem(Entries.at(row)); row++; // multiline Entries << new MTextEdit(MTextEditModel::MultiLine, "", centralWidget()); Entries.at(row)->setObjectName("multilineTextEdit"); Entries.at(row)->setStyleName(inv("CommonSingleInputFieldLabeled")); label6 = new MLabel(centralWidget()); label6->setObjectName("label6"); label6->setStyleName(inv("CommonFieldLabel")); label6->setWordWrap(true); label6->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); label6->setAlignment(Qt::AlignTop); layoutPolicy->addItem(label6); layoutPolicy->addItem(Entries.at(row)); row++; // autoselection line Entries << new MTextEdit(MTextEditModel::SingleLine, "", centralWidget()); Entries.at(row)->setObjectName("autoselectionTextEdit"); Entries.at(row)->setStyleName(inv("CommonSingleInputFieldLabeled")); Entries.at(row)->setAutoSelectionEnabled(true); label7 = new MLabel(centralWidget()); label7->setObjectName("label7"); label7->setStyleName(inv("CommonFieldLabel")); label7->setWordWrap(true); label7->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); label7->setAlignment(Qt::AlignTop); layoutPolicy->addItem(label7); layoutPolicy->addItem(Entries.at(row)); row++; // completion Entries << new MTextEdit(MTextEditModel::MultiLine, "", centralWidget()); Entries.at(row)->setObjectName("completionTextEdit"); Entries.at(row)->setStyleName(inv("CommonSingleInputFieldLabeled")); QStringList list; list << "Betty Brey <*****@*****.**>" << "Anne Rodriguez <*****@*****.**>" << "Elizabeth Hutchings <*****@*****.**>" << "Robert Hornbuckle <*****@*****.**>" << "Willie Logan <*****@*****.**>" << "Marcia Pineda <*****@*****.**>" << "Jessica Schmitt <*****@*****.**>" << "Lynda Wan <*****@*****.**>" << "Alphonso Stevens <*****@*****.**>" << "Patricia Murphy <*****@*****.**>" << "Jeff Terry <*****@*****.**>" << "Richard Orlando <*****@*****.**>" << "Eva Quackenbush <*****@*****.**>" << "Tim Parker <*****@*****.**>" << "Deborah Sanchez <*****@*****.**>" << "Carol Reimer <*****@*****.**>" << "Susan Amaya <*****@*****.**>" << "Shelia Rudd <*****@*****.**>" << "Elizabeth Livingston <*****@*****.**>" << "Renee Heard <*****@*****.**>" << "Megan Gagne <*****@*****.**>" << "Katherine Enos <*****@*****.**>" << "Gary Hawkins <*****@*****.**>" << "Bianca Sparks <*****@*****.**>" << "Cleta Richardson <*****@*****.**>" << "Latoya Lawrence <*****@*****.**>" << "Ethel Allen <*****@*****.**>" << "Maria Austin <*****@*****.**>" << "John Smith <*****@*****.**>" << "Jane Smith <*****@*****.**>" << "Doug Barker <*****@*****.**>" << "Sandra Cross <*****@*****.**>" << "Debra Roberts <*****@*****.**>" << "Mei Copeland <*****@*****.**>" << "Raymond Slack <*****@*****.**>" << "Martin Vidal <*****@*****.**>" << "Patricia Rymer <*****@*****.**>" << "Maria Gilbreath <*****@*****.**>" << "Mary Ramos <*****@*****.**>" << "Michael Haller <*****@*****.**>" << "Randall Hood <*****@*****.**>" << "Bruce Lindsey <*****@*****.**>" << "Heidi Martin <*****@*****.**>" << "Helen Kennedy <*****@*****.**>" << "Margaret Worsham <*****@*****.**>" << "Sun Singleton <*****@*****.**>" << "Alberto Prince <*****@*****.**>" << "Norman Weiland <*****@*****.**>" << "Carolyn Delia <*****@*****.**>" << "Lakesha Acosta <*****@*****.**>"; QStringList cs, c1, c2; foreach(const QString & s, list) { cs = s.split('<'); if (cs.count() >= 2) { c1 << cs[0].trimmed(); c2 << QString('<' + cs[1]); } }
QGraphicsLayout * RightArrowItem::createLayout() { QGraphicsGridLayout *layout; MWidget *spacer; MLabel *titleLabel; MLabel *subTitleLabel = 0; MImageWidget *iconWidget = 0; MImageWidget *drillIconWidget; Qt::Alignment textAlignment = getTextAlignment (); layout = new QGraphicsGridLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); titleLabel = titleLabelWidget (); titleLabel->setWordWrap (true); drillIconWidget = new MImageWidget ("icon-m-common-drilldown-arrow-inverse"); drillIconWidget->setStyleName ("CommonDrillDownIcon"); titleLabel->setStyleName(m_TitleStyleName); switch (itemStyle()) { case TitleWithSubtitle: SYS_DEBUG ("TitleWithSubtitle"); /* * The title label. */ layout->addItem (titleLabel, 0, 0); layout->setAlignment(titleLabel, Qt::AlignLeft | Qt::AlignVCenter); /* * The sub-title label. */ subTitleLabel = subtitleLabelWidget (); subTitleLabel->setStyleName("CommonSubTitleInverted"); layout->addItem (subTitleLabel, 1, 0); layout->setAlignment (subTitleLabel, Qt::AlignLeft | Qt::AlignVCenter); spacer = new MWidget; layout->addItem (spacer, 2, 0); /* * The drill down icon. */ layout->addItem(drillIconWidget, 0, 1, 3, 1); layout->setAlignment (drillIconWidget, Qt::AlignVCenter | Qt::AlignRight); break; case IconWithTitleAndSubtitle: SYS_DEBUG ("IconWithTitleAndSubtitle"); /* * The left side icon. */ iconWidget = imageWidget(); layout->addItem (iconWidget, 0, 0, 2, 1); layout->setAlignment (iconWidget, Qt::AlignVCenter | Qt::AlignRight); /* * The title label. */ layout->addItem (titleLabel, 0, 1); layout->setAlignment (titleLabel, Qt::AlignLeft | Qt::AlignVCenter); /* * The sub-title label. */ subTitleLabel = subtitleLabelWidget (); subTitleLabel->setStyleName("CommonSubTitleInverted"); layout->addItem (subTitleLabel, 1, 1, Qt::AlignLeft | Qt::AlignVCenter); /* * The drill down icon. */ layout->addItem(drillIconWidget, 0, 2, 2, 1); layout->setAlignment (drillIconWidget, Qt::AlignVCenter | Qt::AlignRight); break; case IconWithTitle: SYS_DEBUG ("IconWithTitle"); /* * The left side icon. */ iconWidget = imageWidget(); layout->addItem (iconWidget, 0, 0); layout->setAlignment (iconWidget, Qt::AlignVCenter | Qt::AlignRight); /* * The title label. */ titleLabel->setAlignment (textAlignment | Qt::AlignVCenter); layout->addItem (titleLabel, 0, 1); layout->setAlignment (titleLabel, Qt::AlignLeft | Qt::AlignVCenter); /* * The drill down icon. */ layout->addItem(drillIconWidget, 0, 2); layout->setAlignment (drillIconWidget, Qt::AlignVCenter | Qt::AlignRight); break; default: SYS_WARNING ("itemStyle not supported."); } setStyleName ("CommonPanelInverted"); return layout; }
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 MAbstractLayoutPolicy::setObjectName(const QString &name) { mWarning("MAbstractLayoutPolicy") << Q_FUNC_INFO << "is deprecated. Use setStyleName() instead."; setStyleName(name); }
static int writeFontInfo(ufwCtx h, abfTopDict *top) { char buffer[FILENAME_MAX]; char buffer2[FILENAME_MAX]; abfFontDict *fontDict0; abfPrivateDict *privateDict; int i; if (h->lastiFD != ABF_UNSET_INT) fontDict0 = &(top->FDArray.array[h->lastiFD]); else fontDict0 = &(top->FDArray.array[0]); privateDict = &(fontDict0->Private); /* Set error handler */ DURING_EX(h->err.env) h->state = 1; /* Indicates writing to dst stream */ /* Open fontinfo.plist file as dst stream */ sprintf(buffer, "%s", "fontinfo.plist"); h->cb.stm.clientFileName = buffer; h->stm.dst = h->cb.stm.open(&h->cb.stm, UFW_DST_STREAM_ID, 0); if (h->stm.dst == NULL) fatal(h, ufwErrDstStream); writeLine(h, XML_HEADER); writeLine(h, PLIST_DTD_HEADER); writeLine(h, "<plist version=\"1.0\">"); writeLine(h, "<dict>"); /* This is what I care about the most. Add the rest in the order of the UFO 3 spec. */ writeLine(h, "\t<key>postscriptFontName</key>"); if (top->sup.flags & ABF_CID_FONT) { sprintf(buffer, "\t<string>%s</string>", top->cid.CIDFontName.ptr); writeLine(h, buffer); setStyleName(buffer2, top->cid.CIDFontName.ptr); writeLine(h, "\t<key>styleName</key>"); sprintf(buffer, "\t<string>%s</string>", buffer2); writeLine(h, buffer); } else { sprintf(buffer, "\t<string>%s</string>", fontDict0->FontName.ptr); writeLine(h, buffer); setStyleName(buffer2, fontDict0->FontName.ptr); writeLine(h, "\t<key>styleName</key>"); sprintf(buffer, "\t<string>%s</string>", buffer2); writeLine(h, buffer); } if (top->FamilyName.ptr != NULL) { writeLine(h, "\t<key>familyName</key>"); sprintf(buffer, "\t<string>%s</string>", top->FamilyName.ptr); writeLine(h, buffer); } if (top->sup.flags & ABF_CID_FONT) { if (top->cid.CIDFontVersion != 0) { char versionStr[32]; sprintf(versionStr, "%.3f", top->cid.CIDFontVersion); setVersionMajor(buffer2, versionStr); writeLine(h, "\t<key>versionMajor</key>"); sprintf(buffer, "\t<integer>%s</integer>", buffer2); writeLine(h, buffer); setVersionMinor(buffer2, versionStr); writeLine(h, "\t<key>versionMinor</key>"); sprintf(buffer, "\t<integer>%s</integer>", buffer2); writeLine(h, buffer); } } else { if (top->version.ptr != NULL) { setVersionMajor(buffer2, top->version.ptr); writeLine(h, "\t<key>versionMajor</key>"); sprintf(buffer, "\t<integer>%s</integer>", buffer2); writeLine(h, buffer); setVersionMinor(buffer2, top->version.ptr); writeLine(h, "\t<key>versionMinor</key>"); sprintf(buffer, "\t<integer>%s</integer>", buffer2); writeLine(h, buffer); } } if (top->Copyright.ptr != NULL) { writeLine(h, "\t<key>copyright</key>"); sprintf(buffer, "\t<string>%s</string>", top->Copyright.ptr); writeLine(h, buffer); } if (top->Notice.ptr != NULL) { writeLine(h, "\t<key>trademark</key>"); sprintf(buffer, "\t<string>%s</string>", top->Notice.ptr); writeLine(h, buffer); } writeLine(h, "\t<key>unitsPerEm</key>"); if (fontDict0->FontMatrix.cnt > 0) { sprintf(buffer, "\t<integer>%d</integer>", (int)round(1.0 / fontDict0->FontMatrix.array[0])); writeLine(h, buffer); } else { writeLine(h, "\t<integer>1000</integer>"); } if (top->ItalicAngle != cff_DFLT_ItalicAngle) { writeLine(h, "\t<key>italicAngle</key>"); sprintf(buffer, "\t<real>%.8f</real>", top->ItalicAngle); writeLine(h, buffer); } /* Now for all the other PostScript-specific UFO data */ if (top->FullName.ptr != NULL) { writeLine(h, "\t<key>postscriptFullName</key>"); sprintf(buffer, "\t<string>%s</string>", top->FullName.ptr); writeLine(h, buffer); } if (top->Weight.ptr != NULL) { writeLine(h, "\t<key>postscriptWeightName</key>"); sprintf(buffer, "\t<string>%s</string>", top->Weight.ptr); writeLine(h, buffer); } if (top->UnderlinePosition != cff_DFLT_UnderlinePosition) { writeLine(h, "\t<key>postscriptUnderlinePosition</key>"); sprintf(buffer, "\t<integer>%d</integer>", (int)round(0.5 + top->UnderlinePosition)); writeLine(h, buffer); } if (top->UnderlineThickness != cff_DFLT_UnderlineThickness) { writeLine(h, "\t<key>postscriptUnderlineThickness</key>"); sprintf(buffer, "\t<integer>%d</integer>", (int)round(0.5 + top->UnderlineThickness)); writeLine(h, buffer); } if ((top->isFixedPitch != cff_DFLT_isFixedPitch) && (top->isFixedPitch > 0)) { writeLine(h, "\t<key>postscriptIsFixedPitch</key>"); writeLine(h, "\t<true/>"); } /* All the Blue values */ if (privateDict->BlueValues.cnt != ABF_EMPTY_ARRAY) { writeLine(h, "\t<key>postscriptBlueValues</key>"); writeLine(h, "\t<array>"); for (i = 0; i < privateDict->BlueValues.cnt; i++) { float stem = privateDict->BlueValues.array[i]; if (stem == ((int)stem)) sprintf(buffer, "\t\t<integer>%d</integer>", (int)stem); else sprintf(buffer, "\t\t<real>%.2f</real>", stem); writeLine(h, buffer); } writeLine(h, "\t</array>"); } if (privateDict->OtherBlues.cnt != ABF_EMPTY_ARRAY) { writeLine(h, "\t<key>postscriptOtherBlues</key>"); writeLine(h, "\t<array>"); for (i = 0; i < privateDict->OtherBlues.cnt; i++) { float stem = privateDict->OtherBlues.array[i]; if (stem == ((int)stem)) sprintf(buffer, "\t\t<integer>%d</integer>", (int)stem); else sprintf(buffer, "\t\t<real>%.2f</real>", stem); writeLine(h, buffer); } writeLine(h, "\t</array>"); } if (privateDict->FamilyBlues.cnt != ABF_EMPTY_ARRAY) { writeLine(h, "\t<key>postscriptFamilyBlues</key>"); writeLine(h, "\t<array>"); for (i = 0; i < privateDict->FamilyBlues.cnt; i++) { float stem = privateDict->FamilyBlues.array[i]; if (stem == ((int)stem)) sprintf(buffer, "\t\t<integer>%d</integer>", (int)stem); else sprintf(buffer, "\t\t<real>%.2f</real>", stem); writeLine(h, buffer); } writeLine(h, "\t</array>"); } if (privateDict->FamilyOtherBlues.cnt != ABF_EMPTY_ARRAY) { writeLine(h, "\t<key>postscriptFamilyOtherBlues</key>"); writeLine(h, "\t<array>"); for (i = 0; i < privateDict->FamilyOtherBlues.cnt; i++) { float stem = privateDict->FamilyOtherBlues.array[i]; if (stem == ((int)stem)) sprintf(buffer, "\t\t<integer>%d</integer>", (int)stem); else sprintf(buffer, "\t\t<real>%.2f</real>", stem); writeLine(h, buffer); } writeLine(h, "\t</array>"); } if (privateDict->StemSnapH.cnt != ABF_EMPTY_ARRAY) { writeLine(h, "\t<key>postscriptStemSnapH</key>"); writeLine(h, "\t<array>"); for (i = 0; i < privateDict->StemSnapH.cnt; i++) { float stem = privateDict->StemSnapH.array[i]; if (stem == ((int)stem)) sprintf(buffer, "\t\t<integer>%d</integer>", (int)stem); else sprintf(buffer, "\t\t<real>%.2f</real>", stem); writeLine(h, buffer); } writeLine(h, "\t</array>"); } else if (privateDict->StdHW != ABF_UNSET_REAL) { float stem = privateDict->StdHW; writeLine(h, "\t<key>postscriptStemSnapH</key>"); writeLine(h, "\t<array>"); if (stem == ((int)stem)) sprintf(buffer, "\t\t<integer>%d</integer>", (int)stem); else sprintf(buffer, "\t\t<real>%.2f</real>", stem); writeLine(h, buffer); writeLine(h, "\t</array>"); } if (privateDict->StemSnapV.cnt != ABF_EMPTY_ARRAY) { writeLine(h, "\t<key>postscriptStemSnapV</key>"); writeLine(h, "\t<array>"); for (i = 0; i < privateDict->StemSnapV.cnt; i++) { float stem = privateDict->StemSnapV.array[i]; if (stem == ((int)stem)) sprintf(buffer, "\t\t<integer>%d</integer>", (int)stem); else sprintf(buffer, "\t\t<real>%.2f</real>", stem); writeLine(h, buffer); } writeLine(h, "\t</array>"); } else if (privateDict->StdVW != ABF_UNSET_REAL) { float stem = privateDict->StdVW; writeLine(h, "\t<key>postscriptStemSnapV</key>"); writeLine(h, "\t<array>"); if (stem == ((int)stem)) sprintf(buffer, "\t\t<integer>%d</integer>", (int)stem); else sprintf(buffer, "\t\t<real>%.2f</real>", stem); writeLine(h, buffer); writeLine(h, "\t</array>"); } if (privateDict->BlueScale != ABF_UNSET_REAL) { char *p; char valueBuffer[50]; /* 8 places is as good as it gets when converting ASCII real numbers->float-> ASCII real numbers, as happens to all the PrivateDict values.*/ sprintf(valueBuffer, "%.8f", privateDict->BlueScale); p = strchr(valueBuffer, '.'); if (p != NULL) { /* Have decimal point. Remove trailing zeroes.*/ int l = strlen(p); p += l - 1; while (*p == '0') { *p = '\0'; p--; } if (*p == '.') { *p = '\0'; } } writeLine(h, "\t<key>postscriptBlueScale</key>"); sprintf(buffer, "\t<real>%s</real>", valueBuffer); writeLine(h, buffer); } if (privateDict->BlueShift != ABF_UNSET_REAL) { writeLine(h, "\t<key>postscriptBlueShift</key>"); sprintf(buffer, "\t<integer>%d</integer>", (int)(0.5 + privateDict->BlueShift)); writeLine(h, buffer); } if (privateDict->BlueFuzz != ABF_UNSET_REAL) { writeLine(h, "\t<key>postscriptBlueFuzz</key>"); sprintf(buffer, "\t<integer>%d</integer>", (int)(0.5 + privateDict->BlueFuzz)); writeLine(h, buffer); } if ((privateDict->ForceBold != ABF_UNSET_INT) && (privateDict->ForceBold > 0)) { writeLine(h, "\t<key>postscriptForceBold</key>"); writeLine(h, "\t<true/>"); } /* Finish the file */ writeLine(h, "</dict>"); writeLine(h, "</plist>"); flushBuf(h); /* Close dst stream */ if (h->cb.stm.close(&h->cb.stm, h->stm.dst) == -1) return ufwErrDstStream; HANDLER if (h->stm.dst) h->cb.stm.close(&h->cb.stm, h->stm.dst); return Exception.Code; END_HANDLER return ufwSuccess; }