void CLexiconReadWindow::initActions() {
    qDebug() << "CLexiconReadWindow::initActions";

    BtActionCollection* ac = actionCollection();
    CReadWindow::initActions();
    CLexiconReadWindow::insertKeyboardActions(ac);

    m_actions.backInHistory = dynamic_cast<BtToolBarPopupAction*>(
                                  ac->action(CResMgr::displaywindows::general::backInHistory::actionName) );
    Q_ASSERT(m_actions.backInHistory);
    addAction(m_actions.backInHistory);

    m_actions.forwardInHistory = dynamic_cast<BtToolBarPopupAction*>(
                                     ac->action(CResMgr::displaywindows::general::forwardInHistory::actionName) );
    Q_ASSERT(m_actions.forwardInHistory);
    addAction(m_actions.forwardInHistory);

    QAction* qaction;

    qaction = ac->action("nextEntry");
    QObject::connect(qaction, SIGNAL(triggered()), this, SLOT( nextEntry() ) );
    addAction(qaction);

    qaction = ac->action("previousEntry");
    QObject::connect(qaction, SIGNAL(triggered()), this, SLOT( previousEntry() ) );
    addAction(qaction);

    m_actions.selectAll = ac->action("selectAll");
    Q_ASSERT(m_actions.selectAll);

    m_actions.findText = ac->action("findText");
    Q_ASSERT(m_actions.findText);

    m_actions.findStrongs = ac->action(CResMgr::displaywindows::general::findStrongs::actionName);
    QObject::connect(m_actions.findStrongs, SIGNAL(triggered()), this, SLOT(openSearchStrongsDialog()) );
    addAction(m_actions.findStrongs);

    m_actions.copy.reference = ac->action("copyReferenceOnly");
    QObject::connect(m_actions.copy.reference, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(copyAnchorOnly()) );
    addAction(m_actions.copy.reference);

    m_actions.copy.entry = ac->action("copyEntryWithText");
    QObject::connect(m_actions.copy.entry, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(copyAll()) );
    addAction(m_actions.copy.entry);

    Q_ASSERT(ac->action("copySelectedText"));
    m_actions.copy.selectedText = ac->action("copySelectedText");

    m_actions.save.entryAsPlain = new QAction(tr("Entry as plain text"), ac );
    QObject::connect(m_actions.save.entryAsPlain, SIGNAL(triggered()), this, SLOT(saveAsPlain()) );
    addAction(m_actions.save.entryAsPlain);

    m_actions.save.entryAsHTML = ac->action("saveHtml");
    QObject::connect(m_actions.save.entryAsHTML, SIGNAL(triggered()), this, SLOT(saveAsHTML()));
    addAction(m_actions.save.entryAsHTML);

    m_actions.print.reference = ac->action("printReferenceOnly");
    QObject::connect(m_actions.print.reference, SIGNAL(triggered()), this, SLOT(printAnchorWithText()));
    addAction(m_actions.print.reference);

    m_actions.print.entry = ac->action("printEntryWithText");
    QObject::connect(m_actions.print.entry, SIGNAL(triggered()), this, SLOT(printAll()));
    addAction(m_actions.print.entry);

    // init with the user defined settings
    qDebug() << "call CBTConfig::setupAccelSettings(CBTConfig::lexiconWindow, ac); and end CLexiconReadWindow::initActions";
    CBTConfig::setupAccelSettings(CBTConfig::lexiconWindow, ac);
}
示例#2
0
KJotsMain::KJotsMain(const char* name)
  : KTopLevelWidget( name )
{
  //create widgets
  f_main = new QFrame( this, "Frame_0" );
  f_main->move(0, 28);
  f_main->setMinimumSize( 500, 180 );
  f_main->setFrameStyle( 0 );

  f_text = new QFrame( f_main, "Frame_1" );
  f_text->setGeometry( 8, 72, 452, 45 );
  f_text->setFrameStyle( 50 );
  
  f_labels = new QFrame( f_main, "Frame_2" );
  f_labels->setMinimumSize( 436, 24 );
  f_labels->setFrameStyle( 0 );
  
  menubar = new KMenuBar( this, "MenuBar_1" );
  // KMenubar is not a FRAME!!! (sven)
  //menubar->setFrameStyle( 34 );
  //menubar->setLineWidth( 2 );

  s_bar = new QScrollBar( f_main, "ScrollBar_1" );
  s_bar->setMinimumSize( 452, 16 );
  s_bar->setOrientation( QScrollBar::Horizontal );
  
  me_text = new MyMultiEdit( f_text, "me_text" );
  me_text->setMinimumSize( 436, 30 );
  me_text->insertLine( "" );

  l_folder = new QLabel( f_labels, "Label_4" );
  l_folder->setMinimumSize( 68, 20 );
  l_folder->setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
  l_folder->setText( "" );
  
  le_subject = new QLineEdit( f_labels, "le_subject" );
  le_subject->setMinimumSize( 56, 20 );
  le_subject->setText( "" );
  le_subject->setFocusPolicy(QWidget::ClickFocus);
  
  bg_top = new MyButtonGroup( f_main, "ButtonGroup_2" );
  bg_top->setMinimumSize( 452, 32 );
  bg_top->setFrameStyle( 49 ); 
  bg_top->setTitle( "" );
  bg_top->setAlignment( 1 );
  bg_top->lower();
  
  this->setMinimumSize(500, 211);
  
  KConfig *config = KApplication::getKApplication()->getConfig();

  config->setGroup("kjots");
  entrylist.setAutoDelete(TRUE);
  button_list.setAutoDelete(TRUE);
  folderOpen = FALSE;
  entrylist.append(new TextEntry);
  confdiag = NULL;
  subj_list = new SubjList;
  connect( this, SIGNAL(folderChanged(QList<TextEntry> *)), subj_list,
	   SLOT(rebuildList( QList<TextEntry> *)) );
  connect( this, SIGNAL(entryMoved(int)), subj_list, SLOT( select(int)) );
  connect( subj_list, SIGNAL(entryMoved(int)), this, SLOT( barMoved(int)) );
  connect( le_subject, SIGNAL(textChanged(const char *)), subj_list, 
	   SLOT(entryChanged(const char*)) );
  me_text->setEnabled(FALSE);
  le_subject->setEnabled(FALSE);
  current = 0;
  connect( s_bar, SIGNAL(valueChanged(int)), this, SLOT(barMoved(int)) );
 
  top2bottom = new QGridLayout( f_main, 4, 1, 4 );
  top2bottom->addWidget( f_text, 0, 0, AlignCenter );
  top2bottom->setRowStretch( 0, 1 );
  top2bottom->addWidget( s_bar, 1, 0, AlignCenter );
  top2bottom->addWidget( bg_top, 2, 0, AlignCenter );
  top2bottom->addWidget( f_labels, 3, 0, AlignCenter );
  top2bottom->activate();

  labels_layout = new QGridLayout( f_labels, 1, 2, 0 );
  labels_layout->addWidget( l_folder, 0, 0, AlignVCenter | AlignLeft );
  labels_layout->addWidget( le_subject, 0, 1, AlignVCenter | AlignLeft );
  labels_layout->setColStretch( 1, 1 );
  labels_layout->activate();

  QFont font_label(l_folder->fontInfo().family());
  font_label.setBold(TRUE);
  l_folder->setFont(font_label);

  f_text_layout = new QGridLayout( f_text, 2, 1, 4 );
  f_text_layout->addWidget( me_text, 0, 0, AlignCenter );
  f_text_layout->setRowStretch( 0, 1 );
  f_text_layout->activate();

  s_bar->setRange(0,0);
  s_bar->setValue(0);
  s_bar->setSteps(1,1);

  bg_top->setExclusive(TRUE);
  me_text->setFocusPolicy(QWidget::StrongFocus);

  // read hotlist
  config->readListEntry( "Hotlist", hotlist );
  while( hotlist.count() > HOT_LIST_SIZE )
    hotlist.removeLast();
  // read list of folders
  config->readListEntry( "Folders", folder_list );

  QString temp;
  folders = new QPopupMenu;
  int i = 0;
  QPushButton *temp_button;
  for( temp = folder_list.first(); !temp.isEmpty(); temp = folder_list.next(), i++ )
    { 
      folders->insertItem(temp, i); 
      if( hotlist.contains(temp) )
	{
	  temp_button = new QPushButton(temp, bg_top);
	  temp_button->setFocusPolicy(QWidget::ClickFocus);
	  temp_button->setToggleButton(TRUE);
	  temp_button->setFixedSize(BUTTON_WIDTH,24);
	  bg_top->insert(temp_button, i);
	  button_list.append(temp_button);
	}
    }
  unique_id = i+1;
  connect( folders, SIGNAL(activated(int)), this, SLOT(openFolder(int)) );
  connect( bg_top, SIGNAL(clicked(int)), this, SLOT(openFolder(int)) );

  updateConfiguration();

  // creat keyboard shortcuts
  // CTRL+Key_J := previous page
  // CTRL+Key_K := next page
  // CTRL+Key_L := show subject list
  // CTRL+Key_A := add new page
  // CTRL+Key_M := move focus

  keys = new KAccel( this ); 


  keys->insertStdItem( KAccel::New, klocale->translate("New Book") ); 


  keys->connectItem( KAccel::New, this, SLOT(createFolder()) );
  keys->connectItem( KAccel::Save , this, SLOT(saveFolder()) );
  keys->connectItem( KAccel::Quit, qApp, SLOT(quit()) );
  keys->connectItem( KAccel::Cut , me_text, SLOT(cut()) );
  keys->connectItem( KAccel::Copy , me_text, SLOT(copyText()) );
  keys->connectItem( KAccel::Paste , me_text, SLOT(paste()) );

  keys->insertItem(i18n("PreviousPage"),    "PreviousPage",    CTRL+Key_J);
  keys->insertItem(i18n("NextPage"),        "NextPage",        CTRL+Key_K);
  keys->insertItem(i18n("ShowSubjectList"), "ShowSubjectList", CTRL+Key_L);
  keys->insertItem(i18n("AddNewPage"),      "AddNewPage",      CTRL+Key_A);
  keys->insertItem(i18n("MoveFocus"),       "MoveFocus",       CTRL+Key_M);
  keys->insertItem(i18n("CopySelection"),   "CopySelection",   CTRL+Key_Y);
  keys->connectItem( "PreviousPage", this, SLOT(prevEntry()) );
  keys->connectItem( "NextPage", this, SLOT(nextEntry()) );
  keys->connectItem( "ShowSubjectList", this, SLOT(toggleSubjList()) );
  keys->connectItem( "AddNewPage", this, SLOT(newEntry()) );
  keys->connectItem( "MoveFocus", this, SLOT(moveFocus()) );
  keys->connectItem( "CopySelection", this, SLOT(copySelection()) );
  keys->readSettings();

  // create menu
  int id;
  QPopupMenu *file = new QPopupMenu;
  id = file->insertItem(klocale->translate("&New Book"), this, SLOT(createFolder()));
  keys->changeMenuAccel(file, id, KAccel::New); 

  file->insertSeparator();
  id = file->insertItem(klocale->translate("Save current book"), this, SLOT(saveFolder()) );
  keys->changeMenuAccel(file, id, KAccel::Save); 
  id = file->insertItem(klocale->translate("Save book to ascii file"), this, SLOT(writeBook()) );
  id = file->insertItem(klocale->translate("Save page to ascii file"), this, SLOT(writePage()) );
  file->insertSeparator();
  id = file->insertItem(klocale->translate("Delete current book"), this, SLOT(deleteFolder()) );
  file->insertSeparator();
  id = file->insertItem(klocale->translate("&Quit"), qApp, SLOT( quit() ));
  keys->changeMenuAccel(file, id, KAccel::Quit); 

  QPopupMenu *edit_menu = new QPopupMenu;

  id = edit_menu->insertItem(klocale->translate("C&ut"),me_text, SLOT(cut()));
  keys->changeMenuAccel(edit_menu, id, KAccel::Cut); 
  id = edit_menu->insertItem(klocale->translate("&Copy") , me_text, SLOT(copyText()) );
  keys->changeMenuAccel(edit_menu, id, KAccel::Copy); 
  id = edit_menu->insertItem(klocale->translate("&Paste"), me_text, SLOT(paste()));
  keys->changeMenuAccel(edit_menu, id, KAccel::Paste); 
  edit_menu->insertSeparator();
  id = edit_menu->insertItem(klocale->translate("&New Page"), this, SLOT(newEntry()) );
  keys->changeMenuAccel(edit_menu, id, "AddNewPage"); 
  id = edit_menu->insertItem(klocale->translate("&Delete Page"), this, SLOT(deleteEntry()) );

  QPopupMenu *options = new QPopupMenu;
  options->insertItem(klocale->translate("&Config"), this, SLOT(configure()) );
  options->insertItem(klocale->translate("Configure &Keys"), this, SLOT(configureKeys()) );

  QPopupMenu *hotlist = new QPopupMenu;
  hotlist->insertItem(klocale->translate("Add current book to hotlist"), 
		      this, SLOT(addToHotlist()) );
  hotlist->insertItem(klocale->translate("Remove current book from hotlist"),
		      this, SLOT(removeFromHotlist()) );

  menubar->insertItem( klocale->translate("&File"), file );
  menubar->insertItem( klocale->translate("&Edit"), edit_menu );
  menubar->insertItem( klocale->translate("Hot&list"), hotlist );
  menubar->insertItem( klocale->translate("&Options"), options );
  menubar->insertItem( klocale->translate("&Books"), folders );
  menubar->insertSeparator();
  QString about = "KJots 0.3.1\n\r(C) ";
  about += (QString) klocale->translate("by") +
    " Christoph Neerfeld\n\[email protected]";
  menubar->insertItem( klocale->translate("&Help"),
		       KApplication::getKApplication()->getHelpMenu(TRUE, about ) );


  config->setGroup("kjots");
  // create toolbar
  toolbar = new KToolBar(this);
  QPixmap temp_pix;
  temp_pix = global_pix_loader->loadIcon("filenew.xpm");
  toolbar->insertButton(temp_pix, 0, SIGNAL(clicked()), this,
		      SLOT(newEntry()), TRUE, i18n("New"));
  temp_pix = global_pix_loader->loadIcon("filedel.xpm");
  toolbar->insertButton(temp_pix, 1, SIGNAL(clicked()), this,
		      SLOT(deleteEntry()), TRUE, i18n("Delete"));
  temp_pix = global_pix_loader->loadIcon("back.xpm");
  toolbar->insertButton(temp_pix, 2, SIGNAL(clicked()), this,
		      SLOT(prevEntry()), TRUE, i18n("Previous"));
  temp_pix = global_pix_loader->loadIcon("forward.xpm");
  toolbar->insertButton(temp_pix, 3, SIGNAL(clicked()), this,
		      SLOT(nextEntry()), TRUE, i18n("Next"));
  toolbar->insertSeparator();
  temp_pix = global_pix_loader->loadIcon("openbook.xpm");
  toolbar->insertButton(temp_pix, 4, SIGNAL(clicked()), this,
		      SLOT(toggleSubjList()), TRUE, i18n("Subject List"));
  toolbar->insertSeparator();
  temp_pix = global_pix_loader->loadIcon("exit.xpm");
  toolbar->setBarPos( (KToolBar::BarPosition) config->readNumEntry("ToolBarPos") );
  addToolBar(toolbar);
  setView(f_main, FALSE);
  setMenu(menubar);
  enableToolBar(KToolBar::Show);

  QString last_folder = config->readEntry("LastOpenFolder");
  int nr;
  if( (nr = folder_list.find(last_folder)) >= 0 )
    openFolder(nr);
  int width, height;
  width = config->readNumEntry("Width");
  height = config->readNumEntry("Height");
  if( width < minimumSize().width() )
    width = minimumSize().width();
  if( height < minimumSize().height() )
    height = minimumSize().height();
  resize(width, height);
}
示例#3
0
// -----------------------------------------------------------------------------
// Opens a map from a mapdesc_t
// -----------------------------------------------------------------------------
bool MapPreviewCanvas::openMap(Archive::MapDesc map)
{
	// All errors = invalid map
	Global::error = "Invalid map";

	// Check if this map is a pk3 map
	bool map_archive = false;
	if (map.archive)
	{
		map_archive = true;

		// Attempt to open entry as wad archive
		temp_archive_ = new WadArchive();
		if (!temp_archive_->open(map.head))
		{
			delete temp_archive_;
			return false;
		}

		// Detect maps
		auto maps = temp_archive_->detectMaps();

		// Set map if there are any in the archive
		if (!maps.empty())
			map = maps[0];
		else
			return false;
	}

	// Parse UDMF map
	if (map.format == MapFormat::UDMF)
	{
		ArchiveEntry* udmfdata = nullptr;
		for (auto mapentry = map.head; mapentry != map.end; mapentry = mapentry->nextEntry())
		{
			// Check entry type
			if (mapentry->type() == EntryType::fromId("udmf_textmap"))
			{
				udmfdata = mapentry;
				break;
			}
		}
		if (udmfdata == nullptr)
			return false;

		// Start parsing
		Tokenizer tz;
		tz.openMem(udmfdata->data(), map.head->name());

		// Get first token
		wxString token       = tz.getToken();
		size_t   vertcounter = 0, linecounter = 0, thingcounter = 0;
		while (!token.IsEmpty())
		{
			if (!token.CmpNoCase("namespace"))
			{
				//  skip till we reach the ';'
				do
				{
					token = tz.getToken();
				} while (token.Cmp(";"));
			}
			else if (!token.CmpNoCase("vertex"))
			{
				// Get X and Y properties
				bool   gotx = false;
				bool   goty = false;
				double x    = 0.;
				double y    = 0.;
				do
				{
					token = tz.getToken();
					if (!token.CmpNoCase("x") || !token.CmpNoCase("y"))
					{
						bool isx = !token.CmpNoCase("x");
						token    = tz.getToken();
						if (token.Cmp("="))
						{
							Log::error(wxString::Format("Bad syntax for vertex %i in UDMF map data", vertcounter));
							return false;
						}
						if (isx)
							x = tz.getDouble(), gotx = true;
						else
							y = tz.getDouble(), goty = true;
						// skip to end of declaration after each key
						do
						{
							token = tz.getToken();
						} while (token.Cmp(";"));
					}
				} while (token.Cmp("}"));
				if (gotx && goty)
					addVertex(x, y);
				else
				{
					Log::error(wxString::Format("Wrong vertex %i in UDMF map data", vertcounter));
					return false;
				}
				vertcounter++;
			}
			else if (!token.CmpNoCase("linedef"))
			{
				bool   special  = false;
				bool   twosided = false;
				bool   gotv1 = false, gotv2 = false;
				size_t v1 = 0, v2 = 0;
				do
				{
					token = tz.getToken();
					if (!token.CmpNoCase("v1") || !token.CmpNoCase("v2"))
					{
						bool isv1 = !token.CmpNoCase("v1");
						token     = tz.getToken();
						if (token.Cmp("="))
						{
							Log::error(wxString::Format("Bad syntax for linedef %i in UDMF map data", linecounter));
							return false;
						}
						if (isv1)
							v1 = tz.getInteger(), gotv1 = true;
						else
							v2 = tz.getInteger(), gotv2 = true;
						// skip to end of declaration after each key
						do
						{
							token = tz.getToken();
						} while (token.Cmp(";"));
					}
					else if (!token.CmpNoCase("special"))
					{
						special = true;
						// skip to end of declaration after each key
						do
						{
							token = tz.getToken();
						} while (token.Cmp(";"));
					}
					else if (!token.CmpNoCase("sideback"))
					{
						twosided = true;
						// skip to end of declaration after each key
						do
						{
							token = tz.getToken();
						} while (token.Cmp(";"));
					}
				} while (token.Cmp("}"));
				if (gotv1 && gotv2)
					addLine(v1, v2, twosided, special);
				else
				{
					Log::error(wxString::Format("Wrong line %i in UDMF map data", linecounter));
					return false;
				}
				linecounter++;
			}
			else if (S_CMPNOCASE(token, "thing"))
			{
				// Get X and Y properties
				bool   gotx = false;
				bool   goty = false;
				double x    = 0.;
				double y    = 0.;
				do
				{
					token = tz.getToken();
					if (!token.CmpNoCase("x") || !token.CmpNoCase("y"))
					{
						bool isx = !token.CmpNoCase("x");
						token    = tz.getToken();
						if (token.Cmp("="))
						{
							Log::error(wxString::Format("Bad syntax for thing %i in UDMF map data", vertcounter));
							return false;
						}
						if (isx)
							x = tz.getDouble(), gotx = true;
						else
							y = tz.getDouble(), goty = true;
						// skip to end of declaration after each key
						do
						{
							token = tz.getToken();
						} while (token.Cmp(";"));
					}
				} while (token.Cmp("}"));
				if (gotx && goty)
					addThing(x, y);
				else
				{
					Log::error(wxString::Format("Wrong thing %i in UDMF map data", vertcounter));
					return false;
				}
				vertcounter++;
			}
			else
			{
				// Check for side or sector definition (increase counts)
				if (S_CMPNOCASE(token, "sidedef"))
					n_sides_++;
				else if (S_CMPNOCASE(token, "sector"))
					n_sectors_++;

				// map preview ignores sidedefs, sectors, comments,
				// unknown fields, etc. so skip to end of block
				do
				{
					token = tz.getToken();
				} while (token.Cmp("}") && !token.empty());
			}
			// Iterate to next token
			token = tz.getToken();
		}
	}

	// Non-UDMF map
	if (map.format != MapFormat::UDMF)
	{
		// Read vertices (required)
		if (!readVertices(map.head, map.end, map.format))
			return false;

		// Read linedefs (required)
		if (!readLines(map.head, map.end, map.format))
			return false;

		// Read things
		if (map.format != MapFormat::UDMF)
			readThings(map.head, map.end, map.format);

		// Read sides & sectors (count only)
		ArchiveEntry* sidedefs = nullptr;
		ArchiveEntry* sectors  = nullptr;
		while (map.head)
		{
			// Check entry type
			if (map.head->type() == EntryType::fromId("map_sidedefs"))
				sidedefs = map.head;
			if (map.head->type() == EntryType::fromId("map_sectors"))
				sectors = map.head;

			// Exit loop if we've reached the end of the map entries
			if (map.head == map.end)
				break;
			else
				map.head = map.head->nextEntry();
		}
		if (sidedefs && sectors)
		{
			// Doom64 map
			if (map.format != MapFormat::Doom64)
			{
				n_sides_   = sidedefs->size() / 30;
				n_sectors_ = sectors->size() / 26;
			}

			// Doom/Hexen map
			else
			{
				n_sides_   = sidedefs->size() / 12;
				n_sectors_ = sectors->size() / 16;
			}
		}
	}

	// Clean up
	if (map_archive)
	{
		temp_archive_->close();
		delete temp_archive_;
		temp_archive_ = nullptr;
	}

	// Refresh map
	Refresh();

	return true;
}
示例#4
0
 virtual bool nextEntry(std::string skipTo) {
   return nextEntry(skipTo.c_str());
 }
java::lang::Object* rice::p2p::util::RedBlackMap_ValueIterator::next()
{
    return npc(nextEntry())->value;
}
示例#6
0
 JObject* next() {
     return (*nextEntry()).first;
 }
示例#7
0
 JObject* next() {
     map<JObject*,JObject*,JObject::POINTER_COMPARATOR>::iterator i=nextEntry();
     return new JHashMap::JEntryImpl(i);
 }
示例#8
0
 JObject* next() {
     return (*nextEntry()).second;
 }
void CLexiconReadWindow::initActions()
{
	qDebug("CLexiconReadWindow::initActions");

	KActionCollection* ac = actionCollection();
	CLexiconReadWindow::insertKeyboardActions(ac);
	CReadWindow::initActions();

	
	m_actions.backInHistory = dynamic_cast<KToolBarPopupAction*>(
		ac->action(CResMgr::displaywindows::general::backInHistory::actionName) );
	Q_ASSERT(m_actions.backInHistory);

	m_actions.forwardInHistory = dynamic_cast<KToolBarPopupAction*>(
		 ac->action(CResMgr::displaywindows::general::forwardInHistory::actionName) );
	Q_ASSERT(m_actions.forwardInHistory);


	KAction* kaction;

	kaction = new KAction(tr("Next entry"), ac );
	kaction->setShortcut( CResMgr::displaywindows::lexiconWindow::nextEntry::accel);
	QObject::connect(kaction, SIGNAL(triggered()), this, SLOT( nextEntry() ) );
	ac->addAction("nextEntry", kaction);

	kaction = new KAction(tr("Previous entry"), ac );
	kaction->setShortcut( CResMgr::displaywindows::lexiconWindow::previousEntry::accel);
	QObject::connect(kaction, SIGNAL(triggered()), this, SLOT( previousEntry() ) );
	ac->addAction("previousEntry", kaction);


	m_actions.selectAll = qobject_cast<KAction*>(ac->action("selectAll"));
	//TODO: Q_ASSERT(m_actions.selectAll);

	m_actions.findText = qobject_cast<KAction*>(ac->action("findText"));
	//TODO: Q_ASSERT(m_actions.findText);
	

	m_actions.findStrongs = new KAction(
		KIcon(CResMgr::displaywindows::general::findStrongs::icon),
		tr("Strong's Search"),
		ac
		);
	m_actions.findStrongs->setShortcut(CResMgr::displaywindows::general::findStrongs::accel);
	QObject::connect(m_actions.findStrongs, SIGNAL(triggered()), this, SLOT(openSearchStrongsDialog()) );
	ac->addAction(CResMgr::displaywindows::general::findStrongs::actionName, m_actions.findStrongs);

	m_actions.copy.reference = new KAction(tr("Reference only"), ac );
	QObject::connect(m_actions.copy.reference, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(copyAnchorOnly()) );
	ac->addAction("copyReferenceOnly", m_actions.copy.reference);

	m_actions.copy.entry = new KAction(tr("Entry with text"), ac );
	QObject::connect(m_actions.copy.entry, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(copyAll()) );
	ac->addAction("copyEntryWithText", m_actions.copy.entry);

	Q_ASSERT(ac->action("copySelectedText"));
	m_actions.copy.selectedText = qobject_cast<KAction*>(ac->action("copySelectedText"));
	
	m_actions.save.entryAsPlain = new KAction(tr("Entry as plain text"), ac );
	QObject::connect(m_actions.save.entryAsPlain, SIGNAL(triggered()), this, SLOT(saveAsPlain()) );
	ac->addAction("saveEntryAsPlain", m_actions.save.entryAsPlain);

	m_actions.save.entryAsHTML = new KAction(tr("Entry as HTML"), ac );
	QObject::connect(m_actions.save.entryAsHTML, SIGNAL(triggered()), this, SLOT(saveAsHTML()));
	ac->addAction("saveEntryAsHTML", m_actions.save.entryAsHTML);

	m_actions.print.reference = new KAction(tr("Reference only"), ac);
	QObject::connect(m_actions.print.reference, SIGNAL(triggered()), this, SLOT(printAnchorWithText()));
	ac->addAction("printReferenceOnly", m_actions.print.reference);

	m_actions.print.entry = new KAction(tr("Entry with text"), ac);
	QObject::connect(m_actions.print.entry, SIGNAL(triggered()), this, SLOT(printAll()));
	ac->addAction("printEntryWithText", m_actions.print.entry);

	// init with the user defined settings
	qDebug("call CBTConfig::setupAccelSettings(CBTConfig::lexiconWindow, ac); and end CLexiconReadWindow::initActions");
	CBTConfig::setupAccelSettings(CBTConfig::lexiconWindow, ac);
};
bool indri::index::DocExtentListMemoryBuilderIterator::nextEntry() {
  if( _list < _listEnd ) {
    int deltaDocument;
    int extents;
    
    _list = lemur::utility::RVLCompress::decompress_int( _list, deltaDocument );
    _data.document += deltaDocument;
    _data.extents.clear();
    _data.numbers.clear();

    _list = lemur::utility::RVLCompress::decompress_int( _list, extents );

    int deltaPosition;
    int ordinal = 0;
    int parent = 0;
    int deltaOrdinal;
    Extent extent;
    extent.begin = 0;
    extent.end = 0;
    extent.ordinal = 0;
    extent.parent = -1;
    extent.weight = 1;

    for( int i=0; i<extents; i++ ) {
      _list = lemur::utility::RVLCompress::decompress_int( _list, deltaPosition );
      // delta encode with respect to previous extent's begin
      extent.begin = extent.begin + deltaPosition;
      _list = lemur::utility::RVLCompress::decompress_int( _list, deltaPosition );
      // delta encode end with respect to begin
      extent.end = extent.begin + deltaPosition;

      if( _ordinal ) {
        _list = lemur::utility::RVLCompress::decompress_int( _list, deltaOrdinal );
        ordinal = ordinal + deltaOrdinal;
        extent.ordinal = ordinal;
      }

      if( _parental ) {
        _list = lemur::utility::RVLCompress::decompress_int( _list, parent );
        extent.parent = parent;
      }

      _data.extents.push_back( extent );

      if( _numeric ) {
        INT64 number;
        _list = lemur::utility::RVLCompress::decompress_longlong( _list, number );
        _data.numbers.push_back( number );
      }

      assert( _list <= _listEnd );
    }
  } else {    
    assert( _list == _listEnd );

    // no data left, go to the next segment
    if( _current != _lists->end() )
      _current++;
    
    if( _current != _lists->end() ) {
      _list = _current->base;
      _listEnd = _current->data;
      return nextEntry();
    }

    // no more list segments
    _finished = true;
    return false;
  }

  assert( _list <= _listEnd );
  return true;
}
示例#11
0
void indri::file::BulkTreeIterator::startIteration() {
  _pairIndex = -1;
  _blockIndex = 0;
  _fileLength = _file.size();
  nextEntry();
}
void indri::index::DiskTermListFileIterator::startIteration() {
  _finished = false;
  nextEntry();
}