void Mt_MLabel::testLabelVsMWidgetController() { // Create MWidgetController + MWidgetView combination beginMemoryBenchmark(); MWidgetModel *m = new MWidgetModel; MWidgetController *c = new MWidgetController(m, NULL); MWidgetView *view = new MWidgetView(c); c->setView(view); qDebug() << "Memory consumption of MWidgetController + MWidgetView:"; outputAllocatedMemorySize(); delete c; c = NULL; QCoreApplication::processEvents(); endMemoryBenchmark(); // Create MLabel + MLabelView combination beginMemoryBenchmark(); MLabelModel *lm = new MLabelModel; MLabel *l = new MLabel(NULL, lm); MLabelView *lv = new MLabelView(l); l->setView(lv); qDebug() << "Memory consumption of MLabel + MLabelView:"; outputAllocatedMemorySize(); delete l; l = NULL; QCoreApplication::processEvents(); endMemoryBenchmark(); }
void Ut_MSettingsLanguageTextFactory::testCreateWidget() { // Create a settings text MSettingsLanguageText settingsText("TestKey", "Title"); MSettingsLanguageWidget dds; MockDataStore dataStore; MWidget *widget = MSettingsLanguageTextFactory::createWidget(settingsText, dds, &dataStore); QVERIFY(widget != NULL); // Expecting the widget to have a layout and linear policy QGraphicsLinearLayout *layout = dynamic_cast<QGraphicsLinearLayout *>(widget->layout()); QVERIFY(layout != NULL); // Expecting the layout to contain a MLabel and a MTextEdit QCOMPARE(layout->count(), 2); // The label's title should be the SettingsText's title MLabel *label = dynamic_cast<MLabel *>(layout->itemAt(0)); QVERIFY(label != NULL); QCOMPARE(label->text(), settingsText.title()); // The label's title should be the specified key's value MTextEdit *textEdit = dynamic_cast<MTextEdit *>(layout->itemAt(1)); QVERIFY(textEdit != NULL); QCOMPARE(textEdit->text(), dataStore.value("TestKey").toString()); delete widget; }
static void creatLabel (MLinearLayoutPolicy *policy, QString text, bool addSpacing=false) { MLabel *label = new MLabel (text); label->setWordWrap(true); label->setObjectName ("AccountSetupPageLabel"); policy->addItem(label); if (addSpacing) policy->setItemSpacing(policy->indexOf(label), 5); }
// ---------------------------------------------------------------------------- // 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 DcpDeclWidget::createErrorLabel(const QString& text) { MLabel* label; /* * It seems that he MSettingsLanguageParser can't tell us what was wrong. * Maybe we should add an implementation for that. */ label = new MLabel(this); label->setText("ERROR: " + text + "\nCheck log for details."); label->setWordWrap (true); ((QGraphicsLinearLayout*)(layout()))->addItem(label); DCP_WARNING(qPrintable(text)); }
void ConversationPage::processAttachments(const QMailMessage &message) { if (!message.status() & QMailMessageMetaData::HasAttachments) return; connect(this, SIGNAL(downloadCompleted()), this, SLOT(saveAttachment())); bool oneTimeFlag = true; for (uint i = 1; i < message.partCount(); ++i) { QMailMessagePart sourcePart = message.partAt(i); if (!(sourcePart.multipartType() == QMailMessagePartContainer::MultipartNone)) continue; if (oneTimeFlag) { MSeparator *separator = new MSeparator(); separator->setObjectName("Separator"); m_policy->addItem(separator); oneTimeFlag = false; } MStylableWidget *w = new MStylableWidget(this); QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal); w->setLayout(layout); //% "Attached: " MLabel *label = new MLabel(qtTrId("xx_attached")); label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); label->setObjectName ("AttachmentText"); layout->addItem(label); MButton *button = new MButton(sourcePart.displayName()); button->setObjectName ("AttachmentButton"); button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); layout->addItem(button); //% "Download..." AttachmentAction *action = new AttachmentAction(qtTrId("xx_download_context_menu"), button, sourcePart); connect(action, SIGNAL(triggered()), this, SLOT(openAttachmentDownloadDialog())); //% "Open..." action = new AttachmentAction(qtTrId("xx_open_context_menu"), button, sourcePart); connect(action, SIGNAL(triggered()), this, SLOT(openAttachmentOpenDialog())); m_policy->addItem (w); } }
NotificationAreaView::NotificationAreaView(NotificationArea *controller) : MWidgetView(controller), bannerLayout(new MLayout()), clearButtonLayout(new QGraphicsLinearLayout(Qt::Horizontal)), //% "Clear" clearButton(new MButton(qtTrId("qtn_noti_clear"))), andMore(new MStylableWidget) { // Set up the main layout QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical); mainLayout->setContentsMargins(0, 0, 0, 0); mainLayout->setSpacing(0); mainLayout->addItem(bannerLayout); mainLayout->addItem(andMore); mainLayout->addItem(clearButtonLayout); controller->setLayout(mainLayout); // Set up the banner layout bannerPolicy = new MLinearLayoutPolicy(bannerLayout, Qt::Vertical); bannerPolicy->setStyleName("NotificationAreaBannerLayoutPolicy"); bannerLayout->setContentsMargins(0, 0, 0, 0); bannerLayout->setPolicy(bannerPolicy); // Create the "and more" area andMore->setStyleName("AndMore"); andMore->setVisible(false); //% "And more" MLabel *andMoreLabel = new MLabel(qtTrId("qtn_noti_and_more")); andMoreLabel->setStyleName("AndMoreLabel"); QGraphicsLinearLayout *andMoreLayout = new QGraphicsLinearLayout(Qt::Horizontal); andMoreLayout->setContentsMargins(0, 0, 0, 0); andMoreLayout->setSpacing(0); andMoreLayout->addStretch(); andMoreLayout->addItem(andMoreLabel); andMore->setLayout(andMoreLayout); // Put a clear button into the clear button layout clearButtonLayout->setContentsMargins(0, 0, 0, 0); clearButtonLayout->setSpacing(0); clearButton->setStyleName("NotificationAreaClearButton"); connect(clearButton, SIGNAL(clicked()), controller, SLOT(removeAllRemovableBanners())); clearButtonLayout->addStretch(); clearButtonLayout->addItem(clearButton); clearButtonLayout->addStretch(); }
void MainPage::showAbout(void) { MLabel *label = new MLabel(tr("<big>NFC Tag Builder</big><br>" "<br>" "<br>v%1" "<br>" "Copyright (c) 2012 Hannu Mallat<br>" "<a href=\"http://hannu.mallat.fi/n9/nfctagbuilder\">http://hannu.mallat.fi/n9/nfctagbuilder</a><br>") .arg(VERSION)); label->setWordWrap(true); label->setAlignment(Qt::AlignHCenter); label->setStyleName("CommonQueryText"); connect(label, SIGNAL(linkActivated(const QString &)), this, SLOT(linkActivated(const QString &))); MMessageBox *box = new MMessageBox(); box->setCentralWidget(label); box->appear(); }
int main(int argc, char **argv) { MApplication app(argc, argv); MApplicationWindow window; MApplicationPage page; MTheme::loadCSS("twocolumns.css"); /* Create a MLayout that we set the policy for */ MLayout *layout = new MLayout(page.centralWidget()); MLinearLayoutPolicy *policy = new MLinearLayoutPolicy(layout, Qt::Horizontal); /* Setup first layout with a label and text edit */ MLayout *nameLayout = new MLayout; MLinearLayoutPolicy *namePolicy = new MLinearLayoutPolicy(nameLayout, Qt::Horizontal); MLabel *textEditLabel = new MLabel("Name:"); MTextEdit *textEdit = new MTextEdit(MTextEditModel::MultiLine); namePolicy->addItem(textEditLabel); //Add the label and textedit namePolicy->addItem(textEdit); textEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); /* Setup second layout with a large label */ MLayout *labelLayout = new MLayout; MLinearLayoutPolicy *labelPolicy = new MLinearLayoutPolicy(labelLayout, Qt::Horizontal); MLabel *label = new MLabel("Enter the name of the person who likes to listen to music while sorting their socks!"); label->setObjectName("nameLabel"); labelPolicy->addItem(label); label->setWordWrap(true); /* Add the two layouts to the layout */ policy->addItem(nameLayout); policy->addItem(labelLayout); /* Make the two layouts have an equal preferred size, so that they get an equal amount of space */ nameLayout->setPreferredWidth(1); labelLayout->setPreferredWidth(1); page.appear(&window); window.show(); return app.exec(); }
void LoginSheet::createCentralWidget() { QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical, centralWidget()); mainLayout->setContentsMargins(0,0,0,0); mainLayout->setSpacing(0); //% "Connect to Service" MLabel *label = new MLabel(qtTrId("xx_wg_sheets_connect_service")); label->setStyleName("CommonTitle"); label->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); mainLayout->addItem(label); mainLayout->addItem(createSpacer()); //% "Username:"******"xx_wg_sheets_username")); label->setStyleName("CommonFieldLabel"); mainLayout->addItem(label); userNameTextEdit = new MTextEdit; userNameTextEdit->setStyleName("CommonSingleInputFieldLabeled"); mainLayout->addItem(userNameTextEdit); mainLayout->addItem(createSpacer()); //% "Password:"******"xx_wg_sheets_password")); label->setStyleName("CommonFieldLabel"); mainLayout->addItem(label); MTextEdit *textEdit = new MTextEdit; textEdit->setStyleName("CommonSingleInputFieldLabeled"); textEdit->setEchoMode(MTextEditModel::Password); mainLayout->addItem(textEdit); mainLayout->addStretch(); }
QString AppWindow::getText(QString title, QString prompt, QString text) { MWidget *centralWidget = new MWidget; QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); centralWidget->setLayout(layout); MLabel *label = new MLabel(prompt, centralWidget); label->setStyleName("CommonTitleInverted"); MTextEdit *textEdit = new MTextEdit(MTextEditModel::SingleLine, text, centralWidget); layout->addItem(label); layout->addItem(textEdit); MDialog* dialog = new MDialog(title, M::OkButton | M::CancelButton); dialog->setCentralWidget(centralWidget); connect(dialog, SIGNAL(disappeared()), SLOT(processDialogResult())); if (dialog->exec(this) == M::OkButton) return textEdit->text(); return ""; }
int main(int argc, char **argv) { MApplication app(argc, argv); MTheme::loadCSS("layout_inside_layout.css"); MApplicationWindow window; MApplicationPage page; /* Create a MLayout that we set the policies for */ MLayout *layout = new MLayout; MLinearLayoutPolicy *portraitPolicy = new MLinearLayoutPolicy(layout, Qt::Horizontal); MLinearLayoutPolicy *landscapePolicy = new MLinearLayoutPolicy(layout, Qt::Horizontal); for (int i = 0; i < 3; ++i) { MLabel *label = new MLabel(QString("Item %1").arg(i + 1)); label->setAlignment(Qt::AlignCenter); label->setObjectName("item"); //Set CSS name for styling portraitPolicy->addItem(label); landscapePolicy->addItem(label); } /* Create a widget to hold the inner layout and to put inside the policy */ QGraphicsWidget *widget = new QGraphicsWidget; /* Create an inner layout. A QGraphicsGridLayout is used since we don't require * multiple policies here, but using a MLayout would also work. */ QGraphicsGridLayout *innerLayout = new QGraphicsGridLayout(widget); for (int i = 0; i < 4; ++i) { MLabel *label = new MLabel(QString("Inner Item %1").arg(i + 1)); label->setAlignment(Qt::AlignCenter); label->setObjectName("inneritem"); //Set CSS name for styling innerLayout->addItem(label, i / 2, i % 2); } /* Now add the widget to the landscape policy only, so that the innerLayout is hidden when device is rotated */ landscapePolicy->addItem(widget); layout->setLandscapePolicy(landscapePolicy); layout->setPortraitPolicy(portraitPolicy); /* Attach the layout to the page */ page.centralWidget()->setLayout(layout); page.appear(&window); window.show(); return app.exec(); }
void ConversationPage::createContent() { MApplicationPage::createContent(); setContentsMargins(0, 0, 0, 0); setPannable(true); createActions(); //% "Mail" setTitle(qtTrId("xx_page_title")); MLayout *layout = new MLayout(centralWidget()); layout->setContentsMargins(0, 0, 0, 0); layout->setAnimation(0); m_policy = new MLinearLayoutPolicy(layout, Qt::Vertical); m_policy->setObjectName("VerticalPolicy"); m_policy->setContentsMargins(0, 0, 0, 0); m_policy->setSpacing(0); QMailMessage message(m_id); //% "From" QString body = qtTrId("xx_from") + ": " + message.from().address() + "\n"; QStringList addresses = QMailAddress::toStringList(message.to()); //% "To" body.append(qtTrId("xx_to") + ": " + addresses.join("; ") + "\n"); addresses = QMailAddress::toStringList(message.cc()); if (addresses.size() > 0) //% "Cc" body.append(qtTrId("xx_cc" ) + ": " + addresses.join("; ") + "\n"); addresses = QMailAddress::toStringList(message.bcc()); if (addresses.size() > 0) //% "Bcc" body.append(qtTrId("xx_bcc" ) + ": " + addresses.join("; ") + "\n"); QMailAddress replyTo = message.replyTo(); if (!replyTo.isNull()) //% "Reply-To" body.append(qtTrId("xx_reply_to") + ": " + replyTo.toString() + "\n"); //% "Subject" body.append(qtTrId("xx_subject") + ": " + message.subject() + "\n"); //% "Date: %1" body.append(qtTrId("xx_date").arg(message.date().toLocalTime().toString(Qt::SystemLocaleShortDate))); MLabel *messageBody = new MLabel(body); messageBody->setWordWrap(true); messageBody->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); messageBody->setObjectName("BodyText"); m_policy->addItem(messageBody); MSeparator *separator = new MSeparator(); separator->setObjectName("Separator"); m_policy->addItem(separator); messageBody = new MLabel("\n" + Utils::bodyPlainText(&message)); messageBody->setWordWrap(true); messageBody->setObjectName("BodyText"); messageBody->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); m_policy->addItem (messageBody); processAttachments(message); centralWidget()->setLayout(layout); }
void ZGameClient::OnClanResponseClanInfo(void* pBlob) { int nCount = MGetBlobArrayCount(pBlob); if(nCount != 1) return; MTD_ClanInfo* pClanInfo = (MTD_ClanInfo*)MGetBlobArrayElement(pBlob, 0); // 이미 emblem을 가지고 있었으면 emblem interface 에 통보해준다 int nOldClanID = ZGetNetRepository()->GetClanInfo()->nCLID; // repository에 클랜정보를 보관한다 memcpy(ZGetNetRepository()->GetClanInfo(),pClanInfo,sizeof(MTD_ClanInfo)); // mlog("OnClanResponseClanInfo : "); // emblem interface 에 통보한다 ZGetEmblemInterface()->AddClanInfo(pClanInfo->nCLID); if(nOldClanID!=0) { ZGetEmblemInterface()->DeleteClanInfo(nOldClanID); } ZIDLResource* pRes = ZApplication::GetGameInterface()->GetIDLResource(); MPicture* pPicture= (MPicture*)pRes->FindWidget( "Lobby_ClanInfoEmblem" ); if ( pPicture) pPicture->SetBitmap( ZGetEmblemInterface()->GetClanEmblem2( pClanInfo->nCLID)); // 클랜 이름 MLabel* pLabel = (MLabel*)pRes->FindWidget("Lobby_ClanInfoName"); pLabel->SetText(ZGetNetRepository()->GetClanInfo()->szClanName); // 접속된 사람수 char szCount[16]; sprintf(szCount,"%d",ZGetNetRepository()->GetClanInfo()->nConnedMember); char szOutput[256]; // ZTranslateMessage(szOutput,MSG_LOBBY_CLAN_DETAIL,2, // ZGetNetRepository()->GetClanInfo()->szMaster,szCount); ZTransMsg(szOutput,MSG_LOBBY_CLAN_DETAIL,2, ZGetNetRepository()->GetClanInfo()->szMaster,szCount); pLabel = (MLabel*)pRes->FindWidget("Lobby_ClanInfoDetail"); pLabel->SetText(szOutput); sprintf(szOutput,"%d/%d",ZGetNetRepository()->GetClanInfo()->nWins,ZGetNetRepository()->GetClanInfo()->nLosses); ZBmNumLabel *pNumLabel = (ZBmNumLabel*)pRes->FindWidget("Lobby_ClanInfoWinLose"); pNumLabel->SetText(szOutput); sprintf(szOutput,"%d", ZGetNetRepository()->GetClanInfo()->nPoint); pNumLabel = (ZBmNumLabel*)pRes->FindWidget("Lobby_ClanInfoPoints"); pNumLabel->SetText(szOutput); pNumLabel = (ZBmNumLabel*)pRes->FindWidget("Lobby_ClanInfoTotalPoints"); // sprintf(szOutput,"%d",ZGetNetRepository()->GetClanInfo()->nWins,ZGetNetRepository()->GetClanInfo()->nXP); // pNumLabel->SetText(szOutput); pNumLabel->SetNumber(ZGetNetRepository()->GetClanInfo()->nTotalPoint,true); int nRanking = pClanInfo->nRanking; pNumLabel = (ZBmNumLabel*)pRes->FindWidget("Lobby_ClanInfoRanking"); pNumLabel->SetIndexOffset(16); // 아래쪽 색다른 글씨로 찍는다 MWidget *pUnranked = pRes->FindWidget("Lobby_ClanInfoUnranked"); if(nRanking == 0) { pNumLabel->Show(false); if ( pUnranked) pUnranked->Show(true); }else { pNumLabel->Show(true); pNumLabel->SetNumber(nRanking); if ( pUnranked) pUnranked->Show(false); } /* // UI상에 보여줘야 하지만 지금은 준비가 안되어있는 관계로 채팅창에 뿌린다. char szText[256]; sprintf(szText, "클랜명: %s", pClanInfo->szClanName); ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText); sprintf(szText, "레벨: %d", pClanInfo->nLevel); ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText); sprintf(szText, "경험치: %d", pClanInfo->nXP); ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText); sprintf(szText, "포인트: %d", pClanInfo->nPoint); ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText); sprintf(szText, "마스터: %s", pClanInfo->szMaster); ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText); sprintf(szText, "전적: %d승 %d패", pClanInfo->nWins, pClanInfo->nLoses); ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText); sprintf(szText, "클랜원정보: 총 %d명중 %d명 접속함", pClanInfo->nTotalMemberCount, pClanInfo->nConnedMember); ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText); */ }
MLabel* MLabel::create(const char* _str, uint _size, MColor _color) { MLabel* pRet = new MLabel(); pRet->initLabel(_str, _size, _color); return pRet; }
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(); }
void ZShopEquipInterface::SelectEquipmentTab(int nTabIndex) { if (nTabIndex == -1) nTabIndex = m_nEquipTabNum; ZIDLResource* pResource = GetIDLResource(); SetKindableItem( MMIST_NONE); // Set filter MComboBox* pComboBox = (MComboBox*)pResource->FindWidget( "Equip_AllEquipmentFilter"); if(pComboBox) { int sel = pComboBox->GetSelIndex(); ZMyItemList* pil = ZGetMyInfo()->GetItemList(); if ( pil) { pil->m_ListFilter = sel; pil->Serialize(); } } // EQUIPMENTLISTBOX MWidget* pWidget = pResource->FindWidget("EquipmentList"); if (pWidget != NULL) pWidget->Show(nTabIndex==0 ? true:false); pWidget = pResource->FindWidget("AccountItemList"); if (pWidget != NULL) pWidget->Show(nTabIndex==0 ? false:true); // 탭 버튼 MButton* pButton = (MButton*)pResource->FindWidget( "Equip"); if ( pButton) { pButton->Show( false); pButton->Enable( false); } pButton = (MButton*)pResource->FindWidget( "SendAccountItemBtn"); if ( pButton) { pButton->Show( false); pButton->Enable( false); } pButton = (MButton*)pResource->FindWidget( "BringAccountItemBtn"); if ( pButton) { pButton->Show( false); pButton->Enable( false); } pButton = (MButton*)pResource->FindWidget( "BringAccountSpendableItemConfirmOpen"); if ( pButton) { pButton->Show( false); pButton->Enable( false); } if ( nTabIndex == 0) { pButton = (MButton*)pResource->FindWidget( "Equip"); if (pButton) pButton->Show(true); pButton = (MButton*)pResource->FindWidget( "SendAccountItemBtn"); if (pButton) pButton->Show(true); } else if ( nTabIndex == 1) { pButton = (MButton*)pResource->FindWidget( "BringAccountItemBtn"); if ( pButton) pButton->Show( true); pButton = (MButton*)pResource->FindWidget( "BringAccountSpendableItemConfirmOpen"); if ( pButton) pButton->Show( false); } pButton = (MButton*)pResource->FindWidget("Equipment_CharacterTab"); if (pButton) pButton->Show( nTabIndex==0 ? false : true); pButton = (MButton*)pResource->FindWidget("Equipment_AccountTab"); if (pButton) pButton->Show( nTabIndex==1 ? false : true); // 탭 라벨 MLabel* pLabel; pLabel = (MLabel*)pResource->FindWidget("Equipment_FrameTabLabel1"); if ( pLabel) pLabel->Show( nTabIndex==0 ? true : false); pLabel = (MLabel*)pResource->FindWidget("Equipment_FrameTabLabel2"); if ( pLabel) pLabel->Show( nTabIndex==1 ? true : false); // 탭 리스트 MPicture* pPicture; pPicture = (MPicture*)pResource->FindWidget("Equip_ListLabel1"); if ( pPicture) pPicture->Show( nTabIndex==0 ? true : false); pPicture = (MPicture*)pResource->FindWidget("Equip_ListLabel2"); if ( pPicture) pPicture->Show( nTabIndex==1 ? true : false); // 프레임 탭 pPicture = (MPicture*)pResource->FindWidget("Equip_TabLabel"); MBitmap* pBitmap; if ( pPicture) { if ( nTabIndex == 0) pBitmap = MBitmapManager::Get( "framepaneltab1.tga"); else pBitmap = MBitmapManager::Get( "framepaneltab2.tga"); if ( pBitmap) pPicture->SetBitmap( pBitmap); } // 중앙은행 if (nTabIndex == 1) { ZGetMyInfo()->GetItemList()->ClearAccountItems(); ZGetMyInfo()->GetItemList()->SerializeAccountItem(); } // 아이템 슬롯 Enable/Disable for(int i = 0; i < MMCIP_END; i++) { ZItemSlotView* pItemSlot = (ZItemSlotView*)GetIDLResource()->FindWidget( GetItemSlotName( "Equip", i)); if( pItemSlot ) pItemSlot->EnableDragAndDrop( nTabIndex==0 ? true : false); } m_nEquipTabNum = nTabIndex; DrawCharInfoText(); }
// ---------------------------------------------------------------------------- // 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())); }
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 LookAlikeMainPrivate::onAboutActionTriggered() { static MApplicationPage *aboutPage = 0; if (aboutPage == 0) { const QString title = "LookAlike"; const QString version = "0.0.1"; const QString copyright = "Copyright (c) 2012 Igalia S.L."; const QString contact = "<a href=\"mailto:[email protected]\">[email protected]</a> | " "<a href=\"http://www.igalia.com\">www.igalia.com</a>"; const QString license = "This program is free software: you can redistribute it and/or modify " "it under the terms of the GNU Lesser General Public License " " as published by the Free Software Foundation; version 2.1 of " " the License, or (at your option) any later version.<br /><br />" "This package is distributed in the hope that it will be useful, " "but WITHOUT ANY WARRANTY; without even the implied warranty of " "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " "GNU General Public License for more details.<br /><br />" "You should have received a copy of the GNU General Public License " "along with this program. If not, see " "<a href=\"http://www.gnu.org/licenses\">http://www.gnu.org/licenses</a><br /><br />"; aboutPage = new MApplicationPage(); aboutPage->setStyleName("GalleryPage"); aboutPage->setTitle(title); QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, aboutPage->centralWidget()); MImageWidget *aboutIcon = new MImageWidget(); aboutIcon->setImage(QImage("/usr/share/icons/hicolor/64x64/apps/icon-l-lookalike.png")); MLabel *aboutTitle = new MLabel(title + " " + version); aboutTitle->setAlignment(Qt::AlignCenter); aboutTitle->setColor("white"); MLabel *aboutCopyright = new MLabel(copyright); aboutCopyright->setAlignment(Qt::AlignCenter); aboutCopyright->setColor("white"); MLabel *aboutContact = new MLabel(contact); aboutContact->setAlignment(Qt::AlignCenter); aboutContact->setColor("white"); MLabel *aboutLicense = new MLabel(license); aboutLicense->setAlignment(Qt::AlignJustify); aboutLicense->setWordWrap(true); aboutLicense->setFont(QFont("Nokia Pure Text Light")); aboutLicense->setColor("white"); layout->addItem(aboutIcon); layout->addItem(aboutTitle); layout->addItem(aboutCopyright); layout->addItem(aboutContact); layout->addItem(aboutLicense); } showPage(aboutPage, true); }
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); }