millionSec::millionSec() { // Obtain a QMLDocument and load it into the qml variable, using build patterns. QmlDocument *qml = QmlDocument::create("asset:///second.qml"); qml->setParent(this); NavigationPane *nav = qml->createRootObject<NavigationPane>(); // If the QML document is valid, we process it. if (!qml->hasErrors()) { // Create the application Page from QMLDocument. //Page *appPage = qml->createRootObject<Page>(); if (nav) { // Set the main scene for the application to the Page. Application::instance()->setScene(nav); DropDown *day = DropDown::create(); int date = day->selectedIndex(); DropDown *month = DropDown::create(); month->add(Option::create().text("Jan")); month->add(Option::create().text("Feb")); } } }
void ImagePaintRecipe::onSelectedIndexChanged(int selectedIndex) { DropDown* dropDown = dynamic_cast<DropDown*>(sender()); if (dropDown) { // Change the tiling image for the paint to the one specified by the imageSource property. Option* selectedOption = dropDown->at(selectedIndex); ImagePaint paint(QUrl(selectedOption->imageSource()), RepeatPattern::XY); mRecipeContainer->setBackground(paint); } }
ImagePaintRecipe::ImagePaintRecipe(Container *parent) : CustomControl(parent) { mRecipeContainer = Container::create().top(50.0f).left(50.0f).right(50.0f); mRecipeContainer->setLayout(DockLayout::create()); mRecipeContainer->setPreferredSize(768, 1280); // ImagePaint defines which image to paint with and which // repeat pattern that should be used (both X and Y direction in this // case). The provided image needs to have a width and height that // is a power of two, for optimization purposes. Furthermore, the image // has to be accompanied by a meta file (with file ending .amd) // with the "repeatable" property set to true. Please note that the // .png format extension has been dropped on the file name in order for the matching // images/imagepaint/Tile_nistri_16x16.amd file to be found. ImagePaint paint(QUrl("asset:///images/imagepaint/Tile_nistri_16x16.amd"), RepeatPattern::XY); mRecipeContainer->setBackground(paint); // A drop down control with a couple of different tile images, all of // various power of two dimensions. DropDown *dropDown = new DropDown(); dropDown->setTitle("Select tile"); // Set up Options and add it to the DropDown. dropDown->add( Option::create().text("Nistri").image( QUrl("asset:///images/imagepaint/Tile_nistri_16x16.amd"))); dropDown->add( Option::create().text("Pyamas").image( QUrl("asset:///images/imagepaint/Tile_pyamas_16x16.amd"))); dropDown->add( Option::create().text("Tactile").image( QUrl("asset:///images/imagepaint/Tile_tactile_stripes_16x16.amd"))); dropDown->add( Option::create().text("White Stripes").image( QUrl("asset:///images/imagepaint/Tile_white_stripes_16x16.amd"))); dropDown->add( Option::create().text("Scribble Light").image( QUrl("asset:///images/imagepaint/Tile_scribble_light_256x256.amd"))); dropDown->add( Option::create().text("Light Toast").image( QUrl("asset:///images/imagepaint/Tile_light_toast_128x128.amd"))); dropDown->add( Option::create().text("Tile Gplay").image( QUrl("asset:///images/imagepaint/Tile_gplay_256x256.amd"))); // Connect to the signal for index changes, so that we can update the recipe when a new selection is made. connect(dropDown, SIGNAL(selectedIndexChanged(int)), this, SLOT(onSelectedIndexChanged(int))); mRecipeContainer->add(dropDown); setRoot(mRecipeContainer); }
void PgcMessages::addAccounts(QObject* dropDownObject) const { DropDown* dropDown = qobject_cast<DropDown*>(dropDownObject); bool selected = true; foreach (const Account &account, m_accountList) { const QString name = (account.displayName().isEmpty() ? tr("No Name") : account.displayName()); Option::Builder option = Option::create().text(tr("%1 (%2)").arg(name, account.provider().name())) .value(QVariant::fromValue(account.id())) .selected(selected); selected = false; dropDown->add(option); } }
LRESULT CALLBACK DropDown::DropDownWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { Win::Dow::Handle win (hwnd); DropDown * pDropDown = win.GetLong<DropDown *> (); switch (msg) { case WM_KEYDOWN: if (wParam == VK_RETURN) { pDropDown->OnEnter (); } break; case WM_CHAR: // If we don't ignore this, Windows will beep. if (wParam == VK_RETURN) return 0; } return pDropDown->CallOrgWndProc (hwnd, msg, wParam, lParam); }
void DropDown::KillDropDownsByWindow(CWindowID Window) { // First kill any associated with this window DropDown *Ptr = (DropDown *) CurrentDropDowns.GetHead(); while (Ptr != NULL) { DropDown * Next = (DropDown *) CurrentDropDowns.GetNext(Ptr); // as we may remove this item from the list if (Ptr->Initialised && (Ptr->ParentDlg==Window)) Ptr->Init(NULL, 0); Ptr = Next; } // Now process children if any wxWindowList::Node * pNode = Window->GetChildren().GetFirst(); while (pNode) { KillDropDownsByWindow(pNode->GetData()); pNode = pNode->GetNext(); } return; }
void App::handleInvokeButtonClick() { Button *button = dynamic_cast<Button*>(QObject::sender()); DropDown* qddAction = root->findChild<DropDown*>("qddAction"); QString action; if(qddAction->selectedIndex() != 5){ action = qddAction->at(qddAction->selectedIndex())->text(); } else{ action = root->findChild<QObject*>("qtaAction")->property("text").toString(); } QString mime = root->findChild<QObject*>("qtaMimeType")->property("text").toString(); QString uri = root->findChild<QObject*>("qtaURI")->property("text").toString(); QString data = root->findChild<QObject*>("qtaData")->property("text").toString(); QString target = button->text(); invoke(0, action, mime, uri, data, target); }
void setOption(std::string option) { dropDown->SetOption(option); if(dropDown->callback) { int optionIndex = 0; for(optionIndex = 0; optionIndex < dropDown->options.size(); optionIndex++) { if(option == dropDown->options[optionIndex].first) break; } dropDown->callback->OptionChanged(dropDown, dropDown->options[optionIndex]); } }
DropDownWindow(DropDown * dropDown): Window(ui::Point(dropDown->Position.X+dropDown->GetParentWindow()->Position.X-5, dropDown->Position.Y+dropDown->GetParentWindow()->Position.Y-3), ui::Point(dropDown->Size.X+10, 1+dropDown->options.size()*16)), dropDown(dropDown), appearance(dropDown->Appearance) { int currentY = 1; for(int i = 0; i < dropDown->options.size(); i++) { Button * tempButton = new Button(Point(1, currentY), Point(Size.X-2, 16), dropDown->options[i].first); tempButton->Appearance = appearance; if(i) tempButton->Appearance.Border = ui::Border(0, 1, 1, 1); tempButton->SetActionCallback(new ItemSelectedAction(this, dropDown->options[i].first)); AddComponent(tempButton); currentY += 16; } }
LogicPasteApp::LogicPasteApp(Application *app) : QObject(app), loginSheet_(NULL), ignoreSettingsEvent_(false) { qDebug() << "LogicPasteApp::LogicPasteApp()"; QCoreApplication::setOrganizationName("LogicProbe"); QCoreApplication::setApplicationName("LogicPaste"); qRegisterMetaType<PasteListing>("PasteListing"); pasteModel_ = new PasteModel(this); QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); qml->setContextProperty("cs", this); qml->setContextProperty("model", pasteModel_); AppSettings *appSettings = AppSettings::instance(); if(!qml->hasErrors()) { tabbedPane_ = qml->createRootObject<TabbedPane>(); if(tabbedPane_) { // Paste page pastePage_ = tabbedPane_->findChild<Page*>("pastePage"); connect(pastePage_, SIGNAL(submitPaste()), this, SLOT(onSubmitPaste())); replaceDropDown(pastePage_, "formatDropDown"); // History page historyNav_ = tabbedPane_->findChild<NavigationPane*>("historyPage"); connect(historyNav_, SIGNAL(popTransitionEnded(bb::cascades::Page*)), this, SLOT(onPopFinished(bb::cascades::Page*))); historyPage_ = historyNav_->findChild<Page*>("pasteListPage"); connect(historyPage_, SIGNAL(refreshPage()), pasteModel_, SLOT(refreshHistory())); ListView *historyList = historyPage_->findChild<ListView*>("pasteList"); historyList->setDataModel(pasteModel_->historyModel()); connect(historyList, SIGNAL(openPaste(QString)), this, SLOT(onOpenHistoryPaste(QString))); connect(historyList, SIGNAL(copyUrl(QString)), this, SLOT(onCopyText(QString))); connect(historyList, SIGNAL(deletePaste(QString)), this, SLOT(onDeleteHistoryPaste(QString))); connect(pasteModel_, SIGNAL(historyUpdating()), historyPage_, SLOT(onRefreshStarted())); connect(pasteModel_, SIGNAL(historyUpdated(bool)), this, SLOT(onHistoryRefreshComplete(bool))); // Trending page trendingNav_ = tabbedPane_->findChild<NavigationPane*>("trendingPage"); connect(trendingNav_, SIGNAL(popTransitionEnded(bb::cascades::Page*)), this, SLOT(onPopFinished(bb::cascades::Page*))); trendingPage_ = trendingNav_->findChild<Page*>("pasteListPage"); trendingPage_->findChild<ActionItem*>("refreshAction")->setEnabled(true); connect(trendingPage_, SIGNAL(refreshPage()), pasteModel_, SLOT(refreshTrending())); ListView *trendingList = trendingPage_->findChild<ListView*>("pasteList"); trendingList->setDataModel(pasteModel_->trendingModel()); connect(trendingList, SIGNAL(openPaste(QString)), this, SLOT(onOpenTrendingPaste(QString))); connect(trendingList, SIGNAL(copyUrl(QString)), this, SLOT(onCopyText(QString))); connect(pasteModel_, SIGNAL(trendingUpdating()), trendingPage_, SLOT(onRefreshStarted())); connect(pasteModel_, SIGNAL(trendingUpdated(bool)), this, SLOT(onTrendingRefreshComplete(bool))); // Settings page settingsPage_ = tabbedPane_->findChild<Page*>("settingsPage"); CheckBox *sslCheckBox = settingsPage_->findChild<CheckBox *>("sslCheckBox"); sslCheckBox->setChecked(appSettings->useSsl()); CheckBox *formatterEnable = settingsPage_->findChild<CheckBox*>("formatterEnable"); formatterEnable->setChecked(appSettings->formatterEnabled()); CheckBox *formatterLineNumbering = settingsPage_->findChild<CheckBox*>("formatterLineNumbering"); formatterLineNumbering->setChecked(appSettings->formatterLineNumbering()); DropDown *formatterStyle = settingsPage_->findChild<DropDown*>("formatterStyle"); for(int i = formatterStyle->count() - 1; i >= 0; --i) { if(formatterStyle->at(i)->value() == appSettings->formatterStyle()) { formatterStyle->setSelectedIndex(i); break; } } connect(settingsPage_, SIGNAL(requestLogin()), this, SLOT(onRequestLogin())); connect(settingsPage_, SIGNAL(requestLogout()), this, SLOT(onRequestLogout())); connect(settingsPage_, SIGNAL(refreshUserDetails()), pasteModel_, SLOT(refreshUserDetails())); connect(settingsPage_, SIGNAL(connectionSettingsChanged()), this, SLOT(onConnectionSettingsChanged())); connect(settingsPage_, SIGNAL(pasteSettingsChanged()), this, SLOT(onPasteSettingsChanged())); connect(settingsPage_, SIGNAL(formatterSettingsChanged()), this, SLOT(onFormatterSettingsChanged())); connect(pasteModel_, SIGNAL(userDetailsUpdated()), this, SLOT(onUserDetailsUpdated())); connect(pasteModel_, SIGNAL(userDetailsError(QString)), this, SLOT(onUserDetailsError(QString))); connect(pasteModel_, SIGNAL(userAvatarUpdated()), this, SLOT(onUserAvatarUpdated())); connect(pasteModel_, SIGNAL(deletePasteError(PasteListing,QString)), this, SLOT(onDeletePasteError(PasteListing,QString))); FormatDropDown *formatDropDown = replaceDropDown(settingsPage_, "formatDropDown"); connect(formatDropDown, SIGNAL(selectedIndexChanged(int)), this, SLOT(onPasteSettingsChanged())); // Tabbed pane connect(tabbedPane_, SIGNAL(activePaneChanged(bb::cascades::AbstractPane*)), this, SLOT(onActivePaneChanged(bb::cascades::AbstractPane*))); app->setScene(tabbedPane_); // Create the pull-down menu ActionItem *aboutItem = ActionItem::create() .title(tr("About")) .image(QUrl("asset:///images/action-about.png")); connect(aboutItem, SIGNAL(triggered()), this, SLOT(onAboutActionTriggered())); Menu *menu = Menu::create() .addAction(aboutItem); app->setMenu(menu); if(pasteModel_->isAuthenticated()) { onUserDetailsUpdated(); onUserAvatarUpdated(); } refreshPastePageDefaults(); refreshMainActions(); } }