//--------------------------------------------------------------------------- void MenuMainWindow::createMenu() { QFile menu_file(":/menu.html"); MenuView = new QWebView(parent); MenuView->setAcceptDrops(true); MenuView->setMaximumHeight(75); MenuView->setMinimumHeight(75); ((MainWindow*)parent)->set_widget_to_layout(MenuView); WebPage* page = new WebPage((MainWindow*)parent, MenuView); MenuView->setPage(page); menu_file.open(QIODevice::ReadOnly | QIODevice::Text); QByteArray html = menu_file.readAll(); menu_file.close(); QObject::connect(MenuView, SIGNAL(loadFinished(bool)), this, SLOT(createMenuFinished(bool))); QUrl url = QUrl("qrc:/html"); if (!url.isValid()) return; MenuView->setContent(QString(html).toUtf8(), "text/html", url); }
bool MenuInstanceData::Open() { Close(); // Open up the main data file unique_ptr<File> menu_file(new File(create_menu_filename("mnu"))); if (!menu_file->Open(File::modeBinary | File::modeReadOnly, File::shareDenyNone)) { // Unable to open menu MenuSysopLog("Unable to open Menu"); return false; } // Read the header (control) record into memory menu_file->Seek(0L, File::seekBegin); menu_file->Read(&header, sizeof(MenuHeader)); // Version numbers can be checked here. if (!CreateMenuMap(menu_file.get())) { MenuSysopLog("Unable to create menu index."); return false; } if (!CheckMenuSecurity(&header, true)) { MenuSysopLog("< Menu Sec"); return false; } // Open/Rease/Close Prompt file. We use binary mode since we want the // \r to remain on windows (and linux). TextFile prompt_file(create_menu_filename("pro"), "rb"); if (prompt_file.IsOpen()) { string tmp = prompt_file.ReadFileIntoString(); string::size_type end = tmp.find(".end."); if (end != string::npos) { prompt = tmp.substr(0, end); } else { prompt = tmp; } } // Execute command to use on entering the menu (if any). if (header.szScript[0]) { InterpretCommand(this, header.szScript); } return true; }
void initialize_interface() { warehouse *warehouses = NULL; FILE *database = NULL; boolean loop = TRUE; int option; int db_type; database = get_file(DBNAME, "rb"); db_type = identify(database); //db_type = 2; if(db_type == 0) { warehouses = initialize(database); } else if(db_type == 1) { warehouses = initialize_legacy(database); } else if(db_type == 2) { warehouses = initialize_random(); } if(database != NULL) { fclose(database); } printf("Digite o numero da opcao a esquerda para navegar entre menus.\n\n"); while(loop) { show_menu(1); int_input(&option, 3); switch(option) { case 1: { menu_search(warehouses); break; } case 2: { menu_insert(warehouses); break; } case 3: { menu_file(warehouses); break; } case 4: { menu_warehouse(warehouses); break; } case 9: { loop = FALSE; break; } default: { printf("Essa opcao nao existe.\n\n"); break; } } } show_sold_products(warehouses, TRUE); shutdown(get_file(DBNAME, "wb"), warehouses, TRUE); }