void Inventory::useItem(uint16 var) { switch (var) { case 277: // Atrus closeAllBooks(); _vm->_state->setJournalAtrusState(2); openBook(9, 902, 100); break; case 279: // Saavedro closeAllBooks(); _vm->_state->setJournalSaavedroState(2); openBook(9, 902, 200); break; case 480: // Tomahna closeAllBooks(); _vm->_state->setBookStateTomahna(2); openBook(8, 801, 220); break; case 481: // Releeshahn closeAllBooks(); _vm->_state->setBookStateReleeshahn(2); openBook(9, 902, 300); break; case 345: _vm->dragSymbol(345, 1002); break; case 398: _vm->dragSymbol(398, 1001); break; case 447: _vm->dragSymbol(447, 1000); break; default: debug("Used inventory item %d which is not implemented", var); } }
void MainWindow::newBook() { if(this->BookDescription) { delete this->BookDescription; this->BookDescription = NULL; } this->BookDescription = new bookdescription(this); this->ui->scrollArea->setWidget(this->BookDescription); connect(this->OverView,SIGNAL(openBook(QString)), this->BookDescription,SLOT(openBook(QString))); }
static int testPositionOperations() { Book book; UINT64 hashKey = BOOKINDEX_SIZE + 100; BookPosition position; position.hashKey = hashKey; position.nextPosition = ILLEGAL_OFFSET; position.firstMove = 0; openBook(&book, "moduletest"); createEmptyBook(&book); assert(getBookpositionOffset(&book, hashKey) == ILLEGAL_OFFSET); addBookposition(&book, &position); assert(getBookpositionOffset(&book, hashKey) == getBookpositionIndexOffset(hashKey)); position.hashKey += BOOKINDEX_SIZE; addBookposition(&book, &position); assert(getBookpositionOffset(&book, position.hashKey) == BOOKINDEX_SIZE * sizeof(BookPosition)); closeBook(&book); assert(remove("moduletest.bki") == 0); assert(remove("moduletest.bkm") == 0); return 0; }
void FBReader::initWindow() { ZLApplication::initWindow(); trackStylus(true); MigrationRunnable migration; if (migration.shouldMigrate()) { ZLDialogManager::Instance().wait(ZLResourceKey("migrate"), migration); } if (!myBookAlreadyOpen) { shared_ptr<Book> book; if (!myBookToOpen.empty()) { createBook(ZLFile(myBookToOpen), book); } if (book.isNull()) { const BookList &books = Library::Instance().recentBooks(); if (!books.empty()) { book = books[0]; } } if (book.isNull()) { book = BooksDBUtil::getBook(helpFileName(ZLibrary::Language())); } if (book.isNull()) { book = BooksDBUtil::getBook(helpFileName("en")); } openBook(book); } refreshWindow(); ZLTimeManager::Instance().addTask(new TimeUpdater(), 1000); }
void FBReader::initWindow() { ZLApplication::initWindow(); trackStylus(true); MigrationRunnable migration; if (migration.shouldMigrate()) { ZLDialogManager::instance().wait(ZLResourceKey("migrate"), migration); } if (!myBookAlreadyOpen) { BookDescriptionPtr description; if (!myBookToOpen.empty()) { createDescription(myBookToOpen, description); } if (description.isNull()) { ZLStringOption bookName(ZLCategoryKey::STATE, STATE, BOOK, ""); description = BookDescription::getDescription(bookName.value()); } if (description.isNull()) { description = BookDescription::getDescription(helpFileName(ZLibrary::Language())); } if (description.isNull()) { description = BookDescription::getDescription(helpFileName("en")); } openBook(description); } refreshWindow(); // ZLTimeManager::instance().addTask(new TimeUpdater(*this), 1000); }
void FBReader::tryShowFootnoteView(const std::string &id, const std::string &type) { if (type == "external") { openLinkInBrowser(id); } else if (type == "internal") { if (myMode == BOOK_TEXT_MODE && !myModel.isNull()) { BookModel::Label label = myModel->label(id); if (!label.Model.isNull()) { if (label.Model == myModel->bookTextModel()) { bookTextView().gotoParagraph(label.ParagraphNumber); } else { FootnoteView &view = ((FootnoteView&)*myFootnoteView); view.setModel(label.Model); setMode(FOOTNOTE_MODE); view.gotoParagraph(label.ParagraphNumber); } setHyperlinkCursor(false); refreshWindow(); } } } else if (type == "book") { DownloadBookRunnable downloader(id); downloader.executeWithUI(); if (downloader.hasErrors()) { downloader.showErrorMessage(); } else { shared_ptr<Book> book; createBook(downloader.fileName(), book); if (!book.isNull()) { Library::Instance().addBook(book); openBook(book); refreshWindow(); } } } }
static int testMoveOperations() { Book book; UINT64 hashKey = 4711; BookMove move; openBook(&book, "moduletest"); createEmptyBook(&book); move.move = 7; assert(getBookmoveOffset(&book, hashKey, move.move) == ILLEGAL_OFFSET); move.move = 17; move.nextAlternative = ILLEGAL_OFFSET; appendBookmove(&book, hashKey, &move); assert(getBookmoveOffset(&book, hashKey, move.move) == 0 * sizeof(BookMove)); move.move = 19; appendBookmove(&book, hashKey, &move); assert(getBookmoveOffset(&book, hashKey, move.move) == 1 * sizeof(BookMove)); hashKey += 160939; assert(getBookmoveOffset(&book, hashKey, move.move) == ILLEGAL_OFFSET); appendBookmove(&book, hashKey, &move); assert(getBookmoveOffset(&book, hashKey, move.move) == 2 * sizeof(BookMove)); closeBook(&book); assert(remove("moduletest.bki") == 0); assert(remove("moduletest.bkm") == 0); return 0; }
void Inventory::addSaavedroChapter(uint16 var) { _vm->_state->setVar(var, 1); _vm->_state->setJournalSaavedroState(2); _vm->_state->setJournalSaavedroChapter(var - 285); _vm->_state->setJournalSaavedroPageInChapter(0); openBook(9, 902, 200); }
void FBReader::openFile(const ZLFile &file) { shared_ptr<Book> book; createBook(file, book); if (!book.isNull()) { openBook(book); refreshWindow(); } }
void FBReader::openFile(const std::string &filePath) { shared_ptr<Book> book; createBook(filePath, book); if (!book.isNull()) { openBook(book); refreshWindow(); } }
void FBReader::openFile(const std::string &fileName) { BookDescriptionPtr description; createDescription(fileName, description); if (!description.isNull()) { openBook(description); refreshWindow(); } }
void Books::addBook(const QString &path) { QString bookName = path; BookLabel * label = new BookLabel; label->setAlignment(Qt::AlignCenter); label->setText(bookName); QString style = "background-color: green"; label->setStyleSheet(style); label->setMinimumSize(100, 100); connect(label, SIGNAL(mouseDoubleClicked()), this, SLOT(openBook())); ui.scrollAreaWidgetContents->layout()->addWidget(label); }
int initializeModuleBook() { if (openBook(&globalBook, "book") < 0) { logDebug("No opening book available.\n"); } else { logDebug("Opening book found. %ld positions, %ld moves\n", globalBook.numberOfPositions, globalBook.numberOfMoves); } return 0; }
//Open the clicked bookmark void DesktopApp::on_bookMarkList_itemDoubleClicked(QListWidgetItem* item) { MiniBMark *bm= dynamic_cast<MiniBMark *>(item); if (!bm || bm == 0) return; qDebug() << bm->getBook()->getName(); //Add a new tab and open the link there addViewTab(false); ui->viewTab->setTabText(CURRENT_TAB, tr("Orayta")); CurrentBookdisplayer()->setInternalLocation("#" + bm->getBookIter().toEncodedString()); openBook(bm->getBook()); }
// Initialize mpd_Core with given signal name and book name int MP_Gui_Callback_c::initMpdCore(QString signalName, QString bookName) { if (mpd_Core != NULL) { delete mpd_Core; mpd_Core = NULL; opBook = NOTHING_OPENED; opSig = NOTHING_OPENED; } if (signalName.size()>0) { opSig = openSignal(signalName); } if (bookName.size()>0) { opBook = openBook(bookName); } if (opSig == SIGNAL_OPENED && opBook == NOTHING_OPENED) { book = MP_Book_c::create(signal->numChans, signal->numSamples, signal->sampleRate ); } if (opSig == NOTHING_OPENED && opBook == BOOK_OPENED) { signal = MP_Signal_c::init( book->numChans, book->numSamples, book->sampleRate); baseSignal = new MP_Signal_c(*signal); } if (opSig == SIGNAL_OPENED || opBook == BOOK_OPENED) { approximant = MP_Signal_c::init( book->numChans, book->numSamples, book->sampleRate); mpd_Core = MP_Mpd_Core_c::create(signal,book,approximant); if (opSig == SIGNAL_OPENED && opBook == BOOK_OPENED) return SIGNAL_AND_BOOK_OPENED; if (opSig == SIGNAL_OPENED && opBook == NOTHING_OPENED) return SIGNAL_OPENED; if (opSig == NOTHING_OPENED && opBook == BOOK_OPENED) return BOOK_OPENED; } return NOTHING_OPENED; }
void ReadiumJSApi::openEPub3(std::string path) { m_ignoreRemainingErrors = false; try{ DWORD beginTimeMs = GetTickCount(); ContainerPtr container = Container::OpenContainer(path); DWORD containerOpened = GetTickCount(); if (container) { pkg = container->DefaultPackage(); if (pkg == 0) { auto pkgs = container->Packages(); if (pkgs.size() <= 0) { MessageBox(NULL, _T("ReadiumSDK: No packages found !"), _T("Error"), MB_OK); return; } pkg = pkgs[0]; } // by requesting an empty URL we effectively request the first spine item, usually the title page OpenPageRequest req = OpenPageRequest("", 0, "", "", "", ""); ViewerSettings set(true, 100, 20); DWORD openBookStartedMs = GetTickCount(); openBook(pkg, set, req); DWORD EndTimeTimeMs = GetTickCount(); } } //catch (ePub3::epub_spec_error err) //{ //} catch (...) { throw; } }
void RecentBooksDlg::on_actionSelectBook_triggered() { openBook(getBookNum()); }