ZLResourceKey TagRemoveAction::key() const { return ZLResourceKey("delete"); }
void NetworkOperationRunnable::showErrorMessage(const std::string &message) { ZLDialogManager::instance().errorBox( ZLResourceKey("networkError"), message ); }
FormatInfoPage *HtmlPlugin::createInfoPage(ZLOptionsDialog &dialog, const ZLFile &file) { return new PlainTextInfoPage(dialog, file, ZLResourceKey("<PRE>"), false); }
ZLResourceKey TagEditAction::key() const { return ZLResourceKey("edit"); }
ZLResourceKey FBReaderNode::ExpandTreeAction::key() const { return ZLResourceKey(myNode.isOpen() ? "collapseTree" : "expandTree"); }
ZLResourceKey FBTree::ExpandTreeAction::key() const { return ZLResourceKey("expandTree"); }
ZLResourceKey NetworkCatalogRootTree::TopupAccountAction::key() const { return !myManager.currentAccount().empty() ? ZLResourceKey("topupAccount") : ZLResourceKey("topupAccountUndefined"); }
ZLResourceKey BookReadAction::key() const { return ZLResourceKey("read"); }
void FBReader::openBook(shared_ptr<Book> book) { OpenBookRunnable runnable(book); ZLDialogManager::Instance().wait(ZLResourceKey("loadingBook"), runnable); resetWindowCaption(); }
ZLResourceKey NetworkCatalogRootTree::LogoutAction::key() const { return ZLResourceKey("logout"); }
void ZLToolbar::addParameterItem(Item::Type type, const std::string &actionId, const std::string ¶meterId, int maxWidth, ParameterItem::SymbolSet symbolSet) { ParameterItem *item = (type == Item::TEXT_FIELD) ? (ParameterItem*)new TextFieldItem(*this, actionId, parameterId, maxWidth, symbolSet, myResource[ZLResourceKey(actionId)]) : (ParameterItem*)new ComboBoxItem(*this, actionId, parameterId, maxWidth, symbolSet, myResource[ZLResourceKey(actionId)]); myItems.push_back(item); }
void ZLToolbar::addMenuButton(const std::string &actionId) { myItems.push_back( new MenuButtonItem(*this, actionId, myResource[ZLResourceKey(actionId)]) ); }
ZLApplicationBase::~ZLApplicationBase() { ConfigSaverRunnable configSaver; ZLDialogManager::Instance().wait(ZLResourceKey("savingConfig"), configSaver); }
ZLResourceKey OpenFileDialogAction::key() const { return ZLResourceKey("OpenFileDialog"); }
ZLResourceKey NetworkCatalogRootTree::PasswordRecoveryAction::key() const { return ZLResourceKey("passwordRecovery"); }
ZLResourceKey BookEditInfoAction::key() const { return ZLResourceKey("edit"); }
ZLResourceKey NetworkCatalogRootTree::RegisterUserAction::key() const { return ZLResourceKey("register"); }
SystemOptionsDialog::SystemOptionsDialog() : AbstractOptionsDialog(ZLResourceKey("SystemOptionsDialog"), true) { ZLOptionsDialog &dialog = this->dialog(); ZLDialogContent &encodingTab = dialog.createTab(ZLResourceKey("Language")); encodingTab.addOption(ZLResourceKey("autoDetect"), new ZLSimpleBooleanOptionEntry(PluginCollection::Instance().LanguageAutoDetectOption)); encodingTab.addOption(ZLResourceKey("defaultLanguage"), new ZLLanguageOptionEntry(PluginCollection::Instance().DefaultLanguageOption, ZLLanguageList::languageCodes())); EncodingEntry *encodingEntry = new EncodingEntry(PluginCollection::Instance().DefaultEncodingOption); EncodingSetEntry *encodingSetEntry = new EncodingSetEntry(*encodingEntry); encodingTab.addOption(ZLResourceKey("defaultEncodingSet"), encodingSetEntry); encodingTab.addOption(ZLResourceKey("defaultEncoding"), encodingEntry); if (ZLOption::isAutoSavingSupported()) { ZLDialogContent &configTab = dialog.createTab(ZLResourceKey("Config")); FBReader &fbreader = FBReader::Instance(); ZLToggleBooleanOptionEntry *enableEntry = new ZLToggleBooleanOptionEntry(fbreader.ConfigAutoSavingOption); configTab.addOption(ZLResourceKey("autoSave"), enableEntry); ZLOptionEntry *timeoutEntry = new TimeoutEntry(fbreader.ConfigAutoSaveTimeoutOption); enableEntry->addDependentEntry(timeoutEntry); configTab.addOption(ZLResourceKey("timeout"), timeoutEntry); enableEntry->onStateChanged(enableEntry->initialState()); } FBReader &fbreader = FBReader::Instance(); std::vector<std::pair<ZLResourceKey,ZLOptionEntry*> > additional; ZLOptionEntry *entry = new ZLSimpleBooleanOptionEntry(fbreader.EnableSingleClickDictionaryOption); additional.push_back(std::make_pair(ZLResourceKey("singleClickOpen"), entry)); createIntegrationTab(fbreader.dictionaryCollection(), ZLResourceKey("Dictionary"), additional); dialog.createPlatformDependentTabs(); }
ZLResourceKey key() const { return ZLResourceKey(""); }
void MultiKeyOptionEntry::addAction(const std::string &actionId) { myBimap.insert(actionId); addActionName(myResource[ZLResourceKey(actionId)].value()); }
void FBReader::openBook(BookDescriptionPtr description) { OpenBookRunnable runnable(*this, description); ZLDialogManager::instance().wait(ZLResourceKey("loadingBook"), runnable); resetWindowCaption(); }
StyleOptionsPage::StyleOptionsPage(ZLDialogContent &dialogTab, ZLPaintContext &context) { const ZLResource &styleResource = ZLResource::resource(KEY_STYLE); myComboEntry = new ComboOptionEntry(*this, styleResource[KEY_BASE].value()); myComboEntry->addValue(myComboEntry->initialValue()); ZLTextStyleCollection &collection = ZLTextStyleCollection::Instance(); ZLTextKind styles[] = { REGULAR, TITLE, SECTION_TITLE, SUBTITLE, H1, H2, H3, H4, H5, H6, CONTENTS_TABLE_ENTRY, LIBRARY_ENTRY, ANNOTATION, EPIGRAPH, AUTHOR, DATEKIND, POEM_TITLE, STANZA, VERSE, CITE, INTERNAL_HYPERLINK, EXTERNAL_HYPERLINK, BOOK_HYPERLINK, FOOTNOTE, ITALIC, EMPHASIS, BOLD, STRONG, DEFINITION, DEFINITION_DESCRIPTION, PREFORMATTED, CODE }; const int STYLES_NUMBER = sizeof(styles) / sizeof(ZLTextKind); for (int i = 0; i < STYLES_NUMBER; ++i) { const ZLTextStyleDecoration *decoration = collection.decoration(styles[i]); if (decoration != 0) { myComboEntry->addValue(styleResource[decoration->name()].value()); } } dialogTab.addOption(ZLResourceKey("optionsFor"), myComboEntry); { const std::string &name = myComboEntry->initialValue(); FBTextStyle &baseStyle = FBTextStyle::Instance(); registerEntry(dialogTab, KEY_FONTFAMILY, new ZLFontFamilyOptionEntry(baseStyle.FontFamilyOption, context), name ); registerEntry(dialogTab, KEY_FONTSIZE, new ZLSimpleSpinOptionEntry(baseStyle.FontSizeOption, 2), name ); registerEntry(dialogTab, KEY_BOLD, new ZLSimpleBooleanOptionEntry(baseStyle.BoldOption), name ); registerEntry(dialogTab, KEY_ITALIC, new ZLSimpleBooleanOptionEntry(baseStyle.ItalicOption), name ); registerEntry(dialogTab, KEY_AUTOHYPHENATIONS, new ZLSimpleBooleanOptionEntry(collection.AutoHyphenationOption), name ); } for (int i = 0; i < STYLES_NUMBER; ++i) { ZLTextStyleDecoration *decoration = collection.decoration(styles[i]); if (decoration != 0) { const std::string &name = styleResource[decoration->name()].value(); registerEntry(dialogTab, KEY_FONTFAMILY, new ZLTextFontFamilyWithBaseOptionEntry(decoration->FontFamilyOption, dialogTab.resource(KEY_FONTFAMILY), context), name ); registerEntry(dialogTab, KEY_FONTSIZEDIFFERENCE, new ZLSimpleSpinOptionEntry(decoration->FontSizeDeltaOption, 2), name ); registerEntry(dialogTab, KEY_BOLD, new ZLSimpleBoolean3OptionEntry(decoration->BoldOption), name ); registerEntry(dialogTab, KEY_ITALIC, new ZLSimpleBoolean3OptionEntry(decoration->ItalicOption), name ); registerEntry(dialogTab, KEY_ALLOWHYPHENATIONS, new ZLSimpleBoolean3OptionEntry(decoration->AllowHyphenationsOption), name ); } } myComboEntry->onValueSelected(0); myComboEntry->setActive(false); }
FormatInfoPage *ZTXTPlugin::createInfoPage(ZLOptionsDialog &dialog, const ZLFile &file) { shared_ptr<ZLInputStream> stream = createStream(file); return new PlainTextInfoPage(dialog, file, ZLResourceKey("Text"), !TextFormatDetector().isHtml(*stream)); }
void ShowNetworkLibraryTreeAction::run() { shared_ptr<ZLTreeDialog> myDialog = ZLDialogManager::Instance().createTreeDialog(ZLResourceKey("NetworkTreeDialog")); ZLTreeListener::RootNode &rootNode = myDialog->rootNode(); NetworkLinkCollection &collection = NetworkLinkCollection::Instance(); AppLog(" NetworkLinkCollection::Instance()"); std::set<ZLTreeNode*> nodesToDelete; ZLTreeNode::List rootChildren = rootNode.children(); ZLTreeNode::List::iterator nodeIt = rootChildren.begin(); size_t nodeCount = 0; AppLog("collection.size() = %d",collection.size()); for (size_t i = 0; i < collection.size(); ++i) { AppLog("i = %d",i); NetworkLink &link = collection.link(i); // if (!link.isEnabled()) { // continue; // } bool processed = false; AppLog("processed"); while (nodeIt != rootChildren.end() && (*nodeIt)->isInstanceOf(NetworkCatalogNode::TYPE_ID)) { AppLog("while"); const NetworkLink &nodeLink = ((NetworkCatalogRootNode*)*nodeIt)->link(); if (&nodeLink == &link && nodeLink.SiteName == link.SiteName) { AppLog("reloadLink() 1"); ((NetworkCatalogRootNode*)*nodeIt)->reloadLink(); ++nodeIt; ++nodeCount; processed = true; break; } else { bool found = false; for (size_t j = i + 1; j < collection.size(); ++j) { if (&nodeLink == &collection.link(j) && nodeLink.SiteName == collection.link(j).SiteName) { found = true; AppLog("reloadLink() 2"); ((NetworkCatalogRootNode*)*nodeIt)->reloadLink(); break; } } if (!found) { nodesToDelete.insert(*nodeIt++); ++nodeCount; } else { break; } } } if (!processed) { NetworkCatalogNode *ptr = new NetworkCatalogRootNode(&rootNode, link, nodeCount++); //ptr->item().onDisplayItem(); } } SearchResultNode *srNode = 0; while (nodeIt != rootChildren.end()) { ZLTreeNode *node = *nodeIt++; ++nodeCount; if (node->isInstanceOf(SearchResultNode::TYPE_ID)) { srNode = (SearchResultNode*)node; } else { nodesToDelete.insert(node); } } const SearchResult &searchResult = SearchResult::lastSearchResult(); shared_ptr<NetworkBookCollection> result = searchResult.collection(); if (result.isNull()) { if (srNode != 0) { nodesToDelete.insert(srNode); } } else if (srNode == 0 || srNode->searchResult() != result) { if (srNode != 0) { nodesToDelete.insert(srNode); } //srNode = new SearchResultNode(&rootNode, result, searchResult.summary()); // at nodeCount ??? or not??? NetworkNodesFactory::createSubnodes(srNode, *result); } for (std::set<ZLTreeNode*>::iterator it = nodesToDelete.begin(); it != nodesToDelete.end(); ++it) { ZLTreeNode *node = *it; node->parent()->remove(node); delete node; } // if (srNode != 0) { // srNode->open(false); // srNode->expandOrCollapseSubtree(); // } myDialog->run(); }
FormatOptionsPage::FormatOptionsPage(ZLDialogContent &dialogTab) { const ZLResource &styleResource = ZLResource::resource(KEY_STYLE); myComboEntry = new ComboOptionEntry(*this, styleResource[KEY_BASE].value()); myComboEntry->addValue(myComboEntry->initialValue()); ZLTextStyleCollection &collection = ZLTextStyleCollection::instance(); ZLTextKind styles[] = { REGULAR, TITLE, SECTION_TITLE, SUBTITLE, H1, H2, H3, H4, H5, H6, ANNOTATION, EPIGRAPH, PREFORMATTED, AUTHOR, DATEKIND, POEM_TITLE, STANZA, VERSE }; const int STYLES_NUMBER = sizeof(styles) / sizeof(ZLTextKind); for (int i = 0; i < STYLES_NUMBER; ++i) { const ZLTextStyleDecoration *decoration = collection.decoration(styles[i]); if (decoration != 0) { myComboEntry->addValue(styleResource[decoration->name()].value()); } } dialogTab.addOption(ZLResourceKey("optionsFor"), myComboEntry); { const std::string &name = myComboEntry->initialValue(); ZLTextBaseStyle &baseStyle = collection.baseStyle(); registerEntries(dialogTab, KEY_LINESPACING, new ZLTextLineSpaceOptionEntry(baseStyle.LineSpacePercentOption, dialogTab.resource(KEY_LINESPACING), false), KEY_DUMMY, 0,//new ZLSimpleSpinOptionEntry("First Line Indent", baseStyle.firstLineIndentDeltaOption(), -300, 300, 1), name ); registerEntries(dialogTab, KEY_ALIGNMENT, new ZLTextAlignmentOptionEntry(baseStyle.AlignmentOption, dialogTab.resource(KEY_ALIGNMENT), false), KEY_DUMMY, 0, name ); } for (int i = 0; i < STYLES_NUMBER; ++i) { ZLTextStyleDecoration *d = collection.decoration(styles[i]); if ((d != 0) && (d->isFullDecoration())) { ZLTextFullStyleDecoration *decoration = (ZLTextFullStyleDecoration*)d; const std::string &name = styleResource[decoration->name()].value(); registerEntries(dialogTab, KEY_SPACEBEFORE, new ZLSimpleSpinOptionEntry(decoration->SpaceBeforeOption, 1), KEY_LEFTINDENT, new ZLSimpleSpinOptionEntry(decoration->LeftIndentOption, 1), name ); registerEntries(dialogTab, KEY_SPACEAFTER, new ZLSimpleSpinOptionEntry(decoration->SpaceAfterOption, 1), KEY_RIGHTINDENT, new ZLSimpleSpinOptionEntry(decoration->RightIndentOption, 1), name ); registerEntries(dialogTab, KEY_LINESPACING, new ZLTextLineSpaceOptionEntry(decoration->LineSpacePercentOption, dialogTab.resource(KEY_LINESPACING), true), KEY_FIRSTLINEINDENT, new ZLSimpleSpinOptionEntry(decoration->FirstLineIndentDeltaOption, 1), name ); registerEntries(dialogTab, KEY_ALIGNMENT, new ZLTextAlignmentOptionEntry(decoration->AlignmentOption, dialogTab.resource(KEY_ALIGNMENT), true), KEY_DUMMY, 0, name ); } } myComboEntry->onValueSelected(0); }
ZLResourceKey TagCloneAction::key() const { return ZLResourceKey("clone"); }
BookInfoDialog::BookInfoDialog(const BookCollection &collection, const std::string &fileName) : myCollection(collection), myBookInfo(fileName) { myDialog = ZLDialogManager::instance().createOptionsDialog(ZLResourceKey("InfoDialog")); ZLDialogContent &commonTab = myDialog->createTab(ZLResourceKey("Common")); commonTab.addOption(ZLResourceKey("file"), new ZLStringInfoEntry(ZLFile::fileNameToUtf8(ZLFile(fileName).path())) ); commonTab.addOption(ZLResourceKey("title"), myBookInfo.TitleOption); myAuthorDisplayNameEntry = new AuthorDisplayNameEntry(*this); myAuthorSortKeyEntry = new AuthorSortKeyEntry(*this); myEncodingEntry = new EncodingEntry(myBookInfo.EncodingOption); myEncodingSetEntry = (myEncodingEntry->initialValue() != "auto") ? new EncodingSetEntry(*(EncodingEntry*)myEncodingEntry) : 0; std::vector<std::string> languageCodes = ZLLanguageList::languageCodes(); languageCodes.push_back("de-traditional"); myLanguageEntry = new ZLLanguageOptionEntry(myBookInfo.LanguageOption, languageCodes); mySeriesTitleEntry = new SeriesTitleEntry(*this); myBookNumberEntry = new ZLSimpleSpinOptionEntry(myBookInfo.NumberInSeriesOption, 1); commonTab.addOption(ZLResourceKey("authorDisplayName"), myAuthorDisplayNameEntry); commonTab.addOption(ZLResourceKey("authorSortKey"), myAuthorSortKeyEntry); commonTab.addOption(ZLResourceKey("language"), myLanguageEntry); if (myEncodingSetEntry != 0) { commonTab.addOption(ZLResourceKey("encodingSet"), myEncodingSetEntry); } commonTab.addOption(ZLResourceKey("encoding"), myEncodingEntry); ZLDialogContent &seriesTab = myDialog->createTab(ZLResourceKey("Series")); seriesTab.addOption(ZLResourceKey("seriesTitle"), mySeriesTitleEntry); seriesTab.addOption(ZLResourceKey("bookNumber"), myBookNumberEntry); mySeriesTitleEntry->onValueEdited(mySeriesTitleEntry->initialValue()); /* ZLOrderOptionEntry *orderEntry = new ZLOrderOptionEntry(); orderEntry->values().push_back("First"); orderEntry->values().push_back("Second"); orderEntry->values().push_back("Third"); orderEntry->values().push_back("Fourth"); orderEntry->values().push_back("Fifth"); seriesTab.addOption(orderEntry); */ ZLDialogContent &tagsTab = myDialog->createTab(ZLResourceKey("Tags")); tagsTab.addOption(ZLResourceKey("tags"), myBookInfo.TagsOption); FormatPlugin *plugin = PluginCollection::instance().plugin(ZLFile(fileName), false); if (plugin != 0) { myFormatInfoPage = plugin->createInfoPage(*myDialog, fileName); } }
ZLResourceKey NetworkBookDownloadAction::key() const { return ZLResourceKey(myDemo ? "downloadDemo" : "download"); }
void NetworkOperationRunnable::executeWithUI() { ZLDialogManager::instance().wait(ZLResourceKey(myUiMessageKey), *this); }