Esempio n. 1
0
void LoginScene::menuCallBack(Ref *pSender, Widget::TouchEventType eventType){
    if(eventType == Widget::TouchEventType::ENDED){
        MButton *button = (MButton*) pSender;
        int tag = button->getTag();
        switch (tag) {
            case BTN_FACEBOOK:
                CCLOG("%s","Login with facebook!");
                break;
            case BTN_LOGIN:
                CCLOG("%s","Login with esxit!");
                break;
            case BTN_REGISTER:
                {
                    auto registerscene = RegisterScene::createScene();
                    Director::getInstance()->replaceScene(TransitionMoveInR::create(0.25f, registerscene));
                    
                }
                break;
            case BTN_PLAYNOW:
                {
                    auto select = ShowGame::createScene();
                    Director::getInstance()->replaceScene(TransitionCrossFade::create(0.15f, select));
                }
                break;
            case BTN_FOGOTPASSWORD:
                CCLOG("%s","Forgot_Password!");
                break;
            default:
                
                break;
        }
    }

}
Esempio n. 2
0
void TLMienNam::menuCallBack(Ref *pSender, ui::Widget::TouchEventType eventType){
    MButton *btn = (MButton*) pSender;
    if(eventType == ui::Widget::TouchEventType::ENDED){
        int tag = btn->getTag();
        switch (tag) {
            case BTN_MENU:
                CCLOG("%s","menu");
                {
                    auto select = TableSelect::createScene();
                    Director::getInstance()->replaceScene(TransitionCrossFade::create(0.15f, select));
                }
                break;
            case BTN_MESSAGE:
                CCLOG("%s","message");
                break;
            case BTN_PURCHASE:
                CCLOG("%s","purchase");
                break;
            case BTN_SOUND:
                CCLOG("%s","sound");
                break;
            default:
                break;
        }
    }
    
}
Esempio n. 3
0
void ShowGame::menuCallBack(cocos2d::Ref *sender, Widget::TouchEventType type){
    if(type == Widget::TouchEventType::ENDED) {
        MButton *button = (MButton*) sender;
        int tag = button->getTag();
        switch (tag) {
            case TAG_BTN_BACK:
                CCLOG("%s","btn_back");
                {
                    auto registerscene = LoginScene::createScene();
                    Director::getInstance()->replaceScene(TransitionCrossFade::create(0.25f, registerscene));
                }
                break;
            case TAG_BTN_CAIDAT:
                CCLOG("%s","btn_catdat");
                {
                    m_popupSetting->appear();
                }
                break;
            case TAG_BTN_MENU:
                CCLOG("%s","btn_menu");
                break;
            case TAG_BTN_NAPXU:
                CCLOG("%s","btn_napxu");
                break;
            case TAG_BTN_TROGIUP:
                CCLOG("%s","btn_trogiup");
                break;
            default:
                break;
        }
    }
    
}
Esempio n. 4
0
void TableSelect::menuCallBack(cocos2d::Ref *sender, Widget::TouchEventType type){
    if(type == Widget::TouchEventType::ENDED){
        MButton *button = (MButton*) sender;
        int tag = button->getTag();
        switch (tag) {
            case BTN_BACK:
                CCLOG("%s","Button Back");
                {
                    auto select = ShowGame::createScene();
                    Director::getInstance()->replaceScene(TransitionCrossFade::create(0.15f, select));
                }
                break;
            case BTN_CREATE:
                CCLOG("%s","Button create");
                break;
            case BTN_GOTO:
                CCLOG("%s","Button GoTo");
                break;
            case BTN_PLAYNOW:
                CCLOG("%s","Button Play Now");
                {
                    auto select = TLMienNam::createScene();
                    Director::getInstance()->replaceScene(TransitionCrossFade::create(0.15f, select));
                }
                break;
            case BTN_REFRESH:
                CCLOG("%s","Button Refresh");
                break;
            default:
                break;
        }
    }

}
QGraphicsWidget* StatusIndicatorMenuDropDownView::createTopRow()
{
    // Create an extension area for the top row plugins
    settingsPluginsExtensionArea = new MApplicationExtensionArea("com.meego.core.MStatusIndicatorMenuExtensionInterface/1.0");
    connect(settingsPluginsExtensionArea, SIGNAL(extensionInstantiated(MApplicationExtensionInterface*)), controller, SLOT(setStatusIndicatorMenuInterface(MApplicationExtensionInterface*)));
    settingsPluginsExtensionArea->setObjectName("StatusIndicatorMenuTopRowExtensionArea");
    settingsPluginsExtensionArea->setInProcessFilter(QRegExp("/statusindicatormenu-(volume|alarms|internetconnection|presence|profile).desktop$"));
    settingsPluginsExtensionArea->setOutOfProcessFilter(QRegExp("$^"));
    settingsPluginsExtensionArea->setOrder((QStringList()  << "statusindicatormenu-volume.desktop" << "statusindicatormenu-alarms.desktop" << "statusindicatormenu-internetconnection.desktop" << "statusindicatormenu-presence.desktop" << "statusindicatormenu-profile.desktop"));

    // Create a button for accessing the full settings
    //% "Settings"
    MButton *settingsButton = new MButton(qtTrId("qtn_stat_menu_settings"));
    settingsButton->setObjectName("StatusIndicatorMenuTopRowExtensionButton");
    settingsButton->setViewType(MButton::iconType);
    settingsButton->setIconID("icon-m-status-menu-settings");
    connect(settingsButton, SIGNAL(clicked()), controller, SLOT(launchControlPanelAndHide()));

    // Put the extension area and the settings button to a horizontal layout
    QGraphicsLinearLayout *topRowLayout = new QGraphicsLinearLayout(Qt::Horizontal);
    topRowLayout->setContentsMargins(0, 0, 0, 0);
    topRowLayout->setSpacing(0);
    topRowLayout->addStretch();
    topRowLayout->addItem(settingsPluginsExtensionArea);
    topRowLayout->addItem(settingsButton);
    topRowLayout->addStretch();

    // Create a container widget for extension area and settings button layout
    MWidgetController *topRowWidget = new MStylableWidget;
    topRowWidget->setStyleName("StatusIndicatorMenuExtensionAreaWidget");
    topRowWidget->setLayout(topRowLayout);

    return topRowWidget;
}
void MButtonGroupPrivate::buttonToggle(bool checked)
{
    Q_Q(MButtonGroup);

    MButton *button = static_cast<MButton *>(this->sender());
    if (!button) {
        mWarning("MButtonGroup") << "buttonToggle(): slot unexpectedly called by someone else than MButton";
        return;
    }

    if (!button->isCheckable()) {
        mWarning("MButtonGroup") << "buttonToggle(): Cannot check non-checkable button.";
        return;
    }

    if (checked && q->exclusive() && checkedButton) {
        exclusive = false;
        checkedButton->setChecked(false);
        exclusive = true;
    }

    if (checked) {
        checkedButton = button;
    } else if (checkedButton == button) {
        /* If a button is unchecked and its same as checkedButton, then
           checkedButton should be reset as well */
        checkedButton = 0;
    }
}
void PeopleApplication::initSearch()
{
    m_searchWidget = new MWidgetController;
    m_searchWidget->setViewType("background");
    m_searchWidget->setObjectName("PeopleSearch");
    m_searchWidget->setParentItem(m_mainPage);
    m_searchWidget->setZValue(1);
    m_searchWidget->hide();

    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal, m_searchWidget);

    m_searchEdit = new MTextEdit;
    m_searchEdit->setObjectName("PeopleSearchEdit");
    m_searchEdit->setPrompt(QObject::tr("Tap to start searching people","Prompt for search bar text edit field"));
    layout->addItem(m_searchEdit);
    layout->setAlignment(m_searchEdit, Qt::AlignVCenter);
    connect(m_searchEdit, SIGNAL(returnPressed()), this, SLOT(searchCommit()));

    // uncomment this line to enable dynamic search
    //connect(m_searchEdit, SIGNAL(textChanged()), this, SLOT(searchChanged()));

    MButton *button = new MButton();
    button->setIconID("icon-m-framework-close-alt");
    button->setObjectName("PeopleSearchButton");
    layout->addItem(button);
    layout->setAlignment(button, Qt::AlignVCenter);
    connect(button, SIGNAL(clicked()), this, SLOT(searchClear()));

    button = new MButton(QObject::tr("<b>Search</b>","Toolbar button to launch search widget"));
    button->setObjectName("PeopleSearchButton");
    layout->addItem(button);
    layout->setAlignment(button, Qt::AlignVCenter);
    connect(button, SIGNAL(clicked()), this, SLOT(searchCommit()));
}
Esempio n. 8
0
MButton* MButton::createButton(int _key, MObject* _target, ClickCallback _callbak)
{
	MButton* pRet = new MButton();
	pRet->m_target = _target;
	pRet->m_callback = _callbak;
	pRet->initButton(_key);
	return pRet;
}
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 Ut_MImToolbar::testHideGroup()
{
    m_subject->showToolbarWidget(toolbarData);
    //find button testbutton2, which click will hide group test
    MButton *button = qobject_cast<MButton *>(find("testbutton2"));
    QVERIFY(button != 0);
    button->click();
    QCOMPARE(m_subject->leftBar.layout()->count(), 1);
    QCOMPARE(m_subject->rightBar.layout()->count(), 1);
}
void Ut_MSettingsLanguageSelectionController::testButtonClicked()
{
    MockDataStore dataStore;
    MButton button;
    button.setProperty("key", QString("buttonKey"));
    button.setProperty("value", 1);
    button.setProperty("dataStore", qVariantFromValue(static_cast<void *>(&dataStore)));
    m_subject->buttonClicked(&button);
    QCOMPARE(dataStore.value("buttonKey").toInt(), 1);
}
void MSettingsLanguageBooleanController::buttonToggled(bool checked)
{
    // get button from signal sender
    MButton *button = static_cast<MButton *>(sender());

    if (button != NULL) {
        MDataStore *dataStore = static_cast<MDataStore *>(button->property("dataStore").value<void *>());
        if (dataStore != NULL) {
            dataStore->createValue(button->property("key").toString(), checked);
        }
    }
}
void Ut_MImToolbar::testSendString()
{
    m_subject->showToolbarWidget(toolbarData);
    QSignalSpy spy(m_subject, SIGNAL(sendStringRequest(const QString &)));
    QVERIFY(spy.isValid());
    //find button testbutton2, which click will send string
    MButton *button = qobject_cast<MButton *>(find("testbutton2"));
    QVERIFY(button != 0);
    button->click();
    QVERIFY(spy.count() == 1);
    spy.clear();
}
/*
 * Check that MButton doesn't change the model when
 * it's passed on the constructor.
 */
void Ut_MButton::testConstructorWithModel()
{
    MButtonModel *model = new MButtonModel;
    model->setText("foo");

    MButton *button = new MButton(0, model);

    QCOMPARE(model->text(), QString("foo"));
    QCOMPARE(button->text(), QString("foo"));

    delete button;
    // model should have gone to heaven on MButton's destructor.
}
void Ut_MImToolbar::testKeySequenceString()
{
    m_subject->showToolbarWidget(toolbarData);
    //find button testbutton1, which click will send key sequence (QKeyEvent)
    //because QKeyEvent is not supported by MetaType, use its own slot to test it.
    keyEvents = 0;
    connect(m_subject, SIGNAL(sendKeyEventRequest(const QKeyEvent &)),
            this, SLOT(receiveKeyEvent(const QKeyEvent &)));
    MButton *button = qobject_cast<MButton *>(find("testbutton1"));
    QVERIFY(button != 0);
    button->click();
    QVERIFY(keyEvents > 0);
    keyEvents = 0;
}
void Ut_MImToolbar::testRegion()
{
    QSKIP("Skip this case because Qt (4.7.1~git20101130) break the vkb toolbar.",
          SkipAll);
    QSignalSpy regionSignals(m_subject, SIGNAL(regionUpdated()));

    m_subject->showToolbarWidget(toolbarData);
    QCOMPARE(regionSignals.count(), 1);
    m_subject->updateVisibility();
    QCOMPARE(regionSignals.count(), 1);

    // Get region when there are two buttons on the right.
    const QRegion regionTwoButtons = m_subject->region();

    // When the region is substracted from rightRect there should be nothing left.
    const QRect rightRect = m_subject->rightBar.geometry().toRect();
    QVERIFY((QRegion(rightRect) - regionTwoButtons).isEmpty());

    // We need to add a new button, let's use groups.
    // Clicking testbutton1 will add one button to the right.
    MButton *button = qobject_cast<MButton *>(find("testbutton1"));
    QVERIFY(button != 0);
    button->click();

    while (QCoreApplication::hasPendingEvents()) {
        QCoreApplication::processEvents();
    }

    // Button added, check that regionUpdate() was emitted.
    QCOMPARE(regionSignals.count(), 2);

    // Get region when there are three buttons on the right.
    const QRegion regionThreeButtons = m_subject->region();

    // Toolbar always occupy the same region,
    // because our toolbar contains one line only.
    QCOMPARE(regionThreeButtons, regionTwoButtons);

    m_subject->finalizeOrientationChange();
    QCOMPARE(regionSignals.count(), 2);

    m_subject->hideToolbarWidget();

    QCOMPARE(regionSignals.count(), 3);

    m_subject->hide();

    QCOMPARE(regionSignals.count(), 4);
    QVERIFY(m_subject->region().isEmpty());
}
int MToolBarLayoutPolicy::labelOnlyButtonCount() const
{
    int cnt(0);

    for (int i = 0; i < widgetCount(); i++) {
        MButton *button = dynamic_cast<MButton *>(widgetAt(i));
        if (button &&
            !button->text().isEmpty() && button->iconID().isEmpty() &&
            button->viewType() == MButton::defaultType) {
            cnt++;
        }
    }

    return cnt;
}
void Ut_MImToolbar::testPaste()
{
    QSignalSpy spy(m_subject, SIGNAL(copyPasteRequest(CopyPasteState)));
    QVERIFY(spy.isValid());

    m_subject->showToolbarWidget(toolbarData);
    //find button testbutton2, which click will paste
    MButton *button = qobject_cast<MButton *>(find("testbutton2"));
    QVERIFY(button != 0);
    button->click();
    QVERIFY(spy.count() == 1);
    QVERIFY(spy.first().count() == 1);
    CopyPasteState result = spy.first().first().value<CopyPasteState>();
    QCOMPARE(result, InputMethodPaste);
    spy.clear();
}
Esempio n. 19
0
void TLMienNam::playCallBack(Ref *pSender, ui::Widget::TouchEventType eventType){
    MButton *btn = (MButton*) pSender;
     if(eventType == ui::Widget::TouchEventType::ENDED){
         int tag = btn->getTag();
         switch (tag) {
             case BTN_XEPBAI:
                 CCLOG("%s","xep bai");
                 break;
             case BTN_CHONLAI:
                 CCLOG("%s","chon lai");
                 break;
             default:
                 break;
         }
     }
    
}
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);
    }
}
// ----------------------------------------------------------------------------
// 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);
}
Esempio n. 22
0
void TableSelect::phongCallBack(cocos2d::Ref *sender, Widget::TouchEventType type){
    if(type == Widget::TouchEventType::ENDED){
        Size visibleSize = Director::getInstance()->getVisibleSize();
        Vec2 origin = Director::getInstance()->getVisibleOrigin();
        MButton *button = (MButton*) sender;
        int tag = button->getTag();
        switch (tag) {
            case BTN_PHONGVIP:
                CCLOG("%s","Phong Vip");
                btn_phong->runAction(MoveTo::create(0.1f, Vec2(origin.x+visibleSize.width*0.2f,origin.y)));
                break;
            case BTN_PHONGFREE:
                CCLOG("%s","Phong Free");
                btn_phong->runAction(MoveTo::create(0.1f, Vec2(origin.x+visibleSize.width*0.6f,origin.y)));
                break;
            default:
                break;
        }
    }
}
Esempio n. 23
0
void LoginScene::menuCallBack(Ref *pSender, Widget::TouchEventType eventType){
    if(eventType == Widget::TouchEventType::ENDED){
        MButton *button = (MButton*) pSender;
        int tag = button->getTag();
        switch (tag) {
            case TAG_BTN_FACEBOOK:
                CCLOG("%s","Login with facebook!");

				#ifdef SDKBOX_ENABLED
					sdkbox::PluginFacebook::login(); 
				#endif

                break;
            case TAG_BTN_LOGIN:
                CCLOG("%s","Login with esxit!");
                NetworkManager::getInstance()->getLoginMessageFromServer(user_id_str, password_str);
                
                break;
            case TAG_BTN_REGISTER:
                {
                    auto registerscene = RegisterScene::createScene();
                    Director::getInstance()->replaceScene(TransitionMoveInR::create(0.25f, registerscene));
                    
                }
                break;
            case TAG_BTN_PLAYNOW:
                {
					NetworkManager::getInstance()->getQuickPlayMessageFromServer("00000000", "Samsung galaxy S2");
					// auto select = ShowGame::createScene();
					// Director::getInstance()->replaceScene(TransitionCrossFade::create(0.15f, select));
                }
                break;
            case TAG_BTN_FOGOTPASSWORD:
                CCLOG("%s","Forgot_Password!");
                break;
            default:
                break;
        }
    }

}
Esempio n. 24
0
void CalendarPage::createPageSpecificContent(void)
{
	QList<MButton *> buttons;

	MButton *eButton = new MButton();
	eButton->setText(tr("Calendar event"));
	eButton->setSizePolicy(QSizePolicy::Preferred, 
			       QSizePolicy::Fixed);
	connect(eButton, SIGNAL(clicked()), this, SLOT(chooseEvent()));
	buttons << eButton;

	MButton *tButton = new MButton();
	tButton->setText(tr("Calendar to-do item"));
	tButton->setSizePolicy(QSizePolicy::Preferred, 
			       QSizePolicy::Fixed);
	connect(tButton, SIGNAL(clicked()), this, SLOT(chooseTodo()));
	buttons << tButton;

	m_calendarDetails = new LabelOrList(m_model,
					    _getCreator,
					    tr("Select a calendar entry"),
					    true,
					    false,
					    buttons);
	m_calendarDetails->setSizePolicy(QSizePolicy::Preferred, 
					 QSizePolicy::Preferred);
	layout()->addItem(m_calendarDetails);
	layout()->setAlignment(m_calendarDetails, Qt::AlignCenter);
}
MyNavBarContent::MyNavBarContent(QGraphicsItem *parent)
    : QGraphicsWidget(parent), d(new MyNavBarContentPrivate(this))
{
    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);
    setLayout(layout);
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    MSlider *slider = new MSlider;
    slider->setRange(0, 100);
    slider->setMinLabelVisible(true);
    slider->setMaxLabelVisible(true);
    slider->setHandleLabelVisible(true);
    layout->addItem(slider);

    MButton *okButton = new MButton("OK");
    okButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    okButton->setStyleName("ToolBarLabelOnlyCommonButton");
    connect(okButton, SIGNAL(clicked()), SIGNAL(okClicked()));
    layout->addItem(okButton);
}
Esempio n. 26
0
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()));
}
Esempio n. 27
0
void ShowGame::gameItemCallBack(cocos2d::Ref *sender, Widget::TouchEventType type){
    if(type == Widget::TouchEventType::ENDED){
        MButton *button = (MButton*) sender;
        int tag = button->getTag();
        switch (tag) {
            case TAG_GAME_XOCDIA:
                CCLOG("%s","game : xocdia");
                break;
            case TAG_GAME_XITO:
                CCLOG("%s","game : xito");
                break;
            case TAG_GAME_TLMN:
                CCLOG("%s","game : tlmn");
                {

                    auto registerscene = TLMienNam::createScene();

                    Director::getInstance()->replaceScene(TransitionCrossFade::create(0.25f, registerscene));
                }
                break;
            case TAG_GAME_TLMB:
                CCLOG("%s","game : tlmb");
                break;
            case TAG_GAME_POCKER:
                CCLOG("%s","game : pocker");
                break;
            case TAG_GAME_PHOM:
                CCLOG("%s","game : phom");
                break;
            case TAG_GAME_BACAY:
                CCLOG("%s","game : bacay");
                break;
            default:
                break;
        }
    }
    
}
void ArtistPage::createContent()
{
    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
    centralWidget()->setLayout(layout);

    layout->addItem(new MLabel("Albums:"));

    MButtonGroup *buttonGroup = new MButtonGroup(this);

    Album *album;
    MButton *albumButton;
    for (int i = 0; i < artist->albums.count(); i++) {
        album = artist->albums[i];

        albumButton = new MButton;
        albumButton->setText(album->title);

        layout->addItem(albumButton);
        buttonGroup->addButton(albumButton, i);
    }

    connect(buttonGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(displayAlbum(int)));
}
MOverlay *StatusIndicatorMenuDropDownView::createCloseButtonOverlay()
{
    // Create a close button
    MButton *closeButton = new MButton;
    closeButton->setViewType("icon");
    closeButton->setObjectName("StatusIndicatorMenuCloseButton");
    closeButton->setIconID("icon-m-framework-close");
    connect(closeButton, SIGNAL(clicked()), controller, SIGNAL(hideRequested()));

    // Add two overlay widgets that will not allow mouse events to pass through them next to the close button
    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);
    layout->addItem(new EventEaterWidget);
    layout->addItem(closeButton);
    layout->addItem(new EventEaterWidget);

    // Create the overlay itself
    MOverlay *closeButtonOverlay = new MOverlay;
    closeButtonOverlay->setLayout(layout);
    closeButtonOverlay->setObjectName("CloseButtonOverlay");

    return closeButtonOverlay;
}
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);
}