Exemple #1
0
inline void
TagDialog::nextTrack()
{
    if( m_playlistItem )
    {
        if( !m_playlistItem->itemBelow() ) return;

        storeTags();

        m_playlistItem = static_cast<PlaylistItem *>( m_playlistItem->itemBelow() );

        loadTags( m_playlistItem->url() );
    }
    else
    {
        storeTags( *m_currentURL );

        KURL::List::iterator next = m_currentURL;
        ++next;
        if( next != m_urlList.end() )
            ++m_currentURL;
        loadTags( *m_currentURL );
        enableItems();
    }
    readTags();
}
Exemple #2
0
HAlbumContext::HAlbumContext(HAlbum& rep, QWidget *parent) :
    QWidget(parent),
    s_rep(rep),
    s_albumLoadCount(0),
    s_trackLoadCount(0),
    s_tagLoadCount(0),
    s_artistLoadCount(0),
    s_shoutLoadCount(0),
    s_cachedPlayCount(-1),s_cachedListenerCount(-1),s_cachedUserPlayCount(-1),
    s_shoutsToLoad(5),
    s_pw(0), s_ge(0),
    ui(new Ui::HAlbumContext)
{
    s_showTime=QTime::currentTime();
    ui->setupUi(this);
    ui->label_album->setText(s_rep.getAlbumName());
    s_priority[0].push_back(s_rep.sendSummary(this,"setSummary"));

    s_priority[0].push_back(s_rep.sendPlayCount(this,"setPlayCount"));
    s_priority[0].push_back(s_rep.sendListenerCount(this,"setListenerCount"));
    s_priority[0].push_back(s_rep.sendUserPlayCount(this,"setUserPlayCount"));

    connect(ui->label_moreDescription,SIGNAL(linkActivated(QString)),this,SLOT(showMoreBio()));

    ui->widget_artist->setLayout(new QVBoxLayout);
    ui->widget_tags->setLayout(new QVBoxLayout);
    ui->widget_tracks->setLayout(new QVBoxLayout);
    ui->widget_comments->setLayout(new QVBoxLayout);
    ui->widget_comments->layout()->setSpacing(0);

    connect(ui->label_moreTracks,SIGNAL(linkActivated(QString)),this,SLOT(loadTracks()));

    connect(ui->label_moreTags,SIGNAL(linkActivated(QString)),this,SLOT(loadTags()));

//    connect(ui->label_moreArtists,SIGNAL(linkActivated(QString)),this,SLOT(loadSimilar()));

    connect(ui->label_moreShoutbox,SIGNAL(linkActivated(QString)),this,SLOT(loadShouts()));
    connect(ui->textEdit_shout,SIGNAL(textChanged()),this,SLOT(evalShout()));
    connect(ui->pushButton_post,SIGNAL(clicked()),this,SLOT(sendShout()));

    ui->label_albumPic->adjustSize();
    ui->frame_art->adjustSize();
    ui->frame_header->adjustSize();

    connect(ui->button_play,SIGNAL(clicked()),this,SLOT(play()));
    s_albumLoadCount=0;
    s_trackLoadCount=0;
    s_tagLoadCount=0;

    loadArtist();
    loadTracks();
    loadTags();

    readjustPriorities();
}
Exemple #3
0
bool BooksDB::loadBooks(BookList &books) {
	AppLog(" BooksDB::loadBooks(BookList &books)");
	shared_ptr<DBDataReader> reader = myLoadBooks->executeReader();

	books.clear();
	std::map<int,shared_ptr<Book> > bookMap;

	while (reader->next()) {
		if (reader->type(0) != DBValue::DBINT || /* book_id */
				reader->type(4) != DBValue::DBINT) { /* file_id */
			return false;
		}
		const int bookId = reader->intValue(0);
		const int fileId = reader->intValue(4);
		const std::string fileName = getFileName(fileId);

		shared_ptr<Book> book = Book::createBook(
			ZLFile(fileName),
			bookId,
			reader->textValue(1, Book::AutoEncoding),
			reader->textValue(2, ZLLanguageUtil::OtherLanguageCode),
			reader->textValue(3, std::string())
		);
		books.push_back(book);
		bookMap[bookId] = book;
	}

	loadSeries(bookMap);
	AppLog("loadSeries(bookMap);");
	loadAuthors(bookMap);
	AppLog("loadAuthors(bookMap);");
	loadTags(bookMap);
	AppLog("loadTags(bookMap);");
	return true;
}
void GAFLoader::_processLoad(GAFFile* file, GAFAsset* context)
{
    m_stream = new GAFStream(file);

    GAFHeader& header = m_stream->getInput()->getHeader();

	GAFTimeline *timeline = nullptr;
    if (header.getMajorVersion() >= 4)
    {
        _readHeaderEndV4(header);
        _registerTagLoadersV4();
    }
    else
    {
        _readHeaderEnd(header);
        _registerTagLoadersV3();

		timeline = new GAFTimeline(nullptr, 0, header.frameSize, header.pivot, header.framesCount);
		context->pushTimeline(0, timeline);
        context->setRootTimeline((uint32_t)0);
    }

    _registerTagLoadersCommon();

    context->setHeader(header);

    loadTags(m_stream, context, timeline);

    delete m_stream;
}
Exemple #5
0
shared_ptr<Book> BooksDB::loadBook(const std::string &fileName) {
	AppLog(" BooksDB::loadBook(const std::string &fileName)");
	if (!isInitialized()) {
		return 0;
	}

	myFindFileId->setFileName(fileName);
	if (!myFindFileId->run()) {
		return false;
	}
	((DBIntValue&)*myLoadBook->parameter("@file_id").value()) = myFindFileId->fileId();
	shared_ptr<DBDataReader> reader = myLoadBook->executeReader();

	if (reader.isNull() || !reader->next() ||
			reader->type(0) != DBValue::DBINT /* book_id */) {
		return 0;
	}
	const int bookId = reader->intValue(0);

	shared_ptr<Book> book = Book::createBook(
		ZLFile(fileName), bookId,
		reader->textValue(1, Book::AutoEncoding),
		reader->textValue(2, ZLLanguageUtil::OtherLanguageCode),
		reader->textValue(3, std::string())
	);

	loadSeries(*book);
	AppLog("loadSeries(*book);");
	loadAuthors(*book);
	AppLog("loadSeries(*book);");
	loadTags(*book);
	AppLog("loadSeries(*book);");

	return book;
}
Exemple #6
0
void DisjointMetadata::load(const ImageInfo &info)
{
    CaptionsMap commentMap;
    CaptionsMap titleMap;

    {
        CoreDbAccess access;
        ImageComments comments = info.imageComments(access);
        commentMap             = comments.toCaptionsMap();
        titleMap               = comments.toCaptionsMap(DatabaseComment::Title);
    }

    Template tref = info.metadataTemplate();
    Template t    = TemplateManager::defaultManager()->findByContents(tref);
    //qCDebug(DIGIKAM_GENERAL_LOG) << "Found Metadata Template: " << t.templateTitle();

    load(info.dateTime(),
         titleMap,
         commentMap,
         info.colorLabel(),
         info.pickLabel(),
         info.rating(),
         t.isNull() ? tref : t);

    QList<int> tagIds = info.tagIds();
    loadTags(tagIds);
}
void ofxLayout::loadFromXmlLayout(ofxXmlSettings *xmlLayout, ofxLayoutElement* element, TAG::ENUM tagEnum, int which){
    element->setTag(tagEnum);
    string tag = ofxLayoutElement::getTagString(tagEnum);
    
    string id = xmlLayout->getAttribute(tag,"id", "", which);
    element->setID(id);
    if(id != ""){
        idElementMap[id] = element;
    }
    
    string classes = xmlLayout->getAttribute(tag,"class", "", which);
    element->setClasses(classes);
    for(string classname : ofSplitString(classes, " ",true,true)){
        set<ofxLayoutElement*> cmap = classElementMap[classname];
        if(std::find(cmap.begin(), cmap.end(), element) != cmap.end()) {

        } else {
            /* v does not contain x */
            classElementMap[classname].insert(element);
        }
    }
    
    string style = xmlLayout->getAttribute(tag,"style", "", which);
    element->setInlineStyle(style);
    
    string value = xmlLayout->getValue(tag,"", which);
    element->setValue(value);
    
    
    vector<string> attributes;
    
    xmlLayout->getAttributeNames(tag, attributes, which);
    
    for(int i = 0; i < attributes.size(); i++){
        string attribute = attributes[i];
        if(attribute != "id" && attribute != "class" && ofxOSS::validKey(attribute)){
            element->appendInlineStyle(" "+attribute+" : "+xmlLayout->getAttribute(tag, attribute, "", which)+";");
        }
    }
    
    string file = xmlLayout->getAttribute(tag,"file", "", which);
    
    if(file != ""){
        ofxXmlSettings fileLayout;
        bool fileParsingSuccessful = fileLayout.loadFile(file);
        if(fileParsingSuccessful){
            loadFromXmlLayout(&fileLayout, element, tagEnum, which);
        }
        else{
            ofLogError("ofxLayout::loadFromFile","Unable to parse OFML file "+file+".");
        }
    }
    else{
        // Push into current element, and load all children of different valid tag types
        xmlLayout->pushTag(tag, which);
        loadTags(xmlLayout, element);
        xmlLayout->popTag();
    }
}
Exemple #8
0
// (ctags-load (string|file-name)) -> nil/t
base::cell_t ctags_load(base::lisp &gl, base::cell_t c, base::cells_t &ret) {
	if (base::lisp::validate(c, base::cell::list(1), base::cell::typeString)) {
		const auto &fileName = c + 1;
		if (loadTags(fileName->s))
			return gl.t();
		return gl.nil();
	}
	gl.signalError("ctags-load: invalid arguments, expected (string)");
	return gl.nil();
}
void MainWindow::on_pbDelete_clicked()
{
    int index = ui->tbWords->currentRow();
    if(index != -1){
        string word = ui->tbWords->item(index, 0)->text().toStdString();
        dictionary->deleteWord(word);
        loadTags();
        loadWithFilter("");
    }
}
Exemple #10
0
void KTagsView::slotLoadTags()
{
  if (isVisible()) {
    if (m_inSelection)
      QTimer::singleShot(0, this, SLOT(slotLoadTags()));
    else
      loadTags();
  } else {
    m_needReload = true;
  }
}
Exemple #11
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    dictionary = new Diccionario("diccionario.xml");
    dictionary->loadDictionary();
    loadIntoTable();
    layoutSet = false;
    loadTags();

    setUI();
}
Exemple #12
0
inline void
TagDialog::previousTrack()
{
    if( m_playlistItem )
    {
        if( !m_playlistItem->itemAbove() ) return;

        storeTags();

        m_playlistItem = static_cast<PlaylistItem *>( m_playlistItem->itemAbove() );

        loadTags( m_playlistItem->url() );
    }
    else
    {
        storeTags( *m_currentURL );

        if( m_currentURL != m_urlList.begin() )
            --m_currentURL;
        loadTags( *m_currentURL );
        enableItems();
    }
    readTags();
}
Exemple #13
0
HelpWindow::HelpWindow() :
    // TRANSLATORS: help window name
    Window(_("Help"), Modal_false, nullptr, "help.xml"),
    LinkHandler(),
    ActionListener(),
    // TRANSLATORS: help window. button.
    mDYKButton(new Button(this, _("Did you know..."), "DYK",
        BUTTON_SKIN, this)),
    mBrowserBox(new StaticBrowserBox(this, Opaque_true,
        "browserbox.xml")),
    mScrollArea(new ScrollArea(this, mBrowserBox,
        Opaque_true, "help_background.xml")),
    mTagFileMap()
{
    setMinWidth(300);
    setMinHeight(220);
    setContentSize(455, 350);
    setWindowName("Help");
    setCloseButton(true);
    setResizable(true);
    setStickyButtonLock(true);

    if (setupWindow != nullptr)
        setupWindow->registerWindowForReset(this);

    setDefaultSize(500, 400, ImagePosition::CENTER, 0, 0);

    mBrowserBox->setOpaque(Opaque_false);

    mBrowserBox->setLinkHandler(this);
    if (gui != nullptr)
        mBrowserBox->setFont(gui->getHelpFont());
    mBrowserBox->setProcessVars(true);
    mBrowserBox->setEnableImages(true);
    mBrowserBox->setEnableKeys(true);
    mBrowserBox->setEnableTabs(true);

    place(4, 3, mDYKButton, 1, 1);
    place(0, 0, mScrollArea, 5, 3).setPadding(3);

    Layout &layout = getLayout();
    layout.setRowHeight(0, LayoutType::SET);

    loadWindowState();
    loadTags();
    enableVisibleSound(true);
    widgetResized(Event(nullptr));
}
Exemple #14
0
void KTagsView::showEvent(QShowEvent* event)
{
  emit aboutToShow();

  if (m_needReload) {
    loadTags();
    m_needReload = false;
  }

  // don't forget base class implementation
  QWidget::showEvent(event);

  QList<MyMoneyTag> list;
  selectedTags(list);
  emit selectObjects(list);
}
Exemple #15
0
inline void
TagDialog::perTrack()
{
    m_perTrack = !m_perTrack;
    if( m_perTrack )
    {
        // just switched to per track mode
        applyToAllTracks();
        setSingleTrackMode();
        loadTags( *m_currentURL );
        readTags();
    }
    else
    {
        storeTags( *m_currentURL );
        setMultipleTracksMode();
        readMultipleTracks();
    }

    enableItems();
}
Exemple #16
0
void favoritesTab::load()
{
	loadTags(m_currentTags.trimmed().split(' ', QString::SkipEmptyParts));
}
//--------------------------------------------------------------
void GrafPlayerApp::update(){

	dt  = ofGetElapsedTimef()-lastTime;
	lastTime  = ofGetElapsedTimef();
	
	
	bool bTrans = false;
	
	if( mode == PLAY_MODE_LOAD )
	{
		loadTags();
		if(bUseAudio)audio.update();
	}
	else if( mode == PLAY_MODE_PLAY && tags.size() > 0 )
	{
		
		//---- set drawing data for render
		if( drawer.bSetupDrawer )
			drawer.setup( &tags[currentTagID], tags[currentTagID].distMax );

		//---- update tag playing state
		if( !myTagPlayer.bDonePlaying )					
		{
			myTagPlayer.update(&tags[currentTagID]);	// normal play, update tag
		
		}else if( !myTagPlayer.bPaused && myTagPlayer.bDonePlaying && waitTimer > 0)			   
		{
			waitTimer -= dt;	// pause time after drawn, before fades out
		}
		else if ( !myTagPlayer.bPaused && myTagPlayer.bDonePlaying && (drawer.alpha > 0 || particleDrawer.alpha > 0))			  		
		{
			updateTransition(0);
			bTrans = true;
		}
		else if (  !myTagPlayer.bPaused && myTagPlayer.bDonePlaying )							
		{
			resetPlayer(1);	// setup for next tag
		}
	
		
		//---------- AUDIO applied
		if( bUseAudio) updateAudio();
		
		
		//--------- ARCHITECTURE
		if( bUseArchitecture ) updateArchitecture();
		
		
		//--------- PARTICLES
		updateParticles();
			
		
		//--------- TAG ROTATION + POSITION
		if(bRotating && !myTagPlayer.bPaused ) rotationY += panel.getValueF("ROT_SPEED")*dt;
		
		// update pos / vel
		tags[currentTagID].position.x += tagPosVel.x;
		tags[currentTagID].position.y += tagPosVel.y;
		
		tagPosVel.x -= .1*tagPosVel.x;
		tagPosVel.y -= .1*tagPosVel.y;
		
		if(!bTrans)
		{
		tags[currentTagID].rotation_o = tags[currentTagID].rotation;
		tags[currentTagID].position_o = tags[currentTagID].position;
		}

	}
	
	
	
	// controls
	if( bShowPanel ) updateControlPanel();
	
	
}
Exemple #18
0
void Page::parseTags()
{
	// Check redirection
	QUrl redir = m_replyTags->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
	if (!redir.isEmpty())
	{
		m_urlRegex = m_site->fixUrl(redir.toString(), m_urlRegex);
		loadTags();
		return;
	}

	QString source = QString::fromUtf8(m_replyTags->readAll());
	m_tags.clear();

	if (m_site->contains("Regex/Tags"))
	{
		QRegExp rxtags(m_site->value("Regex/Tags"));
		rxtags.setMinimal(true);
		int p = 0;
		QStringList order = m_site->value("Regex/TagsOrder").split('|', QString::SkipEmptyParts);
		while ((p = rxtags.indexIn(source, p)) != -1)
		{
			p += rxtags.matchedLength();
			QString type = "", tag = "";
			int count = 1;
			if (order.empty())
			{
				switch (rxtags.captureCount())
				{
					case 4:	order << "type" << "" << "count" << "tag";	break;
					case 3:	order << "type" << "tag" << "count";		break;
					case 2:	order << "type" << "tag";					break;
					case 1:	order << "tag";								break;
				}
			}
			for (int o = 0; o < order.size(); o++)
			{
				if (order.at(o) == "tag" && tag.isEmpty())
				{ tag = rxtags.cap(o + 1).replace(" ", "_").replace("&amp;", "&").trimmed(); }
				else if (order.at(o) == "type" && type.isEmpty())
				{
					type = rxtags.cap(o + 1).toLower().trimmed();
					if (type.contains(", "))
					{ type = type.split(", ").at(0).trimmed(); }
					if (type == "series")
					{ type = "copyright"; }
					else if (type == "mangaka")
					{ type = "artist"; }
					else if (type == "game")
					{ type = "copyright"; }
					else if (type == "studio")
					{ type = "circle"; }
					else if (type == "source")
					{ type = "general"; }
					else if (type == "character group")
					{ type = "general"; }
					else if (type.length() == 1)
					{
						int tpe = type.toInt();
						if (tpe >= 0 && tpe <= 4)
						{
							QStringList types = QStringList() << "general" << "artist" << "unknown" << "copyright" << "character";
							type = types[tpe];
						}
					}
				}
				else if (order.at(o) == "count" && count != 0)
				{ count = rxtags.cap(o + 1).toLower().endsWith('k') ? rxtags.cap(3).left(rxtags.cap(3).length() - 1).toInt() * 1000 : rxtags.cap(3).toInt(); }
			}
			if (type.isEmpty())
			{ type = "unknown"; }
			m_tags.append(Tag(tag, type, count));
		}
	}

	// Getting last page
	if (m_site->contains("Regex/Count") && m_imagesCount < 1)
	{
		QRegExp rxlast(m_site->value("Regex/Count"));
		rxlast.indexIn(source, 0);
		m_imagesCount = rxlast.cap(1).remove(",").toInt();
	}
	if (m_imagesCount < 1)
	{
		for (Tag tag : m_tags)
		{
			if (tag.text() == m_search.join(" "))
			{
				m_imagesCount = tag.count();
				if (m_pagesCount < 0)
					m_pagesCount = (int)ceil((m_imagesCount * 1.) / m_imagesPerPage);
			}
		}
	}
	if (m_site->contains("Regex/LastPage") && (m_imagesCount < 1 || m_imagesCount % 1000 == 0))
	{
		QRegExp rxlast(m_site->value("Regex/LastPage"));
		rxlast.indexIn(source, 0);
		m_pagesCount = rxlast.cap(1).remove(",").toInt();
		if (m_pagesCount != 0)
			m_imagesCount = m_pagesCount * m_imagesPerPage;
	}

	// Wiki
	m_wiki.clear();
	if (m_site->contains("Regex/Wiki"))
	{
		QRegExp rxwiki(m_site->value("Regex/Wiki"));
		rxwiki.setMinimal(true);
		if (rxwiki.indexIn(source) != -1)
		{
			m_wiki = rxwiki.cap(1);
			m_wiki.remove("/wiki/show?title=").remove(QRegExp("<p><a href=\"([^\"]+)\">Full entry &raquo;</a></p>")).replace("<h6>", "<span class=\"title\">").replace("</h6>", "</span>");
		}
	}

	m_replyTags->deleteLater();
	m_replyTagsExists = false;

	emit finishedLoadingTags(this);
}
Exemple #19
0
void KTagsView::slotChangeFilter(int index)
{
  //update the filter type then reload the tags list
  m_tagFilterType = index;
  loadTags();
}