Пример #1
0
TestBrowserCookieJar::~TestBrowserCookieJar()
{
    if (m_storageEnabled) {
        extractRawCookies();
        saveToDisk();
    }
}
//static
void LLFloaterBlacklist::updateBlacklists()
{
	if(gAssetStorage)
	{
		blacklist_textures.clear();
		blacklist_objects.clear();
		gAssetStorage->mBlackListedAsset.clear();
		for(std::map<LLUUID,LLSD>::iterator iter = blacklist_entries.begin(); iter != blacklist_entries.end(); ++iter)
		{
			if(blacklist_entries[iter->first]["entry_type"].asString() == "0")
			{
				blacklist_textures.push_back(LLUUID(iter->first));
			}
			else
			{
				gAssetStorage->mBlackListedAsset.push_back(LLUUID(iter->first));
			}
			
			if(blacklist_entries[iter->first]["entry_type"].asString() == "6")
			{
				blacklist_objects.push_back(LLUUID(iter->first));
			}
			
		}
		saveToDisk();
		LLFloaterBlacklist* instance = LLFloaterBlacklist::getInstance();
		if(instance)
			instance->refresh();
	}
}
Пример #3
0
void FvDownloadManager::downloadFinished(QNetworkReply *reply)
{
	const QUrl& url = reply->url();
	QString filename;

	if(m_pCurrentDownload != reply)
		emit error(url, "WTF !?!");

	if (m_pCurrentDownload->error()) 
	{
		if(m_pCurrentDownload->error() == QNetworkReply::OperationCanceledError)
			return;

		emit error(url, m_pCurrentDownload->errorString());
	} 
	else 
	{
		filename = saveFileName(url);
		if(saveToDisk(filename))
		{
			emit finished(url, filename);
		}
	}

	m_pCurrentDownload->deleteLater();
	m_pCurrentDownload = nullptr;
}
Пример #4
0
//--------------------------------------------------------------
void testApp::saveToDevice()
{
    weConnected = tcpClient.setup(ib->IP, 4321);
    tcpClient.setMessageDelimiter("\n");
    tcpClient.setVerbose(true);
    
    if(!tcpClient.isConnected())
    {
        weConnected=false;
        ofSystemAlertDialog("Uh-oh! Could not connect to the Rabbit!!! Try giving it some carrots.");
        return;
    }
    
    while(tcpClient.isConnected())
    {

        if(tcpClient.send(createCsvString()))
        {
            ofSystemAlertDialog("Yes! Upload successful!!!");
        }else
        {
            ofSystemAlertDialog("Whoops. Upload failed...");
        }
        
        tcpClient.close();
    }
    
    
    tcpClient.close();
    saveToDisk("OnRabbit.csv");

}
Пример #5
0
void DownloadManager::downloadFinished(QNetworkReply *reply)
{
    // remove download list
    currentDownloads.removeAll(reply);

    QUrl url = reply->url();
    //QString filename = saveFileName(url);
    const DoubanFMSong song = songsMap.value(reply);
    QString filename = QCoreApplication::applicationDirPath().append("/../../../").append(song.title).append(".mp3");
    bool flag = false;

    if (reply->error()) {
        fprintf(stderr, "Download of %s failed: %s\n",
                url.toEncoded().constData(),
                qPrintable(reply->errorString()));
    } else {
        if (! QFile::exists(filename))
        if (flag = saveToDisk(filename, reply)) {
            printf("Download of %s succeded (saved to %s)\n",
                   url.toEncoded().constData(), qPrintable(filename));
        }
    }

    currentDownloads.removeAll(reply);
    reply->deleteLater();

    if (currentDownloads.isEmpty()) {
        // all downloads finished
        //QCoreApplication::instance()->quit();
    }

    // todo emit signal
    emit saveMp3ToDisk(filename, song, flag);
}
Пример #6
0
void MainWindow::downloadFinished(QNetworkReply *reply)
{
    //std::cout << "download finished" << std::endl;
    QUrl url = reply->url();
    if (reply->error()) {
        fprintf(stderr, "Download of %s failed: %s\n",
                url.toEncoded().constData(),
                qPrintable(reply->errorString()));
    } else {
        QString urlString = url.toEncoded().constData();
        urlString.remove(0, 52);
        QString filename = urlString + ".jpg";
        if (saveToDisk(filename, reply))
            printf("Download of %s succeeded\n", qPrintable(filename));
    }

    currentDownloads.removeAll(reply);
    reply->deleteLater();

   if (currentDownloads.isEmpty())
       return;
            //buildChannelList();

        // all downloads finished
       // QCoreApplication::instance()->quit();
}
Пример #7
0
SalorCookieJar::~SalorCookieJar()
{
    qDebug() << "~SalorCookieJar(): destructing";
    if (!m_readonlyMode) {
        extractRawCookies();
        saveToDisk();
    }
}
Пример #8
0
void Viewer::key_parse(char key){
    if (key == 27 || key == 'q' || key == 'Q'){
        exitFlag = true;
    }
    // save the pcl in to memory
    else if (key==' ')    {
        saveMemory = !saveMemory;
        if (saveMemory){
            std::cout <<   "START saving in MEMORY"     << std::endl;
            rgb_images.clear();
            rgbd_images.clear();
            point_clouds.clear();
            raw_depth.clear();
            depth_show.clear();
            //initialize the recorder
            if (!no_oni){
                if(recorder.isValid()){
                    recorder.stop();
                    recorder.destroy();
                }
                recorder.create("recording.oni");
                recorder.attach(depth);
                if(!only_depth){
                    recorder.attach(color);
                }
                recorder.start();
            }

        }
        else {
            if(!no_oni){
                recorder.stop();
                recorder.destroy();
            }
            std::cout << "STOPP saving in MEMORY - " << FRAME_COUNTER << " frames" << std::endl;
        }
        FRAME_COUNTER = 0;
    }
    // save the pcl into the disk
    else if (key=='s'||key=='S')    {
            create_dir();
            saveMemory = false;
            std::cout << "START saving in DISK" << std::endl;
            saveToDisk();
            std::cout << "STOPP saving in DISK" << std::endl;
            rgb_images.clear();
            rgbd_images.clear();
            point_clouds.clear();
            raw_depth.clear();
            depth_show.clear();
            if(recorder.isValid()){
                recorder.stop();
                recorder.destroy();
            }
    }
}
Пример #9
0
bool SalorCookieJar::setCookiesFromUrl(const QList<QNetworkCookie>& cookieList, const QUrl& url)
{
    qDebug() << "SalorCookieJar::setCookiesFromUrl()";
    bool status = QNetworkCookieJar::setCookiesFromUrl(cookieList, url);
    if (status && !m_readonlyMode) {
        extractRawCookies();
        saveToDisk();
    }
    return status;
}
void DownloadManager::downloadFinished(QNetworkReply *reply) //Notifies user if download finished successfully or not
{
    QUrl url = reply->url();
    if (reply->error())
        QMessageBox::warning(NULL, "Download Failed", "Download failed: " + reply->errorString(), QMessageBox::Ok);
    else {
        QString fileName = saveFileName(url);
        if (saveToDisk(fileName, reply))
            QMessageBox::information(NULL, "Download Success", "Download succeeded for: " + fileName, QMessageBox::Ok);
    }
    currentDownloads.removeAll(reply);
    reply->deleteLater();
}
Пример #11
0
 void FeatureIndexer :: loadOrBuild()
 {
   if (!loadFromDisk())
   {
     ntk_dbg(1) << "Could not load simple sift database indexed, rebuilding.";
     rebuild();
     saveToDisk();
   }
   else
   {
     ntk_dbg(1) << "FeatureIndexer reloaded from: "
         << m_db.directory() + "/" + getIndexerFilename();
   }
 }
Пример #12
0
void LGGAutoCorrect::loadFromDisk()
{
	std::string filename=getFileName();
	if (filename.empty())
	{
		llinfos << "no valid user directory." << llendl; 
	}
	if(!gDirUtilp->fileExists(filename))
	{
		std::string defaultName = getDefaultFileName();
		llinfos << " user settings file doesnt exist, going to try and read default one from "<<defaultName.c_str()<< llendl;

		if(gDirUtilp->fileExists(defaultName))
		{
			LLSD blankllsd;
			llifstream file;
			file.open(defaultName.c_str());
			if (file.is_open())
			{
				LLSDSerialize::fromXMLDocument(blankllsd, file);
			}
			file.close();
			saveToDisk(blankllsd);
		}else
		saveToDisk(getExampleLLSD());
	}
	else
	{
		llifstream file;
		file.open(filename.c_str());
		if (file.is_open())
		{
			LLSDSerialize::fromXML(mAutoCorrects, file);
		}
		file.close();
	}	
}
Пример #13
0
void CamTab::downloadFinished(QNetworkReply *reply)
{
    // Create filename based on date and time. (eg yyyyMMddhhmmss.jpg)
    QDateTime now = QDateTime::currentDateTime();
    QString filename = QString("%1/%2.%3")
            .arg(settings->getDir()).arg(now.toString("yyyyMMddhhmmss")).arg(settings->getExt());

    if (reply->error()) {
        fprintf(stderr, "Download of %s failed: %s\n", settings->getUrl().toEncoded().constData(), qPrintable(reply->errorString()));
    } else {
        if (saveToDisk(filename, reply))
            printf("Download of %s succeeded (saved to %s)\n", settings->getUrl().toEncoded().constData(), qPrintable(filename));
    }

    reply->deleteLater();
}
Пример #14
0
void SerialLogging::readData()
{
	// Get timestamp immediately
	quint64 timeStamp = startTime.msecsTo(QDateTime::currentDateTimeUtc());

	// Read data from serial port
	QByteArray data = serialPort->readAll();

	// Save the data to file
	saveToDisk(data);

	// Send the data to any connected listeners
	emit newDataReady(data, timeStamp);

	// Send out the elapsed time to any connected listeners
	emit newTimeStamp(timeStamp);
}
void LLFloaterBlacklist::onClickRerender(void* user_data)
{
	std::map<LLUUID,LLSD> blacklist_new;
	for(std::map<LLUUID,LLSD>::iterator itr = blacklist_entries.begin(); itr != blacklist_entries.end(); ++itr)
	{
		if(blacklist_entries[itr->first]["entry_type"].asString() == "6") continue;
		blacklist_new[itr->first] = blacklist_entries[itr->first];
		blacklist_new[itr->second] = blacklist_entries[itr->second];
	}
	blacklist_entries = blacklist_new;
	saveToDisk();
	LLFloaterBlacklist* instance = LLFloaterBlacklist::getInstance();
	if(instance)
	{
		instance->refresh();
	}

}
Пример #16
0
void ImageDownload::downloadFinished(QNetworkReply *reply)
{
    QUrl url = reply->url();
    if (reply->error()) {
        fprintf(stderr, "Download of %s failed: %s\n",
                url.toEncoded().constData(),
                qPrintable(reply->errorString()));
    } else {
        QString filename = saveFileName(url);
        if (saveToDisk(filename, reply))
            printf("Download of %s succeeded (saved to %s)\n",
                   url.toEncoded().constData(), qPrintable(filename));
    }

    currentDownloads.removeAll(reply);
    reply->deleteLater();

    if (currentDownloads.isEmpty())
        // all downloads finished
        QCoreApplication::instance()->quit();
}
Пример #17
0
//--------------------------------------------------------------
void testApp::loadFromDevice()
{
    //close any previous connections
    tcpClient.close();
    
    //make new connection
    weConnected = tcpClient.setup(ib->IP, 4322);
    tcpClient.setMessageDelimiter("\n");
    tcpClient.setVerbose(true);
    
    //clear the previous messages
    receivedMessage.clear();
    
    if(!tcpClient.isConnected())
    {
        weConnected=false;
        ofSystemAlertDialog("Uh-oh! Could not connect to the Rabbit!!! Make sure it's connected and has enough carrots.");
        return;
    }
    

    while(tcpClient.isConnected())
    {
        string s = tcpClient.receive();
        
        if( s.length() > 0 ){
            receivedMessage.push_back(s);
        }
    }

    readCsvString(receivedMessage);        
        
    tcpClient.close();
    
    saveToDisk("OnRabbit.csv");
    ofSystemAlertDialog("Data retrieved from the Rabbit!");

    
}
Пример #18
0
void CachedImage::downloadFinished(QNetworkReply *reply)
{
    QStringList filename;
    if (reply->error()) {
        qDebug() << "Something went worng on download";
        m_localUrl = "";
        emit localsrcChanged();
    } else {
        //Create a filename off the url
        filename = saveFileName();
        if (filename[0] == "true") {
            //Saves the file to disk
            if (saveToDisk(filename[1], reply)) {
                m_localUrl = "file:///" + filename[1];
                emit localsrcChanged();
            }
        } else {
            m_localUrl = "file:///" + filename[1];
            emit localsrcChanged();
        }
    }
}
Пример #19
0
Chunk::~Chunk(void)
{
	glDeleteBuffers(1,&m_vboID);
	saveToDisk();
	m_vertexes.clear();
	m_lightDirtyIndex.clear();

	if(m_northChunk != nullptr)
		m_northChunk->m_southChunk = nullptr;
	if(m_southChunk != nullptr)
		m_southChunk->m_northChunk = nullptr;
	if(m_westChunk != nullptr)
		m_westChunk->m_eastChunk = nullptr;
	if(m_eastChunk != nullptr)
		m_eastChunk->m_westChunk = nullptr;

	m_northChunk = nullptr;
	m_southChunk = nullptr;
	m_westChunk = nullptr;
	m_eastChunk = nullptr;

	delete[] m_block;
}
Пример #20
0
TestBrowserCookieJar::TestBrowserCookieJar(QObject* parent)
    : QNetworkCookieJar(parent)
    , m_storageEnabled(false)
{
    // We use a timer for the real disk write to avoid multiple IO
    // syscalls in sequence (when loading pages which set multiple cookies).
    m_timer.setInterval(10000);
    m_timer.setSingleShot(true);
    connect(&m_timer, SIGNAL(timeout()), this, SLOT(saveToDisk()));

#ifndef QT_NO_DESKTOPSERVICES
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    QString path = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
#else
    QString path = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);
#endif
#else
    QString path = QDir::homePath() + "/.QtTestBrowser";
#endif

    QDir().mkpath(path);
    m_file.setFileName(path + "/cookieJar");
}
Пример #21
0
//--------------------------------------------------------------
void testApp::buttonAction(int i)
{
    int butt = i;
    
    switch(butt)
    {
        case 0:
            d->set(770,242);
            if(ib->mode == 0 && ib->active)
                d->mode = ib->type; //rabbitfunction is populated based on ib->type
            else if(ib-> mode == 1)
                d->mode = 11; //display emulator 1
            else
                break;
            d->populateList();
            d->active=true;  
            break;
            
        case 1: 
            d->set(770,178);
            if(ib->mode == 0 || ib -> mode == 3)
                d->mode = 9; //change active element
            else
                d->mode = 10; //output resolution list

            d->populateList();
            d->active=true; 
            break;
        
        case 2:   
            d->set(770,440);
            if(ib->type==0 && ib->mode == 0 && ib->active)
            {
                d->mode = 4; //toggle
            } else if(ib->mode == 1)
            {
                d->mode = 13; //on source loss
            } else
                break;
            d->populateList();
            d->active=true;
            break;
            
        case 3:
        case 4:
        case 5:
        case 6:
            curSkin = butt-3;
            ib->mode=0;
            copyElementDataToInterface();
            break;
        
        case 7:
            ib->reset();
            ib->mode=1;
            
            for(int i = 0; i < numberOfElements; i++)
            {
                e[i]->selected = false;
            }
            break;
            
        case 8:
            saveToDisk(getSaveFileName());
            break;
            
        case 9:
            loadFromFile();
            break;
            
        case 10:
            saveToDevice(); //nooooooo!
            break;
            
        case 11:
            loadFromDevice();
            break;
            
        case 12:
            resetToDefault();
            break;
            
        //IP                   
        case 13: 
            ib->enterIPAddress();
            break;
        
        //enter OSC bar    
        case 14:
            if(ib->mode == 0 && ib->active)
            {
                ib->enterOscAddress();
                if(ib->oscAddress!="")
                {
                    ib->toggleOSC = true;
                    ib->stoggleOSC = d->onOffList[ib->toggleOSC];
                }
                else
                {
                    ib->toggleOSC = false;
                    ib->stoggleOSC = d->onOffList[ib->toggleOSC];
                }
                    
            
                
            }
            break;
        
        //display emulator two   
        case 15:
            
            if(ib->mode == 1)  
            {
                d->set(770,264);
                d->mode = 12; //display emulator 2
                d->populateList();
                d->active=true; 
            }
            break;
            
        case 16:
            d->set(770,330);
            if(ib->mode == 0 && ib->active)
                d->mode = 5; //toggle osc
            else if(ib->mode == 1)
                d->mode = 6; //output hdcp
            else
                break;
            d->populateList();
            d->active=true;  
            break; 
        case 17:
            if(ib->mode == 1)
            {
                d->set(770,350);
                d->mode = 7; //input 01 hdcp
                d->populateList();
                d->active=true;  
            }
            break; 
        case 18:
            if(ib->mode == 1)
            {
                d->set(770,370);
                d->mode = 8; //input 02 hdcp
                d->populateList();
                d->active=true;  
            }
            break;                
            
        default:
            break;
            
    }

}
Пример #22
0
void LGGAutoCorrect::save()
{
	saveToDisk(mAutoCorrects);
}