Ejemplo n.º 1
0
/**
 * \en
 * clears all tags from pattern
 * \_en
 * \ru
 * Удаляет все теги из документа, а также строки, в которых содержится тег секции
 * \_ru
 */
void
aMSOTemplate::cleanUpTags()
{
	QDomNode n = docTpl.lastChild();
	while( !n.isNull() ) 
	{
		clearTags(n,false);
		//clearRow(n);
		n = n.previousSibling();
	}
	n = docTpl.lastChild();
	while( !n.isNull() ) 
	{
		//clearTags(n,false);
		clearRow(n);
		n = n.previousSibling();
	}
	n = docTpl.lastChild();
	while (!n.isNull())
	{
		clearAttributes(n, "Table", "ss:ExpandedRowCount");
		n = n.previousSibling();
	}
	
}
Ejemplo n.º 2
0
/** 
 * \en
 * insert new row in table and replace tag to value
 * \_en
 * \ru
 * Вставляет новую строку в таблицу, заменяет теги на значения, удаляет тег секции из строки таблицы.
 * Выполняет рекурсивный поиск узла, содержащего строку таблицы. У этого узла есть
 * специальное имя(w:r), которое распознается функцией. После того, как узел найден, строка строка дублируется, 
 * а из текущей строки удаляются все теги секции, чтобы избежать мнократного размножения строк таблицы.
 * \_ru
 * \param node - \en context for inserting \_en \ru узел, в который происходит вставка \_ru 
 * \see searchTags()
 */
void 
aMSOTemplate::insertRowValues(QDomNode node)
{
	QDomNode n = node;
	while(!n.parentNode().isNull())
	{
		n = n.parentNode();
		QDomElement e = n.toElement();
		if( n.nodeName()=="Row" ) 
		{	
			QDomAttr a = n.toElement().attributeNode( "ss:Index" );
			n.parentNode().insertAfter(n.cloneNode(true),n);
			clearTags(n,true);
			
			QMap<QString,QString>::Iterator it;
			for ( it = values.begin(); it != values.end(); ++it )
			{
				searchTags(n,it.key());
			}
			int rowIndex = a.value().toInt();
			if (rowIndex == 0) 
			{
				rowIndex = getRowIndex(n);
				n.toElement().setAttribute("ss:Index",rowIndex);	
			}
			n.nextSibling().toElement().setAttribute("ss:Index",rowIndex+1);	
		}
	}
}
Ejemplo n.º 3
0
void TagEditor::createActions(){

    connect(LoadScriptButton,SIGNAL(clicked()),this,SLOT(loadScript()));
    connect(SaveScriptButton,SIGNAL(clicked()),this,SLOT(saveScript()));
    connect(RunScriptButton,SIGNAL(clicked()),this, SLOT(runScript()));

    QAction* searchOnlineAction = new QAction(tr("Search for selected file/album in online musicdatabases..."), this);
    searchOnlineAction->setShortcut(tr("Ctrl+S"));
    connect(searchOnlineAction, SIGNAL(triggered()), this, SLOT(searchOnline()));
    QAction* searchForFilesAction = new QAction(tr("Search for files to add to workspace..."), this);
    //searchForFilesAction->setShortcut(tr("Ctrl+S"));
    connect(searchForFilesAction, SIGNAL(triggered()), this, SLOT(searchAndAddFiles()));

    TreeView->setContextMenuPolicy(Qt::ActionsContextMenu);
    TreeView->addAction(searchOnlineAction);
    TreeView->addAction(searchForFilesAction);


    connect( TreeView, SIGNAL( expanded( const QModelIndex & )  ), this, SLOT( resizeColumn() ) );
    connect( TreeView, SIGNAL( collapsed( const QModelIndex & )  ), this, SLOT( resizeColumn() ) );
    //connect( TreeWidget_, SIGNAL( currentRowChanged( int )  ), this, SLOT( showTagInfo(int) ) );
    connect( TreeWidget_, SIGNAL( itemSelectionChanged() ), this, SLOT( showTagInfo() ) );
    connect( AddButton, SIGNAL( clicked()  ), this, SLOT(addFiles() ) );
    connect( RemoveButton, SIGNAL( clicked()  ), this, SLOT(removeFiles() ) );
    connect( ClearButton, SIGNAL( clicked()  ), this, SLOT(removeAllFiles() ) );
    connect( SaveButton, SIGNAL( clicked()  ), this, SLOT(saveTag() ) );
    connect( ChooseDirButton, SIGNAL( clicked()  ), this, SLOT(chooseDir() ) );

    connect( actionSettings, SIGNAL( triggered() ), this, SLOT( showSettings() ) );
    connect( actionRewriteTag, SIGNAL( triggered() ), this, SLOT( rewriteTag() ) );
    connect( actionRenameFiles, SIGNAL( triggered() ), this, SLOT( renameFiles() ) );
    connect( actionReplaceTags, SIGNAL( triggered() ), this, SLOT( replaceTags() ) );
    connect( actionSerialize, SIGNAL( triggered() ), this, SLOT( serialize() ) );
    connect( actionClearTags, SIGNAL( triggered() ), this, SLOT( clearTags() ) );
    //connect( actionRemoveFrames, SIGNAL( triggered() ), this, SLOT( removeFrames() ) );
    //styles

    QSignalMapper *styleMapper = new QSignalMapper(this);
    QStringList styles = QStyleFactory::keys();
    for(int i=0;i<styles.size();i++){
        QAction *a = new QAction(styles[i],menuStyle);
        a->setCheckable(true);
        connect(a, SIGNAL(triggered()), styleMapper, SLOT(map()));
        styleMapper->setMapping(a, styles[i]);
        menuStyle->addAction(a);
    }
    menuStyle->addSeparator();
    QAction *actionCustomStyleSheet = new QAction("Custom...",menuStyle);
    actionCustomStyleSheet->setCheckable(true);
    connect(actionCustomStyleSheet, SIGNAL(triggered()), this, SLOT(openStyleSheet()));
    menuStyle->addAction( actionCustomStyleSheet );
    connect(styleMapper, SIGNAL(mapped(const QString &)), this, SLOT(setGUIStyle(const QString &)));

}
Ejemplo n.º 4
0
/**
 * \en
 * Deletes tags from \a node
 * \_en
 * \ru
 * Удаляет рекурсивно теги из \a node.
 * \_ru
 * \param node - \en context \_en \ru узел из которого нужно удалить теги \_ru
 * \param section - \ru true, если надо удалить тег секции \_ru
 */
void
aMSOTemplate::clearTags(QDomNode node, bool section )
{
	if(node.isNull()) return;
	
	QDomNode n = node.lastChild();
	while( !n.isNull() )
	{	
		if(n.isText())
		{
			QString str = n.nodeValue();
			QRegExp re;
			if(section)
			{
				re.setPattern(QString("%1.*%2").arg(open_token_section).arg(close_token_section));
			}
			else
			{
				re.setPattern(QString("%1.*%2").arg(open_token).arg(close_token));
			}
			re.setMinimal(true);
			int pos = re.search(str,0);
		
			while(pos != -1)
			{
				str = str.remove(re);
				pos = re.search(str,0);
			}
			n.setNodeValue(str);			
		}
		else
		{
			clearTags(n,section);
		}
		n = n.previousSibling();
	}	
}
Ejemplo n.º 5
0
Local void analyzeParagraph(struct LOC_paragraphSetup *LINK)
{
  paragraph_index i, FORLIM;

  *LINK->voice = 0;
  bottom = 0;
  top = nvoices + 1;
  clearLabels();
  clearTags();
  clearUptext();
  FORLIM = para_len;
  for (i = 1; i <= FORLIM; i++)
  {   /* ----- Paragraph analysis main loop ----- */
    if (*P[i-1] != '\0' && P[i-1][0] != comment) {
      NextWord(LINK->w, P[i-1], blank, colon);
      line_no = orig_line_no[i-1];
      LINK->l = strlen(LINK->w);
      LINK->is_labelled = (LINK->w[LINK->l-1] == colon &&
			   LINK->w[LINK->l-2] != barsym);
      if (LINK->is_labelled) {
	strcpy(LINK->P_keep, P[i-1]);
	predelete(P[i-1], LINK->l);
	shorten(LINK->w, LINK->l - 1);
	LINK->k = findVoice(LINK->w);   /* First look for a voice label */
	if (LINK->k > 0) {
	  *LINK->voice = LINK->k;
	  setMusicLineNo(*LINK->voice, i);
	} else if (LINK->w[0] == 'L')
	  maybeLyrics(*LINK->voice, i, LINK->w);
	else if (LINK->w[0] == 'C')
	  maybeChords(i, LINK);
	else if (LINK->w[0] == 'U')
	  maybeUptext(i, LINK);
	else {
	  if (startsWithIgnoreCase(LINK->w, "SPACE")) {
	    setSpace(P[i-1]);
	    must_respace = true;
	  } else {
	    if (startsWithIgnoreCase(LINK->w, "VOICES")) {
	      selectVoices(P[i-1]);
	      must_restyle = true;
	    } else {
	      strcpy(P[i-1], LINK->P_keep);
	      LINK->is_labelled = false;
	      if (!isNoteOrRest(LINK->w)) {
		error("Unknown line label", print);
		/** ------------ Maybe Space command ------------ */
		/** ------------ Maybe Voices command ------------ */
		/** Could be sticky attribute **/
	      }
	    }
	  }
	}
      }
      if (!LINK->is_labelled) {
	(*LINK->voice)++;
	setMusicLineNo(*LINK->voice, i);
      }
      if (*LINK->voice > bottom)
	bottom = *LINK->voice;
      if (*LINK->voice > 0 && *LINK->voice < top)
	top = *LINK->voice;
    }
  }
}
Ejemplo n.º 6
0
/*
 * @brief 	Constructor of the main class
 * The Constructor initializes all needed variables and one instance of every used dialog.
 */
CReaderTool::CReaderTool(QWidget *parent)
    : QMainWindow(parent)
	, QrfeTraceModule("Reader_Tool")
{
	m_updateThread = NULL;

	int alignment = Qt::AlignHCenter | Qt::AlignBottom;

	//Mod by yingwei tseng for hiding AMS code, 2010/03/10
	#if 0
	QPixmap logo(":/ams logos/amsStartupLogo");
	#endif
	QPixmap logo(":/ams logos/mtiRfidLogo");
	//End by yingwei tseng for hiding AMS code, 2010/03/10
	
	//clark 2011.12.15
	//logo.setMask(logo.createHeuristicMask());
	QSplashScreen *splash = new QSplashScreen(logo);
	splash->setMask(logo.mask());
	splash->setWindowOpacity(0);
	splash->show();
	for(double i = 0; i < 1; i += 0.05)
	{
		splash->setWindowOpacity(i);
		Sleep(50);
	}

	/* Init variables */
	m_scanActive = false;

	splash->showMessage(tr("Initialize GUI..."), alignment);
	/* Setup the ui */
	ui.setupUi(this);

	this->setWindowTitle(QString(APPLICATION_NAME));

	splash->showMessage(tr("Create Handlers..."), alignment);

	/* Create Action Handler */
	m_actionHandler = new CActionHandler(&m_dataHandler, this);

	/* Create Read Rate Calculator */
	m_readRateCalc = new CReadRateCalc(this);

	/* Create Tag Manager */
	m_tagManager = new CTagManager(this);

	m_amsComWrapper = new USBHIDWrapper(0x0);

	splash->showMessage(tr("Create Dialogs..."), alignment);

	/* Create Dialogs */
	m_aboutDialog = new QrfeAboutDialog(this);
	m_keyDialog = new QrfeKeyWindow(this);
	m_tagListDialog = new CTagListView(m_tagManager, this);
	m_settingsDialog = new CSettingsDialog(this);
	m_tagSettingsDialog = new CTagSettingsDialog(&m_dataHandler, this);
	m_gen2SettingsDialog = new CGen2TagDialog(this);

       
	/* Create the view manager */
	m_tagViewManager = new CTagViewManager(ui.readerTreeWidget, &m_dataHandler, m_readRateCalc, this);
	m_tagViewManager->setUp(	m_settingsDialog->showAlias(),
								m_settingsDialog->useTtl(),
								m_settingsDialog->msecsToShowInactive(),
								m_settingsDialog->msecsToShowOutOfRange(),
								m_settingsDialog->msecsToDelete());
	QObject::connect(m_tagViewManager, SIGNAL(requestTagSettings(QString)), this, SLOT(requestTagSettingsDialog(QString)));
	QObject::connect(m_tagViewManager, SIGNAL(requestTagAdvancedSettings(QString, QString)), this, SLOT(requestTagAdvancedSettingsDialog(QString, QString)));
	QObject::connect(m_tagViewManager, SIGNAL(requestReaderAdvancedSettings(QString)), this, SLOT(requestReaderAdvancedSettingsDialog(QString)));
	QObject::connect(m_tagViewManager, SIGNAL(requestReaderRegisterMap(QString)), this, SLOT(requestReaderRegisterMap(QString)));
	QObject::connect(m_tagViewManager, SIGNAL(newTagCount(int)), ui.tagCountNumber, SLOT(display(int)));
	QObject::connect(m_tagViewManager, SIGNAL(newDifferentTagCount(int)), ui.differentTagCountNumber, SLOT(display(int)));
	QObject::connect(m_tagViewManager, SIGNAL(newOverallDifferentTagCount(int)), ui.overallDifferentTagCountNumber, SLOT(display(int)));
	QObject::connect(m_tagViewManager, SIGNAL(oldTagEntryRemoved(QString,QString)), m_tagManager, SLOT(oldTagEntryRemoved(QString,QString)));
	QObject::connect(m_tagViewManager, SIGNAL(currentReaderChanged(QString)), this, SLOT(currentReaderChanged(QString)));
	QObject::connect(m_tagViewManager, SIGNAL(countTotalTags(QString)), this, SLOT(countTotalTags(QString)));
	splash->showMessage(tr("Connect..."), alignment);

	/* Connect the signals of the gui to the right slots */
	QObject::connect(QrfeTrace::getInstance(), SIGNAL(traceSignal(QString)), 	ui.traceBrowser, SLOT(append(QString)));
	QObject::connect(ui.actionAboutReaderTool, SIGNAL(triggered (bool)), 		m_aboutDialog, SLOT(exec()));
	QObject::connect(ui.actionShow_TagList, SIGNAL(triggered (bool)), 			m_tagListDialog, SLOT(exec()));

	QObject::connect(ui.readerTabWidget, SIGNAL(currentChanged(int)), 			this, SLOT(selectReader(int)));
	QObject::connect(ui.startScanButton, SIGNAL(toggled (bool)), 				this, SLOT(startScan(bool)));
	QObject::connect(ui.handleActionPushButton, SIGNAL(toggled(bool)), 			this, SLOT(handleActionsToggled(bool)));
	QObject::connect(ui.actionAdd_Serial_Reader, SIGNAL(triggered(bool)), 		this, SLOT(addSerialReader()));
	//Del by yingwei tseng for hiding AMS code, 2010/03/10
	//QObject::connect(ui.actionAdd_Tcp_Reader, SIGNAL(triggered(bool)), 			this, SLOT(addTcpReader()));
	//End by yingwei tseng for hiding AMS code, 2010/03/10	
	QObject::connect(ui.actionHandle_Actions, SIGNAL(triggered(bool)), 			this, SLOT(handleActionsToggled(bool)));
	QObject::connect(ui.actionShow_Alias_Names, SIGNAL(triggered ( bool)), 		this, SLOT(showAliasNames(bool)));
	QObject::connect(ui.actionUse_Time_To_Live, SIGNAL(triggered ( bool)), 		this, SLOT(useTimeToLive(bool)));
	QObject::connect(ui.actionPreferences, SIGNAL(triggered ( bool)), 			this, SLOT(showSettings()));
	QObject::connect(ui.actionOpen_Register_Map, SIGNAL(triggered ( bool)), 	this, SLOT(showRegisterMap()));
	QObject::connect(ui.clearButton, SIGNAL(clicked()), 						m_readRateCalc, SLOT(clearResults()));
	QObject::connect(ui.actionClear_Tags, SIGNAL(triggered (bool)), 			m_readRateCalc, SLOT(clearResults()));
	QObject::connect(ui.clearButton, SIGNAL(clicked()), 						m_tagViewManager, SLOT(clearTags()));
	QObject::connect(ui.actionClear_Tags, SIGNAL(triggered (bool)), 			m_tagViewManager, SLOT(clearTags()));
	QObject::connect(ui.clearOfflineReaderButton, SIGNAL(clicked()), 			m_tagViewManager, SLOT(clearOfflineReader()));
	QObject::connect(ui.clearOfflineReaderButton, SIGNAL(clicked()), 			this, SLOT(clearOfflineReader()));
	QObject::connect(ui.actionClear_Offline_Reader, SIGNAL(triggered(bool)), 	m_tagViewManager, SLOT(clearOfflineReader()));

	QObject::connect(m_gen2SettingsDialog,    SIGNAL(easterKeyUnlocked()),      this, SLOT(easterKeyUnlocked()));

	/* Create the scan timer to get the end of the scan */
	m_scanTimer = new QTimer(this);
	m_scanTimer->setSingleShot(true);
	QObject::connect(m_scanTimer, SIGNAL(timeout()), this, SLOT(stopScan()));

	/* Create timer for the scan progress bar */
	m_scanProgressTimer = new QTimer(this);
	m_scanProgressTimer->setSingleShot(false);
	m_scanProgressTimer->setInterval(1000);

	m_regMapWindow = NULL;

	/* Connect to the Reader Manager */
	QObject::connect(this, SIGNAL(currentReaderChanged(QrfeReaderInterface*)), m_amsComWrapper, SLOT(gotReader(QrfeReaderInterface*)));
	QObject::connect(&m_readerManager, SIGNAL(lostReader(QrfeReaderInterface*)), m_amsComWrapper, SLOT(lostReader(QrfeReaderInterface*)));
	QObject::connect(&m_readerManager, SIGNAL(gotReader(QrfeReaderInterface*)), this, SLOT(gotReader(QrfeReaderInterface*)));
	QObject::connect(&m_readerManager, SIGNAL(lostReader(QrfeReaderInterface*)), this, SLOT(lostReader(QrfeReaderInterface*)));

    //Add by yingwei tseng for using bar to set power, 2010/07/09
    QObject::connect(ui.powerSlider, SIGNAL(valueChanged(int)), this, SLOT(powerSliderChange(int)));
	//End by yingwei tseng for using bar to set power, 2010/07/09

	/* Create the timer for the multiplexer control */
	m_multiplexTimer = new QTimer(this);
	m_multiplexTimer->setSingleShot(true);
	m_multiplexTimer->setInterval(m_settingsDialog->multiplexTime());
	QObject::connect(m_multiplexTimer, SIGNAL(timeout()), this, SLOT(multiplexISR()));

	/* Finally set up the gui */
	ui.traceDockWidget->setVisible(false);
	ui.informationBox->setVisible(false);
	ui.actionShow_Alias_Names->setChecked(m_settingsDialog->showAlias());
	ui.actionUse_Time_To_Live->setChecked(m_settingsDialog->useTtl());

	splash->showMessage(tr("Starting up..."), alignment);
	ActivateSettings();
	Sleep(1000);
	splash->close();

	//Add by yingwei tseng for hiding AMS code, 2010/03/10
	ui.handleActionPushButton->hide();
	ui.clearOfflineReaderButton->hide();
	//ui.actionAdd_Serial_Reader->setVisible(false);
	ui.actionAdd_USB->setVisible(false);
	ui.actionAdd_Tcp_Reader->setVisible(false);
	ui.actionHandle_Actions->setVisible(false);
	ui.actionClear_Offline_Reader->setVisible(false);
	//End by yingwei tseng for hiding AMS code, 2010/03/10

	//Add by yingwei tseng for hiding items, 2010/12/08
    ui.actionShow_Alias_Names->setVisible(false);
	ui.actionUse_Time_To_Live->setVisible(false);
	ui.actionShow_Trace_Browser->setVisible(false);
	ui.actionShow_TagList->setVisible(false);
	//End by yingwei tseng for hiding items, 2010/12/08
	ui.groupBox_3->hide();
}