Beispiel #1
0
DocumentListSelectionPage::DocumentListSelectionPage(QWidget* parent)
    : QWizardPage(parent), waitWidget(0)
{
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    header = new QLabel;
    header->setWordWrap(true);
    mainLayout->addWidget(header);

    documents = new QContentSet(QContentSet::Asynchronous, this);
    model = new QContentSetModel(documents, this);
    connect(model, SIGNAL(updateFinished()), this, SLOT(updateFinished()));

    largeDocuments = new QContentSet(this);
    largeModel = new DocumentListModel(largeDocuments, this);
    connect(largeModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
            this, SLOT(dataChanged(QModelIndex,QModelIndex)));

    list = new QTableView();
    list->setModel(largeModel);
    list->setAlternatingRowColors(true);
    list->setShowGrid(false);
    list->horizontalHeader()->setStretchLastSection(true);
    list->setEditTriggers(QAbstractItemView::NoEditTriggers);
    list->horizontalHeader()->hide();
    list->verticalHeader()->hide();
    list->setSelectionBehavior(QAbstractItemView::SelectRows);
    list->setSelectionMode(QAbstractItemView::SingleSelection);
    mainLayout->addWidget(list);

    documentsCleanupDialog = new DocumentsCleanupDialog();
}
Beispiel #2
0
void MaraUpdaterApplication::executeUpdate()
{
	//MaraTrace trace(__FUNCSIG__, this, __FILE__, __LINE__);
	connect(_window, SIGNAL(finished()), this, SLOT(updateFinished()));
	_window->show();
	QTimer::singleShot(1000, _window, SLOT(executeUpdate()));
}
Beispiel #3
0
TagsModel::TagsModel(MpkgEngine *engine, QObject *parent):QAbstractTableModel(parent)
{
    mpkg=engine;
    categoryData data;

    data.name=tr("All packages");
    data.tagList=QStringList();
    data.stateList=QStringList();
    bonus.push_back(data);

    data.name=tr("Updates");
    data.stateList<<QString::number(ICONSTATE_UPDATE);
    bonus.push_back(data);
    data.stateList.clear();

    data.name=tr("Installed");
    data.stateList<<QString::number(ICONSTATE_INSTALLED)<<QString::number(ICONSTATE_INSTALLED_DEPRECATED);
    bonus.push_back(data);
    data.stateList.clear();

    data.name=tr("Not installed");
    data.stateList<<QString::number(ICONSTATE_AVAILABLE)<<QString::number(ICONSTATE_AVAILABLE_DEPRECATED);
    bonus.push_back(data);
    data.stateList.clear();

    connect(mpkg,SIGNAL(updateFinished()),this,SLOT(refresh()));
}
GameControllerAttachment::GameControllerAttachment(QObject* parent /*= 0*/) : AttachmentPlugIn(parent)
{
	m_widget = new GameControllerWidget();
	m_widget->setVisible(false);
	connect(m_widget, SIGNAL(modified(bool)), this, SLOT(emitModified(bool)));
	connect(this, SIGNAL(updateFinished()), m_widget, SLOT(emitUpdateFinished()));
	//CustomAttachmentTypes::registerTypes();
}
 /** \brief Constructor. The iterator will go over the range [\p begin, \p
  * end). */
 ConcreteRangeEntityIterator(const DuneEntityIt &begin,
                             const DuneEntityIt &end,
                             const DomainIndex &domain_index)
     : m_begin(begin), m_end(end), m_cur(begin), m_entity(domain_index),
       m_domain_index(domain_index) {
   updateFinished();
   updateEntity();
 }
void GetterAPOD::httpRequestFinished( int id, bool error ) {
  QHttpResponseHeader resp = http->lastResponse ();

  if ( error != 0 ) return ;

  if ( httpIdIndex == id ) { // got index.html
    //lastModified = resp.value( "last-modified" ); // s.o. :-(
    QString s( buffer->buffer().data() );
    int posi = s.indexOf( "<a href=\"image" );
    if ( posi > 0 ) {
      int endpos = s.indexOf( ">", posi );
      if ( endpos > 0 ) {
        QString link = s.mid( posi + 9, endpos - posi - 10 );
        if ( link == lastModified ) {
          qDebug() << "nothing new...";
          emit ( updateFinished( false ) );
          return ;
        } else {
          lastModified = link;
        }


        posi = s.indexOf( "</center>" , endpos );
        if ( posi > 0 ) {
          posi += 9;
          int endpos = s.indexOf( "<b> Tomorrow's picture: </b>", posi );
          if ( endpos > 0 ) {
            description = s.mid( posi, endpos - posi );
          }
        }
        buffer = new QBuffer( this );
        http->setHost( hostname );
        httpIdImage = http->get( "/apod/" + link, buffer );
      }
    }



  } else if ( httpIdImage == id ) { // got image!
    buffer->open( QBuffer::ReadWrite );
    image.loadFromData( buffer->data(), "jpg" );
    qDebug() << "buffer->qba->size=" << buffer->data().size() << " image: h=" << image.height() << " w=" << image.width();
    emit ( updateFinished( true ) );
  }
}
Beispiel #7
0
MpkgModel::MpkgModel(MpkgEngine *engine, QObject *parent) :
    QAbstractTableModel(parent)
{
    mpkg=engine;
    ccount=8;
    loadPixmapList();
    header<<tr("Name")<<tr("Version")<<tr("Short description");
    connect(engine,SIGNAL(updateFinished()),this,SLOT(refresh()));
}
Beispiel #8
0
TagsModel::TagsModel(MpkgEngine *engine, QObject *parent):QAbstractTableModel(parent)
{
    mpkg=engine;
    addBonus(tr("All packages"),QString());
    addBonus(tr("Updates"),QString::number(ICONSTATE_UPDATE));
    addBonus(tr("Installed"),QString::number(ICONSTATE_INSTALLED)+","+QString::number(ICONSTATE_INSTALLED_DEPRECATED));
    addBonus(tr("Not installed"),QString::number(ICONSTATE_AVAILABLE)+","+QString::number(ICONSTATE_AVAILABLE_DEPRECATED));

    connect(mpkg,SIGNAL(updateFinished()),this,SLOT(refresh()));
}
Beispiel #9
0
// APIRequestDelegate
void Acl::handleReplyNonBlocking(RequestOperation *request,
                      QNetworkReply *networkReply)
{
    // Schedule network reply for deletion
    networkReply->deleteLater();

    if(request == _delete) {
        bool success;
        if(deleteReply(networkReply)) {
            emit deleteFinished();
        } else {
            emit deleteFailed(errorString());
        }
    } else
    if(request == _get) {
        AclRule rule;
        if(getReply(networkReply, rule)) {
            emit getFinished(rule);
        } else {
            emit getFailed(errorString());
        }
    } else
    if(request == _insert) {
        AclRule rule;
        if(insertReply(networkReply, rule)) {
            emit insertFinished(rule);
        } else {
            emit insertFailed(errorString());
        }
    } else
    if(request == _list) {
        // TODO: Implement.
    } else
    if(request == _patch) {
        AclRule rule;
        if(patchReply(networkReply, rule)) {
            emit patchFinished(rule);
        } else {
            emit patchFailed(errorString());
        }
    } else
    if(request == _update) {
        AclRule rule;
        if(updateReply(networkReply, rule)) {
            emit updateFinished(rule);
        } else {
            emit updateFailed(errorString());
        }
    } else
    if(request == _watch) {
        // TODO: Implement.
    } else {
        qDebug() << "Warning: Received response for unknown request.";
    }
}
Beispiel #10
0
ThreadHandler::ThreadHandler(QObject *parent) :
    QObject(parent)
{
    aui = new ApplicationUpdateInterface(this);
    requestHandler = new RequestHandler(this);
    blackList = new BlackList(this);

    thumbnailRemoverThread = new QThread();
    thumbnailRemover = new ThumbnailRemover();
    thumbnailRemover->moveToThread(thumbnailRemoverThread);
    connect(thumbnailRemoverThread, SIGNAL(started()), thumbnailRemover, SLOT(removeOutdated()));
    thumbnailRemoverThread->start(QThread::LowPriority);

    connect(this, SIGNAL(removeFiles(QStringList)), thumbnailRemover, SLOT(removeFiles(QStringList)));

    settings = new QSettings("settings.ini", QSettings::IniFormat);
    loadSettings();

    connect(requestHandler, SIGNAL(response(QUrl,QByteArray,bool)), this, SLOT(processRequestResponse(QUrl,QByteArray,bool)));
    connect(requestHandler, SIGNAL(responseError(QUrl,int)), this, SLOT(handleRequestError(QUrl,int)));

//    connect(downloadManager, SIGNAL(error(QString)), ui->statusBar, SLOT(showMessage(QString)));
//    connect(downloadManager, SIGNAL(finishedRequestsChanged(int)), this, SLOT(updateDownloadProgress()));
//    connect(downloadManager, SIGNAL(totalRequestsChanged(int)), this, SLOT(updateDownloadProgress()));

    connect(aui, SIGNAL(connectionEstablished()), this, SLOT(updaterConnected()));
    connect(aui, SIGNAL(updateFinished()), this, SLOT(updateFinished()));
    connect(aui, SIGNAL(updaterVersionSent(QString)), this, SLOT(setUpdaterVersion(QString)));

    createComponentList();

#ifdef __DEBUG__
    createSupervisedDownload(QUrl(QString::fromUtf8("file:d:/Qt/fourchan-dl/webupdate.xml"));
#else
    createSupervisedDownload(QUrl(QString::fromUtf8("http://www.sourceforge.net/projects/fourchan-dl/files/webupdate/webupdate.xml/download")));
#endif

                             autosaveTimer = new QTimer(this);
                             autosaveTimer->setInterval(1000*60*10);     // 10 Minutes
                             autosaveTimer->setSingleShot(false);
                             connect(autosaveTimer, SIGNAL(timeout()), this, SLOT(saveSettings()));
}
Beispiel #11
0
MpdLibraryDb::MpdLibraryDb(QObject *p)
    : LibraryDb(p, "MPD")
    , loading(false)
    , coverQuery(nullptr)
    , albumIdOnlyCoverQuery(nullptr)
    , artistImageQuery(nullptr)
{
    connect(MPDConnection::self(), SIGNAL(updatingLibrary(time_t)), this, SLOT(updateStarted(time_t)));
    connect(MPDConnection::self(), SIGNAL(librarySongs(QList<Song>*)), this, SLOT(insertSongs(QList<Song>*)));
    connect(MPDConnection::self(), SIGNAL(updatedLibrary()), this, SLOT(updateFinished()));
    connect(MPDConnection::self(), SIGNAL(statsUpdated(MPDStatsValues)), this, SLOT(statsUpdated(MPDStatsValues)));
    connect(this, SIGNAL(loadLibrary()), MPDConnection::self(), SLOT(loadLibrary()));
    connect(MPDConnection::self(), SIGNAL(connectionChanged(MPDConnectionDetails)), this, SLOT(connectionChanged(MPDConnectionDetails)));
    DBUG;
}
Beispiel #12
0
void ShotgunField::onUpdate(const QVariant context)
{
    info() << "Update with context" << context;
    trace() << ".update(" << context << ")";

    clearDetails();

    // TODO: ugly...
    if (source())
        setCount(source()->count());
    else
        setCount(1);

    if (count() > 0) {
        OperationAttached::Status status = OperationAttached::Finished;

        for (int i = 0; i < count(); i++) {
            setIndex(i);

            QVariant value = buildValue(i, context.toMap());

            if (value.isValid()) {
                // TODO: Qt bug? null QVariant converts to a non-null QJSValue
                setDetail(i, "value", value.isNull() ? QJSValue(QJSValue::NullValue) : toScriptValue(value));
            } else {
                error() << "Unable to build value";
                status = OperationAttached::Error;
            }
        }

        emit updateFinished(status);
    } else {
        debug() << "source" << source() << "has count of" << source()->count();
        emit updateFinished(OperationAttached::Finished);
    }
}
int MoodBox::SetupDialogFrame::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = ServerFrame::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: updateFinished(); break;
        case 1: updateError(); break;
        default: ;
        }
        _id -= 2;
    }
    return _id;
}
void PluginThread::run()
{
    bool success = initPlugin();

    if (!success)
    {
        LOG_ERROR() << "Could not run plugin because plugin creation failed.";
        return;
    }

    //Start plugin
    updateRunning();
    mPlugin->run();
    updateFinished();
}
Beispiel #15
0
void
Dynamic::SearchQueryBias::newQuery()
{
    DEBUG_BLOCK;

    // ok, I need a new query maker
    m_qm.reset( CollectionManager::instance()->queryMaker() );
    Collections::addTextualFilter( m_qm.data(), m_filter );
    m_qm->setQueryType( Collections::QueryMaker::Custom );
    m_qm->addReturnValue( Meta::valUniqueId );

    connect( m_qm.data(), SIGNAL(newResultReady(QStringList)),
             this, SLOT(updateReady(QStringList)), Qt::QueuedConnection );
    connect( m_qm.data(), SIGNAL(queryDone()),
             this, SLOT(updateFinished()), Qt::QueuedConnection );
    m_qm.data()->run();
}
MessageTopicComboBox::MessageTopicComboBox(QWidget* parent) :
  MatchFilterComboBox(parent),
  registry_(new MessageTopicRegistry(this)),
  isUpdating_(false) {
  connect(registry_, SIGNAL(updateStarted()), this,
    SLOT(registryUpdateStarted()));
  connect(registry_, SIGNAL(updateFinished()), this,
    SLOT(registryUpdateFinished()));
  
  connect(this, SIGNAL(currentIndexChanged(const QString&)), this,
    SLOT(currentIndexChanged(const QString&)));
  
  if (registry_->isUpdating())
    registryUpdateStarted();
  else if (!registry_->isEmpty())
    registryUpdateFinished();
  else
    registry_->update();
}
Beispiel #17
0
void VersionControl::slotProcessExited()
{
  QString standardOutput = mProcess->readAllStandardOutput();
  dbg() << "SVN STDOUT: " << endl;
  if ( standardOutput.isEmpty() )
    dbg() << "<empty>" << endl;
  else
    dbg() << standardOutput;

  QString standardError = mProcess->readAllStandardError();
  dbg() << "SVN STDERR: " << endl;
  if ( standardError.isEmpty() )
    dbg() << "<empty>" << endl;
  else
    dbg() << standardError;

  if ( mCommand == Commit ) emit commitFinished();
  else if ( mCommand == Update ) emit updateFinished();

  QTimer::singleShot( 0, this, SLOT( destroyProcess() ) );
}
Beispiel #18
0
void TerminalEmulator::update()
{
    QByteArray text;

    unsigned char startColumn = 0;
    unsigned char startRow = 0;

    int bufferWidth = displayBuffer->size().width();
    int bufferHeight = displayBuffer->size().height();

    terminalDisplay->clear();

    for (int row = 0; row < bufferHeight; ++row) {
        for (int column = 0; column < bufferWidth; ++column) {
            unsigned char character = displayBuffer->characterAt(column+1, row+1);
            if (character >= 0x20 && character <= 0x3f) {
                if (text.length() > 0) {
                    terminalDisplay->displayText(startColumn, startRow, codec->toUnicode(text));
                    text.clear();
                }
                terminalDisplay->displayAttribute(character);
            } else {
                if (text.isEmpty()) {
                    startColumn = column+1;
                    startRow = row+1;
                }
                text += (character == '\0' ? '\x40': character);
            }
        }

        if (text.length() > 0) {
            terminalDisplay->displayText(startColumn, startRow, codec->toUnicode(text));
            text.clear();
        }
    }

    terminalDisplay->displayCursor(cursor.column(), cursor.row());

    emit updateFinished();
}
void MessageTopicComboBox::registryUpdateFinished() {
  QMap<QString, QString> topics = registry_->getTopics();
  
  blockSignals(true);
  
  for (QMap<QString, QString>::const_iterator it = topics.begin();
      it != topics.end(); ++it)
    addItem(it.key(), it.value());
  
  int index = findText(currentTopic_);
  
  if (index < 0)
    setEditText(currentTopic_);
  else
    setCurrentIndex(index);
  
  blockSignals(false);
  
  isUpdating_ = false;
  emit updateFinished();
  
  setEnabled(true);
}
Beispiel #20
0
void
Dynamic::QuizPlayBias::newQuery()
{
    // ok, I need a new query maker
    m_qm.reset( CollectionManager::instance()->queryMaker() );

    uint field = 0;
    switch( m_follow )
    {
    case Dynamic::QuizPlayBias::TitleToTitle:   field = Meta::valTitle; break;
    case Dynamic::QuizPlayBias::ArtistToArtist: field = Meta::valArtist; break;
    case Dynamic::QuizPlayBias::AlbumToAlbum:   field = Meta::valAlbum; break;
    }
    m_qm->addFilter( field,  QString(m_currentCharacter), true, false );

    m_qm->setQueryType( Collections::QueryMaker::Custom );
    m_qm->addReturnValue( Meta::valUniqueId );

    connect( m_qm.data(), SIGNAL(newResultReady( QStringList )),
             this, SLOT(updateReady( QStringList )) );
    connect( m_qm.data(), SIGNAL(queryDone()),
             this, SLOT(updateFinished()) );
    m_qm.data()->run();
}
Beispiel #21
0
void SearchFetcher::handleHttpResponse(QString resp,QUrl ,bool isSend,int) {
	QRegExp deLt("&lt;");
	QRegExp deGt("&gt;");
	QRegExp deQuot("&quot;");
	int otherPos;
	bool newUser;
	QList<Tweet*> tweets;
	QList<QString> tweetIds;

	emit endFetching();
	inProgressCount--;
	//QMessageBox::information (0,"assdf",resp);
	JSONComplexObject *bob = JSONParser::parse(resp);
	if (!bob) {
		emit otherError(this);
		return;
	}
//	QMessageBox::information (0,"assdf",bob->toString());
	JSONArray *results = (JSONArray*)bob->values.value("results");
	if (results) {
		for(int x=0;x<results->items.length();x++) {
			Tweet *t=new Tweet();
			TweetUser *u=new TweetUser();
			u->is_friend=false;
			newUser=true;
			JSONComplexObject *result = (JSONComplexObject*)results->items.at(x);
			JSONObject *thing;

			thing=result->values.value("text");
			if (thing && thing->type==JSONObject::JSONString) {
				t->message=((JSONString*)thing)->get();
			}
			thing=result->values.value("from_user");
			if (thing && thing->type==JSONObject::JSONString) {
				u->screen_name=t->screen_name=((JSONString*)thing)->get();
			}
			thing=result->values.value("id");
			if (thing && thing->type==JSONObject::JSONString) {
				t->id=((JSONString*)thing)->get();
			}
			thing=result->values.value("from_user_id");
			if (thing && thing->type==JSONObject::JSONString) {
				QString text=((JSONString*)thing)->get();
				t->user_id=u->id=u->search_id=text;
				if (box->getUserByScreenName(u->screen_name)) {
					QString name=u->screen_name;
					delete u;
					u=box->getUserByScreenName(name);
					u->search_id=text;
					t->user_id=u->id;
					newUser=false;
				}
			}
			thing=result->values.value("source");
			if (thing && thing->type==JSONObject::JSONString) {
				QString text=((JSONString*)thing)->get();
				while ((otherPos=deLt.indexIn(text,0))>=0)
					text=text.left(otherPos)+"<"+text.mid(otherPos+4,-1);
				while ((otherPos=deGt.indexIn(text,0))>=0)
					text=text.left(otherPos)+">"+text.mid(otherPos+4,-1);
				while ((otherPos=deQuot.indexIn(text,0))>=0)
					text=text.left(otherPos)+"\""+text.mid(otherPos+6,-1);
				t->source=text;
			}
			thing=result->values.value("profile_image_url");
			if (thing && thing->type==JSONObject::JSONString) {
				u->image_url=((JSONString*)thing)->get();
			}
			thing=result->values.value("created_at");
			if (thing && thing->type==JSONObject::JSONString) {
				t->created_at=parseSearchDate(((JSONString*)thing)->get());
			}
			if (newUser)
				emit haveUser(u);
			tweets.append(t);
			tweetIds.append(t->id);
		}
	}

	JSONObject *since_id = bob->values.value("max_id");
	if (since_id && since_id->type==JSONObject::JSONString) {
		sinceId=((JSONString*)since_id)->get();
	}

	delete bob;

	emit haveTweets(tweets);
	emit haveResults(tweetIds);
	if (!isSend) {
		emit updateFinished(0,this);
		firstFetch=false;
	}
}
void GameControllerAttachment::update()
{
	GameEngine::update();
	emit updateFinished();
}
Beispiel #23
0
void UserGroupFetcher::handleXml(QDomDocument *doc,int type,int req) {
	QDomNode node = doc->firstChild().nextSibling();
	if (node.nodeName()=="lists_list") {
		QDomNodeList children = node.childNodes();
		for(unsigned int x=0;x<children.length();x++) {
			QDomNode child = children.at(x);
			if (child.nodeName()=="lists") {
				QDomNodeList lists = child.childNodes();
				for(unsigned int y=0;y<lists.length();y++) {
					handleListXml(lists.at(y));
				}
			} else if (child.nodeName()=="next_cursor") {
				QString next_cursor = child.firstChild().nodeValue();
				if (next_cursor=="0") {
					minTimeoutSecs=3600;
					cursor="";
				} else {
					minTimeoutSecs=10;
					cursor=next_cursor;
				}
			}
		}
	} else if (node.nodeName()=="list") {
		handleListXml(node);
	}else if (node.nodeName()=="users_list") {
		QDomNodeList children = node.childNodes();
		for(unsigned int x=0;x<children.length();x++) {
			QDomNode child = children.at(x);
			if (child.nodeName()=="users") {
				QDomNodeList users = child.childNodes();
				for(unsigned int y=0;y<users.length();y++) {
					QDomNode node = users.at(y); // GCC needs this var to handle the & on the func below, MSVC doesn't.
					TweetUser *u = handleUserXml(node,false,(Tweet*)0);
					if (u && u->screen_name!="") {
						members.append(u->screen_name);
						//QMessageBox::information (0,"",group()->slug+" - "+((u->is_friend)?"yes":"no"));
					}
				}
			} else if (child.nodeName()=="next_cursor") {
				QString next_cursor = child.firstChild().nodeValue();
				if (next_cursor=="0") {
					myGroup->setGroupMembers(members);
					members.clear();
					cursor="";
					emit haveGroup(myGroup);
					//QMessageBox::information (0,QString::number((long)this),myGroup->id+"-"+QString::number((long)myGroup));
					deleted=true;
					emit fetcherExpired(this);// my work here is done. ;)
				} else
					cursor=next_cursor;
			}
		}
	} else {
		//QMessageBox::information(0,"",node.nodeName());
		emit otherError(this);
		isError.insert(req,true);
	}
	emit endFetching();
	if (inProgressCount)
		inProgressCount--;
	if (type==0)//1==send
		emit updateFinished(0,this);
}
Beispiel #24
0
    // - construct the query
    m_qm->beginOr();
    foreach( const QString &artist, artists )
    {
        // debug() << "adding artist to query:" << artist;
        m_qm->addFilter( Meta::valArtist, artist, true, true );
    }
    m_qm->endAndOr();

    m_qm->setQueryType( Collections::QueryMaker::Custom );
    m_qm->addReturnValue( Meta::valUniqueId );

    connect( m_qm.data(), SIGNAL(newResultReady( QStringList )),
             this, SLOT(updateReady( QStringList )) );
    connect( m_qm.data(), SIGNAL(queryDone()),
             this, SLOT(updateFinished()) );

    // - run the query
    m_qm.data()->run();
}

void
Dynamic::WeeklyTopBias::newWeeklyTimesQuery()
{
    DEBUG_BLOCK

    QMap< QString, QString > params;
    params[ "method" ] = "user.getWeeklyChartList" ;
    params[ "user" ] = lastfm::ws::Username;

    m_weeklyTimesJob = lastfm::ws::get( params );
void PluginThread::pluginFinished()
{
    if (getExecutionState() != TES_FINISHED)
        updateFinished();
}
Beispiel #26
0
void SnpBuffer::update(int posStart, int posEnd, int bins, int trackMin, int trackMax, bool synteny, bool light, int gaps)
{
	if ( ! alignment )
	{
		return;
	}
	
	if ( updating )
	{
		//if ( posStart != snpDataNew->getPosStart() || posEnd != snpDataNew->getPosEnd() )
		{
			//printf("queuing:\t%d\t[%d -\t%d]\t%s\n", bins, posStart, posEnd, synteny ? "syn" : "snp");
			posStartQueue = posStart;
			posEndQueue = posEnd;
			binsQueue = bins;
			trackMinQueue = trackMin;
			trackMaxQueue = trackMax;
			syntenyQueue = synteny;
			lightQueue = light;
			gapsQueue = gaps;
			updateNeeded = true;
		}
		
		return;
	}
	
	//printf("updating:\t%d\t[%d -\t%d]\t%s\n", bins, posStart, posEnd, synteny ? "syn" : "snp");
	
	if ( posEnd < 0 )
	{
		return;
	}
	
	if ( snpDataNew == 0 || snpDataNew->getBins() != bins )
	{
		// reallocate
		
		if ( snpDataNew != 0 )
		{
			delete snpDataNew;
		}
		
		snpDataNew = new SnpData(bins, trackCount);
	}
	
	snpDataNew->setWindow(posStart, posEnd);
	snpDataNew->setTracks(trackMin, trackMax);
	snpDataNew->setSynteny(synteny);
	snpDataNew->setLightColors(light);
	snpDataNew->setShowGaps(gaps);
	snpDataNew->setFilters
	(
		alignment->getFilters(),
		alignment->getFiltersScale(),
		alignment->getFilterPass(),
		alignment->getFilterPassScale()
	);
	
	int radius = (posEnd - posStart + 1) / bins / 6 - 1;
	
	if ( radius > 3 )
	{
		radius = 3;
	}
	
	if ( radius < 0 )
	{
		radius = 0;
	}
	
	bool async = true;
	
	SnpWorker* worker = new SnpWorker
	(
	 alignment,
	 snpDataNew,
	 idByTrack,
	 mutex,
	 radius,
	 light ? snpPaletteLight : snpPaletteDark,
	 &syntenyPalette
	 );
	
	if ( async )
	{
		thread = new QThread;
		
		worker->moveToThread(thread);
		connect(worker, SIGNAL(error(QString)), this, SLOT(threadError(QString)));
		connect(thread, SIGNAL(started()), worker, SLOT(process()));
		connect(worker, SIGNAL(finished()), thread, SLOT(quit()));
		connect(worker, SIGNAL(finished()), worker, SLOT(deleteLater()));
		connect(worker, SIGNAL(finished()), this, SLOT(updateFinished()));
		connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
		thread->start();
/*
		worker->moveToThread(thread);
		
		//connect(worker, SIGNAL(error(QString)), this, SLOT(threadError(QString)));
		connect(thread, SIGNAL(started()), worker, SLOT(process()));
		connect(worker, SIGNAL(finished()), thread, SLOT(quit()));
		connect(worker, SIGNAL(finished()), this, SLOT(updateFinished()));
		connect(worker, SIGNAL(finished()), worker, SLOT(deleteLater()));
		connect(worker, SIGNAL(finished()), thread, SLOT(deleteLater()));
		
		thread->start();
*/		
		updating = true;
		updateNeeded = false;
	}
	else
	{
		worker->process();
		updating = true;
		updateNeeded = false;
		updateFinished();
		delete worker;
	}
}
bool TrWindow::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0:
        doneAndNext();
        break;
    case 1:
        prev();
        break;
    case 2:
        next();
        break;
    case 3:
        recentFileActivated((int)static_QUType_int.get(_o+1));
        break;
    case 4:
        setupRecentFilesMenu();
        break;
    case 5:
        open();
        break;
    case 6:
        save();
        break;
    case 7:
        saveAs();
        break;
    case 8:
        release();
        break;
    case 9:
        print();
        break;
    case 10:
        find();
        break;
    case 11:
        findAgain();
        break;
    case 12:
        replace();
        break;
    case 13:
        newPhraseBook();
        break;
    case 14:
        openPhraseBook();
        break;
    case 15:
        closePhraseBook((int)static_QUType_int.get(_o+1));
        break;
    case 16:
        editPhraseBook((int)static_QUType_int.get(_o+1));
        break;
    case 17:
        printPhraseBook((int)static_QUType_int.get(_o+1));
        break;
    case 18:
        manual();
        break;
    case 19:
        revertSorting();
        break;
    case 20:
        about();
        break;
    case 21:
        aboutQt();
        break;
    case 22:
        setupPhrase();
        break;
    case 23:
        static_QUType_bool.set(_o,maybeSave());
        break;
    case 24:
        updateCaption();
        break;
    case 25:
        showNewScope((QListViewItem*)static_QUType_ptr.get(_o+1));
        break;
    case 26:
        showNewCurrent((QListViewItem*)static_QUType_ptr.get(_o+1));
        break;
    case 27:
        updateTranslation((const QString&)static_QUType_QString.get(_o+1));
        break;
    case 28:
        updateFinished((bool)static_QUType_bool.get(_o+1));
        break;
    case 29:
        toggleFinished((QListViewItem*)static_QUType_ptr.get(_o+1),(const QPoint&)*((const QPoint*)static_QUType_ptr.get(_o+2)),(int)static_QUType_int.get(_o+3));
        break;
    case 30:
        prevUnfinished();
        break;
    case 31:
        nextUnfinished();
        break;
    case 32:
        findNext((const QString&)static_QUType_QString.get(_o+1),(int)static_QUType_int.get(_o+2),(bool)static_QUType_bool.get(_o+3));
        break;
    case 33:
        revalidate();
        break;
    case 34:
        toggleGuessing();
        break;
    case 35:
        focusSourceList();
        break;
    case 36:
        focusPhraseList();
        break;
    case 37:
        updateClosePhraseBook();
        break;
    case 38:
        toggleStatistics();
        break;
    case 39:
        updateStatistics();
        break;
    default:
        return QMainWindow::qt_invoke( _id, _o );
    }
    return TRUE;
}
Beispiel #28
0
void
Dynamic::TagMatchBias::newQuery()
{
    DEBUG_BLOCK;

    // ok, I need a new query maker
    m_qm.reset( CollectionManager::instance()->queryMaker() );

    // -- set the querymaker
    if( m_filter.isDate() )
    {
        switch( m_filter.condition )
        {
        case MetaQueryWidget::LessThan:
        case MetaQueryWidget::Equals:
        case MetaQueryWidget::GreaterThan:
            m_qm->addNumberFilter( m_filter.field(), m_filter.numValue,
                                (Collections::QueryMaker::NumberComparison)m_filter.condition );
            break;
        case MetaQueryWidget::Between:
            m_qm->beginAnd();
            m_qm->addNumberFilter( m_filter.field(), qMin(m_filter.numValue, m_filter.numValue2)-1,
                                Collections::QueryMaker::GreaterThan );
            m_qm->addNumberFilter( m_filter.field(), qMax(m_filter.numValue, m_filter.numValue2)+1,
                                Collections::QueryMaker::LessThan );
            m_qm->endAndOr();
            break;
        case MetaQueryWidget::OlderThan:
            m_qm->addNumberFilter( m_filter.field(), QDateTime::currentDateTime().toTime_t() - m_filter.numValue,
                                Collections::QueryMaker::LessThan );
            break;
        default:
            ;
        }
    }
    else if( m_filter.isNumeric() )
    {
        switch( m_filter.condition )
        {
        case MetaQueryWidget::LessThan:
        case MetaQueryWidget::Equals:
        case MetaQueryWidget::GreaterThan:
            m_qm->addNumberFilter( m_filter.field(), m_filter.numValue,
                                (Collections::QueryMaker::NumberComparison)m_filter.condition );
            break;
        case MetaQueryWidget::Between:
            m_qm->beginAnd();
            m_qm->addNumberFilter( m_filter.field(), qMin(m_filter.numValue, m_filter.numValue2)-1,
                                Collections::QueryMaker::GreaterThan );
            m_qm->addNumberFilter( m_filter.field(), qMax(m_filter.numValue, m_filter.numValue2)+1,
                                Collections::QueryMaker::LessThan );
            m_qm->endAndOr();
            break;
        default:
            ;
        }
    }
    else
    {
        switch( m_filter.condition )
        {
        case MetaQueryWidget::Equals:
            m_qm->addFilter( m_filter.field(), m_filter.value, true, true );
            break;
        case MetaQueryWidget::Contains:
            if( m_filter.field() == 0 )
            {
                // simple search
                // TODO: split different words and make separate searches
                m_qm->beginOr();
                m_qm->addFilter( Meta::valArtist,  m_filter.value );
                m_qm->addFilter( Meta::valTitle,   m_filter.value );
                m_qm->addFilter( Meta::valAlbum,   m_filter.value );
                m_qm->addFilter( Meta::valGenre,   m_filter.value );
                m_qm->addFilter( Meta::valUrl,     m_filter.value );
                m_qm->addFilter( Meta::valComment, m_filter.value );
                m_qm->addFilter( Meta::valLabel,   m_filter.value );
                m_qm->endAndOr();
            }
            else
            {
                m_qm->addFilter( m_filter.field(), m_filter.value );
            }
            break;
        default:
            ;
        }
    }

    m_qm->setQueryType( Collections::QueryMaker::Custom );
    m_qm->addReturnValue( Meta::valUniqueId );

    connect( m_qm.data(), SIGNAL(newResultReady(QStringList)),
             this, SLOT(updateReady(QStringList)), Qt::QueuedConnection );
    connect( m_qm.data(), SIGNAL(queryDone()),
             this, SLOT(updateFinished()), Qt::QueuedConnection );
    m_qm.data()->run();
}
 virtual void next() {
   ++m_cur;
   updateFinished();
   updateEntity();
 }
Beispiel #30
0
CameraMainWindow::CameraMainWindow(QWidget *parent, Qt::WFlags f):
    QMainWindow(parent, f),
    settings( NULL ),
    settingsDialog( NULL ),
    psize( -1 ),
    vsize( -1 ),
    snapRequest( 0 ),
    videoOnSecondary(false),
    m_photoContentSet( QContentSet::Asynchronous ),
    m_photoModel( 0 ),
    m_contextMenuActive(false)
{
    setWindowTitle(tr("Camera"));

    QtopiaApplication::setPowerConstraint(QtopiaApplication::DisableLightOff);

    picfile = Qtopia::tempDir() + "image.jpg";
    QWidget *cameraWidget = new QWidget(this);
    camera = new Ui::CameraBase();
    camera->setupUi(cameraWidget);
    setCentralWidget(cameraWidget);

    camcat = QLatin1String("Camera");
    // Ensure the Camera system categoy exists
    QCategoryManager catman("Documents");
    // For new code a more unique id should be used instead of using the untranslated text
    // eg. ensureSystemCategory("com.mycompany.myapp.mycategory", "My Category");
    catman.ensureSystemCategory(camcat, camcat);

    new CameraService(this);

    camera->photo->setFocus();

    connect(camera->photo, SIGNAL(clicked()), this, SLOT(takePhoto()));
    connect(camera->video, SIGNAL(clicked()), this, SLOT(toggleVideo()));

    refocusTimer = new QTimer(this);
    refocusTimer->setSingleShot(true);
    connect(refocusTimer, SIGNAL(timeout()), this, SLOT(takePhotoNow()));

    thumb[0] = camera->thumb1;
    thumb[1] = camera->thumb2;
    thumb[2] = camera->thumb3;
    thumb[3] = camera->thumb4;
    thumb[4] = camera->thumb5;
    cur_thumb = -1;

    // Load the allowable sizes from the camera hardware.
    photo_size = camera->videocaptureview->photoSizes();
    video_size = camera->videocaptureview->videoSizes();

    namehint=0;
    recording = false;


    if ( !video_supported ) {
        // Room for longer text
        camera->photo->setText(tr("Take Photo"));
        camera->video->setEnabled(false);
        camera->video->hide();
    }

    if (QApplication::desktop()->numScreens() > 1) {
        // We have a secondary display - watch for the clamshell open/close
        clamshellVsi = new QValueSpaceItem("/Hardware/Devices/ClamshellOpen", this);
        connect(clamshellVsi, SIGNAL(contentsChanged()), this, SLOT(clamshellChanged()));
        if (!clamshellVsi->value().toBool()) {
            videoToScreen(1);
        }
    }

    m_photoContentSet.setCriteria( QContentFilter( QContent::Document )
            & QContentFilter::category( QLatin1String( "Camera" ) )
            & QContentFilter::mimeType( QLatin1String( "image/jpeg" ) ) );

    m_photoContentSet.setSortCriteria( QContentSortCriteria( QContentSortCriteria::LastUpdated, Qt::DescendingOrder ) );

    m_photoModel = new QContentSetModel( &m_photoContentSet, this );
    connect( m_photoModel, SIGNAL(updateFinished()), this, SLOT(loadThumbs()) );

    m_wait = new QWaitWidget(camera->videocaptureview);
    m_iswaiting = false;
    QTimer::singleShot(1, this, SLOT(delayedInit()));
    m_currzoom = 0;
    zoomActive = false;

    zoomTimer.setSingleShot(true);
    zoomTimer.setInterval(5000);
    connect(&zoomTimer, SIGNAL(timeout()), this, SLOT(hideZoom()));
}