void showPrice() { double totalPrice = 0, totalWeight = 0; showStatusBar(); for (int i = 0; i < 3; i++) { printf(" %-10s %5.2lf * %4.2lf$\n", Bin[i].Name, Bin[i].Weight, Bin[i].Price); totalPrice += Bin[i].Price * Bin[i].Weight; totalWeight += Bin[i].Weight; } printf(" ------------------------\n"); printf(" Итого %17.2lf$\n", totalPrice); if (totalPrice > 100) { totalPrice *= Sales; printf(" c учётом скидки %7.2lf$\n", totalPrice); } printf(" -Наём грузчиков---------\n"); if (totalWeight < 5){ totalPrice += 1.0; printf(" Доставка 1.00$\n"); } else if (totalWeight < 20) { totalPrice += 3.0; printf(" Доставка 3.00$\n"); } else { double shipPrice = (totalWeight - 20) * 2; totalPrice += shipPrice + 10; printf(" Доставка 10$ + %5.2lf$\n", shipPrice); } printf(" ------------------------\n"); printf(" ИТОГО: %16.2lf$\n", totalPrice); printf(" ------------------------\n"); system("pause"); }
void main() { FILE *fp = NULL; setlocale(LC_ALL, "Russian"); for (;;) { showStatusBar(); showMenu(fp); switch(_getche()) { case '1': fp = openFile(fp); break; case '2': if (fp != NULL) fileAnalyze(fp); break; case '3': puts("Осторожно, прога закрывается без предупреждений!"); if (fp != NULL) fclose(fp); exit(1); default: puts("Была нажата клавиша."); break; } } }
void showBin(){ showStatusBar(); for (int i = 0; i < 3; i++){ printf("%-10s %5.2lf * %5.2lf$\n", Bin[i].Name, Bin[i].Weight, Bin[i].Price); } system("pause"); }
void main(){ setlocale(LC_ALL, "Russian"); do { showStatusBar(); showMenu(); goMenu(); } while(1); }
void GUI::setupActions() { KActionCollection* ac = actionCollection(); KAction* new_action = KStandardAction::openNew(this, SLOT(createTorrent()), ac); new_action->setToolTip(i18n("Create a new torrent")); KAction* open_action = KStandardAction::open(this, SLOT(openTorrent()), ac); open_action->setToolTip(i18n("Open a torrent")); paste_action = KStandardAction::paste(this, SLOT(paste()), ac); open_silently_action = new KAction(KIcon(open_action->icon()), i18n("Open Silently"), this); open_silently_action->setToolTip(i18n("Open a torrent without asking any questions")); connect(open_silently_action, SIGNAL(triggered()), this, SLOT(openTorrentSilently())); ac->addAction("file_open_silently", open_silently_action); KStandardAction::quit(this, SLOT(quit()), ac); show_status_bar_action = KStandardAction::showStatusbar(this, SLOT(showStatusBar()), ac); show_status_bar_action->setIcon(KIcon("kt-show-statusbar")); show_menu_bar_action = KStandardAction::showMenubar(this, SLOT(showMenuBar()), ac); KStandardAction::preferences(this, SLOT(showPrefDialog()), ac); KStandardAction::keyBindings(this, SLOT(configureKeys()), ac); KStandardAction::configureToolbars(this, SLOT(configureToolbars()), ac); KStandardAction::configureNotifications(this, SLOT(configureNotifications()), ac); paste_url_action = new KAction(KIcon("document-open-remote"), i18n("Open URL"), this); paste_url_action->setToolTip(i18n("Open a URL which points to a torrent, magnet links are supported")); paste_url_action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_P)); connect(paste_url_action, SIGNAL(triggered()), this, SLOT(pasteURL())); ac->addAction("paste_url", paste_url_action); ipfilter_action = new KAction(KIcon("view-filter"), i18n("IP Filter"), this); ipfilter_action->setToolTip(i18n("Show the list of blocked IP addresses")); ipfilter_action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_I)); connect(ipfilter_action, SIGNAL(triggered()), this, SLOT(showIPFilter())); ac->addAction("ipfilter_action", ipfilter_action); import_action = new KAction(KIcon("document-import"), i18n("Import Torrent"), this); import_action->setToolTip(i18n("Import a torrent")); import_action->setShortcut(KShortcut(Qt::SHIFT + Qt::Key_I)); connect(import_action, SIGNAL(triggered()), this, SLOT(import())); ac->addAction("import", import_action); show_kt_action = new KAction(KIcon("kt-show-hide"), i18n("Show/Hide KTorrent"), this); connect(show_kt_action, SIGNAL(triggered()), this, SLOT(showOrHide())); ac->addAction("show_kt", show_kt_action); show_kt_action->setGlobalShortcut(KShortcut(Qt::ALT + Qt::SHIFT + Qt::Key_T)); setStandardToolBarMenuEnabled(true); }
double add(int Fruct){ double Weight; showStatusBar(); printf(" Покупаем %s.\n\nТекущая масса: %lf\n", Bin[Fruct].Name, Bin[Fruct].Weight); printf("Введите сколько кг вы хотели бы увидеть в корзине: "); scanf_s("%5lf", &Weight); fflush(stdin); if (Weight >= 0 && Weight < 100.0){ Bin[Fruct].Weight = Weight; printf("В корзине теперь %2.2lfкг\n", Weight); system("pause"); return Weight; } else { printf("\nВведено неверное значение."); system("pause"); return -1; } }
// ---------------------------------------------------------------------------- // renderFrame Method - Takes care of drawing in the different render states // ---------------------------------------------------------------------------- JNIEXPORT void JNICALL Java_com_qualcomm_QCARSamples_CloudRecognition_CloudRecoRenderer_renderFrame(JNIEnv *, jobject) { // Clear color and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Get the state from QCAR and mark the beginning of a rendering section QCAR::State state = QCAR::Renderer::getInstance().begin(); // Explicitly render the Video Background QCAR::Renderer::getInstance().drawVideoBackground(); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); if (deleteCurrentProductTexture) { // Deletes the product texture if necessary if (productTexture != 0) { glDeleteTextures(1, &(productTexture->mTextureID)); delete productTexture; productTexture = 0; } deleteCurrentProductTexture = false; } // If the render state indicates that the texture is generated it generates // the OpenGL texture for start drawing the plane with the book data if (renderState == RS_TEXTURE_GENERATED) { generateProductTextureInOpenGL(); } // Did we find any trackables this frame? if (state.getNumTrackableResults() > 0) { trackingStarted = true; // If we are already tracking something we don't need // to wait any frame before starting the 2D transition // when the target gets lost pthread_mutex_lock(&framesToSkipMutex); framesToSkipBeforeRenderingTransition = 0; pthread_mutex_unlock(&framesToSkipMutex); // Gets current trackable result const QCAR::TrackableResult* trackableResult = state.getTrackableResult(0); if (trackableResult == NULL) { return; } modelViewMatrix = QCAR::Tool::convertPose2GLMatrix(trackableResult->getPose()); // Get the size of the ImageTarget QCAR::ImageTargetResult *imageResult = (QCAR::ImageTargetResult *)trackableResult; targetSize = imageResult->getTrackable().getSize(); // Renders the Augmentation View with the 3D Book data Panel renderAugmentation(trackableResult); } else { // Manages the 3D to 2D Transition initialization if (!scanningMode && showAnimation3Dto2D && renderState == RS_NORMAL && framesToSkipBeforeRenderingTransition == 0) { startTransitionTo2D(); } // Reduces the number of frames to wait before triggering // the transition by 1 if( framesToSkipBeforeRenderingTransition > 0 && renderState == RS_NORMAL) { pthread_mutex_lock(&framesToSkipMutex); framesToSkipBeforeRenderingTransition -= 1; pthread_mutex_unlock(&framesToSkipMutex); } } // Logic for rendering Transition to 2D if (renderState == RS_TRANSITION_TO_2D && showAnimation3Dto2D) { renderTransitionTo2D(); } // Logic for rendering Transition to 3D if (renderState == RS_TRANSITION_TO_3D ) { renderTransitionTo3D(); } // Get the tracker manager: QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance(); // Get the image tracker: QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>( trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER)); // Get the target finder: QCAR::TargetFinder* finder = imageTracker->getTargetFinder(); // Renders the current state - User process Feedback if (finder->isRequesting()) { // Requesting State - Show Requesting text in Status Bar setStatusBarText("Requesting"); showStatusBar(); } else { // Hiding Status Bar hideStatusBar(); } glDisable(GL_DEPTH_TEST); QCAR::Renderer::getInstance().end(); }
void MainMenu::init() { #define ADD_ACTION(name, menu, icon, trName, slot, shortcut) \ action = menu->addAction(icon, trName); \ action->setShortcut(QKeySequence(QSL(shortcut))); \ connect(action, SIGNAL(triggered()), this, slot); \ m_actions[QSL(name)] = action #define ADD_CHECKABLE_ACTION(name, menu, icon, trName, slot, shortcut) \ action = menu->addAction(icon, trName); \ action->setShortcut(QKeySequence(QSL(shortcut))); \ action->setCheckable(true); \ connect(action, SIGNAL(triggered(bool)), this, slot); \ m_actions[QSL(name)] = action // Standard actions - needed on Mac to be placed correctly in "application" menu QAction* action = new QAction(QIcon::fromTheme(QSL("help-about")), tr("&About QupZilla"), this); action->setMenuRole(QAction::AboutRole); connect(action, SIGNAL(triggered()), this, SLOT(showAboutDialog())); m_actions[QSL("Standard/About")] = action; action = new QAction(IconProvider::settingsIcon(), tr("Pr&eferences"), this); action->setMenuRole(QAction::PreferencesRole); action->setShortcut(QKeySequence(QKeySequence::Preferences)); connect(action, SIGNAL(triggered()), this, SLOT(showPreferences())); m_actions[QSL("Standard/Preferences")] = action; action = new QAction(QIcon::fromTheme(QSL("application-exit")), tr("Quit"), this); action->setMenuRole(QAction::QuitRole); // shortcut set from browserwindow connect(action, SIGNAL(triggered()), this, SLOT(quitApplication())); m_actions[QSL("Standard/Quit")] = action; // File menu m_menuFile = new QMenu(tr("&File")); connect(m_menuFile, SIGNAL(aboutToShow()), this, SLOT(aboutToShowFileMenu())); connect(m_menuFile, SIGNAL(aboutToHide()), this, SLOT(aboutToHideFileMenu())); ADD_ACTION("File/NewTab", m_menuFile, IconProvider::newTabIcon(), tr("New Tab"), SLOT(newTab()), "Ctrl+T"); ADD_ACTION("File/NewWindow", m_menuFile, IconProvider::newWindowIcon(), tr("&New Window"), SLOT(newWindow()), "Ctrl+N"); ADD_ACTION("File/NewPrivateWindow", m_menuFile, IconProvider::privateBrowsingIcon(), tr("New &Private Window"), SLOT(newPrivateWindow()), "Ctrl+Shift+P"); ADD_ACTION("File/OpenLocation", m_menuFile, QIcon::fromTheme(QSL("document-open-remote")), tr("Open Location"), SLOT(openLocation()), "Ctrl+L"); ADD_ACTION("File/OpenFile", m_menuFile, QIcon::fromTheme(QSL("document-open")), tr("Open &File..."), SLOT(openFile()), "Ctrl+O"); ADD_ACTION("File/CloseWindow", m_menuFile, QIcon::fromTheme(QSL("window-close")), tr("Close Window"), SLOT(closeWindow()), "Ctrl+Shift+W"); m_menuFile->addSeparator(); ADD_ACTION("File/SavePageAs", m_menuFile, QIcon::fromTheme(QSL("document-save")), tr("&Save Page As..."), SLOT(savePageAs()), "Ctrl+S"); ADD_ACTION("File/SavePageScreen", m_menuFile, QIcon::fromTheme(QSL("image-loading")), tr("Save Page Screen"), SLOT(savePageScreen()), "Ctrl+Shift+S"); ADD_ACTION("File/SendLink", m_menuFile, QIcon::fromTheme(QSL("mail-message-new")), tr("Send Link..."), SLOT(sendLink()), ""); ADD_ACTION("File/Print", m_menuFile, QIcon::fromTheme(QSL("document-print")), tr("&Print..."), SLOT(printPage()), "Ctrl+P"); m_menuFile->addSeparator(); ADD_CHECKABLE_ACTION("File/WorkOffline", m_menuFile, QIcon(), tr("Work &Offline"), SLOT(toggleOfflineMode()), ""); m_menuFile->addSeparator(); m_menuFile->addAction(m_actions[QSL("Standard/Quit")]); // Edit menu m_menuEdit = new QMenu(tr("&Edit")); connect(m_menuEdit, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEditMenu())); connect(m_menuEdit, SIGNAL(aboutToHide()), this, SLOT(aboutToHideEditMenu())); ADD_ACTION("Edit/Undo", m_menuEdit, QIcon::fromTheme(QSL("edit-undo")), tr("&Undo"), SLOT(editUndo()), "Ctrl+Z"); ADD_ACTION("Edit/Redo", m_menuEdit, QIcon::fromTheme(QSL("edit-redo")), tr("&Redo"), SLOT(editRedo()), "Ctrl+Shift+Z"); m_menuEdit->addSeparator(); ADD_ACTION("Edit/Cut", m_menuEdit, QIcon::fromTheme(QSL("edit-cut")), tr("&Cut"), SLOT(editCut()), "Ctrl+X"); ADD_ACTION("Edit/Copy", m_menuEdit, QIcon::fromTheme(QSL("edit-copy")), tr("C&opy"), SLOT(editCopy()), "Ctrl+C"); ADD_ACTION("Edit/Paste", m_menuEdit, QIcon::fromTheme(QSL("edit-paste")), tr("&Paste"), SLOT(editPaste()), "Ctrl+V"); m_menuEdit->addSeparator(); ADD_ACTION("Edit/SelectAll", m_menuEdit, QIcon::fromTheme(QSL("edit-select-all")), tr("Select &All"), SLOT(editSelectAll()), "Ctrl+A"); ADD_ACTION("Edit/Find", m_menuEdit, QIcon::fromTheme(QSL("edit-find")), tr("&Find"), SLOT(editFind()), "Ctrl+F"); m_menuEdit->addSeparator(); // View menu m_menuView = new QMenu(tr("&View")); connect(m_menuView, SIGNAL(aboutToShow()), this, SLOT(aboutToShowViewMenu())); connect(m_menuView, SIGNAL(aboutToHide()), this, SLOT(aboutToHideViewMenu())); QMenu* toolbarsMenu = new QMenu(tr("Toolbars")); connect(toolbarsMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowToolbarsMenu())); QMenu* sidebarMenu = new QMenu(tr("Sidebar")); connect(sidebarMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowSidebarsMenu())); QMenu* encodingMenu = new QMenu(tr("Character &Encoding")); connect(encodingMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEncodingMenu())); // Create menus to make shortcuts available even before first showing the menu m_window->createToolbarsMenu(toolbarsMenu); m_window->createSidebarsMenu(sidebarMenu); m_menuView->addMenu(toolbarsMenu); m_menuView->addMenu(sidebarMenu); ADD_CHECKABLE_ACTION("View/ShowStatusBar", m_menuView, QIcon(), tr("Sta&tus Bar"), SLOT(showStatusBar()), ""); m_menuView->addSeparator(); ADD_ACTION("View/Stop", m_menuView, QIcon::fromTheme(QSL("process-stop")), tr("&Stop"), SLOT(stop()), "Esc"); ADD_ACTION("View/Reload", m_menuView, QIcon::fromTheme(QSL("view-refresh")), tr("&Reload"), SLOT(reload()), "F5"); m_menuView->addSeparator(); ADD_ACTION("View/ZoomIn", m_menuView, QIcon::fromTheme(QSL("zoom-in")), tr("Zoom &In"), SLOT(zoomIn()), "Ctrl++"); ADD_ACTION("View/ZoomOut", m_menuView, QIcon::fromTheme(QSL("zoom-out")), tr("Zoom &Out"), SLOT(zoomOut()), "Ctrl+-"); ADD_ACTION("View/ZoomReset", m_menuView, QIcon::fromTheme(QSL("zoom-original")), tr("Reset"), SLOT(zoomReset()), "Ctrl+0"); m_menuView->addSeparator(); ADD_CHECKABLE_ACTION("View/CaretBrowsing", m_menuView, QIcon(), tr("&Caret Browsing"), SLOT(toggleCaretBrowsing()), "F7"); m_menuView->addMenu(encodingMenu); m_menuView->addSeparator(); ADD_ACTION("View/PageSource", m_menuView, QIcon::fromTheme(QSL("text-html")), tr("&Page Source"), SLOT(showPageSource()), "Ctrl+U"); ADD_CHECKABLE_ACTION("View/FullScreen", m_menuView, QIcon(), tr("&FullScreen"), SLOT(showFullScreen()), "F11"); // Tools menu m_menuTools = new QMenu(tr("&Tools")); connect(m_menuTools, SIGNAL(aboutToShow()), this, SLOT(aboutToShowToolsMenu())); connect(m_menuTools, SIGNAL(aboutToHide()), this, SLOT(aboutToHideToolsMenu())); ADD_ACTION("Tools/WebSearch", m_menuTools, QIcon(), tr("&Web Search"), SLOT(webSearch()), "Ctrl+K"); ADD_ACTION("Tools/SiteInfo", m_menuTools, QIcon::fromTheme(QSL("dialog-information")), tr("Site &Info"), SLOT(showSiteInfo()), "Ctrl+I"); m_menuTools->addSeparator(); ADD_ACTION("Tools/DownloadManager", m_menuTools, QIcon(), tr("&Download Manager"), SLOT(showDownloadManager()), "Ctrl+Y"); ADD_ACTION("Tools/CookiesManager", m_menuTools, QIcon(), tr("&Cookies Manager"), SLOT(showCookieManager()), ""); ADD_ACTION("Tools/AdBlock", m_menuTools, QIcon(), tr("&AdBlock"), SLOT(showAdBlockDialog()), ""); ADD_ACTION("Tools/RssReader", m_menuTools, QIcon(), tr("RSS &Reader"), SLOT(showRssManager()), ""); ADD_ACTION("Tools/WebInspector", m_menuTools, QIcon(), tr("Web In&spector"), SLOT(showWebInspector()), "Ctrl+Shift+I"); ADD_ACTION("Tools/ClearRecentHistory", m_menuTools, QIcon::fromTheme(QSL("edit-clear")), tr("Clear Recent &History"), SLOT(showClearRecentHistoryDialog()), "Ctrl+Shift+Del"); m_menuTools->addSeparator(); // Help menu m_menuHelp = new QMenu(tr("&Help")); #ifndef Q_OS_MAC ADD_ACTION("Help/AboutQt", m_menuHelp, QIcon(QSL(":/icons/menu/qt.png")), tr("About &Qt"), SLOT(aboutQt()), ""); m_menuHelp->addAction(m_actions[QSL("Standard/About")]); m_menuHelp->addSeparator(); #endif ADD_ACTION("Help/InfoAboutApp", m_menuHelp, QIcon::fromTheme(QSL("help-contents")), tr("Information about application"), SLOT(showInfoAboutApp()), ""); ADD_ACTION("Help/ConfigInfo", m_menuHelp, QIcon(), tr("Configuration Information"), SLOT(showConfigInfo()), ""); ADD_ACTION("Help/ReportIssue", m_menuHelp, QIcon(), tr("Report &Issue"), SLOT(reportIssue()), ""); m_actions[QSL("Help/InfoAboutApp")]->setShortcut(QKeySequence(QKeySequence::HelpContents)); // History menu m_menuHistory = new HistoryMenu(); m_menuHistory->setMainWindow(m_window); // Bookmarks menu m_menuBookmarks = new BookmarksMenu(); m_menuBookmarks->setMainWindow(m_window); // Other actions action = new QAction(QIcon::fromTheme(QSL("user-trash")), tr("Restore &Closed Tab"), this); action->setShortcut(QKeySequence(QSL("Ctrl+Shift+T"))); connect(action, SIGNAL(triggered()), this, SLOT(restoreClosedTab())); m_actions[QSL("Other/RestoreClosedTab")] = action; #ifdef Q_OS_MAC m_actions[QSL("View/FullScreen")]->setShortcut(QKeySequence(QSL("F11"))); // Add standard actions to File Menu (as it won't be ever cleared) and Mac menubar should move them to "Application" menu m_menuFile->addAction(m_actions[QSL("Standard/About")]); m_menuFile->addAction(m_actions[QSL("Standard/Preferences")]); #endif #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) m_menuEdit->addAction(m_actions[QSL("Standard/Preferences")]); #elif !defined(Q_OS_MAC) m_menuTools->addAction(m_actions[QSL("Standard/Preferences")]); #endif #ifndef QTWEBKIT_FROM_2_3 m_actions[QSL("View/CaretBrowsing")]->setVisible(false); #endif // Menus are hidden by default aboutToHideFileMenu(); aboutToHideViewMenu(); aboutToHideEditMenu(); aboutToHideToolsMenu(); addActionsToWindow(); }