XineConfig::XineConfig(const xine_t* const xine) : KDialogBase(KDialogBase::IconList, i18n("xine Engine Parameters"), KDialogBase::Ok|KDialogBase::Apply|KDialogBase::Cancel, KDialogBase::Cancel) { setInitialSize(QSize(650,500), true); m_xine = (xine_t*)xine; QStringList cats = getCategories(); QTabWidget* tabWidget = NULL; QFrame* xineFrame = NULL; QVBoxLayout* xineLayout = NULL; QVBox* xineBeginnerPage = NULL; QVBox* xineExpertPage = NULL; QString icon; QStringList::ConstIterator end ( cats.end()); for (QStringList::ConstIterator it = cats.begin(); it != end; ++it) { // kdDebug() << "XineConfig: add page: " << *it << endl; if (*it == "audio") icon = "sound"; else if (*it == "video") icon = "video"; else if (*it == "vcd") icon = "cdrom_unmount"; else if (*it == "input") icon = "connect_established"; else if (*it == "effects") icon = "wizard"; else if (*it == "media") icon = "cdrom_unmount"; else if (*it == "subtitles") icon = "font_bitmap"; else if (*it == "osd") icon = "font_bitmap"; else if (*it == "engine") icon = "exec"; else icon = "edit"; xineFrame = addPage(*it, i18n("%1 Options").arg(*it), KGlobal::iconLoader()->loadIcon(icon, KIcon::Panel, KIcon::SizeMedium)); xineLayout = new QVBoxLayout(xineFrame, marginHint(), spacingHint()); tabWidget = new QTabWidget(xineFrame); xineLayout->addWidget(tabWidget); xineBeginnerPage = new QVBox(tabWidget); xineBeginnerPage->setMargin(5); tabWidget->addTab(xineBeginnerPage, i18n("Beginner Options")); createPage(*it, false, xineBeginnerPage); xineExpertPage = new QVBox(tabWidget); xineExpertPage->setMargin(5); tabWidget->addTab(xineExpertPage, i18n("Expert Options")); createPage(*it, true, xineExpertPage); } connect(this, SIGNAL(okClicked()), SLOT(slotOkPressed())); connect(this, SIGNAL(applyClicked()), SLOT(slotApplyPressed())); }
ActionListEditor::ActionListEditor(ModelStack *models, KActionCollection *ac, QWidget *parent, KXMLGUIClient *client, ItemEditor *itemViewer) : QWidget(parent), m_models(models), m_selectorProxy(new ItemSelectorProxy(this)) { setLayout(new QVBoxLayout(this)); m_stack = new QStackedWidget(this); layout()->addWidget(m_stack); layout()->setContentsMargins(0, 0, 0, 0); connect(models->treeSelection(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(onSideBarSelectionChanged(QModelIndex))); connect(models->contextsSelection(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(onSideBarSelectionChanged(QModelIndex))); connect(models->knowledgeSelection(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(onSideBarSelectionChanged(QModelIndex))); setupActions(ac); createPage(models->treeSelectionModel(), models, Zanshin::ProjectMode, client); createPage(models->contextsSelectionModel(), models, Zanshin::ContextsMode, client); createPage(models->knowledgeSelectionModel(), models, Zanshin::KnowledgeMode, client); connect(m_selectorProxy, SIGNAL(itemSelected(Akonadi::Item)), itemViewer, SLOT(setItem(const Akonadi::Item &))); //connect(&AkonadiCollection::instance(), SIGNAL(itemCreated(const Akonadi::Item &)), m_selectorProxy, SLOT(selectItem(const Akonadi::Item &))); updateActions(); setMode(Zanshin::ProjectMode); m_cancelAdd->setEnabled(false); }
void PageFileManager::writePage(uint64_t pageId, void* data) { if (!isExisting(pageId)) { createPage(pageId); } const off_t offset = pageId * _pageSize; if (lseek(_fd, offset, SEEK_SET) < 0) { perror("lseek"); //@todo throw //throw 42; assert(false); } LOG(INFO) << "Writing page " << pageId << " data at " << data << " to file at pos " << offset << std::endl; size_t wroteBytes = write(_fd, data, _pageSize); if (wroteBytes != _pageSize) { perror("write"); //@todo throw //throw 42; assert(false); } closePage( pageId, data ); }
int sakhadb_pager_request_page(sakhadb_pager_t pager, Pgno no, sakhadb_page_t* pPage) { SLOG_PAGING_INFO("sakhadb_pager_request_page: requesting page [%d]", no); if(no == 1) { *pPage = (sakhadb_page_t)pager->page1; return SAKHADB_OK; } SLOG_PAGING_INFO("sakhadb_pager_request_page: looking for page in table."); struct InternalPage* pInternalPage = lookupPageInTable(pager, no); if(!pInternalPage) { SLOG_PAGING_INFO("sakhadb_pager_request_page: page not found. create new."); int rc = createPage(pager, no, &pInternalPage); if(rc != SAKHADB_OK) { SLOG_PAGING_ERROR("sakhadb_pager_request_page: failed to create page [%d]", no); return rc; } SLOG_PAGING_INFO("sakhadb_pager_request_page: fetch page content"); rc = fetchPageContent(pInternalPage); if(rc != SAKHADB_OK) { SLOG_PAGING_ERROR("sakhadb_pager_request_page: failed to fetch page content. [%d]", no); return rc; } } *pPage = (sakhadb_page_t)pInternalPage; return SAKHADB_OK; }
/** * Pre-load some pages */ static int preloadPages( struct Pager *pPager, /* Pager object, that owns the page */ Pgno startNo, /* No of first page to load */ Pgno endNo /* No of last page to load */ ) { int rc = SAKHADB_OK; Pgno npages = endNo - startNo + 1; for (Pgno i = 0; i <= npages; ++i) { struct InternalPage* pPage; rc = createPage(pPager, i + startNo, &pPage); if(rc != SAKHADB_OK) { SLOG_PAGING_ERROR("preloadPages: failed to create page [%d]", i+startNo); break; } rc = fetchPageContent(pPage); if(rc != SAKHADB_OK) { SLOG_PAGING_ERROR("preloadPages: failed to fetch page content. [%d]", i+startNo); break; } } return rc; }
void* PageFileManager::readPage(uint64_t pageId) { if (!isExisting(pageId)) { createPage(pageId); } const off_t offset = pageId * _pageSize; char* buffer = new char[_pageSize]; if (lseek(_fd, offset, SEEK_SET) < 0) { perror("lseek"); //@todo throw //throw 42; assert(false); } size_t readBytes = read(_fd, buffer, _pageSize); if (readBytes != _pageSize) { perror("read"); fprintf(stderr, "readBytes: %lu pageSize: %lu\n", readBytes, _pageSize); //@todo throw //throw 42; assert(false); } return buffer; }
void SpectralLibraryMatchResults::addResults(const std::vector<SpectralLibraryMatch::MatchResults>& theResults, const std::map<Signature*, ColorType>& colorMap, Progress* pProgress, bool* pAbort) { if (theResults.empty()) { return; } // Since all the results in theResults are for the same raster element, we only need to get/create the page for // the first result. ResultsPage* pPage = getPage(theResults.front().mpRaster); if (pPage == NULL) { pPage = createPage(theResults.front().mpRaster); if (pPage == NULL) { if (pProgress != NULL) { pProgress->updateProgress("Error: Unable to access the results page", 0, ERRORS); } return; } } mpTabWidget->setCurrentWidget(pPage); pPage->addResults(theResults, colorMap, pProgress, pAbort); }
void PageView::addWidgetToPage(Widget *widget, ssize_t pageIdx, bool forceCreate) { if (!widget || pageIdx < 0) { return; } ssize_t pageCount = this->getPageCount(); if (pageIdx < 0 || pageIdx >= pageCount) { if (forceCreate) { if (pageIdx > pageCount) { CCLOG("pageIdx is %d, it will be added as page id [%d]",static_cast<int>(pageIdx),static_cast<int>(pageCount)); } Layout* newPage = createPage(); newPage->addChild(widget); addPage(newPage); } } else { Node * page = _pages.at(pageIdx); page->addChild(widget); } }
WebPageManager::WebPageManager(QObject *parent) : QObject(parent) { m_ignoreSslErrors = false; m_cookieJar = new NetworkCookieJar(this); m_success = true; m_loggingEnabled = false; m_ignoredOutput = new QFile(this); m_timeout = -1; m_customHeadersRequestHandler = new CustomHeadersRequestHandler( new MissingContentHeaderRequestHandler( new NetworkRequestFactory(this), this ), this ); m_unknownUrlHandler = new UnknownUrlHandler(m_customHeadersRequestHandler, this); m_blacklistedRequestHandler = new BlacklistedRequestHandler(m_unknownUrlHandler, this); m_networkAccessManager = new NetworkAccessManager(m_blacklistedRequestHandler, this); m_networkAccessManager->setCookieJar(m_cookieJar); QWebSettings::setMaximumPagesInCache(0); QWebSettings::setObjectCacheCapacities(0, 0, 0); createPage()->setFocus(); }
void UIPageView::addWidgetToPage(UIWidget *widget, int pageIdx, bool forceCreate) { if (!widget) { return; } int pageCount = m_pages->count(); if (pageIdx < 0 || pageIdx >= pageCount) { if (forceCreate) { if (pageIdx > pageCount) { CCLOG("pageIdx is %d, it will be added as page id [%d]",pageIdx,pageCount); } Layout* newPage = createPage(); newPage->addChild(widget); addPage(newPage); } } else { Layout * page = dynamic_cast<Layout*>(m_pages->objectAtIndex(pageIdx)); if (page) { page->addChild(widget); } } }
void Grid::addItem(Component *item) { items.add(item); bool wasAdded = pages.getLast()->addItem(item); if (!wasAdded) { createPage(); pages.getLast()->addItem(item); } }
HighScore::HighScore(QWidget *parent) : QDialog(parent) { tabWidget = new QTabWidget; tabWidget->setTabPosition(QTabWidget::West); // read settings createPage(tr("Easy")); createPage(tr("Medium")); createPage(tr("Hard")); createPage(tr("Custom")); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(tabWidget); setLayout(mainLayout); }
void WebPageManager::removePage(WebPage *page) { m_pages.removeOne(page); page->deleteLater(); if (m_pages.isEmpty()) createPage()->setFocus(); else if (page == m_currentPage) m_pages.first()->setFocus(); }
ConfigPage::ConfigPage(FClass* parent) : ManagerPage(parent, FUNC) { //qDebug() << "ConfigPage::ConfigPage(FClass* parent) : ManagerPage(parent)"; mIcon = QIcon(":/icons/configure.xpm"); mIconText = tr("Configuration"); createPage(); }
bool Book::newPage() { Logger::Log("Entering Book.newPage...", LOG_DEBUG); (*mLastPage)->setNotLastNow(); createPage(); return true; }
void SampleWindow::showPageForAction(QAction *action) { if (currentAction == action) return; MApplicationPage *page = createPage(action->text()); page->appear(this, MSceneWindow::DestroyWhenDone); currentAction = action; }
void ofxUIPageManager::setupPages() { if (pageList != NULL) { ofLogWarning() << "ofxUIPageManager pages are already setup!"; return; } // Add a nice list of pages to help toggle them! pageList = new ofxUICanvas(0,0,listWidth,ofGetHeight()); // add gui config page gui = createPage(name); gui->addToggle("show page list", &isPageListVisible); gui->addWidgetDown(new ofxUILabel("background", OFX_UI_FONT_MEDIUM)); gui->addSlider("bg r", 0, 255, 0.f)->setIncrement(1); gui->addSlider("bg g", 0, 255, 100.f)->setIncrement(1); gui->addSlider("bg b", 0, 255, 150.f)->setIncrement(1); gui->addSlider("bg a", 0, 255, 255.f)->setIncrement(1); bgColour.set(0,100,150); // add listener for gui events ofAddListener(gui->newGUIEvent, this, &ofxUIPageManager::guiEvent); // add gui page to gui manager addPage(gui); // load in our existing saved settings gui->loadSettings(getPath(name)); // finish nice list of pages pageList->setWidgetSpacing(spacer); pageList->setDrawBack(true); vector<string> names; for (int i=0; i<pages.size(); i++) { ofxUILabel* title = (ofxUILabel*)pages[i]->getWidget("title"); string label = title->getLabel(); if (label.size()>7) label = label.substr(0,7); names.push_back( ofToString(i) + ":" + label ); } pageList->addRadio("Pages", names, OFX_UI_ORIENTATION_VERTICAL); pageList->addSpacer(0, 40); pageList->autoSizeToFitWidgets(); ofAddListener(pageList->newGUIEvent, this, &ofxUIPageManager::guiPageListEvent); // update all pages with pages numbers int n = pages.size(); for (int i=0; i<n; i++) { ofxUILabel* title = (ofxUILabel*)pages[i]->getWidget("page"); string label = ofToString(i+1) + "/" + ofToString(n); title->setLabel(label); } updateAllPages(); // gui is hidden by default hide(); }
void* dpTrampolineAllocator::allocate(void *location) { void *ret = nullptr; if(Page *page=findCandidatePage(location)) { ret = page->allocate(); } if(!ret) { Page *page = createPage(location); ret = page->allocate(); } return ret; }
FiPage::FiPage(FClass* parent) : ManagerPage(parent, FUNC) , mFi(0) , mBars(0) , mSymbols(0) , mPlotSheet(0) , mSymbolView(0) { mIcon = QIcon(":/icons/fi-page.png"); mIconText = tr("FI Details"); createPage(); }
void imageList::createImage(imageItem *i) { if (i->X1 != -1) { char *s; int x1 = max(min(i->X1, i->X2) * image_res / postscriptRes - IMAGE_BOARDER_PIXELS, 0); int y1 = max(image_res * vertical_offset / 72 + min(i->Y1, i->Y2) * image_res / postscriptRes - IMAGE_BOARDER_PIXELS, 0); int x2 = max(i->X1, i->X2) * image_res / postscriptRes + IMAGE_BOARDER_PIXELS; int y2 = image_res * vertical_offset / 72 + max(i->Y1, i->Y2) * image_res / postscriptRes + 1 + IMAGE_BOARDER_PIXELS; if (createPage(i->pageNo) == 0) { s = make_message("pnmcut%s %d %d %d %d < %s " "| pnmcrop -quiet | pnmtopng%s %s > %s\n", EXE_EXT, x1, y1, x2 - x1 + 1, y2 - y1 + 1, imagePageName, EXE_EXT, TRANSPARENT, i->imageName); if (s == NULL) sys_fatal("make_message"); #if defined(DEBUGGING) if (debug) { fprintf(stderr, s); fflush(stderr); } #endif html_system(s, 0); free(s); } else { fprintf(stderr, "failed to generate image of page %d\n", i->pageNo); fflush(stderr); } #if defined(DEBUGGING) } else { if (debug) { fprintf(stderr, "ignoring image as x1 coord is -1\n"); fflush(stderr); } #endif } }
static void setUpPages(void) { int i = 0; int j = 0; for (i = 0; i < PAGE_TABLES; i++) { void *addr = (void *) (PAGE_SIZE * ENTRIES * i); createPageTable(addr, RWUPRESENT); int perms = RWUPRESENT; if((unsigned int)addr >= STACK_START) perms = RWUNOTPRESENT; for (j = 0; j < ENTRIES; j++) { createPage((void*) ((unsigned int) addr + j * PAGE_SIZE), perms); } } }
shared_ptr<HtmlTabPage> HtmlTabCtrl::addPage(const String &caption, shared_ptr<HtmlImage> icon) { int32 page_index = getPagesCount(); shared_ptr<HtmlTabPage> page = createPage(page_index); page->setCss(page_index == getCurSel() ? OS_CSS_TABCTRL_ACTIVEPAGE : OS_CSS_TABCTRL_PAGE); m_pages->getControls()->add(page); if(icon != nullptr) page->getControls()->add(icon); if(caption.empty() == false) { shared_ptr<HtmlLink> link(OS_NEW HtmlLink(caption, getPageLink(page_index))); page->getControls()->add(link); } return page; }
const std::string CPageManager::getPageContent(const std::string& pageName, const CFCGIRequest* currRequest) const { if(!isNeedProcessPages) return "Page manager not working"; std::string pageContent = ""; CLog::getInstance()->addInfo("Page request: " + pageName); CPage* page = createPage(pageName, currRequest); // 404 Error if(!page) { pageContent = getErrorPageContent("404", "Sorry, resource not found :'("); return pageContent; } pageContent = page->getPageHTMLContent(); delete page; return pageContent; }
void WebPageManager::reset() { m_timeout = -1; m_cookieJar->clearCookies(); m_networkAccessManager->reset(); m_customHeadersRequestHandler->reset(); m_currentPage->resetLocalStorage(); m_blacklistedRequestHandler->reset(); m_unknownUrlHandler->reset(); while (!m_pages.isEmpty()) { WebPage *page = m_pages.takeFirst(); page->deleteLater(); } qint64 size = QWebSettings::offlineWebApplicationCacheQuota(); // No public function was found to wrap the empty() call to // WebCore::cacheStorage().empty() QWebSettings::setOfflineWebApplicationCacheQuota(size); createPage()->setFocus(); }
void MainDoc::createPagesTemplate(QDomElement &elementLayoutMasterSet,QDomElement &elementRoot) { QDomNode nodePageSeqMast; //in this loop we try to find each fo:simple-page-master for(QDomNode nodeSimplePage = elementLayoutMasterSet.firstChild();!nodeSimplePage.isNull(); nodeSimplePage = nodeSimplePage.nextSibling()) { //try to convert the node to an element QDomElement ePageMaster = nodeSimplePage.toElement(); if(!ePageMaster.isNull()) //find fo:simple-page-master it represent one page layout if(ePageMaster.tagName()=="fo:simple-page-master") { //get page sequence element according to pagemaster QDomElement ePageSequence=getPageSequenceElement(ePageMaster,elementRoot); // qDebug(ePageSequence.attribute("master-reference").toAscii()); PageDoc *temp = new PageDoc(this,ePageSequence,ePageMaster); m_vecPageDoc.push_back(temp); emit createPage(temp); } } }
void SimpleWizard::nextButtonClicked() { ui.nextButton->setEnabled(true); if (mHistory.size() == mNumPages) { // We're on last page and Finish was just clicked accept(); } else { QWidget *oldPage = mHistory.isEmpty() ? NULL : mHistory.last(); QWidget* newPage = createPage( mHistory.size() ); if ( newPage ) { mHistory += newPage; switchPage(oldPage, mHistory.last()); } else nextButtonClicked(); } }
//----------------------------------------------------------------------------- HighscoresDialog::HighscoresDialog(int rank, QWidget *parent) : KDialogBase(internal->nbGameTypes()>1 ? TreeList : Plain, i18n("Highscores"), Close|User1|User2, Close, parent, "show_highscores", true, true, KGuiItem(i18n("Configure..."), "configure"), KGuiItem(i18n("Export..."))), _rank(rank), _tab(0) { _widgets.resize(internal->nbGameTypes(), 0); if ( internal->nbGameTypes()>1 ) { for (uint i=0; i<internal->nbGameTypes(); i++) { QString title = internal->manager.gameTypeLabel(i, Manager::I18N); QString icon = internal->manager.gameTypeLabel(i, Manager::Icon); QWidget *w = addVBoxPage(title, QString::null, BarIcon(icon, KIcon::SizeLarge)); if ( i==internal->gameType() ) createPage(w); } connect(this, SIGNAL(aboutToShowPage(QWidget *)), SLOT(createPage(QWidget *))); showPage(internal->gameType()); } else {
WPaintDevice *WPdfRenderer::startPage(int page) { if (page > 0) page_ = createPage(page); #ifndef WT_TARGET_JAVA HPDF_Page_Concat (page_, 72.0f/dpi_, 0, 0, 72.0f/dpi_, 0, 0); #endif WPdfImage *device = new WPdfImage(pdf_, page_, 0, 0, pageWidth(page), pageHeight(page)); #ifdef WT_TARGET_JAVA WTransform deviceTransform; deviceTransform.scale(72.0f/dpi_, 72.0f/dpi_); device->setDeviceTransform(deviceTransform); #endif //WT_TARGET_JAVA for (unsigned i = 0; i < fontCollections_.size(); ++i) device->addFontCollection(fontCollections_[i].directory, fontCollections_[i].recursive); return device; }
void Book::initialise(float xiWidth, float xiHeight, float xiXt, float xiYt, float xiZt, float xiX, float xiY, float xiZ) { Logger::Log("Entering Book.initialise...", LOG_DEBUG); mWidth = xiWidth; mHeight = xiHeight; // starting position mX = xiX; mY = xiY; mZ = xiZ; // targets mXt = xiXt; mYt = xiYt; mZt = xiZt; mMargin = 0.1; mPageCount = 0; // place 1 page in the pages list createPage(); // add the initial page mCurrentPage = mPages.begin(); // the page that is visible mInsidePage = new Page(this, mWidth - mMargin, mHeight - (mMargin*2), 0); mPosition = 0.0; // zero page turn state mResetSpeed = 1.0; // 1 second to flip page mCurrentSpeed = 0.0; // not moving mCoverPosition = 0.0; // open book (awww...) mCoverPositionT = 1.0; // open mOpenAngle = 170.0; // specifically how open (180.0 = parallel) }
void IndexPager::read(istream &in) { string str; int line = 0, wordCount = 0; while (getline(in, str)) { string word = ""; for (string::iterator it = str.begin(); it <= str.end(); it++) { if (toupper(*it) >= 'A' && toupper(*it) <= 'Z') word.append(1, *it); else // not a letter { if (word.length() > 0) { if (WordKey.find(word) == WordKey.end()) { WordKey.insert(pair<string, int>(word, wordCount)); wordCount++; } // if word already in map mmap.insert(pair<int, int>(WordKey.find(word)->second, line)); word = ""; } // word length > 0 } // not a letter } // while line++; } // while createPage(); } // read()