int main(int argc, char **argv) { /* The base class of all DirectUI applications */ MApplication app(argc, argv); /* The application window is a top-level window that contains the Home and Back/Close framework controls, Navigation bar, View menu and Toolbar components */ MApplicationWindow w; w.show(); /* Pages represent one "view" of an application, into which you can add your application's contents. An application can have any number of pages with transitions between them */ MApplicationPage p; p.appear(&w); /* Let's add a simple push button to our page */ MButton b(p.centralWidget()); /* The (optional) constructor parameter causes our button to be a child of the central widget of the page. This pattern can be used with all MWidgets */ b.setText("Hello World!"); return app.exec(); }
void MScenePrivate::showFpsCounter(QPainter *painter, float fps) { Q_Q(MScene); QString display = QString("FPS: %1").arg((int)(fps + 0.5f)); /* Draw a simple FPS counter in the lower right corner */ static QRectF fpsRect(0, 0, FpsBoxSize.width(), FpsBoxSize.height()); if (!q->views().isEmpty()) { MApplicationWindow *window = qobject_cast<MApplicationWindow *>(q->views().at(0)); if (window) { if (manager && manager->orientation() == M::Portrait) fpsRect.moveTo(QPointF(window->visibleSceneSize().height() - FpsBoxSize.width(), window->visibleSceneSize().width() - FpsBoxSize.height())); else fpsRect.moveTo(QPointF(window->visibleSceneSize().width() - FpsBoxSize.width(), window->visibleSceneSize().height() - FpsBoxSize.height())); } } painter->fillRect(fpsRect, fpsBackgroundBrush); painter->setPen(FpsTextColor); painter->setFont(FpsFont); painter->drawText(fpsRect, Qt::AlignCenter, display); }
int main (int argc, char **argv) { MApplication app (argc, argv); MApplicationWindow * window = new MApplicationWindow(); window->show(); Page * page = new Page(); page->appear (window); return app.exec(); }
int main(int argc, char *argv[]) { int exitCode = 0; MApplication nApp(argc, argv); MApplicationWindow *nMainWin = new MApplicationWindow(); nMainWin->setStyleName("CommonNKaistaWindow"); NMainPage *nMainPage = new NMainPage() ; nMainWin->sceneManager()->appearSceneWindowNow(nMainPage); nMainWin->show(); exitCode = nApp.exec(); return exitCode; }
M_EXPORT int main(int argc, char *argv[]){ MApplication* application = MComponentCache::mApplication(argc, argv); application->setOrganizationName("arcean"); application->setOrganizationDomain("arcean.com"); application->setApplicationName("foss-calc"); MApplicationWindow* window = MComponentCache::mApplicationWindow(); MainPage page; page.appear(window); window->showFullScreen(); return application->exec(); }
int main (int argc, char *argv[]) { MApplication app(argc, argv); MApplicationWindow window; window.showFullScreen(); MApplicationPage page; page.setPannable(false); page.appear(MApplication::instance()->activeWindow()); WeatherApplicationExtension *WAE; WAE = new WeatherApplicationExtension(); WAE->initialize("dddd"); page.setCentralWidget(WAE->widget()); int result = app.exec(); return result; }
int main(int argc, char **argv) { MApplication app(argc, argv); MTheme::loadCSS("calculator.css"); //Load the example svg file in the same directory MTheme::addPixmapDirectory(".", M::NonRecursive); MApplicationWindow window; MApplicationPage page; CalculatorWidget *calculatorWidget = new CalculatorWidget; page.setCentralWidget(calculatorWidget); page.appear(&window); window.show(); return app.exec(); }
void ToolBarPage::clearToolbarActions() { QList<QAction *> acts = actions(); int actsSize = acts.size(); for (int i = 0; i < actsSize; ++i) { MAction *action = qobject_cast<MAction *>(acts[i]); if (action && action->location().testFlag(MAction::ToolBarLocation)) { removeAction(action); } } MApplicationWindow* window = ((MApplicationWindow*)MApplication::activeWindow()); acts = window->actions(); actsSize = acts.size(); for (int i = 0; i < actsSize; ++i) { window->removeAction(acts[i]); } }
int main(int argc, char **argv) { MApplication app(argc, argv); MApplicationWindow window; MainPage *mainPage; // That's the data that will be displayed by our application. // For the sake of keeping the example as simple as possible we use // a very simplistic data structure. QList<Artist *> artistsList; fillOutData(artistsList); mainPage = new MainPage(artistsList); mainPage->appear(&window); window.show(); return app.exec(); }
int main(int argc, char **argv) { /* The base class of all DirectUI applications */ MApplication app(argc, argv); /* The application window is a top-level window that contains the Home and Back/Close framework controls, Navigation bar, View menu and Toolbar components */ MApplicationWindow w; /* Pages represent one "view" of an application, into which you can add your application's contents. An application can have any number of pages with transitions between them */ TrackerGridPage p; p.appear(&w); w.show(); return app.exec(); }
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(); }
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 ArtistPage::createContent() { MApplicationPage::createContent(); QGraphicsWidget *panel = centralWidget(); MLayout* layout = new MLayout(panel); m_policy = new MLinearLayoutPolicy(layout, Qt::Vertical); layout->setAnimation(NULL); panel->setLayout(layout); layout->setLandscapePolicy(m_policy); layout->setPortraitPolicy(m_policy); if (m_pageMode == ALL_ARTISTS) { // Menu Actions MAction* actionImportLastfm = new MAction(panel); actionImportLastfm->setText(tr("Import from Last.fm")); actionImportLastfm->setLocation(MAction::ApplicationMenuLocation); addAction(actionImportLastfm); connect(actionImportLastfm, SIGNAL(triggered()), this, SLOT(slotImportLastfm())); MAction* actionAddArtist = new MAction(panel); actionAddArtist->setText(tr("Add artist")); actionAddArtist->setLocation(MAction::ApplicationMenuLocation); addAction(actionAddArtist); connect(actionAddArtist, SIGNAL(triggered()), this, SLOT(slotAddArtist())); // Toolbar Actions MAction* actionFilter = new MAction("icon-m-toolbar-filter", "", this); actionFilter->setLocation(MAction::ToolBarLocation); addAction(actionFilter); connect(actionFilter, SIGNAL(triggered()), this, SLOT(slotShowFilter())); } MAction* actionRefresh = new MAction("icon-m-toolbar-refresh", "", this); actionRefresh->setLocation(MAction::ToolBarLocation); addAction(actionRefresh); connect(actionRefresh, SIGNAL(triggered()), this, SLOT(slotRefreshEvents())); MAction* actionSearch = new MAction("icon-m-toolbar-search", "", this); actionSearch->setLocation(MAction::ToolBarLocation); addAction(actionSearch); connect(actionSearch, SIGNAL(triggered()), this, SLOT(slotShowSearch())); // setup model m_artistsModel = new ArtistModel(m_dbStorage, artistsModelQuery()); // filtering text box QGraphicsLinearLayout *containerLayout = new QGraphicsLinearLayout(Qt::Horizontal); MLabel* filterLabel = new MLabel(tr("Filter artist:")); containerLayout->addItem(filterLabel); m_filter = new MTextEdit(MTextEditModel::SingleLine, QString()); containerLayout->addItem(m_filter); m_filter->setObjectName("CommonSingleInputField"); connect(m_filter, SIGNAL(textChanged()), this, SLOT(slotFilterChanged())); m_filterWidget = new MWidget(); m_filterWidget->setLayout(containerLayout); // No artist found label m_noArtistLabel = new MLabel(tr("No artist available, add them using one of " "menu options.")); m_noArtistLabel->setAlignment(Qt::AlignCenter); if (m_artistsModel->rowCount() == 0) m_policy->addItem(m_noArtistLabel); // MList with fast view MList* artistsList = new MList(); artistsList->setSelectionMode(MList::SingleSelection); // Content item creator and item model for the list artistsList->setCellCreator(new ArtistItemCreator(m_pageMode, m_dbStorage, m_country)); artistsList->setItemModel(m_artistsModel); m_policy->addItem(artistsList); connect(artistsList, SIGNAL(itemClicked(QModelIndex)), this, SLOT(slotArtistClicked(QModelIndex))); connect(DBManager::instance(m_dbStorage), SIGNAL(artistAdded(int,bool)), this, SLOT(slotArtistAdded(int,bool))); if (m_pageMode == ARTIST_NEAR_LOCATION_SEARCH) { //overwrite history MApplicationWindow* appWindow = applicationWindow(); MScene* scene = appWindow->scene(); MSceneManager* sceneManager = scene->sceneManager(); QList<MSceneWindow*> history = sceneManager->pageHistory(); if (history.last()->metaObject()->className() == NearLocationSearchPage::staticMetaObject.className()) { // overwrite history only if the last page is NearLocationSearchPage history.removeAt(history.size()-1); if (history.last()->metaObject()->className() != NearLocationMainPage::staticMetaObject.className()) { MApplicationPage* prevPage = new NearLocationMainPage(); history << prevPage; } sceneManager->setPageHistory(history); } //search events m_lastfm->getEventsNearLocation(m_latitude, m_longitude, m_distance); } if (m_dbStorage == DBManager::DISK) { DBManager* db = DBManager::instance(m_dbStorage); QStringList incompleteArtists = db->incompleteArtists(); foreach(QString artist, incompleteArtists) { m_lastfm->getEventsForArtist(artist); }