WebcamContent::WebcamContent(int input, QGraphicsScene * scene, QGraphicsItem * parent) : AbstractContent(scene, parent, false) , m_input(input) , m_still(false) { // enable frame text setFrameTextEnabled(true); setFrameText(tr("This is a mirror ;-)")); // initial pixmap setPixmap(QPixmap(":/data/insert-camera.png")); // add swap button ButtonItem * bSwap = new ButtonItem(ButtonItem::Control, Qt::blue, QIcon(":/data/action-flip-horizontal.png"), this); bSwap->setToolTip(tr("Mirror Video")); connect(bSwap, SIGNAL(clicked()), this, SLOT(slotToggleSwap())); addButtonItem(bSwap); // add snapshot button ButtonItem * bStill = new ButtonItem(ButtonItem::Control, Qt::blue, QIcon(":/data/action-snapshot.png"), this); bStill->setToolTip(tr("Still picture")); connect(bStill, SIGNAL(clicked()), this, SLOT(slotToggleStill())); addButtonItem(bStill); // start the video flow VideoProvider::instance()->connectInput(input, this, SLOT(setPixmap(const QPixmap &))); }
void BaseWordForm::PrepareHeader() { Header *header = GetHeader(); if (header) { if (!__pICHeader) __pICHeader = Utils::GetBitmapN("ic_header.png"); header->SetTitleIcon(__pICHeader); header->RemoveAllButtons(); header->RemoveAllItems(); if (__pContextMenu) { ButtonItem btnMenu; btnMenu.Construct(BUTTON_ITEM_STYLE_ICON, ID_MENU); btnMenu.SetIcon(BUTTON_ITEM_STATUS_NORMAL, Utils::GetBitmapN(L"ic_menu.png")); header->SetButton(BUTTON_POSITION_RIGHT, btnMenu); } // ButtonItem btnAddWord; // btnAddWord.Construct(BUTTON_ITEM_STYLE_ICON, ID_ADD_WORD); // //btnAddWord.SetText(GetString("IDS_ADD_WORD_BUTTON")); // btnAddWord.SetIcon(BUTTON_ITEM_STATUS_NORMAL, Utils::GetBitmap(L"ic_add_word.png")); // HeaderItem headerItem1; // header->SetTitleText("voc4u"); // header->SetButton(BUTTON_POSITION_RIGHT, btnAddWord); // header->PlayWaitingAnimation(HEADER_ANIMATION_POSITION_BUTTON_LEFT); header->SetTitleText("Voc4u"); header->AddActionEventListener(*this); } }
void AbstractContent::slotConfigure() { ButtonItem * item = dynamic_cast<ButtonItem *>(sender()); if (!item) return; emit configureMe(item->scenePos().toPoint()); }
bool CategoryItemForm::Initialize(String t, String d) { TabsForm::Initialize(FORM_STYLE_INDICATOR | FORM_STYLE_TEXT_TAB | FORM_STYLE_TITLE | FORM_STYLE_FOOTER, TabsForm::CATEGORY_TAB); SetTitleText(t); dir = d; AppResource* pAppResource = Application::GetInstance()->GetAppResource(); __pFooter = TabsForm::GetFooter(); __pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_ICON); __pFooter->AddActionEventListener(*this); __pFooter->SetBackButton(); SetFormBackEventListener(this); ButtonItem buttonItem; buttonItem.Construct(BUTTON_ITEM_STYLE_TEXT, SOFTKEY_INFO); buttonItem.SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL, pAppResource->GetBitmapN(L"info.png")); buttonItem.SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED, pAppResource->GetBitmapN(L"info_p.png")); __pFooter->SetButton(BUTTON_POSITION_LEFT, buttonItem); /*SetSoftkeyEnabled(SOFTKEY_1,true); SetSoftkeyText(SOFTKEY_1, Helper::GetTraslation("IDS_BACK")); SetSoftkeyActionId(SOFTKEY_1, SOFTKEY_BACK); AddSoftkeyActionListener(SOFTKEY_1, *this);*/ return true; }
void AbstractContent::slotConfigure() { ButtonItem * item = dynamic_cast<ButtonItem *>(sender()); if (item) emit requestConfig(item->scenePos().toPoint()); else emit requestConfig(scenePos().toPoint()); }
TodoHandleItem::TodoHandleItem( QGraphicsItem *item, MainModel *model ) : QObject( model ), QGraphicsEllipseItem( item ), m_model( model ) { init(); ButtonItem *button = new ButtonItem( this ); button->setPlus(); button->setClickEnabled( false ); }
void BMCategoriesForm::UpdateState() { ListView * pList = static_cast<ListView *>(GetControl(IDC_LISTVIEW, true)); pList->UpdateList(); Header* pHeader = GetHeader(); ButtonItem buttonItem; buttonItem.Construct(BUTTON_ITEM_STYLE_TEXT, ID_EDIT); buttonItem.SetText(m_bEditState ? GetString(IDS_DONE): GetString(IDS_EDIT)); pHeader->SetButton(BUTTON_POSITION_RIGHT, buttonItem); Invalidate(true); }
void HelpScreen::processLevelTick(unsigned int millisElapsed) { Music *music = (Music*) ResourcesManager::getResource("MenuMusic"); ButtonItem *backButton = (ButtonItem*) userInterface->getItem("ZBackButton"); if (backButton->isPressed()) { music->stop(500); userInterface->startFadeOut(200); actionAfterFade = 1; } if (actionAfterFade > 0 && !userInterface->isFading()) { GameMenu *menu = new GameMenu(); GameApp::getInstance()->setCurrentLevel(menu); } Level::processLevelTick(millisElapsed); }
void LocalTrackModel::slot_activate_link() { Debug::debug() << " [LocalTrackModel] slot_activate_link"; ButtonItem* button = qobject_cast<ButtonItem*>(sender()); if (!button) return; MEDIA::LinkPtr link = qvariant_cast<MEDIA::LinkPtr>( button->data() ); m_active_link = link; /* register update */ m_active_link->state = SERVICE::DATA_OK; emit dataChanged(); }
result UserProfileForm::OnInitializing(void) { BaseForm::OnInitializing(); AppResource* pAppResource = Application::GetInstance()->GetAppResource(); __pLeftItemBitmap = pAppResource->GetBitmapN(L"facebook_icon1.png"); ButtonItem buttonLeftItem; buttonLeftItem.Construct(BUTTON_ITEM_STYLE_ICON,NULL); buttonLeftItem.SetIcon(BUTTON_ITEM_STATUS_NORMAL, __pLeftItemBitmap); Header* pHeader = GetHeader(); pHeader->SetStyle(HEADER_STYLE_TITLE); pHeader->SetButton(BUTTON_POSITION_LEFT, buttonLeftItem); pHeader->SetTitleText(L"Your Profile Page"); result r = E_SUCCESS; //Read Access Token Registry reg; r = reg.Construct(L"/Home/FacebookReg.ini", false ); String token; String section = L"Facebook"; String entry = L"AccessToken"; r = reg.GetValue(section, entry , token); if(r == E_SUCCESS) AppLog("token is %ls",token.GetPointer()); else AppLog("Reading failed: %s", GetErrorMessage(r)); __accessToken =token; String profileurl; profileurl.Append(L"https://graph.facebook.com/me?"); profileurl.Append(L"access_token="); profileurl.Append(__accessToken); SendRequestGet(profileurl); return r; }
bool CustomHybridForm::Initialize() { NativeBridgeForm::Initialize(); unsigned long style = GetFormStyle(); Footer* pFooter; if (style & FORM_STYLE_FOOTER) { pFooter = GetFooter(); pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT); ButtonItem btnCharac; btnCharac.Construct(BUTTON_ITEM_STYLE_TEXT, ID_BUTTON_CHARAC); btnCharac.SetText("envoi au JS des caractères spéciaux"); pFooter->SetButton(BUTTON_POSITION_RIGHT, btnCharac); pFooter->AddActionEventListener(*this); } return true; }
PictureContent::PictureContent(QGraphicsScene * scene, QGraphicsItem * parent) : AbstractContent(scene, parent, false) , m_photo(0) , m_opaquePhoto(false) , m_progress(0) , m_netWidth(0) , m_netHeight(0) , m_netReply(0) { // enable frame text setFrameTextEnabled(true); setFrameText(tr("...")); // add flipping buttons ButtonItem * bFlipH = new ButtonItem(ButtonItem::FlipH, Qt::blue, QIcon(":/data/action-flip-horizontal.png"), this); bFlipH->setToolTip(tr("Flip horizontally")); bFlipH->setFlag(QGraphicsItem::ItemIgnoresTransformations, false); connect(bFlipH, SIGNAL(clicked()), this, SIGNAL(flipHorizontally())); addButtonItem(bFlipH); ButtonItem * bFlipV = new ButtonItem(ButtonItem::FlipV, Qt::blue, QIcon(":/data/action-flip-vertical.png"), this); bFlipV->setToolTip(tr("Flip vertically")); bFlipV->setFlag(QGraphicsItem::ItemIgnoresTransformations, false); addButtonItem(bFlipV); connect(bFlipV, SIGNAL(clicked()), this, SIGNAL(flipVertically())); /*ButtonItem * bCrop = new ButtonItem(ButtonItem::Control, Qt::blue, QIcon(":/data/action-scale.png"), this); bCrop->setToolTip(tr("")); bCrop->setFlag(QGraphicsItem::ItemIgnoresTransformations, false); addButtonItem(bCrop); connect(bCrop, SIGNAL(clicked()), this, SIGNAL(toggleCropMode()));*/ }
PictureContent::PictureContent(bool spontaneous, QGraphicsScene * scene, QGraphicsItem * parent) : AbstractContent(scene, spontaneous, false, parent) , m_photo(0) , m_opaquePhoto(false) , m_progress(0) , m_netWidth(0) , m_netHeight(0) , m_netReply(0) , m_watcher(0) , m_watcherTimer(0) { // enable frame text setFrameTextEnabled(true); setFrameText(tr("...")); // allow dropping setAcceptDrops(true); // add flipping buttons ButtonItem * bFlipH = new ButtonItem(ButtonItem::FlipH, Qt::blue, QIcon(":/data/action-flip-horizontal.png"), this); bFlipH->setToolTip(tr("Flip horizontally")); bFlipH->setFlag(QGraphicsItem::ItemIgnoresTransformations, false); connect(bFlipH, SIGNAL(clicked()), this, SIGNAL(flipHorizontally())); addButtonItem(bFlipH); ButtonItem * bFlipV = new ButtonItem(ButtonItem::FlipV, Qt::blue, QIcon(":/data/action-flip-vertical.png"), this); bFlipV->setToolTip(tr("Flip vertically")); bFlipV->setFlag(QGraphicsItem::ItemIgnoresTransformations, false); addButtonItem(bFlipV); connect(bFlipV, SIGNAL(clicked()), this, SIGNAL(flipVertically())); #if 0 // add cropping button (TODO: enable this?) ButtonItem * bCrop = new ButtonItem(ButtonItem::Control, Qt::blue, QIcon(":/data/action-scale.png"), this); bCrop->setToolTip(tr("")); bCrop->setFlag(QGraphicsItem::ItemIgnoresTransformations, false); addButtonItem(bCrop); connect(bCrop, SIGNAL(clicked()), this, SIGNAL(requestCrop())); #endif }
AbstractContent::AbstractContent(QGraphicsScene *scene, bool fadeIn, bool noRescale, QGraphicsItem * parent) : AbstractDisposeable(fadeIn, parent) , m_contentRect(-100, -75, 200, 150) , m_frame(0) , m_frameTextItem(0) , m_controlsVisible(false) , m_dirtyTransforming(false) , m_transformRefreshTimer(0) , m_gfxChangeTimer(0) , m_mirrorItem(0) #if QT_VERSION < 0x040600 , m_rotationAngle(0) #endif , m_fxIndex(0) { // the buffered graphics changes timer m_gfxChangeTimer = new QTimer(this); m_gfxChangeTimer->setInterval(0); m_gfxChangeTimer->setSingleShot(true); // customize item's behavior setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsSelectable); #if QT_VERSION >= 0x040600 setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); #endif // allow some items (eg. the shape controls for text) to be shown setFlag(QGraphicsItem::ItemClipsChildrenToShape, false); setAcceptHoverEvents(true); // create child controls createCorner(Qt::TopLeftCorner, noRescale); createCorner(Qt::TopRightCorner, noRescale); createCorner(Qt::BottomLeftCorner, noRescale); createCorner(Qt::BottomRightCorner, noRescale); //ButtonItem * bFront = new ButtonItem(ButtonItem::Control, Qt::blue, QIcon(":/data/action-order-front.png"), this); //bFront->setToolTip(tr("Raise")); //connect(bFront, SIGNAL(clicked()), this, SLOT(slotStackRaise())); //addButtonItem(bFront); ButtonItem * bConf = new ButtonItem(ButtonItem::Control, Qt::green, QIcon(":/data/action-configure.png"), this); bConf->setToolTip(tr("Change properties...")); connect(bConf, SIGNAL(clicked()), this, SLOT(slotConfigure())); addButtonItem(bConf); ButtonItem * bPersp = new ButtonItem(ButtonItem::Control, Qt::red, QIcon(":/data/action-perspective.png"), this); bPersp->setToolTip(tr("Drag around to change the perspective.\nHold SHIFT to move faster.\nUse CTRL to cancel the transformations.")); connect(bPersp, SIGNAL(dragging(const QPointF&,Qt::KeyboardModifiers)), this, SLOT(slotSetPerspective(const QPointF&,Qt::KeyboardModifiers))); connect(bPersp, SIGNAL(doubleClicked()), this, SLOT(slotClearPerspective())); addButtonItem(bPersp); ButtonItem * bDelete = new ButtonItem(ButtonItem::Control, Qt::red, QIcon(":/data/action-delete.png"), this); bDelete->setSelectsParent(false); bDelete->setToolTip(tr("Remove")); connect(bDelete, SIGNAL(clicked()), this, SIGNAL(requestRemoval())); addButtonItem(bDelete); // create default frame Frame * frame = FrameFactory::defaultPictureFrame(); setFrame(frame); // hide and layoutChildren buttons layoutChildren(); // add to the scene scene->addItem(this); // display mirror #if QT_VERSION >= 0x040600 // WORKAROUND with Qt 4.6-tp1 there are crashes activating a mirror before setting the scene // need to rethink this anyway setMirrored(false); #else setMirrored(RenderOpts::LastMirrored); #endif }
result EnrichedTextForm::OnInitializing(void) { BaseForm::OnInitializing(); result r = E_SUCCESS; ButtonItem buttonLeftItem; buttonLeftItem.Construct(BUTTON_ITEM_STYLE_TEXT, ID_EXIT); buttonLeftItem.SetText(L"Back"); Rectangle rect(20, 200, 680, 360); __pEnrichedText = new (std::nothrow) EnrichedText(); __pEnrichedText->Construct(Dimension(rect.width, rect.height)); __pEnrichedText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP); __pEnrichedText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT); __pEnrichedText->SetTextWrapStyle(TEXT_WRAP_NONE); __pEnrichedText->SetTextAbbreviationEnabled(true); Font* pFont = new (std::nothrow) Font(); pFont->Construct(FONT_STYLE_PLAIN, 35); Font* pFontItalic = new (std::nothrow) Font(); pFontItalic->Construct(FONT_STYLE_ITALIC, 30); Bitmap* pBitmap = App::GetInstance()->GetAppResource()->GetBitmapN(L"home_type3.png"); if (pBitmap) { pBitmap->Scale(Dimension(50, 50)); } __pTextElement1 = new (std::nothrow) TextElement(); __pTextElement2 = new (std::nothrow) TextElement(); __pTextElement3 = new (std::nothrow) TextElement(); __pTextElement1->Construct(L"Tizen is a new open platform that enables richer user experience"); __pTextElement2->Construct(L"in applications on mobile devices."); __pTextElement3->Construct(L"Tizen API Reference provides of all the powerful features. Tizen is a new open platform that enables richer user experience in applications on mobile devices"); __pTextElement1->SetTextColor(Color::GetColor(COLOR_ID_YELLOW)); __pTextElement2->SetTextColor(Color::GetColor(COLOR_ID_BLUE)); __pTextElement2->SetFont(*pFont); __pTextElement3->SetTextColor(Color::GetColor(COLOR_ID_VIOLET)); __pTextElement3->SetFont(*pFontItalic); __pEnrichedText->Add(*__pTextElement1); __pEnrichedText->Add(*__pTextElement2); __pEnrichedText->Add(*pBitmap); __pEnrichedText->Add(*__pTextElement3); __pEnrichedText->Refresh(); ListView* pListview = static_cast<ListView*>(GetControl("IDC_LISTVIEW", true)); if(pListview) { pListview->SetBounds(0, GetClientAreaBounds().height/2, GetClientAreaBounds().width, GetClientAreaBounds().height/2); pListview->AddListViewItemEventListener(*this); pListview->SetItemProvider(*this); } delete pFont; delete pFontItalic; delete pBitmap; return r; }